diff --git a/src/dipProof/extensions/timeBoundDidSignature.ts b/src/dipProof/extensions/timeBoundDidSignature.ts index df2cf7a..30cdb75 100644 --- a/src/dipProof/extensions/timeBoundDidSignature.ts +++ b/src/dipProof/extensions/timeBoundDidSignature.ts @@ -21,10 +21,10 @@ import type { Option } from "@polkadot/types-codec" import type { Codec } from "@polkadot/types-codec/types" const defaultValues = { - accountIdRuntimeType: "AccountId", - blockNumberRuntimeType: "u64", - identityDetailsRuntimeType: "Option", - validUntilOffset: new BN(50), + accountIdRuntimeType: async () => "AccountId", + blockNumberRuntimeType: async () => "u64", + identityDetailsRuntimeType: async () => "Option", + validUntilOffset: async () => new BN(50), } /** @@ -99,16 +99,16 @@ export async function generateTimeBoundDipDidSignature({ validUntil ?? (await api.query.system.number()) .toBn() - .add(defaultValues.validUntilOffset) + .add(await defaultValues.validUntilOffset()) const genesis = genesisHash ?? (await api.query.system.blockHash(0)) - const actualIdentityDetailsRuntimeType = identityDetailsRuntimeType ?? defaultValues.identityDetailsRuntimeType + const actualIdentityDetailsRuntimeType = identityDetailsRuntimeType ?? await defaultValues.identityDetailsRuntimeType() const identityDetails = ( await api.query.dipConsumer.identityEntries>(toChain(didUri)) ).unwrapOr(api.createType(actualIdentityDetailsRuntimeType, null)) const signaturePayload = api .createType( - `(Call, ${identityDetailsRuntimeType}, ${accountIdRuntimeType ?? defaultValues.accountIdRuntimeType}, ${blockNumberRuntimeType ?? defaultValues.blockNumberRuntimeType}, Hash)`, + `(Call, ${identityDetailsRuntimeType}, ${accountIdRuntimeType ?? await defaultValues.accountIdRuntimeType()}, ${blockNumberRuntimeType ?? await defaultValues.blockNumberRuntimeType()}, Hash)`, [call, identityDetails, submitterAddress, blockNumber, genesis], ) .toU8a() diff --git a/src/sibling.ts b/src/sibling.ts index 51e2111..0933050 100644 --- a/src/sibling.ts +++ b/src/sibling.ts @@ -26,8 +26,8 @@ import type { Call } from "@polkadot/types/interfaces" import type { Codec } from "@polkadot/types-codec/types" const defaultValues = { - includeWeb3Name: () => false, - linkedAccounts: () => [], + includeWeb3Name: async () => false, + linkedAccounts: async () => [], providerBlockHeight: async (providerApi: ApiPromise) => { const providerLastFinalizedBlockHash = await providerApi.rpc.chain.getFinalizedHead() @@ -104,9 +104,9 @@ export async function generateDipSiblingBaseProof({ didUri, providerApi, keyIds, - linkedAccounts: linkedAccounts || defaultValues.linkedAccounts(), + linkedAccounts: linkedAccounts || await defaultValues.linkedAccounts(), version: proofVersion, - includeWeb3Name: includeWeb3Name || defaultValues.includeWeb3Name(), + includeWeb3Name: includeWeb3Name || await defaultValues.includeWeb3Name(), }) return {