@atumlabs/payment-gateway-client 3.0.1 → 4.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/CHANGELOG.md +37 -0
- package/README.md +27 -6
- package/dist/cli/approve-permit2.js +6174 -1070
- package/dist/cli/payment-status.js +5968 -1075
- package/dist/cli/quote-status.js +5954 -1074
- package/dist/cli/request-quote.js +5954 -1074
- package/dist/cli/send-payment.js +6372 -1230
- package/dist/index.d.ts +294 -403
- package/dist/index.js +6650 -1260
- package/dist/{sender-auth-verify-C-Q-zvAO.d.ts → sender-auth-verify-CEf7FN6s.d.ts} +349 -46
- package/dist/signing.d.ts +2 -2
- package/dist/signing.js +14987 -1519
- package/docs/idempotency.md +6 -4
- package/docs/signing.md +45 -42
- package/package.json +8 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
-
import {
|
|
3
|
-
export { $ as $OpenApiTs, A as AuthTerms,
|
|
2
|
+
import { h as AuthorizePaymentData, i as AuthorizePaymentResponse, G as GetDefaultsData, j as GetDefaultsResponse, H as HealthCheckResponse, k as SubmitPaymentData, l as SubmitPaymentResponse, m as GetPaymentStatusData, n as GetPaymentStatusResponse2, R as ResolvePaymentData, o as ResolvePaymentResponse2, p as GetPaymentTimelineData, q as GetPaymentTimelineResponse, r as PreparePaymentData, s as PreparePaymentResponse2, t as CreateQuoteRequestData, u as CreateQuoteRequestResponse, w as GetQuoteRequestStatusData, x as GetQuoteRequestStatusResponse, y as AwardQuoteData, z as AwardQuoteResponse, B as SignedMessage, E as ErrorResponse, P as PaymentRequest, D as CreateQuoteRequest } from './sender-auth-verify-CEf7FN6s.js';
|
|
3
|
+
export { $ as $OpenApiTs, A as AuthTerms, F as AuthorizationResult, I as AwardAccepted, J as AwardRequest, K as AwardResponse, L as AwardedPayment, M as AwardedQuote, N as BidAward, O as ChainDefaultsByChain, Q as ChainDefaultsWire, C as CommitmentOutcome, a as CommitmentResult, T as DataIntegrityProof, U as DeclineReason, W as DeclineSummaryEntry, X as FulfillmentAuthorization, Y as FulfillmentConfirmation, Z as GetDefaultsResult, _ as GetPaymentStatusResponse, a0 as OwnedAsset, b as ParsedPermit, a1 as PaymentBlockchainContext, a2 as PaymentFailure, a3 as PaymentResponse, a4 as PaymentStatus, a5 as PaymentSummary, a6 as PaymentTimelineResponse, a7 as PaymentTransaction, a8 as PaymentTransactions, a9 as PreparePaymentRequest, aa as PreparePaymentResponse, ab as Quote, ac as QuoteRequestAccepted, ad as QuoteRequestResponse, ae as QuoteRequestStatusResponse, af as RefundSignature, ag as ResolvePaymentResponse, ah as SenderAuth, ai as SenderAuthMessageScheme, S as SolanaDomain, aj as TimelineStep, ak as VerifiableCredential, al as VerifiableCredentialAuth, V as VerifiedSenderAuth, c as VerifyPaymentRequestExpectations, d as VerifyResult, am as deposit, an as domain, ao as error_code, ap as fulfill, aq as reserve, ar as scheme, as as status, at as status2, au as status3, av as status4, aw as status5, ax as status6, ay as status7 } from './sender-auth-verify-CEf7FN6s.js';
|
|
4
4
|
import { Signer } from 'ethers';
|
|
5
5
|
|
|
6
6
|
type ApiRequestOptions = {
|
|
@@ -376,25 +376,17 @@ interface ChainDefaults {
|
|
|
376
376
|
fulfillmentProxy: string;
|
|
377
377
|
permit2Contract?: string;
|
|
378
378
|
/**
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
* same fact in `svmSignatureDomainVersion` below.
|
|
382
|
-
*
|
|
383
|
-
* `4` and above select the four-member witness
|
|
384
|
-
* (`depositRequestHash`, `destination`, `reserver`, `releaser`); `3` selects the two-member
|
|
385
|
-
* witness a not-yet-redeployed escrow pins. ABSENT means four — see the sender-auth package's
|
|
386
|
-
* `ChainDefaults.depositWitnessVersion` for why absence is the permissive default.
|
|
387
|
-
*
|
|
388
|
-
* Passed through to the sender_auth adapter verbatim; this type only has to carry it.
|
|
389
|
-
*/
|
|
390
|
-
depositWitnessVersion?: number;
|
|
391
|
-
/**
|
|
392
|
-
* V3 Solana escrow domain-separation fields, surfaced by payment-gw
|
|
393
|
-
* `/v1/defaults` for Solana source chains. Used to build the EscrowDomain that the
|
|
394
|
-
* V3 deposit hash binds to. Absent for EVM/Tron.
|
|
379
|
+
* Solana escrow domain-separation fields, used to build the EscrowDomain the deposit hash
|
|
380
|
+
* binds to. Absent for EVM/Tron.
|
|
395
381
|
*/
|
|
396
382
|
svmSignatureClusterId?: string;
|
|
397
383
|
svmSignatureDomainVersion?: number;
|
|
384
|
+
/**
|
|
385
|
+
* The depositRequestHash version to sign for a deposit from this chain: 1, keccak256 of the
|
|
386
|
+
* request_id, or 2, the hash of the request's terms. `preparePaymentRequest` signs v2 only for 2;
|
|
387
|
+
* absent, 1 or a version this build does not know signs v1.
|
|
388
|
+
*/
|
|
389
|
+
depositRequestHashVersion?: number;
|
|
398
390
|
}
|
|
399
391
|
|
|
400
392
|
interface Logger {
|
|
@@ -526,6 +518,8 @@ declare function createSenderSigner(sourceChainId: string, opts: SenderSignerOpt
|
|
|
526
518
|
*/
|
|
527
519
|
declare function resolveTurnkeyAddresses(cfg: Omit<TurnkeyConfig, 'pinnedAddress'>): Promise<Record<string, string>>;
|
|
528
520
|
|
|
521
|
+
declare const VERSION = "1.3";
|
|
522
|
+
|
|
529
523
|
/**
|
|
530
524
|
* CAIP-19 asset identifier parsing, backing the caller-facing entry points.
|
|
531
525
|
*
|
|
@@ -588,6 +582,20 @@ declare function parseAssetIdentifier(value: unknown): ParsedAssetIdentifier;
|
|
|
588
582
|
*/
|
|
589
583
|
declare function assetChainId(value: unknown): string;
|
|
590
584
|
|
|
585
|
+
/**
|
|
586
|
+
* Derive a `max_source_amount` from a settler's quoted `source_amount` plus a slippage
|
|
587
|
+
* tolerance in basis points.
|
|
588
|
+
*
|
|
589
|
+
* Input and output are both in the SOURCE token's smallest units: the exchange rate is already
|
|
590
|
+
* inside the quote, so no decimals or price are needed and none are guessed. The result rounds
|
|
591
|
+
* up, because a cap one unit below quote-plus-tolerance would refuse the fill the caller agreed to.
|
|
592
|
+
*
|
|
593
|
+
* @param sourceAmount The quoted `source_amount`, a positive integer in source smallest units.
|
|
594
|
+
* @param slippageBps Headroom above the quote, whole basis points in [0, 10000].
|
|
595
|
+
* @returns The cap as a canonical base-10 integer string.
|
|
596
|
+
*/
|
|
597
|
+
declare function capFromQuote(sourceAmount: string | bigint, slippageBps: number): string;
|
|
598
|
+
|
|
591
599
|
/**
|
|
592
600
|
* The frozen rejection taxonomy. These strings are part of the cross-language contract: Go must
|
|
593
601
|
* reject the same input with the same reason.
|
|
@@ -652,7 +660,7 @@ declare const $AuthorizationResult: {
|
|
|
652
660
|
declare const $PaymentRequest: {
|
|
653
661
|
readonly description: "Structured payment request with sender authorization and optional W3C Verifiable Credentials";
|
|
654
662
|
readonly type: "object";
|
|
655
|
-
readonly required: readonly ["version", "request_id", "source", "destination", "fulfillment_amount", "sender_auth", "quote_deadline", "fulfillment_deadline"];
|
|
663
|
+
readonly required: readonly ["version", "request_id", "source", "destination", "fulfillment_amount", "sender_auth", "quote_deadline", "fulfillment_deadline", "fulfillment_verifier", "escrow_contract_address"];
|
|
656
664
|
readonly properties: {
|
|
657
665
|
readonly version: {
|
|
658
666
|
readonly type: "string";
|
|
@@ -690,7 +698,7 @@ declare const $PaymentRequest: {
|
|
|
690
698
|
readonly quote_deadline: {
|
|
691
699
|
readonly type: "string";
|
|
692
700
|
readonly format: "date-time";
|
|
693
|
-
readonly description: "Required. The deadline for receiving price quotes from settlement providers. After this\npoint no new quotes are accepted. The gateway injects no default and validates the value\nis in the future. The originator must supply it, and a request that omits it or supplies\na past value is rejected with 400.";
|
|
701
|
+
readonly description: "Required. The deadline for receiving price quotes from settlement providers. After this\npoint no new quotes are accepted. The gateway injects no default and validates the value\nis in the future. The originator must supply it, and a request that omits it or supplies\na past value is rejected with 400.\n\nKeep this window short. A settler holds its quoted price for a limited period of its\nown choosing, and the gateway selects only once the window has closed, so a deadline\nset beyond that hold leaves no quote still awardable and the request is declined with\nQUOTE_WINDOW_TOO_LONG. That hold is set by each settler and is not part of this\ncontract, so treat 60 seconds as a practical upper bound and prefer a shorter window\nwhere your integration allows.";
|
|
694
702
|
readonly example: "2024-12-25T10:30:00Z";
|
|
695
703
|
};
|
|
696
704
|
readonly fulfillment_deadline: {
|
|
@@ -699,6 +707,31 @@ declare const $PaymentRequest: {
|
|
|
699
707
|
readonly description: "Required. The final deadline for completing the payment. If not completed by this time the\npayment fails and is eligible for a refund. The gateway injects no default and validates\nthe value is in the future. The originator must supply it, and a request that omits it or\nsupplies a past value is rejected with 400.";
|
|
700
708
|
readonly example: "2024-12-25T11:00:00Z";
|
|
701
709
|
};
|
|
710
|
+
readonly executor: {
|
|
711
|
+
readonly description: "Who performs each leg of the payment. Omitted on the wire means settler for every leg. The split object keeps deposit, reserve, and fulfill as separate keys.";
|
|
712
|
+
readonly oneOf: readonly [{
|
|
713
|
+
readonly type: "string";
|
|
714
|
+
readonly enum: readonly ["settler", "originator"];
|
|
715
|
+
}, {
|
|
716
|
+
readonly type: "object";
|
|
717
|
+
readonly additionalProperties: false;
|
|
718
|
+
readonly required: readonly ["deposit", "reserve", "fulfill"];
|
|
719
|
+
readonly properties: {
|
|
720
|
+
readonly deposit: {
|
|
721
|
+
readonly type: "string";
|
|
722
|
+
readonly enum: readonly ["settler", "originator"];
|
|
723
|
+
};
|
|
724
|
+
readonly reserve: {
|
|
725
|
+
readonly type: "string";
|
|
726
|
+
readonly enum: readonly ["settler", "originator"];
|
|
727
|
+
};
|
|
728
|
+
readonly fulfill: {
|
|
729
|
+
readonly type: "string";
|
|
730
|
+
readonly enum: readonly ["settler", "originator"];
|
|
731
|
+
};
|
|
732
|
+
};
|
|
733
|
+
}];
|
|
734
|
+
};
|
|
702
735
|
readonly settler_auth_required: {
|
|
703
736
|
readonly type: "object";
|
|
704
737
|
readonly description: "Policy requirements for settler authentication. Keys are policy names, values indicate if the policy is required.";
|
|
@@ -719,7 +752,7 @@ declare const $PaymentRequest: {
|
|
|
719
752
|
};
|
|
720
753
|
readonly fulfillment_verifier: {
|
|
721
754
|
readonly type: "object";
|
|
722
|
-
readonly description: "
|
|
755
|
+
readonly description: "The verification service that confirms the payment was delivered before the escrow\nreleases the source funds, and the account it signs with. Required on every chain:\nthe gateway's `/v1/defaults` response supplies it for each chain.";
|
|
723
756
|
readonly required: readonly ["account", "endpoint"];
|
|
724
757
|
readonly properties: {
|
|
725
758
|
readonly account: {
|
|
@@ -737,7 +770,7 @@ declare const $PaymentRequest: {
|
|
|
737
770
|
};
|
|
738
771
|
readonly escrow_contract_address: {
|
|
739
772
|
readonly type: "string";
|
|
740
|
-
readonly description: "Escrow contract
|
|
773
|
+
readonly description: "Escrow contract on the source chain that holds the source funds until proof of fulfillment has been verified. Required on every chain. Take the value for the source chain from the payment gateway's GET /v1/defaults (`escrow_contract`).";
|
|
741
774
|
readonly example: "0x742D35cC6634c0532925a3b844Bc9e7595F41360";
|
|
742
775
|
};
|
|
743
776
|
readonly fulfillment_proxy: {
|
|
@@ -777,10 +810,54 @@ declare const $PaymentRequest: {
|
|
|
777
810
|
};
|
|
778
811
|
};
|
|
779
812
|
};
|
|
813
|
+
declare const $FulfillmentAuthorization: {
|
|
814
|
+
readonly description: "Authorization for an originator to fulfill a payment request. The settler produces this declaration after authorizeFulfillment when the payment request's fulfill executor is \"originator\". A settler fulfill does not produce it.\n\nCanonical JSON Schema: schemas/declarations/FulfillmentAuthorization/v1/schema.json\nPublished at https://schemas.atum.xyz/declarations/FulfillmentAuthorization/v1";
|
|
815
|
+
readonly type: "object";
|
|
816
|
+
readonly additionalProperties: false;
|
|
817
|
+
readonly required: readonly ["version", "scheme", "authorization", "fulfillment_quote_json", "evidence"];
|
|
818
|
+
readonly properties: {
|
|
819
|
+
readonly version: {
|
|
820
|
+
readonly type: "string";
|
|
821
|
+
readonly description: "Semver-shaped declaration version (MAJOR.MINOR). The major component is locked to this schema's parent directory (v1 → major must be 1).";
|
|
822
|
+
readonly pattern: "^1\\.[0-9]+$";
|
|
823
|
+
readonly example: "1.0";
|
|
824
|
+
};
|
|
825
|
+
readonly scheme: {
|
|
826
|
+
readonly type: "string";
|
|
827
|
+
readonly description: "Authorization scheme.";
|
|
828
|
+
readonly enum: readonly ["EIP-3009"];
|
|
829
|
+
};
|
|
830
|
+
readonly authorization: {
|
|
831
|
+
readonly description: "Signed authorization. For scheme EIP-3009, message_prehash is the EIP-712 TransferWithAuthorization typed data as a JSON string ({domain, types, primaryType, message}, with uint256 values as decimal strings), message is its EIP-712 digest, signature is the settler's 65-byte signature over that digest, and payload is absent. message.validBefore is the payment request's fulfillment_deadline in whole unix seconds, and message.nonce is the fulfillment quote hash.";
|
|
832
|
+
readonly $ref: "#/components/schemas/SignedMessage";
|
|
833
|
+
};
|
|
834
|
+
readonly fulfillment_quote_json: {
|
|
835
|
+
readonly type: "string";
|
|
836
|
+
readonly description: "Raw JSON of the fulfillment quote (schemas/declarations/FulfillmentQuote/v1/schema.json), including proof metadata so its canonical quote hash can be computed.";
|
|
837
|
+
};
|
|
838
|
+
readonly evidence: {
|
|
839
|
+
readonly type: "object";
|
|
840
|
+
readonly description: "Pointer to the on-chain evidence of the fulfillment authorization.";
|
|
841
|
+
readonly additionalProperties: false;
|
|
842
|
+
readonly required: readonly ["transaction_id", "log_index"];
|
|
843
|
+
readonly properties: {
|
|
844
|
+
readonly transaction_id: {
|
|
845
|
+
readonly type: "string";
|
|
846
|
+
readonly minLength: 1;
|
|
847
|
+
readonly description: "Chain transaction identifier. EVM transactions are 0x-prefixed hex, Tron transactions are hex without that prefix, and Solana transactions are base58.";
|
|
848
|
+
};
|
|
849
|
+
readonly log_index: {
|
|
850
|
+
readonly type: "integer";
|
|
851
|
+
readonly minimum: 0;
|
|
852
|
+
};
|
|
853
|
+
};
|
|
854
|
+
};
|
|
855
|
+
};
|
|
856
|
+
};
|
|
780
857
|
declare const $FulfillmentConfirmation: {
|
|
781
858
|
readonly type: "object";
|
|
782
859
|
readonly description: "Confirmation details after a payment has been successfully delivered.\nContains proof of delivery and transaction details for both source and destination chains.\n";
|
|
783
|
-
readonly required: readonly ["payment_id", "request_id", "
|
|
860
|
+
readonly required: readonly ["payment_id", "request_id", "source_chain_id", "destination_chain_id", "source_tx_hash", "destination_tx_hash"];
|
|
784
861
|
readonly properties: {
|
|
785
862
|
readonly payment_id: {
|
|
786
863
|
readonly type: "string";
|
|
@@ -887,12 +964,12 @@ declare const $SignedMessage: {
|
|
|
887
964
|
readonly properties: {
|
|
888
965
|
readonly message: {
|
|
889
966
|
readonly type: "string";
|
|
890
|
-
readonly description: "The data that was signed
|
|
967
|
+
readonly description: "The data that was signed, hex-encoded with a 0x prefix on every supported chain. For the deposit (signed_messages[0]) it is the 32-byte hash of message_prehash.";
|
|
891
968
|
readonly example: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef";
|
|
892
969
|
};
|
|
893
970
|
readonly message_prehash: {
|
|
894
971
|
readonly type: "string";
|
|
895
|
-
readonly description: "
|
|
972
|
+
readonly description: "The original data that `message` is the hash of. Required on every entry of a payment\nrequest's `sender_auth.signed_messages`: the gateway reads the signed terms from it.";
|
|
896
973
|
readonly example: "{\"permit\":{\"token\":\"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\"amount\":\"1000000\"}}";
|
|
897
974
|
};
|
|
898
975
|
readonly signature: {
|
|
@@ -990,8 +1067,8 @@ declare const $VerifiableCredential: {
|
|
|
990
1067
|
};
|
|
991
1068
|
declare const $PaymentStatus: {
|
|
992
1069
|
readonly type: "string";
|
|
993
|
-
readonly description: "Where your payment is in its lifecycle. One payment reads the same however you ask\nabout it.\n\n- `pending`: accepted and in progress. Nothing has reached the recipient yet.\n- `finalizing`: the transaction paying your recipient is on chain and is accruing\n the confirmations its chain requires. NOT FINAL, see below.\n- `completed`: delivered, with the required confirmations behind it.\n- `failed`: did not complete. Any funds held in escrow are returned, and `error`\n describes what went wrong.\n\n`completed` and `failed` are final and will not change afterwards
|
|
994
|
-
readonly enum: readonly ["pending", "finalizing", "completed", "failed"];
|
|
1070
|
+
readonly description: "Where your payment is in its lifecycle. One payment reads the same however you ask\nabout it.\n\n- `pending`: accepted and in progress. Nothing has reached the recipient yet.\n- `finalizing`: the transaction paying your recipient is on chain and is accruing\n the confirmations its chain requires. NOT FINAL, see below.\n- `completed`: delivered, with the required confirmations behind it.\n- `failed`: did not complete. Any funds held in escrow are returned, and `error`\n describes what went wrong.\n- `refunding`: the settler will not deliver this payment and your funds are being\n returned from escrow. NOT FINAL: it becomes `refund_available` or `refunded`, and it\n can still become `completed` or `failed`.\n- `refund_available`: the settler did not deliver and the refund is authorized for you\n to submit. GET /v1/payments/{paymentId}/status returns `refund_signature`, which you\n submit to the source escrow to return your funds. The other responses report this\n status without the signature. NOT FINAL: the funds are still in escrow, so it becomes\n `refunded` once the refund lands, or `completed` if the settler delivers late and is\n paid first. Do not pay again while it is `refund_available`.\n- `refunded`: your funds were returned from the source escrow. `transactions.refund` is\n the refund transaction, when it is known.\n\n`completed`, `failed` and `refunded` are final and will not change afterwards.\n`pending`, `finalizing`, `refunding` and `refund_available` will.\n\n**Do not treat `finalizing` as delivered.** It says the payment has been made on\nchain but is not yet irreversible, much as a card authorization is not yet a\nsettlement. It normally becomes `completed`, and it can still become `failed` if\nthe transaction never reaches the confirmation depth its chain requires. Acting on\n`finalizing` — releasing goods, crediting an account — means accepting that risk\ndeliberately, at whatever threshold suits you rather than the one we wait for.\n\n`finalizing` is about paying the recipient. While your own funds are still being\ncommitted on the source chain the payment is `pending`, because nothing has reached\nthe recipient yet.\n";
|
|
1071
|
+
readonly enum: readonly ["pending", "finalizing", "completed", "failed", "refunding", "refund_available", "refunded"];
|
|
995
1072
|
readonly example: "pending";
|
|
996
1073
|
};
|
|
997
1074
|
declare const $PaymentTransaction: {
|
|
@@ -1020,7 +1097,7 @@ declare const $PaymentTransaction: {
|
|
|
1020
1097
|
};
|
|
1021
1098
|
declare const $PaymentTransactions: {
|
|
1022
1099
|
readonly type: "object";
|
|
1023
|
-
readonly description: "The transactions a payment has produced, one entry per stage, added as each becomes\nknown. A stage absent here has produced no transaction yet.\n\nThese are the
|
|
1100
|
+
readonly description: "The transactions a payment has produced, one entry per stage, added as each becomes\nknown. A stage absent here has produced no transaction yet.\n\nThese are the movements that decide whether your payment happened: your funds being\ncommitted, your recipient being paid, and your funds being returned when the payment\nis refunded. Present on every outcome, so a payment that did not complete can still be\ntraced on chain.\n`fulfillment_confirmation` is not a substitute: it is written only once a payment\ncompletes, and describes the finished delivery rather than progress towards it.\n\nWhere a stage is attempted more than once, the entry describes the attempt that\ncounts — the one that succeeded, or the last one if none did.\n";
|
|
1024
1101
|
readonly properties: {
|
|
1025
1102
|
readonly deposit: {
|
|
1026
1103
|
readonly allOf: readonly [{
|
|
@@ -1034,6 +1111,31 @@ declare const $PaymentTransactions: {
|
|
|
1034
1111
|
}];
|
|
1035
1112
|
readonly description: "Paying your recipient on the destination chain.";
|
|
1036
1113
|
};
|
|
1114
|
+
readonly refund: {
|
|
1115
|
+
readonly allOf: readonly [{
|
|
1116
|
+
readonly $ref: "#/components/schemas/PaymentTransaction";
|
|
1117
|
+
}];
|
|
1118
|
+
readonly description: "Returning your funds from the escrow on the source chain. Can be absent on a\n`refunded` payment when the refund transaction is not known.\n";
|
|
1119
|
+
};
|
|
1120
|
+
};
|
|
1121
|
+
};
|
|
1122
|
+
declare const $RefundSignature: {
|
|
1123
|
+
readonly type: "object";
|
|
1124
|
+
readonly description: "The refund authorization for a `refund_available` payment, as the verifier signed it.\nSubmit it to the source chain's escrow `refund` to return your funds yourself.\n\nAnyone holding it can submit the refund, but the escrow only ever pays the depositor. If\nthe settler delivers late and is paid first, the refund no longer goes through.\nOn Solana the submitter also receives the rent of the deposit account the refund closes.\n";
|
|
1125
|
+
readonly required: readonly ["signature", "message_hash", "message_prehash"];
|
|
1126
|
+
readonly properties: {
|
|
1127
|
+
readonly signature: {
|
|
1128
|
+
readonly type: "string";
|
|
1129
|
+
readonly description: "The verifier's signature over `message_hash`. Hex with the `0x` prefix on EVM and\nTron chains, hex without it on Solana.\n";
|
|
1130
|
+
};
|
|
1131
|
+
readonly message_hash: {
|
|
1132
|
+
readonly type: "string";
|
|
1133
|
+
readonly description: "The signed digest, hex without the `0x` prefix.";
|
|
1134
|
+
};
|
|
1135
|
+
readonly message_prehash: {
|
|
1136
|
+
readonly type: "string";
|
|
1137
|
+
readonly description: "The signed message as JSON. On EVM and Tron chains it carries the RefundWitness the\nescrow's `refund` takes.\n";
|
|
1138
|
+
};
|
|
1037
1139
|
};
|
|
1038
1140
|
};
|
|
1039
1141
|
declare const $PaymentResponse: {
|
|
@@ -1070,9 +1172,32 @@ declare const $PaymentResponse: {
|
|
|
1070
1172
|
readonly fulfillment_confirmation: {
|
|
1071
1173
|
readonly $ref: "#/components/schemas/FulfillmentConfirmation";
|
|
1072
1174
|
};
|
|
1175
|
+
readonly fulfillment_authorization: {
|
|
1176
|
+
readonly type: "object";
|
|
1177
|
+
readonly description: "The settler-signed FulfillmentAuthorization for this payment, returned verbatim as an\nopaque signed document (structurally the canonical FulfillmentAuthorization/v1 declaration at\nhttps://schemas.atum.xyz/declarations/FulfillmentAuthorization/v1; see also\n`#/components/schemas/FulfillmentAuthorization`). The inner declaration requires\n`version`, `scheme`, `authorization` (the signed EIP-3009 transfer, in `authorization.message_prehash`), `fulfillment_quote_json`,\nand `evidence` (the on-chain authorizeFulfillment transaction). On the wire the settler\ntypically wraps that declaration in JSON-LD with `@context`, `type`, and `proof` — those\nenvelope fields ride alongside the declaration and MUST be preserved byte-for-byte.\n\nPresent when the settler authorized an originator fulfill. Mutually exclusive with\n`fulfillment_confirmation` until the originator fulfills: when this field is populated,\n`fulfillment_confirmation` is absent.\n\nThe service returns these bytes verbatim and does not re-serialize through a typed\nrepresentation (which would normalize timestamps and reorder JSON-LD envelope fields).\n";
|
|
1178
|
+
readonly 'x-go-type': "json.RawMessage";
|
|
1179
|
+
};
|
|
1073
1180
|
readonly error: {
|
|
1074
1181
|
readonly $ref: "#/components/schemas/PaymentFailure";
|
|
1075
1182
|
};
|
|
1183
|
+
readonly refund_reason: {
|
|
1184
|
+
readonly allOf: readonly [{
|
|
1185
|
+
readonly $ref: "#/components/schemas/PaymentFailure";
|
|
1186
|
+
}];
|
|
1187
|
+
readonly description: "Why the settler did not deliver, as it reported when it gave up. Present only when\n`status` is `refunding`, `refund_available` or `refunded`, and absent when the refund\nstarted without a reason from the settler. `status` decides what to do next: its\n`retry_classification` and `request_id_reusable` describe the settler's error, not\nthis payment, and never mean paying again while it is `refunding` or `refund_available`.\n";
|
|
1188
|
+
};
|
|
1189
|
+
readonly requested_count: {
|
|
1190
|
+
readonly type: "integer";
|
|
1191
|
+
readonly description: "How many settler agents this payment's auction was broadcast to. Accompanies\n`decline_summary` and is present under the same condition. Same meaning and same\nabsence rule as on GET /v1/payments/{paymentId}/status: absent means unknown, never\nzero.\n";
|
|
1192
|
+
readonly example: 8;
|
|
1193
|
+
};
|
|
1194
|
+
readonly decline_summary: {
|
|
1195
|
+
readonly type: "array";
|
|
1196
|
+
readonly description: "Why the payment drew few or no quotes, carried on the submission response so that a\n`failed` payment explains itself here rather than requiring a follow-up read. A\npayment that ran out its quote deadline reports `NO_QUOTES_RECEIVED` on `error`;\nthis is what the settlers actually said.\n\nPresent when `status` is `failed`, alongside `error`. A submission rejected before\nits auction opened is answered as an error response rather than this type and carries\nno breakdown, and GET /v1/payments/{paymentId}/status reports the breakdown in every\nstate.\n\nSame counting rules as GET /v1/payments/{paymentId}/status: every declining agent is\ncounted exactly once under its most recent reason, empty means no agent declined,\nabsent means the breakdown could not be read. The free-form decline detail is never\nrelayed.\n";
|
|
1197
|
+
readonly items: {
|
|
1198
|
+
readonly $ref: "#/components/schemas/DeclineSummaryEntry";
|
|
1199
|
+
};
|
|
1200
|
+
};
|
|
1076
1201
|
};
|
|
1077
1202
|
};
|
|
1078
1203
|
declare const $GetPaymentStatusResponse: {
|
|
@@ -1107,9 +1232,26 @@ declare const $GetPaymentStatusResponse: {
|
|
|
1107
1232
|
readonly fulfillment_confirmation: {
|
|
1108
1233
|
readonly $ref: "#/components/schemas/FulfillmentConfirmation";
|
|
1109
1234
|
};
|
|
1235
|
+
readonly fulfillment_authorization: {
|
|
1236
|
+
readonly type: "object";
|
|
1237
|
+
readonly description: "The settler-signed FulfillmentAuthorization for this payment, returned verbatim as an\nopaque signed document (structurally the canonical FulfillmentAuthorization/v1 declaration at\nhttps://schemas.atum.xyz/declarations/FulfillmentAuthorization/v1; see also\n`#/components/schemas/FulfillmentAuthorization`). The inner declaration requires\n`version`, `scheme`, `authorization` (the signed EIP-3009 transfer, in `authorization.message_prehash`), `fulfillment_quote_json`,\nand `evidence` (the on-chain authorizeFulfillment transaction). On the wire the settler\ntypically wraps that declaration in JSON-LD with `@context`, `type`, and `proof` — those\nenvelope fields ride alongside the declaration and MUST be preserved byte-for-byte.\n\nPresent when the settler authorized an originator fulfill. Mutually exclusive with\n`fulfillment_confirmation` until the originator fulfills: when this field is populated,\n`fulfillment_confirmation` is absent.\n\nThe service returns these bytes verbatim and does not re-serialize through a typed\nrepresentation (which would normalize timestamps and reorder JSON-LD envelope fields).\n";
|
|
1238
|
+
readonly 'x-go-type': "json.RawMessage";
|
|
1239
|
+
};
|
|
1110
1240
|
readonly error: {
|
|
1111
1241
|
readonly $ref: "#/components/schemas/PaymentFailure";
|
|
1112
1242
|
};
|
|
1243
|
+
readonly refund_reason: {
|
|
1244
|
+
readonly allOf: readonly [{
|
|
1245
|
+
readonly $ref: "#/components/schemas/PaymentFailure";
|
|
1246
|
+
}];
|
|
1247
|
+
readonly description: "Why the settler did not deliver, as it reported when it gave up. Present only when\n`status` is `refunding`, `refund_available` or `refunded`, and absent when the refund\nstarted without a reason from the settler. `status` decides what to do next: its\n`retry_classification` and `request_id_reusable` describe the settler's error, not\nthis payment, and never mean paying again while it is `refunding` or `refund_available`.\n";
|
|
1248
|
+
};
|
|
1249
|
+
readonly refund_signature: {
|
|
1250
|
+
readonly allOf: readonly [{
|
|
1251
|
+
readonly $ref: "#/components/schemas/RefundSignature";
|
|
1252
|
+
}];
|
|
1253
|
+
readonly description: "Present only when `status` is `refund_available`.";
|
|
1254
|
+
};
|
|
1113
1255
|
readonly requested_count: {
|
|
1114
1256
|
readonly type: "integer";
|
|
1115
1257
|
readonly description: "How many settler agents this payment's auction was broadcast to. Absent means\nunknown, never zero.\n";
|
|
@@ -1126,7 +1268,7 @@ declare const $GetPaymentStatusResponse: {
|
|
|
1126
1268
|
};
|
|
1127
1269
|
declare const $PaymentFailure: {
|
|
1128
1270
|
readonly type: "object";
|
|
1129
|
-
readonly description: "Why a payment failed.
|
|
1271
|
+
readonly description: "Why a payment failed, or why its settler gave up. As `error` it is present only when\n`status` is `failed`, as `refund_reason` only on the refund statuses, and it is identical\nhowever you ask about the payment.\n\n`code` is the stable, machine-readable identity of the failure — branch on it\nrather than on `message`, which is written for a person and may be reworded.\n`docs_url` points at the page describing that code.\n";
|
|
1130
1272
|
readonly required: readonly ["code", "message"];
|
|
1131
1273
|
readonly properties: {
|
|
1132
1274
|
readonly code: {
|
|
@@ -1155,6 +1297,11 @@ declare const $PaymentFailure: {
|
|
|
1155
1297
|
readonly description: "What the caller should do next. Absent means the condition has not been classified, which is not the same as safe to retry.\nRe-sending the same `request_id` is an idempotent replay and always safe. This value is about submitting a new one, which starts a new payment. See https://docs.atum.xyz/errors for the value set.";
|
|
1156
1298
|
readonly example: "RECONCILE_THEN_DECIDE";
|
|
1157
1299
|
};
|
|
1300
|
+
readonly request_id_reusable: {
|
|
1301
|
+
readonly type: "boolean";
|
|
1302
|
+
readonly description: "Whether the caller may re-send the `request_id` this payment was created under. On this shape it is almost always false, because a payment exists by definition, but it is carried rather than assumed so a caller reads the same field here as on a synchronous error. Absent means undetermined, which a caller should read as false.";
|
|
1303
|
+
readonly example: false;
|
|
1304
|
+
};
|
|
1158
1305
|
readonly blockchain_context: {
|
|
1159
1306
|
readonly $ref: "#/components/schemas/PaymentBlockchainContext";
|
|
1160
1307
|
};
|
|
@@ -1250,8 +1397,8 @@ declare const $PreparePaymentRequest: {
|
|
|
1250
1397
|
readonly quote_deadline_seconds: {
|
|
1251
1398
|
readonly type: "integer";
|
|
1252
1399
|
readonly description: "Seconds until quote deadline (from now).\nHow long to wait for settlement provider quotes.\n";
|
|
1253
|
-
readonly default:
|
|
1254
|
-
readonly example:
|
|
1400
|
+
readonly default: 3;
|
|
1401
|
+
readonly example: 3;
|
|
1255
1402
|
};
|
|
1256
1403
|
readonly fulfillment_deadline_seconds: {
|
|
1257
1404
|
readonly type: "integer";
|
|
@@ -1317,6 +1464,12 @@ declare const $PaymentTimelineResponse: {
|
|
|
1317
1464
|
readonly error: {
|
|
1318
1465
|
readonly $ref: "#/components/schemas/PaymentFailure";
|
|
1319
1466
|
};
|
|
1467
|
+
readonly refund_reason: {
|
|
1468
|
+
readonly allOf: readonly [{
|
|
1469
|
+
readonly $ref: "#/components/schemas/PaymentFailure";
|
|
1470
|
+
}];
|
|
1471
|
+
readonly description: "Why the settler did not deliver, as it reported when it gave up. Present only when\n`status` is `refunding`, `refund_available` or `refunded`, and absent when the refund\nstarted without a reason from the settler. `status` decides what to do next: its\n`retry_classification` and `request_id_reusable` describe the settler's error, not\nthis payment, and never mean paying again while it is `refunding` or `refund_available`.\n";
|
|
1472
|
+
};
|
|
1320
1473
|
readonly steps: {
|
|
1321
1474
|
readonly type: "array";
|
|
1322
1475
|
readonly items: {
|
|
@@ -1454,12 +1607,17 @@ declare const $ErrorResponse: {
|
|
|
1454
1607
|
readonly description: "What the caller should do next. Absent means the condition has not been classified, which is not the same as safe to retry.\nRe-sending the same `request_id` is an idempotent replay and always safe. This value is about submitting a new one, which starts a new operation. See https://docs.atum.xyz/errors for the value set.";
|
|
1455
1608
|
readonly example: "RECONCILE_THEN_DECIDE";
|
|
1456
1609
|
};
|
|
1610
|
+
readonly request_id_reusable: {
|
|
1611
|
+
readonly type: "boolean";
|
|
1612
|
+
readonly description: "Whether the caller may re-send this same request_id. True means no payment was created for it, so the id is still free. False means a payment exists for it, so the id is spent and re-sending only replays this outcome. Absent means undetermined, which a caller should read as false. Separate from retry_classification, which answers what the caller must change rather than whether the id survived.";
|
|
1613
|
+
readonly example: false;
|
|
1614
|
+
};
|
|
1457
1615
|
};
|
|
1458
1616
|
};
|
|
1459
1617
|
declare const $CreateQuoteRequest: {
|
|
1460
1618
|
readonly type: "object";
|
|
1461
1619
|
readonly description: "Request body for opening a quote-request batch. Structurally the existing PaymentRequest\nwith `sender_auth` omitted (the spend authorization is deferred to the award call); see\nschemas/declarations/PaymentRequest/v1/schema.json.\n";
|
|
1462
|
-
readonly required: readonly ["version", "request_id", "source", "destination", "fulfillment_amount", "quote_deadline", "fulfillment_deadline"];
|
|
1620
|
+
readonly required: readonly ["version", "request_id", "source", "destination", "fulfillment_amount", "quote_deadline", "fulfillment_deadline", "fulfillment_verifier", "escrow_contract_address"];
|
|
1463
1621
|
readonly properties: {
|
|
1464
1622
|
readonly version: {
|
|
1465
1623
|
readonly type: "string";
|
|
@@ -1497,7 +1655,7 @@ declare const $CreateQuoteRequest: {
|
|
|
1497
1655
|
readonly quote_deadline: {
|
|
1498
1656
|
readonly type: "string";
|
|
1499
1657
|
readonly format: "date-time";
|
|
1500
|
-
readonly description: "Required. End of the collection window. After this point no new quotes are accepted.\nThe gateway injects no default and never mutates the originator-supplied body, so the\nvalue is carried through verbatim to the award call. It must be supplied and must be in\nthe future. Must be strictly earlier than fulfillment_deadline.\n";
|
|
1658
|
+
readonly description: "Required. End of the collection window. After this point no new quotes are accepted.\nThe gateway injects no default and never mutates the originator-supplied body, so the\nvalue is carried through verbatim to the award call. It must be supplied and must be in\nthe future. Must be strictly earlier than fulfillment_deadline.\n\nKeep this window short. A settler holds its quoted price for a limited period of its\nown choosing, and the gateway selects only once the window has closed, so a deadline\nset beyond that hold leaves no quote still awardable and the request is declined with\nQUOTE_WINDOW_TOO_LONG. That hold is set by each settler and is not part of this\ncontract, so treat 60 seconds as a practical upper bound and prefer a shorter window\nwhere your integration allows.\n";
|
|
1501
1659
|
readonly example: "2026-04-29T12:00:03Z";
|
|
1502
1660
|
};
|
|
1503
1661
|
readonly fulfillment_deadline: {
|
|
@@ -1523,7 +1681,7 @@ declare const $CreateQuoteRequest: {
|
|
|
1523
1681
|
};
|
|
1524
1682
|
readonly fulfillment_verifier: {
|
|
1525
1683
|
readonly type: "object";
|
|
1526
|
-
readonly description: "
|
|
1684
|
+
readonly description: "The verification service that confirms the payment was delivered before the escrow\nreleases the source funds, and the account it signs with. Required on every chain:\nthe gateway's `/v1/defaults` response supplies it for each chain.\n";
|
|
1527
1685
|
readonly required: readonly ["account", "endpoint"];
|
|
1528
1686
|
readonly properties: {
|
|
1529
1687
|
readonly account: {
|
|
@@ -1541,7 +1699,7 @@ declare const $CreateQuoteRequest: {
|
|
|
1541
1699
|
};
|
|
1542
1700
|
readonly escrow_contract_address: {
|
|
1543
1701
|
readonly type: "string";
|
|
1544
|
-
readonly description: "
|
|
1702
|
+
readonly description: "Escrow contract on the source chain that holds the source funds until proof of\nfulfillment has been verified. Required on every chain: the gateway's `/v1/defaults`\nresponse supplies it for each chain (`escrow_contract`).\n";
|
|
1545
1703
|
readonly example: "0x742D35cC6634c0532925a3b844Bc9e7595F41360";
|
|
1546
1704
|
};
|
|
1547
1705
|
readonly fulfillment_proxy: {
|
|
@@ -1952,6 +2110,11 @@ declare const $AwardResponse: {
|
|
|
1952
2110
|
readonly fulfillment_confirmation: {
|
|
1953
2111
|
readonly $ref: "#/components/schemas/FulfillmentConfirmation";
|
|
1954
2112
|
};
|
|
2113
|
+
readonly fulfillment_authorization: {
|
|
2114
|
+
readonly type: "object";
|
|
2115
|
+
readonly description: "The settler-signed FulfillmentAuthorization for this payment, returned verbatim as an\nopaque signed document (structurally the canonical FulfillmentAuthorization/v1 declaration at\nhttps://schemas.atum.xyz/declarations/FulfillmentAuthorization/v1; see also\n`#/components/schemas/FulfillmentAuthorization`). The inner declaration requires\n`version`, `scheme`, `authorization` (the signed EIP-3009 transfer, in `authorization.message_prehash`), `fulfillment_quote_json`,\nand `evidence` (the on-chain authorizeFulfillment transaction). On the wire the settler\ntypically wraps that declaration in JSON-LD with `@context`, `type`, and `proof` — those\nenvelope fields ride alongside the declaration and MUST be preserved byte-for-byte.\n\nPresent when the settler authorized an originator fulfill within the sync wait.\nMutually exclusive with `fulfillment_confirmation` until the originator fulfills: when\nthis field is populated, `fulfillment_confirmation` is absent.\n\nThe service returns these bytes verbatim and does not re-serialize through a typed\nrepresentation (which would normalize timestamps and reorder JSON-LD envelope fields).\n";
|
|
2116
|
+
readonly 'x-go-type': "json.RawMessage";
|
|
2117
|
+
};
|
|
1955
2118
|
};
|
|
1956
2119
|
};
|
|
1957
2120
|
declare const $AwardAccepted: {
|
|
@@ -2020,12 +2183,6 @@ declare const $ChainDefaults: {
|
|
|
2020
2183
|
readonly description: "The Permit2 this chain's escrow verifies against, sent only when it is not the canonical deployment. When absent, use the canonical Permit2 address for the chain. EVM and Tron only.";
|
|
2021
2184
|
readonly example: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
2022
2185
|
};
|
|
2023
|
-
readonly deposit_witness_version: {
|
|
2024
|
-
readonly type: "integer";
|
|
2025
|
-
readonly minimum: 3;
|
|
2026
|
-
readonly description: "Which deposit witness this chain's escrow expects. `4` and above select the four-member witness, `3` the two-member one; absent means four. EVM and Tron only - on Solana this is carried by `svm_signature_domain_version`.";
|
|
2027
|
-
readonly example: 4;
|
|
2028
|
-
};
|
|
2029
2186
|
readonly tokens: {
|
|
2030
2187
|
readonly type: "array";
|
|
2031
2188
|
readonly description: "Tokens this chain's escrow accepts for deposit. Absent when the gateway has no listing for the chain, which does not mean no token is accepted.";
|
|
@@ -2058,7 +2215,13 @@ declare const $ChainDefaults: {
|
|
|
2058
2215
|
readonly svm_signature_domain_version: {
|
|
2059
2216
|
readonly type: "integer";
|
|
2060
2217
|
readonly minimum: 1;
|
|
2061
|
-
readonly description: "Solana only.
|
|
2218
|
+
readonly description: "Solana only. The escrow's signature domain version, which the deposit hash commits to. Absent for EVM and Tron.";
|
|
2219
|
+
readonly example: 5;
|
|
2220
|
+
};
|
|
2221
|
+
readonly deposit_request_hash_version: {
|
|
2222
|
+
readonly type: "integer";
|
|
2223
|
+
readonly minimum: 1;
|
|
2224
|
+
readonly description: "The depositRequestHash version to sign for a deposit from this chain: 1 is keccak256 of the request_id, 2 is the hash of the payment terms, computed over the request body exactly as it is then posted. Absent means 1. A deposit signed with version 1 is still accepted while the gateway publishes 2. The gateway publishes 2 for a chain only once every reader of the deposit there reads version 2, veri-fill's release check included, so this is the network-wide signal a client signs by and a merchant lists 2 in an x402 or MPP challenge by.";
|
|
2062
2225
|
readonly example: 2;
|
|
2063
2226
|
};
|
|
2064
2227
|
};
|
|
@@ -2426,109 +2589,25 @@ declare function needsSourceApproval(params: ApprovalParams): Promise<boolean>;
|
|
|
2426
2589
|
declare function ensureSourceApproval(params: ApprovalParams): Promise<EnsureApprovalResult>;
|
|
2427
2590
|
|
|
2428
2591
|
/**
|
|
2429
|
-
* EVM Permit2 PermitWitnessTransferFrom deposit prehash
|
|
2430
|
-
*
|
|
2431
|
-
* Byte-for-byte counterpart of the sibling Go encoder (deposit_encoder.go,
|
|
2432
|
-
* `EscrowDepositEncoder`). This is the sender-authorization scheme the Atum
|
|
2433
|
-
* protocol uses on EVM chains: it authorizes Permit2 to move tokens into the
|
|
2434
|
-
* escrow contract, with a DepositWitness {reserver, releaser}.
|
|
2592
|
+
* EVM Permit2 PermitWitnessTransferFrom deposit prehash and EIP-712 digest.
|
|
2435
2593
|
*
|
|
2436
|
-
*
|
|
2437
|
-
*
|
|
2438
|
-
* serialization (top-level key order,
|
|
2439
|
-
*
|
|
2440
|
-
* deposit-encoder.test.ts.
|
|
2594
|
+
* Byte-for-byte counterpart of the Go encoder (deposit_encoder.go, `EscrowDepositEncoder`). The
|
|
2595
|
+
* sender signs the digest, and the serialized prehash travels as `message_prehash`, so both the
|
|
2596
|
+
* digest and the JSON serialization (top-level key order, `chainId` as lowercase hex) are pinned
|
|
2597
|
+
* to the Go output. See deposit-encoder.test.ts.
|
|
2441
2598
|
*/
|
|
2442
2599
|
/**
|
|
2443
|
-
* The Permit2 contract
|
|
2444
|
-
*
|
|
2600
|
+
* The Permit2 contract, deployed at the same address on all supported EVM chains; the EIP-712
|
|
2601
|
+
* domain verifyingContract for PermitWitnessTransferFrom.
|
|
2445
2602
|
*/
|
|
2446
2603
|
declare const PERMIT2_CONTRACT_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
2447
|
-
|
|
2448
|
-
/** EIP-155 chain ID. */
|
|
2449
|
-
chainId: number;
|
|
2450
|
-
/** The Permit2 contract (PERMIT2_CONTRACT_ADDRESS). */
|
|
2451
|
-
verifyingContract: string;
|
|
2452
|
-
/** TokenPermissions: source token + amount (smallest units, decimal string). */
|
|
2453
|
-
token: string;
|
|
2454
|
-
amount: string;
|
|
2455
|
-
/** The escrow contract address (spender). */
|
|
2456
|
-
spender: string;
|
|
2457
|
-
nonce: bigint;
|
|
2458
|
-
deadline: bigint;
|
|
2459
|
-
/** DepositWitness (V3): reserver (quote selector) + releaser (fulfillment verifier). */
|
|
2460
|
-
reserver: string;
|
|
2461
|
-
releaser: string;
|
|
2462
|
-
}
|
|
2463
|
-
/**
|
|
2464
|
-
* Build the structured prehash for PermitWitnessTransferFrom. The shape is a
|
|
2465
|
-
* direct argument set for `wallet.signTypedData(domain, types, message)`:
|
|
2466
|
-
* - `domain` carries only Permit2's on-chain EIP712Domain fields (name,
|
|
2467
|
-
* chainId, verifyingContract; no `version`, no `salt`).
|
|
2468
|
-
* - `types` omits an EIP712Domain entry (ethers derives it from the domain
|
|
2469
|
-
* object's keys and rejects an explicit one).
|
|
2470
|
-
* - `chainId` is emitted as a lowercase hex string to match the Go encoder's
|
|
2471
|
-
* %#x serialization and the settler's `message_prehash` contract; the EIP-712
|
|
2472
|
-
* digest itself is invariant to the number-vs-hex representation.
|
|
2473
|
-
*/
|
|
2474
|
-
declare function createPermitWitnessTransferFromPrehash(params: PermitWitnessTransferFromParams): {
|
|
2475
|
-
types: {
|
|
2476
|
-
PermitWitnessTransferFrom: {
|
|
2477
|
-
name: string;
|
|
2478
|
-
type: string;
|
|
2479
|
-
}[];
|
|
2480
|
-
TokenPermissions: {
|
|
2481
|
-
name: string;
|
|
2482
|
-
type: string;
|
|
2483
|
-
}[];
|
|
2484
|
-
DepositWitness: {
|
|
2485
|
-
name: string;
|
|
2486
|
-
type: string;
|
|
2487
|
-
}[];
|
|
2488
|
-
};
|
|
2489
|
-
primaryType: string;
|
|
2490
|
-
domain: {
|
|
2491
|
-
name: string;
|
|
2492
|
-
chainId: string;
|
|
2493
|
-
verifyingContract: string;
|
|
2494
|
-
};
|
|
2495
|
-
message: {
|
|
2496
|
-
permitted: {
|
|
2497
|
-
token: string;
|
|
2498
|
-
amount: string;
|
|
2499
|
-
};
|
|
2500
|
-
spender: string;
|
|
2501
|
-
nonce: string;
|
|
2502
|
-
deadline: string;
|
|
2503
|
-
witness: {
|
|
2504
|
-
reserver: string;
|
|
2505
|
-
releaser: string;
|
|
2506
|
-
};
|
|
2507
|
-
};
|
|
2508
|
-
};
|
|
2509
|
-
/**
|
|
2510
|
-
* Hash a PermitWitnessTransferFrom prehash into its EIP-712 digest (0x-prefixed
|
|
2511
|
-
* 32-byte hex). Accepts the object returned by
|
|
2512
|
-
* createPermitWitnessTransferFromPrehash (or an equivalent parsed from JSON).
|
|
2513
|
-
*/
|
|
2604
|
+
/** Hash a PermitWitnessTransferFrom prehash (or one parsed from JSON) into its EIP-712 digest. */
|
|
2514
2605
|
declare function hashPermitWitnessTransferFrom(prehash: {
|
|
2515
2606
|
domain: any;
|
|
2516
2607
|
types: any;
|
|
2517
2608
|
message: any;
|
|
2518
2609
|
}): string;
|
|
2519
2610
|
|
|
2520
|
-
/**
|
|
2521
|
-
* EVM Permit2 PermitWitnessTransferFrom sender-auth scheme.
|
|
2522
|
-
*
|
|
2523
|
-
* The encoder now lives in the shared @atum-labs/evm-escrow-encoding package
|
|
2524
|
-
* (byte-parity with the Go EscrowDepositEncoder). This module re-exports it so
|
|
2525
|
-
* the pg-client public API and the EVM chain adapter keep the same import
|
|
2526
|
-
* surface.
|
|
2527
|
-
*/
|
|
2528
|
-
|
|
2529
|
-
/** Hash a request ID string to a 32-byte identifier. V1 legacy, unused by the V3 deposit witness. */
|
|
2530
|
-
declare function hashRequestId(requestId: string): string;
|
|
2531
|
-
|
|
2532
2611
|
/**
|
|
2533
2612
|
* Masks a chain ID to 4 bytes for Tron TIP-712 compatibility.
|
|
2534
2613
|
*
|
|
@@ -2571,83 +2650,17 @@ declare function base58ToHex(base58Address: string): string;
|
|
|
2571
2650
|
declare function normalizeAddress(address: string): string;
|
|
2572
2651
|
|
|
2573
2652
|
/**
|
|
2574
|
-
* TVM (Tron) Permit2 PermitWitnessTransferFrom deposit prehash
|
|
2653
|
+
* TVM (Tron) Permit2 PermitWitnessTransferFrom deposit prehash and TIP-712 digest.
|
|
2575
2654
|
*
|
|
2576
|
-
* Byte-for-byte counterpart of the
|
|
2577
|
-
*
|
|
2578
|
-
* Tron-
|
|
2579
|
-
*
|
|
2580
|
-
*
|
|
2581
|
-
*
|
|
2582
|
-
* The sender signs the digest this produces, and the serialized prehash travels
|
|
2583
|
-
* to the settler as `message_prehash`, so BOTH the digest and the JSON
|
|
2584
|
-
* serialization (key order, and `chainId` as a lowercase hex string) must stay
|
|
2585
|
-
* pinned to the Go output. See deposit-encoder.test.ts.
|
|
2586
|
-
*
|
|
2587
|
-
* V3: DepositWitness is `{reserver, releaser}` — `requestId` is gone.
|
|
2655
|
+
* Byte-for-byte counterpart of the Go encoder (deposit_encoder.go, `EscrowDepositEncoder`). Same
|
|
2656
|
+
* shape as the EVM deposit encoder, with Tron's normalization: the chainId is masked to its lower
|
|
2657
|
+
* 4 bytes (Tron's TIP-712 domain uses a uint32 chainId) and every address is converted from base58
|
|
2658
|
+
* to bare 20-byte hex (0x41 prefix stripped). The digest and the JSON serialization (key order,
|
|
2659
|
+
* `chainId` as lowercase hex) are pinned to the Go output. See deposit-encoder.test.ts.
|
|
2588
2660
|
*/
|
|
2589
2661
|
/**
|
|
2590
|
-
*
|
|
2591
|
-
*
|
|
2592
|
-
*/
|
|
2593
|
-
interface TvmPermitWitnessTransferFromParams {
|
|
2594
|
-
chainId: number;
|
|
2595
|
-
permit2Address: string;
|
|
2596
|
-
tokenAddress: string;
|
|
2597
|
-
amount: string;
|
|
2598
|
-
spenderAddress: string;
|
|
2599
|
-
nonce: bigint;
|
|
2600
|
-
deadline: bigint;
|
|
2601
|
-
reserverAddress: string;
|
|
2602
|
-
releaserAddress: string;
|
|
2603
|
-
}
|
|
2604
|
-
/**
|
|
2605
|
-
* Build the V3 TIP-712 prehash for a Permit2 deposit on Tron, shaped for direct
|
|
2606
|
-
* `wallet.signTypedData(domain, types, message)` consumption:
|
|
2607
|
-
* - `domain` carries only name, chainId (pre-masked, lowercase hex string),
|
|
2608
|
-
* verifyingContract — Permit2's on-chain EIP712Domain has no version/salt.
|
|
2609
|
-
* - `types` omits an EIP712Domain entry (ethers derives it from the domain keys).
|
|
2610
|
-
* - all addresses are hex-normalized (0x41 prefix stripped).
|
|
2611
|
-
*/
|
|
2612
|
-
declare function createTvmPermitWitnessTransferFromPrehash(params: TvmPermitWitnessTransferFromParams): {
|
|
2613
|
-
types: {
|
|
2614
|
-
PermitWitnessTransferFrom: {
|
|
2615
|
-
name: string;
|
|
2616
|
-
type: string;
|
|
2617
|
-
}[];
|
|
2618
|
-
TokenPermissions: {
|
|
2619
|
-
name: string;
|
|
2620
|
-
type: string;
|
|
2621
|
-
}[];
|
|
2622
|
-
DepositWitness: {
|
|
2623
|
-
name: string;
|
|
2624
|
-
type: string;
|
|
2625
|
-
}[];
|
|
2626
|
-
};
|
|
2627
|
-
primaryType: string;
|
|
2628
|
-
domain: {
|
|
2629
|
-
name: string;
|
|
2630
|
-
chainId: string;
|
|
2631
|
-
verifyingContract: string;
|
|
2632
|
-
};
|
|
2633
|
-
message: {
|
|
2634
|
-
permitted: {
|
|
2635
|
-
token: string;
|
|
2636
|
-
amount: string;
|
|
2637
|
-
};
|
|
2638
|
-
spender: string;
|
|
2639
|
-
nonce: string;
|
|
2640
|
-
deadline: string;
|
|
2641
|
-
witness: {
|
|
2642
|
-
reserver: string;
|
|
2643
|
-
releaser: string;
|
|
2644
|
-
};
|
|
2645
|
-
};
|
|
2646
|
-
};
|
|
2647
|
-
/**
|
|
2648
|
-
* Hash a TVM Permit2 prehash into its TIP-712 digest (0x-prefixed 32-byte hex).
|
|
2649
|
-
* The Tron-specific work (chainId mask, address normalization) already happened
|
|
2650
|
-
* in createTvmPermitWitnessTransferFromPrehash.
|
|
2662
|
+
* Hash a TVM Permit2 prehash into its TIP-712 digest. The Tron-specific normalization happens in
|
|
2663
|
+
* the builder.
|
|
2651
2664
|
*/
|
|
2652
2665
|
declare function hashTvmPermitWitnessTransferFrom(prehash: {
|
|
2653
2666
|
domain: any;
|
|
@@ -2664,32 +2677,13 @@ declare function encodeU64LE(value: bigint): Uint8Array;
|
|
|
2664
2677
|
declare const MAX_VALID_SLOT: number;
|
|
2665
2678
|
|
|
2666
2679
|
/**
|
|
2667
|
-
* Solana deposit
|
|
2668
|
-
*
|
|
2669
|
-
* This module provides utilities for creating and hashing Solana deposit
|
|
2670
|
-
* authorization messages for the Atum payment gateway.
|
|
2680
|
+
* Solana deposit helpers: replay nonces and base58/hex encoding.
|
|
2671
2681
|
*
|
|
2672
|
-
*
|
|
2673
|
-
*
|
|
2674
|
-
*
|
|
2675
|
-
*
|
|
2676
|
-
*
|
|
2677
|
-
* encodeU64LE, generateSolanaNonce (generateNonce), and MAX_VALID_SLOT are
|
|
2678
|
-
* imported from the shared @atum-labs/solana-escrow-encoding package and
|
|
2679
|
-
* re-exported here to preserve the public API. base58ToBytes, payment-id
|
|
2680
|
-
* generation, and prehash creation stay local, because the local base58/hex
|
|
2681
|
-
* helpers carry the exact error messages the client tests assert.
|
|
2682
|
-
*
|
|
2683
|
-
* NO DEPOSIT HASH IS COMPUTED HERE ANY MORE. hashSolanaDeposit computed the
|
|
2684
|
-
* pre-domain-separation layout above and now throws (see its doc comment), and
|
|
2685
|
-
* hashSolanaDepositV3 was deleted as an un-exported third copy of the package's
|
|
2686
|
-
* own call. Build a deposit through the shared sender_auth adapter, which selects
|
|
2687
|
-
* the preimage from the escrow domain version; reach for computeDepositHash /
|
|
2688
|
-
* computeDepositHashV2 from the package if you need the raw primitive.
|
|
2689
|
-
*
|
|
2690
|
-
* The canonical reference is the @atum-labs/solana-escrow-encoding package in
|
|
2691
|
-
* this repo (contracts/svm/escrow-encoding), the TypeScript sibling of the
|
|
2692
|
-
* on-chain Solana escrow program and the Go signing library.
|
|
2682
|
+
* Deposit authorizations are built through the shared sender_auth adapter
|
|
2683
|
+
* (`getChainAdapter(chainId).buildAuthMessage(...)`), which commits the destination and reads the
|
|
2684
|
+
* escrow's signature domain. For the raw primitive, use computeDepositHashV2 from
|
|
2685
|
+
* @atum-labs/solana-escrow-encoding (contracts/svm/bindings/typescript/escrow-encoding), the encoding shared with the
|
|
2686
|
+
* on-chain program and the Go signing library.
|
|
2693
2687
|
*/
|
|
2694
2688
|
|
|
2695
2689
|
/** Replay horizon in seconds — deposit deadline must be within this window of issuedAt. */
|
|
@@ -2699,35 +2693,10 @@ declare const REPLAY_HORIZON_SECS = 128;
|
|
|
2699
2693
|
* bounded set the escrow-encoding package defines, which keeps the replay_bucket PDAs reusable.
|
|
2700
2694
|
*/
|
|
2701
2695
|
declare const TOTAL_BUCKETS = 131072;
|
|
2702
|
-
/** Exact byte size of a serialized deposit message (7 + 32*5 + 8*3). */
|
|
2703
|
-
declare const DEPOSIT_MESSAGE_SIZE = 199;
|
|
2704
|
-
/**
|
|
2705
|
-
* Parameters for constructing a Solana deposit authorization message.
|
|
2706
|
-
*/
|
|
2707
|
-
interface SolanaDepositParams {
|
|
2708
|
-
/** Base58 Solana public key of the depositor. */
|
|
2709
|
-
depositor: string;
|
|
2710
|
-
/** Base58 SPL token mint address. */
|
|
2711
|
-
mint: string;
|
|
2712
|
-
/** Token amount in smallest units (uint64). */
|
|
2713
|
-
amount: bigint;
|
|
2714
|
-
/** Base58 public key authorized to reserve funds (quote selector). */
|
|
2715
|
-
reserver: string;
|
|
2716
|
-
/** Base58 public key authorized to release/refund funds (fulfillment verifier). */
|
|
2717
|
-
releaser: string;
|
|
2718
|
-
/** Replay protection nonce (uint64). */
|
|
2719
|
-
nonce: bigint;
|
|
2720
|
-
/** Unix timestamp (seconds) when the authorization was created (uint64). */
|
|
2721
|
-
issuedAt: bigint;
|
|
2722
|
-
/** Unix timestamp (seconds) when the deposit authorization expires (uint64). */
|
|
2723
|
-
deadline: bigint;
|
|
2724
|
-
/** Original request ID string (used for payment ID generation). */
|
|
2725
|
-
requestId: string;
|
|
2726
|
-
}
|
|
2727
2696
|
/**
|
|
2728
|
-
* Decodes a Base58-encoded Solana public key to a 32-byte Uint8Array.
|
|
2729
|
-
*
|
|
2730
|
-
*
|
|
2697
|
+
* Decodes a Base58-encoded Solana public key to a 32-byte Uint8Array.
|
|
2698
|
+
*
|
|
2699
|
+
* @throws If the decoded key is not 32 bytes.
|
|
2731
2700
|
*/
|
|
2732
2701
|
declare function base58ToBytes(address: string): Uint8Array;
|
|
2733
2702
|
/**
|
|
@@ -2738,79 +2707,10 @@ declare function bytesToHex(bytes: Uint8Array): string;
|
|
|
2738
2707
|
* Converts a hex string (with or without 0x prefix) to a Uint8Array.
|
|
2739
2708
|
*/
|
|
2740
2709
|
declare function hexToBytes(hex: string): Uint8Array;
|
|
2741
|
-
/**
|
|
2742
|
-
* Generates a 32-byte payment ID from the request ID and deposit parameters.
|
|
2743
|
-
*
|
|
2744
|
-
* Formula: keccak256(requestId_str || "deposit" || depositor[32] ||
|
|
2745
|
-
* amount[8,LE] || reserver[32] || releaser[32] ||
|
|
2746
|
-
* nonce[8,LE] || issuedAt[8,LE] || deadline[8,LE])
|
|
2747
|
-
*
|
|
2748
|
-
* TODO: the V3 gateway simplified this to
|
|
2749
|
-
* just keccak256(requestID). When we migrate to v3, this function should change
|
|
2750
|
-
* to: return keccak256(toUtf8Bytes(requestId)); and the params argument can be
|
|
2751
|
-
* removed. The gateway reads payment_id from the prehash so both approaches work.
|
|
2752
|
-
*
|
|
2753
|
-
* @returns 0x-prefixed hex string (32 bytes)
|
|
2754
|
-
*/
|
|
2755
|
-
declare function generateSolanaPaymentId(requestId: string, params: Omit<SolanaDepositParams, 'requestId'>): string;
|
|
2756
|
-
/**
|
|
2757
|
-
* Prehash structure for a Solana deposit message.
|
|
2758
|
-
* Uses base58 addresses and string numbers for settler parsing.
|
|
2759
|
-
*/
|
|
2760
|
-
interface SolanaDepositPrehash {
|
|
2761
|
-
payment_id: string;
|
|
2762
|
-
depositor: string;
|
|
2763
|
-
mint: string;
|
|
2764
|
-
amount: string;
|
|
2765
|
-
reserver: string;
|
|
2766
|
-
releaser: string;
|
|
2767
|
-
nonce: string;
|
|
2768
|
-
issued_at: string;
|
|
2769
|
-
deadline: string;
|
|
2770
|
-
}
|
|
2771
|
-
/**
|
|
2772
|
-
* Creates the JSON prehash structure for a Solana deposit message.
|
|
2773
|
-
* The prehash contains base58 addresses and string numbers, matching the
|
|
2774
|
-
* format the settler agent expects in `message_prehash`.
|
|
2775
|
-
*
|
|
2776
|
-
* @param paymentId 0x-prefixed hex string (32 bytes) from generateSolanaPaymentId()
|
|
2777
|
-
* @param params The deposit parameters
|
|
2778
|
-
* @returns The structured prehash object
|
|
2779
|
-
*/
|
|
2780
|
-
declare function createSolanaDepositPrehash(paymentId: string, params: SolanaDepositParams): SolanaDepositPrehash;
|
|
2781
|
-
/**
|
|
2782
|
-
* REMOVED — this function computed the PRE-DOMAIN-SEPARATION deposit hash, which no deployed
|
|
2783
|
-
* escrow program accepts. It now throws rather than returning one.
|
|
2784
|
-
*
|
|
2785
|
-
* The layout it used, kept here as a record of the historical scheme:
|
|
2786
|
-
*
|
|
2787
|
-
* keccak256("deposit" || payment_id[32] || depositor[32] || mint[32] ||
|
|
2788
|
-
* amount[8,LE] || reserver[32] || releaser[32] ||
|
|
2789
|
-
* nonce[8,LE] || issued_at[8,LE] || deadline[8,LE]) = 199 bytes
|
|
2790
|
-
*
|
|
2791
|
-
* Every current program prefixes the preimage with its domain —
|
|
2792
|
-
* `"escrow" || signature_domain_version || cluster_id[32] || program_id[32]` — and from domain
|
|
2793
|
-
* version 4 also binds `destination_hash`. So the 199-byte hash is not merely out of date, it is
|
|
2794
|
-
* unverifiable everywhere: `escrow.rs`'s `require!(deposit_hash == message, DepositHashMismatch)`
|
|
2795
|
-
* rejects it on every cluster.
|
|
2796
|
-
*
|
|
2797
|
-
* WHY IT THROWS INSTEAD OF BEING DELETED OR LEFT ALONE. It was exported from this package's
|
|
2798
|
-
* entry point, so removing the symbol outright is a hard break for any consumer that imports it,
|
|
2799
|
-
* while leaving it was worse: it returned a well-formed 32-byte hash that fails on-chain with
|
|
2800
|
-
* `DepositHashMismatch` and no indication why. Throwing turns an undiagnosable on-chain rejection into an
|
|
2801
|
-
* error at the call site that names the replacement.
|
|
2802
|
-
*
|
|
2803
|
-
* Build deposit authorizations through the shared sender_auth adapter
|
|
2804
|
-
* (`getChainAdapter(chainId).buildAuthMessage(...)`), which selects the correct preimage from the
|
|
2805
|
-
* domain version it is given and is the same implementation the facilitator verifies against.
|
|
2806
|
-
*
|
|
2807
|
-
* @throws Always.
|
|
2808
|
-
*/
|
|
2809
|
-
declare function hashSolanaDeposit(_prehash: SolanaDepositPrehash): never;
|
|
2810
2710
|
/**
|
|
2811
2711
|
* Generates a valid nonce for Solana replay protection (upper 32 bits: random
|
|
2812
|
-
* bucket, lower 8 bits: random slot 0..MAX_VALID_SLOT)
|
|
2813
|
-
*
|
|
2712
|
+
* bucket, lower 8 bits: random slot 0..MAX_VALID_SLOT), using a CSPRNG with
|
|
2713
|
+
* rejection sampling.
|
|
2814
2714
|
*
|
|
2815
2715
|
* @returns A bigint nonce suitable for the deposit message
|
|
2816
2716
|
*/
|
|
@@ -2823,14 +2723,13 @@ declare function generateSolanaNonce(): bigint;
|
|
|
2823
2723
|
* manually-crafted utilities for the Atum payment gateway.
|
|
2824
2724
|
*/
|
|
2825
2725
|
|
|
2826
|
-
declare const PAYMENT_REQUEST_VERSION = "1.0";
|
|
2827
|
-
|
|
2828
2726
|
/**
|
|
2829
2727
|
* Applies a SenderSigner to an unsigned PaymentRequest, signing every entry in
|
|
2830
|
-
* signed_messages (filling each signature, and payload.delegate_signer where the
|
|
2831
|
-
* chain requires it).
|
|
2832
|
-
*
|
|
2833
|
-
*
|
|
2728
|
+
* signed_messages as given (filling each signature, and payload.delegate_signer where the
|
|
2729
|
+
* chain requires it). The gateway verifies every signed message. To check what a request
|
|
2730
|
+
* commits to before signing it, see docs/signing.md.
|
|
2731
|
+
*
|
|
2732
|
+
* @throws If the request has no signed_messages.
|
|
2834
2733
|
*/
|
|
2835
2734
|
declare function signPaymentRequest(request: PaymentRequest, signer: SenderSigner): Promise<PaymentRequest>;
|
|
2836
2735
|
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
@@ -2844,50 +2743,48 @@ declare const defaultGateway: string;
|
|
|
2844
2743
|
* Default request-layer configuration, with `BASE` set to this package's default
|
|
2845
2744
|
* gateway ({@link defaultGateway}, production-testnet).
|
|
2846
2745
|
*
|
|
2847
|
-
* The
|
|
2848
|
-
*
|
|
2849
|
-
* without an explicit URL never targets a live-funds environment. The override
|
|
2850
|
-
* lives here rather than in `src/generated/`, which is reproduced from the
|
|
2851
|
-
* contract and stays in sync with it.
|
|
2746
|
+
* The OpenAPI contract's first `servers` entry is mainnet; this package defaults to testnet
|
|
2747
|
+
* so a client created without an explicit URL never targets a live-funds environment.
|
|
2852
2748
|
*
|
|
2853
2749
|
* Exported for callers that want the default configuration shape.
|
|
2854
|
-
* {@link PaymentGatewayClient} does not read it: the client resolves its own
|
|
2855
|
-
* `BASE` and passes it explicitly.
|
|
2750
|
+
* {@link PaymentGatewayClient} does not read it: the client resolves its own `BASE`.
|
|
2856
2751
|
*/
|
|
2857
2752
|
declare const OpenAPI: OpenAPIConfig;
|
|
2858
2753
|
/**
|
|
2859
2754
|
* Default quote-collection window for {@link PaymentGatewayClient.prepareQuoteRequest}
|
|
2860
|
-
* (`quote_deadline = now + this`, in seconds).
|
|
2861
|
-
*
|
|
2862
|
-
*
|
|
2863
|
-
* quotes inline
|
|
2864
|
-
*
|
|
2865
|
-
* shorter window can drop them — plus headroom against client↔gateway clock skew. A
|
|
2866
|
-
* caller on a badly-skewed clock can still pass a larger `quoteDeadlineSeconds`.
|
|
2755
|
+
* (`quote_deadline = now + this`, in seconds). Bidding closes at the quote deadline and the
|
|
2756
|
+
* gateway always waits until then, so the window is time every quote request spends. 3s
|
|
2757
|
+
* leaves settlers ample time to quote and lets a sync (`?wait=true`) request return `ready`
|
|
2758
|
+
* with its quotes inline. A caller whose clock lags the gateway's should pass a larger
|
|
2759
|
+
* `quoteDeadlineSeconds`, since the gateway refuses a quote deadline already in its past.
|
|
2867
2760
|
*/
|
|
2868
|
-
declare const DEFAULT_QUOTE_DEADLINE_SECONDS =
|
|
2761
|
+
declare const DEFAULT_QUOTE_DEADLINE_SECONDS = 3;
|
|
2869
2762
|
/** Default settlement horizon (`fulfillment_deadline = now + this`, seconds); shared by both request builders. */
|
|
2870
2763
|
declare const DEFAULT_FULFILLMENT_DEADLINE_SECONDS = 3600;
|
|
2871
2764
|
/**
|
|
2872
2765
|
* Default `quote_deadline` the single-shot payment path ({@link PaymentGatewayClient.preparePaymentRequest})
|
|
2873
|
-
* stamps (seconds) when the caller passes no `quoteDeadlineSeconds`.
|
|
2874
|
-
*
|
|
2766
|
+
* stamps (seconds) when the caller passes no `quoteDeadlineSeconds`. The gateway runs the
|
|
2767
|
+
* auction until this deadline before it awards a settler, so the window is time every
|
|
2768
|
+
* payment spends. It has to cover signing and submitting the request as well as settlers
|
|
2769
|
+
* quoting; 3s fits a signer that answers in well under a second. It is also how long a signed
|
|
2770
|
+
* request stays submittable. Pass a larger `quoteDeadlineSeconds` when signing takes longer
|
|
2771
|
+
* (for example a signer that waits for an approval), to submit the request later, or when the
|
|
2772
|
+
* caller's clock lags the gateway's.
|
|
2875
2773
|
*/
|
|
2876
|
-
declare const DEFAULT_PAYMENT_QUOTE_DEADLINE_SECONDS =
|
|
2774
|
+
declare const DEFAULT_PAYMENT_QUOTE_DEADLINE_SECONDS = 3;
|
|
2877
2775
|
/**
|
|
2878
2776
|
* Extended PaymentGatewayClient with convenience methods
|
|
2879
2777
|
*/
|
|
2880
2778
|
declare class PaymentGatewayClient extends PaymentGatewayClient$1 {
|
|
2881
2779
|
constructor(config?: PaymentGatewayClientConfig, HttpRequest?: HttpRequestConstructor);
|
|
2882
2780
|
/**
|
|
2883
|
-
* Fetches chain defaults from the payment gateway
|
|
2884
|
-
*
|
|
2885
|
-
* Goes through the generated typed client, so the request shares the payment calls'
|
|
2886
|
-
* transport: one base URL, one timeout policy, and `/v1/defaults` is described by the
|
|
2887
|
-
* OpenAPI contract rather than assembled by hand here.
|
|
2781
|
+
* Fetches chain defaults from the payment gateway (`GET /v1/defaults`), using the same
|
|
2782
|
+
* base URL and timeout policy as the payment calls.
|
|
2888
2783
|
*
|
|
2889
2784
|
* @param chainId The CAIP-2 chain identifier (e.g., "eip155:42161")
|
|
2890
2785
|
* @returns The chain defaults including escrow, quote selector, and fulfillment verifier
|
|
2786
|
+
* @throws If the chain id is empty, the request fails, or the response is missing a
|
|
2787
|
+
* required field or describes a different chain.
|
|
2891
2788
|
*/
|
|
2892
2789
|
fetchChainDefaults(chainId: string): Promise<ChainDefaults>;
|
|
2893
2790
|
/**
|
|
@@ -2912,8 +2809,10 @@ declare class PaymentGatewayClient extends PaymentGatewayClient$1 {
|
|
|
2912
2809
|
* destinationAccount: "0xMerchantAddress",
|
|
2913
2810
|
* destinationAsset: "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831", // USDC on Arbitrum
|
|
2914
2811
|
* fulfillmentAmount: "10000000", // 10 USDC (6 decimals)
|
|
2812
|
+
* maxSourceAmount: "10010000", // at most 10.01 USDC from the payer (source units)
|
|
2813
|
+
* requestId: "order-4711",
|
|
2915
2814
|
* });
|
|
2916
|
-
* //
|
|
2815
|
+
* // Deadlines and the nonce are defaulted; the spend cap never is.
|
|
2917
2816
|
*
|
|
2918
2817
|
* const signer = createSenderSigner("eip155:8453", { provider: "raw", privateKey });
|
|
2919
2818
|
* await signPaymentRequest(request, signer); // fills sender_auth, ready to submit
|
|
@@ -2928,7 +2827,12 @@ declare class PaymentGatewayClient extends PaymentGatewayClient$1 {
|
|
|
2928
2827
|
sourceAsset: string;
|
|
2929
2828
|
destinationAccount: string;
|
|
2930
2829
|
destinationAsset: string;
|
|
2931
|
-
|
|
2830
|
+
/**
|
|
2831
|
+
* REQUIRED spend cap in the source token's smallest units: signed into the Permit2 as the most
|
|
2832
|
+
* the escrow may take. Never derived here, because that needs both tokens' decimals and a
|
|
2833
|
+
* price. Build it from a settler quote with `capFromQuote`, or state it explicitly.
|
|
2834
|
+
*/
|
|
2835
|
+
maxSourceAmount: string;
|
|
2932
2836
|
/**
|
|
2933
2837
|
* REQUIRED idempotency key. It seeds the deterministic deposit nonce, so a retry that
|
|
2934
2838
|
* reuses the same `requestId` reproduces the same single-use permit (no double-charge),
|
|
@@ -2949,24 +2853,24 @@ declare class PaymentGatewayClient extends PaymentGatewayClient$1 {
|
|
|
2949
2853
|
/** Clock source used to stamp the deadlines. Defaults to `Date.now`; inject for offline/deterministic builds. */
|
|
2950
2854
|
now?: () => number;
|
|
2951
2855
|
/**
|
|
2952
|
-
* Explicit deposit-nonce override.
|
|
2953
|
-
*
|
|
2954
|
-
*
|
|
2955
|
-
*
|
|
2956
|
-
*
|
|
2957
|
-
*
|
|
2958
|
-
*
|
|
2959
|
-
* window is not blocked on-chain by the nonce alone. The payment gateway's `request_id`
|
|
2960
|
-
* dedup (and the init-only deposit PDA, which blocks a byte-identical re-POST forever) are
|
|
2961
|
-
* the durable backstop; pin `issued_at` via `solanaClockReader` to keep a rebuild inside
|
|
2962
|
-
* the same window.
|
|
2963
|
-
* Pass a value only to override the derived nonce.
|
|
2856
|
+
* Explicit deposit-nonce override. Omit in normal use: the nonce is then derived from
|
|
2857
|
+
* `requestId` + depositor, so rebuilding the same payment reproduces it.
|
|
2858
|
+
* - EVM/Tron: the Permit2 nonce is a permanent on-chain bitmap, so only one deposit can
|
|
2859
|
+
* settle across any number of rebuilds.
|
|
2860
|
+
* - Solana: the replay nonce is scoped to a ~128s window from `issued_at`, which is re-read
|
|
2861
|
+
* on each build. The gateway also deduplicates on `request_id`; pin `issued_at` via
|
|
2862
|
+
* `solanaClockReader` to keep a rebuild in the same window.
|
|
2964
2863
|
*/
|
|
2965
2864
|
nonce?: bigint | string;
|
|
2966
2865
|
/** Solana-only: override the RPC used to read the cluster clock for issued_at. */
|
|
2967
2866
|
solanaRpcUrl?: string;
|
|
2968
2867
|
/** Solana-only: injectable clock reader for `issued_at` (offline / test seam). */
|
|
2969
2868
|
solanaClockReader?: SolanaClusterUnixTimeReader;
|
|
2869
|
+
/**
|
|
2870
|
+
* Who performs deposit, reserve, and fulfill. Omitted leaves the key off. Omitted on the
|
|
2871
|
+
* wire means settler. Send-payment does not set this.
|
|
2872
|
+
*/
|
|
2873
|
+
executor?: PaymentRequest['executor'];
|
|
2970
2874
|
/**
|
|
2971
2875
|
* Pre-resolved corridor addresses. Omit to fetch them from the gateway
|
|
2972
2876
|
* `/v1/defaults`; supply to build offline. Each side is resolved independently —
|
|
@@ -2980,34 +2884,15 @@ declare class PaymentGatewayClient extends PaymentGatewayClient$1 {
|
|
|
2980
2884
|
}): Promise<PaymentRequest>;
|
|
2981
2885
|
/**
|
|
2982
2886
|
* Prepares a quote-request body (`CreateQuoteRequest`), ready to POST to
|
|
2983
|
-
* `/v1/payments/quote-requests`.
|
|
2984
|
-
* `preparePaymentRequest`:
|
|
2985
|
-
*
|
|
2986
|
-
* signing (and no private key) is required. The spend authorization arrives
|
|
2987
|
-
* later, at the award call.
|
|
2988
|
-
*
|
|
2989
|
-
* Both deadlines are populated here because the gateway requires them and
|
|
2990
|
-
* injects no defaults — it never mutates the originator-supplied body.
|
|
2991
|
-
* `quote_deadline` bounds the collection window (default
|
|
2992
|
-
* `DEFAULT_QUOTE_DEADLINE_SECONDS`); `fulfillment_deadline` bounds settlement
|
|
2993
|
-
* (default `DEFAULT_FULFILLMENT_DEADLINE_SECONDS`). `quote_deadline` must be
|
|
2994
|
-
* strictly earlier than `fulfillment_deadline` (enforced server-side; guarded
|
|
2995
|
-
* here for a clear client-side error).
|
|
2996
|
-
*
|
|
2997
|
-
* `quote_deadline` is stamped client-side and the gateway rejects it unless it
|
|
2998
|
-
* is strictly in the gateway's future, so a caller whose clock may lag the
|
|
2999
|
-
* gateway should pass a larger `quoteDeadlineSeconds` (see
|
|
3000
|
-
* `DEFAULT_QUOTE_DEADLINE_SECONDS` for why the default is what it is).
|
|
2887
|
+
* `/v1/payments/quote-requests`. It carries the same corridor and contract fields as
|
|
2888
|
+
* `preparePaymentRequest` but no `sender_auth`: quoting needs no signature or private key,
|
|
2889
|
+
* and the spend authorization is supplied at award time.
|
|
3001
2890
|
*
|
|
3002
|
-
*
|
|
3003
|
-
*
|
|
3004
|
-
* `
|
|
3005
|
-
*
|
|
3006
|
-
*
|
|
3007
|
-
* must carry the identical contract fields the payment flow does. The ONLY
|
|
3008
|
-
* field this drops relative to `preparePaymentRequest` is `sender_auth`, which
|
|
3009
|
-
* is supplied at award time (quote-time is unauthenticated — no signing, no
|
|
3010
|
-
* private key).
|
|
2891
|
+
* Both deadlines are populated because the gateway requires them and injects no defaults.
|
|
2892
|
+
* `quote_deadline` (default `DEFAULT_QUOTE_DEADLINE_SECONDS`) must be strictly earlier than
|
|
2893
|
+
* `fulfillment_deadline` (default `DEFAULT_FULFILLMENT_DEADLINE_SECONDS`) and strictly in the
|
|
2894
|
+
* gateway's future, so a caller whose clock lags the gateway should pass a larger
|
|
2895
|
+
* `quoteDeadlineSeconds`.
|
|
3011
2896
|
*
|
|
3012
2897
|
* @param params Quote-request parameters
|
|
3013
2898
|
* @returns A complete `CreateQuoteRequest` body (no signature step needed)
|
|
@@ -3018,6 +2903,12 @@ declare class PaymentGatewayClient extends PaymentGatewayClient$1 {
|
|
|
3018
2903
|
sourceAsset: string;
|
|
3019
2904
|
destinationAccount: string;
|
|
3020
2905
|
destinationAsset: string;
|
|
2906
|
+
/**
|
|
2907
|
+
* Spend cap in the source token's smallest units; settlers' quotes above it are filtered.
|
|
2908
|
+
* Omit it to request quotes with no cap: nothing is sent, and the SDK never derives one.
|
|
2909
|
+
* A supplied value must be a positive base-10 integer. To cap a later payment from a quote,
|
|
2910
|
+
* see `capFromQuote`.
|
|
2911
|
+
*/
|
|
3021
2912
|
maxSourceAmount?: string;
|
|
3022
2913
|
/**
|
|
3023
2914
|
* The request id. Reuse the SAME value to retry: the gateway returns the original batch
|
|
@@ -3034,4 +2925,4 @@ declare class PaymentGatewayClient extends PaymentGatewayClient$1 {
|
|
|
3034
2925
|
}): Promise<CreateQuoteRequest>;
|
|
3035
2926
|
}
|
|
3036
2927
|
|
|
3037
|
-
export { $AuthorizationResult, $AwardAccepted, $AwardRequest, $AwardResponse, $AwardedPayment, $AwardedQuote, $BidAward, $ChainDefaults, $ChainDefaultsByChain, $CreateQuoteRequest, $DataIntegrityProof, $DeclineReason, $DeclineSummaryEntry, $ErrorResponse, $FulfillmentConfirmation, $GetDefaultsResult, $GetPaymentStatusResponse, $OwnedAsset, $PaymentBlockchainContext, $PaymentFailure, $PaymentRequest, $PaymentResponse, $PaymentStatus, $PaymentSummary, $PaymentTimelineResponse, $PaymentTransaction, $PaymentTransactions, $PreparePaymentRequest, $PreparePaymentResponse, $Quote, $QuoteRequestAccepted, $QuoteRequestResponse, $QuoteRequestStatusResponse, $ResolvePaymentResponse, $SenderAuth, $SenderAuthMessageScheme, $SignedMessage, $TimelineStep, $VerifiableCredential, $VerifiableCredentialAuth, ApiError, type ApiRequestOptions, type ApiResult, type ApprovalParams, AuthorizationsService, AuthorizePaymentData, AuthorizePaymentResponse, AwardQuoteData, AwardQuoteResponse, CancelError, CancelablePromise, type ChainDefaults, ChainDefaultsService, type ConfirmationOptions, CreateQuoteRequest, CreateQuoteRequestData, CreateQuoteRequestResponse, DEFAULT_FULFILLMENT_DEADLINE_SECONDS, DEFAULT_PAYMENT_QUOTE_DEADLINE_SECONDS, DEFAULT_POLL_INTERVAL_MS, DEFAULT_QUOTE_DEADLINE_SECONDS, DEFAULT_REQUEST_TIMEOUT_MS, DEFAULT_SYNC_WAIT_TIMEOUT_MS, DEFAULT_WAIT_BUDGET_MS,
|
|
2928
|
+
export { $AuthorizationResult, $AwardAccepted, $AwardRequest, $AwardResponse, $AwardedPayment, $AwardedQuote, $BidAward, $ChainDefaults, $ChainDefaultsByChain, $CreateQuoteRequest, $DataIntegrityProof, $DeclineReason, $DeclineSummaryEntry, $ErrorResponse, $FulfillmentAuthorization, $FulfillmentConfirmation, $GetDefaultsResult, $GetPaymentStatusResponse, $OwnedAsset, $PaymentBlockchainContext, $PaymentFailure, $PaymentRequest, $PaymentResponse, $PaymentStatus, $PaymentSummary, $PaymentTimelineResponse, $PaymentTransaction, $PaymentTransactions, $PreparePaymentRequest, $PreparePaymentResponse, $Quote, $QuoteRequestAccepted, $QuoteRequestResponse, $QuoteRequestStatusResponse, $RefundSignature, $ResolvePaymentResponse, $SenderAuth, $SenderAuthMessageScheme, $SignedMessage, $TimelineStep, $VerifiableCredential, $VerifiableCredentialAuth, ApiError, type ApiRequestOptions, type ApiResult, type ApprovalParams, AuthorizationsService, AuthorizePaymentData, AuthorizePaymentResponse, AwardQuoteData, AwardQuoteResponse, CancelError, CancelablePromise, type ChainDefaults, ChainDefaultsService, type ConfirmationOptions, CreateQuoteRequest, CreateQuoteRequestData, CreateQuoteRequestResponse, DEFAULT_FULFILLMENT_DEADLINE_SECONDS, DEFAULT_PAYMENT_QUOTE_DEADLINE_SECONDS, DEFAULT_POLL_INTERVAL_MS, DEFAULT_QUOTE_DEADLINE_SECONDS, DEFAULT_REQUEST_TIMEOUT_MS, DEFAULT_SYNC_WAIT_TIMEOUT_MS, DEFAULT_WAIT_BUDGET_MS, type EnsureApprovalResult, ErrorResponse, GatewayTimeoutError, GetDefaultsData, GetDefaultsResponse, GetPaymentStatusData, GetPaymentStatusResponse2, GetPaymentTimelineData, GetPaymentTimelineResponse, GetQuoteRequestStatusData, GetQuoteRequestStatusResponse, HealthCheckResponse, HealthService, Interceptors, InvalidAccountError, type Reason as InvalidAccountReason, MAX_VALID_SLOT, type OnCancel, OpenAPI, type OpenAPIConfig, VERSION as PAYMENT_REQUEST_VERSION, PERMIT2_CONTRACT_ADDRESS, type ParsedAssetIdentifier, PaymentGatewayClient, type PaymentGatewayClientConfig, PaymentRequest, PaymentsService, PreparePaymentData, PreparePaymentResponse2, QuoteRequestsService, REPLAY_HORIZON_SECS, type RequestTimeouts, ResolvePaymentData, ResolvePaymentResponse2, type SenderSignature, type SenderSigner, type SenderSignerOptions, SignedMessage, type SolanaClusterUnixTimeReader, type StatusSnapshot, SubmitPaymentData, SubmitPaymentResponse, TOTAL_BUCKETS, type TronWebLike, type TurnkeyConfig, TurnkeySenderSigner, type WaitOutcome, type WaitParams, assetChainId, base58ToBytes, base58ToHex, bytesToHex, capFromQuote, createSenderSigner, defaultGateway, encodeU64LE, ensureSourceApproval, generateSolanaNonce, getErrorResponse, hashPermitWitnessTransferFrom, hashTvmPermitWitnessTransferFrom, hexToBytes, isApiError, isGatewayTimeoutError, isTerminalStatus, isUnconfirmed, maskChainId, needsSourceApproval, normalizeAddress, parseAssetIdentifier, resolveTurnkeyAddresses, signPaymentRequest, waitForTerminalStatus };
|