@piprail/sdk 1.13.1 → 1.15.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 (30) hide show
  1. package/CHAINS.md +3 -2
  2. package/CHANGELOG.md +69 -0
  3. package/ERRORS.md +17 -2
  4. package/README.md +57 -4
  5. package/STANDARDS.md +4 -0
  6. package/dist/{algorand-MXUSKX46.cjs → algorand-EJ3S2V7E.cjs} +17 -17
  7. package/dist/{algorand-WGVF4KTU.js → algorand-F3OYB534.js} +1 -1
  8. package/dist/{aptos-YT7SXWPF.cjs → aptos-GJGIZHNI.cjs} +16 -16
  9. package/dist/{aptos-LPBLSEIQ.js → aptos-SUXOVP7B.js} +1 -1
  10. package/dist/{chunk-SVMGHASK.js → chunk-ILPABTI2.js} +18 -1
  11. package/dist/{chunk-MDLZJGLY.cjs → chunk-PA6YD3HL.cjs} +35 -18
  12. package/dist/index.cjs +800 -163
  13. package/dist/index.d.cts +472 -42
  14. package/dist/index.d.ts +472 -42
  15. package/dist/index.js +695 -58
  16. package/dist/{near-K6BDBABG.js → near-LM7S3WUD.js} +1 -1
  17. package/dist/{near-7ZDNISUX.cjs → near-ZJLZE26R.cjs} +19 -19
  18. package/dist/{solana-PU7N2M64.cjs → solana-MPPE6K24.cjs} +14 -14
  19. package/dist/{solana-S3UFI3FE.js → solana-WDKWWF33.js} +1 -1
  20. package/dist/{stellar-Q5PO23SC.js → stellar-FIJPQZVW.js} +1 -1
  21. package/dist/{stellar-VDQOFQEO.cjs → stellar-XHLLNHQP.cjs} +21 -21
  22. package/dist/{sui-FKSMLKRF.cjs → sui-6CVLEXLA.cjs} +17 -17
  23. package/dist/{sui-WOXRKJXS.js → sui-B7AVN7NK.js} +1 -1
  24. package/dist/{ton-WPTXGLVK.js → ton-CHJ26BVA.js} +1 -1
  25. package/dist/{ton-VK6KRJHP.cjs → ton-RNEFN25G.cjs} +14 -14
  26. package/dist/{tron-6GXBXTR4.js → tron-DD3JDROV.js} +1 -1
  27. package/dist/{tron-WLOF5OUV.cjs → tron-TKJHNFGM.cjs} +24 -24
  28. package/dist/{xrpl-HEAPEXAM.js → xrpl-GTUPP6SK.js} +1 -1
  29. package/dist/{xrpl-CMNI25BV.cjs → xrpl-XN2NBNGI.cjs} +21 -21
  30. package/package.json +1 -1
@@ -8,7 +8,7 @@ var _chunkCQREG5LEcjs = require('./chunk-CQREG5LE.cjs');
8
8
 
9
9
 
10
10
 
11
- var _chunkMDLZJGLYcjs = require('./chunk-MDLZJGLY.cjs');
11
+ var _chunkPA6YD3HLcjs = require('./chunk-PA6YD3HL.cjs');
12
12
 
13
13
  // src/drivers/ton/index.ts
14
14
  var _core = require('@ton/core');
@@ -74,7 +74,7 @@ async function waitForSeqno(opened, from, { tries = 30, intervalMs = 2e3 } = {})
74
74
  }
75
75
  if (current > from) return;
76
76
  }
77
- throw new (0, _chunkMDLZJGLYcjs.ConfirmationTimeoutError)(
77
+ throw new (0, _chunkPA6YD3HLcjs.ConfirmationTimeoutError)(
78
78
  `TON wallet seqno did not advance past ${from} \u2014 the payment may not have been accepted.`
79
79
  );
80
80
  }
@@ -202,17 +202,17 @@ var _crypto = require('@ton/crypto');
202
202
 
203
203
  function assertTonWallet(wallet, network) {
204
204
  if (typeof wallet !== "object" || wallet === null) {
205
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
205
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
206
206
  `chain ${network} is TON; wallet must be { mnemonic } (24 words) or { keyPair }.`
207
207
  );
208
208
  }
