@piprail/sdk 2.15.0 → 2.16.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +260 -0
  2. package/README.md +2 -2
  3. package/dist/{algorand-CSEUTWNW.js → algorand-25FMBCT3.js} +13 -4
  4. package/dist/{algorand-I2O24RSM.cjs → algorand-Q3TUQLPK.cjs} +49 -40
  5. package/dist/{aptos-J7QGCWNW.js → aptos-SBV6SGDP.js} +3 -3
  6. package/dist/{aptos-GA5AEYYL.cjs → aptos-VBJONBFY.cjs} +36 -36
  7. package/dist/chunk-2CX7XRZK.js +649 -0
  8. package/dist/chunk-C52H5TYB.js +474 -0
  9. package/dist/chunk-OXEFPLZA.cjs +474 -0
  10. package/dist/{chunk-3FR22M3O.cjs → chunk-QONQSZHJ.cjs} +2 -2
  11. package/dist/{chunk-3ZWM3DKM.js → chunk-QU25LSVS.js} +2 -2
  12. package/dist/chunk-V2IJ5HUW.cjs +649 -0
  13. package/dist/index.cjs +507 -1347
  14. package/dist/index.d.cts +39 -6
  15. package/dist/index.d.ts +39 -6
  16. package/dist/index.js +192 -1032
  17. package/dist/{ledger-uFtXlIHY.d.cts → ledger-Crc1bZox.d.cts} +164 -10
  18. package/dist/{ledger-uFtXlIHY.d.ts → ledger-Crc1bZox.d.ts} +164 -10
  19. package/dist/{near-NDQLGI4U.cjs → near-5LTTDU6G.cjs} +27 -27
  20. package/dist/{near-YA4Y4IGC.js → near-OLKCMTBI.js} +1 -1
  21. package/dist/node.d.cts +2 -2
  22. package/dist/node.d.ts +2 -2
  23. package/dist/{solana-OU6IUMQM.cjs → solana-AI2G7V33.cjs} +73 -52
  24. package/dist/{solana-MB6G3OA5.js → solana-HTKDRTD3.js} +32 -11
  25. package/dist/{stellar-RSNVOIKL.cjs → stellar-E2KWEV2E.cjs} +20 -20
  26. package/dist/{stellar-WDWSYOED.js → stellar-EUFZLX6J.js} +1 -1
  27. package/dist/{sui-GVSFNNJX.js → sui-KCIITCYH.js} +6 -2
  28. package/dist/{sui-MVC46BFJ.cjs → sui-Q3NJOJZS.cjs} +21 -17
  29. package/dist/{ton-MYOI3U3H.cjs → ton-J7TQWRN4.cjs} +16 -16
  30. package/dist/{ton-EJMGM3YI.js → ton-WH2JVQOO.js} +1 -1
  31. package/dist/{tron-VAPVMGJK.js → tron-FXBXDNEY.js} +1 -1
  32. package/dist/{tron-42X5N4GQ.cjs → tron-HIPMOX7S.cjs} +25 -25
  33. package/dist/{xrpl-Q2UWPCTJ.js → xrpl-RUOB37QH.js} +283 -5
  34. package/dist/{xrpl-MGUBUNSZ.cjs → xrpl-SVVS445B.cjs} +312 -34
  35. package/package.json +1 -1
@@ -9,7 +9,7 @@ import {
9
9
  nativeCost,
10
10
  rejectForeignToken,
11
11
  toInsufficientFundsError
12
- } from "./chunk-3ZWM3DKM.js";
12
+ } from "./chunk-QU25LSVS.js";
13
13
 
14
14
  // src/drivers/aptos/index.ts
15
15
  import { Aptos, AptosConfig, Network, AccountAddress as AccountAddress2 } from "@aptos-labs/ts-sdk";
