@fairmint/canton-node-sdk 0.0.276 → 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 +108 -0
- package/build/src/da-registry/setup/steps.js +2 -1
- package/build/src/da-registry/setup/steps.js.map +1 -1
- package/build/src/da-registry/templates.d.ts +4 -0
- package/build/src/da-registry/templates.d.ts.map +1 -1
- package/build/src/da-registry/templates.js +4 -0
- package/build/src/da-registry/templates.js.map +1 -1
- package/build/src/index.d.ts +1 -0
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +24 -1
- package/build/src/index.js.map +1 -1
- 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/utils/token-standard/v1/constants.d.ts +2 -0
- package/build/src/utils/token-standard/v1/constants.d.ts.map +1 -1
- package/build/src/utils/token-standard/v1/constants.js +3 -1
- package/build/src/utils/token-standard/v1/constants.js.map +1 -1
- package/build/src/wallets/acs.d.ts +9 -0
- package/build/src/wallets/acs.d.ts.map +1 -0
- package/build/src/wallets/acs.js +87 -0
- package/build/src/wallets/acs.js.map +1 -0
- package/build/src/wallets/cip103.d.ts +174 -0
- package/build/src/wallets/cip103.d.ts.map +1 -0
- package/build/src/wallets/cip103.js +452 -0
- package/build/src/wallets/cip103.js.map +1 -0
- package/build/src/wallets/commands.d.ts +60 -0
- package/build/src/wallets/commands.d.ts.map +1 -0
- package/build/src/wallets/commands.js +121 -0
- package/build/src/wallets/commands.js.map +1 -0
- package/build/src/wallets/contracts.d.ts +63 -0
- package/build/src/wallets/contracts.d.ts.map +1 -0
- package/build/src/wallets/contracts.js +117 -0
- package/build/src/wallets/contracts.js.map +1 -0
- package/build/src/wallets/da-utilities/client.d.ts +75 -0
- package/build/src/wallets/da-utilities/client.d.ts.map +1 -0
- package/build/src/wallets/da-utilities/client.js +238 -0
- package/build/src/wallets/da-utilities/client.js.map +1 -0
- package/build/src/wallets/decimal.d.ts +9 -0
- package/build/src/wallets/decimal.d.ts.map +1 -0
- package/build/src/wallets/decimal.js +29 -0
- package/build/src/wallets/decimal.js.map +1 -0
- package/build/src/wallets/errors.d.ts +66 -0
- package/build/src/wallets/errors.d.ts.map +1 -0
- package/build/src/wallets/errors.js +71 -0
- package/build/src/wallets/errors.js.map +1 -0
- package/build/src/wallets/holdings.d.ts +48 -0
- package/build/src/wallets/holdings.d.ts.map +1 -0
- package/build/src/wallets/holdings.js +198 -0
- package/build/src/wallets/holdings.js.map +1 -0
- package/build/src/wallets/index.d.ts +23 -0
- package/build/src/wallets/index.d.ts.map +1 -0
- package/build/src/wallets/index.js +36 -0
- package/build/src/wallets/index.js.map +1 -0
- package/build/src/wallets/instrument.d.ts +5 -0
- package/build/src/wallets/instrument.d.ts.map +1 -0
- package/build/src/wallets/instrument.js +18 -0
- package/build/src/wallets/instrument.js.map +1 -0
- package/build/src/wallets/json.d.ts +16 -0
- package/build/src/wallets/json.d.ts.map +1 -0
- package/build/src/wallets/json.js +27 -0
- package/build/src/wallets/json.js.map +1 -0
- 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 +36 -0
- package/build/src/wallets/templates.d.ts.map +1 -0
- package/build/src/wallets/templates.js +70 -0
- package/build/src/wallets/templates.js.map +1 -0
- package/build/src/wallets/token-registry.d.ts +95 -0
- package/build/src/wallets/token-registry.d.ts.map +1 -0
- package/build/src/wallets/token-registry.js +19 -0
- package/build/src/wallets/token-registry.js.map +1 -0
- package/build/src/wallets/token-standard-wallet.d.ts +146 -0
- package/build/src/wallets/token-standard-wallet.d.ts.map +1 -0
- package/build/src/wallets/token-standard-wallet.js +269 -0
- package/build/src/wallets/token-standard-wallet.js.map +1 -0
- package/build/src/wallets/token-wallet.d.ts +50 -0
- package/build/src/wallets/token-wallet.d.ts.map +1 -0
- package/build/src/wallets/token-wallet.js +175 -0
- package/build/src/wallets/token-wallet.js.map +1 -0
- package/build/src/wallets/types.d.ts +74 -0
- package/build/src/wallets/types.d.ts.map +1 -0
- package/build/src/wallets/types.js +3 -0
- package/build/src/wallets/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_READ_RETRY_DELAYS_MS = exports.LOOP_HTTP_REFUSED_MESSAGE = exports.ACS_FALLBACK_CODES = exports.ACS_MAX_PAGES = exports.ACS_PAGE_SIZE = exports.CIP103_ERROR_CODES = void 0;
|
|
4
|
+
exports.cip103ErrorCode = cip103ErrorCode;
|
|
5
|
+
exports.describeError = describeError;
|
|
6
|
+
exports.cip103SubmitError = cip103SubmitError;
|
|
7
|
+
exports.primaryAccount = primaryAccount;
|
|
8
|
+
exports.primaryPartyId = primaryPartyId;
|
|
9
|
+
exports.isRateLimited = isRateLimited;
|
|
10
|
+
exports.cip103Wallet = cip103Wallet;
|
|
11
|
+
/**
|
|
12
|
+
* The SDK's CIP-0103 (Canton dApp API) client: the only way this module talks to a wallet. Any CIP-0103 provider plugs
|
|
13
|
+
* in (Loop's `loop.getCip103Provider()`, a `@canton-network/dapp-sdk` provider, `window.canton`, Send Connect, …). The
|
|
14
|
+
* provider type is structural, so no wallet SDK is imported.
|
|
15
|
+
*
|
|
16
|
+
* - Party: the `partyId` the dApp gives, else the wallet's primary account (`getPrimaryAccount`).
|
|
17
|
+
* - Submit: `prepareExecuteAndWait` acting as that party only; resolves with `tx.payload.updateId`. Never retried.
|
|
18
|
+
* - Read: `ledgerApi` to the Ledger JSON API v2: one `/v2/state/ledger-end`, then the pages of
|
|
19
|
+
* `/v2/state/active-contracts-page` at that one offset, filtered to that party only, with every template and
|
|
20
|
+
* interface filter of the read in one cumulative filter (see {@link ACS_PAGE_SIZE}); a read that joins an earlier
|
|
21
|
+
* snapshot passes that snapshot's `activeAtOffset` and skips the ledger-end call. It is sent as POST, as the Ledger
|
|
22
|
+
* JSON API 3.6 OpenAPI, Loop's `ledgerApi` allowlist and `@canton-network/core-acs-reader` do.
|
|
23
|
+
* - Rate limits: wallets rate-limit `ledgerApi` (Loop answers -32005 for an HTTP 429 of its ledger proxy). Loop also
|
|
24
|
+
* sends two more HTTP requests to its backend before every `ledgerApi` call (a session check, `pair/account`, and a
|
|
25
|
+
* provider status check), so one `ledgerApi` call is three requests against Loop's limit; a 429 of the session check
|
|
26
|
+
* reaches the SDK as -32603 "Session verification failed with status 429." Both count as a rate limit
|
|
27
|
+
* ({@link isRateLimited}): the read is retried after an exponential, jittered back-off
|
|
28
|
+
* ({@link DEFAULT_READ_RETRY_DELAYS_MS}); when the wallet still refuses, the read fails with a `WalletReadError` whose
|
|
29
|
+
* `rateLimited` is true (code -32005). Never for submissions.
|
|
30
|
+
* - Fallback: the snapshot is read once through the unpaged `/v2/state/active-contracts` (subject to the participant's
|
|
31
|
+
* `http-list-max-elements-limit`) only when the first paged call is refused as not offered or malformed
|
|
32
|
+
* ({@link ACS_FALLBACK_CODES}: 4200, -32601, -32004, -32602), or when Loop answers -32002 with exactly "Ledger access
|
|
33
|
+
* unavailable". Loop reports every non-429 HTTP failure of its ledger proxy that way (an endpoint missing from its
|
|
34
|
+
* allowlist, a Canton 3.5 participant that serves the paged endpoint only as GET, a refused `maxPageSize`, but also a
|
|
35
|
+
* 5xx), so that case gets the one fallback request too. A rate limit, a timeout (Loop: -32002 "Ledger request failed
|
|
36
|
+
* or timed out") or any other failure never falls back: a second request would only add load. When the fallback fails
|
|
37
|
+
* too, the error names both failures.
|
|
38
|
+
*
|
|
39
|
+
* Spec: CIP-0103 and the dApp API OpenRPC (`openrpc-dapp-api.json` 0.5.0).
|
|
40
|
+
*/
|
|
41
|
+
const acs_1 = require("./acs");
|
|
42
|
+
const errors_1 = require("./errors");
|
|
43
|
+
const json_1 = require("./json");
|
|
44
|
+
const templates_1 = require("./templates");
|
|
45
|
+
/** CIP-0103 error codes (EIP-1193 and EIP-1474), as `ProviderRpcError.code`. */
|
|
46
|
+
exports.CIP103_ERROR_CODES = {
|
|
47
|
+
userRejected: 4001,
|
|
48
|
+
unauthorized: 4100,
|
|
49
|
+
unsupportedMethod: 4200,
|
|
50
|
+
disconnected: 4900,
|
|
51
|
+
chainDisconnected: 4901,
|
|
52
|
+
parseError: -32700,
|
|
53
|
+
invalidRequest: -32600,
|
|
54
|
+
methodNotFound: -32601,
|
|
55
|
+
invalidParams: -32602,
|
|
56
|
+
internalError: -32603,
|
|
57
|
+
invalidInput: -32000,
|
|
58
|
+
resourceNotFound: -32001,
|
|
59
|
+
resourceUnavailable: -32002,
|
|
60
|
+
transactionRejected: -32003,
|
|
61
|
+
methodNotSupported: -32004,
|
|
62
|
+
limitExceeded: -32005,
|
|
63
|
+
};
|
|
64
|
+
const ERROR_NAMES = {
|
|
65
|
+
4001: 'User Rejected Request',
|
|
66
|
+
4100: 'Unauthorized',
|
|
67
|
+
4200: 'Unsupported Method',
|
|
68
|
+
4900: 'Disconnected',
|
|
69
|
+
4901: 'Chain Disconnected',
|
|
70
|
+
[-32700]: 'Parse error',
|
|
71
|
+
[-32600]: 'Invalid request',
|
|
72
|
+
[-32601]: 'Method not found',
|
|
73
|
+
[-32602]: 'Invalid params',
|
|
74
|
+
[-32603]: 'Internal error',
|
|
75
|
+
[-32000]: 'Invalid input',
|
|
76
|
+
[-32001]: 'Resource not found',
|
|
77
|
+
[-32002]: 'Resource unavailable',
|
|
78
|
+
[-32003]: 'Transaction rejected',
|
|
79
|
+
[-32004]: 'Method not supported',
|
|
80
|
+
[-32005]: 'Limit exceeded',
|
|
81
|
+
};
|
|
82
|
+
/** The numeric `code` of a provider error (`ProviderRpcError`, `JsonRpcError` or a plain object). */
|
|
83
|
+
function cip103ErrorCode(error) {
|
|
84
|
+
const code = (0, json_1.isRecord)(error) ? error['code'] : undefined;
|
|
85
|
+
return typeof code === 'number' && Number.isInteger(code) ? code : undefined;
|
|
86
|
+
}
|
|
87
|
+
/** `message (CIP-0103 4200 Unsupported Method)`, so a UI can show what the wallet answered. */
|
|
88
|
+
function describeError(error) {
|
|
89
|
+
const raw = (0, json_1.isRecord)(error) ? error['message'] : undefined;
|
|
90
|
+
const message = typeof raw === 'string' && raw.length > 0 ? raw : String(error);
|
|
91
|
+
const code = cip103ErrorCode(error);
|
|
92
|
+
if (code === undefined)
|
|
93
|
+
return message;
|
|
94
|
+
const name = ERROR_NAMES[code];
|
|
95
|
+
return `${message} (CIP-0103 ${code}${name !== undefined ? ` ${name}` : ''})`;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Codes a wallet answers only for a request it refused to take on (malformed, or a method or capability it lacks):
|
|
99
|
+
* nothing was handed over, so the submission certainly did not happen.
|
|
100
|
+
*/
|
|
101
|
+
const NOT_SUBMITTED_CODES = new Set([
|
|
102
|
+
exports.CIP103_ERROR_CODES.unsupportedMethod,
|
|
103
|
+
exports.CIP103_ERROR_CODES.parseError,
|
|
104
|
+
exports.CIP103_ERROR_CODES.invalidRequest,
|
|
105
|
+
exports.CIP103_ERROR_CODES.methodNotFound,
|
|
106
|
+
exports.CIP103_ERROR_CODES.invalidParams,
|
|
107
|
+
exports.CIP103_ERROR_CODES.invalidInput,
|
|
108
|
+
exports.CIP103_ERROR_CODES.methodNotSupported,
|
|
109
|
+
]);
|
|
110
|
+
/**
|
|
111
|
+
* Session codes: the wallet was not (or no longer) connected or authorized. A wallet can answer these before
|
|
112
|
+
* submitting, but also after it handed the transaction on (Loop answers 4100 "Session changed during transaction" after
|
|
113
|
+
* its submit, and 4900/4901 for a connection lost while waiting), so they do not prove nothing was submitted.
|
|
114
|
+
*/
|
|
115
|
+
const SESSION_CODES = new Set([
|
|
116
|
+
exports.CIP103_ERROR_CODES.unauthorized,
|
|
117
|
+
exports.CIP103_ERROR_CODES.disconnected,
|
|
118
|
+
exports.CIP103_ERROR_CODES.chainDisconnected,
|
|
119
|
+
]);
|
|
120
|
+
/**
|
|
121
|
+
* A provider error from `prepareExecuteAndWait` as a `WalletSubmitError`:
|
|
122
|
+
*
|
|
123
|
+
* - 4001 → `rejected-by-user`;
|
|
124
|
+
* - -32003 → `failed` (the ledger rejected it);
|
|
125
|
+
* - 4200 and the request/params errors (-32700, -32600, -32601, -32602, -32000, -32004) → `failed`: the wallet did not
|
|
126
|
+
* take the request on, so nothing was submitted;
|
|
127
|
+
* - 4100, 4900, 4901 → `unknown`: the wallet lost or changed its session, possibly after submitting;
|
|
128
|
+
* - Anything else (-32002 timeouts, -32603, no code) → `unknown`: never resubmit without checking the wallet.
|
|
129
|
+
*/
|
|
130
|
+
function cip103SubmitError(error, commandId) {
|
|
131
|
+
const code = cip103ErrorCode(error);
|
|
132
|
+
const message = describeError(error);
|
|
133
|
+
const details = {
|
|
134
|
+
...(code !== undefined && { code }),
|
|
135
|
+
...(commandId !== undefined && { commandId }),
|
|
136
|
+
};
|
|
137
|
+
if (code === exports.CIP103_ERROR_CODES.userRejected) {
|
|
138
|
+
return new errors_1.WalletSubmitError('rejected-by-user', `The user rejected the transaction in the wallet: ${message}`, details);
|
|
139
|
+
}
|
|
140
|
+
if (code === exports.CIP103_ERROR_CODES.transactionRejected) {
|
|
141
|
+
return new errors_1.WalletSubmitError('failed', `The ledger rejected the transaction: ${message}`, details);
|
|
142
|
+
}
|
|
143
|
+
if (code !== undefined && NOT_SUBMITTED_CODES.has(code)) {
|
|
144
|
+
return new errors_1.WalletSubmitError('failed', `The wallet refused the request, so nothing was submitted: ${message}`, details);
|
|
145
|
+
}
|
|
146
|
+
if (code !== undefined && SESSION_CODES.has(code)) {
|
|
147
|
+
return new errors_1.WalletSubmitError('unknown', `The wallet lost or changed its session during the request; it may or may not have been submitted: ${message}.`, details);
|
|
148
|
+
}
|
|
149
|
+
return new errors_1.WalletSubmitError('unknown', `The wallet did not confirm the transaction: ${message}.`, details);
|
|
150
|
+
}
|
|
151
|
+
/** The `prepareExecuteAndWait` result `{tx: {status: 'executed', commandId, payload: {updateId}}}`. */
|
|
152
|
+
function readSubmitResult(raw, commandId) {
|
|
153
|
+
const tx = (0, json_1.isRecord)(raw) ? raw['tx'] : undefined;
|
|
154
|
+
const status = (0, json_1.isRecord)(tx) ? tx['status'] : undefined;
|
|
155
|
+
const payload = (0, json_1.isRecord)(tx) ? tx['payload'] : undefined;
|
|
156
|
+
const updateId = (0, json_1.isRecord)(payload) ? (0, json_1.nonEmptyString)(payload['updateId']) : undefined;
|
|
157
|
+
const resultCommandId = ((0, json_1.isRecord)(tx) ? (0, json_1.nonEmptyString)(tx['commandId']) : undefined) ?? commandId;
|
|
158
|
+
const details = resultCommandId !== undefined ? { commandId: resultCommandId } : {};
|
|
159
|
+
if (status === 'failed') {
|
|
160
|
+
throw new errors_1.WalletSubmitError('failed', 'The wallet reported the transaction failed', details);
|
|
161
|
+
}
|
|
162
|
+
if (status !== 'executed' || updateId === undefined) {
|
|
163
|
+
throw new errors_1.WalletSubmitError('unknown', 'The wallet answered without an executed transaction.', details);
|
|
164
|
+
}
|
|
165
|
+
return { updateId, ...details };
|
|
166
|
+
}
|
|
167
|
+
function newCommandId() {
|
|
168
|
+
// Typed as always present, but missing outside secure contexts and in old runtimes.
|
|
169
|
+
const { crypto } = globalThis;
|
|
170
|
+
return typeof crypto?.randomUUID === 'function' ? crypto.randomUUID() : undefined;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The wallet's primary account (`getPrimaryAccount`). The dApp runs its wallet's own connect flow first; a provider
|
|
174
|
+
* that is not connected answers 4100.
|
|
175
|
+
*/
|
|
176
|
+
async function primaryAccount(provider) {
|
|
177
|
+
let account;
|
|
178
|
+
try {
|
|
179
|
+
account = await provider.request({ method: 'getPrimaryAccount' });
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
throw new errors_1.WalletReadError(`The wallet did not return its primary account: ${describeError(error)}`, cip103ErrorCode(error));
|
|
183
|
+
}
|
|
184
|
+
const partyId = (0, json_1.isRecord)(account) ? (0, json_1.nonEmptyString)(account['partyId']) : undefined;
|
|
185
|
+
if (!(0, json_1.isRecord)(account) || partyId === undefined) {
|
|
186
|
+
throw new errors_1.WalletReadError('The wallet returned a primary account without partyId');
|
|
187
|
+
}
|
|
188
|
+
const publicKey = (0, json_1.nonEmptyString)(account['publicKey']);
|
|
189
|
+
const namespace = (0, json_1.nonEmptyString)(account['namespace']);
|
|
190
|
+
const networkId = (0, json_1.nonEmptyString)(account['networkId']);
|
|
191
|
+
const signingProviderId = (0, json_1.nonEmptyString)(account['signingProviderId']);
|
|
192
|
+
return {
|
|
193
|
+
partyId,
|
|
194
|
+
...(publicKey !== undefined && { publicKey }),
|
|
195
|
+
...(namespace !== undefined && { namespace }),
|
|
196
|
+
...(networkId !== undefined && { networkId }),
|
|
197
|
+
...(signingProviderId !== undefined && { signingProviderId }),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/** The wallet party: the primary account's `partyId` (`getPrimaryAccount`). */
|
|
201
|
+
async function primaryPartyId(provider) {
|
|
202
|
+
return (await primaryAccount(provider)).partyId;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Entries asked for per `/v2/state/active-contracts-page` request (`maxPageSize`). Well under the participant's default
|
|
206
|
+
* page and list limits, so a participant does not refuse it.
|
|
207
|
+
*/
|
|
208
|
+
exports.ACS_PAGE_SIZE = 200;
|
|
209
|
+
/**
|
|
210
|
+
* The most `/v2/state/active-contracts-page` requests one read makes ({@link ACS_PAGE_SIZE} × this = 100,000 contracts
|
|
211
|
+
* of one filter). A read that needs more fails with `WalletReadError` instead of paging on.
|
|
212
|
+
*/
|
|
213
|
+
exports.ACS_MAX_PAGES = 500;
|
|
214
|
+
/**
|
|
215
|
+
* Codes of a first paged ACS call after which the snapshot is read once through the unpaged
|
|
216
|
+
* `/v2/state/active-contracts` instead: the wallet does not offer the paged endpoint (4200, -32601, -32004), or refused
|
|
217
|
+
* the paged request's shape (-32602). Loop reports those cases differently (see {@link LOOP_HTTP_REFUSED_MESSAGE}). Any
|
|
218
|
+
* other failure (a rate limit, a timeout, a refused or disconnected session) is reported as it is: a second read would
|
|
219
|
+
* fail the same way and only add load.
|
|
220
|
+
*/
|
|
221
|
+
exports.ACS_FALLBACK_CODES = new Set([
|
|
222
|
+
exports.CIP103_ERROR_CODES.unsupportedMethod,
|
|
223
|
+
exports.CIP103_ERROR_CODES.methodNotFound,
|
|
224
|
+
exports.CIP103_ERROR_CODES.methodNotSupported,
|
|
225
|
+
exports.CIP103_ERROR_CODES.invalidParams,
|
|
226
|
+
]);
|
|
227
|
+
/**
|
|
228
|
+
* Loop's message, with code -32002, for any non-OK HTTP reply of its ledger proxy other than 429 that carries no
|
|
229
|
+
* structured error (`@fivenorth/loop-sdk` `Connection.ledgerApi`): an endpoint its allowlist does not offer, a
|
|
230
|
+
* participant that serves the paged endpoint only as GET (Canton 3.5) or refuses its `maxPageSize`, or a server error.
|
|
231
|
+
* Loop's timeout or network failure is another message ("Ledger request failed or timed out") and does not fall back.
|
|
232
|
+
*/
|
|
233
|
+
exports.LOOP_HTTP_REFUSED_MESSAGE = 'Ledger access unavailable';
|
|
234
|
+
/**
|
|
235
|
+
* Whether a provider error is a rate limit: -32005, or -32603 whose message says HTTP status 429 (Loop's session check,
|
|
236
|
+
* which runs before every `ledgerApi` call, throws a plain `Error` that Loop's CIP-0103 adapter maps to -32603).
|
|
237
|
+
*/
|
|
238
|
+
function isRateLimited(error) {
|
|
239
|
+
const code = cip103ErrorCode(error);
|
|
240
|
+
if (code === exports.CIP103_ERROR_CODES.limitExceeded)
|
|
241
|
+
return true;
|
|
242
|
+
const message = (0, json_1.isRecord)(error) && typeof error['message'] === 'string' ? error['message'] : '';
|
|
243
|
+
return code === exports.CIP103_ERROR_CODES.internalError && /\bstatus 429\b/.test(message);
|
|
244
|
+
}
|
|
245
|
+
/** Read errors whose provider error was Loop's {@link LOOP_HTTP_REFUSED_MESSAGE} with -32002. */
|
|
246
|
+
const loopHttpRefusals = new WeakSet();
|
|
247
|
+
/** Whether a first paged ACS call's failure means the paged endpoint is not usable, so the unpaged one is tried once. */
|
|
248
|
+
function pagedEndpointRefused(error) {
|
|
249
|
+
if (!(error instanceof errors_1.WalletReadError) || error.code === undefined)
|
|
250
|
+
return false;
|
|
251
|
+
return exports.ACS_FALLBACK_CODES.has(error.code) || loopHttpRefusals.has(error);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Waits before each retry of a read the wallet rate-limited (-32005): 0.5 s, 1 s, 2 s, 4 s, so at most five attempts
|
|
255
|
+
* over about 7.5 s. Each wait is jittered to between half and all of its value, so parallel readers spread out.
|
|
256
|
+
*/
|
|
257
|
+
exports.DEFAULT_READ_RETRY_DELAYS_MS = [500, 1000, 2000, 4000];
|
|
258
|
+
const defaultSleep = async (ms) => new Promise((resolve) => {
|
|
259
|
+
setTimeout(resolve, ms);
|
|
260
|
+
});
|
|
261
|
+
/** One `JsGetActiveContractsPageResponse`: `{activeContracts, activeAtOffset, nextPageToken?}`. */
|
|
262
|
+
function readAcsPage(raw, offset) {
|
|
263
|
+
if (!(0, json_1.isRecord)(raw) || !Array.isArray(raw['activeContracts'])) {
|
|
264
|
+
throw new errors_1.WalletReadError('The wallet returned an active-contracts page without an activeContracts list');
|
|
265
|
+
}
|
|
266
|
+
const pageOffset = raw['activeAtOffset'];
|
|
267
|
+
if (pageOffset !== undefined && pageOffset !== offset) {
|
|
268
|
+
throw new errors_1.WalletReadError(`The wallet returned an active-contracts page at offset ${JSON.stringify(pageOffset)}, not the requested ${offset}`);
|
|
269
|
+
}
|
|
270
|
+
const token = raw['nextPageToken'];
|
|
271
|
+
if (token !== undefined && token !== null && typeof token !== 'string') {
|
|
272
|
+
throw new errors_1.WalletReadError('The wallet returned an active-contracts page with a nextPageToken that is not a string');
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
entries: raw['activeContracts'],
|
|
276
|
+
nextPageToken: typeof token === 'string' && token.length > 0 ? token : undefined,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
/** A Ledger JSON API v2 `CumulativeFilter` for one template or interface. */
|
|
280
|
+
function cumulativeFilter(filter) {
|
|
281
|
+
return {
|
|
282
|
+
identifierFilter: 'templateId' in filter
|
|
283
|
+
? {
|
|
284
|
+
TemplateFilter: {
|
|
285
|
+
value: {
|
|
286
|
+
templateId: filter.templateId,
|
|
287
|
+
includeCreatedEventBlob: false,
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
}
|
|
291
|
+
: {
|
|
292
|
+
InterfaceFilter: {
|
|
293
|
+
value: {
|
|
294
|
+
interfaceId: filter.interfaceId,
|
|
295
|
+
includeInterfaceView: true,
|
|
296
|
+
includeCreatedEventBlob: false,
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
/** The SDK's CIP-0103 client acting as `partyId` through `provider`. */
|
|
303
|
+
function cip103Wallet(provider, partyId, options = {}) {
|
|
304
|
+
const delays = options.readRetry?.delaysMs ?? exports.DEFAULT_READ_RETRY_DELAYS_MS;
|
|
305
|
+
const sleep = options.readRetry?.sleep ?? defaultSleep;
|
|
306
|
+
const random = options.readRetry?.random ?? Math.random;
|
|
307
|
+
/** A read through `ledgerApi`, retried with back-off while the wallet answers -32005. */
|
|
308
|
+
async function ledgerApi(requestMethod, resource, body) {
|
|
309
|
+
const call = `ledgerApi ${requestMethod.toUpperCase()} ${resource}`;
|
|
310
|
+
let waitedMs = 0;
|
|
311
|
+
for (let attempt = 0;; attempt += 1) {
|
|
312
|
+
try {
|
|
313
|
+
return await provider.request({
|
|
314
|
+
method: 'ledgerApi',
|
|
315
|
+
params: {
|
|
316
|
+
requestMethod,
|
|
317
|
+
resource,
|
|
318
|
+
...(body !== undefined && { body }),
|
|
319
|
+
},
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
catch (error) {
|
|
323
|
+
const code = cip103ErrorCode(error);
|
|
324
|
+
if (!isRateLimited(error)) {
|
|
325
|
+
const failed = new errors_1.WalletReadError(`The wallet's ${call} failed: ${describeError(error)}`, code);
|
|
326
|
+
if (code === exports.CIP103_ERROR_CODES.resourceUnavailable &&
|
|
327
|
+
(0, json_1.isRecord)(error) &&
|
|
328
|
+
error['message'] === exports.LOOP_HTTP_REFUSED_MESSAGE) {
|
|
329
|
+
loopHttpRefusals.add(failed);
|
|
330
|
+
}
|
|
331
|
+
throw failed;
|
|
332
|
+
}
|
|
333
|
+
const delay = delays[attempt];
|
|
334
|
+
if (delay === undefined) {
|
|
335
|
+
const tries = attempt === 0
|
|
336
|
+
? ''
|
|
337
|
+
: ` on all ${attempt + 1} attempts, backing off ${(waitedMs / 1000).toFixed(1)} s in total`;
|
|
338
|
+
throw new errors_1.WalletReadError(`The wallet rate-limited its ledger reads: ${call} answered ${describeError(error)}${tries}. Wait a moment, then retry.`, exports.CIP103_ERROR_CODES.limitExceeded);
|
|
339
|
+
}
|
|
340
|
+
const wait = Math.round(delay / 2 + (delay / 2) * Math.min(Math.max(random(), 0), 1));
|
|
341
|
+
waitedMs += wait;
|
|
342
|
+
await sleep(wait);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
async function ledgerEnd() {
|
|
347
|
+
const end = await ledgerApi('get', '/v2/state/ledger-end');
|
|
348
|
+
const offset = (0, json_1.isRecord)(end) ? end['offset'] : undefined;
|
|
349
|
+
if (typeof offset !== 'number' || !Number.isSafeInteger(offset)) {
|
|
350
|
+
throw new errors_1.WalletReadError('The wallet returned no ledger end offset');
|
|
351
|
+
}
|
|
352
|
+
return offset;
|
|
353
|
+
}
|
|
354
|
+
async function readActiveContracts(filters, readOptions = {}) {
|
|
355
|
+
// A template or an interface should not appear twice in a cumulative filter.
|
|
356
|
+
const unique = [...new Map(filters.map((filter) => [(0, templates_1.contractFilterKey)(filter), filter])).values()];
|
|
357
|
+
if (unique.length === 0)
|
|
358
|
+
throw new TypeError('readActiveContracts needs at least one filter');
|
|
359
|
+
const at = readOptions.activeAtOffset;
|
|
360
|
+
if (at !== undefined && (!Number.isSafeInteger(at) || at < 0)) {
|
|
361
|
+
throw new TypeError(`activeAtOffset must be a non-negative integer, not ${String(at)}`);
|
|
362
|
+
}
|
|
363
|
+
const offset = at ?? (await ledgerEnd());
|
|
364
|
+
const eventFormat = {
|
|
365
|
+
verbose: false,
|
|
366
|
+
filtersByParty: {
|
|
367
|
+
[partyId]: { cumulative: unique.map(cumulativeFilter) },
|
|
368
|
+
},
|
|
369
|
+
};
|
|
370
|
+
// Pages at the one offset read above, so every page belongs to the same snapshot. The unpaged endpoint fails once
|
|
371
|
+
// the matches exceed the participant's `http-list-max-elements-limit`; this one does not.
|
|
372
|
+
const entries = [];
|
|
373
|
+
let pageToken;
|
|
374
|
+
for (let page = 0;; page += 1) {
|
|
375
|
+
if (page === exports.ACS_MAX_PAGES) {
|
|
376
|
+
throw new errors_1.WalletReadError(`The wallet's active contracts did not end within ${exports.ACS_MAX_PAGES} pages of ${exports.ACS_PAGE_SIZE}; nothing was read`);
|
|
377
|
+
}
|
|
378
|
+
let raw;
|
|
379
|
+
try {
|
|
380
|
+
raw = await ledgerApi('post', '/v2/state/active-contracts-page', {
|
|
381
|
+
activeAtOffset: offset,
|
|
382
|
+
eventFormat,
|
|
383
|
+
maxPageSize: exports.ACS_PAGE_SIZE,
|
|
384
|
+
...(pageToken !== undefined && { pageToken }),
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
catch (error) {
|
|
388
|
+
if (page === 0 && error instanceof errors_1.WalletReadError && pagedEndpointRefused(error)) {
|
|
389
|
+
return { offset, contracts: await readUnpaged(offset, eventFormat, error) };
|
|
390
|
+
}
|
|
391
|
+
throw error;
|
|
392
|
+
}
|
|
393
|
+
const next = readAcsPage(raw, offset);
|
|
394
|
+
entries.push(...next.entries);
|
|
395
|
+
if (next.nextPageToken === undefined)
|
|
396
|
+
break;
|
|
397
|
+
if (next.nextPageToken === pageToken) {
|
|
398
|
+
throw new errors_1.WalletReadError('The wallet returned the same active-contracts page token twice');
|
|
399
|
+
}
|
|
400
|
+
pageToken = next.nextPageToken;
|
|
401
|
+
}
|
|
402
|
+
return { offset, contracts: (0, acs_1.parseActiveContractEntries)(entries) };
|
|
403
|
+
}
|
|
404
|
+
/** The unpaged snapshot after the paged endpoint was refused; a failure names both. */
|
|
405
|
+
async function readUnpaged(offset, eventFormat, pagedError) {
|
|
406
|
+
try {
|
|
407
|
+
const all = await ledgerApi('post', '/v2/state/active-contracts', {
|
|
408
|
+
verbose: false,
|
|
409
|
+
activeAtOffset: offset,
|
|
410
|
+
eventFormat,
|
|
411
|
+
});
|
|
412
|
+
if (!Array.isArray(all)) {
|
|
413
|
+
throw new errors_1.WalletReadError('The wallet returned active contracts that are not a list');
|
|
414
|
+
}
|
|
415
|
+
// Parsed inside the try, so malformed fallback entries also report the original paged failure.
|
|
416
|
+
return (0, acs_1.parseActiveContractEntries)(all);
|
|
417
|
+
}
|
|
418
|
+
catch (error) {
|
|
419
|
+
if (!(error instanceof errors_1.WalletReadError))
|
|
420
|
+
throw error;
|
|
421
|
+
throw new errors_1.WalletReadError(`${pagedError.message}; the unpaged fallback failed too: ${error.message}`, error.code ?? pagedError.code);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
partyId,
|
|
426
|
+
async listActiveContracts(filter, readOptions) {
|
|
427
|
+
return (await readActiveContracts([filter], readOptions)).contracts;
|
|
428
|
+
},
|
|
429
|
+
readActiveContracts,
|
|
430
|
+
async submit(submission) {
|
|
431
|
+
const commandId = submission.commandId ?? newCommandId();
|
|
432
|
+
const disclosed = submission.disclosedContracts ?? [];
|
|
433
|
+
let raw;
|
|
434
|
+
try {
|
|
435
|
+
raw = await provider.request({
|
|
436
|
+
method: 'prepareExecuteAndWait',
|
|
437
|
+
params: {
|
|
438
|
+
...(commandId !== undefined && { commandId }),
|
|
439
|
+
commands: [...submission.commands],
|
|
440
|
+
...(disclosed.length > 0 && { disclosedContracts: [...disclosed] }),
|
|
441
|
+
actAs: [partyId],
|
|
442
|
+
},
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
catch (error) {
|
|
446
|
+
throw cip103SubmitError(error, commandId);
|
|
447
|
+
}
|
|
448
|
+
return readSubmitResult(raw, commandId);
|
|
449
|
+
},
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
//# sourceMappingURL=cip103.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cip103.js","sourceRoot":"","sources":["../../../src/wallets/cip103.ts"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,+BAAmD;AACnD,qCAA8D;AAC9D,iCAAkD;AAClD,2CAAgD;AA6DhD,gFAAgF;AACnE,QAAA,kBAAkB,GAAG;IAChC,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;IAClB,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB,iBAAiB,EAAE,IAAI;IACvB,UAAU,EAAE,CAAC,KAAK;IAClB,cAAc,EAAE,CAAC,KAAK;IACtB,cAAc,EAAE,CAAC,KAAK;IACtB,aAAa,EAAE,CAAC,KAAK;IACrB,aAAa,EAAE,CAAC,KAAK;IACrB,YAAY,EAAE,CAAC,KAAK;IACpB,gBAAgB,EAAE,CAAC,KAAK;IACxB,mBAAmB,EAAE,CAAC,KAAK;IAC3B,mBAAmB,EAAE,CAAC,KAAK;IAC3B,kBAAkB,EAAE,CAAC,KAAK;IAC1B,aAAa,EAAE,CAAC,KAAK;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Y,CAAC;YACjB,IAAI,CAAC;gBACH,GAAG,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC;oBAC3B,MAAM,EAAE,uBAAuB;oBAC/B,MAAM,EAAE;wBACN,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,CAAC;wBAC7C,QAAQ,EAAE,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC;wBAClC,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,kBAAkB,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;wBACnE,KAAK,EAAE,CAAC,OAAO,CAAC;qBACjB;iBACF,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YAC5C,CAAC;YACD,OAAO,gBAAgB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAC1C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure Ledger JSON API v2 command builders for the holder-side DA Registry and CIP-56 actions, typed as JSON so a
|
|
3
|
+
* wallet can pass them on unchanged.
|
|
4
|
+
*
|
|
5
|
+
* Template, interface and choice names are the SDK's own constants. The builders themselves are not shared with
|
|
6
|
+
* `da-registry/commands` (whose module graph reaches Node-only code) or `buildTokenStandardV1TransferCommand` (which
|
|
7
|
+
* throws the SDK's Node error classes); unit tests check that both produce the same JSON as those builders.
|
|
8
|
+
*/
|
|
9
|
+
import type { JsonObject } from './json';
|
|
10
|
+
import type { ChoiceContextData, TransferInstructionAction, TransferSpec } from './token-registry';
|
|
11
|
+
import type { CreateCommand, ExerciseCommand, InstrumentId } from './types';
|
|
12
|
+
/** Splice `ExtraArgs`: the registry's context, unchanged, and empty metadata. */
|
|
13
|
+
export declare function extraArgs(context: ChoiceContextData): JsonObject;
|
|
14
|
+
/** The holder accepts a DA mint offer (`MintOffer_Accept`). */
|
|
15
|
+
export declare function acceptMintOfferCommand(mintOfferCid: string, context: ChoiceContextData): ExerciseCommand;
|
|
16
|
+
/** DA's `Burn` record. */
|
|
17
|
+
export interface DaBurn {
|
|
18
|
+
readonly instrumentId: InstrumentId;
|
|
19
|
+
readonly amount: string;
|
|
20
|
+
readonly holder: string;
|
|
21
|
+
readonly reference: string;
|
|
22
|
+
readonly requestedAt: string;
|
|
23
|
+
readonly executeBefore: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The holder's burn request (`AllocationFactory_RequestBurn`, controlled by the holder): DA merges and splits
|
|
27
|
+
* `holdingCids`, locks exactly the amount to the registrar and creates a `BurnRequest`. `meta` is left empty.
|
|
28
|
+
*/
|
|
29
|
+
export declare function requestBurnCommand(params: {
|
|
30
|
+
readonly allocationFactoryCid: string;
|
|
31
|
+
readonly expectedAdmin: string;
|
|
32
|
+
readonly burn: DaBurn;
|
|
33
|
+
readonly holdingCids: readonly string[];
|
|
34
|
+
readonly context: ChoiceContextData;
|
|
35
|
+
}): ExerciseCommand;
|
|
36
|
+
/** The CIP-56 transfer (`TransferFactory_Transfer` on the TransferFactory interface), acting as the sender. */
|
|
37
|
+
export declare function transferCommand(params: {
|
|
38
|
+
readonly factoryId: string;
|
|
39
|
+
readonly expectedAdmin: string;
|
|
40
|
+
readonly transfer: TransferSpec;
|
|
41
|
+
readonly context: ChoiceContextData;
|
|
42
|
+
}): ExerciseCommand;
|
|
43
|
+
/** Accept or reject (receiver) or withdraw (sender) a pending CIP-56 transfer, on the TransferInstruction interface. */
|
|
44
|
+
export declare function transferInstructionCommand(transferInstructionCid: string, action: TransferInstructionAction, context: ChoiceContextData): ExerciseCommand;
|
|
45
|
+
/** DA allows up to 10 instrument ids per preapproval; an empty list covers every instrument of the admin. */
|
|
46
|
+
export declare const MAX_PREAPPROVAL_INSTRUMENTS = 10;
|
|
47
|
+
/**
|
|
48
|
+
* The receiver's DA transfer preapproval (a plain create; signatory the receiver, observer DA's operator). Transfers of
|
|
49
|
+
* the allowed instruments then complete at once instead of waiting for the receiver to accept.
|
|
50
|
+
*
|
|
51
|
+
* Experimental: the same command as `da-registry`'s `createTransferPreapproval`, but no holder-side create of it has
|
|
52
|
+
* been observed on a live network yet.
|
|
53
|
+
*/
|
|
54
|
+
export declare function createDaTransferPreapprovalCommand(params: {
|
|
55
|
+
readonly operator: string;
|
|
56
|
+
readonly receiver: string;
|
|
57
|
+
readonly instrumentAdmin: string;
|
|
58
|
+
readonly instrumentIds: readonly string[];
|
|
59
|
+
}): CreateCommand;
|
|
60
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/wallets/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAOzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5E,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CAEhE;AAMD,+DAA+D;AAC/D,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,eAAe,CASxG;AAED,0BAA0B;AAC1B,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM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