@piprail/sdk 2.12.0 → 2.13.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.
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkMWBT7MCEcjs = require('./chunk-MWBT7MCE.cjs');
11
+ var _chunkDCOUJZPLcjs = require('./chunk-DCOUJZPL.cjs');
12
12
 
13
13
  // src/drivers/solana/index.ts
14
14
  var _web3js = require('@solana/web3.js');
@@ -236,7 +236,7 @@ function isEmptySig(sig) {
236
236
  function memoRandomNonce() {
237
237
  const g = globalThis.crypto;
238
238
  if (!_optionalChain([g, 'optionalAccess', _3 => _3.getRandomValues])) {
239
- throw new (0, _chunkMWBT7MCEcjs.UnsupportedSchemeError)(
239
+ throw new (0, _chunkDCOUJZPLcjs.UnsupportedSchemeError)(
240
240
  "this runtime lacks Web Crypto (globalThis.crypto.getRandomValues); SVM exact needs a CSPRNG nonce."
241
241
  );
242
242
  }
@@ -248,7 +248,7 @@ function memoDataFor(accept) {
248
248
  if (accept.extra.memo !== void 0) {
249
249
  const bytes = Buffer.from(accept.extra.memo, "utf8");
250
250
  if (bytes.length > MAX_MEMO_BYTES) {
251
- throw new (0, _chunkMWBT7MCEcjs.UnsupportedSchemeError)(
251
+ throw new (0, _chunkDCOUJZPLcjs.UnsupportedSchemeError)(
252
252
  `SVM exact: extra.memo is ${bytes.length} bytes; the scheme caps it at ${MAX_MEMO_BYTES}.`
253
253
  );
254
254
  }
@@ -262,15 +262,15 @@ function memoInstruction(accept) {
262
262
  async function payExactSolana(input) {
263
263
  const { connection, keypair, accept } = input;
264
264
  if (accept.asset === "native") {
265
- throw new (0, _chunkMWBT7MCEcjs.UnsupportedSchemeError)(
265
+ throw new (0, _chunkDCOUJZPLcjs.UnsupportedSchemeError)(
266
266
  "SVM exact is SPL-token only (TransferChecked); native SOL is not exact-payable. Pay via onchain-proof."
267
267
  );
268
268
  }
269
269
  if (!accept.extra.feePayer) {
270
- throw new (0, _chunkMWBT7MCEcjs.UnsupportedSchemeError)("SVM exact rail must advertise extra.feePayer (the merchant sponsor key).");
270
+ throw new (0, _chunkDCOUJZPLcjs.UnsupportedSchemeError)("SVM exact rail must advertise extra.feePayer (the merchant sponsor key).");
271
271
  }
272
272
  if (accept.extra.decimals === void 0) {
273
- throw new (0, _chunkMWBT7MCEcjs.UnsupportedSchemeError)("SVM exact rail must advertise extra.decimals for the TransferChecked.");
273
+ throw new (0, _chunkDCOUJZPLcjs.UnsupportedSchemeError)("SVM exact rail must advertise extra.decimals for the TransferChecked.");
274
274
  }
275
275
  let feePayer;
276
276
  let mint;
@@ -280,12 +280,12 @@ async function payExactSolana(input) {
280
280
  mint = new (0, _web3js.PublicKey)(accept.asset);
281
281
  payTo = new (0, _web3js.PublicKey)(accept.payTo);
282
282
  } catch (err) {
283
- throw new (0, _chunkMWBT7MCEcjs.UnsupportedSchemeError)(
283
+ throw new (0, _chunkDCOUJZPLcjs.UnsupportedSchemeError)(
284
284
  `SVM exact: bad feePayer/asset/payTo (${err instanceof Error ? err.message : String(err)}).`
285
285
  );
286
286
  }
287
287
  if (feePayer.equals(payTo)) {
288
- throw new (0, _chunkMWBT7MCEcjs.UnsupportedSchemeError)(
288
+ throw new (0, _chunkDCOUJZPLcjs.UnsupportedSchemeError)(
289
289
  "SVM exact: the fee payer must differ from payTo \u2014 payTo appears in the transfer instruction, which the fee payer must not (a scheme MUST-rule). Use a separate relayer key for the gate."
290
290
  );
291
291
  }
@@ -299,7 +299,7 @@ async function payExactSolana(input) {
299
299
  destInfo = "unknown";
300
300
  }
301
301
  if (destInfo === null) {
302
- throw new (0, _chunkMWBT7MCEcjs.UnsupportedSchemeError)(
302
+ throw new (0, _chunkDCOUJZPLcjs.UnsupportedSchemeError)(
303
303
  `SVM exact: the recipient's token account for ${mint.toBase58()} doesn't exist yet \u2014 the exact rail can't create it. Pay via onchain-proof (which creates it), or have ${payTo.toBase58()} create its associated token account first.`
304
304
  );
305
305
  }
@@ -330,11 +330,11 @@ async function payExactSolana(input) {
330
330
  tx.sign([keypair]);
331
331
  const buyerIndex = message.staticAccountKeys.findIndex((k) => k.equals(keypair.publicKey));
332
332
  if (buyerIndex < 1 || buyerIndex >= message.header.numRequiredSignatures) {
333
- throw new (0, _chunkMWBT7MCEcjs.UnsupportedSchemeError)("SVM exact: could not locate the buyer signer slot.");
333
+ throw new (0, _chunkDCOUJZPLcjs.UnsupportedSchemeError)("SVM exact: could not locate the buyer signer slot.");
334
334
  }
335
335
  const buyerSig = tx.signatures[buyerIndex];
336
336
  if (!buyerSig || isEmptySig(buyerSig)) {
337
- throw new (0, _chunkMWBT7MCEcjs.UnsupportedSchemeError)("SVM exact: the wallet did not produce a buyer signature.");
337
+ throw new (0, _chunkDCOUJZPLcjs.UnsupportedSchemeError)("SVM exact: the wallet did not produce a buyer signature.");
338
338
  }
339
339
  const transaction = Buffer.from(tx.serialize()).toString("base64");
340
340
  return {
@@ -361,15 +361,15 @@ async function verifyAndSettleExactSolana(input) {
361
361
  if (!accept.extra.feePayer) throw new Error("rail is missing extra.feePayer");
362
362
  railFeePayer = new (0, _web3js.PublicKey)(accept.extra.feePayer);
363
363
  } catch (err) {
364
- throw new (0, _chunkMWBT7MCEcjs.SettlementError)(`SVM exact: rail has a bad payTo/asset/feePayer (${err instanceof Error ? err.message : String(err)}).`);
364
+ throw new (0, _chunkDCOUJZPLcjs.SettlementError)(`SVM exact: rail has a bad payTo/asset/feePayer (${err instanceof Error ? err.message : String(err)}).`);
365
365
  }
366
366
  if (!railFeePayer.equals(feePayerKeypair.publicKey)) {
367
- throw new (0, _chunkMWBT7MCEcjs.SettlementError)(
367
+ throw new (0, _chunkDCOUJZPLcjs.SettlementError)(
368
368
  "SVM exact: the gate relayer key does not match the rail extra.feePayer \u2014 misconfigured rail."
369
369
  );
370
370
  }
371
371
  if (feePayerKeypair.publicKey.equals(payTo)) {
372
- throw new (0, _chunkMWBT7MCEcjs.SettlementError)("SVM exact: the fee payer must differ from payTo \u2014 misconfigured rail.");
372
+ throw new (0, _chunkDCOUJZPLcjs.SettlementError)("SVM exact: the fee payer must differ from payTo \u2014 misconfigured rail.");
373
373
  }
374
374
  const program = tokenProgramFor(accept);
375
375
  let tx;
@@ -509,7 +509,7 @@ async function verifyAndSettleExactSolana(input) {
509
509
  } catch (err) {
510
510
  const msg = err instanceof Error ? err.message : String(err);
511
511
  if (/blockhash|block height|expired/i.test(msg)) return fail("payment_expired", `Settle broadcast rejected \u2014 blockhash expired: ${shorten(msg)}.`);
512
- throw new (0, _chunkMWBT7MCEcjs.SettlementError)(
512
+ throw new (0, _chunkDCOUJZPLcjs.SettlementError)(
513
513
  `SVM exact settle: the merchant fee payer failed to broadcast (${shorten(msg)}). The buyer's signed transaction is still valid \u2014 fund/fix the fee payer and the buyer can re-present it.`,
514
514
  { cause: err }
515
515
  );
@@ -519,7 +519,7 @@ async function verifyAndSettleExactSolana(input) {
519
519
  return fail("tx_reverted", `Settle tx ${txid} reverted on-chain (a post-simulate race).`);
520
520
  }
521
521
  if (confirmed === "timeout") {
522
- throw new (0, _chunkMWBT7MCEcjs.SettlementError)(
522
+ throw new (0, _chunkDCOUJZPLcjs.SettlementError)(
523
523
  `SVM exact settle: broadcast ${txid} but it did not confirm in time. It likely landed \u2014 re-verify by signature before re-presenting; do NOT re-pay.`
524
524
  );
525
525
  }
@@ -562,18 +562,18 @@ async function pollConfirmed(connection, signature) {
562
562
 
563
563
  function toKeypair(wallet, network) {
564
564
  if (typeof wallet !== "object" || wallet === null) {
565
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
565
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
566
566
  `chain ${network} is Solana; wallet must be { key } (base58 secret) or { signer }.`
567
567
  );
568
568
  }
569
- _chunkMWBT7MCEcjs.assertNoLegacyWalletKey.call(void 0, wallet, "Solana");
569
+ _chunkDCOUJZPLcjs.assertNoLegacyWalletKey.call(void 0, wallet, "Solana");
570
570
  if ("signer" in wallet) {
571
571
  return wallet.signer;
572
572
  }
573
573
  if ("key" in wallet) {
574
574
  const sk = wallet.key;
575
575
  if (typeof sk === "string" && sk.startsWith("0x")) {
576
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
576
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
577
577
  `chain ${network} is Solana, but the wallet { key } is a 0x\u2026 hex key \u2014 that's an EVM key. A Solana key is a base58 secret string (or a 64-byte Uint8Array).`
578
578
  );
579
579
  }
@@ -581,12 +581,12 @@ function toKeypair(wallet, network) {
581
581
  const bytes = typeof sk === "string" ? _bs582.default.decode(sk) : sk;
582
582
  return _web3js.Keypair.fromSecretKey(bytes);
583
583
  } catch (err) {
584
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
584
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
585
585
  `chain ${network} is Solana; the wallet { key } isn't a valid Solana secret (expected a base58 secret string or a 64-byte Uint8Array): ${err instanceof Error ? err.message : String(err)}.`
586
586
  );
587
587
  }
588
588
  }
589
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
589
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
590
590
  `chain ${network} is Solana; wallet must be { key } (base58 secret) or { signer }.`
591
591
  );
592
592
  }
@@ -615,15 +615,15 @@ function makeSolanaNetwork(preset, rpcUrl) {
615
615
  const info = preset.tokens[token.toUpperCase()];
616
616
  if (!info) {
617
617
  const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
618
- throw new (0, _chunkMWBT7MCEcjs.UnknownTokenError)(
618
+ throw new (0, _chunkDCOUJZPLcjs.UnknownTokenError)(
619
619
  `token "${token}" isn't built in for Solana (known: ${known}). Pass { mint, decimals } instead, or use 'native'.`
620
620
  );
621
621
  }
622
622
  return { asset: info.mint, decimals: info.decimals, symbol: info.symbol };
623
623
  }
624
- _chunkMWBT7MCEcjs.rejectForeignToken.call(void 0, token, "solana", network);
624
+ _chunkDCOUJZPLcjs.rejectForeignToken.call(void 0, token, "solana", network);
625
625
  if (!("mint" in token)) {
626
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
626
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
627
627
  `chain ${network} is Solana; a custom token must be { mint, decimals }.`
628
628
  );
629
629
  }
@@ -642,14 +642,14 @@ function makeSolanaNetwork(preset, rpcUrl) {
642
642
  },
643
643
  assertValidPayTo(payTo) {
644
644
  if (payTo.startsWith("0x")) {
645
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
645
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
646
646
  `chain ${network} is Solana, but payTo "${payTo}" looks like an EVM address.`
647
647
  );
648
648
  }
649
649
  try {
650
650
  new (0, _web3js.PublicKey)(payTo);
651
651
  } catch (e7) {
652
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
652
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
653
653
  `chain ${network} is Solana, but payTo "${payTo}" is not a base58 address.`
654
654
  );
655
655
  }
@@ -661,7 +661,7 @@ function makeSolanaNetwork(preset, rpcUrl) {
661
661
  try {
662
662
  return await paySolana({ connection, keypair: wallet._native, accept });
663
663
  } catch (err) {
664
- throw _nullishCoalesce(_chunkMWBT7MCEcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
664
+ throw _nullishCoalesce(_chunkDCOUJZPLcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
665
665
  }
666
666
  },
667
667
  async confirm(ref) {
@@ -672,19 +672,19 @@ function makeSolanaNetwork(preset, rpcUrl) {
672
672
  });
673
673
  info = value[0];
674
674
  } catch (err) {
675
- throw new (0, _chunkMWBT7MCEcjs.ConfirmationTimeoutError)(
675
+ throw new (0, _chunkDCOUJZPLcjs.ConfirmationTimeoutError)(
676
676
  `Solana payment ${ref} could not be confirmed (RPC read failed).`,
677
677
  { cause: err }
678
678
  );
679
679
  }
680
680
  if (!info || info.err || info.confirmationStatus !== "confirmed" && info.confirmationStatus !== "finalized") {
681
- throw new (0, _chunkMWBT7MCEcjs.ConfirmationTimeoutError)(`Solana payment ${ref} did not confirm in time.`);
681
+ throw new (0, _chunkDCOUJZPLcjs.ConfirmationTimeoutError)(`Solana payment ${ref} did not confirm in time.`);
682
682
  }
683
683
  return { height: String(info.slot) };
684
684
  },
685
685
  async estimateCost(accept) {
686
686
  if (accept.scheme === "exact") {
687
- return _chunkMWBT7MCEcjs.nativeCost.call(void 0, {
687
+ return _chunkDCOUJZPLcjs.nativeCost.call(void 0, {
688
688
  symbol: "SOL",
689
689
  decimals: SOL_DECIMALS,
690
690
  fee: 0n,
@@ -694,7 +694,7 @@ function makeSolanaNetwork(preset, rpcUrl) {
694
694
  }
695
695
  const base = 5000n;
696
696
  if (accept.asset === "native") {
697
- return _chunkMWBT7MCEcjs.nativeCost.call(void 0, {
697
+ return _chunkDCOUJZPLcjs.nativeCost.call(void 0, {
698
698
  symbol: "SOL",
699
699
  decimals: SOL_DECIMALS,
700
700
  fee: base,
@@ -703,7 +703,7 @@ function makeSolanaNetwork(preset, rpcUrl) {
703
703
  });
704
704
  }
705
705
  const ataRent = 2039280n;
706
- return _chunkMWBT7MCEcjs.nativeCost.call(void 0, {
706
+ return _chunkDCOUJZPLcjs.nativeCost.call(void 0, {
707
707
  symbol: "SOL",
708
708
  decimals: SOL_DECIMALS,
709
709
  fee: base + ataRent,
@@ -8,7 +8,7 @@ import {
8
8
  nativeCost,
9
9
  rejectForeignToken,
10
10
  toInsufficientFundsError
11
- } from "./chunk-SC2ZYDHD.js";
11
+ } from "./chunk-O32N6MFN.js";
12
12
 
13
13
  // src/drivers/solana/index.ts
14
14
  import { Connection, PublicKey as PublicKey3 } from "@solana/web3.js";
@@ -12,7 +12,7 @@ import {
12
12
  parseUnits,
13
13
  rejectForeignToken,
14
14
  toInsufficientFundsError
15
- } from "./chunk-SC2ZYDHD.js";
15
+ } from "./chunk-O32N6MFN.js";
16
16
 
17
17
  // src/drivers/stellar/index.ts
18
18
  import { Horizon, StrKey as StrKey2 } from "@stellar/stellar-sdk";
@@ -12,7 +12,7 @@ var _chunkCQREG5LEcjs = require('./chunk-CQREG5LE.cjs');
12
12
 
13
13
 
14
14
 
15
- var _chunkMWBT7MCEcjs = require('./chunk-MWBT7MCE.cjs');
15
+ var _chunkDCOUJZPLcjs = require('./chunk-DCOUJZPL.cjs');
16
16
 
17
17
  // src/drivers/stellar/index.ts
18
18
  var _stellarsdk = require('@stellar/stellar-sdk');
@@ -98,30 +98,30 @@ function mapSubmitError(err) {
98
98
  const seen = codes.join(", ");
99
99
  const has = (re) => codes.some((c) => re.test(c));
100
100
  if (has(/op_no_destination/i)) {
101
- return new (0, _chunkMWBT7MCEcjs.RecipientNotReadyError)(
101
+ return new (0, _chunkDCOUJZPLcjs.RecipientNotReadyError)(
102
102
  `Stellar destination account doesn't exist yet \u2014 create it with \u22651 XLM (the base reserve) before it can receive. (Stellar: ${seen})`,
103
103
  { cause: err }
104
104
  );
105
105
  }
106
106
  if (has(/op_(no_trust|line_full|not_authorized)/i) && !has(/src_no_trust/i)) {
107
- return new (0, _chunkMWBT7MCEcjs.RecipientNotReadyError)(
107
+ return new (0, _chunkDCOUJZPLcjs.RecipientNotReadyError)(
108
108
  `Stellar destination can't hold this asset \u2014 it needs a trustline for it (and to be authorized) before it can receive. (Stellar: ${seen})`,
109
109
  { cause: err }
110
110
  );
111
111
  }
112
112
  if (has(/underfunded|insufficient|low_reserve|src_no_trust/i)) {
113
- return new (0, _chunkMWBT7MCEcjs.InsufficientFundsError)(
113
+ return new (0, _chunkDCOUJZPLcjs.InsufficientFundsError)(
114
114
  `Stellar payment failed: the sender can't cover it \u2014 balance, base reserve, or no trustline to send this asset. (Stellar: ${seen})`,
115
115
  { cause: err }
116
116
  );
117
117
  }
118
118
  if (isAccountNotFound(err)) {
119
- return new (0, _chunkMWBT7MCEcjs.InsufficientFundsError)(
119
+ return new (0, _chunkDCOUJZPLcjs.InsufficientFundsError)(
120
120
  "Stellar source account not found on-chain \u2014 fund the sender (\u2265 base reserve) before it can pay.",
121
121
  { cause: err }
122
122
  );
123
123
  }
124
- return _nullishCoalesce(_chunkMWBT7MCEcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
124
+ return _nullishCoalesce(_chunkDCOUJZPLcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
125
125
  }
126
126
  function isAccountNotFound(err) {
127
127
  const e = err;
@@ -218,7 +218,7 @@ function assetMatches(p, want) {
218
218
  }
219
219
  function parseAmount(amount, decimals) {
220
220
  try {
221
- return _chunkMWBT7MCEcjs.parseUnits.call(void 0, amount, decimals);
221
+ return _chunkDCOUJZPLcjs.parseUnits.call(void 0, amount, decimals);
222
222
  } catch (e4) {
223
223
  return 0n;
224
224
  }
@@ -242,13 +242,13 @@ function rpcFailed(nonce) {
242
242
 
243
243
  function assertStellarWallet(wallet, network) {
244
244
  if (typeof wallet !== "object" || wallet === null) {
245
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
245
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
246
246
  `chain ${network} is Stellar; wallet must be { key } (S\u2026 seed) or { keypair }.`
247
247
  );
248
248
  }
249
- _chunkMWBT7MCEcjs.assertNoLegacyWalletKey.call(void 0, wallet, "Stellar");
249
+ _chunkDCOUJZPLcjs.assertNoLegacyWalletKey.call(void 0, wallet, "Stellar");
250
250
  if (!("key" in wallet) && !("keypair" in wallet)) {
251
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
251
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
252
252
  `chain ${network} is Stellar; wallet must be { key } (S\u2026 seed) or { keypair }.`
253
253
  );
254
254
  }
@@ -258,11 +258,11 @@ function resolveStellarWallet(config) {
258
258
  if (config.keypair) return config.keypair;
259
259
  if (config.key) {
260
260
  if (!_stellarsdk.StrKey.isValidEd25519SecretSeed(config.key)) {
261
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)("Stellar wallet { key } is not a valid S\u2026 secret seed.");
261
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)("Stellar wallet { key } is not a valid S\u2026 secret seed.");
262
262
  }
263
263
  return _stellarsdk.Keypair.fromSecret(config.key);
264
264
  }
265
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)("Stellar wallet needs { key } (S\u2026 seed) or { keypair }.");
265
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)("Stellar wallet needs { key } (S\u2026 seed) or { keypair }.");
266
266
  }
267
267
 
268
268
  // src/drivers/stellar/index.ts
@@ -317,7 +317,7 @@ function makeStellarNetwork(preset, rpcUrl) {
317
317
  const info = preset.tokens[token.toUpperCase()];
318
318
  if (!info) {
319
319
  const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
320
- throw new (0, _chunkMWBT7MCEcjs.UnknownTokenError)(
320
+ throw new (0, _chunkDCOUJZPLcjs.UnknownTokenError)(
321
321
  `token "${token}" isn't built in for Stellar (known: ${known}). Pass { issuer, code, decimals } for a custom asset, or use 'native'.`
322
322
  );
323
323
  }
@@ -327,10 +327,10 @@ function makeStellarNetwork(preset, rpcUrl) {
327
327
  symbol: info.symbol
328
328
  };
329
329
  }
330
- _chunkMWBT7MCEcjs.rejectForeignToken.call(void 0, token, "stellar", network);
330
+ _chunkDCOUJZPLcjs.rejectForeignToken.call(void 0, token, "stellar", network);
331
331
  const t = token;
332
332
  if (!t.issuer || !t.code || typeof t.decimals !== "number") {
333
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
333
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
334
334
  `chain ${network} is Stellar; a custom token must be { issuer, code, decimals }.`
335
335
  );
336
336
  }
@@ -351,12 +351,12 @@ function makeStellarNetwork(preset, rpcUrl) {
351
351
  },
352
352
  assertValidPayTo(payTo) {
353
353
  if (payTo.startsWith("0x")) {
354
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
354
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
355
355
  `chain ${network} is Stellar, but payTo "${payTo}" looks like an EVM address.`
356
356
  );
357
357
  }
358
358
  if (!_stellarsdk.StrKey.isValidEd25519PublicKey(payTo)) {
359
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
359
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
360
360
  `chain ${network} is Stellar, but payTo "${payTo}" is not a valid Stellar account (G\u2026).`
361
361
  );
362
362
  }
@@ -377,10 +377,10 @@ function makeStellarNetwork(preset, rpcUrl) {
377
377
  await _chunkCQREG5LEcjs.delay.call(void 0, 1500);
378
378
  }
379
379
  }
380
- throw new (0, _chunkMWBT7MCEcjs.ConfirmationTimeoutError)(`Stellar tx ${ref} not visible on Horizon in time.`);
380
+ throw new (0, _chunkDCOUJZPLcjs.ConfirmationTimeoutError)(`Stellar tx ${ref} not visible on Horizon in time.`);
381
381
  },
382
382
  async estimateCost() {
383
- return _chunkMWBT7MCEcjs.nativeCost.call(void 0, {
383
+ return _chunkDCOUJZPLcjs.nativeCost.call(void 0, {
384
384
  symbol: XLM_SYMBOL,
385
385
  decimals: STELLAR_DECIMALS,
386
386
  fee: 100n,
@@ -404,7 +404,7 @@ function makeStellarNetwork(preset, rpcUrl) {
404
404
  }
405
405
  const toBase = (s) => {
406
406
  try {
407
- return s != null ? _chunkMWBT7MCEcjs.parseUnits.call(void 0, s, STELLAR_DECIMALS) : 0n;
407
+ return s != null ? _chunkDCOUJZPLcjs.parseUnits.call(void 0, s, STELLAR_DECIMALS) : 0n;
408
408
  } catch (e7) {
409
409
  return 0n;
410
410
  }
@@ -7,7 +7,7 @@ import {
7
7
  nativeCost,
8
8
  rejectForeignToken,
9
9
  toInsufficientFundsError
10
- } from "./chunk-SC2ZYDHD.js";
10
+ } from "./chunk-O32N6MFN.js";
11
11
 
12
12
  // src/drivers/sui/index.ts
13
13
  import { SuiJsonRpcClient } from "@mysten/sui/jsonRpc";
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
 
10
- var _chunkMWBT7MCEcjs = require('./chunk-MWBT7MCE.cjs');
10
+ var _chunkDCOUJZPLcjs = require('./chunk-DCOUJZPL.cjs');
11
11
 
12
12
  // src/drivers/sui/index.ts
13
13
  var _jsonRpc = require('@mysten/sui/jsonRpc');
@@ -57,7 +57,7 @@ async function paySui(params) {
57
57
  cursor = page.hasNextPage ? page.nextCursor : null;
58
58
  } while (gathered < amount && cursor);
59
59
  if (!ids.length) {
60
- throw new (0, _chunkMWBT7MCEcjs.InsufficientFundsError)(
60
+ throw new (0, _chunkDCOUJZPLcjs.InsufficientFundsError)(
61
61
  `Sui wallet holds no ${accept.asset} coin objects to pay from.`
62
62
  );
63
63
  }
@@ -75,14 +75,14 @@ async function paySui(params) {
75
75
  });
76
76
  return res.digest;
77
77
  } catch (err) {
78
- if (err instanceof _chunkMWBT7MCEcjs.InsufficientFundsError) throw err;
78
+ if (err instanceof _chunkDCOUJZPLcjs.InsufficientFundsError) throw err;
79
79
  if (isSuiAffordability(err)) {
80
- throw new (0, _chunkMWBT7MCEcjs.InsufficientFundsError)(
80
+ throw new (0, _chunkDCOUJZPLcjs.InsufficientFundsError)(
81
81
  err instanceof Error ? err.message : "Insufficient SUI/coin balance for the payment.",
82
82
  { cause: err }
83
83
  );
84
84
  }
85
- throw _nullishCoalesce(_chunkMWBT7MCEcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
85
+ throw _nullishCoalesce(_chunkDCOUJZPLcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
86
86
  }
87
87
  }
88
88
  function isSuiAffordability(err) {
@@ -162,13 +162,13 @@ function txNotFound(digest) {
162
162
  var _ed25519 = require('@mysten/sui/keypairs/ed25519');
163
163
  function assertSuiWallet(wallet, network) {
164
164
  if (typeof wallet !== "object" || wallet === null) {
165
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
165
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
166
166
  `chain ${network} is Sui; wallet must be { key } (suiprivkey1\u2026 ) or { keypair }.`
167
167
  );
168
168
  }
169
- _chunkMWBT7MCEcjs.assertNoLegacyWalletKey.call(void 0, wallet, "Sui");
169
+ _chunkDCOUJZPLcjs.assertNoLegacyWalletKey.call(void 0, wallet, "Sui");
170
170
  if (!("key" in wallet) && !("keypair" in wallet)) {
171
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
171
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
172
172
  `chain ${network} is Sui; wallet must be { key } (suiprivkey1\u2026) or { keypair }.`
173
173
  );
174
174
  }
@@ -180,13 +180,13 @@ function resolveSuiKeypair(config) {
180
180
  try {
181
181
  return _ed25519.Ed25519Keypair.fromSecretKey(config.key);
182
182
  } catch (cause) {
183
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
183
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
184
184
  "Sui wallet { key } is not a valid suiprivkey1\u2026 secret (or 32-byte key).",
185
185
  { cause }
186
186
  );
187
187
  }
188
188
  }
189
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)("Sui wallet needs { key } (suiprivkey1\u2026) or { keypair }.");
189
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)("Sui wallet needs { key } (suiprivkey1\u2026) or { keypair }.");
190
190
  }
191
191
 
192
192
  // src/drivers/sui/index.ts
@@ -238,16 +238,16 @@ function makeSuiNetwork(preset, rpcUrl) {
238
238
  const info = preset.tokens[token.toUpperCase()];
239
239
  if (!info) {
240
240
  const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
241
- throw new (0, _chunkMWBT7MCEcjs.UnknownTokenError)(
241
+ throw new (0, _chunkDCOUJZPLcjs.UnknownTokenError)(
242
242
  `token "${token}" isn't built in for Sui (known: ${known}). Note: no native USDT on Sui. Pass { coinType, decimals } for a custom coin, or use 'native'.`
243
243
  );
244
244
  }
245
245
  return { asset: info.coinType, decimals: info.decimals, symbol: info.symbol };
246
246
  }
247
- _chunkMWBT7MCEcjs.rejectForeignToken.call(void 0, token, "sui", network);
247
+ _chunkDCOUJZPLcjs.rejectForeignToken.call(void 0, token, "sui", network);
248
248
  const t = token;
249
249
  if (!t.coinType || typeof t.decimals !== "number") {
250
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
250
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
251
251
  `chain ${network} is Sui; a custom token must be { coinType, decimals }.`
252
252
  );
253
253
  }
@@ -266,7 +266,7 @@ function makeSuiNetwork(preset, rpcUrl) {
266
266
  },
267
267
  assertValidPayTo(payTo) {
268
268
  if (!_utils.isValidSuiAddress.call(void 0, payTo)) {
269
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
269
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
270
270
  `chain ${network} is Sui, but payTo "${payTo}" is not a valid Sui address (0x + 32 bytes).`
271
271
  );
272
272
  }
@@ -283,11 +283,11 @@ function makeSuiNetwork(preset, rpcUrl) {
283
283
  const tx = await client.waitForTransaction({ digest: ref, options: { showEffects: true } });
284
284
  return { height: String(_nullishCoalesce(tx.checkpoint, () => ( "0"))) };
285
285
  } catch (err) {
286
- throw new (0, _chunkMWBT7MCEcjs.ConfirmationTimeoutError)(`Sui tx ${ref} did not finalize in time.`, { cause: err });
286
+ throw new (0, _chunkDCOUJZPLcjs.ConfirmationTimeoutError)(`Sui tx ${ref} did not finalize in time.`, { cause: err });
287
287
  }
288
288
  },
289
289
  async estimateCost() {
290
- return _chunkMWBT7MCEcjs.nativeCost.call(void 0, {
290
+ return _chunkDCOUJZPLcjs.nativeCost.call(void 0, {
291
291
  symbol: SUI_SYMBOL,
292
292
  decimals: SUI_DECIMALS,
293
293
  fee: 3000000n,
@@ -9,7 +9,7 @@ var _chunkCQREG5LEcjs = require('./chunk-CQREG5LE.cjs');
9
9
 
10
10
 
11
11
 
12
- var _chunkMWBT7MCEcjs = require('./chunk-MWBT7MCE.cjs');
12
+ var _chunkDCOUJZPLcjs = require('./chunk-DCOUJZPL.cjs');
13
13
 
14
14
  // src/drivers/ton/index.ts
15
15
  var _core = require('@ton/core');
@@ -76,7 +76,7 @@ async function waitForSeqno(opened, from, { tries = 30, intervalMs = 2e3 } = {})
76
76
  }
77
77
  if (current > from) return;
78
78
  }
79
- throw new (0, _chunkMWBT7MCEcjs.ConfirmationTimeoutError)(
79
+ throw new (0, _chunkDCOUJZPLcjs.ConfirmationTimeoutError)(
80
80
  `TON wallet seqno did not advance past ${from} \u2014 the payment may not have been accepted.`
81
81
  );
82
82
  }
@@ -204,13 +204,13 @@ var _crypto = require('@ton/crypto');
204
204
 
205
205
  function assertTonWallet(wallet, network) {
206
206
  if (typeof wallet !== "object" || wallet === null) {
207
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
207
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
208
208
  `chain ${network} is TON; wallet must be { key } (24-word mnemonic) or { keyPair }.`
209
209
  );
210
210
  }
211
- _chunkMWBT7MCEcjs.assertNoLegacyWalletKey.call(void 0, wallet, "TON");
211
+ _chunkDCOUJZPLcjs.assertNoLegacyWalletKey.call(void 0, wallet, "TON");
212
212
  if (!("key" in wallet) && !("keyPair" in wallet)) {
213
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
213
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
214
214
  `chain ${network} is TON; wallet must be { key } (24-word mnemonic) or { keyPair }.`
215
215
  );
216
216
  }
@@ -221,13 +221,13 @@ async function resolveTonWallet(config) {
221
221
  let keyPair;
222
222
  if (config.key) {
223
223
  if (typeof config.key !== "string" && !Array.isArray(config.key)) {
224
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
224
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
225
225
  "chain is TON; the wallet { key } must be a 24-word mnemonic (a string or string[])."
226
226
  );
227
227
  }
228
228
  const words = Array.isArray(config.key) ? config.key : config.key.trim().split(/\s+/);
229
229
  if (!await _crypto.mnemonicValidate.call(void 0, words)) {
230
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
230
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
231
231
  "chain is TON; the wallet { key } is not a valid TON mnemonic (expected 24 words from the TON/BIP-39 wordlist)."
232
232
  );
233
233
  }
@@ -235,7 +235,7 @@ async function resolveTonWallet(config) {
235
235
  } else if (config.keyPair) {
236
236
  keyPair = config.keyPair;
237
237
  } else {
238
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)("TON wallet needs { key } (24-word mnemonic) or { keyPair }.");
238
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)("TON wallet needs { key } (24-word mnemonic) or { keyPair }.");
239
239
  }
240
240
  const contract = version === "v5r1" ? _ton.WalletContractV5R1.create({ workchain: 0, publicKey: keyPair.publicKey }) : _ton.WalletContractV4.create({ workchain: 0, publicKey: keyPair.publicKey });
241
241
  return { keyPair, contract };
@@ -281,15 +281,15 @@ function makeTonNetwork(preset, rpcUrl) {
281
281
  const info = preset.tokens[token.toUpperCase()];
282
282
  if (!info) {
283
283
  const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
284
- throw new (0, _chunkMWBT7MCEcjs.UnknownTokenError)(
284
+ throw new (0, _chunkDCOUJZPLcjs.UnknownTokenError)(
285
285
  `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'.`
286
286
  );
287
287
  }
288
288
  return { asset: info.master, decimals: info.decimals, symbol: info.symbol };
289
289
  }
290
- _chunkMWBT7MCEcjs.rejectForeignToken.call(void 0, token, "ton", network);
290
+ _chunkDCOUJZPLcjs.rejectForeignToken.call(void 0, token, "ton", network);
291
291
  if (!("master" in token)) {
292
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
292
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
293
293
  `chain ${network} is TON; a custom token must be { master, decimals }.`
294
294
  );
295
295
  }
@@ -308,14 +308,14 @@ function makeTonNetwork(preset, rpcUrl) {
308
308
  },
309
309
  assertValidPayTo(payTo) {
310
310
  if (payTo.startsWith("0x")) {
311
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
311
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
312
312
  `chain ${network} is TON, but payTo "${payTo}" looks like an EVM address.`
313
313
  );
314
314
  }
315
315
  try {
316
316
  _core.Address.parse(payTo);
317
317
  } catch (e6) {
318
- throw new (0, _chunkMWBT7MCEcjs.WrongFamilyError)(
318
+ throw new (0, _chunkDCOUJZPLcjs.WrongFamilyError)(
319
319
  `chain ${network} is TON, but payTo "${payTo}" is not a valid TON address.`
320
320
  );
321
321
  }
@@ -331,7 +331,7 @@ function makeTonNetwork(preset, rpcUrl) {
331
331
  const watch = await watchAccountFor(accept);
332
332
  return encodeRef(watch, accept.extra.nonce);
333
333
  } catch (err) {
334
- throw _nullishCoalesce(_chunkMWBT7MCEcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
334
+ throw _nullishCoalesce(_chunkDCOUJZPLcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
335
335
  }
336
336
  },
337
337
  async confirm(ref) {
@@ -350,12 +350,12 @@ function makeTonNetwork(preset, rpcUrl) {
350
350
  if (inc && inc.comment === nonce) return { height: tx.lt.toString() };
351
351
  }
352
352
  }
353
- throw new (0, _chunkMWBT7MCEcjs.ConfirmationTimeoutError)(`TON payment for nonce ${nonce} did not settle in time.`);
353
+ throw new (0, _chunkDCOUJZPLcjs.ConfirmationTimeoutError)(`TON payment for nonce ${nonce} did not settle in time.`);
354
354
  },
355
355
  async estimateCost(accept) {
356
356
  const fee = accept.asset === "native" ? 10000000n : 50000000n;
357
357
  const detail = accept.asset === "native" ? `~0.01 ${TON_NATIVE_SYMBOL} network fee` : `~0.05 ${TON_NATIVE_SYMBOL} attached for the jetton transfer (leftover refunded)`;
358
- return _chunkMWBT7MCEcjs.nativeCost.call(void 0, { symbol: TON_NATIVE_SYMBOL, decimals: TON_DECIMALS, fee, basis: "heuristic", detail });
358
+ return _chunkDCOUJZPLcjs.nativeCost.call(void 0, { symbol: TON_NATIVE_SYMBOL, decimals: TON_DECIMALS, fee, basis: "heuristic", detail });
359
359
  },
360
360
  async balanceOf(wallet, asset) {
361
361
  let owner;
@@ -9,7 +9,7 @@ import {
9
9
  nativeCost,
10
10
  rejectForeignToken,
11
11
  toInsufficientFundsError
12
- } from "./chunk-SC2ZYDHD.js";
12
+ } from "./chunk-O32N6MFN.js";
13
13
 
14
14
  // src/drivers/ton/index.ts
15
15
  import { Address as Address2 } from "@ton/core";
@@ -10,7 +10,7 @@ import {
10
10
  nativeCost,
11
11
  rejectForeignToken,
12
12
  toInsufficientFundsError
13
- } from "./chunk-SC2ZYDHD.js";
13
+ } from "./chunk-O32N6MFN.js";
14
14
 
15
15
  // src/drivers/tron/index.ts
16
16
  import { TronWeb } from "tronweb";