@@ -107,7 +107,7 @@ async function payExactAptos(input) {
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
- const feePayer = accept.extra.feePayer;
110
+ const feePayer = accept.extra?.feePayer;
111
111
  if (!feePayer) {
112
112
  throw new UnsupportedSchemeError("Aptos exact rail must advertise extra.feePayer (the gas sponsor address).");
113
113
  }
@@ -157,7 +157,7 @@ function argBytes(arg) {
157
157
  }
158
158
  async function verifyAndSettleExactAptos(input) {
159
159
  const { client, feePayerAddr, payload, accept } = input;
160
- const railFeePayer = accept.extra.feePayer;
160
+ const railFeePayer = accept.extra?.feePayer;
161
161
  if (!railFeePayer) throw new SettlementError("Aptos exact: rail is missing extra.feePayer.");
162
162
  if (railFeePayer !== feePayerAddr) {
163
163
  throw new SettlementError("Aptos exact: the gate relayer address does not match the rail extra.feePayer \u2014 misconfigured rail.");
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- var _chunk3FR22M3Ocjs = require('./chunk-3FR22M3O.cjs');
12
+ var _chunkQONQSZHJcjs = require('./chunk-QONQSZHJ.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 _chunk3FR22M3Ocjs.InsufficientFundsError) throw err;
61
+ if (err instanceof _chunkQONQSZHJcjs.InsufficientFundsError) throw err;
62
62
  if (isAptosAffordability(err)) {
63
- throw new (0, _chunk3FR22M3Ocjs.InsufficientFundsError)(
63
+ throw new (0, _chunkQONQSZHJcjs.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(_chunk3FR22M3Ocjs.toInsufficientFundsError.call(void 0, err), () => ( err));
68
+ throw _nullishCoalesce(_chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
106
+ throw new (0, _chunkQONQSZHJcjs.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
- const feePayer = accept.extra.feePayer;
110
+ const feePayer = _optionalChain([accept, 'access', _ => _.extra, 'optionalAccess', _2 => _2.feePayer]);
111
111
  if (!feePayer) {
112
- throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)("Aptos exact rail must advertise extra.feePayer (the gas sponsor address).");
112
+ throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(`Aptos exact: extra.feePayer "${feePayer}" is not a valid Aptos address.`);
115
+ if (!feePayerAddr) throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(`Aptos exact: payTo "${accept.payTo}" is not a valid Aptos address.`);
117
+ if (!payToAddr) throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(`Aptos exact: asset "${accept.asset}" is not a valid FA metadata address.`);
119
+ if (!metadataAddr) throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(`Aptos exact: payer "${sender}" is not a valid Aptos address.`);
121
+ if (!senderAddr) throw new (0, _chunkQONQSZHJcjs.UnsupportedSchemeError)(`Aptos exact: payer "${sender}" is not a valid Aptos address.`);
122
122
  if (feePayerAddr.equals(senderAddr)) {
123
- throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
123
+ throw new (0, _chunkQONQSZHJcjs.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
  }
@@ -151,23 +151,23 @@ function fail(error, detail) {
151
151
  return { ok: false, error, detail };
152
152
  }
153
153
  function argBytes(arg) {
154
- const v = _optionalChain([arg, 'access', _ => _.value, 'optionalAccess', _2 => _2.value]);
154
+ const v = _optionalChain([arg, 'access', _3 => _3.value, 'optionalAccess', _4 => _4.value]);
155
155
  if (v instanceof Uint8Array) return v;
156
156
  throw new Error("unexpected entry-function argument shape");
157
157
  }
158
158
  async function verifyAndSettleExactAptos(input) {
159
159
  const { client, feePayerAddr, payload, accept } = input;
160
- const railFeePayer = accept.extra.feePayer;
161
- if (!railFeePayer) throw new (0, _chunk3FR22M3Ocjs.SettlementError)("Aptos exact: rail is missing extra.feePayer.");
160
+ const railFeePayer = _optionalChain([accept, 'access', _5 => _5.extra, 'optionalAccess', _6 => _6.feePayer]);
161
+ if (!railFeePayer) throw new (0, _chunkQONQSZHJcjs.SettlementError)("Aptos exact: rail is missing extra.feePayer.");
162
162
  if (railFeePayer !== feePayerAddr) {
163
- throw new (0, _chunk3FR22M3Ocjs.SettlementError)("Aptos exact: the gate relayer address does not match the rail extra.feePayer \u2014 misconfigured rail.");
163
+ throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.SettlementError)("Aptos exact: native APT is not exact-payable (misconfigured rail).");
165
+ if (accept.asset === "native") throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.SettlementError)("Aptos exact: rail feePayer/payTo/asset is not a valid Aptos address (misconfigured rail).");
170
+ throw new (0, _chunkQONQSZHJcjs.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;
@@ -179,7 +179,7 @@ async function verifyAndSettleExactAptos(input) {
179
179
  }
180
180
  const raw = tx.rawTransaction;
181
181
  if (!tx.feePayerAddress || !tx.feePayerAddress.equals(railFeePayerAddr)) {
182
- return fail("signature_invalid", `The transaction fee payer ${_nullishCoalesce(_optionalChain([tx, 'access', _3 => _3.feePayerAddress, 'optionalAccess', _4 => _4.toString, 'call', _5 => _5()]), () => ( "(none)"))} is not the rail fee payer ${railFeePayer}.`);
182
+ return fail("signature_invalid", `The transaction fee payer ${_nullishCoalesce(_optionalChain([tx, 'access', _7 => _7.feePayerAddress, 'optionalAccess', _8 => _8.toString, 'call', _9 => _9()]), () => ( "(none)"))} is not the rail fee payer ${railFeePayer}.`);
183
183
  }
184
184
  const payloadKind = raw.payload;
185
185
  if (!(payloadKind instanceof _tssdk.TransactionPayloadEntryFunction)) {
@@ -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, _chunk3FR22M3Ocjs.SettlementError)(`Aptos exact settle: the gate could not sign as fee payer (${shorten(err instanceof Error ? err.message : String(err))}).`, { cause: err });
244
+ throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.SettlementError)(
267
+ throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.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 });
276
+ throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.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.`);
279
+ throw new (0, _chunkQONQSZHJcjs.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).`);
@@ -372,13 +372,13 @@ function txNotFound(hash) {
372
372
 
373
373
  function assertAptosWallet(wallet, network) {
374
374
  if (typeof wallet !== "object" || wallet === null) {
375
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
375
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
376
376
  `chain ${network} is Aptos; wallet must be { key } (ed25519-priv-0x\u2026) or { account }.`
377
377
  );
378
378
  }
379
- _chunk3FR22M3Ocjs.assertNoLegacyWalletKey.call(void 0, wallet, "Aptos");
379
+ _chunkQONQSZHJcjs.assertNoLegacyWalletKey.call(void 0, wallet, "Aptos");
380
380
  if (!("key" in wallet) && !("account" in wallet)) {
381
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
381
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
382
382
  `chain ${network} is Aptos; wallet must be { key } (ed25519-priv-0x\u2026) or { account }.`
383
383
  );
384
384
  }
@@ -390,13 +390,13 @@ function resolveAptosAccount(config) {
390
390
  try {
391
391
  return _tssdk.Account.fromPrivateKey({ privateKey: new (0, _tssdk.Ed25519PrivateKey)(config.key) });
392
392
  } catch (cause) {
393
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
393
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
394
394
  "Aptos wallet { key } is not a valid ed25519 secret (ed25519-priv-0x\u2026 or 0x\u2026 hex).",
395
395
  { cause }
396
396
  );
397
397
  }
398
398
  }
399
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)("Aptos wallet needs { key } (ed25519-priv-0x\u2026) or { account }.");
399
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)("Aptos wallet needs { key } (ed25519-priv-0x\u2026) or { account }.");
400
400
  }
401
401
 
402
402
  // src/drivers/aptos/index.ts
@@ -468,16 +468,16 @@ function makeAptosNetwork(preset, rpcUrl) {
468
468
  const info = preset.tokens[token.toUpperCase()];
469
469
  if (!info) {
470
470
  const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
471
- throw new (0, _chunk3FR22M3Ocjs.UnknownTokenError)(
471
+ throw new (0, _chunkQONQSZHJcjs.UnknownTokenError)(
472
472
  `token "${token}" isn't built in for Aptos (known: ${known}). Pass { metadata, decimals } for a custom Fungible Asset, or use 'native'.`
473
473
  );
474
474
  }
475
475
  return { asset: info.metadata, decimals: info.decimals, symbol: info.symbol };
476
476
  }
477
- _chunk3FR22M3Ocjs.rejectForeignToken.call(void 0, token, "aptos", network);
477
+ _chunkQONQSZHJcjs.rejectForeignToken.call(void 0, token, "aptos", network);
478
478
  const t = token;
479
479
  if (!t.metadata || typeof t.decimals !== "number") {
480
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
480
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
481
481
  `chain ${network} is Aptos; a custom token must be { metadata, decimals }.`
482
482
  );
483
483
  }
@@ -504,7 +504,7 @@ function makeAptosNetwork(preset, rpcUrl) {
504
504
  valid = false;
505
505
  }
506
506
  if (!valid || evmLike) {
507
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
507
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
508
508
  `chain ${network} is Aptos, but payTo "${payTo}" is not a valid Aptos address (0x + 32 bytes).`
509
509
  );
510
510
  }
@@ -526,12 +526,12 @@ function makeAptosNetwork(preset, rpcUrl) {
526
526
  const tx = await aptos.waitForTransaction({ transactionHash: ref });
527
527
  return { height: String(_nullishCoalesce(tx.version, () => ( "0"))) };
528
528
  } catch (err) {
529
- throw new (0, _chunk3FR22M3Ocjs.ConfirmationTimeoutError)(`Aptos tx ${ref} did not finalize in time.`, { cause: err });
529
+ throw new (0, _chunkQONQSZHJcjs.ConfirmationTimeoutError)(`Aptos tx ${ref} did not finalize in time.`, { cause: err });
530
530
  }
531
531
  },
532
532
  async estimateCost(accept) {
533
533
  if (accept.scheme === "exact") {
534
- return _chunk3FR22M3Ocjs.nativeCost.call(void 0, {
534
+ return _chunkQONQSZHJcjs.nativeCost.call(void 0, {
535
535
  symbol: APT_SYMBOL,
536
536
  decimals: APT_DECIMALS,
537
537
  fee: 0n,
@@ -539,7 +539,7 @@ function makeAptosNetwork(preset, rpcUrl) {
539
539
  detail: "gasless \u2014 the fee payer (facilitator/relayer) sponsors gas; the buyer pays 0 APT"
540
540
  });
541
541
  }
542
- return _chunk3FR22M3Ocjs.nativeCost.call(void 0, {
542
+ return _chunkQONQSZHJcjs.nativeCost.call(void 0, {
543
543
  symbol: APT_SYMBOL,
544
544
  decimals: APT_DECIMALS,
545
545
  fee: 100000n,
@@ -620,7 +620,7 @@ function makeAptosNetwork(preset, rpcUrl) {
620
620
  feePayerPublicKey: feePayerAccount.publicKey,
621
621
  transaction
622
622
  });
623
- return { success: _optionalChain([sim, 'optionalAccess', _6 => _6.success]) === true, vmStatus: String(_nullishCoalesce(_optionalChain([sim, 'optionalAccess', _7 => _7.vm_status]), () => ( ""))) };
623
+ return { success: _optionalChain([sim, 'optionalAccess', _10 => _10.success]) === true, vmStatus: String(_nullishCoalesce(_optionalChain([sim, 'optionalAccess', _11 => _11.vm_status]), () => ( ""))) };
624
624
  },
625
625
  async submit({ transaction, senderAuthenticator, feePayerAuthenticator }) {
626
626
  const res = await aptos.transaction.submit.simple({ transaction, senderAuthenticator, feePayerAuthenticator });