@sodax/sdk 0.0.1-rc.11 → 0.0.1-rc.12

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
@@ -4,7 +4,7 @@ import { ICON_MAINNET_CHAIN_ID, SUI_MAINNET_CHAIN_ID, STELLAR_MAINNET_CHAIN_ID,
4
4
  export * from '@sodax/types';
5
5
  import { coins } from '@cosmjs/stargate';
6
6
  import * as IconSdkRaw from 'icon-sdk-js';
7
- import { rpc, Contract, TransactionBuilder, BASE_FEE, nativeToScVal, TimeoutInfinite, scValToBigInt, Address } from '@stellar/stellar-sdk';
7
+ import { SorobanRpc, Horizon, Contract, TransactionBuilder, BASE_FEE, nativeToScVal, TimeoutInfinite, rpc, scValToBigInt, Operation, Address, Account } from '@stellar/stellar-sdk';
8
8
  import { bcs } from '@mysten/sui/bcs';
9
9
  import { Transaction } from '@mysten/sui/transactions';
10
10
  import { PublicKey, SystemProgram, ComputeBudgetProgram, Connection } from '@solana/web3.js';
@@ -5076,6 +5076,8 @@ var DEFAULT_RETRY_DELAY_MS = 2e3;
5076
5076
  var ICON_TX_RESULT_WAIT_MAX_RETRY = 10;
5077
5077
  var MAX_UINT256 = (1n << 256n) - 1n;
5078
5078
  var FEE_PERCENTAGE_SCALE = 10000n;
5079
+ var STELLAR_PRIORITY_FEE = "10000";
5080
+ var STELLAR_DEFAULT_TX_TIMEOUT_SECONDS = 100;
5079
5081
  var VAULT_TOKEN_DECIMALS = 18;
5080
5082
  var INTENT_RELAY_CHAIN_IDS = {
5081
5083
  AVAX: 6n,
@@ -5212,6 +5214,12 @@ var spokeChainConfig = {
5212
5214
  name: "Wrapped Sonic",
5213
5215
  decimals: 18,
5214
5216
  address: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38"
5217
+ },
5218
+ SODA: {
5219
+ symbol: "SODA",
5220
+ name: "SODAX",
5221
+ decimals: 18,
5222
+ address: "0x7c7d53EEcda37a87ce0D5bf8E0b24512A48dC963"
5215
5223
  }
5216
5224
  }
5217
5225
  },
@@ -5247,8 +5255,8 @@ var spokeChainConfig = {
5247
5255
  }
5248
5256
  },
5249
5257
  gasPrice: "500000",
5250
- rpcUrl: "https://api.mainnet-beta.solana.com",
5251
- wsUrl: "https://api.mainnet-beta.solana.com",
5258
+ rpcUrl: "https://solana-mainnet.g.alchemy.com/v2/i3q5fE3cYSFBE4Lcg1kS5",
5259
+ wsUrl: "https://solana-mainnet.g.alchemy.com/v2/i3q5fE3cYSFBE4Lcg1kS5",
5252
5260
  walletAddress: ""
5253
5261
  },
5254
5262
  [AVALANCHE_MAINNET_CHAIN_ID]: {
@@ -5342,12 +5350,6 @@ var spokeChainConfig = {
5342
5350
  decimals: 18,
5343
5351
  address: "0xA256dd181C3f6E5eC68C6869f5D50a712d47212e"
5344
5352
  },
5345
- WETH: {
5346
- symbol: "WETH",
5347
- name: "Wrapped Ether",
5348
- decimals: 18,
5349
- address: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"
5350
- },
5351
5353
  wstETH: {
5352
5354
  symbol: "wstETH",
5353
5355
  name: "Wrapped stETH",
@@ -5639,9 +5641,10 @@ var spokeChainConfig = {
5639
5641
  },
5640
5642
  nativeToken: "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",
5641
5643
  bnUSD: "CD6YBFFWMU2UJHX2NGRJ7RN76IJVTCC7MRA46DUBXNB7E6W7H7JRJ2CX",
5642
- rpc_url: "https://rpc.ankr.com/stellar_soroban",
5644
+ horizonRpcUrl: "https://horizon.stellar.org",
5645
+ sorobanRpcUrl: "https://rpc.ankr.com/stellar_soroban",
5643
5646
  chain: {
5644
- name: "soroban-mainnet",
5647
+ name: "Stellar",
5645
5648
  id: STELLAR_MAINNET_CHAIN_ID,
5646
5649
  type: "STELLAR"
5647
5650
  }
@@ -5672,6 +5675,42 @@ var spokeChainConfig = {
5672
5675
  name: "USD Coin",
5673
5676
  decimals: 6,
5674
5677
  address: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
5678
+ },
5679
+ afSUI: {
5680
+ symbol: "afSUI",
5681
+ name: "Aftermath Staked Sui",
5682
+ decimals: 9,
5683
+ address: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI"
5684
+ },
5685
+ mSUI: {
5686
+ symbol: "mSUI",
5687
+ name: "Mirai Staked SUI",
5688
+ decimals: 9,
5689
+ address: "0x922d15d7f55c13fd790f6e54397470ec592caa2b508df292a2e8553f3d3b274f::msui::MSUI"
5690
+ },
5691
+ haSUI: {
5692
+ symbol: "haSUI",
5693
+ name: "haSUI",
5694
+ decimals: 9,
5695
+ address: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI"
5696
+ },
5697
+ vSUI: {
5698
+ symbol: "vSUI",
5699
+ name: "Volo Staked SUI",
5700
+ decimals: 9,
5701
+ address: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT"
5702
+ },
5703
+ yapSUI: {
5704
+ symbol: "yapSUI",
5705
+ name: "Yap Staked SUI",
5706
+ decimals: 9,
5707
+ address: "0x83f1bb8c91ecd1fd313344058b0eed94d63c54e41d8d1ae5bff1353443517d65::yap_sui::YAP_SUI"
5708
+ },
5709
+ trevinSUI: {
5710
+ symbol: "trevinSUI",
5711
+ name: "Trevin Staked SUI",
5712
+ decimals: 9,
5713
+ address: "0x502867b177303bf1bf226245fcdd3403c177e78d175a55a56c0602c7ff51c7fa::trevin_sui::TREVIN_SUI"
5675
5714
  }
5676
5715
  },
5677
5716
  nativeToken: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
@@ -5720,6 +5759,201 @@ var spokeChainConfig = {
5720
5759
  nid: "0x1"
5721
5760
  }
5722
5761
  };
