@fairmint/canton-node-sdk 0.0.277 → 0.0.278
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 +69 -6
- package/build/src/utils/external-signing/index.d.ts +1 -0
- package/build/src/utils/external-signing/index.d.ts.map +1 -1
- package/build/src/utils/external-signing/index.js +1 -0
- package/build/src/utils/external-signing/index.js.map +1 -1
- package/build/src/utils/external-signing/wallet-ownership.d.ts +69 -0
- package/build/src/utils/external-signing/wallet-ownership.d.ts.map +1 -0
- package/build/src/utils/external-signing/wallet-ownership.js +179 -0
- package/build/src/utils/external-signing/wallet-ownership.js.map +1 -0
- package/build/src/wallets/cip103.d.ts +83 -5
- package/build/src/wallets/cip103.d.ts.map +1 -1
- package/build/src/wallets/cip103.js +229 -107
- package/build/src/wallets/cip103.js.map +1 -1
- package/build/src/wallets/da-utilities/client.d.ts.map +1 -1
- package/build/src/wallets/da-utilities/client.js +3 -0
- package/build/src/wallets/da-utilities/client.js.map +1 -1
- package/build/src/wallets/errors.d.ts +18 -0
- package/build/src/wallets/errors.d.ts.map +1 -1
- package/build/src/wallets/errors.js +15 -1
- package/build/src/wallets/errors.js.map +1 -1
- package/build/src/wallets/index.d.ts +9 -6
- package/build/src/wallets/index.d.ts.map +1 -1
- package/build/src/wallets/index.js +10 -3
- package/build/src/wallets/index.js.map +1 -1
- package/build/src/wallets/ownership.d.ts +79 -0
- package/build/src/wallets/ownership.d.ts.map +1 -0
- package/build/src/wallets/ownership.js +202 -0
- package/build/src/wallets/ownership.js.map +1 -0
- package/build/src/wallets/templates.d.ts +15 -0
- package/build/src/wallets/templates.d.ts.map +1 -1
- package/build/src/wallets/templates.js +33 -9
- package/build/src/wallets/templates.js.map +1 -1
- package/build/src/wallets/token-registry.d.ts +11 -0
- package/build/src/wallets/token-registry.d.ts.map +1 -1
- package/build/src/wallets/token-registry.js.map +1 -1
- package/build/src/wallets/token-standard-wallet.d.ts +47 -6
- package/build/src/wallets/token-standard-wallet.d.ts.map +1 -1
- package/build/src/wallets/token-standard-wallet.js +91 -15
- package/build/src/wallets/token-standard-wallet.js.map +1 -1
- package/build/src/wallets/token-wallet.d.ts +12 -1
- package/build/src/wallets/token-wallet.d.ts.map +1 -1
- package/build/src/wallets/token-wallet.js +40 -30
- package/build/src/wallets/token-wallet.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,15 +3,18 @@
|
|
|
3
3
|
* wallet provider. In a browser bundle import `@fairmint/canton-node-sdk/build/src/wallets/index.js`, which loads none
|
|
4
4
|
* of the SDK's Node dependencies; the package root also exports it as the `Wallets` namespace (for Node).
|
|
5
5
|
*
|
|
6
|
-
* The surface is small on purpose: plug in a CIP-0103 provider (`createTokenWallet`), the registry client, the
|
|
7
|
-
*
|
|
6
|
+
* The surface is small on purpose: plug in a CIP-0103 provider (`createTokenWallet`), the registry client, the
|
|
7
|
+
* ownership proof's client side (`proveWalletOwnership` and the message it signs; the server verifies with
|
|
8
|
+
* `verifyWalletOwnership` from the package root, which is Node-only), the read back-off options, the errors and the
|
|
9
|
+
* data types. Command builders, parsers, error-code tables and the CIP-0103 client stay internal.
|
|
8
10
|
*/
|
|
9
|
-
export { createTokenWallet, type BurnRequestOptions, type TokenWallet, type TokenWalletOptions } from './token-wallet';
|
|
10
|
-
export { createTokenStandardWallet, type TokenStandardWallet, type TokenStandardWalletOptions, type TransferOffers, type TransferOptions, type TransferRequest, type TransferResult, } from './token-standard-wallet';
|
|
11
|
-
export { primaryPartyId, type Cip103EventListener, type Cip103LedgerApiParams, type Cip103PrepareExecuteParams, type Cip103Provider, type Cip103Request, } from './cip103';
|
|
11
|
+
export { createTokenWallet, type BurnRequestOptions, type TokenWallet, type TokenWalletOptions, type TokenWalletState, } from './token-wallet';
|
|
12
|
+
export { createTokenStandardWallet, type TokenStandardState, type TokenStandardWallet, type TokenStandardWalletOptions, type TransferOffers, type TransferOptions, type TransferRequest, type TransferResult, } from './token-standard-wallet';
|
|
13
|
+
export { DEFAULT_READ_RETRY_DELAYS_MS, primaryPartyId, type Cip103Account, type Cip103EventListener, type Cip103LedgerApiParams, type Cip103PrepareExecuteParams, type Cip103Provider, type Cip103Request, type Cip103SignMessageParams, type WalletReadRetryOptions, } from './cip103';
|
|
14
|
+
export { buildWalletOwnershipMessage, proveWalletOwnership, type ProveWalletOwnershipOptions, type WalletOwnershipChallenge, type WalletOwnershipMessageFields, type WalletOwnershipProof, } from './ownership';
|
|
12
15
|
export { createDaUtilitiesClient, type BurnRequestContextArgs, type DaNetwork, type DaUtilitiesClient, type DaUtilitiesClientOptions, type DaUtilitiesTarget, type FetchLike, } from './da-utilities/client';
|
|
13
16
|
export type { ChoiceContext, ChoiceContextData, FactoryWithChoiceContext, ReadContracts, TokenRegistry, TransferFactory, TransferFactoryArgs, TransferInstructionAction, TransferKind, TransferSpec, } from './token-registry';
|
|
14
|
-
export { RegistryApiError, RegistryResponseError, TokenWalletError, WalletReadError, WalletSubmitError, type TokenWalletErrorCode, type WalletSubmitOutcome, } from './errors';
|
|
17
|
+
export { RegistryApiError, RegistryResponseError, TokenWalletError, WalletReadError, WalletSignError, WalletSubmitError, type TokenWalletErrorCode, type WalletSignErrorReason, type WalletSubmitOutcome, } from './errors';
|
|
15
18
|
export type { BurnRequest, MintOffer, TransferOffer } from './contracts';
|
|
16
19
|
export type { Holding } from './holdings';
|
|
17
20
|
export type { ActiveContract, ContractFilter, CreateCommand, DisclosedContract, ExerciseCommand, InstrumentId, InterfaceView, LedgerCommand, SubmitResult, WalletSubmission, } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wallets/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wallets/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,kB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AY,CAAC;AAC1C,YAAY,EACV,cAAc,EACd,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseDecimalUnits = exports.formatDecimalUnits = exports.WalletSubmitError = exports.WalletReadError = exports.TokenWalletError = exports.RegistryResponseError = exports.RegistryApiError = exports.createDaUtilitiesClient = exports.primaryPartyId = exports.createTokenStandardWallet = exports.createTokenWallet = void 0;
|
|
3
|
+
exports.parseDecimalUnits = exports.formatDecimalUnits = exports.WalletSubmitError = exports.WalletSignError = exports.WalletReadError = exports.TokenWalletError = exports.RegistryResponseError = exports.RegistryApiError = exports.createDaUtilitiesClient = exports.proveWalletOwnership = exports.buildWalletOwnershipMessage = exports.primaryPartyId = exports.DEFAULT_READ_RETRY_DELAYS_MS = exports.createTokenStandardWallet = exports.createTokenWallet = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Browser-safe token standard (CIP-56) and DA Utility Registry holder actions through any CIP-0103 (Canton dApp API)
|
|
6
6
|
* wallet provider. In a browser bundle import `@fairmint/canton-node-sdk/build/src/wallets/index.js`, which loads none
|
|
7
7
|
* of the SDK's Node dependencies; the package root also exports it as the `Wallets` namespace (for Node).
|
|
8
8
|
*
|
|
9
|
-
* The surface is small on purpose: plug in a CIP-0103 provider (`createTokenWallet`), the registry client, the
|
|
10
|
-
*
|
|
9
|
+
* The surface is small on purpose: plug in a CIP-0103 provider (`createTokenWallet`), the registry client, the
|
|
10
|
+
* ownership proof's client side (`proveWalletOwnership` and the message it signs; the server verifies with
|
|
11
|
+
* `verifyWalletOwnership` from the package root, which is Node-only), the read back-off options, the errors and the
|
|
12
|
+
* data types. Command builders, parsers, error-code tables and the CIP-0103 client stay internal.
|
|
11
13
|
*/
|
|
12
14
|
var token_wallet_1 = require("./token-wallet");
|
|
13
15
|
Object.defineProperty(exports, "createTokenWallet", { enumerable: true, get: function () { return token_wallet_1.createTokenWallet; } });
|
|
14
16
|
var token_standard_wallet_1 = require("./token-standard-wallet");
|
|
15
17
|
Object.defineProperty(exports, "createTokenStandardWallet", { enumerable: true, get: function () { return token_standard_wallet_1.createTokenStandardWallet; } });
|
|
16
18
|
var cip103_1 = require("./cip103");
|
|
19
|
+
Object.defineProperty(exports, "DEFAULT_READ_RETRY_DELAYS_MS", { enumerable: true, get: function () { return cip103_1.DEFAULT_READ_RETRY_DELAYS_MS; } });
|
|
17
20
|
Object.defineProperty(exports, "primaryPartyId", { enumerable: true, get: function () { return cip103_1.primaryPartyId; } });
|
|
21
|
+
var ownership_1 = require("./ownership");
|
|
22
|
+
Object.defineProperty(exports, "buildWalletOwnershipMessage", { enumerable: true, get: function () { return ownership_1.buildWalletOwnershipMessage; } });
|
|
23
|
+
Object.defineProperty(exports, "proveWalletOwnership", { enumerable: true, get: function () { return ownership_1.proveWalletOwnership; } });
|
|
18
24
|
var client_1 = require("./da-utilities/client");
|
|
19
25
|
Object.defineProperty(exports, "createDaUtilitiesClient", { enumerable: true, get: function () { return client_1.createDaUtilitiesClient; } });
|
|
20
26
|
var errors_1 = require("./errors");
|
|
@@ -22,6 +28,7 @@ Object.defineProperty(exports, "RegistryApiError", { enumerable: true, get: func
|
|
|
22
28
|
Object.defineProperty(exports, "RegistryResponseError", { enumerable: true, get: function () { return errors_1.RegistryResponseError; } });
|
|
23
29
|
Object.defineProperty(exports, "TokenWalletError", { enumerable: true, get: function () { return errors_1.TokenWalletError; } });
|
|
24
30
|
Object.defineProperty(exports, "WalletReadError", { enumerable: true, get: function () { return errors_1.WalletReadError; } });
|
|
31
|
+
Object.defineProperty(exports, "WalletSignError", { enumerable: true, get: function () { return errors_1.WalletSignError; } });
|
|
25
32
|
Object.defineProperty(exports, "WalletSubmitError", { enumerable: true, get: function () { return errors_1.WalletSubmitError; } });
|
|
26
33
|
var decimal_1 = require("./decimal");
|
|
27
34
|
Object.defineProperty(exports, "formatDecimalUnits", { enumerable: true, get: function () { return decimal_1.formatDecimalUnits; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/wallets/index.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/wallets/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACH,+CAMwB;AALtB,iHAAA,iBAAiB,OAAA;AAMnB,iEASiC;AAR/B,kIAAA,yBAAyB,OAAA;AAS3B,mCAWkB;AAVhB,sHAAA,4BAA4B,OAAA;AAC5B,wGAAA,cAAc,OAAA;AAUhB,yCAOqB;AANnB,wHAAA,2BAA2B,OAAA;AAC3B,iHAAA,oBAAoB,OAAA;AAMtB,gDAQ+B;AAP7B,iHAAA,uBAAuB,OAAA;AAoBzB,mCAUkB;AAThB,0GAAA,gBAAgB,OAAA;AAChB,+GAAA,qBAAqB,OAAA;AACrB,0GAAA,gBAAgB,OAAA;AAChB,yGAAA,eAAe,OAAA;AACf,yGAAA,eAAe,OAAA;AACf,2GAAA,iBAAiB,OAAA;AAoBnB,qCAAkE;AAAzD,6GAAA,kBAAkB,OAAA;AAAE,4GAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proof that the user controls a wallet's party, not just its party id: the wallet signs a canonical, human-readable
|
|
3
|
+
* message (CIP-0103 `signMessage`) built from a challenge the dApp's server issued, and the server verifies it with
|
|
4
|
+
* `verifyWalletOwnership` (Node only, exported from the package root). A check in the browser proves nothing: anyone
|
|
5
|
+
* can call this code with a made-up provider, so only the server's verification counts.
|
|
6
|
+
*
|
|
7
|
+
* The message is plain text with a fixed first line and a statement that it is not a transaction, so a dApp cannot use
|
|
8
|
+
* it to get a transaction hash (34 binary bytes) signed. Wallets sign the raw message bytes with the party's key (Loop:
|
|
9
|
+
* Ed25519 over the UTF-8 bytes; the CIP-0103 reference wallet: the same), so the text form is the only protection. The
|
|
10
|
+
* nonce must come from the server, be random, and be accepted once.
|
|
11
|
+
*
|
|
12
|
+
* The `Network:` line is a label, not proof: a party id is derived from its key and is the same on every network, so a
|
|
13
|
+
* verified proof says nothing about the party existing or being hosted on that network. `proveWalletOwnership` refuses
|
|
14
|
+
* a wallet that reports another network as a guard against mistakes; a server that needs the network proven must look
|
|
15
|
+
* the party up on that network (its Scan or ledger party and topology APIs).
|
|
16
|
+
*/
|
|
17
|
+
import { type Cip103Provider } from './cip103';
|
|
18
|
+
/** The first line of every ownership message. */
|
|
19
|
+
export declare const WALLET_OWNERSHIP_TITLE = "Canton wallet ownership proof";
|
|
20
|
+
/** The message format version, its `Version:` line. */
|
|
21
|
+
export declare const WALLET_OWNERSHIP_VERSION = "1";
|
|
22
|
+
/** What the dApp's server issues for one proof. Times are ISO-8601 in UTC with milliseconds (`toISOString()`). */
|
|
23
|
+
export interface WalletOwnershipChallenge {
|
|
24
|
+
/** The dApp's host (`app.example.com`, `localhost:3000`): the site the user proves ownership to. */
|
|
25
|
+
readonly domain: string;
|
|
26
|
+
/** Single-use, server-generated, unguessable: 16-512 of `A-Z a-z 0-9 . _ ~ -`. */
|
|
27
|
+
readonly nonce: string;
|
|
28
|
+
readonly issuedAt: string;
|
|
29
|
+
readonly expiresAt: string;
|
|
30
|
+
/**
|
|
31
|
+
* The Canton network the dApp expects the wallet on (for example the wallet's CIP-0103 `networkId`, `canton:devnet`).
|
|
32
|
+
* A label in the message: signing it does not prove the party is on that network (see the module comment).
|
|
33
|
+
*/
|
|
34
|
+
readonly network?: string;
|
|
35
|
+
}
|
|
36
|
+
/** Every field of an ownership message. */
|
|
37
|
+
export interface WalletOwnershipMessageFields extends WalletOwnershipChallenge {
|
|
38
|
+
readonly partyId: string;
|
|
39
|
+
}
|
|
40
|
+
/** What the browser sends to the server to verify. */
|
|
41
|
+
export interface WalletOwnershipProof {
|
|
42
|
+
readonly partyId: string;
|
|
43
|
+
/** The account's `publicKey`, as the wallet reported it. */
|
|
44
|
+
readonly publicKey: string;
|
|
45
|
+
/** The account's `namespace`, when the wallet reported it. */
|
|
46
|
+
readonly namespace?: string;
|
|
47
|
+
/** The exact text the wallet signed. */
|
|
48
|
+
readonly message: string;
|
|
49
|
+
/** The signature as the wallet returned it (Loop: hex; the CIP-0103 reference wallet: base64). */
|
|
50
|
+
readonly signature: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The canonical message for these fields. Throws `TypeError` on a field that is not valid. The same fields always give
|
|
54
|
+
* the same text, so the server rebuilds it from the fields it parses and refuses anything else.
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildWalletOwnershipMessage(fields: WalletOwnershipMessageFields): string;
|
|
57
|
+
/**
|
|
58
|
+
* The fields of a canonical ownership message, or null for any text that is not exactly what
|
|
59
|
+
* {@link buildWalletOwnershipMessage} gives for its fields (another version, an extra line or space, a reordered
|
|
60
|
+
* field).
|
|
61
|
+
*/
|
|
62
|
+
export declare function parseWalletOwnershipMessage(message: string): WalletOwnershipMessageFields | null;
|
|
63
|
+
export interface ProveWalletOwnershipOptions {
|
|
64
|
+
/** The challenge the dApp's server issued. */
|
|
65
|
+
readonly challenge: WalletOwnershipChallenge;
|
|
66
|
+
/**
|
|
67
|
+
* The party the dApp expects. CIP-0103 wallets sign with the primary account, so a different primary account is
|
|
68
|
+
* refused before anything is signed.
|
|
69
|
+
*/
|
|
70
|
+
readonly partyId?: string;
|
|
71
|
+
/** Defaults to the system clock; an expired challenge is refused before anything is signed. */
|
|
72
|
+
readonly now?: () => Date;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Ask the wallet to sign the ownership message for the challenge, as its primary account. Returns what the server needs
|
|
76
|
+
* to verify; it is not itself proof of anything until the server verified it (`verifyWalletOwnership`).
|
|
77
|
+
*/
|
|
78
|
+
export declare function proveWalletOwnership(provider: Cip103Provider, options: ProveWalletOwnershipOptions): Promise<WalletOwnershipProof>;
|
|
79
|
+
//# sourceMappingURL=ownership.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ownership.d.ts","sourceRoot":"","sources":["../../../src/wallets/ownership.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAsE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAInH,iDAAiD;AACjD,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AACtE,uDAAuD;AACvD,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,kHAAkH;AAClH,MAAM,WAAW,wBAAwB;IACvC,oGAAoG;IACpG,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kFAAkF;IAClF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,2CAA2C;AAC3C,MAAM,WAAW,4BAA6B,SAAQ,wBAAwB;IAC5E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,sDAAsD;AACtD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,wCAAwC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kGAAkG;IAClG,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAgDD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,4BAA4B,GAAG,MAAM,CAexF;AAYD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,4BAA4B,GAAG,IAAI,CAgChG;AAED,MAAM,WAAW,2BAA2B;IAC1C,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,EAAE,wBAAwB,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,+FAA+F;IAC/F,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAQD;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,oBAAoB,CAAC,CA8D/B"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WALLET_OWNERSHIP_VERSION = exports.WALLET_OWNERSHIP_TITLE = void 0;
|
|
4
|
+
exports.buildWalletOwnershipMessage = buildWalletOwnershipMessage;
|
|
5
|
+
exports.parseWalletOwnershipMessage = parseWalletOwnershipMessage;
|
|
6
|
+
exports.proveWalletOwnership = proveWalletOwnership;
|
|
7
|
+
/**
|
|
8
|
+
* Proof that the user controls a wallet's party, not just its party id: the wallet signs a canonical, human-readable
|
|
9
|
+
* message (CIP-0103 `signMessage`) built from a challenge the dApp's server issued, and the server verifies it with
|
|
10
|
+
* `verifyWalletOwnership` (Node only, exported from the package root). A check in the browser proves nothing: anyone
|
|
11
|
+
* can call this code with a made-up provider, so only the server's verification counts.
|
|
12
|
+
*
|
|
13
|
+
* The message is plain text with a fixed first line and a statement that it is not a transaction, so a dApp cannot use
|
|
14
|
+
* it to get a transaction hash (34 binary bytes) signed. Wallets sign the raw message bytes with the party's key (Loop:
|
|
15
|
+
* Ed25519 over the UTF-8 bytes; the CIP-0103 reference wallet: the same), so the text form is the only protection. The
|
|
16
|
+
* nonce must come from the server, be random, and be accepted once.
|
|
17
|
+
*
|
|
18
|
+
* The `Network:` line is a label, not proof: a party id is derived from its key and is the same on every network, so a
|
|
19
|
+
* verified proof says nothing about the party existing or being hosted on that network. `proveWalletOwnership` refuses
|
|
20
|
+
* a wallet that reports another network as a guard against mistakes; a server that needs the network proven must look
|
|
21
|
+
* the party up on that network (its Scan or ledger party and topology APIs).
|
|
22
|
+
*/
|
|
23
|
+
const cip103_1 = require("./cip103");
|
|
24
|
+
const errors_1 = require("./errors");
|
|
25
|
+
const json_1 = require("./json");
|
|
26
|
+
/** The first line of every ownership message. */
|
|
27
|
+
exports.WALLET_OWNERSHIP_TITLE = 'Canton wallet ownership proof';
|
|
28
|
+
/** The message format version, its `Version:` line. */
|
|
29
|
+
exports.WALLET_OWNERSHIP_VERSION = '1';
|
|
30
|
+
const DOMAIN_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9.-]{0,251}[A-Za-z0-9])?(?::[0-9]{1,5})?$/;
|
|
31
|
+
const NONCE_PATTERN = /^[A-Za-z0-9._~-]{16,512}$/;
|
|
32
|
+
/** Printable ASCII without spaces. */
|
|
33
|
+
const TOKEN_PATTERN = /^[!-~]+$/;
|
|
34
|
+
const ISO_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
|
|
35
|
+
/** The reason a field is not valid in a message, or null. */
|
|
36
|
+
function fieldProblem(fields) {
|
|
37
|
+
if (typeof fields.domain !== 'string' || !DOMAIN_PATTERN.test(fields.domain)) {
|
|
38
|
+
return 'domain must be a host name, optionally with a port';
|
|
39
|
+
}
|
|
40
|
+
if (typeof fields.nonce !== 'string' || !NONCE_PATTERN.test(fields.nonce)) {
|
|
41
|
+
return 'nonce must be 16-512 characters of letters, digits and . _ ~ -';
|
|
42
|
+
}
|
|
43
|
+
if (typeof fields.partyId !== 'string' ||
|
|
44
|
+
fields.partyId.length > 512 ||
|
|
45
|
+
!TOKEN_PATTERN.test(fields.partyId) ||
|
|
46
|
+
fields.partyId.split('::').length !== 2) {
|
|
47
|
+
return 'partyId must be a Canton party id (hint::namespace)';
|
|
48
|
+
}
|
|
49
|
+
if (fields.network !== undefined &&
|
|
50
|
+
(typeof fields.network !== 'string' || fields.network.length > 128 || !TOKEN_PATTERN.test(fields.network))) {
|
|
51
|
+
return 'network must be 1-128 printable characters without spaces';
|
|
52
|
+
}
|
|
53
|
+
for (const key of ['issuedAt', 'expiresAt']) {
|
|
54
|
+
const value = fields[key];
|
|
55
|
+
// An out-of-range date (month 13) is an Invalid Date, whose toISOString() throws: check it first.
|
|
56
|
+
if (typeof value !== 'string' ||
|
|
57
|
+
!ISO_PATTERN.test(value) ||
|
|
58
|
+
Number.isNaN(Date.parse(value)) ||
|
|
59
|
+
new Date(value).toISOString() !== value) {
|
|
60
|
+
return `${key} must be an ISO-8601 UTC time with milliseconds (Date.toISOString())`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (Date.parse(fields.expiresAt) <= Date.parse(fields.issuedAt)) {
|
|
64
|
+
return 'expiresAt must be after issuedAt';
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The canonical message for these fields. Throws `TypeError` on a field that is not valid. The same fields always give
|
|
70
|
+
* the same text, so the server rebuilds it from the fields it parses and refuses anything else.
|
|
71
|
+
*/
|
|
72
|
+
function buildWalletOwnershipMessage(fields) {
|
|
73
|
+
const problem = fieldProblem(fields);
|
|
74
|
+
if (problem !== null)
|
|
75
|
+
throw new TypeError(`Invalid wallet ownership message: ${problem}`);
|
|
76
|
+
return [
|
|
77
|
+
exports.WALLET_OWNERSHIP_TITLE,
|
|
78
|
+
`Sign this message only to prove to ${fields.domain} that you control the Canton party below. It is not a transaction: it moves no assets and authorizes nothing on the ledger.`,
|
|
79
|
+
'',
|
|
80
|
+
`Version: ${exports.WALLET_OWNERSHIP_VERSION}`,
|
|
81
|
+
`Domain: ${fields.domain}`,
|
|
82
|
+
`Party: ${fields.partyId}`,
|
|
83
|
+
...(fields.network !== undefined ? [`Network: ${fields.network}`] : []),
|
|
84
|
+
`Nonce: ${fields.nonce}`,
|
|
85
|
+
`Issued At: ${fields.issuedAt}`,
|
|
86
|
+
`Expiration Time: ${fields.expiresAt}`,
|
|
87
|
+
].join('\n');
|
|
88
|
+
}
|
|
89
|
+
const FIELD_LINES = new Map([
|
|
90
|
+
['Version', 'version'],
|
|
91
|
+
['Domain', 'domain'],
|
|
92
|
+
['Party', 'partyId'],
|
|
93
|
+
['Network', 'network'],
|
|
94
|
+
['Nonce', 'nonce'],
|
|
95
|
+
['Issued At', 'issuedAt'],
|
|
96
|
+
['Expiration Time', 'expiresAt'],
|
|
97
|
+
]);
|
|
98
|
+
/**
|
|
99
|
+
* The fields of a canonical ownership message, or null for any text that is not exactly what
|
|
100
|
+
* {@link buildWalletOwnershipMessage} gives for its fields (another version, an extra line or space, a reordered
|
|
101
|
+
* field).
|
|
102
|
+
*/
|
|
103
|
+
function parseWalletOwnershipMessage(message) {
|
|
104
|
+
if (typeof message !== 'string' || message.length > 4096)
|
|
105
|
+
return null;
|
|
106
|
+
const lines = message.split('\n');
|
|
107
|
+
if (lines[0] !== exports.WALLET_OWNERSHIP_TITLE)
|
|
108
|
+
return null;
|
|
109
|
+
const found = {};
|
|
110
|
+
for (const line of lines.slice(3)) {
|
|
111
|
+
const separator = line.indexOf(': ');
|
|
112
|
+
const key = separator > 0 ? FIELD_LINES.get(line.slice(0, separator)) : undefined;
|
|
113
|
+
if (key === undefined || found[key] !== undefined)
|
|
114
|
+
return null;
|
|
115
|
+
found[key] = line.slice(separator + 2);
|
|
116
|
+
}
|
|
117
|
+
const { version, domain, partyId, network, nonce, issuedAt, expiresAt } = found;
|
|
118
|
+
if (version !== exports.WALLET_OWNERSHIP_VERSION ||
|
|
119
|
+
domain === undefined ||
|
|
120
|
+
partyId === undefined ||
|
|
121
|
+
nonce === undefined ||
|
|
122
|
+
issuedAt === undefined ||
|
|
123
|
+
expiresAt === undefined) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
const fields = {
|
|
127
|
+
domain,
|
|
128
|
+
partyId,
|
|
129
|
+
nonce,
|
|
130
|
+
issuedAt,
|
|
131
|
+
expiresAt,
|
|
132
|
+
...(network !== undefined && { network }),
|
|
133
|
+
};
|
|
134
|
+
if (fieldProblem(fields) !== null)
|
|
135
|
+
return null;
|
|
136
|
+
return buildWalletOwnershipMessage(fields) === message ? fields : null;
|
|
137
|
+
}
|
|
138
|
+
/** The signature from a `signMessage` result: `{signature}` (CIP-0103) or a bare string (some wallets). */
|
|
139
|
+
function readSignature(raw) {
|
|
140
|
+
if (typeof raw === 'string')
|
|
141
|
+
return (0, json_1.nonEmptyString)(raw);
|
|
142
|
+
return (0, json_1.isRecord)(raw) ? (0, json_1.nonEmptyString)(raw['signature']) : undefined;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Ask the wallet to sign the ownership message for the challenge, as its primary account. Returns what the server needs
|
|
146
|
+
* to verify; it is not itself proof of anything until the server verified it (`verifyWalletOwnership`).
|
|
147
|
+
*/
|
|
148
|
+
async function proveWalletOwnership(provider, options) {
|
|
149
|
+
const account = await (0, cip103_1.primaryAccount)(provider);
|
|
150
|
+
if (options.partyId !== undefined && options.partyId !== account.partyId) {
|
|
151
|
+
throw new errors_1.WalletSignError('invalid-challenge', `The wallet's primary account is ${account.partyId}, not ${options.partyId}; switch accounts in the wallet first`);
|
|
152
|
+
}
|
|
153
|
+
if (account.publicKey === undefined) {
|
|
154
|
+
throw new errors_1.WalletReadError('The wallet returned a primary account without publicKey, so ownership cannot be proven');
|
|
155
|
+
}
|
|
156
|
+
const { challenge } = options;
|
|
157
|
+
// A guard against signing for the wrong network, not proof: the wallet reports its network itself.
|
|
158
|
+
if (challenge.network !== undefined && account.networkId !== undefined && account.networkId !== challenge.network) {
|
|
159
|
+
throw new errors_1.WalletSignError('invalid-challenge', `The wallet is on ${account.networkId}, not ${challenge.network}; switch networks in the wallet first`);
|
|
160
|
+
}
|
|
161
|
+
let message;
|
|
162
|
+
try {
|
|
163
|
+
message = buildWalletOwnershipMessage({
|
|
164
|
+
domain: challenge.domain,
|
|
165
|
+
partyId: account.partyId,
|
|
166
|
+
nonce: challenge.nonce,
|
|
167
|
+
issuedAt: challenge.issuedAt,
|
|
168
|
+
expiresAt: challenge.expiresAt,
|
|
169
|
+
...(challenge.network !== undefined && { network: challenge.network }),
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
throw new errors_1.WalletSignError('invalid-challenge', error instanceof Error ? error.message : String(error));
|
|
174
|
+
}
|
|
175
|
+
const now = (options.now ?? (() => new Date()))().getTime();
|
|
176
|
+
if (!(now < Date.parse(challenge.expiresAt))) {
|
|
177
|
+
throw new errors_1.WalletSignError('invalid-challenge', 'The ownership challenge has expired; ask the server for a new one');
|
|
178
|
+
}
|
|
179
|
+
let raw;
|
|
180
|
+
try {
|
|
181
|
+
raw = await provider.request({ method: 'signMessage', params: { message } });
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
const code = (0, cip103_1.cip103ErrorCode)(error);
|
|
185
|
+
if (code === cip103_1.CIP103_ERROR_CODES.userRejected) {
|
|
186
|
+
throw new errors_1.WalletSignError('rejected-by-user', `The user declined to sign the ownership message: ${(0, cip103_1.describeError)(error)}`, code);
|
|
187
|
+
}
|
|
188
|
+
throw new errors_1.WalletSignError('failed', `The wallet did not sign the ownership message: ${(0, cip103_1.describeError)(error)}`, code);
|
|
189
|
+
}
|
|
190
|
+
const signature = readSignature(raw);
|
|
191
|
+
if (signature === undefined) {
|
|
192
|
+
throw new errors_1.WalletSignError('failed', 'The wallet answered signMessage without a signature');
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
partyId: account.partyId,
|
|
196
|
+
publicKey: account.publicKey,
|
|
197
|
+
...(account.namespace !== undefined && { namespace: account.namespace }),
|
|
198
|
+
message,
|
|
199
|
+
signature,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=ownership.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ownership.js","sourceRoot":"","sources":["../../../src/wallets/ownership.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,qCAAmH;AACnH,qCAA4D;AAC5D,iCAAkD;AAElD,iDAAiD;AACpC,QAAA,sBAAsB,GAAG,+BAA+B,CAAC;AACtE,uDAAuD;AAC1C,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAmC5C,MAAM,cAAc,GAAG,mEAAmE,CAAC;AAC3F,MAAM,aAAa,GAAG,2BAA2B,CAAC;AAClD,sCAAsC;AACtC,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,MAAM,WAAW,GAAG,+CAA+C,CAAC;AAEpE,6DAA6D;AAC7D,SAAS,YAAY,CAAC,MAAoC;IACxD,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7E,OAAO,oDAAoD,CAAC;IAC9D,CAAC;IACD,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1E,OAAO,gEAAgE,CAAC;IAC1E,CAAC;IACD,IACE,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ;QAClC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG;QAC3B,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QACnC,MAAM,CAAC,OAAO,CA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AC5B,MAAM,IAAI,wBAAe,CAAC,QAAQ,EAAE,qDAAqD,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,GAAG,CAAC,OAAO,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;QACxE,OAAO;QACP,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* interface ids (`utils/token-standard/v1/constants`). Both modules are dependency-free, so this module can import them
|
|
8
8
|
* and stay browser-safe.
|
|
9
9
|
*/
|
|
10
|
+
import type { ActiveContract, ContractFilter } from './types';
|
|
10
11
|
/**
|
|
11
12
|
* `Module:Entity` of a template or interface id in either form (`#pkg-name:M:E` or `pkgId:M:E`), or null when the id is
|
|
12
13
|
* not of that shape.
|
|
@@ -18,4 +19,18 @@ export declare function sameQualifiedName(left: string, right: string): boolean;
|
|
|
18
19
|
export declare function packageNameOf(id: string): string | null;
|
|
19
20
|
/** `Module:Entity` of one of the SDK's own id constants; throws on a malformed constant rather than matching nothing. */
|
|
20
21
|
export declare function requireQualifiedName(id: string): string;
|
|
22
|
+
/** A stable key of a filter: `t:<templateId>` or `i:<interfaceId>`. */
|
|
23
|
+
export declare function contractFilterKey(filter: ContractFilter): string;
|
|
24
|
+
/**
|
|
25
|
+
* Whether a contract of a snapshot read with several filters at once is one the given filter would have returned on its
|
|
26
|
+
* own: of the template, or carrying a view of the interface (the ledger computes views only for the interfaces the read
|
|
27
|
+
* asked for).
|
|
28
|
+
*
|
|
29
|
+
* A template match needs proven package identity, not just the same `Module:Entity`: a cumulative read also returns
|
|
30
|
+
* contracts matched only by one of its interface filters, and any party can create a template of that name in its own
|
|
31
|
+
* package. So a package-name filter (`#pkg:M:E`) matches only a contract whose `packageName` is that package; the
|
|
32
|
+
* Ledger JSON API v2 (Canton 3.x) always reports `createdEvent.packageName` (a required field), so a contract without
|
|
33
|
+
* one is not classified at all (fail closed). A package-id filter matches only the exact template id.
|
|
34
|
+
*/
|
|
35
|
+
export declare function contractMatchesFilter(contract: ActiveContract, filter: ContractFilter): boolean;
|
|
21
36
|
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/wallets/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/wallets/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9D;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKvD;AAED,0GAA0G;AAC1G,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAGtE;AAED,8GAA8G;AAC9G,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIvD;AAED,yHAAyH;AACzH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAEhE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAgB/F"}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Comparing template and interface ids across their two forms: package-name (`#package-name:Module:Entity`, as the
|
|
4
|
-
* SDK's constants spell them so they survive DAR upgrades) and package-id (`pkgId:Module:Entity`, as the ledger reports
|
|
5
|
-
* them).
|
|
6
|
-
*
|
|
7
|
-
* The ids themselves are the SDK's own: `DA_REGISTRY_TEMPLATES` (`da-registry/templates`) and the token standard V1
|
|
8
|
-
* interface ids (`utils/token-standard/v1/constants`). Both modules are dependency-free, so this module can import them
|
|
9
|
-
* and stay browser-safe.
|
|
10
|
-
*/
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.qualifiedName = qualifiedName;
|
|
13
4
|
exports.sameQualifiedName = sameQualifiedName;
|
|
14
5
|
exports.packageNameOf = packageNameOf;
|
|
15
6
|
exports.requireQualifiedName = requireQualifiedName;
|
|
7
|
+
exports.contractFilterKey = contractFilterKey;
|
|
8
|
+
exports.contractMatchesFilter = contractMatchesFilter;
|
|
16
9
|
/**
|
|
17
10
|
* `Module:Entity` of a template or interface id in either form (`#pkg-name:M:E` or `pkgId:M:E`), or null when the id is
|
|
18
11
|
* not of that shape.
|
|
@@ -43,4 +36,35 @@ function requireQualifiedName(id) {
|
|
|
43
36
|
throw new TypeError(`Malformed template id ${id}`);
|
|
44
37
|
return name;
|
|
45
38
|
}
|
|
39
|
+
/** A stable key of a filter: `t:<templateId>` or `i:<interfaceId>`. */
|
|
40
|
+
function contractFilterKey(filter) {
|
|
41
|
+
return 'templateId' in filter ? `t:${filter.templateId}` : `i:${filter.interfaceId}`;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Whether a contract of a snapshot read with several filters at once is one the given filter would have returned on its
|
|
45
|
+
* own: of the template, or carrying a view of the interface (the ledger computes views only for the interfaces the read
|
|
46
|
+
* asked for).
|
|
47
|
+
*
|
|
48
|
+
* A template match needs proven package identity, not just the same `Module:Entity`: a cumulative read also returns
|
|
49
|
+
* contracts matched only by one of its interface filters, and any party can create a template of that name in its own
|
|
50
|
+
* package. So a package-name filter (`#pkg:M:E`) matches only a contract whose `packageName` is that package; the
|
|
51
|
+
* Ledger JSON API v2 (Canton 3.x) always reports `createdEvent.packageName` (a required field), so a contract without
|
|
52
|
+
* one is not classified at all (fail closed). A package-id filter matches only the exact template id.
|
|
53
|
+
*/
|
|
54
|
+
function contractMatchesFilter(contract, filter) {
|
|
55
|
+
if ('templateId' in filter) {
|
|
56
|
+
if (!sameQualifiedName(contract.templateId, filter.templateId))
|
|
57
|
+
return false;
|
|
58
|
+
const filterPackage = packageNameOf(filter.templateId);
|
|
59
|
+
return filterPackage === null
|
|
60
|
+
? contract.templateId === filter.templateId
|
|
61
|
+
: contract.packageName !== undefined && contract.packageName === filterPackage;
|
|
62
|
+
}
|
|
63
|
+
// Same rule for interfaces: a package-id filter (`pkgId:M:E`) matches only that exact interface id, so two
|
|
64
|
+
// same-named interfaces from different packages in one cumulative read are never mixed up; a package-name filter
|
|
65
|
+
// (`#pkg:M:E`) matches by name (the ledger reports a view's interface id with the package id it resolved).
|
|
66
|
+
return contract.interfaceViews.some((view) => packageNameOf(filter.interfaceId) === null
|
|
67
|
+
? view.interfaceId === filter.interfaceId
|
|
68
|
+
: sameQualifiedName(view.interfaceId, filter.interfaceId));
|
|
69
|
+
}
|
|
46
70
|
//# sourceMappingURL=templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/wallets/templates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/wallets/templates.ts"],"names":[],"mappings":";;;;;;;;AAWA;;;GAGG;AACH,uBAA8B,EAAU;IACtC,MAAM,SAAS,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,SAAS,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,IAAI,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACrC,OAAO,iCAAiC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACp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AAC,QAAQ,CAAC,UAAU,KAAK,MAAM,CAAC,UAAU;YAC3C,CAAC,CAAC,QAAQ,CAAC,WAAW,KAAK,SAAS,IAAI,QAAQ,CAAC,WAAW,KAAK,aAAa,CAAC;IACnF,CAAC;IACD,2GAA2G;IAC3G,iHAAiH;IACjH,2GAA2G;IAC3G,OAAO,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAC3C,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,IAAI;QACxC,CAAC,CAAC,IAAI,CAAC,WAAW,KAAK,MAAM,CAAC,WAAW;QACzC,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -62,12 +62,23 @@ export interface TokenRegistry {
|
|
|
62
62
|
* lists and spends only the ones this returns true for.
|
|
63
63
|
*/
|
|
64
64
|
servesHolding(contract: ActiveContract): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Filters a token wallet reads holdings with besides the CIP-56 HoldingV1 interface, for example the registry's own
|
|
67
|
+
* holding template, whose create argument still reads when the ledger could not compute a HoldingV1 view. Every read
|
|
68
|
+
* of holdings (a write's fresh read and the state snapshot) uses the same filters, and the same `servesHolding`.
|
|
69
|
+
*/
|
|
70
|
+
readonly holdingFilters?: readonly ContractFilter[];
|
|
65
71
|
/**
|
|
66
72
|
* This registry's pending transfers (CIP-56 TransferInstructions) visible to the wallet, read through `read` and
|
|
67
73
|
* checked to be genuine (made by the registry, not a look-alike any party could create). Both directions: the caller
|
|
68
74
|
* splits them by sender and receiver.
|
|
69
75
|
*/
|
|
70
76
|
pendingTransfers(read: ReadContracts): Promise<TransferOffer[]>;
|
|
77
|
+
/**
|
|
78
|
+
* The filters `pendingTransfers` reads. A token wallet adds them to its one state snapshot, so listing pending
|
|
79
|
+
* transfers costs no ledger read of its own; a read of any other filter goes to the wallet separately.
|
|
80
|
+
*/
|
|
81
|
+
readonly pendingTransferFilters?: readonly ContractFilter[];
|
|
71
82
|
/**
|
|
72
83
|
* `Module:Entity` names of the templates this registry's transfer factory may have. A factory of any other template
|
|
73
84
|
* is refused before anything is signed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-registry.d.ts","sourceRoot":"","sources":["../../../src/wallets/token-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE/F,oFAAoF;AACpF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B;AAED,8GAA8G;AAC9G,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C,QAAQ,CAAC,kBAAkB,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC3D;AAED,sDAAsD;AACtD,MAAM,WAAW,wBAAyB,SAAQ,aAAa;IAC7D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEvD,MAAM,WAAW,eAAgB,SAAQ,wBAAwB;IAC/D,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;CACrC;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,sBAAsB;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC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@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-registry.js","sourceRoot":"","sources":["../../../src/wallets/token-registry.ts"],"names":[],"mappings":";;;AAOA,2CAA4C;
|
|
1
|
+
{"version":3,"file":"token-registry.js","sourceRoot":"","sources":["../../../src/wallets/token-registry.ts"],"names":[],"mappings":";;;AAOA,2CAA4C;AAgG5C;;;GAGG;AACH,8BACE,OAAiC,EACjC,iBAAoC;IAEpC,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3G,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,mDAAmD,CAAC;IAC7D,CAAC;IACD,MAAM,IAAI,GAAG,IAAA,yBAAa,EAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACjD,OAAO,IAAI,KAAK,IAAI,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC;QACtD,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,2DAA2D,SAAS,CAAC,UAAU,IAAI,CAAC;AAC1F,CAAC"}
|