@piprail/sdk 1.21.1 → 1.22.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.
@@ -11,7 +11,7 @@ var _chunkCQREG5LEcjs = require('./chunk-CQREG5LE.cjs');
11
11
 
12
12
 
13
13
 
14
- var _chunkPA6YD3HLcjs = require('./chunk-PA6YD3HL.cjs');
14
+ var _chunkU35MG4TFcjs = require('./chunk-U35MG4TF.cjs');
15
15
 
16
16
  // src/drivers/stellar/index.ts
17
17
  var _stellarsdk = require('@stellar/stellar-sdk');
@@ -97,30 +97,30 @@ function mapSubmitError(err) {
97
97
  const seen = codes.join(", ");
98
98
  const has = (re) => codes.some((c) => re.test(c));
99
99
  if (has(/op_no_destination/i)) {
100
- return new (0, _chunkPA6YD3HLcjs.RecipientNotReadyError)(
100
+ return new (0, _chunkU35MG4TFcjs.RecipientNotReadyError)(
101
101
  `Stellar destination account doesn't exist yet \u2014 create it with \u22651 XLM (the base reserve) before it can receive. (Stellar: ${seen})`,
102
102
  { cause: err }
103
103
  );
104
104
  }
105
105
  if (has(/op_(no_trust|line_full|not_authorized)/i) && !has(/src_no_trust/i)) {
106
- return new (0, _chunkPA6YD3HLcjs.RecipientNotReadyError)(
106
+ return new (0, _chunkU35MG4TFcjs.RecipientNotReadyError)(
107
107
  `Stellar destination can't hold this asset \u2014 it needs a trustline for it (and to be authorized) before it can receive. (Stellar: ${seen})`,
108
108
  { cause: err }
109
109
  );
110
110
  }
111
111
  if (has(/underfunded|insufficient|low_reserve|src_no_trust/i)) {
112
- return new (0, _chunkPA6YD3HLcjs.InsufficientFundsError)(
112
+ return new (0, _chunkU35MG4TFcjs.InsufficientFundsError)(
113
113
  `Stellar payment failed: the sender can't cover it \u2014 balance, base reserve, or no trustline to send this asset. (Stellar: ${seen})`,
114
114
  { cause: err }
115
115
  );
116
116
  }
117
117
  if (isAccountNotFound(err)) {
118
- return new (0, _chunkPA6YD3HLcjs.InsufficientFundsError)(
118
+ return new (0, _chunkU35MG4TFcjs.InsufficientFundsError)(
119
119
  "Stellar source account not found on-chain \u2014 fund the sender (\u2265 base reserve) before it can pay.",
120
120
  { cause: err }
121
121
  );
122
122
  }
123
- return _nullishCoalesce(_chunkPA6YD3HLcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
123
+ return _nullishCoalesce(_chunkU35MG4TFcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
124
124
  }
125
125
  function isAccountNotFound(err) {
126
126
  const e = err;
@@ -217,7 +217,7 @@ function assetMatches(p, want) {
217
217
  }
218
218
  function parseAmount(amount, decimals) {
219
219
  try {
220
- return _chunkPA6YD3HLcjs.parseUnits.call(void 0, amount, decimals);
220
+ return _chunkU35MG4TFcjs.parseUnits.call(void 0, amount, decimals);
221
221
  } catch (e4) {
222
222
  return 0n;
223
223
  }
@@ -241,22 +241,22 @@ function rpcFailed(nonce) {
241
241
 
242
242
  function assertStellarWallet(wallet, network) {
243
243
  if (typeof wallet !== "object" || wallet === null) {
244
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
244
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
245
245
  `chain ${network} is Stellar; wallet must be { secret } (S\u2026 seed) or { keypair }.`
246
246
  );
247
247
  }
248
248
  if ("privateKey" in wallet || "walletClient" in wallet) {
249
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
249
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
250
250
  `chain ${network} is Stellar; an EVM wallet can't be used \u2014 pass { secret } (S\u2026 seed) or { keypair }.`
251
251
  );
252
252
  }
253
253
  if ("secretKey" in wallet || "signer" in wallet || "mnemonic" in wallet || "keyPair" in wallet) {
254
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
254
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
255
255
  `chain ${network} is Stellar; that looks like a Solana/TON wallet \u2014 pass { secret } (S\u2026 seed) or { keypair }.`
256
256
  );
257
257
  }
258
258
  if (!("secret" in wallet) && !("keypair" in wallet)) {
259
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
259
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
260
260
  `chain ${network} is Stellar; wallet must be { secret } (S\u2026 seed) or { keypair }.`
261
261
  );
262
262
  }
@@ -266,13 +266,13 @@ function resolveStellarWallet(config) {
266
266
  if (config.keypair) return config.keypair;
267
267
  if (config.secret) {
268
268
  if (!_stellarsdk.StrKey.isValidEd25519SecretSeed(config.secret)) {
269
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
269
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
270
270
  "Stellar wallet { secret } is not a valid S\u2026 secret seed."
271
271
  );
272
272
  }
273
273
  return _stellarsdk.Keypair.fromSecret(config.secret);
274
274
  }
275
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)("Stellar wallet needs { secret } (S\u2026 seed) or { keypair }.");
275
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)("Stellar wallet needs { secret } (S\u2026 seed) or { keypair }.");
276
276
  }
277
277
 
278
278
  // src/drivers/stellar/index.ts
@@ -327,7 +327,7 @@ function makeStellarNetwork(preset, rpcUrl) {
327
327
  const info = preset.tokens[token.toUpperCase()];
328
328
  if (!info) {
329
329
  const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
330
- throw new (0, _chunkPA6YD3HLcjs.UnknownTokenError)(
330
+ throw new (0, _chunkU35MG4TFcjs.UnknownTokenError)(
331
331
  `token "${token}" isn't built in for Stellar (known: ${known}). Pass { issuer, code, decimals } for a custom asset, or use 'native'.`
332
332
  );
333
333
  }
@@ -337,10 +337,10 @@ function makeStellarNetwork(preset, rpcUrl) {
337
337
  symbol: info.symbol
338
338
  };
339
339
  }
340
- _chunkPA6YD3HLcjs.rejectForeignToken.call(void 0, token, "stellar", network);
340
+ _chunkU35MG4TFcjs.rejectForeignToken.call(void 0, token, "stellar", network);
341
341
  const t = token;
342
342
  if (!t.issuer || !t.code || typeof t.decimals !== "number") {
343
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
343
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
344
344
  `chain ${network} is Stellar; a custom token must be { issuer, code, decimals }.`
345
345
  );
346
346
  }
@@ -361,12 +361,12 @@ function makeStellarNetwork(preset, rpcUrl) {
361
361
  },
362
362
  assertValidPayTo(payTo) {
363
363
  if (payTo.startsWith("0x")) {
364
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
364
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
365
365
  `chain ${network} is Stellar, but payTo "${payTo}" looks like an EVM address.`
366
366
  );
367
367
  }
368
368
  if (!_stellarsdk.StrKey.isValidEd25519PublicKey(payTo)) {
369
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
369
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
370
370
  `chain ${network} is Stellar, but payTo "${payTo}" is not a valid Stellar account (G\u2026).`
371
371
  );
372
372
  }
@@ -387,10 +387,10 @@ function makeStellarNetwork(preset, rpcUrl) {
387
387
  await _chunkCQREG5LEcjs.delay.call(void 0, 1500);
388
388
  }
389
389
  }
390
- throw new (0, _chunkPA6YD3HLcjs.ConfirmationTimeoutError)(`Stellar tx ${ref} not visible on Horizon in time.`);
390
+ throw new (0, _chunkU35MG4TFcjs.ConfirmationTimeoutError)(`Stellar tx ${ref} not visible on Horizon in time.`);
391
391
  },
