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

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';
@@ -6212,7 +6212,7 @@ var spokeChainConfig = {
6212
6212
  wrappedSonic: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38"
6213
6213
  },
6214
6214
  nativeToken: "0x0000000000000000000000000000000000000000",
6215
- bnUSD: "0x6958a4CBFe11406E2a1c1d3a71A1971aD8B3b92F",
6215
+ bnUSD: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131",
6216
6216
  supportedTokens: {
6217
6217
  S: {
6218
6218
  symbol: "S",
@@ -6220,6 +6220,12 @@ var spokeChainConfig = {
6220
6220
  decimals: 18,
6221
6221
  address: "0x0000000000000000000000000000000000000000"
6222
6222
  },
6223
+ bnUSD: {
6224
+ symbol: "bnUSD",
6225
+ name: "bnUSD",
6226
+ decimals: 18,
6227
+ address: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6228
+ },
6223
6229
  WETH: {
6224
6230
  symbol: "WETH",
6225
6231
  name: "Wrapped Ether",
@@ -6788,6 +6794,14 @@ var spokeChainConfig = {
6788
6794
  address: "cx3975b43d260fb8ec802cef6e60c2f4d07486f11d"
6789
6795
  },
6790
6796
  bnUSD: {
6797
+ // same as legacy
6798
+ symbol: "bnUSD",
6799
+ name: "bnUSD",
6800
+ decimals: 18,
6801
+ address: "cx88fd7df7ddff82f7cc735c871dc519838cb235bb"
6802
+ },
6803
+ legacybnUSD: {
6804
+ // duplicate of bnUSD purely for consistency with other legacy tokens chains (sui, stellar)
6791
6805
  symbol: "bnUSD",
6792
6806
  name: "bnUSD",
6793
6807
  decimals: 18,
@@ -6825,6 +6839,7 @@ var HubVaultSymbols = [
6825
6839
  ];
6826
6840
  var hubVaults = {
6827
6841
  IbnUSD: {
6842
+ // ICON bnUSD (Migration) vault on Sonic contains legacy bnUSD tokens (stellar, sui, icon)
6828
6843
  address: "0x9D4b663Eb075d2a1C7B8eaEFB9eCCC0510388B51",
6829
6844
  reserves: [
6830
6845
  // hub asset addresses contained in the vault
@@ -6855,6 +6870,7 @@ var hubVaults = {
6855
6870
  ]
6856
6871
  },
6857
6872
  bnUSD: {
6873
+ // new bnUSD vault on Sonic (also contains IbnUSD vault token as part of it)
6858
6874
  address: "0xe801ca34e19abcbfea12025378d19c4fbe250131",
6859
6875
  reserves: [
6860
6876
  // hub asset addresses contained in the vault
@@ -7000,6 +7016,42 @@ var hubVaults = {
7000
7016
  ]
7001
7017
  }
7002
7018
  };
7019
+ var bnUSDLegacySpokeChainIds = [
7020
+ ICON_MAINNET_CHAIN_ID,
7021
+ SUI_MAINNET_CHAIN_ID,
7022
+ STELLAR_MAINNET_CHAIN_ID
7023
+ ];
7024
+ var newbnUSDSpokeChainIds = SPOKE_CHAIN_IDS.filter((chainId) => chainId !== ICON_MAINNET_CHAIN_ID);
7025
+ var bnUSDLegacyTokens = [
7026
+ spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
7027
+ spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.legacybnUSD,
7028
+ spokeChainConfig[STELLAR_MAINNET_CHAIN_ID].supportedTokens.legacybnUSD
7029
+ ];
7030
+ var bnUSDNewTokens = newbnUSDSpokeChainIds.map((chainId) => spokeChainConfig[chainId].supportedTokens.bnUSD);
7031
+ var isLegacybnUSDChainId = (chainId) => {
7032
+ return bnUSDLegacySpokeChainIds.includes(chainId);
7033
+ };
7034
+ var isNewbnUSDChainId = (chainId) => {
7035
+ return newbnUSDSpokeChainIds.includes(chainId);
7036
+ };
7037
+ var isLegacybnUSDToken = (token) => {
7038
+ if (typeof token === "string") {
7039
+ return bnUSDLegacyTokens.some((t) => t.address.toLowerCase() === token.toLowerCase());
7040
+ }
7041
+ return bnUSDLegacyTokens.some((t) => t.address.toLowerCase() === token.address.toLowerCase());
7042
+ };
7043
+ var isNewbnUSDToken = (token) => {
7044
+ if (typeof token === "string") {
7045
+ return newbnUSDSpokeChainIds.map((chainId) => spokeChainConfig[chainId].supportedTokens.bnUSD).some((t) => t.address.toLowerCase() === token.toLowerCase());
7046
+ }
7047
+ return newbnUSDSpokeChainIds.map((chainId) => spokeChainConfig[chainId].supportedTokens.bnUSD).some((t) => t.address.toLowerCase() === token.address.toLowerCase());
7048
+ };
7049
+ var getAllLegacybnUSDTokens = () => {
7050
+ return bnUSDLegacySpokeChainIds.map((chainId) => ({
7051
+ token: spokeChainConfig[chainId].supportedTokens.legacybnUSD,
7052
+ chainId
7053
+ }));
7054
+ };
7003
7055
  var hubAssets = {
7004
7056
  [SONIC_MAINNET_CHAIN_ID]: {
7005
7057
  [spokeChainConfig[SONIC_MAINNET_CHAIN_ID].nativeToken]: {
@@ -7353,7 +7405,7 @@ var hubAssets = {
7353
7405
  decimal: 18,
7354
7406
  symbol: "legacybnUSD",
7355
7407
  name: "legacybnUSD",
7356
- vault: "0x9D4b663Eb075d2a1C7B8eaEFB9eCCC0510388B51"
7408
+ vault: hubVaults.IbnUSD.address
7357
7409
  }
7358
7410
  },
7359
7411
  [SUI_MAINNET_CHAIN_ID]: {
@@ -7431,7 +7483,7 @@ var hubAssets = {
7431
7483
  decimal: 9,
7432
7484
  symbol: "bnUSD",
7433
7485
  name: "legacybnUSD",
7434
- vault: "0x9D4b663Eb075d2a1C7B8eaEFB9eCCC0510388B51"
7486
+ vault: hubVaults.IbnUSD.address
7435
7487
  }
7436
7488
  },
7437
7489
  [SOLANA_MAINNET_CHAIN_ID]: {
@@ -7478,7 +7530,7 @@ var hubAssets = {
7478
7530
  decimal: 18,
7479
7531
  symbol: "bnUSD",
7480
7532
  name: "bnUSD",
7481
- vault: hubVaults.bnUSD.address
7533
+ vault: hubVaults.IbnUSD.address
7482
7534
  },
7483
7535
  [spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.BALN.address]: {
7484
7536
  asset: "0xde8e19a099fedf9d617599f62c5f7f020d92b572",
@@ -7678,28 +7730,6 @@ var moneyMarketSupportedTokens = {
7678
7730
  spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.wS
7679
7731
  ]
7680
7732
  };
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
7733
  var isMoneyMarketSupportedToken = (chainId, token) => moneyMarketSupportedTokens[chainId].some((t) => t.address.toLowerCase() === token.toLowerCase());
7704
7734
  var getSupportedMoneyMarketTokens = (chainId) => moneyMarketSupportedTokens[chainId];
7705
7735
  var hubVaultsAddressSet = new Set(
@@ -11647,6 +11677,18 @@ function isMoneyMarketWithdrawUnknownError(error) {
11647
11677
  function isMoneyMarketRepayUnknownError(error) {
11648
11678
  return typeof error === "object" && error !== null && "code" in error && error.code === "REPAY_UNKNOWN_ERROR";
11649
11679
  }
11680
+ function isIcxMigrateParams(value) {
11681
+ return typeof value === "object" && value !== null && "address" in value && "amount" in value && "to" in value;
11682
+ }
11683
+ function isUnifiedBnUSDMigrateParams(value) {
11684
+ return typeof value === "object" && value !== null && "srcChainId" in value && "srcbnUSD" in value && "dstChainId" in value && "dstbnUSD" in value && "amount" in value && "to" in value;
11685
+ }
11686
+ function isBalnMigrateParams(value) {
11687
+ return typeof value === "object" && value !== null && "amount" in value && "lockupPeriod" in value && "to" in value && "stake" in value;
11688
+ }
11689
+ function isIcxCreateRevertMigrationParams(value) {
11690
+ return typeof value === "object" && value !== null && "amount" in value && "to" in value;
11691
+ }
11650
11692
 
11651
11693
  // src/services/spoke/SpokeService.ts
11652
11694
  var SpokeService = class {
@@ -12529,8 +12571,8 @@ var SolverService = class {
12529
12571
  * // handle error
12530
12572
  * }
12531
12573
  */
12532
- async swap(payload, spokeProvider, fee, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
12533
- return this.createAndSubmitIntent(payload, spokeProvider, fee, timeout);
12574
+ async swap(payload, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
12575
+ return this.createAndSubmitIntent(payload, spokeProvider, this.config.partnerFee, timeout);
12534
12576
  }
12535
12577
  /**
12536
12578
  * Creates an intent and submits it to the Solver API and Relayer API
@@ -12566,7 +12608,7 @@ var SolverService = class {
12566
12608
  * // handle error
12567
12609
  * }
12568
12610
  */
12569
- async createAndSubmitIntent(payload, spokeProvider, fee, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
12611
+ async createAndSubmitIntent(payload, spokeProvider, fee = this.config.partnerFee, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
12570
12612
  try {
12571
12613
  const createIntentResult = await this.createIntent(payload, spokeProvider, fee, false);
12572
12614
  if (!createIntentResult.ok) {
@@ -13474,9 +13516,25 @@ var MigrationService = class {
13474
13516
  invariant2(params.amount > 0n, "Amount must be greater than 0");
13475
13517
  invariant2(isAddress(params.to) || isIconAddress(params.to), "To address is required");
13476
13518
  invariant2(
13477
- spokeProvider instanceof IconSpokeProvider || spokeProvider instanceof SuiSpokeProvider || spokeProvider instanceof StellarSpokeProvider,
13478
- "Spoke provider must be an instance of IconSpokeProvider, SuiSpokeProvider, or StellarSpokeProvider"
13519
+ isIcxMigrateParams(params) || isBalnMigrateParams(params) || isUnifiedBnUSDMigrateParams(params),
13520
+ "Invalid params"
13479
13521
  );
13522
+ if (spokeProvider instanceof IconSpokeProvider && (isIcxMigrateParams(params) || isBalnMigrateParams(params))) {
13523
+ return {
13524
+ ok: true,
13525
+ value: true
13526
+ };
13527
+ }
13528
+ if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
13529
+ const evmSpokeProvider = spokeProvider;
13530
+ return await Erc20Service.isAllowanceValid(
13531
+ params.srcbnUSD,
13532
+ params.amount,
13533
+ await evmSpokeProvider.walletProvider.getWalletAddress(),
13534
+ evmSpokeProvider instanceof EvmSpokeProvider ? evmSpokeProvider.chainConfig.addresses.assetManager : evmSpokeProvider.chainConfig.bnUSD,
13535
+ evmSpokeProvider
13536
+ );
13537
+ }
13480
13538
  return {
13481
13539
  ok: true,
13482
13540
  value: true
@@ -13485,19 +13543,28 @@ var MigrationService = class {
13485
13543
  if (action === "revert") {
13486
13544
  invariant2(params.amount > 0n, "Amount must be greater than 0");
13487
13545
  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
- );
13546
+ invariant2(isIcxCreateRevertMigrationParams(params) || isUnifiedBnUSDMigrateParams(params), "Invalid params");
13547
+ if (spokeProvider instanceof SonicSpokeProvider && isIcxCreateRevertMigrationParams(params)) {
13548
+ const wallet = await spokeProvider.walletProvider.getWalletAddress();
13549
+ const userRouter = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
13550
+ return await Erc20Service.isAllowanceValid(
13551
+ this.hubProvider.chainConfig.addresses.sodaToken,
13552
+ params.amount,
13553
+ wallet,
13554
+ userRouter,
13555
+ spokeProvider
13556
+ );
13557
+ }
13558
+ if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
13559
+ const evmSpokeProvider = spokeProvider;
13560
+ return await Erc20Service.isAllowanceValid(
13561
+ params.srcbnUSD,
13562
+ params.amount,
13563
+ await evmSpokeProvider.walletProvider.getWalletAddress(),
13564
+ evmSpokeProvider instanceof EvmSpokeProvider ? evmSpokeProvider.chainConfig.addresses.assetManager : evmSpokeProvider.chainConfig.bnUSD,
13565
+ evmSpokeProvider
13566
+ );
13567
+ }
13501
13568
  }
13502
13569
  return {
13503
13570
  ok: false,
@@ -13531,25 +13598,65 @@ var MigrationService = class {
13531
13598
  */
13532
13599
  async approve(params, action, spokeProvider, raw) {
13533
13600
  try {
13601
+ if (action === "migrate") {
13602
+ invariant2(params.amount > 0n, "Amount must be greater than 0");
13603
+ invariant2(params.to.length > 0, "To address is required");
13604
+ invariant2(isUnifiedBnUSDMigrateParams(params), "Invalid params");
13605
+ if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
13606
+ const evmSpokeProvider = spokeProvider;
13607
+ const result = await Erc20Service.approve(
13608
+ params.srcbnUSD,
13609
+ params.amount,
13610
+ evmSpokeProvider instanceof EvmSpokeProvider ? evmSpokeProvider.chainConfig.addresses.assetManager : evmSpokeProvider.chainConfig.bnUSD,
13611
+ evmSpokeProvider,
13612
+ raw
13613
+ );
13614
+ return {
13615
+ ok: true,
13616
+ value: result
13617
+ };
13618
+ }
13619
+ return {
13620
+ ok: false,
13621
+ error: new Error("Invalid params for migrate action")
13622
+ };
13623
+ }
13534
13624
  if (action === "revert") {
13535
13625
  invariant2(params.amount > 0n, "Amount must be greater than 0");
13536
13626
  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
- );
13627
+ invariant2(isIcxCreateRevertMigrationParams(params) || isUnifiedBnUSDMigrateParams(params), "Invalid params");
13628
+ if (spokeProvider instanceof SonicSpokeProvider && isIcxCreateRevertMigrationParams(params)) {
13629
+ const wallet = await spokeProvider.walletProvider.getWalletAddress();
13630
+ const userRouter = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
13631
+ const result = await Erc20Service.approve(
13632
+ this.hubProvider.chainConfig.addresses.sodaToken,
13633
+ params.amount,
13634
+ userRouter,
13635
+ spokeProvider,
13636
+ raw
13637
+ );
13638
+ return {
13639
+ ok: true,
13640
+ value: result
13641
+ };
13642
+ }
13643
+ if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
13644
+ const evmSpokeProvider = spokeProvider;
13645
+ const result = await Erc20Service.approve(
13646
+ params.srcbnUSD,
13647
+ params.amount,
13648
+ evmSpokeProvider instanceof EvmSpokeProvider ? evmSpokeProvider.chainConfig.addresses.assetManager : evmSpokeProvider.chainConfig.bnUSD,
13649
+ evmSpokeProvider,
13650
+ raw
13651
+ );
13652
+ return {
13653
+ ok: true,
13654
+ value: result
13655
+ };
13656
+ }
13550
13657
  return {
13551
- ok: true,
13552
- value: result
13658
+ ok: false,
13659
+ error: new Error("Invalid params or chain type for revert action")
13553
13660
  };
13554
13661
  }
13555
13662
  return {
@@ -13564,27 +13671,37 @@ var MigrationService = class {
13564
13671
  }
13565
13672
  }
13566
13673
  /**
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.
13674
+ * Migrates bnUSD tokens between legacy and new formats across supported spoke chains via the hub chain (sonic).
13675
+ * Handles both legacy-to-new and new-to-legacy bnUSD migrations, enforcing validation and relaying the transaction.
13569
13676
  *
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.
13677
+ * @param params - Migration parameters, including source/destination chain IDs, token addresses, amount, and recipient.
13678
+ * @param spokeProvider - The SpokeProvider instance for the source chain.
13679
+ * @param timeout - Optional timeout in milliseconds for the relay operation (default: 60 seconds).
13680
+ * @param unchecked - Optional flag to skip validation checks (default: false).
13573
13681
  * @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
- *
13682
+ * Result containing a tuple: [spokeTxHash, hubTxHash] if successful, or an error describing the failure.
13577
13683
  *
13578
13684
  * @example
13579
- * // Example: Migrate legacy bnUSD tokens to new bnUSD tokens on the hub chain (sonic)
13685
+ * // Migrate legacy bnUSD to new bnUSD
13580
13686
  * 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)
13687
+ * srcChainId: '0x1.icon', // Source chain ID (legacy)
13688
+ * dstChainId: 'sonic', // Destination chain ID (new)
13689
+ * srcbnUSD: 'cx...', // Legacy bnUSD token address
13690
+ * dstbnUSD: '0x...', // New bnUSD token address
13691
+ * amount: 1000n, // Amount to migrate
13692
+ * to: '0x...', // Recipient address on destination chain
13586
13693
  * }, iconSpokeProvider);
13587
13694
  *
13695
+ * // Reverse migration: new bnUSD to legacy bnUSD
13696
+ * const result = await sodax.migration.migratebnUSD({
13697
+ * srcChainId: 'sonic', // Source chain ID (new)
13698
+ * dstChainId: '0x1.icon', // Destination chain ID (legacy)
13699
+ * srcbnUSD: '0x...', // New bnUSD token address
13700
+ * dstbnUSD: 'cx...', // Legacy bnUSD token address
13701
+ * amount: 1000n, // Amount to migrate
13702
+ * to: 'hx...', // Recipient address on destination chain
13703
+ * }, sonicSpokeProvider);
13704
+ *
13588
13705
  * if (result.ok) {
13589
13706
  * // result.value is a tuple: [spokeTxHash, hubTxHash]
13590
13707
  * const [spokeTxHash, hubTxHash] = result.value;
@@ -13595,9 +13712,9 @@ var MigrationService = class {
13595
13712
  * console.error('[migrateBnUSD] error', result.error);
13596
13713
  * }
13597
13714
  */
13598
- async migratebnUSD(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
13715
+ async migratebnUSD(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT, unchecked = false) {
13599
13716
  try {
13600
- const txResult = await this.createMigratebnUSDIntent(params, spokeProvider);
13717
+ const txResult = await this.createMigratebnUSDIntent(params, spokeProvider, unchecked);
13601
13718
  if (!txResult.ok) {
13602
13719
  return {
13603
13720
  ok: false,
@@ -13628,70 +13745,6 @@ var MigrationService = class {
13628
13745
  };
13629
13746
  }
13630
13747
  }
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
13748
  /**
13696
13749
  * Migrates ICX tokens to SODA tokens on the hub chain (sonic).
13697
13750
  * This function handles the migration of ICX tokens to SODA tokens.
@@ -13884,62 +13937,6 @@ var MigrationService = class {
13884
13937
  };
13885
13938
  }
13886
13939
  }
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
13940
  /**
13944
13941
  * Creates a BALN migration intent on spoke chain (icon).
13945
13942
  *
@@ -13994,39 +13991,112 @@ var MigrationService = class {
13994
13991
  }
13995
13992
  }
13996
13993
  /**
13997
- * Creates a bnUSD migration intent on spoke chain (icon).
13994
+ * Creates a bnUSD migration or reverse migration (legacy bnUSD to new bnUSD or vice versa) intent on a spoke chain.
13998
13995
  *
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
13996
+ * This function prepares the transaction data for migrating legacy bnUSD to new bnUSD,
13997
+ * or for reverting (migrating new bnUSD back to legacy bnUSD), depending on the provided parameters.
13998
+ * It performs validation on chain IDs and token addresses unless `unchecked` is set to true.
13999
+ *
14000
+ * @param params - The parameters for the bnUSD migration or reverse migration transaction.
14001
+ * @param spokeProvider - The spoke provider instance for the source chain.
14002
+ * @param unchecked - If true, skips input validation (use with caution).
14003
+ * @param raw - If true, returns the raw transaction hash instead of the transaction receipt.
14004
+ * @returns {Promise<Result<TxReturnType<S, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>}
14005
+ * Returns a Result containing the transaction payload or hash, or an error if creation failed.
14003
14006
  *
14004
14007
  * @example
14008
+ * // Migrate legacy bnUSD to new bnUSD
14005
14009
  * const result = await migrationService.createMigratebnUSDIntent(
14006
14010
  * {
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
14011
+ * srcChainId: '0x1.icon', // Source chain ID (legacy bnUSD chain)
14012
+ * dstChainId: 'sonic', // Destination chain ID (new bnUSD chain)
14013
+ * srcbnUSD: 'cx...', // Legacy bnUSD token address
14014
+ * dstbnUSD: '0x...', // New bnUSD token address
14015
+ * amount: 1000n, // Amount to migrate
14016
+ * to: '0x...', // Recipient address on destination chain
14017
+ * } satisfies UnifiedBnUSDMigrateParams,
14018
+ * spokeProvider, // SpokeProvider instance
14019
+ * false, // Optional unchecked flag (validation is skipped)
14020
+ * true // Optional raw flag
14014
14021
  * );
14015
14022
  *
14023
+ * // Reverse migration: new bnUSD to legacy bnUSD
14024
+ * const result = await migrationService.createMigratebnUSDIntent(
14025
+ * {
14026
+ * srcChainId: 'sonic', // Source chain ID (new bnUSD chain)
14027
+ * dstChainId: '0x1.icon', // Destination chain ID (legacy bnUSD chain)
14028
+ * srcbnUSD: '0x...', // New bnUSD token address
14029
+ * dstbnUSD: 'cx...', // Legacy bnUSD token address
14030
+ * amount: 1000n, // Amount to migrate
14031
+ * to: 'hx...', // Recipient address on destination chain
14032
+ * } satisfies UnifiedBnUSDMigrateParams,
14033
+ * spokeProvider
14034
+ * );
14016
14035
  */
14017
- async createMigratebnUSDIntent(params, spokeProvider, raw) {
14036
+ async createMigratebnUSDIntent(params, spokeProvider, unchecked = false, raw) {
14018
14037
  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
- });
14038
+ if (!unchecked) {
14039
+ invariant2(isValidSpokeChainId(params.srcChainId), "Invalid spoke source chain ID");
14040
+ invariant2(isValidSpokeChainId(params.dstChainId), "Invalid spoke destination chain ID");
14041
+ invariant2(params.srcbnUSD.length > 0, "Legacy bnUSD token address is required");
14042
+ invariant2(params.dstbnUSD.length > 0, "New bnUSD token address is required");
14043
+ invariant2(params.amount > 0, "Amount must be greater than 0");
14044
+ invariant2(params.to.length > 0, "Recipient address is required");
14045
+ invariant2(
14046
+ !(isLegacybnUSDToken(params.srcbnUSD) && isLegacybnUSDToken(params.dstbnUSD)),
14047
+ "srcbnUSD and dstbnUSD cannot both be legacy bnUSD tokens"
14048
+ );
14049
+ }
14050
+ let migrationData;
14051
+ if (isLegacybnUSDToken(params.srcbnUSD)) {
14052
+ if (!unchecked) {
14053
+ invariant2(
14054
+ isLegacybnUSDChainId(params.srcChainId),
14055
+ "srcChainId must be a legacy bnUSD chain (icon, sui, stellar) if srcbnUSD is a legacy bnUSD token"
14056
+ );
14057
+ invariant2(
14058
+ isNewbnUSDChainId(params.dstChainId),
14059
+ "dstChainId must be a new bnUSD chain (all spoke chains besides Icon) if dstbnUSD is a legacy bnUSD token"
14060
+ );
14061
+ }
14062
+ migrationData = this.bnUSDMigrationService.migrateData({
14063
+ srcChainId: params.srcChainId,
14064
+ legacybnUSD: params.srcbnUSD,
14065
+ newbnUSD: params.dstbnUSD,
14066
+ dstChainId: params.dstChainId,
14067
+ amount: params.amount,
14068
+ to: encodeAddress(params.dstChainId, params.to)
14069
+ });
14070
+ } else if (isLegacybnUSDToken(params.dstbnUSD)) {
14071
+ if (!unchecked) {
14072
+ invariant2(
14073
+ isLegacybnUSDChainId(params.dstChainId),
14074
+ "dstChainId must be a legacy bnUSD chain (sui, stellar, icon) if dstbnUSD is a legacy bnUSD token"
14075
+ );
14076
+ invariant2(
14077
+ isNewbnUSDToken(params.srcbnUSD),
14078
+ "srcbnUSD must be a new bnUSD token if dstbnUSD is a legacy bnUSD token"
14079
+ );
14080
+ invariant2(
14081
+ isNewbnUSDChainId(params.srcChainId),
14082
+ "srcChainId must be a new bnUSD chain (all spoke chains besides Icon) if srcbnUSD is a new bnUSD token"
14083
+ );
14084
+ }
14085
+ migrationData = this.bnUSDMigrationService.revertMigrationData({
14086
+ srcChainId: params.srcChainId,
14087
+ legacybnUSD: params.dstbnUSD,
14088
+ newbnUSD: params.srcbnUSD,
14089
+ dstChainId: params.dstChainId,
14090
+ amount: params.amount,
14091
+ to: encodeAddress(params.dstChainId, params.to)
14092
+ });
14093
+ } else {
14094
+ throw new Error("srcbnUSD or dstbnUSD must be a legacy bnUSD token");
14095
+ }
14026
14096
  const txResult = await SpokeService.deposit(
14027
14097
  {
14028
14098
  from: await spokeProvider.walletProvider.getWalletAddress(),
14029
- token: legacybnUSD.address,
14099
+ token: params.srcbnUSD,
14030
14100
  amount: params.amount,
14031
14101
  data: migrationData
14032
14102
  },
@@ -14197,7 +14267,7 @@ var BnUSDMigrationService = class {
14197
14267
  */
14198
14268
  migrateData(params) {
14199
14269
  const calls = [];
14200
- const assetConfig = getHubAssetInfo(params.srcChainID, params.legacybnUSD);
14270
+ const assetConfig = getHubAssetInfo(params.srcChainId, params.legacybnUSD);
14201
14271
  invariant2(assetConfig, `hub asset not found for legacy bnUSD token: ${params.legacybnUSD}`);
14202
14272
  const bnUSDVault = getMoneyMarketConfig(SONIC_MAINNET_CHAIN_ID).bnUSDVault;
14203
14273
  calls.push(Erc20Service.encodeApprove(assetConfig.asset, assetConfig.vault, params.amount));
@@ -14209,7 +14279,7 @@ var BnUSDMigrationService = class {
14209
14279
  calls.push(Erc20Service.encodeTransfer(bnUSDVault, params.to, translatedAmount));
14210
14280
  return encodeContractCalls(calls);
14211
14281
  }
14212
- const dstAssetConfig = getHubAssetInfo(this.hubProvider.chainConfig.chain.id, params.newbnUSD);
14282
+ const dstAssetConfig = getHubAssetInfo(params.dstChainId, params.newbnUSD);
14213
14283
  invariant2(dstAssetConfig, `hub asset not found for new bnUSD token: ${params.newbnUSD}`);
14214
14284
  calls.push(EvmVaultTokenService.encodeWithdraw(bnUSDVault, dstAssetConfig.asset, translatedAmount));
14215
14285
  const translatedAmountOut = EvmVaultTokenService.translateOutgoingDecimals(
@@ -14240,19 +14310,17 @@ var BnUSDMigrationService = class {
14240
14310
  revertMigrationData(params) {
14241
14311
  const calls = [];
14242
14312
  const bnUSDVault = getMoneyMarketConfig(SONIC_MAINNET_CHAIN_ID).bnUSDVault;
14243
- console.log("params.newbnUSD", params.newbnUSD);
14244
- console.log("bnUSDVault", bnUSDVault);
14245
14313
  let decimals = 18;
14246
14314
  if (params.newbnUSD.toLowerCase() !== bnUSDVault.toLowerCase()) {
14247
- const assetConfig = getHubAssetInfo(params.srcChainID, params.newbnUSD);
14315
+ const assetConfig = getHubAssetInfo(params.srcChainId, params.newbnUSD);
14248
14316
  invariant2(assetConfig, `hub asset not found for new bnUSD token: ${params.newbnUSD}`);
14249
14317
  decimals = assetConfig.decimal;
14250
14318
  calls.push(Erc20Service.encodeApprove(assetConfig.asset, bnUSDVault, params.amount));
14251
14319
  calls.push(EvmVaultTokenService.encodeDeposit(bnUSDVault, assetConfig.asset, params.amount));
14252
14320
  }
14253
14321
  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}`);
14322
+ const dstAssetConfig = getHubAssetInfo(params.dstChainId, params.legacybnUSD);
14323
+ invariant2(dstAssetConfig, `hub asset not found for new bnUSD token: ${params.legacybnUSD}`);
14256
14324
  calls.push(EvmVaultTokenService.encodeWithdraw(bnUSDVault, dstAssetConfig.vault, translatedAmount));
14257
14325
  calls.push(EvmVaultTokenService.encodeWithdraw(dstAssetConfig.vault, dstAssetConfig.asset, translatedAmount));
14258
14326
  const translatedAmountOut = EvmVaultTokenService.translateOutgoingDecimals(
@@ -14568,6 +14636,6 @@ var SolverIntentErrorCode = /* @__PURE__ */ ((SolverIntentErrorCode2) => {
14568
14636
  return SolverIntentErrorCode2;
14569
14637
  })(SolverIntentErrorCode || {});
14570
14638
 
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 };
14639
+ 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
14640
  //# sourceMappingURL=index.mjs.map
14573
14641
  //# sourceMappingURL=index.mjs.map