@stablechain/sdk 1.0.8 → 1.0.9

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.
package/dist/index.cjs CHANGED
@@ -18,7 +18,8 @@
18
18
 
19
19
 
20
20
 
21
- var _chunkQQ26UI3Fcjs = require('./chunk-QQ26UI3F.cjs');
21
+
22
+ var _chunkMMZ7HVWZcjs = require('./chunk-MMZ7HVWZ.cjs');
22
23
 
23
24
  // src/stable.ts
24
25
 
@@ -122,7 +123,7 @@ var MorphoService = class {
122
123
  deposit(params) {
123
124
  this._validateAmount(params.amount, "earn deposit");
124
125
  if (params.depositBuffer !== void 0 && (params.depositBuffer <= 0 || params.depositBuffer > 1)) {
125
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
126
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
126
127
  "depositBuffer",
127
128
  params.depositBuffer,
128
129
  "earn deposit: depositBuffer must be > 0 and \u2264 1"
@@ -158,7 +159,7 @@ var MorphoService = class {
158
159
  const succeeded2 = results.filter(
159
160
  (r) => r.status === "fulfilled"
160
161
  ).length;
161
- throw new (0, _chunkQQ26UI3Fcjs.StableBulkError)({
162
+ throw new (0, _chunkMMZ7HVWZcjs.StableBulkError)({
162
163
  shortMessage: "bulkDeposit halted on first failure",
163
164
  results,
164
165
  succeeded: succeeded2,
@@ -202,7 +203,7 @@ var MorphoService = class {
202
203
  const succeeded2 = results.filter(
203
204
  (r) => r.status === "fulfilled"
204
205
  ).length;
205
- throw new (0, _chunkQQ26UI3Fcjs.StableBulkError)({
206
+ throw new (0, _chunkMMZ7HVWZcjs.StableBulkError)({
206
207
  shortMessage: "bulkWithdraw halted on first failure",
207
208
  results,
208
209
  succeeded: succeeded2,
@@ -255,7 +256,7 @@ var MorphoService = class {
255
256
  async prepareDepositCalldata(params) {
256
257
  this._validateAmount(params.amount, "prepareDepositCalldata");
257
258
  if (params.depositBuffer !== void 0 && (params.depositBuffer <= 0 || params.depositBuffer > 1)) {
258
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
259
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
259
260
  "depositBuffer",
260
261
  params.depositBuffer,
261
262
  "prepareDepositCalldata: depositBuffer must be > 0 and \u2264 1"
@@ -274,7 +275,7 @@ var MorphoService = class {
274
275
  if (assetsRaw > maxAllowed) {
275
276
  const maxFormatted = Number(_viem.formatUnits.call(void 0, maxAllowed, decimals));
276
277
  const idleFormatted = Number(_viem.formatUnits.call(void 0, vaultData.assetBalance, decimals));
277
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
278
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
278
279
  "amount",
279
280
  amount,
280
281
  `prepareDepositCalldata: amount ${amount} exceeds deposit buffer \u2014 max ${maxFormatted} (${depositBuffer * 100}% of ${idleFormatted} idle liquidity)`
@@ -332,7 +333,7 @@ var MorphoService = class {
332
333
  functionName: "decimals"
333
334
  });
334
335
  } catch (e) {
335
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
336
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
336
337
  "shareDecimals",
337
338
  void 0,
338
339
  `prepareRedeemCalldata: could not fetch share decimals for vault "${vaultAddr}" \u2014 pass shareDecimals explicitly`
@@ -378,7 +379,7 @@ var MorphoService = class {
378
379
  const idleFormatted = Number(
379
380
  _viem.formatUnits.call(void 0, vaultData.assetBalance, decimals)
380
381
  );
381
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
382
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
382
383
  "amount",
383
384
  amount,
384
385
  `earn deposit: amount ${amount} exceeds deposit buffer \u2014 max ${maxFormatted} (${depositBuffer * 100}% of ${idleFormatted} idle liquidity)`
@@ -408,7 +409,7 @@ var MorphoService = class {
408
409
  hash: approveHash
409
410
  });
410
411
  if (approveReceipt.status === "reverted") {
411
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
412
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
412
413
  phase: "approve",
413
414
  shortMessage: "earn deposit: token approval reverted on-chain",
414
415
  txHash: approveReceipt.transactionHash,
@@ -423,7 +424,7 @@ var MorphoService = class {
423
424
  const hash = await this._sendTx(tx.to, tx.data, tx.value, from);
424
425
  const receipt = await this.pc.waitForTransactionReceipt({ hash });
425
426
  if (receipt.status === "reverted") {
426
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
427
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
427
428
  phase: "receipt",
428
429
  shortMessage: "earn deposit: vault deposit reverted on-chain",
429
430
  txHash: receipt.transactionHash,
@@ -453,7 +454,7 @@ var MorphoService = class {
453
454
  const hash = await this._sendTx(tx.to, tx.data, tx.value, from);
454
455
  const receipt = await this.pc.waitForTransactionReceipt({ hash });
455
456
  if (receipt.status === "reverted") {
456
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
457
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
457
458
  phase: "receipt",
458
459
  shortMessage: "earn withdraw: vault withdraw reverted on-chain",
459
460
  txHash: receipt.transactionHash,
@@ -476,7 +477,7 @@ var MorphoService = class {
476
477
  functionName: "decimals"
477
478
  });
478
479
  } catch (e2) {
479
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
480
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
480
481
  "shareDecimals",
481
482
  void 0,
482
483
  `earn redeem: could not fetch share decimals for vault "${vaultAddr}" \u2014 pass shareDecimals explicitly`
@@ -499,7 +500,7 @@ var MorphoService = class {
499
500
  const hash = await this._sendTx(tx.to, tx.data, tx.value, from);
500
501
  const receipt = await this.pc.waitForTransactionReceipt({ hash });
501
502
  if (receipt.status === "reverted") {
502
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
503
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
503
504
  phase: "receipt",
504
505
  shortMessage: "earn redeem: vault redeem reverted on-chain",
505
506
  txHash: receipt.transactionHash,
@@ -530,7 +531,7 @@ var MorphoService = class {
530
531
  const hash = await this._sendTx(tx.to, tx.data, tx.value, from);
531
532
  const receipt = await this.pc.waitForTransactionReceipt({ hash });
532
533
  if (receipt.status === "reverted") {
533
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
534
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
534
535
  phase: "receipt",
535
536
  shortMessage: "earn forceWithdraw: vault forceWithdraw reverted on-chain",
536
537
  txHash: receipt.transactionHash,
@@ -560,7 +561,7 @@ var MorphoService = class {
560
561
  functionName: "decimals"
561
562
  });
562
563
  } catch (e3) {
563
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
564
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
564
565
  "shareDecimals",
565
566
  void 0,
566
567
  `earn forceRedeem: could not fetch share decimals for vault "${vaultAddr}" \u2014 pass shareDecimals explicitly`
@@ -583,7 +584,7 @@ var MorphoService = class {
583
584
  const hash = await this._sendTx(tx.to, tx.data, tx.value, from);
584
585
  const receipt = await this.pc.waitForTransactionReceipt({ hash });
585
586
  if (receipt.status === "reverted") {
586
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
587
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
587
588
  phase: "receipt",
588
589
  shortMessage: "earn forceRedeem: vault forceRedeem reverted on-chain",
589
590
  txHash: receipt.transactionHash,
@@ -605,7 +606,7 @@ var MorphoService = class {
605
606
  remaining = this._pullFromAdapter(adapter, remaining, now, result);
606
607
  }
607
608
  if (remaining > 0n) {
608
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
609
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
609
610
  "amount",
610
611
  amount,
611
612
  "earn withdraw: insufficient adapter liquidity \u2014 reduce the amount or wait for market liquidity to free up"
@@ -652,7 +653,7 @@ var MorphoService = class {
652
653
  _requireFrom() {
653
654
  const from = _optionalChain([this, 'access', _4 => _4.wc, 'access', _5 => _5.account, 'optionalAccess', _6 => _6.address]);
654
655
  if (!from) {
655
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
656
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
656
657
  "signer",
657
658
  void 0,
658
659
  "earn: requires a signer \u2014 set walletClient or account in StableConfig"
@@ -665,7 +666,7 @@ var MorphoService = class {
665
666
  await this.wc.switchChain({ id: this.config.chainId });
666
667
  } catch (err) {
667
668
  if (err.code === 4001) {
668
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
669
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
669
670
  phase: "switch_chain",
670
671
  shortMessage: `earn: wallet rejected switch to chain ${this.config.chainId}`,
671
672
  chainId: this.config.chainId,
@@ -684,7 +685,7 @@ var MorphoService = class {
684
685
  chain: this.chain
685
686
  });
686
687
  } catch (err) {
687
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
688
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
688
689
  phase: "send",
689
690
  shortMessage: "earn: transaction send failed",
690
691
  chainId: this.config.chainId,
@@ -702,7 +703,7 @@ var MorphoService = class {
702
703
  })
703
704
  );
704
705
  } catch (e4) {
705
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
706
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
706
707
  "tokenDecimals",
707
708
  void 0,
708
709
  `${op}: could not fetch decimals for asset "${asset}" \u2014 pass tokenDecimals explicitly`
@@ -719,7 +720,7 @@ var MorphoService = class {
719
720
  }
720
721
  _validateAmount(amount, op) {
721
722
  if (!Number.isFinite(amount) || amount <= 0) {
722
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
723
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
723
724
  "amount",
724
725
  amount,
725
726
  `${op}: amount must be a finite positive number`
@@ -728,7 +729,7 @@ var MorphoService = class {
728
729
  }
729
730
  _validateShares(shares, op) {
730
731
  if (!Number.isFinite(shares) || shares <= 0) {
731
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
732
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
732
733
  "shares",
733
734
  shares,
734
735
  `${op}: shares must be a finite positive number`
@@ -783,21 +784,21 @@ var MORPHO_API_URL = "https://blue-api.morpho.org/graphql";
783
784
  var EarnReader = class {
784
785
  constructor(config) {
785
786
  if (!_optionalChain([config, 'access', _7 => _7.earn, 'optionalAccess', _8 => _8.vault])) {
786
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
787
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
787
788
  "earn.vault",
788
789
  void 0,
789
790
  "createStableReader: earn.vault is required"
790
791
  );
791
792
  }
792
793
  if (!_viem.isAddress.call(void 0, config.address)) {
793
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
794
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
794
795
  "address",
795
796
  config.address,
796
797
  `createStableReader: invalid user address "${config.address}"`
797
798
  );
798
799
  }
799
800
  if (!_viem.isAddress.call(void 0, config.earn.vault)) {
800
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
801
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
801
802
  "earn.vault",
802
803
  config.earn.vault,
803
804
  `createStableReader: invalid vault address "${config.earn.vault}"`
@@ -932,7 +933,7 @@ var EarnReader = class {
932
933
  );
933
934
  } catch (err) {
934
935
  if (err instanceof TypeError || err instanceof HttpError) {
935
- throw new (0, _chunkQQ26UI3Fcjs.StableNetworkError)({
936
+ throw new (0, _chunkMMZ7HVWZcjs.StableNetworkError)({
936
937
  shortMessage: err instanceof HttpError ? `earn: Morpho API returned ${err.status} after retries` : `earn: failed to reach Morpho API after retries \u2014 ${String(
937
938
  err
938
939
  )}`,
@@ -944,7 +945,7 @@ var EarnReader = class {
944
945
  }
945
946
  const vault = _optionalChain([body, 'optionalAccess', _9 => _9.data, 'optionalAccess', _10 => _10.vaultV2ByAddress]);
946
947
  if (!vault || typeof vault.avgNetApy !== "number") {
947
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
948
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
948
949
  "apy",
949
950
  void 0,
950
951
  "earn: vault not found in Morpho API or unexpected response shape"
@@ -996,7 +997,7 @@ var MerklService = class {
996
997
  }
997
998
  async fetchRewards(address) {
998
999
  if (!_viem.isAddress.call(void 0, address)) {
999
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1000
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1000
1001
  "address",
1001
1002
  address,
1002
1003
  `merkl: invalid address "${address}"`
@@ -1014,7 +1015,7 @@ var MerklService = class {
1014
1015
  (r) => r.rawAmount !== "0" && r.proofs.length > 0
1015
1016
  );
1016
1017
  if (claimable.length === 0) {
1017
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1018
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1018
1019
  "rewards",
1019
1020
  [],
1020
1021
  rewards.length > 0 ? "merkl: rewards are pending the next merkle tree update \u2014 try again in ~2 hours" : "merkl: no rewards to claim on this chain"
@@ -1029,7 +1030,7 @@ var MerklService = class {
1029
1030
  try {
1030
1031
  await wc.switchChain({ id: this.config.chainId });
1031
1032
  } catch (err) {
1032
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
1033
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
1033
1034
  phase: "switch_chain",
1034
1035
  shortMessage: `merkl: wallet rejected or failed to switch to chain ${this.config.chainId}`,
1035
1036
  chainId: this.config.chainId,
@@ -1053,7 +1054,7 @@ var MerklService = class {
1053
1054
  chain
1054
1055
  });
1055
1056
  } catch (err) {
1056
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
1057
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
1057
1058
  phase: "send",
1058
1059
  shortMessage: "merkl: claim transaction failed",
1059
1060
  chainId: this.config.chainId,
@@ -1066,7 +1067,7 @@ var MerklService = class {
1066
1067
  });
1067
1068
  const receipt = await pc.waitForTransactionReceipt({ hash });
1068
1069
  if (receipt.status === "reverted") {
1069
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
1070
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
1070
1071
  phase: "receipt",
1071
1072
  shortMessage: "merkl: claim transaction reverted on-chain",
1072
1073
  txHash: receipt.transactionHash,
@@ -1080,7 +1081,7 @@ var MerklService = class {
1080
1081
  }
1081
1082
  async prepareClaimCalldata(address) {
1082
1083
  if (!_viem.isAddress.call(void 0, address)) {
1083
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1084
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1084
1085
  "address",
1085
1086
  address,
1086
1087
  `merkl: invalid address "${address}"`
@@ -1091,7 +1092,7 @@ var MerklService = class {
1091
1092
  (r) => r.rawAmount !== "0" && r.proofs.length > 0
1092
1093
  );
1093
1094
  if (claimable.length === 0) {
1094
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1095
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1095
1096
  "rewards",
1096
1097
  [],
1097
1098
  rewards.length > 0 ? "merkl: rewards are pending the next merkle tree update \u2014 try again in ~2 hours" : "merkl: no rewards to claim on this chain"
@@ -1116,7 +1117,7 @@ var MerklService = class {
1116
1117
  _requireFrom() {
1117
1118
  const from = _nullishCoalesce(_optionalChain([this, 'access', _11 => _11.config, 'access', _12 => _12.walletClient, 'optionalAccess', _13 => _13.account, 'optionalAccess', _14 => _14.address]), () => ( _optionalChain([this, 'access', _15 => _15.config, 'access', _16 => _16.account, 'optionalAccess', _17 => _17.address])));
1118
1119
  if (!from) {
1119
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1120
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1120
1121
  "signer",
1121
1122
  void 0,
1122
1123
  "merkl.claim: requires a signer \u2014 set walletClient or account in StableConfig"
@@ -1158,15 +1159,15 @@ var MerklService = class {
1158
1159
  try {
1159
1160
  return await retryWithBackoff(() => this._fetchOnce(url));
1160
1161
  } catch (err) {
1161
- if (err instanceof _chunkQQ26UI3Fcjs.StableNetworkError) throw err;
1162
+ if (err instanceof _chunkMMZ7HVWZcjs.StableNetworkError) throw err;
1162
1163
  if (err instanceof HttpError) {
1163
- throw new (0, _chunkQQ26UI3Fcjs.StableNetworkError)({
1164
+ throw new (0, _chunkMMZ7HVWZcjs.StableNetworkError)({
1164
1165
  shortMessage: `merkl: request failed \u2014 ${err.message}`,
1165
1166
  url,
1166
1167
  cause: err
1167
1168
  });
1168
1169
  }
1169
- throw new (0, _chunkQQ26UI3Fcjs.StableNetworkError)({
1170
+ throw new (0, _chunkMMZ7HVWZcjs.StableNetworkError)({
1170
1171
  shortMessage: "merkl: request failed before reaching the server",
1171
1172
  url,
1172
1173
  cause: err
@@ -1183,7 +1184,7 @@ var MerklService = class {
1183
1184
  true
1184
1185
  );
1185
1186
  }
1186
- throw new (0, _chunkQQ26UI3Fcjs.StableNetworkError)({
1187
+ throw new (0, _chunkMMZ7HVWZcjs.StableNetworkError)({
1187
1188
  shortMessage: `merkl: API error ${res.status} ${res.statusText}`,
1188
1189
  url
1189
1190
  });
@@ -1382,13 +1383,13 @@ var LiFiService = class {
1382
1383
  const src = CHAIN_CONFIGS[fromChain];
1383
1384
  const dst = CHAIN_CONFIGS[toChain];
1384
1385
  if (!src)
1385
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1386
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1386
1387
  "fromChain",
1387
1388
  fromChain,
1388
1389
  `LI.FI bridge: unsupported source chain "${fromChain}"`
1389
1390
  );
1390
1391
  if (!dst)
1391
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1392
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1392
1393
  "toChain",
1393
1394
  toChain,
1394
1395
  `LI.FI bridge: unsupported destination chain "${toChain}"`
@@ -1420,14 +1421,14 @@ var LiFiService = class {
1420
1421
  const src = CHAIN_CONFIGS[fromChain];
1421
1422
  const dst = CHAIN_CONFIGS[toChain];
1422
1423
  if (!src) {
1423
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1424
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1424
1425
  "fromChain",
1425
1426
  fromChain,
1426
1427
  `LI.FI bridge: unsupported source chain "${fromChain}"`
1427
1428
  );
1428
1429
  }
1429
1430
  if (!dst) {
1430
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1431
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1431
1432
  "toChain",
1432
1433
  toChain,
1433
1434
  `LI.FI bridge: unsupported destination chain "${toChain}"`
@@ -1456,35 +1457,35 @@ var LiFiService = class {
1456
1457
  toAddress
1457
1458
  }) {
1458
1459
  if (!_viem.isAddress.call(void 0, fromToken)) {
1459
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1460
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1460
1461
  "fromToken",
1461
1462
  fromToken,
1462
1463
  `swap: invalid fromToken address "${fromToken}"`
1463
1464
  );
1464
1465
  }
1465
1466
  if (!_viem.isAddress.call(void 0, toToken)) {
1466
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1467
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1467
1468
  "toToken",
1468
1469
  toToken,
1469
1470
  `swap: invalid toToken address "${toToken}"`
1470
1471
  );
1471
1472
  }
1472
1473
  if (fromToken.toLowerCase() === toToken.toLowerCase()) {
1473
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1474
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1474
1475
  "toToken",
1475
1476
  toToken,
1476
1477
  "swap: fromToken and toToken must differ"
1477
1478
  );
1478
1479
  }
1479
1480
  if (!Number.isFinite(amount) || amount <= 0) {
1480
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1481
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1481
1482
  "amount",
1482
1483
  amount,
1483
1484
  "swap: amount must be a finite positive number"
1484
1485
  );
1485
1486
  }
1486
1487
  if (toAddress !== void 0 && !_viem.isAddress.call(void 0, toAddress)) {
1487
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1488
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1488
1489
  "toAddress",
1489
1490
  toAddress,
1490
1491
  `swap: invalid toAddress "${toAddress}"`
@@ -1500,35 +1501,35 @@ var LiFiService = class {
1500
1501
  recipient
1501
1502
  }) {
1502
1503
  if (!_viem.isAddress.call(void 0, fromToken)) {
1503
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1504
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1504
1505
  "fromToken",
1505
1506
  fromToken,
1506
1507
  `LI.FI bridge: invalid fromToken address "${fromToken}"`
1507
1508
  );
1508
1509
  }
1509
1510
  if (!_viem.isAddress.call(void 0, toToken)) {
1510
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1511
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1511
1512
  "toToken",
1512
1513
  toToken,
1513
1514
  `LI.FI bridge: invalid toToken address "${toToken}"`
1514
1515
  );
1515
1516
  }
1516
1517
  if (!Number.isFinite(amount) || amount <= 0) {
1517
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1518
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1518
1519
  "amount",
1519
1520
  amount,
1520
1521
  "LI.FI bridge: amount must be a finite positive number"
1521
1522
  );
1522
1523
  }
1523
1524
  if (recipient !== void 0 && !_viem.isAddress.call(void 0, recipient)) {
1524
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1525
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1525
1526
  "recipient",
1526
1527
  recipient,
1527
1528
  `LI.FI bridge: invalid recipient address "${recipient}"`
1528
1529
  );
1529
1530
  }
1530
1531
  if (fromChain === toChain) {
1531
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1532
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1532
1533
  "toChain",
1533
1534
  toChain,
1534
1535
  "LI.FI bridge: fromChain and toChain must differ"
@@ -1538,7 +1539,7 @@ var LiFiService = class {
1538
1539
  _requireFrom() {
1539
1540
  const from = _nullishCoalesce(_optionalChain([this, 'access', _29 => _29.config, 'access', _30 => _30.walletClient, 'optionalAccess', _31 => _31.account, 'optionalAccess', _32 => _32.address]), () => ( _optionalChain([this, 'access', _33 => _33.config, 'access', _34 => _34.account, 'optionalAccess', _35 => _35.address])));
1540
1541
  if (!from) {
1541
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
1542
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1542
1543
  "signer",
1543
1544
  void 0,
1544
1545
  "LI.FI: requires a signer \u2014 set walletClient or account in StableConfig"
@@ -1551,16 +1552,16 @@ var LiFiService = class {
1551
1552
  try {
1552
1553
  return await retryWithBackoff(() => this._fetchQuoteOnce(url));
1553
1554
  } catch (err) {
1554
- if (err instanceof _chunkQQ26UI3Fcjs.StableQuoteError) throw err;
1555
+ if (err instanceof _chunkMMZ7HVWZcjs.StableQuoteError) throw err;
1555
1556
  if (err instanceof HttpError) {
1556
- throw new (0, _chunkQQ26UI3Fcjs.StableQuoteError)({
1557
+ throw new (0, _chunkMMZ7HVWZcjs.StableQuoteError)({
1557
1558
  provider: "lifi",
1558
1559
  shortMessage: err.message,
1559
1560
  httpStatus: err.status,
1560
1561
  cause: err
1561
1562
  });
1562
1563
  }
1563
- throw new (0, _chunkQQ26UI3Fcjs.StableNetworkError)({
1564
+ throw new (0, _chunkMMZ7HVWZcjs.StableNetworkError)({
1564
1565
  shortMessage: "LI.FI: quote request failed before reaching the server",
1565
1566
  url,
1566
1567
  cause: err
@@ -1580,7 +1581,7 @@ var LiFiService = class {
1580
1581
  true
1581
1582
  );
1582
1583
  }
1583
- throw new (0, _chunkQQ26UI3Fcjs.StableQuoteError)({
1584
+ throw new (0, _chunkMMZ7HVWZcjs.StableQuoteError)({
1584
1585
  provider: "lifi",
1585
1586
  shortMessage: `LI.FI: ${_nullishCoalesce(providerMessage, () => ( res.statusText))}`,
1586
1587
  httpStatus: res.status,
@@ -1589,7 +1590,7 @@ var LiFiService = class {
1589
1590
  });
1590
1591
  }
1591
1592
  if (!isLiFiQuoteShape(body)) {
1592
- throw new (0, _chunkQQ26UI3Fcjs.StableQuoteError)({
1593
+ throw new (0, _chunkMMZ7HVWZcjs.StableQuoteError)({
1593
1594
  provider: "lifi",
1594
1595
  shortMessage: "LI.FI: unexpected quote response shape",
1595
1596
  httpStatus: res.status,
@@ -1617,7 +1618,7 @@ var LiFiService = class {
1617
1618
  const { transactionRequest } = quote;
1618
1619
  const srcChainId = transactionRequest.chainId;
1619
1620
  if (srcChainId !== expectedChainId) {
1620
- throw new (0, _chunkQQ26UI3Fcjs.StableQuoteError)({
1621
+ throw new (0, _chunkMMZ7HVWZcjs.StableQuoteError)({
1621
1622
  provider: "lifi",
1622
1623
  shortMessage: `LI.FI: returned tx for chain ${srcChainId} but expected ${expectedChainId}`,
1623
1624
  providerCode: "chain_mismatch",
@@ -1633,7 +1634,7 @@ var LiFiService = class {
1633
1634
  try {
1634
1635
  await wc.switchChain({ id: srcChainId });
1635
1636
  } catch (err) {
1636
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
1637
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
1637
1638
  phase: "switch_chain",
1638
1639
  shortMessage: `LI.FI: wallet rejected or failed to switch to chain ${srcChainId}`,
1639
1640
  chainId: srcChainId,
@@ -1659,7 +1660,7 @@ var LiFiService = class {
1659
1660
  chain: srcChain
1660
1661
  });
1661
1662
  } catch (err) {
1662
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
1663
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
1663
1664
  phase: "send",
1664
1665
  shortMessage: "LI.FI: swap/bridge transaction failed",
1665
1666
  chainId: srcChainId,
@@ -1694,7 +1695,7 @@ var LiFiService = class {
1694
1695
  chain: srcChain
1695
1696
  });
1696
1697
  } catch (err) {
1697
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
1698
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
1698
1699
  phase: "approve",
1699
1700
  shortMessage: "LI.FI: token approve failed",
1700
1701
  chainId: srcChainId,
@@ -1705,7 +1706,7 @@ var LiFiService = class {
1705
1706
  hash: approveHash
1706
1707
  });
1707
1708
  if (approveReceipt.status === "reverted") {
1708
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
1709
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
1709
1710
  phase: "approve",
1710
1711
  shortMessage: "LI.FI: token approve reverted on-chain",
1711
1712
  txHash: approveReceipt.transactionHash,
@@ -1750,6 +1751,12 @@ var XAUT0_DEPLOYMENTS = {
1750
1751
  ["plasma" /* Plasma */]: { address: "0x1B64B9025EEbb9A6239575dF9Ea4b9Ac46D4d193", decimals: 6, oftAdapter: "0x63aB93cBC9d4ecD9c4947b1A38F458147C08E6F7", approvalRequired: false },
1751
1752
  ["bsc" /* BSC */]: { address: "0x21cAef8A43163Eea865baeE23b9C2E327696A3bf", decimals: 6, oftAdapter: "0x53C3A64c8942288e12813C1F8457Db45980BcfC2", approvalRequired: false }
1752
1753
  };
1754
+ var PYUSD_DEPLOYMENTS = {
1755
+ // No floor: unlike USDT0's, this pathway's DVNs don't hold for finality. 15
1756
+ // confirmations compute to ~184s; LayerZero Scan observed ~202s (2026-10-27).
1757
+ ["ethereum" /* Ethereum */]: { address: "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8", decimals: 6, oftAdapter: "0xa2C323fE5A74aDffAd2bf3E007E36bb029606444", approvalRequired: false, minDeliverySec: 0 },
1758
+ ["stable" /* Stable */]: { address: _chunkMMZ7HVWZcjs.STABLE_PYUSD_ADDRESS, decimals: 6, oftAdapter: "0x2eb79387Fa1a6EF6DC8E25401C8fdc291Cc542C7", approvalRequired: false }
1759
+ };
1753
1760
  var USDT0_LOCKBOX_CHAINS = /* @__PURE__ */ new Set(["ethereum" /* Ethereum */, "sepolia" /* Sepolia */]);
1754
1761
  function bridgeChain(chain, lzEid, blockTimeSec, usdt0Adapter, minDeliverySec) {
1755
1762
  const base = C[chain];
@@ -1764,6 +1771,8 @@ function bridgeChain(chain, lzEid, blockTimeSec, usdt0Adapter, minDeliverySec) {
1764
1771
  }
1765
1772
  const xaut0 = XAUT0_DEPLOYMENTS[chain];
1766
1773
  if (xaut0) tokens.xaut0 = xaut0;
1774
+ const pyusd = PYUSD_DEPLOYMENTS[chain];
1775
+ if (pyusd) tokens.pyusd = pyusd;
1767
1776
  return { ...base, lzEid, blockTimeSec, minDeliverySec, tokens, oftAdapter: usdt0Adapter };
1768
1777
  }
1769
1778
  var BRIDGE_CHAIN_CONFIGS = {
@@ -1990,7 +1999,7 @@ function buildLzOptions(gasLimit = 0n, nativeDrop = 0n, dropReceiver) {
1990
1999
  ];
1991
2000
  if (nativeDrop > 0n) {
1992
2001
  if (!dropReceiver) {
1993
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2002
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
1994
2003
  "recipient",
1995
2004
  dropReceiver,
1996
2005
  "buildLzOptions: a native drop needs a receiver address"
@@ -2021,7 +2030,7 @@ function padFee(nativeFee, bufferBps) {
2021
2030
  function resolveFeeBuffer(feeBufferBps, method) {
2022
2031
  if (feeBufferBps === void 0) return DEFAULT_FEE_BUFFER_BPS;
2023
2032
  if (!Number.isInteger(feeBufferBps) || feeBufferBps < 0 || feeBufferBps > MAX_FEE_BUFFER_BPS) {
2024
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2033
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2025
2034
  "feeBufferBps",
2026
2035
  feeBufferBps,
2027
2036
  `${method}: feeBufferBps must be an integer between 0 and ${MAX_FEE_BUFFER_BPS}`
@@ -2103,7 +2112,7 @@ var LayerZeroService = class {
2103
2112
  functionName: "quoteSend",
2104
2113
  args: [sendParam, false]
2105
2114
  }).catch((err) => {
2106
- throw new (0, _chunkQQ26UI3Fcjs.StableQuoteError)({
2115
+ throw new (0, _chunkMMZ7HVWZcjs.StableQuoteError)({
2107
2116
  provider: "layerzero",
2108
2117
  shortMessage: plan.nativeDrop > 0n ? `${method}: quoteSend call failed \u2014 a dstNativeDrop over the pathway's executor nativeCap is the usual cause` : `${method}: quoteSend call failed`,
2109
2118
  cause: err
@@ -2111,7 +2120,7 @@ var LayerZeroService = class {
2111
2120
  }),
2112
2121
  this.readOftQuote(plan, sendParam).catch((err) => {
2113
2122
  if (!requireOft) return void 0;
2114
- throw new (0, _chunkQQ26UI3Fcjs.StableQuoteError)({
2123
+ throw new (0, _chunkMMZ7HVWZcjs.StableQuoteError)({
2115
2124
  provider: "layerzero",
2116
2125
  shortMessage: `${method}: quoteOFT call failed \u2014 the adapter's receipt is what floors the send at what it would actually deliver, and there is no safe default for it`,
2117
2126
  cause: err
@@ -2240,7 +2249,7 @@ var LayerZeroService = class {
2240
2249
  chain: srcChain
2241
2250
  });
2242
2251
  } catch (err) {
2243
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
2252
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
2244
2253
  phase: "approve",
2245
2254
  shortMessage: `bridge: ${asset} ${what} failed`,
2246
2255
  chainId: src.id,
@@ -2249,7 +2258,7 @@ var LayerZeroService = class {
2249
2258
  }
2250
2259
  const approveReceipt = await pc.waitForTransactionReceipt({ hash: approveHash });
2251
2260
  if (approveReceipt.status === "reverted") {
2252
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
2261
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
2253
2262
  phase: "approve",
2254
2263
  shortMessage: `bridge: ${asset} ${what} reverted on-chain`,
2255
2264
  txHash: approveReceipt.transactionHash,
@@ -2260,7 +2269,7 @@ var LayerZeroService = class {
2260
2269
  async bridge(params) {
2261
2270
  const from = this.signerAddress();
2262
2271
  if (!from) {
2263
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2272
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2264
2273
  "signer",
2265
2274
  void 0,
2266
2275
  "bridge: requires a signer \u2014 set walletClient or account in StableConfig"
@@ -2283,7 +2292,7 @@ var LayerZeroService = class {
2283
2292
  try {
2284
2293
  await wc.switchChain({ id: src.id });
2285
2294
  } catch (err) {
2286
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
2295
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
2287
2296
  phase: "switch_chain",
2288
2297
  shortMessage: `bridge: wallet rejected or failed to switch to chain ${src.id}`,
2289
2298
  chainId: src.id,
@@ -2309,7 +2318,7 @@ var LayerZeroService = class {
2309
2318
  });
2310
2319
  return { txHash: hash, toAmount: _nullishCoalesce(_optionalChain([oft, 'optionalAccess', _49 => _49.amountReceived]), () => ( params.amount)) };
2311
2320
  } catch (err) {
2312
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
2321
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
2313
2322
  phase: "send",
2314
2323
  shortMessage: "bridge: OFT send failed",
2315
2324
  chainId: src.id,
@@ -2336,7 +2345,7 @@ var LayerZeroService = class {
2336
2345
  const method = "prepareBridgeCalldata";
2337
2346
  const from = params.from;
2338
2347
  if (!_viem.isAddress.call(void 0, from)) {
2339
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2348
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2340
2349
  "from",
2341
2350
  params.from,
2342
2351
  `${method}: invalid from address "${params.from}" \u2014 the address that will sign these transactions`
@@ -2394,7 +2403,7 @@ var LayerZeroService = class {
2394
2403
  * The number comes from the pathway's live ULN config:
2395
2404
  * `srcBlockTime × confirmations + dstBlockTime × (2 + dvnCount)`, floored at the
2396
2405
  * source chain's {@link BridgeChainConfig.minDeliverySec} where the confirmation
2397
- * count is not the whole wait. This is what the DVNs are actually bound by, so it
2406
+ * count is not the whole wait (unless the asset sets its own floor). This is what the DVNs are actually bound by, so it
2398
2407
  * tracks a config change the moment it lands — and on every pathway that is purely
2399
2408
  * confirmation-bound it agrees with both usdt0.to's own estimate and the delivery
2400
2409
  * times Scan reports to well under a percent.
@@ -2419,10 +2428,10 @@ var LayerZeroService = class {
2419
2428
  const from = _nullishCoalesce(fromToken, () => ( _optionalChain([src, 'optionalAccess', _51 => _51.tokens, 'access', _52 => _52.usdt0, 'optionalAccess', _53 => _53.address])));
2420
2429
  const to = _nullishCoalesce(toToken, () => ( _optionalChain([dst, 'optionalAccess', _54 => _54.tokens, 'access', _55 => _55.usdt0, 'optionalAccess', _56 => _56.address])));
2421
2430
  if (!(src && from)) {
2422
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)("fromChain", fromChain, `estimateBridgeTime: no OFT adapter for "${fromChain}"`);
2431
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)("fromChain", fromChain, `estimateBridgeTime: no OFT adapter for "${fromChain}"`);
2423
2432
  }
2424
2433
  if (!(dst && to)) {
2425
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)("toChain", toChain, `estimateBridgeTime: no OFT adapter for "${toChain}"`);
2434
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)("toChain", toChain, `estimateBridgeTime: no OFT adapter for "${toChain}"`);
2426
2435
  }
2427
2436
  const { srcToken, dstToken } = this.resolveRoute(fromChain, toChain, from, to);
2428
2437
  const [uln, observedSeconds] = await Promise.all([
@@ -2437,9 +2446,10 @@ var LayerZeroService = class {
2437
2446
  );
2438
2447
  formulaSeconds = Number.isFinite(computed) ? computed : void 0;
2439
2448
  }
2440
- const resolved = resolveDeliverySeconds(formulaSeconds, observedSeconds, src.minDeliverySec);
2449
+ const floor = _nullishCoalesce(srcToken.minDeliverySec, () => ( src.minDeliverySec));
2450
+ const resolved = resolveDeliverySeconds(formulaSeconds, observedSeconds, floor);
2441
2451
  if (!resolved) {
2442
- throw new (0, _chunkQQ26UI3Fcjs.StableQuoteError)({
2452
+ throw new (0, _chunkMMZ7HVWZcjs.StableQuoteError)({
2443
2453
  provider: "layerzero",
2444
2454
  shortMessage: `estimateBridgeTime: no pathway data for ${fromChain}\u2192${toChain}`
2445
2455
  });
@@ -2466,7 +2476,7 @@ var LayerZeroService = class {
2466
2476
  if (err instanceof ScanHttpError && err.status === 404) {
2467
2477
  return { state: "pending", srcTxHash, scanUrl };
2468
2478
  }
2469
- throw new (0, _chunkQQ26UI3Fcjs.StableQuoteError)({
2479
+ throw new (0, _chunkMMZ7HVWZcjs.StableQuoteError)({
2470
2480
  provider: "layerzero",
2471
2481
  shortMessage: `trackBridge: LayerZero Scan lookup failed for ${srcTxHash}`,
2472
2482
  cause: err
@@ -2522,21 +2532,21 @@ var LayerZeroService = class {
2522
2532
  }
2523
2533
  validateBridgeParams(params, method) {
2524
2534
  if (!_viem.isAddress.call(void 0, params.recipient)) {
2525
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2535
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2526
2536
  "recipient",
2527
2537
  params.recipient,
2528
2538
  `${method}: invalid recipient address "${params.recipient}"`
2529
2539
  );
2530
2540
  }
2531
2541
  if (!Number.isFinite(params.amount) || params.amount <= 0) {
2532
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2542
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2533
2543
  "amount",
2534
2544
  params.amount,
2535
2545
  `${method}: amount must be a finite positive number`
2536
2546
  );
2537
2547
  }
2538
2548
  if (params.fromChain === params.toChain) {
2539
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2549
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2540
2550
  "toChain",
2541
2551
  params.toChain,
2542
2552
  `${method}: fromChain and toChain must differ`
@@ -2553,11 +2563,11 @@ var LayerZeroService = class {
2553
2563
  resolveRoute(fromChain, toChain, fromToken, toToken) {
2554
2564
  const src = BRIDGE_CHAIN_CONFIGS[fromChain];
2555
2565
  const dst = BRIDGE_CHAIN_CONFIGS[toChain];
2556
- if (!src) throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)("fromChain", fromChain, `Unsupported source chain: "${fromChain}"`);
2557
- if (!dst) throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)("toChain", toChain, `Unsupported destination chain: "${toChain}"`);
2566
+ if (!src) throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)("fromChain", fromChain, `Unsupported source chain: "${fromChain}"`);
2567
+ if (!dst) throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)("toChain", toChain, `Unsupported destination chain: "${toChain}"`);
2558
2568
  const asset = bridgeAssetFor(src, fromToken);
2559
2569
  if (!asset) {
2560
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2570
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2561
2571
  "fromToken",
2562
2572
  fromToken,
2563
2573
  `Native OFT bridge does not recognize "${fromToken}" on "${fromChain}" \u2014 it moves ${describeAssets(src)}. Use route "lifi" to bridge other tokens.`
@@ -2566,14 +2576,14 @@ var LayerZeroService = class {
2566
2576
  const srcToken = src.tokens[asset];
2567
2577
  const dstToken = dst.tokens[asset];
2568
2578
  if (!dstToken) {
2569
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2579
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2570
2580
  "toChain",
2571
2581
  toChain,
2572
2582
  `Native OFT bridge cannot deliver ${asset} to "${toChain}" \u2014 no ${asset} deployment there. Use route "lifi" instead.`
2573
2583
  );
2574
2584
  }
2575
2585
  if (dstToken.address.toLowerCase() !== toToken.toLowerCase()) {
2576
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2586
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2577
2587
  "toToken",
2578
2588
  toToken,
2579
2589
  `Native OFT bridge moves ${asset} to itself \u2014 toToken must be ${dstToken.address} on "${toChain}", got "${toToken}". Use route "lifi" to bridge between different tokens.`
@@ -2590,7 +2600,7 @@ var LayerZeroService = class {
2590
2600
  const recipientAddr = _nullishCoalesce(recipient, () => ( ZERO_ADDRESS));
2591
2601
  this.validateBridgeParams({ fromChain, toChain, amount, recipient: recipientAddr }, method);
2592
2602
  if (dstNativeDrop !== void 0 && dstNativeDrop < 0n) {
2593
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2603
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2594
2604
  "dstNativeDrop",
2595
2605
  dstNativeDrop,
2596
2606
  `${method}: dstNativeDrop must not be negative`
@@ -2604,7 +2614,7 @@ var LayerZeroService = class {
2604
2614
  toToken
2605
2615
  );
2606
2616
  if (params.fromDecimals !== void 0 && params.fromDecimals !== srcToken.decimals) {
2607
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2617
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2608
2618
  "fromDecimals",
2609
2619
  params.fromDecimals,
2610
2620
  `${method}: ${asset} has ${srcToken.decimals} decimals on "${fromChain}", not ${params.fromDecimals}. The native OFT route parses the amount with the token's own decimals; fromDecimals applies to LI.FI routes only.`
@@ -2636,7 +2646,7 @@ var LayerZeroService = class {
2636
2646
  resolveRefundAddress(refundAddress, sender, method) {
2637
2647
  if (refundAddress === void 0) return sender;
2638
2648
  if (!_viem.isAddress.call(void 0, refundAddress)) {
2639
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2649
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2640
2650
  "refundAddress",
2641
2651
  refundAddress,
2642
2652
  `${method}: invalid refundAddress "${refundAddress}"`
@@ -2679,7 +2689,7 @@ function isNativeOftRoute(fromChain, toChain, fromToken, toToken) {
2679
2689
  function selectBridge(params) {
2680
2690
  const selected = resolveBridge(params);
2681
2691
  if (selected === "lifi" && (_nullishCoalesce(params.dstNativeDrop, () => ( 0n))) > 0n) {
2682
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2692
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2683
2693
  "dstNativeDrop",
2684
2694
  params.dstNativeDrop,
2685
2695
  `bridge: dstNativeDrop is only supported on the native OFT route, and ${params.fromChain}\u2192${params.toChain} resolved to LI.FI`
@@ -2705,28 +2715,28 @@ function validateTransferParams({
2705
2715
  tokenDecimals
2706
2716
  }) {
2707
2717
  if (!_viem.isAddress.call(void 0, to)) {
2708
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2718
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2709
2719
  "to",
2710
2720
  to,
2711
2721
  `transfer: invalid recipient address "${to}"`
2712
2722
  );
2713
2723
  }
2714
2724
  if (!Number.isFinite(amount) || amount <= 0) {
2715
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2725
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2716
2726
  "amount",
2717
2727
  amount,
2718
2728
  "transfer: amount must be a finite positive number"
2719
2729
  );
2720
2730
  }
2721
2731
  if (token !== void 0 && !_viem.isAddress.call(void 0, token)) {
2722
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2732
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2723
2733
  "token",
2724
2734
  token,
2725
2735
  `transfer: invalid token address "${token}"`
2726
2736
  );
2727
2737
  }
2728
2738
  if (tokenDecimals !== void 0 && (!Number.isInteger(tokenDecimals) || tokenDecimals < 0 || tokenDecimals > 77)) {
2729
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2739
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2730
2740
  "tokenDecimals",
2731
2741
  tokenDecimals,
2732
2742
  "transfer: tokenDecimals must be an integer between 0 and 77"
@@ -2742,7 +2752,7 @@ async function resolveTokenDecimals(publicClient, token, tokenDecimals) {
2742
2752
  functionName: "decimals"
2743
2753
  });
2744
2754
  } catch (e8) {
2745
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2755
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2746
2756
  "tokenDecimals",
2747
2757
  void 0,
2748
2758
  `transfer: could not fetch decimals for token "${token}" \u2014 pass tokenDecimals explicitly`
@@ -2752,7 +2762,7 @@ async function resolveTokenDecimals(publicClient, token, tokenDecimals) {
2752
2762
  async function executeTokenTransfer(wc, publicClient, token, to, amount, tokenDecimals, acc, chain) {
2753
2763
  const code = await publicClient.getCode({ address: token });
2754
2764
  if (!code || code === "0x") {
2755
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2765
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2756
2766
  "token",
2757
2767
  token,
2758
2768
  `transfer: no contract found at "${token}" on chain ${chain.id} \u2014 check the address and network`
@@ -2802,10 +2812,10 @@ function createStable({
2802
2812
  chain,
2803
2813
  transport: _nullishCoalesce(transport, () => ( _viem.http.call(void 0, rpc)))
2804
2814
  }) : _viem.createPublicClient.call(void 0, { chain, transport: _viem.http.call(void 0, rpc) });
2805
- const authorization = _chunkQQ26UI3Fcjs.erc3009Actions.call(void 0, erc3009Client);
2815
+ const authorization = _chunkMMZ7HVWZcjs.erc3009Actions.call(void 0, erc3009Client);
2806
2816
  function requireEarn() {
2807
2817
  if (!morpho) {
2808
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2818
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2809
2819
  "earn",
2810
2820
  void 0,
2811
2821
  "stable.earn.*: pass earn: { vault: '0x...' } to createStable() to enable earn operations"
@@ -2816,7 +2826,7 @@ function createStable({
2816
2826
  function requireSignerAddress() {
2817
2827
  const from = _nullishCoalesce(_optionalChain([walletClient, 'optionalAccess', _84 => _84.account, 'optionalAccess', _85 => _85.address]), () => ( _optionalChain([account, 'optionalAccess', _86 => _86.address])));
2818
2828
  if (!from) {
2819
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2829
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2820
2830
  "signer",
2821
2831
  void 0,
2822
2832
  "stable.rewards.*: requires a signer \u2014 set walletClient or account in StableConfig"
@@ -2836,7 +2846,7 @@ function createStable({
2836
2846
  try {
2837
2847
  await wc.switchChain({ id: chain.id });
2838
2848
  } catch (err) {
2839
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
2849
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
2840
2850
  phase: "switch_chain",
2841
2851
  shortMessage: `transfer: wallet rejected or failed to switch to chain ${chain.id}`,
2842
2852
  chainId: chain.id,
@@ -2868,7 +2878,7 @@ function createStable({
2868
2878
  );
2869
2879
  const receipt = await publicClient.waitForTransactionReceipt({ hash });
2870
2880
  if (receipt.status === "reverted") {
2871
- throw new (0, _chunkQQ26UI3Fcjs.StableTransactionError)({
2881
+ throw new (0, _chunkMMZ7HVWZcjs.StableTransactionError)({
2872
2882
  phase: "receipt",
2873
2883
  shortMessage: "transfer: transaction reverted on-chain",
2874
2884
  txHash: receipt.transactionHash,
@@ -2885,7 +2895,7 @@ function createStable({
2885
2895
  bridge: async (params) => selectBridge(params) === "oft" ? lz.bridge(params) : lifi.bridge(params),
2886
2896
  prepareBridgeCalldata: async (params) => {
2887
2897
  if (selectBridge(params) !== "oft") {
2888
- throw new (0, _chunkQQ26UI3Fcjs.StableValidationError)(
2898
+ throw new (0, _chunkMMZ7HVWZcjs.StableValidationError)(
2889
2899
  "route",
2890
2900
  _nullishCoalesce(params.route, () => ( "auto")),
2891
2901
  `prepareBridgeCalldata: only the native OFT route can be built unsigned, and ${params.fromChain}\u2192${params.toChain} resolved to LI.FI`
@@ -2963,4 +2973,5 @@ function createStableReader(config) {
2963
2973
 
2964
2974
 
2965
2975
 
2966
- exports.BRIDGE_CHAIN_CONFIGS = BRIDGE_CHAIN_CONFIGS; exports.CHAIN_CONFIGS = CHAIN_CONFIGS; exports.Chain = Chain; exports.ERC3009_ABI = _chunkQQ26UI3Fcjs.ERC3009_ABI; exports.Network = Network; exports.OFT_ADAPTER_ABI = OFT_ADAPTER_ABI; exports.STABLE_USDT_ADDRESS = _chunkQQ26UI3Fcjs.STABLE_USDT_ADDRESS; exports.STABLE_VAULT_ADDRESS = _chunkQQ26UI3Fcjs.STABLE_VAULT_ADDRESS; exports.StableBulkError = _chunkQQ26UI3Fcjs.StableBulkError; exports.StableError = _chunkQQ26UI3Fcjs.StableError; exports.StableNetworkError = _chunkQQ26UI3Fcjs.StableNetworkError; exports.StableQuoteError = _chunkQQ26UI3Fcjs.StableQuoteError; exports.StableTransactionError = _chunkQQ26UI3Fcjs.StableTransactionError; exports.StableValidationError = _chunkQQ26UI3Fcjs.StableValidationError; exports.bridgeAssetFor = bridgeAssetFor; exports.buildLzOptions = buildLzOptions; exports.cancelAuthorization = _chunkQQ26UI3Fcjs.cancelAuthorization; exports.clearBridgeEstimateCache = clearBridgeEstimateCache; exports.createStable = createStable; exports.createStableReader = createStableReader; exports.erc3009Actions = _chunkQQ26UI3Fcjs.erc3009Actions; exports.getAuthorizationState = _chunkQQ26UI3Fcjs.getAuthorizationState; exports.getAuthorizationUsage = _chunkQQ26UI3Fcjs.getAuthorizationUsage; exports.prepareTransferWithAuthorization = _chunkQQ26UI3Fcjs.prepareTransferWithAuthorization; exports.receiveWithAuthorization = _chunkQQ26UI3Fcjs.receiveWithAuthorization; exports.signReceiveAuthorization = _chunkQQ26UI3Fcjs.signReceiveAuthorization; exports.signTransferAuthorization = _chunkQQ26UI3Fcjs.signTransferAuthorization; exports.transferWithAuthorization = _chunkQQ26UI3Fcjs.transferWithAuthorization; exports.verifyAuthorization = _chunkQQ26UI3Fcjs.verifyAuthorization;
2976
+
2977
+ exports.BRIDGE_CHAIN_CONFIGS = BRIDGE_CHAIN_CONFIGS; exports.CHAIN_CONFIGS = CHAIN_CONFIGS; exports.Chain = Chain; exports.ERC3009_ABI = _chunkMMZ7HVWZcjs.ERC3009_ABI; exports.Network = Network; exports.OFT_ADAPTER_ABI = OFT_ADAPTER_ABI; exports.STABLE_PYUSD_ADDRESS = _chunkMMZ7HVWZcjs.STABLE_PYUSD_ADDRESS; exports.STABLE_USDT_ADDRESS = _chunkMMZ7HVWZcjs.STABLE_USDT_ADDRESS; exports.STABLE_VAULT_ADDRESS = _chunkMMZ7HVWZcjs.STABLE_VAULT_ADDRESS; exports.StableBulkError = _chunkMMZ7HVWZcjs.StableBulkError; exports.StableError = _chunkMMZ7HVWZcjs.StableError; exports.StableNetworkError = _chunkMMZ7HVWZcjs.StableNetworkError; exports.StableQuoteError = _chunkMMZ7HVWZcjs.StableQuoteError; exports.StableTransactionError = _chunkMMZ7HVWZcjs.StableTransactionError; exports.StableValidationError = _chunkMMZ7HVWZcjs.StableValidationError; exports.bridgeAssetFor = bridgeAssetFor; exports.buildLzOptions = buildLzOptions; exports.cancelAuthorization = _chunkMMZ7HVWZcjs.cancelAuthorization; exports.clearBridgeEstimateCache = clearBridgeEstimateCache; exports.createStable = createStable; exports.createStableReader = createStableReader; exports.erc3009Actions = _chunkMMZ7HVWZcjs.erc3009Actions; exports.getAuthorizationState = _chunkMMZ7HVWZcjs.getAuthorizationState; exports.getAuthorizationUsage = _chunkMMZ7HVWZcjs.getAuthorizationUsage; exports.prepareTransferWithAuthorization = _chunkMMZ7HVWZcjs.prepareTransferWithAuthorization; exports.receiveWithAuthorization = _chunkMMZ7HVWZcjs.receiveWithAuthorization; exports.signReceiveAuthorization = _chunkMMZ7HVWZcjs.signReceiveAuthorization; exports.signTransferAuthorization = _chunkMMZ7HVWZcjs.signTransferAuthorization; exports.transferWithAuthorization = _chunkMMZ7HVWZcjs.transferWithAuthorization; exports.verifyAuthorization = _chunkMMZ7HVWZcjs.verifyAuthorization;