209
209
  if ("privateKey" in wallet || "walletClient" in wallet) {
210
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
210
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
211
211
  `chain ${network} is TON; an EVM wallet can't be used \u2014 pass { mnemonic } (24 words) or { keyPair }.`
212
212
  );
213
213
  }
214
214
  if (!("mnemonic" in wallet) && !("keyPair" in wallet)) {
215
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
215
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
216
216
  `chain ${network} is TON; wallet must be { mnemonic } (24 words) or { keyPair }.`
217
217
  );
218
218
  }
@@ -227,7 +227,7 @@ async function resolveTonWallet(config) {
227
227
  } else if (config.keyPair) {
228
228
  keyPair = config.keyPair;
229
229
  } else {
230
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)("TON wallet needs { mnemonic } (24 words) or { keyPair }.");
230
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)("TON wallet needs { mnemonic } (24 words) or { keyPair }.");
231
231
  }
232
232
  const contract = version === "v5r1" ? _ton.WalletContractV5R1.create({ workchain: 0, publicKey: keyPair.publicKey }) : _ton.WalletContractV4.create({ workchain: 0, publicKey: keyPair.publicKey });
233
233
  return { keyPair, contract };
@@ -270,15 +270,15 @@ function makeTonNetwork(preset, rpcUrl) {
270
270
  const info = preset.tokens[token.toUpperCase()];
271
271
  if (!info) {
272
272
  const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
273
- throw new (0, _chunkMDLZJGLYcjs.UnknownTokenError)(
273
+ throw new (0, _chunkPA6YD3HLcjs.UnknownTokenError)(
274
274
  `token "${token}" isn't built in for TON (known: ${known}). Note: native USDC doesn't exist on TON. Pass { master, decimals } for a custom jetton, or use 'native'.`
275
275
  );
276
276
  }
277
277
  return { asset: info.master, decimals: info.decimals, symbol: info.symbol };
278
278
  }
279
- _chunkMDLZJGLYcjs.rejectForeignToken.call(void 0, token, "ton", network);
279
+ _chunkPA6YD3HLcjs.rejectForeignToken.call(void 0, token, "ton", network);
280
280
  if (!("master" in token)) {
281
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
281
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
282
282
  `chain ${network} is TON; a custom token must be { master, decimals }.`
283
283
  );
284
284
  }
@@ -297,14 +297,14 @@ function makeTonNetwork(preset, rpcUrl) {
297
297
  },
298
298
  assertValidPayTo(payTo) {
299
299
  if (payTo.startsWith("0x")) {
300
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
300
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
301
301
  `chain ${network} is TON, but payTo "${payTo}" looks like an EVM address.`
302
302
  );
303
303
  }
304
304
  try {
305
305
  _core.Address.parse(payTo);
306
306
  } catch (e6) {
307
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
307
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
308
308
  `chain ${network} is TON, but payTo "${payTo}" is not a valid TON address.`
309
309
  );
310
310
  }
@@ -320,7 +320,7 @@ function makeTonNetwork(preset, rpcUrl) {
320
320
  const watch = await watchAccountFor(accept);
321
321
  return encodeRef(watch, accept.extra.nonce);
322
322
  } catch (err) {
323
- throw _nullishCoalesce(_chunkMDLZJGLYcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
323
+ throw _nullishCoalesce(_chunkPA6YD3HLcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
324
324
  }
325
325
  },
326
326
  async confirm(ref) {
@@ -339,12 +339,12 @@ function makeTonNetwork(preset, rpcUrl) {
339
339
  if (inc && inc.comment === nonce) return { height: tx.lt.toString() };
340
340
  }
341
341
  }
342
- throw new (0, _chunkMDLZJGLYcjs.ConfirmationTimeoutError)(`TON payment for nonce ${nonce} did not settle in time.`);
342
+ throw new (0, _chunkPA6YD3HLcjs.ConfirmationTimeoutError)(`TON payment for nonce ${nonce} did not settle in time.`);
343
343
  },
