@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.cjs CHANGED
@@ -5103,6 +5103,8 @@ var DEFAULT_RETRY_DELAY_MS = 2e3;
5103
5103
  var ICON_TX_RESULT_WAIT_MAX_RETRY = 10;
5104
5104
  var MAX_UINT256 = (1n << 256n) - 1n;
5105
5105
  var FEE_PERCENTAGE_SCALE = 10000n;
5106
+ var STELLAR_PRIORITY_FEE = "10000";
5107
+ var STELLAR_DEFAULT_TX_TIMEOUT_SECONDS = 100;
5106
5108
  var VAULT_TOKEN_DECIMALS = 18;
5107
5109
  var INTENT_RELAY_CHAIN_IDS = {
5108
5110
  AVAX: 6n,
@@ -5239,6 +5241,12 @@ var spokeChainConfig = {
5239
5241
  name: "Wrapped Sonic",
5240
5242
  decimals: 18,
5241
5243
  address: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38"
5244
+ },
5245
+ SODA: {
5246
+ symbol: "SODA",
5247
+ name: "SODAX",
5248
+ decimals: 18,
5249
+ address: "0x7c7d53EEcda37a87ce0D5bf8E0b24512A48dC963"
5242
5250
  }
5243
5251
  }
5244
5252
  },
@@ -5274,8 +5282,8 @@ var spokeChainConfig = {
5274
5282
  }
5275
5283
  },
5276
5284
  gasPrice: "500000",
5277
- rpcUrl: "https://api.mainnet-beta.solana.com",
5278
- wsUrl: "https://api.mainnet-beta.solana.com",
5285
+ rpcUrl: "https://solana-mainnet.g.alchemy.com/v2/i3q5fE3cYSFBE4Lcg1kS5",
5286
+ wsUrl: "https://solana-mainnet.g.alchemy.com/v2/i3q5fE3cYSFBE4Lcg1kS5",
5279
5287
  walletAddress: ""
5280
5288
  },
5281
5289
  [types.AVALANCHE_MAINNET_CHAIN_ID]: {
@@ -5369,12 +5377,6 @@ var spokeChainConfig = {
5369
5377
  decimals: 18,
5370
5378
  address: "0xA256dd181C3f6E5eC68C6869f5D50a712d47212e"
5371
5379
  },
5372
- WETH: {
5373
- symbol: "WETH",
5374
- name: "Wrapped Ether",
5375
- decimals: 18,
5376
- address: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"
5377
- },
5378
5380
  wstETH: {
5379
5381
  symbol: "wstETH",
5380
5382
  name: "Wrapped stETH",
@@ -5666,9 +5668,10 @@ var spokeChainConfig = {
5666
5668
  },
5667
5669
  nativeToken: "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",
5668
5670
  bnUSD: "CD6YBFFWMU2UJHX2NGRJ7RN76IJVTCC7MRA46DUBXNB7E6W7H7JRJ2CX",
5669
- rpc_url: "https://rpc.ankr.com/stellar_soroban",
5671
+ horizonRpcUrl: "https://horizon.stellar.org",
5672
+ sorobanRpcUrl: "https://rpc.ankr.com/stellar_soroban",
5670
5673
  chain: {
5671
- name: "soroban-mainnet",
5674
+ name: "Stellar",
5672
5675
  id: types.STELLAR_MAINNET_CHAIN_ID,
5673
5676
  type: "STELLAR"
5674
5677
  }
@@ -5699,6 +5702,42 @@ var spokeChainConfig = {
5699
5702
  name: "USD Coin",
5700
5703
  decimals: 6,
5701
5704
  address: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
5705
+ },
5706
+ afSUI: {
5707
+ symbol: "afSUI",
5708
+ name: "Aftermath Staked Sui",
5709
+ decimals: 9,
5710
+ address: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI"
5711
+ },
5712
+ mSUI: {
5713
+ symbol: "mSUI",
5714
+ name: "Mirai Staked SUI",
5715
+ decimals: 9,
5716
+ address: "0x922d15d7f55c13fd790f6e54397470ec592caa2b508df292a2e8553f3d3b274f::msui::MSUI"
5717
+ },
5718
+ haSUI: {
5719
+ symbol: "haSUI",
5720
+ name: "haSUI",
5721
+ decimals: 9,
5722
+ address: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI"
5723
+ },
5724
+ vSUI: {
5725
+ symbol: "vSUI",
5726
+ name: "Volo Staked SUI",
5727
+ decimals: 9,
5728
+ address: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT"
5729
+ },
5730
+ yapSUI: {
5731
+ symbol: "yapSUI",
5732
+ name: "Yap Staked SUI",
5733
+ decimals: 9,
5734
+ address: "0x83f1bb8c91ecd1fd313344058b0eed94d63c54e41d8d1ae5bff1353443517d65::yap_sui::YAP_SUI"
5735
+ },
5736
+ trevinSUI: {
5737
+ symbol: "trevinSUI",
5738
+ name: "Trevin Staked SUI",
5739
+ decimals: 9,
5740
+ address: "0x502867b177303bf1bf226245fcdd3403c177e78d175a55a56c0602c7ff51c7fa::trevin_sui::TREVIN_SUI"
5702
5741
  }
5703
5742
  },
5704
5743
  nativeToken: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
@@ -5747,6 +5786,201 @@ var spokeChainConfig = {
5747
5786
  nid: "0x1"
5748
5787
  }
5749
5788
  };
5789
+ var HubVaultSymbols = [
5790
+ "sodaAVAX",
5791
+ "sodaBNB",
5792
+ "sodaETH",
5793
+ "sodaBTC",
5794
+ "sodaSUI",
5795
+ "sodaINJ",
5796
+ "sodaXLM",
5797
+ "sodaSOL",
5798
+ "sodaSODA",
5799
+ "sodaUSDT",
5800
+ "sodaUSDC",
5801
+ "bnUSD",
5802
+ "sodaPOL",
5803
+ "sodaNIBI",
5804
+ "sodaS",
5805
+ "IbnUSD"
5806
+ ];
5807
+ var hubVaults = {
5808
+ IbnUSD: {
5809
+ address: "0x9D4b663Eb075d2a1C7B8eaEFB9eCCC0510388B51",
5810
+ reserves: [
5811
+ // hub asset addresses contained in the vault
5812
+ "0x654DdDf32a9a2aC53f5FB54bf1e93F66791f8047",
5813
+ "0xddf6AD38F9C9451C1F4cDf369040F6869e37393e",
5814
+ "0x1559B52d2e165da1505a542EA37C543c9137f52a"
5815
+ ]
5816
+ },
5817
+ sodaS: {
5818
+ address: "0x62ecc3eeb80a162c57624b3ff80313fe69f5203e",
5819
+ reserves: [
5820
+ // hub asset addresses contained in the vault
5821
+ "0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38"
5822
+ ]
5823
+ },
5824
+ sodaNIBI: {
5825
+ address: "0xc6c85287a8b173a509c2f198bb719a8a5a2d0c68",
5826
+ reserves: [
5827
+ // hub asset addresses contained in the vault
5828
+ "0xe0064414c2c1a636a9424c7a17d86fbf7fd3f190"
5829
+ ]
5830
+ },
5831
+ sodaPOL: {
5832
+ address: "0x208ed38f4783328aa9ebfec360d32e7520a9b779",
5833
+ reserves: [
5834
+ // hub asset addresses contained in the vault
5835
+ "0x9ee17486571917837210824b0d4cadfe3b324d12"
5836
+ ]
5837
+ },
5838
+ bnUSD: {
5839
+ address: "0xe801ca34e19abcbfea12025378d19c4fbe250131",
5840
+ reserves: [
5841
+ // hub asset addresses contained in the vault
5842
+ "0xabbb91c0617090f0028bdc27597cd0d038f3a833",
5843
+ "0xbdf1f453fcb61424011bbddcb96cfdb30f3fe876",
5844
+ "0x94dc79ce9c515ba4ae4d195da8e6ab86c69bfc38",
5845
+ "0x5ce6c1c51ff762cf3acd21396257046f694168b6",
5846
+ "0xdf5639d91359866f266b56d60d98ede9feedd100",
5847
+ "0x238384ae2b4f0ec189ecb5031859ba306b2679c5",
5848
+ "0x419ca9054e44e94ceab52846ecdc3997439bbca6",
5849
+ "0x18f85f9e80ff9496eebd5979a051af16ce751567",
5850
+ "0x289cda1043b4ce26bdca3c12e534f56b24308a5b",
5851
+ "0x23225ab8e63fca4070296678cb46566d57e1bbe3",
5852
+ "0x14c65b1cdc0b821569081b1f77342da0d0cbf439",
5853
+ "0xdf23097b9aeb917bf8fb70e99b6c528fffa35364",
5854
+ "0x11b93c162aabffd026539bb3b9f9ec22c8b7ef8a",
5855
+ "0x69425ffb14704124a58d6f69d510f74a59d9a5bc",
5856
+ "0x9d4b663eb075d2a1c7b8eaefb9eccc0510388b51"
5857
+ ]
5858
+ },
5859
+ sodaSODA: {
5860
+ // SODA SODA vault
5861
+ address: "0x21685e341de7844135329914be6bd8d16982d834",
5862
+ reserves: [
5863
+ // hub asset addresses contained in the vault
5864
+ "0x7c7d53eecda37a87ce0d5bf8e0b24512a48dc963"
5865
+ // SODA SODA hub asset
5866
+ ]
5867
+ },
5868
+ sodaAVAX: {
5869
+ // SODA AVAX vault
5870
+ address: "0x14238d267557e9d799016ad635b53cd15935d290",
5871
+ reserves: [
5872
+ // hub asset addresses contained in the vault
5873
+ "0xc9e4f0b6195f389d9d2b639f2878b7674eb9d8cd"
5874
+ // AvalancheAVAX hub asset
5875
+ ]
5876
+ },
5877
+ sodaBNB: {
5878
+ // SODA BNB vault
5879
+ address: "0x40cd41b35db9e5109ae7e54b44de8625db320e6b",
5880
+ reserves: [
5881
+ // hub asset addresses contained in the vault
5882
+ "0x13b70564b1ec12876b20fab5d1bb630311312f4f"
5883
+ // BSC BNB hub asset
5884
+ ]
5885
+ },
5886
+ sodaETH: {
5887
+ // SODA ETH vault
5888
+ address: "0x4effb5813271699683c25c734f4dabc45b363709",
5889
+ reserves: [
5890
+ // hub asset addresses contained in the vault
5891
+ "0x70178089842be7f8e4726b33f0d1569db8021faa",
5892
+ // BASE ETH hub asset
5893
+ "0xad332860dd3b6f0e63f4f66e9457900917ac78cd",
5894
+ // Optimism ETH hub asset
5895
+ "0xdcd9578b51ef55239b6e68629d822a8d97c95b86",
5896
+ // Arbitrum ETH hub asset
5897
+ "0x57fc2ac5701e463ae261adbd6c99fbeb48ce5293",
5898
+ // BSC ETH hub asset
5899
+ "0x50c42deacd8fc9773493ed674b675be577f2634b"
5900
+ // Sonic WETH hub asset
5901
+ ]
5902
+ },
5903
+ sodaBTC: {
5904
+ // SODA BTC vault
5905
+ address: "0x7a1a5555842ad2d0ed274d09b5c4406a95799d5d",
5906
+ reserves: [
5907
+ // hub asset addresses contained in the vault
5908
+ "0x2803a23a3ba6b09e57d1c71dec0d9efdbb00a27f",
5909
+ // BASE cbBTC hub asset,
5910
+ "0xfb0acb1b2720b620935f50a6dd3f7fea52b2fcbe",
5911
+ // Arbitrum wBTC hub asset
5912
+ "0x96fc8540736f1598b7e235e6de8814062b3b5d3b",
5913
+ // Arbitrum tBTC hub asset,
5914
+ "0xd8a24c71fea5bb81c66c01e532de7d9b11e13905"
5915
+ // BSC BTCB hub asset
5916
+ ]
5917
+ },
5918
+ sodaSUI: {
5919
+ // SODA SUI vault
5920
+ address: "0xdc5b4b00f98347e95b9f94911213dab4c687e1e3",
5921
+ reserves: [
5922
+ // hub asset addresses contained in the vault
5923
+ "0x4676b2a551b25c04e235553c1c81019337384673"
5924
+ // SUI SUI hub asset
5925
+ ]
5926
+ },
5927
+ sodaINJ: {
5928
+ // SODA INJ vault
5929
+ address: "0x1f22279c89b213944b7ea41dacb0a868ddcdfd13",
5930
+ reserves: [
5931
+ // hub asset addresses contained in the vault
5932
+ "0xd375590b4955f6ea5623f799153f9b787a3bd319"
5933
+ // Injective INJ hub asset
5934
+ ]
5935
+ },
5936
+ sodaXLM: {
5937
+ // SODA XLM vault
5938
+ address: "0x6bc8c37cba91f76e68c9e6d689a9c21e4d32079b",
5939
+ reserves: [
5940
+ // hub asset addresses contained in the vault
5941
+ "0x8ac68af223907fb1b893086601a3d99e00f2fa9d"
5942
+ // Stellar XLM hub asset
5943
+ ]
5944
+ },
5945
+ sodaSOL: {
5946
+ // SODA SOL vault
5947
+ address: "0xdea692287e2ce8cb08fa52917be0f16b1dacdc87",
5948
+ reserves: [
5949
+ // hub asset addresses contained in the vault
5950
+ "0x0c09e69a4528945de6d16c7e469dea6996fdf636"
5951
+ // Solana SOL hub asset
5952
+ ]
5953
+ },
5954
+ sodaUSDT: {
5955
+ // SODA USDT vault
5956
+ address: "0xbdf1f453fcb61424011bbddcb96cfdb30f3fe876",
5957
+ reserves: [
5958
+ // hub asset addresses contained in the vault
5959
+ "0x41fd5c169e014e2a657b9de3553f7a7b735fe47a",
5960
+ "0xc168067d95109003805ac865ae556e8476dc69bc",
5961
+ "0x3c0a80c6a1110fc80309382b3989ec626c135ee9",
5962
+ "0x6047828dc181963ba44974801ff68e538da5eaf9"
5963
+ // Sonic USDT
5964
+ ]
5965
+ },
5966
+ sodaUSDC: {
5967
+ address: "0xabbb91c0617090f0028bdc27597cd0d038f3a833",
5968
+ reserves: [
5969
+ "0x41abf4b1559ff709ef8150079bcb26db1fffd117",
5970
+ "0x72e852545b024ddcbc5b70c1bcbdaa025164259c",
5971
+ "0xb7c213cbd24967de9838fa014668fddb338f724b",
5972
+ "0xdb7bda65c3a1c51d64dc4444e418684677334109",
5973
+ "0xa36893ba308b332fdebfa95916d1df3a2e3cf8b3",
5974
+ "0x29219dd400f2bf60e5a23d13be72b486d4038894",
5975
+ "0x5635369c8a29a081d26c2e9e28012fca548ba0cb",
5976
+ "0x3d73437dd81b3f9ec82752beb1752f03a8531710",
5977
+ "0x4bc1211faa06fb50ff61a70331f56167ae511057",
5978
+ "0x348007b53f25a9a857ab8ea81ec9e3ccbcf440f2",
5979
+ "0xc3f020057510ffe10ceb882e1b48238b43d78a5e",
5980
+ "0x9d58508ad10d34048a11640735ca5075bba07b35"
5981
+ ]
5982
+ }
5983
+ };
5750
5984
  var hubAssets = {
5751
5985
  [types.SONIC_MAINNET_CHAIN_ID]: {
5752
5986
  [spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].nativeToken]: {
@@ -5754,35 +5988,42 @@ var hubAssets = {
5754
5988
  decimal: 18,
5755
5989
  symbol: "S",
5756
5990
  name: "Sonic",
5757
- vault: "0x62ecc3Eeb80a162c57624B3fF80313FE69f5203e"
5991
+ vault: hubVaults.sodaS.address
5758
5992
  },
5759
5993
  [spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.wSonic.address]: {
5760
5994
  asset: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38",
5761
5995
  decimal: 18,
5762
5996
  symbol: "wSonic",
5763
5997
  name: "Sonic",
5764
- vault: "0x62ecc3Eeb80a162c57624B3fF80313FE69f5203e"
5998
+ vault: hubVaults.sodaS.address
5765
5999
  },
5766
6000
  [spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.WETH.address]: {
5767
6001
  asset: "0x50c42dEAcD8Fc9773493ED674b675bE577f2634b",
5768
6002
  decimal: 18,
5769
6003
  symbol: "WETH",
5770
6004
  name: "Wrapped Ethereum",
5771
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6005
+ vault: hubVaults.sodaETH.address
5772
6006
  },
5773
6007
  [spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
5774
6008
  asset: "0x29219dd400f2Bf60E5a23d13Be72B486D4038894",
5775
6009
  decimal: 6,
5776
6010
  symbol: "USDC ",
5777
6011
  name: "USD Coin",
5778
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6012
+ vault: hubVaults.sodaUSDC.address
5779
6013
  },
5780
6014
  [spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.USDT.address]: {
5781
6015
  asset: "0x6047828dc181963ba44974801ff68e538da5eaf9",
5782
6016
  decimal: 6,
5783
6017
  symbol: "USDT",
5784
6018
  name: "Tether USD",
5785
- vault: "0xbDf1F453FCB61424011BBDDCB96cFDB30f3Fe876"
6019
+ vault: hubVaults.sodaUSDT.address
6020
+ },
6021
+ [spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
6022
+ asset: "0x7c7d53EEcda37a87ce0D5bf8E0b24512A48dC963",
6023
+ decimal: 18,
6024
+ symbol: "SODA",
6025
+ name: "SODA",
6026
+ vault: hubVaults.sodaSODA.address
5786
6027
  }
5787
6028
  },
5788
6029
  [types.AVALANCHE_MAINNET_CHAIN_ID]: {
@@ -5791,28 +6032,28 @@ var hubAssets = {
5791
6032
  decimal: 18,
5792
6033
  symbol: "AVAX",
5793
6034
  name: "AVAX",
5794
- vault: "0x14238D267557E9d799016ad635B53CD15935d290"
6035
+ vault: hubVaults.sodaAVAX.address
5795
6036
  },
5796
6037
  [spokeChainConfig[types.AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.USDT.address]: {
5797
6038
  asset: "0x41Fd5c169e014e2A657B9de3553f7a7b735Fe47A",
5798
6039
  decimal: 6,
5799
6040
  symbol: "USDT",
5800
6041
  name: "Tether USD",
5801
- vault: "0xbDf1F453FCB61424011BBDDCB96cFDB30f3Fe876"
6042
+ vault: hubVaults.sodaUSDT.address
5802
6043
  },
5803
6044
  [spokeChainConfig[types.AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
5804
6045
  asset: "0x41abF4B1559FF709Ef8150079BcB26DB1Fffd117",
5805
6046
  decimal: 6,
5806
6047
  symbol: "USDC",
5807
6048
  name: "USD Coin",
5808
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6049
+ vault: hubVaults.sodaUSDC.address
5809
6050
  },
5810
6051
  [spokeChainConfig[types.AVALANCHE_MAINNET_CHAIN_ID].bnUSD]: {
5811
6052
  asset: "0x289cDa1043b4Ce26BDCa3c12E534f56b24308A5B",
5812
6053
  decimal: 18,
5813
6054
  symbol: "bnUSD",
5814
6055
  name: "bnUSD",
5815
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6056
+ vault: hubVaults.bnUSD.address
5816
6057
  }
5817
6058
  },
5818
6059
  [types.ARBITRUM_MAINNET_CHAIN_ID]: {
@@ -5821,56 +6062,58 @@ var hubAssets = {
5821
6062
  decimal: 18,
5822
6063
  symbol: "ETH",
5823
6064
  name: "Ethereum",
5824
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6065
+ vault: hubVaults.sodaETH.address
5825
6066
  },
5826
6067
  [spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.WBTC.address]: {
5827
6068
  asset: "0xfB0ACB1b2720B620935F50a6dd3F7FEA52b2FCBe",
5828
6069
  decimal: 8,
5829
6070
  symbol: "WBTC",
5830
6071
  name: "Wrapped Bitcoin",
5831
- vault: "0x7A1A5555842Ad2D0eD274d09b5c4406a95799D5d"
6072
+ vault: hubVaults.sodaBTC.address
5832
6073
  },
5833
6074
  [spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.weETH.address]: {
5834
6075
  asset: "0x08D5cf039De35627fD5C0f48B8AF4a1647a462E8",
5835
6076
  decimal: 18,
5836
6077
  symbol: "weETH",
5837
6078
  name: "Wrapped eETH",
5838
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6079
+ vault: "0x"
6080
+ // no vault yet
5839
6081
  },
5840
6082
  [spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.wstETH.address]: {
5841
6083
  asset: "0x2D5A7837D68b0c2CC4b14C2af2a1F0Ef420DDDc5",
5842
6084
  decimal: 18,
5843
6085
  symbol: "wstETH",
5844
6086
  name: "Wrapped Staked Ethereum",
5845
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6087
+ vault: "0x"
6088
+ // no vault yet
5846
6089
  },
5847
6090
  [spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.tBTC.address]: {
5848
6091
  asset: "0x96Fc8540736f1598b7E235e6dE8814062b3b5d3B",
5849
6092
  decimal: 18,
5850
6093
  symbol: "tBTC",
5851
6094
  name: "Arbitrum tBTC",
5852
- vault: "0x7A1A5555842Ad2D0eD274d09b5c4406a95799D5d"
6095
+ vault: hubVaults.sodaBTC.address
5853
6096
  },
5854
6097
  [spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.USDT.address]: {
5855
6098
  asset: "0x3C0a80C6a1110fC80309382b3989eC626c135eE9",
5856
6099
  decimal: 6,
5857
6100
  symbol: "USDT",
5858
6101
  name: "Tether USD",
5859
- vault: "0xbDf1F453FCB61424011BBDDCB96cFDB30f3Fe876"
6102
+ vault: hubVaults.sodaUSDT.address
5860
6103
  },
5861
6104
  [spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
5862
6105
  asset: "0xdB7BdA65c3a1C51D64dC4444e418684677334109",
5863
6106
  decimal: 6,
5864
6107
  symbol: "USDC",
5865
6108
  name: "USD Coin",
5866
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6109
+ vault: hubVaults.sodaUSDC.address
5867
6110
  },
5868
6111
  [spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].bnUSD]: {
5869
6112
  asset: "0x419cA9054E44E94ceAb52846eCdC3997439BBcA6",
5870
6113
  decimal: 18,
5871
6114
  symbol: "bnUSD",
5872
6115
  name: "bnUSD",
5873
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6116
+ vault: hubVaults.bnUSD.address
5874
6117
  }
5875
6118
  },
5876
6119
  [types.BASE_MAINNET_CHAIN_ID]: {
@@ -5879,42 +6122,44 @@ var hubAssets = {
5879
6122
  decimal: 18,
5880
6123
  symbol: "ETH",
5881
6124
  name: "Ethereum",
5882
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6125
+ vault: hubVaults.sodaETH.address
5883
6126
  },
5884
6127
  [spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.cbBTC.address]: {
5885
6128
  asset: "0x2803a23a3BA6b09e57D1c71deC0D9eFdBB00A27F",
5886
6129
  decimal: 8,
5887
6130
  symbol: "cbBTC",
5888
6131
  name: "Coinbase Wrapped BTC",
5889
- vault: "0x7A1A5555842Ad2D0eD274d09b5c4406a95799D5d"
6132
+ vault: hubVaults.sodaBTC.address
5890
6133
  },
5891
6134
  [spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
5892
6135
  asset: "0x72E852545B024ddCbc5b70C1bCBDAA025164259C",
5893
6136
  decimal: 6,
5894
6137
  symbol: "USDC",
5895
6138
  name: "USD Coin",
5896
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6139
+ vault: hubVaults.sodaUSDC.address
5897
6140
  },
5898
6141
  [spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].bnUSD]: {
5899
6142
  asset: "0xDF5639D91359866f266b56D60d98edE9fEEDd100",
5900
6143
  decimal: 18,
5901
6144
  symbol: "bnUSD",
5902
6145
  name: "bnUSD",
5903
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6146
+ vault: hubVaults.bnUSD.address
5904
6147
  },
5905
6148
  [spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.weETH.address]: {
5906
6149
  asset: "0x55e0ad45eb97493b3045eee417fb6726cb85dfd4",
5907
6150
  decimal: 18,
5908
6151
  symbol: "weETH",
5909
6152
  name: "Wrapped eETH",
5910
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6153
+ vault: "0x"
6154
+ // no vault yet
5911
6155
  },
5912
6156
  [spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.wstETH.address]: {
5913
6157
  asset: "0x494aaeaefdf5964d4ed400174e8c5b98c00957aa",
5914
6158
  decimal: 18,
5915
6159
  symbol: "wstETH",
5916
6160
  name: "Wrapped Staked Ethereum",
5917
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6161
+ vault: "0x"
6162
+ // no vault yet
5918
6163
  }
5919
6164
  },
5920
6165
  [types.OPTIMISM_MAINNET_CHAIN_ID]: {
@@ -5923,42 +6168,44 @@ var hubAssets = {
5923
6168
  decimal: 18,
5924
6169
  symbol: "ETH",
5925
6170
  name: "Ethereum",
5926
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6171
+ vault: hubVaults.sodaETH.address
5927
6172
  },
5928
6173
  [spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].bnUSD]: {
5929
6174
  asset: "0x238384AE2b4F0EC189ecB5031859bA306B2679c5",
5930
6175
  decimal: 18,
5931
6176
  symbol: "bnUSD",
5932
6177
  name: "bnUSD",
5933
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6178
+ vault: hubVaults.bnUSD.address
5934
6179
  },
5935
6180
  [spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
5936
6181
  asset: "0xb7C213CbD24967dE9838fa014668FDDB338f724B",
5937
6182
  decimal: 6,
5938
6183
  symbol: "USDC",
5939
6184
  name: "USD Coin",
5940
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6185
+ vault: hubVaults.sodaUSDC.address
5941
6186
  },
5942
6187
  [spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.wstETH.address]: {
5943
6188
  asset: "0x61e26f611090CdC6bc79A7Bf156b0fD10f1fC212",
5944
6189
  decimal: 18,
5945
6190
  symbol: "wstETH",
5946
6191
  name: "Wrapped Staked Ethereum",
5947
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6192
+ vault: "0x"
6193
+ // no vault yet
5948
6194
  },
5949
6195
  [spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.weETH.address]: {
5950
6196
  asset: "0xE121c0Dc2B33c00ff31ee3D902D248cc3f19Ea50",
5951
6197
  decimal: 18,
5952
6198
  symbol: "weETH",
5953
6199
  name: "Wrapped eETH",
5954
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6200
+ vault: "0x"
6201
+ // no vault yet
5955
6202
  },
5956
6203
  [spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.USDT.address]: {
5957
6204
  asset: "0xc168067d95109003805aC865ae556e8476DC69bc",
5958
6205
  decimal: 6,
5959
6206
  symbol: "USDT",
5960
6207
  name: "Tether USD",
5961
- vault: "0xbDf1F453FCB61424011BBDDCB96cFDB30f3Fe876"
6208
+ vault: hubVaults.sodaUSDT.address
5962
6209
  }
5963
6210
  },
