@dakota-xyz/ts-sdk 1.6.0 → 2.0.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/README.md +122 -0
- package/dist/index.d.mts +1188 -11
- package/dist/index.d.ts +1188 -11
- package/dist/index.js +754 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +735 -7
- package/dist/index.mjs.map +1 -1
- package/dist/webhook/index.d.mts +141 -7
- package/dist/webhook/index.d.ts +141 -7
- package/dist/webhook/index.js +9 -2
- package/dist/webhook/index.js.map +1 -1
- package/dist/webhook/index.mjs +9 -2
- package/dist/webhook/index.mjs.map +1 -1
- package/package.json +5 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { KeyObject } from 'node:crypto';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Environment configuration for Dakota Platform API.
|
|
3
5
|
*/
|
|
@@ -728,7 +730,7 @@ type components = {
|
|
|
728
730
|
* @example transaction.auto.updated
|
|
729
731
|
* @enum {string}
|
|
730
732
|
*/
|
|
731
|
-
readonly EventType: "user.created" | "user.updated" | "user.deleted" | "api_key.created" | "api_key.deleted" | "customer.created" | "customer.updated" | "customer.kyb_link.created" | "customer.kyb_link.updated" | "customer.kyb_status.created" | "customer.kyb_status.updated" | "customer.kyb_application.submitted" | "auto_account.created" | "auto_account.updated" | "auto_account.deleted" | "transaction.auto.created" | "transaction.auto.updated" | "transaction.one_off.created" | "transaction.one_off.updated" | "recipient.created" | "recipient.updated" | "recipient.deleted" | "destination.created" | "destination.deleted" | "target.created" | "target.updated" | "target.deleted" | "exception.created" | "exception.cleared" | "bvnk.onboarding.created" | "bvnk.onboarding.updated" | "wallet.created" | "wallet.updated" | "wallet.signer_group.created" | "wallet.signer_group.updated" | "wallet.policy.created" | "wallet.policy.updated" | "wallet.transaction.created" | "wallet.transaction.updated" | "wallet.deposit";
|
|
733
|
+
readonly EventType: "user.created" | "user.updated" | "user.deleted" | "api_key.created" | "api_key.deleted" | "customer.created" | "customer.updated" | "customer.kyb_link.created" | "customer.kyb_link.updated" | "customer.kyb_status.created" | "customer.kyb_status.updated" | "customer.kyb_application.submitted" | "customer.capability_status.updated" | "auto_account.created" | "auto_account.updated" | "auto_account.deleted" | "transaction.auto.created" | "transaction.auto.updated" | "transaction.one_off.created" | "transaction.one_off.updated" | "recipient.created" | "recipient.updated" | "recipient.deleted" | "destination.created" | "destination.deleted" | "target.created" | "target.updated" | "target.deleted" | "exception.created" | "exception.cleared" | "bvnk.onboarding.created" | "bvnk.onboarding.updated" | "wallet.created" | "wallet.updated" | "wallet.signer_group.created" | "wallet.signer_group.updated" | "wallet.policy.created" | "wallet.policy.updated" | "wallet.transaction.created" | "wallet.transaction.updated" | "wallet.deposit" | "fee_payout_destination.updated" | "fee_payout_destination.deleted" | "scheduled_payment.failed";
|
|
732
734
|
/** @description Request metadata for the original operation that emitted the event, when available. */
|
|
733
735
|
readonly EventRequest: {
|
|
734
736
|
/**
|
|
@@ -1244,12 +1246,18 @@ type components = {
|
|
|
1244
1246
|
};
|
|
1245
1247
|
/**
|
|
1246
1248
|
* Account Update Request
|
|
1247
|
-
* @description Unified account update request for onramp/offramp/swap.
|
|
1249
|
+
* @description Unified account update request for onramp/offramp/swap. `developer_fee_bps` is also updatable and applies to future transactions only; existing transactions are unaffected.
|
|
1248
1250
|
*/
|
|
1249
1251
|
readonly AccountUpdateRequest: {
|
|
1250
1252
|
readonly account_type: components["schemas"]["AccountType"];
|
|
1251
1253
|
readonly crypto_destination_id?: components["schemas"]["KSUID"];
|
|
1252
1254
|
readonly fiat_destination_id?: components["schemas"]["KSUID"];
|
|
1255
|
+
/**
|
|
1256
|
+
* Format: int32
|
|
1257
|
+
* @description Developer fee (client revenue share) in basis points. When set, updates the fee applied to FUTURE transactions on this account; existing transactions are unaffected. Routing fields remain immutable.
|
|
1258
|
+
* @example 50
|
|
1259
|
+
*/
|
|
1260
|
+
readonly developer_fee_bps?: number;
|
|
1253
1261
|
readonly destination_network_id?: components["schemas"]["NetworkId"];
|
|
1254
1262
|
/**
|
|
1255
1263
|
* @description Asset to receive at the destination.
|
|
@@ -4516,6 +4524,423 @@ type components = {
|
|
|
4516
4524
|
*/
|
|
4517
4525
|
readonly created_at?: string;
|
|
4518
4526
|
};
|
|
4527
|
+
readonly PaymentAgentResponse: {
|
|
4528
|
+
readonly id?: string;
|
|
4529
|
+
readonly name?: string;
|
|
4530
|
+
readonly customer_id?: string;
|
|
4531
|
+
readonly hosted?: boolean;
|
|
4532
|
+
readonly signer_id?: string;
|
|
4533
|
+
/** @description base64 P-256 SPKI */
|
|
4534
|
+
readonly signer_public_key?: string;
|
|
4535
|
+
/** @description DERIVED - wallets whose attached signer groups contain the agent's signer. Empty until the customer's endorsed attaches land. */
|
|
4536
|
+
readonly wallet_ids?: readonly string[];
|
|
4537
|
+
/**
|
|
4538
|
+
* @description pending is DERIVED - a non-revoked agent recognized on no wallet. It cannot accept instructions until a wallet attach is endorsed.
|
|
4539
|
+
* @enum {string}
|
|
4540
|
+
*/
|
|
4541
|
+
readonly state?: "pending" | "active" | "revoked";
|
|
4542
|
+
/** @description Present on revoke: the signer groups the (now-revoked) agent's signer still belongs to. A revoked signer can't sign, but its group membership lingers — remove signer_id from each (DELETE /signer-groups/{signer_group_id}/signers/{signer_id}) to finish de-provisioning. Absent when there is nothing to clean up. */
|
|
4543
|
+
readonly signer_group_cleanup?: readonly components["schemas"]["PaymentAgentSignerGroupRef"][];
|
|
4544
|
+
};
|
|
4545
|
+
/** @description A signer-group reference (id + display name). */
|
|
4546
|
+
readonly PaymentAgentSignerGroupRef: {
|
|
4547
|
+
readonly signer_group_id: string;
|
|
4548
|
+
readonly name: string;
|
|
4549
|
+
};
|
|
4550
|
+
/** @description Tagged union - exactly one payload field matching `type` is set. */
|
|
4551
|
+
readonly AgenticAction: {
|
|
4552
|
+
/** @enum {string} */
|
|
4553
|
+
readonly type: "create_recipient" | "create_crypto_destination" | "create_bank_destination" | "create_mandate" | "create_scheduled_payments" | "create_auto_account";
|
|
4554
|
+
readonly create_recipient?: components["schemas"]["RecipientRequest"];
|
|
4555
|
+
readonly create_crypto_destination?: components["schemas"]["CreateCryptoDestinationAction"];
|
|
4556
|
+
readonly create_bank_destination?: components["schemas"]["CreateBankDestinationAction"];
|
|
4557
|
+
readonly create_mandate?: components["schemas"]["CreateMandateAction"];
|
|
4558
|
+
readonly create_scheduled_payments?: components["schemas"]["CreateScheduledPaymentsAction"];
|
|
4559
|
+
readonly create_auto_account?: components["schemas"]["CreateAutoAccountAction"];
|
|
4560
|
+
};
|
|
4561
|
+
readonly AgenticActionDownstream: {
|
|
4562
|
+
readonly recipient_id?: string;
|
|
4563
|
+
readonly destination_id?: string;
|
|
4564
|
+
readonly mandate_id?: string;
|
|
4565
|
+
readonly scheduled_payment_ids?: readonly string[];
|
|
4566
|
+
/** @description The provisioned auto-account (set for a create_auto_account action). */
|
|
4567
|
+
readonly auto_account_id?: string;
|
|
4568
|
+
};
|
|
4569
|
+
/** @description An input artifact attached to a conversation turn. Tagged union: exactly one payload field matching `type` is set. Extensible — further kinds (e.g. an email stream) are added as new `type` enum values + payload fields, additively, without breaking this shape. */
|
|
4570
|
+
readonly AgenticAttachment: {
|
|
4571
|
+
/**
|
|
4572
|
+
* @description The attachment kind — `document` (a PDF or image) today; further sources are added additively.
|
|
4573
|
+
* @enum {string}
|
|
4574
|
+
*/
|
|
4575
|
+
readonly type: "document";
|
|
4576
|
+
readonly document?: components["schemas"]["AgenticDocumentAttachment"];
|
|
4577
|
+
};
|
|
4578
|
+
/** @description One typed reference to the platform object an insight item was computed from. */
|
|
4579
|
+
readonly InsightEvidence: {
|
|
4580
|
+
/** @description Platform resource name — the kind of object `id` refers to. OPEN set (like `InsightItem.kind`): new resource types may be referenced without a breaking change, so a client MUST handle an unrecognized type gracefully (e.g. show the item without a deep-link), never error. `transaction` is reserved (advertised and client-handled, but not emitted today). */
|
|
4581
|
+
readonly type: string;
|
|
4582
|
+
readonly id: string;
|
|
4583
|
+
};
|
|
4584
|
+
/** @description One observation (in `insights`) or advisory recommendation (in `suggestions`) — the same schema in both arrays. `kind` is an OPEN set: new kinds appear without notice and clients must ignore kinds they do not recognize. */
|
|
4585
|
+
readonly InsightItem: {
|
|
4586
|
+
/**
|
|
4587
|
+
* @description Machine-readable item type. This is an OPEN set — the values below are the kinds emitted TODAY, but new kinds may be added at any time without a breaking change, so it is documented as an extensible enum rather than a closed one. A client MUST render an unrecognized kind generically from `message` + `severity` (and `evidence`), never drop it. Kinds emitted today, by array:
|
|
4588
|
+
* Observations (`insights[]`):
|
|
4589
|
+
* * `upcoming_payments` — open payments due within the horizon (count + per-asset totals).
|
|
4590
|
+
* * `payment_failures_clustered` — ≥2 recent failures to the same payee sharing one reason (root cause).
|
|
4591
|
+
* * `payments_failed` — remaining recent singleton failures, summarized.
|
|
4592
|
+
* * `account_activity` — executed volume over the window + mandates awaiting signature.
|
|
4593
|
+
* * `new_counterparty` — first open payments to a recently-added payee.
|
|
4594
|
+
* * `counterparty_concentration` — one payee dominates recent executed outflow.
|
|
4595
|
+
*
|
|
4596
|
+
* Suggestions (`suggestions[]`, advisory — acting is a separate human-gated step):
|
|
4597
|
+
* * `payment_at_risk` — an open payment is past its scheduled time.
|
|
4598
|
+
* * `funding_shortfall` — a funding wallet's indexed balance is below its near-term payment needs.
|
|
4599
|
+
* * `mandate_expiring` — an active mandate ends soon (warn when open payments depend on it).
|
|
4600
|
+
* * `mandate_headroom` — a mandate's window budget is nearly or already over-consumed.
|
|
4601
|
+
*/
|
|
4602
|
+
readonly kind: string;
|
|
4603
|
+
/** @enum {string} */
|
|
4604
|
+
readonly severity: "info" | "warn" | "critical";
|
|
4605
|
+
/** @description Human-readable, self-contained statement of the finding, with exact amounts and dates. */
|
|
4606
|
+
readonly message: string;
|
|
4607
|
+
/** @description Machine-readable facts behind the message (decimal strings, counts, unix timestamps). Keys vary by kind. */
|
|
4608
|
+
readonly detail?: {
|
|
4609
|
+
readonly [key: string]: unknown;
|
|
4610
|
+
};
|
|
4611
|
+
/** @description The platform objects this item is computed from (capped; may be empty when the claim is an aggregate). */
|
|
4612
|
+
readonly evidence: readonly components["schemas"]["InsightEvidence"][];
|
|
4613
|
+
};
|
|
4614
|
+
/** @description One funding wallet's indexed holding of one asset on one network. The balance index prices holdings in USD; values may lag the chain. */
|
|
4615
|
+
readonly InsightSnapshotBalance: {
|
|
4616
|
+
readonly wallet_id: string;
|
|
4617
|
+
readonly name?: string;
|
|
4618
|
+
readonly network_id: string;
|
|
4619
|
+
readonly asset: string;
|
|
4620
|
+
readonly amount_usd: string;
|
|
4621
|
+
};
|
|
4622
|
+
/** @description Open scheduled payments due within the window. */
|
|
4623
|
+
readonly InsightSnapshotUpcoming: {
|
|
4624
|
+
readonly days: number;
|
|
4625
|
+
readonly count: number;
|
|
4626
|
+
/** @description Asset → total amount due in the window (decimal strings). */
|
|
4627
|
+
readonly totals?: {
|
|
4628
|
+
readonly [key: string]: string;
|
|
4629
|
+
};
|
|
4630
|
+
};
|
|
4631
|
+
/** @description Typed FACTS about the account — rendered directly by clients, not narrated. `balances`/`total_usd` cover the wallets the customer's open payments spend from and are present only when the balance index is configured; they degrade to absent, never to an error. */
|
|
4632
|
+
readonly InsightSnapshot: {
|
|
4633
|
+
readonly total_usd?: string;
|
|
4634
|
+
readonly balances?: readonly components["schemas"]["InsightSnapshotBalance"][];
|
|
4635
|
+
readonly upcoming: components["schemas"]["InsightSnapshotUpcoming"];
|
|
4636
|
+
readonly open_scheduled_payments: number;
|
|
4637
|
+
readonly active_mandates: number;
|
|
4638
|
+
};
|
|
4639
|
+
/** @description The deterministic, read-only insight report for a customer. Computed on demand; nothing is stored. */
|
|
4640
|
+
readonly InsightReport: {
|
|
4641
|
+
readonly customer_id: string;
|
|
4642
|
+
/** Format: int64 */
|
|
4643
|
+
readonly generated_at: number;
|
|
4644
|
+
readonly snapshot: components["schemas"]["InsightSnapshot"];
|
|
4645
|
+
/** @description Observations about the account (always present, possibly empty). */
|
|
4646
|
+
readonly insights: readonly components["schemas"]["InsightItem"][];
|
|
4647
|
+
/** @description Advisory recommendations (always present, possibly empty). Non-binding — acting on one is a separate, human-gated step. */
|
|
4648
|
+
readonly suggestions: readonly components["schemas"]["InsightItem"][];
|
|
4649
|
+
};
|
|
4650
|
+
readonly InsightChatMessage: {
|
|
4651
|
+
/** @enum {string} */
|
|
4652
|
+
readonly role: "user" | "assistant";
|
|
4653
|
+
readonly content: string;
|
|
4654
|
+
};
|
|
4655
|
+
readonly InsightChatRequest: {
|
|
4656
|
+
/** @description The conversation so far, oldest first. */
|
|
4657
|
+
readonly messages: readonly components["schemas"]["InsightChatMessage"][];
|
|
4658
|
+
};
|
|
4659
|
+
readonly InsightChatResponse: {
|
|
4660
|
+
/** @description The assistant's plain-text answer. Advisory only — the assistant cannot execute anything. */
|
|
4661
|
+
readonly reply: string;
|
|
4662
|
+
/**
|
|
4663
|
+
* @description How the boundary screen treated this turn. `ok` is a normal turn; `warned` means the request was off-topic and the customer was warned but may continue; `blocked` means the conversation has been terminated (repeated off-topic turns or a manipulation attempt) — the client should stop serving it and offer a fresh chat.
|
|
4664
|
+
* @enum {string}
|
|
4665
|
+
*/
|
|
4666
|
+
readonly conversation_status?: "ok" | "warned" | "blocked";
|
|
4667
|
+
};
|
|
4668
|
+
readonly AgenticChatMessage: {
|
|
4669
|
+
/** @enum {string} */
|
|
4670
|
+
readonly role: "user" | "assistant";
|
|
4671
|
+
readonly content: string;
|
|
4672
|
+
/** @description Input artifacts attached to this turn for the agent to investigate — e.g. an invoice PDF to draft a payment from. Optional. Document attachments (PDF or image) are accepted up to 8 MiB per document and 16 MiB per request, measured on the decoded payload. */
|
|
4673
|
+
readonly attachments?: readonly components["schemas"]["AgenticAttachment"][];
|
|
4674
|
+
};
|
|
4675
|
+
readonly AgenticDocumentAttachment: {
|
|
4676
|
+
/**
|
|
4677
|
+
* @description MIME type of the attached document.
|
|
4678
|
+
* @enum {string}
|
|
4679
|
+
*/
|
|
4680
|
+
readonly media_type: "application/pdf" | "image/png" | "image/jpeg" | "image/webp" | "image/gif";
|
|
4681
|
+
/**
|
|
4682
|
+
* Format: byte
|
|
4683
|
+
* @description The document bytes, base64-encoded.
|
|
4684
|
+
*/
|
|
4685
|
+
readonly data: string;
|
|
4686
|
+
/** @description Optional original filename, for display and audit. */
|
|
4687
|
+
readonly filename?: string;
|
|
4688
|
+
};
|
|
4689
|
+
readonly AgenticInstruction: {
|
|
4690
|
+
readonly id?: string;
|
|
4691
|
+
readonly payment_agent_id?: string;
|
|
4692
|
+
/** @enum {string} */
|
|
4693
|
+
readonly status?: "proposed" | "executed" | "failed";
|
|
4694
|
+
readonly actions?: readonly components["schemas"]["AgenticAction"][];
|
|
4695
|
+
readonly downstream?: readonly components["schemas"]["AgenticActionDownstream"][];
|
|
4696
|
+
};
|
|
4697
|
+
readonly AgenticInstructionsResult: {
|
|
4698
|
+
/** @description Every mandate this batch DRAFTED, in full wire shape (identical to GET /mandates/{mandate_id}) — sign the §8 approval immediately, no follow-up fetch or polling. Pending until a signer other than the bound one approves. */
|
|
4699
|
+
readonly mandates?: readonly components["schemas"]["Mandate"][];
|
|
4700
|
+
readonly instruction_ids?: readonly string[];
|
|
4701
|
+
};
|
|
4702
|
+
/** @description A self-contained series of actions. Cross-action links are <entity>_id fields - empty binds to the artifact created in this proposal, a real id reuses an existing one. Every proposal must instruct a payment or draft a mandate - a mandate-only proposal is a standing authorization (sign now, schedule under it later by mandate_id with no new signature). */
|
|
4703
|
+
readonly AgenticProposal: {
|
|
4704
|
+
readonly summary?: string;
|
|
4705
|
+
readonly actions: readonly components["schemas"]["AgenticAction"][];
|
|
4706
|
+
};
|
|
4707
|
+
/** @description The agent's next step. At least one of `proposals` or `reply` is always present in a successful response — `proposals` at high confidence (optionally with a short `reply` note), or `reply` alone when the agent needs more from the user. */
|
|
4708
|
+
readonly AgenticProposalsResult: {
|
|
4709
|
+
/** @description Validated action-series proposals, ready to accept via POST /instructions. Present only at high confidence. */
|
|
4710
|
+
readonly proposals?: readonly components["schemas"]["AgenticProposal"][];
|
|
4711
|
+
/** @description The agent's conversational reply — a clarifying question or confirmation. Present without proposals when the agent needs more from the user; may accompany proposals as a short note. */
|
|
4712
|
+
readonly reply?: string;
|
|
4713
|
+
/**
|
|
4714
|
+
* @description How the boundary screen treated this turn: `ok` is a normal payments turn; `warned` means the request was off-topic and the customer was warned but may continue; `blocked` means the conversation has been terminated (repeated off-topic turns or a manipulation attempt) — the client should stop serving it and offer a fresh chat.
|
|
4715
|
+
* @enum {string}
|
|
4716
|
+
*/
|
|
4717
|
+
readonly conversation_status?: "ok" | "warned" | "blocked";
|
|
4718
|
+
};
|
|
4719
|
+
readonly ApproveMandateRequest: {
|
|
4720
|
+
readonly approver_public_key: string;
|
|
4721
|
+
readonly signature: string;
|
|
4722
|
+
};
|
|
4723
|
+
readonly CancelMandateRequest: {
|
|
4724
|
+
readonly signer_public_key: string;
|
|
4725
|
+
readonly signature: string;
|
|
4726
|
+
};
|
|
4727
|
+
readonly CreatePaymentAgentRequest: {
|
|
4728
|
+
readonly customer_id: string;
|
|
4729
|
+
readonly name: string;
|
|
4730
|
+
/** @description Must be true. Only hosted agents (signing keys custodied by the isolated agent-signer service) are supported today; bring-your-own-signer agents are not yet available, so the API rejects hosted=false. */
|
|
4731
|
+
readonly hosted: boolean;
|
|
4732
|
+
};
|
|
4733
|
+
readonly CreateBankDestinationAction: {
|
|
4734
|
+
readonly recipient_id?: string;
|
|
4735
|
+
readonly account_holder_name?: string;
|
|
4736
|
+
readonly account_number?: string;
|
|
4737
|
+
readonly routing_number?: string;
|
|
4738
|
+
/** @enum {string} */
|
|
4739
|
+
readonly account_type?: "checking" | "savings";
|
|
4740
|
+
readonly iban?: string;
|
|
4741
|
+
readonly bic?: string;
|
|
4742
|
+
readonly bank_name?: string;
|
|
4743
|
+
};
|
|
4744
|
+
readonly CreateCryptoDestinationAction: {
|
|
4745
|
+
/** @description recipient reference: empty = the recipient created in this proposal; a recipient id or name = an existing recipient */
|
|
4746
|
+
readonly recipient_id?: string;
|
|
4747
|
+
readonly address: string;
|
|
4748
|
+
readonly network_id: components["schemas"]["NetworkId"];
|
|
4749
|
+
};
|
|
4750
|
+
readonly CreateInstructionsRequest: {
|
|
4751
|
+
readonly payment_agent_id: string;
|
|
4752
|
+
readonly proposals: readonly components["schemas"]["AgenticProposal"][];
|
|
4753
|
+
};
|
|
4754
|
+
readonly CreateMandateAction: {
|
|
4755
|
+
readonly rule: components["schemas"]["MandateRule"];
|
|
4756
|
+
/** Format: int64 */
|
|
4757
|
+
readonly valid_from?: number;
|
|
4758
|
+
/** Format: int64 */
|
|
4759
|
+
readonly valid_until?: number;
|
|
4760
|
+
};
|
|
4761
|
+
/** @description Exactly one binding form is required - payment_agent_id alone, or signer_id together with customer_id. Any other combination is rejected with 400. */
|
|
4762
|
+
readonly CreateMandateRequest: {
|
|
4763
|
+
/** @description Binding form A (hosted convenience) - the mandate binds this agent's signer and anchors to the agent's customer. Mutually exclusive with signer_id/customer_id. */
|
|
4764
|
+
readonly payment_agent_id?: string;
|
|
4765
|
+
/** @description Binding form B - the mandate binds this signer directly (any of the client's signers, not only an agent's). Requires customer_id. */
|
|
4766
|
+
readonly signer_id?: string;
|
|
4767
|
+
/** @description Binding form B - the customer the mandate is anchored to; must belong to the calling client. Defines the recipient-target scope and the §8 approver set (approval requires a recognized signer of THIS customer other than the bound one). Requires signer_id. */
|
|
4768
|
+
readonly customer_id?: string;
|
|
4769
|
+
readonly rule: components["schemas"]["MandateRule"];
|
|
4770
|
+
/** Format: int64 */
|
|
4771
|
+
readonly valid_from?: number;
|
|
4772
|
+
/** Format: int64 */
|
|
4773
|
+
readonly valid_until?: number;
|
|
4774
|
+
};
|
|
4775
|
+
/** @description A freeform proposals conversation. The server is stateless — send the whole history in `messages` on each call. `prompt` is a convenience for a single-shot turn (or the latest user message); it is appended after `messages`. At least one of `prompt` or `messages` must be non-empty. Supplying both is valid only when `messages` does not already end with a user turn; otherwise the request is rejected with 400 (two consecutive user turns are not allowed). */
|
|
4776
|
+
readonly CreateProposalsRequest: {
|
|
4777
|
+
/** @description Single-shot input, appended as the latest user turn. */
|
|
4778
|
+
readonly prompt?: string;
|
|
4779
|
+
/** @description The conversation so far, oldest first. */
|
|
4780
|
+
readonly messages?: readonly components["schemas"]["AgenticChatMessage"][];
|
|
4781
|
+
};
|
|
4782
|
+
readonly CreateScheduledPaymentsAction: {
|
|
4783
|
+
readonly destination_id?: string;
|
|
4784
|
+
/** @description The funding wallet for these payments — one the agent recognizes. Optional only when the agent recognizes exactly one wallet (used by default); otherwise required, since a signer can recognize several and the choice cannot be deferred to fire time. Its chain family must match the payment network. */
|
|
4785
|
+
readonly wallet_id?: string;
|
|
4786
|
+
readonly amount: string;
|
|
4787
|
+
readonly asset: string;
|
|
4788
|
+
readonly dates?: readonly number[];
|
|
4789
|
+
readonly count?: number;
|
|
4790
|
+
/** Format: int64 */
|
|
4791
|
+
readonly interval_seconds?: number;
|
|
4792
|
+
/** Format: int64 */
|
|
4793
|
+
readonly start_at?: number;
|
|
4794
|
+
};
|
|
4795
|
+
/** @description Direct (signer-first) schedule create. The signer + funding wallet are the caller's choice; the schedule is explicit `dates`, or `count` × `interval_seconds` from `start_at`. Name the payee EITHER with `destination_id` (an existing crypto destination of the wallet's customer) OR with a direct `address` + `network_id` (a raw crypto address, no recipient — matched on the address at fire time, like a mandate address target) — exactly one of the two. */
|
|
4796
|
+
readonly CreateScheduledPaymentRequest: {
|
|
4797
|
+
/** @description The signer the payments bind to; its hosted agent signs at fire time. */
|
|
4798
|
+
readonly signer_id: string;
|
|
4799
|
+
/** @description The funding wallet these payments spend from. Required — the signer must be permitted to spend on it, and its chain family must match the payment network. */
|
|
4800
|
+
readonly wallet_id: string;
|
|
4801
|
+
/** @description An existing crypto destination of the wallet's customer to pay. Omit to pay a direct address (address + network_id). */
|
|
4802
|
+
readonly destination_id?: string;
|
|
4803
|
+
/** @description A direct crypto address to pay — an alternative to destination_id (no recipient). Requires network_id; the wallet's chain family must match. */
|
|
4804
|
+
readonly address?: string;
|
|
4805
|
+
/** @description The network for a direct-address payment (required together with address). */
|
|
4806
|
+
readonly network_id?: string;
|
|
4807
|
+
/** @description Decimal string, at the destination asset. */
|
|
4808
|
+
readonly amount: string;
|
|
4809
|
+
readonly asset: string;
|
|
4810
|
+
/** @description Explicit per-payment unix times (one payment each). Win over count × interval_seconds. */
|
|
4811
|
+
readonly dates?: readonly number[];
|
|
4812
|
+
/** @description Number of payments when using count × interval_seconds (default 1). */
|
|
4813
|
+
readonly count?: number;
|
|
4814
|
+
/**
|
|
4815
|
+
* Format: int64
|
|
4816
|
+
* @description Cadence in seconds between payments when using count.
|
|
4817
|
+
*/
|
|
4818
|
+
readonly interval_seconds?: number;
|
|
4819
|
+
/**
|
|
4820
|
+
* Format: int64
|
|
4821
|
+
* @description First due time (0 ⇒ now).
|
|
4822
|
+
*/
|
|
4823
|
+
readonly start_at?: number;
|
|
4824
|
+
};
|
|
4825
|
+
/** @description Provision a provider-managed convert-and-forward "auto-account" so a payment can cross chain families (crypto→crypto swap) or exit to a bank (crypto→bank offramp). The agent pays the auto-account's crypto DEPOSIT on source_network_id (on the funding wallet's own family) and the provider converts source_asset→output_asset and forwards to destination_id. A scheduled payment then targets the deposit; the mandate still targets the real recipient. */
|
|
4826
|
+
readonly CreateAutoAccountAction: {
|
|
4827
|
+
/** @description The REAL destination the auto-account forwards to: a crypto destination (⇒ swap) or a bank destination (⇒ offramp). Empty = the destination created in this proposal. */
|
|
4828
|
+
readonly destination_id?: string;
|
|
4829
|
+
/** @description The asset the agent deposits and the scheduled payment sends (may be the ANY wildcard). */
|
|
4830
|
+
readonly source_asset: string;
|
|
4831
|
+
readonly source_network_id: components["schemas"]["NetworkId"];
|
|
4832
|
+
/** @description The asset the recipient receives (a currency such as USD for a bank offramp). */
|
|
4833
|
+
readonly output_asset: string;
|
|
4834
|
+
/** @description Outbound rail — REQUIRED for a bank offramp (e.g. ach, fedwire, swift, sepa); omit for a crypto swap. */
|
|
4835
|
+
readonly rail?: string;
|
|
4836
|
+
/** @enum {string} */
|
|
4837
|
+
readonly routing_preference?: "fastest" | "cheapest";
|
|
4838
|
+
/**
|
|
4839
|
+
* Format: int32
|
|
4840
|
+
* @description Optional developer fee in basis points (0–10000).
|
|
4841
|
+
*/
|
|
4842
|
+
readonly fee_bps?: number;
|
|
4843
|
+
};
|
|
4844
|
+
readonly Mandate: {
|
|
4845
|
+
readonly id?: string;
|
|
4846
|
+
/**
|
|
4847
|
+
* @description expired is DERIVED, never stored - a pending or active mandate whose valid_until has passed. It cannot authorize payments and cannot be approved; it can still be cancelled.
|
|
4848
|
+
* @enum {string}
|
|
4849
|
+
*/
|
|
4850
|
+
readonly status?: "pending" | "active" | "expired" | "rejected" | "revoked" | "done";
|
|
4851
|
+
readonly bound_signer_id?: string;
|
|
4852
|
+
/** @description The customer this mandate is anchored to - approval requires a recognized signer of this customer other than the bound one (§8), and recipient targets belong to it. Absent only on rows created before the anchor existed. */
|
|
4853
|
+
readonly customer_id?: string;
|
|
4854
|
+
/** @description DERIVED, display-only - the rule's recipient targets resolved to names, parallel to rule.targets (raw id on a miss). Absent for address/any target kinds. The ids in the rule remain the grant. */
|
|
4855
|
+
readonly target_names?: readonly string[];
|
|
4856
|
+
readonly instruction_id?: string;
|
|
4857
|
+
readonly rule?: components["schemas"]["MandateRule"];
|
|
4858
|
+
/** Format: int64 */
|
|
4859
|
+
readonly valid_from?: number;
|
|
4860
|
+
/** Format: int64 */
|
|
4861
|
+
readonly valid_until?: number;
|
|
4862
|
+
readonly approved_by_signer_id?: string;
|
|
4863
|
+
/**
|
|
4864
|
+
* Format: int64
|
|
4865
|
+
* @description Unix time of the §8 approval; absent until approved.
|
|
4866
|
+
*/
|
|
4867
|
+
readonly approved_at?: number;
|
|
4868
|
+
/** @description The signer that cancelled the mandate while it was still pending (§8); absent otherwise. */
|
|
4869
|
+
readonly rejected_by_signer_id?: string;
|
|
4870
|
+
/** @description The signer that cancelled the mandate after activation (§8); absent otherwise. */
|
|
4871
|
+
readonly revoked_by_signer_id?: string;
|
|
4872
|
+
};
|
|
4873
|
+
readonly MandateResponse: {
|
|
4874
|
+
readonly id?: string;
|
|
4875
|
+
/** @enum {string} */
|
|
4876
|
+
readonly status?: "pending" | "active" | "rejected" | "revoked" | "done";
|
|
4877
|
+
readonly approved_by_signer_id?: string;
|
|
4878
|
+
/** @description The signer that cancelled the mandate while it was still pending (§8); absent otherwise. */
|
|
4879
|
+
readonly rejected_by_signer_id?: string;
|
|
4880
|
+
/** @description The signer that cancelled the mandate after activation (§8); absent otherwise. */
|
|
4881
|
+
readonly revoked_by_signer_id?: string;
|
|
4882
|
+
};
|
|
4883
|
+
readonly MandateRule: {
|
|
4884
|
+
/** @enum {string} */
|
|
4885
|
+
readonly target_type: "any" | "recipient" | "address";
|
|
4886
|
+
/** @description One or more targets of the declared kind (recipient ids or addresses; empty for any). Max 32. */
|
|
4887
|
+
readonly targets?: readonly string[];
|
|
4888
|
+
/** @description The network the funding wallet pays on (e.g. base-sepolia). Empty authorizes any network — the other dimensions still apply. */
|
|
4889
|
+
readonly network_id?: string;
|
|
4890
|
+
/** @description The asset the funding wallet SENDS — deposit-denominated, e.g. USDC — compared case-insensitively against the firing payment. Write the crypto deposit asset even when the recipient ultimately receives fiat via a bank offramp (stablecoin conversion is 1:1): a fiat symbol such as USD can never match a send, so the mandate would deny every payment. */
|
|
4891
|
+
readonly asset: string;
|
|
4892
|
+
/** @description Per-payment cap — a decimal string in the rule's (deposit) asset. Empty means no per-payment cap; the window caps may still bound total spend. */
|
|
4893
|
+
readonly max_per_tx?: string;
|
|
4894
|
+
/**
|
|
4895
|
+
* @description Spend-cap window for the per-target limits (calendar, not rolling). NONE = lifetime; WEEKLY = calendar week from Monday 00:00 UTC; MONTHLY = calendar month from the 1st, 00:00 UTC.
|
|
4896
|
+
* @enum {string}
|
|
4897
|
+
*/
|
|
4898
|
+
readonly window?: "NONE" | "WEEKLY" | "MONTHLY";
|
|
4899
|
+
/** @description Cumulative cap over the window, PER TARGET (never shared across targets). */
|
|
4900
|
+
readonly max_amount_per_target_in_window?: string;
|
|
4901
|
+
/** @description Up to N times PER TARGET in the window (window NONE = lifetime). */
|
|
4902
|
+
readonly max_count_per_target_in_window?: number;
|
|
4903
|
+
};
|
|
4904
|
+
readonly ScheduledPaymentResponse: {
|
|
4905
|
+
readonly id?: string;
|
|
4906
|
+
/** @description The signer (hosted agent) this payment fires under. Updatable via PATCH while scheduled. */
|
|
4907
|
+
readonly signer_id?: string;
|
|
4908
|
+
/** @description The funding wallet this payment spends from (the customer's choice at acceptance; updatable via PATCH while scheduled). */
|
|
4909
|
+
readonly wallet_id?: string;
|
|
4910
|
+
/** @description AUDIT — the mandate that covered this payment at fire time. Absent until the payment executes (coverage is decided at fire time, not bound at rest). */
|
|
4911
|
+
readonly mandate_id?: string;
|
|
4912
|
+
/** @description AUDIT — the money-path transaction created when this payment fired. Absent until the payment executes. */
|
|
4913
|
+
readonly wallet_transaction_id?: string;
|
|
4914
|
+
readonly amount?: string;
|
|
4915
|
+
readonly asset?: string;
|
|
4916
|
+
/** @description Why the payment failed (e.g. the mandate gate's denied dimensions); absent unless status is failed. */
|
|
4917
|
+
readonly failure_reason?: string;
|
|
4918
|
+
/** @description The recipient this payment pays, when created from a destination. Absent for a direct-address payment. Use this — NOT the address — to resolve the payee (two payees can share a destination address). */
|
|
4919
|
+
readonly recipient_id?: string;
|
|
4920
|
+
/** @description The REAL destination this settles to (a bank for an offramp, a crypto destination otherwise). For an auto-account payment the address is the crypto DEPOSIT while this names the bank/crypto target. */
|
|
4921
|
+
readonly destination_id?: string;
|
|
4922
|
+
/**
|
|
4923
|
+
* @description The kind of the REAL destination. `bank` marks an offramp (crypto converts to fiat, forwarded via a bank rail); `crypto` a direct or cross-family crypto payout.
|
|
4924
|
+
* @enum {string}
|
|
4925
|
+
*/
|
|
4926
|
+
readonly destination_type?: "bank" | "crypto";
|
|
4927
|
+
/** @description A human label for the real destination — e.g. "Chase ••••5432" for a bank, or a shortened address for crypto — so a client shows which account the payment settles to without a second lookup. */
|
|
4928
|
+
readonly destination_label?: string;
|
|
4929
|
+
/** @description For a bank destination, the payout rail (e.g. ach, fedwire, swift, sepa). Absent for crypto. */
|
|
4930
|
+
readonly destination_rail?: string;
|
|
4931
|
+
/** @description The asset the recipient ULTIMATELY receives — the fiat currency (e.g. USD) for an offramp, else equal to `asset`. Stablecoin conversion is 1:1, so the output amount equals `amount`. */
|
|
4932
|
+
readonly output_asset?: string;
|
|
4933
|
+
/** @description For a crypto destination, the network the recipient receives on — differs from `network_id` (the deposit network) for a cross-family swap (e.g. solana-devnet vs base-sepolia); equals `network_id` for a direct crypto payment; absent for a bank offramp. */
|
|
4934
|
+
readonly output_network?: string;
|
|
4935
|
+
readonly address?: string;
|
|
4936
|
+
readonly network_id?: string;
|
|
4937
|
+
/** @enum {string} */
|
|
4938
|
+
readonly status?: "scheduled" | "cancelled" | "executed" | "failed";
|
|
4939
|
+
/** Format: int64 */
|
|
4940
|
+
readonly executed_at?: number;
|
|
4941
|
+
/** Format: int64 */
|
|
4942
|
+
readonly scheduled_at?: number;
|
|
4943
|
+
};
|
|
4519
4944
|
};
|
|
4520
4945
|
responses: never;
|
|
4521
4946
|
parameters: {
|
|
@@ -4817,8 +5242,13 @@ type SignerGroup = components['schemas']['SignerGroup'];
|
|
|
4817
5242
|
type SignerGroupCreateRequest = components['schemas']['SignerGroupCreateRequest'];
|
|
4818
5243
|
/** Signer */
|
|
4819
5244
|
type Signer = components['schemas']['Signer'];
|
|
4820
|
-
/** Signer creation request */
|
|
5245
|
+
/** Signer creation request (POST /signers — creates a signer resource) */
|
|
4821
5246
|
type SignerCreateRequest = components['schemas']['SignerCreateRequest'];
|
|
5247
|
+
/**
|
|
5248
|
+
* Signer group signer add request (POST /signer-groups/{id}/signers —
|
|
5249
|
+
* adds an EXISTING signer's public key to a group).
|
|
5250
|
+
*/
|
|
5251
|
+
type SignerGroupSignerAddRequest = components['schemas']['CreateSignerGroupSignerRequest'];
|
|
4822
5252
|
/** API key */
|
|
4823
5253
|
type ApiKey = components['schemas']['ApiKeyListItem'];
|
|
4824
5254
|
/** API key response */
|
|
@@ -5173,10 +5603,11 @@ interface SelfServeCreditsLedgerParams {
|
|
|
5173
5603
|
*
|
|
5174
5604
|
* @example
|
|
5175
5605
|
* ```typescript
|
|
5176
|
-
* // Use a custom idempotency key for replay safety
|
|
5606
|
+
* // Use a custom idempotency key for replay safety (must be a valid UUID —
|
|
5607
|
+
* // the platform rejects other formats with 400)
|
|
5177
5608
|
* const tx = await client.transactions.create(
|
|
5178
5609
|
* { customer_id: '...', amount: '100.00', ... },
|
|
5179
|
-
* { idempotencyKey:
|
|
5610
|
+
* { idempotencyKey: randomUUID() }
|
|
5180
5611
|
* );
|
|
5181
5612
|
* ```
|
|
5182
5613
|
*/
|
|
@@ -5250,6 +5681,80 @@ interface TransactionListParams extends ListParams {
|
|
|
5250
5681
|
interface EventListParams extends ListParams {
|
|
5251
5682
|
event_type?: string;
|
|
5252
5683
|
}
|
|
5684
|
+
/** Payment agent (hosted signer that drafts payments on a customer's behalf) */
|
|
5685
|
+
type PaymentAgent = components['schemas']['PaymentAgentResponse'];
|
|
5686
|
+
/** Payment agent creation request */
|
|
5687
|
+
type PaymentAgentCreateRequest = components['schemas']['CreatePaymentAgentRequest'];
|
|
5688
|
+
/** Slim reference to a signer group an agent's signer still belongs to (returned by revoke). */
|
|
5689
|
+
type PaymentAgentSignerGroupRef = components['schemas']['PaymentAgentSignerGroupRef'];
|
|
5690
|
+
/** A single reviewable action series drafted by an agent. */
|
|
5691
|
+
type AgenticProposal = components['schemas']['AgenticProposal'];
|
|
5692
|
+
/** One tagged action inside an AgenticProposal. */
|
|
5693
|
+
type AgenticAction = components['schemas']['AgenticAction'];
|
|
5694
|
+
/** Per-action downstream artifacts produced by actuation. */
|
|
5695
|
+
type AgenticActionDownstream = components['schemas']['AgenticActionDownstream'];
|
|
5696
|
+
/** The result of POST /payment-agents/{id}/proposals. */
|
|
5697
|
+
type AgenticProposalsResult = components['schemas']['AgenticProposalsResult'];
|
|
5698
|
+
/** Request body for POST /payment-agents/{id}/proposals. */
|
|
5699
|
+
type CreateProposalsRequest = components['schemas']['CreateProposalsRequest'];
|
|
5700
|
+
/** Request body for POST /instructions. */
|
|
5701
|
+
type CreateInstructionsRequest = components['schemas']['CreateInstructionsRequest'];
|
|
5702
|
+
/** A persisted, actuated instruction (the accepted proposal). */
|
|
5703
|
+
type AgenticInstruction = components['schemas']['AgenticInstruction'];
|
|
5704
|
+
/** The result of POST /instructions — instruction_ids + the mandates the batch drafted. */
|
|
5705
|
+
type AgenticInstructionsResult = components['schemas']['AgenticInstructionsResult'];
|
|
5706
|
+
/** A mandate — the §8 authorization a customer signs to arm scheduled payments. */
|
|
5707
|
+
type Mandate = components['schemas']['Mandate'];
|
|
5708
|
+
/** Mandate rule — the spend authorization the customer approves. */
|
|
5709
|
+
type MandateRule = components['schemas']['MandateRule'];
|
|
5710
|
+
/** Slim mandate response (approve/cancel). */
|
|
5711
|
+
type MandateResponse = components['schemas']['MandateResponse'];
|
|
5712
|
+
/** Request body for POST /mandates — draft a mandate from a direct user interaction. */
|
|
5713
|
+
type CreateMandateRequest = components['schemas']['CreateMandateRequest'];
|
|
5714
|
+
/** Request body for POST /mandates/{id}/approve. */
|
|
5715
|
+
type ApproveMandateRequest = components['schemas']['ApproveMandateRequest'];
|
|
5716
|
+
/** Request body for POST /mandates/{id}/cancel. */
|
|
5717
|
+
type CancelMandateRequest = components['schemas']['CancelMandateRequest'];
|
|
5718
|
+
/** A scheduled payment — bookkeeping row created by accepting an instruction. */
|
|
5719
|
+
type ScheduledPayment = components['schemas']['ScheduledPaymentResponse'];
|
|
5720
|
+
/** Request body for POST /scheduled-payments — direct (signer-first) schedule create. */
|
|
5721
|
+
type CreateScheduledPaymentRequest = components['schemas']['CreateScheduledPaymentRequest'];
|
|
5722
|
+
/** The customer's account insight report (deterministic, read-only). */
|
|
5723
|
+
type InsightReport = components['schemas']['InsightReport'];
|
|
5724
|
+
/** One observation or suggestion inside an InsightReport. `kind` is an OPEN set. */
|
|
5725
|
+
type InsightItem = components['schemas']['InsightItem'];
|
|
5726
|
+
/** Typed reference to the platform object an insight was computed from. */
|
|
5727
|
+
type InsightEvidence = components['schemas']['InsightEvidence'];
|
|
5728
|
+
/** The typed-facts snapshot inside an InsightReport. */
|
|
5729
|
+
type InsightSnapshot = components['schemas']['InsightSnapshot'];
|
|
5730
|
+
/** One conversation turn for the insight chat. */
|
|
5731
|
+
type InsightChatMessage = components['schemas']['InsightChatMessage'];
|
|
5732
|
+
/** Request body for POST /customers/{id}/insights/chat (stateless; send the whole conversation). */
|
|
5733
|
+
type InsightChatRequest = components['schemas']['InsightChatRequest'];
|
|
5734
|
+
/** The insight-chat assistant's reply. */
|
|
5735
|
+
type InsightChatResponse = components['schemas']['InsightChatResponse'];
|
|
5736
|
+
/** Parameters for listing mandates. */
|
|
5737
|
+
interface MandateListParams extends ListParams {
|
|
5738
|
+
customer_id?: string;
|
|
5739
|
+
signer_id?: string;
|
|
5740
|
+
/**
|
|
5741
|
+
* Effective status(es) to include. Accepts a single status or a
|
|
5742
|
+
* comma-separated combination, e.g. 'active,expired'. Omit for all.
|
|
5743
|
+
*/
|
|
5744
|
+
status?: NonNullable<Mandate['status']> | (string & NonNullable<unknown>);
|
|
5745
|
+
}
|
|
5746
|
+
/** Parameters for listing scheduled payments. */
|
|
5747
|
+
interface ScheduledPaymentListParams extends ListParams {
|
|
5748
|
+
customer_id?: string;
|
|
5749
|
+
signer_id?: string;
|
|
5750
|
+
wallet_id?: string;
|
|
5751
|
+
mandate_id?: string;
|
|
5752
|
+
/**
|
|
5753
|
+
* Status(es) to include. Accepts a single status or a comma-separated
|
|
5754
|
+
* combination, e.g. 'scheduled,executed'. Omit for all.
|
|
5755
|
+
*/
|
|
5756
|
+
status?: NonNullable<ScheduledPayment['status']> | (string & NonNullable<unknown>);
|
|
5757
|
+
}
|
|
5253
5758
|
|
|
5254
5759
|
/**
|
|
5255
5760
|
* Customers resource.
|
|
@@ -6273,20 +6778,26 @@ declare class SignerGroupsResource extends BaseResource {
|
|
|
6273
6778
|
*/
|
|
6274
6779
|
get(signerGroupId: string): Promise<SignerGroup>;
|
|
6275
6780
|
/**
|
|
6276
|
-
* Add
|
|
6781
|
+
* Add an existing signer's public key to a group.
|
|
6782
|
+
*
|
|
6783
|
+
* The endpoint takes `{ member_key }` — the base64 PKIX (SPKI) public
|
|
6784
|
+
* key of an existing signer resource — not a fresh signer definition.
|
|
6785
|
+
* Returns the updated group (with the new member included).
|
|
6277
6786
|
*
|
|
6278
6787
|
* @param signerGroupId - Signer group ID
|
|
6279
|
-
* @param data -
|
|
6280
|
-
* @returns
|
|
6788
|
+
* @param data - `{ member_key }` (the signer's base64 PKIX public key)
|
|
6789
|
+
* @returns The updated signer group
|
|
6281
6790
|
*/
|
|
6282
|
-
addSigner(signerGroupId: string, data:
|
|
6791
|
+
addSigner(signerGroupId: string, data: SignerGroupSignerAddRequest, options?: RequestOptions): Promise<SignerGroup>;
|
|
6283
6792
|
/**
|
|
6284
6793
|
* Remove a signer from a group.
|
|
6285
6794
|
*
|
|
6286
6795
|
* @param signerGroupId - Signer group ID
|
|
6287
6796
|
* @param signerId - Signer ID
|
|
6797
|
+
* @param options - Optional request options (e.g. an explicit idempotency
|
|
6798
|
+
* key — the platform requires one on this DELETE)
|
|
6288
6799
|
*/
|
|
6289
|
-
removeSigner(signerGroupId: string, signerId: string): Promise<void>;
|
|
6800
|
+
removeSigner(signerGroupId: string, signerId: string, options?: RequestOptions): Promise<void>;
|
|
6290
6801
|
/**
|
|
6291
6802
|
* Get wallets attached to a signer group.
|
|
6292
6803
|
*
|
|
@@ -6853,6 +7364,363 @@ declare class SelfServeResource extends BaseResource {
|
|
|
6853
7364
|
getPricing(): Promise<SelfServeCreditsPricingResponse>;
|
|
6854
7365
|
}
|
|
6855
7366
|
|
|
7367
|
+
/**
|
|
7368
|
+
* Payment Agents resource (ALPHA).
|
|
7369
|
+
*
|
|
7370
|
+
* Agentic payments is an alpha surface (x-alpha, flag-gated on the platform)
|
|
7371
|
+
* and may change without a major-version bump.
|
|
7372
|
+
*/
|
|
7373
|
+
|
|
7374
|
+
/**
|
|
7375
|
+
* Payment Agents API resource (ALPHA).
|
|
7376
|
+
*/
|
|
7377
|
+
declare class PaymentAgentsResource extends BaseResource {
|
|
7378
|
+
/**
|
|
7379
|
+
* Create a hosted payment agent.
|
|
7380
|
+
*
|
|
7381
|
+
* @param data - Payment agent creation data (customer_id, name, hosted)
|
|
7382
|
+
* @returns The created payment agent (id, signer_id, signer_public_key, state)
|
|
7383
|
+
*/
|
|
7384
|
+
create(data: PaymentAgentCreateRequest, options?: RequestOptions): Promise<PaymentAgent>;
|
|
7385
|
+
/**
|
|
7386
|
+
* Get a hosted payment agent.
|
|
7387
|
+
*
|
|
7388
|
+
* Returns the agent together with the wallets it can currently spend
|
|
7389
|
+
* from. `wallet_ids` are DERIVED at query time from the agent signer's
|
|
7390
|
+
* live signer-group membership, so they reflect the agent's access
|
|
7391
|
+
* right now — not just at creation time.
|
|
7392
|
+
*
|
|
7393
|
+
* @param paymentAgentId - Payment agent ID
|
|
7394
|
+
*/
|
|
7395
|
+
get(paymentAgentId: string): Promise<PaymentAgent>;
|
|
7396
|
+
/**
|
|
7397
|
+
* Revoke a hosted payment agent.
|
|
7398
|
+
*
|
|
7399
|
+
* The agent can no longer be used, and its signing key is destroyed
|
|
7400
|
+
* in the isolated signer service (best-effort — the revoked state is
|
|
7401
|
+
* authoritative). Idempotent.
|
|
7402
|
+
*
|
|
7403
|
+
* The response's `signer_group_cleanup` names the signer groups the
|
|
7404
|
+
* (now-revoked) agent's signer still belongs to. A revoked signer can't
|
|
7405
|
+
* sign, but its group membership lingers — remove it with
|
|
7406
|
+
* `client.signerGroups.removeSigner(signer_group_id, signer_id)` to
|
|
7407
|
+
* finish de-provisioning.
|
|
7408
|
+
*
|
|
7409
|
+
* @param paymentAgentId - Payment agent ID
|
|
7410
|
+
* @returns The revoked payment agent (state=revoked, signer_group_cleanup?)
|
|
7411
|
+
*/
|
|
7412
|
+
revoke(paymentAgentId: string, options?: RequestOptions): Promise<PaymentAgent>;
|
|
7413
|
+
/**
|
|
7414
|
+
* Draft payment proposals from a conversation.
|
|
7415
|
+
*
|
|
7416
|
+
* Pure cognition, no side effects: turn a customer's natural-language
|
|
7417
|
+
* request into reviewable proposals. Stateless — send the whole
|
|
7418
|
+
* conversation so far in `messages` on each call. Prefer
|
|
7419
|
+
* `AgentConversation` for multi-turn chat; use this directly only for
|
|
7420
|
+
* one-shot proposals.
|
|
7421
|
+
*
|
|
7422
|
+
* @param paymentAgentId - Payment agent ID
|
|
7423
|
+
* @param data - Prompt and/or messages
|
|
7424
|
+
* @returns Proposals (at high confidence) and/or a conversational reply
|
|
7425
|
+
*/
|
|
7426
|
+
createProposals(paymentAgentId: string, data: CreateProposalsRequest, options?: RequestOptions): Promise<AgenticProposalsResult>;
|
|
7427
|
+
}
|
|
7428
|
+
|
|
7429
|
+
/**
|
|
7430
|
+
* Instructions resource (ALPHA).
|
|
7431
|
+
*
|
|
7432
|
+
* Agentic payments is an alpha surface (x-alpha, flag-gated on the platform)
|
|
7433
|
+
* and may change without a major-version bump.
|
|
7434
|
+
*/
|
|
7435
|
+
|
|
7436
|
+
/**
|
|
7437
|
+
* Instructions API resource (ALPHA).
|
|
7438
|
+
*
|
|
7439
|
+
* Each accepted proposal becomes one persisted instruction whose action
|
|
7440
|
+
* series is actuated deterministically.
|
|
7441
|
+
*/
|
|
7442
|
+
declare class InstructionsResource extends BaseResource {
|
|
7443
|
+
/**
|
|
7444
|
+
* Accept proposals — actuate them into persisted instructions.
|
|
7445
|
+
*
|
|
7446
|
+
* @param data - The payment agent id and the proposals to accept
|
|
7447
|
+
* @returns instruction_ids + the mandates the batch drafted (in full
|
|
7448
|
+
* wire shape; sign the §8 approval immediately)
|
|
7449
|
+
*/
|
|
7450
|
+
create(data: CreateInstructionsRequest, options?: RequestOptions): Promise<AgenticInstructionsResult>;
|
|
7451
|
+
/**
|
|
7452
|
+
* Get an accepted instruction — its action series and the per-action
|
|
7453
|
+
* downstream artifacts actuation produced.
|
|
7454
|
+
*
|
|
7455
|
+
* @param instructionId - Instruction ID
|
|
7456
|
+
*/
|
|
7457
|
+
get(instructionId: string): Promise<AgenticInstruction>;
|
|
7458
|
+
}
|
|
7459
|
+
|
|
7460
|
+
/**
|
|
7461
|
+
* Mandates resource (ALPHA).
|
|
7462
|
+
*
|
|
7463
|
+
* Agentic payments is an alpha surface (x-alpha, flag-gated on the platform)
|
|
7464
|
+
* and may change without a major-version bump.
|
|
7465
|
+
*/
|
|
7466
|
+
|
|
7467
|
+
/**
|
|
7468
|
+
* Mandates API resource (ALPHA).
|
|
7469
|
+
*/
|
|
7470
|
+
declare class MandatesResource extends BaseResource {
|
|
7471
|
+
/**
|
|
7472
|
+
* List mandates (newest first), with the EFFECTIVE status — a pending or
|
|
7473
|
+
* active mandate past its valid_until reads "expired". Filter with
|
|
7474
|
+
* customer_id / signer_id / status; omit them all for the full collection.
|
|
7475
|
+
*
|
|
7476
|
+
* @param params - Optional pagination + filter parameters
|
|
7477
|
+
* @returns Async iterator of mandates
|
|
7478
|
+
*/
|
|
7479
|
+
list(params?: MandateListParams): PaginatedIterator<Mandate>;
|
|
7480
|
+
/**
|
|
7481
|
+
* Get a mandate — the signer it binds, its rule exactly as the customer
|
|
7482
|
+
* approves it, validity, and status.
|
|
7483
|
+
*
|
|
7484
|
+
* @param mandateId - Mandate ID
|
|
7485
|
+
*/
|
|
7486
|
+
get(mandateId: string): Promise<Mandate>;
|
|
7487
|
+
/**
|
|
7488
|
+
* Create a mandate directly.
|
|
7489
|
+
*
|
|
7490
|
+
* Drafts a PENDING mandate from a direct user interaction — no instruction
|
|
7491
|
+
* back-link. Exactly one binding form names the signer the mandate binds:
|
|
7492
|
+
* `payment_agent_id` (hosted convenience — binds that agent's signer and
|
|
7493
|
+
* anchors to the agent's customer), or `signer_id` together with
|
|
7494
|
+
* `customer_id` (any of the client's signers, BYO keys included). The rule
|
|
7495
|
+
* is the one the customer will approve (via `approve`, a recognized signer
|
|
7496
|
+
* other than the bound one, §8).
|
|
7497
|
+
*
|
|
7498
|
+
* @param data - One binding form + rule + optional validity window
|
|
7499
|
+
* @returns The drafted (pending) mandate
|
|
7500
|
+
*/
|
|
7501
|
+
create(data: CreateMandateRequest, options?: RequestOptions): Promise<Mandate>;
|
|
7502
|
+
/**
|
|
7503
|
+
* Approve a mandate.
|
|
7504
|
+
*
|
|
7505
|
+
* A recognized signer OTHER than the bound one signs the mandate payload
|
|
7506
|
+
* (see `mandateSignPayload` + `MandateSigner`) to activate it; arms its
|
|
7507
|
+
* scheduled payments.
|
|
7508
|
+
*
|
|
7509
|
+
* @param mandateId - Mandate ID
|
|
7510
|
+
* @param data - Approver public key (base64 PKIX) + base64 ASN.1 signature
|
|
7511
|
+
*/
|
|
7512
|
+
approve(mandateId: string, data: ApproveMandateRequest, options?: RequestOptions): Promise<MandateResponse>;
|
|
7513
|
+
/**
|
|
7514
|
+
* Cancel a mandate.
|
|
7515
|
+
*
|
|
7516
|
+
* Revokes a pending or active mandate. The canceller must be a recognized
|
|
7517
|
+
* signer OTHER than the bound one, with a valid signature over the mandate
|
|
7518
|
+
* payload — the bound signer can never mutate its own mandate.
|
|
7519
|
+
*
|
|
7520
|
+
* @param mandateId - Mandate ID
|
|
7521
|
+
* @param data - Signer public key (base64 PKIX) + base64 ASN.1 signature
|
|
7522
|
+
*/
|
|
7523
|
+
cancel(mandateId: string, data: CancelMandateRequest, options?: RequestOptions): Promise<MandateResponse>;
|
|
7524
|
+
}
|
|
7525
|
+
|
|
7526
|
+
/**
|
|
7527
|
+
* Scheduled Payments resource (ALPHA).
|
|
7528
|
+
*
|
|
7529
|
+
* Agentic payments is an alpha surface (x-alpha, flag-gated on the platform)
|
|
7530
|
+
* and may change without a major-version bump.
|
|
7531
|
+
*/
|
|
7532
|
+
|
|
7533
|
+
/**
|
|
7534
|
+
* Scheduled Payments API resource (ALPHA).
|
|
7535
|
+
*/
|
|
7536
|
+
declare class ScheduledPaymentsResource extends BaseResource {
|
|
7537
|
+
/**
|
|
7538
|
+
* List scheduled payments (oldest due first).
|
|
7539
|
+
*
|
|
7540
|
+
* Narrow the collection with the optional customer_id, signer_id,
|
|
7541
|
+
* wallet_id, mandate_id, and status filters; omit them all for the full
|
|
7542
|
+
* client collection.
|
|
7543
|
+
*
|
|
7544
|
+
* @param params - Optional pagination + filter parameters
|
|
7545
|
+
* @returns Async iterator of scheduled payments
|
|
7546
|
+
*/
|
|
7547
|
+
list(params?: ScheduledPaymentListParams): PaginatedIterator<ScheduledPayment>;
|
|
7548
|
+
/**
|
|
7549
|
+
* Schedule payments directly — bypass the proposal flow.
|
|
7550
|
+
*
|
|
7551
|
+
* Creates one or more scheduled payments for a signer under an existing
|
|
7552
|
+
* active mandate (coverage is matched at fire time, so no new signature
|
|
7553
|
+
* is needed here). The schedule is explicit `dates` OR `count` ×
|
|
7554
|
+
* `interval_seconds` from `start_at`.
|
|
7555
|
+
*
|
|
7556
|
+
* @param data - Signer + wallet + destination (or address+network_id) + schedule
|
|
7557
|
+
* @returns The rows that were created (one per date)
|
|
7558
|
+
*/
|
|
7559
|
+
create(data: CreateScheduledPaymentRequest, options?: RequestOptions): Promise<ScheduledPayment[]>;
|
|
7560
|
+
/**
|
|
7561
|
+
* Cancel one still-scheduled payment.
|
|
7562
|
+
*
|
|
7563
|
+
* Finalizes the row as cancelled. No signature is required — schedule rows
|
|
7564
|
+
* are bookkeeping, not authorization; the signed grant is the MANDATE,
|
|
7565
|
+
* which this does not touch.
|
|
7566
|
+
*
|
|
7567
|
+
* @param scheduledPaymentId - Scheduled payment ID
|
|
7568
|
+
*/
|
|
7569
|
+
cancel(scheduledPaymentId: string, options?: RequestOptions): Promise<void>;
|
|
7570
|
+
}
|
|
7571
|
+
|
|
7572
|
+
/**
|
|
7573
|
+
* Insights resource (ALPHA).
|
|
7574
|
+
*
|
|
7575
|
+
* Agentic payments is an alpha surface (x-alpha, flag-gated on the platform)
|
|
7576
|
+
* and may change without a major-version bump.
|
|
7577
|
+
*/
|
|
7578
|
+
|
|
7579
|
+
/**
|
|
7580
|
+
* Insights API resource (ALPHA).
|
|
7581
|
+
*
|
|
7582
|
+
* Read-only, advisory reporting over a customer's agentic activity. Nothing
|
|
7583
|
+
* here moves money or changes state.
|
|
7584
|
+
*/
|
|
7585
|
+
declare class InsightsResource extends BaseResource {
|
|
7586
|
+
/**
|
|
7587
|
+
* Get the customer's account insight report.
|
|
7588
|
+
*
|
|
7589
|
+
* A deterministic, read-only report: a snapshot of typed facts
|
|
7590
|
+
* (funding-wallet balances, upcoming totals, open payments, active
|
|
7591
|
+
* mandates), observations (`insights`), and advisory recommendations
|
|
7592
|
+
* (`suggestions`). Every item carries `evidence` — typed references to
|
|
7593
|
+
* the platform objects it was computed from. `kind` is an OPEN set;
|
|
7594
|
+
* ignore kinds you do not recognize.
|
|
7595
|
+
*
|
|
7596
|
+
* @param customerId - Customer ID
|
|
7597
|
+
* @returns The customer's insight report
|
|
7598
|
+
*/
|
|
7599
|
+
get(customerId: string): Promise<InsightReport>;
|
|
7600
|
+
/**
|
|
7601
|
+
* Ask about the customer's account.
|
|
7602
|
+
*
|
|
7603
|
+
* A read-only, advisory conversation. Stateless: send the conversation so
|
|
7604
|
+
* far in `messages` on each call; the response is the assistant's next
|
|
7605
|
+
* plain-text `reply`. The assistant narrates the same deterministic report
|
|
7606
|
+
* {@link get} returns — it never originates a number, never proposes, and
|
|
7607
|
+
* never moves money. Rate-limited per customer (hourly burst + daily
|
|
7608
|
+
* window) — a 429 means back off and retry later.
|
|
7609
|
+
*
|
|
7610
|
+
* @param customerId - Customer ID
|
|
7611
|
+
* @param data - The conversation so far (1–40 messages)
|
|
7612
|
+
* @returns The assistant's reply (+ how the boundary screen treated the turn)
|
|
7613
|
+
*/
|
|
7614
|
+
chat(customerId: string, data: InsightChatRequest, options?: RequestOptions): Promise<InsightChatResponse>;
|
|
7615
|
+
}
|
|
7616
|
+
|
|
7617
|
+
/**
|
|
7618
|
+
* Multi-turn agent chat. The platform's proposals endpoint is STATELESS —
|
|
7619
|
+
* it holds no session and must be sent the whole transcript on every turn.
|
|
7620
|
+
* `AgentConversation` hides that bookkeeping so a caller just sends user
|
|
7621
|
+
* messages and reads the agent's clarifying questions / final proposals.
|
|
7622
|
+
*
|
|
7623
|
+
* Agentic payments is an alpha surface (x-alpha, flag-gated on the platform)
|
|
7624
|
+
* and may change without a major-version bump.
|
|
7625
|
+
*/
|
|
7626
|
+
|
|
7627
|
+
/**
|
|
7628
|
+
* MIME types the platform accepts for a document attachment.
|
|
7629
|
+
*/
|
|
7630
|
+
type AttachmentMediaType = 'application/pdf' | 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
|
|
7631
|
+
/**
|
|
7632
|
+
* An input artifact on a user turn for the agent to read — today a document
|
|
7633
|
+
* (a PDF or image, e.g. an invoice to draft a payment from). `data` is the
|
|
7634
|
+
* RAW document bytes; the SDK base64-encodes them on the wire.
|
|
7635
|
+
*/
|
|
7636
|
+
interface Attachment {
|
|
7637
|
+
mediaType: AttachmentMediaType;
|
|
7638
|
+
/** raw document bytes (not base64) */
|
|
7639
|
+
data: Uint8Array;
|
|
7640
|
+
/** optional, for display/audit */
|
|
7641
|
+
filename?: string;
|
|
7642
|
+
}
|
|
7643
|
+
/**
|
|
7644
|
+
* One turn of an agent conversation.
|
|
7645
|
+
*/
|
|
7646
|
+
interface ChatMessage {
|
|
7647
|
+
role: 'user' | 'assistant';
|
|
7648
|
+
content: string;
|
|
7649
|
+
/**
|
|
7650
|
+
* Input artifacts attached to this turn for the agent to investigate.
|
|
7651
|
+
* Attachments ride only on the turn they are passed; they are NOT
|
|
7652
|
+
* persisted in the transcript.
|
|
7653
|
+
*/
|
|
7654
|
+
attachments?: Attachment[];
|
|
7655
|
+
}
|
|
7656
|
+
/**
|
|
7657
|
+
* The agent's response to one user message.
|
|
7658
|
+
*/
|
|
7659
|
+
interface ConversationTurn {
|
|
7660
|
+
/**
|
|
7661
|
+
* The agent's conversational text — a clarifying question or a
|
|
7662
|
+
* confirmation. May be empty when only proposals are returned.
|
|
7663
|
+
*/
|
|
7664
|
+
reply: string;
|
|
7665
|
+
/**
|
|
7666
|
+
* The reviewable action series, present once the agent reaches high
|
|
7667
|
+
* confidence. Accept it via the instructions flow.
|
|
7668
|
+
*/
|
|
7669
|
+
proposals: AgenticProposal[];
|
|
7670
|
+
/** Whether the agent drafted proposals this turn. */
|
|
7671
|
+
hasProposals: boolean;
|
|
7672
|
+
/**
|
|
7673
|
+
* The boundary screen's verdict for this turn: `"ok"` (normal), `"warned"`
|
|
7674
|
+
* (off-topic — the customer was warned), or `"blocked"` (the chat is
|
|
7675
|
+
* terminated; stop serving and offer a fresh conversation). Empty when
|
|
7676
|
+
* the platform sent none.
|
|
7677
|
+
*/
|
|
7678
|
+
conversationStatus: string;
|
|
7679
|
+
}
|
|
7680
|
+
/**
|
|
7681
|
+
* A stateful, multi-turn proposals chat with one agent.
|
|
7682
|
+
*
|
|
7683
|
+
* Keeps the running transcript, appends each user message and the agent's
|
|
7684
|
+
* reply, and resends the whole transcript on every {@link send} — so
|
|
7685
|
+
* callers never deal with the stateless endpoint's "send all history each
|
|
7686
|
+
* time" contract.
|
|
7687
|
+
*
|
|
7688
|
+
* For a stateless backend (one HTTP request per chat message), persist
|
|
7689
|
+
* {@link messages} between requests and rebuild with
|
|
7690
|
+
* {@link DakotaClient.resumeAgentConversation}.
|
|
7691
|
+
*/
|
|
7692
|
+
declare class AgentConversation {
|
|
7693
|
+
private readonly client;
|
|
7694
|
+
private readonly paymentAgentId;
|
|
7695
|
+
private history;
|
|
7696
|
+
constructor(client: DakotaClient, paymentAgentId: string, history?: ChatMessage[]);
|
|
7697
|
+
/**
|
|
7698
|
+
* Adds the user's message to the transcript, asks the agent, records the
|
|
7699
|
+
* agent's reply, and returns the turn. When `hasProposals` is true the
|
|
7700
|
+
* agent has drafted a reviewable action series; otherwise `reply` holds
|
|
7701
|
+
* its next question.
|
|
7702
|
+
*
|
|
7703
|
+
* On error the optimistic user turn is rolled back, so the caller may
|
|
7704
|
+
* retry the same call without duplicating it.
|
|
7705
|
+
*/
|
|
7706
|
+
send(userMessage: string): Promise<ConversationTurn>;
|
|
7707
|
+
/**
|
|
7708
|
+
* {@link send} with documents (e.g. an invoice PDF) attached to the user
|
|
7709
|
+
* turn for the agent to read and draft payments from. Same turn semantics
|
|
7710
|
+
* and rollback-on-error behavior as `send`. Attachments ride only on the
|
|
7711
|
+
* turn they are passed; the stateless transcript keeps the agent's text
|
|
7712
|
+
* reply, so a follow-up turn relies on that summary rather than re-sending
|
|
7713
|
+
* the document.
|
|
7714
|
+
*/
|
|
7715
|
+
sendWithAttachments(userMessage: string, attachments?: Attachment[]): Promise<ConversationTurn>;
|
|
7716
|
+
/**
|
|
7717
|
+
* A copy of the full transcript so far. Persist this between requests in
|
|
7718
|
+
* a stateless backend and rebuild with
|
|
7719
|
+
* {@link DakotaClient.resumeAgentConversation}.
|
|
7720
|
+
*/
|
|
7721
|
+
messages(): ChatMessage[];
|
|
7722
|
+
}
|
|
7723
|
+
|
|
6856
7724
|
/**
|
|
6857
7725
|
* Dakota Platform API Client.
|
|
6858
7726
|
*/
|
|
@@ -6922,6 +7790,16 @@ declare class DakotaClient {
|
|
|
6922
7790
|
readonly sandbox: SandboxResource;
|
|
6923
7791
|
/** Self-Serve Credits API - manage prepaid transfer credits */
|
|
6924
7792
|
readonly selfServe: SelfServeResource;
|
|
7793
|
+
/** Payment Agents API (ALPHA) - hosted signing agents that draft payments */
|
|
7794
|
+
readonly paymentAgents: PaymentAgentsResource;
|
|
7795
|
+
/** Instructions API (ALPHA) - accept and inspect actuated proposals */
|
|
7796
|
+
readonly instructions: InstructionsResource;
|
|
7797
|
+
/** Mandates API (ALPHA) - the §8 authorizations that arm scheduled payments */
|
|
7798
|
+
readonly mandates: MandatesResource;
|
|
7799
|
+
/** Scheduled Payments API (ALPHA) - schedule rows created from instructions */
|
|
7800
|
+
readonly scheduledPayments: ScheduledPaymentsResource;
|
|
7801
|
+
/** Insights API (ALPHA) - read-only advisory reporting over agentic activity */
|
|
7802
|
+
readonly insights: InsightsResource;
|
|
6925
7803
|
/**
|
|
6926
7804
|
* Create a new Dakota client.
|
|
6927
7805
|
*
|
|
@@ -6955,6 +7833,41 @@ declare class DakotaClient {
|
|
|
6955
7833
|
* ```
|
|
6956
7834
|
*/
|
|
6957
7835
|
constructor(config: DakotaClientConfig);
|
|
7836
|
+
/**
|
|
7837
|
+
* Start a fresh multi-turn conversation with a payment agent.
|
|
7838
|
+
*
|
|
7839
|
+
* @see AgentConversation
|
|
7840
|
+
*/
|
|
7841
|
+
newAgentConversation(paymentAgentId: string): AgentConversation;
|
|
7842
|
+
/**
|
|
7843
|
+
* Rebuild a conversation from a persisted transcript (oldest first) —
|
|
7844
|
+
* for backends that store the history between requests.
|
|
7845
|
+
*/
|
|
7846
|
+
resumeAgentConversation(paymentAgentId: string, history: ChatMessage[]): AgentConversation;
|
|
7847
|
+
/**
|
|
7848
|
+
* Grant a principal (user or agent — both are just signers) permission to
|
|
7849
|
+
* spend from a wallet by adding its signer to an EXISTING signer group on
|
|
7850
|
+
* that wallet. Idempotent; errors if the group isn't attached to the wallet.
|
|
7851
|
+
*
|
|
7852
|
+
* @see attachUserToWallet in `agentic/wallets.ts` for the full contract.
|
|
7853
|
+
*/
|
|
7854
|
+
attachUserToWallet(walletId: string, signerPublicKey: string, spendingGroupId: string, options?: {
|
|
7855
|
+
idempotencyKey?: string;
|
|
7856
|
+
}): Promise<{
|
|
7857
|
+
alreadyMember: boolean;
|
|
7858
|
+
}>;
|
|
7859
|
+
/**
|
|
7860
|
+
* Revoke a principal's spend permission by removing its signer from the
|
|
7861
|
+
* given signer group — the inverse of {@link attachUserToWallet}.
|
|
7862
|
+
* Idempotent; errors if the group isn't attached to the wallet.
|
|
7863
|
+
*
|
|
7864
|
+
* @see detachUserFromWallet in `agentic/wallets.ts` for the full contract.
|
|
7865
|
+
*/
|
|
7866
|
+
detachUserFromWallet(walletId: string, signerPublicKey: string, spendingGroupId: string, options?: {
|
|
7867
|
+
idempotencyKey?: string;
|
|
7868
|
+
}): Promise<{
|
|
7869
|
+
wasMember: boolean;
|
|
7870
|
+
}>;
|
|
6958
7871
|
/**
|
|
6959
7872
|
* Get the resolved base URL.
|
|
6960
7873
|
*/
|
|
@@ -7007,4 +7920,268 @@ declare class ConfigurationError extends Error {
|
|
|
7007
7920
|
constructor(message: string);
|
|
7008
7921
|
}
|
|
7009
7922
|
|
|
7010
|
-
|
|
7923
|
+
/**
|
|
7924
|
+
* High-level agentic helpers: collapse the multi-step, crypto-heavy hosted-
|
|
7925
|
+
* agent flows into single calls with good defaults, so a partner integration
|
|
7926
|
+
* stays short. The raw operations remain reachable via the resource classes
|
|
7927
|
+
* on `DakotaClient`.
|
|
7928
|
+
*
|
|
7929
|
+
* Agentic payments is an alpha surface (x-alpha, flag-gated on the platform)
|
|
7930
|
+
* and may change without a major-version bump.
|
|
7931
|
+
*/
|
|
7932
|
+
|
|
7933
|
+
/**
|
|
7934
|
+
* Grant a principal — a user OR an agent, both are just signers — permission
|
|
7935
|
+
* to spend from a wallet by adding its signer to an EXISTING signer group on
|
|
7936
|
+
* that wallet: the group whose attached policies should govern it.
|
|
7937
|
+
*
|
|
7938
|
+
* That membership change is the whole operation, and it is UNENDORSED: group
|
|
7939
|
+
* membership is a client-admin action, not a wallet endorsement, so it needs
|
|
7940
|
+
* NO signature — not from the wallet owner, not from the principal being
|
|
7941
|
+
* added. From then on the principal's transactions are subject to exactly
|
|
7942
|
+
* the policies bound to `spendingGroupId`, the same as any other member of
|
|
7943
|
+
* that group. The per-payment spend bound remains the agentic mandate gate,
|
|
7944
|
+
* not the policy.
|
|
7945
|
+
*
|
|
7946
|
+
* Deliberately reuses the wallet's pre-built policies and creates NO
|
|
7947
|
+
* per-signer policy. Two policy-engine realities make a per-signer policy
|
|
7948
|
+
* the wrong tool: a policy → wallet attach is endorsed by the policy's OWN
|
|
7949
|
+
* signer group (so only that group's key could attach it), and an
|
|
7950
|
+
* unconditional approval-threshold ALLOW policy inverts to a deny for any
|
|
7951
|
+
* transaction its group didn't sign, so a second signer's policy would veto
|
|
7952
|
+
* the first. Prepare the wallet's groups + policies in advance and point
|
|
7953
|
+
* each principal at the group whose constraints you want it to inherit.
|
|
7954
|
+
*
|
|
7955
|
+
* Idempotent: if the signer is already a member, returns
|
|
7956
|
+
* `alreadyMember: true` and makes no write. Rejects `spendingGroupId` if it
|
|
7957
|
+
* is not attached to `walletId`, so a wrong group fails loudly instead of
|
|
7958
|
+
* silently granting nothing.
|
|
7959
|
+
*
|
|
7960
|
+
* The key must already exist as a signer resource — the add endpoint takes
|
|
7961
|
+
* a `member_key` reference, it does not register keys. A hosted agent's key
|
|
7962
|
+
* is minted by `paymentAgents.create`; for a bare user key, register it
|
|
7963
|
+
* first (`POST /signers`) or the add fails with a signer-not-found error.
|
|
7964
|
+
*
|
|
7965
|
+
* @param client - Dakota client
|
|
7966
|
+
* @param walletId - The wallet the principal will spend from
|
|
7967
|
+
* @param signerPublicKey - The principal's registered signer public key
|
|
7968
|
+
* (base64 PKIX) — e.g. `signer_public_key` returned by
|
|
7969
|
+
* `paymentAgents.create` for a hosted agent
|
|
7970
|
+
* @param spendingGroupId - The signer group whose attached policies should
|
|
7971
|
+
* govern the principal; must already be attached to `walletId`
|
|
7972
|
+
* @param options - Optional. Supply `idempotencyKey` (a valid UUID — the
|
|
7973
|
+
* platform rejects other formats with 400) to make the WHOLE helper
|
|
7974
|
+
* safely retryable — a crashed or partitioned call replayed with the
|
|
7975
|
+
* same key dedupes the underlying write server-side. Defaults to a
|
|
7976
|
+
* fresh random UUID per call.
|
|
7977
|
+
* @returns `{ alreadyMember }` — true when the signer was already a member
|
|
7978
|
+
* (no write performed)
|
|
7979
|
+
*/
|
|
7980
|
+
declare function attachUserToWallet(client: DakotaClient, walletId: string, signerPublicKey: string, spendingGroupId: string, options?: {
|
|
7981
|
+
idempotencyKey?: string;
|
|
7982
|
+
}): Promise<{
|
|
7983
|
+
alreadyMember: boolean;
|
|
7984
|
+
}>;
|
|
7985
|
+
/**
|
|
7986
|
+
* Revoke a principal's spend permission by removing its signer from
|
|
7987
|
+
* `spendingGroupId` — the inverse of {@link attachUserToWallet}, and
|
|
7988
|
+
* likewise UNENDORSED (no signature).
|
|
7989
|
+
*
|
|
7990
|
+
* Deliberately SCOPED to the one group you pass, NOT a sweep across every
|
|
7991
|
+
* group on the wallet, for two reasons:
|
|
7992
|
+
* - signer groups are NOT wallet-exclusive — the same group can govern
|
|
7993
|
+
* multiple wallets — so removing a signer from a group revokes it on
|
|
7994
|
+
* EVERY wallet that group governs; passing one explicit group keeps
|
|
7995
|
+
* that blast radius known instead of multiplying it across all of the
|
|
7996
|
+
* wallet's groups;
|
|
7997
|
+
* - a sweep cannot tell "added for this agent" from "belongs here for
|
|
7998
|
+
* another reason" (e.g. the human owner sitting in the admin group),
|
|
7999
|
+
* so it can lock out a legitimate member.
|
|
8000
|
+
*
|
|
8001
|
+
* Pass the same group you used to attach. Idempotent: if the signer isn't
|
|
8002
|
+
* a member, it is a no-op (`wasMember: false`). Rejects `spendingGroupId`
|
|
8003
|
+
* if it is not attached to `walletId`.
|
|
8004
|
+
*
|
|
8005
|
+
* NOTE: this does not guard against removing a group's LAST member —
|
|
8006
|
+
* emptying the group that governs a wallet can leave it with no authorized
|
|
8007
|
+
* signer. The caller must avoid stranding the wallet. For a hosted agent,
|
|
8008
|
+
* prefer `paymentAgents.revoke` (it destroys the agent's key, so the signer
|
|
8009
|
+
* can authorize nothing even while still listed) and use this for
|
|
8010
|
+
* membership hygiene.
|
|
8011
|
+
*
|
|
8012
|
+
* @param options - Optional. Supply `idempotencyKey` (a valid UUID) to
|
|
8013
|
+
* make the WHOLE helper safely retryable across crashes/partitions;
|
|
8014
|
+
* defaults to a fresh random UUID per call.
|
|
8015
|
+
*/
|
|
8016
|
+
declare function detachUserFromWallet(client: DakotaClient, walletId: string, signerPublicKey: string, spendingGroupId: string, options?: {
|
|
8017
|
+
idempotencyKey?: string;
|
|
8018
|
+
}): Promise<{
|
|
8019
|
+
wasMember: boolean;
|
|
8020
|
+
}>;
|
|
8021
|
+
|
|
8022
|
+
/**
|
|
8023
|
+
* §8 mandate signing. Approving (or cancelling) a mandate is not a bare API
|
|
8024
|
+
* call: it requires a cryptographic signature over the mandate's canonical
|
|
8025
|
+
* bytes, proving the action came from a holder of the registered key. This
|
|
8026
|
+
* file reproduces the platform's exact signed payload (RFC 8785 / JCS
|
|
8027
|
+
* canonical JSON) and a P-256 signing/verification path, so partners never
|
|
8028
|
+
* hand-roll JCS + ECDSA.
|
|
8029
|
+
*
|
|
8030
|
+
* The canonical bytes a signature covers — matched byte-for-byte with the
|
|
8031
|
+
* platform's MandatePayload — are JCS JSON of:
|
|
8032
|
+
*
|
|
8033
|
+
* {action, id, bound_signer, rule, valid_from, valid_until}
|
|
8034
|
+
*
|
|
8035
|
+
* signed as base64( ASN.1( ECDSA-P256( SHA-256(payload) ))), with the public
|
|
8036
|
+
* key as base64 PKIX (SPKI).
|
|
8037
|
+
*
|
|
8038
|
+
* Agentic payments is an alpha surface (x-alpha, flag-gated on the platform)
|
|
8039
|
+
* and may change without a major-version bump.
|
|
8040
|
+
*/
|
|
8041
|
+
|
|
8042
|
+
/**
|
|
8043
|
+
* The §8 verb a signature authorizes. It is part of the signed payload so
|
|
8044
|
+
* an approval and a cancellation can never be each other's replay: a signed
|
|
8045
|
+
* cancel must not be byte-identical to a signed approve.
|
|
8046
|
+
*/
|
|
8047
|
+
type MandateAction = 'approve' | 'cancel';
|
|
8048
|
+
/**
|
|
8049
|
+
* Produces the §8 signature the platform verifies for a mandate
|
|
8050
|
+
* approve/cancel. The caller holds the private key; the SDK never sees it.
|
|
8051
|
+
*
|
|
8052
|
+
* Implement this over your own key custody (HSM/KMS) for production. For
|
|
8053
|
+
* sandbox and tests, `P256MandateSigner` is a ready in-memory implementation.
|
|
8054
|
+
*/
|
|
8055
|
+
interface MandateSigner {
|
|
8056
|
+
/**
|
|
8057
|
+
* The base64 PKIX (SPKI) P-256 public key — the exact form the platform
|
|
8058
|
+
* registered for this signer and verifies signatures against.
|
|
8059
|
+
*/
|
|
8060
|
+
publicKeyBase64(): string;
|
|
8061
|
+
/**
|
|
8062
|
+
* Returns a base64 ASN.1 ECDSA signature over SHA-256(payload).
|
|
8063
|
+
*/
|
|
8064
|
+
sign(payload: Uint8Array): Promise<string> | string;
|
|
8065
|
+
}
|
|
8066
|
+
/**
|
|
8067
|
+
* Reproduces, byte-for-byte, the canonical bytes the platform signs for one
|
|
8068
|
+
* §8 action on a mandate. Build it straight from the mandate as returned by
|
|
8069
|
+
* `mandates.get` / `mandates.list` — no server state is needed, and field
|
|
8070
|
+
* order is irrelevant (JCS sorts).
|
|
8071
|
+
*
|
|
8072
|
+
* `valid_from` / `valid_until` are always present in the signed payload
|
|
8073
|
+
* (even when zero); the wire omits a zero value, so a missing field
|
|
8074
|
+
* canonicalizes to 0 — matching the platform, which signs the int64
|
|
8075
|
+
* directly.
|
|
8076
|
+
*/
|
|
8077
|
+
declare function mandateSignPayload(mandate: Mandate, action: MandateAction): Uint8Array;
|
|
8078
|
+
/**
|
|
8079
|
+
* Canonical bytes a recognized wallet signer endorses to attach a signer
|
|
8080
|
+
* group to a wallet.
|
|
8081
|
+
*/
|
|
8082
|
+
declare function attachGroupPayload(walletId: string, groupId: string, idempotencyKey: string): Uint8Array;
|
|
8083
|
+
/**
|
|
8084
|
+
* Canonical bytes a recognized wallet signer endorses to attach a policy to
|
|
8085
|
+
* a wallet.
|
|
8086
|
+
*/
|
|
8087
|
+
declare function attachPolicyPayload(walletId: string, policyId: string, idempotencyKey: string): Uint8Array;
|
|
8088
|
+
/**
|
|
8089
|
+
* Canonical bytes a recognized wallet signer endorses to remove a signer
|
|
8090
|
+
* group from a wallet — the inverse of {@link attachGroupPayload}.
|
|
8091
|
+
*/
|
|
8092
|
+
declare function detachGroupPayload(walletId: string, groupId: string, idempotencyKey: string): Uint8Array;
|
|
8093
|
+
/**
|
|
8094
|
+
* Canonical bytes a recognized wallet signer endorses to remove a policy
|
|
8095
|
+
* from a wallet — the inverse of {@link attachPolicyPayload}.
|
|
8096
|
+
*/
|
|
8097
|
+
declare function detachPolicyPayload(walletId: string, policyId: string, idempotencyKey: string): Uint8Array;
|
|
8098
|
+
/**
|
|
8099
|
+
* Canonical bytes a member of the policy's governing signer group endorses
|
|
8100
|
+
* to delete a policy.
|
|
8101
|
+
*/
|
|
8102
|
+
declare function deletePolicyPayload(policyId: string, idempotencyKey: string): Uint8Array;
|
|
8103
|
+
/**
|
|
8104
|
+
* Canonical bytes a member of the policy's governing signer group endorses
|
|
8105
|
+
* to remove a rule from a policy.
|
|
8106
|
+
*/
|
|
8107
|
+
declare function removePolicyRulePayload(policyId: string, ruleId: string, idempotencyKey: string): Uint8Array;
|
|
8108
|
+
/**
|
|
8109
|
+
* Canonical bytes a member of the policy's governing signer group endorses
|
|
8110
|
+
* to update a rule's definition. `updatedDefinition` is the rule definition
|
|
8111
|
+
* as a JSON STRING; it is signed opaquely, exactly as sent on the update
|
|
8112
|
+
* request.
|
|
8113
|
+
*/
|
|
8114
|
+
declare function updatePolicyRulePayload(policyId: string, ruleId: string, updatedDefinition: string, idempotencyKey: string): Uint8Array;
|
|
8115
|
+
/**
|
|
8116
|
+
* Canonical bytes a member of the policy's governing signer group endorses
|
|
8117
|
+
* to add a rule to a policy. `action` (e.g. `"allow"`), `ruleType` (e.g.
|
|
8118
|
+
* `"amount_threshold"`), and `definition` (the rule-type-specific config,
|
|
8119
|
+
* in API format) must match the values sent on the add request, or the
|
|
8120
|
+
* endorsement won't verify against it.
|
|
8121
|
+
*/
|
|
8122
|
+
declare function addPolicyRulePayload(policyId: string, action: string, ruleType: string, definition: Record<string, unknown>, idempotencyKey: string): Uint8Array;
|
|
8123
|
+
/**
|
|
8124
|
+
* A {@link MandateSigner} holding a P-256 (ES256) private key in memory.
|
|
8125
|
+
*
|
|
8126
|
+
* Convenient for sandbox and tests; for production, implement
|
|
8127
|
+
* {@link MandateSigner} over your own key custody so the private key never
|
|
8128
|
+
* lives in the process.
|
|
8129
|
+
*/
|
|
8130
|
+
declare class P256MandateSigner implements MandateSigner {
|
|
8131
|
+
private readonly privateKey;
|
|
8132
|
+
private readonly publicKey;
|
|
8133
|
+
private constructor();
|
|
8134
|
+
/**
|
|
8135
|
+
* Generate a fresh P-256 keypair.
|
|
8136
|
+
*/
|
|
8137
|
+
static generate(): P256MandateSigner;
|
|
8138
|
+
/**
|
|
8139
|
+
* Adopt an existing P-256 private key. Accepts a PKCS#8 PEM string, a
|
|
8140
|
+
* DER-encoded PKCS#8 buffer, or a Node {@link KeyObject}.
|
|
8141
|
+
*/
|
|
8142
|
+
static fromPrivateKey(key: KeyObject | string | Uint8Array): P256MandateSigner;
|
|
8143
|
+
/**
|
|
8144
|
+
* base64 PKIX (SPKI) public key — pass this as the signer's registered
|
|
8145
|
+
* public key at agent creation / mandate approval.
|
|
8146
|
+
*/
|
|
8147
|
+
publicKeyBase64(): string;
|
|
8148
|
+
/**
|
|
8149
|
+
* Returns base64( ASN.1 ECDSA signature over SHA-256(payload) ).
|
|
8150
|
+
*/
|
|
8151
|
+
sign(payload: Uint8Array): string;
|
|
8152
|
+
}
|
|
8153
|
+
/**
|
|
8154
|
+
* Check a base64 ASN.1 signature over SHA-256 of the canonical payload
|
|
8155
|
+
* against a base64 PKIX P-256 public key — the platform's exact
|
|
8156
|
+
* verification. Exposed so callers (and tests) can self-check a signature
|
|
8157
|
+
* before submitting it.
|
|
8158
|
+
*
|
|
8159
|
+
* @throws if the public key or signature can't be parsed, or the signature
|
|
8160
|
+
* does not verify against the payload.
|
|
8161
|
+
*/
|
|
8162
|
+
declare function verifyMandateSignature(publicKeyBase64: string, payload: Uint8Array, signatureBase64: string): void;
|
|
8163
|
+
|
|
8164
|
+
/**
|
|
8165
|
+
* RFC 8785 (JCS) canonical JSON — the exact bytes the platform signs.
|
|
8166
|
+
*
|
|
8167
|
+
* A payload canonicalized here matches the platform's `enc.C14nJSON`
|
|
8168
|
+
* (json.Marshal + jsoncanonicalizer.Transform) byte-for-byte, so a
|
|
8169
|
+
* signature produced from the result verifies server-side.
|
|
8170
|
+
*
|
|
8171
|
+
* This implementation covers the value shapes the SDK ever puts into a
|
|
8172
|
+
* signed payload: nulls, booleans, finite integers/floats, strings,
|
|
8173
|
+
* arrays, and plain object maps. It intentionally does NOT handle
|
|
8174
|
+
* non-integer numbers with fractional parts differently from
|
|
8175
|
+
* JSON.stringify, because every mandate/endorsement payload the SDK
|
|
8176
|
+
* produces uses only integers, strings, arrays, and object maps — decimal
|
|
8177
|
+
* amounts are always sent as strings.
|
|
8178
|
+
*/
|
|
8179
|
+
/**
|
|
8180
|
+
* RFC 8785 (JCS) canonicalize `value` and return its bytes as a UTF-8 string.
|
|
8181
|
+
*
|
|
8182
|
+
* @throws if `value` contains a non-finite number, a Symbol, a bigint, or a
|
|
8183
|
+
* circular reference — any of which cannot be encoded to canonical JSON.
|
|
8184
|
+
*/
|
|
8185
|
+
declare function canonicalJSON(value: unknown): string;
|
|
8186
|
+
|
|
8187
|
+
export { APIError, type Account, type AccountCreateRequest, type AccountListParams, type AccountUpdateRequest, AccountsResource, type Address, type AdvanceSimulationRequest, type AdvanceSimulationResult, AgentConversation, type AgenticAction, type AgenticActionDownstream, type AgenticInstruction, type AgenticInstructionsResult, type AgenticProposal, type AgenticProposalsResult, type ApiKey, type ApiKeyCreateRequest, type ApiKeyResponse, ApiKeysResource, type Application, type ApplicationDocumentType, type ApplicationDocumentUploadRequest, type ApplicationDocumentUploadUrlRequest, type ApplicationListItem, type ApplicationStatus, type ApplicationSubmissionRequest, ApplicationsResource, type ApproveMandateRequest, type AssociatedIndividual, type AssociatedIndividualRequest, type AttachedPolicy, type AttachedWallet, type Attachment, type AttachmentMediaType, type AttestationSubmitRequest, type AttestationType, AuthMode, type AutoTransaction, AutoTransactionsResource, type AverageMonthlyRevenue, type BulkImportSumsubTokensRequest, type BulkImportSumsubTokensResponse, type BulkImportSumsubTokensResult, type BusinessApplicationCreateRequest, type BusinessDetailsResponse, type BusinessPurposeOfAccount, type BusinessSourceOfFunds, type CancelMandateRequest, type ChatMessage, type ClientPricingConfig, ConfigurationError, type ConversationTurn, type Country, type CreateApiKeyForClientRequest, type CreateInstructionsRequest, type CreateMandateRequest, type CreateProposalsRequest, type CreateScheduledPaymentRequest, type CryptoDestination, type CryptoDestinationRequest, type CursorExtractor, type Customer, type CustomerCreateRequest, type CustomerCreateResponse, type CustomerListParams, CustomersResource, DEFAULT_RETRY_POLICY, DakotaClient, type DakotaClientConfig, type Destination, type DestinationCreateResponse, type DestinationRequest, DestinationsResource, type DocumentUploadResponse, type DocumentUploadUrlResponse, type EDDRequest, type EDDWithApplicationID, type EmploymentStatus, type EndorsedRequest, Environment, type Event, type EventListParams, type EventType, EventsResource, type ExpectedMonthlyDeposit, type Family, type FiatUSDestination, type FiatUSDestinationRequest, type IndividualDetailsResponse, type IndividualDocumentType, type IndividualDocumentUploadRequest, type IndividualDocumentUploadUrlRequest, type IndividualRequest, type IndividualRole, type IndividualTitle, InfoResource, type InsightChatMessage, type InsightChatRequest, type InsightChatResponse, type InsightEvidence, type InsightItem, type InsightReport, type InsightSnapshot, InsightsResource, InstructionsResource, type KSUID, type KybStatus, type LegalStructure, type ListParams, type Logger, type Mandate, type MandateAction, type MandateListParams, type MandateResponse, type MandateRule, type MandateSigner, MandatesResource, type Meta, type Network, type NetworkId, type OfframpAccount, type OfframpAccountCreateRequest, type OneOffTransaction, type OneOffTransactionRequest, type OnrampAccount, type OnrampAccountCreateRequest, P256MandateSigner, type PageFetcher, PaginatedIterator, type PaginatedResponse, type PaginationMeta, type PaginationParams, type PaymentAgent, type PaymentAgentCreateRequest, type PaymentAgentSignerGroupRef, PaymentAgentsResource, type PaymentCapability, type PersonName, PoliciesResource, type Policy, type PolicyCreateRequest, type PolicyRule, type PolicyRuleCreateRequest, type Recipient, type RecipientRequest, type RecipientUpdateRequest, RecipientsResource, type RequestOptions, type ResolvedConfig, type RetryPolicy, SandboxResource, type SandboxScenario, type ScheduledPayment, type ScheduledPaymentListParams, ScheduledPaymentsResource, type SelfServeCreditTier, type SelfServeCreditTiersResponse, type SelfServeCreditsBalanceResponse, type SelfServeCreditsLedgerEntry, type SelfServeCreditsLedgerEntryType, type SelfServeCreditsLedgerParams, type SelfServeCreditsLedgerResponse, type SelfServeCreditsPricingResponse, type SelfServeCreditsPurchaseRequest, type SelfServeCreditsPurchaseResponse, SelfServeResource, type SendTransactionIntent, type Signer, type SignerCreateRequest, type SignerGroup, type SignerGroupCreateRequest, type SignerGroupSignerAddRequest, SignerGroupsResource, SignersResource, type SimulateInboundRequest, type SimulateInboundType, type SimulateOnboardingRequest, type SimulateOnboardingResponse, type SimulateOnboardingType, type SimulationCallbackRecord, type SimulationInspection, type SimulationResponse, type SubClientSummary, type SwapAccount, type SwapAccountCreateRequest, type TransactionListParams, type TransactionStatus, TransactionsResource, TransportError, type UpdateCustomerSubClientRequest, type UploadedDocumentMetadata, type User, type UserCreateRequest, type UserUpdateRequest, UsersResource, type Wallet, type WalletBalance, type WalletBalances, type WalletCreateRequest, type WalletTransaction, type WalletTransactionRequest, WalletsResource, type WebhookEvent, type WebhookHistoryList, type WebhookHistoryListParams, type WebhookHistoryResponse, type WebhookReplayResponse, type WebhookTarget, type WebhookTargetCreateRequest, type WebhookTargetUpdateRequest, WebhooksResource, addPolicyRulePayload, attachGroupPayload, attachPolicyPayload, attachUserToWallet, canonicalJSON, consoleLogger, deletePolicyPayload, detachGroupPayload, detachPolicyPayload, detachUserFromWallet, getEnvironmentURL, mandateSignPayload, noopLogger, paginate, removePolicyRulePayload, updatePolicyRulePayload, verifyMandateSignature };
|