5762
+ var HubVaultSymbols = [
5763
+ "sodaAVAX",
5764
+ "sodaBNB",
5765
+ "sodaETH",
5766
+ "sodaBTC",
5767
+ "sodaSUI",
5768
+ "sodaINJ",
5769
+ "sodaXLM",
5770
+ "sodaSOL",
5771
+ "sodaSODA",
5772
+ "sodaUSDT",
5773
+ "sodaUSDC",
5774
+ "bnUSD",
5775
+ "sodaPOL",
5776
+ "sodaNIBI",
5777
+ "sodaS",
5778
+ "IbnUSD"
5779
+ ];
5780
+ var hubVaults = {
5781
+ IbnUSD: {
5782
+ address: "0x9D4b663Eb075d2a1C7B8eaEFB9eCCC0510388B51",
5783
+ reserves: [
5784
+ // hub asset addresses contained in the vault
5785
+ "0x654DdDf32a9a2aC53f5FB54bf1e93F66791f8047",
5786
+ "0xddf6AD38F9C9451C1F4cDf369040F6869e37393e",
5787
+ "0x1559B52d2e165da1505a542EA37C543c9137f52a"
5788
+ ]
5789
+ },
5790
+ sodaS: {
5791
+ address: "0x62ecc3eeb80a162c57624b3ff80313fe69f5203e",
5792
+ reserves: [
5793
+ // hub asset addresses contained in the vault
5794
+ "0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38"
5795
+ ]
5796
+ },
5797
+ sodaNIBI: {
5798
+ address: "0xc6c85287a8b173a509c2f198bb719a8a5a2d0c68",
5799
+ reserves: [
5800
+ // hub asset addresses contained in the vault
5801
+ "0xe0064414c2c1a636a9424c7a17d86fbf7fd3f190"
5802
+ ]
5803
+ },
5804
+ sodaPOL: {
5805
+ address: "0x208ed38f4783328aa9ebfec360d32e7520a9b779",
5806
+ reserves: [
5807
+ // hub asset addresses contained in the vault
5808
+ "0x9ee17486571917837210824b0d4cadfe3b324d12"
5809
+ ]
5810
+ },
5811
+ bnUSD: {
5812
+ address: "0xe801ca34e19abcbfea12025378d19c4fbe250131",
5813
+ reserves: [
5814
+ // hub asset addresses contained in the vault
5815
+ "0xabbb91c0617090f0028bdc27597cd0d038f3a833",
5816
+ "0xbdf1f453fcb61424011bbddcb96cfdb30f3fe876",
5817
+ "0x94dc79ce9c515ba4ae4d195da8e6ab86c69bfc38",
5818
+ "0x5ce6c1c51ff762cf3acd21396257046f694168b6",
5819
+ "0xdf5639d91359866f266b56d60d98ede9feedd100",
5820
+ "0x238384ae2b4f0ec189ecb5031859ba306b2679c5",
5821
+ "0x419ca9054e44e94ceab52846ecdc3997439bbca6",
5822
+ "0x18f85f9e80ff9496eebd5979a051af16ce751567",
5823
+ "0x289cda1043b4ce26bdca3c12e534f56b24308a5b",
5824
+ "0x23225ab8e63fca4070296678cb46566d57e1bbe3",
5825
+ "0x14c65b1cdc0b821569081b1f77342da0d0cbf439",
5826
+ "0xdf23097b9aeb917bf8fb70e99b6c528fffa35364",
5827
+ "0x11b93c162aabffd026539bb3b9f9ec22c8b7ef8a",
5828
+ "0x69425ffb14704124a58d6f69d510f74a59d9a5bc",
5829
+ "0x9d4b663eb075d2a1c7b8eaefb9eccc0510388b51"
5830
+ ]
5831
+ },
5832
+ sodaSODA: {
5833
+ // SODA SODA vault
5834
+ address: "0x21685e341de7844135329914be6bd8d16982d834",
5835
+ reserves: [
5836
+ // hub asset addresses contained in the vault
5837
+ "0x7c7d53eecda37a87ce0d5bf8e0b24512a48dc963"
5838
+ // SODA SODA hub asset
5839
+ ]
5840
+ },
5841
+ sodaAVAX: {
5842
+ // SODA AVAX vault
5843
+ address: "0x14238d267557e9d799016ad635b53cd15935d290",
5844
+ reserves: [
5845
+ // hub asset addresses contained in the vault
5846
+ "0xc9e4f0b6195f389d9d2b639f2878b7674eb9d8cd"
5847
+ // AvalancheAVAX hub asset
5848
+ ]
5849
+ },
5850
+ sodaBNB: {
5851
+ // SODA BNB vault
5852
+ address: "0x40cd41b35db9e5109ae7e54b44de8625db320e6b",
5853
+ reserves: [
5854
+ // hub asset addresses contained in the vault
5855
+ "0x13b70564b1ec12876b20fab5d1bb630311312f4f"
5856
+ // BSC BNB hub asset
5857
+ ]
5858
+ },
5859
+ sodaETH: {
5860
+ // SODA ETH vault
5861
+ address: "0x4effb5813271699683c25c734f4dabc45b363709",
5862
+ reserves: [
5863
+ // hub asset addresses contained in the vault
5864
+ "0x70178089842be7f8e4726b33f0d1569db8021faa",
5865
+ // BASE ETH hub asset
5866
+ "0xad332860dd3b6f0e63f4f66e9457900917ac78cd",
5867
+ // Optimism ETH hub asset
5868
+ "0xdcd9578b51ef55239b6e68629d822a8d97c95b86",
5869
+ // Arbitrum ETH hub asset
5870
+ "0x57fc2ac5701e463ae261adbd6c99fbeb48ce5293",
5871
+ // BSC ETH hub asset
5872
+ "0x50c42deacd8fc9773493ed674b675be577f2634b"
5873
+ // Sonic WETH hub asset
5874
+ ]
5875
+ },
5876
+ sodaBTC: {
5877
+ // SODA BTC vault
5878
+ address: "0x7a1a5555842ad2d0ed274d09b5c4406a95799d5d",
5879
+ reserves: [
5880
+ // hub asset addresses contained in the vault
5881
+ "0x2803a23a3ba6b09e57d1c71dec0d9efdbb00a27f",
5882
+ // BASE cbBTC hub asset,
5883
+ "0xfb0acb1b2720b620935f50a6dd3f7fea52b2fcbe",
5884
+ // Arbitrum wBTC hub asset
5885
+ "0x96fc8540736f1598b7e235e6de8814062b3b5d3b",
5886
+ // Arbitrum tBTC hub asset,
5887
+ "0xd8a24c71fea5bb81c66c01e532de7d9b11e13905"
5888
+ // BSC BTCB hub asset
5889
+ ]
5890
+ },
5891
+ sodaSUI: {
5892
+ // SODA SUI vault
5893
+ address: "0xdc5b4b00f98347e95b9f94911213dab4c687e1e3",
5894
+ reserves: [
5895
+ // hub asset addresses contained in the vault
5896
+ "0x4676b2a551b25c04e235553c1c81019337384673"
5897
+ // SUI SUI hub asset
5898
+ ]
5899
+ },
5900
+ sodaINJ: {
5901
+ // SODA INJ vault
5902
+ address: "0x1f22279c89b213944b7ea41dacb0a868ddcdfd13",
5903
+ reserves: [
5904
+ // hub asset addresses contained in the vault
5905
+ "0xd375590b4955f6ea5623f799153f9b787a3bd319"
5906
+ // Injective INJ hub asset
5907
+ ]
5908
+ },
5909
+ sodaXLM: {
5910
+ // SODA XLM vault
5911
+ address: "0x6bc8c37cba91f76e68c9e6d689a9c21e4d32079b",
5912
+ reserves: [
5913
+ // hub asset addresses contained in the vault
5914
+ "0x8ac68af223907fb1b893086601a3d99e00f2fa9d"
5915
+ // Stellar XLM hub asset
5916
+ ]
5917
+ },
5918
+ sodaSOL: {
5919
+ // SODA SOL vault
5920
+ address: "0xdea692287e2ce8cb08fa52917be0f16b1dacdc87",
5921
+ reserves: [
5922
+ // hub asset addresses contained in the vault
5923
+ "0x0c09e69a4528945de6d16c7e469dea6996fdf636"
5924
+ // Solana SOL hub asset
5925
+ ]
5926
+ },
5927
+ sodaUSDT: {
5928
+ // SODA USDT vault
5929
+ address: "0xbdf1f453fcb61424011bbddcb96cfdb30f3fe876",
5930
+ reserves: [
5931
+ // hub asset addresses contained in the vault
5932
+ "0x41fd5c169e014e2a657b9de3553f7a7b735fe47a",
5933
+ "0xc168067d95109003805ac865ae556e8476dc69bc",
5934
+ "0x3c0a80c6a1110fc80309382b3989ec626c135ee9",
5935
+ "0x6047828dc181963ba44974801ff68e538da5eaf9"
5936
+ // Sonic USDT
5937
+ ]
5938
+ },
5939
+ sodaUSDC: {
5940
+ address: "0xabbb91c0617090f0028bdc27597cd0d038f3a833",
5941
+ reserves: [
5942
+ "0x41abf4b1559ff709ef8150079bcb26db1fffd117",
5943
+ "0x72e852545b024ddcbc5b70c1bcbdaa025164259c",
5944
+ "0xb7c213cbd24967de9838fa014668fddb338f724b",
5945
+ "0xdb7bda65c3a1c51d64dc4444e418684677334109",
5946
+ "0xa36893ba308b332fdebfa95916d1df3a2e3cf8b3",
5947
+ "0x29219dd400f2bf60e5a23d13be72b486d4038894",
5948
+ "0x5635369c8a29a081d26c2e9e28012fca548ba0cb",
5949
+ "0x3d73437dd81b3f9ec82752beb1752f03a8531710",
5950
+ "0x4bc1211faa06fb50ff61a70331f56167ae511057",
5951
+ "0x348007b53f25a9a857ab8ea81ec9e3ccbcf440f2",
5952
+ "0xc3f020057510ffe10ceb882e1b48238b43d78a5e",
5953
+ "0x9d58508ad10d34048a11640735ca5075bba07b35"
5954
+ ]
5955
+ }
5956
+ };
5723
5957
  var hubAssets = {
5724
5958
  [SONIC_MAINNET_CHAIN_ID]: {
5725
5959
  [spokeChainConfig[SONIC_MAINNET_CHAIN_ID].nativeToken]: {
@@ -5727,35 +5961,42 @@ var hubAssets = {
5727
5961
  decimal: 18,
5728
5962
  symbol: "S",
5729
5963
  name: "Sonic",
5730
- vault: "0x62ecc3Eeb80a162c57624B3fF80313FE69f5203e"
5964
+ vault: hubVaults.sodaS.address
5731
5965
  },
5732
5966
  [spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.wSonic.address]: {
5733
5967
  asset: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38",
5734
5968
  decimal: 18,
5735
5969
  symbol: "wSonic",
5736
5970
  name: "Sonic",
5737
- vault: "0x62ecc3Eeb80a162c57624B3fF80313FE69f5203e"
5971
+ vault: hubVaults.sodaS.address
5738
5972
  },
5739
5973
  [spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.WETH.address]: {
5740
5974
  asset: "0x50c42dEAcD8Fc9773493ED674b675bE577f2634b",
5741
5975
  decimal: 18,
5742
5976
  symbol: "WETH",
5743
5977
  name: "Wrapped Ethereum",
5744
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
5978
+ vault: hubVaults.sodaETH.address
5745
5979
  },
5746
5980
  [spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
5747
5981
  asset: "0x29219dd400f2Bf60E5a23d13Be72B486D4038894",
5748
5982
  decimal: 6,
5749
5983
  symbol: "USDC ",
5750
5984
  name: "USD Coin",
5751
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
5985
+ vault: hubVaults.sodaUSDC.address
5752
5986
  },
5753
5987
  [spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.USDT.address]: {
5754
5988
  asset: "0x6047828dc181963ba44974801ff68e538da5eaf9",
5755
5989
  decimal: 6,
5756
5990
  symbol: "USDT",
5757
5991
  name: "Tether USD",
5758
- vault: "0xbDf1F453FCB61424011BBDDCB96cFDB30f3Fe876"
5992
+ vault: hubVaults.sodaUSDT.address
5993
+ },
5994
+ [spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
5995
+ asset: "0x7c7d53EEcda37a87ce0D5bf8E0b24512A48dC963",
5996
+ decimal: 18,
5997
+ symbol: "SODA",
5998
+ name: "SODA",
5999
+ vault: hubVaults.sodaSODA.address
5759
6000
  }
5760
6001
  },
5761
6002
  [AVALANCHE_MAINNET_CHAIN_ID]: {
@@ -5764,28 +6005,28 @@ var hubAssets = {
5764
6005
  decimal: 18,
5765
6006
  symbol: "AVAX",
5766
6007
  name: "AVAX",
5767
- vault: "0x14238D267557E9d799016ad635B53CD15935d290"
6008
+ vault: hubVaults.sodaAVAX.address
5768
6009
  },
5769
6010
  [spokeChainConfig[AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.USDT.address]: {
5770
6011
  asset: "0x41Fd5c169e014e2A657B9de3553f7a7b735Fe47A",
5771
6012
  decimal: 6,
5772
6013
  symbol: "USDT",
5773
6014
  name: "Tether USD",
5774
- vault: "0xbDf1F453FCB61424011BBDDCB96cFDB30f3Fe876"
6015
+ vault: hubVaults.sodaUSDT.address
5775
6016
  },
5776
6017
  [spokeChainConfig[AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
5777
6018
  asset: "0x41abF4B1559FF709Ef8150079BcB26DB1Fffd117",
5778
6019
  decimal: 6,
5779
6020
  symbol: "USDC",
5780
6021
  name: "USD Coin",
5781
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6022
+ vault: hubVaults.sodaUSDC.address
5782
6023
  },
5783
6024
  [spokeChainConfig[AVALANCHE_MAINNET_CHAIN_ID].bnUSD]: {
5784
6025
  asset: "0x289cDa1043b4Ce26BDCa3c12E534f56b24308A5B",
5785
6026
  decimal: 18,
5786
6027
  symbol: "bnUSD",
5787
6028
  name: "bnUSD",
5788
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6029
+ vault: hubVaults.bnUSD.address
5789
6030
  }
5790
6031
  },
5791
6032
  [ARBITRUM_MAINNET_CHAIN_ID]: {
@@ -5794,56 +6035,58 @@ var hubAssets = {
5794
6035
  decimal: 18,
5795
6036
  symbol: "ETH",
5796
6037
  name: "Ethereum",
5797
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6038
+ vault: hubVaults.sodaETH.address
5798
6039
  },
5799
6040
  [spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.WBTC.address]: {
5800
6041
  asset: "0xfB0ACB1b2720B620935F50a6dd3F7FEA52b2FCBe",
5801
6042
  decimal: 8,
5802
6043
  symbol: "WBTC",
5803
6044
  name: "Wrapped Bitcoin",
5804
- vault: "0x7A1A5555842Ad2D0eD274d09b5c4406a95799D5d"
6045
+ vault: hubVaults.sodaBTC.address
5805
6046
  },
5806
6047
  [spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.weETH.address]: {
5807
6048
  asset: "0x08D5cf039De35627fD5C0f48B8AF4a1647a462E8",
5808
6049
  decimal: 18,
5809
6050
  symbol: "weETH",
5810
6051
  name: "Wrapped eETH",
5811
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6052
+ vault: "0x"
6053
+ // no vault yet
5812
6054
  },
5813
6055
  [spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.wstETH.address]: {
5814
6056
  asset: "0x2D5A7837D68b0c2CC4b14C2af2a1F0Ef420DDDc5",
5815
6057
  decimal: 18,
5816
6058
  symbol: "wstETH",
5817
6059
  name: "Wrapped Staked Ethereum",
5818
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6060
+ vault: "0x"
6061
+ // no vault yet
5819
6062
  },
5820
6063
  [spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.tBTC.address]: {
5821
6064
  asset: "0x96Fc8540736f1598b7E235e6dE8814062b3b5d3B",
5822
6065
  decimal: 18,
5823
6066
  symbol: "tBTC",
5824
6067
  name: "Arbitrum tBTC",
5825
- vault: "0x7A1A5555842Ad2D0eD274d09b5c4406a95799D5d"
6068
+ vault: hubVaults.sodaBTC.address
5826
6069
  },
5827
6070
  [spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.USDT.address]: {
5828
6071
  asset: "0x3C0a80C6a1110fC80309382b3989eC626c135eE9",
5829
6072
  decimal: 6,
5830
6073
  symbol: "USDT",
5831
6074
  name: "Tether USD",
5832
- vault: "0xbDf1F453FCB61424011BBDDCB96cFDB30f3Fe876"
6075
+ vault: hubVaults.sodaUSDT.address
5833
6076
  },
5834
6077
  [spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
5835
6078
  asset: "0xdB7BdA65c3a1C51D64dC4444e418684677334109",
5836
6079
  decimal: 6,
5837
6080
  symbol: "USDC",
5838
6081
  name: "USD Coin",
5839
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6082
+ vault: hubVaults.sodaUSDC.address
5840
6083
  },
5841
6084
  [spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].bnUSD]: {
5842
6085
  asset: "0x419cA9054E44E94ceAb52846eCdC3997439BBcA6",
5843
6086
  decimal: 18,
5844
6087
  symbol: "bnUSD",
5845
6088
  name: "bnUSD",
5846
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6089
+ vault: hubVaults.bnUSD.address
5847
6090
  }
5848
6091
  },
5849
6092
  [BASE_MAINNET_CHAIN_ID]: {
@@ -5852,42 +6095,44 @@ var hubAssets = {
5852
6095
  decimal: 18,
5853
6096
  symbol: "ETH",
5854
6097
  name: "Ethereum",
5855
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6098
+ vault: hubVaults.sodaETH.address
5856
6099
  },
5857
6100
  [spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.cbBTC.address]: {
5858
6101
  asset: "0x2803a23a3BA6b09e57D1c71deC0D9eFdBB00A27F",
5859
6102
  decimal: 8,
5860
6103
  symbol: "cbBTC",
5861
6104
  name: "Coinbase Wrapped BTC",
5862
- vault: "0x7A1A5555842Ad2D0eD274d09b5c4406a95799D5d"
6105
+ vault: hubVaults.sodaBTC.address
5863
6106
  },
5864
6107
  [spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
5865
6108
  asset: "0x72E852545B024ddCbc5b70C1bCBDAA025164259C",
5866
6109
  decimal: 6,
5867
6110
  symbol: "USDC",
5868
6111
  name: "USD Coin",
5869
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6112
+ vault: hubVaults.sodaUSDC.address
5870
6113
  },
5871
6114
  [spokeChainConfig[BASE_MAINNET_CHAIN_ID].bnUSD]: {
5872
6115
  asset: "0xDF5639D91359866f266b56D60d98edE9fEEDd100",
5873
6116
  decimal: 18,
5874
6117
  symbol: "bnUSD",
5875
6118
  name: "bnUSD",
5876
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6119
+ vault: hubVaults.bnUSD.address
5877
6120
  },
5878
6121
  [spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.weETH.address]: {
5879
6122
  asset: "0x55e0ad45eb97493b3045eee417fb6726cb85dfd4",
5880
6123
  decimal: 18,
5881
6124
  symbol: "weETH",
5882
6125
  name: "Wrapped eETH",
5883
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6126
+ vault: "0x"
6127
+ // no vault yet
5884
6128
  },
5885
6129
  [spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.wstETH.address]: {
5886
6130
  asset: "0x494aaeaefdf5964d4ed400174e8c5b98c00957aa",
5887
6131
  decimal: 18,
5888
6132
  symbol: "wstETH",
5889
6133
  name: "Wrapped Staked Ethereum",
5890
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6134
+ vault: "0x"
6135
+ // no vault yet
5891
6136
  }
5892
6137
  },
5893
6138
  [OPTIMISM_MAINNET_CHAIN_ID]: {
@@ -5896,42 +6141,44 @@ var hubAssets = {
5896
6141
  decimal: 18,
5897
6142
  symbol: "ETH",
5898
6143
  name: "Ethereum",
5899
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6144
+ vault: hubVaults.sodaETH.address
5900
6145
  },
5901
6146
  [spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].bnUSD]: {
5902
6147
  asset: "0x238384AE2b4F0EC189ecB5031859bA306B2679c5",
5903
6148
  decimal: 18,
5904
6149
  symbol: "bnUSD",
5905
6150
  name: "bnUSD",
5906
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6151
+ vault: hubVaults.bnUSD.address
5907
6152
  },
5908
6153
  [spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
5909
6154
  asset: "0xb7C213CbD24967dE9838fa014668FDDB338f724B",
5910
6155
  decimal: 6,
5911
6156
  symbol: "USDC",
5912
6157
  name: "USD Coin",
5913
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6158
+ vault: hubVaults.sodaUSDC.address
5914
6159
  },
5915
6160
  [spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.wstETH.address]: {
5916
6161
  asset: "0x61e26f611090CdC6bc79A7Bf156b0fD10f1fC212",
5917
6162
  decimal: 18,
5918
6163
  symbol: "wstETH",
5919
6164
  name: "Wrapped Staked Ethereum",
5920
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6165
+ vault: "0x"
6166
+ // no vault yet
5921
6167
  },
5922
6168
  [spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.weETH.address]: {
5923
6169
  asset: "0xE121c0Dc2B33c00ff31ee3D902D248cc3f19Ea50",
5924
6170
  decimal: 18,
5925
6171
  symbol: "weETH",
5926
6172
  name: "Wrapped eETH",
5927
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6173
+ vault: "0x"
6174
+ // no vault yet
5928
6175
  },
5929
6176
  [spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.USDT.address]: {
5930
6177
  asset: "0xc168067d95109003805aC865ae556e8476DC69bc",
5931
6178
  decimal: 6,
5932
6179
  symbol: "USDT",
5933
6180
  name: "Tether USD",
5934
- vault: "0xbDf1F453FCB61424011BBDDCB96cFDB30f3Fe876"
6181
+ vault: hubVaults.sodaUSDT.address
5935
6182
  }
5936
6183
  },
5937
6184
  [NIBIRU_MAINNET_CHAIN_ID]: {
@@ -5940,14 +6187,14 @@ var hubAssets = {
5940
6187
  decimal: 18,
5941
6188
  symbol: "NIBI",
5942
6189
  name: "Nibiru",
5943
- vault: "0xc6c85287a8b173A509C2F198bB719A8a5a2d0C68"
6190
+ vault: hubVaults.sodaNIBI.address
5944
6191
  },
5945
6192
  [spokeChainConfig[NIBIRU_MAINNET_CHAIN_ID].bnUSD]: {
5946
6193
  asset: "0x11b93C162aABFfD026539bb3B9F9eC22c8b7ef8a",
5947
6194
  decimal: 18,
5948
6195
  symbol: "bnUSD",
5949
6196
  name: "bnUSD",
5950
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6197
+ vault: hubVaults.bnUSD.address
5951
6198
  }
5952
6199
  },
5953
6200
  [BSC_MAINNET_CHAIN_ID]: {
@@ -5956,35 +6203,35 @@ var hubAssets = {
5956
6203
  decimal: 18,
5957
6204
  symbol: "BNB",
5958
6205
  name: "BNB",
5959
- vault: "0x40Cd41b35DB9e5109ae7E54b44De8625dB320E6b"
6206
+ vault: hubVaults.sodaBNB.address
5960
6207
  },
5961
6208
  [spokeChainConfig[BSC_MAINNET_CHAIN_ID].supportedTokens.ETHB.address]: {
5962
6209
  asset: "0x57fC2aC5701e463ae261AdBd6C99FBeB48Ce5293",
5963
6210
  decimal: 18,
5964
6211
  symbol: "ETHB",
5965
6212
  name: "Wrapped Ethereum",
5966
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6213
+ vault: hubVaults.sodaETH.address
5967
6214
  },
5968
6215
  [spokeChainConfig[BSC_MAINNET_CHAIN_ID].supportedTokens.BTCB.address]: {
5969
6216
  asset: "0xD8A24c71FEa5bB81c66C01e532dE7d9B11e13905",
5970
6217
  decimal: 18,
5971
6218
  symbol: "BTCB",
5972
6219
  name: "Wrapped Bitcoin",
5973
- vault: "0x7A1A5555842Ad2D0eD274d09b5c4406a95799D5d"
6220
+ vault: hubVaults.sodaBTC.address
5974
6221
  },
5975
6222
  [spokeChainConfig[BSC_MAINNET_CHAIN_ID].bnUSD]: {
5976
6223
  asset: "0x5Ce6C1c51ff762cF3acD21396257046f694168b6",
5977
6224
  decimal: 18,
5978
6225
  symbol: "bnUSD",
5979
6226
  name: "bnUSD",
5980
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6227
+ vault: hubVaults.bnUSD.address
5981
6228
  },
5982
6229
  [spokeChainConfig[BSC_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
5983
6230
  asset: "0x9d58508ad10d34048a11640735ca5075bba07b35",
5984
6231
  decimal: 18,
5985
6232
  symbol: "USDC",
5986
6233
  name: "USD Coin",
5987
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6234
+ vault: hubVaults.sodaUSDC.address
5988
6235
  }
5989
6236
  },
5990
6237
  [POLYGON_MAINNET_CHAIN_ID]: {
@@ -5993,21 +6240,21 @@ var hubAssets = {
5993
6240
  decimal: 18,
5994
6241
  symbol: "MATIC",
5995
6242
  name: "Polygon",
5996
- vault: "0x0000000000000000000000000000000000000000"
6243
+ vault: hubVaults.sodaPOL.address
5997
6244
  },
5998
6245
  [spokeChainConfig[POLYGON_MAINNET_CHAIN_ID].bnUSD]: {
5999
6246
  asset: "0x18f85f9E80ff9496EeBD5979a051AF16Ce751567",
6000
6247
  decimal: 18,
6001
6248
  symbol: "bnUSD",
6002
6249
  name: "bnUSD",
6003
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6250
+ vault: hubVaults.bnUSD.address
6004
6251
  },
6005
6252
  [spokeChainConfig[POLYGON_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
6006
6253
  asset: "0xa36893ba308b332FDEbfa95916D1dF3a2e3CF8B3",
6007
6254
  decimal: 6,
6008
6255
  symbol: "USDC",
6009
6256
  name: "USD Coin",
6010
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6257
+ vault: hubVaults.sodaUSDC.address
6011
6258
  }
6012
6259
  },
6013
6260
  [INJECTIVE_MAINNET_CHAIN_ID]: {
@@ -6016,21 +6263,21 @@ var hubAssets = {
6016
6263
  decimal: 18,
6017
6264
  symbol: "INJ",
6018
6265
  name: "Injective",
6019
- vault: "0x1f22279C89B213944b7Ea41daCB0a868DdCDFd13"
6266
+ vault: hubVaults.sodaINJ.address
6020
6267
  },
6021
6268
  [spokeChainConfig[INJECTIVE_MAINNET_CHAIN_ID].bnUSD]: {
6022
6269
  asset: "0x69425FFb14704124A58d6F69d510f74A59D9a5bC",
6023
6270
  decimal: 18,
6024
6271
  symbol: "bnUSD",
6025
6272
  name: "bnUSD",
6026
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6273
+ vault: hubVaults.bnUSD.address
6027
6274
  },
6028
6275
  [spokeChainConfig[INJECTIVE_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
6029
6276
  asset: "0x4bc1211faa06fb50ff61a70331f56167ae511057",
6030
6277
  decimal: 6,
6031
6278
  symbol: "USDC",
6032
6279
  name: "USD Coin",
6033
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6280
+ vault: hubVaults.sodaUSDC.address
6034
6281
  }
6035
6282
  },
6036
6283
  [STELLAR_MAINNET_CHAIN_ID]: {
@@ -6039,21 +6286,21 @@ var hubAssets = {
6039
6286
  decimal: 7,
6040
6287
  symbol: "XLM",
6041
6288
  name: "Stellar Lumens",
6042
- vault: "0x6BC8C37cba91F76E68C9e6d689A9C21E4d32079B"
6289
+ vault: hubVaults.sodaXLM.address
6043
6290
  },
6044
6291
  [spokeChainConfig[STELLAR_MAINNET_CHAIN_ID].bnUSD]: {
6045
6292
  asset: "0x23225Ab8E63FCa4070296678cb46566d57E1BBe3",
6046
6293
  decimal: 7,
6047
6294
  symbol: "bnUSD",
6048
6295
  name: "bnUSD",
6049
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6296
+ vault: hubVaults.bnUSD.address
6050
6297
  },
6051
6298
  [spokeChainConfig[STELLAR_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
6052
6299
  asset: "0x348007B53F25A9A857aB8eA81ec9E3CCBCf440f2",
6053
6300
  decimal: 7,
6054
6301
  symbol: "USDC",
6055
6302
  name: "USD Coin",
6056
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6303
+ vault: hubVaults.sodaUSDC.address
6057
6304
  }
6058
6305
  },
6059
6306
  [SUI_MAINNET_CHAIN_ID]: {
@@ -6062,21 +6309,69 @@ var hubAssets = {
6062
6309
  decimal: 9,
6063
6310
  symbol: "SUI",
6064
6311
  name: "Sui",
6065
- vault: "0xdc5B4b00F98347E95b9F94911213DAB4C687e1e3"
6312
+ vault: hubVaults.sodaSUI.address
6066
6313
  },
6067
6314
  [spokeChainConfig[SUI_MAINNET_CHAIN_ID].bnUSD]: {
6068
6315
  asset: "0xDf23097B9AEb917Bf8fb70e99b6c528fffA35364",
6069
6316
  decimal: 9,
6070
6317
  symbol: "bnUSD",
6071
6318
  name: "bnUSD",
6072
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6319
+ vault: hubVaults.bnUSD.address
6073
6320
  },
6074
6321
  [spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
6075
6322
  asset: "0x5635369c8a29A081d26C2e9e28012FCa548BA0Cb",
6076
6323
  decimal: 6,
6077
6324
  symbol: "USDC",
6078
6325
  name: "USD Coin",
6079
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6326
+ vault: hubVaults.sodaUSDC.address
6327
+ },
6328
+ [spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.afSUI.address]: {
6329
+ asset: "0x039666bd0cbc96a66c40e8541af465beaa81aa7e",
6330
+ decimal: 9,
6331
+ symbol: "afSUI",
6332
+ name: "afSUI",
6333
+ vault: "0x"
6334
+ // no vault yet
6335
+ },
6336
+ [spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.mSUI.address]: {
6337
+ asset: "0xb202c674c9a79b5681e981ba0daa782b3ceeebbe",
6338
+ decimal: 9,
6339
+ symbol: "mSUI",
6340
+ name: "mSUI",
6341
+ vault: "0x"
6342
+ // no vault yet
6343
+ },
6344
+ [spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.haSUI.address]: {
6345
+ asset: "0x67a26d11fce15e8b33ac97230d36cae1c52c35e7",
6346
+ decimal: 9,
6347
+ symbol: "haSUI",
6348
+ name: "haSUI",
6349
+ vault: "0x"
6350
+ // no vault yet
6351
+ },
6352
+ [spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.vSUI.address]: {
6353
+ asset: "0x025715bcda08db06c795cd5bf944e2081468d99a",
6354
+ decimal: 9,
6355
+ symbol: "vSUI",
6356
+ name: "vSUI",
6357
+ vault: "0x"
6358
+ // no vault yet
6359
+ },
6360
+ [spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.yapSUI.address]: {
6361
+ asset: "0xac509404f3a3ca3f7766baf65be45a52b1cfccd7",
6362
+ decimal: 9,
6363
+ symbol: "yapSUI",
6364
+ name: "yapSUI",
6365
+ vault: "0x"
6366
+ // no vault yet
6367
+ },
6368
+ [spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.trevinSUI.address]: {
6369
+ asset: "0x514569c788b096595672e0f68ec72387a22ac67b",
6370
+ decimal: 9,
6371
+ symbol: "trevinSUI",
6372
+ name: "trevinSUI",
6373
+ vault: "0x"
6374
+ // no vault yet
6080
6375
  }
6081
6376
  },
6082
6377
  [SOLANA_MAINNET_CHAIN_ID]: {
@@ -6085,21 +6380,21 @@ var hubAssets = {
6085
6380
  decimal: 9,
6086
6381
  symbol: "SOL",
6087
6382
  name: "Solana",
6088
- vault: "0xdEa692287E2cE8Cb08FA52917Be0F16b1DACDC87"
6383
+ vault: hubVaults.sodaSOL.address
6089
6384
  },
6090
6385
  [spokeChainConfig[SOLANA_MAINNET_CHAIN_ID].bnUSD]: {
6091
6386
  asset: "0x14C65b1CDc0B821569081b1F77342dA0D0CbF439",
6092
6387
  decimal: 9,
6093
6388
  symbol: "bnUSD",
6094
6389
  name: "bnUSD",
6095
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6390
+ vault: hubVaults.bnUSD.address
6096
6391
  },
6097
6392
  [spokeChainConfig[SOLANA_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
6098
6393
  asset: "0xC3f020057510ffE10Ceb882e1B48238b43d78a5e",
6099
6394
  decimal: 6,
6100
6395
  symbol: "USDC",
6101
6396
  name: "USD Coin",
6102
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6397
+ vault: hubVaults.sodaUSDC.address
6103
6398
  }
6104
6399
  },
6105
6400
  [ICON_MAINNET_CHAIN_ID]: {
@@ -6108,7 +6403,8 @@ var hubAssets = {
6108
6403
  decimal: 18,
6109
6404
  symbol: "ICX",
6110
6405
  name: "ICON",
6111
- vault: "0x0000000000000000000000000000000000000000"
6406
+ vault: "0x"
6407
+ // no vault yet
6112
6408
  },
6113
6409
  [spokeChainConfig[ICON_MAINNET_CHAIN_ID].addresses.wICX]: {
6114
6410
  asset: "0xb66cB7D841272AF6BaA8b8119007EdEE35d2C24F",
@@ -6122,7 +6418,7 @@ var hubAssets = {
6122
6418
  decimal: 18,
6123
6419
  symbol: "bnUSD",
6124
6420
  name: "bnUSD",
6125
- vault: "0x9D4b663Eb075d2a1C7B8eaEFB9eCCC0510388B51"
6421
+ vault: hubVaults.IbnUSD.address
6126
6422
  }
6127
6423
  }
6128
6424
  };
@@ -6130,24 +6426,26 @@ var DEFAULT_RELAYER_API_ENDPOINT = "https://xcall-relay.nw.iconblockchain.xyz";
6130
6426
  var solverConfig = {
6131
6427
  [SONIC_MAINNET_CHAIN_ID]: {
6132
6428
  intentsContract: "0x6382D6ccD780758C5e8A6123c33ee8F4472F96ef",
6133
- solverApiEndpoint: "https://sodax-solver.iconblockchain.xyz"
6429
+ solverApiEndpoint: "https://sodax-solver-staging.iconblockchain.xyz"
6134
6430
  }
6135
6431
  };
6136
6432
  var getSolverConfig = (chainId) => solverConfig[chainId];
6137
6433
  var solverSupportedTokens = {
6138
6434
  [SONIC_MAINNET_CHAIN_ID]: [
6139
- spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.WETH,
6140
- spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.USDC,
6141
- spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.USDT,
6142
- spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.wSonic
6435
+ // spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.WETH, // NOTE: Planned for next release (1 - 2 weeks)
6436
+ // spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.USDC, // NOTE: Planned for next release (1 - 2 weeks)
6437
+ // spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.USDT, // NOTE: Planned for next release (1 - 2 weeks)
6438
+ // spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.wSonic, // NOTE: Planned for next release (1 - 2 weeks)
6143
6439
  ],
6144
6440
  [AVALANCHE_MAINNET_CHAIN_ID]: [
6145
6441
  spokeChainConfig[AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.AVAX,
6146
6442
  spokeChainConfig[AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.USDT,
6147
6443
  spokeChainConfig[AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.USDC
6444
+ // spokeChainConfig[AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6148
6445
  ],
6149
6446
  [ARBITRUM_MAINNET_CHAIN_ID]: [
6150
6447
  spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.ETH,
6448
+ // spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6151
6449
  spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.WBTC,
6152
6450
  spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.weETH,
6153
6451
  spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.wstETH,
@@ -6157,6 +6455,7 @@ var solverSupportedTokens = {
6157
6455
  ],
6158
6456
  [BASE_MAINNET_CHAIN_ID]: [
6159
6457
  spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.ETH,
6458
+ // spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6160
6459
  spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.weETH,
6161
6460
  spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.USDC,
6162
6461
  spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.wstETH,
@@ -6164,43 +6463,62 @@ var solverSupportedTokens = {
6164
6463
  ],
6165
6464
  [OPTIMISM_MAINNET_CHAIN_ID]: [
6166
6465
  spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.ETH,
6466
+ // spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6167
6467
  spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.USDC,
6168
6468
  spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.wstETH,
6169
- spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.weETH,
6469
+ // spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.weETH, // NOTE: Not Implemented
6170
6470
  spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.USDT
6171
6471
  ],
6172
6472
  [POLYGON_MAINNET_CHAIN_ID]: [
6173
6473
  spokeChainConfig[POLYGON_MAINNET_CHAIN_ID].supportedTokens.POL,
6474
+ // spokeChainConfig[POLYGON_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6174
6475
  spokeChainConfig[POLYGON_MAINNET_CHAIN_ID].supportedTokens.USDC
6175
6476
  ],
6176
6477
  [BSC_MAINNET_CHAIN_ID]: [
6177
6478
  spokeChainConfig[BSC_MAINNET_CHAIN_ID].supportedTokens.BNB,
6178
6479
  spokeChainConfig[BSC_MAINNET_CHAIN_ID].supportedTokens.ETHB,
6179
6480
  spokeChainConfig[BSC_MAINNET_CHAIN_ID].supportedTokens.BTCB,
6481
+ // spokeChainConfig[BSC_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6180
6482
  spokeChainConfig[BSC_MAINNET_CHAIN_ID].supportedTokens.USDC
6181
6483
  ],
6182
6484
  [SOLANA_MAINNET_CHAIN_ID]: [
6183
6485
  spokeChainConfig[SOLANA_MAINNET_CHAIN_ID].supportedTokens.SOL,
6486
+ // spokeChainConfig[SOLANA_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6184
6487
  spokeChainConfig[SOLANA_MAINNET_CHAIN_ID].supportedTokens.USDC
6185
6488
  ],
6186
6489
  [ICON_MAINNET_CHAIN_ID]: [
6187
6490
  spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.ICX,
6188
6491
  spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.wICX,
6189
6492
  spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.bnUSD
6493
+ // spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.BALN, // NOTE: Not Implemented
6494
+ // spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.OMM, // NOTE: Not Implemented
6190
6495
  ],
6191
6496
  [STELLAR_MAINNET_CHAIN_ID]: [
6192
6497
  spokeChainConfig[STELLAR_MAINNET_CHAIN_ID].supportedTokens.XLM,
6498
+ // spokeChainConfig[STELLAR_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6193
6499
  spokeChainConfig[STELLAR_MAINNET_CHAIN_ID].supportedTokens.USDC
6194
6500
  ],
6195
6501
  [SUI_MAINNET_CHAIN_ID]: [
6196
6502
  spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.SUI,
6197
- spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.USDC
6503
+ // spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6504
+ spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.USDC,
6505
+ spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.afSUI,
6506
+ spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.mSUI,
6507
+ spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.haSUI,
6508
+ spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.vSUI,
6509
+ spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.yapSUI,
6510
+ spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.trevinSUI
6198
6511
  ],
6199
6512
  [INJECTIVE_MAINNET_CHAIN_ID]: [
6200
6513
  spokeChainConfig[INJECTIVE_MAINNET_CHAIN_ID].supportedTokens.INJ,
6514
+ // spokeChainConfig[INJECTIVE_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6201
6515
  spokeChainConfig[INJECTIVE_MAINNET_CHAIN_ID].supportedTokens.USDC
6202
6516
  ],
6203
- [NIBIRU_MAINNET_CHAIN_ID]: []
6517
+ [NIBIRU_MAINNET_CHAIN_ID]: [
6518
+ // spokeChainConfig[NIBIRU_MAINNET_CHAIN_ID].supportedTokens.NIBI, // NOTE: Not Implemented
6519
+ // spokeChainConfig[NIBIRU_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6520
+ // spokeChainConfig[NIBIRU_MAINNET_CHAIN_ID].supportedTokens.USDC, // NOTE: Not Implemented
6521
+ ]
6204
6522
  };
6205
6523
  var getSupportedSolverTokens = (chainId) => solverSupportedTokens[chainId];
6206
6524
  var isSolverSupportedToken = (chainId, token) => solverSupportedTokens[chainId].some((t) => t.address.toLowerCase() === token.toLowerCase());
@@ -6225,8 +6543,8 @@ var moneyMarketSupportedTokens = {
6225
6543
  spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.ETH,
6226
6544
  spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
6227
6545
  spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.WBTC,
6228
- spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.weETH,
6229
- spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.wstETH,
6546
+ // spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.weETH,
6547
+ // spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.wstETH,
6230
6548
  spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.tBTC,
6231
6549
  spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.USDT,
6232
6550
  spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.USDC
@@ -6234,17 +6552,17 @@ var moneyMarketSupportedTokens = {
6234
6552
  [BASE_MAINNET_CHAIN_ID]: [
6235
6553
  spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.ETH,
6236
6554
  spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
6237
- spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.weETH,
6555
+ // spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.weETH,
6238
6556
  spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.USDC,
6239
- spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.wstETH,
6557
+ // spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.wstETH,
6240
6558
  spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.cbBTC
6241
6559
  ],
6242
6560
  [OPTIMISM_MAINNET_CHAIN_ID]: [
6243
6561
  spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.ETH,
6244
6562
  spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
6245
6563
  spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.USDC,
6246
- spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.wstETH,
6247
- spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.weETH,
6564
+ // spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.wstETH,
6565
+ // spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.weETH,
6248
6566
  spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.USDT
6249
6567
  ],
6250
6568
  [POLYGON_MAINNET_CHAIN_ID]: [
@@ -6260,12 +6578,13 @@ var moneyMarketSupportedTokens = {
6260
6578
  ],
6261
6579
  [SOLANA_MAINNET_CHAIN_ID]: [
6262
6580
  spokeChainConfig[SOLANA_MAINNET_CHAIN_ID].supportedTokens.SOL,
6263
- spokeChainConfig[SOLANA_MAINNET_CHAIN_ID].supportedTokens.bnUSD
6581
+ spokeChainConfig[SOLANA_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
6582
+ spokeChainConfig[SOLANA_MAINNET_CHAIN_ID].supportedTokens.USDC
6264
6583
  ],
6265
6584
  [ICON_MAINNET_CHAIN_ID]: [
6266
- spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.ICX,
6267
- spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
6268
- spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.wICX
6585
+ // spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.ICX,
6586
+ spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.bnUSD
6587
+ // spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.wICX,
6269
6588
  ],
6270
6589
  [STELLAR_MAINNET_CHAIN_ID]: [
6271
6590
  spokeChainConfig[STELLAR_MAINNET_CHAIN_ID].supportedTokens.XLM,
@@ -6292,102 +6611,6 @@ var moneyMarketSupportedTokens = {
6292
6611
  };
6293
6612
  var isMoneyMarketSupportedToken = (chainId, token) => moneyMarketSupportedTokens[chainId].some((t) => t.address.toLowerCase() === token.toLowerCase());
6294
6613
  var getSupportedMoneyMarketTokens = (chainId) => moneyMarketSupportedTokens[chainId];
6295
- var HubVaultSymbols = [
6296
- "sodaAVAX",
6297
- "sodaBNB",
6298
- "sodaETH",
6299
- "sodaBTC",
6300
- "sodaSUI",
6301
- "sodaINJ",
6302
- "sodaXLM",
6303
- "sodaSOL"
6304
- ];
6305
- var hubVaults = {
6306
- sodaAVAX: {
6307
- // SODA AVAX vault
6308
- address: "0x14238d267557e9d799016ad635b53cd15935d290",
6309
- reserves: [
6310
- // hub asset addresses contained in the vault
6311
- "0xc9e4f0b6195f389d9d2b639f2878b7674eb9d8cd"
6312
- // AvalancheAVAX hub asset
6313
- ]
6314
- },
6315
- sodaBNB: {
6316
- // SODA BNB vault
6317
- address: "0x40cd41b35db9e5109ae7e54b44de8625db320e6b",
6318
- reserves: [
6319
- // hub asset addresses contained in the vault
6320
- "0x13b70564b1ec12876b20fab5d1bb630311312f4f"
6321
- // BSC BNB hub asset
6322
- ]
6323
- },
6324
- sodaETH: {
6325
- // SODA ETH vault
6326
- address: "0x4effb5813271699683c25c734f4dabc45b363709",
6327
- reserves: [
6328
- // hub asset addresses contained in the vault
6329
- "0x70178089842be7f8e4726b33f0d1569db8021faa",
6330
- // BASE ETH hub asset
6331
- "0xad332860dd3b6f0e63f4f66e9457900917ac78cd",
6332
- // Optimism ETH hub asset
6333
- "0xdcd9578b51ef55239b6e68629d822a8d97c95b86",
6334
- // Arbitrum ETH hub asset
6335
- "0x57fc2ac5701e463ae261adbd6c99fbeb48ce5293"
6336
- // BSC ETH hub asset
6337
- ]
6338
- },
6339
- sodaBTC: {
6340
- // SODA BTC vault
6341
- address: "0x7a1a5555842ad2d0ed274d09b5c4406a95799d5d",
6342
- reserves: [
6343
- // hub asset addresses contained in the vault
6344
- "0x2803a23a3ba6b09e57d1c71dec0d9efdbb00a27f",
6345
- // BASE cbBTC hub asset,
6346
- "0xfb0acb1b2720b620935f50a6dd3f7fea52b2fcbe",
6347
- // Arbitrum wBTC hub asset
6348
- "0x96fc8540736f1598b7e235e6de8814062b3b5d3b",
6349
- // Arbitrum tBTC hub asset,
6350
- "0xd8a24c71fea5bb81c66c01e532de7d9b11e13905"
6351
- // BSC BTCB hub asset
6352
- ]
6353
- },
6354
- sodaSUI: {
6355
- // SODA SUI vault
6356
- address: "0xdc5b4b00f98347e95b9f94911213dab4c687e1e3",
6357
- reserves: [
6358
- // hub asset addresses contained in the vault
6359
- "0x4676b2a551b25c04e235553c1c81019337384673"
6360
- // SUI SUI hub asset
6361
- ]
6362
- },
6363
- sodaINJ: {
6364
- // SODA INJ vault
6365
- address: "0x1f22279c89b213944b7ea41dacb0a868ddcdfd13",
6366
- reserves: [
6367
- // hub asset addresses contained in the vault
6368
- "0xd375590b4955f6ea5623f799153f9b787a3bd319"
6369
- // Injective INJ hub asset
6370
- ]
6371
- },
6372
- sodaXLM: {
6373
- // SODA XLM vault
6374
- address: "0x6bc8c37cba91f76e68c9e6d689a9c21e4d32079b",
6375
- reserves: [
6376
- // hub asset addresses contained in the vault
6377
- "0x8ac68af223907fb1b893086601a3d99e00f2fa9d"
6378
- // Stellar XLM hub asset
6379
- ]
6380
- },
6381
- sodaSOL: {
6382
- // SODA SOL vault
6383
- address: "0xdea692287e2ce8cb08fa52917be0f16b1dacdc87",
6384
- reserves: [
6385
- // hub asset addresses contained in the vault
6386
- "0x0c09e69a4528945de6d16c7e469dea6996fdf636"
6387
- // Solana SOL hub asset
6388
- ]
6389
- }
6390
- };
6391
6614
  var hubVaultsAddressSet = new Set(
6392
6615
  Object.values(hubVaults).map((vault) => vault.address.toLowerCase())
6393
6616
  );
@@ -6396,14 +6619,7 @@ var moneyMarketReserveHubAssetsSet = new Set(
6396
6619
  );
6397
6620
  var isMoneyMarketReserveHubAsset = (hubAsset) => moneyMarketReserveHubAssetsSet.has(hubAsset.toLowerCase());
6398
6621
  var moneyMarketReserveAssets = [
6399
- hubVaults["sodaAVAX"].address,
6400
- hubVaults["sodaBNB"].address,
6401
- hubVaults["sodaETH"].address,
6402
- hubVaults["sodaBTC"].address,
6403
- hubVaults["sodaSUI"].address,
6404
- hubVaults["sodaINJ"].address,
6405
- hubVaults["sodaXLM"].address,
6406
- hubVaults["sodaSOL"].address,
6622
+ ...Object.values(hubVaults).map((vault) => vault.address),
6407
6623
  getMoneyMarketConfig(SONIC_MAINNET_CHAIN_ID).bnUSDVault
6408
6624
  ];
6409
6625
  var isMoneyMarketReserveAsset = (asset) => moneyMarketReserveAssets.map((a) => a.toLowerCase()).includes(asset.toLowerCase());
@@ -6750,28 +6966,164 @@ var EvmSpokeProvider = class {
6750
6966
  }
6751
6967
  }
6752
6968
  };
6969
+ var CustomStellarAccount = class {
6970
+ accountId;
6971
+ sequenceNumber;
6972
+ startingSequenceNumber;
6973
+ constructor({ account_id, sequence }) {
6974
+ this.accountId = account_id;
6975
+ this.sequenceNumber = BigInt(sequence);
6976
+ this.startingSequenceNumber = BigInt(sequence);
6977
+ }
6978
+ getSequenceNumber() {
6979
+ return this.sequenceNumber;
6980
+ }
6981
+ getStartingSequenceNumber() {
6982
+ return this.startingSequenceNumber;
6983
+ }
6984
+ getAccountId() {
6985
+ return this.accountId;
6986
+ }
6987
+ getAccountClone() {
6988
+ return new Account(this.accountId, this.sequenceNumber.toString());
6989
+ }
6990
+ incrementSequenceNumber() {
6991
+ this.sequenceNumber++;
6992
+ }
6993
+ decrementSequenceNumber() {
6994
+ if (this.sequenceNumber > this.startingSequenceNumber) {
6995
+ this.sequenceNumber--;
6996
+ }
6997
+ throw new Error(
6998
+ `Sequence number cannot be decremented below the starting sequence number: ${this.startingSequenceNumber}`
6999
+ );
7000
+ }
7001
+ resetSequenceNumber() {
7002
+ this.sequenceNumber = this.startingSequenceNumber;
7003
+ }
7004
+ };
7005
+ var CustomSorobanServer = class extends SorobanRpc.Server {
7006
+ customHeaders;
7007
+ constructor(serverUrl, customHeaders) {
7008
+ super(serverUrl, {
7009
+ allowHttp: true
7010
+ });
7011
+ this.customHeaders = customHeaders;
7012
+ }
7013
+ async getNetwork() {
7014
+ const requestOptions = {
7015
+ method: "POST",
7016
+ headers: {
7017
+ "Content-Type": "application/json",
7018
+ ...this.customHeaders
7019
+ },
7020
+ body: JSON.stringify({
7021
+ id: 1,
7022
+ jsonrpc: "2.0",
7023
+ method: "getNetwork"
7024
+ })
7025
+ };
7026
+ const response = await fetch(`${this.serverURL}`, requestOptions);
7027
+ if (!response.ok) {
7028
+ throw new Error(`HTTP error getting network! status: ${response.status}`);
7029
+ }
7030
+ return response.json().then((json) => json.result);
7031
+ }
7032
+ async simulateTransaction(tx) {
7033
+ const requestOptions = {
7034
+ method: "POST",
7035
+ headers: {
7036
+ "Content-Type": "application/json",
7037
+ ...this.customHeaders
7038
+ },
7039
+ body: JSON.stringify({
7040
+ id: 1,
7041
+ jsonrpc: "2.0",
7042
+ method: "simulateTransaction",
7043
+ params: {
7044
+ transaction: tx.toXDR()
7045
+ }
7046
+ })
7047
+ };
7048
+ const response = await fetch(`${this.serverURL}`, requestOptions);
7049
+ if (!response.ok) {
7050
+ throw new Error(`HTTP error simulating TX! status: ${response.status}`);
7051
+ }
7052
+ return response.json().then((json) => json.result);
7053
+ }
7054
+ async sendTransaction(tx) {
7055
+ const requestOptions = {
7056
+ method: "POST",
7057
+ headers: {
7058
+ "Content-Type": "application/json",
7059
+ ...this.customHeaders
7060
+ },
7061
+ body: JSON.stringify({
7062
+ id: 1,
7063
+ jsonrpc: "2.0",
7064
+ method: "sendTransaction",
7065
+ params: {
7066
+ transaction: tx.toXDR()
7067
+ }
7068
+ })
7069
+ };
7070
+ const response = await fetch(`${this.serverURL}`, requestOptions);
7071
+ if (!response.ok) {
7072
+ throw new Error(`HTTP error submitting TX! status: ${response.status}`);
7073
+ }
7074
+ return response.json().then((json) => json.result);
7075
+ }
7076
+ async getTransaction(hash) {
7077
+ const requestOptions = {
7078
+ method: "POST",
7079
+ headers: {
7080
+ "Content-Type": "application/json",
7081
+ ...this.customHeaders
7082
+ },
7083
+ body: JSON.stringify({
7084
+ id: 1,
7085
+ jsonrpc: "2.0",
7086
+ method: "getTransaction",
7087
+ params: { hash }
7088
+ })
7089
+ };
7090
+ const response = await fetch(`${this.serverURL}`, requestOptions);
7091
+ if (!response.ok) {
7092
+ throw new Error(`HTTP error getting TX! status: ${response.status}`);
7093
+ }
7094
+ return response.json().then((json) => json.result);
7095
+ }
7096
+ };
6753
7097
  var StellarSpokeProvider = class {
6754
7098
  server;
7099
+ sorobanServer;
6755
7100
  contract;
6756
7101
  chainConfig;
6757
7102
  walletProvider;
6758
- constructor(walletProvider, contractAddress, config, rpc$1) {
6759
- this.server = new rpc.Server(rpc$1);
7103
+ constructor(walletProvider, config, rpcConfig) {
7104
+ this.server = new Horizon.Server(
7105
+ rpcConfig && rpcConfig.horizonRpcUrl ? rpcConfig.horizonRpcUrl : config.horizonRpcUrl,
7106
+ { allowHttp: true }
7107
+ );
7108
+ this.sorobanServer = new CustomSorobanServer(
7109
+ rpcConfig && rpcConfig.sorobanRpcUrl ? rpcConfig.sorobanRpcUrl : config.sorobanRpcUrl,
7110
+ {}
7111
+ );
6760
7112
  this.walletProvider = walletProvider;
6761
- this.contract = new Contract(contractAddress);
7113
+ this.contract = new Contract(config.addresses.assetManager);
6762
7114
  this.chainConfig = config;
6763
7115
  }
6764
7116
  async getBalance(tokenAddress) {
6765
7117
  const [network, walletAddress] = await Promise.all([
6766
- this.server.getNetwork(),
7118
+ this.sorobanServer.getNetwork(),
6767
7119
  this.walletProvider.getWalletAddress()
6768
7120
  ]);
6769
- const sourceAccount = await this.server.getAccount(walletAddress);
7121
+ const sourceAccount = await this.sorobanServer.getAccount(walletAddress);
6770
7122
  const tx = new TransactionBuilder(sourceAccount, {
6771
7123
  fee: BASE_FEE,
6772
7124
  networkPassphrase: network.passphrase
6773
7125
  }).addOperation(this.contract.call("get_token_balance", nativeToScVal(tokenAddress, { type: "address" }))).setTimeout(TimeoutInfinite).build();
6774
- const result = await this.server.simulateTransaction(tx);
7126
+ const result = await this.sorobanServer.simulateTransaction(tx);
6775
7127
  if (rpc.Api.isSimulationError(result)) {
6776
7128
  throw new Error("Failed to simulate transaction");
6777
7129
  }
@@ -6781,32 +7133,112 @@ var StellarSpokeProvider = class {
6781
7133
  }
6782
7134
  throw new Error("result undefined");
6783
7135
  }
7136
+ async buildPriorityStellarTransaction(account, network, operation) {
7137
+ const simulationForFee = await this.sorobanServer.simulateTransaction(
7138
+ new TransactionBuilder(account.getAccountClone(), {
7139
+ fee: BASE_FEE,
7140
+ networkPassphrase: network.passphrase
7141
+ }).addOperation(operation).setTimeout(STELLAR_DEFAULT_TX_TIMEOUT_SECONDS).build()
7142
+ );
7143
+ if (!rpc.Api.isSimulationSuccess(simulationForFee)) {
7144
+ throw new Error(`Simulation error: ${JSON.stringify(simulationForFee)}`);
7145
+ }
7146
+ const priorityTransaction = new TransactionBuilder(account.getAccountClone(), {
7147
+ fee: (BigInt(simulationForFee.minResourceFee) + BigInt(STELLAR_PRIORITY_FEE) + BigInt(BASE_FEE.toString())).toString(),
7148
+ networkPassphrase: network.passphrase
7149
+ }).addOperation(operation).setTimeout(STELLAR_DEFAULT_TX_TIMEOUT_SECONDS).build();
7150
+ const simulation = await this.sorobanServer.simulateTransaction(priorityTransaction);
7151
+ return [SorobanRpc.assembleTransaction(priorityTransaction, simulation).build(), simulation];
7152
+ }
7153
+ handleSendTransactionError(response) {
7154
+ if (response.status === "ERROR") {
7155
+ throw new Error(
7156
+ `Transaction failed: status: ${response.status}, hash: ${response.hash}, errorResult: ${JSON.stringify({
7157
+ name: response?.errorResult?.result()?.switch()?.name ?? "unknown",
7158
+ value: response?.errorResult?.result()?.switch()?.value ?? "unknown"
7159
+ })}, diagnosticEvents: ${JSON.stringify(response?.diagnosticEvents ?? "{}")}`
7160
+ );
7161
+ }
7162
+ return response;
7163
+ }
7164
+ async signAndSendTransaction(tx, waitForTransaction = true) {
7165
+ const signedTransaction = await this.walletProvider.signTransaction(tx.toXDR());
7166
+ const signedTx = TransactionBuilder.fromXDR(signedTransaction, tx.networkPassphrase);
7167
+ const response = this.handleSendTransactionError(await this.sorobanServer.sendTransaction(signedTx));
7168
+ if (waitForTransaction) {
7169
+ return await this.waitForTransaction(response.hash);
7170
+ }
7171
+ return response.hash;
7172
+ }
7173
+ async waitForTransaction(hash, attempts = 60) {
7174
+ if (attempts === 0) {
7175
+ throw new Error(
7176
+ "[StellarSpokeProvider.waitForTransaction] Timeout error. Transaction not found after 5 attempts"
7177
+ );
7178
+ }
7179
+ const response = await this.sorobanServer.getTransaction(hash);
7180
+ if (response.status === rpc.Api.GetTransactionStatus.SUCCESS) {
7181
+ return hash;
7182
+ }
7183
+ if (response.status === rpc.Api.GetTransactionStatus.FAILED) {
7184
+ throw response;
7185
+ }
7186
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
7187
+ return this.waitForTransaction(hash, attempts - 1);
7188
+ }
7189
+ async submitOrRestoreAndRetry(account, network, tx, operation, simulation) {
7190
+ const initialSimulation = simulation ?? await this.sorobanServer.simulateTransaction(tx);
7191
+ if (!rpc.Api.isSimulationSuccess(initialSimulation)) {
7192
+ throw new Error(
7193
+ `[StellarSpokeProvider.submitOrRestoreAndRetry] Simulation Failed: ${JSON.stringify(initialSimulation)}`
7194
+ );
7195
+ }
7196
+ let restored = false;
7197
+ if (rpc.Api.isSimulationRestore(initialSimulation)) {
7198
+ try {
7199
+ await this.handleSimulationRestore(
7200
+ initialSimulation.restorePreamble.minResourceFee,
7201
+ initialSimulation.restorePreamble.transactionData.build(),
7202
+ account,
7203
+ network
7204
+ );
7205
+ restored = true;
7206
+ } catch (error) {
7207
+ throw new Error(
7208
+ `[StellarSpokeProvider.submitOrRestoreAndRetry] Simulation Restore Failed: ${JSON.stringify(error)}`
7209
+ );
7210
+ }
7211
+ }
7212
+ if (!restored) {
7213
+ return await this.signAndSendTransaction(tx);
7214
+ }
7215
+ const newAccount = account.getAccountClone();
7216
+ newAccount.incrementSequenceNumber();
7217
+ return await this.signAndSendTransaction(
7218
+ new TransactionBuilder(newAccount, {
7219
+ fee: BASE_FEE,
7220
+ networkPassphrase: network.passphrase
7221
+ }).addOperation(operation).setTimeout(STELLAR_DEFAULT_TX_TIMEOUT_SECONDS).build()
7222
+ );
7223
+ }
7224
+ async handleSimulationRestore(minResourceFee, transactionData, account, network) {
7225
+ const totalFee = (BigInt(BASE_FEE) + BigInt(STELLAR_PRIORITY_FEE) + BigInt(minResourceFee)).toString();
7226
+ return this.signAndSendTransaction(
7227
+ new TransactionBuilder(account.getAccountClone(), { fee: totalFee }).setNetworkPassphrase(network.passphrase).setSorobanData(transactionData).addOperation(Operation.restoreFootprint({})).setTimeout(STELLAR_DEFAULT_TX_TIMEOUT_SECONDS).build()
7228
+ );
7229
+ }
6784
7230
  async deposit(token, amount, recipient, data, raw) {
6785
7231
  try {
6786
7232
  const [network, walletAddress] = await Promise.all([
6787
- this.server.getNetwork(),
7233
+ this.sorobanServer.getNetwork(),
6788
7234
  this.walletProvider.getWalletAddress()
6789
7235
  ]);
6790
- const sourceAccount = await this.server.getAccount(walletAddress);
6791
- const simulateTx = new TransactionBuilder(sourceAccount, {
6792
- fee: BASE_FEE,
6793
- networkPassphrase: network.passphrase
6794
- }).addOperation(
6795
- this.contract.call(
6796
- "transfer",
6797
- nativeToScVal(Address.fromString(walletAddress), { type: "address" }),
6798
- nativeToScVal(Address.fromString(token), {
6799
- type: "address"
6800
- }),
6801
- nativeToScVal(BigInt(amount), { type: "u128" }),
6802
- nativeToScVal(recipient),
6803
- nativeToScVal(Buffer.from(data), { type: "bytes" })
6804
- )
6805
- ).setTimeout(100).build();
6806
- const simResult = await this.server.simulateTransaction(simulateTx);
6807
- const tx = rpc.assembleTransaction(simulateTx, simResult).build();
7236
+ const accountResponse = await this.server.loadAccount(walletAddress);
7237
+ const stellarAccount = new CustomStellarAccount(accountResponse);
7238
+ const depositCall = this.buildDepositCall(walletAddress, token, amount, recipient, data);
7239
+ const [priorityTx, simulation] = await this.buildPriorityStellarTransaction(stellarAccount, network, depositCall);
6808
7240
  if (raw) {
6809
- const transactionXdr = tx.toXDR();
7241
+ const transactionXdr = priorityTx.toXDR();
6810
7242
  return {
6811
7243
  from: walletAddress,
6812
7244
  to: this.chainConfig.addresses.assetManager,
@@ -6814,16 +7246,8 @@ var StellarSpokeProvider = class {
6814
7246
  data: transactionXdr
6815
7247
  };
6816
7248
  }
6817
- if (tx) {
6818
- const signedTx = await this.walletProvider.signTransaction(tx.toXDR());
6819
- const sendResponse = await this.server.sendTransaction(
6820
- TransactionBuilder.fromXDR(signedTx, tx.networkPassphrase)
6821
- );
6822
- if (sendResponse.hash) {
6823
- return `0x${sendResponse.hash}`;
6824
- }
6825
- }
6826
- throw new Error("Failed to create transaction");
7249
+ const hash = await this.submitOrRestoreAndRetry(stellarAccount, network, priorityTx, depositCall, simulation);
7250
+ return `${hash}`;
6827
7251
  } catch (error) {
6828
7252
  console.error("Error during deposit:", error);
6829
7253
  throw error;
@@ -6832,27 +7256,19 @@ var StellarSpokeProvider = class {
6832
7256
  async sendMessage(dst_chain_id, dst_address, payload, raw) {
6833
7257
  try {
6834
7258
  const [network, walletAddress] = await Promise.all([
6835
- this.server.getNetwork(),
7259
+ this.sorobanServer.getNetwork(),
6836
7260
  this.walletProvider.getWalletAddress()
6837
7261
  ]);
6838
- const sourceAccount = await this.server.getAccount(walletAddress);
6839
- const connection = new Contract(this.chainConfig.addresses.connection);
6840
- const simulateTx = new TransactionBuilder(sourceAccount, {
6841
- fee: BASE_FEE,
6842
- networkPassphrase: network.passphrase
6843
- }).addOperation(
6844
- connection.call(
6845
- "send_message",
6846
- nativeToScVal(Address.fromString(walletAddress), { type: "address" }),
6847
- nativeToScVal(dst_chain_id, { type: "u128" }),
6848
- nativeToScVal(Buffer.from(dst_address), { type: "bytes" }),
6849
- nativeToScVal(Buffer.from(payload), { type: "bytes" })
6850
- )
6851
- ).setTimeout(100).build();
6852
- const simResult = await this.server.simulateTransaction(simulateTx);
6853
- const tx = rpc.assembleTransaction(simulateTx, simResult).build();
7262
+ const accountResponse = await this.server.loadAccount(walletAddress);
7263
+ const stellarAccount = new CustomStellarAccount(accountResponse);
7264
+ const sendMessageCall = this.buildSendMessageCall(walletAddress, dst_chain_id, dst_address, payload);
7265
+ const [priorityTx, simulation] = await this.buildPriorityStellarTransaction(
7266
+ stellarAccount,
7267
+ network,
7268
+ sendMessageCall
7269
+ );
6854
7270
  if (raw) {
6855
- const transactionXdr = tx.toXDR();
7271
+ const transactionXdr = priorityTx.toXDR();
6856
7272
  return {
6857
7273
  from: walletAddress,
6858
7274
  to: this.chainConfig.addresses.assetManager,
@@ -6860,21 +7276,35 @@ var StellarSpokeProvider = class {
6860
7276
  data: transactionXdr
6861
7277
  };
6862
7278
  }
6863
- if (tx) {
6864
- const signedTx = await this.walletProvider.signTransaction(tx.toXDR());
6865
- const sendResponse = await this.server.sendTransaction(
6866
- TransactionBuilder.fromXDR(signedTx, tx.networkPassphrase)
6867
- );
6868
- if (sendResponse.hash) {
6869
- return `0x${sendResponse.hash}`;
6870
- }
6871
- }
6872
- throw new Error("Failed to create transaction");
7279
+ const hash = await this.submitOrRestoreAndRetry(stellarAccount, network, priorityTx, sendMessageCall, simulation);
7280
+ return `${hash}`;
6873
7281
  } catch (error) {
6874
- console.error("Error during deposit:", error);
7282
+ console.error("Error during sendMessage:", error);
6875
7283
  throw error;
6876
7284
  }
6877
7285
  }
7286
+ buildDepositCall(walletAddress, token, amount, recipient, data) {
7287
+ return this.contract.call(
7288
+ "transfer",
7289
+ nativeToScVal(Address.fromString(walletAddress), { type: "address" }),
7290
+ nativeToScVal(Address.fromString(token), {
7291
+ type: "address"
7292
+ }),
7293
+ nativeToScVal(BigInt(amount), { type: "u128" }),
7294
+ nativeToScVal(Buffer.from(recipient), { type: "bytes" }),
7295
+ nativeToScVal(Buffer.from(data), { type: "bytes" })
7296
+ );
7297
+ }
7298
+ buildSendMessageCall(walletAddress, dst_chain_id, dst_address, payload) {
7299
+ const connection = new Contract(this.chainConfig.addresses.connection);
7300
+ return connection.call(
7301
+ "send_message",
7302
+ nativeToScVal(Address.fromString(walletAddress), { type: "address" }),
7303
+ nativeToScVal(dst_chain_id, { type: "u128" }),
7304
+ nativeToScVal(Buffer.from(dst_address), { type: "bytes" }),
7305
+ nativeToScVal(Buffer.from(payload), { type: "bytes" })
7306
+ );
7307
+ }
6878
7308
  static getAddressBCSBytes(stellaraddress) {
6879
7309
  return `0x${Address.fromString(stellaraddress).toScVal().toXDR("hex")}`;
6880
7310
  }
@@ -7645,9 +8075,13 @@ function encodeAddress(spokeChainId, address) {
7645
8075
  case "injective-1":
7646
8076
  return toHex(Buffer.from(address, "utf-8"));
7647
8077
  case "0x1.icon":
7648
- return `0x${Buffer.from(address.replace("cx", "01").replace("hx", "00") ?? "f8", "hex").toString("hex")}`;
8078
+ return toHex(Buffer.from(address.replace("cx", "01").replace("hx", "00") ?? "f8", "hex"));
7649
8079
  case "sui":
7650
8080
  return toHex(bcs.Address.serialize(address).toBytes());
8081
+ case "solana":
8082
+ return toHex(Buffer.from(new PublicKey(address).toBytes()));
8083
+ case "stellar":
8084
+ return `0x${Address.fromString(address).toScVal().toXDR("hex")}`;
7651
8085
  default:
7652
8086
  return address;
7653
8087
  }
@@ -7900,10 +8334,10 @@ var MoneyMarketService = class _MoneyMarketService {
7900
8334
  * @param params - The parameters for the supply transaction.
7901
8335
  * @param spokeProvider - The spoke provider.
7902
8336
  * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
7903
- * @returns {Promise<Result<[Hex, Hex], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
8337
+ * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
7904
8338
  *
7905
8339
  * @example
7906
- * const result = await moneyMarketService.supplyAndSubmit(
8340
+ * const result = await moneyMarketService.supply(
7907
8341
  * {
7908
8342
  * token: '0x...', // Address of the token (spoke chain address) to supply
7909
8343
  * amount: 1000n, // Amount to supply (in token decimals)
@@ -7922,40 +8356,47 @@ var MoneyMarketService = class _MoneyMarketService {
7922
8356
  * ] = result.value;
7923
8357
  * console.log('Supply transaction hashes:', { spokeTxHash, hubTxHash });
7924
8358
  */
7925
- async supplyAndSubmit(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
8359
+ async supply(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
7926
8360
  try {
7927
- const txResult = await this.supply(params, spokeProvider);
8361
+ const txResult = await this.createSupplyIntent(params, spokeProvider);
7928
8362
  if (!txResult.ok) {
7929
- return {
7930
- ok: false,
7931
- error: {
7932
- code: "SUPPLY_FAILED",
7933
- error: txResult.error
7934
- }
7935
- };
8363
+ return txResult;
7936
8364
  }
7937
8365
  const packetResult = await relayTxAndWaitPacket(
7938
8366
  txResult.value,
8367
+ spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
7939
8368
  spokeProvider,
7940
8369
  this.config.relayerApiEndpoint,
7941
8370
  timeout
7942
8371
  );
7943
8372
  if (!packetResult.ok) {
7944
- return packetResult;
8373
+ return {
8374
+ ok: false,
8375
+ error: {
8376
+ code: packetResult.error.code,
8377
+ data: {
8378
+ error: packetResult.error,
8379
+ payload: txResult.value
8380
+ }
8381
+ }
8382
+ };
7945
8383
  }
7946
8384
  return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
7947
8385
  } catch (error) {
7948
8386
  return {
7949
8387
  ok: false,
7950
8388
  error: {
7951
- code: "UNKNOWN",
7952
- error
8389
+ code: "SUPPLY_UNKNOWN_ERROR",
8390
+ data: {
8391
+ error,
8392
+ payload: params
8393
+ }
7953
8394
  }
7954
8395
  };
7955
8396
  }
7956
8397
  }
7957
8398
  /**
7958
- * Supply tokens to the money market pool without submitting the intent to the Solver API
8399
+ * Create supply intent only (without submitting to Solver API)
7959
8400
  * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
7960
8401
  * In order to successfully supply tokens, you need to:
7961
8402
  * 1. Check if the allowance is sufficient
@@ -7970,7 +8411,7 @@ var MoneyMarketService = class _MoneyMarketService {
7970
8411
  *
7971
8412
  * @example
7972
8413
  * const moneyMarketService = new MoneyMarketService(config);
7973
- * const result = await moneyMarketService.supply(
8414
+ * const result = await moneyMarketService.createSupplyIntent(
7974
8415
  * {
7975
8416
  * token: "0x123...", // token address
7976
8417
  * amount: 1000000000000000000n // 1 token in wei
@@ -7986,7 +8427,7 @@ var MoneyMarketService = class _MoneyMarketService {
7986
8427
  * console.error('Supply failed:', result.error);
7987
8428
  * }
7988
8429
  */
7989
- async supply(params, spokeProvider, raw) {
8430
+ async createSupplyIntent(params, spokeProvider, raw) {
7990
8431
  try {
7991
8432
  invariant2(params.action === "supply", "Invalid action");
7992
8433
  invariant2(params.token.length > 0, "Token is required");
@@ -8002,7 +8443,12 @@ var MoneyMarketService = class _MoneyMarketService {
8002
8443
  this.hubProvider,
8003
8444
  spokeProvider
8004
8445
  );
8005
- const data = this.supplyData(params.token, hubWallet, params.amount, spokeProvider.chainConfig.chain.id);
8446
+ const data = this.buildSupplyData(
8447
+ params.token,
8448
+ hubWallet,
8449
+ params.amount,
8450
+ spokeProvider.chainConfig.chain.id
8451
+ );
8006
8452
  const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
8007
8453
  const txResult = await SpokeService.deposit(
8008
8454
  {
@@ -8018,14 +8464,21 @@ var MoneyMarketService = class _MoneyMarketService {
8018
8464
  );
8019
8465
  return {
8020
8466
  ok: true,
8021
- value: txResult
8467
+ value: txResult,
8468
+ data: {
8469
+ address: hubWallet,
8470
+ payload: data
8471
+ }
8022
8472
  };
8023
8473
  } catch (error) {
8024
8474
  return {
8025
8475
  ok: false,
8026
8476
  error: {
8027
- code: "UNKNOWN",
8028
- error
8477
+ code: "CREATE_SUPPLY_INTENT_FAILED",
8478
+ data: {
8479
+ error,
8480
+ payload: params
8481
+ }
8029
8482
  }
8030
8483
  };
8031
8484
  }
@@ -8035,10 +8488,10 @@ var MoneyMarketService = class _MoneyMarketService {
8035
8488
  * @param params - The parameters for the borrow transaction.
8036
8489
  * @param spokeProvider - The spoke provider.
8037
8490
  * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
8038
- * @returns {Promise<Result<[Hex, Hex], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
8491
+ * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
8039
8492
  *
8040
8493
  * @example
8041
- * const result = await moneyMarketService.borrowAndSubmit(
8494
+ * const result = await moneyMarketService.borrow(
8042
8495
  * {
8043
8496
  * token: '0x...', // Address of the token (spoke chain address) to borrow
8044
8497
  * amount: 1000n, // Amount to borrow (in token decimals)
@@ -8057,40 +8510,47 @@ var MoneyMarketService = class _MoneyMarketService {
8057
8510
  * ] = result.value;
8058
8511
  * console.log('Borrow transaction hashes:', { spokeTxHash, hubTxHash });
8059
8512
  */
8060
- async borrowAndSubmit(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
8513
+ async borrow(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
8061
8514
  try {
8062
- const txResult = await this.borrow(params, spokeProvider);
8515
+ const txResult = await this.createBorrowIntent(params, spokeProvider);
8063
8516
  if (!txResult.ok) {
8064
- return {
8065
- ok: false,
8066
- error: {
8067
- code: "BORROW_FAILED",
8068
- error: txResult.error
8069
- }
8070
- };
8517
+ return txResult;
8071
8518
  }
8072
8519
  const packetResult = await relayTxAndWaitPacket(
8073
8520
  txResult.value,
8521
+ spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
8074
8522
  spokeProvider,
8075
8523
  this.config.relayerApiEndpoint,
8076
8524
  timeout
8077
8525
  );
8078
8526
  if (!packetResult.ok) {
8079
- return packetResult;
8527
+ return {
8528
+ ok: false,
8529
+ error: {
8530
+ code: packetResult.error.code,
8531
+ data: {
8532
+ error: packetResult.error,
8533
+ payload: txResult.value
8534
+ }
8535
+ }
8536
+ };
8080
8537
  }
8081
8538
  return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
8082
8539
  } catch (error) {
8083
8540
  return {
8084
8541
  ok: false,
8085
8542
  error: {
8086
- code: "UNKNOWN",
8087
- error
8543
+ code: "BORROW_UNKNOWN_ERROR",
8544
+ data: {
8545
+ error,
8546
+ payload: params
8547
+ }
8088
8548
  }
8089
8549
  };
8090
8550
  }
8091
8551
  }
8092
8552
  /**
8093
- * Borrow tokens from the money market pool without submitting the intent to the Solver API
8553
+ * Create borrow intent only (without submitting to Solver API)
8094
8554
  * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
8095
8555
  * In order to successfully borrow tokens, you need to:
8096
8556
  * 1. Execute the borrow transaction on the spoke chain
@@ -8103,13 +8563,13 @@ var MoneyMarketService = class _MoneyMarketService {
8103
8563
  *
8104
8564
  * @example
8105
8565
  * const moneyMarketService = new MoneyMarketService(config);
8106
- * const result = await moneyMarketService.borrow(
8566
+ * const result = await moneyMarketService.createBorrowIntent(
8107
8567
  * {
8108
8568
  * token: "0x123...", // token address
8109
8569
  * amount: 1000000000000000000n // 1 token in wei
8110
8570
  * },
8111
8571
  * spokeProvider,
8112
- * raw // Optional: true = return the raw transaction data, false = exeute and return the transaction hash (default: false)
8572
+ * raw // Optional: true = return the raw transaction data, false = execute and return the transaction hash (default: false)
8113
8573
  * );
8114
8574
  *
8115
8575
  * if (result.ok) {
@@ -8119,7 +8579,7 @@ var MoneyMarketService = class _MoneyMarketService {
8119
8579
  * console.error('Borrow failed:', result.error);
8120
8580
  * }
8121
8581
  */
8122
- async borrow(params, spokeProvider, raw) {
8582
+ async createBorrowIntent(params, spokeProvider, raw) {
8123
8583
  invariant2(params.action === "borrow", "Invalid action");
8124
8584
  invariant2(params.token.length > 0, "Token is required");
8125
8585
  invariant2(params.amount > 0n, "Amount must be greater than 0");
@@ -8134,7 +8594,7 @@ var MoneyMarketService = class _MoneyMarketService {
8134
8594
  this.hubProvider,
8135
8595
  spokeProvider
8136
8596
  );
8137
- const data = this.borrowData(
8597
+ const data = this.buildBorrowData(
8138
8598
  hubWallet,
8139
8599
  walletAddressBytes,
8140
8600
  params.token,
@@ -8142,7 +8602,14 @@ var MoneyMarketService = class _MoneyMarketService {
8142
8602
  spokeProvider.chainConfig.chain.id
8143
8603
  );
8144
8604
  const txResult = await SpokeService.callWallet(hubWallet, data, spokeProvider, this.hubProvider, raw);
8145
- return { ok: true, value: txResult };
8605
+ return {
8606
+ ok: true,
8607
+ value: txResult,
8608
+ data: {
8609
+ address: hubWallet,
8610
+ payload: data
8611
+ }
8612
+ };
8146
8613
  }
8147
8614
  /**
8148
8615
  * Withdraw tokens from the money market pool, relay the transaction to the hub and submit the intent to the Solver API
@@ -8150,10 +8617,10 @@ var MoneyMarketService = class _MoneyMarketService {
8150
8617
  * @param params - The parameters for the withdraw transaction.
8151
8618
  * @param spokeProvider - The spoke provider.
8152
8619
  * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
8153
- * @returns {Promise<Result<[Hex, Hex], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
8620
+ * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the spoke and hub transaction hashes or error
8154
8621
  *
8155
8622
  * @example
8156
- * const result = await moneyMarketService.withdrawAndSubmit(
8623
+ * const result = await moneyMarketService.withdraw(
8157
8624
  * {
8158
8625
  * token: '0x...', // Address of the token (spoke chain address) to withdraw
8159
8626
  * amount: 1000n, // Amount to withdraw (in token decimals)
@@ -8172,40 +8639,47 @@ var MoneyMarketService = class _MoneyMarketService {
8172
8639
  * ] = result.value;
8173
8640
  * console.log('Withdraw transaction hashes:', { spokeTxHash, hubTxHash });
8174
8641
  */
8175
- async withdrawAndSubmit(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
8642
+ async withdraw(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
8176
8643
  try {
8177
- const txResult = await this.withdraw(params, spokeProvider);
8644
+ const txResult = await this.createWithdrawIntent(params, spokeProvider);
8178
8645
  if (!txResult.ok) {
8179
- return {
8180
- ok: false,
8181
- error: {
8182
- code: "WITHDRAW_FAILED",
8183
- error: txResult.error
8184
- }
8185
- };
8646
+ return txResult;
8186
8647
  }
8187
8648
  const packetResult = await relayTxAndWaitPacket(
8188
8649
  txResult.value,
8650
+ spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
8189
8651
  spokeProvider,
8190
8652
  this.config.relayerApiEndpoint,
8191
8653
  timeout
8192
8654
  );
8193
8655
  if (!packetResult.ok) {
8194
- return packetResult;
8656
+ return {
8657
+ ok: false,
8658
+ error: {
8659
+ code: packetResult.error.code,
8660
+ data: {
8661
+ error: packetResult.error,
8662
+ payload: txResult.value
8663
+ }
8664
+ }
8665
+ };
8195
8666
  }
8196
8667
  return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
8197
8668
  } catch (error) {
8198
8669
  return {
8199
8670
  ok: false,
8200
8671
  error: {
8201
- code: "UNKNOWN",
8202
- error
8672
+ code: "WITHDRAW_UNKNOWN_ERROR",
8673
+ data: {
8674
+ error,
8675
+ payload: params
8676
+ }
8203
8677
  }
8204
8678
  };
8205
8679
  }
8206
8680
  }
8207
8681
  /**
8208
- * Withdraw tokens from the money market pool without submitting the intent to the Solver API
8682
+ * Create withdraw intent only (without submitting to Solver API)
8209
8683
  * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
8210
8684
  * In order to successfully withdraw tokens, you need to:
8211
8685
  * 1. Execute the withdraw transaction on the spoke chain
@@ -8218,7 +8692,7 @@ var MoneyMarketService = class _MoneyMarketService {
8218
8692
  *
8219
8693
  * @example
8220
8694
  * const moneyMarketService = new MoneyMarketService(config);
8221
- * const result = await moneyMarketService.withdraw(
8695
+ * const result = await moneyMarketService.createWithdrawIntent(
8222
8696
  * {
8223
8697
  * token: "0x123...", // token address
8224
8698
  * amount: 1000000000000000000n // 1 token in wei
@@ -8234,7 +8708,7 @@ var MoneyMarketService = class _MoneyMarketService {
8234
8708
  * console.error('Withdraw failed:', result.error);
8235
8709
  * }
8236
8710
  */
8237
- async withdraw(params, spokeProvider, raw) {
8711
+ async createWithdrawIntent(params, spokeProvider, raw) {
8238
8712
  invariant2(params.action === "withdraw", "Invalid action");
8239
8713
  invariant2(params.token.length > 0, "Token is required");
8240
8714
  invariant2(params.amount > 0n, "Amount must be greater than 0");
@@ -8249,7 +8723,7 @@ var MoneyMarketService = class _MoneyMarketService {
8249
8723
  this.hubProvider,
8250
8724
  spokeProvider
8251
8725
  );
8252
- const data = this.withdrawData(
8726
+ const data = this.buildWithdrawData(
8253
8727
  hubWallet,
8254
8728
  walletAddressBytes,
8255
8729
  params.token,
@@ -8257,7 +8731,14 @@ var MoneyMarketService = class _MoneyMarketService {
8257
8731
  spokeProvider.chainConfig.chain.id
8258
8732
  );
8259
8733
  const txResult = await SpokeService.callWallet(hubWallet, data, spokeProvider, this.hubProvider, raw);
8260
- return { ok: true, value: txResult };
8734
+ return {
8735
+ ok: true,
8736
+ value: txResult,
8737
+ data: {
8738
+ address: hubWallet,
8739
+ payload: data
8740
+ }
8741
+ };
8261
8742
  }
8262
8743
  /**
8263
8744
  * Repay tokens to the money market pool, relay the transaction to the hub and submit the intent to the Solver API
@@ -8265,10 +8746,10 @@ var MoneyMarketService = class _MoneyMarketService {
8265
8746
  * @param params - The parameters for the repay transaction.
8266
8747
  * @param spokeProvider - The spoke provider.
8267
8748
  * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
8268
- * @returns {Promise<Result<[Hex, Hex], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
8749
+ * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the spoke and hub transaction hashes or error
8269
8750
  *
8270
8751
  * @example
8271
- * const result = await moneyMarketService.repayAndSubmit(
8752
+ * const result = await moneyMarketService.repay(
8272
8753
  * {
8273
8754
  * token: '0x...', // Address of the token (spoke chain address) to repay
8274
8755
  * amount: 1000n, // Amount to repay (in token decimals)
@@ -8287,40 +8768,47 @@ var MoneyMarketService = class _MoneyMarketService {
8287
8768
  * ] = result.value;
8288
8769
  * console.log('Repay transaction hashes:', { spokeTxHash, hubTxHash });
8289
8770
  */
8290
- async repayAndSubmit(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
8771
+ async repay(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
8291
8772
  try {
8292
- const txResult = await this.repay(params, spokeProvider);
8773
+ const txResult = await this.createRepayIntent(params, spokeProvider);
8293
8774
  if (!txResult.ok) {
8294
- return {
8295
- ok: false,
8296
- error: {
8297
- code: "REPAY_FAILED",
8298
- error: txResult.error
8299
- }
8300
- };
8775
+ return txResult;
8301
8776
  }
8302
8777
  const packetResult = await relayTxAndWaitPacket(
8303
8778
  txResult.value,
8779
+ spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
8304
8780
  spokeProvider,
8305
8781
  this.config.relayerApiEndpoint,
8306
8782
  timeout
8307
8783
  );
8308
8784
  if (!packetResult.ok) {
8309
- return packetResult;
8785
+ return {
8786
+ ok: false,
8787
+ error: {
8788
+ code: packetResult.error.code,
8789
+ data: {
8790
+ error: packetResult.error,
8791
+ payload: txResult.value
8792
+ }
8793
+ }
8794
+ };
8310
8795
  }
8311
8796
  return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
8312
8797
  } catch (error) {
8313
8798
  return {
8314
8799
  ok: false,
8315
8800
  error: {
8316
- code: "UNKNOWN",
8317
- error
8801
+ code: "REPAY_UNKNOWN_ERROR",
8802
+ data: {
8803
+ error,
8804
+ payload: params
8805
+ }
8318
8806
  }
8319
8807
  };
8320
8808
  }
8321
8809
  }
8322
8810
  /**
8323
- * Repay tokens to the money market pool without submitting the intent to the Solver API
8811
+ * Create repay intent only (without submitting to Solver API)
8324
8812
  * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
8325
8813
  * In order to successfully repay tokens, you need to:
8326
8814
  * 1. Check if the allowance is sufficient
@@ -8335,7 +8823,7 @@ var MoneyMarketService = class _MoneyMarketService {
8335
8823
  *
8336
8824
  * @example
8337
8825
  * const moneyMarketService = new MoneyMarketService(config);
8338
- * const result = await moneyMarketService.repay(
8826
+ * const result = await moneyMarketService.createRepayIntent(
8339
8827
  * {
8340
8828
  * token: "0x123...", // token address
8341
8829
  * amount: 1000000000000000000n // 1 token in wei
@@ -8351,7 +8839,7 @@ var MoneyMarketService = class _MoneyMarketService {
8351
8839
  * console.error('Repay failed:', result.error);
8352
8840
  * }
8353
8841
  */
8354
- async repay(params, spokeProvider, raw) {
8842
+ async createRepayIntent(params, spokeProvider, raw) {
8355
8843
  invariant2(params.action === "repay", "Invalid action");
8356
8844
  invariant2(params.token.length > 0, "Token is required");
8357
8845
  invariant2(params.amount > 0n, "Amount must be greater than 0");
@@ -8366,7 +8854,7 @@ var MoneyMarketService = class _MoneyMarketService {
8366
8854
  this.hubProvider,
8367
8855
  spokeProvider
8368
8856
  );
8369
- const data = this.repayData(params.token, hubWallet, params.amount, spokeProvider.chainConfig.chain.id);
8857
+ const data = this.buildRepayData(params.token, hubWallet, params.amount, spokeProvider.chainConfig.chain.id);
8370
8858
  const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
8371
8859
  const txResult = await SpokeService.deposit(
8372
8860
  {
@@ -8380,7 +8868,14 @@ var MoneyMarketService = class _MoneyMarketService {
8380
8868
  this.hubProvider,
8381
8869
  raw
8382
8870
  );
8383
- return { ok: true, value: txResult };
8871
+ return {
8872
+ ok: true,
8873
+ value: txResult,
8874
+ data: {
8875
+ address: hubWallet,
8876
+ payload: data
8877
+ }
8878
+ };
8384
8879
  }
8385
8880
  /**
8386
8881
  * Build transaction data for supplying to the money market pool
@@ -8390,7 +8885,7 @@ var MoneyMarketService = class _MoneyMarketService {
8390
8885
  * @param spokeChainId - The chain ID of the spoke chain
8391
8886
  * @returns {Hex} The transaction data.
8392
8887
  */
8393
- supplyData(token, to, amount, spokeChainId) {
8888
+ buildSupplyData(token, to, amount, spokeChainId) {
8394
8889
  const calls = [];
8395
8890
  const assetConfig = getHubAssetInfo(spokeChainId, token);
8396
8891
  invariant2(assetConfig, `hub asset not found for spoke chain token (token): ${token}`);
@@ -8418,7 +8913,7 @@ var MoneyMarketService = class _MoneyMarketService {
8418
8913
  * @param spokeChainId - The chain ID of the spoke chain
8419
8914
  * @returns {Hex} The transaction data.
8420
8915
  */
8421
- borrowData(from, to, token, amount, spokeChainId) {
8916
+ buildBorrowData(from, to, token, amount, spokeChainId) {
8422
8917
  invariant2(isValidSpokeChainId(spokeChainId), `Invalid spokeChainId: ${spokeChainId}`);
8423
8918
  invariant2(
8424
8919
  isValidOriginalAssetAddress(spokeChainId, token),
@@ -8493,7 +8988,7 @@ var MoneyMarketService = class _MoneyMarketService {
8493
8988
  * @param spokeChainId - The chain ID of the spoke chain
8494
8989
  * @returns {Hex} The transaction data.
8495
8990
  */
8496
- withdrawData(from, to, token, amount, spokeChainId) {
8991
+ buildWithdrawData(from, to, token, amount, spokeChainId) {
8497
8992
  const calls = [];
8498
8993
  const assetConfig = getHubAssetInfo(spokeChainId, token);
8499
8994
  if (!assetConfig) {
@@ -8544,11 +9039,11 @@ var MoneyMarketService = class _MoneyMarketService {
8544
9039
  * @param spokeChainId - The chain ID of the spoke chain
8545
9040
  * @returns {Hex} The transaction data.
8546
9041
  */
8547
- repayData(token, to, amount, spokeChainId) {
9042
+ buildRepayData(token, to, amount, spokeChainId) {
8548
9043
  const calls = [];
8549
9044
  const assetConfig = getHubAssetInfo(spokeChainId, token);
8550
9045
  if (!assetConfig) {
8551
- throw new Error("[repayData] Hub asset not found");
9046
+ throw new Error("[buildRepayData] Hub asset not found");
8552
9047
  }
8553
9048
  const assetAddress = assetConfig.asset;
8554
9049
  const vaultAddress = assetConfig.vault;
@@ -9168,7 +9663,7 @@ var SolanaSpokeService = class _SolanaSpokeService {
9168
9663
  static async deposit(params, spokeProvider, hubProvider, raw) {
9169
9664
  const userWallet = params.to ?? await EvmWalletAbstraction.getUserHubWalletAddress(
9170
9665
  spokeProvider.chainConfig.chain.id,
9171
- toHex(new PublicKey(params.from).toBytes()),
9666
+ encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
9172
9667
  hubProvider
9173
9668
  );
9174
9669
  return _SolanaSpokeService.transfer(
@@ -9176,7 +9671,7 @@ var SolanaSpokeService = class _SolanaSpokeService {
9176
9671
  token: new PublicKey(params.token),
9177
9672
  recipient: userWallet,
9178
9673
  amount: params.amount.toString(),
9179
- data: params.data
9674
+ data: keccak256(params.data)
9180
9675
  },
9181
9676
  spokeProvider,
9182
9677
  raw
@@ -9210,7 +9705,7 @@ var SolanaSpokeService = class _SolanaSpokeService {
9210
9705
  */
9211
9706
  static async callWallet(from, payload, spokeProvider, hubProvider, raw) {
9212
9707
  const relayId = getIntentRelayChainId(hubProvider.chainConfig.chain.id);
9213
- return _SolanaSpokeService.call(BigInt(relayId), from, payload, spokeProvider, raw);
9708
+ return _SolanaSpokeService.call(BigInt(relayId), from, keccak256(payload), spokeProvider, raw);
9214
9709
  }
9215
9710
  static async transfer({ token, recipient, amount, data }, spokeProvider, raw) {
9216
9711
  let depositInstruction;
@@ -9763,9 +10258,9 @@ var SonicSpokeService = class _SonicSpokeService {
9763
10258
  }
9764
10259
  return spokeProvider.walletProvider.sendTransaction(rawTx);
9765
10260
  }
9766
- static async withdrawData(from, withdrawInfo, amount, spokeProvider, moneyMarketService) {
10261
+ static async buildWithdrawData(from, withdrawInfo, amount, spokeProvider, moneyMarketService) {
9767
10262
  const userRouter = await _SonicSpokeService.getUserRouter(from, spokeProvider);
9768
- const withdrawCall = moneyMarketService.withdrawData(
10263
+ const withdrawCall = moneyMarketService.buildWithdrawData(
9769
10264
  userRouter,
9770
10265
  from,
9771
10266
  withdrawInfo.token,
@@ -9866,6 +10361,51 @@ function isConfiguredSolverConfig(value) {
9866
10361
  function isConfiguredMoneyMarketConfig(value) {
9867
10362
  return typeof value === "object" && value !== null && "lendingPool" in value && "uiPoolDataProvider" in value && "poolAddressesProvider" in value && "bnUSD" in value && "bnUSDVault" in value;
9868
10363
  }
10364
+ function isIntentCreationFailedError(error) {
10365
+ return typeof error === "object" && error !== null && "code" in error && error.code === "CREATION_FAILED" && "data" in error && typeof error.data === "object" && error.data !== null && "payload" in error.data && "error" in error.data;
10366
+ }
10367
+ function isIntentSubmitTxFailedError(error) {
10368
+ return typeof error === "object" && error !== null && "code" in error && error.code === "SUBMIT_TX_FAILED" && "data" in error && typeof error.data === "object" && error.data !== null && "payload" in error.data && "error" in error.data;
10369
+ }
10370
+ function isIntentPostExecutionFailedError(error) {
10371
+ return typeof error === "object" && error !== null && "code" in error && error.code === "POST_EXECUTION_FAILED" && "data" in error && typeof error.data === "object" && error.data !== null && "detail" in error.data;
10372
+ }
10373
+ function isWaitUntilIntentExecutedFailed(error) {
10374
+ return typeof error === "object" && error !== null && "code" in error && error.code === "RELAY_TIMEOUT" && "data" in error && typeof error.data === "object" && error.data !== null && "payload" in error.data && "error" in error.data;
10375
+ }
10376
+ function isIntentCreationUnknownError(error) {
10377
+ return typeof error === "object" && error !== null && "code" in error && error.code === "UNKNOWN" && "data" in error && typeof error.data === "object" && error.data !== null && "payload" in error.data && "error" in error.data;
10378
+ }
10379
+ function isMoneyMarketSubmitTxFailedError(error) {
10380
+ return typeof error === "object" && error !== null && "code" in error && error.code === "SUBMIT_TX_FAILED";
10381
+ }
10382
+ function isMoneyMarketRelayTimeoutError(error) {
10383
+ return typeof error === "object" && error !== null && "code" in error && error.code === "RELAY_TIMEOUT";
10384
+ }
10385
+ function isMoneyMarketCreateSupplyIntentFailedError(error) {
10386
+ return typeof error === "object" && error !== null && "code" in error && error.code === "CREATE_SUPPLY_INTENT_FAILED";
10387
+ }
10388
+ function isMoneyMarketCreateBorrowIntentFailedError(error) {
10389
+ return typeof error === "object" && error !== null && "code" in error && error.code === "CREATE_BORROW_INTENT_FAILED";
10390
+ }
10391
+ function isMoneyMarketCreateWithdrawIntentFailedError(error) {
10392
+ return typeof error === "object" && error !== null && "code" in error && error.code === "CREATE_WITHDRAW_INTENT_FAILED";
10393
+ }
10394
+ function isMoneyMarketCreateRepayIntentFailedError(error) {
10395
+ return typeof error === "object" && error !== null && "code" in error && error.code === "CREATE_REPAY_INTENT_FAILED";
10396
+ }
10397
+ function isMoneyMarketSupplyUnknownError(error) {
10398
+ return typeof error === "object" && error !== null && "code" in error && error.code === "SUPPLY_UNKNOWN_ERROR";
10399
+ }
10400
+ function isMoneyMarketBorrowUnknownError(error) {
10401
+ return typeof error === "object" && error !== null && "code" in error && error.code === "BORROW_UNKNOWN_ERROR";
10402
+ }
10403
+ function isMoneyMarketWithdrawUnknownError(error) {
10404
+ return typeof error === "object" && error !== null && "code" in error && error.code === "WITHDRAW_UNKNOWN_ERROR";
10405
+ }
10406
+ function isMoneyMarketRepayUnknownError(error) {
10407
+ return typeof error === "object" && error !== null && "code" in error && error.code === "REPAY_UNKNOWN_ERROR";
10408
+ }
9869
10409
 
9870
10410
  // src/services/spoke/SpokeService.ts
9871
10411
  var SpokeService = class {
@@ -10062,12 +10602,12 @@ async function waitUntilIntentExecuted(payload) {
10062
10602
  } catch (e) {
10063
10603
  console.error("Error getting transaction packets", e);
10064
10604
  }
10065
- await new Promise((resolve) => setTimeout(resolve, 1e3));
10605
+ await new Promise((resolve) => setTimeout(resolve, 2e3));
10066
10606
  }
10067
10607
  return {
10068
10608
  ok: false,
10069
10609
  error: {
10070
- code: "TIMEOUT",
10610
+ code: "RELAY_TIMEOUT",
10071
10611
  data: {
10072
10612
  payload,
10073
10613
  error: {
@@ -10081,7 +10621,7 @@ async function waitUntilIntentExecuted(payload) {
10081
10621
  return {
10082
10622
  ok: false,
10083
10623
  error: {
10084
- code: "TIMEOUT",
10624
+ code: "RELAY_TIMEOUT",
10085
10625
  data: {
10086
10626
  payload,
10087
10627
  error: e
@@ -10090,12 +10630,16 @@ async function waitUntilIntentExecuted(payload) {
10090
10630
  };
10091
10631
  }
10092
10632
  }
10093
- async function relayTxAndWaitPacket(spokeTxHash, spokeProvider, relayerApiEndpoint, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
10633
+ async function relayTxAndWaitPacket(spokeTxHash, data, spokeProvider, relayerApiEndpoint, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
10094
10634
  try {
10095
10635
  const intentRelayChainId = getIntentRelayChainId(spokeProvider.chainConfig.chain.id).toString();
10096
10636
  const submitPayload = {
10097
10637
  action: "submit",
10098
- params: {
10638
+ params: data ? {
10639
+ chain_id: intentRelayChainId,
10640
+ tx_hash: spokeTxHash,
10641
+ data
10642
+ } : {
10099
10643
  chain_id: intentRelayChainId,
10100
10644
  tx_hash: spokeTxHash
10101
10645
  }
@@ -10120,7 +10664,7 @@ async function relayTxAndWaitPacket(spokeTxHash, spokeProvider, relayerApiEndpoi
10120
10664
  return {
10121
10665
  ok: false,
10122
10666
  error: {
10123
- code: "TIMEOUT",
10667
+ code: "RELAY_TIMEOUT",
10124
10668
  error: packet.error
10125
10669
  }
10126
10670
  };
@@ -10133,7 +10677,7 @@ async function relayTxAndWaitPacket(spokeTxHash, spokeProvider, relayerApiEndpoi
10133
10677
  return {
10134
10678
  ok: false,
10135
10679
  error: {
10136
- code: "UNKNOWN",
10680
+ code: "SUBMIT_TX_FAILED",
10137
10681
  error
10138
10682
  }
10139
10683
  };
@@ -10171,6 +10715,8 @@ var EvmSolverService = class _EvmSolverService {
10171
10715
  outputToken,
10172
10716
  srcChain: getIntentRelayChainId(createIntentParams.srcChain),
10173
10717
  dstChain: getIntentRelayChainId(createIntentParams.dstChain),
10718
+ srcAddress: encodeAddress(createIntentParams.srcChain, createIntentParams.srcAddress),
10719
+ dstAddress: encodeAddress(createIntentParams.dstChain, createIntentParams.dstAddress),
10174
10720
  intentId: randomUint256(),
10175
10721
  creator: creatorHubWalletAddress,
10176
10722
  data: feeData
@@ -10398,7 +10944,7 @@ var SolverApiService = class {
10398
10944
  * }
10399
10945
  * }
10400
10946
  */
10401
- static async postExecution(intentExecutionRequest, config) {
10947
+ static async postExecution(request, config) {
10402
10948
  try {
10403
10949
  const response = await retry(
10404
10950
  () => fetch(`${config.solverApiEndpoint}/execute`, {
@@ -10406,7 +10952,7 @@ var SolverApiService = class {
10406
10952
  headers: {
10407
10953
  "Content-Type": "application/json"
10408
10954
  },
10409
- body: JSON.stringify(intentExecutionRequest)
10955
+ body: JSON.stringify(request)
10410
10956
  })
10411
10957
  );
10412
10958
  if (!response.ok) {
@@ -10432,15 +10978,15 @@ var SolverApiService = class {
10432
10978
  };
10433
10979
  }
10434
10980
  }
10435
- static async getStatus(intentStatusRequest, config) {
10436
- invariant2(intentStatusRequest.intent_tx_hash.length > 0, "Empty intent_tx_hash");
10981
+ static async getStatus(request, config) {
10982
+ invariant2(request.intent_tx_hash.length > 0, "Empty intent_tx_hash");
10437
10983
  try {
10438
10984
  const response = await fetch(`${config.solverApiEndpoint}/status`, {
10439
10985
  method: "POST",
10440
10986
  headers: {
10441
10987
  "Content-Type": "application/json"
10442
10988
  },
10443
- body: JSON.stringify(intentStatusRequest)
10989
+ body: JSON.stringify(request)
10444
10990
  });
10445
10991
  if (!response.ok) {
10446
10992
  return {
@@ -10499,8 +11045,8 @@ var SolverService = class {
10499
11045
  }
10500
11046
  /**
10501
11047
  * Request a quote from the solver API
10502
- * @param {IntentQuoteRequest} payload - The intent quote request
10503
- * @returns {Promise<Result<IntentQuoteResponse, IntentErrorResponse>>} The intent quote response
11048
+ * @param {SolverIntentQuoteRequest} payload - The solver intent quote request
11049
+ * @returns {Promise<Result<SolverIntentQuoteResponse, SolverErrorResponse>>} The intent quote response
10504
11050
  *
10505
11051
  * @example
10506
11052
  * const payload = {
@@ -10510,7 +11056,7 @@ var SolverService = class {
10510
11056
  * "token_dst_blockchain_id":"0xa4b1.arbitrum",
10511
11057
  * "amount":1000000000000000n,
10512
11058
  * "quote_type": "exact_input"
10513
- * } satisfies IntentQuoteRequest
11059
+ * } satisfies SolverIntentQuoteRequest
10514
11060
  *
10515
11061
  * const response = await solverService.getQuote(payload);
10516
11062
  *
@@ -10542,15 +11088,15 @@ var SolverService = class {
10542
11088
  /**
10543
11089
  * Get the status of an intent from Solver API
10544
11090
  * NOTE: intentHash should be retrieved from relay packet dst_tx_hash property (see createAndSubmitIntent)
10545
- * @param {IntentStatusRequest} intentStatusRequest - The intent status request
10546
- * @returns {Promise<Result<IntentStatusResponse, IntentErrorResponse>>} The intent status response
11091
+ * @param {SolverIntentStatusRequest} request - The intent status request
11092
+ * @returns {Promise<Result<SolverIntentStatusResponse, SolverErrorResponse>>} The solver intent status response
10547
11093
  *
10548
11094
  * @example
10549
- * const intentStatusRequest = {
10550
- * "intentHash": "a0dd7652-b360-4123-ab2d-78cfbcd20c6b" // destination tx hash from relay packet
10551
- * } satisfies IntentStatusRequest
11095
+ * const request = {
11096
+ * "intent_tx_hash": "a0dd7652-b360-4123-ab2d-78cfbcd20c6b" // destination tx hash from relay packet
11097
+ * } satisfies SolverIntentStatusRequest
10552
11098
  *
10553
- * const response = await solverService.getStatus(intentStatusRequest);
11099
+ * const response = await solverService.getStatus(request);
10554
11100
  *
10555
11101
  * if (response.ok) {
10556
11102
  * const { status, intent_hash } = response.value;
@@ -10560,20 +11106,20 @@ var SolverService = class {
10560
11106
  * // handle error
10561
11107
  * }
10562
11108
  */
10563
- async getStatus(intentStatusRequest) {
10564
- return SolverApiService.getStatus(intentStatusRequest, this.config);
11109
+ async getStatus(request) {
11110
+ return SolverApiService.getStatus(request, this.config);
10565
11111
  }
10566
11112
  /**
10567
11113
  * Post execution of intent order transaction executed on hub chain to Solver API
10568
- * @param {IntentExecutionRequest} intentExecutionRequest - The intent execution request
10569
- * @returns {Promise<Result<IntentExecutionResponse, IntentErrorResponse>>} The intent execution response
11114
+ * @param {SolverExecutionRequest} request - The intent execution request
11115
+ * @returns {Promise<Result<SolverExecutionResponse, SolverErrorResponse>>} The intent execution response
10570
11116
  *
10571
11117
  * @example
10572
- * const intentExecutionRequest = {
11118
+ * const request = {
10573
11119
  * "intent_tx_hash": "0xba3dce19347264db32ced212ff1a2036f20d9d2c7493d06af15027970be061af",
10574
- * } satisfies IntentExecutionRequest
11120
+ * } satisfies SolverExecutionRequest
10575
11121
  *
10576
- * const response = await solverService.postExecution(intentExecutionRequest);
11122
+ * const response = await solverService.postExecution(request);
10577
11123
  *
10578
11124
  * if (response.ok) {
10579
11125
  * const { answer, intent_hash } = response.value;
@@ -10583,15 +11129,108 @@ var SolverService = class {
10583
11129
  * // handle error
10584
11130
  * }
10585
11131
  */
10586
- async postExecution(intentExecutionRequest) {
10587
- return SolverApiService.postExecution(intentExecutionRequest, this.config);
11132
+ async postExecution(request) {
11133
+ return SolverApiService.postExecution(request, this.config);
11134
+ }
11135
+ /**
11136
+ * Submit intent transaction to the relayer API
11137
+ * @param {IntentRelayRequest<'submit'>} submitPayload - The intent relay request
11138
+ * @returns {Promise<Result<GetRelayResponse<'submit'>, IntentError<'SUBMIT_TX_FAILED'>>>} The intent relay response
11139
+ *
11140
+ * @example
11141
+ * const submitPayload = {
11142
+ * "action": "submit",
11143
+ * "params": {
11144
+ * "chain_id": "0x38.bsc",
11145
+ * "tx_hash": "0xba3dce19347264db32ced212ff1a2036f20d9d2c7493d06af15027970be061af",
11146
+ * },
11147
+ * } satisfies IntentRelayRequest<'submit'>;
11148
+ *
11149
+ * const submitResult = await solverService.submitIntent(submitPayload);
11150
+ *
11151
+ * if (submitResult.ok) {
11152
+ * const { success, message } = submitResult.value;
11153
+ * console.log('Success:', success);
11154
+ * console.log('Message:', message);
11155
+ * } else {
11156
+ * // handle error
11157
+ * }
11158
+ */
11159
+ async submitIntent(submitPayload) {
11160
+ try {
11161
+ const submitResult = await submitTransaction(submitPayload, this.config.relayerApiEndpoint);
11162
+ if (!submitResult.success) {
11163
+ return {
11164
+ ok: false,
11165
+ error: {
11166
+ code: "SUBMIT_TX_FAILED",
11167
+ data: {
11168
+ payload: submitPayload,
11169
+ error: new Error(submitResult.message)
11170
+ }
11171
+ }
11172
+ };
11173
+ }
11174
+ return {
11175
+ ok: true,
11176
+ value: submitResult
11177
+ };
11178
+ } catch (error) {
11179
+ return {
11180
+ ok: false,
11181
+ error: {
11182
+ code: "SUBMIT_TX_FAILED",
11183
+ data: {
11184
+ payload: submitPayload,
11185
+ error
11186
+ }
11187
+ }
11188
+ };
11189
+ }
11190
+ }
11191
+ /**
11192
+ * Swap is a syntatic sugar for createAndSubmitIntent that creates an intent and submits it to the Solver API and Relayer API
11193
+ * @param {CreateIntentParams} payload - The intent to create
11194
+ * @param {ISpokeProvider} spokeProvider - The spoke provider
11195
+ * @param {number} timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
11196
+ * @returns {Promise<Result<[SolverExecutionResponse, Intent, PacketData], IntentError<IntentErrorCode>>>} The solver execution response, intent, and packet data
11197
+ *
11198
+ * @example
11199
+ * const payload = {
11200
+ * "inputToken": "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", // BSC ETH token address
11201
+ * "outputToken": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", // ARB WBTC token address
11202
+ * "inputAmount": 1000000000000000n, // The amount of input tokens
11203
+ * "minOutputAmount": 900000000000000n, // min amount you are expecting to receive
11204
+ * "deadline": 0n, // Optional timestamp after which intent expires (0 = no deadline)
11205
+ * "allowPartialFill": false, // Whether the intent can be partially filled
11206
+ * "srcChain": "0x38.bsc", // Chain ID where input tokens originate
11207
+ * "dstChain": "0xa4b1.arbitrum", // Chain ID where output tokens should be delivered
11208
+ * "srcAddress": "0x..", // Source address (original address on spoke chain)
11209
+ * "dstAddress": "0x...", // Destination address (original address on spoke chain)
11210
+ * "solver": "0x..", // Optional specific solver address (address(0) = any solver)
11211
+ * "data": "0x..", // Additional arbitrary data
11212
+ * } satisfies CreateIntentParams;
11213
+ *
11214
+ * const swapResult = await solverService.swap(payload, spokeProvider);
11215
+ *
11216
+ * if (swapResult.ok) {
11217
+ * const [solverExecutionResponse, intent, packetData] = swapResult.value;
11218
+ * console.log('Intent execution response:', solverExecutionResponse);
11219
+ * console.log('Intent:', intent);
11220
+ * console.log('Packet data:', packetData);
11221
+ * } else {
11222
+ * // handle error
11223
+ * }
11224
+ */
11225
+ async swap(payload, spokeProvider, fee, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
11226
+ return this.createAndSubmitIntent(payload, spokeProvider, fee, timeout);
10588
11227
  }
10589
11228
  /**
10590
11229
  * Creates an intent and submits it to the Solver API and Relayer API
10591
11230
  * @param {CreateIntentParams} payload - The intent to create
10592
11231
  * @param {ISpokeProvider} spokeProvider - The spoke provider
10593
11232
  * @param {number} timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
10594
- * @returns {Promise<Result<[IntentExecutionResponse, Intent, PacketData], IntentSubmitError<IntentSubmitErrorCode>>>} The intent execution response, intent, and packet data
11233
+ * @returns {Promise<Result<[SolverExecutionResponse, Intent, PacketData], IntentError<IntentErrorCode>>>} The solver execution response, intent, and packet data
10595
11234
  *
10596
11235
  * @example
10597
11236
  * const payload = {
@@ -10603,8 +11242,8 @@ var SolverService = class {
10603
11242
  * "allowPartialFill": false, // Whether the intent can be partially filled
10604
11243
  * "srcChain": "0x38.bsc", // Chain ID where input tokens originate
10605
11244
  * "dstChain": "0xa4b1.arbitrum", // Chain ID where output tokens should be delivered
10606
- * "srcAddress": "0x..", // Source address in bytes (original address on spoke chain)
10607
- * "dstAddress": "0x...", // Destination address in bytes (original address on spoke chain)
11245
+ * "srcAddress": "0x..", // Source address (original address on spoke chain)
11246
+ * "dstAddress": "0x...", // Destination address (original address on spoke chain)
10608
11247
  * "solver": "0x..", // Optional specific solver address (address(0) = any solver)
10609
11248
  * "data": "0x..", // Additional arbitrary data
10610
11249
  * } satisfies CreateIntentParams;
@@ -10612,8 +11251,8 @@ var SolverService = class {
10612
11251
  * const createAndSubmitIntentResult = await solverService.createAndSubmitIntent(payload, spokeProvider);
10613
11252
  *
10614
11253
  * if (createAndSubmitIntentResult.ok) {
10615
- * const [intentExecutionResponse, intent, packetData] = createAndSubmitIntentResult.value;
10616
- * console.log('Intent execution response:', intentExecutionResponse);
11254
+ * const [solverExecutionResponse, intent, packetData] = createAndSubmitIntentResult.value;
11255
+ * console.log('Intent execution response:', solverExecutionResponse);
10617
11256
  * console.log('Intent:', intent);
10618
11257
  * console.log('Packet data:', packetData);
10619
11258
  * } else {
@@ -10624,32 +11263,30 @@ var SolverService = class {
10624
11263
  try {
10625
11264
  const createIntentResult = await this.createIntent(payload, spokeProvider, fee, false);
10626
11265
  if (!createIntentResult.ok) {
10627
- return {
10628
- ok: false,
10629
- error: createIntentResult.error
10630
- };
11266
+ return createIntentResult;
10631
11267
  }
10632
- const [spokeTxHash, intent] = createIntentResult.value;
11268
+ const [spokeTxHash, intent, data] = createIntentResult.value;
10633
11269
  const intentRelayChainId = getIntentRelayChainId(payload.srcChain).toString();
10634
- const submitPayload = {
11270
+ const submitPayload = payload.srcChain === SOLANA_MAINNET_CHAIN_ID && data ? {
11271
+ action: "submit",
11272
+ params: {
11273
+ chain_id: intentRelayChainId,
11274
+ tx_hash: spokeTxHash,
11275
+ data: {
11276
+ address: intent.creator,
11277
+ payload: data
11278
+ }
11279
+ }
11280
+ } : {
10635
11281
  action: "submit",
10636
11282
  params: {
10637
11283
  chain_id: intentRelayChainId,
10638
11284
  tx_hash: spokeTxHash
10639
11285
  }
10640
11286
  };
10641
- const submitResult = await submitTransaction(submitPayload, this.config.relayerApiEndpoint);
10642
- if (!submitResult.success) {
10643
- return {
10644
- ok: false,
10645
- error: {
10646
- code: "SUBMIT_TX_FAILED",
10647
- data: {
10648
- payload: submitPayload,
10649
- apiUrl: this.config.relayerApiEndpoint
10650
- }
10651
- }
10652
- };
11287
+ const submitResult = await this.submitIntent(submitPayload);
11288
+ if (!submitResult.ok) {
11289
+ return submitResult;
10653
11290
  }
10654
11291
  const packet = await waitUntilIntentExecuted({
10655
11292
  intentRelayChainId,
@@ -10708,8 +11345,8 @@ var SolverService = class {
10708
11345
  * "allowPartialFill": false, // Whether the intent can be partially filled
10709
11346
  * "srcChain": "0x38.bsc", // Chain ID where input tokens originate
10710
11347
  * "dstChain": "0xa4b1.arbitrum", // Chain ID where output tokens should be delivered
10711
- * "srcAddress": "0x..", // Source address in bytes (original address on spoke chain)
10712
- * "dstAddress": "0x...", // Destination address in bytes (original address on spoke chain)
11348
+ * "srcAddress": "0x..", // Source address (original address on spoke chain)
11349
+ * "dstAddress": "0x...", // Destination address (original address on spoke chain)
10713
11350
  * "solver": "0x..", // Optional specific solver address (address(0) = any solver)
10714
11351
  * "data": "0x..", // Additional arbitrary data
10715
11352
  * } satisfies CreateIntentParams;
@@ -10800,11 +11437,11 @@ var SolverService = class {
10800
11437
  /**
10801
11438
  * Creates an intent by handling token approval and intent creation
10802
11439
  * NOTE: This method does not submit the intent to the Solver API
10803
- * @param {CreateIntentParams} params - The intent to create
11440
+ * @param {Omit<CreateIntentParams, 'srcAddress'>} params - The intent to create
10804
11441
  * @param {SpokeProvider} spokeProvider - The spoke provider
10805
11442
  * @param {boolean} raw - Whether to return the raw transaction
10806
11443
  * @param {PartnerFee} fee - The fee to apply to the intent
10807
- * @returns {Promise<Result<[TxReturnType<S, R>, Intent & FeeAmount], IntentSubmitError<'CREATION_FAILED'>>>} The encoded contract call
11444
+ * @returns {Promise<Result<[TxReturnType<S, R>, Intent & FeeAmount], IntentError<'CREATION_FAILED'>>>} The encoded contract call
10808
11445
  *
10809
11446
  * @example
10810
11447
  * const payload = {
@@ -10816,8 +11453,8 @@ var SolverService = class {
10816
11453
  * "allowPartialFill": false, // Whether the intent can be partially filled
10817
11454
  * "srcChain": "0x38.bsc", // Chain ID where input tokens originate
10818
11455
  * "dstChain": "0xa4b1.arbitrum", // Chain ID where output tokens should be delivered
10819
- * "srcAddress": "0x..", // Source address in bytes (original address on spoke chain)
10820
- * "dstAddress": "0x...", // Destination address in bytes (original address on spoke chain)
11456
+ * "srcAddress": "0x..", // Source address (original address on spoke chain)
11457
+ * "dstAddress": "0x...", // Destination address (original address on spoke chain)
10821
11458
  * "solver": "0x..", // Optional specific solver address (address(0) = any solver)
10822
11459
  * "data": "0x..", // Additional arbitrary data
10823
11460
  * } satisfies CreateIntentParams;
@@ -10841,7 +11478,12 @@ var SolverService = class {
10841
11478
  invariant2(isValidSpokeChainId(params.srcChain), `Invalid spoke chain (params.srcChain): ${params.srcChain}`);
10842
11479
  invariant2(isValidSpokeChainId(params.dstChain), `Invalid spoke chain (params.dstChain): ${params.dstChain}`);
10843
11480
  try {
10844
- const walletAddressBytes = await spokeProvider.walletProvider.getWalletAddressBytes();
11481
+ const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
11482
+ invariant2(
11483
+ params.srcAddress.toLowerCase() === walletAddress.toLowerCase(),
11484
+ "srcAddress must be the same as wallet address"
11485
+ );
11486
+ const walletAddressBytes = encodeAddress(params.srcChain, walletAddress);
10845
11487
  const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddressBytes : await WalletAbstractionService.getUserHubWalletAddress(
10846
11488
  params.srcChain,
10847
11489
  walletAddressBytes,
@@ -10849,12 +11491,14 @@ var SolverService = class {
10849
11491
  spokeProvider
10850
11492
  );
10851
11493
  const [data, intent, feeAmount] = EvmSolverService.constructCreateIntentData(
10852
- params,
11494
+ {
11495
+ ...params,
11496
+ srcAddress: walletAddress
11497
+ },
10853
11498
  creatorHubWalletAddress,
10854
11499
  this.config,
10855
11500
  fee
10856
11501
  );
10857
- const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
10858
11502
  const txResult = await SpokeService.deposit(
10859
11503
  {
10860
11504
  from: walletAddress,
@@ -10869,7 +11513,7 @@ var SolverService = class {
10869
11513
  );
10870
11514
  return {
10871
11515
  ok: true,
10872
- value: [txResult, { ...intent, feeAmount }]
11516
+ value: [txResult, { ...intent, feeAmount }, data]
10873
11517
  };
10874
11518
  } catch (error) {
10875
11519
  return {
@@ -10892,20 +11536,37 @@ var SolverService = class {
10892
11536
  * @returns {Promise<TxReturnType<T, R>>} The encoded contract call
10893
11537
  */
10894
11538
  async cancelIntent(intent, spokeProvider, raw) {
10895
- invariant2(isValidIntentRelayChainId(intent.srcChain), `Invalid intent.srcChain: ${intent.srcChain}`);
10896
- invariant2(isValidIntentRelayChainId(intent.dstChain), `Invalid intent.dstChain: ${intent.dstChain}`);
10897
- const walletAddressBytes = await spokeProvider.walletProvider.getWalletAddressBytes();
10898
- const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddressBytes : await WalletAbstractionService.getUserHubWalletAddress(
10899
- spokeProvider.chainConfig.chain.id,
10900
- walletAddressBytes,
10901
- this.hubProvider,
10902
- spokeProvider
10903
- );
10904
- const calls = [];
10905
- const intentsContract = this.config.intentsContract;
10906
- calls.push(EvmSolverService.encodeCancelIntent(intent, intentsContract));
10907
- const data = encodeContractCalls(calls);
10908
- return SpokeService.callWallet(creatorHubWalletAddress, data, spokeProvider, this.hubProvider, raw);
11539
+ try {
11540
+ invariant2(isValidIntentRelayChainId(intent.srcChain), `Invalid intent.srcChain: ${intent.srcChain}`);
11541
+ invariant2(isValidIntentRelayChainId(intent.dstChain), `Invalid intent.dstChain: ${intent.dstChain}`);
11542
+ const walletAddressBytes = await spokeProvider.walletProvider.getWalletAddressBytes();
11543
+ const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddressBytes : await WalletAbstractionService.getUserHubWalletAddress(
11544
+ spokeProvider.chainConfig.chain.id,
11545
+ walletAddressBytes,
11546
+ this.hubProvider,
11547
+ spokeProvider
11548
+ );
11549
+ const calls = [];
11550
+ const intentsContract = this.config.intentsContract;
11551
+ calls.push(EvmSolverService.encodeCancelIntent(intent, intentsContract));
11552
+ const data = encodeContractCalls(calls);
11553
+ const txResult = await SpokeService.callWallet(
11554
+ creatorHubWalletAddress,
11555
+ data,
11556
+ spokeProvider,
11557
+ this.hubProvider,
11558
+ raw
11559
+ );
11560
+ return {
11561
+ ok: true,
11562
+ value: txResult
11563
+ };
11564
+ } catch (error) {
11565
+ return {
11566
+ ok: false,
11567
+ error
11568
+ };
11569
+ }
10909
11570
  }
10910
11571
  /**
10911
11572
  * Gets an intent from a transaction hash (on Hub chain)
@@ -11644,6 +12305,7 @@ var MigrationService = class {
11644
12305
  }
11645
12306
  const packetResult = await relayTxAndWaitPacket(
11646
12307
  txResult.value,
12308
+ void 0,
11647
12309
  spokeProvider,
11648
12310
  this.config.relayerApiEndpoint,
11649
12311
  timeout
@@ -11705,6 +12367,7 @@ var MigrationService = class {
11705
12367
  }
11706
12368
  const packetResult = await relayTxAndWaitPacket(
11707
12369
  txResult.value,
12370
+ void 0,
11708
12371
  spokeProvider,
11709
12372
  this.config.relayerApiEndpoint,
11710
12373
  timeout
@@ -11880,36 +12543,36 @@ var Sodax = class {
11880
12543
  };
11881
12544
 
11882
12545
  // src/types.ts
11883
- var IntentStatusCode = /* @__PURE__ */ ((IntentStatusCode2) => {
11884
- IntentStatusCode2[IntentStatusCode2["NOT_FOUND"] = -1] = "NOT_FOUND";
11885
- IntentStatusCode2[IntentStatusCode2["NOT_STARTED_YET"] = 1] = "NOT_STARTED_YET";
11886
- IntentStatusCode2[IntentStatusCode2["STARTED_NOT_FINISHED"] = 2] = "STARTED_NOT_FINISHED";
11887
- IntentStatusCode2[IntentStatusCode2["SOLVED"] = 3] = "SOLVED";
11888
- IntentStatusCode2[IntentStatusCode2["FAILED"] = 4] = "FAILED";
11889
- return IntentStatusCode2;
11890
- })(IntentStatusCode || {});
11891
- var IntentErrorCode = /* @__PURE__ */ ((IntentErrorCode2) => {
11892
- IntentErrorCode2[IntentErrorCode2["NO_PATH_FOUND"] = -4] = "NO_PATH_FOUND";
11893
- IntentErrorCode2[IntentErrorCode2["NO_PRIVATE_LIQUIDITY"] = -5] = "NO_PRIVATE_LIQUIDITY";
11894
- IntentErrorCode2[IntentErrorCode2["NOT_ENOUGH_PRIVATE_LIQUIDITY"] = -8] = "NOT_ENOUGH_PRIVATE_LIQUIDITY";
11895
- IntentErrorCode2[IntentErrorCode2["NO_EXECUTION_MODULE_FOUND"] = -7] = "NO_EXECUTION_MODULE_FOUND";
11896
- IntentErrorCode2[IntentErrorCode2["QUOTE_NOT_FOUND"] = -8] = "QUOTE_NOT_FOUND";
11897
- IntentErrorCode2[IntentErrorCode2["QUOTE_NOT_MATCH"] = -9] = "QUOTE_NOT_MATCH";
11898
- IntentErrorCode2[IntentErrorCode2["INTENT_DATA_NOT_MATCH_QUOTE"] = -10] = "INTENT_DATA_NOT_MATCH_QUOTE";
11899
- IntentErrorCode2[IntentErrorCode2["NO_GAS_HANDLER_FOR_BLOCKCHAIN"] = -11] = "NO_GAS_HANDLER_FOR_BLOCKCHAIN";
11900
- IntentErrorCode2[IntentErrorCode2["INTENT_NOT_FOUND"] = -12] = "INTENT_NOT_FOUND";
11901
- IntentErrorCode2[IntentErrorCode2["QUOTE_EXPIRED"] = -13] = "QUOTE_EXPIRED";
11902
- IntentErrorCode2[IntentErrorCode2["MAX_INPUT_AMOUNT"] = -14] = "MAX_INPUT_AMOUNT";
11903
- IntentErrorCode2[IntentErrorCode2["MAX_DIFF_OUTPUT"] = -15] = "MAX_DIFF_OUTPUT";
11904
- IntentErrorCode2[IntentErrorCode2["STOPPED"] = -16] = "STOPPED";
11905
- IntentErrorCode2[IntentErrorCode2["NO_ORACLE_MODULE_FOUND"] = -17] = "NO_ORACLE_MODULE_FOUND";
11906
- IntentErrorCode2[IntentErrorCode2["NEGATIVE_INPUT_AMOUNT"] = -18] = "NEGATIVE_INPUT_AMOUNT";
11907
- IntentErrorCode2[IntentErrorCode2["INTENT_ALREADY_IN_ORDERBOOK"] = -19] = "INTENT_ALREADY_IN_ORDERBOOK";
11908
- IntentErrorCode2[IntentErrorCode2["CREATE_INTENT_ORDER_FAILED"] = -998] = "CREATE_INTENT_ORDER_FAILED";
11909
- IntentErrorCode2[IntentErrorCode2["UNKNOWN"] = -999] = "UNKNOWN";
11910
- return IntentErrorCode2;
11911
- })(IntentErrorCode || {});
12546
+ var SolverIntentStatusCode = /* @__PURE__ */ ((SolverIntentStatusCode2) => {
12547
+ SolverIntentStatusCode2[SolverIntentStatusCode2["NOT_FOUND"] = -1] = "NOT_FOUND";
12548
+ SolverIntentStatusCode2[SolverIntentStatusCode2["NOT_STARTED_YET"] = 1] = "NOT_STARTED_YET";
12549
+ SolverIntentStatusCode2[SolverIntentStatusCode2["STARTED_NOT_FINISHED"] = 2] = "STARTED_NOT_FINISHED";
12550
+ SolverIntentStatusCode2[SolverIntentStatusCode2["SOLVED"] = 3] = "SOLVED";
12551
+ SolverIntentStatusCode2[SolverIntentStatusCode2["FAILED"] = 4] = "FAILED";
12552
+ return SolverIntentStatusCode2;
12553
+ })(SolverIntentStatusCode || {});
12554
+ var SolverIntentErrorCode = /* @__PURE__ */ ((SolverIntentErrorCode2) => {
12555
+ SolverIntentErrorCode2[SolverIntentErrorCode2["NO_PATH_FOUND"] = -4] = "NO_PATH_FOUND";
12556
+ SolverIntentErrorCode2[SolverIntentErrorCode2["NO_PRIVATE_LIQUIDITY"] = -5] = "NO_PRIVATE_LIQUIDITY";
12557
+ SolverIntentErrorCode2[SolverIntentErrorCode2["NOT_ENOUGH_PRIVATE_LIQUIDITY"] = -8] = "NOT_ENOUGH_PRIVATE_LIQUIDITY";
12558
+ SolverIntentErrorCode2[SolverIntentErrorCode2["NO_EXECUTION_MODULE_FOUND"] = -7] = "NO_EXECUTION_MODULE_FOUND";
12559
+ SolverIntentErrorCode2[SolverIntentErrorCode2["QUOTE_NOT_FOUND"] = -8] = "QUOTE_NOT_FOUND";
12560
+ SolverIntentErrorCode2[SolverIntentErrorCode2["QUOTE_NOT_MATCH"] = -9] = "QUOTE_NOT_MATCH";
12561
+ SolverIntentErrorCode2[SolverIntentErrorCode2["INTENT_DATA_NOT_MATCH_QUOTE"] = -10] = "INTENT_DATA_NOT_MATCH_QUOTE";
12562
+ SolverIntentErrorCode2[SolverIntentErrorCode2["NO_GAS_HANDLER_FOR_BLOCKCHAIN"] = -11] = "NO_GAS_HANDLER_FOR_BLOCKCHAIN";
12563
+ SolverIntentErrorCode2[SolverIntentErrorCode2["INTENT_NOT_FOUND"] = -12] = "INTENT_NOT_FOUND";
12564
+ SolverIntentErrorCode2[SolverIntentErrorCode2["QUOTE_EXPIRED"] = -13] = "QUOTE_EXPIRED";
12565
+ SolverIntentErrorCode2[SolverIntentErrorCode2["MAX_INPUT_AMOUNT"] = -14] = "MAX_INPUT_AMOUNT";
12566
+ SolverIntentErrorCode2[SolverIntentErrorCode2["MAX_DIFF_OUTPUT"] = -15] = "MAX_DIFF_OUTPUT";
12567
+ SolverIntentErrorCode2[SolverIntentErrorCode2["STOPPED"] = -16] = "STOPPED";
12568
+ SolverIntentErrorCode2[SolverIntentErrorCode2["NO_ORACLE_MODULE_FOUND"] = -17] = "NO_ORACLE_MODULE_FOUND";
12569
+ SolverIntentErrorCode2[SolverIntentErrorCode2["NEGATIVE_INPUT_AMOUNT"] = -18] = "NEGATIVE_INPUT_AMOUNT";
12570
+ SolverIntentErrorCode2[SolverIntentErrorCode2["INTENT_ALREADY_IN_ORDERBOOK"] = -19] = "INTENT_ALREADY_IN_ORDERBOOK";
12571
+ SolverIntentErrorCode2[SolverIntentErrorCode2["CREATE_INTENT_ORDER_FAILED"] = -998] = "CREATE_INTENT_ORDER_FAILED";
12572
+ SolverIntentErrorCode2[SolverIntentErrorCode2["UNKNOWN"] = -999] = "UNKNOWN";
12573
+ return SolverIntentErrorCode2;
12574
+ })(SolverIntentErrorCode || {});
11912
12575
 
11913
- export { BigIntToHex, CWSpokeProvider, 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, IntentCreatedEventAbi, IntentDataType, IntentErrorCode, IntentStatusCode, IntentsAbi, MAX_UINT256, MigrationService, MoneyMarketService, Sodax, SolanaSpokeProvider, SolverService, SonicSpokeProvider, SonicSpokeService, SpokeService, StellarSpokeProvider, SuiSpokeProvider, VAULT_TOKEN_DECIMALS, WalletAbstractionService, assetManagerAbi, calculateFeeAmount, calculatePercentageFeeAmount, chainIdToHubAssetsMap, connectionAbi, encodeAddress, encodeContractCalls, erc20Abi, getEvmViemChain, getHubAssetInfo, getHubChainConfig, getIconAddressBytes, getIntentRelayChainId, getMoneyMarketConfig, getOriginalAssetAddress, getPacket, getRandomBytes, getSolanaAddressBytes, getSolverConfig, getSpokeChainIdFromIntentRelayChainId, getSupportedMoneyMarketTokens, getSupportedSolverTokens, getTransactionPackets, hubAssetToOriginalAssetMap, hubAssets, hubVaults, hubVaultsAddressSet, intentRelayChainIdToSpokeChainIdMap, isCWSpokeProvider, isConfiguredMoneyMarketConfig, isConfiguredSolverConfig, isEvmHubChainConfig, isEvmInitializedConfig, isEvmSpokeChainConfig, isEvmSpokeProvider, isEvmUninitializedBrowserConfig, isEvmUninitializedConfig, isEvmUninitializedPrivateKeyConfig, isIconAddress, isIconSpokeProvider, isIntentRelayChainId, isJsonRpcPayloadResponse, isMoneyMarketReserveAsset, isMoneyMarketReserveHubAsset, isMoneyMarketSupportedToken, isNativeToken, isPartnerFeeAmount, isPartnerFeePercentage, isResponseAddressType, isResponseSigningType, isSolanaSpokeProvider, isSolverSupportedToken, isSonicSpokeProvider, isStellarSpokeProvider, isSuiSpokeProvider, isValidChainHubAsset, isValidHubAsset, isValidIntentRelayChainId, isValidOriginalAssetAddress, isValidSpokeChainId, moneyMarketReserveAssets, moneyMarketReserveHubAssetsSet, originalAssetTohubAssetMap, poolAbi, randomUint256, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainIdsSet, submitTransaction, supportedHubAssets, supportedHubChains, supportedSpokeChains, supportedTokensPerChain, uiPoolDataAbi, variableDebtTokenAbi, vaultTokenAbi, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
12576
+ export { BigIntToHex, CWSpokeProvider, 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, IntentCreatedEventAbi, IntentDataType, IntentsAbi, MAX_UINT256, MigrationService, MoneyMarketService, STELLAR_DEFAULT_TX_TIMEOUT_SECONDS, STELLAR_PRIORITY_FEE, Sodax, SolanaSpokeProvider, SolverIntentErrorCode, SolverIntentStatusCode, SolverService, SonicSpokeProvider, SonicSpokeService, SpokeService, StellarSpokeProvider, SuiSpokeProvider, VAULT_TOKEN_DECIMALS, WalletAbstractionService, assetManagerAbi, calculateFeeAmount, calculatePercentageFeeAmount, chainIdToHubAssetsMap, connectionAbi, encodeAddress, encodeContractCalls, erc20Abi, getEvmViemChain, getHubAssetInfo, getHubChainConfig, getIconAddressBytes, getIntentRelayChainId, getMoneyMarketConfig, getOriginalAssetAddress, getPacket, getRandomBytes, getSolanaAddressBytes, getSolverConfig, getSpokeChainIdFromIntentRelayChainId, getSupportedMoneyMarketTokens, getSupportedSolverTokens, getTransactionPackets, hubAssetToOriginalAssetMap, hubAssets, hubVaults, hubVaultsAddressSet, intentRelayChainIdToSpokeChainIdMap, isCWSpokeProvider, isConfiguredMoneyMarketConfig, isConfiguredSolverConfig, isEvmHubChainConfig, isEvmInitializedConfig, isEvmSpokeChainConfig, isEvmSpokeProvider, isEvmUninitializedBrowserConfig, isEvmUninitializedConfig, isEvmUninitializedPrivateKeyConfig, isIconAddress, isIconSpokeProvider, 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, 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 };
11914
12577
  //# sourceMappingURL=index.mjs.map
11915
12578
  //# sourceMappingURL=index.mjs.map