392
392
  async estimateCost() {
393
- return _chunkPA6YD3HLcjs.nativeCost.call(void 0, {
393
+ return _chunkU35MG4TFcjs.nativeCost.call(void 0, {
394
394
  symbol: XLM_SYMBOL,
395
395
  decimals: STELLAR_DECIMALS,
396
396
  fee: 100n,
@@ -414,7 +414,7 @@ function makeStellarNetwork(preset, rpcUrl) {
414
414
  }
415
415
  const toBase = (s) => {
416
416
  try {
417
- return s != null ? _chunkPA6YD3HLcjs.parseUnits.call(void 0, s, STELLAR_DECIMALS) : 0n;
417
+ return s != null ? _chunkU35MG4TFcjs.parseUnits.call(void 0, s, STELLAR_DECIMALS) : 0n;
418
418
  } catch (e7) {
419
419
  return 0n;
420
420
  }
@@ -11,7 +11,7 @@ import {
11
11
  parseUnits,
12
12
  rejectForeignToken,
13
13
  toInsufficientFundsError
14
- } from "./chunk-ILPABTI2.js";
14
+ } from "./chunk-L6WQRHEZ.js";
15
15
 
16
16
  // src/drivers/stellar/index.ts
17
17
  import { Horizon, StrKey as StrKey2 } from "@stellar/stellar-sdk";
@@ -6,7 +6,7 @@ import {
6
6
  nativeCost,
7
7
  rejectForeignToken,
8
8
  toInsufficientFundsError
9
- } from "./chunk-ILPABTI2.js";
9
+ } from "./chunk-L6WQRHEZ.js";
10
10
 
11
11
  // src/drivers/sui/index.ts
12
12
  import { SuiJsonRpcClient } from "@mysten/sui/jsonRpc";
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkPA6YD3HLcjs = require('./chunk-PA6YD3HL.cjs');
9
+ var _chunkU35MG4TFcjs = require('./chunk-U35MG4TF.cjs');
10
10
 
11
11
  // src/drivers/sui/index.ts
12
12
  var _jsonRpc = require('@mysten/sui/jsonRpc');
@@ -45,7 +45,7 @@ async function paySui(params) {
45
45
  } else {
46
46
  const coins = await client.getCoins({ owner: sender, coinType: accept.asset });
47
47
  if (!coins.data.length) {
48
- throw new (0, _chunkPA6YD3HLcjs.InsufficientFundsError)(
48
+ throw new (0, _chunkU35MG4TFcjs.InsufficientFundsError)(
49
49
  `Sui wallet holds no ${accept.asset} coin objects to pay from.`
50
50
  );
51
51
  }
@@ -64,14 +64,14 @@ async function paySui(params) {
64
64
  });
65
65
  return res.digest;
66
66
  } catch (err) {
67
- if (err instanceof _chunkPA6YD3HLcjs.InsufficientFundsError) throw err;
67
+ if (err instanceof _chunkU35MG4TFcjs.InsufficientFundsError) throw err;
68
68
  if (isSuiAffordability(err)) {
69
- throw new (0, _chunkPA6YD3HLcjs.InsufficientFundsError)(
69
+ throw new (0, _chunkU35MG4TFcjs.InsufficientFundsError)(
70
70
  err instanceof Error ? err.message : "Insufficient SUI/coin balance for the payment.",
71
71
  { cause: err }
72
72
  );
73
73
  }
74
- throw _nullishCoalesce(_chunkPA6YD3HLcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
74
+ throw _nullishCoalesce(_chunkU35MG4TFcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
75
75
  }
76
76
  }
77
77
  function isSuiAffordability(err) {
@@ -151,22 +151,22 @@ function txNotFound(digest) {
151
151
  var _ed25519 = require('@mysten/sui/keypairs/ed25519');
152
152
  function assertSuiWallet(wallet, network) {
153
153
  if (typeof wallet !== "object" || wallet === null) {
154
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
154
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
155
155
  `chain ${network} is Sui; wallet must be { privateKey } (suiprivkey1\u2026 ) or { keypair }.`
156
156
  );
157
157
  }
158
158
  if ("walletClient" in wallet) {
159
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
159
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
160
160
  `chain ${network} is Sui; a viem { walletClient } can't be used \u2014 pass { privateKey } (suiprivkey1\u2026) or { keypair }.`
161
161
  );
162
162
  }
163
163
  if ("secretKey" in wallet || "signer" in wallet || "mnemonic" in wallet || "keyPair" in wallet || "secret" in wallet || "seed" in wallet || "accountId" in wallet) {
164
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
164
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
165
165
  `chain ${network} is Sui; that looks like another family's wallet \u2014 pass { privateKey } (suiprivkey1\u2026) or { keypair }.`
166
166
  );
167
167
  }
168
168
  if (!("privateKey" in wallet) && !("keypair" in wallet)) {
169
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
169
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
170
170
  `chain ${network} is Sui; wallet must be { privateKey } (suiprivkey1\u2026) or { keypair }.`
171
171
  );
172
172
  }
@@ -178,13 +178,13 @@ function resolveSuiKeypair(config) {
178
178
  try {
179
179
  return _ed25519.Ed25519Keypair.fromSecretKey(config.privateKey);
180
180
  } catch (cause) {
181
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
181
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
182
182
  "Sui wallet { privateKey } is not a valid suiprivkey1\u2026 secret (or 32-byte key).",
183
183
  { cause }
184
184
  );
185
185
  }
186
186
  }
187
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)("Sui wallet needs { privateKey } (suiprivkey1\u2026) or { keypair }.");
187
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)("Sui wallet needs { privateKey } (suiprivkey1\u2026) or { keypair }.");
188
188
  }
189
189
 
190
190
  // src/drivers/sui/index.ts
@@ -236,16 +236,16 @@ function makeSuiNetwork(preset, rpcUrl) {
236
236
  const info = preset.tokens[token.toUpperCase()];
237
237
  if (!info) {
238
238
  const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
239
- throw new (0, _chunkPA6YD3HLcjs.UnknownTokenError)(
239
+ throw new (0, _chunkU35MG4TFcjs.UnknownTokenError)(
240
240
  `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'.`
241
241
  );
242
242
  }
243
243
  return { asset: info.coinType, decimals: info.decimals, symbol: info.symbol };
244
244
  }
245
- _chunkPA6YD3HLcjs.rejectForeignToken.call(void 0, token, "sui", network);
245
+ _chunkU35MG4TFcjs.rejectForeignToken.call(void 0, token, "sui", network);
246
246
  const t = token;
247
247
  if (!t.coinType || typeof t.decimals !== "number") {
248
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
248
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
249
249
  `chain ${network} is Sui; a custom token must be { coinType, decimals }.`
250
250
  );
251
251
  }
@@ -264,7 +264,7 @@ function makeSuiNetwork(preset, rpcUrl) {
264
264
  },
265
265
  assertValidPayTo(payTo) {
266
266
  if (!_utils.isValidSuiAddress.call(void 0, payTo)) {
267
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
267
+ throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
268
268
  `chain ${network} is Sui, but payTo "${payTo}" is not a valid Sui address (0x + 32 bytes).`
269
269
  );
270
270
  }
@@ -281,11 +281,11 @@ function makeSuiNetwork(preset, rpcUrl) {
281
281
  const tx = await client.waitForTransaction({ digest: ref, options: { showEffects: true } });
282
282
  return { height: String(_nullishCoalesce(tx.checkpoint, () => ( "0"))) };
283
283
  } catch (err) {
284
- throw new (0, _chunkPA6YD3HLcjs.ConfirmationTimeoutError)(`Sui tx ${ref} did not finalize in time.`, { cause: err });
284
+ throw new (0, _chunkU35MG4TFcjs.ConfirmationTimeoutError)(`Sui tx ${ref} did not finalize in time.`, { cause: err });
285
285
  }
286
286
  },