344
344
  async estimateCost(accept) {
345
345
  const fee = accept.asset === "native" ? 10000000n : 50000000n;
346
346
  const detail = accept.asset === "native" ? "~0.01 TON network fee" : "~0.05 TON attached for the jetton transfer (leftover refunded)";
347
- return _chunkMDLZJGLYcjs.nativeCost.call(void 0, { symbol: "TON", decimals: TON_DECIMALS, fee, basis: "heuristic", detail });
347
+ return _chunkPA6YD3HLcjs.nativeCost.call(void 0, { symbol: "TON", decimals: TON_DECIMALS, fee, basis: "heuristic", detail });
348
348
  },
349
349
  async balanceOf(wallet, asset) {
350
350
  let owner;
@@ -9,7 +9,7 @@ import {
9
9
  nativeCost,
10
10
  rejectForeignToken,
11
11
  toInsufficientFundsError
12
- } from "./chunk-SVMGHASK.js";
12
+ } from "./chunk-ILPABTI2.js";
13
13
 
14
14
  // src/drivers/tron/index.ts
15
15
  import { TronWeb } from "tronweb";
@@ -9,7 +9,7 @@ var _chunkCQREG5LEcjs = require('./chunk-CQREG5LE.cjs');
9
9
 
10
10
 
11
11
 
12
- var _chunkMDLZJGLYcjs = require('./chunk-MDLZJGLY.cjs');
12
+ var _chunkPA6YD3HLcjs = require('./chunk-PA6YD3HL.cjs');
13
13
 
14
14
  // src/drivers/tron/index.ts
15
15
  var _tronweb = require('tronweb');
@@ -61,7 +61,7 @@ async function payTron(params) {
61
61
  return _nullishCoalesce(_nullishCoalesce(broadcast.txid, () => ( _optionalChain([broadcast, 'access', _7 => _7.transaction, 'optionalAccess', _8 => _8.txID]))), () => ( signed.txID));
62
62
  }
63
63
  if (isTronAffordability(broadcast.code, broadcast.message)) {
64
- throw new (0, _chunkMDLZJGLYcjs.InsufficientFundsError)(
64
+ throw new (0, _chunkPA6YD3HLcjs.InsufficientFundsError)(
65
65
  `Tron payment rejected (${_nullishCoalesce(broadcast.code, () => ( "broadcast"))}): not enough TRX for energy/bandwidth, or insufficient token balance.`
66
66
  );
67
67
  }
@@ -69,8 +69,8 @@ async function payTron(params) {
69
69
  `Tron broadcast failed: ${_nullishCoalesce(broadcast.code, () => ( ""))} ${decodeMaybeHex(broadcast.message)}`.trim()
70
70
  );
71
71
  } catch (err) {
72
- if (err instanceof _chunkMDLZJGLYcjs.InsufficientFundsError) throw err;
73
- throw _nullishCoalesce(_chunkMDLZJGLYcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
72
+ if (err instanceof _chunkPA6YD3HLcjs.InsufficientFundsError) throw err;
73
+ throw _nullishCoalesce(_chunkPA6YD3HLcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
74
74
  }
75
75
  }
76
76
  async function payTronNative(params) {
@@ -83,7 +83,7 @@ async function payTronNative(params) {
83
83
  return _nullishCoalesce(_nullishCoalesce(broadcast.txid, () => ( _optionalChain([broadcast, 'access', _11 => _11.transaction, 'optionalAccess', _12 => _12.txID]))), () => ( signed.txID));
84
84
  }
85
85
  if (isTronAffordability(broadcast.code, broadcast.message)) {
86
- throw new (0, _chunkMDLZJGLYcjs.InsufficientFundsError)(
86
+ throw new (0, _chunkPA6YD3HLcjs.InsufficientFundsError)(
87
87
  `Tron TRX payment rejected (${_nullishCoalesce(broadcast.code, () => ( "broadcast"))}): not enough TRX for the amount plus bandwidth (and the ~1 TRX account-creation fee if the recipient is new).`
88
88
  );
89
89
  }
@@ -91,8 +91,8 @@ async function payTronNative(params) {
91
91
  `Tron TRX broadcast failed: ${_nullishCoalesce(broadcast.code, () => ( ""))} ${decodeMaybeHex(broadcast.message)}`.trim()
92
92
  );
93
93
  } catch (err) {
94
- if (err instanceof _chunkMDLZJGLYcjs.InsufficientFundsError) throw err;
95
- throw _nullishCoalesce(_chunkMDLZJGLYcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
94
+ if (err instanceof _chunkPA6YD3HLcjs.InsufficientFundsError) throw err;
95
+ throw _nullishCoalesce(_chunkPA6YD3HLcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
96
96
  }
97
97
  }
98
98
  function decodeMaybeHex(message) {
@@ -263,22 +263,22 @@ function txNotFound(txid) {
263
263
  // src/drivers/tron/wallet.ts
264
264
  function assertTronWallet(wallet, network) {
265
265
  if (typeof wallet !== "object" || wallet === null) {
266
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
266
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
267
267
  `chain ${network} is Tron; wallet must be { privateKey } (32-byte hex).`
268
268
  );
269
269
  }
270
270
  if ("walletClient" in wallet) {
271
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
271
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
272
272
  `chain ${network} is Tron; a viem { walletClient } can't be used \u2014 pass { privateKey } (32-byte hex).`
273
273
  );
274
274
  }
275
275
  if ("secretKey" in wallet || "signer" in wallet || "mnemonic" in wallet || "keyPair" in wallet || "secret" in wallet || "keypair" in wallet || "seed" in wallet) {
276
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
276
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
277
277
  `chain ${network} is Tron; that looks like a Solana/TON/Stellar/XRPL wallet \u2014 pass { privateKey } (32-byte hex).`
278
278
  );
279
279
  }
280
280
  if (!("privateKey" in wallet)) {
281
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
281
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
282
282
  `chain ${network} is Tron; wallet must be { privateKey } (32-byte hex).`
283
283
  );
284
284
  }
@@ -286,11 +286,11 @@ function assertTronWallet(wallet, network) {
286
286
  }
287
287
  function resolveTronPrivateKey(config) {
288
288
  if (!config.privateKey) {
289
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)("Tron wallet needs { privateKey } (32-byte hex).");
289
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)("Tron wallet needs { privateKey } (32-byte hex).");
290
290
  }
291
291
  const hex = config.privateKey.replace(/^0x/i, "").toLowerCase();
292
292
  if (!/^[0-9a-f]{64}$/.test(hex)) {
293
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
293
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
294
294
  "Tron wallet { privateKey } must be a 32-byte hex string (64 hex chars)."
295
295
  );
296
296
  }
