Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
{
"name": "@kiltprotocol/type-definitions",
"repository": "https://github.com/kiltprotocol/type-definitions",
"description": "polkadot js type definitions for kilt",
"description": "Type decorations for the KILT blockchain.",
"main": "./lib/index.js",
"files": [
"/lib"
],
"license": "BSD-4-Clause",
"scripts": {
"build": "tsc",
"generate-types": "ts-node scripts/generate-types.ts"
"build": "tsc"
},
"publishConfig": {
"access": "public"
},
"bugs": "https://github.com/KILTprotocol/type-definitions/issues",
"homepage": "https://github.com/KILTprotocol/type-definitions#readme",
"devDependencies": {
"@polkadot/types": "^5.3.1",
"ts-node": "^10.2.1",
"@polkadot/types": "^9.1.1",
"typescript": "^4.3.5"
},
"version": "0.1.23"
"version": "0.2.0"
}
33 changes: 0 additions & 33 deletions scripts/generate-types.ts

This file was deleted.

52 changes: 36 additions & 16 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import type { OverrideBundleDefinition } from "@polkadot/types/types";
import type { OverrideBundleDefinition } from "@polkadot/types/types"

import { types8 } from "./types_8";
import { types9 } from "./types_9";
import { types10 } from "./types_10";
import { types12 } from "./types_12";
import { types17 } from "./types_17";
import { types18 } from "./types_18";
import { types19 } from "./types_19";
import { types20 } from "./types_20";
import { types21 } from "./types_21";
import { types23 } from "./types_23";
import { types25 } from "./types_25";
import { types2700 } from "./types_2700";
import { types8 } from "./types_8"
import { types9 } from "./types_9"
import { types10 } from "./types_10"
import { types12 } from "./types_12"
import { types17 } from "./types_17"
import { types18 } from "./types_18"
import { types19 } from "./types_19"
import { types20 } from "./types_20"
import { types21 } from "./types_21"
import { types23 } from "./types_23"
import { types25 } from "./types_25"
import { types2700 } from "./types_2700"
import { types10720 } from "./types_10720"

import runtime from "./runtime"
import rpc from "./rpc"

// Export type definitions
export {
types8,
types9,
Expand All @@ -26,8 +31,17 @@ export {
types23,
types25,
types2700,
};
types10720,
types10720 as latest,
}

// Export runtime APIs definitions
export { runtime }

// Export custom RPC definitions
export { rpc }

// Export complete package
export const typeBundleForPolkadot: OverrideBundleDefinition = {
types: [
{
Expand Down Expand Up @@ -75,8 +89,14 @@ export const typeBundleForPolkadot: OverrideBundleDefinition = {
types: types25,
},
{
minmax: [2700, undefined],
minmax: [2700, 10710],
types: types2700,
},
{
minmax: [10720, undefined],
types: types10720,
},
],
};
runtime: runtime,
rpc: rpc
}
55 changes: 55 additions & 0 deletions src/rpc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import type {
DefinitionRpc, DefinitionRpcSub
} from "@polkadot/types/types"

const rpc: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>> = {
did: {
query: {
description: "Return the DID information linked to the provided DID identifier, if found.",
params: [
{
name: "did",
type: "AccountId32",
},
{
name: "at",
type: "Hash",
isOptional: true,
},
],
type: "Option<DidLinkedInfo>"
},
queryByWeb3Name: {
description: "Return the DID information linked to the provided web3name, if found.",
params: [
{
name: "name",
type: "String",
},
{
name: "at",
type: "Hash",
isOptional: true,
},
],
type: "Option<DidLinkedInfo>"
},
queryByAccount: {
description: "Return the DID information linked to the provided account, if found.",
params: [
{
name: "account",
type: "AccountId32",
},
{
name: "at",
type: "Hash",
isOptional: true,
},
],
type: "Option<DidLinkedInfo>"
}
}
}

export default rpc
45 changes: 45 additions & 0 deletions src/runtime.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import type {
DefinitionsCall,
} from "@polkadot/types/types"

const runtime: DefinitionsCall = {
DidApi: [
{
methods: {
query_did_by_w3n: {
description: "Return the information relative to the owner of the provided web3name, if any.",
params: [
{
name: "name",
type: "Text",
},
],
type: "Option<RawDidLinkedInfo<AccountId32, AccountId32, AccountId32, Balance, Key, BlockNumber>>"
},
query_did_by_account_id: {
description: "Return the information relative to the DID to which the provided account is linked, if any.",
params: [
{
name: "account",
type: "AccountId32"
}
],
type: "Option<RawDidLinkedInfo<AccountId32, AccountId32, AccountId32, Balance, Key, BlockNumber>>"
},
query_did: {
description: "Return the information relative to the owner of the provided DID, if present.",
params: [
{
name: "did",
type: "AccountId32"
}
],
type: "Option<RawDidLinkedInfo<AccountId32, AccountId32, AccountId32, Balance, Key, BlockNumber>>"
}
},
version: 1
}
]
}

export default runtime
4 changes: 2 additions & 2 deletions src/types_10.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { RegistryTypes } from "@polkadot/types/types";
import type { RegistryTypes } from "@polkadot/types/types"

