@atumlabs/payment-gateway-client 2.2.0 → 3.0.1
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 +108 -0
- package/LICENSE +202 -83
- package/NOTICE +2 -0
- package/README.md +547 -46
- package/THIRD-PARTY-NOTICES.txt +7 -1
- package/dist/cli/approve-permit2.d.ts +1 -0
- package/dist/cli/approve-permit2.js +7325 -0
- package/dist/cli/payment-status.js +2307 -261
- package/dist/cli/quote-status.js +2305 -259
- package/dist/cli/request-quote.js +2333 -266
- package/dist/cli/send-payment.js +3079 -360
- package/dist/index.d.ts +926 -1701
- package/dist/index.js +3470 -492
- package/dist/sender-auth-verify-C-Q-zvAO.d.ts +2013 -0
- package/dist/signing.d.ts +223 -0
- package/dist/signing.js +7219 -0
- package/docs/idempotency.md +97 -40
- package/docs/signing.md +218 -0
- package/package.json +48 -14
- package/signing.d.ts +2 -0
- package/signing.js +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,114 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **Breaking: `PaymentStatus` is one type across all three payment responses**, with the values `pending`, `finalizing`, `completed` and `failed`. Submitting a payment, polling its status and reading its timeline previously returned three unrelated status types, so a caller could not write one function that handled "a payment status". `settling` is gone — it described how far our own bookkeeping had got, not the payment. `cancelled` is gone too: nothing could produce it, and a payment that ends without being delivered is reported as `failed`. `isTerminalStatus('cancelled')` therefore returns `false` now. A caller with an exhaustive `switch` on status gets a compile error and has to add a `finalizing` branch; a caller testing only for `completed` or `failed` is unaffected.
|
|
12
|
+
- **`finalizing` is new, and is NOT terminal.** It means the transaction paying the recipient is on chain and accruing the confirmations its chain requires — made, but not yet irreversible, much as a card authorization is not a settlement. It normally becomes `completed` and can still become `failed`. Nothing emits it yet; it is declared here so clients are ready before the gateway starts sending it.
|
|
13
|
+
- **Breaking: one failure shape.** `PaymentError` and `TimelineError` are replaced by a single `PaymentFailure` used by all three responses, so a failure reads identically however you ask about the payment. On the timeline that is a real change of shape: `chain_id`, `tx_hash` and `revert_reason` were flat on the error and are now nested under `blockchain_context`, which also carries the four fields that endpoint previously discarded — the block number among them.
|
|
14
|
+
- **Breaking: `tx_hash` is now `transaction_hash`**, on `error.blockchain_context` (all three responses) and on `steps[]` (timeline). This is the name the shared error shape and the rest of our published specs already used; the payment API was the outlier. **A caller reading `error.blockchain_context.tx_hash` gets `undefined` after upgrading** — there is no deprecation period because the field moved to the shared definition rather than being duplicated under both names.
|
|
15
|
+
- `PaymentFailure` now carries `docs_url` and `retry_classification`. Both were already computed for every error code but only ever reached failed *requests*, never failed *payments*.
|
|
16
|
+
- The `payment-outcome` CLI no longer maps `cancelled` to exit code 3 (terminal failure), because the gateway no longer reports it. A status this build does not recognise exits 2 (still pending), which is the safe direction: a script that waits one more round costs a poll, a script that gives up on a live payment can cost a second charge.
|
|
17
|
+
- **New `transactions` object** (`deposit`, `fulfillment`) on all three responses, for looking a payment's on-chain transactions up yourself. Declared but not yet populated.
|
|
18
|
+
|
|
19
|
+
### Security
|
|
20
|
+
- The HTTP client is now axios 1.20.0. 1.13.2 had a run of advisories (prototype-pollution gadgets that could tamper with requests or responses, proxy-authorization leaks, NO_PROXY SSRF, ReDoS). A caller that pins axios independently should take 1.18.0 or newer. A timeout that fires after headers have arrived still surfaces as `GatewayTimeoutError`: axios 1.20 attaches the partial response, and the client drops it so a stalled error body is not reported as a completed HTTP status.
|
|
21
|
+
|
|
22
|
+
## [3.0.1] - 2026-09-18
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- Published under Apache-2.0 with `publishConfig.access: public`. npm will not overwrite 3.0.0, so this version exists to ship the LICENSE, NOTICE, and public visibility that 3.0.0 cannot take.
|
|
26
|
+
|
|
27
|
+
## [3.0.0] - 2026-09-16
|
|
28
|
+
|
|
29
|
+
> **Read this before upgrading if the gateway has been accepting your asset identifiers.**
|
|
30
|
+
> They are now validated locally, on both entry points and on both legs of the payment. One rule
|
|
31
|
+
> is stricter than the gateway's, the EIP-55 checksum on a mixed-case EVM token address, so a
|
|
32
|
+
> value the gateway resolves fine can be refused before the request is even built. See Breaking.
|
|
33
|
+
>
|
|
34
|
+
> A second break sits there too. A blank `pinnedAddress` is now rejected rather than skipping the
|
|
35
|
+
> sender check, so a caller that defaults that field to an empty string has to pass the sender
|
|
36
|
+
> address instead, or omit the field to skip the check on purpose.
|
|
37
|
+
|
|
38
|
+
Quote-requests now carry the same idempotency contract as payments: one `request_id`
|
|
39
|
+
identifies one batch, re-sending it recovers that batch, and reusing it for a different
|
|
40
|
+
corridor is refused rather than silently served.
|
|
41
|
+
|
|
42
|
+
### Breaking
|
|
43
|
+
- Asset identifiers are validated on every entry point. `prepareQuoteRequest` built no deposit and so applied no address rules at all, and `preparePaymentRequest` applied them only to the source, since only the source reached a chain library. Both legs of both entry points are now checked, so a value that used to be forwarded can now be refused locally, with the messages under Fixed: a malformed or wrongly-checksummed EVM token address, a placeholder such as `erc20:0x6`, a native `slip44` asset, a malformed Tron or Solana token reference, or a hex `eip155` chain id. Every segment is also checked against the character set the PaymentRequest schema publishes, so a stray space is refused here rather than remotely.
|
|
44
|
+
- **A mixed-case EVM token address whose EIP-55 checksum does not hold is refused on the destination leg too, and that is deliberate.** The gateway tolerates such a destination on purpose: `blockchain.AssetIdentifier.Equal` folds the case of an eip155 token address with `EqualFold`, the token registry lowercases before it looks a token up, and `payment-gw/internal/canonical` folds a destination it could not parse rather than refusing it, precisely so two spellings of one destination cannot refuse a legitimate retry. The settler lowercases before it checksums, so a wrong checksum settles fine. This rule therefore buys no settlement safety. It is typo protection while the request is still being built, kept fatal because a mistyped token address is cheap to catch here and expensive to discover once a payout has landed on it. It is narrow on purpose: the destination account is not checked, so this is not a claim that the client validates the receive side. A caller that can rewrite the value should send the all-lowercase form of the destination, which makes no checksum claim, is accepted, and is the same twenty bytes. A caller whose corridor is composed inside a library that builds the request for it, as in `mppx-atum-escrow`, has nothing to rewrite, and the lowercasing belongs there.
|
|
45
|
+
- **Behaviour change.** An empty `pinnedAddress` is now rejected before anything is signed or submitted, on both signing providers. It previously counted as omitting the field, so the check that the sender is the signer's own address was skipped: the Turnkey path forwarded the pin only when truthy, and the private-key path gated its key-derivation check the same way. What that produced depended on the caller. `send-payment` derives the depositor from the same `<sender>` argument, so the payment went out with an empty source account for the gateway to reject. An SDK caller that supplies `depositor` and `pinnedAddress` separately got a valid, settleable payment whose sender was never checked against the wallet or the key, which is the case this closes. A call that previously proceeded now throws, so a caller defaulting the field to `''` needs to fall back to the sender address instead. Omitting `pinnedAddress` still skips the check as before.
|
|
46
|
+
- `prepareQuoteRequest` now **requires** `requestId`, and `requestIdPrefix` is gone. It
|
|
47
|
+
previously generated an id when you omitted one, on the grounds that the id was only a
|
|
48
|
+
correlation handle there — which is no longer true, because it is now the idempotency key.
|
|
49
|
+
Generating one for you meant a rebuilt retry quietly opened a **second** batch and left the
|
|
50
|
+
first unreachable. `preparePaymentRequest` has always required it; the two now match. The requirement is
|
|
51
|
+
enforced at runtime as well as in the type, so an untyped JavaScript caller or an empty
|
|
52
|
+
string throws rather than sending a request with no idempotency key. Pass
|
|
53
|
+
your own stable id, and reuse it to retry. The `request-quote` CLI is unaffected: it
|
|
54
|
+
generates an id when `--request-id` is omitted and prints it back, exactly as `send-payment`
|
|
55
|
+
does.
|
|
56
|
+
- `QuoteRequestResponse.idempotent_replay` and `QuoteRequestAccepted.idempotent_replay` are new
|
|
57
|
+
**required** fields. Reading a response is simpler, not harder — the flag is always present,
|
|
58
|
+
so `false` means `false` rather than "maybe an older gateway".
|
|
59
|
+
- **The error `domain` value `SOLVER_GATEWAY` is now `SETTLER_GATEWAY`.** It names the service that runs the settler auction, which is a settler gateway; the old name was left over from earlier terminology and was the only place the word "solver" still reached callers. Code that switches on `AtumError.domain` and has a `'SOLVER_GATEWAY'` case must rename it — nothing else about the error changes, and `domain` is diagnostic metadata rather than something the payment flow branches on, so most callers are unaffected. The public `code` and `message` on an error are unchanged: the internal codes behind this domain already mapped to the public `SERVICE_BUSY` and `INTERNAL_ERROR`, and still do.
|
|
60
|
+
|
|
61
|
+
### Added
|
|
62
|
+
- **`ensureSourceApproval` and `needsSourceApproval`**, so the Permit2 prerequisite this package has always stated can now be satisfied from it. Paying from EVM or Tron needs a one-off approval of the source token for Permit2; without it a payment is built correctly, signed correctly, accepted by the gateway, and then reverts on-chain at settlement — the most expensive way to learn about a missing allowance. Until now the README and `send-payment --help` named the requirement and offered no way to meet it. `ensureSourceApproval` reads the current allowance and sends an approval only if it falls short; `needsSourceApproval` answers the same question read-only, spending no gas, so a payer can be warned before being asked to sign. Solana reports that no approval is needed rather than doing nothing, since its deposit authorizes the transfer itself. **This is the first part of this package that broadcasts a transaction and spends gas.** Everything else builds and signs offline, and that has not changed: you pass a connected ethers signer (or a TronWeb instance for Tron), so the package still never chooses an RPC endpoint or holds a key. An approval is unlimited by default, so later payments need no further transaction; `approvalAmount` bounds it instead, at the cost of having to renew it as Permit2 consumes it — pair a bound with `requiredAllowance` across repeated payments, or the bound stops covering itself as soon as the first charge is decremented from it. Waiting for the approval to confirm is bounded by `confirmation.timeoutMs` (one minute by default) rather than indefinite, and `onSubmitted` hands you the transaction hash the moment it is broadcast. Tokens that refuse to overwrite a non-zero allowance — mainnet USDT most notably — are reset to zero first, but only where the token actually demands it. An approval is refused outright when the signer you pass does not hold the `owner` account whose allowance was read: an approval only ever applies to the account that sends it, so a mismatched signer would approve that account, hand back a transaction hash that reads as success, and leave the owner exactly as unable to pay as before. The read-only `needsSourceApproval` is unaffected, since asking whether a payer is ready without holding their keys is a legitimate preflight. `isUnconfirmed` ships alongside them for telling a broadcast-but-unseen approval apart from one that failed: the wait for a confirmation is bounded, and reaching that bound is not a failure, so the two need opposite responses. `approve-permit2` reports an unconfirmed run as `{"unconfirmed": true, "txHash": ...}` on stdout rather than as a bare non-zero exit indistinguishable from a revert. These helpers raise an allowance and never lower one, so `--amount` below an allowance the wallet already holds leaves it alone and says so.
|
|
63
|
+
- **`approve-permit2`**, a command that performs that approval. `approve-permit2 <sender> <sourceAsset> --rpc-url <url>` takes the same CAIP-19 asset string as `send-payment`, and `--check` reports whether an approval is needed without sending anything or needing a key. It is a separate command rather than a flag on `send-payment` because it is a different kind of act: it spends gas, once per wallet and token, and is worth doing deliberately and ahead of time rather than as a side effect of paying. The private key comes from `PRIVATE_KEY` or an interactive prompt and is never accepted as a flag, which would put it in shell history and in the process list. EVM and Tron; Tron additionally needs `tronweb`, an optional peer dependency, so that EVM-only installs do not carry it. The result JSON goes to stdout, like the other commands. The allowance is read before a key is ever requested, so an already-approved wallet — which is every wallet after the first run — never has to produce a secret to learn there was nothing to do, and the key is checked against `<sender>` before anything is sent, so a mismatched key cannot approve the wrong account and report success.
|
|
64
|
+
- **Signing helpers for all three PaymentRequest signatures**, available from the `@atum-labs/payment-gateway-client/signing` subpath. A PaymentRequest carries three unrelated signatures and choosing the wrong one is the mistake this surface exists to prevent, so they are named for what they authorize rather than for how they are built. `signPaymentRequest` fills `sender_auth.signed_messages[]` and authorizes the **on-chain transfer**. `signDeclaration` attests that the **document** came from its signer, as a W3C Data Integrity proof over the URDNA2015-canonicalized request — it is exported under that name, rather than the upstream library's `signPaymentRequest`, precisely so the two cannot be confused. `buildEnvelope` and `buildEnvelopeForAccount` carry the **originator's identity** as a holder-signed PaymentRequestEnvelope. Signing one does not stand in for another: a request with a valid `sender_auth` and no envelope authorizes a transfer by an unidentified originator, and the reverse identifies an originator who has authorized nothing. Every one of them takes a **signer, never a private key** — a hex key would force raw key material into a JavaScript string that cannot be zeroized, is copied on assignment, and lands in heap snapshots and any log line that stringifies the surrounding object, and it would exclude every custodian whose key sits in a KMS or an HSM. `signerFromEthersWallet` covers a local key; a custodial signer implements `signDigest` over its own call. The signature contract is 65 bytes of `r || s || v` with **v ∈ {0, 1}**: a signature whose v is already 27 or 28 is refused, because applying the alignment twice recovers a *different* address, which is a well-formed signature that verifies as somebody else. Also exported: `computeRequestHash`, `verifyDeclaration` (which **throws** rather than returning a flag, and refuses a document whose signature recovers a signer other than the one it claims), `verifyPaymentRequest` for checking what a `sender_auth` signature actually commits to before submitting, `didForAccount`, `verificationMethodForAccount`, and their types. See `docs/signing.md`.
|
|
65
|
+
- **`jsonld` is a new dependency**, and it is pinned exactly rather than floating. It runs URDNA2015, the canonicalization that determines exactly what a signature covers, so a minor release that changed its output would change what customers sign, on their machines, with nothing in our CI to notice.
|
|
66
|
+
- **`send-payment --prepare-only` and `send-payment --submit <file>`** split the single-shot command in two. `--prepare-only` builds and signs a payment request, prints it to stdout, and stops without submitting; `--submit` sends one that was prepared earlier (`-` reads stdin, so the two pipe together). Together they turn the single-shot command into an inspect-then-approve flow: the printed document is byte-for-byte what that run would have POSTed, so it can be read and reviewed before any money moves. Treat it like a signed cheque: it is a signed authorization rather than a draft and `--submit` needs no key, so delete the file once the payment is sent or abandoned. Re-preparing under the same `request_id` targets the same payment and cannot pay twice, but does not reproduce the same bytes: the deadlines are stamped from the clock on each run and the signature covers them. Two things to know. `--prepare-only` still calls the gateway, which is where the corridor addresses come from, so it is not an offline signing mode. And the exit-code table describes a *submitted* payment, so it does not apply under `--prepare-only`, where `0` means the request was built and signed and no payment exists — do not chain a payment-conditional step off such a run. If you intend to submit later, widen the quote window with `--quote-deadline-seconds` — but by tens of seconds, not minutes. A prepared document is submittable only while its window is open (the default is 10 seconds), and that same window is the settler auction: the gateway waits it out before selecting, and settler quotes expire on their own, so an over-long window ends in a terminal `QUOTES_EXPIRED`. `--submit` signs nothing and needs no private key, takes no corridor arguments, refuses the options that only shape a request being built rather than ignoring them, and reports with the same exit codes and streams as an ordinary run; it supports `--wait` the same way. The two flags are mutually exclusive, and a short invocation now names both forms rather than reporting a missing argument.
|
|
67
|
+
- The Permit2 approval prerequisite now appears at the top of `send-payment --help`, above the arguments and options, instead of in the last paragraph. It is the most common cause of a payment that is built and signed correctly and still fails to settle, and it was previously about a hundred lines below the usage line. The contract addresses stay at the end of the help, where the prerequisite points.
|
|
68
|
+
- **`waitForTerminalStatus` and `isTerminalStatus` are exported**, so following a submitted payment to its end is one call rather than a hand-written loop. A submission usually comes back `pending`, so waiting is the ordinary path, and the previous answer — write your own poll — put the burden of getting it right on every caller. A failed status check does not end the wait: a blip while a payment is settling is the worst moment to stop looking, so failures are counted in `errorCount`, reported through `onError`, and polling continues to the budget. The outcome reports `timedOut` so a caller can tell "still in flight" from "finished", which a bare loop cannot. This is the same helper behind the `send-payment --wait` flag, so the command-line tools and the SDK now agree by construction. `isTerminalStatus` is the single definition of which states are final, so a caller no longer keeps its own copy of that list in step with the contract. `budgetMs` is optional and in milliseconds, defaulting to `DEFAULT_WAIT_BUDGET_MS` (one minute); the seconds-based constant behind the command line's `--wait-seconds` stays internal, so there is one unit on the public surface and no way to pass 60 where 60000 was meant. An optional `signal` ends the wait early for a caller that must stop on shutdown or when its request is cancelled, and the outcome reports `aborted` — which always implies `timedOut`, so an interrupted wait can never be read as a settled payment. Also exported: `DEFAULT_WAIT_BUDGET_MS`, `DEFAULT_POLL_INTERVAL_MS`, `StatusSnapshot`, `WaitOutcome`, `WaitParams`.
|
|
69
|
+
- **`ErrorResponse.payment_id`**, alongside the existing `request_id`. The two ids are independent and either can be absent: `request_id` correlates the HTTP call, and `payment_id` names the payment the error was raised against. It closes a real mislabel. A settlement failure on `POST /v1/payments` was returning the payment id in `request_id`, because that was the only id field the shape had, so a caller who trusted the field name and looked the value up as a request id found nothing. Read `getErrorResponse(err)?.payment_id` and reconcile with `GET /v1/payments/{paymentId}/status` before retrying, because a failed settlement leaves the on-chain outcome unguaranteed. The field is absent whenever the error is not about a specific payment, which is every validation or authentication failure raised before a payment exists.
|
|
70
|
+
- `parseAssetIdentifier` and `assetChainId` are exported, so a caller can apply the same parsing and canonicalization the CLIs do.
|
|
71
|
+
- `timeoutMs` and `syncWaitTimeoutMs` on the client config, for callers whose gateway is slower than the defaults (30s for a promptly-answered request, 120s for one the gateway holds open). The two are separate because some endpoints are held open on purpose, bounded by the gateway's own `quote_sync_wait_seconds` and `payment_sync_wait_seconds`, so one budget cannot serve both: too short aborts a settling payment, too long leaves an unresponsive gateway hanging. An interceptor that sets `timeout` still takes precedence, for a per-request override. New exports: `GatewayTimeoutError`, `isGatewayTimeoutError`, `PaymentGatewayClientConfig`, `RequestTimeouts`, `DEFAULT_REQUEST_TIMEOUT_MS`, `DEFAULT_SYNC_WAIT_TIMEOUT_MS`.
|
|
72
|
+
- `createQuoteRequest` returns **`409` `IDEMPOTENCY_TERMS_MISMATCH`** when a `request_id` is
|
|
73
|
+
reused with different economics (accounts, assets, or amounts), instead of returning the
|
|
74
|
+
first batch. Without it you could receive quotes priced for the corridor you asked for
|
|
75
|
+
earlier, and awarding one of those settles a payment on that corridor.
|
|
76
|
+
- `idempotent_replay` on both quote-request responses tells you whether you were handed an
|
|
77
|
+
existing batch or a newly opened one.
|
|
78
|
+
|
|
79
|
+
### Changed
|
|
80
|
+
- `resolveTurnkeyAddresses` takes its Turnkey config without `pinnedAddress`. That call lists the wallet's accounts and verifies nothing, so a pin handed to it was ignored. Passing one inline is now a compile error instead of a check that never ran. A caller reusing one whole `TurnkeyConfig` for both this call and signing is unaffected.
|
|
81
|
+
- The CLIs no longer print the full gateway defaults listing when a chain-defaults lookup fails. The failure itself names the chain and carries the gateway's error, and the client no longer makes the second `/defaults` request that fetched the listing.
|
|
82
|
+
- Re-sending a quote-request whose `quote_deadline` has already passed now returns the original
|
|
83
|
+
batch instead of `400 QUOTE_DEADLINE_NOT_FUTURE`. The collection window is short, so a retry
|
|
84
|
+
after a lost response almost always carries an expired deadline — previously that made the
|
|
85
|
+
`quote_request_id` unrecoverable even though the batch existed and held quotes. Deadlines are
|
|
86
|
+
exempt from the idempotency comparison, on this endpoint as on payments.
|
|
87
|
+
- Note the window itself is not extended: it belongs to the batch, so asking again with a later
|
|
88
|
+
`quote_deadline` returns the batch's own window.
|
|
89
|
+
- `docs/idempotency.md` is reorganised around the shared contract rather than the payment
|
|
90
|
+
endpoint, with the endpoint-specific parts (the on-chain settlement guarantee, payment status)
|
|
91
|
+
labelled as such.
|
|
92
|
+
- The `409 IDEMPOTENCY_TERMS_MISMATCH` message no longer says a *payment* exists. It previously
|
|
93
|
+
read "already used for a payment with different terms", which is wrong on quote-requests —
|
|
94
|
+
nothing is charged there and no payment exists for the caller to go looking for. It now says
|
|
95
|
+
"already used for a different request". This affects the payments path too: the wording is
|
|
96
|
+
slightly less specific there, in exchange for being correct on both. The `code` and the docs
|
|
97
|
+
link are unchanged, so nothing a client branches on has moved.
|
|
98
|
+
- The asynchronous (202) quote-request response now says plainly that its `status` field is a
|
|
99
|
+
constant rather than a report of the batch's state: on an idempotent replay the window may
|
|
100
|
+
already have closed and it will still read `collecting`. Points at
|
|
101
|
+
`GET /v1/payments/quote-requests/{quoteRequestId}` instead. Documentation only.
|
|
102
|
+
|
|
103
|
+
### Fixed
|
|
104
|
+
- A malformed asset identifier is reported with the offending value and what to correct, instead of surfacing as a chain-library error. A missing `/` between the chain and the token says `Invalid asset identifier "<value>": expected CAIP-19 "<chain>/<type>:<address>", e.g. eip155:421614/erc20:0x...` where it previously threw `TypeError: Cannot read properties of undefined (reading 'split')`. An empty token or a stray slash says `Invalid token address in asset "<value>".`, and a mixed-case address whose EIP-55 checksum does not hold says `Token address "<addr>" has an invalid checksum. Fix the capitalization or use the all-lowercase form.` Those were `invalid address` and `bad address checksum` respectively, from `ethers`. Two cases name their real cause rather than the address they were also reported as: a hex `eip155` chain id says `Invalid eip155 chain id "0x66eee" in asset "<value>": use the decimal chain id (421614), not hex.` and any other non-decimal reference says `Invalid eip155 chain id "<reference>" in asset "<value>": an eip155 chain id is decimal, e.g. 421614.`, while a native asset says `Asset "<value>" is a native asset (slip44) and has no contract to deposit. Use the wrapped token's erc20 identifier.`
|
|
105
|
+
- An identifier whose CAIP-2 namespace is not lowercase (`EIP155:42161/...`) is routed rather than refused as an unsupported chain. Both namespaces are canonicalized to lowercase in the request the client builds and in the deposit it signs, which is what the PaymentRequest schema requires, so such a request is no longer rejected by the gateway either.
|
|
106
|
+
- A Tron chain reference is folded with the namespaces, mirroring the protocol's own `manifest.CanonicalizeCAIP2`, so `TRON:MAINNET/trc20:...` routes instead of failing inside the sender_auth SDK with `no Permit2 address known for Tron network`. A Solana reference is still left alone: it is base58, and its cluster name is UTF-8 encoded into the escrow's on-chain `cluster_id`, so folding it would change the signing domain.
|
|
107
|
+
- A failed chain-defaults lookup reports the gateway's own `code`, `message` and `request_id` instead of the HTTP status text, which reduced every cause to `Bad Request`.
|
|
108
|
+
- A non-integer value for `--quote-deadline-seconds`, `--fulfillment-deadline-seconds` or `--wait-seconds` (for example `1.5`, `1e3`, `0x10`, or plain text) now prints the one-line reason and exits `1`, instead of a full Node stack trace. The CLIs already refused to run with such a value and the exit code is unchanged; only the output is. The option parser runs before the command's error handling, so what it threw had been escaping uncaught.
|
|
109
|
+
- A whitespace-only `pinnedAddress` was not skipped but reported as an address mismatch, so the error named a padded value rather than the actual problem. It now gets the same up-front rejection as an empty one.
|
|
110
|
+
- `send-payment` validates `<sender>` before prompting for a private key, so a blank argument no longer costs the user an entered secret first.
|
|
111
|
+
- Gateway requests now time out instead of hanging. The client had no network timeout: the chain-defaults call used a bare `fetch` with no abort signal and the HTTP client set none, so a gateway that accepted the connection and never replied left the CLI waiting indefinitely with nothing on stdout or stderr. Requests now abort and raise a `GatewayTimeoutError` reading `Gateway at <url> did not respond within <n>s`. The abort covers the response body as well as the headers, so a gateway that returns `200` and then stalls is caught too, as is one that answers a chain-defaults failure and then stalls the error body the message is read from.
|
|
112
|
+
- **The Solana signing format in the published types was wrong.** `SignedMessage.message` was documented as a base64-encoded message on Solana, where the value the network verifies is the hex-encoded message hash with a `0x` prefix, as it is on EVM and Tron. A caller following the type's own documentation produced a signature that could not be recovered, and the request was refused with nothing in the message pointing at the encoding. The description now matches the format that is signed and verified. Types and runtime behaviour are unchanged; only what the types say about them.
|
|
113
|
+
- `SenderAuthMessageScheme` documents `EVM_PERMIT2_ESCROW`. The value has always been accepted and appeared in the type's union, but the accompanying description listed only the other three, so the one scheme that pairs a gasless approval with escrow support read as undocumented.
|
|
114
|
+
- `SenderAuth.verifiable_credential` is marked deprecated in the published type, which it already was in the format that is signed. Credentials belong in the holder-signed `PaymentRequestEnvelope`; the inner request carries none, and its Data Integrity signature excludes this field. A caller still populating it can see that from the type now rather than only from the signing schema.
|
|
115
|
+
|
|
8
116
|
## [2.2.0] - 2026-08-04
|
|
9
117
|
|
|
10
118
|
> **Read this before upgrading if you script `send-payment`.** Its exit codes now
|
package/LICENSE
CHANGED
|
@@ -1,83 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED