@sodax/sdk 0.0.1-rc.17 → 0.0.1-rc.19

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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { getAbiItem, fromHex, createPublicClient, http, toHex, encodeAbiParameters, parseAbiParameters, erc20Abi as erc20Abi$1, encodeFunctionData, isAddress, decodeAbiParameters, encodePacked, parseEventLogs, keccak256 } from 'viem';
2
2
  import { nibiru, polygon, bsc, optimism, base, arbitrum, avalanche, sonic } from 'viem/chains';
3
- import { ICON_MAINNET_CHAIN_ID, SUI_MAINNET_CHAIN_ID, STELLAR_MAINNET_CHAIN_ID, INJECTIVE_MAINNET_CHAIN_ID, POLYGON_MAINNET_CHAIN_ID, BSC_MAINNET_CHAIN_ID, OPTIMISM_MAINNET_CHAIN_ID, BASE_MAINNET_CHAIN_ID, ARBITRUM_MAINNET_CHAIN_ID, NIBIRU_MAINNET_CHAIN_ID, AVALANCHE_MAINNET_CHAIN_ID, SOLANA_MAINNET_CHAIN_ID, SONIC_MAINNET_CHAIN_ID, SPOKE_CHAIN_IDS } from '@sodax/types';
3
+ import { SPOKE_CHAIN_IDS, ICON_MAINNET_CHAIN_ID, SUI_MAINNET_CHAIN_ID, STELLAR_MAINNET_CHAIN_ID, INJECTIVE_MAINNET_CHAIN_ID, POLYGON_MAINNET_CHAIN_ID, BSC_MAINNET_CHAIN_ID, OPTIMISM_MAINNET_CHAIN_ID, BASE_MAINNET_CHAIN_ID, ARBITRUM_MAINNET_CHAIN_ID, NIBIRU_MAINNET_CHAIN_ID, AVALANCHE_MAINNET_CHAIN_ID, SOLANA_MAINNET_CHAIN_ID, SONIC_MAINNET_CHAIN_ID } from '@sodax/types';
4
4
  export * from '@sodax/types';
5
5
  import { ChainGrpcWasmApi, TxGrpcApi, toBase64 } from '@injectivelabs/sdk-ts';
6
6
  import { getNetworkEndpoints, Network } from '@injectivelabs/networks';
@@ -6188,12 +6188,9 @@ var hubChainConfig = {
6188
6188
  assetManager: "0x60c5681bD1DB4e50735c4cA3386005A4BA4937C0",
6189
6189
  hubWallet: "0xA0ed3047D358648F2C0583B415CffCA571FDB544",
6190
6190
  xTokenManager: "0x5bD2843de9D6b0e6A05d0FB742072274EA3C6CA3",
6191
- icxMigration: "0x8Af7cae2c8377BEDD8820A5ad096AaFA29D839cc",
6192
- // TODO update with "final" address before migration
6191
+ icxMigration: "0x8294DE9fc60F5ABCc19245E5857071d7C42B9875",
6193
6192
  balnSwap: "0x610a90B61b89a98b954d5750E94834Aa45d08d10",
6194
- // TODO update with "final" address before migration
6195
- sodaToken: "0x8515352CB9832D1d379D52366D1E995ADd358420"
6196
- // TODO update with "final" address before migration
6193
+ sodaToken: "0x7c7d53eecda37a87ce0d5bf8e0b24512a48dc963"
6197
6194
  },
6198
6195
  nativeToken: "0x0000000000000000000000000000000000000000",
6199
6196
  supportedTokens: []
@@ -6212,7 +6209,7 @@ var spokeChainConfig = {
6212
6209
  wrappedSonic: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38"
6213
6210
  },
6214
6211
  nativeToken: "0x0000000000000000000000000000000000000000",