export const types10: RegistryTypes = {
// Runtime
Expand Down Expand Up @@ -234,4 +234,4 @@ export const types10: RegistryTypes = {
Leaving: "SessionIndex",
},
},
};
}
75 changes: 75 additions & 0 deletions src/types_10720.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import type {
RegistryTypes,
} from "@polkadot/types/types"

export const types10720: RegistryTypes = {
// DID state_call
RawDidLinkedInfo: {
identifier: "AccountId32",
accounts: "Vec<AccountId32>",
w3n: "Option<Text>",
serviceEndpoints: "Vec<RawServiceEndpoints>",
details: "RawDidDetails",
},
RawServiceEndpoints: {
id: "Text",
serviceTypes: "Vec<Text>",
urls: "Vec<Text>"
},
RawDidDetails: {
authenticationKey: "Hash",
keyAgreementKeys: "BTreeSet<Hash>",
delegationKey: "Option<Hash>",
attestationKey: "Option<Hash>",
publicKeys: "BTreeMap<Hash, DidDidDetailsDidPublicKeyDetails<BlockNumber>>",
lastTxCounter: "BlockNumber",
deposit: "KiltSupportDeposit<AccountId32, Balance>"
},

// DID RPC
DidLinkedInfo: {
identifier: "AccountId32",
accounts: "Vec<AccountId32>",
w3n: "Option<String>",
serviceEndpoints: "Vec<RpcServiceEndpoint>",
details: "RpcDidDetails"
},
RpcServiceEndpoint: {
id: "String",
serviceTypes: "Vec<String>",
urls: "Vec<String>"
},
RpcDidDetails: {
authenticationKey: "Hash",
keyAgreementKeys: "BTreeSet<Hash>",
delegationKey: "Option<Hash>",
attestationKey: "Option<Hash>",
publicKeys: "BTreeMap<Hash, RpcPublicKeyDetails>",
lastTxCounter: "BlockNumber",
deposit: "KiltSupportDeposit<AccountId32, Balance>"
},
RpcPublicKeyDetails: {
key: "RpcDidPublicKey",
blockNumber: "BlockNumber"
},
RpcDidPublicKey: {
_enum: {
PublicVerificationKey: "RpcDidVerificationKey",
PublicEncryptionKey: "RpcDidEncryptionKey",
},
},
// Base58-encoded public verification key
RpcDidVerificationKey: {
_enum: {
Ed25519: "AccountId32",
Sr25519: "AccountId32",
Ecdsa: "AccountId33",
},
},
// Base58-encoded public encryption key
RpcDidEncryptionKey: {
_enum: {
X25519: "AccountId32",
},
}
}
6 changes: 3 additions & 3 deletions src/types_12.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RegistryTypes } from "@polkadot/types/types";
import { types10 } from "./types_10";
import type { RegistryTypes } from "@polkadot/types/types"
import { types10 } from "./types_10"

export const types12: RegistryTypes = {
...types10,
Expand All @@ -23,4 +23,4 @@ export const types12: RegistryTypes = {
"Ecdsa-Secp256k1": "EcdsaSignature",
},
},
};
}
6 changes: 3 additions & 3 deletions src/types_17.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RegistryTypes } from "@polkadot/types/types";
import { types12 } from "./types_12";
import type { RegistryTypes } from "@polkadot/types/types"
import { types12 } from "./types_12"

export const types17: RegistryTypes = {
...types12,
Expand All @@ -21,4 +21,4 @@ export const types17: RegistryTypes = {
DelegationStorageVersion: {
_enum: ["V1", "V2"],
},
};
}
6 changes: 3 additions & 3 deletions src/types_18.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RegistryTypes } from "@polkadot/types/types";
import { types17 } from "./types_17";
import type { RegistryTypes } from "@polkadot/types/types"
import { types17 } from "./types_17"

export const types18: RegistryTypes = {
...types17,
Expand All @@ -24,4 +24,4 @@ export const types18: RegistryTypes = {
publicKeysToRemove: "BTreeSet<KeyIdOf>",
newEndpointUrl: "Option<Url>",
},
};
}
6 changes: 3 additions & 3 deletions src/types_19.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RegistryTypes } from "@polkadot/types/types";
import { types18 } from "./types_18";
import type { RegistryTypes } from "@polkadot/types/types"
import { types18 } from "./types_18"

export const types19: RegistryTypes = {
...types18,
Expand Down Expand Up @@ -59,4 +59,4 @@ export const types19: RegistryTypes = {
DidStorageVersion: {
_enum: ["V1", "V2"],
},
};
}
6 changes: 3 additions & 3 deletions src/types_20.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RegistryTypes } from "@polkadot/types/types";
import { types19 } from "./types_19";
import type { RegistryTypes } from "@polkadot/types/types"
import { types19 } from "./types_19"

export const types20: RegistryTypes = {
...types19,
Expand Down Expand Up @@ -105,4 +105,4 @@ export const types20: RegistryTypes = {
MaxOldAttestationKeysExceeded: "Null",
},
},
};
}
Loading