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