@fairmint/canton-node-sdk 0.0.308 → 0.0.310
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 +95 -0
- package/build/src/clients/scan-api/ScanApiClient.generated.d.ts +1 -1
- package/build/src/clients/scan-api/ScanApiClient.generated.d.ts.map +1 -1
- package/build/src/clients/scan-api/operations/v0/scan.d.ts +11 -0
- package/build/src/clients/scan-api/operations/v0/scan.d.ts.map +1 -1
- package/build/src/clients/scan-api/operations/v0/scan.js +11 -0
- package/build/src/clients/scan-api/operations/v0/scan.js.map +1 -1
- package/build/src/clients/validator-api/ValidatorApiClient.generated.d.ts +0 -3
- package/build/src/clients/validator-api/ValidatorApiClient.generated.d.ts.map +1 -1
- package/build/src/clients/validator-api/ValidatorApiClient.generated.js +0 -2
- package/build/src/clients/validator-api/ValidatorApiClient.generated.js.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/index.d.ts +0 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/index.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/index.js +0 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/index.js.map +1 -1
- package/build/src/clients/validator-api/schemas/api/scan-proxy.d.ts +0 -12
- package/build/src/clients/validator-api/schemas/api/scan-proxy.d.ts.map +1 -1
- package/build/src/clients/validator-api/schemas/api/scan-proxy.js +1 -13
- package/build/src/clients/validator-api/schemas/api/scan-proxy.js.map +1 -1
- package/build/src/clients/validator-api/schemas/operations/scan-proxy.d.ts +0 -5
- package/build/src/clients/validator-api/schemas/operations/scan-proxy.d.ts.map +1 -1
- package/build/src/clients/validator-api/schemas/operations/scan-proxy.js +1 -6
- package/build/src/clients/validator-api/schemas/operations/scan-proxy.js.map +1 -1
- package/build/src/utils/token-standard/v2/constants.d.ts +51 -0
- package/build/src/utils/token-standard/v2/constants.d.ts.map +1 -0
- package/build/src/utils/token-standard/v2/constants.js +54 -0
- package/build/src/utils/token-standard/v2/constants.js.map +1 -0
- package/build/src/utils/token-standard/v2/holdings.d.ts +0 -1
- package/build/src/utils/token-standard/v2/holdings.d.ts.map +1 -1
- package/build/src/utils/token-standard/v2/holdings.js +3 -3
- package/build/src/utils/token-standard/v2/holdings.js.map +1 -1
- package/build/src/utils/token-standard/v2/index.d.ts +1 -0
- package/build/src/utils/token-standard/v2/index.d.ts.map +1 -1
- package/build/src/utils/token-standard/v2/index.js +1 -0
- package/build/src/utils/token-standard/v2/index.js.map +1 -1
- package/build/src/utils/traffic/get-traffic-status.d.ts +15 -36
- package/build/src/utils/traffic/get-traffic-status.d.ts.map +1 -1
- package/build/src/utils/traffic/get-traffic-status.js +28 -27
- package/build/src/utils/traffic/get-traffic-status.js.map +1 -1
- package/build/src/wallets/amulet/registry.d.ts.map +1 -1
- package/build/src/wallets/amulet/registry.js +10 -91
- package/build/src/wallets/amulet/registry.js.map +1 -1
- package/build/src/wallets/cip103.d.ts.map +1 -1
- package/build/src/wallets/cip103.js +5 -1
- package/build/src/wallets/cip103.js.map +1 -1
- package/build/src/wallets/commands.d.ts +6 -0
- package/build/src/wallets/commands.d.ts.map +1 -1
- package/build/src/wallets/commands.js +22 -0
- package/build/src/wallets/commands.js.map +1 -1
- package/build/src/wallets/contracts.d.ts +80 -5
- package/build/src/wallets/contracts.d.ts.map +1 -1
- package/build/src/wallets/contracts.js +174 -2
- package/build/src/wallets/contracts.js.map +1 -1
- package/build/src/wallets/errors.d.ts +8 -1
- package/build/src/wallets/errors.d.ts.map +1 -1
- package/build/src/wallets/errors.js +5 -1
- package/build/src/wallets/errors.js.map +1 -1
- package/build/src/wallets/holding-view.d.ts +33 -1
- package/build/src/wallets/holding-view.d.ts.map +1 -1
- package/build/src/wallets/holding-view.js +49 -1
- package/build/src/wallets/holding-view.js.map +1 -1
- package/build/src/wallets/holdings.d.ts +38 -8
- package/build/src/wallets/holdings.d.ts.map +1 -1
- package/build/src/wallets/holdings.js +49 -9
- package/build/src/wallets/holdings.js.map +1 -1
- package/build/src/wallets/index.d.ts +11 -2
- package/build/src/wallets/index.d.ts.map +1 -1
- package/build/src/wallets/index.js +25 -2
- package/build/src/wallets/index.js.map +1 -1
- package/build/src/wallets/registry-http.d.ts +32 -0
- package/build/src/wallets/registry-http.d.ts.map +1 -0
- package/build/src/wallets/registry-http.js +105 -0
- package/build/src/wallets/registry-http.js.map +1 -0
- package/build/src/wallets/store.d.ts +3 -0
- package/build/src/wallets/store.d.ts.map +1 -1
- package/build/src/wallets/store.js +2 -1
- package/build/src/wallets/store.js.map +1 -1
- package/build/src/wallets/token-registry.d.ts +126 -0
- package/build/src/wallets/token-registry.d.ts.map +1 -0
- package/build/src/wallets/token-registry.js +249 -0
- package/build/src/wallets/token-registry.js.map +1 -0
- package/build/src/wallets/tokens.d.ts +16 -4
- package/build/src/wallets/tokens.d.ts.map +1 -1
- package/build/src/wallets/tokens.js +21 -15
- package/build/src/wallets/tokens.js.map +1 -1
- package/build/src/wallets/wallet.d.ts +30 -0
- package/build/src/wallets/wallet.d.ts.map +1 -1
- package/build/src/wallets/wallet.js +377 -18
- package/build/src/wallets/wallet.js.map +1 -1
- package/package.json +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-member-traffic-status.d.ts +0 -33
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-member-traffic-status.d.ts.map +0 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-member-traffic-status.js +0 -92
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-member-traffic-status.js.map +0 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { TransferInstructionAction } from './commands';
|
|
2
|
+
import { type ChoiceContext, type FetchLike } from './da-utilities/client';
|
|
3
|
+
import type { InstrumentMetadata } from './holdings';
|
|
4
|
+
import type { ActiveContract, InstrumentId } from './types';
|
|
5
|
+
/** A token-standard registry, given by its URL and its admin party (see the module comment for how it is trusted). */
|
|
6
|
+
export interface TokenRegistryOptions {
|
|
7
|
+
/** The base URL that serves `/registry/...` at its root (a registry, or a proxy of one). */
|
|
8
|
+
readonly url: string;
|
|
9
|
+
/**
|
|
10
|
+
* The registry's admin party: the `instrumentId.admin` of its instruments, the party that must sign its holdings and
|
|
11
|
+
* transfer instructions. Pinned: the registry is never asked for it, only checked against it.
|
|
12
|
+
*/
|
|
13
|
+
readonly adminParty: string;
|
|
14
|
+
/** How errors and `describeWalletError` name the registry. Defaults to `The token registry at <url>`. */
|
|
15
|
+
readonly name?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Further parties that must have signed every holding and transfer instruction of the registry (for example the
|
|
18
|
+
* operators it publishes). Default: the admin alone.
|
|
19
|
+
*/
|
|
20
|
+
readonly requiredSignatories?: readonly string[];
|
|
21
|
+
/**
|
|
22
|
+
* The templates (package-name form, `#package-name:Module:Entity`) whose contracts count as the registry's. Default:
|
|
23
|
+
* any template the admin signed. Set it to narrow the registry to the templates you reviewed.
|
|
24
|
+
*/
|
|
25
|
+
readonly trustedTemplates?: readonly string[];
|
|
26
|
+
/**
|
|
27
|
+
* The token-standard interfaces the registry's contracts implement, which the wallet reads them through. Default:
|
|
28
|
+
* every one of {@link TOKEN_STANDARD_INTERFACES}. The wallet reads the interfaces any configured registry names, so
|
|
29
|
+
* name only the ones the registry uses: an unnamed interface is never asked of the participant. Leave out the V1
|
|
30
|
+
* interfaces for a registry that implements V2 alone, for example: their filters also match Canton Coin's holdings
|
|
31
|
+
* and transfer instructions, which then count toward the participant's list limit even with `cantonCoin: false`. An
|
|
32
|
+
* instruction read without its V1 view is answered through V2. Whatever is named, an interface whose package the
|
|
33
|
+
* participant does not have is left out of a read, so the rest of the state still loads, and
|
|
34
|
+
* `WalletState.registryInterfacesUnavailable` names it (every interface when the refusal does not say which).
|
|
35
|
+
*/
|
|
36
|
+
readonly interfaces?: readonly TokenStandardInterface[];
|
|
37
|
+
/**
|
|
38
|
+
* Full ids of further, non-standard interfaces the registry's holdings and transfer instructions implement
|
|
39
|
+
* (`#package-name:Module:Entity` or `<package-id>:Module:Entity`), whose views a library outside this SDK reads. The
|
|
40
|
+
* wallet asks the participant for their views in the state snapshot that reads the registry's holdings and transfer
|
|
41
|
+
* instructions, and passes them on raw as `Holding.interfaceViews` and `TransferOffer.interfaceViews`, keyed by the
|
|
42
|
+
* id as given here. It neither decodes nor checks them: which contracts count is decided by the standard views and
|
|
43
|
+
* the trust rules above, as without this option. An interface whose package the participant does not have is left out
|
|
44
|
+
* of the read like a standard one, and `WalletState.registryInterfacesUnavailable` names it by its id. A view is
|
|
45
|
+
* matched to its id by `Module:Entity` (the ledger reports views by package id), so no two different ids, in this
|
|
46
|
+
* registry or any other, may share a `Module:Entity`. Default: none, so only the token-standard interfaces are read.
|
|
47
|
+
*/
|
|
48
|
+
readonly extraInterfaceIds?: readonly string[];
|
|
49
|
+
/** Defaults to `globalThis.fetch`. Never another registry's `fetch`. */
|
|
50
|
+
readonly fetch?: FetchLike;
|
|
51
|
+
/** How long one request may take, in milliseconds. Defaults to {@link DA_REGISTRY_REQUEST_TIMEOUT_MS}. */
|
|
52
|
+
readonly timeoutMs?: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A token-standard interface a registry's contracts may implement: `HoldingV1`/`HoldingV2` and `TransferInstruction`
|
|
56
|
+
* V1/V2.
|
|
57
|
+
*/
|
|
58
|
+
export type TokenStandardInterface = 'holding-v2' | 'holding-v1' | 'transfer-instruction-v2' | 'transfer-instruction-v1';
|
|
59
|
+
/** Every {@link TokenStandardInterface}: what a registry without `interfaces` is read through. */
|
|
60
|
+
export declare const TOKEN_STANDARD_INTERFACES: readonly TokenStandardInterface[];
|
|
61
|
+
/** Which version of the token standard's `TransferInstruction` interface a choice is exercised through. */
|
|
62
|
+
export type TransferInstructionStandard = 'v1' | 'v2';
|
|
63
|
+
/** An instrument as the registry's metadata API describes it (`GET /registry/metadata/v1/instruments/{id}`). */
|
|
64
|
+
export interface RegistryInstrument extends InstrumentMetadata {
|
|
65
|
+
readonly id: string;
|
|
66
|
+
/** The APIs the registry supports for it, with their minor versions (`splice-api-token-holding-v2` → 0). */
|
|
67
|
+
readonly supportedApis: Readonly<Record<string, number>>;
|
|
68
|
+
/** Decimal string, when the registry reports it. */
|
|
69
|
+
readonly totalSupply?: string;
|
|
70
|
+
readonly totalSupplyAsOf?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* How long a snapshot waits for a registry lookup once the registry answered or failed before; a slower answer is still
|
|
74
|
+
* cached for the next call.
|
|
75
|
+
*/
|
|
76
|
+
export declare const TOKEN_REGISTRY_SNAPSHOT_WAIT_MS = 1500;
|
|
77
|
+
/** How long a snapshot waits for the very first lookup of a registry (at most the registry's own `timeoutMs`). */
|
|
78
|
+
export declare const TOKEN_REGISTRY_FIRST_WAIT_MS = 5000;
|
|
79
|
+
/** One registry of {@link TokenRegistryOptions}. */
|
|
80
|
+
export interface TokenRegistry {
|
|
81
|
+
readonly adminParty: string;
|
|
82
|
+
readonly url: string;
|
|
83
|
+
readonly name: string;
|
|
84
|
+
/** The interfaces the wallet reads the registry's contracts through (`TokenRegistryOptions.interfaces`). */
|
|
85
|
+
readonly interfaces: readonly TokenStandardInterface[];
|
|
86
|
+
/** The extra interface ids whose raw views the wallet passes on (`TokenRegistryOptions.extraInterfaceIds`). */
|
|
87
|
+
readonly extraInterfaceIds: readonly string[];
|
|
88
|
+
/**
|
|
89
|
+
* Whether `contract` counts as this registry's: of a trusted template (when the registry names them) and signed by
|
|
90
|
+
* the admin and every required signatory. Its views are not read here.
|
|
91
|
+
*/
|
|
92
|
+
trusts(contract: ActiveContract): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* The registry's `adminId`, once it answered (undefined while unknown). Read once, cached; a failure is asked again
|
|
95
|
+
* only after a back-off.
|
|
96
|
+
*/
|
|
97
|
+
registryAdminId(signal?: AbortSignal, waitMs?: number): Promise<string | undefined>;
|
|
98
|
+
/**
|
|
99
|
+
* The instrument's entry at the registry, or undefined on any failure (an error status, a malformed answer, an
|
|
100
|
+
* instrument of another admin) or while the registry is not confirmed to serve the pinned admin. Cached per
|
|
101
|
+
* instrument; waits at most {@link TOKEN_REGISTRY_FIRST_WAIT_MS} for a first lookup and
|
|
102
|
+
* {@link TOKEN_REGISTRY_SNAPSHOT_WAIT_MS} after that (a slower answer is still cached for the next call).
|
|
103
|
+
*/
|
|
104
|
+
instrument(instrumentId: InstrumentId, signal?: AbortSignal): Promise<RegistryInstrument | undefined>;
|
|
105
|
+
/**
|
|
106
|
+
* Context to accept, reject or withdraw one of the registry's transfer instructions through `standard`'s endpoint.
|
|
107
|
+
* Refused with `RegistryResponseError` (nothing submitted) unless the registry's `adminId` is confirmed to be the
|
|
108
|
+
* pinned admin: another party, no `adminId`, or a failed or timed-out lookup all refuse.
|
|
109
|
+
*/
|
|
110
|
+
transferInstructionContext(instructionCid: string, action: TransferInstructionAction, standard: TransferInstructionStandard, signal?: AbortSignal): Promise<ChoiceContext>;
|
|
111
|
+
}
|
|
112
|
+
/** Test hooks of {@link createTokenRegistry}; not part of the public options. */
|
|
113
|
+
export interface TokenRegistryInternalOptions {
|
|
114
|
+
/** The clock of the failure back-off, in milliseconds. Defaults to `Date.now`. */
|
|
115
|
+
readonly now?: () => number;
|
|
116
|
+
}
|
|
117
|
+
/** A metadata V1 `Instrument` of `id`, or undefined when the answer is of another instrument or malformed. */
|
|
118
|
+
export declare function parseRegistryInstrument(raw: unknown, id: string): RegistryInstrument | undefined;
|
|
119
|
+
/** One token-standard registry, as `options` configure it. */
|
|
120
|
+
export declare function createTokenRegistry(options: TokenRegistryOptions, internal?: TokenRegistryInternalOptions): TokenRegistry;
|
|
121
|
+
/**
|
|
122
|
+
* The registries of `options`, by admin party. Throws a `TypeError` on an invalid entry or two entries for one admin
|
|
123
|
+
* (wallets discover one registry URL per admin party).
|
|
124
|
+
*/
|
|
125
|
+
export declare function createTokenRegistries(options: readonly TokenRegistryOptions[] | undefined, internal?: TokenRegistryInternalOptions): ReadonlyMap<string, TokenRegistry>;
|
|
126
|
+
//# sourceMappingURL=token-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-registry.d.ts","sourceRoot":"","sources":["../../../src/wallets/token-registry.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAML,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAKrD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAU5D,sHAAsH;AACtH,MAAM,WAAW,oBAAoB;IACnC,4FAA4F;IAC5F,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,yGAAyG;IACzG,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjD;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C;;;;;;;;;OASG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACxD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,wEAAwE;IACxE,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,0GAA0G;IAC1G,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAChC,YAAY,GAAG,YAAY,GAAG,yBAAyB,GAAG,yBAAyB,CAAC;AAEtF,kGAAkG;AAClG,eAAO,MAAM,yBAAy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,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,yBAAyB,EACjC,QAAQ,EAAE,2BAA2B,EACrC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,aAAa,CAAC,CAAC;CAC3B;AAED,iFAAiF;AACjF,MAAM,WAAW,4BAA4B;IAC3C,kFAAkF;IAClF,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC7B;AAaD,8GAA8G;AAC9G,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAchG;AA+ED,8DAA8D;AAC9D,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,GAAE,4BAAiC,GAC1C,aAAa,CA6Gf;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,SAAS,oBAAoB,EAAE,GAAG,SAAS,EACpD,QAAQ,GAAE,4BAAiC,GAC1C,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAiBpC"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TOKEN_REGISTRY_FIRST_WAIT_MS = exports.TOKEN_REGISTRY_SNAPSHOT_WAIT_MS = exports.TOKEN_STANDARD_INTERFACES = void 0;
|
|
4
|
+
exports.parseRegistryInstrument = parseRegistryInstrument;
|
|
5
|
+
exports.createTokenRegistry = createTokenRegistry;
|
|
6
|
+
exports.createTokenRegistries = createTokenRegistries;
|
|
7
|
+
/**
|
|
8
|
+
* Token-standard registries a wallet is given by URL and admin party: any CIP-56 / CIP-0112 registry beside Canton Coin
|
|
9
|
+
* and DA's Utility Registry. Browser-safe: it uses an injectable `fetch` and sends only `content-type:
|
|
10
|
+
* application/json`.
|
|
11
|
+
*
|
|
12
|
+
* Trust: the admin party is pinned by the caller. A contract counts as the registry's only when that admin (and every
|
|
13
|
+
* `requiredSignatories` party) signed it, and, when `trustedTemplates` is set, when it is of one of those templates.
|
|
14
|
+
* The registry's HTTP answers are never trusted for the admin: its `adminId` (`GET /registry/metadata/v1/info`) is read
|
|
15
|
+
* once to check the URL serves that admin. A registry whose `adminId` is another party, absent, or could not be read
|
|
16
|
+
* has its instrument metadata ignored and its choice contexts refused (fail closed), so a misconfiguration fails with a
|
|
17
|
+
* clear error before anything is submitted.
|
|
18
|
+
*
|
|
19
|
+
* Endpoints, at the root of `url` (the token standard specs at Splice 0.6.14, `token-standard/<api>/openapi`):
|
|
20
|
+
*
|
|
21
|
+
* - Metadata V1 (CIP-0112 registries serve it too; there is no V2 metadata API): `GET /registry/metadata/v1/info` and
|
|
22
|
+
* `GET /registry/metadata/v1/instruments/{instrumentId}`;
|
|
23
|
+
* - Transfer instruction V1 and V2: `POST
|
|
24
|
+
* /registry/transfer-instruction/{v1|v2}/{cid}/choice-contexts/{accept|reject|withdraw}`.
|
|
25
|
+
*/
|
|
26
|
+
const abort_1 = require("./abort");
|
|
27
|
+
const client_1 = require("./da-utilities/client");
|
|
28
|
+
const errors_1 = require("./errors");
|
|
29
|
+
const holdings_1 = require("./holdings");
|
|
30
|
+
const json_1 = require("./json");
|
|
31
|
+
const registry_http_1 = require("./registry-http");
|
|
32
|
+
const templates_1 = require("./templates");
|
|
33
|
+
const constants_1 = require("../utils/token-standard/v1/constants");
|
|
34
|
+
const constants_2 = require("../utils/token-standard/v2/constants");
|
|
35
|
+
/** Every {@link TokenStandardInterface}: what a registry without `interfaces` is read through. */
|
|
36
|
+
exports.TOKEN_STANDARD_INTERFACES = Object.freeze([
|
|
37
|
+
'holding-v2',
|
|
38
|
+
'holding-v1',
|
|
39
|
+
'transfer-instruction-v2',
|
|
40
|
+
'transfer-instruction-v1',
|
|
41
|
+
]);
|
|
42
|
+
/**
|
|
43
|
+
* How long a snapshot waits for a registry lookup once the registry answered or failed before; a slower answer is still
|
|
44
|
+
* cached for the next call.
|
|
45
|
+
*/
|
|
46
|
+
exports.TOKEN_REGISTRY_SNAPSHOT_WAIT_MS = 1500;
|
|
47
|
+
/** How long a snapshot waits for the very first lookup of a registry (at most the registry's own `timeoutMs`). */
|
|
48
|
+
exports.TOKEN_REGISTRY_FIRST_WAIT_MS = 5000;
|
|
49
|
+
function readSupportedApis(value) {
|
|
50
|
+
if (value === undefined)
|
|
51
|
+
return {};
|
|
52
|
+
if (!(0, json_1.isRecord)(value))
|
|
53
|
+
return undefined;
|
|
54
|
+
const apis = Object.create(null);
|
|
55
|
+
for (const [api, version] of Object.entries(value)) {
|
|
56
|
+
if (typeof version !== 'number' || !Number.isInteger(version) || version < 0)
|
|
57
|
+
return undefined;
|
|
58
|
+
apis[api] = version;
|
|
59
|
+
}
|
|
60
|
+
return apis;
|
|
61
|
+
}
|
|
62
|
+
/** A metadata V1 `Instrument` of `id`, or undefined when the answer is of another instrument or malformed. */
|
|
63
|
+
function parseRegistryInstrument(raw, id) {
|
|
64
|
+
const metadata = (0, client_1.parseInstrumentMetadata)(raw, id);
|
|
65
|
+
if (metadata === undefined || !(0, json_1.isRecord)(raw))
|
|
66
|
+
return undefined;
|
|
67
|
+
const supportedApis = readSupportedApis(raw['supportedApis']);
|
|
68
|
+
if (supportedApis === undefined)
|
|
69
|
+
return undefined;
|
|
70
|
+
const totalSupply = (0, json_1.nonEmptyString)(raw['totalSupply']);
|
|
71
|
+
const totalSupplyAsOf = (0, json_1.nonEmptyString)(raw['totalSupplyAsOf']);
|
|
72
|
+
return {
|
|
73
|
+
id,
|
|
74
|
+
...metadata,
|
|
75
|
+
supportedApis,
|
|
76
|
+
...(totalSupply !== undefined && { totalSupply }),
|
|
77
|
+
...(totalSupplyAsOf !== undefined && { totalSupplyAsOf }),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function requireParty(value, field) {
|
|
81
|
+
const party = (0, json_1.nonEmptyString)(value);
|
|
82
|
+
if (party === undefined)
|
|
83
|
+
throw new TypeError(`${field} must be a non-empty party id`);
|
|
84
|
+
return party;
|
|
85
|
+
}
|
|
86
|
+
/** `interfaces` as given (each once, in {@link TOKEN_STANDARD_INTERFACES} order), or all of them when not given. */
|
|
87
|
+
function requireInterfaces(value) {
|
|
88
|
+
if (value === undefined)
|
|
89
|
+
return exports.TOKEN_STANDARD_INTERFACES;
|
|
90
|
+
const known = exports.TOKEN_STANDARD_INTERFACES;
|
|
91
|
+
if (!Array.isArray(value) || value.length === 0 || !value.every((entry) => known.includes(entry))) {
|
|
92
|
+
throw new TypeError(`registries[].interfaces must name one or more of ${exports.TOKEN_STANDARD_INTERFACES.join(', ')}`);
|
|
93
|
+
}
|
|
94
|
+
return Object.freeze(exports.TOKEN_STANDARD_INTERFACES.filter((entry) => value.includes(entry)));
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A full interface id: `#package-name:Module:Entity` or `<package-id>:Module:Entity` (a package id is 64 lowercase hex
|
|
98
|
+
* digits; a module and an entity are dotted Daml names).
|
|
99
|
+
*/
|
|
100
|
+
const FULL_INTERFACE_ID_PATTERN = /^(?:#[A-Za-z0-9][A-Za-z0-9._-]*|[0-9a-f]{64}):[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*:[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*$/;
|
|
101
|
+
/** `Module:Entity` of a full interface id. */
|
|
102
|
+
const moduleEntity = (interfaceId) => interfaceId.slice(interfaceId.indexOf(':') + 1);
|
|
103
|
+
/** The `Module:Entity` of each standard interface the wallet reads, which an extra id must not repeat. */
|
|
104
|
+
const STANDARD_INTERFACE_NAMES = new Set([
|
|
105
|
+
constants_1.TOKEN_STANDARD_V1_HOLDING_INTERFACE_ID,
|
|
106
|
+
constants_2.TOKEN_STANDARD_V2_HOLDING_INTERFACE_ID,
|
|
107
|
+
constants_1.TOKEN_STANDARD_V1_TRANSFER_INSTRUCTION_INTERFACE_ID,
|
|
108
|
+
constants_2.TOKEN_STANDARD_V2_TRANSFER_INSTRUCTION_INTERFACE_ID,
|
|
109
|
+
].map(moduleEntity));
|
|
110
|
+
/** `extraInterfaceIds` as given (each once, in order), validated; empty when not given. */
|
|
111
|
+
function requireExtraInterfaceIds(value) {
|
|
112
|
+
if (value === undefined)
|
|
113
|
+
return Object.freeze([]);
|
|
114
|
+
if (!Array.isArray(value))
|
|
115
|
+
throw new TypeError('registries[].extraInterfaceIds must be a list of interface ids');
|
|
116
|
+
const ids = [];
|
|
117
|
+
for (const entry of value) {
|
|
118
|
+
if (typeof entry !== 'string' || !FULL_INTERFACE_ID_PATTERN.test(entry)) {
|
|
119
|
+
throw new TypeError('registries[].extraInterfaceIds must be full interface ids (#package-name:Module:Entity or <package-id>:Module:Entity)');
|
|
120
|
+
}
|
|
121
|
+
if (STANDARD_INTERFACE_NAMES.has(moduleEntity(entry))) {
|
|
122
|
+
throw new TypeError(`registries[].extraInterfaceIds names the token-standard interface ${entry}: name standard interfaces in interfaces`);
|
|
123
|
+
}
|
|
124
|
+
if (!ids.includes(entry))
|
|
125
|
+
ids.push(entry);
|
|
126
|
+
}
|
|
127
|
+
refuseSharedModuleEntity(ids, 'registries[].extraInterfaceIds');
|
|
128
|
+
return Object.freeze(ids);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Throws when two different ids in `ids` share a `Module:Entity`. The ledger reports a view by package id, so a view is
|
|
132
|
+
* matched to a configured extra id by `Module:Entity` alone: two packages' interfaces of one name (or two forms of one
|
|
133
|
+
* id) cannot be told apart, and a view of one would be reported under the other.
|
|
134
|
+
*/
|
|
135
|
+
function refuseSharedModuleEntity(ids, field) {
|
|
136
|
+
const byName = new Map();
|
|
137
|
+
for (const id of ids) {
|
|
138
|
+
const name = moduleEntity(id);
|
|
139
|
+
const other = byName.get(name);
|
|
140
|
+
if (other !== undefined && other !== id) {
|
|
141
|
+
throw new TypeError(`${field} names ${other} and ${id}, which share the Module:Entity ${name}: a view is matched by Module:Entity, so name one`);
|
|
142
|
+
}
|
|
143
|
+
byName.set(name, id);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/** One token-standard registry, as `options` configure it. */
|
|
147
|
+
function createTokenRegistry(options, internal = {}) {
|
|
148
|
+
const adminParty = requireParty(options.adminParty, 'registries[].adminParty');
|
|
149
|
+
if ((0, json_1.nonEmptyString)(options.url) === undefined)
|
|
150
|
+
throw new TypeError('registries[].url must be a non-empty URL');
|
|
151
|
+
const url = (0, client_1.trimTrailingSlashes)(options.url);
|
|
152
|
+
const name = (0, json_1.nonEmptyString)(options.name) ?? `The token registry at ${url}`;
|
|
153
|
+
const requiredSignatories = (options.requiredSignatories ?? []).map((party, index) => requireParty(party, `registries[].requiredSignatories[${index}]`));
|
|
154
|
+
const trustedTemplates = options.trustedTemplates?.map((templateId) => {
|
|
155
|
+
if (typeof templateId !== 'string' || !templateId.startsWith('#')) {
|
|
156
|
+
throw new TypeError('registries[].trustedTemplates must be package-name form ids (#package-name:Module:Entity)');
|
|
157
|
+
}
|
|
158
|
+
return templateId;
|
|
159
|
+
});
|
|
160
|
+
const interfaces = requireInterfaces(options.interfaces);
|
|
161
|
+
const extraInterfaceIds = requireExtraInterfaceIds(options.extraInterfaceIds);
|
|
162
|
+
const timeoutMs = options.timeoutMs ?? client_1.DA_REGISTRY_REQUEST_TIMEOUT_MS;
|
|
163
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0 || timeoutMs > abort_1.MAX_TIMER_MS) {
|
|
164
|
+
throw new TypeError(`registries[].timeoutMs must be a positive finite number of milliseconds, at most ${abort_1.MAX_TIMER_MS}`);
|
|
165
|
+
}
|
|
166
|
+
const now = internal.now ?? Date.now;
|
|
167
|
+
const call = (0, registry_http_1.registryCaller)({
|
|
168
|
+
baseUrl: url,
|
|
169
|
+
fetch: options.fetch ?? (0, client_1.globalFetch)('registries[].fetch'),
|
|
170
|
+
timeoutMs,
|
|
171
|
+
name,
|
|
172
|
+
});
|
|
173
|
+
const signers = [adminParty, ...requiredSignatories];
|
|
174
|
+
const firstWaitMs = Math.min(timeoutMs, exports.TOKEN_REGISTRY_FIRST_WAIT_MS);
|
|
175
|
+
const admin = (0, registry_http_1.cachedLookup)(async () => {
|
|
176
|
+
const info = await call('GET', '/registry/metadata/v1/info', undefined, undefined);
|
|
177
|
+
return (0, json_1.isRecord)(info) ? (0, json_1.nonEmptyString)(info['adminId']) : undefined;
|
|
178
|
+
}, now);
|
|
179
|
+
/** The `adminId`: the whole request on the very first lookup, a short wait after that. */
|
|
180
|
+
async function registryAdminId(signal, waitMs) {
|
|
181
|
+
return admin.get(signal, waitMs ?? (admin.settled() ? exports.TOKEN_REGISTRY_SNAPSHOT_WAIT_MS : firstWaitMs));
|
|
182
|
+
}
|
|
183
|
+
const instruments = new Map();
|
|
184
|
+
function instrumentLookup(instrumentId) {
|
|
185
|
+
const key = (0, holdings_1.instrumentKey)(instrumentId);
|
|
186
|
+
let entry = instruments.get(key);
|
|
187
|
+
if (entry === undefined) {
|
|
188
|
+
entry = (0, registry_http_1.cachedLookup)(async () => parseRegistryInstrument(await call('GET', `/registry/metadata/v1/instruments/${encodeURIComponent(instrumentId.id)}`, undefined, undefined), instrumentId.id), now);
|
|
189
|
+
instruments.set(key, entry);
|
|
190
|
+
}
|
|
191
|
+
return entry;
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
adminParty,
|
|
195
|
+
url,
|
|
196
|
+
name,
|
|
197
|
+
interfaces,
|
|
198
|
+
extraInterfaceIds,
|
|
199
|
+
trusts: (contract) => signers.every((party) => contract.signatories.includes(party)) &&
|
|
200
|
+
(trustedTemplates === undefined || trustedTemplates.some((templateId) => (0, templates_1.isTemplate)(contract, templateId))),
|
|
201
|
+
registryAdminId,
|
|
202
|
+
async instrument(instrumentId, signal) {
|
|
203
|
+
(0, abort_1.throwIfAborted)(signal);
|
|
204
|
+
if (instrumentId.admin !== adminParty)
|
|
205
|
+
return undefined;
|
|
206
|
+
const lookup = instrumentLookup(instrumentId);
|
|
207
|
+
const [confirmed, entry] = await Promise.all([
|
|
208
|
+
registryAdminId(signal),
|
|
209
|
+
lookup.get(signal, lookup.settled() ? exports.TOKEN_REGISTRY_SNAPSHOT_WAIT_MS : firstWaitMs),
|
|
210
|
+
]);
|
|
211
|
+
// A registry not confirmed to serve the pinned admin (another network's, or not answering) is ignored.
|
|
212
|
+
return confirmed === adminParty ? entry : undefined;
|
|
213
|
+
},
|
|
214
|
+
async transferInstructionContext(instructionCid, action, standard, signal) {
|
|
215
|
+
// Fail closed: no context is asked for (and nothing submitted) until the registry is confirmed to serve the
|
|
216
|
+
// pinned admin. An unanswered or failed lookup (including during its back-off) refuses the action as well.
|
|
217
|
+
const confirmed = await registryAdminId(signal, timeoutMs);
|
|
218
|
+
if (confirmed === undefined) {
|
|
219
|
+
throw new errors_1.RegistryResponseError(`${name} could not be confirmed to serve the admin party ${adminParty} (its /registry/metadata/v1/info gave no adminId, failed or timed out). Nothing was submitted; try again shortly.`);
|
|
220
|
+
}
|
|
221
|
+
if (confirmed !== adminParty) {
|
|
222
|
+
throw new errors_1.RegistryResponseError(`${name} serves the admin party ${confirmed}, not the configured ${adminParty}: its url and adminParty name different registries. Nothing was submitted.`);
|
|
223
|
+
}
|
|
224
|
+
return (0, client_1.parseChoiceContext)(await call('POST', `/registry/transfer-instruction/${standard}/${encodeURIComponent(instructionCid)}/choice-contexts/${action}`, { excludeDebugFields: true }, signal));
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The registries of `options`, by admin party. Throws a `TypeError` on an invalid entry or two entries for one admin
|
|
230
|
+
* (wallets discover one registry URL per admin party).
|
|
231
|
+
*/
|
|
232
|
+
function createTokenRegistries(options, internal = {}) {
|
|
233
|
+
const registries = new Map();
|
|
234
|
+
if (options === undefined)
|
|
235
|
+
return registries;
|
|
236
|
+
if (!Array.isArray(options))
|
|
237
|
+
throw new TypeError('registries must be a list');
|
|
238
|
+
for (const entry of options) {
|
|
239
|
+
const registry = createTokenRegistry(entry, internal);
|
|
240
|
+
if (registries.has(registry.adminParty)) {
|
|
241
|
+
throw new TypeError(`registries names the admin party ${registry.adminParty} twice`);
|
|
242
|
+
}
|
|
243
|
+
registries.set(registry.adminParty, registry);
|
|
244
|
+
}
|
|
245
|
+
// Every registry's extra interfaces are read in one snapshot, so the rule holds across registries too.
|
|
246
|
+
refuseSharedModuleEntity([...registries.values()].flatMap((registry) => registry.extraInterfaceIds), 'registries[].extraInterfaceIds');
|
|
247
|
+
return registries;
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=token-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-registry.js","sourceRoot":"","sources":["../../../src/wallets/token-registry.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,mCAAuD;AAEvD,kDAQ+B;AAC/B,qCAAiD;AAEjD,yCAA2C;AAC3C,iCAAkD;AAClD,mDAAkF;AAClF,2CAAyC;AAEzC,oEAG8C;AAC9C,oEAG8C;AA2D9C,kGAAkG;AACrF,QAAA,yBAAyB,GAAsC,MAAM,CAAC,MAAM,CAAC;IACxF,YAAY;IACZ,YAAY;IACZ,yBAAyB;IACzB,yBAAyB;CAC1B,CAAC,CAAC;AAeH;;;GAGG;AACU,QAAA,+BAA+B,GAAG,IAAI,CAAC;AACpD,kHAAkH;AACrG,QAAA,4BAA4B,GAAG,IAAI,CAAC;AA+CjD,SAAS,iBAAiB,CAAC,KAAc;IACvC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACnC,IAAI,CAAC,IAAA,eAAQ,EAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACvC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAA2B,CAAC;IAC3D,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAA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;QACtD,IAAI,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YACxC,MAAM,IAAI,SAAS,CAAC,oCAAoC,QAAQ,CAAC,UAAU,QAAQ,CAAC,CAAC;QACvF,CAAC;QACD,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAChD,CAAC;IACD,uGAAuG;IACvG,wBAAwB,CACtB,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAC1E,gCAAgC,CACjC,CAAC;IACF,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -22,9 +22,12 @@ export declare function lockedInExpiredOffers(holdings: readonly Holding[], offe
|
|
|
22
22
|
export declare function expiredUnclaimedLocks(holdings: readonly Holding[], offers: ReadonlyArray<Pick<TransferOffer, 'lockedHoldingCid'>>, atMs: number): Holding[];
|
|
23
23
|
/** Per instrument (by `instrumentKey`), the units of `holdings`. */
|
|
24
24
|
export declare function unitsByInstrument(holdings: readonly Holding[]): Map<string, bigint>;
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* What the wallet can do with a token. Honest per token: Canton Coin's, and a configured token-standard registry's, are
|
|
27
|
+
* what this wallet supports for them today.
|
|
28
|
+
*/
|
|
26
29
|
export interface TokenCapabilities {
|
|
27
|
-
/** Send it (`planTransfer`, `submitTransfer`). Not Canton Coin. */
|
|
30
|
+
/** Send it (`planTransfer`, `submitTransfer`). Not Canton Coin, not a configured registry's token. */
|
|
28
31
|
readonly send: boolean;
|
|
29
32
|
/** Redeem it (`requestBurn`). Not Canton Coin. */
|
|
30
33
|
readonly burn: boolean;
|
|
@@ -40,7 +43,10 @@ export interface TokenCapabilities {
|
|
|
40
43
|
* `withdrawExpiredTransferOffers`, `reclaimLockedTokens`).
|
|
41
44
|
*/
|
|
42
45
|
readonly withdrawOffers: boolean;
|
|
43
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Accept or reject DA mint offers of it. Only DA Registry tokens have them; a token-standard registry's mint offer is
|
|
48
|
+
* an incoming transfer offer (`TransferOffer.mint`), answered with `answerOffers`.
|
|
49
|
+
*/
|
|
44
50
|
readonly answerMintOffers: boolean;
|
|
45
51
|
}
|
|
46
52
|
/** Everything a page shows for one token, from one wallet state (see {@link walletTokens}). */
|
|
@@ -73,6 +79,11 @@ export interface WalletToken {
|
|
|
73
79
|
readonly canReclaim: boolean;
|
|
74
80
|
readonly holdingCount: number;
|
|
75
81
|
readonly isCantonCoin: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Whether the token is of a token-standard registry the wallet was configured with (`WalletOptions.registries`). Such
|
|
84
|
+
* a token is listed and its offers answered, but it is not sent, burnt or pre-approved through the wallet.
|
|
85
|
+
*/
|
|
86
|
+
readonly isTokenStandard: boolean;
|
|
76
87
|
readonly capabilities: TokenCapabilities;
|
|
77
88
|
/**
|
|
78
89
|
* Transfer offers of this token, each with `expired` set (see {@link WalletTokenOffer}). `expiredIncoming` is the part
|
|
@@ -108,7 +119,8 @@ export interface WalletToken {
|
|
|
108
119
|
/**
|
|
109
120
|
* `covered` (`preapproval` is set) or `none` for a DA token. `unknown` for Canton Coin: its preapproval is a
|
|
110
121
|
* DSO-signed Splice `TransferPreapproval` made through the party's validator, which this wallet does not read, so a
|
|
111
|
-
* page must not say the party has none.
|
|
122
|
+
* page must not say the party has none. Also `unknown` for a configured registry's token, which DA preapprovals do
|
|
123
|
+
* not cover.
|
|
112
124
|
*/
|
|
113
125
|
readonly preapprovalStatus: 'covered' | 'none' | 'unknown';
|
|
114
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/wallets/tokens.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,mB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;IAChC,QAAQ,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAChD,QAAQ,CAAC,cAAc,EAAE;QAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAA;KAAE,CAAC;IACtH,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9C,QAAQ,CAAC,oBAAoB,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC9D,kEAAkE;IAClE,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED,iFAAiF;AACjF,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,kHAAkH;IAClH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,uCAAuC;AACvC,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAC3C;AAMD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,EAAE,OAAO,GAAE,mBAAwB,GAAG,WAAW,EAAE,CAwGvG;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,WAAW,EAAE,EAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,MAAM,CAAC,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACnC,WAAW,GAAG,IAAI,CAOpB"}
|
|
@@ -95,30 +95,34 @@ const compareText = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
|
95
95
|
*/
|
|
96
96
|
function walletTokens(state, options = {}) {
|
|
97
97
|
const drafts = new Map();
|
|
98
|
-
const note = (instrumentId, cantonCoin, balance) => {
|
|
98
|
+
const note = (instrumentId, cantonCoin, tokenStandard, balance) => {
|
|
99
99
|
const key = (0, holdings_1.instrumentKey)(instrumentId);
|
|
100
|
-
const draft = drafts.get(key) ?? { instrumentId, cantonCoin: false };
|
|
100
|
+
const draft = drafts.get(key) ?? { instrumentId, cantonCoin: false, tokenStandard: false };
|
|
101
101
|
draft.cantonCoin || (draft.cantonCoin = cantonCoin);
|
|
102
|
+
draft.tokenStandard || (draft.tokenStandard = tokenStandard);
|
|
102
103
|
if (balance !== undefined)
|
|
103
104
|
draft.balance = balance;
|
|
104
105
|
drafts.set(key, draft);
|
|
105
106
|
};
|
|
106
|
-
for (const balance of state.balances)
|
|
107
|
-
note(balance.instrumentId, balance.source === 'amulet', balance);
|
|
107
|
+
for (const balance of state.balances) {
|
|
108
|
+
note(balance.instrumentId, balance.source === 'amulet', balance.source === 'token-standard', balance);
|
|
109
|
+
}
|
|
108
110
|
for (const offer of [...state.transferOffers.incoming, ...state.transferOffers.outgoing]) {
|
|
109
|
-
note(offer.instrumentId, offer.registry === 'amulet');
|
|
111
|
+
note(offer.instrumentId, offer.registry === 'amulet', offer.registry === 'token-standard');
|
|
110
112
|
}
|
|
111
113
|
for (const item of [...state.mintOffers, ...state.burnRequests])
|
|
112
|
-
note(item.instrumentId, false);
|
|
114
|
+
note(item.instrumentId, false, false);
|
|
113
115
|
if (options.includeEmptyCantonCoin === true && ![...drafts.values()].some((draft) => draft.cantonCoin)) {
|
|
114
116
|
// The DSO party is not in the state: an empty admin, so nothing acts on this entry's instrument.
|
|
115
|
-
note({ admin: '', id: constants_1.AMULET_INSTRUMENT_ID }, true);
|
|
117
|
+
note({ admin: '', id: constants_1.AMULET_INSTRUMENT_ID }, true, false);
|
|
116
118
|
}
|
|
117
119
|
const cantonCoinUnavailable = state.cantonCoinUnavailable === true;
|
|
118
120
|
const withExpiry = (offer) => ({ ...offer, expired: offer.expired === true });
|
|
119
121
|
const of = (list, key) => list.filter((item) => (0, holdings_1.instrumentKey)(item.instrumentId) === key);
|
|
120
122
|
return [...drafts.entries()]
|
|
121
|
-
.map(([key, { instrumentId, balance, cantonCoin }]) => {
|
|
123
|
+
.map(([key, { instrumentId, balance, cantonCoin, tokenStandard }]) => {
|
|
124
|
+
// Neither Canton Coin nor a configured registry's token is sent, burnt or pre-approved through the wallet.
|
|
125
|
+
const daToken = !cantonCoin && !tokenStandard;
|
|
122
126
|
// Canton Coin offered before the party holds any has no balance to carry the registry's answer.
|
|
123
127
|
const metadata = balance?.metadata ?? (cantonCoin ? constants_1.CANTON_COIN_METADATA : undefined);
|
|
124
128
|
const incoming = of(state.transferOffers.incoming, key).map(withExpiry);
|
|
@@ -127,7 +131,7 @@ function walletTokens(state, options = {}) {
|
|
|
127
131
|
const lockedUnits = units(balance?.locked);
|
|
128
132
|
const inLocks = units(balance?.lockedInExpiredLocks);
|
|
129
133
|
const reclaimable = units(balance?.lockedInExpiredOffers) + inLocks;
|
|
130
|
-
const preapprovals =
|
|
134
|
+
const preapprovals = !daToken
|
|
131
135
|
? []
|
|
132
136
|
: state.transferPreapprovals.filter((candidate) => candidate.instrumentAdmin === instrumentId.admin &&
|
|
133
137
|
(candidate.instrumentIds.length === 0 || candidate.instrumentIds.includes(instrumentId.id)));
|
|
@@ -145,16 +149,18 @@ function walletTokens(state, options = {}) {
|
|
|
145
149
|
available: balance?.unlocked ?? ZERO,
|
|
146
150
|
locked: balance?.locked ?? ZERO,
|
|
147
151
|
lockedReclaimable: (0, decimal_1.formatDecimalUnits)(reclaimable > lockedUnits ? lockedUnits : reclaimable),
|
|
148
|
-
|
|
152
|
+
// `reclaimLockedTokens` covers DA's and Canton Coin's offers; a configured registry's are withdrawn one by one.
|
|
153
|
+
canReclaim: !tokenStandard && (expiredOutgoing.length > 0 || inLocks > 0n),
|
|
149
154
|
holdingCount: balance?.holdingCount ?? 0,
|
|
150
155
|
isCantonCoin: cantonCoin,
|
|
156
|
+
isTokenStandard: tokenStandard,
|
|
151
157
|
capabilities: {
|
|
152
|
-
send:
|
|
153
|
-
burn:
|
|
154
|
-
preapprove:
|
|
158
|
+
send: daToken,
|
|
159
|
+
burn: daToken,
|
|
160
|
+
preapprove: daToken,
|
|
155
161
|
answerOffers: true,
|
|
156
162
|
withdrawOffers: true,
|
|
157
|
-
answerMintOffers:
|
|
163
|
+
answerMintOffers: daToken,
|
|
158
164
|
},
|
|
159
165
|
offers: {
|
|
160
166
|
incoming,
|
|
@@ -166,7 +172,7 @@ function walletTokens(state, options = {}) {
|
|
|
166
172
|
burnRequests: of(state.burnRequests, key),
|
|
167
173
|
preapproval,
|
|
168
174
|
preapprovals,
|
|
169
|
-
preapprovalStatus:
|
|
175
|
+
preapprovalStatus: !daToken ? 'unknown' : preapproval === null ? 'none' : 'covered',
|
|
170
176
|
unavailable: cantonCoin && cantonCoinUnavailable,
|
|
171
177
|
};
|
|
172
178
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/wallets/tokens.ts"],"names":[],"mappings":";;;;;;;;AAAA;;;;GAIG;AACH,kDAAgF;AAEhF,2CAAkD;AAClD,uCAAkE;AAClE,yCAAwH;AAGxH;;;GAGG;AACH,gCAAuC,KAA2C,EAAE,IAAY;IAC9F,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACjD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,IAAI,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,+BACE,QAA4B,EAC5B,MAAgC;IAEhC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/F,MAAM,YAAY,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