From c880f1f0e9994e6f61f6c0c1bb4fb356eb0eb0b8 Mon Sep 17 00:00:00 2001 From: Raphael Flechtner Date: Thu, 16 Jan 2025 17:27:27 +0100 Subject: [PATCH] refactor: use type-definitions from new repo --- packages/augment-api/package.json | 2 +- packages/core/package.json | 2 +- packages/type-definitions/package.json | 36 --- packages/type-definitions/src/index.ts | 199 -------------- packages/type-definitions/src/mergeType.ts | 28 -- packages/type-definitions/src/runtime/did.ts | 113 -------- .../src/runtime/dipProvider.ts | 29 --- .../src/runtime/publicCredentials.ts | 46 ---- .../type-definitions/src/runtime/staking.ts | 35 --- packages/type-definitions/src/types_10.ts | 245 ------------------ packages/type-definitions/src/types_10410.ts | 21 -- packages/type-definitions/src/types_10720.ts | 24 -- packages/type-definitions/src/types_10800.ts | 33 --- packages/type-definitions/src/types_10900.ts | 16 -- packages/type-definitions/src/types_11200.ts | 87 ------- packages/type-definitions/src/types_12.ts | 33 --- packages/type-definitions/src/types_17.ts | 31 --- packages/type-definitions/src/types_18.ts | 38 --- packages/type-definitions/src/types_19.ts | 73 ------ packages/type-definitions/src/types_20.ts | 122 --------- packages/type-definitions/src/types_21.ts | 74 ------ packages/type-definitions/src/types_23.ts | 48 ---- packages/type-definitions/src/types_25.ts | 22 -- packages/type-definitions/src/types_2700.ts | 129 --------- packages/type-definitions/src/types_8.ts | 88 ------- packages/type-definitions/src/types_9.ts | 186 ------------- packages/type-definitions/tsconfig.build.json | 17 -- packages/type-definitions/tsconfig.esm.json | 7 - tsconfig.json | 1 - yarn.lock | 20 +- 30 files changed, 12 insertions(+), 1793 deletions(-) delete mode 100644 packages/type-definitions/package.json delete mode 100644 packages/type-definitions/src/index.ts delete mode 100644 packages/type-definitions/src/mergeType.ts delete mode 100644 packages/type-definitions/src/runtime/did.ts delete mode 100644 packages/type-definitions/src/runtime/dipProvider.ts delete mode 100644 packages/type-definitions/src/runtime/publicCredentials.ts delete mode 100644 packages/type-definitions/src/runtime/staking.ts delete mode 100644 packages/type-definitions/src/types_10.ts delete mode 100644 packages/type-definitions/src/types_10410.ts delete mode 100644 packages/type-definitions/src/types_10720.ts delete mode 100644 packages/type-definitions/src/types_10800.ts delete mode 100644 packages/type-definitions/src/types_10900.ts delete mode 100644 packages/type-definitions/src/types_11200.ts delete mode 100644 packages/type-definitions/src/types_12.ts delete mode 100644 packages/type-definitions/src/types_17.ts delete mode 100644 packages/type-definitions/src/types_18.ts delete mode 100644 packages/type-definitions/src/types_19.ts delete mode 100644 packages/type-definitions/src/types_20.ts delete mode 100644 packages/type-definitions/src/types_21.ts delete mode 100644 packages/type-definitions/src/types_23.ts delete mode 100644 packages/type-definitions/src/types_25.ts delete mode 100644 packages/type-definitions/src/types_2700.ts delete mode 100644 packages/type-definitions/src/types_8.ts delete mode 100644 packages/type-definitions/src/types_9.ts delete mode 100644 packages/type-definitions/tsconfig.build.json delete mode 100644 packages/type-definitions/tsconfig.esm.json diff --git a/packages/augment-api/package.json b/packages/augment-api/package.json index 209125052..7b99649fd 100644 --- a/packages/augment-api/package.json +++ b/packages/augment-api/package.json @@ -49,6 +49,6 @@ "yargs": "^16.2.0" }, "dependencies": { - "@kiltprotocol/type-definitions": "workspace:*" + "@kiltprotocol/type-definitions": "^1.0.0" } } diff --git a/packages/core/package.json b/packages/core/package.json index 1f878038e..1598f71e8 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -41,7 +41,7 @@ "@kiltprotocol/chain-helpers": "workspace:*", "@kiltprotocol/config": "workspace:*", "@kiltprotocol/did": "workspace:*", - "@kiltprotocol/type-definitions": "workspace:*", + "@kiltprotocol/type-definitions": "^1.0.0", "@kiltprotocol/types": "workspace:*", "@kiltprotocol/utils": "workspace:*", "@polkadot/api": "^10.7.3", diff --git a/packages/type-definitions/package.json b/packages/type-definitions/package.json deleted file mode 100644 index 9a2b48aaf..000000000 --- a/packages/type-definitions/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "@kiltprotocol/type-definitions", - "version": "0.35.2", - "description": "", - "main": "./lib/cjs/index.js", - "module": "./lib/esm/index.js", - "types": "./lib/cjs/index.d.ts", - "exports": { - ".": { - "import": "./lib/esm/index.js", - "require": "./lib/cjs/index.js" - } - }, - "files": [ - "lib/**/*" - ], - "scripts": { - "clean": "rimraf ./lib", - "build": "yarn clean && yarn build:ts", - "build:ts": "yarn build:cjs && yarn build:esm", - "build:cjs": "tsc --declaration -p tsconfig.build.json && echo '{\"type\":\"commonjs\"}' > ./lib/cjs/package.json", - "build:esm": "tsc --declaration -p tsconfig.esm.json && echo '{\"type\":\"module\"}' > ./lib/esm/package.json" - }, - "repository": "github:kiltprotocol/sdk-js", - "engines": { - "node": ">=16.0" - }, - "author": "", - "license": "BSD-4-Clause", - "bugs": "https://github.com/KILTprotocol/sdk-js/issues", - "homepage": "https://github.com/KILTprotocol/sdk-js#readme", - "devDependencies": { - "rimraf": "^3.0.2", - "typescript": "^4.8.3" - } -} diff --git a/packages/type-definitions/src/index.ts b/packages/type-definitions/src/index.ts deleted file mode 100644 index 8f9fcd605..000000000 --- a/packages/type-definitions/src/index.ts +++ /dev/null @@ -1,199 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { - OverrideBundleType, - OverrideVersionedType, -} from '@polkadot/types/types' - -import { types8 } from './types_8.js' -import { types9 } from './types_9.js' -import { types10 } from './types_10.js' -import { types12 } from './types_12.js' -import { types17 } from './types_17.js' -import { types18 } from './types_18.js' -import { types19 } from './types_19.js' -import { types20 } from './types_20.js' -import { types21 } from './types_21.js' -import { types23 } from './types_23.js' -import { types25 } from './types_25.js' -import { types2700 } from './types_2700.js' -import { types10410 } from './types_10410.js' -import { types10720 } from './types_10720.js' -import { types10800 } from './types_10800.js' -import { types10900 } from './types_10900.js' -import { types11200 } from './types_11200.js' - -// Custom runtime calls - -import { calls as didCalls } from './runtime/did.js' -import { calls as stakingCalls } from './runtime/staking.js' -import { calls as publicCredentialsCalls } from './runtime/publicCredentials.js' -import { calls as dipProviderCalls } from './runtime/dipProvider.js' - -export { - types8, - types9, - types10, - types12, - types17, - types18, - types19, - types20, - types21, - types23, - types25, - types2700, - types10410, - types10720, - types10800, - types10900, - types11200, - types11200 as types, -} - -export { calls as didCalls } from './runtime/did.js' -export { calls as stakingCalls } from './runtime/staking.js' -export { calls as publicCredentialsCalls } from './runtime/publicCredentials.js' -export { calls as dipProviderCalls } from './runtime/dipProvider.js' - -const defaultTypesBundle: OverrideVersionedType[] = [ - { - minmax: [0, 8], - types: types8, - }, - { - minmax: [9, 9], - types: types9, - }, - { - minmax: [10, 11], - types: types10, - }, - { - minmax: [12, 16], - types: types12, - }, - { - minmax: [17, 17], - types: types17, - }, - { - minmax: [18, 18], - types: types18, - }, - { - minmax: [19, 19], - types: types19, - }, - { - minmax: [20, 20], - types: types20, - }, - { - minmax: [21, 22], - types: types21, - }, - { - minmax: [23, 24], - types: types23, - }, - { - minmax: [25, 2699], - types: types25, - }, - { - minmax: [2700, 10409], - types: types2700, - }, - { - minmax: [10410, 10719], - types: types10410, - }, - { - minmax: [10720, 10750], - types: types10720, - }, - { - minmax: [10800, 10899], - types: types10800, - }, - { - minmax: [10900, 11199], - types: types10900, - }, - { - minmax: [11200, undefined], - types: types11200, - }, -] - -// Current runtime version: 10730 -export const typesBundle: OverrideBundleType = { - chain: { - 'KILT Spiritnet': { - runtime: { - ...didCalls, - ...stakingCalls, - ...publicCredentialsCalls, - ...dipProviderCalls, - }, - types: defaultTypesBundle, - }, - 'KILT Spiritnet Develop': { - runtime: { - ...didCalls, - ...stakingCalls, - ...publicCredentialsCalls, - ...dipProviderCalls, - }, - types: defaultTypesBundle, - }, - 'KILT Peregrine': { - runtime: { - ...didCalls, - ...stakingCalls, - ...publicCredentialsCalls, - ...dipProviderCalls, - }, - types: defaultTypesBundle, - }, - 'KILT Peregrine Stagenet': { - runtime: { - ...didCalls, - ...stakingCalls, - ...publicCredentialsCalls, - ...dipProviderCalls, - }, - types: defaultTypesBundle, - }, - 'KILT Peregrine Develop': { - runtime: { - ...didCalls, - ...stakingCalls, - ...publicCredentialsCalls, - ...dipProviderCalls, - }, - types: defaultTypesBundle, - }, - 'KILT Mashnet': { - runtime: { - ...didCalls, - ...publicCredentialsCalls, - }, - types: defaultTypesBundle, - }, - Development: { - runtime: { - ...didCalls, - ...publicCredentialsCalls, - ...dipProviderCalls, - }, - types: defaultTypesBundle, - }, - }, -} diff --git a/packages/type-definitions/src/mergeType.ts b/packages/type-definitions/src/mergeType.ts deleted file mode 100644 index 1c366667f..000000000 --- a/packages/type-definitions/src/mergeType.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' - -/** - * Removes parts of the type definition without altering the original object. - * - * @param oldTypes The old types that should be updated. - * @param newTypes The new types that will be merged with the old types. Types with the same key will be overwritten by the new types. - * @param deleteKeys Keys that will get removed from the new and old types. - * @returns The adjusted types. - */ -export function mergeType( - oldTypes: RegistryTypes, - newTypes: RegistryTypes, - deleteKeys: string[] -): RegistryTypes { - const adjustedTypes = { ...oldTypes, ...newTypes } - deleteKeys.forEach((key) => { - delete adjustedTypes[key] - }) - return adjustedTypes -} diff --git a/packages/type-definitions/src/runtime/did.ts b/packages/type-definitions/src/runtime/did.ts deleted file mode 100644 index b5ec62df2..000000000 --- a/packages/type-definitions/src/runtime/did.ts +++ /dev/null @@ -1,113 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { DefinitionsCall, DefinitionCall } from '@polkadot/types/types' - -const oldDidApiCalls: Record = { - 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', - }, - 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: 'DidApiAccountId', - }, - ], - type: 'Option', - }, - query_did: { - description: - 'Return the information relative to the owner of the provided DID, if present.', - params: [ - { - name: 'did', - type: 'AccountId32', - }, - ], - type: 'Option', - }, -} - -const newDidApiCalls: Record = { - query_by_web3_name: { - description: - 'Return the information relative to the owner of the provided web3name, if any.', - params: [ - { - name: 'name', - type: 'Text', - }, - ], - type: 'Option', - }, - query_by_account: { - description: - 'Return the information relative to the DID to which the provided account is linked, if any.', - params: [ - { - name: 'account', - type: 'DidApiAccountId', - }, - ], - type: 'Option', - }, - query: { - description: - 'Return the information relative to the owner of the provided DID, if present.', - params: [ - { - name: 'did', - type: 'AccountId32', - }, - ], - type: 'Option', - }, -} - -export const calls: DefinitionsCall = { - DidApi: [ - { - methods: { - ...oldDidApiCalls, - }, - version: 1, - }, - // Same calls, since the type of AccountId is overwritten in the type definitions - { - methods: { - ...oldDidApiCalls, - }, - version: 2, - }, - ], - Did: [ - { - methods: { - ...newDidApiCalls, - }, - version: 1, - }, - // Same calls, since the type of AccountId is overwritten in the type definitions - { - methods: { - ...newDidApiCalls, - }, - version: 2, - }, - ], -} diff --git a/packages/type-definitions/src/runtime/dipProvider.ts b/packages/type-definitions/src/runtime/dipProvider.ts deleted file mode 100644 index b5cb5afc2..000000000 --- a/packages/type-definitions/src/runtime/dipProvider.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { DefinitionsCall } from '@polkadot/types/types' - -export const calls: DefinitionsCall = { - DipProvider: [ - { - methods: { - generate_proof: { - description: - 'Generate a Merkle proof for the DIP protocol for the specified request parameters.', - params: [ - { - name: 'request', - type: 'DipProofRequest', - }, - ], - type: 'Result', - }, - }, - version: 1, - }, - ], -} diff --git a/packages/type-definitions/src/runtime/publicCredentials.ts b/packages/type-definitions/src/runtime/publicCredentials.ts deleted file mode 100644 index 84ca464fa..000000000 --- a/packages/type-definitions/src/runtime/publicCredentials.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { DefinitionsCall } from '@polkadot/types/types' - -export const calls: DefinitionsCall = { - PublicCredentials: [ - { - methods: { - get_by_id: { - description: - 'Return the public credential with the specified ID, if found.', - params: [ - { - name: 'credential_id', - type: 'Hash', - }, - ], - type: 'Option', - }, - get_by_subject: { - description: `Return all the public credentials linked to the specified subject. - An optional filter can be passed to be applied to the result before being returned to the client. - It returns an error if the provided specified subject ID is not valid. - `, - params: [ - { - name: 'subject', - type: 'Text', - }, - { - name: 'filter', - type: 'Option', - }, - ], - type: 'Result, PublicCredentialError>', - }, - }, - version: 1, - }, - ], -} diff --git a/packages/type-definitions/src/runtime/staking.ts b/packages/type-definitions/src/runtime/staking.ts deleted file mode 100644 index 9d08c6306..000000000 --- a/packages/type-definitions/src/runtime/staking.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { DefinitionsCall } from '@polkadot/types/types' - -export const calls: DefinitionsCall = { - Staking: [ - { - methods: { - get_staking_rates: { - description: - 'Calculate the current staking and reward rates for collators and delegators', - params: [], - type: 'StakingRates', - }, - get_unclaimed_staking_rewards: { - description: - 'Calculate the claimable staking rewards for a given account address', - params: [ - { - name: 'account', - type: 'AccountId32', - }, - ], - type: 'Balance', - }, - }, - version: 1, - }, - ], -} diff --git a/packages/type-definitions/src/types_10.ts b/packages/type-definitions/src/types_10.ts deleted file mode 100644 index c7cc2237d..000000000 --- a/packages/type-definitions/src/types_10.ts +++ /dev/null @@ -1,245 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' - -export const types10: RegistryTypes = { - // Runtime - DispatchError: 'DispatchErrorPre6First', - AccountInfo: 'AccountInfoWithTripleRefCount', - Address: 'MultiAddress', - AmountOf: 'i128', - Balance: 'u128', - BlockNumber: 'u64', - Index: 'u64', - LookupSource: 'MultiAddress', - - // Ctypes - CtypeCreatorOf: 'AccountId', - CtypeHashOf: 'Hash', - ClaimHashOf: 'Hash', - - // Attestations - AttesterOf: 'AccountId', - AttestationDetails: { - ctypeHash: 'CtypeHashOf', - attester: 'AttesterOf', - delegationId: 'Option', - revoked: 'bool', - }, - - // Delegations - Permissions: 'u32', - DelegationNodeIdOf: 'Hash', - DelegatorIdOf: 'AccountId', - DelegateSignatureTypeOf: 'Vec', - DelegationRoot: { - ctypeHash: 'CtypeHashOf', - owner: 'DelegatorIdOf', - revoked: 'bool', - }, - DelegationNode: { - rootId: 'DelegationNodeIdOf', - parent: 'Option', - owner: 'DelegatorIdOf', - permissions: 'Permissions', - revoked: 'bool', - }, - - // DIDs - KeyIdOf: 'Hash', - DidIdentifierOf: 'AccountId', - AccountIdentifierOf: 'AccountId', - BlockNumberOf: 'BlockNumber', - DidCallableOf: 'Call', - DidVerificationKey: { - _enum: { - Ed25519: '[u8; 32]', - Sr25519: '[u8; 32]', - }, - }, - DidEncryptionKey: { - _enum: { - X25519: '[u8; 32]', - }, - }, - DidPublicKey: { - _enum: { - PublicVerificationKey: 'DidVerificationKey', - PublicEncryptionKey: 'DidEncryptionKey', - }, - }, - DidVerificationKeyRelationship: { - _enum: [ - 'Authentication', - 'CapabilityDelegation', - 'CapabilityInvocation', - 'AssertionMethod', - ], - }, - DidSignature: { - _enum: { - Ed25519: 'Ed25519Signature', - Sr25519: 'Sr25519Signature', - }, - }, - DidError: { - _enum: { - StorageError: 'StorageError', - SignatureError: 'SignatureError', - UrlError: 'UrlError', - InputError: 'InputError', - InternalError: 'Null', - }, - }, - StorageError: { - _enum: { - DidAlreadyPresent: 'Null', - DidNotPresent: 'Null', - DidKeyNotPresent: 'DidVerificationKeyRelationship', - VerificationKeyNotPresent: 'Null', - CurrentlyActiveKey: 'Null', - MaxTxCounterValue: 'Null', - }, - }, - SignatureError: { - _enum: ['InvalidSignatureFormat', 'InvalidSignature', 'InvalidNonce'], - }, - KeyError: { - _enum: ['InvalidVerificationKeyFormat', 'InvalidEncryptionKeyFormat'], - }, - UrlError: { - _enum: ['InvalidUrlEncoding', 'InvalidUrlScheme'], - }, - InputError: { - _enum: [ - 'MaxKeyAgreementKeysLimitExceeded', - 'MaxVerificationKeysToRemoveLimitExceeded', - 'MaxUrlLengthExceeded', - ], - }, - DidPublicKeyDetails: { - key: 'DidPublicKey', - blockNumber: 'BlockNumberOf', - }, - DidDetails: { - authenticationKey: 'KeyIdOf', - keyAgreementKeys: 'BTreeSet', - delegationKey: 'Option', - attestationKey: 'Option', - publicKeys: 'BTreeMap', - endpointUrl: 'Option', - lastTxCounter: 'u64', - }, - DidCreationOperation: { - did: 'DidIdentifierOf', - newAuthenticationKey: 'DidVerificationKey', - newKeyAgreementKeys: 'BTreeSet', - newAttestationKey: 'Option', - newDelegationKey: 'Option', - newEndpointUrl: 'Option', - }, - DidUpdateOperation: { - did: 'DidIdentifierOf', - newAuthenticationKey: 'Option', - newKeyAgreementKeys: 'BTreeSet', - attestationKeyUpdate: 'DidVerificationKeyUpdateAction', - delegationKeyUpdate: 'DidVerificationKeyUpdateAction', - publicKeysToRemove: 'BTreeSet', - newEndpointUrl: 'Option', - txCounter: 'u64', - }, - DidVerificationKeyUpdateAction: { - _enum: { - Ignore: 'Null', - Change: 'DidVerificationKey', - Delete: 'Null', - }, - }, - DidDeletionOperation: { - did: 'DidIdentifierOf', - txCounter: 'u64', - }, - DidAuthorizedCallOperation: { - did: 'DidIdentifierOf', - txCounter: 'u64', - call: 'DidCallableOf', - }, - HttpUrl: { - payload: 'Text', - }, - FtpUrl: { - payload: 'Text', - }, - IpfsUrl: { - payload: 'Text', - }, - Url: { - _enum: { - Http: 'HttpUrl', - Ftp: 'FtpUrl', - Ipfs: 'IpfsUrl', - }, - }, - - // LaunchPallet - LockedBalance: { - block: 'BlockNumber', - amount: 'Balance', - }, - - // Staking - BalanceOf: 'Balance', - RoundInfo: { - current: 'SessionIndex', - first: 'BlockNumber', - length: 'BlockNumber', - }, - OrderedSet: 'Vec', - Stake: { - owner: 'AccountId', - amount: 'Balance', - }, - TotalStake: { - collators: 'Balance', - delegators: 'Balance', - }, - InflationInfo: { - collator: 'StakingInfo', - delegator: 'StakingInfo', - }, - StakingInfo: { - maxRate: 'Perquintill', - rewardRate: 'RewardRate', - }, - RewardRate: { - annual: 'Perquintill', - perBlock: 'Perquintill', - }, - Delegator: { - delegations: 'Vec', - total: 'Balance', - }, - CollatorSnapshot: { - stake: 'Balance', - delegators: 'Vec', - total: 'Balance', - }, - Collator: { - id: 'AccountId', - stake: 'Balance', - delegators: 'Vec', - total: 'Balance', - state: 'CollatorStatus', - }, - CollatorStatus: { - _enum: { - Active: 'Null', - Leaving: 'SessionIndex', - }, - }, -} diff --git a/packages/type-definitions/src/types_10410.ts b/packages/type-definitions/src/types_10410.ts deleted file mode 100644 index b4a8a457f..000000000 --- a/packages/type-definitions/src/types_10410.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' -import { mergeType } from './mergeType.js' -import { types2700 } from './types_2700.js' - -export const types10410: RegistryTypes = mergeType( - // Use the old types as the base of the new types. - types2700, - - // We add these new type: - {}, - - // Remove old DID types: - ['DispatchError'] -) diff --git a/packages/type-definitions/src/types_10720.ts b/packages/type-definitions/src/types_10720.ts deleted file mode 100644 index 3c6091cc4..000000000 --- a/packages/type-definitions/src/types_10720.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' - -// Starting with this version we no longer need to define our custom types manually. They are contained in the runtime metadata. -// We therefore do not add the types of runtime version 2700 to the type definition here. -export const types10720: RegistryTypes = { - // we need to keep the custom dispatch error since it was changed at some point - - // DID state_call - DidApiAccountId: 'AccountId32', - RawDidLinkedInfo: { - identifier: 'AccountId32', - accounts: 'Vec', - w3n: 'Option', - serviceEndpoints: 'Vec', - details: 'DidDidDetails', - }, -} diff --git a/packages/type-definitions/src/types_10800.ts b/packages/type-definitions/src/types_10800.ts deleted file mode 100644 index b22ecff75..000000000 --- a/packages/type-definitions/src/types_10800.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' - -import { types10720 } from './types_10720.js' - -export const types10800: RegistryTypes = { - ...types10720, - - // Public credentials state_call - PublicCredentialFilter: { - _enum: { - ctypeHash: 'Hash', - attester: 'AccountId32', - }, - }, - PublicCredentialError: { - _enum: ['InvalidSubjectId'], - }, - - // Staking get_staking_rates - StakingRates: { - collatorStakingRate: 'Perquintill', - collatorRewardRate: 'Perquintill', - delegatorStakingRate: 'Perquintill', - delegatorRewardRate: 'Perquintill', - }, -} diff --git a/packages/type-definitions/src/types_10900.ts b/packages/type-definitions/src/types_10900.ts deleted file mode 100644 index f5900c64a..000000000 --- a/packages/type-definitions/src/types_10900.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' - -import { types10800 } from './types_10800.js' - -export const types10900: RegistryTypes = { - ...types10800, - // DID state_call v2 - DidApiAccountId: 'PalletDidLookupLinkableAccountLinkableAccountId', -} diff --git a/packages/type-definitions/src/types_11200.ts b/packages/type-definitions/src/types_11200.ts deleted file mode 100644 index 2d332fc9d..000000000 --- a/packages/type-definitions/src/types_11200.ts +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' - -import { types10900 } from './types_10900.js' - -export const types11200: RegistryTypes = { - ...types10900, - IdentityCommitmentVersion: 'u16', - // DipProvider state_call - DipProofRequest: { - identifier: 'AccountId32', - version: 'IdentityCommitmentVersion', - proofKeys: 'Vec', - accounts: 'Vec', - shouldIncludeWeb3Name: 'bool', - }, - CompleteMerkleProof: { - root: 'MerkleRoot', - proof: 'MerkleProof', - }, - MerkleRoot: 'Hash', - MerkleProof: { - blinded: 'BlindedLeaves', - revealed: 'RevealedLeaves', - }, - BlindedLeaves: 'Vec', - BlindedValue: 'Bytes', - RevealedLeaves: 'Vec', - RevealedLeaf: { - _enum: { - DidKey: 'RevealedDidKey', - Web3Name: 'RevealedWeb3Name', - LinkedAccount: 'RevealedAccountId', - }, - }, - RevealedDidKey: { - id: 'Hash', - relationship: 'KeyRelationship', - details: 'DidDidDetailsDidPublicKeyDetails', - }, - KeyRelationship: { - _enum: { - Encryption: 'Null', - Verification: 'VerificationRelationship', - }, - }, - VerificationRelationship: { - _enum: [ - 'Authentication', - 'CapabilityDelegation', - 'CapabilityInvocation', - 'AssertionMethod', - ], - }, - RevealedWeb3Name: { - web3Name: 'Text', - claimedAt: 'BlockNumber', - }, - RevealedAccountId: 'PalletDidLookupLinkableAccountLinkableAccountId', - RuntimeApiDipProofError: { - _enum: { - IdentityProvider: 'LinkedDidIdentityProviderError', - MerkleProof: 'DidMerkleProofError', - }, - }, - LinkedDidIdentityProviderError: { - _enum: ['DidNotFound', 'DidDeleted', 'Internal'], - }, - DidIdentityProviderError: { - _enum: ['DidNotFound', 'Internal'], - }, - DidMerkleProofError: { - _enum: [ - 'UnsupportedVersion', - 'KeyNotFound', - 'LinkedAccountNotFound', - 'Web3NameNotFound', - 'Internal', - ], - }, -} diff --git a/packages/type-definitions/src/types_12.ts b/packages/type-definitions/src/types_12.ts deleted file mode 100644 index 61b520f01..000000000 --- a/packages/type-definitions/src/types_12.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' -import { types10 } from './types_10.js' - -export const types12: RegistryTypes = { - ...types10, - // Staking updated types - DelegationCounter: { - round: 'SessionIndex', - counter: 'u32', - }, - // DID updated types - DidVerificationKey: { - _enum: { - Ed25519: '[u8; 32]', - Sr25519: '[u8; 32]', - Secp256k1: '[u8; 33]', - }, - }, - DidSignature: { - _enum: { - Ed25519: 'Ed25519Signature', - Sr25519: 'Sr25519Signature', - 'Ecdsa-Secp256k1': 'EcdsaSignature', - }, - }, -} diff --git a/packages/type-definitions/src/types_17.ts b/packages/type-definitions/src/types_17.ts deleted file mode 100644 index 39cd09fd2..000000000 --- a/packages/type-definitions/src/types_17.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' -import { types12 } from './types_12.js' - -export const types17: RegistryTypes = { - ...types12, - // Delegation updated types - DelegationNode: { - hierarchyRootId: 'DelegationNodeIdOf', - parent: 'Option', - children: 'BTreeSet', - details: 'DelegationDetails', - }, - DelegationDetails: { - owner: 'DelegatorIdOf', - revoked: 'bool', - permissions: 'Permissions', - }, - DelegationHierarchyDetails: { - ctypeHash: 'CtypeHashOf', - }, - DelegationStorageVersion: { - _enum: ['V1', 'V2'], - }, -} diff --git a/packages/type-definitions/src/types_18.ts b/packages/type-definitions/src/types_18.ts deleted file mode 100644 index b0033ab63..000000000 --- a/packages/type-definitions/src/types_18.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' -import { mergeType } from './mergeType.js' -import { types17 } from './types_17.js' - -export const types18: RegistryTypes = mergeType( - // Use the old types as the base of the new types. - types17, - - // We add these new type: - { - // DID management update - DidCreationDetails: { - did: 'DidIdentifierOf', - newKeyAgreementKeys: 'BTreeSet', - newAttestationKey: 'Option', - newDelegationKey: 'Option', - newEndpointUrl: 'Option', - }, - DidUpdateDetails: { - newAuthenticationKey: 'Option', - newKeyAgreementKeys: 'BTreeSet', - attestationKeyUpdate: 'DidVerificationKeyUpdateAction', - delegationKeyUpdate: 'DidVerificationKeyUpdateAction', - publicKeysToRemove: 'BTreeSet', - newEndpointUrl: 'Option', - }, - }, - - // Remove old DID types - ['DidCreationOperation', 'DidUpdateOperation', 'DidDeletionOperation'] -) diff --git a/packages/type-definitions/src/types_19.ts b/packages/type-definitions/src/types_19.ts deleted file mode 100644 index f12f8e519..000000000 --- a/packages/type-definitions/src/types_19.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' -import { mergeType } from './mergeType.js' -import { types18 } from './types_18.js' - -export const types19: RegistryTypes = mergeType( - // Use the old types as the base of the new types. - types18, - - // We add these new type: - { - ServiceEndpoints: { - contentHash: 'Hash', - urls: 'Vec', - contentType: 'ContentType', - }, - DidFragmentUpdateAction_ServiceEndpoints: { - _enum: { - Ignore: 'Null', - Change: 'ServiceEndpoints', - Delete: 'Null', - }, - }, - DidFragmentUpdateAction_DidVerificationKey: { - _enum: { - Ignore: 'Null', - Change: 'DidVerificationKey', - Delete: 'Null', - }, - }, - ContentType: { - _enum: ['ApplicationJson', 'ApplicationJsonLd'], - }, - - // Updated types - DidCreationDetails: { - did: 'DidIdentifierOf', - newKeyAgreementKeys: 'BTreeSet', - newAttestationKey: 'Option', - newDelegationKey: 'Option', - newServiceEndpoints: 'Option', - }, - DidUpdateDetails: { - newAuthenticationKey: 'Option', - newKeyAgreementKeys: 'BTreeSet', - attestationKeyUpdate: 'DidFragmentUpdateAction_DidVerificationKey', - delegationKeyUpdate: 'DidFragmentUpdateAction_DidVerificationKey', - publicKeysToRemove: 'BTreeSet', - serviceEndpointsUpdate: 'DidFragmentUpdateAction_ServiceEndpoints', - }, - DidDetails: { - authenticationKey: 'KeyIdOf', - keyAgreementKeys: 'BTreeSet', - delegationKey: 'Option', - attestationKey: 'Option', - publicKeys: 'BTreeMap', - serviceEndpoints: 'Option', - lastTxCounter: 'u64', - }, - DidStorageVersion: { - _enum: ['V1', 'V2'], - }, - }, - - // Remove old DID types: - ['DidVerificationKeyUpdateAction'] -) diff --git a/packages/type-definitions/src/types_20.ts b/packages/type-definitions/src/types_20.ts deleted file mode 100644 index ba98ad3be..000000000 --- a/packages/type-definitions/src/types_20.ts +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' -import { mergeType } from './mergeType.js' -import { types19 } from './types_19.js' - -export const types20: RegistryTypes = mergeType( - // Use the old types as the base of the new types. - types19, - - // We add these new type: - { - // Staking - OrderedSet: 'BoundedVec', - MaxCollatorCandidates: 'u32', - Collator: { - id: 'AccountId', - stake: 'Balance', - // new - delegators: 'OrderedSet', - total: 'Balance', - state: 'CollatorStatus', - }, - MaxDelegatorsPerCollator: 'u32', - Delegator: { - // new - delegations: 'OrderedSet', - total: 'Balance', - }, - MaxCollatorsPerDelegator: 'u32', - StakingStorageVersion: { - _enum: ['V1_0_0', 'V2_0_0', 'V3_0_0', 'V4'], - }, - - // Attestation - MaxDelegatedAttestations: 'u32', - - // KILT Launch - MaxClaims: 'u32', - - // Delegation - DelegationNode: { - hierarchyRootId: 'DelegationNodeIdOf', - parent: 'Option', - // new - children: 'BoundedBTreeSet', - details: 'DelegationDetails', - }, - MaxChildren: 'u32', - - // DIDs - DidNewKeyAgreementKeys: - 'BoundedBTreeSet', - DidKeyAgreementKeys: 'BoundedBTreeSet', - DidVerificationKeysToRevoke: - 'BoundedBTreeSet', - MaxNewKeyAgreementKeys: 'u32', - MaxTotalKeyAgreementKeys: 'u32', - MaxVerificationKeysToRevoke: 'u32', - MaxPublicKeysPerDid: 'u32', - DidPublicKeyMap: - 'BoundedBTreeMap', - DidCreationDetails: { - did: 'DidIdentifierOf', - newKeyAgreementKeys: 'DidNewKeyAgreementKeys', - newAttestationKey: 'Option', - newDelegationKey: 'Option', - newServiceEndpoints: 'Option', - }, - DidUpdateDetails: { - newAuthenticationKey: 'Option', - // new - newKeyAgreementKeys: 'DidNewKeyAgreementKeys', - attestationKeyUpdate: 'DidFragmentUpdateAction_DidVerificationKey', - delegationKeyUpdate: 'DidFragmentUpdateAction_DidVerificationKey', - // new - publicKeysToRemove: 'DidVerificationKeysToRevoke', - serviceEndpointsUpdate: 'DidFragmentUpdateAction_ServiceEndpoints', - }, - DidDetails: { - authenticationKey: 'KeyIdOf', - // new - keyAgreementKeys: 'DidKeyAgreementKeys', - delegationKey: 'Option', - attestationKey: 'Option', - // new - publicKeys: 'DidPublicKeyMap', - serviceEndpoints: 'Option', - lastTxCounter: 'u64', - }, - ServiceEndpoints: { - contentHash: 'Hash', - // new - urls: 'BoundedVec', - contentType: 'ContentType', - }, - MaxUrlLength: 'u32', - MaxEndpointUrlsCount: 'u32', - StorageError: { - _enum: { - DidAlreadyPresent: 'Null', - DidNotPresent: 'Null', - DidKeyNotPresent: 'DidVerificationKeyRelationship', - VerificationKeyNotPresent: 'Null', - CurrentlyActiveKey: 'Null', - MaxTxCounterValue: 'Null', - // new - MaxPublicKeysPerDidKeyIdentifierExceeded: 'Null', - MaxTotalKeyAgreementKeysExceeded: 'Null', - MaxOldAttestationKeysExceeded: 'Null', - }, - }, - }, - - // Remove old DID types: - ['CollatorSnapshot'] -) diff --git a/packages/type-definitions/src/types_21.ts b/packages/type-definitions/src/types_21.ts deleted file mode 100644 index f1f74b729..000000000 --- a/packages/type-definitions/src/types_21.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' -import { mergeType } from './mergeType.js' -import { types20 } from './types_20.js' - -export const types21: RegistryTypes = mergeType( - // Use the old types as the base of the new types. - types20, - - // We add these new type: - { - StorageError: { - _enum: { - DidAlreadyPresent: 'Null', - DidNotPresent: 'Null', - DidKeyNotPresent: 'DidVerificationKeyRelationship', - VerificationKeyNotPresent: 'Null', - CurrentlyActiveKey: 'Null', - MaxTxCounterValue: 'Null', - MaxPublicKeysPerDidKeyIdentifierExceeded: 'Null', - // renamed - MaxTotalKeyAgreementKeysExceeded: 'Null', - MaxOldAttestationKeysExceeded: 'Null', - }, - }, - DidCreationDetails: { - did: 'DidIdentifierOf', - newKeyAgreementKeys: 'DidNewKeyAgreementKeys', - newAssertionMethodKey: 'Option', - newCapabilityDelegationKey: 'Option', - newServiceEndpoints: 'Option', - }, - DidDetails: { - authenticationKey: 'KeyIdOf', - keyAgreementKeys: 'DidKeyAgreementKeys', - // renamed - capabilityDelegationKey: 'Option', - // renamed - assertionMethodKey: 'Option', - publicKeys: 'DidPublicKeyMap', - serviceEndpoints: 'Option', - lastTxCounter: 'u64', - }, - DelegateSignatureTypeOf: 'DidSignature', - ContentType: { - _enum: ['application/json', 'application/ld+json'], - }, - - // fix: generics mostly don't work here, but OrderedSet is reduced to a Vec anyway - Collator: { - id: 'AccountId', - stake: 'Balance', - // fix - delegators: 'Vec', - total: 'Balance', - state: 'CollatorStatus', - }, - Delegator: { - // fix - delegations: 'Vec', - total: 'Balance', - }, - Keys: 'SessionKeys1', - }, - - // Remove old DID types: - ['DidUpdateDetails', 'OrderedSet'] -) diff --git a/packages/type-definitions/src/types_23.ts b/packages/type-definitions/src/types_23.ts deleted file mode 100644 index ba4a74f91..000000000 --- a/packages/type-definitions/src/types_23.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' -import { mergeType } from './mergeType.js' -import { types21 } from './types_21.js' - -export const types23: RegistryTypes = mergeType( - // Use the old types as the base of the new types. - types21, - - // We add these new type: - { - MinCollators: 'u32', - MaxTopCandidates: 'u32', - - // Renamed collator to candidate since they are not always collators (most of them are candidates) - Candidate: { - id: 'AccountId', - stake: 'Balance', - delegators: 'Vec', - total: 'Balance', - // renamed from state to status to be consistent - status: 'CandidateStatus', - }, - CandidateStatus: { - _enum: { - Active: 'Null', - Leaving: 'SessionIndex', - }, - }, - StakingStorageVersion: { - _enum: ['V1_0_0', 'V2_0_0', 'V3_0_0', 'V4', 'V5'], - }, - }, - - // Remove old DID types: - [ - 'MaxCollatorCandidates', - 'MinSelectedCandidates', - 'Collator', - 'CollatorStatus', - ] -) diff --git a/packages/type-definitions/src/types_25.ts b/packages/type-definitions/src/types_25.ts deleted file mode 100644 index e50f1a069..000000000 --- a/packages/type-definitions/src/types_25.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' -import { types23 } from './types_23.js' - -export const types25: RegistryTypes = { - // Use the old types as the base of the new types. - ...types23, - - // We add these new type: - DidAuthorizedCallOperation: { - did: 'DidIdentifierOf', - txCounter: 'u64', - call: 'DidCallableOf', - submitter: 'AccountId', - }, -} diff --git a/packages/type-definitions/src/types_2700.ts b/packages/type-definitions/src/types_2700.ts deleted file mode 100644 index c0b25b116..000000000 --- a/packages/type-definitions/src/types_2700.ts +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' -import { mergeType } from './mergeType.js' -import { types25 } from './types_25.js' - -export const types2700: RegistryTypes = mergeType( - // Use the old types as the base of the new types. - types25, - - // We add these new type: - { - // Add deposit for attestations - Deposit: { - owner: 'AccountId', - amount: 'Balance', - }, - AttestationDetails: { - ctypeHash: 'CtypeHashOf', - attester: 'AttesterOf', - delegationId: 'Option', - revoked: 'bool', - // Added - deposit: 'Deposit', - }, - - DidAuthorizedCallOperation: { - did: 'DidIdentifierOf', - txCounter: 'u64', - call: 'DidCallableOf', - // Added - blockNumber: 'BlockNumber', - submitter: 'AccountId', - }, - - // Remove serviceEndpoints - DidDetails: { - authenticationKey: 'KeyIdOf', - keyAgreementKeys: 'DidKeyAgreementKeys', - capabilityDelegationKey: 'Option', - assertionMethodKey: 'Option', - publicKeys: 'DidPublicKeyMap', - lastTxCounter: 'u64', - // Added - deposit: 'Deposit', - }, - - // Remove newServiceEndpoints - DidCreationDetails: { - did: 'DidIdentifierOf', - // Added - submitter: 'AccountId', - newKeyAgreementKeys: 'DidNewKeyAgreementKeys', - newAssertionMethodKey: 'Option', - newCapabilityDelegationKey: 'Option', - }, - - // Remove UrlError - DidError: { - _enum: { - StorageError: 'StorageError', - SignatureError: 'SignatureError', - InputError: 'InputError', - InternalError: 'Null', - }, - }, - - // Remove MaxUrlLengthExceeded - InputError: { - _enum: [ - 'MaxKeyAgreementKeysLimitExceeded', - 'MaxVerificationKeysToRemoveLimitExceeded', - ], - }, - - StorageError: { - _enum: { - DidAlreadyPresent: 'Null', - DidNotPresent: 'Null', - DidKeyNotPresent: 'DidVerificationKeyRelationship', - KeyNotPresent: 'Null', - CurrentlyActiveKey: 'Null', - MaxPublicKeysPerDidExceeded: 'Null', - MaxTotalKeyAgreementKeysExceeded: 'Null', - DidAlreadyDeleted: 'Null', - }, - }, - SignatureError: { - _enum: [ - 'InvalidSignatureFormat', - 'InvalidSignature', - 'InvalidNonce', - 'TransactionExpired', - ], - }, - DelegationNode: { - hierarchyRootId: 'DelegationNodeIdOf', - parent: 'Option', - children: 'BoundedBTreeSet', - details: 'DelegationDetails', - // new - deposit: 'Deposit', - }, - - // Add V3 - DidStorageVersion: { - _enum: ['V1', 'V2', 'V3'], - }, - }, - - // Remove old DID types: - [ - 'ServiceEndpoints', - 'UrlError', - 'ContentType', - 'Url', - 'HttpUrl', - 'FtpUrl', - 'IpfsUrl', - 'MaxEndpointUrlsCount', - 'MaxUrlLength', - 'DelegationRoot', - ] -) diff --git a/packages/type-definitions/src/types_8.ts b/packages/type-definitions/src/types_8.ts deleted file mode 100644 index b7fb8c27a..000000000 --- a/packages/type-definitions/src/types_8.ts +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' - -export const types8: RegistryTypes = { - DispatchError: 'DispatchErrorPre6First', - AccountInfo: 'AccountInfoWithDualRefCount', - Address: 'AccountId', - Attestation: { - ctypeHash: 'Hash', - attester: 'AccountId', - delegationId: 'Option', - revoked: 'bool', - }, - Balance: 'u128', - DelegationNode: { - rootId: 'DelegationNodeId', - parent: 'Option', - owner: 'AccountId', - permissions: 'Permissions', - revoked: 'bool', - }, - DelegationNodeId: 'Hash', - DelegationRoot: { - ctypeHash: 'Hash', - owner: 'AccountId', - revoked: 'bool', - }, - DidRecord: { - signKey: 'Hash', - boxKey: 'Hash', - docRef: 'Option>', - }, - Index: 'u64', - LookupSource: 'AccountId', - Permissions: 'u32', - PublicBoxKey: 'Hash', - PublicSigningKey: 'Hash', - Signature: 'MultiSignature', - XCurrencyId: { - chainId: 'ChainId', - currencyId: 'Vec', - }, - ChainId: { - _enum: { - RelayChain: 'Null', - ParaChain: 'ParaId', - }, - }, - CurrencyIdOf: 'CurrencyId', - CurrencyId: { - _enum: { - DOT: 0, - KSM: 1, - KILT: 2, - }, - }, - XcmError: { - _enum: { - Undefined: 0, - Unimplemented: 1, - UnhandledXcmVersion: 2, - UnhandledXcmMessage: 3, - UnhandledEffect: 4, - EscalationOfPrivilege: 5, - UntrustedReserveLocation: 6, - UntrustedTeleportLocation: 7, - DestinationBufferOverflow: 8, - CannotReachDestination: 9, - MultiLocationFull: 10, - FailedToDecode: 11, - BadOrigin: 12, - ExceedsMaxMessageSize: 13, - FailedToTransactAsset: 14, - }, - }, - ReferendumInfo: { - _enum: { - Ongoing: 'ReferendumStatus', - Finished: 'ReferendumInfoFinished', - }, - }, -} diff --git a/packages/type-definitions/src/types_9.ts b/packages/type-definitions/src/types_9.ts deleted file mode 100644 index a44924f69..000000000 --- a/packages/type-definitions/src/types_9.ts +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Copyright (c) 2018-2023, BOTLabs GmbH. - * - * This source code is licensed under the BSD 4-Clause "Original" license - * found in the LICENSE file in the root directory of this source tree. - */ - -import type { RegistryTypes } from '@polkadot/types/types' - -export const types9: RegistryTypes = { - // Runtime types - DispatchError: 'DispatchErrorPre6First', - AccountInfo: 'AccountInfoWithTripleRefCount', - Address: 'MultiAddress', - AmountOf: 'i128', - Balance: 'u128', - BlockNumber: 'u64', - Index: 'u64', - LookupSource: 'MultiAddress', - - // Ctype types - CtypeCreatorOf: 'DidIdentifierOf', - CtypeHashOf: 'Hash', - - // Attestation types - ClaimHashOf: 'Hash', - AttesterOf: 'DidIdentifierOf', - AttestationDetails: { - ctypeHash: 'CtypeHashOf', - attester: 'AttesterOf', - delegationId: 'Option', - revoked: 'bool', - }, - - // Delegation types - Permissions: 'u32', - DelegationNodeIdOf: 'Hash', - DelegatorIdOf: 'DidIdentifierOf', - DelegationSignature: 'DidSignature', - DelegationRoot: { - ctypeHash: 'CtypeHashOf', - owner: 'DelegatorIdOf', - revoked: 'bool', - }, - DelegationNode: { - rootId: 'DelegationNodeIdOf', - parent: 'Option', - owner: 'DelegatorIdOf', - permissions: 'Permissions', - revoked: 'bool', - }, - - // Did types - KeyIdOf: 'Hash', - DidIdentifierOf: 'AccountId', - AccountIdentifierOf: 'AccountId', - BlockNumberOf: 'BlockNumber', - DidCallableOf: 'Call', - DidVerificationKey: { - _enum: { - Ed25519: '[u8; 32]', - Sr25519: '[u8; 32]', - }, - }, - DidEncryptionKey: { - _enum: { - X25519: '[u8; 32]', - }, - }, - DidPublicKey: { - _enum: { - PublicVerificationKey: 'DidVerificationKey', - PublicEncryptionKey: 'DidEncryptionKey', - }, - }, - DidVerificationKeyRelationship: { - _enum: [ - 'Authentication', - 'CapabilityDelegation', - 'CapabilityInvocation', - 'AssertionMethod', - ], - }, - DidSignature: { - _enum: { - Ed25519: 'Ed25519Signature', - Sr25519: 'Sr25519Signature', - }, - }, - DidError: { - _enum: { - StorageError: 'StorageError', - SignatureError: 'SignatureError', - UrlError: 'UrlError', - InternalError: 'Null', - }, - }, - StorageError: { - _enum: { - DidAlreadyPresent: 'Null', - DidNotPresent: 'Null', - DidKeyNotPresent: 'DidVerificationKeyRelationship', - VerificationKeyNotPresent: 'Null', - CurrentlyActiveKey: 'Null', - MaxTxCounterValue: 'Null', - }, - }, - SignatureError: { - _enum: ['InvalidSignatureFormat', 'InvalidSignature', 'InvalidNonce'], - }, - KeyError: { - _enum: ['InvalidVerificationKeyFormat', 'InvalidEncryptionKeyFormat'], - }, - UrlError: { - _enum: ['InvalidUrlEncoding', 'InvalidUrlScheme'], - }, - DidPublicKeyDetails: { - key: 'DidPublicKey', - blockNumber: 'BlockNumberOf', - }, - DidDetails: { - authenticationKey: 'KeyIdOf', - keyAgreementKeys: 'BTreeSet', - delegationKey: 'Option', - attestationKey: 'Option', - publicKeys: 'BTreeMap', - endpointUrl: 'Option', - lastTxCounter: 'u64', - }, - DidCreationOperation: { - did: 'DidIdentifierOf', - newAuthenticationKey: 'DidVerificationKey', - newKeyAgreementKeys: 'BTreeSet', - newAttestationKey: 'Option', - newDelegationKey: 'Option', - newEndpointUrl: 'Option', - }, - DidUpdateOperation: { - did: 'DidIdentifierOf', - newAuthenticationKey: 'Option', - newKeyAgreementKeys: 'BTreeSet', - attestationKeyUpdate: 'DidVerificationKeyUpdateAction', - delegationKeyUpdate: 'DidVerificationKeyUpdateAction', - publicKeysToRemove: 'BTreeSet', - newEndpointUrl: 'Option', - txCounter: 'u64', - }, - DidVerificationKeyUpdateAction: { - _enum: { - Ignore: 'Null', - Change: 'DidVerificationKey', - Delete: 'Null', - }, - }, - DidDeletionOperation: { - did: 'DidIdentifierOf', - txCounter: 'u64', - }, - DidAuthorizedCallOperation: { - did: 'DidIdentifierOf', - txCounter: 'u64', - call: 'DidCallableOf', - }, - HttpUrl: { - payload: 'Text', - }, - FtpUrl: { - payload: 'Text', - }, - IpfsUrl: { - payload: 'Text', - }, - Url: { - _enum: { - Http: 'HttpUrl', - Ftp: 'FtpUrl', - Ipfs: 'IpfsUrl', - }, - }, - - // Launch types - LockedBalance: { - block: 'BlockNumber', - amount: 'Balance', - }, -} diff --git a/packages/type-definitions/tsconfig.build.json b/packages/type-definitions/tsconfig.build.json deleted file mode 100644 index d59aa31ce..000000000 --- a/packages/type-definitions/tsconfig.build.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../tsconfig.build.json", - - "compilerOptions": { - "module": "CommonJS", - "outDir": "./lib/cjs" - }, - - "include": [ - "src/**/*.ts", "src/**/*.js" - ], - - "exclude": [ - "coverage", - "**/*.spec.ts", - ] -} diff --git a/packages/type-definitions/tsconfig.esm.json b/packages/type-definitions/tsconfig.esm.json deleted file mode 100644 index e1f3b73b6..000000000 --- a/packages/type-definitions/tsconfig.esm.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "compilerOptions": { - "module": "ES6", - "outDir": "./lib/esm" - } -} diff --git a/tsconfig.json b/tsconfig.json index a447ff164..0410e2629 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,7 +18,6 @@ "@kiltprotocol/docs": ["docs/src"], "@kiltprotocol/augment-api": ["augment-api/src"], "@kiltprotocol/augment-api/extraDefs": ["augment-api/src/interfaces/extraDefs"], - "@kiltprotocol/type-definitions": ["type-definitions/src"], } }, } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 57f38f74e..57a049e97 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1883,7 +1883,7 @@ __metadata: version: 0.0.0-use.local resolution: "@kiltprotocol/augment-api@workspace:packages/augment-api" dependencies: - "@kiltprotocol/type-definitions": "workspace:*" + "@kiltprotocol/type-definitions": ^1.0.0 "@polkadot/api": ^10.7.3 "@polkadot/typegen": ^10.7.3 glob: ^7.1.1 @@ -1930,7 +1930,7 @@ __metadata: "@kiltprotocol/chain-helpers": "workspace:*" "@kiltprotocol/config": "workspace:*" "@kiltprotocol/did": "workspace:*" - "@kiltprotocol/type-definitions": "workspace:*" + "@kiltprotocol/type-definitions": ^1.0.0 "@kiltprotocol/types": "workspace:*" "@kiltprotocol/utils": "workspace:*" "@polkadot/api": ^10.7.3 @@ -1997,14 +1997,14 @@ __metadata: languageName: unknown linkType: soft -"@kiltprotocol/type-definitions@workspace:*, @kiltprotocol/type-definitions@workspace:packages/type-definitions": - version: 0.0.0-use.local - resolution: "@kiltprotocol/type-definitions@workspace:packages/type-definitions" - dependencies: - rimraf: ^3.0.2 - typescript: ^4.8.3 - languageName: unknown - linkType: soft +"@kiltprotocol/type-definitions@npm:^1.0.0": + version: 1.11401.1 + resolution: "@kiltprotocol/type-definitions@npm:1.11401.1" + peerDependencies: + "@polkadot/types": ^12.2.0 + checksum: 6f7f8e837cd04d9d823e11879aee3c9986c2686567381548e860969c4b38757274c2b0adee2a01c661c07a86f6583ecc1a99ae1d506b71d7880f3c2f757cc15e + languageName: node + linkType: hard "@kiltprotocol/types@workspace:*, @kiltprotocol/types@workspace:packages/types": version: 0.0.0-use.local