@totochain/client 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -28
- package/_cjs/accounts/substrateSigner.js +4 -1
- package/_cjs/actions/attestation/attest.d.cts +14 -9
- package/_cjs/actions/attestation/attest.js +6 -6
- package/_cjs/actions/attestation/index.d.cts +1 -1
- package/_cjs/actions/index.d.cts +1 -1
- package/_cjs/actions/index.js +1 -1
- package/_cjs/actions/{fractionalNft → puzzlePieces}/getCollectionsCount.js +1 -1
- package/_cjs/actions/{fractionalNft → puzzlePieces}/getItemsCount.js +1 -1
- package/_cjs/actions/{fractionalNft → puzzlePieces}/getOwner.js +1 -1
- package/_cjs/actions/puzzlePieces/getPendingWildcards.d.cts +8 -0
- package/_cjs/actions/puzzlePieces/getPendingWildcards.js +9 -0
- package/_cjs/actions/puzzlePieces/getTotalPuzzlePiecesMinted.d.cts +7 -0
- package/_cjs/actions/puzzlePieces/getTotalPuzzlePiecesMinted.js +8 -0
- package/_cjs/actions/{fractionalNft → puzzlePieces}/getWildcardCollectionId.js +1 -1
- package/_cjs/actions/{fractionalNft → puzzlePieces}/getWildcardDistributionMap.js +1 -1
- package/_cjs/actions/{fractionalNft → puzzlePieces}/getWildcardThreshold.js +1 -1
- package/_cjs/actions/{fractionalNft → puzzlePieces}/index.d.cts +5 -5
- package/_cjs/actions/{fractionalNft → puzzlePieces}/index.js +5 -5
- package/_cjs/actions/puzzlePieces/types.d.cts +5 -0
- package/_cjs/actions/rewardPool/index.d.cts +0 -4
- package/_cjs/actions/rewardPool/index.js +1 -5
- package/_cjs/client/compatibility.d.cts +16 -0
- package/_cjs/client/compatibility.js +60 -0
- package/_cjs/client/createClient.d.cts +2 -0
- package/_cjs/client/createClient.js +11 -0
- package/_cjs/crypto/index.d.cts +0 -2
- package/_cjs/crypto/index.js +1 -4
- package/_cjs/did/didUri.d.cts +11 -0
- package/_cjs/did/didUri.js +14 -0
- package/_cjs/index.d.cts +7 -4
- package/_cjs/index.js +9 -4
- package/_cjs/plugins/index.d.cts +2 -2
- package/_cjs/plugins/index.js +3 -3
- package/_cjs/plugins/{fractionalNft.d.cts → puzzlePieces.d.cts} +7 -10
- package/_cjs/plugins/{fractionalNft.js → puzzlePieces.js} +6 -6
- package/_cjs/plugins/rewardPool.d.cts +0 -5
- package/_cjs/plugins/rewardPool.js +0 -2
- package/_cjs/rpc/call.js +17 -1
- package/_cjs/rpc/definitions.js +49 -65
- package/_cjs/rpc/types.js +8 -12
- package/_esm/accounts/substrateSigner.js +5 -2
- package/_esm/actions/attestation/attest.js +6 -6
- package/_esm/actions/index.js +1 -1
- package/_esm/actions/{fractionalNft → puzzlePieces}/getCollectionsCount.js +1 -1
- package/_esm/actions/{fractionalNft → puzzlePieces}/getItemsCount.js +1 -1
- package/_esm/actions/{fractionalNft → puzzlePieces}/getOwner.js +1 -1
- package/_esm/actions/puzzlePieces/getPendingWildcards.js +6 -0
- package/_esm/actions/puzzlePieces/getTotalPuzzlePiecesMinted.js +5 -0
- package/_esm/actions/{fractionalNft → puzzlePieces}/getWildcardCollectionId.js +1 -1
- package/_esm/actions/{fractionalNft → puzzlePieces}/getWildcardDistributionMap.js +1 -1
- package/_esm/actions/{fractionalNft → puzzlePieces}/getWildcardThreshold.js +1 -1
- package/_esm/actions/{fractionalNft → puzzlePieces}/index.js +2 -2
- package/_esm/actions/rewardPool/index.js +0 -2
- package/_esm/client/compatibility.js +55 -0
- package/_esm/client/createClient.js +11 -0
- package/_esm/crypto/index.js +0 -1
- package/_esm/did/didUri.js +11 -0
- package/_esm/index.js +4 -2
- package/_esm/plugins/index.js +1 -1
- package/_esm/plugins/{fractionalNft.js → puzzlePieces.js} +5 -5
- package/_esm/plugins/rewardPool.js +1 -3
- package/_esm/rpc/call.js +17 -1
- package/_esm/rpc/definitions.js +49 -65
- package/_esm/rpc/types.js +8 -12
- package/_types/accounts/substrateSigner.d.ts.map +1 -1
- package/_types/actions/attestation/attest.d.ts +14 -9
- package/_types/actions/attestation/attest.d.ts.map +1 -1
- package/_types/actions/attestation/index.d.ts +1 -1
- package/_types/actions/attestation/index.d.ts.map +1 -1
- package/_types/actions/index.d.ts +1 -1
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/puzzlePieces/getCollectionsCount.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getItemsCount.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getOwner.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getPendingWildcards.d.ts +8 -0
- package/_types/actions/puzzlePieces/getPendingWildcards.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getTotalPuzzlePiecesMinted.d.ts +7 -0
- package/_types/actions/puzzlePieces/getTotalPuzzlePiecesMinted.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getWildcardCollectionId.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getWildcardDistributionMap.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getWildcardThreshold.d.ts.map +1 -0
- package/_types/actions/{fractionalNft → puzzlePieces}/index.d.ts +5 -5
- package/_types/actions/puzzlePieces/index.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/types.d.ts +5 -0
- package/_types/actions/puzzlePieces/types.d.ts.map +1 -0
- package/_types/actions/rewardPool/index.d.ts +0 -4
- package/_types/actions/rewardPool/index.d.ts.map +1 -1
- package/_types/client/compatibility.d.ts +16 -0
- package/_types/client/compatibility.d.ts.map +1 -0
- package/_types/client/createClient.d.ts +2 -0
- package/_types/client/createClient.d.ts.map +1 -1
- package/_types/crypto/index.d.ts +0 -2
- package/_types/crypto/index.d.ts.map +1 -1
- package/_types/did/didUri.d.ts +11 -0
- package/_types/did/didUri.d.ts.map +1 -0
- package/_types/index.d.ts +7 -4
- package/_types/index.d.ts.map +1 -1
- package/_types/plugins/index.d.ts +2 -2
- package/_types/plugins/index.d.ts.map +1 -1
- package/_types/plugins/{fractionalNft.d.ts → puzzlePieces.d.ts} +7 -10
- package/_types/plugins/puzzlePieces.d.ts.map +1 -0
- package/_types/plugins/rewardPool.d.ts +0 -5
- package/_types/plugins/rewardPool.d.ts.map +1 -1
- package/_types/rpc/call.d.ts.map +1 -1
- package/_types/rpc/definitions.d.ts.map +1 -1
- package/_types/rpc/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/_cjs/actions/fractionalNft/getNftInfo.d.cts +0 -9
- package/_cjs/actions/fractionalNft/getNftInfo.js +0 -12
- package/_cjs/actions/fractionalNft/getTotalFnftsMinted.d.cts +0 -7
- package/_cjs/actions/fractionalNft/getTotalFnftsMinted.js +0 -8
- package/_cjs/actions/fractionalNft/types.d.cts +0 -10
- package/_cjs/actions/rewardPool/getCollectionIds.d.cts +0 -7
- package/_cjs/actions/rewardPool/getCollectionIds.js +0 -8
- package/_cjs/actions/rewardPool/getItemIds.d.cts +0 -8
- package/_cjs/actions/rewardPool/getItemIds.js +0 -8
- package/_cjs/crypto/claimHash.d.cts +0 -23
- package/_cjs/crypto/claimHash.js +0 -38
- package/_esm/actions/fractionalNft/getNftInfo.js +0 -9
- package/_esm/actions/fractionalNft/getTotalFnftsMinted.js +0 -5
- package/_esm/actions/rewardPool/getCollectionIds.js +0 -5
- package/_esm/actions/rewardPool/getItemIds.js +0 -5
- package/_esm/crypto/claimHash.js +0 -34
- package/_types/actions/fractionalNft/getCollectionsCount.d.ts.map +0 -1
- package/_types/actions/fractionalNft/getItemsCount.d.ts.map +0 -1
- package/_types/actions/fractionalNft/getNftInfo.d.ts +0 -9
- package/_types/actions/fractionalNft/getNftInfo.d.ts.map +0 -1
- package/_types/actions/fractionalNft/getOwner.d.ts.map +0 -1
- package/_types/actions/fractionalNft/getTotalFnftsMinted.d.ts +0 -7
- package/_types/actions/fractionalNft/getTotalFnftsMinted.d.ts.map +0 -1
- package/_types/actions/fractionalNft/getWildcardCollectionId.d.ts.map +0 -1
- package/_types/actions/fractionalNft/getWildcardDistributionMap.d.ts.map +0 -1
- package/_types/actions/fractionalNft/getWildcardThreshold.d.ts.map +0 -1
- package/_types/actions/fractionalNft/index.d.ts.map +0 -1
- package/_types/actions/fractionalNft/types.d.ts +0 -10
- package/_types/actions/fractionalNft/types.d.ts.map +0 -1
- package/_types/actions/rewardPool/getCollectionIds.d.ts +0 -7
- package/_types/actions/rewardPool/getCollectionIds.d.ts.map +0 -1
- package/_types/actions/rewardPool/getItemIds.d.ts +0 -8
- package/_types/actions/rewardPool/getItemIds.d.ts.map +0 -1
- package/_types/crypto/claimHash.d.ts +0 -23
- package/_types/crypto/claimHash.d.ts.map +0 -1
- package/_types/plugins/fractionalNft.d.ts.map +0 -1
- /package/_cjs/actions/{fractionalNft → puzzlePieces}/getCollectionsCount.d.cts +0 -0
- /package/_cjs/actions/{fractionalNft → puzzlePieces}/getItemsCount.d.cts +0 -0
- /package/_cjs/actions/{fractionalNft → puzzlePieces}/getOwner.d.cts +0 -0
- /package/_cjs/actions/{fractionalNft → puzzlePieces}/getWildcardCollectionId.d.cts +0 -0
- /package/_cjs/actions/{fractionalNft → puzzlePieces}/getWildcardDistributionMap.d.cts +0 -0
- /package/_cjs/actions/{fractionalNft → puzzlePieces}/getWildcardThreshold.d.cts +0 -0
- /package/_cjs/actions/{fractionalNft → puzzlePieces}/types.js +0 -0
- /package/_esm/actions/{fractionalNft → puzzlePieces}/types.js +0 -0
- /package/_types/actions/{fractionalNft → puzzlePieces}/getCollectionsCount.d.ts +0 -0
- /package/_types/actions/{fractionalNft → puzzlePieces}/getItemsCount.d.ts +0 -0
- /package/_types/actions/{fractionalNft → puzzlePieces}/getOwner.d.ts +0 -0
- /package/_types/actions/{fractionalNft → puzzlePieces}/getWildcardCollectionId.d.ts +0 -0
- /package/_types/actions/{fractionalNft → puzzlePieces}/getWildcardDistributionMap.d.ts +0 -0
- /package/_types/actions/{fractionalNft → puzzlePieces}/getWildcardThreshold.d.ts +0 -0
package/README.md
CHANGED
|
@@ -57,21 +57,36 @@ to the actions, so the three cannot diverge.
|
|
|
57
57
|
Use `createClientFromApi` instead of `createClient` when you already manage your own
|
|
58
58
|
`ApiPromise`.
|
|
59
59
|
|
|
60
|
+
## Node compatibility
|
|
61
|
+
|
|
62
|
+
`createClient` checks the node when it connects: the runtime name, the arguments of every
|
|
63
|
+
call the actions build, and every custom RPC. A mismatch logs one warning that lists each
|
|
64
|
+
problem.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
await createClient({ url, compatibility: 'strict' }); // throw IncompatibleNodeError instead
|
|
68
|
+
await createClient({ url, compatibility: 'off' }); // skip the check
|
|
69
|
+
checkCompatibility(api); // the same check on your own ApiPromise; [] when it matches
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The check cannot see a reordered or retyped RPC parameter or a changed RPC result: the node
|
|
73
|
+
does not publish those.
|
|
74
|
+
|
|
60
75
|
## Coverage
|
|
61
76
|
|
|
62
|
-
All
|
|
77
|
+
All 55 custom RPC methods, across the chain's nine RPC-exposing pallets, plus the DID
|
|
63
78
|
and attestation extrinsics.
|
|
64
79
|
|
|
65
80
|
| Pallet | Methods | Plugin |
|
|
66
81
|
| ---------------------- | ------- | ---------------------------- |
|
|
67
82
|
| potential | 11 | `potentialPlugin` |
|
|
68
83
|
| activity-tracker | 8 | `activityTrackerPlugin` |
|
|
69
|
-
|
|
|
84
|
+
| puzzle-pieces | 8 | `puzzlePiecesPlugin` |
|
|
70
85
|
| validator-manager | 8 | `validatorManagerPlugin` |
|
|
71
86
|
| referral | 7 | `referralPlugin` |
|
|
72
87
|
| handshake | 5 | `handshakePlugin` |
|
|
73
88
|
| reputation-voting | 4 | `reputationVotingPlugin` |
|
|
74
|
-
| reward-pool |
|
|
89
|
+
| reward-pool | 2 | `rewardPoolPlugin` |
|
|
75
90
|
| tech-committee-manager | 2 | `techCommitteeManagerPlugin` |
|
|
76
91
|
|
|
77
92
|
Each plugin is optional. Import the bare actions instead and you pay only for what you
|
|
@@ -80,17 +95,13 @@ pass them yourself if you build the `ApiPromise`.
|
|
|
80
95
|
|
|
81
96
|
## DID and attestation
|
|
82
97
|
|
|
83
|
-
An attestation records that a provider
|
|
84
|
-
stores
|
|
98
|
+
An attestation records that a provider verified a claim of one CType for a subject. The
|
|
99
|
+
chain keys it by subject and CType hash and stores nothing derived from the claim's
|
|
100
|
+
value, not even a hash: the provider checks the value off chain, and anyone who needs
|
|
101
|
+
the value gets it from the provider.
|
|
85
102
|
|
|
86
103
|
```ts
|
|
87
|
-
import {
|
|
88
|
-
account,
|
|
89
|
-
deriveClaimHash,
|
|
90
|
-
didUri,
|
|
91
|
-
REGISTERED_CTYPES,
|
|
92
|
-
submitAndWait,
|
|
93
|
-
} from '@totochain/client';
|
|
104
|
+
import { account, REGISTERED_CTYPES, submitAndWait } from '@totochain/client';
|
|
94
105
|
import { attest, createDid } from '@totochain/client/actions';
|
|
95
106
|
|
|
96
107
|
const provider = account('AttestationProvider');
|
|
@@ -100,23 +111,34 @@ await submitAndWait(client, { extrinsic: createDid(client), signer: subject });
|
|
|
100
111
|
|
|
101
112
|
const email = REGISTERED_CTYPES.find((c) => c.title === 'Email' && !c.deprecated)!;
|
|
102
113
|
|
|
103
|
-
// The key must be the property the CType declares — it is part of the hash preimage.
|
|
104
|
-
const claimHash = deriveClaimHash({
|
|
105
|
-
ctypeHash: email.hash,
|
|
106
|
-
subject: didUri(subject.address),
|
|
107
|
-
contents: { email: 'alice@example.com' },
|
|
108
|
-
});
|
|
109
|
-
|
|
110
114
|
await submitAndWait(client, {
|
|
111
|
-
extrinsic: attest(client, {
|
|
112
|
-
claimHash,
|
|
113
|
-
ctypeHash: email.hash,
|
|
114
|
-
subject: subject.address,
|
|
115
|
-
}),
|
|
115
|
+
extrinsic: attest(client, { subject: subject.address, ctypeHash: email.hash }),
|
|
116
116
|
signer: provider,
|
|
117
117
|
});
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
+
`revokeAttestation` and `removeAttestation` also take the `issuanceId` of the attestation
|
|
121
|
+
they mean to act on. The chain never reuses an issuance id, so a stale or retried call
|
|
122
|
+
fails with `IssuanceMismatch` rather than reach a later re-attestation of the same
|
|
123
|
+
subject and CType:
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
import { removeAttestation } from '@totochain/client/actions';
|
|
127
|
+
|
|
128
|
+
const record = await client.api.query.attestation.attestations(subject.address, email.hash);
|
|
129
|
+
if (record.isSome) {
|
|
130
|
+
const { issuanceId } = record.unwrap();
|
|
131
|
+
await submitAndWait(client, {
|
|
132
|
+
extrinsic: removeAttestation(client, {
|
|
133
|
+
subject: subject.address,
|
|
134
|
+
ctypeHash: email.hash,
|
|
135
|
+
issuanceId: issuanceId.toBigInt(),
|
|
136
|
+
}),
|
|
137
|
+
signer: provider,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
120
142
|
`submitAndWait` resolves once the extrinsic is in a block and succeeded, rejecting on
|
|
121
143
|
a module error, on a status that means it will never be included, on a failed call
|
|
122
144
|
inside a `utility.batch`, and on the provider dropping the subscription. It takes a
|
|
@@ -147,10 +169,12 @@ try {
|
|
|
147
169
|
}
|
|
148
170
|
```
|
|
149
171
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
172
|
+
`ctypeHash` is consensus-relevant. It reproduces all 11 registered CTypes, and the CType
|
|
173
|
+
hash is half of an attestation's key, so a change to it makes every previously issued
|
|
174
|
+
attestation unfindable. `REGISTERED_CTYPES` carries the registered schemas, deprecated
|
|
175
|
+
ones included, so old attestations resolve. Read one back with
|
|
176
|
+
`client.api.query.attestation.attestations(subject, ctypeHash)`, an `Option` of
|
|
177
|
+
`{ attester, revoked, createdAt, issuanceId }`.
|
|
154
178
|
|
|
155
179
|
## Pagination
|
|
156
180
|
|
|
@@ -30,7 +30,10 @@ function toSubstrateSigner(api, signer) {
|
|
|
30
30
|
const extrinsic = api.registry.createType('ExtrinsicPayload', payload, {
|
|
31
31
|
version: payload.version,
|
|
32
32
|
});
|
|
33
|
-
|
|
33
|
+
// A payload longer than 256 bytes is signed as its blake2_256 hash, which is what the
|
|
34
|
+
// chain checks the signature against.
|
|
35
|
+
const encoded = extrinsic.toU8a({ method: true });
|
|
36
|
+
const digest = (0, util_crypto_1.keccakAsU8a)(encoded.length > 256 ? (0, util_crypto_1.blake2AsU8a)(encoded) : encoded);
|
|
34
37
|
return { id: 0, signature: (0, util_1.u8aToHex)(normalise(await signer.signDigest(digest))) };
|
|
35
38
|
},
|
|
36
39
|
async signRaw(raw) {
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import type { Client } from '../../client/types.cjs';
|
|
2
2
|
import type { Address, Hash } from '../../types/index.cjs';
|
|
3
3
|
import type { Extrinsic } from '../did/createDid.cjs';
|
|
4
|
+
/** The pair that identifies an attestation: the chain holds at most one per subject and CType. */
|
|
4
5
|
export interface AttestParameters {
|
|
5
|
-
claimHash: Hash;
|
|
6
|
-
ctypeHash: Hash;
|
|
7
6
|
subject: Address;
|
|
7
|
+
ctypeHash: Hash;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* One issuance of an attestation. The chain never reuses an issuance id, so revoking or removing
|
|
11
|
+
* by it cannot reach a later re-attestation of the same subject and CType: the call fails with
|
|
12
|
+
* `IssuanceMismatch` instead. Read the id from `api.query.attestation.attestations(subject,
|
|
13
|
+
* ctypeHash)` (`issuanceId`) or from the `AttestationCreated` event.
|
|
14
|
+
*/
|
|
15
|
+
export interface AttestationIssuanceParameters extends AttestParameters {
|
|
16
|
+
issuanceId: bigint;
|
|
8
17
|
}
|
|
9
|
-
export declare function attest(client: Client, {
|
|
10
|
-
export declare function revokeAttestation(client: Client, {
|
|
11
|
-
|
|
12
|
-
}): Extrinsic;
|
|
13
|
-
export declare function removeAttestation(client: Client, { claimHash }: {
|
|
14
|
-
claimHash: Hash;
|
|
15
|
-
}): Extrinsic;
|
|
18
|
+
export declare function attest(client: Client, { subject, ctypeHash }: AttestParameters): Extrinsic;
|
|
19
|
+
export declare function revokeAttestation(client: Client, { subject, ctypeHash, issuanceId }: AttestationIssuanceParameters): Extrinsic;
|
|
20
|
+
export declare function removeAttestation(client: Client, { subject, ctypeHash, issuanceId }: AttestationIssuanceParameters): Extrinsic;
|
|
16
21
|
//# sourceMappingURL=attest.d.ts.map
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.attest = attest;
|
|
4
4
|
exports.revokeAttestation = revokeAttestation;
|
|
5
5
|
exports.removeAttestation = removeAttestation;
|
|
6
|
-
function attest(client, {
|
|
7
|
-
return client.api.tx['attestation']['add'](
|
|
6
|
+
function attest(client, { subject, ctypeHash }) {
|
|
7
|
+
return client.api.tx['attestation']['add'](subject, ctypeHash);
|
|
8
8
|
}
|
|
9
|
-
function revokeAttestation(client, {
|
|
10
|
-
return client.api.tx['attestation']['revoke'](
|
|
9
|
+
function revokeAttestation(client, { subject, ctypeHash, issuanceId }) {
|
|
10
|
+
return client.api.tx['attestation']['revoke'](subject, ctypeHash, issuanceId);
|
|
11
11
|
}
|
|
12
|
-
function removeAttestation(client, {
|
|
13
|
-
return client.api.tx['attestation']['remove'](
|
|
12
|
+
function removeAttestation(client, { subject, ctypeHash, issuanceId }) {
|
|
13
|
+
return client.api.tx['attestation']['remove'](subject, ctypeHash, issuanceId);
|
|
14
14
|
}
|
package/_cjs/actions/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from './activityTracker/index.cjs';
|
|
2
2
|
export * from './attestation/index.cjs';
|
|
3
3
|
export * from './did/index.cjs';
|
|
4
|
-
export * from './fractionalNft/index.cjs';
|
|
5
4
|
export * from './handshake/index.cjs';
|
|
6
5
|
export * from './potential/index.cjs';
|
|
6
|
+
export * from './puzzlePieces/index.cjs';
|
|
7
7
|
export * from './referral/index.cjs';
|
|
8
8
|
export * from './reputationVoting/index.cjs';
|
|
9
9
|
export * from './rewardPool/index.cjs';
|
package/_cjs/actions/index.js
CHANGED
|
@@ -18,9 +18,9 @@ exports.submitAndWait = exports.SubscriptionFailedError = exports.SubmitTimeoutE
|
|
|
18
18
|
__exportStar(require("./activityTracker/index.js"), exports);
|
|
19
19
|
__exportStar(require("./attestation/index.js"), exports);
|
|
20
20
|
__exportStar(require("./did/index.js"), exports);
|
|
21
|
-
__exportStar(require("./fractionalNft/index.js"), exports);
|
|
22
21
|
__exportStar(require("./handshake/index.js"), exports);
|
|
23
22
|
__exportStar(require("./potential/index.js"), exports);
|
|
23
|
+
__exportStar(require("./puzzlePieces/index.js"), exports);
|
|
24
24
|
__exportStar(require("./referral/index.js"), exports);
|
|
25
25
|
__exportStar(require("./reputationVoting/index.js"), exports);
|
|
26
26
|
__exportStar(require("./rewardPool/index.js"), exports);
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getCollectionsCount = getCollectionsCount;
|
|
4
4
|
const call_js_1 = require("../../rpc/call.js");
|
|
5
5
|
async function getCollectionsCount(client, { at } = {}) {
|
|
6
|
-
const result = await (0, call_js_1.callRpc)(client, '
|
|
6
|
+
const result = await (0, call_js_1.callRpc)(client, 'puzzlePieces', 'collectionsCount', at);
|
|
7
7
|
return result.toNumber();
|
|
8
8
|
}
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getItemsCount = getItemsCount;
|
|
4
4
|
const call_js_1 = require("../../rpc/call.js");
|
|
5
5
|
async function getItemsCount(client, { collectionId, at }) {
|
|
6
|
-
const result = await (0, call_js_1.callRpc)(client, '
|
|
6
|
+
const result = await (0, call_js_1.callRpc)(client, 'puzzlePieces', 'itemsCount', collectionId, at);
|
|
7
7
|
return result.toNumber();
|
|
8
8
|
}
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getOwner = getOwner;
|
|
4
4
|
const call_js_1 = require("../../rpc/call.js");
|
|
5
5
|
async function getOwner(client, { collectionId, itemId, at }) {
|
|
6
|
-
const result = await (0, call_js_1.callRpc)(client, '
|
|
6
|
+
const result = await (0, call_js_1.callRpc)(client, 'puzzlePieces', 'owner', collectionId, itemId, at);
|
|
7
7
|
return result.isSome ? result.unwrap().toString() : null;
|
|
8
8
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.cjs';
|
|
2
|
+
import type { BlockHash } from '../../types/index.cjs';
|
|
3
|
+
export interface GetPendingWildcardsParameters {
|
|
4
|
+
at?: BlockHash;
|
|
5
|
+
}
|
|
6
|
+
/** Wildcards owed but not yet minted into the distribution map. */
|
|
7
|
+
export declare function getPendingWildcards(client: Client, { at }?: GetPendingWildcardsParameters): Promise<number>;
|
|
8
|
+
//# sourceMappingURL=getPendingWildcards.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPendingWildcards = getPendingWildcards;
|
|
4
|
+
const call_js_1 = require("../../rpc/call.js");
|
|
5
|
+
/** Wildcards owed but not yet minted into the distribution map. */
|
|
6
|
+
async function getPendingWildcards(client, { at } = {}) {
|
|
7
|
+
const result = await (0, call_js_1.callRpc)(client, 'puzzlePieces', 'pendingWildcards', at);
|
|
8
|
+
return result.toNumber();
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.cjs';
|
|
2
|
+
import type { BlockHash } from '../../types/index.cjs';
|
|
3
|
+
export interface GetTotalPuzzlePiecesMintedParameters {
|
|
4
|
+
at?: BlockHash;
|
|
5
|
+
}
|
|
6
|
+
export declare function getTotalPuzzlePiecesMinted(client: Client, { at }?: GetTotalPuzzlePiecesMintedParameters): Promise<number | null>;
|
|
7
|
+
//# sourceMappingURL=getTotalPuzzlePiecesMinted.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTotalPuzzlePiecesMinted = getTotalPuzzlePiecesMinted;
|
|
4
|
+
const call_js_1 = require("../../rpc/call.js");
|
|
5
|
+
async function getTotalPuzzlePiecesMinted(client, { at } = {}) {
|
|
6
|
+
const result = await (0, call_js_1.callRpc)(client, 'puzzlePieces', 'totalPuzzlePiecesMinted', at);
|
|
7
|
+
return result.isSome ? result.unwrap().toNumber() : null;
|
|
8
|
+
}
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getWildcardCollectionId = getWildcardCollectionId;
|
|
4
4
|
const call_js_1 = require("../../rpc/call.js");
|
|
5
5
|
async function getWildcardCollectionId(client, { at } = {}) {
|
|
6
|
-
const result = await (0, call_js_1.callRpc)(client, '
|
|
6
|
+
const result = await (0, call_js_1.callRpc)(client, 'puzzlePieces', 'wildcardCollectionId', at);
|
|
7
7
|
return result.isSome ? result.unwrap().toNumber() : null;
|
|
8
8
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getWildcardDistributionMap = getWildcardDistributionMap;
|
|
4
4
|
const call_js_1 = require("../../rpc/call.js");
|
|
5
5
|
async function getWildcardDistributionMap(client, { at } = {}) {
|
|
6
|
-
const result = await (0, call_js_1.callRpc)(client, '
|
|
6
|
+
const result = await (0, call_js_1.callRpc)(client, 'puzzlePieces', 'wildcardDistributionMap', at);
|
|
7
7
|
const pairs = result.toJSON();
|
|
8
8
|
return pairs.map(([blockNumber, itemId]) => ({ blockNumber, itemId }));
|
|
9
9
|
}
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getWildcardThreshold = getWildcardThreshold;
|
|
4
4
|
const call_js_1 = require("../../rpc/call.js");
|
|
5
5
|
async function getWildcardThreshold(client, { at } = {}) {
|
|
6
|
-
const result = await (0, call_js_1.callRpc)(client, '
|
|
6
|
+
const result = await (0, call_js_1.callRpc)(client, 'puzzlePieces', 'wildcardThreshold', at);
|
|
7
7
|
return result.isSome ? result.unwrap().toNumber() : null;
|
|
8
8
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export { getCollectionsCount } from './getCollectionsCount.cjs';
|
|
2
2
|
export { getItemsCount } from './getItemsCount.cjs';
|
|
3
|
-
export { getNftInfo } from './getNftInfo.cjs';
|
|
4
3
|
export { getOwner } from './getOwner.cjs';
|
|
5
|
-
export {
|
|
4
|
+
export { getPendingWildcards } from './getPendingWildcards.cjs';
|
|
5
|
+
export { getTotalPuzzlePiecesMinted } from './getTotalPuzzlePiecesMinted.cjs';
|
|
6
6
|
export { getWildcardCollectionId } from './getWildcardCollectionId.cjs';
|
|
7
7
|
export { getWildcardDistributionMap } from './getWildcardDistributionMap.cjs';
|
|
8
8
|
export { getWildcardThreshold } from './getWildcardThreshold.cjs';
|
|
9
|
-
export type {
|
|
9
|
+
export type { WildcardDistribution } from './types.cjs';
|
|
10
10
|
export type { GetCollectionsCountParameters } from './getCollectionsCount.cjs';
|
|
11
11
|
export type { GetItemsCountParameters } from './getItemsCount.cjs';
|
|
12
|
-
export type { GetNftInfoParameters } from './getNftInfo.cjs';
|
|
13
12
|
export type { GetOwnerParameters } from './getOwner.cjs';
|
|
14
|
-
export type {
|
|
13
|
+
export type { GetPendingWildcardsParameters } from './getPendingWildcards.cjs';
|
|
14
|
+
export type { GetTotalPuzzlePiecesMintedParameters } from './getTotalPuzzlePiecesMinted.cjs';
|
|
15
15
|
export type { GetWildcardCollectionIdParameters } from './getWildcardCollectionId.cjs';
|
|
16
16
|
export type { GetWildcardDistributionMapParameters } from './getWildcardDistributionMap.cjs';
|
|
17
17
|
export type { GetWildcardThresholdParameters } from './getWildcardThreshold.cjs';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWildcardThreshold = exports.getWildcardDistributionMap = exports.getWildcardCollectionId = exports.
|
|
3
|
+
exports.getWildcardThreshold = exports.getWildcardDistributionMap = exports.getWildcardCollectionId = exports.getTotalPuzzlePiecesMinted = exports.getPendingWildcards = exports.getOwner = exports.getItemsCount = exports.getCollectionsCount = void 0;
|
|
4
4
|
var getCollectionsCount_js_1 = require("./getCollectionsCount.js");
|
|
5
5
|
Object.defineProperty(exports, "getCollectionsCount", { enumerable: true, get: function () { return getCollectionsCount_js_1.getCollectionsCount; } });
|
|
6
6
|
var getItemsCount_js_1 = require("./getItemsCount.js");
|
|
7
7
|
Object.defineProperty(exports, "getItemsCount", { enumerable: true, get: function () { return getItemsCount_js_1.getItemsCount; } });
|
|
8
|
-
var getNftInfo_js_1 = require("./getNftInfo.js");
|
|
9
|
-
Object.defineProperty(exports, "getNftInfo", { enumerable: true, get: function () { return getNftInfo_js_1.getNftInfo; } });
|
|
10
8
|
var getOwner_js_1 = require("./getOwner.js");
|
|
11
9
|
Object.defineProperty(exports, "getOwner", { enumerable: true, get: function () { return getOwner_js_1.getOwner; } });
|
|
12
|
-
var
|
|
13
|
-
Object.defineProperty(exports, "
|
|
10
|
+
var getPendingWildcards_js_1 = require("./getPendingWildcards.js");
|
|
11
|
+
Object.defineProperty(exports, "getPendingWildcards", { enumerable: true, get: function () { return getPendingWildcards_js_1.getPendingWildcards; } });
|
|
12
|
+
var getTotalPuzzlePiecesMinted_js_1 = require("./getTotalPuzzlePiecesMinted.js");
|
|
13
|
+
Object.defineProperty(exports, "getTotalPuzzlePiecesMinted", { enumerable: true, get: function () { return getTotalPuzzlePiecesMinted_js_1.getTotalPuzzlePiecesMinted; } });
|
|
14
14
|
var getWildcardCollectionId_js_1 = require("./getWildcardCollectionId.js");
|
|
15
15
|
Object.defineProperty(exports, "getWildcardCollectionId", { enumerable: true, get: function () { return getWildcardCollectionId_js_1.getWildcardCollectionId; } });
|
|
16
16
|
var getWildcardDistributionMap_js_1 = require("./getWildcardDistributionMap.js");
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
export { getCollectionIds } from './getCollectionIds.cjs';
|
|
2
|
-
export { getItemIds } from './getItemIds.cjs';
|
|
3
1
|
export { getRewardPoolAccount } from './getRewardPoolAccount.cjs';
|
|
4
2
|
export { getRewardPoolBalance } from './getRewardPoolBalance.cjs';
|
|
5
|
-
export type { GetCollectionIdsParameters } from './getCollectionIds.cjs';
|
|
6
|
-
export type { GetItemIdsParameters } from './getItemIds.cjs';
|
|
7
3
|
export type { GetRewardPoolAccountParameters } from './getRewardPoolAccount.cjs';
|
|
8
4
|
export type { GetRewardPoolBalanceParameters } from './getRewardPoolBalance.cjs';
|
|
9
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRewardPoolBalance = exports.getRewardPoolAccount =
|
|
4
|
-
var getCollectionIds_js_1 = require("./getCollectionIds.js");
|
|
5
|
-
Object.defineProperty(exports, "getCollectionIds", { enumerable: true, get: function () { return getCollectionIds_js_1.getCollectionIds; } });
|
|
6
|
-
var getItemIds_js_1 = require("./getItemIds.js");
|
|
7
|
-
Object.defineProperty(exports, "getItemIds", { enumerable: true, get: function () { return getItemIds_js_1.getItemIds; } });
|
|
3
|
+
exports.getRewardPoolBalance = exports.getRewardPoolAccount = void 0;
|
|
8
4
|
var getRewardPoolAccount_js_1 = require("./getRewardPoolAccount.js");
|
|
9
5
|
Object.defineProperty(exports, "getRewardPoolAccount", { enumerable: true, get: function () { return getRewardPoolAccount_js_1.getRewardPoolAccount; } });
|
|
10
6
|
var getRewardPoolBalance_js_1 = require("./getRewardPoolBalance.js");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ApiPromise } from '@polkadot/api';
|
|
2
|
+
/** The runtime this client is written against. */
|
|
3
|
+
export declare const SPEC_NAME = "totochain";
|
|
4
|
+
/** Every call an action builds, with the arguments it passes, as the node's metadata lists them. */
|
|
5
|
+
export declare const EXPECTED_CALLS: Readonly<Record<string, string>>;
|
|
6
|
+
/** Thrown by `createClient` in strict mode when the node does not match this client. */
|
|
7
|
+
export declare class IncompatibleNodeError extends Error {
|
|
8
|
+
readonly problems: readonly string[];
|
|
9
|
+
constructor(problems: readonly string[]);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Lists every way the connected node differs from what this client sends: the runtime, the
|
|
13
|
+
* calls the actions build and the custom RPCs. Empty when they match.
|
|
14
|
+
*/
|
|
15
|
+
export declare function checkCompatibility(api: ApiPromise): string[];
|
|
16
|
+
//# sourceMappingURL=compatibility.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IncompatibleNodeError = exports.EXPECTED_CALLS = exports.SPEC_NAME = void 0;
|
|
4
|
+
exports.checkCompatibility = checkCompatibility;
|
|
5
|
+
const definitions_js_1 = require("../rpc/definitions.js");
|
|
6
|
+
/** The runtime this client is written against. */
|
|
7
|
+
exports.SPEC_NAME = 'totochain';
|
|
8
|
+
/** Every call an action builds, with the arguments it passes, as the node's metadata lists them. */
|
|
9
|
+
exports.EXPECTED_CALLS = {
|
|
10
|
+
'attestation.add': 'subject: AccountId20, ctypeHash: H256',
|
|
11
|
+
'attestation.remove': 'subject: AccountId20, ctypeHash: H256, issuanceId: u64',
|
|
12
|
+
'attestation.revoke': 'subject: AccountId20, ctypeHash: H256, issuanceId: u64',
|
|
13
|
+
'did.createDidFor': 'subject: AccountId20',
|
|
14
|
+
'did.createFromAccount': '',
|
|
15
|
+
};
|
|
16
|
+
/** Thrown by `createClient` in strict mode when the node does not match this client. */
|
|
17
|
+
class IncompatibleNodeError extends Error {
|
|
18
|
+
problems;
|
|
19
|
+
constructor(problems) {
|
|
20
|
+
super(`The node does not match @totochain/client:\n- ${problems.join('\n- ')}`);
|
|
21
|
+
this.name = 'IncompatibleNodeError';
|
|
22
|
+
this.problems = problems;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.IncompatibleNodeError = IncompatibleNodeError;
|
|
26
|
+
/**
|
|
27
|
+
* Lists every way the connected node differs from what this client sends: the runtime, the
|
|
28
|
+
* calls the actions build and the custom RPCs. Empty when they match.
|
|
29
|
+
*/
|
|
30
|
+
function checkCompatibility(api) {
|
|
31
|
+
const problems = [];
|
|
32
|
+
const specName = api.runtimeVersion.specName.toString();
|
|
33
|
+
if (specName !== exports.SPEC_NAME) {
|
|
34
|
+
problems.push(`runtime is ${specName}, expected ${exports.SPEC_NAME}`);
|
|
35
|
+
}
|
|
36
|
+
for (const [call, expected] of Object.entries(exports.EXPECTED_CALLS)) {
|
|
37
|
+
const [section, method] = call.split('.');
|
|
38
|
+
const fn = api.tx[section]?.[method];
|
|
39
|
+
if (!fn) {
|
|
40
|
+
problems.push(`call ${call} is missing`);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const actual = fn.meta.args
|
|
44
|
+
.map((arg) => `${arg.name.toString()}: ${arg.type.toString()}`)
|
|
45
|
+
.join(', ');
|
|
46
|
+
if (actual !== expected) {
|
|
47
|
+
problems.push(`call ${call} takes (${actual}), the client sends (${expected})`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// polkadot-js removes every RPC the node does not list in `rpc_methods`.
|
|
51
|
+
const rpc = api.rpc;
|
|
52
|
+
for (const [section, methods] of Object.entries(definitions_js_1.RPC_DEFINITIONS)) {
|
|
53
|
+
for (const method of Object.keys(methods)) {
|
|
54
|
+
if (typeof rpc[section]?.[method] !== 'function') {
|
|
55
|
+
problems.push(`RPC ${section}_${method} is missing`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return problems;
|
|
60
|
+
}
|
|
@@ -3,6 +3,8 @@ import type { Client, Plugin } from './types.cjs';
|
|
|
3
3
|
export interface CreateClientOptions {
|
|
4
4
|
url: string;
|
|
5
5
|
timeoutMs?: number;
|
|
6
|
+
/** When the node does not match this client: log a warning (default), throw, or skip the check. */
|
|
7
|
+
compatibility?: 'warn' | 'strict' | 'off';
|
|
6
8
|
}
|
|
7
9
|
export declare function createClientFromApi(api: ApiPromise): Client;
|
|
8
10
|
export declare function createClient(options: CreateClientOptions): Promise<Client>;
|
|
@@ -5,6 +5,7 @@ exports.createClient = createClient;
|
|
|
5
5
|
const api_1 = require("@polkadot/api");
|
|
6
6
|
const definitions_js_1 = require("../rpc/definitions.js");
|
|
7
7
|
const types_js_1 = require("../rpc/types.js");
|
|
8
|
+
const compatibility_js_1 = require("./compatibility.js");
|
|
8
9
|
function createClientFromApi(api) {
|
|
9
10
|
const client = {
|
|
10
11
|
api,
|
|
@@ -21,5 +22,15 @@ async function createClient(options) {
|
|
|
21
22
|
rpc: definitions_js_1.RPC_DEFINITIONS,
|
|
22
23
|
types: types_js_1.CHAIN_TYPES,
|
|
23
24
|
});
|
|
25
|
+
const mode = options.compatibility ?? 'warn';
|
|
26
|
+
const problems = mode === 'off' ? [] : (0, compatibility_js_1.checkCompatibility)(api);
|
|
27
|
+
if (problems.length > 0) {
|
|
28
|
+
const error = new compatibility_js_1.IncompatibleNodeError(problems);
|
|
29
|
+
if (mode === 'strict') {
|
|
30
|
+
await api.disconnect();
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
console.warn(error.message);
|
|
34
|
+
}
|
|
24
35
|
return createClientFromApi(api);
|
|
25
36
|
}
|
package/_cjs/crypto/index.d.cts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
export { canonicalCTypeBytes, ctypeHash } from './ctypeHash.cjs';
|
|
2
|
-
export { deriveClaimHash, didUri } from './claimHash.cjs';
|
|
3
2
|
export type { CTypeSchema } from './ctypeHash.cjs';
|
|
4
|
-
export type { DeriveClaimHashParameters, DidUri } from './claimHash.cjs';
|
|
5
3
|
//# sourceMappingURL=index.d.ts.map
|
package/_cjs/crypto/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ctypeHash = exports.canonicalCTypeBytes = void 0;
|
|
4
4
|
var ctypeHash_js_1 = require("./ctypeHash.js");
|
|
5
5
|
Object.defineProperty(exports, "canonicalCTypeBytes", { enumerable: true, get: function () { return ctypeHash_js_1.canonicalCTypeBytes; } });
|
|
6
6
|
Object.defineProperty(exports, "ctypeHash", { enumerable: true, get: function () { return ctypeHash_js_1.ctypeHash; } });
|
|
7
|
-
var claimHash_js_1 = require("./claimHash.js");
|
|
8
|
-
Object.defineProperty(exports, "deriveClaimHash", { enumerable: true, get: function () { return claimHash_js_1.deriveClaimHash; } });
|
|
9
|
-
Object.defineProperty(exports, "didUri", { enumerable: true, get: function () { return claimHash_js_1.didUri; } });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type DidUri = `did:toto:${string}`;
|
|
2
|
+
/**
|
|
3
|
+
* Renders an address as its DID URI: `did:toto:` followed by the address without its `0x`.
|
|
4
|
+
*
|
|
5
|
+
* The address is passed through verbatim, case included. Nothing hashes the string and the chain
|
|
6
|
+
* never sees it — the DID and attestation pallets identify the account by its typed H160 — so the
|
|
7
|
+
* case carries no meaning, and two URIs for one account can differ in case alone. Lowercase the
|
|
8
|
+
* address first if you compare URIs as strings; `pallet_did::did_uri` renders lowercase.
|
|
9
|
+
*/
|
|
10
|
+
export declare function didUri(address: `0x${string}`): DidUri;
|
|
11
|
+
//# sourceMappingURL=didUri.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.didUri = didUri;
|
|
4
|
+
/**
|
|
5
|
+
* Renders an address as its DID URI: `did:toto:` followed by the address without its `0x`.
|
|
6
|
+
*
|
|
7
|
+
* The address is passed through verbatim, case included. Nothing hashes the string and the chain
|
|
8
|
+
* never sees it — the DID and attestation pallets identify the account by its typed H160 — so the
|
|
9
|
+
* case carries no meaning, and two URIs for one account can differ in case alone. Lowercase the
|
|
10
|
+
* address first if you compare URIs as strings; `pallet_did::did_uri` renders lowercase.
|
|
11
|
+
*/
|
|
12
|
+
function didUri(address) {
|
|
13
|
+
return `did:toto:${address.slice(2)}`;
|
|
14
|
+
}
|
package/_cjs/index.d.cts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
export { createClient, createClientFromApi } from './client/createClient.cjs';
|
|
2
2
|
export type { CreateClientOptions } from './client/createClient.cjs';
|
|
3
|
+
export { checkCompatibility, EXPECTED_CALLS, IncompatibleNodeError, SPEC_NAME, } from './client/compatibility.cjs';
|
|
3
4
|
export type { Client, Plugin } from './client/types.cjs';
|
|
4
|
-
export { activityTrackerPlugin,
|
|
5
|
-
export type { ActivityTrackerCapability,
|
|
5
|
+
export { activityTrackerPlugin, handshakePlugin, potentialPlugin, puzzlePiecesPlugin, referralPlugin, reputationVotingPlugin, rewardPoolPlugin, techCommitteeManagerPlugin, validatorManagerPlugin, } from './plugins/index.cjs';
|
|
6
|
+
export type { ActivityTrackerCapability, HandshakeCapability, PotentialCapability, PuzzlePiecesCapability, ReferralCapability, ReputationVotingCapability, RewardPoolCapability, TechCommitteeManagerCapability, ValidatorManagerCapability, } from './plugins/index.cjs';
|
|
6
7
|
export { RPC_DEFINITIONS } from './rpc/definitions.cjs';
|
|
7
8
|
export { CHAIN_TYPES } from './rpc/types.cjs';
|
|
8
9
|
export { TOTOCHAIN_DEFINITIONS, typesBundle } from './rpc/bundle.cjs';
|
|
9
10
|
export type { Address, BlockHash, Pagination, PaginatedResponse } from './types/index.cjs';
|
|
10
11
|
export { DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE } from './types/index.cjs';
|
|
11
|
-
export { canonicalCTypeBytes, ctypeHash
|
|
12
|
-
export type { CTypeSchema
|
|
12
|
+
export { canonicalCTypeBytes, ctypeHash } from './crypto/index.cjs';
|
|
13
|
+
export type { CTypeSchema } from './crypto/index.cjs';
|
|
14
|
+
export { didUri } from './did/didUri.cjs';
|
|
15
|
+
export type { DidUri } from './did/didUri.cjs';
|
|
13
16
|
export { REGISTERED_CTYPES } from './ctypes/index.cjs';
|
|
14
17
|
export type { RegisteredCType } from './ctypes/index.cjs';
|
|
15
18
|
export { DispatchFailedError, isDispatchFailure, NotIncludedError, SubmitTimeoutError, SubscriptionFailedError, submitAndWait, } from './actions/submitAndWait.cjs';
|
package/_cjs/index.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WELL_KNOWN_ACCOUNTS = exports.VALIDATOR_ACCOUNTS = exports.DEV_ACCOUNTS = exports.toSubstrateSigner = exports.stash = exports.isValidAddress = exports.generateMnemonic = exports.generateAccount = exports.fromPrivateKey = exports.fromMnemonic = exports.deriveAddress = exports.createKeyring = exports.addressOf = exports.account = exports.defineChain = exports.totochainTestnet = exports.totochainLocal = exports.totochainDev = exports.totochain = exports.submitAndWait = exports.SubscriptionFailedError = exports.SubmitTimeoutError = exports.NotIncludedError = exports.isDispatchFailure = exports.DispatchFailedError = exports.REGISTERED_CTYPES = exports.didUri = exports.
|
|
3
|
+
exports.WELL_KNOWN_ACCOUNTS = exports.VALIDATOR_ACCOUNTS = exports.DEV_ACCOUNTS = exports.toSubstrateSigner = exports.stash = exports.isValidAddress = exports.generateMnemonic = exports.generateAccount = exports.fromPrivateKey = exports.fromMnemonic = exports.deriveAddress = exports.createKeyring = exports.addressOf = exports.account = exports.defineChain = exports.totochainTestnet = exports.totochainLocal = exports.totochainDev = exports.totochain = exports.submitAndWait = exports.SubscriptionFailedError = exports.SubmitTimeoutError = exports.NotIncludedError = exports.isDispatchFailure = exports.DispatchFailedError = exports.REGISTERED_CTYPES = exports.didUri = exports.ctypeHash = exports.canonicalCTypeBytes = exports.MAX_PAGE_SIZE = exports.DEFAULT_PAGE_SIZE = exports.typesBundle = exports.TOTOCHAIN_DEFINITIONS = exports.CHAIN_TYPES = exports.RPC_DEFINITIONS = exports.validatorManagerPlugin = exports.techCommitteeManagerPlugin = exports.rewardPoolPlugin = exports.reputationVotingPlugin = exports.referralPlugin = exports.puzzlePiecesPlugin = exports.potentialPlugin = exports.handshakePlugin = exports.activityTrackerPlugin = exports.SPEC_NAME = exports.IncompatibleNodeError = exports.EXPECTED_CALLS = exports.checkCompatibility = exports.createClientFromApi = exports.createClient = void 0;
|
|
4
4
|
var createClient_js_1 = require("./client/createClient.js");
|
|
5
5
|
Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return createClient_js_1.createClient; } });
|
|
6
6
|
Object.defineProperty(exports, "createClientFromApi", { enumerable: true, get: function () { return createClient_js_1.createClientFromApi; } });
|
|
7
|
+
var compatibility_js_1 = require("./client/compatibility.js");
|
|
8
|
+
Object.defineProperty(exports, "checkCompatibility", { enumerable: true, get: function () { return compatibility_js_1.checkCompatibility; } });
|
|
9
|
+
Object.defineProperty(exports, "EXPECTED_CALLS", { enumerable: true, get: function () { return compatibility_js_1.EXPECTED_CALLS; } });
|
|
10
|
+
Object.defineProperty(exports, "IncompatibleNodeError", { enumerable: true, get: function () { return compatibility_js_1.IncompatibleNodeError; } });
|
|
11
|
+
Object.defineProperty(exports, "SPEC_NAME", { enumerable: true, get: function () { return compatibility_js_1.SPEC_NAME; } });
|
|
7
12
|
var index_js_1 = require("./plugins/index.js");
|
|
8
13
|
Object.defineProperty(exports, "activityTrackerPlugin", { enumerable: true, get: function () { return index_js_1.activityTrackerPlugin; } });
|
|
9
|
-
Object.defineProperty(exports, "fractionalNftPlugin", { enumerable: true, get: function () { return index_js_1.fractionalNftPlugin; } });
|
|
10
14
|
Object.defineProperty(exports, "handshakePlugin", { enumerable: true, get: function () { return index_js_1.handshakePlugin; } });
|
|
11
15
|
Object.defineProperty(exports, "potentialPlugin", { enumerable: true, get: function () { return index_js_1.potentialPlugin; } });
|
|
16
|
+
Object.defineProperty(exports, "puzzlePiecesPlugin", { enumerable: true, get: function () { return index_js_1.puzzlePiecesPlugin; } });
|
|
12
17
|
Object.defineProperty(exports, "referralPlugin", { enumerable: true, get: function () { return index_js_1.referralPlugin; } });
|
|
13
18
|
Object.defineProperty(exports, "reputationVotingPlugin", { enumerable: true, get: function () { return index_js_1.reputationVotingPlugin; } });
|
|
14
19
|
Object.defineProperty(exports, "rewardPoolPlugin", { enumerable: true, get: function () { return index_js_1.rewardPoolPlugin; } });
|
|
@@ -27,8 +32,8 @@ Object.defineProperty(exports, "MAX_PAGE_SIZE", { enumerable: true, get: functio
|
|
|
27
32
|
var index_js_3 = require("./crypto/index.js");
|
|
28
33
|
Object.defineProperty(exports, "canonicalCTypeBytes", { enumerable: true, get: function () { return index_js_3.canonicalCTypeBytes; } });
|
|
29
34
|
Object.defineProperty(exports, "ctypeHash", { enumerable: true, get: function () { return index_js_3.ctypeHash; } });
|
|
30
|
-
|
|
31
|
-
Object.defineProperty(exports, "didUri", { enumerable: true, get: function () { return
|
|
35
|
+
var didUri_js_1 = require("./did/didUri.js");
|
|
36
|
+
Object.defineProperty(exports, "didUri", { enumerable: true, get: function () { return didUri_js_1.didUri; } });
|
|
32
37
|
var index_js_4 = require("./ctypes/index.js");
|
|
33
38
|
Object.defineProperty(exports, "REGISTERED_CTYPES", { enumerable: true, get: function () { return index_js_4.REGISTERED_CTYPES; } });
|
|
34
39
|
var submitAndWait_js_1 = require("./actions/submitAndWait.js");
|