@@ -340,21 +340,21 @@ function makeTronNetwork(preset, rpcUrl) {
340
340
  const info = preset.tokens[token.toUpperCase()];
341
341
  if (!info) {
342
342
  const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
343
- throw new (0, _chunkMDLZJGLYcjs.UnknownTokenError)(
343
+ throw new (0, _chunkPA6YD3HLcjs.UnknownTokenError)(
344
344
  `token "${token}" isn't built in for Tron (known: ${known}). Note: native USDC doesn't exist on Tron. Pass { address, decimals } for a custom TRC-20.`
345
345
  );
346
346
  }
347
347
  return { asset: info.address, decimals: info.decimals, symbol: info.symbol };
348
348
  }
349
- _chunkMDLZJGLYcjs.rejectForeignToken.call(void 0, token, "tron", network);
349
+ _chunkPA6YD3HLcjs.rejectForeignToken.call(void 0, token, "tron", network);
350
350
  if (!("address" in token)) {
351
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
351
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
352
352
  `chain ${network} is Tron; a custom token must be { address, decimals } (Base58 T\u2026 contract).`
353
353
  );
354
354
  }
355
355
  const t = token;
356
356
  if (t.address.startsWith("0x") || !tronWeb.isAddress(t.address)) {
357
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
357
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
358
358
  `chain ${network} is Tron, but token address "${t.address}" is not a valid Tron contract (T\u2026).`
359
359
  );
360
360
  }
@@ -373,12 +373,12 @@ function makeTronNetwork(preset, rpcUrl) {
373
373
  },
374
374
  assertValidPayTo(payTo) {
375
375
  if (payTo.startsWith("0x")) {
376
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
376
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
377
377
  `chain ${network} is Tron, but payTo "${payTo}" looks like an EVM address.`
378
378
  );
379
379
  }
380
380
  if (!tronWeb.isAddress(payTo)) {
381
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
381
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
382
382
  `chain ${network} is Tron, but payTo "${payTo}" is not a valid Tron address (T\u2026).`
383
383
  );
384
384
  }