5964
6211
  [types.NIBIRU_MAINNET_CHAIN_ID]: {
@@ -5967,14 +6214,14 @@ var hubAssets = {
5967
6214
  decimal: 18,
5968
6215
  symbol: "NIBI",
5969
6216
  name: "Nibiru",
5970
- vault: "0xc6c85287a8b173A509C2F198bB719A8a5a2d0C68"
6217
+ vault: hubVaults.sodaNIBI.address
5971
6218
  },
5972
6219
  [spokeChainConfig[types.NIBIRU_MAINNET_CHAIN_ID].bnUSD]: {
5973
6220
  asset: "0x11b93C162aABFfD026539bb3B9F9eC22c8b7ef8a",
5974
6221
  decimal: 18,
5975
6222
  symbol: "bnUSD",
5976
6223
  name: "bnUSD",
5977
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6224
+ vault: hubVaults.bnUSD.address
5978
6225
  }
5979
6226
  },
5980
6227
  [types.BSC_MAINNET_CHAIN_ID]: {
@@ -5983,35 +6230,35 @@ var hubAssets = {
5983
6230
  decimal: 18,
5984
6231
  symbol: "BNB",
5985
6232
  name: "BNB",
5986
- vault: "0x40Cd41b35DB9e5109ae7E54b44De8625dB320E6b"
6233
+ vault: hubVaults.sodaBNB.address
5987
6234
  },
5988
6235
  [spokeChainConfig[types.BSC_MAINNET_CHAIN_ID].supportedTokens.ETHB.address]: {
5989
6236
  asset: "0x57fC2aC5701e463ae261AdBd6C99FBeB48Ce5293",
5990
6237
  decimal: 18,
5991
6238
  symbol: "ETHB",
5992
6239
  name: "Wrapped Ethereum",
5993
- vault: "0x4effB5813271699683C25c734F4daBc45B363709"
6240
+ vault: hubVaults.sodaETH.address
5994
6241
  },
5995
6242
  [spokeChainConfig[types.BSC_MAINNET_CHAIN_ID].supportedTokens.BTCB.address]: {
5996
6243
  asset: "0xD8A24c71FEa5bB81c66C01e532dE7d9B11e13905",
5997
6244
  decimal: 18,
5998
6245
  symbol: "BTCB",
5999
6246
  name: "Wrapped Bitcoin",
6000
- vault: "0x7A1A5555842Ad2D0eD274d09b5c4406a95799D5d"
6247
+ vault: hubVaults.sodaBTC.address
6001
6248
  },
6002
6249
  [spokeChainConfig[types.BSC_MAINNET_CHAIN_ID].bnUSD]: {
6003
6250
  asset: "0x5Ce6C1c51ff762cF3acD21396257046f694168b6",
6004
6251
  decimal: 18,
6005
6252
  symbol: "bnUSD",
6006
6253
  name: "bnUSD",
6007
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6254
+ vault: hubVaults.bnUSD.address
6008
6255
  },
6009
6256
  [spokeChainConfig[types.BSC_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
6010
6257
  asset: "0x9d58508ad10d34048a11640735ca5075bba07b35",
6011
6258
  decimal: 18,
6012
6259
  symbol: "USDC",
6013
6260
  name: "USD Coin",
6014
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6261
+ vault: hubVaults.sodaUSDC.address
6015
6262
  }
6016
6263
  },
6017
6264
  [types.POLYGON_MAINNET_CHAIN_ID]: {
@@ -6020,21 +6267,21 @@ var hubAssets = {
6020
6267
  decimal: 18,
6021
6268
  symbol: "MATIC",
6022
6269
  name: "Polygon",
6023
- vault: "0x0000000000000000000000000000000000000000"
6270
+ vault: hubVaults.sodaPOL.address
6024
6271
  },
6025
6272
  [spokeChainConfig[types.POLYGON_MAINNET_CHAIN_ID].bnUSD]: {
6026
6273
  asset: "0x18f85f9E80ff9496EeBD5979a051AF16Ce751567",
6027
6274
  decimal: 18,
6028
6275
  symbol: "bnUSD",
6029
6276
  name: "bnUSD",
6030
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6277
+ vault: hubVaults.bnUSD.address
6031
6278
  },
6032
6279
  [spokeChainConfig[types.POLYGON_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
6033
6280
  asset: "0xa36893ba308b332FDEbfa95916D1dF3a2e3CF8B3",
6034
6281
  decimal: 6,
6035
6282
  symbol: "USDC",
6036
6283
  name: "USD Coin",
6037
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6284
+ vault: hubVaults.sodaUSDC.address
6038
6285
  }
6039
6286
  },
6040
6287
  [types.INJECTIVE_MAINNET_CHAIN_ID]: {
@@ -6043,21 +6290,21 @@ var hubAssets = {
6043
6290
  decimal: 18,
6044
6291
  symbol: "INJ",
6045
6292
  name: "Injective",
6046
- vault: "0x1f22279C89B213944b7Ea41daCB0a868DdCDFd13"
6293
+ vault: hubVaults.sodaINJ.address
6047
6294
  },
6048
6295
  [spokeChainConfig[types.INJECTIVE_MAINNET_CHAIN_ID].bnUSD]: {
6049
6296
  asset: "0x69425FFb14704124A58d6F69d510f74A59D9a5bC",
6050
6297
  decimal: 18,
6051
6298
  symbol: "bnUSD",
6052
6299
  name: "bnUSD",
6053
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6300
+ vault: hubVaults.bnUSD.address
6054
6301
  },
6055
6302
  [spokeChainConfig[types.INJECTIVE_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
6056
6303
  asset: "0x4bc1211faa06fb50ff61a70331f56167ae511057",
6057
6304
  decimal: 6,
6058
6305
  symbol: "USDC",
6059
6306
  name: "USD Coin",
6060
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6307
+ vault: hubVaults.sodaUSDC.address
6061
6308
  }
6062
6309
  },
6063
6310
  [types.STELLAR_MAINNET_CHAIN_ID]: {
@@ -6066,21 +6313,21 @@ var hubAssets = {
6066
6313
  decimal: 7,
6067
6314
  symbol: "XLM",
6068
6315
  name: "Stellar Lumens",
6069
- vault: "0x6BC8C37cba91F76E68C9e6d689A9C21E4d32079B"
6316
+ vault: hubVaults.sodaXLM.address
6070
6317
  },
6071
6318
  [spokeChainConfig[types.STELLAR_MAINNET_CHAIN_ID].bnUSD]: {
6072
6319
  asset: "0x23225Ab8E63FCa4070296678cb46566d57E1BBe3",
6073
6320
  decimal: 7,
6074
6321
  symbol: "bnUSD",
6075
6322
  name: "bnUSD",
6076
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6323
+ vault: hubVaults.bnUSD.address
6077
6324
  },
6078
6325
  [spokeChainConfig[types.STELLAR_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
6079
6326
  asset: "0x348007B53F25A9A857aB8eA81ec9E3CCBCf440f2",
6080
6327
  decimal: 7,
6081
6328
  symbol: "USDC",
6082
6329
  name: "USD Coin",
6083
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6330
+ vault: hubVaults.sodaUSDC.address
6084
6331
  }
6085
6332
  },
6086
6333
  [types.SUI_MAINNET_CHAIN_ID]: {
@@ -6089,21 +6336,69 @@ var hubAssets = {
6089
6336
  decimal: 9,
6090
6337
  symbol: "SUI",
6091
6338
  name: "Sui",
6092
- vault: "0xdc5B4b00F98347E95b9F94911213DAB4C687e1e3"
6339
+ vault: hubVaults.sodaSUI.address
6093
6340
  },
6094
6341
  [spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].bnUSD]: {
6095
6342
  asset: "0xDf23097B9AEb917Bf8fb70e99b6c528fffA35364",
6096
6343
  decimal: 9,
6097
6344
  symbol: "bnUSD",
6098
6345
  name: "bnUSD",
6099
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6346
+ vault: hubVaults.bnUSD.address
6100
6347
  },
6101
6348
  [spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
6102
6349
  asset: "0x5635369c8a29A081d26C2e9e28012FCa548BA0Cb",
6103
6350
  decimal: 6,
6104
6351
  symbol: "USDC",
6105
6352
  name: "USD Coin",
6106
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6353
+ vault: hubVaults.sodaUSDC.address
6354
+ },
6355
+ [spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.afSUI.address]: {
6356
+ asset: "0x039666bd0cbc96a66c40e8541af465beaa81aa7e",
6357
+ decimal: 9,
6358
+ symbol: "afSUI",
6359
+ name: "afSUI",
6360
+ vault: "0x"
6361
+ // no vault yet
6362
+ },
6363
+ [spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.mSUI.address]: {
6364
+ asset: "0xb202c674c9a79b5681e981ba0daa782b3ceeebbe",
6365
+ decimal: 9,
6366
+ symbol: "mSUI",
6367
+ name: "mSUI",
6368
+ vault: "0x"
6369
+ // no vault yet
6370
+ },
6371
+ [spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.haSUI.address]: {
6372
+ asset: "0x67a26d11fce15e8b33ac97230d36cae1c52c35e7",
6373
+ decimal: 9,
6374
+ symbol: "haSUI",
6375
+ name: "haSUI",
6376
+ vault: "0x"
6377
+ // no vault yet
6378
+ },
6379
+ [spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.vSUI.address]: {
6380
+ asset: "0x025715bcda08db06c795cd5bf944e2081468d99a",
6381
+ decimal: 9,
6382
+ symbol: "vSUI",
6383
+ name: "vSUI",
6384
+ vault: "0x"
6385
+ // no vault yet
6386
+ },
6387
+ [spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.yapSUI.address]: {
6388
+ asset: "0xac509404f3a3ca3f7766baf65be45a52b1cfccd7",
6389
+ decimal: 9,
6390
+ symbol: "yapSUI",
6391
+ name: "yapSUI",
6392
+ vault: "0x"
6393
+ // no vault yet
6394
+ },
6395
+ [spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.trevinSUI.address]: {
6396
+ asset: "0x514569c788b096595672e0f68ec72387a22ac67b",
6397
+ decimal: 9,
6398
+ symbol: "trevinSUI",
6399
+ name: "trevinSUI",
6400
+ vault: "0x"
6401
+ // no vault yet
6107
6402
  }
6108
6403
  },
6109
6404
  [types.SOLANA_MAINNET_CHAIN_ID]: {
@@ -6112,21 +6407,21 @@ var hubAssets = {
6112
6407
  decimal: 9,
6113
6408
  symbol: "SOL",
6114
6409
  name: "Solana",
6115
- vault: "0xdEa692287E2cE8Cb08FA52917Be0F16b1DACDC87"
6410
+ vault: hubVaults.sodaSOL.address
6116
6411
  },
6117
6412
  [spokeChainConfig[types.SOLANA_MAINNET_CHAIN_ID].bnUSD]: {
6118
6413
  asset: "0x14C65b1CDc0B821569081b1F77342dA0D0CbF439",
6119
6414
  decimal: 9,
6120
6415
  symbol: "bnUSD",
6121
6416
  name: "bnUSD",
6122
- vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
6417
+ vault: hubVaults.bnUSD.address
6123
6418
  },
6124
6419
  [spokeChainConfig[types.SOLANA_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
6125
6420
  asset: "0xC3f020057510ffE10Ceb882e1B48238b43d78a5e",
6126
6421
  decimal: 6,
6127
6422
  symbol: "USDC",
6128
6423
  name: "USD Coin",
6129
- vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833"
6424
+ vault: hubVaults.sodaUSDC.address
6130
6425
  }
6131
6426
  },
6132
6427
  [types.ICON_MAINNET_CHAIN_ID]: {
@@ -6135,7 +6430,8 @@ var hubAssets = {
6135
6430
  decimal: 18,
6136
6431
  symbol: "ICX",
6137
6432
  name: "ICON",
6138
- vault: "0x0000000000000000000000000000000000000000"
6433
+ vault: "0x"
6434
+ // no vault yet
6139
6435
  },
6140
6436
  [spokeChainConfig[types.ICON_MAINNET_CHAIN_ID].addresses.wICX]: {
6141
6437
  asset: "0xb66cB7D841272AF6BaA8b8119007EdEE35d2C24F",
@@ -6149,7 +6445,7 @@ var hubAssets = {
6149
6445
  decimal: 18,
6150
6446
  symbol: "bnUSD",
6151
6447
  name: "bnUSD",
6152
- vault: "0x9D4b663Eb075d2a1C7B8eaEFB9eCCC0510388B51"
6448
+ vault: hubVaults.IbnUSD.address
6153
6449
  }
6154
6450
  }
6155
6451
  };
@@ -6157,24 +6453,26 @@ var DEFAULT_RELAYER_API_ENDPOINT = "https://xcall-relay.nw.iconblockchain.xyz";
6157
6453
  var solverConfig = {
6158
6454
  [types.SONIC_MAINNET_CHAIN_ID]: {
6159
6455
  intentsContract: "0x6382D6ccD780758C5e8A6123c33ee8F4472F96ef",
6160
- solverApiEndpoint: "https://sodax-solver.iconblockchain.xyz"
6456
+ solverApiEndpoint: "https://sodax-solver-staging.iconblockchain.xyz"
6161
6457
  }
6162
6458
  };
6163
6459
  var getSolverConfig = (chainId) => solverConfig[chainId];
6164
6460
  var solverSupportedTokens = {
6165
6461
  [types.SONIC_MAINNET_CHAIN_ID]: [
6166
- spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.WETH,
6167
- spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.USDC,
6168
- spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.USDT,
6169
- spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.wSonic
6462
+ // spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.WETH, // NOTE: Planned for next release (1 - 2 weeks)
6463
+ // spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.USDC, // NOTE: Planned for next release (1 - 2 weeks)
6464
+ // spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.USDT, // NOTE: Planned for next release (1 - 2 weeks)
6465
+ // spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.wSonic, // NOTE: Planned for next release (1 - 2 weeks)
6170
6466
  ],
6171
6467
  [types.AVALANCHE_MAINNET_CHAIN_ID]: [
6172
6468
  spokeChainConfig[types.AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.AVAX,
6173
6469
  spokeChainConfig[types.AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.USDT,
6174
6470
  spokeChainConfig[types.AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.USDC
6471
+ // spokeChainConfig[AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6175
6472
  ],
6176
6473
  [types.ARBITRUM_MAINNET_CHAIN_ID]: [
6177
6474
  spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.ETH,
6475
+ // spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6178
6476
  spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.WBTC,
6179
6477
  spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.weETH,
6180
6478
  spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.wstETH,
@@ -6184,6 +6482,7 @@ var solverSupportedTokens = {
6184
6482
  ],
6185
6483
  [types.BASE_MAINNET_CHAIN_ID]: [
6186
6484
  spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.ETH,
6485
+ // spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6187
6486
  spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.weETH,
6188
6487
  spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.USDC,
6189
6488
  spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.wstETH,
@@ -6191,43 +6490,62 @@ var solverSupportedTokens = {
6191
6490
  ],
6192
6491
  [types.OPTIMISM_MAINNET_CHAIN_ID]: [
6193
6492
  spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.ETH,
6493
+ // spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6194
6494
  spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.USDC,
6195
6495
  spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.wstETH,
6196
- spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.weETH,
6496
+ // spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.weETH, // NOTE: Not Implemented
6197
6497
  spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.USDT
6198
6498
  ],
6199
6499
  [types.POLYGON_MAINNET_CHAIN_ID]: [
6200
6500
  spokeChainConfig[types.POLYGON_MAINNET_CHAIN_ID].supportedTokens.POL,
6501
+ // spokeChainConfig[POLYGON_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6201
6502
  spokeChainConfig[types.POLYGON_MAINNET_CHAIN_ID].supportedTokens.USDC
6202
6503
  ],
6203
6504
  [types.BSC_MAINNET_CHAIN_ID]: [
6204
6505
  spokeChainConfig[types.BSC_MAINNET_CHAIN_ID].supportedTokens.BNB,
6205
6506
  spokeChainConfig[types.BSC_MAINNET_CHAIN_ID].supportedTokens.ETHB,
6206
6507
  spokeChainConfig[types.BSC_MAINNET_CHAIN_ID].supportedTokens.BTCB,
6508
+ // spokeChainConfig[BSC_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6207
6509
  spokeChainConfig[types.BSC_MAINNET_CHAIN_ID].supportedTokens.USDC
6208
6510
  ],
6209
6511
  [types.SOLANA_MAINNET_CHAIN_ID]: [
6210
6512
  spokeChainConfig[types.SOLANA_MAINNET_CHAIN_ID].supportedTokens.SOL,
6513
+ // spokeChainConfig[SOLANA_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6211
6514
  spokeChainConfig[types.SOLANA_MAINNET_CHAIN_ID].supportedTokens.USDC
6212
6515
  ],
6213
6516
  [types.ICON_MAINNET_CHAIN_ID]: [
6214
6517
  spokeChainConfig[types.ICON_MAINNET_CHAIN_ID].supportedTokens.ICX,
6215
6518
  spokeChainConfig[types.ICON_MAINNET_CHAIN_ID].supportedTokens.wICX,
6216
6519
  spokeChainConfig[types.ICON_MAINNET_CHAIN_ID].supportedTokens.bnUSD
6520
+ // spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.BALN, // NOTE: Not Implemented
6521
+ // spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.OMM, // NOTE: Not Implemented
6217
6522
  ],
6218
6523
  [types.STELLAR_MAINNET_CHAIN_ID]: [
6219
6524
  spokeChainConfig[types.STELLAR_MAINNET_CHAIN_ID].supportedTokens.XLM,
6525
+ // spokeChainConfig[STELLAR_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6220
6526
  spokeChainConfig[types.STELLAR_MAINNET_CHAIN_ID].supportedTokens.USDC
6221
6527
  ],
6222
6528
  [types.SUI_MAINNET_CHAIN_ID]: [
6223
6529
  spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.SUI,
6224
- spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.USDC
6530
+ // spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6531
+ spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.USDC,
6532
+ spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.afSUI,
6533
+ spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.mSUI,
6534
+ spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.haSUI,
6535
+ spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.vSUI,
6536
+ spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.yapSUI,
6537
+ spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.trevinSUI
6225
6538
  ],
6226
6539
  [types.INJECTIVE_MAINNET_CHAIN_ID]: [
6227
6540
  spokeChainConfig[types.INJECTIVE_MAINNET_CHAIN_ID].supportedTokens.INJ,
6541
+ // spokeChainConfig[INJECTIVE_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6228
6542
  spokeChainConfig[types.INJECTIVE_MAINNET_CHAIN_ID].supportedTokens.USDC
6229
6543
  ],
6230
- [types.NIBIRU_MAINNET_CHAIN_ID]: []
6544
+ [types.NIBIRU_MAINNET_CHAIN_ID]: [
6545
+ // spokeChainConfig[NIBIRU_MAINNET_CHAIN_ID].supportedTokens.NIBI, // NOTE: Not Implemented
6546
+ // spokeChainConfig[NIBIRU_MAINNET_CHAIN_ID].supportedTokens.bnUSD, // NOTE: Not Implemented
6547
+ // spokeChainConfig[NIBIRU_MAINNET_CHAIN_ID].supportedTokens.USDC, // NOTE: Not Implemented
6548
+ ]
6231
6549
  };
6232
6550
  var getSupportedSolverTokens = (chainId) => solverSupportedTokens[chainId];
6233
6551
  var isSolverSupportedToken = (chainId, token) => solverSupportedTokens[chainId].some((t) => t.address.toLowerCase() === token.toLowerCase());
@@ -6252,8 +6570,8 @@ var moneyMarketSupportedTokens = {
6252
6570
  spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.ETH,
6253
6571
  spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
6254
6572
  spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.WBTC,
6255
- spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.weETH,
6256
- spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.wstETH,
6573
+ // spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.weETH,
6574
+ // spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.wstETH,
6257
6575
  spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.tBTC,
6258
6576
  spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.USDT,
6259
6577
  spokeChainConfig[types.ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.USDC
@@ -6261,17 +6579,17 @@ var moneyMarketSupportedTokens = {
6261
6579
  [types.BASE_MAINNET_CHAIN_ID]: [
6262
6580
  spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.ETH,
6263
6581
  spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
6264
- spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.weETH,
6582
+ // spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.weETH,
6265
6583
  spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.USDC,
6266
- spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.wstETH,
6584
+ // spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.wstETH,
6267
6585
  spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.cbBTC
6268
6586
  ],
6269
6587
  [types.OPTIMISM_MAINNET_CHAIN_ID]: [
6270
6588
  spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.ETH,
6271
6589
  spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
6272
6590
  spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.USDC,
6273
- spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.wstETH,
6274
- spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.weETH,
6591
+ // spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.wstETH,
6592
+ // spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.weETH,
6275
6593
  spokeChainConfig[types.OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.USDT
6276
6594
  ],
6277
6595
  [types.POLYGON_MAINNET_CHAIN_ID]: [
@@ -6287,12 +6605,13 @@ var moneyMarketSupportedTokens = {
6287
6605
  ],
6288
6606
  [types.SOLANA_MAINNET_CHAIN_ID]: [
6289
6607
  spokeChainConfig[types.SOLANA_MAINNET_CHAIN_ID].supportedTokens.SOL,
6290
- spokeChainConfig[types.SOLANA_MAINNET_CHAIN_ID].supportedTokens.bnUSD
6608
+ spokeChainConfig[types.SOLANA_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
6609
+ spokeChainConfig[types.SOLANA_MAINNET_CHAIN_ID].supportedTokens.USDC
6291
6610
  ],
6292
6611
  [types.ICON_MAINNET_CHAIN_ID]: [
6293
- spokeChainConfig[types.ICON_MAINNET_CHAIN_ID].supportedTokens.ICX,
6294
- spokeChainConfig[types.ICON_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
6295
- spokeChainConfig[types.ICON_MAINNET_CHAIN_ID].supportedTokens.wICX
6612
+ // spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.ICX,
6613
+ spokeChainConfig[types.ICON_MAINNET_CHAIN_ID].supportedTokens.bnUSD
6614
+ // spokeChainConfig[ICON_MAINNET_CHAIN_ID].supportedTokens.wICX,
6296
6615
  ],
6297
6616
  [types.STELLAR_MAINNET_CHAIN_ID]: [
6298
6617
  spokeChainConfig[types.STELLAR_MAINNET_CHAIN_ID].supportedTokens.XLM,
@@ -6319,102 +6638,6 @@ var moneyMarketSupportedTokens = {
6319
6638
  };
6320
6639
  var isMoneyMarketSupportedToken = (chainId, token) => moneyMarketSupportedTokens[chainId].some((t) => t.address.toLowerCase() === token.toLowerCase());
6321
6640
  var getSupportedMoneyMarketTokens = (chainId) => moneyMarketSupportedTokens[chainId];
6322
- var HubVaultSymbols = [
6323
- "sodaAVAX",
6324
- "sodaBNB",
6325
- "sodaETH",
6326
- "sodaBTC",
6327
- "sodaSUI",
6328
- "sodaINJ",
6329
- "sodaXLM",
6330
- "sodaSOL"
6331
- ];
6332
- var hubVaults = {
6333
- sodaAVAX: {
6334
- // SODA AVAX vault
6335
- address: "0x14238d267557e9d799016ad635b53cd15935d290",
6336
- reserves: [
6337
- // hub asset addresses contained in the vault
6338
- "0xc9e4f0b6195f389d9d2b639f2878b7674eb9d8cd"
6339
- // AvalancheAVAX hub asset
6340
- ]
6341
- },
6342
- sodaBNB: {
6343
- // SODA BNB vault
6344
- address: "0x40cd41b35db9e5109ae7e54b44de8625db320e6b",
6345
- reserves: [
6346
- // hub asset addresses contained in the vault
6347
- "0x13b70564b1ec12876b20fab5d1bb630311312f4f"
6348
- // BSC BNB hub asset
6349
- ]
6350
- },
6351
- sodaETH: {
6352
- // SODA ETH vault
6353
- address: "0x4effb5813271699683c25c734f4dabc45b363709",
6354
- reserves: [
6355
- // hub asset addresses contained in the vault
6356
- "0x70178089842be7f8e4726b33f0d1569db8021faa",
6357
- // BASE ETH hub asset
6358
- "0xad332860dd3b6f0e63f4f66e9457900917ac78cd",
6359
- // Optimism ETH hub asset
6360
- "0xdcd9578b51ef55239b6e68629d822a8d97c95b86",
6361
- // Arbitrum ETH hub asset
6362
- "0x57fc2ac5701e463ae261adbd6c99fbeb48ce5293"
6363
- // BSC ETH hub asset
6364
- ]
6365
- },
6366
- sodaBTC: {
6367
- // SODA BTC vault
6368
- address: "0x7a1a5555842ad2d0ed274d09b5c4406a95799d5d",
6369
- reserves: [
6370
- // hub asset addresses contained in the vault
6371
- "0x2803a23a3ba6b09e57d1c71dec0d9efdbb00a27f",
6372
- // BASE cbBTC hub asset,
6373
- "0xfb0acb1b2720b620935f50a6dd3f7fea52b2fcbe",
6374
- // Arbitrum wBTC hub asset
6375
- "0x96fc8540736f1598b7e235e6de8814062b3b5d3b",
6376
- // Arbitrum tBTC hub asset,
6377
- "0xd8a24c71fea5bb81c66c01e532de7d9b11e13905"
6378
- // BSC BTCB hub asset
6379
- ]
6380
- },
6381
- sodaSUI: {
6382
- // SODA SUI vault
6383
- address: "0xdc5b4b00f98347e95b9f94911213dab4c687e1e3",
6384
- reserves: [
6385
- // hub asset addresses contained in the vault
6386
- "0x4676b2a551b25c04e235553c1c81019337384673"
6387
- // SUI SUI hub asset
6388
- ]
6389
- },
6390
- sodaINJ: {
6391
- // SODA INJ vault
6392
- address: "0x1f22279c89b213944b7ea41dacb0a868ddcdfd13",
6393
- reserves: [
6394
- // hub asset addresses contained in the vault
6395
- "0xd375590b4955f6ea5623f799153f9b787a3bd319"
6396
- // Injective INJ hub asset
6397
- ]
6398
- },
6399
- sodaXLM: {
6400
- // SODA XLM vault
6401
- address: "0x6bc8c37cba91f76e68c9e6d689a9c21e4d32079b",
6402
- reserves: [
6403
- // hub asset addresses contained in the vault
6404
- "0x8ac68af223907fb1b893086601a3d99e00f2fa9d"
6405
- // Stellar XLM hub asset
6406
- ]
6407
- },
6408
- sodaSOL: {
6409
- // SODA SOL vault
6410
- address: "0xdea692287e2ce8cb08fa52917be0f16b1dacdc87",
6411
- reserves: [
6412
- // hub asset addresses contained in the vault
6413
- "0x0c09e69a4528945de6d16c7e469dea6996fdf636"
6414
- // Solana SOL hub asset
6415
- ]
6416
- }
6417
- };
6418
6641
  var hubVaultsAddressSet = new Set(
6419
6642
  Object.values(hubVaults).map((vault) => vault.address.toLowerCase())
6420
6643
  );
@@ -6423,14 +6646,7 @@ var moneyMarketReserveHubAssetsSet = new Set(
6423
6646
  );
6424
6647
  var isMoneyMarketReserveHubAsset = (hubAsset) => moneyMarketReserveHubAssetsSet.has(hubAsset.toLowerCase());
6425
6648
  var moneyMarketReserveAssets = [
6426
- hubVaults["sodaAVAX"].address,
6427
- hubVaults["sodaBNB"].address,
6428
- hubVaults["sodaETH"].address,
6429
- hubVaults["sodaBTC"].address,
6430
- hubVaults["sodaSUI"].address,
6431
- hubVaults["sodaINJ"].address,
6432
- hubVaults["sodaXLM"].address,
6433
- hubVaults["sodaSOL"].address,
6649
+ ...Object.values(hubVaults).map((vault) => vault.address),
6434
6650
  getMoneyMarketConfig(types.SONIC_MAINNET_CHAIN_ID).bnUSDVault
6435
6651
  ];
6436
6652
  var isMoneyMarketReserveAsset = (asset) => moneyMarketReserveAssets.map((a) => a.toLowerCase()).includes(asset.toLowerCase());
@@ -6777,28 +6993,164 @@ var EvmSpokeProvider = class {
6777
6993
  }
6778
6994
  }
6779
6995
  };
6996
+ var CustomStellarAccount = class {
6997
+ accountId;
6998
+ sequenceNumber;
6999
+ startingSequenceNumber;
7000
+ constructor({ account_id, sequence }) {
7001
+ this.accountId = account_id;
7002
+ this.sequenceNumber = BigInt(sequence);
7003
+ this.startingSequenceNumber = BigInt(sequence);
7004
+ }
7005
+ getSequenceNumber() {
7006
+ return this.sequenceNumber;
7007
+ }
7008
+ getStartingSequenceNumber() {
7009
+ return this.startingSequenceNumber;
7010
+ }
7011
+ getAccountId() {
7012
+ return this.accountId;
7013
+ }
7014
+ getAccountClone() {
7015
+ return new stellarSdk.Account(this.accountId, this.sequenceNumber.toString());
7016
+ }
7017
+ incrementSequenceNumber() {
7018
+ this.sequenceNumber++;
7019
+ }
7020
+ decrementSequenceNumber() {
7021
+ if (this.sequenceNumber > this.startingSequenceNumber) {
7022
+ this.sequenceNumber--;
7023
+ }
7024
+ throw new Error(
7025
+ `Sequence number cannot be decremented below the starting sequence number: ${this.startingSequenceNumber}`
7026
+ );
7027
+ }
7028
+ resetSequenceNumber() {
7029
+ this.sequenceNumber = this.startingSequenceNumber;
7030
+ }
7031
+ };
7032
+ var CustomSorobanServer = class extends stellarSdk.SorobanRpc.Server {
7033
+ customHeaders;
7034
+ constructor(serverUrl, customHeaders) {
7035
+ super(serverUrl, {
7036
+ allowHttp: true
7037
+ });
7038
+ this.customHeaders = customHeaders;
7039
+ }
7040
+ async getNetwork() {
7041
+ const requestOptions = {
7042
+ method: "POST",
7043
+ headers: {
7044
+ "Content-Type": "application/json",
7045
+ ...this.customHeaders
7046
+ },
7047
+ body: JSON.stringify({
7048
+ id: 1,
7049
+ jsonrpc: "2.0",
7050
+ method: "getNetwork"
7051
+ })
7052
+ };
7053
+ const response = await fetch(`${this.serverURL}`, requestOptions);
7054
+ if (!response.ok) {
7055
+ throw new Error(`HTTP error getting network! status: ${response.status}`);
7056
+ }
7057
+ return response.json().then((json) => json.result);
7058
+ }
7059
+ async simulateTransaction(tx) {
7060
+ const requestOptions = {
7061
+ method: "POST",
7062
+ headers: {
7063
+ "Content-Type": "application/json",
7064
+ ...this.customHeaders
7065
+ },
7066
+ body: JSON.stringify({
7067
+ id: 1,
7068
+ jsonrpc: "2.0",
7069
+ method: "simulateTransaction",
7070
+ params: {
7071
+ transaction: tx.toXDR()
7072
+ }
7073
+ })
7074
+ };
7075
+ const response = await fetch(`${this.serverURL}`, requestOptions);
7076
+ if (!response.ok) {
7077
+ throw new Error(`HTTP error simulating TX! status: ${response.status}`);
7078
+ }
7079
+ return response.json().then((json) => json.result);
7080
+ }
7081
+ async sendTransaction(tx) {
7082
+ const requestOptions = {
7083
+ method: "POST",
7084
+ headers: {
7085
+ "Content-Type": "application/json",
7086
+ ...this.customHeaders
7087
+ },
7088
+ body: JSON.stringify({
7089
+ id: 1,
7090
+ jsonrpc: "2.0",
7091
+ method: "sendTransaction",
7092
+ params: {
7093
+ transaction: tx.toXDR()
7094
+ }
7095
+ })
7096
+ };
7097
+ const response = await fetch(`${this.serverURL}`, requestOptions);
7098
+ if (!response.ok) {
7099
+ throw new Error(`HTTP error submitting TX! status: ${response.status}`);
7100
+ }
7101
+ return response.json().then((json) => json.result);
7102
+ }
7103
+ async getTransaction(hash) {
7104
+ const requestOptions = {
7105
+ method: "POST",
7106
+ headers: {
7107
+ "Content-Type": "application/json",
7108
+ ...this.customHeaders
7109
+ },
7110
+ body: JSON.stringify({
7111
+ id: 1,
7112
+ jsonrpc: "2.0",
7113
+ method: "getTransaction",
7114
+ params: { hash }
7115
+ })
7116
+ };
7117
+ const response = await fetch(`${this.serverURL}`, requestOptions);
7118
+ if (!response.ok) {
7119
+ throw new Error(`HTTP error getting TX! status: ${response.status}`);
7120
+ }
7121
+ return response.json().then((json) => json.result);
7122
+ }
7123
+ };
6780
7124
  var StellarSpokeProvider = class {
6781
7125
  server;
7126
+ sorobanServer;
6782
7127
  contract;
6783
7128
  chainConfig;
6784
7129
  walletProvider;
6785
- constructor(walletProvider, contractAddress, config, rpc) {
6786
- this.server = new stellarSdk.rpc.Server(rpc);
7130
+ constructor(walletProvider, config, rpcConfig) {
7131
+ this.server = new stellarSdk.Horizon.Server(
7132
+ rpcConfig && rpcConfig.horizonRpcUrl ? rpcConfig.horizonRpcUrl : config.horizonRpcUrl,
7133
+ { allowHttp: true }
7134
+ );
7135
+ this.sorobanServer = new CustomSorobanServer(
7136
+ rpcConfig && rpcConfig.sorobanRpcUrl ? rpcConfig.sorobanRpcUrl : config.sorobanRpcUrl,
7137
+ {}
7138
+ );
6787
7139
  this.walletProvider = walletProvider;
6788
- this.contract = new stellarSdk.Contract(contractAddress);
7140
+ this.contract = new stellarSdk.Contract(config.addresses.assetManager);
6789
7141
  this.chainConfig = config;
6790
7142
  }
6791
7143
  async getBalance(tokenAddress) {
6792
7144
  const [network, walletAddress] = await Promise.all([
6793
- this.server.getNetwork(),
7145
+ this.sorobanServer.getNetwork(),
6794
7146
  this.walletProvider.getWalletAddress()
6795
7147
  ]);
6796
- const sourceAccount = await this.server.getAccount(walletAddress);
7148
+ const sourceAccount = await this.sorobanServer.getAccount(walletAddress);
6797
7149
  const tx = new stellarSdk.TransactionBuilder(sourceAccount, {
6798
7150
  fee: stellarSdk.BASE_FEE,
6799
7151
  networkPassphrase: network.passphrase
6800
7152
  }).addOperation(this.contract.call("get_token_balance", stellarSdk.nativeToScVal(tokenAddress, { type: "address" }))).setTimeout(stellarSdk.TimeoutInfinite).build();
6801
- const result = await this.server.simulateTransaction(tx);
7153
+ const result = await this.sorobanServer.simulateTransaction(tx);
6802
7154
  if (stellarSdk.rpc.Api.isSimulationError(result)) {
6803
7155
  throw new Error("Failed to simulate transaction");
6804
7156
  }
@@ -6808,32 +7160,112 @@ var StellarSpokeProvider = class {
6808
7160
  }
6809
7161
  throw new Error("result undefined");
6810
7162
  }
7163
+ async buildPriorityStellarTransaction(account, network, operation) {
7164
+ const simulationForFee = await this.sorobanServer.simulateTransaction(
7165
+ new stellarSdk.TransactionBuilder(account.getAccountClone(), {
7166
+ fee: stellarSdk.BASE_FEE,
7167
+ networkPassphrase: network.passphrase
7168
+ }).addOperation(operation).setTimeout(STELLAR_DEFAULT_TX_TIMEOUT_SECONDS).build()
7169
+ );
7170
+ if (!stellarSdk.rpc.Api.isSimulationSuccess(simulationForFee)) {
7171
+ throw new Error(`Simulation error: ${JSON.stringify(simulationForFee)}`);
7172
+ }
7173
+ const priorityTransaction = new stellarSdk.TransactionBuilder(account.getAccountClone(), {
7174
+ fee: (BigInt(simulationForFee.minResourceFee) + BigInt(STELLAR_PRIORITY_FEE) + BigInt(stellarSdk.BASE_FEE.toString())).toString(),
7175
+ networkPassphrase: network.passphrase
7176
+ }).addOperation(operation).setTimeout(STELLAR_DEFAULT_TX_TIMEOUT_SECONDS).build();
7177
+ const simulation = await this.sorobanServer.simulateTransaction(priorityTransaction);
7178
+ return [stellarSdk.SorobanRpc.assembleTransaction(priorityTransaction, simulation).build(), simulation];
7179
+ }
7180
+ handleSendTransactionError(response) {
7181
+ if (response.status === "ERROR") {
7182
+ throw new Error(
7183
+ `Transaction failed: status: ${response.status}, hash: ${response.hash}, errorResult: ${JSON.stringify({
7184
+ name: response?.errorResult?.result()?.switch()?.name ?? "unknown",
7185
+ value: response?.errorResult?.result()?.switch()?.value ?? "unknown"
7186
+ })}, diagnosticEvents: ${JSON.stringify(response?.diagnosticEvents ?? "{}")}`
7187
+ );
7188
+ }
7189
+ return response;
7190
+ }
7191
+ async signAndSendTransaction(tx, waitForTransaction = true) {
7192
+ const signedTransaction = await this.walletProvider.signTransaction(tx.toXDR());
7193
+ const signedTx = stellarSdk.TransactionBuilder.fromXDR(signedTransaction, tx.networkPassphrase);
7194
+ const response = this.handleSendTransactionError(await this.sorobanServer.sendTransaction(signedTx));
7195
+ if (waitForTransaction) {
7196
+ return await this.waitForTransaction(response.hash);
7197
+ }
7198
+ return response.hash;
7199
+ }
7200
+ async waitForTransaction(hash, attempts = 60) {
7201
+ if (attempts === 0) {
7202
+ throw new Error(
7203
+ "[StellarSpokeProvider.waitForTransaction] Timeout error. Transaction not found after 5 attempts"
7204
+ );
7205
+ }
7206
+ const response = await this.sorobanServer.getTransaction(hash);
7207
+ if (response.status === stellarSdk.rpc.Api.GetTransactionStatus.SUCCESS) {
7208
+ return hash;
7209
+ }
7210
+ if (response.status === stellarSdk.rpc.Api.GetTransactionStatus.FAILED) {
7211
+ throw response;
7212
+ }
7213
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
7214
+ return this.waitForTransaction(hash, attempts - 1);
7215
+ }
7216
+ async submitOrRestoreAndRetry(account, network, tx, operation, simulation) {
7217
+ const initialSimulation = simulation ?? await this.sorobanServer.simulateTransaction(tx);
7218
+ if (!stellarSdk.rpc.Api.isSimulationSuccess(initialSimulation)) {
7219
+ throw new Error(
7220
+ `[StellarSpokeProvider.submitOrRestoreAndRetry] Simulation Failed: ${JSON.stringify(initialSimulation)}`
7221
+ );
7222
+ }
7223
+ let restored = false;
7224
+ if (stellarSdk.rpc.Api.isSimulationRestore(initialSimulation)) {
7225
+ try {
7226
+ await this.handleSimulationRestore(
7227
+ initialSimulation.restorePreamble.minResourceFee,
7228
+ initialSimulation.restorePreamble.transactionData.build(),
7229
+ account,
7230
+ network
7231
+ );
7232
+ restored = true;
7233
+ } catch (error) {
7234
+ throw new Error(
7235
+ `[StellarSpokeProvider.submitOrRestoreAndRetry] Simulation Restore Failed: ${JSON.stringify(error)}`
7236
+ );
7237
+ }
7238
+ }
7239
+ if (!restored) {
7240
+ return await this.signAndSendTransaction(tx);
7241
+ }
7242
+ const newAccount = account.getAccountClone();
7243
+ newAccount.incrementSequenceNumber();
7244
+ return await this.signAndSendTransaction(
7245
+ new stellarSdk.TransactionBuilder(newAccount, {
7246
+ fee: stellarSdk.BASE_FEE,
7247
+ networkPassphrase: network.passphrase
7248
+ }).addOperation(operation).setTimeout(STELLAR_DEFAULT_TX_TIMEOUT_SECONDS).build()
7249
+ );
7250
+ }
7251
+ async handleSimulationRestore(minResourceFee, transactionData, account, network) {
7252
+ const totalFee = (BigInt(stellarSdk.BASE_FEE) + BigInt(STELLAR_PRIORITY_FEE) + BigInt(minResourceFee)).toString();
7253
+ return this.signAndSendTransaction(
7254
+ new stellarSdk.TransactionBuilder(account.getAccountClone(), { fee: totalFee }).setNetworkPassphrase(network.passphrase).setSorobanData(transactionData).addOperation(stellarSdk.Operation.restoreFootprint({})).setTimeout(STELLAR_DEFAULT_TX_TIMEOUT_SECONDS).build()
7255
+ );
7256
+ }
6811
7257
  async deposit(token, amount, recipient, data, raw) {
6812
7258
  try {
6813
7259
  const [network, walletAddress] = await Promise.all([
6814
- this.server.getNetwork(),
7260
+ this.sorobanServer.getNetwork(),
6815
7261
  this.walletProvider.getWalletAddress()
6816
7262
  ]);
6817
- const sourceAccount = await this.server.getAccount(walletAddress);
6818
- const simulateTx = new stellarSdk.TransactionBuilder(sourceAccount, {
6819
- fee: stellarSdk.BASE_FEE,
6820
- networkPassphrase: network.passphrase
6821
- }).addOperation(
6822
- this.contract.call(
6823
- "transfer",
6824
- stellarSdk.nativeToScVal(stellarSdk.Address.fromString(walletAddress), { type: "address" }),
6825
- stellarSdk.nativeToScVal(stellarSdk.Address.fromString(token), {
6826
- type: "address"
6827
- }),
6828
- stellarSdk.nativeToScVal(BigInt(amount), { type: "u128" }),
6829
- stellarSdk.nativeToScVal(recipient),
6830
- stellarSdk.nativeToScVal(Buffer.from(data), { type: "bytes" })
6831
- )
6832
- ).setTimeout(100).build();
6833
- const simResult = await this.server.simulateTransaction(simulateTx);
6834
- const tx = stellarSdk.rpc.assembleTransaction(simulateTx, simResult).build();
7263
+ const accountResponse = await this.server.loadAccount(walletAddress);
7264
+ const stellarAccount = new CustomStellarAccount(accountResponse);
7265
+ const depositCall = this.buildDepositCall(walletAddress, token, amount, recipient, data);
7266
+ const [priorityTx, simulation] = await this.buildPriorityStellarTransaction(stellarAccount, network, depositCall);
6835
7267
  if (raw) {
6836
- const transactionXdr = tx.toXDR();
7268
+ const transactionXdr = priorityTx.toXDR();
6837
7269
  return {
6838
7270
  from: walletAddress,
6839
7271
  to: this.chainConfig.addresses.assetManager,
@@ -6841,16 +7273,8 @@ var StellarSpokeProvider = class {
6841
7273
  data: transactionXdr
6842
7274
  };
6843
7275
  }
6844
- if (tx) {
6845
- const signedTx = await this.walletProvider.signTransaction(tx.toXDR());
6846
- const sendResponse = await this.server.sendTransaction(
6847
- stellarSdk.TransactionBuilder.fromXDR(signedTx, tx.networkPassphrase)
6848
- );
6849
- if (sendResponse.hash) {
6850
- return `0x${sendResponse.hash}`;
6851
- }
6852
- }
6853
- throw new Error("Failed to create transaction");
7276
+ const hash = await this.submitOrRestoreAndRetry(stellarAccount, network, priorityTx, depositCall, simulation);
7277
+ return `${hash}`;
6854
7278
  } catch (error) {
6855
7279
  console.error("Error during deposit:", error);
6856
7280
  throw error;
@@ -6859,27 +7283,19 @@ var StellarSpokeProvider = class {
6859
7283
  async sendMessage(dst_chain_id, dst_address, payload, raw) {
6860
7284
  try {
6861
7285
  const [network, walletAddress] = await Promise.all([
6862
- this.server.getNetwork(),
7286
+ this.sorobanServer.getNetwork(),
6863
7287
  this.walletProvider.getWalletAddress()
6864
7288
  ]);
6865
- const sourceAccount = await this.server.getAccount(walletAddress);
6866
- const connection = new stellarSdk.Contract(this.chainConfig.addresses.connection);
6867
- const simulateTx = new stellarSdk.TransactionBuilder(sourceAccount, {
6868
- fee: stellarSdk.BASE_FEE,
6869
- networkPassphrase: network.passphrase
6870
- }).addOperation(
6871
- connection.call(
6872
- "send_message",
6873
- stellarSdk.nativeToScVal(stellarSdk.Address.fromString(walletAddress), { type: "address" }),
6874
- stellarSdk.nativeToScVal(dst_chain_id, { type: "u128" }),
6875
- stellarSdk.nativeToScVal(Buffer.from(dst_address), { type: "bytes" }),
6876
- stellarSdk.nativeToScVal(Buffer.from(payload), { type: "bytes" })
6877
- )
6878
- ).setTimeout(100).build();
6879
- const simResult = await this.server.simulateTransaction(simulateTx);
6880
- const tx = stellarSdk.rpc.assembleTransaction(simulateTx, simResult).build();
7289
+ const accountResponse = await this.server.loadAccount(walletAddress);
7290
+ const stellarAccount = new CustomStellarAccount(accountResponse);
7291
+ const sendMessageCall = this.buildSendMessageCall(walletAddress, dst_chain_id, dst_address, payload);
7292
+ const [priorityTx, simulation] = await this.buildPriorityStellarTransaction(
7293
+ stellarAccount,
7294
+ network,
7295
+ sendMessageCall
7296
+ );
6881
7297
  if (raw) {
6882
- const transactionXdr = tx.toXDR();
7298
+ const transactionXdr = priorityTx.toXDR();
6883
7299
  return {
6884
7300
  from: walletAddress,
6885
7301
  to: this.chainConfig.addresses.assetManager,
@@ -6887,21 +7303,35 @@ var StellarSpokeProvider = class {
6887
7303
  data: transactionXdr
6888
7304
  };
6889
7305
  }
6890
- if (tx) {
6891
- const signedTx = await this.walletProvider.signTransaction(tx.toXDR());
6892
- const sendResponse = await this.server.sendTransaction(
6893
- stellarSdk.TransactionBuilder.fromXDR(signedTx, tx.networkPassphrase)
6894
- );
6895
- if (sendResponse.hash) {
6896
- return `0x${sendResponse.hash}`;
6897
- }
6898
- }
6899
- throw new Error("Failed to create transaction");
7306
+ const hash = await this.submitOrRestoreAndRetry(stellarAccount, network, priorityTx, sendMessageCall, simulation);
7307
+ return `${hash}`;
6900
7308
  } catch (error) {
6901
- console.error("Error during deposit:", error);
7309
+ console.error("Error during sendMessage:", error);
6902
7310
  throw error;
6903
7311
  }
6904
7312
  }
7313
+ buildDepositCall(walletAddress, token, amount, recipient, data) {
7314
+ return this.contract.call(
7315
+ "transfer",
7316
+ stellarSdk.nativeToScVal(stellarSdk.Address.fromString(walletAddress), { type: "address" }),
7317
+ stellarSdk.nativeToScVal(stellarSdk.Address.fromString(token), {
7318
+ type: "address"
7319
+ }),
7320
+ stellarSdk.nativeToScVal(BigInt(amount), { type: "u128" }),
7321
+ stellarSdk.nativeToScVal(Buffer.from(recipient), { type: "bytes" }),
7322
+ stellarSdk.nativeToScVal(Buffer.from(data), { type: "bytes" })
7323
+ );
7324
+ }
7325
+ buildSendMessageCall(walletAddress, dst_chain_id, dst_address, payload) {
7326
+ const connection = new stellarSdk.Contract(this.chainConfig.addresses.connection);
7327
+ return connection.call(
7328
+ "send_message",
7329
+ stellarSdk.nativeToScVal(stellarSdk.Address.fromString(walletAddress), { type: "address" }),
7330
+ stellarSdk.nativeToScVal(dst_chain_id, { type: "u128" }),
7331
+ stellarSdk.nativeToScVal(Buffer.from(dst_address), { type: "bytes" }),
7332
+ stellarSdk.nativeToScVal(Buffer.from(payload), { type: "bytes" })
7333
+ );
7334
+ }
6905
7335
  static getAddressBCSBytes(stellaraddress) {
6906
7336
  return `0x${stellarSdk.Address.fromString(stellaraddress).toScVal().toXDR("hex")}`;
6907
7337
  }
@@ -7672,9 +8102,13 @@ function encodeAddress(spokeChainId, address) {
7672
8102
  case "injective-1":
7673
8103
  return viem.toHex(Buffer.from(address, "utf-8"));
7674
8104
  case "0x1.icon":
7675
- return `0x${Buffer.from(address.replace("cx", "01").replace("hx", "00") ?? "f8", "hex").toString("hex")}`;
8105
+ return viem.toHex(Buffer.from(address.replace("cx", "01").replace("hx", "00") ?? "f8", "hex"));
7676
8106
  case "sui":
7677
8107
  return viem.toHex(bcs.bcs.Address.serialize(address).toBytes());
8108
+ case "solana":
8109
+ return viem.toHex(Buffer.from(new web3_js.PublicKey(address).toBytes()));
8110
+ case "stellar":
8111
+ return `0x${stellarSdk.Address.fromString(address).toScVal().toXDR("hex")}`;
7678
8112
  default:
7679
8113
  return address;
7680
8114
  }
@@ -7927,10 +8361,10 @@ var MoneyMarketService = class _MoneyMarketService {
7927
8361
  * @param params - The parameters for the supply transaction.
7928
8362
  * @param spokeProvider - The spoke provider.
7929
8363
  * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
7930
- * @returns {Promise<Result<[Hex, Hex], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
8364
+ * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
7931
8365
  *
7932
8366
  * @example
7933
- * const result = await moneyMarketService.supplyAndSubmit(
8367
+ * const result = await moneyMarketService.supply(
7934
8368
  * {
7935
8369
  * token: '0x...', // Address of the token (spoke chain address) to supply
7936
8370
  * amount: 1000n, // Amount to supply (in token decimals)
@@ -7949,40 +8383,47 @@ var MoneyMarketService = class _MoneyMarketService {
7949
8383
  * ] = result.value;
7950
8384
  * console.log('Supply transaction hashes:', { spokeTxHash, hubTxHash });
7951
8385
  */
7952
- async supplyAndSubmit(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
8386
+ async supply(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
7953
8387
  try {
7954
- const txResult = await this.supply(params, spokeProvider);
8388
+ const txResult = await this.createSupplyIntent(params, spokeProvider);
7955
8389
  if (!txResult.ok) {
7956
- return {
7957
- ok: false,
7958
- error: {
7959
- code: "SUPPLY_FAILED",
7960
- error: txResult.error
7961
- }
7962
- };
8390
+ return txResult;
7963
8391
  }
7964
8392
  const packetResult = await relayTxAndWaitPacket(
7965
8393
  txResult.value,
8394
+ spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
7966
8395
  spokeProvider,
7967
8396
  this.config.relayerApiEndpoint,
7968
8397
  timeout
7969
8398
  );
7970
8399
  if (!packetResult.ok) {
7971
- return packetResult;
8400
+ return {
8401
+ ok: false,
8402
+ error: {
8403
+ code: packetResult.error.code,
8404
+ data: {
8405
+ error: packetResult.error,
8406
+ payload: txResult.value
8407
+ }
8408
+ }
8409
+ };
7972
8410
  }
7973
8411
  return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
7974
8412
  } catch (error) {
7975
8413
  return {
7976
8414
  ok: false,
7977
8415
  error: {
7978
- code: "UNKNOWN",
7979
- error
8416
+ code: "SUPPLY_UNKNOWN_ERROR",
8417
+ data: {
8418
+ error,
8419
+ payload: params
8420
+ }
7980
8421
  }
7981
8422
  };
7982
8423
  }
7983
8424
  }
7984
8425
  /**
7985
- * Supply tokens to the money market pool without submitting the intent to the Solver API
8426
+ * Create supply intent only (without submitting to Solver API)
7986
8427
  * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
7987
8428
  * In order to successfully supply tokens, you need to:
7988
8429
  * 1. Check if the allowance is sufficient
@@ -7997,7 +8438,7 @@ var MoneyMarketService = class _MoneyMarketService {
7997
8438
  *
7998
8439
  * @example
7999
8440
  * const moneyMarketService = new MoneyMarketService(config);
8000
- * const result = await moneyMarketService.supply(
8441
+ * const result = await moneyMarketService.createSupplyIntent(
8001
8442
  * {
8002
8443
  * token: "0x123...", // token address
8003
8444
  * amount: 1000000000000000000n // 1 token in wei
@@ -8013,7 +8454,7 @@ var MoneyMarketService = class _MoneyMarketService {
8013
8454
  * console.error('Supply failed:', result.error);
8014
8455
  * }
8015
8456
  */
8016
- async supply(params, spokeProvider, raw) {
8457
+ async createSupplyIntent(params, spokeProvider, raw) {
8017
8458
  try {
8018
8459
  invariant2__default.default(params.action === "supply", "Invalid action");
8019
8460
  invariant2__default.default(params.token.length > 0, "Token is required");
@@ -8029,7 +8470,12 @@ var MoneyMarketService = class _MoneyMarketService {
8029
8470
  this.hubProvider,
8030
8471
  spokeProvider
8031
8472
  );
8032
- const data = this.supplyData(params.token, hubWallet, params.amount, spokeProvider.chainConfig.chain.id);
8473
+ const data = this.buildSupplyData(
8474
+ params.token,
8475
+ hubWallet,
8476
+ params.amount,
8477
+ spokeProvider.chainConfig.chain.id
8478
+ );
8033
8479
  const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
8034
8480
  const txResult = await SpokeService.deposit(
8035
8481
  {
@@ -8045,14 +8491,21 @@ var MoneyMarketService = class _MoneyMarketService {
8045
8491
  );
8046
8492
  return {
8047
8493
  ok: true,
8048
- value: txResult
8494
+ value: txResult,
8495
+ data: {
8496
+ address: hubWallet,
8497
+ payload: data
8498
+ }
8049
8499
  };
8050
8500
  } catch (error) {
8051
8501
  return {
8052
8502
  ok: false,
8053
8503
  error: {
8054
- code: "UNKNOWN",
8055
- error
8504
+ code: "CREATE_SUPPLY_INTENT_FAILED",
8505
+ data: {
8506
+ error,
8507
+ payload: params
8508
+ }
8056
8509
  }
8057
8510
  };
8058
8511
  }
@@ -8062,10 +8515,10 @@ var MoneyMarketService = class _MoneyMarketService {
8062
8515
  * @param params - The parameters for the borrow transaction.
8063
8516
  * @param spokeProvider - The spoke provider.
8064
8517
  * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
8065
- * @returns {Promise<Result<[Hex, Hex], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
8518
+ * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
8066
8519
  *
8067
8520
  * @example
8068
- * const result = await moneyMarketService.borrowAndSubmit(
8521
+ * const result = await moneyMarketService.borrow(
8069
8522
  * {
8070
8523
  * token: '0x...', // Address of the token (spoke chain address) to borrow
8071
8524
  * amount: 1000n, // Amount to borrow (in token decimals)
@@ -8084,40 +8537,47 @@ var MoneyMarketService = class _MoneyMarketService {
8084
8537
  * ] = result.value;
8085
8538
  * console.log('Borrow transaction hashes:', { spokeTxHash, hubTxHash });
8086
8539
  */
8087
- async borrowAndSubmit(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
8540
+ async borrow(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
8088
8541
  try {
8089
- const txResult = await this.borrow(params, spokeProvider);
8542
+ const txResult = await this.createBorrowIntent(params, spokeProvider);
8090
8543
  if (!txResult.ok) {
8091
- return {
8092
- ok: false,
8093
- error: {
8094
- code: "BORROW_FAILED",
8095
- error: txResult.error
8096
- }
8097
- };
8544
+ return txResult;
8098
8545
  }
8099
8546
  const packetResult = await relayTxAndWaitPacket(
8100
8547
  txResult.value,
8548
+ spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
8101
8549
  spokeProvider,
8102
8550
  this.config.relayerApiEndpoint,
8103
8551
  timeout
8104
8552
  );
8105
8553
  if (!packetResult.ok) {
8106
- return packetResult;
8554
+ return {
8555
+ ok: false,
8556
+ error: {
8557
+ code: packetResult.error.code,
8558
+ data: {
8559
+ error: packetResult.error,
8560
+ payload: txResult.value
8561
+ }
8562
+ }
8563
+ };
8107
8564
  }
8108
8565
  return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
8109
8566
  } catch (error) {
8110
8567
  return {
8111
8568
  ok: false,
8112
8569
  error: {
8113
- code: "UNKNOWN",
8114
- error
8570
+ code: "BORROW_UNKNOWN_ERROR",
8571
+ data: {
8572
+ error,
8573
+ payload: params
8574
+ }
8115
8575
  }
8116
8576
  };
8117
8577
  }
8118
8578
  }
8119
8579
  /**
8120
- * Borrow tokens from the money market pool without submitting the intent to the Solver API
8580
+ * Create borrow intent only (without submitting to Solver API)
8121
8581
  * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
8122
8582
  * In order to successfully borrow tokens, you need to:
8123
8583
  * 1. Execute the borrow transaction on the spoke chain
@@ -8130,13 +8590,13 @@ var MoneyMarketService = class _MoneyMarketService {
8130
8590
  *
8131
8591
  * @example
8132
8592
  * const moneyMarketService = new MoneyMarketService(config);
8133
- * const result = await moneyMarketService.borrow(
8593
+ * const result = await moneyMarketService.createBorrowIntent(
8134
8594
  * {
8135
8595
  * token: "0x123...", // token address
8136
8596
  * amount: 1000000000000000000n // 1 token in wei
8137
8597
  * },
8138
8598
  * spokeProvider,
8139
- * raw // Optional: true = return the raw transaction data, false = exeute and return the transaction hash (default: false)
8599
+ * raw // Optional: true = return the raw transaction data, false = execute and return the transaction hash (default: false)
8140
8600
  * );
8141
8601
  *
8142
8602
  * if (result.ok) {
@@ -8146,7 +8606,7 @@ var MoneyMarketService = class _MoneyMarketService {
8146
8606
  * console.error('Borrow failed:', result.error);
8147
8607
  * }
8148
8608
  */
8149
- async borrow(params, spokeProvider, raw) {
8609
+ async createBorrowIntent(params, spokeProvider, raw) {
8150
8610
  invariant2__default.default(params.action === "borrow", "Invalid action");
8151
8611
  invariant2__default.default(params.token.length > 0, "Token is required");
8152
8612
  invariant2__default.default(params.amount > 0n, "Amount must be greater than 0");
@@ -8161,7 +8621,7 @@ var MoneyMarketService = class _MoneyMarketService {
8161
8621
  this.hubProvider,
8162
8622
  spokeProvider
8163
8623
  );
8164
- const data = this.borrowData(
8624
+ const data = this.buildBorrowData(
8165
8625
  hubWallet,
8166
8626
  walletAddressBytes,
8167
8627
  params.token,
@@ -8169,7 +8629,14 @@ var MoneyMarketService = class _MoneyMarketService {
8169
8629
  spokeProvider.chainConfig.chain.id
8170
8630
  );
8171
8631
  const txResult = await SpokeService.callWallet(hubWallet, data, spokeProvider, this.hubProvider, raw);
8172
- return { ok: true, value: txResult };
8632
+ return {
8633
+ ok: true,
8634
+ value: txResult,
8635
+ data: {
8636
+ address: hubWallet,
8637
+ payload: data
8638
+ }
8639
+ };
8173
8640
  }
8174
8641
  /**
8175
8642
  * Withdraw tokens from the money market pool, relay the transaction to the hub and submit the intent to the Solver API
@@ -8177,10 +8644,10 @@ var MoneyMarketService = class _MoneyMarketService {
8177
8644
  * @param params - The parameters for the withdraw transaction.
8178
8645
  * @param spokeProvider - The spoke provider.
8179
8646
  * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
8180
- * @returns {Promise<Result<[Hex, Hex], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
8647
+ * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the spoke and hub transaction hashes or error
8181
8648
  *
8182
8649
  * @example
8183
- * const result = await moneyMarketService.withdrawAndSubmit(
8650
+ * const result = await moneyMarketService.withdraw(
8184
8651
  * {
8185
8652
  * token: '0x...', // Address of the token (spoke chain address) to withdraw
8186
8653
  * amount: 1000n, // Amount to withdraw (in token decimals)
@@ -8199,40 +8666,47 @@ var MoneyMarketService = class _MoneyMarketService {
8199
8666
  * ] = result.value;
8200
8667
  * console.log('Withdraw transaction hashes:', { spokeTxHash, hubTxHash });
8201
8668
  */
8202
- async withdrawAndSubmit(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
8669
+ async withdraw(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
8203
8670
  try {
8204
- const txResult = await this.withdraw(params, spokeProvider);
8671
+ const txResult = await this.createWithdrawIntent(params, spokeProvider);
8205
8672
  if (!txResult.ok) {
8206
- return {
8207
- ok: false,
8208
- error: {
8209
- code: "WITHDRAW_FAILED",
8210
- error: txResult.error
8211
- }
8212
- };
8673
+ return txResult;
8213
8674
  }
8214
8675
  const packetResult = await relayTxAndWaitPacket(
8215
8676
  txResult.value,
8677
+ spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
8216
8678
  spokeProvider,
8217
8679
  this.config.relayerApiEndpoint,
8218
8680
  timeout
8219
8681
  );
8220
8682
  if (!packetResult.ok) {
8221
- return packetResult;
8683
+ return {
8684
+ ok: false,
8685
+ error: {
8686
+ code: packetResult.error.code,
8687
+ data: {
8688
+ error: packetResult.error,
8689
+ payload: txResult.value
8690
+ }
8691
+ }
8692
+ };
8222
8693
  }
8223
8694
  return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
8224
8695
  } catch (error) {
8225
8696
  return {
8226
8697
  ok: false,
8227
8698
  error: {
8228
- code: "UNKNOWN",
8229
- error
8699
+ code: "WITHDRAW_UNKNOWN_ERROR",
8700
+ data: {
8701
+ error,
8702
+ payload: params
8703
+ }
8230
8704
  }
8231
8705
  };
8232
8706
  }
8233
8707
  }
8234
8708
  /**
8235
- * Withdraw tokens from the money market pool without submitting the intent to the Solver API
8709
+ * Create withdraw intent only (without submitting to Solver API)
8236
8710
  * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
8237
8711
  * In order to successfully withdraw tokens, you need to:
8238
8712
  * 1. Execute the withdraw transaction on the spoke chain
@@ -8245,7 +8719,7 @@ var MoneyMarketService = class _MoneyMarketService {
8245
8719
  *
8246
8720
  * @example
8247
8721
  * const moneyMarketService = new MoneyMarketService(config);
8248
- * const result = await moneyMarketService.withdraw(
8722
+ * const result = await moneyMarketService.createWithdrawIntent(
8249
8723
  * {
8250
8724
  * token: "0x123...", // token address
8251
8725
  * amount: 1000000000000000000n // 1 token in wei
@@ -8261,7 +8735,7 @@ var MoneyMarketService = class _MoneyMarketService {
8261
8735
  * console.error('Withdraw failed:', result.error);
8262
8736
  * }
8263
8737
  */
8264
- async withdraw(params, spokeProvider, raw) {
8738
+ async createWithdrawIntent(params, spokeProvider, raw) {
8265
8739
  invariant2__default.default(params.action === "withdraw", "Invalid action");
8266
8740
  invariant2__default.default(params.token.length > 0, "Token is required");
8267
8741
  invariant2__default.default(params.amount > 0n, "Amount must be greater than 0");
@@ -8276,7 +8750,7 @@ var MoneyMarketService = class _MoneyMarketService {
8276
8750
  this.hubProvider,
8277
8751
  spokeProvider
8278
8752
  );
8279
- const data = this.withdrawData(
8753
+ const data = this.buildWithdrawData(
8280
8754
  hubWallet,
8281
8755
  walletAddressBytes,
8282
8756
  params.token,
@@ -8284,7 +8758,14 @@ var MoneyMarketService = class _MoneyMarketService {
8284
8758
  spokeProvider.chainConfig.chain.id
8285
8759
  );
8286
8760
  const txResult = await SpokeService.callWallet(hubWallet, data, spokeProvider, this.hubProvider, raw);
8287
- return { ok: true, value: txResult };
8761
+ return {
8762
+ ok: true,
8763
+ value: txResult,
8764
+ data: {
8765
+ address: hubWallet,
8766
+ payload: data
8767
+ }
8768
+ };
8288
8769
  }
8289
8770
  /**
8290
8771
  * Repay tokens to the money market pool, relay the transaction to the hub and submit the intent to the Solver API
@@ -8292,10 +8773,10 @@ var MoneyMarketService = class _MoneyMarketService {
8292
8773
  * @param params - The parameters for the repay transaction.
8293
8774
  * @param spokeProvider - The spoke provider.
8294
8775
  * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
8295
- * @returns {Promise<Result<[Hex, Hex], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
8776
+ * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the spoke and hub transaction hashes or error
8296
8777
  *
8297
8778
  * @example
8298
- * const result = await moneyMarketService.repayAndSubmit(
8779
+ * const result = await moneyMarketService.repay(
8299
8780
  * {
8300
8781
  * token: '0x...', // Address of the token (spoke chain address) to repay
8301
8782
  * amount: 1000n, // Amount to repay (in token decimals)
@@ -8314,40 +8795,47 @@ var MoneyMarketService = class _MoneyMarketService {
8314
8795
  * ] = result.value;
8315
8796
  * console.log('Repay transaction hashes:', { spokeTxHash, hubTxHash });
8316
8797
  */
8317
- async repayAndSubmit(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
8798
+ async repay(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
8318
8799
  try {
8319
- const txResult = await this.repay(params, spokeProvider);
8800
+ const txResult = await this.createRepayIntent(params, spokeProvider);
8320
8801
  if (!txResult.ok) {
8321
- return {
8322
- ok: false,
8323
- error: {
8324
- code: "REPAY_FAILED",
8325
- error: txResult.error
8326
- }
8327
- };
8802
+ return txResult;
8328
8803
  }
8329
8804
  const packetResult = await relayTxAndWaitPacket(
8330
8805
  txResult.value,
8806
+ spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
8331
8807
  spokeProvider,
8332
8808
  this.config.relayerApiEndpoint,
8333
8809
  timeout
8334
8810
  );
8335
8811
  if (!packetResult.ok) {
8336
- return packetResult;
8812
+ return {
8813
+ ok: false,
8814
+ error: {
8815
+ code: packetResult.error.code,
8816
+ data: {
8817
+ error: packetResult.error,
8818
+ payload: txResult.value
8819
+ }
8820
+ }
8821
+ };
8337
8822
  }
8338
8823
  return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
8339
8824
  } catch (error) {
8340
8825
  return {
8341
8826
  ok: false,
8342
8827
  error: {
8343
- code: "UNKNOWN",
8344
- error
8828
+ code: "REPAY_UNKNOWN_ERROR",
8829
+ data: {
8830
+ error,
8831
+ payload: params
8832
+ }
8345
8833
  }
8346
8834
  };
8347
8835
  }
8348
8836
  }
8349
8837
  /**
8350
- * Repay tokens to the money market pool without submitting the intent to the Solver API
8838
+ * Create repay intent only (without submitting to Solver API)
8351
8839
  * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
8352
8840
  * In order to successfully repay tokens, you need to:
8353
8841
  * 1. Check if the allowance is sufficient
@@ -8362,7 +8850,7 @@ var MoneyMarketService = class _MoneyMarketService {
8362
8850
  *
8363
8851
  * @example
8364
8852
  * const moneyMarketService = new MoneyMarketService(config);
8365
- * const result = await moneyMarketService.repay(
8853
+ * const result = await moneyMarketService.createRepayIntent(
8366
8854
  * {
8367
8855
  * token: "0x123...", // token address
8368
8856
  * amount: 1000000000000000000n // 1 token in wei
@@ -8378,7 +8866,7 @@ var MoneyMarketService = class _MoneyMarketService {
8378
8866
  * console.error('Repay failed:', result.error);
8379
8867
  * }
8380
8868
  */
8381
- async repay(params, spokeProvider, raw) {
8869
+ async createRepayIntent(params, spokeProvider, raw) {
8382
8870
  invariant2__default.default(params.action === "repay", "Invalid action");
8383
8871
  invariant2__default.default(params.token.length > 0, "Token is required");
8384
8872
  invariant2__default.default(params.amount > 0n, "Amount must be greater than 0");
@@ -8393,7 +8881,7 @@ var MoneyMarketService = class _MoneyMarketService {
8393
8881
  this.hubProvider,
8394
8882
  spokeProvider
8395
8883
  );
8396
- const data = this.repayData(params.token, hubWallet, params.amount, spokeProvider.chainConfig.chain.id);
8884
+ const data = this.buildRepayData(params.token, hubWallet, params.amount, spokeProvider.chainConfig.chain.id);
8397
8885
  const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
8398
8886
  const txResult = await SpokeService.deposit(
8399
8887
  {
@@ -8407,7 +8895,14 @@ var MoneyMarketService = class _MoneyMarketService {
8407
8895
  this.hubProvider,
8408
8896
  raw
8409
8897
  );
8410
- return { ok: true, value: txResult };
8898
+ return {
8899
+ ok: true,
8900
+ value: txResult,
8901
+ data: {
8902
+ address: hubWallet,
8903
+ payload: data
8904
+ }
8905
+ };
8411
8906
  }
8412
8907
  /**
8413
8908
  * Build transaction data for supplying to the money market pool
@@ -8417,7 +8912,7 @@ var MoneyMarketService = class _MoneyMarketService {
8417
8912
  * @param spokeChainId - The chain ID of the spoke chain
8418
8913
  * @returns {Hex} The transaction data.
8419
8914
  */
8420
- supplyData(token, to, amount, spokeChainId) {
8915
+ buildSupplyData(token, to, amount, spokeChainId) {
8421
8916
  const calls = [];
8422
8917
  const assetConfig = getHubAssetInfo(spokeChainId, token);
8423
8918
  invariant2__default.default(assetConfig, `hub asset not found for spoke chain token (token): ${token}`);
@@ -8445,7 +8940,7 @@ var MoneyMarketService = class _MoneyMarketService {
8445
8940
  * @param spokeChainId - The chain ID of the spoke chain
8446
8941
  * @returns {Hex} The transaction data.
8447
8942
  */
8448
- borrowData(from, to, token, amount, spokeChainId) {
8943
+ buildBorrowData(from, to, token, amount, spokeChainId) {
8449
8944
  invariant2__default.default(isValidSpokeChainId(spokeChainId), `Invalid spokeChainId: ${spokeChainId}`);
8450
8945
  invariant2__default.default(
8451
8946
  isValidOriginalAssetAddress(spokeChainId, token),
@@ -8520,7 +9015,7 @@ var MoneyMarketService = class _MoneyMarketService {
8520
9015
  * @param spokeChainId - The chain ID of the spoke chain
8521
9016
  * @returns {Hex} The transaction data.
8522
9017
  */
8523
- withdrawData(from, to, token, amount, spokeChainId) {
9018
+ buildWithdrawData(from, to, token, amount, spokeChainId) {
8524
9019
  const calls = [];
8525
9020
  const assetConfig = getHubAssetInfo(spokeChainId, token);
8526
9021
  if (!assetConfig) {
@@ -8571,11 +9066,11 @@ var MoneyMarketService = class _MoneyMarketService {
8571
9066
  * @param spokeChainId - The chain ID of the spoke chain
8572
9067
  * @returns {Hex} The transaction data.
8573
9068
  */
8574
- repayData(token, to, amount, spokeChainId) {
9069
+ buildRepayData(token, to, amount, spokeChainId) {
8575
9070
  const calls = [];
8576
9071
  const assetConfig = getHubAssetInfo(spokeChainId, token);
8577
9072
  if (!assetConfig) {
8578
- throw new Error("[repayData] Hub asset not found");
9073
+ throw new Error("[buildRepayData] Hub asset not found");
8579
9074
  }
8580
9075
  const assetAddress = assetConfig.asset;
8581
9076
  const vaultAddress = assetConfig.vault;
@@ -9195,7 +9690,7 @@ var SolanaSpokeService = class _SolanaSpokeService {
9195
9690
  static async deposit(params, spokeProvider, hubProvider, raw) {
9196
9691
  const userWallet = params.to ?? await EvmWalletAbstraction.getUserHubWalletAddress(
9197
9692
  spokeProvider.chainConfig.chain.id,
9198
- viem.toHex(new web3_js.PublicKey(params.from).toBytes()),
9693
+ encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
9199
9694
  hubProvider
9200
9695
  );
9201
9696
  return _SolanaSpokeService.transfer(
@@ -9203,7 +9698,7 @@ var SolanaSpokeService = class _SolanaSpokeService {
9203
9698
  token: new web3_js.PublicKey(params.token),
9204
9699
  recipient: userWallet,
9205
9700
  amount: params.amount.toString(),
9206
- data: params.data
9701
+ data: viem.keccak256(params.data)
9207
9702
  },
9208
9703
  spokeProvider,
9209
9704
  raw
@@ -9237,7 +9732,7 @@ var SolanaSpokeService = class _SolanaSpokeService {
9237
9732
  */
9238
9733
  static async callWallet(from, payload, spokeProvider, hubProvider, raw) {
9239
9734
  const relayId = getIntentRelayChainId(hubProvider.chainConfig.chain.id);
9240
- return _SolanaSpokeService.call(BigInt(relayId), from, payload, spokeProvider, raw);
9735
+ return _SolanaSpokeService.call(BigInt(relayId), from, viem.keccak256(payload), spokeProvider, raw);
9241
9736
  }
9242
9737
  static async transfer({ token, recipient, amount, data }, spokeProvider, raw) {
9243
9738
  let depositInstruction;
@@ -9790,9 +10285,9 @@ var SonicSpokeService = class _SonicSpokeService {
9790
10285
  }
9791
10286
  return spokeProvider.walletProvider.sendTransaction(rawTx);
9792
10287
  }
9793
- static async withdrawData(from, withdrawInfo, amount, spokeProvider, moneyMarketService) {
10288
+ static async buildWithdrawData(from, withdrawInfo, amount, spokeProvider, moneyMarketService) {
9794
10289
  const userRouter = await _SonicSpokeService.getUserRouter(from, spokeProvider);
9795
- const withdrawCall = moneyMarketService.withdrawData(
10290
+ const withdrawCall = moneyMarketService.buildWithdrawData(
9796
10291
  userRouter,
9797
10292
  from,
9798
10293
  withdrawInfo.token,
@@ -9893,6 +10388,51 @@ function isConfiguredSolverConfig(value) {
9893
10388
  function isConfiguredMoneyMarketConfig(value) {
9894
10389
  return typeof value === "object" && value !== null && "lendingPool" in value && "uiPoolDataProvider" in value && "poolAddressesProvider" in value && "bnUSD" in value && "bnUSDVault" in value;
9895
10390
  }
10391
+ function isIntentCreationFailedError(error) {
10392
+ 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;
10393
+ }
10394
+ function isIntentSubmitTxFailedError(error) {
10395
+ 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;
10396
+ }
10397
+ function isIntentPostExecutionFailedError(error) {
10398
+ 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;
10399
+ }
10400
+ function isWaitUntilIntentExecutedFailed(error) {
10401
+ 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;
10402
+ }
10403
+ function isIntentCreationUnknownError(error) {
10404
+ 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;
10405
+ }
10406
+ function isMoneyMarketSubmitTxFailedError(error) {
10407
+ return typeof error === "object" && error !== null && "code" in error && error.code === "SUBMIT_TX_FAILED";
10408
+ }
10409
+ function isMoneyMarketRelayTimeoutError(error) {
10410
+ return typeof error === "object" && error !== null && "code" in error && error.code === "RELAY_TIMEOUT";
10411
+ }
10412
+ function isMoneyMarketCreateSupplyIntentFailedError(error) {
10413
+ return typeof error === "object" && error !== null && "code" in error && error.code === "CREATE_SUPPLY_INTENT_FAILED";
10414
+ }
10415
+ function isMoneyMarketCreateBorrowIntentFailedError(error) {
10416
+ return typeof error === "object" && error !== null && "code" in error && error.code === "CREATE_BORROW_INTENT_FAILED";
10417
+ }
10418
+ function isMoneyMarketCreateWithdrawIntentFailedError(error) {
10419
+ return typeof error === "object" && error !== null && "code" in error && error.code === "CREATE_WITHDRAW_INTENT_FAILED";
10420
+ }
10421
+ function isMoneyMarketCreateRepayIntentFailedError(error) {
10422
+ return typeof error === "object" && error !== null && "code" in error && error.code === "CREATE_REPAY_INTENT_FAILED";
10423
+ }
10424
+ function isMoneyMarketSupplyUnknownError(error) {
10425
+ return typeof error === "object" && error !== null && "code" in error && error.code === "SUPPLY_UNKNOWN_ERROR";
10426
+ }
10427
+ function isMoneyMarketBorrowUnknownError(error) {
10428
+ return typeof error === "object" && error !== null && "code" in error && error.code === "BORROW_UNKNOWN_ERROR";
10429
+ }
10430
+ function isMoneyMarketWithdrawUnknownError(error) {
10431
+ return typeof error === "object" && error !== null && "code" in error && error.code === "WITHDRAW_UNKNOWN_ERROR";
10432
+ }
10433
+ function isMoneyMarketRepayUnknownError(error) {
10434
+ return typeof error === "object" && error !== null && "code" in error && error.code === "REPAY_UNKNOWN_ERROR";
10435
+ }
9896
10436
 
9897
10437
  // src/services/spoke/SpokeService.ts
9898
10438
  var SpokeService = class {
@@ -10089,12 +10629,12 @@ async function waitUntilIntentExecuted(payload) {
10089
10629
  } catch (e) {
10090
10630
  console.error("Error getting transaction packets", e);
10091
10631
  }
10092
- await new Promise((resolve) => setTimeout(resolve, 1e3));
10632
+ await new Promise((resolve) => setTimeout(resolve, 2e3));
10093
10633
  }
10094
10634
  return {
10095
10635
  ok: false,
10096
10636
  error: {
10097
- code: "TIMEOUT",
10637
+ code: "RELAY_TIMEOUT",
10098
10638
  data: {
10099
10639
  payload,
10100
10640
  error: {
@@ -10108,7 +10648,7 @@ async function waitUntilIntentExecuted(payload) {
10108
10648
  return {
10109
10649
  ok: false,
10110
10650
  error: {
10111
- code: "TIMEOUT",
10651
+ code: "RELAY_TIMEOUT",
10112
10652
  data: {
10113
10653
  payload,
10114
10654
  error: e
@@ -10117,12 +10657,16 @@ async function waitUntilIntentExecuted(payload) {
10117
10657
  };
10118
10658
  }
10119
10659
  }
10120
- async function relayTxAndWaitPacket(spokeTxHash, spokeProvider, relayerApiEndpoint, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
10660
+ async function relayTxAndWaitPacket(spokeTxHash, data, spokeProvider, relayerApiEndpoint, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
10121
10661
  try {
10122
10662
  const intentRelayChainId = getIntentRelayChainId(spokeProvider.chainConfig.chain.id).toString();
10123
10663
  const submitPayload = {
10124
10664
  action: "submit",
10125
- params: {
10665
+ params: data ? {
10666
+ chain_id: intentRelayChainId,
10667
+ tx_hash: spokeTxHash,
10668
+ data
10669
+ } : {
10126
10670
  chain_id: intentRelayChainId,
10127
10671
  tx_hash: spokeTxHash
10128
10672
  }
@@ -10147,7 +10691,7 @@ async function relayTxAndWaitPacket(spokeTxHash, spokeProvider, relayerApiEndpoi
10147
10691
  return {
10148
10692
  ok: false,
10149
10693
  error: {
10150
- code: "TIMEOUT",
10694
+ code: "RELAY_TIMEOUT",
10151
10695
  error: packet.error
10152
10696
  }
10153
10697
  };
@@ -10160,7 +10704,7 @@ async function relayTxAndWaitPacket(spokeTxHash, spokeProvider, relayerApiEndpoi
10160
10704
  return {
10161
10705
  ok: false,
10162
10706
  error: {
10163
- code: "UNKNOWN",
10707
+ code: "SUBMIT_TX_FAILED",
10164
10708
  error
10165
10709
  }
10166
10710
  };
@@ -10198,6 +10742,8 @@ var EvmSolverService = class _EvmSolverService {
10198
10742
  outputToken,
10199
10743
  srcChain: getIntentRelayChainId(createIntentParams.srcChain),
10200
10744
  dstChain: getIntentRelayChainId(createIntentParams.dstChain),
10745
+ srcAddress: encodeAddress(createIntentParams.srcChain, createIntentParams.srcAddress),
10746
+ dstAddress: encodeAddress(createIntentParams.dstChain, createIntentParams.dstAddress),
10201
10747
  intentId: randomUint256(),
10202
10748
  creator: creatorHubWalletAddress,
10203
10749
  data: feeData
@@ -10425,7 +10971,7 @@ var SolverApiService = class {
10425
10971
  * }
10426
10972
  * }
10427
10973
  */
10428
- static async postExecution(intentExecutionRequest, config) {
10974
+ static async postExecution(request, config) {
10429
10975
  try {
10430
10976
  const response = await retry(
10431
10977
  () => fetch(`${config.solverApiEndpoint}/execute`, {
@@ -10433,7 +10979,7 @@ var SolverApiService = class {
10433
10979
  headers: {
10434
10980
  "Content-Type": "application/json"
10435
10981
  },
10436
- body: JSON.stringify(intentExecutionRequest)
10982
+ body: JSON.stringify(request)
10437
10983
  })
10438
10984
  );
10439
10985
  if (!response.ok) {
@@ -10459,15 +11005,15 @@ var SolverApiService = class {
10459
11005
  };
10460
11006
  }
10461
11007
  }
10462
- static async getStatus(intentStatusRequest, config) {
10463
- invariant2__default.default(intentStatusRequest.intent_tx_hash.length > 0, "Empty intent_tx_hash");
11008
+ static async getStatus(request, config) {
11009
+ invariant2__default.default(request.intent_tx_hash.length > 0, "Empty intent_tx_hash");
10464
11010
  try {
10465
11011
  const response = await fetch(`${config.solverApiEndpoint}/status`, {
10466
11012
  method: "POST",
10467
11013
  headers: {
10468
11014
  "Content-Type": "application/json"
10469
11015
  },
10470
- body: JSON.stringify(intentStatusRequest)
11016
+ body: JSON.stringify(request)
10471
11017
  });
10472
11018
  if (!response.ok) {
10473
11019
  return {
@@ -10526,8 +11072,8 @@ var SolverService = class {
10526
11072
  }
10527
11073
  /**
10528
11074
  * Request a quote from the solver API
10529
- * @param {IntentQuoteRequest} payload - The intent quote request
10530
- * @returns {Promise<Result<IntentQuoteResponse, IntentErrorResponse>>} The intent quote response
11075
+ * @param {SolverIntentQuoteRequest} payload - The solver intent quote request
11076
+ * @returns {Promise<Result<SolverIntentQuoteResponse, SolverErrorResponse>>} The intent quote response
10531
11077
  *
10532
11078
  * @example
10533
11079
  * const payload = {
@@ -10537,7 +11083,7 @@ var SolverService = class {
10537
11083
  * "token_dst_blockchain_id":"0xa4b1.arbitrum",
10538
11084
  * "amount":1000000000000000n,
10539
11085
  * "quote_type": "exact_input"
10540
- * } satisfies IntentQuoteRequest
11086
+ * } satisfies SolverIntentQuoteRequest
10541
11087
  *
10542
11088
  * const response = await solverService.getQuote(payload);
10543
11089
  *
@@ -10569,15 +11115,15 @@ var SolverService = class {
10569
11115
  /**
10570
11116
  * Get the status of an intent from Solver API
10571
11117
  * NOTE: intentHash should be retrieved from relay packet dst_tx_hash property (see createAndSubmitIntent)
10572
- * @param {IntentStatusRequest} intentStatusRequest - The intent status request
10573
- * @returns {Promise<Result<IntentStatusResponse, IntentErrorResponse>>} The intent status response
11118
+ * @param {SolverIntentStatusRequest} request - The intent status request
11119
+ * @returns {Promise<Result<SolverIntentStatusResponse, SolverErrorResponse>>} The solver intent status response
10574
11120
  *
10575
11121
  * @example
10576
- * const intentStatusRequest = {
10577
- * "intentHash": "a0dd7652-b360-4123-ab2d-78cfbcd20c6b" // destination tx hash from relay packet
10578
- * } satisfies IntentStatusRequest
11122
+ * const request = {
11123
+ * "intent_tx_hash": "a0dd7652-b360-4123-ab2d-78cfbcd20c6b" // destination tx hash from relay packet
11124
+ * } satisfies SolverIntentStatusRequest
10579
11125
  *
10580
- * const response = await solverService.getStatus(intentStatusRequest);
11126
+ * const response = await solverService.getStatus(request);
10581
11127
  *
10582
11128
  * if (response.ok) {
10583
11129
  * const { status, intent_hash } = response.value;
@@ -10587,20 +11133,20 @@ var SolverService = class {
10587
11133
  * // handle error
10588
11134
  * }
10589
11135
  */
10590
- async getStatus(intentStatusRequest) {
10591
- return SolverApiService.getStatus(intentStatusRequest, this.config);
11136
+ async getStatus(request) {
11137
+ return SolverApiService.getStatus(request, this.config);
10592
11138
  }
10593
11139
  /**
10594
11140
  * Post execution of intent order transaction executed on hub chain to Solver API
10595
- * @param {IntentExecutionRequest} intentExecutionRequest - The intent execution request
10596
- * @returns {Promise<Result<IntentExecutionResponse, IntentErrorResponse>>} The intent execution response
11141
+ * @param {SolverExecutionRequest} request - The intent execution request
11142
+ * @returns {Promise<Result<SolverExecutionResponse, SolverErrorResponse>>} The intent execution response
10597
11143
  *
10598
11144
  * @example
10599
- * const intentExecutionRequest = {
11145
+ * const request = {
10600
11146
  * "intent_tx_hash": "0xba3dce19347264db32ced212ff1a2036f20d9d2c7493d06af15027970be061af",
10601
- * } satisfies IntentExecutionRequest
11147
+ * } satisfies SolverExecutionRequest
10602
11148
  *
10603
- * const response = await solverService.postExecution(intentExecutionRequest);
11149
+ * const response = await solverService.postExecution(request);
10604
11150
  *
10605
11151
  * if (response.ok) {
10606
11152
  * const { answer, intent_hash } = response.value;
@@ -10610,15 +11156,108 @@ var SolverService = class {
10610
11156
  * // handle error
10611
11157
  * }
10612
11158
  */
10613
- async postExecution(intentExecutionRequest) {
10614
- return SolverApiService.postExecution(intentExecutionRequest, this.config);
11159
+ async postExecution(request) {
11160
+ return SolverApiService.postExecution(request, this.config);
11161
+ }
11162
+ /**
11163
+ * Submit intent transaction to the relayer API
11164
+ * @param {IntentRelayRequest<'submit'>} submitPayload - The intent relay request
11165
+ * @returns {Promise<Result<GetRelayResponse<'submit'>, IntentError<'SUBMIT_TX_FAILED'>>>} The intent relay response
11166
+ *
11167
+ * @example
11168
+ * const submitPayload = {
11169
+ * "action": "submit",
11170
+ * "params": {
11171
+ * "chain_id": "0x38.bsc",
11172
+ * "tx_hash": "0xba3dce19347264db32ced212ff1a2036f20d9d2c7493d06af15027970be061af",
11173
+ * },
11174
+ * } satisfies IntentRelayRequest<'submit'>;
11175
+ *
11176
+ * const submitResult = await solverService.submitIntent(submitPayload);
11177
+ *
11178
+ * if (submitResult.ok) {
11179
+ * const { success, message } = submitResult.value;
11180
+ * console.log('Success:', success);
11181
+ * console.log('Message:', message);
11182
+ * } else {
11183
+ * // handle error
11184
+ * }
11185
+ */
11186
+ async submitIntent(submitPayload) {
11187
+ try {
11188
+ const submitResult = await submitTransaction(submitPayload, this.config.relayerApiEndpoint);
11189
+ if (!submitResult.success) {
11190
+ return {
11191
+ ok: false,
11192
+ error: {
11193
+ code: "SUBMIT_TX_FAILED",
11194
+ data: {
11195
+ payload: submitPayload,
11196
+ error: new Error(submitResult.message)
11197
+ }
11198
+ }
11199
+ };
11200
+ }
11201
+ return {
11202
+ ok: true,
11203
+ value: submitResult
11204
+ };
11205
+ } catch (error) {
11206
+ return {
11207
+ ok: false,
11208
+ error: {
11209
+ code: "SUBMIT_TX_FAILED",
11210
+ data: {
11211
+ payload: submitPayload,
11212
+ error
11213
+ }
11214
+ }
11215
+ };
11216
+ }
11217
+ }
11218
+ /**
11219
+ * Swap is a syntatic sugar for createAndSubmitIntent that creates an intent and submits it to the Solver API and Relayer API
11220
+ * @param {CreateIntentParams} payload - The intent to create
11221
+ * @param {ISpokeProvider} spokeProvider - The spoke provider
11222
+ * @param {number} timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
11223
+ * @returns {Promise<Result<[SolverExecutionResponse, Intent, PacketData], IntentError<IntentErrorCode>>>} The solver execution response, intent, and packet data
11224
+ *
11225
+ * @example
11226
+ * const payload = {
11227
+ * "inputToken": "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", // BSC ETH token address
11228
+ * "outputToken": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", // ARB WBTC token address
11229
+ * "inputAmount": 1000000000000000n, // The amount of input tokens
11230
+ * "minOutputAmount": 900000000000000n, // min amount you are expecting to receive
11231
+ * "deadline": 0n, // Optional timestamp after which intent expires (0 = no deadline)
11232
+ * "allowPartialFill": false, // Whether the intent can be partially filled
11233
+ * "srcChain": "0x38.bsc", // Chain ID where input tokens originate
11234
+ * "dstChain": "0xa4b1.arbitrum", // Chain ID where output tokens should be delivered
11235
+ * "srcAddress": "0x..", // Source address (original address on spoke chain)
11236
+ * "dstAddress": "0x...", // Destination address (original address on spoke chain)
11237
+ * "solver": "0x..", // Optional specific solver address (address(0) = any solver)
11238
+ * "data": "0x..", // Additional arbitrary data
11239
+ * } satisfies CreateIntentParams;
11240
+ *
11241
+ * const swapResult = await solverService.swap(payload, spokeProvider);
11242
+ *
11243
+ * if (swapResult.ok) {
11244
+ * const [solverExecutionResponse, intent, packetData] = swapResult.value;
11245
+ * console.log('Intent execution response:', solverExecutionResponse);
11246
+ * console.log('Intent:', intent);
11247
+ * console.log('Packet data:', packetData);
11248
+ * } else {
11249
+ * // handle error
11250
+ * }
11251
+ */
11252
+ async swap(payload, spokeProvider, fee, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
11253
+ return this.createAndSubmitIntent(payload, spokeProvider, fee, timeout);
10615
11254
  }
10616
11255
  /**
10617
11256
  * Creates an intent and submits it to the Solver API and Relayer API
10618
11257
  * @param {CreateIntentParams} payload - The intent to create
10619
11258
  * @param {ISpokeProvider} spokeProvider - The spoke provider
10620
11259
  * @param {number} timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
10621
- * @returns {Promise<Result<[IntentExecutionResponse, Intent, PacketData], IntentSubmitError<IntentSubmitErrorCode>>>} The intent execution response, intent, and packet data
11260
+ * @returns {Promise<Result<[SolverExecutionResponse, Intent, PacketData], IntentError<IntentErrorCode>>>} The solver execution response, intent, and packet data
10622
11261
  *
10623
11262
  * @example
10624
11263
  * const payload = {
@@ -10630,8 +11269,8 @@ var SolverService = class {
10630
11269
  * "allowPartialFill": false, // Whether the intent can be partially filled
10631
11270
  * "srcChain": "0x38.bsc", // Chain ID where input tokens originate
10632
11271
  * "dstChain": "0xa4b1.arbitrum", // Chain ID where output tokens should be delivered
10633
- * "srcAddress": "0x..", // Source address in bytes (original address on spoke chain)
10634
- * "dstAddress": "0x...", // Destination address in bytes (original address on spoke chain)
11272
+ * "srcAddress": "0x..", // Source address (original address on spoke chain)
11273
+ * "dstAddress": "0x...", // Destination address (original address on spoke chain)
10635
11274
  * "solver": "0x..", // Optional specific solver address (address(0) = any solver)
10636
11275
  * "data": "0x..", // Additional arbitrary data
10637
11276
  * } satisfies CreateIntentParams;
@@ -10639,8 +11278,8 @@ var SolverService = class {
10639
11278
  * const createAndSubmitIntentResult = await solverService.createAndSubmitIntent(payload, spokeProvider);
10640
11279
  *
10641
11280
  * if (createAndSubmitIntentResult.ok) {
10642
- * const [intentExecutionResponse, intent, packetData] = createAndSubmitIntentResult.value;
10643
- * console.log('Intent execution response:', intentExecutionResponse);
11281
+ * const [solverExecutionResponse, intent, packetData] = createAndSubmitIntentResult.value;
11282
+ * console.log('Intent execution response:', solverExecutionResponse);
10644
11283
  * console.log('Intent:', intent);
10645
11284
  * console.log('Packet data:', packetData);
10646
11285
  * } else {
@@ -10651,32 +11290,30 @@ var SolverService = class {
10651
11290
  try {
10652
11291
  const createIntentResult = await this.createIntent(payload, spokeProvider, fee, false);
10653
11292
  if (!createIntentResult.ok) {
10654
- return {
10655
- ok: false,
10656
- error: createIntentResult.error
10657
- };
11293
+ return createIntentResult;
10658
11294
  }
10659
- const [spokeTxHash, intent] = createIntentResult.value;
11295
+ const [spokeTxHash, intent, data] = createIntentResult.value;
10660
11296
  const intentRelayChainId = getIntentRelayChainId(payload.srcChain).toString();
10661
- const submitPayload = {
11297
+ const submitPayload = payload.srcChain === types.SOLANA_MAINNET_CHAIN_ID && data ? {
11298
+ action: "submit",
11299
+ params: {
11300
+ chain_id: intentRelayChainId,
11301
+ tx_hash: spokeTxHash,
11302
+ data: {
11303
+ address: intent.creator,
11304
+ payload: data
11305
+ }
11306
+ }
11307
+ } : {
10662
11308
  action: "submit",
10663
11309
  params: {
10664
11310
  chain_id: intentRelayChainId,
10665
11311
  tx_hash: spokeTxHash
10666
11312
  }
10667
11313
  };
10668
- const submitResult = await submitTransaction(submitPayload, this.config.relayerApiEndpoint);
10669
- if (!submitResult.success) {
10670
- return {
10671
- ok: false,
10672
- error: {
10673
- code: "SUBMIT_TX_FAILED",
10674
- data: {
10675
- payload: submitPayload,
10676
- apiUrl: this.config.relayerApiEndpoint
10677
- }
10678
- }
10679
- };
11314
+ const submitResult = await this.submitIntent(submitPayload);
11315
+ if (!submitResult.ok) {
11316
+ return submitResult;
10680
11317
  }
10681
11318
  const packet = await waitUntilIntentExecuted({
10682
11319
  intentRelayChainId,
@@ -10735,8 +11372,8 @@ var SolverService = class {
10735
11372
  * "allowPartialFill": false, // Whether the intent can be partially filled
10736
11373
  * "srcChain": "0x38.bsc", // Chain ID where input tokens originate
10737
11374
  * "dstChain": "0xa4b1.arbitrum", // Chain ID where output tokens should be delivered
10738
- * "srcAddress": "0x..", // Source address in bytes (original address on spoke chain)
10739
- * "dstAddress": "0x...", // Destination address in bytes (original address on spoke chain)
11375
+ * "srcAddress": "0x..", // Source address (original address on spoke chain)
11376
+ * "dstAddress": "0x...", // Destination address (original address on spoke chain)
10740
11377
  * "solver": "0x..", // Optional specific solver address (address(0) = any solver)
10741
11378
  * "data": "0x..", // Additional arbitrary data
10742
11379
  * } satisfies CreateIntentParams;
@@ -10827,11 +11464,11 @@ var SolverService = class {
10827
11464
  /**
10828
11465
  * Creates an intent by handling token approval and intent creation
10829
11466
  * NOTE: This method does not submit the intent to the Solver API
10830
- * @param {CreateIntentParams} params - The intent to create
11467
+ * @param {Omit<CreateIntentParams, 'srcAddress'>} params - The intent to create
10831
11468
  * @param {SpokeProvider} spokeProvider - The spoke provider
10832
11469
  * @param {boolean} raw - Whether to return the raw transaction
10833
11470
  * @param {PartnerFee} fee - The fee to apply to the intent
10834
- * @returns {Promise<Result<[TxReturnType<S, R>, Intent & FeeAmount], IntentSubmitError<'CREATION_FAILED'>>>} The encoded contract call
11471
+ * @returns {Promise<Result<[TxReturnType<S, R>, Intent & FeeAmount], IntentError<'CREATION_FAILED'>>>} The encoded contract call
10835
11472
  *
10836
11473
  * @example
10837
11474
  * const payload = {
@@ -10843,8 +11480,8 @@ var SolverService = class {
10843
11480
  * "allowPartialFill": false, // Whether the intent can be partially filled
10844
11481
  * "srcChain": "0x38.bsc", // Chain ID where input tokens originate
10845
11482
  * "dstChain": "0xa4b1.arbitrum", // Chain ID where output tokens should be delivered
10846
- * "srcAddress": "0x..", // Source address in bytes (original address on spoke chain)
10847
- * "dstAddress": "0x...", // Destination address in bytes (original address on spoke chain)
11483
+ * "srcAddress": "0x..", // Source address (original address on spoke chain)
11484
+ * "dstAddress": "0x...", // Destination address (original address on spoke chain)
10848
11485
  * "solver": "0x..", // Optional specific solver address (address(0) = any solver)
10849
11486
  * "data": "0x..", // Additional arbitrary data
10850
11487
  * } satisfies CreateIntentParams;
@@ -10868,7 +11505,12 @@ var SolverService = class {
10868
11505
  invariant2__default.default(isValidSpokeChainId(params.srcChain), `Invalid spoke chain (params.srcChain): ${params.srcChain}`);
10869
11506
  invariant2__default.default(isValidSpokeChainId(params.dstChain), `Invalid spoke chain (params.dstChain): ${params.dstChain}`);
10870
11507
  try {
10871
- const walletAddressBytes = await spokeProvider.walletProvider.getWalletAddressBytes();
11508
+ const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
11509
+ invariant2__default.default(
11510
+ params.srcAddress.toLowerCase() === walletAddress.toLowerCase(),
11511
+ "srcAddress must be the same as wallet address"
11512
+ );
11513
+ const walletAddressBytes = encodeAddress(params.srcChain, walletAddress);
10872
11514
  const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddressBytes : await WalletAbstractionService.getUserHubWalletAddress(
10873
11515
  params.srcChain,
10874
11516
  walletAddressBytes,
@@ -10876,12 +11518,14 @@ var SolverService = class {
10876
11518
  spokeProvider
10877
11519
  );
10878
11520
  const [data, intent, feeAmount] = EvmSolverService.constructCreateIntentData(
10879
- params,
11521
+ {
11522
+ ...params,
11523
+ srcAddress: walletAddress
11524
+ },
10880
11525
  creatorHubWalletAddress,
10881
11526
  this.config,
10882
11527
  fee
10883
11528
  );
10884
- const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
10885
11529
  const txResult = await SpokeService.deposit(
10886
11530
  {
10887
11531
  from: walletAddress,
@@ -10896,7 +11540,7 @@ var SolverService = class {
10896
11540
  );
10897
11541
  return {
10898
11542
  ok: true,
10899
- value: [txResult, { ...intent, feeAmount }]
11543
+ value: [txResult, { ...intent, feeAmount }, data]
10900
11544
  };
10901
11545
  } catch (error) {
10902
11546
  return {
@@ -10919,20 +11563,37 @@ var SolverService = class {
10919
11563
  * @returns {Promise<TxReturnType<T, R>>} The encoded contract call
10920
11564
  */
10921
11565
  async cancelIntent(intent, spokeProvider, raw) {
10922
- invariant2__default.default(isValidIntentRelayChainId(intent.srcChain), `Invalid intent.srcChain: ${intent.srcChain}`);
10923
- invariant2__default.default(isValidIntentRelayChainId(intent.dstChain), `Invalid intent.dstChain: ${intent.dstChain}`);
10924
- const walletAddressBytes = await spokeProvider.walletProvider.getWalletAddressBytes();
10925
- const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddressBytes : await WalletAbstractionService.getUserHubWalletAddress(
10926
- spokeProvider.chainConfig.chain.id,
10927
- walletAddressBytes,
10928
- this.hubProvider,
10929
- spokeProvider
10930
- );
10931
- const calls = [];
10932
- const intentsContract = this.config.intentsContract;
10933
- calls.push(EvmSolverService.encodeCancelIntent(intent, intentsContract));
10934
- const data = encodeContractCalls(calls);
10935
- return SpokeService.callWallet(creatorHubWalletAddress, data, spokeProvider, this.hubProvider, raw);
11566
+ try {
11567
+ invariant2__default.default(isValidIntentRelayChainId(intent.srcChain), `Invalid intent.srcChain: ${intent.srcChain}`);
11568
+ invariant2__default.default(isValidIntentRelayChainId(intent.dstChain), `Invalid intent.dstChain: ${intent.dstChain}`);
11569
+ const walletAddressBytes = await spokeProvider.walletProvider.getWalletAddressBytes();
11570
+ const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddressBytes : await WalletAbstractionService.getUserHubWalletAddress(
11571
+ spokeProvider.chainConfig.chain.id,
11572
+ walletAddressBytes,
11573
+ this.hubProvider,
11574
+ spokeProvider
11575
+ );
11576
+ const calls = [];
11577
+ const intentsContract = this.config.intentsContract;
11578
+ calls.push(EvmSolverService.encodeCancelIntent(intent, intentsContract));
11579
+ const data = encodeContractCalls(calls);
11580
+ const txResult = await SpokeService.callWallet(
11581
+ creatorHubWalletAddress,
11582
+ data,
11583
+ spokeProvider,
11584
+ this.hubProvider,
11585
+ raw
11586
+ );
11587
+ return {
11588
+ ok: true,
11589
+ value: txResult
11590
+ };
11591
+ } catch (error) {
11592
+ return {
11593
+ ok: false,
11594
+ error
11595
+ };
11596
+ }
10936
11597
  }
10937
11598
  /**
10938
11599
  * Gets an intent from a transaction hash (on Hub chain)
@@ -11671,6 +12332,7 @@ var MigrationService = class {
11671
12332
  }
11672
12333
  const packetResult = await relayTxAndWaitPacket(
11673
12334
  txResult.value,
12335
+ void 0,
11674
12336
  spokeProvider,
11675
12337
  this.config.relayerApiEndpoint,
11676
12338
  timeout
@@ -11732,6 +12394,7 @@ var MigrationService = class {
11732
12394
  }
11733
12395
  const packetResult = await relayTxAndWaitPacket(
11734
12396
  txResult.value,
12397
+ void 0,
11735
12398
  spokeProvider,
11736
12399
  this.config.relayerApiEndpoint,
11737
12400
  timeout
@@ -11907,35 +12570,35 @@ var Sodax = class {
11907
12570
  };
11908
12571
 
11909
12572
  // src/types.ts
11910
- var IntentStatusCode = /* @__PURE__ */ ((IntentStatusCode2) => {
11911
- IntentStatusCode2[IntentStatusCode2["NOT_FOUND"] = -1] = "NOT_FOUND";
11912
- IntentStatusCode2[IntentStatusCode2["NOT_STARTED_YET"] = 1] = "NOT_STARTED_YET";
11913
- IntentStatusCode2[IntentStatusCode2["STARTED_NOT_FINISHED"] = 2] = "STARTED_NOT_FINISHED";
11914
- IntentStatusCode2[IntentStatusCode2["SOLVED"] = 3] = "SOLVED";
11915
- IntentStatusCode2[IntentStatusCode2["FAILED"] = 4] = "FAILED";
11916
- return IntentStatusCode2;
11917
- })(IntentStatusCode || {});
11918
- var IntentErrorCode = /* @__PURE__ */ ((IntentErrorCode2) => {
11919
- IntentErrorCode2[IntentErrorCode2["NO_PATH_FOUND"] = -4] = "NO_PATH_FOUND";
11920
- IntentErrorCode2[IntentErrorCode2["NO_PRIVATE_LIQUIDITY"] = -5] = "NO_PRIVATE_LIQUIDITY";
11921
- IntentErrorCode2[IntentErrorCode2["NOT_ENOUGH_PRIVATE_LIQUIDITY"] = -8] = "NOT_ENOUGH_PRIVATE_LIQUIDITY";
11922
- IntentErrorCode2[IntentErrorCode2["NO_EXECUTION_MODULE_FOUND"] = -7] = "NO_EXECUTION_MODULE_FOUND";
11923
- IntentErrorCode2[IntentErrorCode2["QUOTE_NOT_FOUND"] = -8] = "QUOTE_NOT_FOUND";
11924
- IntentErrorCode2[IntentErrorCode2["QUOTE_NOT_MATCH"] = -9] = "QUOTE_NOT_MATCH";
11925
- IntentErrorCode2[IntentErrorCode2["INTENT_DATA_NOT_MATCH_QUOTE"] = -10] = "INTENT_DATA_NOT_MATCH_QUOTE";
11926
- IntentErrorCode2[IntentErrorCode2["NO_GAS_HANDLER_FOR_BLOCKCHAIN"] = -11] = "NO_GAS_HANDLER_FOR_BLOCKCHAIN";
11927
- IntentErrorCode2[IntentErrorCode2["INTENT_NOT_FOUND"] = -12] = "INTENT_NOT_FOUND";
11928
- IntentErrorCode2[IntentErrorCode2["QUOTE_EXPIRED"] = -13] = "QUOTE_EXPIRED";
11929
- IntentErrorCode2[IntentErrorCode2["MAX_INPUT_AMOUNT"] = -14] = "MAX_INPUT_AMOUNT";
11930
- IntentErrorCode2[IntentErrorCode2["MAX_DIFF_OUTPUT"] = -15] = "MAX_DIFF_OUTPUT";
11931
- IntentErrorCode2[IntentErrorCode2["STOPPED"] = -16] = "STOPPED";
11932
- IntentErrorCode2[IntentErrorCode2["NO_ORACLE_MODULE_FOUND"] = -17] = "NO_ORACLE_MODULE_FOUND";
11933
- IntentErrorCode2[IntentErrorCode2["NEGATIVE_INPUT_AMOUNT"] = -18] = "NEGATIVE_INPUT_AMOUNT";
11934
- IntentErrorCode2[IntentErrorCode2["INTENT_ALREADY_IN_ORDERBOOK"] = -19] = "INTENT_ALREADY_IN_ORDERBOOK";
11935
- IntentErrorCode2[IntentErrorCode2["CREATE_INTENT_ORDER_FAILED"] = -998] = "CREATE_INTENT_ORDER_FAILED";
11936
- IntentErrorCode2[IntentErrorCode2["UNKNOWN"] = -999] = "UNKNOWN";
11937
- return IntentErrorCode2;
11938
- })(IntentErrorCode || {});
12573
+ var SolverIntentStatusCode = /* @__PURE__ */ ((SolverIntentStatusCode2) => {
12574
+ SolverIntentStatusCode2[SolverIntentStatusCode2["NOT_FOUND"] = -1] = "NOT_FOUND";
12575
+ SolverIntentStatusCode2[SolverIntentStatusCode2["NOT_STARTED_YET"] = 1] = "NOT_STARTED_YET";
12576
+ SolverIntentStatusCode2[SolverIntentStatusCode2["STARTED_NOT_FINISHED"] = 2] = "STARTED_NOT_FINISHED";
12577
+ SolverIntentStatusCode2[SolverIntentStatusCode2["SOLVED"] = 3] = "SOLVED";
12578
+ SolverIntentStatusCode2[SolverIntentStatusCode2["FAILED"] = 4] = "FAILED";
12579
+ return SolverIntentStatusCode2;
12580
+ })(SolverIntentStatusCode || {});
12581
+ var SolverIntentErrorCode = /* @__PURE__ */ ((SolverIntentErrorCode2) => {
12582
+ SolverIntentErrorCode2[SolverIntentErrorCode2["NO_PATH_FOUND"] = -4] = "NO_PATH_FOUND";
12583
+ SolverIntentErrorCode2[SolverIntentErrorCode2["NO_PRIVATE_LIQUIDITY"] = -5] = "NO_PRIVATE_LIQUIDITY";
12584
+ SolverIntentErrorCode2[SolverIntentErrorCode2["NOT_ENOUGH_PRIVATE_LIQUIDITY"] = -8] = "NOT_ENOUGH_PRIVATE_LIQUIDITY";
12585
+ SolverIntentErrorCode2[SolverIntentErrorCode2["NO_EXECUTION_MODULE_FOUND"] = -7] = "NO_EXECUTION_MODULE_FOUND";
12586
+ SolverIntentErrorCode2[SolverIntentErrorCode2["QUOTE_NOT_FOUND"] = -8] = "QUOTE_NOT_FOUND";
12587
+ SolverIntentErrorCode2[SolverIntentErrorCode2["QUOTE_NOT_MATCH"] = -9] = "QUOTE_NOT_MATCH";
12588
+ SolverIntentErrorCode2[SolverIntentErrorCode2["INTENT_DATA_NOT_MATCH_QUOTE"] = -10] = "INTENT_DATA_NOT_MATCH_QUOTE";
12589
+ SolverIntentErrorCode2[SolverIntentErrorCode2["NO_GAS_HANDLER_FOR_BLOCKCHAIN"] = -11] = "NO_GAS_HANDLER_FOR_BLOCKCHAIN";
12590
+ SolverIntentErrorCode2[SolverIntentErrorCode2["INTENT_NOT_FOUND"] = -12] = "INTENT_NOT_FOUND";
12591
+ SolverIntentErrorCode2[SolverIntentErrorCode2["QUOTE_EXPIRED"] = -13] = "QUOTE_EXPIRED";
12592
+ SolverIntentErrorCode2[SolverIntentErrorCode2["MAX_INPUT_AMOUNT"] = -14] = "MAX_INPUT_AMOUNT";
12593
+ SolverIntentErrorCode2[SolverIntentErrorCode2["MAX_DIFF_OUTPUT"] = -15] = "MAX_DIFF_OUTPUT";
12594
+ SolverIntentErrorCode2[SolverIntentErrorCode2["STOPPED"] = -16] = "STOPPED";
12595
+ SolverIntentErrorCode2[SolverIntentErrorCode2["NO_ORACLE_MODULE_FOUND"] = -17] = "NO_ORACLE_MODULE_FOUND";
12596
+ SolverIntentErrorCode2[SolverIntentErrorCode2["NEGATIVE_INPUT_AMOUNT"] = -18] = "NEGATIVE_INPUT_AMOUNT";
12597
+ SolverIntentErrorCode2[SolverIntentErrorCode2["INTENT_ALREADY_IN_ORDERBOOK"] = -19] = "INTENT_ALREADY_IN_ORDERBOOK";
12598
+ SolverIntentErrorCode2[SolverIntentErrorCode2["CREATE_INTENT_ORDER_FAILED"] = -998] = "CREATE_INTENT_ORDER_FAILED";
12599
+ SolverIntentErrorCode2[SolverIntentErrorCode2["UNKNOWN"] = -999] = "UNKNOWN";
12600
+ return SolverIntentErrorCode2;
12601
+ })(SolverIntentErrorCode || {});
11939
12602
 
11940
12603
  exports.BigIntToHex = BigIntToHex;
11941
12604
  exports.CWSpokeProvider = CWSpokeProvider;
@@ -11961,14 +12624,16 @@ exports.IconSpokeProvider = IconSpokeProvider;
11961
12624
  exports.IcxMigrationService = IcxMigrationService;
11962
12625
  exports.IntentCreatedEventAbi = IntentCreatedEventAbi;
11963
12626
  exports.IntentDataType = IntentDataType;
11964
- exports.IntentErrorCode = IntentErrorCode;
11965
- exports.IntentStatusCode = IntentStatusCode;
11966
12627
  exports.IntentsAbi = IntentsAbi;
11967
12628
  exports.MAX_UINT256 = MAX_UINT256;
11968
12629
  exports.MigrationService = MigrationService;
11969
12630
  exports.MoneyMarketService = MoneyMarketService;
12631
+ exports.STELLAR_DEFAULT_TX_TIMEOUT_SECONDS = STELLAR_DEFAULT_TX_TIMEOUT_SECONDS;
12632
+ exports.STELLAR_PRIORITY_FEE = STELLAR_PRIORITY_FEE;
11970
12633
  exports.Sodax = Sodax;
11971
12634
  exports.SolanaSpokeProvider = SolanaSpokeProvider;
12635
+ exports.SolverIntentErrorCode = SolverIntentErrorCode;
12636
+ exports.SolverIntentStatusCode = SolverIntentStatusCode;
11972
12637
  exports.SolverService = SolverService;
11973
12638
  exports.SonicSpokeProvider = SonicSpokeProvider;
11974
12639
  exports.SonicSpokeService = SonicSpokeService;
@@ -12017,11 +12682,25 @@ exports.isEvmUninitializedConfig = isEvmUninitializedConfig;
12017
12682
  exports.isEvmUninitializedPrivateKeyConfig = isEvmUninitializedPrivateKeyConfig;
12018
12683
  exports.isIconAddress = isIconAddress;
12019
12684
  exports.isIconSpokeProvider = isIconSpokeProvider;
12685
+ exports.isIntentCreationFailedError = isIntentCreationFailedError;
12686
+ exports.isIntentCreationUnknownError = isIntentCreationUnknownError;
12687
+ exports.isIntentPostExecutionFailedError = isIntentPostExecutionFailedError;
12020
12688
  exports.isIntentRelayChainId = isIntentRelayChainId;
12689
+ exports.isIntentSubmitTxFailedError = isIntentSubmitTxFailedError;
12021
12690
  exports.isJsonRpcPayloadResponse = isJsonRpcPayloadResponse;
12691
+ exports.isMoneyMarketBorrowUnknownError = isMoneyMarketBorrowUnknownError;
12692
+ exports.isMoneyMarketCreateBorrowIntentFailedError = isMoneyMarketCreateBorrowIntentFailedError;
12693
+ exports.isMoneyMarketCreateRepayIntentFailedError = isMoneyMarketCreateRepayIntentFailedError;
12694
+ exports.isMoneyMarketCreateSupplyIntentFailedError = isMoneyMarketCreateSupplyIntentFailedError;
12695
+ exports.isMoneyMarketCreateWithdrawIntentFailedError = isMoneyMarketCreateWithdrawIntentFailedError;
12696
+ exports.isMoneyMarketRelayTimeoutError = isMoneyMarketRelayTimeoutError;
12697
+ exports.isMoneyMarketRepayUnknownError = isMoneyMarketRepayUnknownError;
12022
12698
  exports.isMoneyMarketReserveAsset = isMoneyMarketReserveAsset;
12023
12699
  exports.isMoneyMarketReserveHubAsset = isMoneyMarketReserveHubAsset;
12700
+ exports.isMoneyMarketSubmitTxFailedError = isMoneyMarketSubmitTxFailedError;
12701
+ exports.isMoneyMarketSupplyUnknownError = isMoneyMarketSupplyUnknownError;
12024
12702
  exports.isMoneyMarketSupportedToken = isMoneyMarketSupportedToken;
12703
+ exports.isMoneyMarketWithdrawUnknownError = isMoneyMarketWithdrawUnknownError;
12025
12704
  exports.isNativeToken = isNativeToken;
12026
12705
  exports.isPartnerFeeAmount = isPartnerFeeAmount;
12027
12706
  exports.isPartnerFeePercentage = isPartnerFeePercentage;
@@ -12037,8 +12716,10 @@ exports.isValidHubAsset = isValidHubAsset;
12037
12716
  exports.isValidIntentRelayChainId = isValidIntentRelayChainId;
12038
12717
  exports.isValidOriginalAssetAddress = isValidOriginalAssetAddress;
12039
12718
  exports.isValidSpokeChainId = isValidSpokeChainId;
12719
+ exports.isWaitUntilIntentExecutedFailed = isWaitUntilIntentExecutedFailed;
12040
12720
  exports.moneyMarketReserveAssets = moneyMarketReserveAssets;
12041
12721
  exports.moneyMarketReserveHubAssetsSet = moneyMarketReserveHubAssetsSet;
12722
+ exports.moneyMarketSupportedTokens = moneyMarketSupportedTokens;
12042
12723
  exports.originalAssetTohubAssetMap = originalAssetTohubAssetMap;
12043
12724
  exports.poolAbi = poolAbi;
12044
12725
  exports.randomUint256 = randomUint256;