@sodax/sdk 0.0.1-rc.11 → 0.0.1-rc.13
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/README.md +3 -3
- package/dist/index.cjs +1173 -484
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +615 -139
- package/dist/index.d.ts +615 -139
- package/dist/index.mjs +1153 -482
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
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://
|
|
5278
|
-
wsUrl: "https://
|
|
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
|
-
|
|
5671
|
+
horizonRpcUrl: "https://horizon.stellar.org",
|
|
5672
|
+
sorobanRpcUrl: "https://rpc.ankr.com/stellar_soroban",
|
|
5670
5673
|
chain: {
|
|
5671
|
-
name: "
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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: "
|
|
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: "
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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: "
|
|
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: "
|
|
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:
|
|
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:
|
|
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:
|
|
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: "
|
|
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: "
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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: "
|
|
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:
|
|
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[
|
|
6167
|
-
spokeChainConfig[
|
|
6168
|
-
spokeChainConfig[
|
|
6169
|
-
spokeChainConfig[
|
|
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[
|
|
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[
|
|
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[
|
|
6256
|
-
spokeChainConfig[
|
|
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[
|
|
6582
|
+
// spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.weETH,
|
|
6265
6583
|
spokeChainConfig[types.BASE_MAINNET_CHAIN_ID].supportedTokens.USDC,
|
|
6266
|
-
spokeChainConfig[
|
|
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[
|
|
6274
|
-
spokeChainConfig[
|
|
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[
|
|
6294
|
-
spokeChainConfig[types.ICON_MAINNET_CHAIN_ID].supportedTokens.bnUSD
|
|
6295
|
-
spokeChainConfig[
|
|
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
|
|
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());
|
|
@@ -6491,8 +6707,8 @@ var isNativeToken = (chainId, token) => {
|
|
|
6491
6707
|
return token.address.toLowerCase() === spokeChainConfig[chainId].nativeToken.toLowerCase();
|
|
6492
6708
|
};
|
|
6493
6709
|
|
|
6494
|
-
// src/entities/
|
|
6495
|
-
var
|
|
6710
|
+
// src/entities/injective/Injective20Token.ts
|
|
6711
|
+
var Injective20Token = class {
|
|
6496
6712
|
client;
|
|
6497
6713
|
contractAddress;
|
|
6498
6714
|
constructor(client, contractAddress) {
|
|
@@ -6557,8 +6773,8 @@ var CW20Token = class {
|
|
|
6557
6773
|
}
|
|
6558
6774
|
};
|
|
6559
6775
|
|
|
6560
|
-
// src/entities/
|
|
6561
|
-
var
|
|
6776
|
+
// src/entities/injective/InjectiveSpokeProvider.ts
|
|
6777
|
+
var InjectiveSpokeProvider = class {
|
|
6562
6778
|
walletProvider;
|
|
6563
6779
|
chainConfig;
|
|
6564
6780
|
constructor(conf, walletProvider) {
|
|
@@ -6606,8 +6822,8 @@ var CWSpokeProvider = class {
|
|
|
6606
6822
|
return res.transactionHash;
|
|
6607
6823
|
}
|
|
6608
6824
|
async depositToken(sender, tokenAddress, to, amount, data = new Uint8Array(), raw) {
|
|
6609
|
-
const
|
|
6610
|
-
await
|
|
6825
|
+
const injective20Token = new Injective20Token(this.walletProvider, tokenAddress);
|
|
6826
|
+
await injective20Token.increaseAllowance(sender, this.chainConfig.addresses.assetManager, amount);
|
|
6611
6827
|
return this.transfer(sender, tokenAddress, to, amount, data, [], raw);
|
|
6612
6828
|
}
|
|
6613
6829
|
static async deposit(sender, token_address, to, amount, data = "0x", provider, raw) {
|
|
@@ -6625,11 +6841,13 @@ var CWSpokeProvider = class {
|
|
|
6625
6841
|
}
|
|
6626
6842
|
async isNative(token) {
|
|
6627
6843
|
let isNative2 = true;
|
|
6628
|
-
const
|
|
6844
|
+
const injective20Token = new Injective20Token(this.walletProvider, token);
|
|
6629
6845
|
try {
|
|
6630
|
-
await
|
|
6846
|
+
await injective20Token.getTokenInfo();
|
|
6631
6847
|
isNative2 = false;
|
|
6632
6848
|
} catch (err) {
|
|
6849
|
+
console.log("[InjectiveSpokeProvider] isNative error", err);
|
|
6850
|
+
throw err;
|
|
6633
6851
|
}
|
|
6634
6852
|
return isNative2;
|
|
6635
6853
|
}
|
|
@@ -6700,7 +6918,7 @@ var CWSpokeProvider = class {
|
|
|
6700
6918
|
return num.toString();
|
|
6701
6919
|
}
|
|
6702
6920
|
};
|
|
6703
|
-
var IconSdk = IconSdkRaw__namespace.default
|
|
6921
|
+
var IconSdk = "default" in IconSdkRaw__namespace.default ? IconSdkRaw__namespace.default : IconSdkRaw__namespace;
|
|
6704
6922
|
var IconSpokeProvider = class {
|
|
6705
6923
|
walletProvider;
|
|
6706
6924
|
chainConfig;
|
|
@@ -6777,28 +6995,164 @@ var EvmSpokeProvider = class {
|
|
|
6777
6995
|
}
|
|
6778
6996
|
}
|
|
6779
6997
|
};
|
|
6998
|
+
var CustomStellarAccount = class {
|
|
6999
|
+
accountId;
|
|
7000
|
+
sequenceNumber;
|
|
7001
|
+
startingSequenceNumber;
|
|
7002
|
+
constructor({ account_id, sequence }) {
|
|
7003
|
+
this.accountId = account_id;
|
|
7004
|
+
this.sequenceNumber = BigInt(sequence);
|
|
7005
|
+
this.startingSequenceNumber = BigInt(sequence);
|
|
7006
|
+
}
|
|
7007
|
+
getSequenceNumber() {
|
|
7008
|
+
return this.sequenceNumber;
|
|
7009
|
+
}
|
|
7010
|
+
getStartingSequenceNumber() {
|
|
7011
|
+
return this.startingSequenceNumber;
|
|
7012
|
+
}
|
|
7013
|
+
getAccountId() {
|
|
7014
|
+
return this.accountId;
|
|
7015
|
+
}
|
|
7016
|
+
getAccountClone() {
|
|
7017
|
+
return new stellarSdk.Account(this.accountId, this.sequenceNumber.toString());
|
|
7018
|
+
}
|
|
7019
|
+
incrementSequenceNumber() {
|
|
7020
|
+
this.sequenceNumber++;
|
|
7021
|
+
}
|
|
7022
|
+
decrementSequenceNumber() {
|
|
7023
|
+
if (this.sequenceNumber > this.startingSequenceNumber) {
|
|
7024
|
+
this.sequenceNumber--;
|
|
7025
|
+
}
|
|
7026
|
+
throw new Error(
|
|
7027
|
+
`Sequence number cannot be decremented below the starting sequence number: ${this.startingSequenceNumber}`
|
|
7028
|
+
);
|
|
7029
|
+
}
|
|
7030
|
+
resetSequenceNumber() {
|
|
7031
|
+
this.sequenceNumber = this.startingSequenceNumber;
|
|
7032
|
+
}
|
|
7033
|
+
};
|
|
7034
|
+
var CustomSorobanServer = class extends stellarSdk.SorobanRpc.Server {
|
|
7035
|
+
customHeaders;
|
|
7036
|
+
constructor(serverUrl, customHeaders) {
|
|
7037
|
+
super(serverUrl, {
|
|
7038
|
+
allowHttp: true
|
|
7039
|
+
});
|
|
7040
|
+
this.customHeaders = customHeaders;
|
|
7041
|
+
}
|
|
7042
|
+
async getNetwork() {
|
|
7043
|
+
const requestOptions = {
|
|
7044
|
+
method: "POST",
|
|
7045
|
+
headers: {
|
|
7046
|
+
"Content-Type": "application/json",
|
|
7047
|
+
...this.customHeaders
|
|
7048
|
+
},
|
|
7049
|
+
body: JSON.stringify({
|
|
7050
|
+
id: 1,
|
|
7051
|
+
jsonrpc: "2.0",
|
|
7052
|
+
method: "getNetwork"
|
|
7053
|
+
})
|
|
7054
|
+
};
|
|
7055
|
+
const response = await fetch(`${this.serverURL}`, requestOptions);
|
|
7056
|
+
if (!response.ok) {
|
|
7057
|
+
throw new Error(`HTTP error getting network! status: ${response.status}`);
|
|
7058
|
+
}
|
|
7059
|
+
return response.json().then((json) => json.result);
|
|
7060
|
+
}
|
|
7061
|
+
async simulateTransaction(tx) {
|
|
7062
|
+
const requestOptions = {
|
|
7063
|
+
method: "POST",
|
|
7064
|
+
headers: {
|
|
7065
|
+
"Content-Type": "application/json",
|
|
7066
|
+
...this.customHeaders
|
|
7067
|
+
},
|
|
7068
|
+
body: JSON.stringify({
|
|
7069
|
+
id: 1,
|
|
7070
|
+
jsonrpc: "2.0",
|
|
7071
|
+
method: "simulateTransaction",
|
|
7072
|
+
params: {
|
|
7073
|
+
transaction: tx.toXDR()
|
|
7074
|
+
}
|
|
7075
|
+
})
|
|
7076
|
+
};
|
|
7077
|
+
const response = await fetch(`${this.serverURL}`, requestOptions);
|
|
7078
|
+
if (!response.ok) {
|
|
7079
|
+
throw new Error(`HTTP error simulating TX! status: ${response.status}`);
|
|
7080
|
+
}
|
|
7081
|
+
return response.json().then((json) => json.result);
|
|
7082
|
+
}
|
|
7083
|
+
async sendTransaction(tx) {
|
|
7084
|
+
const requestOptions = {
|
|
7085
|
+
method: "POST",
|
|
7086
|
+
headers: {
|
|
7087
|
+
"Content-Type": "application/json",
|
|
7088
|
+
...this.customHeaders
|
|
7089
|
+
},
|
|
7090
|
+
body: JSON.stringify({
|
|
7091
|
+
id: 1,
|
|
7092
|
+
jsonrpc: "2.0",
|
|
7093
|
+
method: "sendTransaction",
|
|
7094
|
+
params: {
|
|
7095
|
+
transaction: tx.toXDR()
|
|
7096
|
+
}
|
|
7097
|
+
})
|
|
7098
|
+
};
|
|
7099
|
+
const response = await fetch(`${this.serverURL}`, requestOptions);
|
|
7100
|
+
if (!response.ok) {
|
|
7101
|
+
throw new Error(`HTTP error submitting TX! status: ${response.status}`);
|
|
7102
|
+
}
|
|
7103
|
+
return response.json().then((json) => json.result);
|
|
7104
|
+
}
|
|
7105
|
+
async getTransaction(hash) {
|
|
7106
|
+
const requestOptions = {
|
|
7107
|
+
method: "POST",
|
|
7108
|
+
headers: {
|
|
7109
|
+
"Content-Type": "application/json",
|
|
7110
|
+
...this.customHeaders
|
|
7111
|
+
},
|
|
7112
|
+
body: JSON.stringify({
|
|
7113
|
+
id: 1,
|
|
7114
|
+
jsonrpc: "2.0",
|
|
7115
|
+
method: "getTransaction",
|
|
7116
|
+
params: { hash }
|
|
7117
|
+
})
|
|
7118
|
+
};
|
|
7119
|
+
const response = await fetch(`${this.serverURL}`, requestOptions);
|
|
7120
|
+
if (!response.ok) {
|
|
7121
|
+
throw new Error(`HTTP error getting TX! status: ${response.status}`);
|
|
7122
|
+
}
|
|
7123
|
+
return response.json().then((json) => json.result);
|
|
7124
|
+
}
|
|
7125
|
+
};
|
|
6780
7126
|
var StellarSpokeProvider = class {
|
|
6781
7127
|
server;
|
|
7128
|
+
sorobanServer;
|
|
6782
7129
|
contract;
|
|
6783
7130
|
chainConfig;
|
|
6784
7131
|
walletProvider;
|
|
6785
|
-
constructor(walletProvider,
|
|
6786
|
-
this.server = new stellarSdk.
|
|
7132
|
+
constructor(walletProvider, config, rpcConfig) {
|
|
7133
|
+
this.server = new stellarSdk.Horizon.Server(
|
|
7134
|
+
rpcConfig && rpcConfig.horizonRpcUrl ? rpcConfig.horizonRpcUrl : config.horizonRpcUrl,
|
|
7135
|
+
{ allowHttp: true }
|
|
7136
|
+
);
|
|
7137
|
+
this.sorobanServer = new CustomSorobanServer(
|
|
7138
|
+
rpcConfig && rpcConfig.sorobanRpcUrl ? rpcConfig.sorobanRpcUrl : config.sorobanRpcUrl,
|
|
7139
|
+
{}
|
|
7140
|
+
);
|
|
6787
7141
|
this.walletProvider = walletProvider;
|
|
6788
|
-
this.contract = new stellarSdk.Contract(
|
|
7142
|
+
this.contract = new stellarSdk.Contract(config.addresses.assetManager);
|
|
6789
7143
|
this.chainConfig = config;
|
|
6790
7144
|
}
|
|
6791
7145
|
async getBalance(tokenAddress) {
|
|
6792
7146
|
const [network, walletAddress] = await Promise.all([
|
|
6793
|
-
this.
|
|
7147
|
+
this.sorobanServer.getNetwork(),
|
|
6794
7148
|
this.walletProvider.getWalletAddress()
|
|
6795
7149
|
]);
|
|
6796
|
-
const sourceAccount = await this.
|
|
7150
|
+
const sourceAccount = await this.sorobanServer.getAccount(walletAddress);
|
|
6797
7151
|
const tx = new stellarSdk.TransactionBuilder(sourceAccount, {
|
|
6798
7152
|
fee: stellarSdk.BASE_FEE,
|
|
6799
7153
|
networkPassphrase: network.passphrase
|
|
6800
7154
|
}).addOperation(this.contract.call("get_token_balance", stellarSdk.nativeToScVal(tokenAddress, { type: "address" }))).setTimeout(stellarSdk.TimeoutInfinite).build();
|
|
6801
|
-
const result = await this.
|
|
7155
|
+
const result = await this.sorobanServer.simulateTransaction(tx);
|
|
6802
7156
|
if (stellarSdk.rpc.Api.isSimulationError(result)) {
|
|
6803
7157
|
throw new Error("Failed to simulate transaction");
|
|
6804
7158
|
}
|
|
@@ -6808,32 +7162,112 @@ var StellarSpokeProvider = class {
|
|
|
6808
7162
|
}
|
|
6809
7163
|
throw new Error("result undefined");
|
|
6810
7164
|
}
|
|
7165
|
+
async buildPriorityStellarTransaction(account, network, operation) {
|
|
7166
|
+
const simulationForFee = await this.sorobanServer.simulateTransaction(
|
|
7167
|
+
new stellarSdk.TransactionBuilder(account.getAccountClone(), {
|
|
7168
|
+
fee: stellarSdk.BASE_FEE,
|
|
7169
|
+
networkPassphrase: network.passphrase
|
|
7170
|
+
}).addOperation(operation).setTimeout(STELLAR_DEFAULT_TX_TIMEOUT_SECONDS).build()
|
|
7171
|
+
);
|
|
7172
|
+
if (!stellarSdk.rpc.Api.isSimulationSuccess(simulationForFee)) {
|
|
7173
|
+
throw new Error(`Simulation error: ${JSON.stringify(simulationForFee)}`);
|
|
7174
|
+
}
|
|
7175
|
+
const priorityTransaction = new stellarSdk.TransactionBuilder(account.getAccountClone(), {
|
|
7176
|
+
fee: (BigInt(simulationForFee.minResourceFee) + BigInt(STELLAR_PRIORITY_FEE) + BigInt(stellarSdk.BASE_FEE.toString())).toString(),
|
|
7177
|
+
networkPassphrase: network.passphrase
|
|
7178
|
+
}).addOperation(operation).setTimeout(STELLAR_DEFAULT_TX_TIMEOUT_SECONDS).build();
|
|
7179
|
+
const simulation = await this.sorobanServer.simulateTransaction(priorityTransaction);
|
|
7180
|
+
return [stellarSdk.SorobanRpc.assembleTransaction(priorityTransaction, simulation).build(), simulation];
|
|
7181
|
+
}
|
|
7182
|
+
handleSendTransactionError(response) {
|
|
7183
|
+
if (response.status === "ERROR") {
|
|
7184
|
+
throw new Error(
|
|
7185
|
+
`Transaction failed: status: ${response.status}, hash: ${response.hash}, errorResult: ${JSON.stringify({
|
|
7186
|
+
name: response?.errorResult?.result()?.switch()?.name ?? "unknown",
|
|
7187
|
+
value: response?.errorResult?.result()?.switch()?.value ?? "unknown"
|
|
7188
|
+
})}, diagnosticEvents: ${JSON.stringify(response?.diagnosticEvents ?? "{}")}`
|
|
7189
|
+
);
|
|
7190
|
+
}
|
|
7191
|
+
return response;
|
|
7192
|
+
}
|
|
7193
|
+
async signAndSendTransaction(tx, waitForTransaction = true) {
|
|
7194
|
+
const signedTransaction = await this.walletProvider.signTransaction(tx.toXDR());
|
|
7195
|
+
const signedTx = stellarSdk.TransactionBuilder.fromXDR(signedTransaction, tx.networkPassphrase);
|
|
7196
|
+
const response = this.handleSendTransactionError(await this.sorobanServer.sendTransaction(signedTx));
|
|
7197
|
+
if (waitForTransaction) {
|
|
7198
|
+
return await this.waitForTransaction(response.hash);
|
|
7199
|
+
}
|
|
7200
|
+
return response.hash;
|
|
7201
|
+
}
|
|
7202
|
+
async waitForTransaction(hash, attempts = 60) {
|
|
7203
|
+
if (attempts === 0) {
|
|
7204
|
+
throw new Error(
|
|
7205
|
+
"[StellarSpokeProvider.waitForTransaction] Timeout error. Transaction not found after 5 attempts"
|
|
7206
|
+
);
|
|
7207
|
+
}
|
|
7208
|
+
const response = await this.sorobanServer.getTransaction(hash);
|
|
7209
|
+
if (response.status === stellarSdk.rpc.Api.GetTransactionStatus.SUCCESS) {
|
|
7210
|
+
return hash;
|
|
7211
|
+
}
|
|
7212
|
+
if (response.status === stellarSdk.rpc.Api.GetTransactionStatus.FAILED) {
|
|
7213
|
+
throw response;
|
|
7214
|
+
}
|
|
7215
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
7216
|
+
return this.waitForTransaction(hash, attempts - 1);
|
|
7217
|
+
}
|
|
7218
|
+
async submitOrRestoreAndRetry(account, network, tx, operation, simulation) {
|
|
7219
|
+
const initialSimulation = simulation ?? await this.sorobanServer.simulateTransaction(tx);
|
|
7220
|
+
if (!stellarSdk.rpc.Api.isSimulationSuccess(initialSimulation)) {
|
|
7221
|
+
throw new Error(
|
|
7222
|
+
`[StellarSpokeProvider.submitOrRestoreAndRetry] Simulation Failed: ${JSON.stringify(initialSimulation)}`
|
|
7223
|
+
);
|
|
7224
|
+
}
|
|
7225
|
+
let restored = false;
|
|
7226
|
+
if (stellarSdk.rpc.Api.isSimulationRestore(initialSimulation)) {
|
|
7227
|
+
try {
|
|
7228
|
+
await this.handleSimulationRestore(
|
|
7229
|
+
initialSimulation.restorePreamble.minResourceFee,
|
|
7230
|
+
initialSimulation.restorePreamble.transactionData.build(),
|
|
7231
|
+
account,
|
|
7232
|
+
network
|
|
7233
|
+
);
|
|
7234
|
+
restored = true;
|
|
7235
|
+
} catch (error) {
|
|
7236
|
+
throw new Error(
|
|
7237
|
+
`[StellarSpokeProvider.submitOrRestoreAndRetry] Simulation Restore Failed: ${JSON.stringify(error)}`
|
|
7238
|
+
);
|
|
7239
|
+
}
|
|
7240
|
+
}
|
|
7241
|
+
if (!restored) {
|
|
7242
|
+
return await this.signAndSendTransaction(tx);
|
|
7243
|
+
}
|
|
7244
|
+
const newAccount = account.getAccountClone();
|
|
7245
|
+
newAccount.incrementSequenceNumber();
|
|
7246
|
+
return await this.signAndSendTransaction(
|
|
7247
|
+
new stellarSdk.TransactionBuilder(newAccount, {
|
|
7248
|
+
fee: stellarSdk.BASE_FEE,
|
|
7249
|
+
networkPassphrase: network.passphrase
|
|
7250
|
+
}).addOperation(operation).setTimeout(STELLAR_DEFAULT_TX_TIMEOUT_SECONDS).build()
|
|
7251
|
+
);
|
|
7252
|
+
}
|
|
7253
|
+
async handleSimulationRestore(minResourceFee, transactionData, account, network) {
|
|
7254
|
+
const totalFee = (BigInt(stellarSdk.BASE_FEE) + BigInt(STELLAR_PRIORITY_FEE) + BigInt(minResourceFee)).toString();
|
|
7255
|
+
return this.signAndSendTransaction(
|
|
7256
|
+
new stellarSdk.TransactionBuilder(account.getAccountClone(), { fee: totalFee }).setNetworkPassphrase(network.passphrase).setSorobanData(transactionData).addOperation(stellarSdk.Operation.restoreFootprint({})).setTimeout(STELLAR_DEFAULT_TX_TIMEOUT_SECONDS).build()
|
|
7257
|
+
);
|
|
7258
|
+
}
|
|
6811
7259
|
async deposit(token, amount, recipient, data, raw) {
|
|
6812
7260
|
try {
|
|
6813
7261
|
const [network, walletAddress] = await Promise.all([
|
|
6814
|
-
this.
|
|
7262
|
+
this.sorobanServer.getNetwork(),
|
|
6815
7263
|
this.walletProvider.getWalletAddress()
|
|
6816
7264
|
]);
|
|
6817
|
-
const
|
|
6818
|
-
const
|
|
6819
|
-
|
|
6820
|
-
|
|
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();
|
|
7265
|
+
const accountResponse = await this.server.loadAccount(walletAddress);
|
|
7266
|
+
const stellarAccount = new CustomStellarAccount(accountResponse);
|
|
7267
|
+
const depositCall = this.buildDepositCall(walletAddress, token, amount, recipient, data);
|
|
7268
|
+
const [priorityTx, simulation] = await this.buildPriorityStellarTransaction(stellarAccount, network, depositCall);
|
|
6835
7269
|
if (raw) {
|
|
6836
|
-
const transactionXdr =
|
|
7270
|
+
const transactionXdr = priorityTx.toXDR();
|
|
6837
7271
|
return {
|
|
6838
7272
|
from: walletAddress,
|
|
6839
7273
|
to: this.chainConfig.addresses.assetManager,
|
|
@@ -6841,16 +7275,8 @@ var StellarSpokeProvider = class {
|
|
|
6841
7275
|
data: transactionXdr
|
|
6842
7276
|
};
|
|
6843
7277
|
}
|
|
6844
|
-
|
|
6845
|
-
|
|
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");
|
|
7278
|
+
const hash = await this.submitOrRestoreAndRetry(stellarAccount, network, priorityTx, depositCall, simulation);
|
|
7279
|
+
return `${hash}`;
|
|
6854
7280
|
} catch (error) {
|
|
6855
7281
|
console.error("Error during deposit:", error);
|
|
6856
7282
|
throw error;
|
|
@@ -6859,27 +7285,19 @@ var StellarSpokeProvider = class {
|
|
|
6859
7285
|
async sendMessage(dst_chain_id, dst_address, payload, raw) {
|
|
6860
7286
|
try {
|
|
6861
7287
|
const [network, walletAddress] = await Promise.all([
|
|
6862
|
-
this.
|
|
7288
|
+
this.sorobanServer.getNetwork(),
|
|
6863
7289
|
this.walletProvider.getWalletAddress()
|
|
6864
7290
|
]);
|
|
6865
|
-
const
|
|
6866
|
-
const
|
|
6867
|
-
const
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
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();
|
|
7291
|
+
const accountResponse = await this.server.loadAccount(walletAddress);
|
|
7292
|
+
const stellarAccount = new CustomStellarAccount(accountResponse);
|
|
7293
|
+
const sendMessageCall = this.buildSendMessageCall(walletAddress, dst_chain_id, dst_address, payload);
|
|
7294
|
+
const [priorityTx, simulation] = await this.buildPriorityStellarTransaction(
|
|
7295
|
+
stellarAccount,
|
|
7296
|
+
network,
|
|
7297
|
+
sendMessageCall
|
|
7298
|
+
);
|
|
6881
7299
|
if (raw) {
|
|
6882
|
-
const transactionXdr =
|
|
7300
|
+
const transactionXdr = priorityTx.toXDR();
|
|
6883
7301
|
return {
|
|
6884
7302
|
from: walletAddress,
|
|
6885
7303
|
to: this.chainConfig.addresses.assetManager,
|
|
@@ -6887,21 +7305,35 @@ var StellarSpokeProvider = class {
|
|
|
6887
7305
|
data: transactionXdr
|
|
6888
7306
|
};
|
|
6889
7307
|
}
|
|
6890
|
-
|
|
6891
|
-
|
|
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");
|
|
7308
|
+
const hash = await this.submitOrRestoreAndRetry(stellarAccount, network, priorityTx, sendMessageCall, simulation);
|
|
7309
|
+
return `${hash}`;
|
|
6900
7310
|
} catch (error) {
|
|
6901
|
-
console.error("Error during
|
|
7311
|
+
console.error("Error during sendMessage:", error);
|
|
6902
7312
|
throw error;
|
|
6903
7313
|
}
|
|
6904
7314
|
}
|
|
7315
|
+
buildDepositCall(walletAddress, token, amount, recipient, data) {
|
|
7316
|
+
return this.contract.call(
|
|
7317
|
+
"transfer",
|
|
7318
|
+
stellarSdk.nativeToScVal(stellarSdk.Address.fromString(walletAddress), { type: "address" }),
|
|
7319
|
+
stellarSdk.nativeToScVal(stellarSdk.Address.fromString(token), {
|
|
7320
|
+
type: "address"
|
|
7321
|
+
}),
|
|
7322
|
+
stellarSdk.nativeToScVal(BigInt(amount), { type: "u128" }),
|
|
7323
|
+
stellarSdk.nativeToScVal(Buffer.from(recipient), { type: "bytes" }),
|
|
7324
|
+
stellarSdk.nativeToScVal(Buffer.from(data), { type: "bytes" })
|
|
7325
|
+
);
|
|
7326
|
+
}
|
|
7327
|
+
buildSendMessageCall(walletAddress, dst_chain_id, dst_address, payload) {
|
|
7328
|
+
const connection = new stellarSdk.Contract(this.chainConfig.addresses.connection);
|
|
7329
|
+
return connection.call(
|
|
7330
|
+
"send_message",
|
|
7331
|
+
stellarSdk.nativeToScVal(stellarSdk.Address.fromString(walletAddress), { type: "address" }),
|
|
7332
|
+
stellarSdk.nativeToScVal(dst_chain_id, { type: "u128" }),
|
|
7333
|
+
stellarSdk.nativeToScVal(Buffer.from(dst_address), { type: "bytes" }),
|
|
7334
|
+
stellarSdk.nativeToScVal(Buffer.from(payload), { type: "bytes" })
|
|
7335
|
+
);
|
|
7336
|
+
}
|
|
6905
7337
|
static getAddressBCSBytes(stellaraddress) {
|
|
6906
7338
|
return `0x${stellarSdk.Address.fromString(stellaraddress).toScVal().toXDR("hex")}`;
|
|
6907
7339
|
}
|
|
@@ -7672,9 +8104,13 @@ function encodeAddress(spokeChainId, address) {
|
|
|
7672
8104
|
case "injective-1":
|
|
7673
8105
|
return viem.toHex(Buffer.from(address, "utf-8"));
|
|
7674
8106
|
case "0x1.icon":
|
|
7675
|
-
return
|
|
8107
|
+
return viem.toHex(Buffer.from(address.replace("cx", "01").replace("hx", "00") ?? "f8", "hex"));
|
|
7676
8108
|
case "sui":
|
|
7677
8109
|
return viem.toHex(bcs.bcs.Address.serialize(address).toBytes());
|
|
8110
|
+
case "solana":
|
|
8111
|
+
return viem.toHex(Buffer.from(new web3_js.PublicKey(address).toBytes()));
|
|
8112
|
+
case "stellar":
|
|
8113
|
+
return `0x${stellarSdk.Address.fromString(address).toScVal().toXDR("hex")}`;
|
|
7678
8114
|
default:
|
|
7679
8115
|
return address;
|
|
7680
8116
|
}
|
|
@@ -7927,10 +8363,10 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
7927
8363
|
* @param params - The parameters for the supply transaction.
|
|
7928
8364
|
* @param spokeProvider - The spoke provider.
|
|
7929
8365
|
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
7930
|
-
* @returns {Promise<Result<[
|
|
8366
|
+
* @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
|
|
7931
8367
|
*
|
|
7932
8368
|
* @example
|
|
7933
|
-
* const result = await moneyMarketService.
|
|
8369
|
+
* const result = await moneyMarketService.supply(
|
|
7934
8370
|
* {
|
|
7935
8371
|
* token: '0x...', // Address of the token (spoke chain address) to supply
|
|
7936
8372
|
* amount: 1000n, // Amount to supply (in token decimals)
|
|
@@ -7949,40 +8385,47 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
7949
8385
|
* ] = result.value;
|
|
7950
8386
|
* console.log('Supply transaction hashes:', { spokeTxHash, hubTxHash });
|
|
7951
8387
|
*/
|
|
7952
|
-
async
|
|
8388
|
+
async supply(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
|
|
7953
8389
|
try {
|
|
7954
|
-
const txResult = await this.
|
|
8390
|
+
const txResult = await this.createSupplyIntent(params, spokeProvider);
|
|
7955
8391
|
if (!txResult.ok) {
|
|
7956
|
-
return
|
|
7957
|
-
ok: false,
|
|
7958
|
-
error: {
|
|
7959
|
-
code: "SUPPLY_FAILED",
|
|
7960
|
-
error: txResult.error
|
|
7961
|
-
}
|
|
7962
|
-
};
|
|
8392
|
+
return txResult;
|
|
7963
8393
|
}
|
|
7964
8394
|
const packetResult = await relayTxAndWaitPacket(
|
|
7965
8395
|
txResult.value,
|
|
8396
|
+
spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
|
|
7966
8397
|
spokeProvider,
|
|
7967
8398
|
this.config.relayerApiEndpoint,
|
|
7968
8399
|
timeout
|
|
7969
8400
|
);
|
|
7970
8401
|
if (!packetResult.ok) {
|
|
7971
|
-
return
|
|
8402
|
+
return {
|
|
8403
|
+
ok: false,
|
|
8404
|
+
error: {
|
|
8405
|
+
code: packetResult.error.code,
|
|
8406
|
+
data: {
|
|
8407
|
+
error: packetResult.error,
|
|
8408
|
+
payload: txResult.value
|
|
8409
|
+
}
|
|
8410
|
+
}
|
|
8411
|
+
};
|
|
7972
8412
|
}
|
|
7973
8413
|
return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
|
|
7974
8414
|
} catch (error) {
|
|
7975
8415
|
return {
|
|
7976
8416
|
ok: false,
|
|
7977
8417
|
error: {
|
|
7978
|
-
code: "
|
|
7979
|
-
|
|
8418
|
+
code: "SUPPLY_UNKNOWN_ERROR",
|
|
8419
|
+
data: {
|
|
8420
|
+
error,
|
|
8421
|
+
payload: params
|
|
8422
|
+
}
|
|
7980
8423
|
}
|
|
7981
8424
|
};
|
|
7982
8425
|
}
|
|
7983
8426
|
}
|
|
7984
8427
|
/**
|
|
7985
|
-
*
|
|
8428
|
+
* Create supply intent only (without submitting to Solver API)
|
|
7986
8429
|
* NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
|
|
7987
8430
|
* In order to successfully supply tokens, you need to:
|
|
7988
8431
|
* 1. Check if the allowance is sufficient
|
|
@@ -7997,7 +8440,7 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
7997
8440
|
*
|
|
7998
8441
|
* @example
|
|
7999
8442
|
* const moneyMarketService = new MoneyMarketService(config);
|
|
8000
|
-
* const result = await moneyMarketService.
|
|
8443
|
+
* const result = await moneyMarketService.createSupplyIntent(
|
|
8001
8444
|
* {
|
|
8002
8445
|
* token: "0x123...", // token address
|
|
8003
8446
|
* amount: 1000000000000000000n // 1 token in wei
|
|
@@ -8013,7 +8456,7 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8013
8456
|
* console.error('Supply failed:', result.error);
|
|
8014
8457
|
* }
|
|
8015
8458
|
*/
|
|
8016
|
-
async
|
|
8459
|
+
async createSupplyIntent(params, spokeProvider, raw) {
|
|
8017
8460
|
try {
|
|
8018
8461
|
invariant2__default.default(params.action === "supply", "Invalid action");
|
|
8019
8462
|
invariant2__default.default(params.token.length > 0, "Token is required");
|
|
@@ -8029,7 +8472,12 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8029
8472
|
this.hubProvider,
|
|
8030
8473
|
spokeProvider
|
|
8031
8474
|
);
|
|
8032
|
-
const data = this.
|
|
8475
|
+
const data = this.buildSupplyData(
|
|
8476
|
+
params.token,
|
|
8477
|
+
hubWallet,
|
|
8478
|
+
params.amount,
|
|
8479
|
+
spokeProvider.chainConfig.chain.id
|
|
8480
|
+
);
|
|
8033
8481
|
const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
|
|
8034
8482
|
const txResult = await SpokeService.deposit(
|
|
8035
8483
|
{
|
|
@@ -8045,14 +8493,21 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8045
8493
|
);
|
|
8046
8494
|
return {
|
|
8047
8495
|
ok: true,
|
|
8048
|
-
value: txResult
|
|
8496
|
+
value: txResult,
|
|
8497
|
+
data: {
|
|
8498
|
+
address: hubWallet,
|
|
8499
|
+
payload: data
|
|
8500
|
+
}
|
|
8049
8501
|
};
|
|
8050
8502
|
} catch (error) {
|
|
8051
8503
|
return {
|
|
8052
8504
|
ok: false,
|
|
8053
8505
|
error: {
|
|
8054
|
-
code: "
|
|
8055
|
-
|
|
8506
|
+
code: "CREATE_SUPPLY_INTENT_FAILED",
|
|
8507
|
+
data: {
|
|
8508
|
+
error,
|
|
8509
|
+
payload: params
|
|
8510
|
+
}
|
|
8056
8511
|
}
|
|
8057
8512
|
};
|
|
8058
8513
|
}
|
|
@@ -8062,10 +8517,10 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8062
8517
|
* @param params - The parameters for the borrow transaction.
|
|
8063
8518
|
* @param spokeProvider - The spoke provider.
|
|
8064
8519
|
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
8065
|
-
* @returns {Promise<Result<[
|
|
8520
|
+
* @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
|
|
8066
8521
|
*
|
|
8067
8522
|
* @example
|
|
8068
|
-
* const result = await moneyMarketService.
|
|
8523
|
+
* const result = await moneyMarketService.borrow(
|
|
8069
8524
|
* {
|
|
8070
8525
|
* token: '0x...', // Address of the token (spoke chain address) to borrow
|
|
8071
8526
|
* amount: 1000n, // Amount to borrow (in token decimals)
|
|
@@ -8084,40 +8539,47 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8084
8539
|
* ] = result.value;
|
|
8085
8540
|
* console.log('Borrow transaction hashes:', { spokeTxHash, hubTxHash });
|
|
8086
8541
|
*/
|
|
8087
|
-
async
|
|
8542
|
+
async borrow(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
|
|
8088
8543
|
try {
|
|
8089
|
-
const txResult = await this.
|
|
8544
|
+
const txResult = await this.createBorrowIntent(params, spokeProvider);
|
|
8090
8545
|
if (!txResult.ok) {
|
|
8091
|
-
return
|
|
8092
|
-
ok: false,
|
|
8093
|
-
error: {
|
|
8094
|
-
code: "BORROW_FAILED",
|
|
8095
|
-
error: txResult.error
|
|
8096
|
-
}
|
|
8097
|
-
};
|
|
8546
|
+
return txResult;
|
|
8098
8547
|
}
|
|
8099
8548
|
const packetResult = await relayTxAndWaitPacket(
|
|
8100
8549
|
txResult.value,
|
|
8550
|
+
spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
|
|
8101
8551
|
spokeProvider,
|
|
8102
8552
|
this.config.relayerApiEndpoint,
|
|
8103
8553
|
timeout
|
|
8104
8554
|
);
|
|
8105
8555
|
if (!packetResult.ok) {
|
|
8106
|
-
return
|
|
8556
|
+
return {
|
|
8557
|
+
ok: false,
|
|
8558
|
+
error: {
|
|
8559
|
+
code: packetResult.error.code,
|
|
8560
|
+
data: {
|
|
8561
|
+
error: packetResult.error,
|
|
8562
|
+
payload: txResult.value
|
|
8563
|
+
}
|
|
8564
|
+
}
|
|
8565
|
+
};
|
|
8107
8566
|
}
|
|
8108
8567
|
return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
|
|
8109
8568
|
} catch (error) {
|
|
8110
8569
|
return {
|
|
8111
8570
|
ok: false,
|
|
8112
8571
|
error: {
|
|
8113
|
-
code: "
|
|
8114
|
-
|
|
8572
|
+
code: "BORROW_UNKNOWN_ERROR",
|
|
8573
|
+
data: {
|
|
8574
|
+
error,
|
|
8575
|
+
payload: params
|
|
8576
|
+
}
|
|
8115
8577
|
}
|
|
8116
8578
|
};
|
|
8117
8579
|
}
|
|
8118
8580
|
}
|
|
8119
8581
|
/**
|
|
8120
|
-
*
|
|
8582
|
+
* Create borrow intent only (without submitting to Solver API)
|
|
8121
8583
|
* NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
|
|
8122
8584
|
* In order to successfully borrow tokens, you need to:
|
|
8123
8585
|
* 1. Execute the borrow transaction on the spoke chain
|
|
@@ -8130,13 +8592,13 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8130
8592
|
*
|
|
8131
8593
|
* @example
|
|
8132
8594
|
* const moneyMarketService = new MoneyMarketService(config);
|
|
8133
|
-
* const result = await moneyMarketService.
|
|
8595
|
+
* const result = await moneyMarketService.createBorrowIntent(
|
|
8134
8596
|
* {
|
|
8135
8597
|
* token: "0x123...", // token address
|
|
8136
8598
|
* amount: 1000000000000000000n // 1 token in wei
|
|
8137
8599
|
* },
|
|
8138
8600
|
* spokeProvider,
|
|
8139
|
-
* raw // Optional: true = return the raw transaction data, false =
|
|
8601
|
+
* raw // Optional: true = return the raw transaction data, false = execute and return the transaction hash (default: false)
|
|
8140
8602
|
* );
|
|
8141
8603
|
*
|
|
8142
8604
|
* if (result.ok) {
|
|
@@ -8146,7 +8608,7 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8146
8608
|
* console.error('Borrow failed:', result.error);
|
|
8147
8609
|
* }
|
|
8148
8610
|
*/
|
|
8149
|
-
async
|
|
8611
|
+
async createBorrowIntent(params, spokeProvider, raw) {
|
|
8150
8612
|
invariant2__default.default(params.action === "borrow", "Invalid action");
|
|
8151
8613
|
invariant2__default.default(params.token.length > 0, "Token is required");
|
|
8152
8614
|
invariant2__default.default(params.amount > 0n, "Amount must be greater than 0");
|
|
@@ -8161,7 +8623,7 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8161
8623
|
this.hubProvider,
|
|
8162
8624
|
spokeProvider
|
|
8163
8625
|
);
|
|
8164
|
-
const data = this.
|
|
8626
|
+
const data = this.buildBorrowData(
|
|
8165
8627
|
hubWallet,
|
|
8166
8628
|
walletAddressBytes,
|
|
8167
8629
|
params.token,
|
|
@@ -8169,7 +8631,14 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8169
8631
|
spokeProvider.chainConfig.chain.id
|
|
8170
8632
|
);
|
|
8171
8633
|
const txResult = await SpokeService.callWallet(hubWallet, data, spokeProvider, this.hubProvider, raw);
|
|
8172
|
-
return {
|
|
8634
|
+
return {
|
|
8635
|
+
ok: true,
|
|
8636
|
+
value: txResult,
|
|
8637
|
+
data: {
|
|
8638
|
+
address: hubWallet,
|
|
8639
|
+
payload: data
|
|
8640
|
+
}
|
|
8641
|
+
};
|
|
8173
8642
|
}
|
|
8174
8643
|
/**
|
|
8175
8644
|
* Withdraw tokens from the money market pool, relay the transaction to the hub and submit the intent to the Solver API
|
|
@@ -8177,10 +8646,10 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8177
8646
|
* @param params - The parameters for the withdraw transaction.
|
|
8178
8647
|
* @param spokeProvider - The spoke provider.
|
|
8179
8648
|
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
8180
|
-
* @returns {Promise<Result<[
|
|
8649
|
+
* @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the spoke and hub transaction hashes or error
|
|
8181
8650
|
*
|
|
8182
8651
|
* @example
|
|
8183
|
-
* const result = await moneyMarketService.
|
|
8652
|
+
* const result = await moneyMarketService.withdraw(
|
|
8184
8653
|
* {
|
|
8185
8654
|
* token: '0x...', // Address of the token (spoke chain address) to withdraw
|
|
8186
8655
|
* amount: 1000n, // Amount to withdraw (in token decimals)
|
|
@@ -8199,40 +8668,47 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8199
8668
|
* ] = result.value;
|
|
8200
8669
|
* console.log('Withdraw transaction hashes:', { spokeTxHash, hubTxHash });
|
|
8201
8670
|
*/
|
|
8202
|
-
async
|
|
8671
|
+
async withdraw(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
|
|
8203
8672
|
try {
|
|
8204
|
-
const txResult = await this.
|
|
8673
|
+
const txResult = await this.createWithdrawIntent(params, spokeProvider);
|
|
8205
8674
|
if (!txResult.ok) {
|
|
8206
|
-
return
|
|
8207
|
-
ok: false,
|
|
8208
|
-
error: {
|
|
8209
|
-
code: "WITHDRAW_FAILED",
|
|
8210
|
-
error: txResult.error
|
|
8211
|
-
}
|
|
8212
|
-
};
|
|
8675
|
+
return txResult;
|
|
8213
8676
|
}
|
|
8214
8677
|
const packetResult = await relayTxAndWaitPacket(
|
|
8215
8678
|
txResult.value,
|
|
8679
|
+
spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
|
|
8216
8680
|
spokeProvider,
|
|
8217
8681
|
this.config.relayerApiEndpoint,
|
|
8218
8682
|
timeout
|
|
8219
8683
|
);
|
|
8220
8684
|
if (!packetResult.ok) {
|
|
8221
|
-
return
|
|
8685
|
+
return {
|
|
8686
|
+
ok: false,
|
|
8687
|
+
error: {
|
|
8688
|
+
code: packetResult.error.code,
|
|
8689
|
+
data: {
|
|
8690
|
+
error: packetResult.error,
|
|
8691
|
+
payload: txResult.value
|
|
8692
|
+
}
|
|
8693
|
+
}
|
|
8694
|
+
};
|
|
8222
8695
|
}
|
|
8223
8696
|
return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
|
|
8224
8697
|
} catch (error) {
|
|
8225
8698
|
return {
|
|
8226
8699
|
ok: false,
|
|
8227
8700
|
error: {
|
|
8228
|
-
code: "
|
|
8229
|
-
|
|
8701
|
+
code: "WITHDRAW_UNKNOWN_ERROR",
|
|
8702
|
+
data: {
|
|
8703
|
+
error,
|
|
8704
|
+
payload: params
|
|
8705
|
+
}
|
|
8230
8706
|
}
|
|
8231
8707
|
};
|
|
8232
8708
|
}
|
|
8233
8709
|
}
|
|
8234
8710
|
/**
|
|
8235
|
-
*
|
|
8711
|
+
* Create withdraw intent only (without submitting to Solver API)
|
|
8236
8712
|
* NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
|
|
8237
8713
|
* In order to successfully withdraw tokens, you need to:
|
|
8238
8714
|
* 1. Execute the withdraw transaction on the spoke chain
|
|
@@ -8245,7 +8721,7 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8245
8721
|
*
|
|
8246
8722
|
* @example
|
|
8247
8723
|
* const moneyMarketService = new MoneyMarketService(config);
|
|
8248
|
-
* const result = await moneyMarketService.
|
|
8724
|
+
* const result = await moneyMarketService.createWithdrawIntent(
|
|
8249
8725
|
* {
|
|
8250
8726
|
* token: "0x123...", // token address
|
|
8251
8727
|
* amount: 1000000000000000000n // 1 token in wei
|
|
@@ -8261,7 +8737,7 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8261
8737
|
* console.error('Withdraw failed:', result.error);
|
|
8262
8738
|
* }
|
|
8263
8739
|
*/
|
|
8264
|
-
async
|
|
8740
|
+
async createWithdrawIntent(params, spokeProvider, raw) {
|
|
8265
8741
|
invariant2__default.default(params.action === "withdraw", "Invalid action");
|
|
8266
8742
|
invariant2__default.default(params.token.length > 0, "Token is required");
|
|
8267
8743
|
invariant2__default.default(params.amount > 0n, "Amount must be greater than 0");
|
|
@@ -8276,7 +8752,7 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8276
8752
|
this.hubProvider,
|
|
8277
8753
|
spokeProvider
|
|
8278
8754
|
);
|
|
8279
|
-
const data = this.
|
|
8755
|
+
const data = this.buildWithdrawData(
|
|
8280
8756
|
hubWallet,
|
|
8281
8757
|
walletAddressBytes,
|
|
8282
8758
|
params.token,
|
|
@@ -8284,7 +8760,14 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8284
8760
|
spokeProvider.chainConfig.chain.id
|
|
8285
8761
|
);
|
|
8286
8762
|
const txResult = await SpokeService.callWallet(hubWallet, data, spokeProvider, this.hubProvider, raw);
|
|
8287
|
-
return {
|
|
8763
|
+
return {
|
|
8764
|
+
ok: true,
|
|
8765
|
+
value: txResult,
|
|
8766
|
+
data: {
|
|
8767
|
+
address: hubWallet,
|
|
8768
|
+
payload: data
|
|
8769
|
+
}
|
|
8770
|
+
};
|
|
8288
8771
|
}
|
|
8289
8772
|
/**
|
|
8290
8773
|
* Repay tokens to the money market pool, relay the transaction to the hub and submit the intent to the Solver API
|
|
@@ -8292,10 +8775,10 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8292
8775
|
* @param params - The parameters for the repay transaction.
|
|
8293
8776
|
* @param spokeProvider - The spoke provider.
|
|
8294
8777
|
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
8295
|
-
* @returns {Promise<Result<[
|
|
8778
|
+
* @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the spoke and hub transaction hashes or error
|
|
8296
8779
|
*
|
|
8297
8780
|
* @example
|
|
8298
|
-
* const result = await moneyMarketService.
|
|
8781
|
+
* const result = await moneyMarketService.repay(
|
|
8299
8782
|
* {
|
|
8300
8783
|
* token: '0x...', // Address of the token (spoke chain address) to repay
|
|
8301
8784
|
* amount: 1000n, // Amount to repay (in token decimals)
|
|
@@ -8314,40 +8797,47 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8314
8797
|
* ] = result.value;
|
|
8315
8798
|
* console.log('Repay transaction hashes:', { spokeTxHash, hubTxHash });
|
|
8316
8799
|
*/
|
|
8317
|
-
async
|
|
8800
|
+
async repay(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
|
|
8318
8801
|
try {
|
|
8319
|
-
const txResult = await this.
|
|
8802
|
+
const txResult = await this.createRepayIntent(params, spokeProvider);
|
|
8320
8803
|
if (!txResult.ok) {
|
|
8321
|
-
return
|
|
8322
|
-
ok: false,
|
|
8323
|
-
error: {
|
|
8324
|
-
code: "REPAY_FAILED",
|
|
8325
|
-
error: txResult.error
|
|
8326
|
-
}
|
|
8327
|
-
};
|
|
8804
|
+
return txResult;
|
|
8328
8805
|
}
|
|
8329
8806
|
const packetResult = await relayTxAndWaitPacket(
|
|
8330
8807
|
txResult.value,
|
|
8808
|
+
spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
|
|
8331
8809
|
spokeProvider,
|
|
8332
8810
|
this.config.relayerApiEndpoint,
|
|
8333
8811
|
timeout
|
|
8334
8812
|
);
|
|
8335
8813
|
if (!packetResult.ok) {
|
|
8336
|
-
return
|
|
8814
|
+
return {
|
|
8815
|
+
ok: false,
|
|
8816
|
+
error: {
|
|
8817
|
+
code: packetResult.error.code,
|
|
8818
|
+
data: {
|
|
8819
|
+
error: packetResult.error,
|
|
8820
|
+
payload: txResult.value
|
|
8821
|
+
}
|
|
8822
|
+
}
|
|
8823
|
+
};
|
|
8337
8824
|
}
|
|
8338
8825
|
return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
|
|
8339
8826
|
} catch (error) {
|
|
8340
8827
|
return {
|
|
8341
8828
|
ok: false,
|
|
8342
8829
|
error: {
|
|
8343
|
-
code: "
|
|
8344
|
-
|
|
8830
|
+
code: "REPAY_UNKNOWN_ERROR",
|
|
8831
|
+
data: {
|
|
8832
|
+
error,
|
|
8833
|
+
payload: params
|
|
8834
|
+
}
|
|
8345
8835
|
}
|
|
8346
8836
|
};
|
|
8347
8837
|
}
|
|
8348
8838
|
}
|
|
8349
8839
|
/**
|
|
8350
|
-
*
|
|
8840
|
+
* Create repay intent only (without submitting to Solver API)
|
|
8351
8841
|
* NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
|
|
8352
8842
|
* In order to successfully repay tokens, you need to:
|
|
8353
8843
|
* 1. Check if the allowance is sufficient
|
|
@@ -8362,7 +8852,7 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8362
8852
|
*
|
|
8363
8853
|
* @example
|
|
8364
8854
|
* const moneyMarketService = new MoneyMarketService(config);
|
|
8365
|
-
* const result = await moneyMarketService.
|
|
8855
|
+
* const result = await moneyMarketService.createRepayIntent(
|
|
8366
8856
|
* {
|
|
8367
8857
|
* token: "0x123...", // token address
|
|
8368
8858
|
* amount: 1000000000000000000n // 1 token in wei
|
|
@@ -8378,7 +8868,7 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8378
8868
|
* console.error('Repay failed:', result.error);
|
|
8379
8869
|
* }
|
|
8380
8870
|
*/
|
|
8381
|
-
async
|
|
8871
|
+
async createRepayIntent(params, spokeProvider, raw) {
|
|
8382
8872
|
invariant2__default.default(params.action === "repay", "Invalid action");
|
|
8383
8873
|
invariant2__default.default(params.token.length > 0, "Token is required");
|
|
8384
8874
|
invariant2__default.default(params.amount > 0n, "Amount must be greater than 0");
|
|
@@ -8393,7 +8883,7 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8393
8883
|
this.hubProvider,
|
|
8394
8884
|
spokeProvider
|
|
8395
8885
|
);
|
|
8396
|
-
const data = this.
|
|
8886
|
+
const data = this.buildRepayData(params.token, hubWallet, params.amount, spokeProvider.chainConfig.chain.id);
|
|
8397
8887
|
const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
|
|
8398
8888
|
const txResult = await SpokeService.deposit(
|
|
8399
8889
|
{
|
|
@@ -8407,7 +8897,14 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8407
8897
|
this.hubProvider,
|
|
8408
8898
|
raw
|
|
8409
8899
|
);
|
|
8410
|
-
return {
|
|
8900
|
+
return {
|
|
8901
|
+
ok: true,
|
|
8902
|
+
value: txResult,
|
|
8903
|
+
data: {
|
|
8904
|
+
address: hubWallet,
|
|
8905
|
+
payload: data
|
|
8906
|
+
}
|
|
8907
|
+
};
|
|
8411
8908
|
}
|
|
8412
8909
|
/**
|
|
8413
8910
|
* Build transaction data for supplying to the money market pool
|
|
@@ -8417,7 +8914,7 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8417
8914
|
* @param spokeChainId - The chain ID of the spoke chain
|
|
8418
8915
|
* @returns {Hex} The transaction data.
|
|
8419
8916
|
*/
|
|
8420
|
-
|
|
8917
|
+
buildSupplyData(token, to, amount, spokeChainId) {
|
|
8421
8918
|
const calls = [];
|
|
8422
8919
|
const assetConfig = getHubAssetInfo(spokeChainId, token);
|
|
8423
8920
|
invariant2__default.default(assetConfig, `hub asset not found for spoke chain token (token): ${token}`);
|
|
@@ -8445,7 +8942,7 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8445
8942
|
* @param spokeChainId - The chain ID of the spoke chain
|
|
8446
8943
|
* @returns {Hex} The transaction data.
|
|
8447
8944
|
*/
|
|
8448
|
-
|
|
8945
|
+
buildBorrowData(from, to, token, amount, spokeChainId) {
|
|
8449
8946
|
invariant2__default.default(isValidSpokeChainId(spokeChainId), `Invalid spokeChainId: ${spokeChainId}`);
|
|
8450
8947
|
invariant2__default.default(
|
|
8451
8948
|
isValidOriginalAssetAddress(spokeChainId, token),
|
|
@@ -8520,7 +9017,7 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8520
9017
|
* @param spokeChainId - The chain ID of the spoke chain
|
|
8521
9018
|
* @returns {Hex} The transaction data.
|
|
8522
9019
|
*/
|
|
8523
|
-
|
|
9020
|
+
buildWithdrawData(from, to, token, amount, spokeChainId) {
|
|
8524
9021
|
const calls = [];
|
|
8525
9022
|
const assetConfig = getHubAssetInfo(spokeChainId, token);
|
|
8526
9023
|
if (!assetConfig) {
|
|
@@ -8571,11 +9068,11 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
8571
9068
|
* @param spokeChainId - The chain ID of the spoke chain
|
|
8572
9069
|
* @returns {Hex} The transaction data.
|
|
8573
9070
|
*/
|
|
8574
|
-
|
|
9071
|
+
buildRepayData(token, to, amount, spokeChainId) {
|
|
8575
9072
|
const calls = [];
|
|
8576
9073
|
const assetConfig = getHubAssetInfo(spokeChainId, token);
|
|
8577
9074
|
if (!assetConfig) {
|
|
8578
|
-
throw new Error("[
|
|
9075
|
+
throw new Error("[buildRepayData] Hub asset not found");
|
|
8579
9076
|
}
|
|
8580
9077
|
const assetAddress = assetConfig.asset;
|
|
8581
9078
|
const vaultAddress = assetConfig.vault;
|
|
@@ -8921,16 +9418,16 @@ var EvmSpokeService = class _EvmSpokeService {
|
|
|
8921
9418
|
return spokeProvider.walletProvider.sendTransaction(rawTx);
|
|
8922
9419
|
}
|
|
8923
9420
|
};
|
|
8924
|
-
var
|
|
9421
|
+
var InjectiveSpokeService = class _InjectiveSpokeService {
|
|
8925
9422
|
constructor() {
|
|
8926
9423
|
}
|
|
8927
9424
|
/**
|
|
8928
9425
|
* Deposit tokens to the spoke chain.
|
|
8929
|
-
* @param {
|
|
8930
|
-
* @param {
|
|
9426
|
+
* @param {InjectiveSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
|
|
9427
|
+
* @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
|
|
8931
9428
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
8932
9429
|
* @param {boolean} raw - The return type raw or just transaction hash
|
|
8933
|
-
* @returns {
|
|
9430
|
+
* @returns {PromiseInjectiveTxReturnType<R>} A promise that resolves to the transaction hash.
|
|
8934
9431
|
*/
|
|
8935
9432
|
static async deposit(params, spokeProvider, hubProvider, raw) {
|
|
8936
9433
|
const userWallet = params.to ?? await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
@@ -8938,7 +9435,7 @@ var CWSpokeService = class _CWSpokeService {
|
|
|
8938
9435
|
viem.toHex(Buffer.from(params.from, "utf-8")),
|
|
8939
9436
|
hubProvider
|
|
8940
9437
|
);
|
|
8941
|
-
return
|
|
9438
|
+
return _InjectiveSpokeService.transfer(
|
|
8942
9439
|
{
|
|
8943
9440
|
token: params.token,
|
|
8944
9441
|
recipient: userWallet,
|
|
@@ -8952,7 +9449,7 @@ var CWSpokeService = class _CWSpokeService {
|
|
|
8952
9449
|
/**
|
|
8953
9450
|
* Get the balance of the token in the spoke chain.
|
|
8954
9451
|
* @param {Address} token - The address of the token to get the balance of.
|
|
8955
|
-
* @param {
|
|
9452
|
+
* @param {InjectiveSpokeProvider} spokeProvider - The spoke provider.
|
|
8956
9453
|
* @returns {Promise<bigint>} The balance of the token.
|
|
8957
9454
|
*/
|
|
8958
9455
|
static async getDeposit(token, spokeProvider) {
|
|
@@ -8963,43 +9460,43 @@ var CWSpokeService = class _CWSpokeService {
|
|
|
8963
9460
|
* Calls a contract on the spoke chain using the user's wallet.
|
|
8964
9461
|
* @param {HubAddress} from - The address of the user on the hub chain.
|
|
8965
9462
|
* @param {Hex} payload - The payload to send to the contract.
|
|
8966
|
-
* @param {
|
|
9463
|
+
* @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
|
|
8967
9464
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
8968
|
-
* @returns {
|
|
9465
|
+
* @returns {PromiseInjectiveTxReturnType<R>} A promise that resolves to the transaction hash.
|
|
8969
9466
|
*/
|
|
8970
9467
|
static async callWallet(from, payload, spokeProvider, hubProvider, raw) {
|
|
8971
9468
|
const relayId = getIntentRelayChainId(hubProvider.chainConfig.chain.id);
|
|
8972
|
-
return
|
|
9469
|
+
return _InjectiveSpokeService.call(BigInt(relayId), from, payload, spokeProvider, raw);
|
|
8973
9470
|
}
|
|
8974
9471
|
/**
|
|
8975
9472
|
* Transfers tokens to the hub chain.
|
|
8976
|
-
* @param {
|
|
9473
|
+
* @param {InjectiveTransferToHubParams} params - The parameters for the transfer, including:
|
|
8977
9474
|
* - {string} token: The address of the token to transfer (use address(0) for native token).
|
|
8978
9475
|
* - {Uint8Array} recipient: The recipient address on the hub chain.
|
|
8979
9476
|
* - {string} amount: The amount to transfer.
|
|
8980
9477
|
* - {Uint8Array} [data=new Uint8Array([])]: Additional data for the transfer.
|
|
8981
|
-
* @param {
|
|
9478
|
+
* @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
|
|
8982
9479
|
* @param {boolean} raw - The return type raw or just transaction hash
|
|
8983
|
-
* @returns {
|
|
9480
|
+
* @returns {PromiseInjectiveTxReturnType<R>} A promise that resolves to the transaction hash.
|
|
8984
9481
|
*/
|
|
8985
9482
|
static async transfer({ token, recipient, amount, data = "0x" }, spokeProvider, raw) {
|
|
8986
9483
|
const sender = await spokeProvider.walletProvider.getWalletAddress();
|
|
8987
|
-
return
|
|
9484
|
+
return InjectiveSpokeProvider.deposit(sender, token, recipient, amount, data, spokeProvider, raw);
|
|
8988
9485
|
}
|
|
8989
9486
|
/**
|
|
8990
9487
|
* Sends a message to the hub chain.
|
|
8991
9488
|
* @param {bigint} dstChainId - The chain ID of the hub chain.
|
|
8992
9489
|
* @param {Address} dstAddress - The address on the hub chain.
|
|
8993
9490
|
* @param {Hex} payload - The payload to send.
|
|
8994
|
-
* @param {
|
|
8995
|
-
* @returns {
|
|
9491
|
+
* @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
|
|
9492
|
+
* @returns {PromiseInjectiveTxReturnType<R>} A promise that resolves to the transaction hash.
|
|
8996
9493
|
*/
|
|
8997
9494
|
static async call(dstChainId, dstAddress, payload, spokeProvider, raw) {
|
|
8998
9495
|
const sender = await spokeProvider.walletProvider.getWalletAddress();
|
|
8999
9496
|
return spokeProvider.send_message(sender, dstChainId.toString(), dstAddress, payload, raw);
|
|
9000
9497
|
}
|
|
9001
9498
|
};
|
|
9002
|
-
var IconSdk2 = IconSdkRaw__namespace.default
|
|
9499
|
+
var IconSdk2 = "default" in IconSdkRaw__namespace.default ? IconSdkRaw__namespace.default : IconSdkRaw__namespace;
|
|
9003
9500
|
var { Converter, CallTransactionBuilder, CallBuilder } = IconSdk2;
|
|
9004
9501
|
var IconSpokeService = class _IconSpokeService {
|
|
9005
9502
|
constructor() {
|
|
@@ -9195,7 +9692,7 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
9195
9692
|
static async deposit(params, spokeProvider, hubProvider, raw) {
|
|
9196
9693
|
const userWallet = params.to ?? await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
9197
9694
|
spokeProvider.chainConfig.chain.id,
|
|
9198
|
-
|
|
9695
|
+
encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
9199
9696
|
hubProvider
|
|
9200
9697
|
);
|
|
9201
9698
|
return _SolanaSpokeService.transfer(
|
|
@@ -9203,7 +9700,7 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
9203
9700
|
token: new web3_js.PublicKey(params.token),
|
|
9204
9701
|
recipient: userWallet,
|
|
9205
9702
|
amount: params.amount.toString(),
|
|
9206
|
-
data: params.data
|
|
9703
|
+
data: viem.keccak256(params.data)
|
|
9207
9704
|
},
|
|
9208
9705
|
spokeProvider,
|
|
9209
9706
|
raw
|
|
@@ -9237,7 +9734,7 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
9237
9734
|
*/
|
|
9238
9735
|
static async callWallet(from, payload, spokeProvider, hubProvider, raw) {
|
|
9239
9736
|
const relayId = getIntentRelayChainId(hubProvider.chainConfig.chain.id);
|
|
9240
|
-
return _SolanaSpokeService.call(BigInt(relayId), from, payload, spokeProvider, raw);
|
|
9737
|
+
return _SolanaSpokeService.call(BigInt(relayId), from, viem.keccak256(payload), spokeProvider, raw);
|
|
9241
9738
|
}
|
|
9242
9739
|
static async transfer({ token, recipient, amount, data }, spokeProvider, raw) {
|
|
9243
9740
|
let depositInstruction;
|
|
@@ -9428,7 +9925,7 @@ var SuiSpokeService = class _SuiSpokeService {
|
|
|
9428
9925
|
}
|
|
9429
9926
|
/**
|
|
9430
9927
|
* Deposit tokens to the spoke chain.
|
|
9431
|
-
* @param {
|
|
9928
|
+
* @param {InjectiveSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
|
|
9432
9929
|
* @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
|
|
9433
9930
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
9434
9931
|
* @param {boolean} raw - The return type raw or just transaction hash
|
|
@@ -9790,9 +10287,9 @@ var SonicSpokeService = class _SonicSpokeService {
|
|
|
9790
10287
|
}
|
|
9791
10288
|
return spokeProvider.walletProvider.sendTransaction(rawTx);
|
|
9792
10289
|
}
|
|
9793
|
-
static async
|
|
10290
|
+
static async buildWithdrawData(from, withdrawInfo, amount, spokeProvider, moneyMarketService) {
|
|
9794
10291
|
const userRouter = await _SonicSpokeService.getUserRouter(from, spokeProvider);
|
|
9795
|
-
const withdrawCall = moneyMarketService.
|
|
10292
|
+
const withdrawCall = moneyMarketService.buildWithdrawData(
|
|
9796
10293
|
userRouter,
|
|
9797
10294
|
from,
|
|
9798
10295
|
withdrawInfo.token,
|
|
@@ -9878,8 +10375,8 @@ function isSolanaSpokeProvider(value) {
|
|
|
9878
10375
|
function isStellarSpokeProvider(value) {
|
|
9879
10376
|
return typeof value === "object" && value !== null && value instanceof StellarSpokeProvider && value.chainConfig.chain.type === "STELLAR";
|
|
9880
10377
|
}
|
|
9881
|
-
function
|
|
9882
|
-
return typeof value === "object" && value !== null && value instanceof
|
|
10378
|
+
function isInjectiveSpokeProvider(value) {
|
|
10379
|
+
return typeof value === "object" && value !== null && value instanceof InjectiveSpokeProvider && value.chainConfig.chain.type === "INJECTIVE";
|
|
9883
10380
|
}
|
|
9884
10381
|
function isIconSpokeProvider(value) {
|
|
9885
10382
|
return typeof value === "object" && value !== null && value instanceof IconSpokeProvider && value.chainConfig.chain.type === "ICON";
|
|
@@ -9893,6 +10390,51 @@ function isConfiguredSolverConfig(value) {
|
|
|
9893
10390
|
function isConfiguredMoneyMarketConfig(value) {
|
|
9894
10391
|
return typeof value === "object" && value !== null && "lendingPool" in value && "uiPoolDataProvider" in value && "poolAddressesProvider" in value && "bnUSD" in value && "bnUSDVault" in value;
|
|
9895
10392
|
}
|
|
10393
|
+
function isIntentCreationFailedError(error) {
|
|
10394
|
+
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;
|
|
10395
|
+
}
|
|
10396
|
+
function isIntentSubmitTxFailedError(error) {
|
|
10397
|
+
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;
|
|
10398
|
+
}
|
|
10399
|
+
function isIntentPostExecutionFailedError(error) {
|
|
10400
|
+
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;
|
|
10401
|
+
}
|
|
10402
|
+
function isWaitUntilIntentExecutedFailed(error) {
|
|
10403
|
+
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;
|
|
10404
|
+
}
|
|
10405
|
+
function isIntentCreationUnknownError(error) {
|
|
10406
|
+
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;
|
|
10407
|
+
}
|
|
10408
|
+
function isMoneyMarketSubmitTxFailedError(error) {
|
|
10409
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "SUBMIT_TX_FAILED";
|
|
10410
|
+
}
|
|
10411
|
+
function isMoneyMarketRelayTimeoutError(error) {
|
|
10412
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "RELAY_TIMEOUT";
|
|
10413
|
+
}
|
|
10414
|
+
function isMoneyMarketCreateSupplyIntentFailedError(error) {
|
|
10415
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "CREATE_SUPPLY_INTENT_FAILED";
|
|
10416
|
+
}
|
|
10417
|
+
function isMoneyMarketCreateBorrowIntentFailedError(error) {
|
|
10418
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "CREATE_BORROW_INTENT_FAILED";
|
|
10419
|
+
}
|
|
10420
|
+
function isMoneyMarketCreateWithdrawIntentFailedError(error) {
|
|
10421
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "CREATE_WITHDRAW_INTENT_FAILED";
|
|
10422
|
+
}
|
|
10423
|
+
function isMoneyMarketCreateRepayIntentFailedError(error) {
|
|
10424
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "CREATE_REPAY_INTENT_FAILED";
|
|
10425
|
+
}
|
|
10426
|
+
function isMoneyMarketSupplyUnknownError(error) {
|
|
10427
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "SUPPLY_UNKNOWN_ERROR";
|
|
10428
|
+
}
|
|
10429
|
+
function isMoneyMarketBorrowUnknownError(error) {
|
|
10430
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "BORROW_UNKNOWN_ERROR";
|
|
10431
|
+
}
|
|
10432
|
+
function isMoneyMarketWithdrawUnknownError(error) {
|
|
10433
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "WITHDRAW_UNKNOWN_ERROR";
|
|
10434
|
+
}
|
|
10435
|
+
function isMoneyMarketRepayUnknownError(error) {
|
|
10436
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "REPAY_UNKNOWN_ERROR";
|
|
10437
|
+
}
|
|
9896
10438
|
|
|
9897
10439
|
// src/services/spoke/SpokeService.ts
|
|
9898
10440
|
var SpokeService = class {
|
|
@@ -9921,8 +10463,8 @@ var SpokeService = class {
|
|
|
9921
10463
|
raw
|
|
9922
10464
|
);
|
|
9923
10465
|
}
|
|
9924
|
-
if (spokeProvider instanceof
|
|
9925
|
-
return
|
|
10466
|
+
if (spokeProvider instanceof InjectiveSpokeProvider) {
|
|
10467
|
+
return InjectiveSpokeService.deposit(
|
|
9926
10468
|
params,
|
|
9927
10469
|
spokeProvider,
|
|
9928
10470
|
hubProvider,
|
|
@@ -9973,8 +10515,8 @@ var SpokeService = class {
|
|
|
9973
10515
|
if (spokeProvider instanceof EvmSpokeProvider) {
|
|
9974
10516
|
return EvmSpokeService.getDeposit(token, spokeProvider);
|
|
9975
10517
|
}
|
|
9976
|
-
if (spokeProvider instanceof
|
|
9977
|
-
return
|
|
10518
|
+
if (spokeProvider instanceof InjectiveSpokeProvider) {
|
|
10519
|
+
return InjectiveSpokeService.getDeposit(token, spokeProvider);
|
|
9978
10520
|
}
|
|
9979
10521
|
if (spokeProvider instanceof StellarSpokeProvider) {
|
|
9980
10522
|
return StellarSpokeService.getDeposit(token, spokeProvider);
|
|
@@ -10008,8 +10550,14 @@ var SpokeService = class {
|
|
|
10008
10550
|
if (isEvmSpokeProvider(spokeProvider)) {
|
|
10009
10551
|
return await EvmSpokeService.callWallet(from, payload, spokeProvider, hubProvider);
|
|
10010
10552
|
}
|
|
10011
|
-
if (
|
|
10012
|
-
return await
|
|
10553
|
+
if (isInjectiveSpokeProvider(spokeProvider)) {
|
|
10554
|
+
return await InjectiveSpokeService.callWallet(
|
|
10555
|
+
from,
|
|
10556
|
+
payload,
|
|
10557
|
+
spokeProvider,
|
|
10558
|
+
hubProvider,
|
|
10559
|
+
raw
|
|
10560
|
+
);
|
|
10013
10561
|
}
|
|
10014
10562
|
if (isIconSpokeProvider(spokeProvider)) {
|
|
10015
10563
|
return await IconSpokeService.callWallet(from, payload, spokeProvider, hubProvider, raw);
|
|
@@ -10089,12 +10637,12 @@ async function waitUntilIntentExecuted(payload) {
|
|
|
10089
10637
|
} catch (e) {
|
|
10090
10638
|
console.error("Error getting transaction packets", e);
|
|
10091
10639
|
}
|
|
10092
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
10640
|
+
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
10093
10641
|
}
|
|
10094
10642
|
return {
|
|
10095
10643
|
ok: false,
|
|
10096
10644
|
error: {
|
|
10097
|
-
code: "
|
|
10645
|
+
code: "RELAY_TIMEOUT",
|
|
10098
10646
|
data: {
|
|
10099
10647
|
payload,
|
|
10100
10648
|
error: {
|
|
@@ -10108,7 +10656,7 @@ async function waitUntilIntentExecuted(payload) {
|
|
|
10108
10656
|
return {
|
|
10109
10657
|
ok: false,
|
|
10110
10658
|
error: {
|
|
10111
|
-
code: "
|
|
10659
|
+
code: "RELAY_TIMEOUT",
|
|
10112
10660
|
data: {
|
|
10113
10661
|
payload,
|
|
10114
10662
|
error: e
|
|
@@ -10117,12 +10665,16 @@ async function waitUntilIntentExecuted(payload) {
|
|
|
10117
10665
|
};
|
|
10118
10666
|
}
|
|
10119
10667
|
}
|
|
10120
|
-
async function relayTxAndWaitPacket(spokeTxHash, spokeProvider, relayerApiEndpoint, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
|
|
10668
|
+
async function relayTxAndWaitPacket(spokeTxHash, data, spokeProvider, relayerApiEndpoint, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
|
|
10121
10669
|
try {
|
|
10122
10670
|
const intentRelayChainId = getIntentRelayChainId(spokeProvider.chainConfig.chain.id).toString();
|
|
10123
10671
|
const submitPayload = {
|
|
10124
10672
|
action: "submit",
|
|
10125
|
-
params: {
|
|
10673
|
+
params: data ? {
|
|
10674
|
+
chain_id: intentRelayChainId,
|
|
10675
|
+
tx_hash: spokeTxHash,
|
|
10676
|
+
data
|
|
10677
|
+
} : {
|
|
10126
10678
|
chain_id: intentRelayChainId,
|
|
10127
10679
|
tx_hash: spokeTxHash
|
|
10128
10680
|
}
|
|
@@ -10147,7 +10699,7 @@ async function relayTxAndWaitPacket(spokeTxHash, spokeProvider, relayerApiEndpoi
|
|
|
10147
10699
|
return {
|
|
10148
10700
|
ok: false,
|
|
10149
10701
|
error: {
|
|
10150
|
-
code: "
|
|
10702
|
+
code: "RELAY_TIMEOUT",
|
|
10151
10703
|
error: packet.error
|
|
10152
10704
|
}
|
|
10153
10705
|
};
|
|
@@ -10160,7 +10712,7 @@ async function relayTxAndWaitPacket(spokeTxHash, spokeProvider, relayerApiEndpoi
|
|
|
10160
10712
|
return {
|
|
10161
10713
|
ok: false,
|
|
10162
10714
|
error: {
|
|
10163
|
-
code: "
|
|
10715
|
+
code: "SUBMIT_TX_FAILED",
|
|
10164
10716
|
error
|
|
10165
10717
|
}
|
|
10166
10718
|
};
|
|
@@ -10198,6 +10750,8 @@ var EvmSolverService = class _EvmSolverService {
|
|
|
10198
10750
|
outputToken,
|
|
10199
10751
|
srcChain: getIntentRelayChainId(createIntentParams.srcChain),
|
|
10200
10752
|
dstChain: getIntentRelayChainId(createIntentParams.dstChain),
|
|
10753
|
+
srcAddress: encodeAddress(createIntentParams.srcChain, createIntentParams.srcAddress),
|
|
10754
|
+
dstAddress: encodeAddress(createIntentParams.dstChain, createIntentParams.dstAddress),
|
|
10201
10755
|
intentId: randomUint256(),
|
|
10202
10756
|
creator: creatorHubWalletAddress,
|
|
10203
10757
|
data: feeData
|
|
@@ -10425,7 +10979,7 @@ var SolverApiService = class {
|
|
|
10425
10979
|
* }
|
|
10426
10980
|
* }
|
|
10427
10981
|
*/
|
|
10428
|
-
static async postExecution(
|
|
10982
|
+
static async postExecution(request, config) {
|
|
10429
10983
|
try {
|
|
10430
10984
|
const response = await retry(
|
|
10431
10985
|
() => fetch(`${config.solverApiEndpoint}/execute`, {
|
|
@@ -10433,7 +10987,7 @@ var SolverApiService = class {
|
|
|
10433
10987
|
headers: {
|
|
10434
10988
|
"Content-Type": "application/json"
|
|
10435
10989
|
},
|
|
10436
|
-
body: JSON.stringify(
|
|
10990
|
+
body: JSON.stringify(request)
|
|
10437
10991
|
})
|
|
10438
10992
|
);
|
|
10439
10993
|
if (!response.ok) {
|
|
@@ -10459,15 +11013,15 @@ var SolverApiService = class {
|
|
|
10459
11013
|
};
|
|
10460
11014
|
}
|
|
10461
11015
|
}
|
|
10462
|
-
static async getStatus(
|
|
10463
|
-
invariant2__default.default(
|
|
11016
|
+
static async getStatus(request, config) {
|
|
11017
|
+
invariant2__default.default(request.intent_tx_hash.length > 0, "Empty intent_tx_hash");
|
|
10464
11018
|
try {
|
|
10465
11019
|
const response = await fetch(`${config.solverApiEndpoint}/status`, {
|
|
10466
11020
|
method: "POST",
|
|
10467
11021
|
headers: {
|
|
10468
11022
|
"Content-Type": "application/json"
|
|
10469
11023
|
},
|
|
10470
|
-
body: JSON.stringify(
|
|
11024
|
+
body: JSON.stringify(request)
|
|
10471
11025
|
});
|
|
10472
11026
|
if (!response.ok) {
|
|
10473
11027
|
return {
|
|
@@ -10526,8 +11080,8 @@ var SolverService = class {
|
|
|
10526
11080
|
}
|
|
10527
11081
|
/**
|
|
10528
11082
|
* Request a quote from the solver API
|
|
10529
|
-
* @param {
|
|
10530
|
-
* @returns {Promise<Result<
|
|
11083
|
+
* @param {SolverIntentQuoteRequest} payload - The solver intent quote request
|
|
11084
|
+
* @returns {Promise<Result<SolverIntentQuoteResponse, SolverErrorResponse>>} The intent quote response
|
|
10531
11085
|
*
|
|
10532
11086
|
* @example
|
|
10533
11087
|
* const payload = {
|
|
@@ -10537,7 +11091,7 @@ var SolverService = class {
|
|
|
10537
11091
|
* "token_dst_blockchain_id":"0xa4b1.arbitrum",
|
|
10538
11092
|
* "amount":1000000000000000n,
|
|
10539
11093
|
* "quote_type": "exact_input"
|
|
10540
|
-
* } satisfies
|
|
11094
|
+
* } satisfies SolverIntentQuoteRequest
|
|
10541
11095
|
*
|
|
10542
11096
|
* const response = await solverService.getQuote(payload);
|
|
10543
11097
|
*
|
|
@@ -10569,15 +11123,15 @@ var SolverService = class {
|
|
|
10569
11123
|
/**
|
|
10570
11124
|
* Get the status of an intent from Solver API
|
|
10571
11125
|
* NOTE: intentHash should be retrieved from relay packet dst_tx_hash property (see createAndSubmitIntent)
|
|
10572
|
-
* @param {
|
|
10573
|
-
* @returns {Promise<Result<
|
|
11126
|
+
* @param {SolverIntentStatusRequest} request - The intent status request
|
|
11127
|
+
* @returns {Promise<Result<SolverIntentStatusResponse, SolverErrorResponse>>} The solver intent status response
|
|
10574
11128
|
*
|
|
10575
11129
|
* @example
|
|
10576
|
-
* const
|
|
10577
|
-
* "
|
|
10578
|
-
* } satisfies
|
|
11130
|
+
* const request = {
|
|
11131
|
+
* "intent_tx_hash": "a0dd7652-b360-4123-ab2d-78cfbcd20c6b" // destination tx hash from relay packet
|
|
11132
|
+
* } satisfies SolverIntentStatusRequest
|
|
10579
11133
|
*
|
|
10580
|
-
* const response = await solverService.getStatus(
|
|
11134
|
+
* const response = await solverService.getStatus(request);
|
|
10581
11135
|
*
|
|
10582
11136
|
* if (response.ok) {
|
|
10583
11137
|
* const { status, intent_hash } = response.value;
|
|
@@ -10587,20 +11141,20 @@ var SolverService = class {
|
|
|
10587
11141
|
* // handle error
|
|
10588
11142
|
* }
|
|
10589
11143
|
*/
|
|
10590
|
-
async getStatus(
|
|
10591
|
-
return SolverApiService.getStatus(
|
|
11144
|
+
async getStatus(request) {
|
|
11145
|
+
return SolverApiService.getStatus(request, this.config);
|
|
10592
11146
|
}
|
|
10593
11147
|
/**
|
|
10594
11148
|
* Post execution of intent order transaction executed on hub chain to Solver API
|
|
10595
|
-
* @param {
|
|
10596
|
-
* @returns {Promise<Result<
|
|
11149
|
+
* @param {SolverExecutionRequest} request - The intent execution request
|
|
11150
|
+
* @returns {Promise<Result<SolverExecutionResponse, SolverErrorResponse>>} The intent execution response
|
|
10597
11151
|
*
|
|
10598
11152
|
* @example
|
|
10599
|
-
* const
|
|
11153
|
+
* const request = {
|
|
10600
11154
|
* "intent_tx_hash": "0xba3dce19347264db32ced212ff1a2036f20d9d2c7493d06af15027970be061af",
|
|
10601
|
-
* } satisfies
|
|
11155
|
+
* } satisfies SolverExecutionRequest
|
|
10602
11156
|
*
|
|
10603
|
-
* const response = await solverService.postExecution(
|
|
11157
|
+
* const response = await solverService.postExecution(request);
|
|
10604
11158
|
*
|
|
10605
11159
|
* if (response.ok) {
|
|
10606
11160
|
* const { answer, intent_hash } = response.value;
|
|
@@ -10610,15 +11164,108 @@ var SolverService = class {
|
|
|
10610
11164
|
* // handle error
|
|
10611
11165
|
* }
|
|
10612
11166
|
*/
|
|
10613
|
-
async postExecution(
|
|
10614
|
-
return SolverApiService.postExecution(
|
|
11167
|
+
async postExecution(request) {
|
|
11168
|
+
return SolverApiService.postExecution(request, this.config);
|
|
11169
|
+
}
|
|
11170
|
+
/**
|
|
11171
|
+
* Submit intent transaction to the relayer API
|
|
11172
|
+
* @param {IntentRelayRequest<'submit'>} submitPayload - The intent relay request
|
|
11173
|
+
* @returns {Promise<Result<GetRelayResponse<'submit'>, IntentError<'SUBMIT_TX_FAILED'>>>} The intent relay response
|
|
11174
|
+
*
|
|
11175
|
+
* @example
|
|
11176
|
+
* const submitPayload = {
|
|
11177
|
+
* "action": "submit",
|
|
11178
|
+
* "params": {
|
|
11179
|
+
* "chain_id": "0x38.bsc",
|
|
11180
|
+
* "tx_hash": "0xba3dce19347264db32ced212ff1a2036f20d9d2c7493d06af15027970be061af",
|
|
11181
|
+
* },
|
|
11182
|
+
* } satisfies IntentRelayRequest<'submit'>;
|
|
11183
|
+
*
|
|
11184
|
+
* const submitResult = await solverService.submitIntent(submitPayload);
|
|
11185
|
+
*
|
|
11186
|
+
* if (submitResult.ok) {
|
|
11187
|
+
* const { success, message } = submitResult.value;
|
|
11188
|
+
* console.log('Success:', success);
|
|
11189
|
+
* console.log('Message:', message);
|
|
11190
|
+
* } else {
|
|
11191
|
+
* // handle error
|
|
11192
|
+
* }
|
|
11193
|
+
*/
|
|
11194
|
+
async submitIntent(submitPayload) {
|
|
11195
|
+
try {
|
|
11196
|
+
const submitResult = await submitTransaction(submitPayload, this.config.relayerApiEndpoint);
|
|
11197
|
+
if (!submitResult.success) {
|
|
11198
|
+
return {
|
|
11199
|
+
ok: false,
|
|
11200
|
+
error: {
|
|
11201
|
+
code: "SUBMIT_TX_FAILED",
|
|
11202
|
+
data: {
|
|
11203
|
+
payload: submitPayload,
|
|
11204
|
+
error: new Error(submitResult.message)
|
|
11205
|
+
}
|
|
11206
|
+
}
|
|
11207
|
+
};
|
|
11208
|
+
}
|
|
11209
|
+
return {
|
|
11210
|
+
ok: true,
|
|
11211
|
+
value: submitResult
|
|
11212
|
+
};
|
|
11213
|
+
} catch (error) {
|
|
11214
|
+
return {
|
|
11215
|
+
ok: false,
|
|
11216
|
+
error: {
|
|
11217
|
+
code: "SUBMIT_TX_FAILED",
|
|
11218
|
+
data: {
|
|
11219
|
+
payload: submitPayload,
|
|
11220
|
+
error
|
|
11221
|
+
}
|
|
11222
|
+
}
|
|
11223
|
+
};
|
|
11224
|
+
}
|
|
11225
|
+
}
|
|
11226
|
+
/**
|
|
11227
|
+
* Swap is a syntatic sugar for createAndSubmitIntent that creates an intent and submits it to the Solver API and Relayer API
|
|
11228
|
+
* @param {CreateIntentParams} payload - The intent to create
|
|
11229
|
+
* @param {ISpokeProvider} spokeProvider - The spoke provider
|
|
11230
|
+
* @param {number} timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
11231
|
+
* @returns {Promise<Result<[SolverExecutionResponse, Intent, PacketData], IntentError<IntentErrorCode>>>} The solver execution response, intent, and packet data
|
|
11232
|
+
*
|
|
11233
|
+
* @example
|
|
11234
|
+
* const payload = {
|
|
11235
|
+
* "inputToken": "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", // BSC ETH token address
|
|
11236
|
+
* "outputToken": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", // ARB WBTC token address
|
|
11237
|
+
* "inputAmount": 1000000000000000n, // The amount of input tokens
|
|
11238
|
+
* "minOutputAmount": 900000000000000n, // min amount you are expecting to receive
|
|
11239
|
+
* "deadline": 0n, // Optional timestamp after which intent expires (0 = no deadline)
|
|
11240
|
+
* "allowPartialFill": false, // Whether the intent can be partially filled
|
|
11241
|
+
* "srcChain": "0x38.bsc", // Chain ID where input tokens originate
|
|
11242
|
+
* "dstChain": "0xa4b1.arbitrum", // Chain ID where output tokens should be delivered
|
|
11243
|
+
* "srcAddress": "0x..", // Source address (original address on spoke chain)
|
|
11244
|
+
* "dstAddress": "0x...", // Destination address (original address on spoke chain)
|
|
11245
|
+
* "solver": "0x..", // Optional specific solver address (address(0) = any solver)
|
|
11246
|
+
* "data": "0x..", // Additional arbitrary data
|
|
11247
|
+
* } satisfies CreateIntentParams;
|
|
11248
|
+
*
|
|
11249
|
+
* const swapResult = await solverService.swap(payload, spokeProvider);
|
|
11250
|
+
*
|
|
11251
|
+
* if (swapResult.ok) {
|
|
11252
|
+
* const [solverExecutionResponse, intent, packetData] = swapResult.value;
|
|
11253
|
+
* console.log('Intent execution response:', solverExecutionResponse);
|
|
11254
|
+
* console.log('Intent:', intent);
|
|
11255
|
+
* console.log('Packet data:', packetData);
|
|
11256
|
+
* } else {
|
|
11257
|
+
* // handle error
|
|
11258
|
+
* }
|
|
11259
|
+
*/
|
|
11260
|
+
async swap(payload, spokeProvider, fee, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
|
|
11261
|
+
return this.createAndSubmitIntent(payload, spokeProvider, fee, timeout);
|
|
10615
11262
|
}
|
|
10616
11263
|
/**
|
|
10617
11264
|
* Creates an intent and submits it to the Solver API and Relayer API
|
|
10618
11265
|
* @param {CreateIntentParams} payload - The intent to create
|
|
10619
11266
|
* @param {ISpokeProvider} spokeProvider - The spoke provider
|
|
10620
11267
|
* @param {number} timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
10621
|
-
* @returns {Promise<Result<[
|
|
11268
|
+
* @returns {Promise<Result<[SolverExecutionResponse, Intent, PacketData], IntentError<IntentErrorCode>>>} The solver execution response, intent, and packet data
|
|
10622
11269
|
*
|
|
10623
11270
|
* @example
|
|
10624
11271
|
* const payload = {
|
|
@@ -10630,8 +11277,8 @@ var SolverService = class {
|
|
|
10630
11277
|
* "allowPartialFill": false, // Whether the intent can be partially filled
|
|
10631
11278
|
* "srcChain": "0x38.bsc", // Chain ID where input tokens originate
|
|
10632
11279
|
* "dstChain": "0xa4b1.arbitrum", // Chain ID where output tokens should be delivered
|
|
10633
|
-
* "srcAddress": "0x..", // Source address
|
|
10634
|
-
* "dstAddress": "0x...", // Destination address
|
|
11280
|
+
* "srcAddress": "0x..", // Source address (original address on spoke chain)
|
|
11281
|
+
* "dstAddress": "0x...", // Destination address (original address on spoke chain)
|
|
10635
11282
|
* "solver": "0x..", // Optional specific solver address (address(0) = any solver)
|
|
10636
11283
|
* "data": "0x..", // Additional arbitrary data
|
|
10637
11284
|
* } satisfies CreateIntentParams;
|
|
@@ -10639,8 +11286,8 @@ var SolverService = class {
|
|
|
10639
11286
|
* const createAndSubmitIntentResult = await solverService.createAndSubmitIntent(payload, spokeProvider);
|
|
10640
11287
|
*
|
|
10641
11288
|
* if (createAndSubmitIntentResult.ok) {
|
|
10642
|
-
* const [
|
|
10643
|
-
* console.log('Intent execution response:',
|
|
11289
|
+
* const [solverExecutionResponse, intent, packetData] = createAndSubmitIntentResult.value;
|
|
11290
|
+
* console.log('Intent execution response:', solverExecutionResponse);
|
|
10644
11291
|
* console.log('Intent:', intent);
|
|
10645
11292
|
* console.log('Packet data:', packetData);
|
|
10646
11293
|
* } else {
|
|
@@ -10651,32 +11298,30 @@ var SolverService = class {
|
|
|
10651
11298
|
try {
|
|
10652
11299
|
const createIntentResult = await this.createIntent(payload, spokeProvider, fee, false);
|
|
10653
11300
|
if (!createIntentResult.ok) {
|
|
10654
|
-
return
|
|
10655
|
-
ok: false,
|
|
10656
|
-
error: createIntentResult.error
|
|
10657
|
-
};
|
|
11301
|
+
return createIntentResult;
|
|
10658
11302
|
}
|
|
10659
|
-
const [spokeTxHash, intent] = createIntentResult.value;
|
|
11303
|
+
const [spokeTxHash, intent, data] = createIntentResult.value;
|
|
10660
11304
|
const intentRelayChainId = getIntentRelayChainId(payload.srcChain).toString();
|
|
10661
|
-
const submitPayload = {
|
|
11305
|
+
const submitPayload = payload.srcChain === types.SOLANA_MAINNET_CHAIN_ID && data ? {
|
|
11306
|
+
action: "submit",
|
|
11307
|
+
params: {
|
|
11308
|
+
chain_id: intentRelayChainId,
|
|
11309
|
+
tx_hash: spokeTxHash,
|
|
11310
|
+
data: {
|
|
11311
|
+
address: intent.creator,
|
|
11312
|
+
payload: data
|
|
11313
|
+
}
|
|
11314
|
+
}
|
|
11315
|
+
} : {
|
|
10662
11316
|
action: "submit",
|
|
10663
11317
|
params: {
|
|
10664
11318
|
chain_id: intentRelayChainId,
|
|
10665
11319
|
tx_hash: spokeTxHash
|
|
10666
11320
|
}
|
|
10667
11321
|
};
|
|
10668
|
-
const submitResult = await
|
|
10669
|
-
if (!submitResult.
|
|
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
|
-
};
|
|
11322
|
+
const submitResult = await this.submitIntent(submitPayload);
|
|
11323
|
+
if (!submitResult.ok) {
|
|
11324
|
+
return submitResult;
|
|
10680
11325
|
}
|
|
10681
11326
|
const packet = await waitUntilIntentExecuted({
|
|
10682
11327
|
intentRelayChainId,
|
|
@@ -10735,8 +11380,8 @@ var SolverService = class {
|
|
|
10735
11380
|
* "allowPartialFill": false, // Whether the intent can be partially filled
|
|
10736
11381
|
* "srcChain": "0x38.bsc", // Chain ID where input tokens originate
|
|
10737
11382
|
* "dstChain": "0xa4b1.arbitrum", // Chain ID where output tokens should be delivered
|
|
10738
|
-
* "srcAddress": "0x..", // Source address
|
|
10739
|
-
* "dstAddress": "0x...", // Destination address
|
|
11383
|
+
* "srcAddress": "0x..", // Source address (original address on spoke chain)
|
|
11384
|
+
* "dstAddress": "0x...", // Destination address (original address on spoke chain)
|
|
10740
11385
|
* "solver": "0x..", // Optional specific solver address (address(0) = any solver)
|
|
10741
11386
|
* "data": "0x..", // Additional arbitrary data
|
|
10742
11387
|
* } satisfies CreateIntentParams;
|
|
@@ -10827,11 +11472,11 @@ var SolverService = class {
|
|
|
10827
11472
|
/**
|
|
10828
11473
|
* Creates an intent by handling token approval and intent creation
|
|
10829
11474
|
* NOTE: This method does not submit the intent to the Solver API
|
|
10830
|
-
* @param {CreateIntentParams} params - The intent to create
|
|
11475
|
+
* @param {Omit<CreateIntentParams, 'srcAddress'>} params - The intent to create
|
|
10831
11476
|
* @param {SpokeProvider} spokeProvider - The spoke provider
|
|
10832
11477
|
* @param {boolean} raw - Whether to return the raw transaction
|
|
10833
11478
|
* @param {PartnerFee} fee - The fee to apply to the intent
|
|
10834
|
-
* @returns {Promise<Result<[TxReturnType<S, R>, Intent & FeeAmount],
|
|
11479
|
+
* @returns {Promise<Result<[TxReturnType<S, R>, Intent & FeeAmount], IntentError<'CREATION_FAILED'>>>} The encoded contract call
|
|
10835
11480
|
*
|
|
10836
11481
|
* @example
|
|
10837
11482
|
* const payload = {
|
|
@@ -10843,8 +11488,8 @@ var SolverService = class {
|
|
|
10843
11488
|
* "allowPartialFill": false, // Whether the intent can be partially filled
|
|
10844
11489
|
* "srcChain": "0x38.bsc", // Chain ID where input tokens originate
|
|
10845
11490
|
* "dstChain": "0xa4b1.arbitrum", // Chain ID where output tokens should be delivered
|
|
10846
|
-
* "srcAddress": "0x..", // Source address
|
|
10847
|
-
* "dstAddress": "0x...", // Destination address
|
|
11491
|
+
* "srcAddress": "0x..", // Source address (original address on spoke chain)
|
|
11492
|
+
* "dstAddress": "0x...", // Destination address (original address on spoke chain)
|
|
10848
11493
|
* "solver": "0x..", // Optional specific solver address (address(0) = any solver)
|
|
10849
11494
|
* "data": "0x..", // Additional arbitrary data
|
|
10850
11495
|
* } satisfies CreateIntentParams;
|
|
@@ -10868,7 +11513,12 @@ var SolverService = class {
|
|
|
10868
11513
|
invariant2__default.default(isValidSpokeChainId(params.srcChain), `Invalid spoke chain (params.srcChain): ${params.srcChain}`);
|
|
10869
11514
|
invariant2__default.default(isValidSpokeChainId(params.dstChain), `Invalid spoke chain (params.dstChain): ${params.dstChain}`);
|
|
10870
11515
|
try {
|
|
10871
|
-
const
|
|
11516
|
+
const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
|
|
11517
|
+
invariant2__default.default(
|
|
11518
|
+
params.srcAddress.toLowerCase() === walletAddress.toLowerCase(),
|
|
11519
|
+
"srcAddress must be the same as wallet address"
|
|
11520
|
+
);
|
|
11521
|
+
const walletAddressBytes = encodeAddress(params.srcChain, walletAddress);
|
|
10872
11522
|
const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddressBytes : await WalletAbstractionService.getUserHubWalletAddress(
|
|
10873
11523
|
params.srcChain,
|
|
10874
11524
|
walletAddressBytes,
|
|
@@ -10876,12 +11526,14 @@ var SolverService = class {
|
|
|
10876
11526
|
spokeProvider
|
|
10877
11527
|
);
|
|
10878
11528
|
const [data, intent, feeAmount] = EvmSolverService.constructCreateIntentData(
|
|
10879
|
-
|
|
11529
|
+
{
|
|
11530
|
+
...params,
|
|
11531
|
+
srcAddress: walletAddress
|
|
11532
|
+
},
|
|
10880
11533
|
creatorHubWalletAddress,
|
|
10881
11534
|
this.config,
|
|
10882
11535
|
fee
|
|
10883
11536
|
);
|
|
10884
|
-
const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
|
|
10885
11537
|
const txResult = await SpokeService.deposit(
|
|
10886
11538
|
{
|
|
10887
11539
|
from: walletAddress,
|
|
@@ -10896,7 +11548,7 @@ var SolverService = class {
|
|
|
10896
11548
|
);
|
|
10897
11549
|
return {
|
|
10898
11550
|
ok: true,
|
|
10899
|
-
value: [txResult, { ...intent, feeAmount }]
|
|
11551
|
+
value: [txResult, { ...intent, feeAmount }, data]
|
|
10900
11552
|
};
|
|
10901
11553
|
} catch (error) {
|
|
10902
11554
|
return {
|
|
@@ -10919,20 +11571,37 @@ var SolverService = class {
|
|
|
10919
11571
|
* @returns {Promise<TxReturnType<T, R>>} The encoded contract call
|
|
10920
11572
|
*/
|
|
10921
11573
|
async cancelIntent(intent, spokeProvider, raw) {
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
spokeProvider.chainConfig.chain.id
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
|
|
10930
|
-
|
|
10931
|
-
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
11574
|
+
try {
|
|
11575
|
+
invariant2__default.default(isValidIntentRelayChainId(intent.srcChain), `Invalid intent.srcChain: ${intent.srcChain}`);
|
|
11576
|
+
invariant2__default.default(isValidIntentRelayChainId(intent.dstChain), `Invalid intent.dstChain: ${intent.dstChain}`);
|
|
11577
|
+
const walletAddressBytes = await spokeProvider.walletProvider.getWalletAddressBytes();
|
|
11578
|
+
const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddressBytes : await WalletAbstractionService.getUserHubWalletAddress(
|
|
11579
|
+
spokeProvider.chainConfig.chain.id,
|
|
11580
|
+
walletAddressBytes,
|
|
11581
|
+
this.hubProvider,
|
|
11582
|
+
spokeProvider
|
|
11583
|
+
);
|
|
11584
|
+
const calls = [];
|
|
11585
|
+
const intentsContract = this.config.intentsContract;
|
|
11586
|
+
calls.push(EvmSolverService.encodeCancelIntent(intent, intentsContract));
|
|
11587
|
+
const data = encodeContractCalls(calls);
|
|
11588
|
+
const txResult = await SpokeService.callWallet(
|
|
11589
|
+
creatorHubWalletAddress,
|
|
11590
|
+
data,
|
|
11591
|
+
spokeProvider,
|
|
11592
|
+
this.hubProvider,
|
|
11593
|
+
raw
|
|
11594
|
+
);
|
|
11595
|
+
return {
|
|
11596
|
+
ok: true,
|
|
11597
|
+
value: txResult
|
|
11598
|
+
};
|
|
11599
|
+
} catch (error) {
|
|
11600
|
+
return {
|
|
11601
|
+
ok: false,
|
|
11602
|
+
error
|
|
11603
|
+
};
|
|
11604
|
+
}
|
|
10936
11605
|
}
|
|
10937
11606
|
/**
|
|
10938
11607
|
* Gets an intent from a transaction hash (on Hub chain)
|
|
@@ -11671,6 +12340,7 @@ var MigrationService = class {
|
|
|
11671
12340
|
}
|
|
11672
12341
|
const packetResult = await relayTxAndWaitPacket(
|
|
11673
12342
|
txResult.value,
|
|
12343
|
+
void 0,
|
|
11674
12344
|
spokeProvider,
|
|
11675
12345
|
this.config.relayerApiEndpoint,
|
|
11676
12346
|
timeout
|
|
@@ -11732,6 +12402,7 @@ var MigrationService = class {
|
|
|
11732
12402
|
}
|
|
11733
12403
|
const packetResult = await relayTxAndWaitPacket(
|
|
11734
12404
|
txResult.value,
|
|
12405
|
+
void 0,
|
|
11735
12406
|
spokeProvider,
|
|
11736
12407
|
this.config.relayerApiEndpoint,
|
|
11737
12408
|
timeout
|
|
@@ -11907,38 +12578,37 @@ var Sodax = class {
|
|
|
11907
12578
|
};
|
|
11908
12579
|
|
|
11909
12580
|
// src/types.ts
|
|
11910
|
-
var
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
return
|
|
11917
|
-
})(
|
|
11918
|
-
var
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
|
|
11931
|
-
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11937
|
-
return
|
|
11938
|
-
})(
|
|
12581
|
+
var SolverIntentStatusCode = /* @__PURE__ */ ((SolverIntentStatusCode2) => {
|
|
12582
|
+
SolverIntentStatusCode2[SolverIntentStatusCode2["NOT_FOUND"] = -1] = "NOT_FOUND";
|
|
12583
|
+
SolverIntentStatusCode2[SolverIntentStatusCode2["NOT_STARTED_YET"] = 1] = "NOT_STARTED_YET";
|
|
12584
|
+
SolverIntentStatusCode2[SolverIntentStatusCode2["STARTED_NOT_FINISHED"] = 2] = "STARTED_NOT_FINISHED";
|
|
12585
|
+
SolverIntentStatusCode2[SolverIntentStatusCode2["SOLVED"] = 3] = "SOLVED";
|
|
12586
|
+
SolverIntentStatusCode2[SolverIntentStatusCode2["FAILED"] = 4] = "FAILED";
|
|
12587
|
+
return SolverIntentStatusCode2;
|
|
12588
|
+
})(SolverIntentStatusCode || {});
|
|
12589
|
+
var SolverIntentErrorCode = /* @__PURE__ */ ((SolverIntentErrorCode2) => {
|
|
12590
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["NO_PATH_FOUND"] = -4] = "NO_PATH_FOUND";
|
|
12591
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["NO_PRIVATE_LIQUIDITY"] = -5] = "NO_PRIVATE_LIQUIDITY";
|
|
12592
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["NOT_ENOUGH_PRIVATE_LIQUIDITY"] = -8] = "NOT_ENOUGH_PRIVATE_LIQUIDITY";
|
|
12593
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["NO_EXECUTION_MODULE_FOUND"] = -7] = "NO_EXECUTION_MODULE_FOUND";
|
|
12594
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["QUOTE_NOT_FOUND"] = -8] = "QUOTE_NOT_FOUND";
|
|
12595
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["QUOTE_NOT_MATCH"] = -9] = "QUOTE_NOT_MATCH";
|
|
12596
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["INTENT_DATA_NOT_MATCH_QUOTE"] = -10] = "INTENT_DATA_NOT_MATCH_QUOTE";
|
|
12597
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["NO_GAS_HANDLER_FOR_BLOCKCHAIN"] = -11] = "NO_GAS_HANDLER_FOR_BLOCKCHAIN";
|
|
12598
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["INTENT_NOT_FOUND"] = -12] = "INTENT_NOT_FOUND";
|
|
12599
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["QUOTE_EXPIRED"] = -13] = "QUOTE_EXPIRED";
|
|
12600
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["MAX_INPUT_AMOUNT"] = -14] = "MAX_INPUT_AMOUNT";
|
|
12601
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["MAX_DIFF_OUTPUT"] = -15] = "MAX_DIFF_OUTPUT";
|
|
12602
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["STOPPED"] = -16] = "STOPPED";
|
|
12603
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["NO_ORACLE_MODULE_FOUND"] = -17] = "NO_ORACLE_MODULE_FOUND";
|
|
12604
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["NEGATIVE_INPUT_AMOUNT"] = -18] = "NEGATIVE_INPUT_AMOUNT";
|
|
12605
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["INTENT_ALREADY_IN_ORDERBOOK"] = -19] = "INTENT_ALREADY_IN_ORDERBOOK";
|
|
12606
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["CREATE_INTENT_ORDER_FAILED"] = -998] = "CREATE_INTENT_ORDER_FAILED";
|
|
12607
|
+
SolverIntentErrorCode2[SolverIntentErrorCode2["UNKNOWN"] = -999] = "UNKNOWN";
|
|
12608
|
+
return SolverIntentErrorCode2;
|
|
12609
|
+
})(SolverIntentErrorCode || {});
|
|
11939
12610
|
|
|
11940
12611
|
exports.BigIntToHex = BigIntToHex;
|
|
11941
|
-
exports.CWSpokeProvider = CWSpokeProvider;
|
|
11942
12612
|
exports.DEFAULT_MAX_RETRY = DEFAULT_MAX_RETRY;
|
|
11943
12613
|
exports.DEFAULT_RELAYER_API_ENDPOINT = DEFAULT_RELAYER_API_ENDPOINT;
|
|
11944
12614
|
exports.DEFAULT_RELAY_TX_TIMEOUT = DEFAULT_RELAY_TX_TIMEOUT;
|
|
@@ -11959,16 +12629,19 @@ exports.ICON_TX_RESULT_WAIT_MAX_RETRY = ICON_TX_RESULT_WAIT_MAX_RETRY;
|
|
|
11959
12629
|
exports.INTENT_RELAY_CHAIN_IDS = INTENT_RELAY_CHAIN_IDS;
|
|
11960
12630
|
exports.IconSpokeProvider = IconSpokeProvider;
|
|
11961
12631
|
exports.IcxMigrationService = IcxMigrationService;
|
|
12632
|
+
exports.InjectiveSpokeProvider = InjectiveSpokeProvider;
|
|
11962
12633
|
exports.IntentCreatedEventAbi = IntentCreatedEventAbi;
|
|
11963
12634
|
exports.IntentDataType = IntentDataType;
|
|
11964
|
-
exports.IntentErrorCode = IntentErrorCode;
|
|
11965
|
-
exports.IntentStatusCode = IntentStatusCode;
|
|
11966
12635
|
exports.IntentsAbi = IntentsAbi;
|
|
11967
12636
|
exports.MAX_UINT256 = MAX_UINT256;
|
|
11968
12637
|
exports.MigrationService = MigrationService;
|
|
11969
12638
|
exports.MoneyMarketService = MoneyMarketService;
|
|
12639
|
+
exports.STELLAR_DEFAULT_TX_TIMEOUT_SECONDS = STELLAR_DEFAULT_TX_TIMEOUT_SECONDS;
|
|
12640
|
+
exports.STELLAR_PRIORITY_FEE = STELLAR_PRIORITY_FEE;
|
|
11970
12641
|
exports.Sodax = Sodax;
|
|
11971
12642
|
exports.SolanaSpokeProvider = SolanaSpokeProvider;
|
|
12643
|
+
exports.SolverIntentErrorCode = SolverIntentErrorCode;
|
|
12644
|
+
exports.SolverIntentStatusCode = SolverIntentStatusCode;
|
|
11972
12645
|
exports.SolverService = SolverService;
|
|
11973
12646
|
exports.SonicSpokeProvider = SonicSpokeProvider;
|
|
11974
12647
|
exports.SonicSpokeService = SonicSpokeService;
|
|
@@ -12005,7 +12678,6 @@ exports.hubAssets = hubAssets;
|
|
|
12005
12678
|
exports.hubVaults = hubVaults;
|
|
12006
12679
|
exports.hubVaultsAddressSet = hubVaultsAddressSet;
|
|
12007
12680
|
exports.intentRelayChainIdToSpokeChainIdMap = intentRelayChainIdToSpokeChainIdMap;
|
|
12008
|
-
exports.isCWSpokeProvider = isCWSpokeProvider;
|
|
12009
12681
|
exports.isConfiguredMoneyMarketConfig = isConfiguredMoneyMarketConfig;
|
|
12010
12682
|
exports.isConfiguredSolverConfig = isConfiguredSolverConfig;
|
|
12011
12683
|
exports.isEvmHubChainConfig = isEvmHubChainConfig;
|
|
@@ -12017,11 +12689,26 @@ exports.isEvmUninitializedConfig = isEvmUninitializedConfig;
|
|
|
12017
12689
|
exports.isEvmUninitializedPrivateKeyConfig = isEvmUninitializedPrivateKeyConfig;
|
|
12018
12690
|
exports.isIconAddress = isIconAddress;
|
|
12019
12691
|
exports.isIconSpokeProvider = isIconSpokeProvider;
|
|
12692
|
+
exports.isInjectiveSpokeProvider = isInjectiveSpokeProvider;
|
|
12693
|
+
exports.isIntentCreationFailedError = isIntentCreationFailedError;
|
|
12694
|
+
exports.isIntentCreationUnknownError = isIntentCreationUnknownError;
|
|
12695
|
+
exports.isIntentPostExecutionFailedError = isIntentPostExecutionFailedError;
|
|
12020
12696
|
exports.isIntentRelayChainId = isIntentRelayChainId;
|
|
12697
|
+
exports.isIntentSubmitTxFailedError = isIntentSubmitTxFailedError;
|
|
12021
12698
|
exports.isJsonRpcPayloadResponse = isJsonRpcPayloadResponse;
|
|
12699
|
+
exports.isMoneyMarketBorrowUnknownError = isMoneyMarketBorrowUnknownError;
|
|
12700
|
+
exports.isMoneyMarketCreateBorrowIntentFailedError = isMoneyMarketCreateBorrowIntentFailedError;
|
|
12701
|
+
exports.isMoneyMarketCreateRepayIntentFailedError = isMoneyMarketCreateRepayIntentFailedError;
|
|
12702
|
+
exports.isMoneyMarketCreateSupplyIntentFailedError = isMoneyMarketCreateSupplyIntentFailedError;
|
|
12703
|
+
exports.isMoneyMarketCreateWithdrawIntentFailedError = isMoneyMarketCreateWithdrawIntentFailedError;
|
|
12704
|
+
exports.isMoneyMarketRelayTimeoutError = isMoneyMarketRelayTimeoutError;
|
|
12705
|
+
exports.isMoneyMarketRepayUnknownError = isMoneyMarketRepayUnknownError;
|
|
12022
12706
|
exports.isMoneyMarketReserveAsset = isMoneyMarketReserveAsset;
|
|
12023
12707
|
exports.isMoneyMarketReserveHubAsset = isMoneyMarketReserveHubAsset;
|
|
12708
|
+
exports.isMoneyMarketSubmitTxFailedError = isMoneyMarketSubmitTxFailedError;
|
|
12709
|
+
exports.isMoneyMarketSupplyUnknownError = isMoneyMarketSupplyUnknownError;
|
|
12024
12710
|
exports.isMoneyMarketSupportedToken = isMoneyMarketSupportedToken;
|
|
12711
|
+
exports.isMoneyMarketWithdrawUnknownError = isMoneyMarketWithdrawUnknownError;
|
|
12025
12712
|
exports.isNativeToken = isNativeToken;
|
|
12026
12713
|
exports.isPartnerFeeAmount = isPartnerFeeAmount;
|
|
12027
12714
|
exports.isPartnerFeePercentage = isPartnerFeePercentage;
|
|
@@ -12037,8 +12724,10 @@ exports.isValidHubAsset = isValidHubAsset;
|
|
|
12037
12724
|
exports.isValidIntentRelayChainId = isValidIntentRelayChainId;
|
|
12038
12725
|
exports.isValidOriginalAssetAddress = isValidOriginalAssetAddress;
|
|
12039
12726
|
exports.isValidSpokeChainId = isValidSpokeChainId;
|
|
12727
|
+
exports.isWaitUntilIntentExecutedFailed = isWaitUntilIntentExecutedFailed;
|
|
12040
12728
|
exports.moneyMarketReserveAssets = moneyMarketReserveAssets;
|
|
12041
12729
|
exports.moneyMarketReserveHubAssetsSet = moneyMarketReserveHubAssetsSet;
|
|
12730
|
+
exports.moneyMarketSupportedTokens = moneyMarketSupportedTokens;
|
|
12042
12731
|
exports.originalAssetTohubAssetMap = originalAssetTohubAssetMap;
|
|
12043
12732
|
exports.poolAbi = poolAbi;
|
|
12044
12733
|
exports.randomUint256 = randomUint256;
|