@catena/sdk 0.1.0 → 0.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.
@@ -152,8 +152,15 @@ declare const accountBalanceResponseSchema: v.ObjectSchema<{
152
152
  readonly asset_id: v.StringSchema<undefined>;
153
153
  }, undefined>;
154
154
  /**
155
- * `available` (what a send is checked against) is `total` minus reserved
156
- * funds. Absent only from API deployments that predate the field.
155
+ * `available` is the most one payment from this account can move: every
156
+ * network it may use together where a plan carries the payment across
157
+ * them, otherwise the balance on the one network that payment binds, or
158
+ * the largest of them while that network holds nothing yet. It is zero
159
+ * while the account is not active, and zero when the only network the
160
+ * account holds is one agents may not use. A transfer to a Catena
161
+ * account still binds one network, so a plan's figure can be more than
162
+ * such a transfer accepts. Absent only from API deployments that predate
163
+ * these fields.
157
164
  */
158
165
  readonly balances: v.OptionalSchema<v.ObjectSchema<{
159
166
  readonly total: v.ObjectSchema<{
@@ -178,6 +185,41 @@ declare const accountBalanceResponseSchema: v.ObjectSchema<{
178
185
  */
179
186
  readonly asset_id: v.StringSchema<undefined>;
180
187
  }, undefined>;
188
+ /**
189
+ * `total` and `available` for each network that the account holds and
190
+ * agents may use. The entries can add up to less than `balances.total`,
191
+ * which also counts a network agents may not use, and their `available`
192
+ * can add up to more than `balances.available`, which one payment binds
193
+ * to one network. Every `available` is zero while the account is not
194
+ * active. An empty array means no network the account holds is open to
195
+ * agents. Absent until the account's money is split by network,
196
+ * and from API deployments that predate the field.
197
+ */
198
+ readonly byNetwork: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
199
+ readonly network: v.StringSchema<undefined>;
200
+ readonly total: v.ObjectSchema<{
201
+ /**
202
+ * Decimal string in the asset's major unit: "12.50" is $12.50. Never cents or
203
+ * atomic units.
204
+ */
205
+ readonly amount: v.StringSchema<undefined>;
206
+ /**
207
+ * Asset identifier, e.g. "USD".
208
+ */
209
+ readonly asset_id: v.StringSchema<undefined>;
210
+ }, undefined>;
211
+ readonly available: v.ObjectSchema<{
212
+ /**
213
+ * Decimal string in the asset's major unit: "12.50" is $12.50. Never cents or
214
+ * atomic units.
215
+ */
216
+ readonly amount: v.StringSchema<undefined>;
217
+ /**
218
+ * Asset identifier, e.g. "USD".
219
+ */
220
+ readonly asset_id: v.StringSchema<undefined>;
221
+ }, undefined>;
222
+ }, undefined>, undefined>, undefined>;
181
223
  }, undefined>, undefined>;
182
224
  }, undefined>;
183
225
  type AccountBalanceResponse = v.InferOutput<typeof accountBalanceResponseSchema>;
@@ -222,6 +264,10 @@ declare const accountTransactionsResponseSchema: v.ObjectSchema<{
222
264
  readonly asset_id: v.StringSchema<undefined>;
223
265
  }, undefined>;
224
266
  readonly currency: v.StringSchema<undefined>;
267
+ /**
268
+ * On-chain network, absent for fiat and older transactions.
269
+ */
270
+ readonly network: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
225
271
  readonly counterpartyName: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
226
272
  readonly method: v.OptionalSchema<v.GenericSchema<string, ExtensibleString<readonly ["ach", "wire", "on-chain"]>>, undefined>;
227
273
  readonly memo: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -267,8 +313,19 @@ type AccountDepositAddressResponse = v.InferOutput<typeof accountDepositAddressR
267
313
  * or asset added server-side never becomes a compile-time wall for an older
268
314
  * SDK. Response schemas parse plain strings for the same reason.
269
315
  */
270
- type OnchainNetworkInput = "base" | "base-sepolia" | (string & {});
316
+ type OnchainNetworkInput = "base" | "base-sepolia" | "arc" | (string & {});
271
317
  type OnchainAssetInput = "usdc" | (string & {});
