diff --git a/src/dipProof/extensions/index.ts b/src/dipProof/extensions/index.ts
index 74f1e78..81a48e5 100644
--- a/src/dipProof/extensions/index.ts
+++ b/src/dipProof/extensions/index.ts
@@ -5,6 +5,6 @@
* found in the LICENSE file in the root directory of this source tree.
*/
-export type * from './types.js'
+export type * from "./types.js"
-export * as timeBoundDidSignature from './timeBoundDidSignature.js'
+export * as timeBoundDidSignature from "./timeBoundDidSignature.js"
diff --git a/src/dipProof/extensions/timeBoundDidSignature.ts b/src/dipProof/extensions/timeBoundDidSignature.ts
index f1102d5..5acd3d6 100644
--- a/src/dipProof/extensions/timeBoundDidSignature.ts
+++ b/src/dipProof/extensions/timeBoundDidSignature.ts
@@ -78,7 +78,7 @@ export type TimeBoundDidSignatureRes = {
* Generate a DID signature to be used in conjunction with a DIP proof to DID-authorize a cross-chain operation.
*
* @param params The signature generation parameters.
- *
+ *
* @returns The generated cross-chain DID signature.
*/
export async function generateDidSignature({
@@ -101,14 +101,22 @@ export async function generateDidSignature({
.toBn()
.add(await defaultValues.validUntilOffset())
const genesis = genesisHash ?? (await api.query.system.blockHash(0))
- const actualIdentityDetailsRuntimeType = identityDetailsRuntimeType ?? await defaultValues.identityDetailsRuntimeType()
+ const actualIdentityDetailsRuntimeType =
+ identityDetailsRuntimeType ??
+ (await defaultValues.identityDetailsRuntimeType())
const identityDetails = (
- await api.query.dipConsumer.identityEntries>(didToChain(didUri))
+ await api.query.dipConsumer.identityEntries >(
+ didToChain(didUri),
+ )
).unwrapOr(api.createType(actualIdentityDetailsRuntimeType, null))
const signaturePayload = api
.createType(
- `(Call, ${identityDetailsRuntimeType}, ${accountIdRuntimeType ?? await defaultValues.accountIdRuntimeType()}, ${blockNumberRuntimeType ?? await defaultValues.blockNumberRuntimeType()}, Hash)`,
+ `(Call, ${identityDetailsRuntimeType}, ${
+ accountIdRuntimeType ?? (await defaultValues.accountIdRuntimeType())
+ }, ${
+ blockNumberRuntimeType ?? (await defaultValues.blockNumberRuntimeType())
+ }, Hash)`,
[call, identityDetails, submitterAddress, blockNumber, genesis],
)
.toU8a()
@@ -128,17 +136,19 @@ export async function generateDidSignature({
* Transform a [[TimeBoundDidSignatureRes]] into an object that can be used to extend the basic DIP proof generated by [[generateDipSiblingBaseProof]].
*
* @param params The cross-chain DID signature as generated by [[generateDidSignature]].
- *
+ *
* @returns The CODEC-ready version of the signature.
*/
-export function toChain(signature: TimeBoundDidSignatureRes): Record {
+export function toChain(
+ signature: TimeBoundDidSignatureRes,
+): Record {
const encodedSignature = {
signature: {
- [signature.type]: u8aToHex(signature.signature)
+ [signature.type]: u8aToHex(signature.signature),
},
- validUntil: signature.validUntil
+ validUntil: signature.validUntil,
} as any as Codec
return {
- signature: encodedSignature
+ signature: encodedSignature,
}
}
diff --git a/src/dipProof/extensions/types.ts b/src/dipProof/extensions/types.ts
index b538829..ef415a5 100644
--- a/src/dipProof/extensions/types.ts
+++ b/src/dipProof/extensions/types.ts
@@ -5,4 +5,4 @@
* found in the LICENSE file in the root directory of this source tree.
*/
-export type * from './timeBoundDidSignature.js'
+export type * from "./timeBoundDidSignature.js"
diff --git a/src/dipProof/index.ts b/src/dipProof/index.ts
index 369309e..f4a5bd0 100644
--- a/src/dipProof/index.ts
+++ b/src/dipProof/index.ts
@@ -5,7 +5,7 @@
* found in the LICENSE file in the root directory of this source tree.
*/
-export type * from './types.js'
+export type * from "./types.js"
-export * from './subjectIdentity.js'
-export * as extensions from './extensions/index.js'
+export * from "./subjectIdentity.js"
+export * as extensions from "./extensions/index.js"
diff --git a/src/dipProof/subjectIdentity.ts b/src/dipProof/subjectIdentity.ts
index ebc36ae..92edf27 100644
--- a/src/dipProof/subjectIdentity.ts
+++ b/src/dipProof/subjectIdentity.ts
@@ -8,10 +8,7 @@
import { toChain } from "@kiltprotocol/did"
import type { PalletDidLookupLinkableAccountLinkableAccountId } from "@kiltprotocol/augment-api"
-import type {
- DidUri,
- DidKey,
-} from "@kiltprotocol/types"
+import type { DidUri, DidKey } from "@kiltprotocol/types"
import type { ApiPromise } from "@polkadot/api"
import type { Hash } from "@polkadot/types/interfaces"
import type { Codec } from "@polkadot/types-codec/types"
@@ -49,7 +46,7 @@ export type DipIdentityProofRes = {
}
/**
* Generate a DIP proof that reveals the specified information about the DID subject.
- *
+ *
* @param params The DIP proof params.
*
* @returns The generated basic DIP proof that reveals the specified parts of the DID Document, optionally revealing its web3name and any linked accounts as specified.
diff --git a/src/dipProof/types.ts b/src/dipProof/types.ts
index 41b7d9e..5bdd51d 100644
--- a/src/dipProof/types.ts
+++ b/src/dipProof/types.ts
@@ -5,5 +5,5 @@
* found in the LICENSE file in the root directory of this source tree.
*/
-export type * from './subjectIdentity.js'
-export type * from './extensions/types.js'
+export type * from "./subjectIdentity.js"
+export type * from "./extensions/types.js"
diff --git a/src/index.ts b/src/index.ts
index 0c85294..3d5492b 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -9,8 +9,8 @@
* @module @kiltprotocol/dip-sdk
*/
-export type * from './types.js'
+export type * from "./types.js"
-export * as stateProof from './stateProof/index.js'
-export * as dipProof from './dipProof/index.js'
+export * as stateProof from "./stateProof/index.js"
+export * as dipProof from "./dipProof/index.js"
export * from "./sibling.js"
diff --git a/src/sibling.ts b/src/sibling.ts
index 69a4966..8cc799f 100644
--- a/src/sibling.ts
+++ b/src/sibling.ts
@@ -9,19 +9,15 @@ import { toChain } from "@kiltprotocol/did"
import { ApiPromise } from "@polkadot/api"
import { BN } from "@polkadot/util"
-import { generateDipIdentityProof } from './dipProof/subjectIdentity.js'
-import { generateProviderStateRootProof } from './stateProof/providerStateRoot.js'
-import { generateDipCommitmentProof } from './stateProof/subjectDipCommitment.js'
+import { generateDipIdentityProof } from "./dipProof/subjectIdentity.js"
+import { generateProviderStateRootProof } from "./stateProof/providerStateRoot.js"
+import { generateDipCommitmentProof } from "./stateProof/subjectDipCommitment.js"
-import type { DipIdentityProofRes } from './dipProof/subjectIdentity.js'
-import type { ProviderStateRootProofRes } from './stateProof/providerStateRoot.js'
-import type { DipCommitmentProofRes } from './stateProof/subjectDipCommitment.js'
+import type { DipIdentityProofRes } from "./dipProof/subjectIdentity.js"
+import type { ProviderStateRootProofRes } from "./stateProof/providerStateRoot.js"
+import type { DipCommitmentProofRes } from "./stateProof/subjectDipCommitment.js"
import type { PalletDidLookupLinkableAccountLinkableAccountId } from "@kiltprotocol/augment-api"
-import type {
- DidUri,
- DidKey,
- SubmittableExtrinsic,
-} from "@kiltprotocol/types"
+import type { DidUri, DidKey, SubmittableExtrinsic } from "@kiltprotocol/types"
import type { Call } from "@polkadot/types/interfaces"
const defaultValues = {
@@ -33,7 +29,7 @@ const defaultValues = {
return providerApi.rpc.chain
.getHeader(providerLastFinalizedBlockHash)
.then((h) => h.number.toBn())
- }
+ },
}
/** The DIP proof params. */
@@ -58,15 +54,15 @@ export type DipSiblingBaseProofInput = {
/** The DIP proof result. */
export type DipSiblingBaseProofRes = {
- providerHeadProof: ProviderStateRootProofRes,
- dipCommitmentProof: DipCommitmentProofRes,
- dipProof: DipIdentityProofRes,
- proofVersion: number,
+ providerHeadProof: ProviderStateRootProofRes
+ dipCommitmentProof: DipCommitmentProofRes
+ dipProof: DipIdentityProofRes
+ proofVersion: number
}
/**
* Generate a base DIP proof according to the parameters provided, to be used on a consumer chain of which the provider chain is a sibling.
- *
+ *
* The generated proof only contains parts of the DID Document of the subject.
* Any additional components that the consumer chain requires, e.g., a cross-chain DID signature, or the presentation of some claims about the subject, are not part of the generated proof.
* This SDK contains an `extensions` section in which chain-specific proof formats could be added, if needed.
@@ -83,9 +79,11 @@ export async function generateDipSiblingBaseProof({
relayApi,
providerBlockHeight,
includeWeb3Name,
- linkedAccounts
+ linkedAccounts,
}: DipSiblingBaseProofInput): Promise {
- const actualProviderBlockHeight = providerBlockHeight ?? await defaultValues.providerBlockHeight(providerApi)
+ const actualProviderBlockHeight =
+ providerBlockHeight ??
+ (await defaultValues.providerBlockHeight(providerApi))
const providerHeadProof = await generateProviderStateRootProof({
relayApi,
providerApi,
@@ -108,9 +106,9 @@ export async function generateDipSiblingBaseProof({
didUri,
providerApi,
keyIds,
- linkedAccounts: linkedAccounts || await defaultValues.linkedAccounts(),
+ linkedAccounts: linkedAccounts || (await defaultValues.linkedAccounts()),
version: proofVersion,
- includeWeb3Name: includeWeb3Name || await defaultValues.includeWeb3Name(),
+ includeWeb3Name: includeWeb3Name || (await defaultValues.includeWeb3Name()),
})
return {
@@ -124,25 +122,31 @@ export async function generateDipSiblingBaseProof({
/** The params to create an extrinsic containing a cross-chain DIP proof and operation. */
export type GenerateDipSubmittableExtrinsicInput = {
/** Any consumer-specific pieces of information to be included in the DIP proof beyond proof-of-DID. */
- additionalProofElements: Record,
+ additionalProofElements: Record
/** The [[ApiPromise]] instance of the consumer chain. */
- api: ApiPromise,
+ api: ApiPromise
/** [[DipSiblingBaseProofRes]] as generated by [[generateDipSiblingBaseProof]]. */
- baseDipProof: DipSiblingBaseProofRes,
+ baseDipProof: DipSiblingBaseProofRes
/** The [[Call]] on the consumer chain that requires a DIP origin to be authorized. */
call: Call
/** The [[DidUri]] of the subject performing the cross-chain operation. */
- didUri: DidUri,
+ didUri: DidUri
}
/**
* Extend a [[DipSiblingBaseProofRes]] proof with consumer-specific components, and compiles the `dispatchAs` extrinsic following the consumer's type registry.
- *
+ *
* @param params The consumer information.
- *
+ *
* @returns A [[SubmittableExtrinsic]] that refers to a [[Call]] on the consumer chain being dispatched by the specified [[DidUri]].
*/
-export function generateDipSubmittableExtrinsic({ additionalProofElements, api, baseDipProof, call, didUri }: GenerateDipSubmittableExtrinsicInput): SubmittableExtrinsic {
+export function generateDipSubmittableExtrinsic({
+ additionalProofElements,
+ api,
+ baseDipProof,
+ call,
+ didUri,
+}: GenerateDipSubmittableExtrinsicInput): SubmittableExtrinsic {
const { proofVersion, ...dipProof } = baseDipProof
return api.tx.dipConsumer.dispatchAs(
@@ -151,16 +155,16 @@ export function generateDipSubmittableExtrinsic({ additionalProofElements, api,
[`V${proofVersion}`]: {
providerHeadProof: {
relayBlockNumber: dipProof.providerHeadProof.relayBlockHeight,
- proof: dipProof.providerHeadProof.proof.proof
+ proof: dipProof.providerHeadProof.proof.proof,
},
dipCommitmentProof: dipProof.dipCommitmentProof.proof.proof,
dipProof: {
blinded: dipProof.dipProof.proof.blinded,
- revealed: dipProof.dipProof.proof.revealed
+ revealed: dipProof.dipProof.proof.revealed,
},
- ...additionalProofElements
- }
+ ...additionalProofElements,
+ },
},
- call
+ call,
)
}
diff --git a/src/stateProof/index.ts b/src/stateProof/index.ts
index 2426607..ebccffe 100644
--- a/src/stateProof/index.ts
+++ b/src/stateProof/index.ts
@@ -5,7 +5,7 @@
* found in the LICENSE file in the root directory of this source tree.
*/
-export type * from './types.js'
+export type * from "./types.js"
-export * from './providerStateRoot.js'
-export * from './subjectDipCommitment.js'
+export * from "./providerStateRoot.js"
+export * from "./subjectDipCommitment.js"
diff --git a/src/stateProof/providerStateRoot.ts b/src/stateProof/providerStateRoot.ts
index b1fd9b7..c1f5201 100644
--- a/src/stateProof/providerStateRoot.ts
+++ b/src/stateProof/providerStateRoot.ts
@@ -12,7 +12,7 @@ import type { ReadProof } from "@polkadot/types/interfaces"
/**
* The options object provided when generating a proof for the provider state.
- *
+ *
* Proof generation logic depends on the value of `proofVersion`.
* For more details about what each `proofVersion` provides, please refer to our docs.
*/
@@ -37,7 +37,7 @@ export type ProviderStateRootProofRes = {
}
/**
* Generate a proof for the state root of the provider.
- *
+ *
* The value and type of the proof depends on the version specified.
* For more details about what each `proofVersion` provides, please refer to our docs.
*
@@ -49,10 +49,11 @@ export async function generateProviderStateRootProof({
providerApi,
relayApi,
providerBlockHeight,
- // `proofVersion` is not used, for now, but it's added to avoid introducing unnecessary breaking changes
- // proofVersion,
-}: ProviderStateRootProofOpts): Promise {
- const providerBlockHash = await providerApi.rpc.chain.getBlockHash(providerBlockHeight)
+} // `proofVersion` is not used, for now, but it's added to avoid introducing unnecessary breaking changes
+// proofVersion,
+: ProviderStateRootProofOpts): Promise {
+ const providerBlockHash =
+ await providerApi.rpc.chain.getBlockHash(providerBlockHeight)
const providerApiAtBlock = await providerApi.at(providerBlockHash)
const providerParaId =
await providerApiAtBlock.query.parachainInfo.parachainId()
@@ -70,6 +71,6 @@ export async function generateProviderStateRootProof({
return {
proof,
- relayBlockHeight: relayParentBlockNumber.toBn()
+ relayBlockHeight: relayParentBlockNumber.toBn(),
}
}
diff --git a/src/stateProof/subjectDipCommitment.ts b/src/stateProof/subjectDipCommitment.ts
index 642477a..3aa4df4 100644
--- a/src/stateProof/subjectDipCommitment.ts
+++ b/src/stateProof/subjectDipCommitment.ts
@@ -7,9 +7,7 @@
import { toChain } from "@kiltprotocol/did"
-import type {
- DidUri,
-} from "@kiltprotocol/types"
+import type { DidUri } from "@kiltprotocol/types"
import type { ApiPromise } from "@polkadot/api"
import type { Hash, ReadProof } from "@polkadot/types/interfaces"
@@ -37,7 +35,7 @@ export type DipCommitmentProofRes = {
* Generate a state proof for the value of a DIP identity commitment of a specific version on the specified provider chain.
*
* For more details about what each `version` provides, please refer to our docs.
- *
+ *
* @param params The state proof params.
*
* @returns The generated state proof.
diff --git a/src/stateProof/types.ts b/src/stateProof/types.ts
index b0b6623..3f70f52 100644
--- a/src/stateProof/types.ts
+++ b/src/stateProof/types.ts
@@ -5,5 +5,5 @@
* found in the LICENSE file in the root directory of this source tree.
*/
-export type * from './providerStateRoot.js'
-export type * from './subjectDipCommitment.js'
+export type * from "./providerStateRoot.js"
+export type * from "./subjectDipCommitment.js"
diff --git a/src/types.ts b/src/types.ts
index 7db1331..2f3b4c1 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -5,6 +5,6 @@
* found in the LICENSE file in the root directory of this source tree.
*/
-export type * from './stateProof/index.js'
-export type * from './dipProof/index.js'
-export type * from './sibling.js'
+export type * from "./stateProof/index.js"
+export type * from "./dipProof/index.js"
+export type * from "./sibling.js"
diff --git a/tests/dip-provider-template-dip-consumer-template/develop.test.ts b/tests/dip-provider-template-dip-consumer-template/develop.test.ts
index e4da276..4ec056a 100644
--- a/tests/dip-provider-template-dip-consumer-template/develop.test.ts
+++ b/tests/dip-provider-template-dip-consumer-template/develop.test.ts
@@ -15,7 +15,12 @@ import dotenv from "dotenv"
import { beforeAll, describe, it, expect } from "vitest"
import type { GetStoreTxSignCallback, Web3Name } from "@kiltprotocol/did"
-import type { DipSiblingBaseProofInput, TimeBoundDidSignatureConsumerOpts, TimeBoundDidSignatureOpts, TimeBoundDidSignatureProviderOpts } from "@kiltprotocol/dip-sdk"
+import type {
+ DipSiblingBaseProofInput,
+ TimeBoundDidSignatureConsumerOpts,
+ TimeBoundDidSignatureOpts,
+ TimeBoundDidSignatureProviderOpts,
+} from "@kiltprotocol/dip-sdk"
import type {
DidDocument,
KiltAddress,
@@ -33,7 +38,9 @@ dotenv.config({
const baseConfig: Pick<
TimeBoundDidSignatureConsumerOpts,
- "accountIdRuntimeType" | "blockNumberRuntimeType" | "identityDetailsRuntimeType"
+ | "accountIdRuntimeType"
+ | "blockNumberRuntimeType"
+ | "identityDetailsRuntimeType"
> = {
accountIdRuntimeType: "AccountId32",
blockNumberRuntimeType: "u64",
@@ -58,7 +65,7 @@ describe("V0", () => {
Pick<
DipSiblingBaseProofInput,
"proofVersion" | "providerApi" | "relayApi"
- > & { "consumerApi": TimeBoundDidSignatureConsumerOpts['api'] }
+ > & { consumerApi: TimeBoundDidSignatureConsumerOpts["api"] }
beforeAll(async () => {
const [relayApi, providerApi, consumerApi] = await Promise.all([
@@ -87,11 +94,10 @@ describe("V0", () => {
let testConfig: typeof v0Config &
Pick<
DipSiblingBaseProofInput,
- | "didUri"
- | "keyIds"
- | "includeWeb3Name"
- | "linkedAccounts"
- > & Pick & Pick
+ "didUri" | "keyIds" | "includeWeb3Name" | "linkedAccounts"
+ > &
+ Pick &
+ Pick
beforeAll(async () => {
const { providerApi, consumerApi } = v0Config
@@ -196,12 +202,24 @@ describe("V0", () => {
const config: DipSiblingBaseProofInput & TimeBoundDidSignatureOpts = {
...testConfig,
provider: testConfig,
- consumer: { ...testConfig, api: consumerApi, call }
+ consumer: { ...testConfig, api: consumerApi, call },
}
const baseDipProof = await DipSdk.generateDipSiblingBaseProof(config)
- const crossChainDidSignature = await DipSdk.dipProof.extensions.timeBoundDidSignature.generateDidSignature(config)
+ const crossChainDidSignature =
+ await DipSdk.dipProof.extensions.timeBoundDidSignature.generateDidSignature(
+ config,
+ )
- const dipSubmittable = DipSdk.generateDipSubmittableExtrinsic({ additionalProofElements: DipSdk.dipProof.extensions.timeBoundDidSignature.toChain(crossChainDidSignature), api: consumerApi, baseDipProof, call, didUri: did.uri })
+ const dipSubmittable = DipSdk.generateDipSubmittableExtrinsic({
+ additionalProofElements:
+ DipSdk.dipProof.extensions.timeBoundDidSignature.toChain(
+ crossChainDidSignature,
+ ),
+ api: consumerApi,
+ baseDipProof,
+ call,
+ didUri: did.uri,
+ })
const { status } = await signAndSubmitTx(
consumerApi,
@@ -219,7 +237,8 @@ describe("V0", () => {
const postKey = blake2AsHex(
consumerApi
.createType(
- `(${config.consumer.blockNumberRuntimeType as string
+ `(${
+ config.consumer.blockNumberRuntimeType as string
}, ${web3NameRuntimeType}, Bytes)`,
[blockNumber, web3Name, postText],
)
@@ -242,13 +261,25 @@ describe("V0", () => {
// Set explicit block number for the DIP proof
providerBlockHeight: lastTestSetupProviderBlockNumber,
provider: testConfig,
- consumer: { ...testConfig, api: consumerApi, call, }
+ consumer: { ...testConfig, api: consumerApi, call },
}
const baseDipProof = await DipSdk.generateDipSiblingBaseProof(config)
- const crossChainDidSignature = await DipSdk.dipProof.extensions.timeBoundDidSignature.generateDidSignature(config)
+ const crossChainDidSignature =
+ await DipSdk.dipProof.extensions.timeBoundDidSignature.generateDidSignature(
+ config,
+ )
- const dipSubmittable = DipSdk.generateDipSubmittableExtrinsic({ additionalProofElements: DipSdk.dipProof.extensions.timeBoundDidSignature.toChain(crossChainDidSignature), api: consumerApi, baseDipProof, call, didUri: did.uri })
+ const dipSubmittable = DipSdk.generateDipSubmittableExtrinsic({
+ additionalProofElements:
+ DipSdk.dipProof.extensions.timeBoundDidSignature.toChain(
+ crossChainDidSignature,
+ ),
+ api: consumerApi,
+ baseDipProof,
+ call,
+ didUri: did.uri,
+ })
const { status } = await signAndSubmitTx(
consumerApi,
@@ -266,7 +297,8 @@ describe("V0", () => {
const postKey = blake2AsHex(
consumerApi
.createType(
- `(${config.consumer.blockNumberRuntimeType as string
+ `(${
+ config.consumer.blockNumberRuntimeType as string
}, ${web3NameRuntimeType}, Bytes)`,
[blockNumber, web3Name, postText],
)
diff --git a/tests/peregrine-dip-consumer-template/develop.test.ts b/tests/peregrine-dip-consumer-template/develop.test.ts
index b3011a7..53b4c19 100644
--- a/tests/peregrine-dip-consumer-template/develop.test.ts
+++ b/tests/peregrine-dip-consumer-template/develop.test.ts
@@ -15,7 +15,12 @@ import dotenv from "dotenv"
import { beforeAll, describe, it, expect } from "vitest"
import type { GetStoreTxSignCallback, Web3Name } from "@kiltprotocol/did"
-import type { DipSiblingBaseProofInput, TimeBoundDidSignatureConsumerOpts, TimeBoundDidSignatureOpts, TimeBoundDidSignatureProviderOpts } from "@kiltprotocol/dip-sdk"
+import type {
+ DipSiblingBaseProofInput,
+ TimeBoundDidSignatureConsumerOpts,
+ TimeBoundDidSignatureOpts,
+ TimeBoundDidSignatureProviderOpts,
+} from "@kiltprotocol/dip-sdk"
import type {
DidDocument,
KiltAddress,
@@ -28,12 +33,14 @@ import type { Codec } from "@polkadot/types/types"
import { signAndSubmitTx, withCrossModuleSystemImport } from "../utils.js"
dotenv.config({
- path: "tests/peregrine-dip-consumer-template/.env.develop.test"
+ path: "tests/peregrine-dip-consumer-template/.env.develop.test",
})
const baseConfig: Pick<
TimeBoundDidSignatureConsumerOpts,
- "accountIdRuntimeType" | "blockNumberRuntimeType" | "identityDetailsRuntimeType"
+ | "accountIdRuntimeType"
+ | "blockNumberRuntimeType"
+ | "identityDetailsRuntimeType"
> = {
accountIdRuntimeType: "AccountId32",
blockNumberRuntimeType: "u64",
@@ -58,7 +65,7 @@ describe("V0", () => {
Pick<
DipSiblingBaseProofInput,
"proofVersion" | "providerApi" | "relayApi"
- > & { "consumerApi": TimeBoundDidSignatureConsumerOpts['api'] }
+ > & { consumerApi: TimeBoundDidSignatureConsumerOpts["api"] }
beforeAll(async () => {
const [relayApi, providerApi, consumerApi] = await Promise.all([
@@ -87,11 +94,10 @@ describe("V0", () => {
let testConfig: typeof v0Config &
Pick<
DipSiblingBaseProofInput,
- | "didUri"
- | "keyIds"
- | "includeWeb3Name"
- | "linkedAccounts"
- > & Pick & Pick
+ "didUri" | "keyIds" | "includeWeb3Name" | "linkedAccounts"
+ > &
+ Pick &
+ Pick
beforeAll(async () => {
const { providerApi, consumerApi } = v0Config
@@ -171,9 +177,9 @@ describe("V0", () => {
newSubmitterKeypair.address as KiltAddress,
{ txCounter: new BN(2) },
)
- const newDelegationKey = new Kilt.Utils.Keyring({ type: "ed25519" }).addFromMnemonic(
- Kilt.Utils.Crypto.mnemonicGenerate(),
- )
+ const newDelegationKey = new Kilt.Utils.Keyring({
+ type: "ed25519",
+ }).addFromMnemonic(Kilt.Utils.Crypto.mnemonicGenerate())
const newDelegationKeyTx = (() => {
return providerApi.tx.did.setDelegationKey(
Kilt.Did.publicKeyToChain({
@@ -287,12 +293,24 @@ describe("V0", () => {
const config: DipSiblingBaseProofInput & TimeBoundDidSignatureOpts = {
...testConfig,
provider: testConfig,
- consumer: { ...testConfig, api: consumerApi, call }
+ consumer: { ...testConfig, api: consumerApi, call },
}
const baseDipProof = await DipSdk.generateDipSiblingBaseProof(config)
- const crossChainDidSignature = await DipSdk.dipProof.extensions.timeBoundDidSignature.generateDidSignature(config)
+ const crossChainDidSignature =
+ await DipSdk.dipProof.extensions.timeBoundDidSignature.generateDidSignature(
+ config,
+ )
- const dipSubmittable = DipSdk.generateDipSubmittableExtrinsic({ additionalProofElements: DipSdk.dipProof.extensions.timeBoundDidSignature.toChain(crossChainDidSignature), api: consumerApi, baseDipProof, call, didUri: did.uri })
+ const dipSubmittable = DipSdk.generateDipSubmittableExtrinsic({
+ additionalProofElements:
+ DipSdk.dipProof.extensions.timeBoundDidSignature.toChain(
+ crossChainDidSignature,
+ ),
+ api: consumerApi,
+ baseDipProof,
+ call,
+ didUri: did.uri,
+ })
const { status } = await signAndSubmitTx(
consumerApi,
@@ -310,7 +328,8 @@ describe("V0", () => {
const postKey = blake2AsHex(
consumerApi
.createType(
- `(${config.consumer.blockNumberRuntimeType as string
+ `(${
+ config.consumer.blockNumberRuntimeType as string
}, ${web3NameRuntimeType}, Bytes)`,
[blockNumber, web3Name, postText],
)
@@ -333,13 +352,25 @@ describe("V0", () => {
// Set explicit block number for the DIP proof
providerBlockHeight: lastTestSetupProviderBlockNumber,
provider: testConfig,
- consumer: { ...testConfig, api: consumerApi, call, }
+ consumer: { ...testConfig, api: consumerApi, call },
}
const baseDipProof = await DipSdk.generateDipSiblingBaseProof(config)
- const crossChainDidSignature = await DipSdk.dipProof.extensions.timeBoundDidSignature.generateDidSignature(config)
+ const crossChainDidSignature =
+ await DipSdk.dipProof.extensions.timeBoundDidSignature.generateDidSignature(
+ config,
+ )
- const dipSubmittable = DipSdk.generateDipSubmittableExtrinsic({ additionalProofElements: DipSdk.dipProof.extensions.timeBoundDidSignature.toChain(crossChainDidSignature), api: consumerApi, baseDipProof, call, didUri: did.uri })
+ const dipSubmittable = DipSdk.generateDipSubmittableExtrinsic({
+ additionalProofElements:
+ DipSdk.dipProof.extensions.timeBoundDidSignature.toChain(
+ crossChainDidSignature,
+ ),
+ api: consumerApi,
+ baseDipProof,
+ call,
+ didUri: did.uri,
+ })
const { status } = await signAndSubmitTx(
consumerApi,
@@ -357,7 +388,8 @@ describe("V0", () => {
const postKey = blake2AsHex(
consumerApi
.createType(
- `(${config.consumer.blockNumberRuntimeType as string
+ `(${
+ config.consumer.blockNumberRuntimeType as string
}, ${web3NameRuntimeType}, Bytes)`,
[blockNumber, web3Name, postText],
)
diff --git a/tests/utils.ts b/tests/utils.ts
index 4a85ba9..a6dbc96 100644
--- a/tests/utils.ts
+++ b/tests/utils.ts
@@ -11,10 +11,7 @@ import { describe } from "vitest"
import type { KeyringPair, SubmittableExtrinsic } from "@kiltprotocol/types"
import type { ApiPromise } from "@polkadot/api"
-import type {
- AnyNumber,
- ISubmittableResult,
-} from "@polkadot/types/types"
+import type { AnyNumber, ISubmittableResult } from "@polkadot/types/types"
export async function createProviderApi(address: string): Promise {
return Kilt.connect(address)