@dakota-xyz/ts-sdk 3.0.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -118,7 +118,15 @@ var APIError = class _APIError extends Error {
118
118
  }
119
119
  } catch {
120
120
  }
121
- return new _APIError(response.status, code, message, {
121
+ if (typeof code !== "string") {
122
+ code = `http_${response.status}`;
123
+ }
124
+ const governanceCode = code.replace(/-/g, "_");
125
+ const Typed = GOVERNANCE_ERRORS.get(governanceCode);
126
+ if (Typed) {
127
+ code = governanceCode;
128
+ }
129
+ return new (Typed ?? _APIError)(response.status, code, message, {
122
130
  details,
123
131
  requestId,
124
132
  rawBody,
@@ -133,6 +141,50 @@ var APIError = class _APIError extends Error {
133
141
  return `APIError [${this.statusCode}]: ${this.message}`;
134
142
  }
135
143
  };
144
+ var EndorsementRequiredError = class extends APIError {
145
+ constructor(statusCode, code, message, options) {
146
+ super(statusCode, code, message, options);
147
+ this.name = "EndorsementRequiredError";
148
+ }
149
+ };
150
+ var InsufficientEndorsementsError = class extends APIError {
151
+ /** Signatures the platform counted, when it said so. */
152
+ have;
153
+ /** Signatures the quorum needs, when it said so. */
154
+ need;
155
+ constructor(statusCode, code, message, options) {
156
+ super(statusCode, code, message, options);
157
+ this.name = "InsufficientEndorsementsError";
158
+ const m = /have (\d+), need (\d+)/.exec(message);
159
+ this.have = m ? Number(m[1]) : null;
160
+ this.need = m ? Number(m[2]) : null;
161
+ }
162
+ };
163
+ var StaleSignerGroupVersionError = class extends APIError {
164
+ constructor(statusCode, code, message, options) {
165
+ super(statusCode, code, message, options);
166
+ this.name = "StaleSignerGroupVersionError";
167
+ }
168
+ };
169
+ var BelowThresholdError = class extends APIError {
170
+ constructor(statusCode, code, message, options) {
171
+ super(statusCode, code, message, options);
172
+ this.name = "BelowThresholdError";
173
+ }
174
+ };
175
+ var InvalidGoverningGroupError = class extends APIError {
176
+ constructor(statusCode, code, message, options) {
177
+ super(statusCode, code, message, options);
178
+ this.name = "InvalidGoverningGroupError";
179
+ }
180
+ };
181
+ var GOVERNANCE_ERRORS = /* @__PURE__ */ new Map([
182
+ ["endorsement_required", EndorsementRequiredError],
183
+ ["insufficient_endorsements", InsufficientEndorsementsError],
184
+ ["stale_signer_group_version", StaleSignerGroupVersionError],
185
+ ["below_threshold", BelowThresholdError],
186
+ ["invalid_governing_group", InvalidGoverningGroupError]
187
+ ]);
136
188
  var TransportError = class _TransportError extends Error {
137
189
  /** The underlying error that caused this transport error */
138
190
  cause;
@@ -277,7 +329,7 @@ var Transport = class {
277
329
  * Make an HTTP request with automatic retry and error handling.
278
330
  */
279
331
  async request(options) {
280
- const { method, path, body, query, headers, idempotencyKey, signal } = options;
332
+ const { method, path, body, query, headers, idempotencyKey, signal, noContent } = options;
281
333
  const url = this.buildURL(path, query);
282
334
  const requestHeaders = this.buildHeaders(method, path, headers, idempotencyKey);
283
335
  const requestBody = body !== void 0 ? JSON.stringify(body) : void 0;
@@ -289,7 +341,8 @@ var Transport = class {
289
341
  body: requestBody,
290
342
  signal
291
343
  },
292
- this.resolveTimeout(options)
344
+ this.resolveTimeout(options),
345
+ noContent === true
293
346
  );
294
347
  }
295
348
  /**
@@ -385,7 +438,7 @@ var Transport = class {
385
438
  * deadline, so a request that keeps timing out can take up to
386
439
  * `timeout × maxAttempts` before it throws.
387
440
  */
388
- async executeWithRetry(url, init, timeout) {
441
+ async executeWithRetry(url, init, timeout, noContent = false) {
389
442
  const { maxAttempts, initialBackoffMs, maxBackoffMs } = this.config.retryPolicy;
390
443
  const method = init.method ?? "GET";
391
444
  let lastError;
@@ -406,7 +459,7 @@ var Transport = class {
406
459
  clearTimeout(timeoutId);
407
460
  this.logResponse(method, url, response.status, attempt);
408
461
  if (response.ok) {
409
- if (response.status === 204) {
462
+ if (response.status === 204 || noContent) {
410
463
  return void 0;
411
464
  }
412
465
  return await response.json();
@@ -872,6 +925,42 @@ var CustomersResource = class extends BaseResource {
872
925
  timeout: options?.timeout
873
926
  });
874
927
  }
928
+ /**
929
+ * Withdraw a customer's onboarding application.
930
+ *
931
+ * Closes the application when the customer will not or cannot continue —
932
+ * for example after a request for information they chose not to answer.
933
+ *
934
+ * Withdrawal is FINAL. The application and its entities are recorded as
935
+ * withdrawn, the customer's `status` becomes `withdrawn`, and onboarding
936
+ * that customer again requires a new application. An application that
937
+ * already has a decision returns a 409.
938
+ *
939
+ * Emits `customer.application.withdrawn`.
940
+ *
941
+ * @param customerId - Customer ID (KSUID)
942
+ * @param applicationId - The customer's onboarding application ID
943
+ * @param data - Optional `reason`, recorded for audit and shown to reviewers
944
+ * @param options - Request options (e.g., custom idempotency key)
945
+ *
946
+ * @example
947
+ * ```typescript
948
+ * await client.customers.withdrawApplication(customerId, applicationId, {
949
+ * reason: 'Customer opted not to proceed',
950
+ * });
951
+ * ```
952
+ */
953
+ async withdrawApplication(customerId, applicationId, data = {}, options) {
954
+ await this.transport.request({
955
+ method: "POST",
956
+ path: `/customers/${customerId}/applications/${applicationId}/withdraw`,
957
+ body: data,
958
+ idempotencyKey: options?.idempotencyKey,
959
+ timeout: options?.timeout,
960
+ // The platform answers a bare 200 with no body.
961
+ noContent: true
962
+ });
963
+ }
875
964
  /**
876
965
  * Update the sub-client association for a customer.
877
966
  *
@@ -1065,6 +1154,7 @@ var RecipientsResource = class extends BaseResource {
1065
1154
  * ```typescript
1066
1155
  * const recipient = await client.recipients.create(customerId, {
1067
1156
  * name: 'Treasury Account',
1157
+ * external_id: 'vendor-1177', // optional: your own label, not unique
1068
1158
  * });
1069
1159
  * ```
1070
1160
  */
@@ -1081,7 +1171,7 @@ var RecipientsResource = class extends BaseResource {
1081
1171
  * List recipients for a customer.
1082
1172
  *
1083
1173
  * @param customerId - Customer ID
1084
- * @param params - Pagination parameters
1174
+ * @param params - Pagination parameters and an optional `external_id` filter
1085
1175
  * @returns Async iterator of recipients
1086
1176
  *
1087
1177
  * @example
@@ -1089,6 +1179,11 @@ var RecipientsResource = class extends BaseResource {
1089
1179
  * for await (const recipient of client.recipients.list(customerId)) {
1090
1180
  * console.log(recipient.name);
1091
1181
  * }
1182
+ *
1183
+ * // Look up recipients by your own label
1184
+ * const matches = await client.recipients
1185
+ * .list(customerId, { external_id: 'vendor-1177' })
1186
+ * .toArray();
1092
1187
  * ```
1093
1188
  */
1094
1189
  list(customerId, params) {
@@ -1152,6 +1247,211 @@ var RecipientsResource = class extends BaseResource {
1152
1247
  }
1153
1248
  };
1154
1249
 
1250
+ // src/agentic/canonicalize.ts
1251
+ function canonicalJSON(value) {
1252
+ return canonicalize(value);
1253
+ }
1254
+ function canonicalize(value) {
1255
+ if (value === null || value === void 0) {
1256
+ return "null";
1257
+ }
1258
+ if (typeof value === "boolean") {
1259
+ return value ? "true" : "false";
1260
+ }
1261
+ if (typeof value === "number") {
1262
+ if (!Number.isFinite(value)) {
1263
+ throw new TypeError(`canonical JSON: non-finite number ${value}`);
1264
+ }
1265
+ return JSON.stringify(value);
1266
+ }
1267
+ if (typeof value === "string") {
1268
+ return JSON.stringify(value);
1269
+ }
1270
+ if (typeof value === "bigint") {
1271
+ throw new TypeError("canonical JSON: bigint values are not supported");
1272
+ }
1273
+ if (Array.isArray(value)) {
1274
+ const parts = value.map((item) => canonicalize(item));
1275
+ return `[${parts.join(",")}]`;
1276
+ }
1277
+ if (typeof value === "object") {
1278
+ const obj = value;
1279
+ const keys = Object.keys(obj).sort();
1280
+ const parts = keys.map((key) => `${JSON.stringify(key)}:${canonicalize(obj[key])}`);
1281
+ return `{${parts.join(",")}}`;
1282
+ }
1283
+ throw new TypeError(`canonical JSON: unsupported value type ${typeof value}`);
1284
+ }
1285
+
1286
+ // src/governance/encoding.ts
1287
+ var B64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1288
+ function bytesToBase64(bytes) {
1289
+ let out = "";
1290
+ let i = 0;
1291
+ for (; i + 2 < bytes.length; i += 3) {
1292
+ const n = bytes[i] << 16 | bytes[i + 1] << 8 | bytes[i + 2];
1293
+ out += B64_ALPHABET[n >> 18 & 63] + B64_ALPHABET[n >> 12 & 63] + B64_ALPHABET[n >> 6 & 63] + B64_ALPHABET[n & 63];
1294
+ }
1295
+ const rest = bytes.length - i;
1296
+ if (rest === 1) {
1297
+ const n = bytes[i] << 16;
1298
+ out += B64_ALPHABET[n >> 18 & 63] + B64_ALPHABET[n >> 12 & 63] + "==";
1299
+ } else if (rest === 2) {
1300
+ const n = bytes[i] << 16 | bytes[i + 1] << 8;
1301
+ out += B64_ALPHABET[n >> 18 & 63] + B64_ALPHABET[n >> 12 & 63] + B64_ALPHABET[n >> 6 & 63] + "=";
1302
+ }
1303
+ return out;
1304
+ }
1305
+ function bytesToBase64url(bytes) {
1306
+ return stripPadding(bytesToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_"));
1307
+ }
1308
+ function stripPadding(s) {
1309
+ let end = s.length;
1310
+ while (end > 0 && s.charCodeAt(end - 1) === 61) end--;
1311
+ return s.slice(0, end);
1312
+ }
1313
+ function base64ToBytes(input) {
1314
+ const s = stripPadding(input.replace(/-/g, "+").replace(/_/g, "/"));
1315
+ if (!/^[A-Za-z0-9+/]*$/.test(s) || s.length % 4 === 1) {
1316
+ throw new TypeError("invalid base64 or base64url string");
1317
+ }
1318
+ const out = new Uint8Array(Math.floor(s.length * 3 / 4));
1319
+ let o = 0;
1320
+ for (let i = 0; i < s.length; i += 4) {
1321
+ const a = B64_ALPHABET.indexOf(s[i]);
1322
+ const b = B64_ALPHABET.indexOf(s[i + 1]);
1323
+ const c = i + 2 < s.length ? B64_ALPHABET.indexOf(s[i + 2]) : 0;
1324
+ const d = i + 3 < s.length ? B64_ALPHABET.indexOf(s[i + 3]) : 0;
1325
+ const n = a << 18 | b << 12 | c << 6 | d;
1326
+ out[o++] = n >> 16 & 255;
1327
+ if (i + 2 < s.length) out[o++] = n >> 8 & 255;
1328
+ if (i + 3 < s.length) out[o++] = n & 255;
1329
+ }
1330
+ return out;
1331
+ }
1332
+ function utf8(s) {
1333
+ return new TextEncoder().encode(s);
1334
+ }
1335
+ function toBytes(source) {
1336
+ if (ArrayBuffer.isView(source)) {
1337
+ return new Uint8Array(source.buffer, source.byteOffset, source.byteLength).slice();
1338
+ }
1339
+ if (Object.prototype.toString.call(source) === "[object ArrayBuffer]") {
1340
+ return new Uint8Array(source.slice(0));
1341
+ }
1342
+ throw new TypeError("expected an ArrayBuffer or a typed array");
1343
+ }
1344
+
1345
+ // src/governance/intents.ts
1346
+ var LOWERCASE_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
1347
+ function assertIdempotencyKey(key) {
1348
+ if (typeof key !== "string" || !LOWERCASE_UUID.test(key)) {
1349
+ throw new TypeError(
1350
+ `idempotency key must be a lowercase UUID (got ${JSON.stringify(key)}); the platform refuses any other form`
1351
+ );
1352
+ }
1353
+ }
1354
+ function newIdempotencyKey() {
1355
+ const c = globalThis.crypto;
1356
+ if (c && typeof c.randomUUID === "function") {
1357
+ return c.randomUUID().toLowerCase();
1358
+ }
1359
+ if (!c || typeof c.getRandomValues !== "function") {
1360
+ throw new Error("no cryptographic random source: pass an idempotency key explicitly");
1361
+ }
1362
+ const b = c.getRandomValues(new Uint8Array(16));
1363
+ b[6] = b[6] & 15 | 64;
1364
+ b[8] = b[8] & 63 | 128;
1365
+ const hex = Array.from(b, (x) => x.toString(16).padStart(2, "0")).join("");
1366
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
1367
+ }
1368
+ function nonEmpty(name, value) {
1369
+ if (typeof value !== "string" || value === "") {
1370
+ throw new TypeError(`${name} is required`);
1371
+ }
1372
+ return value;
1373
+ }
1374
+ function keyList(name, keys) {
1375
+ if (!Array.isArray(keys) || keys.length === 0) {
1376
+ throw new TypeError(`${name} must list at least one public key`);
1377
+ }
1378
+ return keys.map((k, i) => {
1379
+ const key = nonEmpty(`${name}[${i}]`, k);
1380
+ if (key.trim() !== key) {
1381
+ throw new TypeError(`${name}[${i}] has leading or trailing whitespace; trim it first`);
1382
+ }
1383
+ return key;
1384
+ });
1385
+ }
1386
+ function version(v) {
1387
+ if (!Number.isSafeInteger(v) || v < 0) {
1388
+ throw new TypeError(
1389
+ `signer_group_version must be a non-negative integer (got ${String(v)}); read it from the group's \`version\``
1390
+ );
1391
+ }
1392
+ return v;
1393
+ }
1394
+ function finish(intent) {
1395
+ const canonical = canonicalJSON(intent);
1396
+ return { intent, canonical, bytes: utf8(canonical) };
1397
+ }
1398
+ function addSignersToGroupIntent(params) {
1399
+ assertIdempotencyKey(params.idempotencyKey);
1400
+ return finish({
1401
+ type: "add_signers_to_group",
1402
+ signer_group_id: nonEmpty("signerGroupId", params.signerGroupId),
1403
+ new_member_keys: keyList("newMemberKeys", params.newMemberKeys),
1404
+ signer_group_version: version(params.signerGroupVersion),
1405
+ idempotency_key: params.idempotencyKey
1406
+ });
1407
+ }
1408
+ function removeSignersFromGroupIntent(params) {
1409
+ assertIdempotencyKey(params.idempotencyKey);
1410
+ return finish({
1411
+ type: "remove_signers_from_group",
1412
+ group_id: nonEmpty("signerGroupId", params.signerGroupId),
1413
+ members_to_remove: keyList("membersToRemove", params.membersToRemove),
1414
+ signer_group_version: version(params.signerGroupVersion),
1415
+ idempotency_key: params.idempotencyKey
1416
+ });
1417
+ }
1418
+ function updateSignerGroupGovernanceIntent(params) {
1419
+ assertIdempotencyKey(params.idempotencyKey);
1420
+ const intent = {
1421
+ type: "update_signer_group_governance",
1422
+ signer_group_id: nonEmpty("signerGroupId", params.signerGroupId),
1423
+ signer_group_version: version(params.signerGroupVersion),
1424
+ idempotency_key: params.idempotencyKey
1425
+ };
1426
+ if (params.governanceThreshold !== void 0 && params.governanceThreshold !== null) {
1427
+ const t = params.governanceThreshold;
1428
+ if (!Number.isSafeInteger(t) || t < 1 || t > 2147483647) {
1429
+ throw new TypeError(
1430
+ "governanceThreshold must be an integer from 1 to 2^31-1, or null to clear it"
1431
+ );
1432
+ }
1433
+ intent.governance_threshold = params.governanceThreshold;
1434
+ }
1435
+ if (params.governanceSignerGroupId !== void 0 && params.governanceSignerGroupId !== null) {
1436
+ intent.governance_signer_group_id = nonEmpty(
1437
+ "governanceSignerGroupId",
1438
+ params.governanceSignerGroupId
1439
+ );
1440
+ }
1441
+ return finish(intent);
1442
+ }
1443
+ function createCryptoDestinationIntent(params) {
1444
+ assertIdempotencyKey(params.idempotencyKey);
1445
+ return finish({
1446
+ type: "create_crypto_destination",
1447
+ recipient_id: nonEmpty("recipientId", params.recipientId),
1448
+ network_id: nonEmpty("networkId", params.networkId),
1449
+ address: nonEmpty("address", params.address),
1450
+ signer_group_id: nonEmpty("signerGroupId", params.signerGroupId),
1451
+ idempotency_key: params.idempotencyKey
1452
+ });
1453
+ }
1454
+
1155
1455
  // src/client/resources/destinations.ts
1156
1456
  var DestinationsResource = class extends BaseResource {
1157
1457
  /**
@@ -1193,6 +1493,15 @@ var DestinationsResource = class extends BaseResource {
1193
1493
  * ```
1194
1494
  */
1195
1495
  async create(recipientId, data, options) {
1496
+ const signatures = data.signatures;
1497
+ if (signatures !== void 0 && signatures.length > 0) {
1498
+ if (!options?.idempotencyKey) {
1499
+ throw new TypeError(
1500
+ "destinations.create with signatures needs options.idempotencyKey: the idempotency_key inside the signed intent (a generated one could never match)"
1501
+ );
1502
+ }
1503
+ assertIdempotencyKey(options.idempotencyKey);
1504
+ }
1196
1505
  return this.transport.request({
1197
1506
  method: "POST",
1198
1507
  path: `/recipients/${recipientId}/destinations`,
@@ -1342,11 +1651,18 @@ var AccountsResource = class extends BaseResource {
1342
1651
  * @param data - Update data
1343
1652
  * @returns Updated account
1344
1653
  *
1654
+ * Only the developer fee can be updated, and setting one kind replaces the
1655
+ * other. `developer_fee_fixed` is a decimal string in units of the asset
1656
+ * deposited (at most 2 decimals, greater than 0); it applies to future
1657
+ * deposits only.
1658
+ *
1345
1659
  * @example
1346
1660
  * ```typescript
1347
1661
  * const account = await client.accounts.update(accountId, {
1348
- * status: 'inactive',
1662
+ * account_type: 'onramp',
1663
+ * developer_fee_fixed: '10.00',
1349
1664
  * });
1665
+ * console.log(account.minimum_deposit); // '10.01'
1350
1666
  * ```
1351
1667
  */
1352
1668
  async update(accountId, data, options) {
@@ -1685,13 +2001,19 @@ var WalletsResource = class extends BaseResource {
1685
2001
  * with the wallet's signer-group ECDSA P-256 key, base64-encode the
1686
2002
  * DER signature, then post the envelope.
1687
2003
  *
2004
+ * Use the SDK's `canonicalJSON`: it matches the platform's canonical form
2005
+ * byte for byte. Write `amount` in its shortest decimal form (`'100'`, not
2006
+ * `'100.00'`; `'0.5'`, not `'0.50'`). The platform parses the amount as a
2007
+ * decimal and re-serializes it before it checks the signature, so trailing
2008
+ * zeros change the signed bytes and the signature fails.
2009
+ *
1688
2010
  * @param walletId - Wallet ID
1689
2011
  * @param data - Endorsed wallet transaction request: `{ signatures, intent }`
1690
2012
  * @returns Created transaction
1691
2013
  *
1692
2014
  * @example
1693
2015
  * ```typescript
1694
- * import canonicalize from 'canonicalize';
2016
+ * import { canonicalJSON } from '@dakota-xyz/ts-sdk';
1695
2017
  * import { createSign, createPrivateKey, randomUUID } from 'node:crypto';
1696
2018
  *
1697
2019
  * const intent = {
@@ -1701,12 +2023,12 @@ var WalletsResource = class extends BaseResource {
1701
2023
  * kind: 'transfer',
1702
2024
  * from: wallet.address,
1703
2025
  * to: '0x...',
1704
- * amount: '100.00',
2026
+ * amount: '100', // shortest decimal form, see below
1705
2027
  * asset_id: 'USDC',
1706
2028
  * },
1707
2029
  * idempotency_key: randomUUID(),
1708
2030
  * };
1709
- * const canonical = canonicalize(intent)!;
2031
+ * const canonical = canonicalJSON(intent);
1710
2032
  * const sig = createSign('SHA256').update(canonical).sign({
1711
2033
  * key: createPrivateKey({ key: privateKeyDer, format: 'der', type: 'pkcs8' }),
1712
2034
  * dsaEncoding: 'der',
@@ -2325,6 +2647,63 @@ var PoliciesResource = class extends BaseResource {
2325
2647
  }
2326
2648
  };
2327
2649
 
2650
+ // src/governance/signer.ts
2651
+ async function signGovernanceIntent(intent, signers) {
2652
+ if (!Array.isArray(signers) || signers.length === 0) {
2653
+ throw new TypeError("a governance change needs at least one signer");
2654
+ }
2655
+ const bytes = ArrayBuffer.isView(intent) ? toBytes(intent) : intent.bytes;
2656
+ const out = [];
2657
+ for (const s of signers) {
2658
+ const sig = typeof s === "function" ? await s(bytes.slice()) : await s.sign(bytes.slice());
2659
+ if (typeof sig !== "string" || sig === "") {
2660
+ throw new Error("a governance signer returned an empty signature");
2661
+ }
2662
+ out.push(sig);
2663
+ }
2664
+ return out;
2665
+ }
2666
+ function webCryptoES256Signer(privateKey, subtle) {
2667
+ return {
2668
+ async sign(payload) {
2669
+ const s = subtle ?? globalThis.crypto?.subtle;
2670
+ if (!s) {
2671
+ throw new Error(
2672
+ "WebCrypto is not available: pass a SubtleCrypto or use ES256Signer on Node"
2673
+ );
2674
+ }
2675
+ const raw = new Uint8Array(
2676
+ await s.sign(
2677
+ { name: "ECDSA", hash: "SHA-256" },
2678
+ privateKey,
2679
+ toArrayBuffer(payload)
2680
+ )
2681
+ );
2682
+ return bytesToBase64(p1363ToDer(raw));
2683
+ }
2684
+ };
2685
+ }
2686
+ function toArrayBuffer(bytes) {
2687
+ const out = new ArrayBuffer(bytes.length);
2688
+ new Uint8Array(out).set(bytes);
2689
+ return out;
2690
+ }
2691
+ function p1363ToDer(sig) {
2692
+ if (sig.length !== 64) {
2693
+ throw new Error(`expected a 64-byte P-256 signature, got ${sig.length} bytes`);
2694
+ }
2695
+ const int = (bytes) => {
2696
+ let i = 0;
2697
+ while (i < bytes.length - 1 && bytes[i] === 0) i++;
2698
+ const trimmed = bytes.slice(i);
2699
+ const body = trimmed[0] & 128 ? Uint8Array.of(0, ...trimmed) : trimmed;
2700
+ return Uint8Array.of(2, body.length, ...body);
2701
+ };
2702
+ const r = int(sig.slice(0, 32));
2703
+ const s = int(sig.slice(32));
2704
+ return Uint8Array.of(48, r.length + s.length, ...r, ...s);
2705
+ }
2706
+
2328
2707
  // src/client/resources/signer-groups.ts
2329
2708
  var SignerGroupsResource = class extends BaseResource {
2330
2709
  /**
@@ -2373,7 +2752,7 @@ var SignerGroupsResource = class extends BaseResource {
2373
2752
  async get(signerGroupId, params) {
2374
2753
  return this.transport.request({
2375
2754
  method: "GET",
2376
- path: `/signer-groups/${signerGroupId}`,
2755
+ path: `/signer-groups/${seg(signerGroupId)}`,
2377
2756
  query: { ...params }
2378
2757
  });
2379
2758
  }
@@ -2384,21 +2763,35 @@ var SignerGroupsResource = class extends BaseResource {
2384
2763
  * key of an existing signer resource — not a fresh signer definition.
2385
2764
  * Returns the updated group (with the new member included).
2386
2765
  *
2766
+ * A governed group (governance settings, or a client with governance
2767
+ * enforcement on) refuses an unsigned add with
2768
+ * `EndorsementRequiredError`; use {@link addSignerSigned} instead, or pass
2769
+ * `signatures` + `signer_group_version` yourself with the SAME idempotency
2770
+ * key that is inside the signed intent.
2771
+ *
2387
2772
  * @param signerGroupId - Signer group ID
2388
2773
  * @param data - `{ member_key }` (the signer's base64 PKIX public key)
2389
2774
  * @returns The updated signer group
2390
2775
  */
2391
2776
  async addSigner(signerGroupId, data, options) {
2777
+ if (data.signatures !== void 0) {
2778
+ requireSignedKey("addSigner", options);
2779
+ }
2392
2780
  return this.transport.request({
2393
2781
  method: "POST",
2394
- path: `/signer-groups/${signerGroupId}/signers`,
2782
+ path: `/signer-groups/${seg(signerGroupId)}/signers`,
2395
2783
  body: data,
2396
2784
  idempotencyKey: options?.idempotencyKey,
2397
2785
  timeout: options?.timeout
2398
2786
  });
2399
2787
  }
2400
2788
  /**
2401
- * Remove a signer from a group.
2789
+ * Remove ONE signer from a group, unsigned, by its KSUID `signer_id`
2790
+ * (`DELETE /signer-groups/{id}/signers/{signer_id}`).
2791
+ *
2792
+ * A governed group refuses this with `EndorsementRequiredError`; use
2793
+ * {@link removeSignersSigned} instead. Not to be confused with
2794
+ * {@link removeSigners} (plural), the signed removal by PUBLIC KEY.
2402
2795
  *
2403
2796
  * @param signerGroupId - Signer group ID
2404
2797
  * @param signerId - The signer's KSUID `signer_id` — NOT its public key.
@@ -2409,11 +2802,257 @@ var SignerGroupsResource = class extends BaseResource {
2409
2802
  async removeSigner(signerGroupId, signerId, options) {
2410
2803
  await this.transport.request({
2411
2804
  method: "DELETE",
2412
- path: `/signer-groups/${signerGroupId}/signers/${signerId}`,
2805
+ path: `/signer-groups/${seg(signerGroupId)}/signers/${seg(signerId)}`,
2806
+ idempotencyKey: options?.idempotencyKey,
2807
+ timeout: options?.timeout
2808
+ });
2809
+ }
2810
+ // --------------------------------------------------------------------------
2811
+ // Signed (governed) membership and governance changes
2812
+ // --------------------------------------------------------------------------
2813
+ /**
2814
+ * Remove members by PUBLIC KEY, with signatures from the group's governance
2815
+ * (`POST /signer-groups/{id}/signer-removals`). Low level: you supply the
2816
+ * signed body, and `options.idempotencyKey` is required and MUST be the key
2817
+ * inside the signed intent. Prefer {@link removeSignersSigned}. (The
2818
+ * singular {@link removeSigner} is the unsigned removal by `signer_id`.)
2819
+ */
2820
+ async removeSigners(signerGroupId, data, options) {
2821
+ requireSignedKey("removeSigners", options);
2822
+ return this.transport.request({
2823
+ method: "POST",
2824
+ path: `/signer-groups/${seg(signerGroupId)}/signer-removals`,
2825
+ body: data,
2826
+ idempotencyKey: options?.idempotencyKey,
2827
+ timeout: options?.timeout
2828
+ });
2829
+ }
2830
+ /**
2831
+ * Replace a group's governance settings with signatures from its current
2832
+ * governance (`PATCH /signer-groups/{id}/governance`). The body is the
2833
+ * WHOLE state: a setting left out is cleared. Low level: you supply the
2834
+ * signed body, and `options.idempotencyKey` is required and MUST be the key
2835
+ * inside the signed intent. Prefer {@link updateGovernanceSigned}.
2836
+ */
2837
+ async updateGovernance(signerGroupId, data, options) {
2838
+ requireSignedKey("updateGovernance", options);
2839
+ return this.transport.request({
2840
+ method: "PATCH",
2841
+ path: `/signer-groups/${seg(signerGroupId)}/governance`,
2842
+ body: data,
2413
2843
  idempotencyKey: options?.idempotencyKey,
2414
2844
  timeout: options?.timeout
2415
2845
  });
2416
2846
  }
2847
+ /**
2848
+ * Build (but do not sign or send) the change that adds `memberKey` to the
2849
+ * group. Reads the group's current `version` unless
2850
+ * `options.signerGroupVersion` is given, and generates a lowercase UUID
2851
+ * idempotency key unless one is given.
2852
+ *
2853
+ * Use it when the signatures are collected elsewhere — for example a
2854
+ * passkey in the user's browser: send `change.canonical` there, pass it to
2855
+ * `buildChallenge`, then give the packed assertions to
2856
+ * {@link submitSignedChange}.
2857
+ */
2858
+ async prepareAddSigner(signerGroupId, memberKey, options) {
2859
+ return this.prepareChange(
2860
+ "add_signers_to_group",
2861
+ signerGroupId,
2862
+ { memberKeys: [memberKey] },
2863
+ options
2864
+ );
2865
+ }
2866
+ /**
2867
+ * Build (but do not sign or send) the change that removes `memberKeys`
2868
+ * (public keys, as the group lists them; signed in this order).
2869
+ */
2870
+ async prepareRemoveSigners(signerGroupId, memberKeys, options) {
2871
+ return this.prepareChange(
2872
+ "remove_signers_from_group",
2873
+ signerGroupId,
2874
+ { memberKeys: [...memberKeys] },
2875
+ options
2876
+ );
2877
+ }
2878
+ /**
2879
+ * Build (but do not sign or send) the change that sets the group's
2880
+ * governance to `settings`. It replaces the whole state: a setting left
2881
+ * out or null is cleared.
2882
+ */
2883
+ async prepareGovernanceUpdate(signerGroupId, settings, options) {
2884
+ const governance = {};
2885
+ if (settings.governance_threshold !== void 0 && settings.governance_threshold !== null) {
2886
+ governance.governance_threshold = settings.governance_threshold;
2887
+ }
2888
+ if (settings.governance_signer_group_id !== void 0 && settings.governance_signer_group_id !== null) {
2889
+ governance.governance_signer_group_id = settings.governance_signer_group_id;
2890
+ }
2891
+ return this.prepareChange(
2892
+ "update_signer_group_governance",
2893
+ signerGroupId,
2894
+ { governance },
2895
+ options
2896
+ );
2897
+ }
2898
+ /**
2899
+ * Send a prepared change with its signatures (ES256 DER base64, or packed
2900
+ * passkey assertions), using the change's idempotency key as
2901
+ * `X-Idempotency-Key`. Re-checks that the change still matches the intent
2902
+ * that was signed and refuses it otherwise, without sending anything.
2903
+ *
2904
+ * @throws EndorsementRequiredError, InsufficientEndorsementsError,
2905
+ * StaleSignerGroupVersionError, BelowThresholdError (all APIError)
2906
+ */
2907
+ async submitSignedChange(change, signatures, options) {
2908
+ if (!Array.isArray(signatures) || signatures.length === 0 || signatures.some((s) => typeof s !== "string" || s === "")) {
2909
+ throw new TypeError("a signed change needs at least one non-empty signature");
2910
+ }
2911
+ const built = buildChangeIntent(change);
2912
+ if (built.canonical !== change.canonical) {
2913
+ throw new Error(
2914
+ "the prepared change does not match the intent that was signed (it was altered after it was prepared); prepare it again"
2915
+ );
2916
+ }
2917
+ const i = built.intent;
2918
+ const requestOptions = { idempotencyKey: i.idempotency_key, timeout: options?.timeout };
2919
+ const sigs = [...signatures];
2920
+ switch (i.type) {
2921
+ case "add_signers_to_group":
2922
+ return this.addSigner(
2923
+ i.signer_group_id,
2924
+ {
2925
+ member_key: i.new_member_keys[0],
2926
+ signer_group_version: i.signer_group_version,
2927
+ signatures: sigs
2928
+ },
2929
+ requestOptions
2930
+ );
2931
+ case "remove_signers_from_group":
2932
+ return this.removeSigners(
2933
+ i.group_id,
2934
+ {
2935
+ members_to_remove: [...i.members_to_remove],
2936
+ signer_group_version: i.signer_group_version,
2937
+ signatures: sigs
2938
+ },
2939
+ requestOptions
2940
+ );
2941
+ case "update_signer_group_governance": {
2942
+ const body = {
2943
+ ...i.governance_threshold !== void 0 && {
2944
+ governance_threshold: i.governance_threshold
2945
+ },
2946
+ ...i.governance_signer_group_id !== void 0 && {
2947
+ governance_signer_group_id: i.governance_signer_group_id
2948
+ },
2949
+ signer_group_version: i.signer_group_version,
2950
+ signatures: sigs
2951
+ };
2952
+ return this.updateGovernance(i.signer_group_id, body, requestOptions);
2953
+ }
2954
+ default:
2955
+ throw new TypeError(`cannot submit a ${i.type} change from signerGroups`);
2956
+ }
2957
+ }
2958
+ /**
2959
+ * Add `memberKey` to a governed group in one call: read the version, build
2960
+ * the `add_signers_to_group` intent, sign it with each signer (in order),
2961
+ * and send it with the same idempotency key in the intent and the header.
2962
+ *
2963
+ * @param signers - ES256 signers (`ES256Signer`, your KMS) or plain
2964
+ * `(bytes) => signature` functions; together they must meet the group's
2965
+ * `effective_governance_threshold`. For a passkey in the user's browser
2966
+ * or app, use {@link prepareAddSigner} + {@link submitSignedChange}
2967
+ * instead, so the API key stays on your server; `webauthnSigner` fits
2968
+ * here only when the passkey prompt runs in the same process as this
2969
+ * client. Each stale retry calls every signer again.
2970
+ * @example
2971
+ * ```typescript
2972
+ * const group = await client.signerGroups.addSignerSigned(groupId, newKey, [
2973
+ * ES256Signer.fromPrivateKey(adminKeyPem),
2974
+ * ]);
2975
+ * ```
2976
+ */
2977
+ async addSignerSigned(signerGroupId, memberKey, signers, options) {
2978
+ return this.signAndSubmit(
2979
+ () => this.prepareAddSigner(signerGroupId, memberKey, options),
2980
+ signers,
2981
+ options
2982
+ );
2983
+ }
2984
+ /** Remove `memberKeys` from a governed group in one call; see {@link addSignerSigned}. */
2985
+ async removeSignersSigned(signerGroupId, memberKeys, signers, options) {
2986
+ return this.signAndSubmit(
2987
+ () => this.prepareRemoveSigners(signerGroupId, memberKeys, options),
2988
+ signers,
2989
+ options
2990
+ );
2991
+ }
2992
+ /**
2993
+ * Replace a group's governance settings in one call; see
2994
+ * {@link addSignerSigned}. Signed by the group's CURRENT governance.
2995
+ *
2996
+ * `staleRetries` is refused here: the change replaces the WHOLE governance
2997
+ * state, so re-signing it after someone else changed the group would
2998
+ * silently undo their change. On `StaleSignerGroupVersionError`, re-read
2999
+ * the group, decide, and call again.
3000
+ */
3001
+ async updateGovernanceSigned(signerGroupId, settings, signers, options) {
3002
+ if (options?.staleRetries) {
3003
+ throw new TypeError(
3004
+ "staleRetries is not supported on updateGovernanceSigned: a re-sign after a concurrent change would undo it"
3005
+ );
3006
+ }
3007
+ return this.signAndSubmit(
3008
+ () => this.prepareGovernanceUpdate(signerGroupId, settings, options),
3009
+ signers,
3010
+ options
3011
+ );
3012
+ }
3013
+ async prepareChange(kind, signerGroupId, fields, options) {
3014
+ if (options?.idempotencyKey !== void 0) {
3015
+ assertIdempotencyKey(options.idempotencyKey);
3016
+ }
3017
+ const signerGroupVersion = options?.signerGroupVersion ?? await this.currentVersion(signerGroupId);
3018
+ const draft = {
3019
+ kind,
3020
+ signerGroupId,
3021
+ signerGroupVersion,
3022
+ idempotencyKey: options?.idempotencyKey ?? governanceIdempotencyKey(),
3023
+ ...fields,
3024
+ canonical: ""
3025
+ };
3026
+ return { ...draft, canonical: buildChangeIntent(draft).canonical };
3027
+ }
3028
+ async currentVersion(signerGroupId) {
3029
+ const group = await this.get(signerGroupId);
3030
+ if (typeof group.version !== "number") {
3031
+ throw new Error(
3032
+ `signer group ${signerGroupId} has no version in the response, so a signed change cannot be built; pass signerGroupVersion if you know it`
3033
+ );
3034
+ }
3035
+ return group.version;
3036
+ }
3037
+ async signAndSubmit(prepare, signers, options) {
3038
+ if (!Array.isArray(signers) || signers.length === 0) {
3039
+ throw new TypeError("a governance change needs at least one signer");
3040
+ }
3041
+ let retries = staleRetryBudget(options);
3042
+ for (; ; ) {
3043
+ const change = await prepare();
3044
+ const signatures = await signGovernanceIntent(utf8(change.canonical), signers);
3045
+ try {
3046
+ return await this.submitSignedChange(change, signatures, { timeout: options?.timeout });
3047
+ } catch (err) {
3048
+ if (err instanceof StaleSignerGroupVersionError && retries > 0) {
3049
+ retries--;
3050
+ continue;
3051
+ }
3052
+ throw err;
3053
+ }
3054
+ }
3055
+ }
2417
3056
  /**
2418
3057
  * Get wallets attached to a signer group.
2419
3058
  *
@@ -2425,7 +3064,7 @@ var SignerGroupsResource = class extends BaseResource {
2425
3064
  async getWallets(signerGroupId) {
2426
3065
  return this.transport.request({
2427
3066
  method: "GET",
2428
- path: `/signer-groups/${signerGroupId}/wallets`
3067
+ path: `/signer-groups/${seg(signerGroupId)}/wallets`
2429
3068
  });
2430
3069
  }
2431
3070
  /**
@@ -2442,7 +3081,7 @@ var SignerGroupsResource = class extends BaseResource {
2442
3081
  async attachToWallet(walletId, signerGroupId, options) {
2443
3082
  await this.transport.request({
2444
3083
  method: "PUT",
2445
- path: `/wallets/${walletId}/signer-groups/${signerGroupId}`,
3084
+ path: `/wallets/${seg(walletId)}/signer-groups/${seg(signerGroupId)}`,
2446
3085
  body: options?.endorsement,
2447
3086
  idempotencyKey: options?.idempotencyKey,
2448
3087
  timeout: options?.timeout
@@ -2462,7 +3101,7 @@ var SignerGroupsResource = class extends BaseResource {
2462
3101
  async detachFromWallet(walletId, signerGroupId, options) {
2463
3102
  await this.transport.request({
2464
3103
  method: "DELETE",
2465
- path: `/wallets/${walletId}/signer-groups/${signerGroupId}`,
3104
+ path: `/wallets/${seg(walletId)}/signer-groups/${seg(signerGroupId)}`,
2466
3105
  body: options?.endorsement,
2467
3106
  idempotencyKey: options?.idempotencyKey,
2468
3107
  timeout: options?.timeout
@@ -2479,6 +3118,65 @@ var SignerGroupsResource = class extends BaseResource {
2479
3118
  return this.paginate(`/wallets/${walletId}/signer-groups`, params);
2480
3119
  }
2481
3120
  };
3121
+ function seg(id) {
3122
+ if (typeof id !== "string" || id === "" || id === "." || id === "..") {
3123
+ throw new TypeError(`invalid id for a request path: ${JSON.stringify(id)}`);
3124
+ }
3125
+ return encodeURIComponent(id);
3126
+ }
3127
+ var MAX_STALE_RETRIES = 5;
3128
+ function staleRetryBudget(options) {
3129
+ const n = options?.staleRetries ?? 0;
3130
+ if (!Number.isInteger(n) || n < 0 || n > MAX_STALE_RETRIES) {
3131
+ throw new TypeError(`staleRetries must be an integer from 0 to ${MAX_STALE_RETRIES}`);
3132
+ }
3133
+ if (n > 0 && (options?.signerGroupVersion !== void 0 || options?.idempotencyKey !== void 0)) {
3134
+ throw new TypeError(
3135
+ "staleRetries cannot be combined with a fixed signerGroupVersion or idempotencyKey: a retry needs a fresh read and a fresh key"
3136
+ );
3137
+ }
3138
+ return n;
3139
+ }
3140
+ function governanceIdempotencyKey() {
3141
+ const c = globalThis.crypto;
3142
+ return typeof c?.randomUUID === "function" ? newIdempotencyKey() : crypto.randomUUID().toLowerCase();
3143
+ }
3144
+ function requireSignedKey(method, options) {
3145
+ if (!options?.idempotencyKey) {
3146
+ throw new TypeError(
3147
+ `${method} with signatures needs options.idempotencyKey: the idempotency_key inside the signed intent (a generated one could never match)`
3148
+ );
3149
+ }
3150
+ assertIdempotencyKey(options.idempotencyKey);
3151
+ }
3152
+ function buildChangeIntent(change) {
3153
+ const common = {
3154
+ signerGroupId: change.signerGroupId,
3155
+ signerGroupVersion: change.signerGroupVersion,
3156
+ idempotencyKey: change.idempotencyKey
3157
+ };
3158
+ switch (change.kind) {
3159
+ case "add_signers_to_group":
3160
+ if (!change.memberKeys || change.memberKeys.length !== 1) {
3161
+ throw new TypeError(
3162
+ "an add change carries exactly one member key (the endpoint adds one per request)"
3163
+ );
3164
+ }
3165
+ return addSignersToGroupIntent({ ...common, newMemberKeys: change.memberKeys });
3166
+ case "remove_signers_from_group":
3167
+ return removeSignersFromGroupIntent({ ...common, membersToRemove: change.memberKeys ?? [] });
3168
+ case "update_signer_group_governance":
3169
+ return updateSignerGroupGovernanceIntent({
3170
+ ...common,
3171
+ governanceThreshold: change.governance?.governance_threshold,
3172
+ governanceSignerGroupId: change.governance?.governance_signer_group_id
3173
+ });
3174
+ default:
3175
+ throw new TypeError(
3176
+ `unknown signer-group change kind ${JSON.stringify(change.kind)}`
3177
+ );
3178
+ }
3179
+ }
2482
3180
  var SignersResource = class extends BaseResource {
2483
3181
  /**
2484
3182
  * Create a new signer.
@@ -2537,6 +3235,23 @@ var ApiKeysResource = class extends BaseResource {
2537
3235
  list(params) {
2538
3236
  return this.paginate("/api-keys", params);
2539
3237
  }
3238
+ /**
3239
+ * Change the name, the scope, or both, of an API key. A new scope applies
3240
+ * from the next request made with the key. The key value does not change.
3241
+ *
3242
+ * @param apiKeyId - API key ID
3243
+ * @param data - The new name, the new scope, or both
3244
+ * @returns The updated API key
3245
+ */
3246
+ async update(apiKeyId, data, options) {
3247
+ return this.transport.request({
3248
+ method: "PATCH",
3249
+ path: `/api-keys/${apiKeyId}`,
3250
+ body: data,
3251
+ idempotencyKey: options?.idempotencyKey,
3252
+ timeout: options?.timeout
3253
+ });
3254
+ }
2540
3255
  /**
2541
3256
  * Delete an API key.
2542
3257
  *
@@ -2861,11 +3576,11 @@ var LegalResource = class extends BaseResource {
2861
3576
  * });
2862
3577
  * ```
2863
3578
  */
2864
- async get(documentKey, version) {
3579
+ async get(documentKey, version2) {
2865
3580
  return this.transport.request({
2866
3581
  method: "GET",
2867
3582
  path: `/legal/documents/${documentKey}`,
2868
- query: version !== void 0 ? { version } : void 0
3583
+ query: version2 !== void 0 ? { version: version2 } : void 0
2869
3584
  });
2870
3585
  }
2871
3586
  };
@@ -2931,6 +3646,65 @@ var RDMarketingFeeResource = class extends BaseResource {
2931
3646
  path: `/rd-marketing-fee/statements/${month}`
2932
3647
  });
2933
3648
  }
3649
+ /**
3650
+ * The wallet this client's RD marketing fee is sent to.
3651
+ *
3652
+ * A **404** here is the ordinary state for a client who has not registered
3653
+ * one yet — not an error. A **403** means the client is not in the
3654
+ * programme at all.
3655
+ *
3656
+ * @returns The registered destination: always on Base (`eip155:8453`)
3657
+ *
3658
+ * @example
3659
+ * ```typescript
3660
+ * try {
3661
+ * const dest = await client.rdMarketingFee.getPayoutDestination();
3662
+ * console.log(dest.address);
3663
+ * } catch (error) {
3664
+ * if (error instanceof APIError && error.statusCode === 404) {
3665
+ * // Nothing registered yet — prompt for one.
3666
+ * }
3667
+ * }
3668
+ * ```
3669
+ */
3670
+ async getPayoutDestination() {
3671
+ return this.transport.request({
3672
+ method: "GET",
3673
+ path: "/rd-marketing-fee/payout-destination"
3674
+ });
3675
+ }
3676
+ /**
3677
+ * Register, or replace, the wallet the RD marketing fee is sent to.
3678
+ *
3679
+ * RD exists only on Base, so the chain is not a parameter — only an EVM
3680
+ * `address`. There is one destination per client, so this REPLACES any
3681
+ * existing one. Emits `rd_payout_destination.updated`.
3682
+ *
3683
+ * This is a SEPARATE registration from the developer-fee payout
3684
+ * destination (`client.feePayoutDestination`): the two programmes pay
3685
+ * different assets and are set independently.
3686
+ *
3687
+ * @param data - The EVM address on Base to pay the fee to
3688
+ * @param options - Request options (e.g., custom idempotency key)
3689
+ * @returns The stored destination
3690
+ *
3691
+ * @example
3692
+ * ```typescript
3693
+ * const dest = await client.rdMarketingFee.setPayoutDestination({
3694
+ * address: '0x1234567890123456789012345678901234567890',
3695
+ * });
3696
+ * console.log(dest.chain); // 'eip155:8453'
3697
+ * ```
3698
+ */
3699
+ async setPayoutDestination(data, options) {
3700
+ return this.transport.request({
3701
+ method: "PUT",
3702
+ path: "/rd-marketing-fee/payout-destination",
3703
+ body: data,
3704
+ idempotencyKey: options?.idempotencyKey,
3705
+ timeout: options?.timeout
3706
+ });
3707
+ }
2934
3708
  };
2935
3709
 
2936
3710
  // src/client/resources/sandbox.ts
@@ -2943,9 +3717,13 @@ var SandboxResource = class extends BaseResource {
2943
3717
  *
2944
3718
  * | Type | Required Fields |
2945
3719
  * |------|-----------------|
2946
- * | `ach_inbound`, `wire_inbound` | `account_id` |
2947
- * | `crypto_inbound` | `wallet_id` |
2948
- * | `*_outbound_*`, `*_reversal` | `movement_id` |
3720
+ * | `ach_inbound`, `fedwire_inbound`, `swift_inbound`, `fednow_inbound` | `account_id` |
3721
+ * | `crypto_inbound` | `wallet_address` |
3722
+ * | `*_outbound_*`, `*_reversal` | `account_id` + `one_off_transaction_id` |
3723
+ *
3724
+ * `swift_inbound` and `fedwire_inbound` behave identically: the rail a
3725
+ * deposit books on is derived from the RECEIVING account, so pick the
3726
+ * account, not the type, to choose between a SWIFT and a Fedwire deposit.
2949
3727
  *
2950
3728
  * @param data - Simulation request data
2951
3729
  * @returns Simulation response with ID and state
@@ -2974,11 +3752,13 @@ var SandboxResource = class extends BaseResource {
2974
3752
  * destination_payment_rail: 'ach',
2975
3753
  * });
2976
3754
  *
2977
- * // Simulate the ACH settlement
3755
+ * // Simulate the ACH settlement. `account_id` is the offramp account that
3756
+ * // funded the transaction.
2978
3757
  * await client.sandbox.simulateInbound({
2979
3758
  * simulation_id: `sim_${Date.now()}`,
2980
3759
  * type: 'ach_outbound_settled',
2981
- * movement_id: tx.id,
3760
+ * account_id: 'acc_456',
3761
+ * one_off_transaction_id: tx.id,
2982
3762
  * amount: '100.00',
2983
3763
  * currency: 'USD',
2984
3764
  * });
@@ -2989,7 +3769,7 @@ var SandboxResource = class extends BaseResource {
2989
3769
  * const result = await client.sandbox.simulateInbound({
2990
3770
  * simulation_id: `sim_${Date.now()}`,
2991
3771
  * type: 'crypto_inbound',
2992
- * wallet_id: 'wallet_789',
3772
+ * wallet_address: '0x165cd37b4c644c2921454429e7f9358d18a45e14',
2993
3773
  * amount: '500.00',
2994
3774
  * currency: 'USDC',
2995
3775
  * });
@@ -3018,21 +3798,16 @@ var SandboxResource = class extends BaseResource {
3018
3798
  * @param data - Simulation request data
3019
3799
  * @returns Simulation response with previous and new state
3020
3800
  *
3021
- * @example Approve KYB and activate applicant
3801
+ * `applicant_activate` runs the same code path as `kyb_approve`. One call
3802
+ * is enough: do not send `applicant_activate` after `kyb_approve`.
3803
+ *
3804
+ * @example Approve an application
3022
3805
  * ```typescript
3023
- * // Step 1: Approve the KYB application
3024
3806
  * await client.sandbox.simulateOnboarding({
3025
3807
  * type: 'kyb_approve',
3026
3808
  * applicant_id: customer.application_id,
3027
3809
  * simulation_id: `sim_kyb_${Date.now()}`,
3028
3810
  * });
3029
- *
3030
- * // Step 2: Activate the applicant (triggers provisioning)
3031
- * await client.sandbox.simulateOnboarding({
3032
- * type: 'applicant_activate',
3033
- * applicant_id: customer.application_id,
3034
- * simulation_id: `sim_activate_${Date.now()}`,
3035
- * });
3036
3811
  * ```
3037
3812
  *
3038
3813
  * @example Reject a KYB application
@@ -3469,14 +4244,22 @@ var InstructionsResource = class extends BaseResource {
3469
4244
  *
3470
4245
  * One optional field shapes the actuation:
3471
4246
  *
3472
- * - `developer_fee` declares your fee PER PAYOUT TYPE — `swap_bps` for a
3473
- * crypto payout, `offramp_bps` for a bank payout. They are independent,
3474
- * so one conversation can charge a swap and stay silent about a bank
3475
- * payout in the same turn. Omit a rate (or send zero) and that payout
3476
- * type carries no fee: nothing is charged, nothing is added to the
3477
- * amount, and the agent is told nothing about a fee it could mention.
3478
- * Both are DEFAULTS for the auto-accounts this request creates — an
3479
- * action-level `fee_bps` still wins outright.
4247
+ * - `developer_fee_defaults` declares your fee PER PAYOUT TYPE —
4248
+ * `swap` for a crypto payout, `offramp` for a bank payout — each as
4249
+ * a percentage (`developer_fee_bps`) or a flat amount per payment
4250
+ * (`developer_fee_fixed`, a decimal string in units of the asset
4251
+ * deposited, added on top of the amount), never both. They are
4252
+ * independent, so one conversation can charge a swap and stay silent
4253
+ * about a bank payout in the same turn. Omit a payout type (or set its
4254
+ * `developer_fee_bps` to zero) and it carries no fee: nothing is
4255
+ * charged, nothing is added to the amount, and the agent is told
4256
+ * nothing about a fee it could mention. Both are
4257
+ * DEFAULTS for the auto-accounts this request creates — an action-level
4258
+ * `developer_fee_bps` or `developer_fee_fixed` still wins outright.
4259
+ *
4260
+ * It replaces the deprecated `developer_fee` (`swap_bps` /
4261
+ * `offramp_bps`), which the platform still accepts. Send one or the
4262
+ * other: both is a 400.
3480
4263
  *
3481
4264
  * The vocabulary the actuation is judged against comes from the policy
3482
4265
  * registered with `client.agenticPolicy.set()` — the same one the drafting
@@ -3669,11 +4452,17 @@ var MandatesResource = class extends BaseResource {
3669
4452
  * it at its due date, days later, with the payee unpaid.
3670
4453
  *
3671
4454
  * Advisory — nothing here reserves budget, and the gate remains the
3672
- * authority at fire time. Two things to honour when reading a line:
3673
- * an ABSENT `remaining_amount` / `remaining_count` means "not capped", never
3674
- * "nothing left"; a `remaining_amount` of `'?'` means the figure could not
3675
- * be summed and MUST be treated as no headroom (the gate fails closed on the
3676
- * same data).
4455
+ * authority at fire time. Three things to honour when reading a line:
4456
+ *
4457
+ * - An ABSENT `remaining_amount` / `remaining_count` means "not capped",
4458
+ * never "nothing left" — EXCEPT on a `per_target` line with
4459
+ * `prior_scope: true`. That line's spend was booked under an earlier
4460
+ * version's target scope (before a `target_type` amendment) and no
4461
+ * current target claims it: the spend is real and still counts toward
4462
+ * the aggregate caps, but no payment can consume the bucket, so absent
4463
+ * remaining_* there means NO headroom. Never set on aggregate lines.
4464
+ * - A `remaining_amount` of `'?'` means the figure could not be summed and
4465
+ * MUST be treated as no headroom (the gate fails closed on the same data).
3677
4466
  *
3678
4467
  * @param mandateId - Mandate ID
3679
4468
  * @returns Per-target and aggregate budget lines, as of a stated instant
@@ -3681,8 +4470,11 @@ var MandatesResource = class extends BaseResource {
3681
4470
  * @example
3682
4471
  * ```typescript
3683
4472
  * const budget = await client.mandates.getBudget(mandateId);
3684
- * for (const line of budget.aggregate) {
3685
- * console.log(line.bucket, line.remaining_amount ?? 'uncapped');
4473
+ * for (const line of [...budget.per_target, ...budget.aggregate]) {
4474
+ * const headroom = line.prior_scope
4475
+ * ? 'none (prior scope)'
4476
+ * : (line.remaining_amount ?? 'uncapped');
4477
+ * console.log(line.target ?? '(all payees)', line.bucket, headroom);
3686
4478
  * }
3687
4479
  * ```
3688
4480
  */
@@ -3769,6 +4561,47 @@ var InsightsResource = class extends BaseResource {
3769
4561
  path: `/customers/${customerId}/insights`
3770
4562
  });
3771
4563
  }
4564
+ /**
4565
+ * Get the client-level portfolio insight report.
4566
+ *
4567
+ * The client-scope companion of {@link get}: one deterministic, read-only
4568
+ * report over ALL of the caller's customers' agentic activity. Items reuse
4569
+ * the customer report's shape, plus `customer_id` (omitted on
4570
+ * cross-customer aggregates) and `responsibility` (a grouping label for
4571
+ * filtering — not ownership). On top of the items the report carries
4572
+ * dashboard-shaped data: KPI `metrics` with previous-window values for
4573
+ * trend deltas, daily `series` for charts, and a per-customer roll-up in
4574
+ * `customers` sorted worst-first.
4575
+ *
4576
+ * Every filter is optional and only NARROWS the report; the response shape
4577
+ * never changes. The report scans at most 100 customers per request —
4578
+ * `snapshot.customers.scanned < total` says it was computed over a prefix
4579
+ * of the book, never silently.
4580
+ *
4581
+ * A 404 means agentic payments are not enabled for the key, or the
4582
+ * `customer_id` filter names an unknown customer.
4583
+ *
4584
+ * @param params - Optional filters and the report window
4585
+ * @returns The client's portfolio insight report
4586
+ *
4587
+ * @example
4588
+ * ```typescript
4589
+ * const report = await client.insights.getClientReport({
4590
+ * severity: 'critical,warn',
4591
+ * window_days: 30,
4592
+ * });
4593
+ * for (const row of report.customers) {
4594
+ * if (row.item_counts.critical > 0) console.log(row.customer_id, row.name);
4595
+ * }
4596
+ * ```
4597
+ */
4598
+ async getClientReport(params) {
4599
+ return this.transport.request({
4600
+ method: "GET",
4601
+ path: "/insights",
4602
+ query: { ...params }
4603
+ });
4604
+ }
3772
4605
  };
3773
4606
 
3774
4607
  // src/client/resources/agentic-policy.ts
@@ -3854,6 +4687,7 @@ var AgentConversation = class {
3854
4687
  paymentAgentId;
3855
4688
  timezone;
3856
4689
  timeout;
4690
+ developerFeeDefaults;
3857
4691
  developerFee;
3858
4692
  history = [];
3859
4693
  constructor(client, paymentAgentId, history, options) {
@@ -3861,6 +4695,7 @@ var AgentConversation = class {
3861
4695
  this.paymentAgentId = paymentAgentId;
3862
4696
  this.timezone = options?.timezone;
3863
4697
  this.timeout = options?.timeout;
4698
+ this.developerFeeDefaults = options?.developerFeeDefaults;
3864
4699
  this.developerFee = options?.developerFee;
3865
4700
  if (history && history.length > 0) {
3866
4701
  this.history = history.map(cloneMessage);
@@ -3909,6 +4744,7 @@ var AgentConversation = class {
3909
4744
  // Resent on EVERY turn — the endpoint is stateless, so a value
3910
4745
  // given once would be forgotten on the next one.
3911
4746
  ...this.timezone ? { timezone: this.timezone } : {},
4747
+ ...this.developerFeeDefaults ? { developer_fee_defaults: this.developerFeeDefaults } : {},
3912
4748
  ...this.developerFee ? { developer_fee: this.developerFee } : {}
3913
4749
  },
3914
4750
  this.timeout !== void 0 ? { timeout: this.timeout } : void 0
@@ -4195,41 +5031,84 @@ var DakotaClient = class {
4195
5031
  return this.config.baseURL;
4196
5032
  }
4197
5033
  };
4198
-
4199
- // src/agentic/canonicalize.ts
4200
- function canonicalJSON(value) {
4201
- return canonicalize(value);
4202
- }
4203
- function canonicalize(value) {
4204
- if (value === null || value === void 0) {
4205
- return "null";
5034
+ var ES256Signer = class _ES256Signer {
5035
+ privateKey;
5036
+ publicKey;
5037
+ constructor(privateKey, publicKey) {
5038
+ this.privateKey = privateKey;
5039
+ this.publicKey = publicKey;
4206
5040
  }
4207
- if (typeof value === "boolean") {
4208
- return value ? "true" : "false";
5041
+ /**
5042
+ * Generate a fresh P-256 keypair.
5043
+ */
5044
+ static generate() {
5045
+ const { privateKey, publicKey } = crypto.generateKeyPairSync("ec", { namedCurve: "P-256" });
5046
+ return new _ES256Signer(privateKey, publicKey);
4209
5047
  }
4210
- if (typeof value === "number") {
4211
- if (!Number.isFinite(value)) {
4212
- throw new TypeError(`canonical JSON: non-finite number ${value}`);
5048
+ /**
5049
+ * Adopt an existing P-256 private key. Accepts a PKCS#8 PEM string, a
5050
+ * DER-encoded PKCS#8 buffer, or a Node {@link KeyObject}.
5051
+ */
5052
+ static fromPrivateKey(key) {
5053
+ const privateKey = typeof key === "string" || key instanceof Uint8Array ? crypto.createPrivateKey({
5054
+ key,
5055
+ format: typeof key === "string" ? "pem" : "der",
5056
+ type: "pkcs8"
5057
+ }) : key;
5058
+ if (privateKey.asymmetricKeyType !== "ec") {
5059
+ throw new Error("a P-256 private key is required (ES256)");
4213
5060
  }
4214
- return JSON.stringify(value);
5061
+ const details = privateKey.asymmetricKeyDetails;
5062
+ if (details?.namedCurve !== "prime256v1") {
5063
+ throw new Error("a P-256 private key is required (ES256)");
5064
+ }
5065
+ const publicKey = crypto.createPublicKey(privateKey);
5066
+ return new _ES256Signer(privateKey, publicKey);
4215
5067
  }
4216
- if (typeof value === "string") {
4217
- return JSON.stringify(value);
5068
+ /**
5069
+ * base64 PKIX (SPKI) public key — pass this as the signer's registered
5070
+ * public key at agent creation / mandate approval.
5071
+ */
5072
+ publicKeyBase64() {
5073
+ const der = this.publicKey.export({ format: "der", type: "spki" });
5074
+ return Buffer.from(der).toString("base64");
4218
5075
  }
4219
- if (typeof value === "bigint") {
4220
- throw new TypeError("canonical JSON: bigint values are not supported");
5076
+ /**
5077
+ * Returns base64( ASN.1 ECDSA signature over SHA-256(payload) ).
5078
+ */
5079
+ sign(payload) {
5080
+ const signer = crypto.createSign("SHA256");
5081
+ signer.update(payload);
5082
+ const sig = signer.sign({ key: this.privateKey, dsaEncoding: "der" });
5083
+ return Buffer.from(sig).toString("base64");
4221
5084
  }
4222
- if (Array.isArray(value)) {
4223
- const parts = value.map((item) => canonicalize(item));
4224
- return `[${parts.join(",")}]`;
5085
+ };
5086
+ function verifyES256Signature(publicKeyBase64, payload, signatureBase64) {
5087
+ let publicKey;
5088
+ try {
5089
+ publicKey = crypto.createPublicKey({
5090
+ key: Buffer.from(publicKeyBase64, "base64"),
5091
+ format: "der",
5092
+ type: "spki"
5093
+ });
5094
+ } catch (err) {
5095
+ throw new Error(`parse public key: ${err.message}`);
4225
5096
  }
4226
- if (typeof value === "object") {
4227
- const obj = value;
4228
- const keys = Object.keys(obj).sort();
4229
- const parts = keys.map((key) => `${JSON.stringify(key)}:${canonicalize(obj[key])}`);
4230
- return `{${parts.join(",")}}`;
5097
+ if (publicKey.asymmetricKeyType !== "ec") {
5098
+ throw new Error("not a P-256 public key (ES256 requires P-256)");
5099
+ }
5100
+ if (publicKey.asymmetricKeyDetails?.namedCurve !== "prime256v1") {
5101
+ throw new Error("not a P-256 public key (ES256 requires P-256)");
5102
+ }
5103
+ const verifier = crypto.createVerify("SHA256");
5104
+ verifier.update(payload);
5105
+ const ok = verifier.verify(
5106
+ { key: publicKey, dsaEncoding: "der" },
5107
+ Buffer.from(signatureBase64, "base64")
5108
+ );
5109
+ if (!ok) {
5110
+ throw new Error("signature verification failed");
4231
5111
  }
4232
- throw new TypeError(`canonical JSON: unsupported value type ${typeof value}`);
4233
5112
  }
4234
5113
 
4235
5114
  // src/agentic/sign.ts
@@ -4253,14 +5132,14 @@ function mandateSignPayload(mandate, action) {
4253
5132
  });
4254
5133
  return new TextEncoder().encode(encoded);
4255
5134
  }
4256
- function mandateAmendSignPayload(mandate, version, rule) {
5135
+ function mandateAmendSignPayload(mandate, version2, rule) {
4257
5136
  if (!mandate.id) {
4258
5137
  throw new Error("mandate has no id");
4259
5138
  }
4260
5139
  if (!mandate.bound_signer_id) {
4261
5140
  throw new Error("mandate has no bound_signer_id");
4262
5141
  }
4263
- if (!Number.isInteger(version) || version < 2) {
5142
+ if (!Number.isInteger(version2) || version2 < 2) {
4264
5143
  throw new Error("amend version must be an integer >= 2 (the version being created)");
4265
5144
  }
4266
5145
  const encoded = canonicalJSON({
@@ -4270,7 +5149,7 @@ function mandateAmendSignPayload(mandate, version, rule) {
4270
5149
  rule,
4271
5150
  valid_from: mandate.valid_from ?? 0,
4272
5151
  valid_until: mandate.valid_until ?? 0,
4273
- version
5152
+ version: version2
4274
5153
  });
4275
5154
  return new TextEncoder().encode(encoded);
4276
5155
  }
@@ -4359,84 +5238,105 @@ function addPolicyRulePayload(policyId, action, ruleType, definition, idempotenc
4359
5238
  function textBytes(s) {
4360
5239
  return new TextEncoder().encode(s);
4361
5240
  }
4362
- var P256MandateSigner = class _P256MandateSigner {
4363
- privateKey;
4364
- publicKey;
4365
- constructor(privateKey, publicKey) {
4366
- this.privateKey = privateKey;
4367
- this.publicKey = publicKey;
5241
+
5242
+ // src/governance/webauthn.ts
5243
+ function buildChallenge(intent) {
5244
+ const bytes = challengeBytes(intent);
5245
+ const out = new ArrayBuffer(bytes.length);
5246
+ new Uint8Array(out).set(bytes);
5247
+ return out;
5248
+ }
5249
+ function challengeBytes(intent) {
5250
+ if (typeof intent === "string") {
5251
+ return utf8(intent);
4368
5252
  }
4369
- /**
4370
- * Generate a fresh P-256 keypair.
4371
- */
4372
- static generate() {
4373
- const { privateKey, publicKey } = crypto.generateKeyPairSync("ec", { namedCurve: "P-256" });
4374
- return new _P256MandateSigner(privateKey, publicKey);
5253
+ if (isBinary(intent)) {
5254
+ return toBytes(intent);
4375
5255
  }
4376
- /**
4377
- * Adopt an existing P-256 private key. Accepts a PKCS#8 PEM string, a
4378
- * DER-encoded PKCS#8 buffer, or a Node {@link KeyObject}.
4379
- */
4380
- static fromPrivateKey(key) {
4381
- const privateKey = typeof key === "string" || key instanceof Uint8Array ? crypto.createPrivateKey({
4382
- key,
4383
- format: typeof key === "string" ? "pem" : "der",
4384
- type: "pkcs8"
4385
- }) : key;
4386
- if (privateKey.asymmetricKeyType !== "ec") {
4387
- throw new Error("a P-256 private key is required (ES256)");
4388
- }
4389
- const details = privateKey.asymmetricKeyDetails;
4390
- if (details?.namedCurve !== "prime256v1") {
4391
- throw new Error("a P-256 private key is required (ES256)");
5256
+ if (intent && typeof intent === "object") {
5257
+ const canonical = intent.canonical;
5258
+ if (typeof canonical === "string") {
5259
+ return utf8(canonical);
4392
5260
  }
4393
- const publicKey = crypto.createPublicKey(privateKey);
4394
- return new _P256MandateSigner(privateKey, publicKey);
4395
5261
  }
4396
- /**
4397
- * base64 PKIX (SPKI) public key — pass this as the signer's registered
4398
- * public key at agent creation / mandate approval.
4399
- */
4400
- publicKeyBase64() {
4401
- const der = this.publicKey.export({ format: "der", type: "spki" });
4402
- return Buffer.from(der).toString("base64");
5262
+ throw new TypeError(
5263
+ "expected a built intent, a prepared change, its canonical string, or its bytes"
5264
+ );
5265
+ }
5266
+ function isBinary(v) {
5267
+ return ArrayBuffer.isView(v) || Object.prototype.toString.call(v) === "[object ArrayBuffer]";
5268
+ }
5269
+ function b64urlField(name, value) {
5270
+ if (value === void 0 || value === null || value === "") {
5271
+ throw new TypeError(`passkey assertion is missing ${name}`);
4403
5272
  }
4404
- /**
4405
- * Returns base64( ASN.1 ECDSA signature over SHA-256(payload) ).
4406
- */
4407
- sign(payload) {
4408
- const signer = crypto.createSign("SHA256");
4409
- signer.update(payload);
4410
- const sig = signer.sign({ key: this.privateKey, dsaEncoding: "der" });
4411
- return Buffer.from(sig).toString("base64");
5273
+ if (typeof value === "string") {
5274
+ return bytesToBase64url(base64ToBytes(value));
4412
5275
  }
4413
- };
4414
- function verifyMandateSignature(publicKeyBase64, payload, signatureBase64) {
4415
- let publicKey;
4416
- try {
4417
- publicKey = crypto.createPublicKey({
4418
- key: Buffer.from(publicKeyBase64, "base64"),
4419
- format: "der",
4420
- type: "spki"
4421
- });
4422
- } catch (err) {
4423
- throw new Error(`parse public key: ${err.message}`);
5276
+ return bytesToBase64url(toBytes(value));
5277
+ }
5278
+ function packAssertion(credential) {
5279
+ if (!credential || credential.type !== "public-key") {
5280
+ throw new TypeError('expected a WebAuthn assertion with type "public-key"');
4424
5281
  }
4425
- if (publicKey.asymmetricKeyType !== "ec") {
4426
- throw new Error("not a P-256 public key (ES256 requires P-256)");
5282
+ if (typeof credential.id !== "string" || credential.id === "") {
5283
+ throw new TypeError("passkey assertion is missing id");
4427
5284
  }
4428
- if (publicKey.asymmetricKeyDetails?.namedCurve !== "prime256v1") {
4429
- throw new Error("not a P-256 public key (ES256 requires P-256)");
5285
+ const r = credential.response;
5286
+ if (!r) {
5287
+ throw new TypeError("passkey assertion is missing response");
4430
5288
  }
4431
- const verifier = crypto.createVerify("SHA256");
4432
- verifier.update(payload);
4433
- const ok = verifier.verify(
4434
- { key: publicKey, dsaEncoding: "der" },
4435
- Buffer.from(signatureBase64, "base64")
4436
- );
4437
- if (!ok) {
4438
- throw new Error("signature verification failed");
5289
+ const response = {
5290
+ clientDataJSON: b64urlField("clientDataJSON", r.clientDataJSON),
5291
+ authenticatorData: b64urlField("authenticatorData", r.authenticatorData),
5292
+ signature: b64urlField("signature", r.signature)
5293
+ };
5294
+ if (r.userHandle !== void 0 && r.userHandle !== null && r.userHandle !== "") {
5295
+ response.userHandle = b64urlField("userHandle", r.userHandle);
5296
+ }
5297
+ const envelope = {
5298
+ // The verifier requires `id` to be base64url; some mobile libraries hand
5299
+ // out standard base64, so normalize it like the binary fields.
5300
+ id: b64urlField("id", credential.id),
5301
+ rawId: b64urlField("rawId", credential.rawId),
5302
+ type: "public-key",
5303
+ clientExtensionResults: {},
5304
+ response
5305
+ };
5306
+ if (credential.authenticatorAttachment) {
5307
+ envelope.authenticatorAttachment = credential.authenticatorAttachment;
4439
5308
  }
5309
+ return bytesToBase64url(utf8(JSON.stringify(envelope)));
5310
+ }
5311
+ var MAX_PACKED_ASSERTION_LENGTH = 64 * 1024;
5312
+ function assertionChallengeMatches(packed, intent) {
5313
+ if (typeof packed !== "string" || packed.length > MAX_PACKED_ASSERTION_LENGTH) {
5314
+ return false;
5315
+ }
5316
+ try {
5317
+ const envelope = JSON.parse(new TextDecoder().decode(base64ToBytes(packed)));
5318
+ const clientDataB64 = envelope.response?.clientDataJSON;
5319
+ if (typeof clientDataB64 !== "string") {
5320
+ return false;
5321
+ }
5322
+ const clientData = JSON.parse(new TextDecoder().decode(base64ToBytes(clientDataB64)));
5323
+ if (typeof clientData.challenge !== "string") {
5324
+ return false;
5325
+ }
5326
+ const got = base64ToBytes(clientData.challenge);
5327
+ const want = new Uint8Array(buildChallenge(intent));
5328
+ return got.length === want.length && got.every((b, i) => b === want[i]);
5329
+ } catch {
5330
+ return false;
5331
+ }
5332
+ }
5333
+ function webauthnSigner(getAssertion) {
5334
+ return {
5335
+ async sign(payload) {
5336
+ const credential = await getAssertion(buildChallenge(payload));
5337
+ return packAssertion(credential);
5338
+ }
5339
+ };
4440
5340
  }
4441
5341
 
4442
5342
  exports.APIError = APIError;
@@ -4447,19 +5347,24 @@ exports.ApiKeysResource = ApiKeysResource;
4447
5347
  exports.ApplicationsResource = ApplicationsResource;
4448
5348
  exports.AuthMode = AuthMode;
4449
5349
  exports.AutoTransactionsResource = AutoTransactionsResource;
5350
+ exports.BelowThresholdError = BelowThresholdError;
4450
5351
  exports.ConfigurationError = ConfigurationError;
4451
5352
  exports.CustomersResource = CustomersResource;
4452
5353
  exports.DEFAULT_RETRY_POLICY = DEFAULT_RETRY_POLICY;
4453
5354
  exports.DakotaClient = DakotaClient;
4454
5355
  exports.DestinationsResource = DestinationsResource;
5356
+ exports.ES256Signer = ES256Signer;
5357
+ exports.EndorsementRequiredError = EndorsementRequiredError;
4455
5358
  exports.Environment = Environment;
4456
5359
  exports.EventsResource = EventsResource;
4457
5360
  exports.FeePayoutDestinationResource = FeePayoutDestinationResource;
4458
5361
  exports.InfoResource = InfoResource;
4459
5362
  exports.InsightsResource = InsightsResource;
4460
5363
  exports.InstructionsResource = InstructionsResource;
5364
+ exports.InsufficientEndorsementsError = InsufficientEndorsementsError;
5365
+ exports.InvalidGoverningGroupError = InvalidGoverningGroupError;
4461
5366
  exports.MandatesResource = MandatesResource;
4462
- exports.P256MandateSigner = P256MandateSigner;
5367
+ exports.P256MandateSigner = ES256Signer;
4463
5368
  exports.PaginatedIterator = PaginatedIterator;
4464
5369
  exports.PaymentAgentsResource = PaymentAgentsResource;
4465
5370
  exports.PoliciesResource = PoliciesResource;
@@ -4469,17 +5374,23 @@ exports.ScheduledPaymentsResource = ScheduledPaymentsResource;
4469
5374
  exports.SelfServeResource = SelfServeResource;
4470
5375
  exports.SignerGroupsResource = SignerGroupsResource;
4471
5376
  exports.SignersResource = SignersResource;
5377
+ exports.StaleSignerGroupVersionError = StaleSignerGroupVersionError;
4472
5378
  exports.TransactionsResource = TransactionsResource;
4473
5379
  exports.TransportError = TransportError;
4474
5380
  exports.UsersResource = UsersResource;
4475
5381
  exports.WalletsResource = WalletsResource;
4476
5382
  exports.WebhooksResource = WebhooksResource;
4477
5383
  exports.addPolicyRulePayload = addPolicyRulePayload;
5384
+ exports.addSignersToGroupIntent = addSignersToGroupIntent;
5385
+ exports.assertIdempotencyKey = assertIdempotencyKey;
5386
+ exports.assertionChallengeMatches = assertionChallengeMatches;
4478
5387
  exports.attachGroupPayload = attachGroupPayload;
4479
5388
  exports.attachPolicyPayload = attachPolicyPayload;
4480
5389
  exports.attachUserToWallet = attachUserToWallet;
5390
+ exports.buildChallenge = buildChallenge;
4481
5391
  exports.canonicalJSON = canonicalJSON;
4482
5392
  exports.consoleLogger = consoleLogger;
5393
+ exports.createCryptoDestinationIntent = createCryptoDestinationIntent;
4483
5394
  exports.deletePolicyPayload = deletePolicyPayload;
4484
5395
  exports.detachGroupPayload = detachGroupPayload;
4485
5396
  exports.detachPolicyPayload = detachPolicyPayload;
@@ -4487,10 +5398,18 @@ exports.detachUserFromWallet = detachUserFromWallet;
4487
5398
  exports.getEnvironmentURL = getEnvironmentURL;
4488
5399
  exports.mandateAmendSignPayload = mandateAmendSignPayload;
4489
5400
  exports.mandateSignPayload = mandateSignPayload;
5401
+ exports.newIdempotencyKey = newIdempotencyKey;
4490
5402
  exports.noopLogger = noopLogger;
5403
+ exports.packAssertion = packAssertion;
4491
5404
  exports.paginate = paginate;
4492
5405
  exports.removePolicyRulePayload = removePolicyRulePayload;
5406
+ exports.removeSignersFromGroupIntent = removeSignersFromGroupIntent;
5407
+ exports.signGovernanceIntent = signGovernanceIntent;
4493
5408
  exports.updatePolicyRulePayload = updatePolicyRulePayload;
4494
- exports.verifyMandateSignature = verifyMandateSignature;
5409
+ exports.updateSignerGroupGovernanceIntent = updateSignerGroupGovernanceIntent;
5410
+ exports.verifyES256Signature = verifyES256Signature;
5411
+ exports.verifyMandateSignature = verifyES256Signature;
5412
+ exports.webCryptoES256Signer = webCryptoES256Signer;
5413
+ exports.webauthnSigner = webauthnSigner;
4495
5414
  //# sourceMappingURL=index.js.map
4496
5415
  //# sourceMappingURL=index.js.map