318
+ declare const walletCounterpartyRailSchema: v.ObjectSchema<{
319
+ readonly type: v.LiteralSchema<"wallet", undefined>;
320
+ readonly walletAddress: v.CustomSchema<`0x${string}`, undefined>;
321
+ readonly network: v.CustomSchema<OnchainNetworkInput, undefined>;
322
+ }, undefined>;
323
+ /**
324
+ * Catena wallet rail returned for deliberate counterparty recovery. It can be
325
+ * passed directly as `create_counterparty`'s `rail` after the caller chooses a
326
+ * name and confirms the recipient.
327
+ */
328
+ type WalletCounterpartyRail = v.InferOutput<typeof walletCounterpartyRailSchema>;
272
329
  type AccountDepositAddressParams = {
273
330
  network: OnchainNetworkInput;
274
331
  asset: OnchainAssetInput;
@@ -276,8 +333,11 @@ type AccountDepositAddressParams = {
276
333
  /**
277
334
  * Rails are modeled tolerantly rather than as a variant on `type`: each
278
335
  * field is present only on the rail types it applies to (wallet rails carry
279
- * `walletAddress`/`network`, bank rails carry `bankName`/`accountNumber`),
280
- * and a server that later adds a new rail type must not break older clients.
336
+ * `walletAddress` and may carry `network`; bank rails carry
337
+ * `bankName`/`accountNumber`), and a server that later adds a new rail type
338
+ * must not break older clients. A wallet rail omits `network` when its
339
+ * configured destination is unavailable to the agent; it cannot receive an
340
+ * agent send until that configuration or the organization's capability changes.
281
341
  */
282
342
  declare const counterpartySchema: v.ObjectSchema<{
283
343
  readonly id: v.StringSchema<undefined>;
@@ -331,15 +391,68 @@ declare const counterpartiesResponseSchema: v.ObjectSchema<{
331
391
  type CounterpartiesResponse = v.InferOutput<typeof counterpartiesResponseSchema>;
332
392
  type CounterpartiesParams = {
333
393
  /**
334
- * Only counterparties with a wallet rail at this address.
394
+ * Only counterparties that own this wallet address.
335
395
  */
336
396
  address?: `0x${string}` | undefined;
337
397
  /**
338
- * Only counterparties with a wallet rail on this network.
398
+ * Only counterparties that own a wallet address in this network class.
399
+ * This does not promise that a payment can settle on the queried network.
339
400
  */
340
401
  network?: OnchainNetworkInput | undefined;
341
402
  };
342
403
  declare const INTENT_ACTION_TYPES: readonly ["send", "transfer", "create_counterparty", "request_counterparty_details", "x402", "mpp", "policy_override"];
404
+ /**
405
+ * Present on a send that crosses chains: the counterparty wallet sits on the
406
+ * other side of the Base and Arc lane and the account had no balance to pay
407
+ * it there, so the first signature burned the amount toward the account's own
408
+ * address on the destination. `nextStep` is the whole contract: `wait` and
409
+ * poll while the crossing runs, `continue` when `continueIntent` is due,
410
+ * `done` once the counterparty was paid, `blocked` when an operator must
411
+ * step in. `state` walks `burning`, `attesting`, `minting`, `ready`,
412
+ * `delivering`, `delivered`; `failed` and `manual_review` are terminal.
413
+ */
414
+ declare const CROSS_CHAIN_STATES: readonly ["burning", "attesting", "minting", "ready", "delivering", "delivered", "failed", "manual_review"];
415
+ declare const CROSS_CHAIN_NEXT_STEPS: readonly ["wait", "continue", "done", "blocked"];
416
+ declare const crossChainSendSchema: v.ObjectSchema<{
417
+ readonly id: v.StringSchema<undefined>;
418
+ readonly sourceNetwork: v.StringSchema<undefined>;
419
+ readonly destinationNetwork: v.StringSchema<undefined>;
420
+ readonly state: v.GenericSchema<string, ExtensibleString<readonly ["burning", "attesting", "minting", "ready", "delivering", "delivered", "failed", "manual_review"]>>;
421
+ readonly nextStep: v.GenericSchema<string, ExtensibleString<readonly ["wait", "continue", "done", "blocked"]>>;
422
+ readonly readyAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
423
+ readonly deliveredAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
424
+ readonly failureReason: v.NullableSchema<v.StringSchema<undefined>, undefined>;
425
+ }, undefined>;
426
+ type CrossChainSend = v.InferOutput<typeof crossChainSendSchema>;
427
+ declare const MOVEMENT_NEXT_STEPS: readonly ["wait", "continue", "done", "blocked"];
428
+ /**
429
+ * Present on a payment carried by a movement plan.
430
+ *
431
+ * `nextStep` is what the payment is waiting for, which `status` cannot say on
432
+ * its own: a payment an admin is signing and one whose signature is already in
433
+ * flight are both "processing".
434
+ *
435
+ * - "wait" — nothing to do here. A person is deciding the payment, or has
436
+ * approved it and an admin is finishing it. Read it again with
437
+ * getIntent(...). If you restarted before signing a payment nobody had to
438
+ * approve, send the original request again on the same idempotency key.
439
+ * Within about five minutes of the first send it answers
440
+ * `movement_authorization_in_progress`; after that it hands the payment back
441
+ * for you to sign.
442
+ * - "done" — the payment completed.
443
+ * - "blocked" — it ended without paying. Read `reasons` for why; it is empty when
444
+ * an approval lapsed.
445
+ *
446
+ * A payment a person has to approve is never handed back to you to finish:
447
+ * "continue" belongs to a send that crossed chains and is not an answer this
448
+ * field gives. It stays in the list because both fields are parsed against one
449
+ * vocabulary.
450
+ */
451
+ declare const movementSchema: v.ObjectSchema<{
452
+ readonly planId: v.StringSchema<undefined>;
453
+ readonly nextStep: v.GenericSchema<string, ExtensibleString<readonly ["wait", "continue", "done", "blocked"]>>;
454
+ }, undefined>;
455
+ type Movement = v.InferOutput<typeof movementSchema>;
343
456
  declare const wireIntentResultSchema: v.ObjectSchema<{
344
457
  readonly id: v.StringSchema<undefined>;
345
458
  /**
@@ -352,11 +465,16 @@ declare const wireIntentResultSchema: v.ObjectSchema<{
352
465
  * Disposition of the intent:
353
466
  *
354
467
  * - "pending" — accepted but not yet executing, typically parked for a human
355
- * approval; `reasons` says why and `expiresAt` when it lapses.
468
+ * approval; `reasons` says why and `expiresAt` when it lapses. A client
469
+ * with no registered signing key has every wallet payment parked, whatever
470
+ * the amount, and `reasons` carries `agent_signer_not_registered` (or
471
+ * `operator_signature_required` for a payment with no `movement`).
356
472
  * - "processing" — accepted and in progress. Executing intents advance on their
357
473
  * own; poll `getIntent`. An approved MPP or x402 payment instead rests here
358
474
  * until the paid request is re-run — polling never advances it — and
359
- * `expiresAt` is when that grant lapses.
475
+ * `expiresAt` is when that grant lapses. A payment a person approved also
476
+ * rests here while an admin signs it, and `movement.nextStep` reads "wait"
477
+ * until it is done or blocked.
360
478
  * - "completed" — the action succeeded: money moved for send and transfer; for
361
479
  * MPP and x402 the payment authorization was delivered
362
480
  * (`data.paymentCredential.value`), with on-chain settlement verified
@@ -396,6 +514,27 @@ declare const wireIntentResultSchema: v.ObjectSchema<{
396
514
  readonly metadata: v.OptionalSchema<v.ObjectSchema<{
397
515
  readonly dataUrl: v.NullableSchema<v.StringSchema<undefined>, undefined>;
398
516
  }, undefined>, undefined>;
517
+ /**
518
+ * Present on a send that crosses chains. See `CrossChainSend`.
519
+ */
520
+ readonly crossChain: v.OptionalSchema<v.ObjectSchema<{
521
+ readonly id: v.StringSchema<undefined>;
522
+ readonly sourceNetwork: v.StringSchema<undefined>;
523
+ readonly destinationNetwork: v.StringSchema<undefined>;
524
+ readonly state: v.GenericSchema<string, ExtensibleString<readonly ["burning", "attesting", "minting", "ready", "delivering", "delivered", "failed", "manual_review"]>>;
525
+ readonly nextStep: v.GenericSchema<string, ExtensibleString<readonly ["wait", "continue", "done", "blocked"]>>;
526
+ readonly readyAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
527
+ readonly deliveredAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
528
+ readonly failureReason: v.NullableSchema<v.StringSchema<undefined>, undefined>;
529
+ }, undefined>, undefined>;
530
+ /**
531
+ * Present on a payment carried by a movement plan, and absent from a server
532
+ * that has not deployed them. See `Movement`.
533
+ */
534
+ readonly movement: v.OptionalSchema<v.ObjectSchema<{
535
+ readonly planId: v.StringSchema<undefined>;
536
+ readonly nextStep: v.GenericSchema<string, ExtensibleString<readonly ["wait", "continue", "done", "blocked"]>>;
537
+ }, undefined>, undefined>;
399
538
  readonly nextAction: v.OptionalSchema<v.ObjectSchema<{
400
539
  readonly type: v.LiteralSchema<"submit_stamp", undefined>;
401
540
  readonly signingRequestId: v.StringSchema<undefined>;
@@ -409,6 +548,24 @@ declare const wireIntentResultSchema: v.ObjectSchema<{
409
548
  readonly expiresAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
410
549
  readonly prepareToken: v.StringSchema<undefined>;
411
550
  }, undefined>;
551
+ /**
552
+ * Present when the approval covers a movement plan, whose one signature
553
+ * authorizes several digests at once. It carries what each of those digests
554
+ * commits to, so the signer can rebuild them rather than stamp bytes it has
555
+ * not read.
556
+ */
557
+ readonly movement: v.OptionalSchema<v.ObjectSchema<{
558
+ readonly planId: v.StringSchema<undefined>;
559
+ readonly signerAddress: v.StringSchema<undefined>;
560
+ readonly digests: v.ArraySchema<v.StringSchema<undefined>, undefined>;
561
+ readonly instructions: v.ArraySchema<v.LooseObjectSchema<{
562
+ readonly kind: v.StringSchema<undefined>;
563
+ readonly network: v.StringSchema<undefined>;
564
+ readonly signerAddress: v.StringSchema<undefined>;
565
+ readonly digest: v.StringSchema<undefined>;
566
+ readonly payload: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
567
+ }, undefined>, undefined>;
568
+ }, undefined>, undefined>;
412
569
  }, undefined>, undefined>;
413
570
  }, undefined>;
414
571
  type WireIntentResult = v.InferOutput<typeof wireIntentResultSchema>;
@@ -631,7 +788,7 @@ declare const mppActionSchema: v.ObjectSchema<{
631
788
  */
632
789
  type MppAction = v.InferOutput<typeof mppActionSchema>;
633
790
  declare const POLICY_OVERRIDE_CAPABILITIES: readonly ["send", "transfer"];
634
- declare const intentActionSchema: v.UnionSchema<[v.ObjectSchema<{
791
+ declare const intentActionSchema: v.UnionSchema<[v.VariantSchema<"method", [v.ObjectSchema<{
635
792
  readonly type: v.LiteralSchema<"send", undefined>;
636
793
  /**
637
794
  * Omit when the current policy allows sends from exactly one account.
@@ -647,10 +804,67 @@ declare const intentActionSchema: v.UnionSchema<[v.ObjectSchema<{
647
804
  * Decimal USD string: "12.50" is $12.50. Never cents or atomic units.
648
805
  */
649
806
  readonly amount: v.StringSchema<undefined>;
650
- readonly method: v.PicklistSchema<readonly ["ach", "wire", "on-chain"], undefined>;
807
+ /**
808
+ * Internal note stored in Catena.
809
+ */
810
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
811
+ readonly method: v.LiteralSchema<"ach", undefined>;
812
+ /**
813
+ * Reference sent with the ACH payment.
814
+ */
651
815
  readonly memo: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
816
+ }, undefined>, v.ObjectSchema<{
817
+ readonly type: v.LiteralSchema<"send", undefined>;
818
+ /**
819
+ * Omit when the current policy allows sends from exactly one account.
820
+ * Zero or multiple send accounts require a policy change or an explicit id.
821
+ */
822
+ readonly accountId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
823
+ /**
824
+ * Id of one entry in a counterparty's `rails` array (from
825
+ * `listCounterparties`) — not the counterparty id itself.
826
+ */
827
+ readonly counterpartyRailId: v.StringSchema<undefined>;
828
+ /**
829
+ * Decimal USD string: "12.50" is $12.50. Never cents or atomic units.
830
+ */
831
+ readonly amount: v.StringSchema<undefined>;
832
+ /**
833
+ * Internal note stored in Catena.
834
+ */
652
835
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
836
+ readonly method: v.LiteralSchema<"wire", undefined>;
837
+ /**
838
+ * Reference sent with the wire payment.
839
+ */
840
+ readonly memo: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
653
841
  }, undefined>, v.ObjectSchema<{
842
+ readonly type: v.LiteralSchema<"send", undefined>;
843
+ /**
844
+ * Omit when the current policy allows sends from exactly one account.
845
+ * Zero or multiple send accounts require a policy change or an explicit id.
846
+ */
847
+ readonly accountId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
848
+ /**
849
+ * Id of one entry in a counterparty's `rails` array (from
850
+ * `listCounterparties`) — not the counterparty id itself.
851
+ */
852
+ readonly counterpartyRailId: v.StringSchema<undefined>;
853
+ /**
854
+ * Decimal USD string: "12.50" is $12.50. Never cents or atomic units.
855
+ */
856
+ readonly amount: v.StringSchema<undefined>;
857
+ /**
858
+ * Internal note stored in Catena.
859
+ */
860
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
861
+ readonly method: v.LiteralSchema<"on-chain", undefined>;
862
+ /**
863
+ * @deprecated Not sent to the blockchain. Use `description` for an internal
864
+ * note.
865
+ */
866
+ readonly memo: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
867
+ }, undefined>], undefined>, v.ObjectSchema<{
654
868
  readonly type: v.LiteralSchema<"transfer", undefined>;
655
869
  readonly accountId: v.StringSchema<undefined>;
656
870
  readonly toAccountId: v.StringSchema<undefined>;
@@ -912,12 +1126,19 @@ type IntentAction = v.InferOutput<typeof intentActionSchema>;
912
1126
  * Non-OK API response. `code` is the API's stable error code — branch on it,
913
1127
  * not on message prose. The code is also embedded in the message so hosts
914
1128
  * that only print `error.message` still surface it.
1129
+ * Field explanations are included in the message and preserved on `fields`.
915
1130
  */
916
1131
  declare class ApiError extends Error {
917
1132
  readonly status: number;
918
1133
  readonly code: string | undefined;
919
1134
  readonly details: Record<string, unknown> | undefined;
920
- constructor(status: number, message: string, code?: string, details?: Record<string, unknown>);
1135
+ /**
1136
+ * Validation explanations keyed by request field path, when present.
1137
+ * The `request` key represents a request-wide issue rather than a field;
1138
+ * its explanation appears in `message` without a field-path prefix.
1139
+ */
1140
+ readonly fields: Record<string, string> | undefined;
1141
+ constructor(status: number, message: string, code?: string, details?: Record<string, unknown>, fields?: Record<string, string>);
921
1142
  }
922
1143
  /**
923
1144
  * An HTTP exchange exceeded the client's configured deadline. The deadline
@@ -1055,6 +1276,42 @@ declare class CatenaClient {
1055
1276
  idempotencyKey?: string;
1056
1277
  }): Promise<IntentResult>;
1057
1278
  getIntent(id: string): Promise<IntentResult>;
1279
+ /**
1280
+ * Finish a send that crossed chains, once `crossChain.nextStep` reads
1281
+ * "continue": prepares and signs the send to the counterparty on the
1282
+ * destination network. Gas is paid by Catena. A destination the provider does
1283
+ * not sponsor yet is refused with `wallet_send_action_not_yet_enabled`; the
1284
+ * intent stays at "continue" and the call can be made again later.
1285
+ *
1286
+ * A payment a person had to approve is NOT continued here. Once it is
1287
+ * approved an admin finishes it, and this call refuses it with
1288
+ * `movement_admin_completes_payment`; `movement.nextStep` stays "wait" and
1289
+ * resolves to "done" or "blocked" on its own. Resending the original request
1290
+ * does not finish it either — that hands back the payment's intent, or tells
1291
+ * you to read it, never a new signature.
1292
+ *
1293
+ * It continues the same intent, so no second intent, spend or approval is
1294
+ * involved, and the result is the intent view after the signature, the same
1295
+ * shape `getIntent(...)` serves.
1296
+ *
1297
+ * `action` is the one you originally submitted. It is compared only against
1298
+ * a movement stamp, and a continuation now only finishes a send that crossed
1299
+ * chains, which carries none, so today it is accepted and not checked.
1300
+ *
1301
+ * Errors: failures in the continue exchange propagate unwrapped — `ApiError`
1302
+ * for non-OK responses (the refusals above among them), `TimeoutError` when
1303
+ * the exchange deadline expires, and raw transport, signing and
1304
+ * response-parsing errors otherwise. Once the continuation is prepared,
1305
+ * failures while stamping or signing it surface as `IntentSubmitError` with
1306
+ * outcome `"not-submitted"`; from the first dispatched byte they surface
1307
+ * with outcome `"unknown"`, and `getIntent(...)` is the reconciliation
1308
+ * handle.
1309
+ */
1310
+ continueIntent(params: {
1311
+ intentId: string;
1312
+ idempotencyKey?: string;
1313
+ action?: IntentAction;
1314
+ }): Promise<IntentResult>;
1058
1315
  /**
1059
1316
  * Permanently sever this agent link: the server revokes the link's active
1060
1317
  * auth keys, so every request signed with this credential fails from then
@@ -1093,4 +1350,4 @@ declare class CatenaClient {
1093
1350
  */
1094
1351
  declare function createCatenaClient(options?: CatenaClientOptions): CatenaClient;
1095
1352
  //#endregion
1096
- export { IntentResult as A, Policy as B, COUNTERPARTY_RULE_MODES as C, ExtensibleString as D, Counterparty as E, OnchainNetworkInput as F, X402Resource as G, SendMethod as H, POLICY_CAPABILITIES as I, X402SignedReceipt as J, AppInfo as K, POLICY_OVERRIDE_CAPABILITIES as L, MppChallenge as M, MppResource as N, INTENT_ACTION_TYPES as O, OnchainAssetInput as P, POLICY_RULE_ACTIONS as R, COUNTERPARTY_ACTIONS as S, CounterpartiesResponse as T, X402Authorization as U, SEND_METHODS as V, X402PaymentRequirements as W, AccountDepositAddressResponse as _, IntentSubmitError as a, AccountsResponse as b, ACCOUNT_AGGREGATION_SCOPES as c, ACCOUNT_TRANSACTION_MOVEMENT_STATUSES as d, ACCOUNT_TRANSACTION_STATUSES as f, AccountDepositAddressParams as g, AccountBalanceResponse as h, FetchLike as i, MppAction as j, IntentAction as k, ACCOUNT_DEPOSIT_ADDRESS_SOURCES as l, ACTOR_AGGREGATION_SCOPES as m, CatenaClient as n, TimeoutError as o, ACCOUNT_TRANSACTION_TYPES as p, X402SignedOffer as q, CatenaClientOptions as r, createCatenaClient as s, ApiError as t, ACCOUNT_TRANSACTION_METHODS as u, AccountTransactionsParams as v, CounterpartiesParams as w, Agent as x, AccountTransactionsResponse as y, POLICY_RULE_TYPES as z };
1353
+ export { X402SignedOffer as $, ExtensibleString as A, OnchainNetworkInput as B, COUNTERPARTY_RULE_MODES as C, CounterpartiesResponse as D, CounterpartiesParams as E, Movement as F, Policy as G, POLICY_OVERRIDE_CAPABILITIES as H, MppAction as I, WalletCounterpartyRail as J, SEND_METHODS as K, MppChallenge as L, IntentAction as M, IntentResult as N, Counterparty as O, MOVEMENT_NEXT_STEPS as P, AppInfo as Q, MppResource as R, COUNTERPARTY_ACTIONS as S, CROSS_CHAIN_STATES as T, POLICY_RULE_ACTIONS as U, POLICY_CAPABILITIES as V, POLICY_RULE_TYPES as W, X402PaymentRequirements as X, X402Authorization as Y, X402Resource as Z, AccountDepositAddressResponse as _, IntentSubmitError as a, AccountsResponse as b, ACCOUNT_AGGREGATION_SCOPES as c, ACCOUNT_TRANSACTION_MOVEMENT_STATUSES as d, X402SignedReceipt as et, ACCOUNT_TRANSACTION_STATUSES as f, AccountDepositAddressParams as g, AccountBalanceResponse as h, FetchLike as i, INTENT_ACTION_TYPES as j, CrossChainSend as k, ACCOUNT_DEPOSIT_ADDRESS_SOURCES as l, ACTOR_AGGREGATION_SCOPES as m, CatenaClient as n, TimeoutError as o, ACCOUNT_TRANSACTION_TYPES as p, SendMethod as q, CatenaClientOptions as r, createCatenaClient as s, ApiError as t, ACCOUNT_TRANSACTION_METHODS as u, AccountTransactionsParams as v, CROSS_CHAIN_NEXT_STEPS as w, Agent as x, AccountTransactionsResponse as y, OnchainAssetInput as z };
package/dist/client.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { t as InvalidKeyError } from "./keypair-BjMJtI3-.mjs";
2
- import { A as IntentResult, B as Policy, C as COUNTERPARTY_RULE_MODES, D as ExtensibleString, E as Counterparty, F as OnchainNetworkInput, G as X402Resource, H as SendMethod, I as POLICY_CAPABILITIES, J as X402SignedReceipt, K as AppInfo, L as POLICY_OVERRIDE_CAPABILITIES, M as MppChallenge, N as MppResource, O as INTENT_ACTION_TYPES, P as OnchainAssetInput, R as POLICY_RULE_ACTIONS, S as COUNTERPARTY_ACTIONS, T as CounterpartiesResponse, U as X402Authorization, V as SEND_METHODS, W as X402PaymentRequirements, _ as AccountDepositAddressResponse, a as IntentSubmitError, b as AccountsResponse, c as ACCOUNT_AGGREGATION_SCOPES, d as ACCOUNT_TRANSACTION_MOVEMENT_STATUSES, f as ACCOUNT_TRANSACTION_STATUSES, g as AccountDepositAddressParams, h as AccountBalanceResponse, i as FetchLike, j as MppAction, k as IntentAction, l as ACCOUNT_DEPOSIT_ADDRESS_SOURCES, m as ACTOR_AGGREGATION_SCOPES, n as CatenaClient, o as TimeoutError, p as ACCOUNT_TRANSACTION_TYPES, q as X402SignedOffer, r as CatenaClientOptions, s as createCatenaClient, t as ApiError, u as ACCOUNT_TRANSACTION_METHODS, v as AccountTransactionsParams, w as CounterpartiesParams, x as Agent, y as AccountTransactionsResponse, z as POLICY_RULE_TYPES } from "./client-Cm2wNUuB.mjs";
3
- export { ACCOUNT_AGGREGATION_SCOPES, ACCOUNT_DEPOSIT_ADDRESS_SOURCES, ACCOUNT_TRANSACTION_METHODS, ACCOUNT_TRANSACTION_MOVEMENT_STATUSES, ACCOUNT_TRANSACTION_STATUSES, ACCOUNT_TRANSACTION_TYPES, ACTOR_AGGREGATION_SCOPES, type AccountBalanceResponse, type AccountDepositAddressParams, type AccountDepositAddressResponse, type AccountTransactionsParams, type AccountTransactionsResponse, type AccountsResponse, type Agent, ApiError, type AppInfo, COUNTERPARTY_ACTIONS, COUNTERPARTY_RULE_MODES, type CatenaClient, CatenaClientOptions, type CounterpartiesParams, type CounterpartiesResponse, type Counterparty, type ExtensibleString, FetchLike, INTENT_ACTION_TYPES, type IntentAction, type IntentResult, IntentSubmitError, InvalidKeyError, type MppAction, type MppChallenge, type MppResource, type OnchainAssetInput, type OnchainNetworkInput, POLICY_CAPABILITIES, POLICY_OVERRIDE_CAPABILITIES, POLICY_RULE_ACTIONS, POLICY_RULE_TYPES, type Policy, SEND_METHODS, type SendMethod, TimeoutError, type X402Authorization, type X402PaymentRequirements, type X402Resource, type X402SignedOffer, type X402SignedReceipt, createCatenaClient };
2
+ import { $ as X402SignedOffer, A as ExtensibleString, B as OnchainNetworkInput, C as COUNTERPARTY_RULE_MODES, D as CounterpartiesResponse, E as CounterpartiesParams, F as Movement, G as Policy, H as POLICY_OVERRIDE_CAPABILITIES, I as MppAction, J as WalletCounterpartyRail, K as SEND_METHODS, L as MppChallenge, M as IntentAction, N as IntentResult, O as Counterparty, P as MOVEMENT_NEXT_STEPS, Q as AppInfo, R as MppResource, S as COUNTERPARTY_ACTIONS, T as CROSS_CHAIN_STATES, U as POLICY_RULE_ACTIONS, V as POLICY_CAPABILITIES, W as POLICY_RULE_TYPES, X as X402PaymentRequirements, Y as X402Authorization, Z as X402Resource, _ as AccountDepositAddressResponse, a as IntentSubmitError, b as AccountsResponse, c as ACCOUNT_AGGREGATION_SCOPES, d as ACCOUNT_TRANSACTION_MOVEMENT_STATUSES, et as X402SignedReceipt, f as ACCOUNT_TRANSACTION_STATUSES, g as AccountDepositAddressParams, h as AccountBalanceResponse, i as FetchLike, j as INTENT_ACTION_TYPES, k as CrossChainSend, l as ACCOUNT_DEPOSIT_ADDRESS_SOURCES, m as ACTOR_AGGREGATION_SCOPES, n as CatenaClient, o as TimeoutError, p as ACCOUNT_TRANSACTION_TYPES, q as SendMethod, r as CatenaClientOptions, s as createCatenaClient, t as ApiError, u as ACCOUNT_TRANSACTION_METHODS, v as AccountTransactionsParams, w as CROSS_CHAIN_NEXT_STEPS, x as Agent, y as AccountTransactionsResponse, z as OnchainAssetInput } from "./client-B_Gi0aqH.mjs";
3
+ export { ACCOUNT_AGGREGATION_SCOPES, ACCOUNT_DEPOSIT_ADDRESS_SOURCES, ACCOUNT_TRANSACTION_METHODS, ACCOUNT_TRANSACTION_MOVEMENT_STATUSES, ACCOUNT_TRANSACTION_STATUSES, ACCOUNT_TRANSACTION_TYPES, ACTOR_AGGREGATION_SCOPES, type AccountBalanceResponse, type AccountDepositAddressParams, type AccountDepositAddressResponse, type AccountTransactionsParams, type AccountTransactionsResponse, type AccountsResponse, type Agent, ApiError, type AppInfo, COUNTERPARTY_ACTIONS, COUNTERPARTY_RULE_MODES, CROSS_CHAIN_NEXT_STEPS, CROSS_CHAIN_STATES, type CatenaClient, CatenaClientOptions, type CounterpartiesParams, type CounterpartiesResponse, type Counterparty, type CrossChainSend, type ExtensibleString, FetchLike, INTENT_ACTION_TYPES, type IntentAction, type IntentResult, IntentSubmitError, InvalidKeyError, MOVEMENT_NEXT_STEPS, type Movement, type MppAction, type MppChallenge, type MppResource, type OnchainAssetInput, type OnchainNetworkInput, POLICY_CAPABILITIES, POLICY_OVERRIDE_CAPABILITIES, POLICY_RULE_ACTIONS, POLICY_RULE_TYPES, type Policy, SEND_METHODS, type SendMethod, TimeoutError, type WalletCounterpartyRail, type X402Authorization, type X402PaymentRequirements, type X402Resource, type X402SignedOffer, type X402SignedReceipt, createCatenaClient };
package/dist/client.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import { InvalidKeyError } from "./keypair.mjs";
2
- import { _ as POLICY_RULE_ACTIONS, a as ACCOUNT_AGGREGATION_SCOPES, c as ACCOUNT_TRANSACTION_MOVEMENT_STATUSES, d as ACTOR_AGGREGATION_SCOPES, f as COUNTERPARTY_ACTIONS, g as POLICY_OVERRIDE_CAPABILITIES, h as POLICY_CAPABILITIES, i as createCatenaClient, l as ACCOUNT_TRANSACTION_STATUSES, m as INTENT_ACTION_TYPES, n as IntentSubmitError, o as ACCOUNT_DEPOSIT_ADDRESS_SOURCES, p as COUNTERPARTY_RULE_MODES, r as TimeoutError, s as ACCOUNT_TRANSACTION_METHODS, t as ApiError, u as ACCOUNT_TRANSACTION_TYPES, v as POLICY_RULE_TYPES, y as SEND_METHODS } from "./client-CHZMO00P.mjs";
3
- export { ACCOUNT_AGGREGATION_SCOPES, ACCOUNT_DEPOSIT_ADDRESS_SOURCES, ACCOUNT_TRANSACTION_METHODS, ACCOUNT_TRANSACTION_MOVEMENT_STATUSES, ACCOUNT_TRANSACTION_STATUSES, ACCOUNT_TRANSACTION_TYPES, ACTOR_AGGREGATION_SCOPES, ApiError, COUNTERPARTY_ACTIONS, COUNTERPARTY_RULE_MODES, INTENT_ACTION_TYPES, IntentSubmitError, InvalidKeyError, POLICY_CAPABILITIES, POLICY_OVERRIDE_CAPABILITIES, POLICY_RULE_ACTIONS, POLICY_RULE_TYPES, SEND_METHODS, TimeoutError, createCatenaClient };
2
+ import { S as SEND_METHODS, _ as MOVEMENT_NEXT_STEPS, a as ACCOUNT_AGGREGATION_SCOPES, b as POLICY_RULE_ACTIONS, c as ACCOUNT_TRANSACTION_MOVEMENT_STATUSES, d as ACTOR_AGGREGATION_SCOPES, f as COUNTERPARTY_ACTIONS, g as INTENT_ACTION_TYPES, h as CROSS_CHAIN_STATES, i as createCatenaClient, l as ACCOUNT_TRANSACTION_STATUSES, m as CROSS_CHAIN_NEXT_STEPS, n as IntentSubmitError, o as ACCOUNT_DEPOSIT_ADDRESS_SOURCES, p as COUNTERPARTY_RULE_MODES, r as TimeoutError, s as ACCOUNT_TRANSACTION_METHODS, t as ApiError, u as ACCOUNT_TRANSACTION_TYPES, v as POLICY_CAPABILITIES, x as POLICY_RULE_TYPES, y as POLICY_OVERRIDE_CAPABILITIES } from "./client-BSYVYJGm.mjs";
3
+ export { ACCOUNT_AGGREGATION_SCOPES, ACCOUNT_DEPOSIT_ADDRESS_SOURCES, ACCOUNT_TRANSACTION_METHODS, ACCOUNT_TRANSACTION_MOVEMENT_STATUSES, ACCOUNT_TRANSACTION_STATUSES, ACCOUNT_TRANSACTION_TYPES, ACTOR_AGGREGATION_SCOPES, ApiError, COUNTERPARTY_ACTIONS, COUNTERPARTY_RULE_MODES, CROSS_CHAIN_NEXT_STEPS, CROSS_CHAIN_STATES, INTENT_ACTION_TYPES, IntentSubmitError, InvalidKeyError, MOVEMENT_NEXT_STEPS, POLICY_CAPABILITIES, POLICY_OVERRIDE_CAPABILITIES, POLICY_RULE_ACTIONS, POLICY_RULE_TYPES, SEND_METHODS, TimeoutError, createCatenaClient };
@@ -0,0 +1,139 @@
1
+ //#region src/movements.d.ts
2
+ /**
3
+ * Independent review of a movement approval, before anything is stamped.
4
+ *
5
+ * A movement is authorized by one signature over a batch of pre-hashed
6
+ * digests. A digest cannot be read, so a signing policy cannot constrain what
7
+ * it commits to: the only content control is the signer rebuilding every
8
+ * digest from the fields it is said to cover and refusing when they disagree.
9
+ * The console does this before it prompts for a passkey. An agent holds the
10
+ * same authority with a different credential, so it does the same thing here
11
+ * rather than stamping a body it has not checked.
12
+ *
13
+ * The check is local: no network, no server answer to trust. It proves that the
14
+ * request would sign exactly the digests the approval lists, that each of them
15
+ * is the payload shown for it, that every payload acts on the approval's own
16
+ * wallet and on the network it is labelled with, and that a delegation names
17
+ * the one contract a wallet here is allowed to hand itself to.
18
+ *
19
+ * It also refuses any payload that would move the network's own token, which
20
+ * is the one amount every kind states in a field rather than inside call data.
21
+ * On a chain whose gas token is the asset being moved, that value is a payment
22
+ * nothing else in the approval describes.
23
+ *
24
+ * Given the caller's own amount it also proves the approval pays it, for the
25
+ * approvals where that can be known: a transfer authorization states its
26
+ * amount in a field the digest covers, so an approval built only from those is
27
+ * bound to the sum they deliver.
28
+ *
29
+ * What it does not prove is what a payload's call data does. A raw transaction
30
+ * and a batch execution carry their recipient and amount as encoded call data,
31
+ * which is reproduced but not decoded, and a payment can be built entirely
32
+ * from those -- so an approval carrying one is not bound to any amount at all.
33
+ * For those kinds the guarantee is that the bytes signed are the bytes shown,
34
+ * not that the bytes shown are a payment to anyone in particular. Binding them
35
+ * needs that call data decoded, which would mean recognising every contract
36
+ * and call shape a payment can use and refusing any built from one this client
37
+ * does not know yet; that is not attempted here.
38
+ *
39
+ * Requires the optional `viem` peer dependency; importing this module without
40
+ * viem installed fails with a module-not-found error naming it.
41
+ */
42
+ /**
43
+ * One thing the approval would sign, with every field its digest commits to.
44
+ */
45
+ export interface MovementInstructionReview {
46
+ /**
47
+ * What kind of signable material this is.
48
+ */
49
+ kind: string;
50
+ /**
51
+ * The network it acts on.
52
+ */
53
+ network: string;
54
+ /**
55
+ * The wallet that must sign it.
56
+ */
57
+ signerAddress: string;
58
+ /**
59
+ * The digest the approval carries for it.
60
+ */
61
+ digest: string;
62
+ /**
63
+ * The fields the digest commits to.
64
+ */
65
+ payload: Record<string, unknown>;
66
+ }
67
+ /**
68
+ * The approval as prepared, as it arrives on a `submit_stamp` next action.
69
+ */
70
+ export interface PreparedMovement {
71
+ /**
72
+ * The wallet every instruction must name.
73
+ */
74
+ signerAddress: string;
75
+ /**
76
+ * Every digest the approval would sign, in order.
77
+ */
78
+ digests: readonly string[];
79
+ /**
80
+ * What each of those digests commits to.
81
+ */
82
+ instructions: readonly MovementInstructionReview[];
83
+ /**
84
+ * The provider request body that would be stamped.
85
+ */
86
+ body: string;
87
+ }
88
+ /**
89
+ * What the caller asked for, to check the approval against. Only the amount
90
+ * today: a counterparty rail is named by id rather than by address, and this
91
+ * client cannot resolve one locally, so the recipient stays unbound.
92
+ */
93
+ export interface RequestedPayment {
94
+ /**
95
+ * The amount as the caller wrote it, in USDC.
96
+ */
97
+ amount: string;
98
+ }
99
+ export type MovementReviewVerdict = {
100
+ ok: true;
101
+ } | {
102
+ ok: false;
103
+ reason: string;
104
+ };
105
+ /**
106
+ * Recompute an instruction's digest from the fields it says it covers, or
107
+ * `null` when the payload does not parse as its kind. A `null` is a refusal,
108
+ * never a pass.
109
+ */
110
+ export declare function rebuildInstructionDigest(instruction: Pick<MovementInstructionReview, "kind" | "payload">): string | null;
111
+ /**
112
+ * Whether a prepared movement may be stamped: every digest rebuilt from the
113
+ * fields it says it covers, every instruction naming the same signer and the
114
+ * network it actually signs on, no payload spending from another wallet, no
115
+ * delegation handing the wallet to an unrecognised contract, the approval
116
+ * listing exactly those digests, and the request body pinned to them and to
117
+ * that signer.
118
+ *
119
+ * Refuse on anything but `ok`. A reason describes what disagreed, and a
120
+ * disagreement means the body would sign something other than what it
121
+ * describes.
122
+ *
123
+ * No instruction may move the network's own token, which is the one amount
124
+ * every kind states in a field rather than inside call data.
125
+ *
126
+ * Pass `requested` to also check the approval against what the caller asked
127
+ * for. That binds only when every payload able to move value states its amount
128
+ * in a named field; an approval carrying one whose amount lives in call data
129
+ * is left unbound, because a sum over the rest would bind nothing.
130
+ *
131
+ * This checks that a payload is the one shown for its digest. It does not
132
+ * decode call data, so for kinds that carry their recipient and amount as
133
+ * encoded call data rather than as named fields, a passing verdict means the
134
+ * bytes signed are the bytes shown, not that they pay a particular party for a
135
+ * particular amount. The recipient is never bound: a counterparty rail is
136
+ * named by id, and this client cannot resolve one to an address on its own.
137
+ */
138
+ export declare function verifyPreparedMovement(prepared: PreparedMovement, requested?: RequestedPayment): MovementReviewVerdict;
139
+ //#endregion