diff --git a/packages/type-definitions/src/index.ts b/packages/type-definitions/src/index.ts index 8755060b1..be04fc47f 100644 --- a/packages/type-definitions/src/index.ts +++ b/packages/type-definitions/src/index.ts @@ -29,6 +29,7 @@ import { types10800 } from './types_10800.js' import { calls as didCalls } from './runtime/did.js' import { calls as parachainStakingCalls } from './runtime/parachainStaking.js' +import { calls as publicCredentialsCalls } from './runtime/publicCredentials.js' export { types8, @@ -50,6 +51,7 @@ export { export { calls as didCalls } from './runtime/did.js' export { calls as parachainStakingCalls } from './runtime/parachainStaking.js' +export { calls as publicCredentialsCalls } from './runtime/publicCredentials.js' const defaultTypesBundle: OverrideVersionedType[] = [ { @@ -117,6 +119,7 @@ export const typesBundle: OverrideBundleType = { runtime: { ...didCalls, ...parachainStakingCalls, + ...publicCredentialsCalls, }, types: defaultTypesBundle, }, @@ -124,18 +127,21 @@ export const typesBundle: OverrideBundleType = { runtime: { ...didCalls, ...parachainStakingCalls, + ...publicCredentialsCalls, }, types: defaultTypesBundle, }, 'KILT Mashnet': { runtime: { ...didCalls, + ...publicCredentialsCalls, }, types: defaultTypesBundle, }, Development: { runtime: { ...didCalls, + ...publicCredentialsCalls, }, types: defaultTypesBundle, }, diff --git a/packages/type-definitions/src/runtime/publicCredentials.ts b/packages/type-definitions/src/runtime/publicCredentials.ts new file mode 100644 index 000000000..39d50102d --- /dev/null +++ b/packages/type-definitions/src/runtime/publicCredentials.ts @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2018-2022, 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_credential: { + description: + 'Return the public credential with the specified ID, if found.', + params: [ + { + name: 'credential_id', + type: 'Hash', + }, + ], + type: 'Option', + }, + get_credentials: { + description: + 'Return all the public credentials linked to the specified subject.', + params: [ + { + name: 'subject', + type: 'Text', + }, + { + name: 'filter', + type: 'Option', + }, + ], + type: 'Result, PublicCredentialApiError>', + }, + }, + version: 1, + }, + ], +} diff --git a/packages/type-definitions/src/types_10800.ts b/packages/type-definitions/src/types_10800.ts index 9769b4fe9..a58aaaf62 100644 --- a/packages/type-definitions/src/types_10800.ts +++ b/packages/type-definitions/src/types_10800.ts @@ -13,4 +13,16 @@ export const types10800: RegistryTypes = { ...types10720, // DID state_call v2 DidApiAccountId: 'PalletDidLookupLinkableAccountLinkableAccountId', + + // Public credentials state_calls (types are somehow not exported in the metadata info) + // FIXME: if exported in the metadata, remove these type definitions from future versions + PublicCredentialsFilter: { + _enum: { + ctypeHash: 'Hash', + attester: 'AccountId32', + }, + }, + PublicCredentialApiError: { + _enum: ['InvalidSubjectId'], + }, }