@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
@@ -8,7 +8,7 @@ import {
8
8
  nativeCost,
9
9
  rejectForeignToken,
10
10
  toInsufficientFundsError
11
- } from "./chunk-3ZWM3DKM.js";
11
+ } from "./chunk-QU25LSVS.js";
12
12
 
13
13
  // src/drivers/solana/index.ts
14
14
  import { Connection, PublicKey as PublicKey3 } from "@solana/web3.js";
@@ -229,7 +229,17 @@ var MAX_COMPUTE_UNIT_PRICE_MICROLAMPORTS = 100000n;
229
229
  var CB_SET_UNIT_LIMIT = 2;
230
230
  var CB_SET_UNIT_PRICE = 3;
231
231
  function tokenProgramFor(accept) {
232
- return accept.extra.tokenProgram === "token-2022" ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID;
232
+ return accept.extra?.tokenProgram === "token-2022" ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID;
233
+ }
234
+ async function readMintDecimals(connection, mint) {
235
+ try {
236
+ const info = await connection.getAccountInfo(mint);
237
+ const data = info?.data;
238
+ if (!data || data.length < 45) return void 0;
239
+ return data[44];
240
+ } catch {
241
+ return void 0;
242
+ }
233
243
  }
234
244
  function isEmptySig(sig) {
235
245
  return !sig || sig.every((b) => b === 0);
@@ -246,7 +256,7 @@ function memoRandomNonce() {
246
256
  return Buffer.from([...raw].map((b) => b.toString(16).padStart(2, "0")).join(""), "utf8");
247
257
  }
248
258
  function memoDataFor(accept) {
249
- if (accept.extra.memo !== void 0) {
259
+ if (accept.extra?.memo !== void 0) {
250
260
  const bytes = Buffer.from(accept.extra.memo, "utf8");
251
261
  if (bytes.length > MAX_MEMO_BYTES) {
252
262
  throw new UnsupportedSchemeError(
@@ -267,17 +277,15 @@ async function payExactSolana(input) {
267
277
  "SVM exact is SPL-token only (TransferChecked); native SOL is not exact-payable. Pay via onchain-proof."
268
278
  );
269
279
  }
270
- if (!accept.extra.feePayer) {
280
+ const extra = accept.extra ?? {};
281
+ if (!extra.feePayer) {
271
282
  throw new UnsupportedSchemeError("SVM exact rail must advertise extra.feePayer (the merchant sponsor key).");
272
283
  }
273
- if (accept.extra.decimals === void 0) {
274
- throw new UnsupportedSchemeError("SVM exact rail must advertise extra.decimals for the TransferChecked.");
275
- }
276
284
  let feePayer;
277
285
  let mint;
278
286
  let payTo;
279
287
  try {
280
- feePayer = new PublicKey2(accept.extra.feePayer);
288
+ feePayer = new PublicKey2(extra.feePayer);
281
289
  mint = new PublicKey2(accept.asset);
282
290
  payTo = new PublicKey2(accept.payTo);
283
291
  } catch (err) {
@@ -285,6 +293,18 @@ async function payExactSolana(input) {
285
293
  `SVM exact: bad feePayer/asset/payTo (${err instanceof Error ? err.message : String(err)}).`
286
294
  );
287
295
  }
296
+ const onChainDecimals = await readMintDecimals(connection, mint);
297
+ const decimals = onChainDecimals ?? extra.decimals;
298
+ if (decimals === void 0) {
299
+ throw new UnsupportedSchemeError(
300
+ `SVM exact: couldn't read the decimals of mint ${accept.asset} on-chain, and the rail states none. Retry with a reliable rpcUrl \u2014 TransferChecked cannot be built without them.`
301
+ );
302
+ }
303
+ if (onChainDecimals !== void 0 && extra.decimals !== void 0 && extra.decimals !== onChainDecimals) {
304
+ throw new UnsupportedSchemeError(
305
+ `SVM exact: the rail states ${extra.decimals} decimals for ${accept.asset} but the mint says ${onChainDecimals} \u2014 refusing to sign (a mismatch this size misprices the transfer).`
306
+ );
307
+ }
288
308
  if (feePayer.equals(payTo)) {
289
309
  throw new UnsupportedSchemeError(
290
310
  "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."
@@ -314,7 +334,8 @@ async function payExactSolana(input) {
314
334
  dest,
315
335
  keypair.publicKey,
316
336
  BigInt(accept.amount),
317
- accept.extra.decimals,
337
+ decimals,
338
+ // read from the MINT (see above), not from the server's `extra`
318
339
  [],
319
340
  program
320
341
  ),
@@ -359,7 +380,7 @@ async function verifyAndSettleExactSolana(input) {
359
380
  try {
360
381
  payTo = new PublicKey2(accept.payTo);
361
382
  mint = new PublicKey2(accept.asset);
362
- if (!accept.extra.feePayer) throw new Error("rail is missing extra.feePayer");
383
+ if (!accept.extra?.feePayer) throw new Error("rail is missing extra.feePayer");
363
384
  railFeePayer = new PublicKey2(accept.extra.feePayer);
364
385
  } catch (err) {
365
386
  throw new SettlementError(`SVM exact: rail has a bad payTo/asset/feePayer (${err instanceof Error ? err.message : String(err)}).`);
@@ -467,7 +488,7 @@ async function verifyAndSettleExactSolana(input) {
467
488
  if (!decoded.keys.destination.pubkey.equals(expectedDest)) {
468
489
  return fail("wrong_recipient", `A transfer pays ${decoded.keys.destination.pubkey.toBase58()}, not payTo's ATA ${expectedDest.toBase58()}.`);
469
490
  }
470
- if (decoded.data.decimals !== accept.extra.decimals) {
491
+ if (accept.extra?.decimals !== void 0 && decoded.data.decimals !== accept.extra.decimals) {
471
492
  return fail("transfer_not_found", `Transfer decimals ${decoded.data.decimals} \u2260 rail decimals ${accept.extra.decimals}.`);
472
493
  }
473
494
  sawTransferToPayTo = true;
@@ -12,7 +12,7 @@ var _chunkCQREG5LEcjs = require('./chunk-CQREG5LE.cjs');
12
12
 
13
13
 
14
14
 
15
- var _chunk3FR22M3Ocjs = require('./chunk-3FR22M3O.cjs');
15
+ var _chunkQONQSZHJcjs = require('./chunk-QONQSZHJ.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, _chunk3FR22M3Ocjs.RecipientNotReadyError)(
101
+ return new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.RecipientNotReadyError)(
107
+ return new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.InsufficientFundsError)(
113
+ return new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.InsufficientFundsError)(
119
+ return new (0, _chunkQONQSZHJcjs.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(_chunk3FR22M3Ocjs.toInsufficientFundsError.call(void 0, err), () => ( err));
124
+ return _nullishCoalesce(_chunkQONQSZHJcjs.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 _chunk3FR22M3Ocjs.parseUnits.call(void 0, amount, decimals);
221
+ return _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.WrongFamilyError)(
245
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
246
246
  `chain ${network} is Stellar; wallet must be { key } (S\u2026 seed) or { keypair }.`
247
247
  );
248
248
  }
249
- _chunk3FR22M3Ocjs.assertNoLegacyWalletKey.call(void 0, wallet, "Stellar");
249
+ _chunkQONQSZHJcjs.assertNoLegacyWalletKey.call(void 0, wallet, "Stellar");
250
250
  if (!("key" in wallet) && !("keypair" in wallet)) {
251
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
251
+ throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.WrongFamilyError)("Stellar wallet { key } is not a valid S\u2026 secret seed.");
261
+ throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.WrongFamilyError)("Stellar wallet needs { key } (S\u2026 seed) or { keypair }.");
265
+ throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.UnknownTokenError)(
320
+ throw new (0, _chunkQONQSZHJcjs.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
- _chunk3FR22M3Ocjs.rejectForeignToken.call(void 0, token, "stellar", network);
330
+ _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.WrongFamilyError)(
333
+ throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.WrongFamilyError)(
354
+ throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.WrongFamilyError)(
359
+ throw new (0, _chunkQONQSZHJcjs.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, _chunk3FR22M3Ocjs.ConfirmationTimeoutError)(`Stellar tx ${ref} not visible on Horizon in time.`);
380
+ throw new (0, _chunkQONQSZHJcjs.ConfirmationTimeoutError)(`Stellar tx ${ref} not visible on Horizon in time.`);
381
381
  },
382
382
  async estimateCost() {
383
- return _chunk3FR22M3Ocjs.nativeCost.call(void 0, {
383
+ return _chunkQONQSZHJcjs.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 ? _chunk3FR22M3Ocjs.parseUnits.call(void 0, s, STELLAR_DECIMALS) : 0n;
407
+ return s != null ? _chunkQONQSZHJcjs.parseUnits.call(void 0, s, STELLAR_DECIMALS) : 0n;
408
408
  } catch (e7) {
409
409
  return 0n;
410
410
  }
@@ -12,7 +12,7 @@ import {
12
12
  parseUnits,
13
13
  rejectForeignToken,
14
14
  toInsufficientFundsError
15
- } from "./chunk-3ZWM3DKM.js";
15
+ } from "./chunk-QU25LSVS.js";
16
16
 
17
17
  // src/drivers/stellar/index.ts
18
18
  import { Horizon, StrKey as StrKey2 } from "@stellar/stellar-sdk";
@@ -7,7 +7,7 @@ import {
7
7
  nativeCost,
8
8
  rejectForeignToken,
9
9
  toInsufficientFundsError
10
- } from "./chunk-3ZWM3DKM.js";
10
+ } from "./chunk-QU25LSVS.js";
11
11
 
12
12
  // src/drivers/sui/index.ts
13
13
  import { SuiJsonRpcClient } from "@mysten/sui/jsonRpc";
@@ -19,7 +19,11 @@ var SUI_SYMBOL = "SUI";
19
19
  var SUI_NATIVE_COINTYPE = "0x2::sui::SUI";
20
20
  var SUI_MAINNET = {
21
21
  caip2: "sui:mainnet",
22
- defaultRpc: "https://fullnode.mainnet.sui.io:443",
22
+ // Third-party JSON-RPC (the official fullnode no longer serves it — see SuiPreset.defaultRpc).
23
+ // publicnode verified 2026-08-28 for suix_getBalance / suix_getCoinMetadata /
24
+ // suix_getOwnedObjects / sui_getTransactionBlock. Alternates that also passed, if this one
25
+ // degrades: https://rpc-mainnet.suiscan.xyz · https://mainnet.suiet.app
26
+ defaultRpc: "https://sui-rpc.publicnode.com",
23
27
  tokens: {
24
28
  // Circle USDC — coin type + 6 decimals verified live on mainnet
25
29
  // (suix_getCoinMetadata) before shipping. No native USDT on Sui.
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
 
10
- var _chunk3FR22M3Ocjs = require('./chunk-3FR22M3O.cjs');
10
+ var _chunkQONQSZHJcjs = require('./chunk-QONQSZHJ.cjs');
11
11
 
12
12
  // src/drivers/sui/index.ts
13
13
  var _jsonRpc = require('@mysten/sui/jsonRpc');
@@ -19,7 +19,11 @@ var SUI_SYMBOL = "SUI";
19
19
  var SUI_NATIVE_COINTYPE = "0x2::sui::SUI";
20
20
  var SUI_MAINNET = {
21
21
  caip2: "sui:mainnet",
22
- defaultRpc: "https://fullnode.mainnet.sui.io:443",
22
+ // Third-party JSON-RPC (the official fullnode no longer serves it — see SuiPreset.defaultRpc).
23
+ // publicnode verified 2026-08-28 for suix_getBalance / suix_getCoinMetadata /
24
+ // suix_getOwnedObjects / sui_getTransactionBlock. Alternates that also passed, if this one
25
+ // degrades: https://rpc-mainnet.suiscan.xyz · https://mainnet.suiet.app
26
+ defaultRpc: "https://sui-rpc.publicnode.com",
23
27
  tokens: {
24
28
  // Circle USDC — coin type + 6 decimals verified live on mainnet
25
29
  // (suix_getCoinMetadata) before shipping. No native USDT on Sui.
@@ -57,7 +61,7 @@ async function paySui(params) {
57
61
  cursor = page.hasNextPage ? page.nextCursor : null;
58
62
  } while (gathered < amount && cursor);
59
63
  if (!ids.length) {
60
- throw new (0, _chunk3FR22M3Ocjs.InsufficientFundsError)(
64
+ throw new (0, _chunkQONQSZHJcjs.InsufficientFundsError)(
61
65
  `Sui wallet holds no ${accept.asset} coin objects to pay from.`
62
66
  );
63
67
  }
@@ -75,14 +79,14 @@ async function paySui(params) {
75
79
  });
76
80
  return res.digest;
77
81
  } catch (err) {
78
- if (err instanceof _chunk3FR22M3Ocjs.InsufficientFundsError) throw err;
82
+ if (err instanceof _chunkQONQSZHJcjs.InsufficientFundsError) throw err;
79
83
  if (isSuiAffordability(err)) {
80
- throw new (0, _chunk3FR22M3Ocjs.InsufficientFundsError)(
84
+ throw new (0, _chunkQONQSZHJcjs.InsufficientFundsError)(
81
85
  err instanceof Error ? err.message : "Insufficient SUI/coin balance for the payment.",
82
86
  { cause: err }
83
87
  );
84
88
  }
85
- throw _nullishCoalesce(_chunk3FR22M3Ocjs.toInsufficientFundsError.call(void 0, err), () => ( err));
89
+ throw _nullishCoalesce(_chunkQONQSZHJcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
86
90
  }
87
91
  }
88
92
  function isSuiAffordability(err) {
@@ -170,13 +174,13 @@ function normalizeSuiAddress(value) {
170
174
  var _ed25519 = require('@mysten/sui/keypairs/ed25519');
171
175
  function assertSuiWallet(wallet, network) {
172
176
  if (typeof wallet !== "object" || wallet === null) {
173
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
177
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
174
178
  `chain ${network} is Sui; wallet must be { key } (suiprivkey1\u2026 ) or { keypair }.`
175
179
  );
176
180
  }
177
- _chunk3FR22M3Ocjs.assertNoLegacyWalletKey.call(void 0, wallet, "Sui");
181
+ _chunkQONQSZHJcjs.assertNoLegacyWalletKey.call(void 0, wallet, "Sui");
178
182
  if (!("key" in wallet) && !("keypair" in wallet)) {
179
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
183
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
180
184
  `chain ${network} is Sui; wallet must be { key } (suiprivkey1\u2026) or { keypair }.`
181
185
  );
182
186
  }
@@ -188,13 +192,13 @@ function resolveSuiKeypair(config) {
188
192
  try {
189
193
  return _ed25519.Ed25519Keypair.fromSecretKey(config.key);
190
194
  } catch (cause) {
191
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
195
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
192
196
  "Sui wallet { key } is not a valid suiprivkey1\u2026 secret (or 32-byte key).",
193
197
  { cause }
194
198
  );
195
199
  }
196
200
  }
197
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)("Sui wallet needs { key } (suiprivkey1\u2026) or { keypair }.");
201
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)("Sui wallet needs { key } (suiprivkey1\u2026) or { keypair }.");
198
202
  }
199
203
 
200
204
  // src/drivers/sui/index.ts
@@ -246,16 +250,16 @@ function makeSuiNetwork(preset, rpcUrl) {
246
250
  const info = preset.tokens[token.toUpperCase()];
247
251
  if (!info) {
248
252
  const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
249
- throw new (0, _chunk3FR22M3Ocjs.UnknownTokenError)(
253
+ throw new (0, _chunkQONQSZHJcjs.UnknownTokenError)(
250
254
  `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'.`
251
255
  );
252
256
  }
253
257
  return { asset: info.coinType, decimals: info.decimals, symbol: info.symbol };
254
258
  }
255
- _chunk3FR22M3Ocjs.rejectForeignToken.call(void 0, token, "sui", network);
259
+ _chunkQONQSZHJcjs.rejectForeignToken.call(void 0, token, "sui", network);
256
260
  const t = token;
257
261
  if (!t.coinType || typeof t.decimals !== "number") {
258
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
262
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
259
263
  `chain ${network} is Sui; a custom token must be { coinType, decimals }.`
260
264
  );
261
265
  }
@@ -274,7 +278,7 @@ function makeSuiNetwork(preset, rpcUrl) {
274
278
  },
275
279
  assertValidPayTo(payTo) {
276
280
  if (!_utils.isValidSuiAddress.call(void 0, payTo)) {
277
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
281
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
278
282
  `chain ${network} is Sui, but payTo "${payTo}" is not a valid Sui address (0x + 32 bytes).`
279
283
  );
280
284
  }
@@ -291,11 +295,11 @@ function makeSuiNetwork(preset, rpcUrl) {
291
295
  const tx = await client.waitForTransaction({ digest: ref, options: { showEffects: true } });
292
296
  return { height: String(_nullishCoalesce(tx.checkpoint, () => ( "0"))) };
293
297
  } catch (err) {
294
- throw new (0, _chunk3FR22M3Ocjs.ConfirmationTimeoutError)(`Sui tx ${ref} did not finalize in time.`, { cause: err });
298
+ throw new (0, _chunkQONQSZHJcjs.ConfirmationTimeoutError)(`Sui tx ${ref} did not finalize in time.`, { cause: err });
295
299
  }
296
300
  },
297
301
  async estimateCost() {
298
- return _chunk3FR22M3Ocjs.nativeCost.call(void 0, {
302
+ return _chunkQONQSZHJcjs.nativeCost.call(void 0, {
299
303
  symbol: SUI_SYMBOL,
300
304
  decimals: SUI_DECIMALS,
301
305
  fee: 3000000n,
@@ -9,7 +9,7 @@ var _chunkCQREG5LEcjs = require('./chunk-CQREG5LE.cjs');
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/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, _chunk3FR22M3Ocjs.ConfirmationTimeoutError)(
79
+ throw new (0, _chunkQONQSZHJcjs.ConfirmationTimeoutError)(
80
80
  `TON wallet seqno did not advance past ${from} \u2014 the payment may not have been accepted.`
81
81
  );
82
82
  }
@@ -207,13 +207,13 @@ var _crypto = require('@ton/crypto');
207
207
 
208
208
  function assertTonWallet(wallet, network) {
209
209
  if (typeof wallet !== "object" || wallet === null) {
210
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
210
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
211
211
  `chain ${network} is TON; wallet must be { key } (24-word mnemonic) or { keyPair }.`
212
212
  );
213
213
  }
214
- _chunk3FR22M3Ocjs.assertNoLegacyWalletKey.call(void 0, wallet, "TON");
214
+ _chunkQONQSZHJcjs.assertNoLegacyWalletKey.call(void 0, wallet, "TON");
215
215
  if (!("key" in wallet) && !("keyPair" in wallet)) {
216
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
216
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
217
217
  `chain ${network} is TON; wallet must be { key } (24-word mnemonic) or { keyPair }.`
218
218
  );
219
219
  }
@@ -224,13 +224,13 @@ async function resolveTonWallet(config) {
224
224
  let keyPair;
225
225
  if (config.key) {
226
226
  if (typeof config.key !== "string" && !Array.isArray(config.key)) {
227
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
227
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
228
228
  "chain is TON; the wallet { key } must be a 24-word mnemonic (a string or string[])."
229
229
  );
230
230
  }
231
231
  const words = Array.isArray(config.key) ? config.key : config.key.trim().split(/\s+/);
232
232
  if (!await _crypto.mnemonicValidate.call(void 0, words)) {
233
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
233
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
234
234
  "chain is TON; the wallet { key } is not a valid TON mnemonic (expected 24 words from the TON/BIP-39 wordlist)."
235
235
  );
236
236
  }
@@ -238,7 +238,7 @@ async function resolveTonWallet(config) {
238
238
  } else if (config.keyPair) {
239
239
  keyPair = config.keyPair;
240
240
  } else {
241
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)("TON wallet needs { key } (24-word mnemonic) or { keyPair }.");
241
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)("TON wallet needs { key } (24-word mnemonic) or { keyPair }.");
242
242
  }
243
243
  const contract = version === "v5r1" ? _ton.WalletContractV5R1.create({ workchain: 0, publicKey: keyPair.publicKey }) : _ton.WalletContractV4.create({ workchain: 0, publicKey: keyPair.publicKey });
244
244
  return { keyPair, contract };
@@ -287,15 +287,15 @@ function makeTonNetwork(preset, rpcUrl) {
287
287
  const info = preset.tokens[token.toUpperCase()];
288
288
  if (!info) {
289
289
  const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
290
- throw new (0, _chunk3FR22M3Ocjs.UnknownTokenError)(
290
+ throw new (0, _chunkQONQSZHJcjs.UnknownTokenError)(
291
291
  `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'.`
292
292
  );
293
293
  }
294
294
  return { asset: info.master, decimals: info.decimals, symbol: info.symbol };
295
295
  }
296
- _chunk3FR22M3Ocjs.rejectForeignToken.call(void 0, token, "ton", network);
296
+ _chunkQONQSZHJcjs.rejectForeignToken.call(void 0, token, "ton", network);
297
297
  if (!("master" in token)) {
298
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
298
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
299
299
  `chain ${network} is TON; a custom token must be { master, decimals }.`
300
300
  );
301
301
  }
@@ -314,14 +314,14 @@ function makeTonNetwork(preset, rpcUrl) {
314
314
  },
315
315
  assertValidPayTo(payTo) {
316
316
  if (payTo.startsWith("0x")) {
317
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
317
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
318
318
  `chain ${network} is TON, but payTo "${payTo}" looks like an EVM address.`
319
319
  );
320
320
  }
321
321
  try {
322
322
  _core.Address.parse(payTo);
323
323
  } catch (e6) {
324
- throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
324
+ throw new (0, _chunkQONQSZHJcjs.WrongFamilyError)(
325
325
  `chain ${network} is TON, but payTo "${payTo}" is not a valid TON address.`
326
326
  );
327
327
  }
@@ -337,7 +337,7 @@ function makeTonNetwork(preset, rpcUrl) {
337
337
  const watch = await watchAccountFor(accept);
338
338
  return encodeRef(watch, accept.extra.nonce);
339
339
  } catch (err) {
340
- throw _nullishCoalesce(_chunk3FR22M3Ocjs.toInsufficientFundsError.call(void 0, err), () => ( err));
340
+ throw _nullishCoalesce(_chunkQONQSZHJcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
341
341
  }
342
342
  },
343
343
  async confirm(ref) {
@@ -356,12 +356,12 @@ function makeTonNetwork(preset, rpcUrl) {
356
356
  if (inc && inc.comment === nonce) return { height: tx.lt.toString() };
357
357
  }
358
358
  }
359
- throw new (0, _chunk3FR22M3Ocjs.ConfirmationTimeoutError)(`TON payment for nonce ${nonce} did not settle in time.`);
359
+ throw new (0, _chunkQONQSZHJcjs.ConfirmationTimeoutError)(`TON payment for nonce ${nonce} did not settle in time.`);
360
360
  },
361
361
  async estimateCost(accept) {
362
362
  const fee = accept.asset === "native" ? 10000000n : 50000000n;
363
363
  const detail = accept.asset === "native" ? `~0.01 ${TON_NATIVE_SYMBOL} network fee` : `~0.05 ${TON_NATIVE_SYMBOL} attached for the jetton transfer (leftover refunded)`;
364
- return _chunk3FR22M3Ocjs.nativeCost.call(void 0, { symbol: TON_NATIVE_SYMBOL, decimals: TON_DECIMALS, fee, basis: "heuristic", detail });
364
+ return _chunkQONQSZHJcjs.nativeCost.call(void 0, { symbol: TON_NATIVE_SYMBOL, decimals: TON_DECIMALS, fee, basis: "heuristic", detail });
365
365
  },
366
366
  async balanceOf(wallet, asset) {
367
367
  let owner;
@@ -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/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-3ZWM3DKM.js";
13
+ } from "./chunk-QU25LSVS.js";
14
14
 
15
15
  // src/drivers/tron/index.ts
16
16
  import { TronWeb } from "tronweb";