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
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { types2700 } from "./types_2700"
import { types10700 } from "./types_10700"

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

// Export type definitions
export {
Expand All @@ -37,6 +38,9 @@ export {
// Export runtime APIs definitions
export { runtime }

// Export custom RPC definitions
export { rpc }

// Export complete package
export const typeBundleForPolkadot: OverrideBundleDefinition = {
types: [
Expand Down Expand Up @@ -93,5 +97,6 @@ export const typeBundleForPolkadot: OverrideBundleDefinition = {
types: types10700,
},
],
runtime: runtime
runtime: runtime,
rpc: rpc
}
45 changes: 45 additions & 0 deletions src/rpc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import type {
DefinitionRpc, DefinitionRpcSub
} from "@polkadot/types/types"

const rpc: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>> = {
credentials: {
getCredential: {
description: "Test",
params: [
{
name: "credential_id",
type: "Hash",
},
{
name: "at",
type: "Hash",
isOptional: true,
},
],
type: "Option<PublicCredentialsCredentialsCredentialEntry>"
},
getCredentials: {
description: "Return all the credentials issued to the provided subject, optionally filtering with the provided logic.",
params: [
{
name: "subject",
type: "String",
},
{
name: "filter",
type: "PublicCredentialFilter",
isOptional: true,
},
{
name: "at",
type: "Hash",
isOptional: true,
},
],
type: "Vec<(Hash, PublicCredentialsCredentialsCredentialEntry)>"
}
}
}

export default rpc
27 changes: 27 additions & 0 deletions src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,33 @@ const runtime: DefinitionsCall = {
version: 1
}
],
PublicCredentialsApi: [
{
methods: {
get_credential: {
description: "Test",
params: [
{
name: "credentialId",
type: "Hash",
},
],
type: "Option<PublicCredentialsCredentialsCredentialEntry>"
},
get_credentials: {
description: "Test",
params: [
{
name: "subject",
type: "RuntimeCommonAssetsAssetDid",
},
],
type: "Vec<(Hash, PublicCredentialsCredentialsCredentialEntry)>"
},
},
version: 1
}
],
}

export default runtime
8 changes: 8 additions & 0 deletions src/types_10700.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,12 @@ export const types10700: RegistryTypes = {
lastTxCounter: "BlockNumber",
deposit: "KiltSupportDeposit<AccountId32, Balance>"
},

// Public credentials RPC
PublicCredentialFilter: {
_enum: {
ctypeHash: "Hash",
attester: "DidIdentifier",
}
}
}