@piprail/sdk 2.13.1 → 2.14.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 +70 -0
- package/dist/{algorand-TQCYK2XT.js → algorand-6J3IABVF.js} +12 -11
- package/dist/{algorand-AQK5EAUF.cjs → algorand-QU6G2DQZ.cjs} +43 -42
- package/dist/{aptos-RYQOSFBQ.js → aptos-DHOMTBLZ.js} +11 -10
- package/dist/{aptos-65UX7GKA.cjs → aptos-LFTQGBBK.cjs} +41 -40
- package/dist/{chunk-DCOUJZPL.cjs → chunk-GYM46G5L.cjs} +16 -0
- package/dist/{chunk-O32N6MFN.js → chunk-PAMKCWVW.js} +16 -0
- package/dist/index.cjs +484 -231
- package/dist/index.d.cts +270 -7
- package/dist/index.d.ts +270 -7
- package/dist/index.js +280 -27
- package/dist/{ledger-mF_SoiDB.d.ts → ledger-uFtXlIHY.d.cts} +31 -1
- package/dist/{ledger-mF_SoiDB.d.cts → ledger-uFtXlIHY.d.ts} +31 -1
- package/dist/{near-VDATC5AV.js → near-5PXTVQ47.js} +14 -5
- package/dist/{near-UDPFA6SV.cjs → near-YNNK7RW7.cjs} +39 -30
- package/dist/node.d.cts +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/{solana-VYLWFNAH.js → solana-HITVI3HF.js} +22 -7
- package/dist/{solana-RQNXFCZO.cjs → solana-N3UCNCYE.cjs} +54 -39
- package/dist/{stellar-KBR4V77T.js → stellar-2QT6YYKN.js} +4 -4
- package/dist/{stellar-OK2HW5PZ.cjs → stellar-Y3SQN7S5.cjs} +23 -23
- package/dist/{sui-SVFBJFW5.cjs → sui-4AL4E6XU.cjs} +35 -27
- package/dist/{sui-BXHB6D3W.js → sui-FV5L6WF5.js} +20 -12
- package/dist/{ton-NNKQFQ6U.js → ton-5FWDQ4QR.js} +18 -7
- package/dist/{ton-D7YN6BGR.cjs → ton-5HDVOTMR.cjs} +33 -22
- package/dist/{tron-W2D5PQXV.js → tron-AZDY7BMQ.js} +10 -10
- package/dist/{tron-WZFU57NX.cjs → tron-TX2B4N2A.cjs} +39 -39
- package/dist/{xrpl-5NHY3NEL.cjs → xrpl-5TYDLQFS.cjs} +31 -31
- package/dist/{xrpl-37E23W53.js → xrpl-UJL5J7CY.js} +13 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,74 @@ All notable changes to `@piprail/sdk` are documented here. The format
|
|
|
4
4
|
follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the
|
|
5
5
|
versions follow [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [2.14.0] — 2026-06-23 — x402-over-MCP transport, payment-identifier idempotency, the `.well-known/x402.json` manifest — and a deep three-pass security hardening of every chain
|
|
8
|
+
|
|
9
|
+
A feature **and** hardening release. It adds the third official x402 transport, an opt-in
|
|
10
|
+
idempotency extension, and a forward-compatible discovery manifest — then puts the whole SDK through
|
|
11
|
+
**three independent adversarial audit passes** (90+ agents) plus **live mainnet settlements of every
|
|
12
|
+
transaction type across 10+ chains**, fixing ~28 issues the audits surfaced. Every default is
|
|
13
|
+
unchanged; everything new is additive/opt-in. Proven on real mainnet payments on Base, BNB, Solana,
|
|
14
|
+
Sui, Aptos, Algorand, Stellar, TON, Tron, and the XRP Ledger (onchain-proof, EIP-3009 + Permit2
|
|
15
|
+
`exact`, non-EVM self-settle/facilitator `exact`, `upto`, A2A **and** MCP transports, verifiable
|
|
16
|
+
receipts, discovery/registration).
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **x402-over-MCP transport (the third official transport).** `createMcpPaymentTool` wraps a
|
|
21
|
+
`PaymentGate` as a paid **MCP tool** — the MCP analogue of `requirePayment` / `createA2APaymentHandler`.
|
|
22
|
+
A 402 is an `isError` tool result (the `PaymentRequired` in `structuredContent` + a byte-equal
|
|
23
|
+
`content[0].text`); the payment rides under `params._meta["x402/payment"]`, the settlement under
|
|
24
|
+
`_meta["x402/payment-response"]`. All verify/settle/replay runs through the gate's `verifyObject`
|
|
25
|
+
(zero new crypto, zero driver changes) so every family rides MCP for free. Ships the full pure codec
|
|
26
|
+
+ buyer read/frame helpers (`toMcpPaymentRequired`/`toMcpPaymentResponse`/`fromMcpPayment*`/
|
|
27
|
+
`isMcpPaymentRequired`/`buildMcpPaymentMeta`); a fully-automatic `McpPayer` is a documented fast-follow.
|
|
28
|
+
- **Opt-in `payment-identifier` idempotency extension.** `paymentIdentifier: true` advertises the
|
|
29
|
+
extension; a buyer supplies a stable `id` (16–128 chars, `[A-Za-z0-9_-]`) it can retry under,
|
|
30
|
+
deduped on the gate's existing used-proof set (`pid:<id>`, case-sensitive). Default OFF; the three
|
|
31
|
+
verify branches are untouched. Codecs `buildPaymentIdentifierAdvertisement` / `readPaymentIdentifier`.
|
|
32
|
+
- **Forward-compatible `.well-known/x402.json` manifest.** `buildWellKnownX402Manifest` emits the
|
|
33
|
+
richer, V2-shaped manifest (`{ x402Version: 2, lastUpdated, items[] }`) beside the legacy flat
|
|
34
|
+
`buildWellKnownX402` breadcrumb — a self-describing item per resource (its rails + call method), so a
|
|
35
|
+
crawler enumerates an origin without hitting each 402.
|
|
36
|
+
- `estimateCost` now reports the buyer-gasless `exact`/`upto` rails as fee `0` across every family
|
|
37
|
+
(NEAR included), and ships a multi-chain cost matrix in the tests.
|
|
38
|
+
|
|
39
|
+
### Fixed & hardened (three adversarial audit passes + live mainnet)
|
|
40
|
+
|
|
41
|
+
- **SECURITY — memo-bound double-redeem (server).** The gate keyed its replay set on the
|
|
42
|
+
client-controlled `txHash`; memo-bound families (XRPL/Stellar/TON/Algorand) + native NEAR locate the
|
|
43
|
+
tx by memo/decoded-hash and ignore the ref, so one real payment could be re-redeemed N times within
|
|
44
|
+
the recency window. The gate now binds the replay key to the **verified** `receipt.transaction`
|
|
45
|
+
(a no-op for digest-bound EVM/Solana).
|
|
46
|
+
- **SECURITY — TON jetton forgery.** `verify()` now requires a successful `vm` compute for a jetton
|
|
47
|
+
credit, rejecting a forged `internal_transfer` to an undeployed merchant jetton wallet (native exempt).
|
|
48
|
+
- **Recency fails CLOSED uniformly.** Every digest/memo driver (EVM/Solana/Sui/NEAR/Stellar/Algorand/
|
|
49
|
+
XRPL/Tron/**Aptos**) now returns `payment_expired` on a missing/non-finite on-chain timestamp instead
|
|
50
|
+
of skipping the age check — closing a fail-open replay-backstop bypass.
|
|
51
|
+
- **MCP transport B7 (at-most-once).** A `fulfill()` throw *after* settlement still returns a success
|
|
52
|
+
`_meta` payment-response (never a re-challenge), so a serve-time hiccup never re-charges the buyer.
|
|
53
|
+
- **Sponsor fee-drain guard hardened.** The Solana `exact` ComputeBudget guard is now an allowlist
|
|
54
|
+
(rejects any discriminator ≠ set-unit-limit/price), closing the deprecated `RequestUnits`
|
|
55
|
+
`additional_fee` drain.
|
|
56
|
+
- **Tron `tron:`-prefix double-redeem** closed (verify reads the ref verbatim). **Sui** recipient match
|
|
57
|
+
is case/padding-insensitive (a mixed-case `payTo` is no longer paid-but-unverifiable).
|
|
58
|
+
- **Never-throw reads honored.** TON `verify()` maps a transient jetton-wallet RPC failure to a
|
|
59
|
+
retryable `tx_not_found` (and no longer poison-caches the rejected promise); EVM `estimateCost`
|
|
60
|
+
optional-chains a missing `extra`; the client drops a native or `extra`-less rail from the
|
|
61
|
+
exact/upto gather so plan/autoRoute/pay stay consistent.
|
|
62
|
+
- **Typed errors at the boundary.** An unknown chain name → `UnsupportedNetworkError`; an invalid EVM
|
|
63
|
+
custom-token address → `WrongFamilyError` (at config time, not a raw viem throw later).
|
|
64
|
+
- `floorUnits`/`parseUnits` accept scientific notation (XRPL funded-trustline false-`null` fix);
|
|
65
|
+
Solana `balanceOf` detects the Token-2022 program (no false 0); the memo-bound verifiers scan a full
|
|
66
|
+
200-tx page; the `payment-identifier` id stays case-sensitive in the default store; legacy v1
|
|
67
|
+
`txHash`-only receipts map onto `transaction`.
|
|
68
|
+
|
|
69
|
+
### Docs
|
|
70
|
+
|
|
71
|
+
- New **MCP transport (seller)** page; documented the manifest, the payment-identifier extension, the
|
|
72
|
+
uniform recency fail-closed, the sponsor-drain guard, the TON jetton compute-success rule, and the
|
|
73
|
+
5-family `exact` surface — a 17-fix single-source-of-truth pass over the docs.
|
|
74
|
+
|
|
7
75
|
## [2.13.1] — 2026-06-21 — Family-correct `exact`-rail recovery hints (no EVM-only assumptions on non-EVM rails)
|
|
8
76
|
|
|
9
77
|
A correctness pass on the family-agnostic `exact` buyer path: its failure/timeout messages and one
|
|
@@ -1695,6 +1763,8 @@ straight into your wallet. The API is small and self-contained.
|
|
|
1695
1763
|
to your wallet; PipRail never holds funds.
|
|
1696
1764
|
- `viem ^2.21` is a peer dependency. Node 20+ or a modern browser.
|
|
1697
1765
|
|
|
1766
|
+
[2.14.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
1767
|
+
[2.13.1]: https://www.npmjs.com/package/@piprail/sdk
|
|
1698
1768
|
[2.12.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
1699
1769
|
[2.11.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
1700
1770
|
[2.10.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
nativeCost,
|
|
11
11
|
rejectForeignToken,
|
|
12
12
|
toInsufficientFundsError
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PAMKCWVW.js";
|
|
14
14
|
|
|
15
15
|
// src/drivers/algorand/index.ts
|
|
16
16
|
import algosdk3 from "algosdk";
|
|
@@ -304,21 +304,22 @@ async function verifyAlgorand(params) {
|
|
|
304
304
|
const wantAssetId = parseAlgorandAssetId(accept.asset);
|
|
305
305
|
let txs;
|
|
306
306
|
try {
|
|
307
|
-
txs = await reader.transactionsForAccount(accept.payTo,
|
|
307
|
+
txs = await reader.transactionsForAccount(accept.payTo, 200);
|
|
308
308
|
} catch {
|
|
309
309
|
return rpcFailed(nonce);
|
|
310
310
|
}
|
|
311
311
|
const tx = txs.find((t) => typeof t.note === "string" && t.note === nonce);
|
|
312
312
|
if (!tx) return notFound(nonce);
|
|
313
|
-
if (
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
313
|
+
if (!Number.isFinite(tx.roundTime)) {
|
|
314
|
+
return { ok: false, error: "payment_expired", detail: `Cannot bound the age of Algorand tx ${tx.id} (no/invalid round-time) \u2014 failing closed.` };
|
|
315
|
+
}
|
|
316
|
+
const ageSeconds = Math.floor(Date.now() / 1e3) - tx.roundTime;
|
|
317
|
+
if (!Number.isFinite(ageSeconds) || ageSeconds > accept.maxTimeoutSeconds) {
|
|
318
|
+
return {
|
|
319
|
+
ok: false,
|
|
320
|
+
error: "payment_expired",
|
|
321
|
+
detail: `Payment is ${ageSeconds}s old; max allowed is ${accept.maxTimeoutSeconds}s.`
|
|
322
|
+
};
|
|
322
323
|
}
|
|
323
324
|
const isNative = wantAssetId === null;
|
|
324
325
|
const typeOk = isNative ? tx.txType === "pay" : tx.txType === "axfer";
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkGYM46G5Lcjs = require('./chunk-GYM46G5L.cjs');
|
|
14
14
|
|
|
15
15
|
// src/drivers/algorand/index.ts
|
|
16
16
|
var _algosdk = require('algosdk'); var _algosdk2 = _interopRequireDefault(_algosdk);
|
|
@@ -58,13 +58,13 @@ async function payAlgorand(params) {
|
|
|
58
58
|
} catch (err) {
|
|
59
59
|
const mapped = mapAlgorandError(err, accept.payTo);
|
|
60
60
|
if (mapped) throw mapped;
|
|
61
|
-
throw _nullishCoalesce(
|
|
61
|
+
throw _nullishCoalesce(_chunkGYM46G5Lcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
function mapAlgorandError(err, payTo) {
|
|
65
65
|
const m = err instanceof Error ? err.message : String(err);
|
|
66
66
|
if (/must optin/i.test(m) || /missing from/i.test(m) && m.includes(payTo)) {
|
|
67
|
-
return new (0,
|
|
67
|
+
return new (0, _chunkGYM46G5Lcjs.RecipientNotReadyError)(
|
|
68
68
|
`Algorand recipient ${payTo} hasn't opted into this asset \u2014 it must opt in (a 0-amount asset transfer to itself) before it can receive. (Algorand: ${firstLine(m)})`,
|
|
69
69
|
{ cause: err }
|
|
70
70
|
);
|
|
@@ -72,7 +72,7 @@ function mapAlgorandError(err, payTo) {
|
|
|
72
72
|
if (/overspend|below min|min(imum)? balance|tried to spend|balance \d+ below|asset \d+ missing from|insufficient|underflow/i.test(
|
|
73
73
|
m
|
|
74
74
|
)) {
|
|
75
|
-
return new (0,
|
|
75
|
+
return new (0, _chunkGYM46G5Lcjs.InsufficientFundsError)(
|
|
76
76
|
`Algorand payment failed: the sender can't cover it \u2014 token balance, ALGO for fees, the 0.1-ALGO minimum balance, or a missing asset opt-in on the sender. (Algorand: ${firstLine(m)})`,
|
|
77
77
|
{ cause: err }
|
|
78
78
|
);
|
|
@@ -99,33 +99,33 @@ function isSet(addr) {
|
|
|
99
99
|
function randomNote() {
|
|
100
100
|
const g = globalThis.crypto;
|
|
101
101
|
if (!_optionalChain([g, 'optionalAccess', _ => _.getRandomValues])) {
|
|
102
|
-
throw new (0,
|
|
102
|
+
throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)("Algorand exact: no Web Crypto CSPRNG available to generate a unique note.");
|
|
103
103
|
}
|
|
104
104
|
return g.getRandomValues(new Uint8Array(32));
|
|
105
105
|
}
|
|
106
106
|
async function payExactAlgorand(input) {
|
|
107
107
|
const { suggestedParams, sk, sender, accept } = input;
|
|
108
108
|
if (accept.asset === "native") {
|
|
109
|
-
throw new (0,
|
|
109
|
+
throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
|
|
110
110
|
"Algorand exact is ASA-only (an asset transfer); native ALGO is not exact-payable. Pay via onchain-proof."
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
113
|
const feePayer = accept.extra.feePayer;
|
|
114
114
|
if (!feePayer) {
|
|
115
|
-
throw new (0,
|
|
115
|
+
throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)("Algorand exact rail must advertise extra.feePayer (the fee sponsor address).");
|
|
116
116
|
}
|
|
117
117
|
const assetId = parseAlgorandAssetId(accept.asset);
|
|
118
118
|
if (assetId === null) {
|
|
119
|
-
throw new (0,
|
|
119
|
+
throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(`Algorand exact rail asset "${accept.asset}" must be a numeric ASA id.`);
|
|
120
120
|
}
|
|
121
121
|
if (!_algosdk2.default.isValidAddress(feePayer)) {
|
|
122
|
-
throw new (0,
|
|
122
|
+
throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(`Algorand exact: extra.feePayer "${feePayer}" is not a valid Algorand address.`);
|
|
123
123
|
}
|
|
124
124
|
if (!_algosdk2.default.isValidAddress(accept.payTo)) {
|
|
125
|
-
throw new (0,
|
|
125
|
+
throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(`Algorand exact: payTo "${accept.payTo}" is not a valid Algorand address.`);
|
|
126
126
|
}
|
|
127
127
|
if (feePayer === sender) {
|
|
128
|
-
throw new (0,
|
|
128
|
+
throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
|
|
129
129
|
"Algorand exact: the fee payer must differ from the payer \u2014 the buyer must pay ZERO ALGO (the sponsor pays the pooled fee)."
|
|
130
130
|
);
|
|
131
131
|
}
|
|
@@ -172,13 +172,13 @@ function decodeElement(bytes) {
|
|
|
172
172
|
async function verifyAndSettleExactAlgorand(input) {
|
|
173
173
|
const { client, feePayerSk, feePayerAddr, payload, accept } = input;
|
|
174
174
|
const railFeePayer = accept.extra.feePayer;
|
|
175
|
-
if (!railFeePayer) throw new (0,
|
|
175
|
+
if (!railFeePayer) throw new (0, _chunkGYM46G5Lcjs.SettlementError)("Algorand exact: rail is missing extra.feePayer.");
|
|
176
176
|
if (railFeePayer !== feePayerAddr) {
|
|
177
|
-
throw new (0,
|
|
177
|
+
throw new (0, _chunkGYM46G5Lcjs.SettlementError)("Algorand exact: the gate relayer address does not match the rail extra.feePayer \u2014 misconfigured rail.");
|
|
178
178
|
}
|
|
179
179
|
const assetId = parseAlgorandAssetId(accept.asset);
|
|
180
|
-
if (assetId === null) throw new (0,
|
|
181
|
-
if (!_algosdk2.default.isValidAddress(accept.payTo)) throw new (0,
|
|
180
|
+
if (assetId === null) throw new (0, _chunkGYM46G5Lcjs.SettlementError)(`Algorand exact: rail asset "${accept.asset}" is not a numeric ASA id.`);
|
|
181
|
+
if (!_algosdk2.default.isValidAddress(accept.payTo)) throw new (0, _chunkGYM46G5Lcjs.SettlementError)(`Algorand exact: rail payTo "${accept.payTo}" is invalid.`);
|
|
182
182
|
const { paymentIndex, paymentGroup } = payload;
|
|
183
183
|
if (paymentGroup.length !== GROUP_SIZE) {
|
|
184
184
|
return fail("signature_invalid", `Algorand exact expects a ${GROUP_SIZE}-transaction group (payment + fee), got ${paymentGroup.length}.`);
|
|
@@ -244,7 +244,7 @@ async function verifyAndSettleExactAlgorand(input) {
|
|
|
244
244
|
try {
|
|
245
245
|
feeSigned = fee.signTxn(feePayerSk);
|
|
246
246
|
} catch (err) {
|
|
247
|
-
throw new (0,
|
|
247
|
+
throw new (0, _chunkGYM46G5Lcjs.SettlementError)(`Algorand exact settle: the gate could not sign the fee transaction (${shorten(err instanceof Error ? err.message : String(err))}).`, { cause: err });
|
|
248
248
|
}
|
|
249
249
|
const signedGroup = elements.map((el, i) => i === paymentIndex ? payElement.raw : feeSigned);
|
|
250
250
|
try {
|
|
@@ -266,7 +266,7 @@ async function verifyAndSettleExactAlgorand(input) {
|
|
|
266
266
|
if (/signature|sig|auth|malformed/i.test(m)) return fail("signature_invalid", `Settle rejected \u2014 bad signature: ${shorten(m)}.`);
|
|
267
267
|
if (/already in ledger|already committed|duplicate/i.test(m)) return fail("tx_already_used", `This payment was already settled: ${shorten(m)}.`);
|
|
268
268
|
if (/\bround\b|expired|lifetime|stale|validity/i.test(m)) return fail("payment_expired", `Settle rejected \u2014 validity window expired: ${shorten(m)}.`);
|
|
269
|
-
throw new (0,
|
|
269
|
+
throw new (0, _chunkGYM46G5Lcjs.SettlementError)(
|
|
270
270
|
`Algorand exact settle: the group failed to submit (${shorten(m)}). The buyer's signed transaction is still valid \u2014 fund/fix the fee payer (${railFeePayer}) and the buyer can re-present it.`,
|
|
271
271
|
{ cause: err }
|
|
272
272
|
);
|
|
@@ -275,10 +275,10 @@ async function verifyAndSettleExactAlgorand(input) {
|
|
|
275
275
|
try {
|
|
276
276
|
round = await client.waitForConfirmation(buyerTxid);
|
|
277
277
|
} catch (err) {
|
|
278
|
-
throw new (0,
|
|
278
|
+
throw new (0, _chunkGYM46G5Lcjs.SettlementError)(`Algorand exact settle: submitted ${buyerTxid} but confirmation read failed (${shorten(err instanceof Error ? err.message : String(err))}). It likely landed \u2014 re-verify before re-presenting; do NOT re-pay.`, { cause: err });
|
|
279
279
|
}
|
|
280
280
|
if (round === null) {
|
|
281
|
-
throw new (0,
|
|
281
|
+
throw new (0, _chunkGYM46G5Lcjs.SettlementError)(`Algorand exact settle: submitted ${buyerTxid} but it did not confirm in time. It likely landed \u2014 re-verify before re-presenting; do NOT re-pay.`);
|
|
282
282
|
}
|
|
283
283
|
return {
|
|
284
284
|
ok: true,
|
|
@@ -304,21 +304,22 @@ async function verifyAlgorand(params) {
|
|
|
304
304
|
const wantAssetId = parseAlgorandAssetId(accept.asset);
|
|
305
305
|
let txs;
|
|
306
306
|
try {
|
|
307
|
-
txs = await reader.transactionsForAccount(accept.payTo,
|
|
307
|
+
txs = await reader.transactionsForAccount(accept.payTo, 200);
|
|
308
308
|
} catch (e4) {
|
|
309
309
|
return rpcFailed(nonce);
|
|
310
310
|
}
|
|
311
311
|
const tx = txs.find((t) => typeof t.note === "string" && t.note === nonce);
|
|
312
312
|
if (!tx) return notFound(nonce);
|
|
313
|
-
if (
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
313
|
+
if (!Number.isFinite(tx.roundTime)) {
|
|
314
|
+
return { ok: false, error: "payment_expired", detail: `Cannot bound the age of Algorand tx ${tx.id} (no/invalid round-time) \u2014 failing closed.` };
|
|
315
|
+
}
|
|
316
|
+
const ageSeconds = Math.floor(Date.now() / 1e3) - tx.roundTime;
|
|
317
|
+
if (!Number.isFinite(ageSeconds) || ageSeconds > accept.maxTimeoutSeconds) {
|
|
318
|
+
return {
|
|
319
|
+
ok: false,
|
|
320
|
+
error: "payment_expired",
|
|
321
|
+
detail: `Payment is ${ageSeconds}s old; max allowed is ${accept.maxTimeoutSeconds}s.`
|
|
322
|
+
};
|
|
322
323
|
}
|
|
323
324
|
const isNative = wantAssetId === null;
|
|
324
325
|
const typeOk = isNative ? tx.txType === "pay" : tx.txType === "axfer";
|
|
@@ -373,13 +374,13 @@ function rpcFailed(nonce) {
|
|
|
373
374
|
|
|
374
375
|
function assertAlgorandWallet(wallet, network) {
|
|
375
376
|
if (typeof wallet !== "object" || wallet === null) {
|
|
376
|
-
throw new (0,
|
|
377
|
+
throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
|
|
377
378
|
`chain ${network} is Algorand; wallet must be { key } (25-word mnemonic) or { account }.`
|
|
378
379
|
);
|
|
379
380
|
}
|
|
380
|
-
|
|
381
|
+
_chunkGYM46G5Lcjs.assertNoLegacyWalletKey.call(void 0, wallet, "Algorand");
|
|
381
382
|
if (!("key" in wallet) && !("account" in wallet)) {
|
|
382
|
-
throw new (0,
|
|
383
|
+
throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
|
|
383
384
|
`chain ${network} is Algorand; wallet must be { key } (25-word mnemonic) or { account }.`
|
|
384
385
|
);
|
|
385
386
|
}
|
|
@@ -394,13 +395,13 @@ function resolveAlgorandWallet(config) {
|
|
|
394
395
|
const { addr, sk } = _algosdk2.default.mnemonicToSecretKey(config.key);
|
|
395
396
|
return { addr: addr.toString(), sk };
|
|
396
397
|
} catch (cause) {
|
|
397
|
-
throw new (0,
|
|
398
|
+
throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
|
|
398
399
|
"Algorand wallet { key } is not a valid 25-word Algorand mnemonic.",
|
|
399
400
|
{ cause }
|
|
400
401
|
);
|
|
401
402
|
}
|
|
402
403
|
}
|
|
403
|
-
throw new (0,
|
|
404
|
+
throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)("Algorand wallet needs { key } (25-word mnemonic) or { account }.");
|
|
404
405
|
}
|
|
405
406
|
|
|
406
407
|
// src/drivers/algorand/index.ts
|
|
@@ -471,16 +472,16 @@ function makeAlgorandNetwork(preset, algodUrl) {
|
|
|
471
472
|
const info = preset.tokens[token.toUpperCase()];
|
|
472
473
|
if (!info) {
|
|
473
474
|
const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
|
|
474
|
-
throw new (0,
|
|
475
|
+
throw new (0, _chunkGYM46G5Lcjs.UnknownTokenError)(
|
|
475
476
|
`token "${token}" isn't built in for Algorand (known: ${known}). Pass { assetId, decimals } for a custom ASA, or use 'native'.`
|
|
476
477
|
);
|
|
477
478
|
}
|
|
478
479
|
return { asset: algorandAssetId(info.assetId), decimals: info.decimals, symbol: info.symbol };
|
|
479
480
|
}
|
|
480
|
-
|
|
481
|
+
_chunkGYM46G5Lcjs.rejectForeignToken.call(void 0, token, "algorand", network);
|
|
481
482
|
const t = token;
|
|
482
483
|
if (typeof t.assetId !== "number" || typeof t.decimals !== "number") {
|
|
483
|
-
throw new (0,
|
|
484
|
+
throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
|
|
484
485
|
`chain ${network} is Algorand; a custom token must be { assetId, decimals }.`
|
|
485
486
|
);
|
|
486
487
|
}
|
|
@@ -501,12 +502,12 @@ function makeAlgorandNetwork(preset, algodUrl) {
|
|
|
501
502
|
},
|
|
502
503
|
assertValidPayTo(payTo) {
|
|
503
504
|
if (payTo.startsWith("0x")) {
|
|
504
|
-
throw new (0,
|
|
505
|
+
throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
|
|
505
506
|
`chain ${network} is Algorand, but payTo "${payTo}" looks like an EVM address.`
|
|
506
507
|
);
|
|
507
508
|
}
|
|
508
509
|
if (!_algosdk2.default.isValidAddress(payTo)) {
|
|
509
|
-
throw new (0,
|
|
510
|
+
throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
|
|
510
511
|
`chain ${network} is Algorand, but payTo "${payTo}" is not a valid Algorand address.`
|
|
511
512
|
);
|
|
512
513
|
}
|
|
@@ -523,14 +524,14 @@ function makeAlgorandNetwork(preset, algodUrl) {
|
|
|
523
524
|
const info = await _algosdk2.default.waitForConfirmation(algod, ref, 10);
|
|
524
525
|
return { height: String(_nullishCoalesce(info.confirmedRound, () => ( 0))) };
|
|
525
526
|
} catch (err) {
|
|
526
|
-
throw new (0,
|
|
527
|
+
throw new (0, _chunkGYM46G5Lcjs.ConfirmationTimeoutError)(`Algorand tx ${ref} did not confirm in time.`, {
|
|
527
528
|
cause: err
|
|
528
529
|
});
|
|
529
530
|
}
|
|
530
531
|
},
|
|
531
532
|
async estimateCost(accept) {
|
|
532
533
|
if (accept.scheme === "exact") {
|
|
533
|
-
return
|
|
534
|
+
return _chunkGYM46G5Lcjs.nativeCost.call(void 0, {
|
|
534
535
|
symbol: ALGO_SYMBOL,
|
|
535
536
|
decimals: ALGO_DECIMALS,
|
|
536
537
|
fee: 0n,
|
|
@@ -538,7 +539,7 @@ function makeAlgorandNetwork(preset, algodUrl) {
|
|
|
538
539
|
detail: "gasless \u2014 the fee payer (facilitator/relayer) pools the group fee; the buyer pays 0 ALGO"
|
|
539
540
|
});
|
|
540
541
|
}
|
|
541
|
-
return
|
|
542
|
+
return _chunkGYM46G5Lcjs.nativeCost.call(void 0, {
|
|
542
543
|
symbol: ALGO_SYMBOL,
|
|
543
544
|
decimals: ALGO_DECIMALS,
|
|
544
545
|
fee: 1000n,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
nativeCost,
|
|
10
10
|
rejectForeignToken,
|
|
11
11
|
toInsufficientFundsError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PAMKCWVW.js";
|
|
13
13
|
|
|
14
14
|
// src/drivers/aptos/index.ts
|
|
15
15
|
import { Aptos, AptosConfig, Network, AccountAddress as AccountAddress2 } from "@aptos-labs/ts-sdk";
|
|
@@ -312,15 +312,16 @@ async function verifyAptos(params) {
|
|
|
312
312
|
if (!tx.success) {
|
|
313
313
|
return { ok: false, error: "tx_reverted", detail: `Aptos tx ${hash} did not succeed.` };
|
|
314
314
|
}
|
|
315
|
-
if (
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
315
|
+
if (!Number.isFinite(tx.timestampSeconds)) {
|
|
316
|
+
return { ok: false, error: "payment_expired", detail: `Cannot bound the age of Aptos tx ${hash} (no/invalid timestamp) \u2014 failing closed.` };
|
|
317
|
+
}
|
|
318
|
+
const ageSeconds = Math.floor(Date.now() / 1e3) - tx.timestampSeconds;
|
|
319
|
+
if (!Number.isFinite(ageSeconds) || ageSeconds > accept.maxTimeoutSeconds) {
|
|
320
|
+
return {
|
|
321
|
+
ok: false,
|
|
322
|
+
error: "payment_expired",
|
|
323
|
+
detail: `Payment is ${ageSeconds}s old; max allowed is ${accept.maxTimeoutSeconds}s.`
|
|
324
|
+
};
|
|
324
325
|
}
|
|
325
326
|
let wantStore;
|
|
326
327
|
try {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkGYM46G5Lcjs = require('./chunk-GYM46G5L.cjs');
|
|
13
13
|
|
|
14
14
|
// src/drivers/aptos/index.ts
|
|
15
15
|
var _tssdk = require('@aptos-labs/ts-sdk');
|
|
@@ -58,14 +58,14 @@ async function payAptos(params) {
|
|
|
58
58
|
const res = await client.signSubmit({ signer, transaction });
|
|
59
59
|
return res.hash;
|
|
60
60
|
} catch (err) {
|
|
61
|
-
if (err instanceof
|
|
61
|
+
if (err instanceof _chunkGYM46G5Lcjs.InsufficientFundsError) throw err;
|
|
62
62
|
if (isAptosAffordability(err)) {
|
|
63
|
-
throw new (0,
|
|
63
|
+
throw new (0, _chunkGYM46G5Lcjs.InsufficientFundsError)(
|
|
64
64
|
err instanceof Error ? err.message : "Insufficient APT/token balance for the payment.",
|
|
65
65
|
{ cause: err }
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
|
-
throw _nullishCoalesce(
|
|
68
|
+
throw _nullishCoalesce(_chunkGYM46G5Lcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
function isAptosAffordability(err) {
|
|
@@ -103,24 +103,24 @@ function parseAddr(addr) {
|
|
|
103
103
|
async function payExactAptos(input) {
|
|
104
104
|
const { client, sender, accept } = input;
|
|
105
105
|
if (accept.asset === "native") {
|
|
106
|
-
throw new (0,
|
|
106
|
+
throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
|
|
107
107
|
"Aptos exact is Fungible-Asset only (a primary_fungible_store transfer); native APT is not exact-payable. Pay via onchain-proof."
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
const feePayer = accept.extra.feePayer;
|
|
111
111
|
if (!feePayer) {
|
|
112
|
-
throw new (0,
|
|
112
|
+
throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)("Aptos exact rail must advertise extra.feePayer (the gas sponsor address).");
|
|
113
113
|
}
|
|
114
114
|
const feePayerAddr = parseAddr(feePayer);
|
|
115
|
-
if (!feePayerAddr) throw new (0,
|
|
115
|
+
if (!feePayerAddr) throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(`Aptos exact: extra.feePayer "${feePayer}" is not a valid Aptos address.`);
|
|
116
116
|
const payToAddr = parseAddr(accept.payTo);
|
|
117
|
-
if (!payToAddr) throw new (0,
|
|
117
|
+
if (!payToAddr) throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(`Aptos exact: payTo "${accept.payTo}" is not a valid Aptos address.`);
|
|
118
118
|
const metadataAddr = parseAddr(accept.asset);
|
|
119
|
-
if (!metadataAddr) throw new (0,
|
|
119
|
+
if (!metadataAddr) throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(`Aptos exact: asset "${accept.asset}" is not a valid FA metadata address.`);
|
|
120
120
|
const senderAddr = parseAddr(sender);
|
|
121
|
-
if (!senderAddr) throw new (0,
|
|
121
|
+
if (!senderAddr) throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(`Aptos exact: payer "${sender}" is not a valid Aptos address.`);
|
|
122
122
|
if (feePayerAddr.equals(senderAddr)) {
|
|
123
|
-
throw new (0,
|
|
123
|
+
throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
|
|
124
124
|
"Aptos exact: the fee payer must differ from the payer \u2014 the buyer must pay ZERO APT (the sponsor pays gas)."
|
|
125
125
|
);
|
|
126
126
|
}
|
|
@@ -158,16 +158,16 @@ function argBytes(arg) {
|
|
|
158
158
|
async function verifyAndSettleExactAptos(input) {
|
|
159
159
|
const { client, feePayerAddr, payload, accept } = input;
|
|
160
160
|
const railFeePayer = accept.extra.feePayer;
|
|
161
|
-
if (!railFeePayer) throw new (0,
|
|
161
|
+
if (!railFeePayer) throw new (0, _chunkGYM46G5Lcjs.SettlementError)("Aptos exact: rail is missing extra.feePayer.");
|
|
162
162
|
if (railFeePayer !== feePayerAddr) {
|
|
163
|
-
throw new (0,
|
|
163
|
+
throw new (0, _chunkGYM46G5Lcjs.SettlementError)("Aptos exact: the gate relayer address does not match the rail extra.feePayer \u2014 misconfigured rail.");
|
|
164
164
|
}
|
|
165
|
-
if (accept.asset === "native") throw new (0,
|
|
165
|
+
if (accept.asset === "native") throw new (0, _chunkGYM46G5Lcjs.SettlementError)("Aptos exact: native APT is not exact-payable (misconfigured rail).");
|
|
166
166
|
const railFeePayerAddr = parseAddr(railFeePayer);
|
|
167
167
|
const railPayTo = parseAddr(accept.payTo);
|
|
168
168
|
const railMetadata = parseAddr(accept.asset);
|
|
169
169
|
if (!railFeePayerAddr || !railPayTo || !railMetadata) {
|
|
170
|
-
throw new (0,
|
|
170
|
+
throw new (0, _chunkGYM46G5Lcjs.SettlementError)("Aptos exact: rail feePayer/payTo/asset is not a valid Aptos address (misconfigured rail).");
|
|
171
171
|
}
|
|
172
172
|
let tx;
|
|
173
173
|
let senderAuth;
|
|
@@ -241,7 +241,7 @@ async function verifyAndSettleExactAptos(input) {
|
|
|
241
241
|
try {
|
|
242
242
|
feePayerAuth = client.signAsFeePayer({ transaction: tx });
|
|
243
243
|
} catch (err) {
|
|
244
|
-
throw new (0,
|
|
244
|
+
throw new (0, _chunkGYM46G5Lcjs.SettlementError)(`Aptos exact settle: the gate could not sign as fee payer (${shorten(err instanceof Error ? err.message : String(err))}).`, { cause: err });
|
|
245
245
|
}
|
|
246
246
|
if (senderAuth instanceof _tssdk.AccountAuthenticatorEd25519) {
|
|
247
247
|
try {
|
|
@@ -264,7 +264,7 @@ async function verifyAndSettleExactAptos(input) {
|
|
|
264
264
|
if (/signature|invalid.*auth|INVALID_SIGNATURE/i.test(m)) return fail("signature_invalid", `Settle rejected \u2014 bad signature: ${shorten(m)}.`);
|
|
265
265
|
if (/SEQUENCE_NUMBER_TOO_OLD|already.*(committed|ledger)|duplicate/i.test(m)) return fail("tx_already_used", `This payment was already settled: ${shorten(m)}.`);
|
|
266
266
|
if (/EXPIRED|expired|TOO_NEW/i.test(m)) return fail("payment_expired", `Settle rejected \u2014 expired/stale: ${shorten(m)}.`);
|
|
267
|
-
throw new (0,
|
|
267
|
+
throw new (0, _chunkGYM46G5Lcjs.SettlementError)(
|
|
268
268
|
`Aptos exact settle: the transaction failed to submit (${shorten(m)}). The buyer's signed transaction is still valid \u2014 fund/fix the fee payer (${railFeePayer}) and the buyer can re-present it.`,
|
|
269
269
|
{ cause: err }
|
|
270
270
|
);
|
|
@@ -273,10 +273,10 @@ async function verifyAndSettleExactAptos(input) {
|
|
|
273
273
|
try {
|
|
274
274
|
confirmed = await client.waitForConfirmation(hash);
|
|
275
275
|
} catch (err) {
|
|
276
|
-
throw new (0,
|
|
276
|
+
throw new (0, _chunkGYM46G5Lcjs.SettlementError)(`Aptos exact settle: submitted ${hash} but confirmation read failed (${shorten(err instanceof Error ? err.message : String(err))}). It likely landed \u2014 re-verify before re-presenting; do NOT re-pay.`, { cause: err });
|
|
277
277
|
}
|
|
278
278
|
if (confirmed === null) {
|
|
279
|
-
throw new (0,
|
|
279
|
+
throw new (0, _chunkGYM46G5Lcjs.SettlementError)(`Aptos exact settle: submitted ${hash} but it did not confirm in time. It likely landed \u2014 re-verify before re-presenting; do NOT re-pay.`);
|
|
280
280
|
}
|
|
281
281
|
if (!confirmed.success) {
|
|
282
282
|
return fail("tx_reverted", `Settle tx ${hash} reverted on-chain (a post-simulate race).`);
|
|
@@ -312,15 +312,16 @@ async function verifyAptos(params) {
|
|
|
312
312
|
if (!tx.success) {
|
|
313
313
|
return { ok: false, error: "tx_reverted", detail: `Aptos tx ${hash} did not succeed.` };
|
|
314
314
|
}
|
|
315
|
-
if (
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
315
|
+
if (!Number.isFinite(tx.timestampSeconds)) {
|
|
316
|
+
return { ok: false, error: "payment_expired", detail: `Cannot bound the age of Aptos tx ${hash} (no/invalid timestamp) \u2014 failing closed.` };
|
|
317
|
+
}
|
|
318
|
+
const ageSeconds = Math.floor(Date.now() / 1e3) - tx.timestampSeconds;
|
|
319
|
+
if (!Number.isFinite(ageSeconds) || ageSeconds > accept.maxTimeoutSeconds) {
|
|
320
|
+
return {
|
|
321
|
+
ok: false,
|
|
322
|
+
error: "payment_expired",
|
|
323
|
+
detail: `Payment is ${ageSeconds}s old; max allowed is ${accept.maxTimeoutSeconds}s.`
|
|
324
|
+
};
|
|
324
325
|
}
|
|
325
326
|
let wantStore;
|
|
326
327
|
try {
|
|
@@ -371,13 +372,13 @@ function txNotFound(hash) {
|
|
|
371
372
|
|
|
372
373
|
function assertAptosWallet(wallet, network) {
|
|
373
374
|
if (typeof wallet !== "object" || wallet === null) {
|
|
374
|
-
throw new (0,
|
|
375
|
+
throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
|
|
375
376
|
`chain ${network} is Aptos; wallet must be { key } (ed25519-priv-0x\u2026) or { account }.`
|
|
376
377
|
);
|
|
377
378
|
}
|
|
378
|
-
|
|
379
|
+
_chunkGYM46G5Lcjs.assertNoLegacyWalletKey.call(void 0, wallet, "Aptos");
|
|
379
380
|
if (!("key" in wallet) && !("account" in wallet)) {
|
|
380
|
-
throw new (0,
|
|
381
|
+
throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
|
|
381
382
|
`chain ${network} is Aptos; wallet must be { key } (ed25519-priv-0x\u2026) or { account }.`
|
|
382
383
|
);
|
|
383
384
|
}
|
|
@@ -389,13 +390,13 @@ function resolveAptosAccount(config) {
|
|
|
389
390
|
try {
|
|
390
391
|
return _tssdk.Account.fromPrivateKey({ privateKey: new (0, _tssdk.Ed25519PrivateKey)(config.key) });
|
|
391
392
|
} catch (cause) {
|
|
392
|
-
throw new (0,
|
|
393
|
+
throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
|
|
393
394
|
"Aptos wallet { key } is not a valid ed25519 secret (ed25519-priv-0x\u2026 or 0x\u2026 hex).",
|
|
394
395
|
{ cause }
|
|
395
396
|
);
|
|
396
397
|
}
|
|
397
398
|
}
|
|
398
|
-
throw new (0,
|
|
399
|
+
throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)("Aptos wallet needs { key } (ed25519-priv-0x\u2026) or { account }.");
|
|
399
400
|
}
|
|
400
401
|
|
|
401
402
|
// src/drivers/aptos/index.ts
|
|
@@ -467,16 +468,16 @@ function makeAptosNetwork(preset, rpcUrl) {
|
|
|
467
468
|
const info = preset.tokens[token.toUpperCase()];
|
|
468
469
|
if (!info) {
|
|
469
470
|
const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
|
|
470
|
-
throw new (0,
|
|
471
|
+
throw new (0, _chunkGYM46G5Lcjs.UnknownTokenError)(
|
|
471
472
|
`token "${token}" isn't built in for Aptos (known: ${known}). Pass { metadata, decimals } for a custom Fungible Asset, or use 'native'.`
|
|
472
473
|
);
|
|
473
474
|
}
|
|
474
475
|
return { asset: info.metadata, decimals: info.decimals, symbol: info.symbol };
|
|
475
476
|
}
|
|
476
|
-
|
|
477
|
+
_chunkGYM46G5Lcjs.rejectForeignToken.call(void 0, token, "aptos", network);
|
|
477
478
|
const t = token;
|
|
478
479
|
if (!t.metadata || typeof t.decimals !== "number") {
|
|
479
|
-
throw new (0,
|
|
480
|
+
throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
|
|
480
481
|
`chain ${network} is Aptos; a custom token must be { metadata, decimals }.`
|
|
481
482
|
);
|
|
482
483
|
}
|
|
@@ -503,7 +504,7 @@ function makeAptosNetwork(preset, rpcUrl) {
|
|
|
503
504
|
valid = false;
|
|
504
505
|
}
|
|
505
506
|
if (!valid || evmLike) {
|
|
506
|
-
throw new (0,
|
|
507
|
+
throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
|
|
507
508
|
`chain ${network} is Aptos, but payTo "${payTo}" is not a valid Aptos address (0x + 32 bytes).`
|
|
508
509
|
);
|
|
509
510
|
}
|
|
@@ -525,12 +526,12 @@ function makeAptosNetwork(preset, rpcUrl) {
|
|
|
525
526
|
const tx = await aptos.waitForTransaction({ transactionHash: ref });
|
|
526
527
|
return { height: String(_nullishCoalesce(tx.version, () => ( "0"))) };
|
|
527
528
|
} catch (err) {
|
|
528
|
-
throw new (0,
|
|
529
|
+
throw new (0, _chunkGYM46G5Lcjs.ConfirmationTimeoutError)(`Aptos tx ${ref} did not finalize in time.`, { cause: err });
|
|
529
530
|
}
|
|
530
531
|
},
|
|
531
532
|
async estimateCost(accept) {
|
|
532
533
|
if (accept.scheme === "exact") {
|
|
533
|
-
return
|
|
534
|
+
return _chunkGYM46G5Lcjs.nativeCost.call(void 0, {
|
|
534
535
|
symbol: APT_SYMBOL,
|
|
535
536
|
decimals: APT_DECIMALS,
|
|
536
537
|
fee: 0n,
|
|
@@ -538,7 +539,7 @@ function makeAptosNetwork(preset, rpcUrl) {
|
|
|
538
539
|
detail: "gasless \u2014 the fee payer (facilitator/relayer) sponsors gas; the buyer pays 0 APT"
|
|
539
540
|
});
|
|
540
541
|
}
|
|
541
|
-
return
|
|
542
|
+
return _chunkGYM46G5Lcjs.nativeCost.call(void 0, {
|
|
542
543
|
symbol: APT_SYMBOL,
|
|
543
544
|
decimals: APT_DECIMALS,
|
|
544
545
|
fee: 100000n,
|