6215
- bnUSD: "0x6958a4CBFe11406E2a1c1d3a71A1971aD8B3b92F",
6212
+ bnUSD: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131",
6216
6213
  supportedTokens: {
6217
6214
  S: {
6218
6215
  symbol: "S",
@@ -6220,6 +6217,12 @@ var spokeChainConfig = {
6220
6217
  decimals: 18,
6221
6218
  address: "0x0000000000000000000000000000000000000000"
6222
6219
  },
6220
+ bnUSD: {
6221
+ symbol: "bnUSD",
6222
+ name: "bnUSD",
6223
+ decimals: 18,
6224
+ address: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6225
+ },
6223
6226
  WETH: {
6224
6227
  symbol: "WETH",
6225
6228
  name: "Wrapped Ether",
@@ -6788,6 +6791,14 @@ var spokeChainConfig = {
6788
6791
  address: "cx3975b43d260fb8ec802cef6e60c2f4d07486f11d"
6789
6792
  },
6790
6793
  bnUSD: {
6794
+ // same as legacy
6795
+ symbol: "bnUSD",
6796
+ name: "bnUSD",
6797
+ decimals: 18,
6798
+ address: "cx88fd7df7ddff82f7cc735c871dc519838cb235bb"
6799
+ },
6800
+ legacybnUSD: {
6801
+ // duplicate of bnUSD purely for consistency with other legacy tokens chains (sui, stellar)
6791
6802
  symbol: "bnUSD",
6792
6803
  name: "bnUSD",
6793
6804
  decimals: 18,
@@ -6825,6 +6836,7 @@ var HubVaultSymbols = [
6825
6836
  ];
6826
6837
  var hubVaults = {
6827
6838
  IbnUSD: {
6839
+ // ICON bnUSD (Migration) vault on Sonic contains legacy bnUSD tokens (stellar, sui, icon)
6828
6840
  address: "0x9D4b663Eb075d2a1C7B8eaEFB9eCCC0510388B51",
6829
6841
  reserves: [
6830
6842
  // hub asset addresses contained in the vault
@@ -6855,6 +6867,7 @@ var hubVaults = {
6855
6867
  ]
6856
6868
  },
6857
6869
  bnUSD: {
6870
+ // new bnUSD vault on Sonic (also contains IbnUSD vault token as part of it)
6858
6871
  address: "0xe801ca34e19abcbfea12025378d19c4fbe250131",
6859
6872
  reserves: [
6860
6873
  // hub asset addresses contained in the vault
@@ -7000,6 +7013,42 @@ var hubVaults = {
7000
7013
  ]
7001
7014
  }
7002
7015
  };
7016
+ var bnUSDLegacySpokeChainIds = [
7017
+ ICON_MAINNET_CHAIN_ID,
7018
+ SUI_MAINNET_CHAIN_ID,
7019
+ STELLAR_MAINNET_CHAIN_ID
7020
+ ];
7021
+ var newbnUSDSpokeChainIds = SPOKE_CHAIN_IDS.filter((chainId) => chainId !== ICON_MAINNET_CHAIN_ID);
7022
+ var bnUSDLegacyTokens = [
7023
+ spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
7024
+ spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.legacybnUSD,
7025
+ spokeChainConfig[STELLAR_MAINNET_CHAIN_ID].supportedTokens.legacybnUSD
7026
+ ];
7027
+ var bnUSDNewTokens = newbnUSDSpokeChainIds.map((chainId) => spokeChainConfig[chainId].supportedTokens.bnUSD);
7028
+ var isLegacybnUSDChainId = (chainId) => {
7029
+ return bnUSDLegacySpokeChainIds.includes(chainId);
7030
+ };
7031
+ var isNewbnUSDChainId = (chainId) => {
7032
+ return newbnUSDSpokeChainIds.includes(chainId);
7033
+ };
7034
+ var isLegacybnUSDToken = (token) => {
7035
+ if (typeof token === "string") {
7036
+ return bnUSDLegacyTokens.some((t) => t.address.toLowerCase() === token.toLowerCase());
7037
+ }
7038
+ return bnUSDLegacyTokens.some((t) => t.address.toLowerCase() === token.address.toLowerCase());
7039
+ };
7040
+ var isNewbnUSDToken = (token) => {
7041
+ if (typeof token === "string") {
7042
+ return newbnUSDSpokeChainIds.map((chainId) => spokeChainConfig[chainId].supportedTokens.bnUSD).some((t) => t.address.toLowerCase() === token.toLowerCase());
7043
+ }
7044
+ return newbnUSDSpokeChainIds.map((chainId) => spokeChainConfig[chainId].supportedTokens.bnUSD).some((t) => t.address.toLowerCase() === token.address.toLowerCase());
7045
+ };
7046
+ var getAllLegacybnUSDTokens = () => {
7047
+ return bnUSDLegacySpokeChainIds.map((chainId) => ({
7048
+ token: spokeChainConfig[chainId].supportedTokens.legacybnUSD,
7049
+ chainId
7050
+ }));
7051
+ };
7003
7052
  var hubAssets = {
7004
7053
  [SONIC_MAINNET_CHAIN_ID]: {
7005
7054
  [spokeChainConfig[SONIC_MAINNET_CHAIN_ID].nativeToken]: {
@@ -7353,7 +7402,7 @@ var hubAssets = {
7353
7402
  decimal: 18,
7354
7403
  symbol: "legacybnUSD",
7355
7404
  name: "legacybnUSD",
7356
- vault: "0x9D4b663Eb075d2a1C7B8eaEFB9eCCC0510388B51"
7405
+ vault: hubVaults.IbnUSD.address
7357
7406
  }
7358
7407
  },
7359
7408
  [SUI_MAINNET_CHAIN_ID]: {
@@ -7431,7 +7480,7 @@ var hubAssets = {
7431
7480
  decimal: 9,
7432
7481
  symbol: "bnUSD",
7433
7482
  name: "legacybnUSD",
7434
- vault: "0x9D4b663Eb075d2a1C7B8eaEFB9eCCC0510388B51"
7483
+ vault: hubVaults.IbnUSD.address
7435
7484
  }
7436
7485
  },
7437
7486
  [SOLANA_MAINNET_CHAIN_ID]: {
@@ -7478,7 +7527,7 @@ var hubAssets = {
7478
7527
  decimal: 18,
7479
7528
  symbol: "bnUSD",
7480
7529
  name: "bnUSD",
7481
- vault: hubVaults.bnUSD.address
7530
+ vault: hubVaults.IbnUSD.address
7482
7531
  },
7483
7532
  [spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.BALN.address]: {
7484
7533
  asset: "0xde8e19a099fedf9d617599f62c5f7f020d92b572",
@@ -7678,28 +7727,6 @@ var moneyMarketSupportedTokens = {
7678
7727
  spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.wS
7679
7728
  ]
7680
7729
  };
7681
- var migrationConfig = {
7682
- bnUSD: {
7683
- [ICON_MAINNET_CHAIN_ID]: {
7684
- legacybnUSD: spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
7685
- newbnUSD: hubVaults.bnUSD.address
7686
- },
7687
- [SUI_MAINNET_CHAIN_ID]: {
7688
- legacybnUSD: spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.legacybnUSD,
7689
- newbnUSD: hubVaults.bnUSD.address
7690
- },
7691
- [STELLAR_MAINNET_CHAIN_ID]: {
7692
- legacybnUSD: spokeChainConfig[STELLAR_MAINNET_CHAIN_ID].supportedTokens.legacybnUSD,
7693
- newbnUSD: hubVaults.bnUSD.address
7694
- }
7695
- },
7696
- ICX: {
7697
- [ICON_MAINNET_CHAIN_ID]: {
7698
- icx: spokeChainConfig[ICON_MAINNET_CHAIN_ID]["nativeToken"],
7699
- wICX: spokeChainConfig[ICON_MAINNET_CHAIN_ID]["addresses"]["wICX"]
7700
- }
7701
- }
7702
- };
7703
7730
  var isMoneyMarketSupportedToken = (chainId, token) => moneyMarketSupportedTokens[chainId].some((t) => t.address.toLowerCase() === token.toLowerCase());
7704
7731
  var getSupportedMoneyMarketTokens = (chainId) => moneyMarketSupportedTokens[chainId];
7705
7732
  var hubVaultsAddressSet = new Set(
@@ -9465,7 +9492,7 @@ var MoneyMarketService = class _MoneyMarketService {
9465
9492
  }
9466
9493
  }
9467
9494
  /**
9468
- * Create supply intent only (without submitting to Solver API)
9495
+ * Create supply intent only (without relay submit to Solver API)
9469
9496
  * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
9470
9497
  * In order to successfully supply tokens, you need to:
9471
9498
  * 1. Check if the allowance is sufficient
@@ -9623,7 +9650,7 @@ var MoneyMarketService = class _MoneyMarketService {
9623
9650
  }
9624
9651
  }
9625
9652
  /**
9626
- * Create borrow intent only (without submitting to Solver API)
9653
+ * Create borrow intent only (without relay and submit to Solver API)
9627
9654
  * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
9628
9655
  * In order to successfully borrow tokens, you need to:
9629
9656
  * 1. Execute the borrow transaction on the spoke chain
@@ -9758,7 +9785,7 @@ var MoneyMarketService = class _MoneyMarketService {
9758
9785
  }
9759
9786
  }
9760
9787
  /**
9761
- * Create withdraw intent only (without submitting to Solver API)
9788
+ * Create withdraw intent only (without relay and submit to Solver API)
9762
9789
  * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
9763
9790
  * In order to successfully withdraw tokens, you need to:
9764
9791
  * 1. Execute the withdraw transaction on the spoke chain
@@ -9893,7 +9920,7 @@ var MoneyMarketService = class _MoneyMarketService {
9893
9920
  }
9894
9921
  }
9895
9922
  /**
9896
- * Create repay intent only (without submitting to Solver API)
9923
+ * Create repay intent only (without relay and submit to Solver API)
9897
9924
  * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
9898
9925
  * In order to successfully repay tokens, you need to:
9899
9926
  * 1. Check if the allowance is sufficient
@@ -11597,7 +11624,7 @@ function isSuiSpokeProvider(value) {
11597
11624
  return typeof value === "object" && value !== null && value instanceof SuiSpokeProvider && value.chainConfig.chain.type === "SUI";
11598
11625
  }
11599
11626
  function isConfiguredSolverConfig(value) {
11600
- return typeof value === "object" && value !== null && "intentsContract" in value && "solverApiEndpoint" in value && "relayerApiEndpoint" in value;
11627
+ return typeof value === "object" && value !== null && "intentsContract" in value && "solverApiEndpoint" in value;
11601
11628
  }
11602
11629
  function isConfiguredMoneyMarketConfig(value) {
11603
11630
  return typeof value === "object" && value !== null && "lendingPool" in value && "uiPoolDataProvider" in value && "poolAddressesProvider" in value && "bnUSD" in value && "bnUSDVault" in value;
@@ -11647,6 +11674,18 @@ function isMoneyMarketWithdrawUnknownError(error) {
11647
11674
  function isMoneyMarketRepayUnknownError(error) {
11648
11675
  return typeof error === "object" && error !== null && "code" in error && error.code === "REPAY_UNKNOWN_ERROR";
11649
11676
  }
11677
+ function isIcxMigrateParams(value) {
11678
+ return typeof value === "object" && value !== null && "address" in value && "amount" in value && "to" in value;
11679
+ }
11680
+ function isUnifiedBnUSDMigrateParams(value) {
11681
+ return typeof value === "object" && value !== null && "srcChainId" in value && "srcbnUSD" in value && "dstChainId" in value && "dstbnUSD" in value && "amount" in value && "to" in value;
11682
+ }
11683
+ function isBalnMigrateParams(value) {
11684
+ return typeof value === "object" && value !== null && "amount" in value && "lockupPeriod" in value && "to" in value && "stake" in value;
11685
+ }
11686
+ function isIcxCreateRevertMigrationParams(value) {
11687
+ return typeof value === "object" && value !== null && "amount" in value && "to" in value;
11688
+ }
11650
11689
 
11651
11690
  // src/services/spoke/SpokeService.ts
11652
11691
  var SpokeService = class {
@@ -12529,8 +12568,8 @@ var SolverService = class {
12529
12568
  * // handle error
12530
12569
  * }
12531
12570
  */
12532
- async swap(payload, spokeProvider, fee, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
12533
- return this.createAndSubmitIntent(payload, spokeProvider, fee, timeout);
12571
+ async swap(payload, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
12572
+ return this.createAndSubmitIntent(payload, spokeProvider, this.config.partnerFee, timeout);
12534
12573
  }
12535
12574
  /**
12536
12575
  * Creates an intent and submits it to the Solver API and Relayer API
@@ -12566,7 +12605,7 @@ var SolverService = class {
12566
12605
  * // handle error
12567
12606
  * }
12568
12607
  */
12569
- async createAndSubmitIntent(payload, spokeProvider, fee, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
12608
+ async createAndSubmitIntent(payload, spokeProvider, fee = this.config.partnerFee, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
12570
12609
  try {
12571
12610
  const createIntentResult = await this.createIntent(payload, spokeProvider, fee, false);
12572
12611
  if (!createIntentResult.ok) {
@@ -13474,9 +13513,25 @@ var MigrationService = class {
13474
13513
  invariant2(params.amount > 0n, "Amount must be greater than 0");
13475
13514
  invariant2(isAddress(params.to) || isIconAddress(params.to), "To address is required");
13476
13515
  invariant2(
13477
- spokeProvider instanceof IconSpokeProvider || spokeProvider instanceof SuiSpokeProvider || spokeProvider instanceof StellarSpokeProvider,
13478
- "Spoke provider must be an instance of IconSpokeProvider, SuiSpokeProvider, or StellarSpokeProvider"
13516
+ isIcxMigrateParams(params) || isBalnMigrateParams(params) || isUnifiedBnUSDMigrateParams(params),
13517
+ "Invalid params"
13479
13518
  );
13519
+ if (spokeProvider instanceof IconSpokeProvider && (isIcxMigrateParams(params) || isBalnMigrateParams(params))) {
13520
+ return {
13521
+ ok: true,
13522
+ value: true
13523
+ };
13524
+ }
13525
+ if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
13526
+ const evmSpokeProvider = spokeProvider;
13527
+ return await Erc20Service.isAllowanceValid(
13528
+ params.srcbnUSD,
13529
+ params.amount,
13530
+ await evmSpokeProvider.walletProvider.getWalletAddress(),
13531
+ evmSpokeProvider instanceof EvmSpokeProvider ? evmSpokeProvider.chainConfig.addresses.assetManager : evmSpokeProvider.chainConfig.bnUSD,
13532
+ evmSpokeProvider
13533
+ );
13534
+ }
13480
13535
  return {
13481
13536
  ok: true,
13482
13537
  value: true
@@ -13485,19 +13540,28 @@ var MigrationService = class {
13485
13540
  if (action === "revert") {
13486
13541
  invariant2(params.amount > 0n, "Amount must be greater than 0");
13487
13542
  invariant2(params.to.length > 0, "To address is required");
13488
- invariant2(
13489
- spokeProvider instanceof SonicSpokeProvider,
13490
- "Spoke provider must be an instance of SonicSpokeProvider"
13491
- );
13492
- const wallet = await spokeProvider.walletProvider.getWalletAddress();
13493
- const userRouter = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
13494
- return await Erc20Service.isAllowanceValid(
13495
- this.hubProvider.chainConfig.addresses.sodaToken,
13496
- params.amount,
13497
- wallet,
13498
- userRouter,
13499
- spokeProvider
13500
- );
13543
+ invariant2(isIcxCreateRevertMigrationParams(params) || isUnifiedBnUSDMigrateParams(params), "Invalid params");
13544
+ if (spokeProvider instanceof SonicSpokeProvider && isIcxCreateRevertMigrationParams(params)) {
13545
+ const wallet = await spokeProvider.walletProvider.getWalletAddress();
13546
+ const userRouter = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
13547
+ return await Erc20Service.isAllowanceValid(
13548
+ this.hubProvider.chainConfig.addresses.sodaToken,
13549
+ params.amount,
13550
+ wallet,
13551
+ userRouter,
13552
+ spokeProvider
13553
+ );
13554
+ }
13555
+ if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
13556
+ const evmSpokeProvider = spokeProvider;
13557
+ return await Erc20Service.isAllowanceValid(
13558
+ params.srcbnUSD,
13559
+ params.amount,
13560
+ await evmSpokeProvider.walletProvider.getWalletAddress(),
13561
+ evmSpokeProvider instanceof EvmSpokeProvider ? evmSpokeProvider.chainConfig.addresses.assetManager : evmSpokeProvider.chainConfig.bnUSD,
13562
+ evmSpokeProvider
13563
+ );
13564
+ }
13501
13565
  }
13502
13566
  return {
13503
13567
  ok: false,
@@ -13531,25 +13595,65 @@ var MigrationService = class {
13531
13595
  */
13532
13596
  async approve(params, action, spokeProvider, raw) {
13533
13597
  try {
13598
+ if (action === "migrate") {
13599
+ invariant2(params.amount > 0n, "Amount must be greater than 0");
13600
+ invariant2(params.to.length > 0, "To address is required");
13601
+ invariant2(isUnifiedBnUSDMigrateParams(params), "Invalid params");
13602
+ if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
13603
+ const evmSpokeProvider = spokeProvider;
13604
+ const result = await Erc20Service.approve(
13605
+ params.srcbnUSD,
13606
+ params.amount,
13607
+ evmSpokeProvider instanceof EvmSpokeProvider ? evmSpokeProvider.chainConfig.addresses.assetManager : evmSpokeProvider.chainConfig.bnUSD,
13608
+ evmSpokeProvider,
13609
+ raw
13610
+ );
13611
+ return {
13612
+ ok: true,
13613
+ value: result
13614
+ };
13615
+ }
13616
+ return {
13617
+ ok: false,
13618
+ error: new Error("Invalid params for migrate action")
13619
+ };
13620
+ }
13534
13621
  if (action === "revert") {
13535
13622
  invariant2(params.amount > 0n, "Amount must be greater than 0");
13536
13623
  invariant2(params.to.length > 0, "To address is required");
13537
- invariant2(
13538
- spokeProvider instanceof SonicSpokeProvider,
13539
- "Spoke provider must be an instance of SonicSpokeProvider"
13540
- );
13541
- const wallet = await spokeProvider.walletProvider.getWalletAddress();
13542
- const userRouter = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
13543
- const result = await Erc20Service.approve(
13544
- this.hubProvider.chainConfig.addresses.sodaToken,
13545
- params.amount,
13546
- userRouter,
13547
- spokeProvider,
13548
- raw
13549
- );
13624
+ invariant2(isIcxCreateRevertMigrationParams(params) || isUnifiedBnUSDMigrateParams(params), "Invalid params");
13625
+ if (spokeProvider instanceof SonicSpokeProvider && isIcxCreateRevertMigrationParams(params)) {
13626
+ const wallet = await spokeProvider.walletProvider.getWalletAddress();
13627
+ const userRouter = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
13628
+ const result = await Erc20Service.approve(
13629
+ this.hubProvider.chainConfig.addresses.sodaToken,
13630
+ params.amount,
13631
+ userRouter,
13632
+ spokeProvider,
13633
+ raw
13634
+ );
13635
+ return {
13636
+ ok: true,
13637
+ value: result
13638
+ };
13639
+ }
13640
+ if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
13641
+ const evmSpokeProvider = spokeProvider;
13642
+ const result = await Erc20Service.approve(
13643
+ params.srcbnUSD,
13644
+ params.amount,
13645
+ evmSpokeProvider instanceof EvmSpokeProvider ? evmSpokeProvider.chainConfig.addresses.assetManager : evmSpokeProvider.chainConfig.bnUSD,
13646
+ evmSpokeProvider,
13647
+ raw
13648
+ );
13649
+ return {
13650
+ ok: true,
13651
+ value: result
13652
+ };
13653
+ }
13550
13654
  return {
13551
- ok: true,
13552
- value: result
13655
+ ok: false,
13656
+ error: new Error("Invalid params or chain type for revert action")
13553
13657
  };
13554
13658
  }
13555
13659
  return {
@@ -13564,27 +13668,37 @@ var MigrationService = class {
13564
13668
  }
13565
13669
  }
13566
13670
  /**
13567
- * Migrates legacy bnUSD tokens to new bnUSD tokens on the hub chain (sonic).
13568
- * This function handles the migration of legacy bnUSD tokens to new bnUSD tokens.
13671
+ * Migrates bnUSD tokens between legacy and new formats across supported spoke chains via the hub chain (sonic).
13672
+ * Handles both legacy-to-new and new-to-legacy bnUSD migrations, enforcing validation and relaying the transaction.
13569
13673
  *
13570
- * @param params - The parameters for the migration transaction.
13571
- * @param spokeProvider - The spoke provider.
13572
- * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
13674
+ * @param params - Migration parameters, including source/destination chain IDs, token addresses, amount, and recipient.
13675
+ * @param spokeProvider - The SpokeProvider instance for the source chain.
13676
+ * @param timeout - Optional timeout in milliseconds for the relay operation (default: 60 seconds).
13677
+ * @param unchecked - Optional flag to skip validation checks (default: false).
13573
13678
  * @returns {Promise<Result<[string, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
13574
- * Returns a Result containing a tuple of [spokeTxHash, hubTxHash] if successful,
13575
- * or an error describing why the migration or relay failed.
13576
- *
13679
+ * Result containing a tuple: [spokeTxHash, hubTxHash] if successful, or an error describing the failure.
13577
13680
  *
13578
13681
  * @example
13579
- * // Example: Migrate legacy bnUSD tokens to new bnUSD tokens on the hub chain (sonic)
13682
+ * // Migrate legacy bnUSD to new bnUSD
13580
13683
  * const result = await sodax.migration.migratebnUSD({
13581
- * address: 'cx88fd7df7ddff82f7cc735c871dc519838cb235bb', // mock legacy bnUSD address
13582
- * srcChainID: '0x1.icon', // source chain ID (e.g., ICON_MAINNET_CHAIN_ID)
13583
- * amount: 1000000000000000000n,
13584
- * to: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd', // recipient address
13585
- * dstChainID: 'sonic', // destination hub chain ID (e.g., SONIC_MAINNET_CHAIN_ID)
13684
+ * srcChainId: '0x1.icon', // Source chain ID (legacy)
13685
+ * dstChainId: 'sonic', // Destination chain ID (new)
13686
+ * srcbnUSD: 'cx...', // Legacy bnUSD token address
13687
+ * dstbnUSD: '0x...', // New bnUSD token address
13688
+ * amount: 1000n, // Amount to migrate
13689
+ * to: '0x...', // Recipient address on destination chain
13586
13690
  * }, iconSpokeProvider);
13587
13691
  *
13692
+ * // Reverse migration: new bnUSD to legacy bnUSD
13693
+ * const result = await sodax.migration.migratebnUSD({
13694
+ * srcChainId: 'sonic', // Source chain ID (new)
13695
+ * dstChainId: '0x1.icon', // Destination chain ID (legacy)
13696
+ * srcbnUSD: '0x...', // New bnUSD token address
13697
+ * dstbnUSD: 'cx...', // Legacy bnUSD token address
13698
+ * amount: 1000n, // Amount to migrate
13699
+ * to: 'hx...', // Recipient address on destination chain
13700
+ * }, sonicSpokeProvider);
13701
+ *
13588
13702
  * if (result.ok) {
13589
13703
  * // result.value is a tuple: [spokeTxHash, hubTxHash]
13590
13704
  * const [spokeTxHash, hubTxHash] = result.value;
@@ -13595,9 +13709,9 @@ var MigrationService = class {
13595
13709
  * console.error('[migrateBnUSD] error', result.error);
13596
13710
  * }
13597
13711
  */
13598
- async migratebnUSD(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
13712
+ async migratebnUSD(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT, unchecked = false) {
13599
13713
  try {
13600
- const txResult = await this.createMigratebnUSDIntent(params, spokeProvider);
13714
+ const txResult = await this.createMigratebnUSDIntent(params, spokeProvider, unchecked);
13601
13715
  if (!txResult.ok) {
13602
13716
  return {
13603
13717
  ok: false,
@@ -13628,70 +13742,6 @@ var MigrationService = class {
13628
13742
  };
13629
13743
  }
13630
13744
  }
13631
- /**
13632
- * Reverses the migration of legacy bnUSD tokens to new bnUSD tokens on the hub chain (sonic).
13633
- * This function handles the reversal of the migration of legacy bnUSD tokens to new bnUSD tokens.
13634
- *
13635
- * @param params - The parameters for the migration transaction.
13636
- * @param spokeProvider - The spoke provider.
13637
- * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
13638
- * @returns {Promise<Result<[string, Hex], MigrationError<'REVERT_MIGRATION_FAILED'> | MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'> | RelayError>>}
13639
- * Returns a Result containing a tuple of [spokeTxHash, hubTxHash] if successful,
13640
- * or an error describing why the revert migration or relay failed.
13641
- *
13642
- *
13643
- * @example
13644
- * // Example: Reverse the migration of legacy bnUSD tokens to new bnUSD tokens on the hub chain (sonic)
13645
- * const result = await sodax.migration.reverseMigratebnUSD({
13646
- * srcChainID: 'sonic', // source chain ID (e.g., SONIC_MAINNET_CHAIN_ID)
13647
- * amount: 1000000000000000000n,
13648
- * to: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd', // The spoke chain address that will receive the migrated legacy bnUSD tokens
13649
- * dstChainID: '0x1.icon', // destination chain ID of type bnUSDLegacySpokeChainId (e.g., ICON_MAINNET_CHAIN_ID)
13650
- * }, iconSpokeProvider);
13651
- *
13652
- * if (result.ok) {
13653
- * // result.value is a tuple: [spokeTxHash, hubTxHash]
13654
- * const [spokeTxHash, hubTxHash] = result.value;
13655
- * console.log('[reverseMigrateBnUSD] hubTxHash', hubTxHash);
13656
- * console.log('[reverseMigrateBnUSD] spokeTxHash', spokeTxHash);
13657
- * } else {
13658
- * // Handle revert migration error
13659
- * console.error('[reverseMigrateBnUSD] error', result.error);
13660
- * }
13661
- */
13662
- async reverseMigratebnUSD(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
13663
- try {
13664
- const txResult = await this.createRevertMigratebnUSDIntent(params, spokeProvider);
13665
- if (!txResult.ok) {
13666
- return {
13667
- ok: false,
13668
- error: txResult.error
13669
- };
13670
- }
13671
- const packetResult = await relayTxAndWaitPacket(
13672
- txResult.value,
13673
- void 0,
13674
- spokeProvider,
13675
- this.config.relayerApiEndpoint,
13676
- timeout
13677
- );
13678
- if (!packetResult.ok) {
13679
- return packetResult;
13680
- }
13681
- return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
13682
- } catch (error) {
13683
- return {
13684
- ok: false,
13685
- error: {
13686
- code: "REVERT_MIGRATION_FAILED",
13687
- data: {
13688
- payload: params,
13689
- error
13690
- }
13691
- }
13692
- };
13693
- }
13694
- }
13695
13745
  /**
13696
13746
  * Migrates ICX tokens to SODA tokens on the hub chain (sonic).
13697
13747
  * This function handles the migration of ICX tokens to SODA tokens.
@@ -13884,62 +13934,6 @@ var MigrationService = class {
13884
13934
  };
13885
13935
  }
13886
13936
  }
13887
- /**
13888
- * Creates a revert migration intent and submits (relays) it to the spoke chain.
13889
- * @param params - The parameters for the revert migration transaction.
13890
- * @param spokeProvider - The spoke provider.
13891
- * @param raw - Whether to return the raw transaction hash instead of the transaction receipt
13892
- * @returns {Promise<Result<TxReturnType<bnUSDLegacyMigrationProviders, R>>>} - Returns the raw transaction payload or transaction hash
13893
- *
13894
- * @example
13895
- * const result = await migrationService.createRevertMigratebnUSDIntent(
13896
- * {
13897
- * srcChainID: 'sonic', // The source chain ID where the new bnUSD token exists (hub chain)
13898
- * amount: 1000n, // The amount of new bnUSD tokens to migrate back
13899
- * to: '0x...', // The spoke chain address that will receive the migrated legacy bnUSD tokens
13900
- * dstChainID: '0x1.icon', // The destination chain ID for the migration (spoke chain)
13901
- * },
13902
- * spokeProvider, // IconSpokeProvider instance
13903
- * true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
13904
- * );
13905
- *
13906
- */
13907
- async createRevertMigratebnUSDIntent(params, spokeProvider, raw) {
13908
- try {
13909
- const { legacybnUSD, newbnUSD } = migrationConfig.bnUSD[params.dstChainID];
13910
- const migrationData = this.bnUSDMigrationService.revertMigrationData({
13911
- ...params,
13912
- legacybnUSD: legacybnUSD.address,
13913
- newbnUSD
13914
- });
13915
- const txResult = await SpokeService.deposit(
13916
- {
13917
- from: await spokeProvider.walletProvider.getWalletAddressBytes(),
13918
- token: newbnUSD,
13919
- amount: params.amount,
13920
- data: migrationData
13921
- },
13922
- spokeProvider,
13923
- this.hubProvider,
13924
- raw
13925
- );
13926
- return {
13927
- ok: true,
13928
- value: txResult
13929
- };
13930
- } catch (error) {
13931
- return {
13932
- ok: false,
13933
- error: {
13934
- code: "CREATE_REVERT_MIGRATION_INTENT_FAILED",
13935
- data: {
13936
- payload: params,
13937
- error
13938
- }
13939
- }
13940
- };
13941
- }
13942
- }
13943
13937
  /**
13944
13938
  * Creates a BALN migration intent on spoke chain (icon).
13945
13939
  *
@@ -13994,39 +13988,112 @@ var MigrationService = class {
13994
13988
  }
13995
13989
  }
13996
13990
  /**
13997
- * Creates a bnUSD migration intent on spoke chain (icon).
13991
+ * Creates a bnUSD migration or reverse migration (legacy bnUSD to new bnUSD or vice versa) intent on a spoke chain.
13998
13992
  *
13999
- * @param params - The parameters for the bnUSD migration transaction.
14000
- * @param spokeProvider - The spoke provider.
14001
- * @param raw - Whether to return the raw transaction hash instead of the transaction receipt
14002
- * @returns {Promise<Result<TxReturnType<bnUSDLegacyMigrationProviders, R>>>} - Returns the raw transaction payload or transaction hash
13993
+ * This function prepares the transaction data for migrating legacy bnUSD to new bnUSD,
13994
+ * or for reverting (migrating new bnUSD back to legacy bnUSD), depending on the provided parameters.
13995
+ * It performs validation on chain IDs and token addresses unless `unchecked` is set to true.
13996
+ *
13997
+ * @param params - The parameters for the bnUSD migration or reverse migration transaction.
13998
+ * @param spokeProvider - The spoke provider instance for the source chain.
13999
+ * @param unchecked - If true, skips input validation (use with caution).
14000
+ * @param raw - If true, returns the raw transaction hash instead of the transaction receipt.
14001
+ * @returns {Promise<Result<TxReturnType<S, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>}
14002
+ * Returns a Result containing the transaction payload or hash, or an error if creation failed.
14003
14003
  *
14004
14004
  * @example
14005
+ * // Migrate legacy bnUSD to new bnUSD
14005
14006
  * const result = await migrationService.createMigratebnUSDIntent(
14006
14007
  * {
14007
- * srcChainID: 'sonic', // The source chain ID where the legacy bnUSD token exists (spoke chain)
14008
- * amount: 1000n, // The amount of legacy bnUSD tokens to migrate
14009
- * to: '0x...', // The hub (sonic) chain address that will receive the migrated new bnUSD tokens
14010
- * dstChainID: '0x1.icon', // The destination chain ID for the migration (hub chain)
14011
- * },
14012
- * spokeProvider, // IconSpokeProvider instance
14013
- * true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
14008
+ * srcChainId: '0x1.icon', // Source chain ID (legacy bnUSD chain)
14009
+ * dstChainId: 'sonic', // Destination chain ID (new bnUSD chain)
14010
+ * srcbnUSD: 'cx...', // Legacy bnUSD token address
14011
+ * dstbnUSD: '0x...', // New bnUSD token address
14012
+ * amount: 1000n, // Amount to migrate
14013
+ * to: '0x...', // Recipient address on destination chain
14014
+ * } satisfies UnifiedBnUSDMigrateParams,
14015
+ * spokeProvider, // SpokeProvider instance
14016
+ * false, // Optional unchecked flag (validation is skipped)
14017
+ * true // Optional raw flag
14014
14018
  * );
14015
14019
  *
14020
+ * // Reverse migration: new bnUSD to legacy bnUSD
14021
+ * const result = await migrationService.createMigratebnUSDIntent(
14022
+ * {
14023
+ * srcChainId: 'sonic', // Source chain ID (new bnUSD chain)
14024
+ * dstChainId: '0x1.icon', // Destination chain ID (legacy bnUSD chain)
14025
+ * srcbnUSD: '0x...', // New bnUSD token address
14026
+ * dstbnUSD: 'cx...', // Legacy bnUSD token address
14027
+ * amount: 1000n, // Amount to migrate
14028
+ * to: 'hx...', // Recipient address on destination chain
14029
+ * } satisfies UnifiedBnUSDMigrateParams,
14030
+ * spokeProvider
14031
+ * );
14016
14032
  */
14017
- async createMigratebnUSDIntent(params, spokeProvider, raw) {
14033
+ async createMigratebnUSDIntent(params, spokeProvider, unchecked = false, raw) {
14018
14034
  try {
14019
- const { legacybnUSD, newbnUSD } = migrationConfig.bnUSD[params.srcChainID];
14020
- const migrationData = this.bnUSDMigrationService.migrateData({
14021
- ...params,
14022
- to: encodeAddress(this.hubProvider.chainConfig.chain.id, params.to),
14023
- legacybnUSD: legacybnUSD.address,
14024
- newbnUSD
14025
- });
14035
+ if (!unchecked) {
14036
+ invariant2(isValidSpokeChainId(params.srcChainId), "Invalid spoke source chain ID");
14037
+ invariant2(isValidSpokeChainId(params.dstChainId), "Invalid spoke destination chain ID");
14038
+ invariant2(params.srcbnUSD.length > 0, "Legacy bnUSD token address is required");
14039
+ invariant2(params.dstbnUSD.length > 0, "New bnUSD token address is required");
14040
+ invariant2(params.amount > 0, "Amount must be greater than 0");
14041
+ invariant2(params.to.length > 0, "Recipient address is required");
14042
+ invariant2(
14043
+ !(isLegacybnUSDToken(params.srcbnUSD) && isLegacybnUSDToken(params.dstbnUSD)),
14044
+ "srcbnUSD and dstbnUSD cannot both be legacy bnUSD tokens"
14045
+ );
14046
+ }
14047
+ let migrationData;
14048
+ if (isLegacybnUSDToken(params.srcbnUSD)) {
14049
+ if (!unchecked) {
14050
+ invariant2(
14051
+ isLegacybnUSDChainId(params.srcChainId),
14052
+ "srcChainId must be a legacy bnUSD chain (icon, sui, stellar) if srcbnUSD is a legacy bnUSD token"
14053
+ );
14054
+ invariant2(
14055
+ isNewbnUSDChainId(params.dstChainId),
14056
+ "dstChainId must be a new bnUSD chain (all spoke chains besides Icon) if dstbnUSD is a legacy bnUSD token"
14057
+ );
14058
+ }
14059
+ migrationData = this.bnUSDMigrationService.migrateData({
14060
+ srcChainId: params.srcChainId,
14061
+ legacybnUSD: params.srcbnUSD,
14062
+ newbnUSD: params.dstbnUSD,
14063
+ dstChainId: params.dstChainId,
14064
+ amount: params.amount,
14065
+ to: encodeAddress(params.dstChainId, params.to)
14066
+ });
14067
+ } else if (isLegacybnUSDToken(params.dstbnUSD)) {
14068
+ if (!unchecked) {
14069
+ invariant2(
14070
+ isLegacybnUSDChainId(params.dstChainId),
14071
+ "dstChainId must be a legacy bnUSD chain (sui, stellar, icon) if dstbnUSD is a legacy bnUSD token"
14072
+ );
14073
+ invariant2(
14074
+ isNewbnUSDToken(params.srcbnUSD),
14075
+ "srcbnUSD must be a new bnUSD token if dstbnUSD is a legacy bnUSD token"
14076
+ );
14077
+ invariant2(
14078
+ isNewbnUSDChainId(params.srcChainId),
14079
+ "srcChainId must be a new bnUSD chain (all spoke chains besides Icon) if srcbnUSD is a new bnUSD token"
14080
+ );
14081
+ }
14082
+ migrationData = this.bnUSDMigrationService.revertMigrationData({
14083
+ srcChainId: params.srcChainId,
14084
+ legacybnUSD: params.dstbnUSD,
14085
+ newbnUSD: params.srcbnUSD,
14086
+ dstChainId: params.dstChainId,
14087
+ amount: params.amount,
14088
+ to: encodeAddress(params.dstChainId, params.to)
14089
+ });
14090
+ } else {
14091
+ throw new Error("srcbnUSD or dstbnUSD must be a legacy bnUSD token");
14092
+ }
14026
14093
  const txResult = await SpokeService.deposit(
14027
14094
  {
14028
14095
  from: await spokeProvider.walletProvider.getWalletAddress(),
14029
- token: legacybnUSD.address,
14096
+ token: params.srcbnUSD,
14030
14097
  amount: params.amount,
14031
14098
  data: migrationData
14032
14099
  },
@@ -14197,7 +14264,7 @@ var BnUSDMigrationService = class {
14197
14264
  */
14198
14265
  migrateData(params) {
14199
14266
  const calls = [];
14200
- const assetConfig = getHubAssetInfo(params.srcChainID, params.legacybnUSD);
14267
+ const assetConfig = getHubAssetInfo(params.srcChainId, params.legacybnUSD);
14201
14268
  invariant2(assetConfig, `hub asset not found for legacy bnUSD token: ${params.legacybnUSD}`);
14202
14269
  const bnUSDVault = getMoneyMarketConfig(SONIC_MAINNET_CHAIN_ID).bnUSDVault;
14203
14270
  calls.push(Erc20Service.encodeApprove(assetConfig.asset, assetConfig.vault, params.amount));
@@ -14209,7 +14276,7 @@ var BnUSDMigrationService = class {
14209
14276
  calls.push(Erc20Service.encodeTransfer(bnUSDVault, params.to, translatedAmount));
14210
14277
  return encodeContractCalls(calls);
14211
14278
  }
14212
- const dstAssetConfig = getHubAssetInfo(this.hubProvider.chainConfig.chain.id, params.newbnUSD);
14279
+ const dstAssetConfig = getHubAssetInfo(params.dstChainId, params.newbnUSD);
14213
14280
  invariant2(dstAssetConfig, `hub asset not found for new bnUSD token: ${params.newbnUSD}`);
14214
14281
  calls.push(EvmVaultTokenService.encodeWithdraw(bnUSDVault, dstAssetConfig.asset, translatedAmount));
14215
14282
  const translatedAmountOut = EvmVaultTokenService.translateOutgoingDecimals(
@@ -14240,19 +14307,17 @@ var BnUSDMigrationService = class {
14240
14307
  revertMigrationData(params) {
14241
14308
  const calls = [];
14242
14309
  const bnUSDVault = getMoneyMarketConfig(SONIC_MAINNET_CHAIN_ID).bnUSDVault;
14243
- console.log("params.newbnUSD", params.newbnUSD);
14244
- console.log("bnUSDVault", bnUSDVault);
14245
14310
  let decimals = 18;
14246
14311
  if (params.newbnUSD.toLowerCase() !== bnUSDVault.toLowerCase()) {
14247
- const assetConfig = getHubAssetInfo(params.srcChainID, params.newbnUSD);
14312
+ const assetConfig = getHubAssetInfo(params.srcChainId, params.newbnUSD);
14248
14313
  invariant2(assetConfig, `hub asset not found for new bnUSD token: ${params.newbnUSD}`);
14249
14314
  decimals = assetConfig.decimal;
14250
14315
  calls.push(Erc20Service.encodeApprove(assetConfig.asset, bnUSDVault, params.amount));
14251
14316
  calls.push(EvmVaultTokenService.encodeDeposit(bnUSDVault, assetConfig.asset, params.amount));
14252
14317
  }
14253
14318
  const translatedAmount = EvmVaultTokenService.translateIncomingDecimals(decimals, params.amount);
14254
- const dstAssetConfig = getHubAssetInfo(params.dstChainID, params.legacybnUSD);
14255
- invariant2(dstAssetConfig, `hub asset not found for legacy bnUSD token: ${params.legacybnUSD}`);
14319
+ const dstAssetConfig = getHubAssetInfo(params.dstChainId, params.legacybnUSD);
14320
+ invariant2(dstAssetConfig, `hub asset not found for new bnUSD token: ${params.legacybnUSD}`);
14256
14321
  calls.push(EvmVaultTokenService.encodeWithdraw(bnUSDVault, dstAssetConfig.vault, translatedAmount));
14257
14322
  calls.push(EvmVaultTokenService.encodeWithdraw(dstAssetConfig.vault, dstAssetConfig.asset, translatedAmount));
14258
14323
  const translatedAmountOut = EvmVaultTokenService.translateOutgoingDecimals(
@@ -14568,6 +14633,6 @@ var SolverIntentErrorCode = /* @__PURE__ */ ((SolverIntentErrorCode2) => {
14568
14633
  return SolverIntentErrorCode2;
14569
14634
  })(SolverIntentErrorCode || {});
14570
14635
 
14571
- export { BalnSwapService, BigIntToHex, BnUSDMigrationService, ChainIdToIntentRelayChainId, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, EVM_CHAIN_IDS, EVM_SPOKE_CHAIN_IDS, Erc20Service, EvmAssetManagerService, EvmHubProvider, EvmSolverService, EvmSpokeProvider, EvmSpokeService, EvmVaultTokenService, EvmWalletAbstraction, FEE_PERCENTAGE_SCALE, HubVaultSymbols, ICON_TX_RESULT_WAIT_MAX_RETRY, INTENT_RELAY_CHAIN_IDS, IconSpokeProvider, IcxMigrationService, InjectiveSpokeProvider, IntentCreatedEventAbi, IntentDataType, IntentsAbi, LockupMultiplier, LockupPeriod, MAX_UINT256, MigrationService, MoneyMarketService, STELLAR_DEFAULT_TX_TIMEOUT_SECONDS, STELLAR_PRIORITY_FEE, Sodax, SolanaSpokeProvider, SolverIntentErrorCode, SolverIntentStatusCode, SolverService, SonicSpokeProvider, SonicSpokeService, SpokeService, StellarSpokeProvider, SuiSpokeProvider, SupportedMigrationTokens, VAULT_TOKEN_DECIMALS, WalletAbstractionService, assetManagerAbi, balnSwapAbi, calculateFeeAmount, calculatePercentageFeeAmount, chainIdToHubAssetsMap, connectionAbi, encodeAddress, encodeContractCalls, erc20Abi, getEvmViemChain, getHubAssetInfo, getHubChainConfig, getIconAddressBytes, getIntentRelayChainId, getMoneyMarketConfig, getOriginalAssetAddress, getPacket, getRandomBytes, getSolanaAddressBytes, getSolverConfig, getSpokeChainIdFromIntentRelayChainId, getSupportedMoneyMarketTokens, getSupportedSolverTokens, getTransactionPackets, hexToBigInt, hubAssetToOriginalAssetMap, hubAssets, hubVaults, hubVaultsAddressSet, intentRelayChainIdToSpokeChainIdMap, isConfiguredMoneyMarketConfig, isConfiguredSolverConfig, isEvmHubChainConfig, isEvmInitializedConfig, isEvmSpokeChainConfig, isEvmSpokeProvider, isEvmUninitializedBrowserConfig, isEvmUninitializedConfig, isEvmUninitializedPrivateKeyConfig, isIconAddress, isIconSpokeProvider, isInjectiveSpokeProvider, isIntentCreationFailedError, isIntentCreationUnknownError, isIntentPostExecutionFailedError, isIntentRelayChainId, isIntentSubmitTxFailedError, isJsonRpcPayloadResponse, isMoneyMarketBorrowUnknownError, isMoneyMarketCreateBorrowIntentFailedError, isMoneyMarketCreateRepayIntentFailedError, isMoneyMarketCreateSupplyIntentFailedError, isMoneyMarketCreateWithdrawIntentFailedError, isMoneyMarketRelayTimeoutError, isMoneyMarketRepayUnknownError, isMoneyMarketReserveAsset, isMoneyMarketReserveHubAsset, isMoneyMarketSubmitTxFailedError, isMoneyMarketSupplyUnknownError, isMoneyMarketSupportedToken, isMoneyMarketWithdrawUnknownError, isNativeToken, isPartnerFeeAmount, isPartnerFeePercentage, isResponseAddressType, isResponseSigningType, isSolanaSpokeProvider, isSolverSupportedToken, isSonicSpokeProvider, isStellarSpokeProvider, isSuiSpokeProvider, isValidChainHubAsset, isValidHubAsset, isValidIntentRelayChainId, isValidOriginalAssetAddress, isValidSpokeChainId, isWaitUntilIntentExecutedFailed, migrationConfig, moneyMarketReserveAssets, moneyMarketReserveHubAssetsSet, moneyMarketSupportedTokens, originalAssetTohubAssetMap, poolAbi, randomUint256, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainIdsSet, submitTransaction, supportedHubAssets, supportedHubChains, supportedSpokeChains, supportedTokensPerChain, uiPoolDataAbi, variableDebtTokenAbi, vaultTokenAbi, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
14636
+ export { BalnSwapService, BigIntToHex, BnUSDMigrationService, ChainIdToIntentRelayChainId, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, EVM_CHAIN_IDS, EVM_SPOKE_CHAIN_IDS, Erc20Service, EvmAssetManagerService, EvmHubProvider, EvmSolverService, EvmSpokeProvider, EvmSpokeService, EvmVaultTokenService, EvmWalletAbstraction, FEE_PERCENTAGE_SCALE, HubVaultSymbols, ICON_TX_RESULT_WAIT_MAX_RETRY, INTENT_RELAY_CHAIN_IDS, IconSpokeProvider, IcxMigrationService, InjectiveSpokeProvider, IntentCreatedEventAbi, IntentDataType, IntentsAbi, LockupMultiplier, LockupPeriod, MAX_UINT256, MigrationService, MoneyMarketService, STELLAR_DEFAULT_TX_TIMEOUT_SECONDS, STELLAR_PRIORITY_FEE, Sodax, SolanaSpokeProvider, SolverIntentErrorCode, SolverIntentStatusCode, SolverService, SonicSpokeProvider, SonicSpokeService, SpokeService, StellarSpokeProvider, SuiSpokeProvider, SupportedMigrationTokens, VAULT_TOKEN_DECIMALS, WalletAbstractionService, assetManagerAbi, balnSwapAbi, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bnUSDNewTokens, calculateFeeAmount, calculatePercentageFeeAmount, chainIdToHubAssetsMap, connectionAbi, encodeAddress, encodeContractCalls, erc20Abi, getAllLegacybnUSDTokens, getEvmViemChain, getHubAssetInfo, getHubChainConfig, getIconAddressBytes, getIntentRelayChainId, getMoneyMarketConfig, getOriginalAssetAddress, getPacket, getRandomBytes, getSolanaAddressBytes, getSolverConfig, getSpokeChainIdFromIntentRelayChainId, getSupportedMoneyMarketTokens, getSupportedSolverTokens, getTransactionPackets, hexToBigInt, hubAssetToOriginalAssetMap, hubAssets, hubVaults, hubVaultsAddressSet, intentRelayChainIdToSpokeChainIdMap, isBalnMigrateParams, isConfiguredMoneyMarketConfig, isConfiguredSolverConfig, isEvmHubChainConfig, isEvmInitializedConfig, isEvmSpokeChainConfig, isEvmSpokeProvider, isEvmUninitializedBrowserConfig, isEvmUninitializedConfig, isEvmUninitializedPrivateKeyConfig, isIconAddress, isIconSpokeProvider, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveSpokeProvider, isIntentCreationFailedError, isIntentCreationUnknownError, isIntentPostExecutionFailedError, isIntentRelayChainId, isIntentSubmitTxFailedError, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isMoneyMarketBorrowUnknownError, isMoneyMarketCreateBorrowIntentFailedError, isMoneyMarketCreateRepayIntentFailedError, isMoneyMarketCreateSupplyIntentFailedError, isMoneyMarketCreateWithdrawIntentFailedError, isMoneyMarketRelayTimeoutError, isMoneyMarketRepayUnknownError, isMoneyMarketReserveAsset, isMoneyMarketReserveHubAsset, isMoneyMarketSubmitTxFailedError, isMoneyMarketSupplyUnknownError, isMoneyMarketSupportedToken, isMoneyMarketWithdrawUnknownError, isNativeToken, isNewbnUSDChainId, isNewbnUSDToken, isPartnerFeeAmount, isPartnerFeePercentage, isResponseAddressType, isResponseSigningType, isSolanaSpokeProvider, isSolverSupportedToken, isSonicSpokeProvider, isStellarSpokeProvider, isSuiSpokeProvider, isUnifiedBnUSDMigrateParams, isValidChainHubAsset, isValidHubAsset, isValidIntentRelayChainId, isValidOriginalAssetAddress, isValidSpokeChainId, isWaitUntilIntentExecutedFailed, moneyMarketReserveAssets, moneyMarketReserveHubAssetsSet, moneyMarketSupportedTokens, newbnUSDSpokeChainIds, originalAssetTohubAssetMap, poolAbi, randomUint256, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainIdsSet, submitTransaction, supportedHubAssets, supportedHubChains, supportedSpokeChains, supportedTokensPerChain, uiPoolDataAbi, variableDebtTokenAbi, vaultTokenAbi, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
14572
14637
  //# sourceMappingURL=index.mjs.map
14573
14638
  //# sourceMappingURL=index.mjs.map