@@ -390,7 +390,7 @@ function makeTronNetwork(preset, rpcUrl) {
390
390
  const privateKey = resolveTronPrivateKey(wallet._native);
391
391
  const from = tronWeb.address.fromPrivateKey(privateKey);
392
392
  if (!from) {
393
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)("Tron wallet { privateKey } could not derive an address.");
393
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)("Tron wallet { privateKey } could not derive an address.");
394
394
  }
395
395
  if (accept.asset === "native") {
396
396
  return payTronNative({ client: tronWeb, from, privateKey, accept });
@@ -413,11 +413,11 @@ function makeTronNetwork(preset, rpcUrl) {
413
413
  }
414
414
  await _chunkCQREG5LEcjs.delay.call(void 0, 2500);
415
415
  }
416
- throw new (0, _chunkMDLZJGLYcjs.ConfirmationTimeoutError)(`Tron tx ${txid} did not solidify in time.`);
416
+ throw new (0, _chunkPA6YD3HLcjs.ConfirmationTimeoutError)(`Tron tx ${txid} did not solidify in time.`);
417
417
  },
418
418
  async estimateCost(accept, opts) {
419
419
  if (accept.asset === "native") {
420
- return _chunkMDLZJGLYcjs.nativeCost.call(void 0, {
420
+ return _chunkPA6YD3HLcjs.nativeCost.call(void 0, {
421
421
  symbol: "TRX",
422
422
  decimals: TRX_DECIMALS,
423
423
  fee: 1300000n,
@@ -441,7 +441,7 @@ function makeTronNetwork(preset, rpcUrl) {
441
441
  );
442
442
  const energy = BigInt(_nullishCoalesce(r.energy_used, () => ( 0)));
443
443
  if (energy > 0n) {
444
- return _chunkMDLZJGLYcjs.nativeCost.call(void 0, {
444
+ return _chunkPA6YD3HLcjs.nativeCost.call(void 0, {
445
445
  symbol: "TRX",
446
446
  decimals: TRX_DECIMALS,
447
447
  fee: energy * ENERGY_PRICE + BANDWIDTH_SUN,
@@ -452,7 +452,7 @@ function makeTronNetwork(preset, rpcUrl) {
452
452
  } catch (e8) {
453
453
  }
454
454
  }
455
- return _chunkMDLZJGLYcjs.nativeCost.call(void 0, {
455
+ return _chunkPA6YD3HLcjs.nativeCost.call(void 0, {
456
456
  symbol: "TRX",
457
457
  decimals: TRX_DECIMALS,
458
458
  fee: 30000n * ENERGY_PRICE + BANDWIDTH_SUN,
@@ -12,7 +12,7 @@ import {
12
12
  parseUnits,
13
13
  rejectForeignToken,
14
14
  toInsufficientFundsError
15
- } from "./chunk-SVMGHASK.js";
15
+ } from "./chunk-ILPABTI2.js";
16
16
 
17
17
  // src/drivers/xrpl/index.ts
18
18
  import { isValidClassicAddress } from "xrpl";
@@ -12,7 +12,7 @@ var _chunkCQREG5LEcjs = require('./chunk-CQREG5LE.cjs');
12
12
 
13
13
 
14
14
 
15
- var _chunkMDLZJGLYcjs = require('./chunk-MDLZJGLY.cjs');
15
+ var _chunkPA6YD3HLcjs = require('./chunk-PA6YD3HL.cjs');
16
16
 
17
17
  // src/drivers/xrpl/index.ts
18
18
  var _xrpl = require('xrpl');
@@ -94,17 +94,17 @@ async function payXrpl(params) {
94
94
  const code = res.engine_result;
95
95
  if (code.startsWith("tes")) return _nullishCoalesce(_optionalChain([res, 'access', _ => _.tx_json, 'optionalAccess', _2 => _2.hash]), () => ( signed.hash));
96
96
  const recipientMsg = recipientNotReadyMessage(code);
97
- if (recipientMsg) throw new (0, _chunkMDLZJGLYcjs.RecipientNotReadyError)(recipientMsg, { cause: makeEngineError(res) });
97
+ if (recipientMsg) throw new (0, _chunkPA6YD3HLcjs.RecipientNotReadyError)(recipientMsg, { cause: makeEngineError(res) });
98
98
  if (isAffordabilityCode(code)) {
99
- throw new (0, _chunkMDLZJGLYcjs.InsufficientFundsError)(
99
+ throw new (0, _chunkPA6YD3HLcjs.InsufficientFundsError)(
100
100
  `XRPL payment rejected: the sender can't cover it \u2014 balance or the 1 XRP base reserve. (XRPL: ${code})`,
101
101
  { cause: makeEngineError(res) }
102
102
  );
103
103
  }
104
104
  throw makeEngineError(res);
105
105
  } catch (err) {
106
- if (err instanceof _chunkMDLZJGLYcjs.InsufficientFundsError || err instanceof _chunkMDLZJGLYcjs.RecipientNotReadyError) throw err;
107
- throw _nullishCoalesce(_chunkMDLZJGLYcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
106
+ if (err instanceof _chunkPA6YD3HLcjs.InsufficientFundsError || err instanceof _chunkPA6YD3HLcjs.RecipientNotReadyError) throw err;
107
+ throw _nullishCoalesce(_chunkPA6YD3HLcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
108
108
  }
109
109
  }
110
110
  function amountForAccept(accept) {
@@ -229,7 +229,7 @@ function deliveredBaseUnits(delivered, want, decimals) {
229
229
  return null;
230
230
  }
231
231
  try {
232
- return _chunkMDLZJGLYcjs.floorUnits.call(void 0, delivered.value, decimals);
232
+ return _chunkPA6YD3HLcjs.floorUnits.call(void 0, delivered.value, decimals);
233
233
  } catch (e3) {
234
234
  return null;
235
235
  }
@@ -253,22 +253,22 @@ function rpcFailed(nonce) {
253
253
 
254
254
  function assertXrplWallet(wallet, network) {
255
255
  if (typeof wallet !== "object" || wallet === null) {
256
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
256
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
257
257
  `chain ${network} is XRPL; wallet must be { seed } (s\u2026 seed) or { wallet }.`
258
258
  );
259
259
  }
260
260
  if ("privateKey" in wallet || "walletClient" in wallet) {
261
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
261
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
262
262
  `chain ${network} is XRPL; an EVM wallet can't be used \u2014 pass { seed } (s\u2026 seed) or { wallet }.`
263
263
  );
264
264
  }
265
265
  if ("secretKey" in wallet || "signer" in wallet || "mnemonic" in wallet || "keyPair" in wallet || "secret" in wallet || "keypair" in wallet) {
266
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
266
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
267
267
  `chain ${network} is XRPL; that looks like a Solana/TON/Stellar wallet \u2014 pass { seed } (s\u2026 seed) or { wallet }.`
268
268
  );
269
269
  }
270
270
  if (!("seed" in wallet) && !("wallet" in wallet)) {
271
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
271
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
272
272
  `chain ${network} is XRPL; wallet must be { seed } (s\u2026 seed) or { wallet }.`
273
273
  );
274
274
  }
@@ -278,11 +278,11 @@ function resolveXrplWallet(config) {
278
278
  if (config.wallet) return config.wallet;
279
279
  if (config.seed) {
280
280
  if (!_xrpl.isValidSecret.call(void 0, config.seed)) {
281
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)("XRPL wallet { seed } is not a valid s\u2026 secret seed.");
281
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)("XRPL wallet { seed } is not a valid s\u2026 secret seed.");
282
282
  }
283
283
  return _xrpl.Wallet.fromSeed(config.seed);
284
284
  }
285
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)("XRPL wallet needs { seed } (s\u2026 seed) or { wallet }.");
285
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)("XRPL wallet needs { seed } (s\u2026 seed) or { wallet }.");
286
286
  }
287
287
 
288
288
  // src/drivers/xrpl/index.ts
@@ -357,7 +357,7 @@ function makeXrplNetwork(preset, rpcUrl) {
357
357
  const info = preset.tokens[token.toUpperCase()];
358
358
  if (!info) {
359
359
  const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
360
- throw new (0, _chunkMDLZJGLYcjs.UnknownTokenError)(
360
+ throw new (0, _chunkPA6YD3HLcjs.UnknownTokenError)(
361
361
  `token "${token}" isn't built in for XRPL (known: ${known}). Pass { issuer, currencyHex, decimals } for a custom IOU, or use 'native'.`
362
362
  );
363
363
  }
@@ -367,10 +367,10 @@ function makeXrplNetwork(preset, rpcUrl) {
367
367
  symbol: info.symbol
368
368
  };
369
369
  }
370
- _chunkMDLZJGLYcjs.rejectForeignToken.call(void 0, token, "xrpl", network);
370
+ _chunkPA6YD3HLcjs.rejectForeignToken.call(void 0, token, "xrpl", network);
371
371
  const t = token;
372
372
  if (!t.issuer || !t.currencyHex || typeof t.decimals !== "number") {
373
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
373
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
374
374
  `chain ${network} is XRPL; a custom token must be { issuer, currencyHex, decimals }.`
375
375
  );
376
376
  }
@@ -391,12 +391,12 @@ function makeXrplNetwork(preset, rpcUrl) {
391
391
  },
392
392
  assertValidPayTo(payTo) {
393
393
  if (payTo.startsWith("0x")) {
394
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
394
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
395
395
  `chain ${network} is XRPL, but payTo "${payTo}" looks like an EVM address.`
396
396
  );
397
397
  }
398
398
  if (!_xrpl.isValidClassicAddress.call(void 0, payTo)) {
399
- throw new (0, _chunkMDLZJGLYcjs.WrongFamilyError)(
399
+ throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
400
400
  `chain ${network} is XRPL, but payTo "${payTo}" is not a valid XRPL account (r\u2026).`
401
401
  );
402
402
  }
@@ -419,14 +419,14 @@ function makeXrplNetwork(preset, rpcUrl) {
419
419
  }
420
420
  await _chunkCQREG5LEcjs.delay.call(void 0, 1500);
421
421
  }
422
- throw new (0, _chunkMDLZJGLYcjs.ConfirmationTimeoutError)(`XRPL tx ${ref} not validated on-ledger in time.`);
422
+ throw new (0, _chunkPA6YD3HLcjs.ConfirmationTimeoutError)(`XRPL tx ${ref} not validated on-ledger in time.`);
423
423
  },
424
424
  async estimateCost() {
425
425
  try {
426
426
  const drops = await payClient.feeDrops();
427
427
  const n = Number(drops);
428
428
  const fee = BigInt(Number.isFinite(n) && n > 12 ? Math.ceil(n) : 12);
429
- return _chunkMDLZJGLYcjs.nativeCost.call(void 0, {
429
+ return _chunkPA6YD3HLcjs.nativeCost.call(void 0, {
430
430
  symbol: XRP_SYMBOL,
431
431
  decimals: XRP_DECIMALS,
432
432
  fee,
@@ -434,7 +434,7 @@ function makeXrplNetwork(preset, rpcUrl) {
434
434
  detail: `network fee ${fee} drops`
435
435
  });
436
436
  } catch (e5) {
437
- return _chunkMDLZJGLYcjs.nativeCost.call(void 0, {
437
+ return _chunkPA6YD3HLcjs.nativeCost.call(void 0, {
438
438
  symbol: XRP_SYMBOL,
439
439
  decimals: XRP_DECIMALS,
440
440
  fee: 12n,
@@ -471,7 +471,7 @@ function makeXrplNetwork(preset, rpcUrl) {
471
471
  const line = r.lines.find(
472
472
  (l) => l.currency.toUpperCase() === (_nullishCoalesce(currencyHex, () => ( ""))).toUpperCase() && l.account === issuer
473
473
  );
474
- token = line ? _chunkMDLZJGLYcjs.parseUnits.call(void 0, line.balance, XRP_DECIMALS) : 0n;
474
+ token = line ? _chunkPA6YD3HLcjs.parseUnits.call(void 0, line.balance, XRP_DECIMALS) : 0n;
475
475
  } catch (e) {
476
476
  token = isXrplActNotFound(e) ? 0n : null;
477
477
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piprail/sdk",
3
- "version": "1.13.1",
3
+ "version": "1.15.0",
4
4
  "description": "Accept x402 crypto payments across 29 chains — every major EVM chain plus Solana, TON, Tron, NEAR, Sui, Aptos, Algorand, Stellar & XRPL — in a couple of lines. No backend, no database, no fee; payments settle straight to your wallet.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",