287
287
  async estimateCost() {
288
- return _chunkPA6YD3HLcjs.nativeCost.call(void 0, {
288
+ return _chunkU35MG4TFcjs.nativeCost.call(void 0, {
289
289
  symbol: SUI_SYMBOL,
290
290
  decimals: SUI_DECIMALS,
291
291
  fee: 3000000n,
@@ -8,7 +8,7 @@ import {
8
8
  nativeCost,
9
9
  rejectForeignToken,
10
10
  toInsufficientFundsError
11
- } from "./chunk-ILPABTI2.js";
11
+ } from "./chunk-L6WQRHEZ.js";
12
12
 
13
13
  // src/drivers/ton/index.ts
14
14
  import { Address as Address2 } from "@ton/core";
@@ -8,7 +8,7 @@ var _chunkCQREG5LEcjs = require('./chunk-CQREG5LE.cjs');
8
8
 
9
9
 
10
10
 
11
- var _chunkPA6YD3HLcjs = require('./chunk-PA6YD3HL.cjs');
11
+ var _chunkU35MG4TFcjs = require('./chunk-U35MG4TF.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, _chunkPA6YD3HLcjs.ConfirmationTimeoutError)(
77
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)(
205
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)(
210
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)(
215
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)("TON wallet needs { mnemonic } (24 words) or { keyPair }.");
230
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.UnknownTokenError)(
273
+ throw new (0, _chunkU35MG4TFcjs.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
- _chunkPA6YD3HLcjs.rejectForeignToken.call(void 0, token, "ton", network);
279
+ _chunkU35MG4TFcjs.rejectForeignToken.call(void 0, token, "ton", network);
280
280
  if (!("master" in token)) {
281
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
281
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)(
300
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)(
307
+ throw new (0, _chunkU35MG4TFcjs.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(_chunkPA6YD3HLcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
323
+ throw _nullishCoalesce(_chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.ConfirmationTimeoutError)(`TON payment for nonce ${nonce} did not settle in time.`);
342
+ throw new (0, _chunkU35MG4TFcjs.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 _chunkPA6YD3HLcjs.nativeCost.call(void 0, { symbol: "TON", decimals: TON_DECIMALS, fee, basis: "heuristic", detail });
347
+ return _chunkU35MG4TFcjs.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 @@ var _chunkCQREG5LEcjs = require('./chunk-CQREG5LE.cjs');
9
9
 
10
10
 
11
11
 
12
- var _chunkPA6YD3HLcjs = require('./chunk-PA6YD3HL.cjs');
12
+ var _chunkU35MG4TFcjs = require('./chunk-U35MG4TF.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, _chunkPA6YD3HLcjs.InsufficientFundsError)(
64
+ throw new (0, _chunkU35MG4TFcjs.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 _chunkPA6YD3HLcjs.InsufficientFundsError) throw err;
73
- throw _nullishCoalesce(_chunkPA6YD3HLcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
72
+ if (err instanceof _chunkU35MG4TFcjs.InsufficientFundsError) throw err;
73
+ throw _nullishCoalesce(_chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.InsufficientFundsError)(
86
+ throw new (0, _chunkU35MG4TFcjs.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 _chunkPA6YD3HLcjs.InsufficientFundsError) throw err;
95
- throw _nullishCoalesce(_chunkPA6YD3HLcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
94
+ if (err instanceof _chunkU35MG4TFcjs.InsufficientFundsError) throw err;
95
+ throw _nullishCoalesce(_chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)(
266
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)(
271
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)(
276
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)(
281
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)("Tron wallet needs { privateKey } (32-byte hex).");
289
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)(
293
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.UnknownTokenError)(
343
+ throw new (0, _chunkU35MG4TFcjs.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
- _chunkPA6YD3HLcjs.rejectForeignToken.call(void 0, token, "tron", network);
349
+ _chunkU35MG4TFcjs.rejectForeignToken.call(void 0, token, "tron", network);
350
350
  if (!("address" in token)) {
351
- throw new (0, _chunkPA6YD3HLcjs.WrongFamilyError)(
351
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)(
357
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)(
376
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)(
381
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.WrongFamilyError)("Tron wallet { privateKey } could not derive an address.");
393
+ throw new (0, _chunkU35MG4TFcjs.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, _chunkPA6YD3HLcjs.ConfirmationTimeoutError)(`Tron tx ${txid} did not solidify in time.`);
416
+ throw new (0, _chunkU35MG4TFcjs.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 _chunkPA6YD3HLcjs.nativeCost.call(void 0, {
420
+ return _chunkU35MG4TFcjs.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 _chunkPA6YD3HLcjs.nativeCost.call(void 0, {
444
+ return _chunkU35MG4TFcjs.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 _chunkPA6YD3HLcjs.nativeCost.call(void 0, {
455
+ return _chunkU35MG4TFcjs.nativeCost.call(void 0, {
456
456
  symbol: "TRX",
457
457
  decimals: TRX_DECIMALS,
458
458
  fee: 30000n * ENERGY_PRICE + BANDWIDTH_SUN,
@@ -9,7 +9,7 @@ import {
9
9
  nativeCost,
10
10
  rejectForeignToken,
11
11
  toInsufficientFundsError
12
- } from "./chunk-ILPABTI2.js";
12
+ } from "./chunk-L6WQRHEZ.js";
13
13
 
14
14
  // src/drivers/tron/index.ts
15
15
  import { TronWeb } from "tronweb";
@@ -12,7 +12,7 @@ import {
12
12
  parseUnits,
13
13
  rejectForeignToken,
14
14
  toInsufficientFundsError
15
- } from "./chunk-ILPABTI2.js";
15
+ } from "./chunk-L6WQRHEZ.js";
16
16
 
17
17
  // src/drivers/xrpl/index.ts
18
18
  import { isValidClassicAddress } from "xrpl";