@sodax/sdk 0.0.1-rc.32 → 0.0.1-rc.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +330 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +302 -1
- package/dist/index.d.ts +302 -1
- package/dist/index.mjs +327 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6113,6 +6113,12 @@ var FEE_PERCENTAGE_SCALE = 10000n;
|
|
|
6113
6113
|
var STELLAR_PRIORITY_FEE = "10000";
|
|
6114
6114
|
var STELLAR_DEFAULT_TX_TIMEOUT_SECONDS = 100;
|
|
6115
6115
|
var DEFAULT_DEADLINE_OFFSET = 300n;
|
|
6116
|
+
var DEFAULT_BACKEND_API_ENDPOINT = "https://apiv1.coolify.iconblockchain.xyz";
|
|
6117
|
+
var DEFAULT_BACKEND_API_TIMEOUT = 3e4;
|
|
6118
|
+
var DEFAULT_BACKEND_API_HEADERS = {
|
|
6119
|
+
"Content-Type": "application/json",
|
|
6120
|
+
Accept: "application/json"
|
|
6121
|
+
};
|
|
6116
6122
|
var VAULT_TOKEN_DECIMALS = 18;
|
|
6117
6123
|
var INTENT_RELAY_CHAIN_IDS = {
|
|
6118
6124
|
AVAX: 6n,
|
|
@@ -6350,6 +6356,7 @@ var hubChainConfig = {
|
|
|
6350
6356
|
icxMigration: "0x8294DE9fc60F5ABCc19245E5857071d7C42B9875",
|
|
6351
6357
|
balnSwap: "0x610a90B61b89a98b954d5750E94834Aa45d08d10",
|
|
6352
6358
|
sodaToken: "0x7c7d53eecda37a87ce0d5bf8e0b24512a48dc963"
|
|
6359
|
+
// SODA token on Sonic
|
|
6353
6360
|
},
|
|
6354
6361
|
nativeToken: "0x0000000000000000000000000000000000000000",
|
|
6355
6362
|
wrappedNativeToken: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38",
|
|
@@ -6448,6 +6455,13 @@ var spokeChainConfig = {
|
|
|
6448
6455
|
decimals: 6,
|
|
6449
6456
|
address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
6450
6457
|
xChainId: SOLANA_MAINNET_CHAIN_ID
|
|
6458
|
+
},
|
|
6459
|
+
SODA: {
|
|
6460
|
+
symbol: "SODA",
|
|
6461
|
+
name: "SODAX",
|
|
6462
|
+
decimals: 9,
|
|
6463
|
+
address: "8Bj8gSbga8My8qRkT1RrvgxFBExiGFgdRNHFaR9o2T3Q",
|
|
6464
|
+
xChainId: SOLANA_MAINNET_CHAIN_ID
|
|
6451
6465
|
}
|
|
6452
6466
|
},
|
|
6453
6467
|
gasPrice: "500000",
|
|
@@ -6494,6 +6508,13 @@ var spokeChainConfig = {
|
|
|
6494
6508
|
decimals: 6,
|
|
6495
6509
|
address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
|
|
6496
6510
|
xChainId: AVALANCHE_MAINNET_CHAIN_ID
|
|
6511
|
+
},
|
|
6512
|
+
SODA: {
|
|
6513
|
+
symbol: "SODA",
|
|
6514
|
+
name: "SODAX",
|
|
6515
|
+
decimals: 18,
|
|
6516
|
+
address: "0x390ceed555905ec225Da330A188EA04e85570f00",
|
|
6517
|
+
xChainId: AVALANCHE_MAINNET_CHAIN_ID
|
|
6497
6518
|
}
|
|
6498
6519
|
}
|
|
6499
6520
|
},
|
|
@@ -6523,6 +6544,13 @@ var spokeChainConfig = {
|
|
|
6523
6544
|
decimals: 18,
|
|
6524
6545
|
address: "0x043fb7e23350Dd5b77dE5E228B528763DEcb9131",
|
|
6525
6546
|
xChainId: NIBIRU_MAINNET_CHAIN_ID
|
|
6547
|
+
},
|
|
6548
|
+
SODA: {
|
|
6549
|
+
symbol: "SODA",
|
|
6550
|
+
name: "SODAX",
|
|
6551
|
+
decimals: 18,
|
|
6552
|
+
address: "0x5bda87f18109CA85fa7ADDf1D48B97734e9dc6F5",
|
|
6553
|
+
xChainId: NIBIRU_MAINNET_CHAIN_ID
|
|
6526
6554
|
}
|
|
6527
6555
|
}
|
|
6528
6556
|
},
|
|
@@ -6594,6 +6622,13 @@ var spokeChainConfig = {
|
|
|
6594
6622
|
decimals: 6,
|
|
6595
6623
|
address: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
|
|
6596
6624
|
xChainId: ARBITRUM_MAINNET_CHAIN_ID
|
|
6625
|
+
},
|
|
6626
|
+
SODA: {
|
|
6627
|
+
symbol: "SODA",
|
|
6628
|
+
name: "SODAX",
|
|
6629
|
+
decimals: 18,
|
|
6630
|
+
address: "0x6958a4CBFe11406E2a1c1d3a71A1971aD8B3b92F",
|
|
6631
|
+
xChainId: ARBITRUM_MAINNET_CHAIN_ID
|
|
6597
6632
|
}
|
|
6598
6633
|
}
|
|
6599
6634
|
},
|
|
@@ -6651,6 +6686,13 @@ var spokeChainConfig = {
|
|
|
6651
6686
|
decimals: 8,
|
|
6652
6687
|
address: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
|
|
6653
6688
|
xChainId: BASE_MAINNET_CHAIN_ID
|
|
6689
|
+
},
|
|
6690
|
+
SODA: {
|
|
6691
|
+
symbol: "SODA",
|
|
6692
|
+
name: "SODAX",
|
|
6693
|
+
decimals: 18,
|
|
6694
|
+
address: "0xdc5B4b00F98347E95b9F94911213DAB4C687e1e3",
|
|
6695
|
+
xChainId: BASE_MAINNET_CHAIN_ID
|
|
6654
6696
|
}
|
|
6655
6697
|
}
|
|
6656
6698
|
},
|
|
@@ -6708,6 +6750,13 @@ var spokeChainConfig = {
|
|
|
6708
6750
|
decimals: 6,
|
|
6709
6751
|
address: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",
|
|
6710
6752
|
xChainId: OPTIMISM_MAINNET_CHAIN_ID
|
|
6753
|
+
},
|
|
6754
|
+
SODA: {
|
|
6755
|
+
symbol: "SODA",
|
|
6756
|
+
name: "SODAX",
|
|
6757
|
+
decimals: 18,
|
|
6758
|
+
address: "0x1f22279C89B213944b7Ea41daCB0a868DdCDFd13",
|
|
6759
|
+
xChainId: OPTIMISM_MAINNET_CHAIN_ID
|
|
6711
6760
|
}
|
|
6712
6761
|
}
|
|
6713
6762
|
},
|
|
@@ -6758,6 +6807,13 @@ var spokeChainConfig = {
|
|
|
6758
6807
|
decimals: 18,
|
|
6759
6808
|
address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
|
|
6760
6809
|
xChainId: BSC_MAINNET_CHAIN_ID
|
|
6810
|
+
},
|
|
6811
|
+
SODA: {
|
|
6812
|
+
symbol: "SODA",
|
|
6813
|
+
name: "SODAX",
|
|
6814
|
+
decimals: 18,
|
|
6815
|
+
address: "0xdc5B4b00F98347E95b9F94911213DAB4C687e1e3",
|
|
6816
|
+
xChainId: BSC_MAINNET_CHAIN_ID
|
|
6761
6817
|
}
|
|
6762
6818
|
}
|
|
6763
6819
|
},
|
|
@@ -6794,6 +6850,13 @@ var spokeChainConfig = {
|
|
|
6794
6850
|
decimals: 6,
|
|
6795
6851
|
address: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
|
|
6796
6852
|
xChainId: POLYGON_MAINNET_CHAIN_ID
|
|
6853
|
+
},
|
|
6854
|
+
SODA: {
|
|
6855
|
+
symbol: "SODA",
|
|
6856
|
+
name: "SODAX",
|
|
6857
|
+
decimals: 18,
|
|
6858
|
+
address: "0xDDF645F33eDAD18fC23E01416eD0267A1bF59D45",
|
|
6859
|
+
xChainId: POLYGON_MAINNET_CHAIN_ID
|
|
6797
6860
|
}
|
|
6798
6861
|
}
|
|
6799
6862
|
},
|
|
@@ -6834,6 +6897,13 @@ var spokeChainConfig = {
|
|
|
6834
6897
|
decimals: 6,
|
|
6835
6898
|
address: "ibc/2CBC2EA121AE42563B08028466F37B600F2D7D4282342DE938283CC3FB2BC00E",
|
|
6836
6899
|
xChainId: INJECTIVE_MAINNET_CHAIN_ID
|
|
6900
|
+
},
|
|
6901
|
+
SODA: {
|
|
6902
|
+
symbol: "SODA",
|
|
6903
|
+
name: "SODAX",
|
|
6904
|
+
decimals: 18,
|
|
6905
|
+
address: "factory/inj1d036ftaatxpkqsu9hja8r24rv3v33chz3appxp/soda",
|
|
6906
|
+
xChainId: INJECTIVE_MAINNET_CHAIN_ID
|
|
6837
6907
|
}
|
|
6838
6908
|
},
|
|
6839
6909
|
gasPrice: "500000000inj",
|
|
@@ -6879,6 +6949,13 @@ var spokeChainConfig = {
|
|
|
6879
6949
|
decimals: 18,
|
|
6880
6950
|
address: "CCT4ZYIYZ3TUO2AWQFEOFGBZ6HQP3GW5TA37CK7CRZVFRDXYTHTYX7KP",
|
|
6881
6951
|
xChainId: STELLAR_MAINNET_CHAIN_ID
|
|
6952
|
+
},
|
|
6953
|
+
SODA: {
|
|
6954
|
+
symbol: "SODA",
|
|
6955
|
+
name: "SODAX",
|
|
6956
|
+
decimals: 7,
|
|
6957
|
+
address: "CAH5LKJC2ZB4RVUVEVL2QWJWNJLHQE2UF767ILLQ5EQ4O3OURR2XIUGM",
|
|
6958
|
+
xChainId: STELLAR_MAINNET_CHAIN_ID
|
|
6882
6959
|
}
|
|
6883
6960
|
},
|
|
6884
6961
|
nativeToken: "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",
|
|
@@ -6970,6 +7047,13 @@ var spokeChainConfig = {
|
|
|
6970
7047
|
decimals: 9,
|
|
6971
7048
|
address: "0x502867b177303bf1bf226245fcdd3403c177e78d175a55a56c0602c7ff51c7fa::trevin_sui::TREVIN_SUI",
|
|
6972
7049
|
xChainId: SUI_MAINNET_CHAIN_ID
|
|
7050
|
+
},
|
|
7051
|
+
SODA: {
|
|
7052
|
+
symbol: "SODA",
|
|
7053
|
+
name: "SODAX",
|
|
7054
|
+
decimals: 9,
|
|
7055
|
+
address: "0x0a0393721732617a2a771535e83c0a46f04aeef7d03239bbbb1249bc0981b952::soda::SODA",
|
|
7056
|
+
xChainId: SUI_MAINNET_CHAIN_ID
|
|
6973
7057
|
}
|
|
6974
7058
|
},
|
|
6975
7059
|
nativeToken: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
@@ -7363,6 +7447,13 @@ var hubAssets = {
|
|
|
7363
7447
|
symbol: "bnUSD",
|
|
7364
7448
|
name: "bnUSD",
|
|
7365
7449
|
vault: hubVaults.bnUSD.address
|
|
7450
|
+
},
|
|
7451
|
+
[spokeChainConfig[AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
|
|
7452
|
+
asset: "0xf51d7082375cdca8C19C74e1A0c77dA482aFDa4e",
|
|
7453
|
+
decimal: 18,
|
|
7454
|
+
symbol: "SODA",
|
|
7455
|
+
name: "SODAX",
|
|
7456
|
+
vault: hubVaults.sodaSODA.address
|
|
7366
7457
|
}
|
|
7367
7458
|
},
|
|
7368
7459
|
[ARBITRUM_MAINNET_CHAIN_ID]: {
|
|
@@ -7423,6 +7514,13 @@ var hubAssets = {
|
|
|
7423
7514
|
symbol: "bnUSD",
|
|
7424
7515
|
name: "bnUSD",
|
|
7425
7516
|
vault: hubVaults.bnUSD.address
|
|
7517
|
+
},
|
|
7518
|
+
[spokeChainConfig[ARBITRUM_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
|
|
7519
|
+
asset: "0x93a367E5B37a1B9E8D04ef25a6Af40d181a3DfFF",
|
|
7520
|
+
decimal: 18,
|
|
7521
|
+
symbol: "SODA",
|
|
7522
|
+
name: "SODAX",
|
|
7523
|
+
vault: hubVaults.sodaSODA.address
|
|
7426
7524
|
}
|
|
7427
7525
|
},
|
|
7428
7526
|
[BASE_MAINNET_CHAIN_ID]: {
|
|
@@ -7469,6 +7567,13 @@ var hubAssets = {
|
|
|
7469
7567
|
name: "Wrapped Staked Ethereum",
|
|
7470
7568
|
vault: "0x"
|
|
7471
7569
|
// no vault yet
|
|
7570
|
+
},
|
|
7571
|
+
[spokeChainConfig[BASE_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
|
|
7572
|
+
asset: "0x17fF8Ad5EBe6CA8B15751067cD0c89f0E580CD17",
|
|
7573
|
+
decimal: 18,
|
|
7574
|
+
symbol: "SODA",
|
|
7575
|
+
name: "SODAX",
|
|
7576
|
+
vault: hubVaults.sodaSODA.address
|
|
7472
7577
|
}
|
|
7473
7578
|
},
|
|
7474
7579
|
[OPTIMISM_MAINNET_CHAIN_ID]: {
|
|
@@ -7515,6 +7620,13 @@ var hubAssets = {
|
|
|
7515
7620
|
symbol: "USDT",
|
|
7516
7621
|
name: "Tether USD",
|
|
7517
7622
|
vault: hubVaults.sodaUSDT.address
|
|
7623
|
+
},
|
|
7624
|
+
[spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
|
|
7625
|
+
asset: "0x0eD0d274dC77ef460DC96b9fBaFF3EDB074e0471",
|
|
7626
|
+
decimal: 18,
|
|
7627
|
+
symbol: "SODA",
|
|
7628
|
+
name: "SODAX",
|
|
7629
|
+
vault: hubVaults.sodaSODA.address
|
|
7518
7630
|
}
|
|
7519
7631
|
},
|
|
7520
7632
|
[NIBIRU_MAINNET_CHAIN_ID]: {
|
|
@@ -7531,6 +7643,13 @@ var hubAssets = {
|
|
|
7531
7643
|
symbol: "bnUSD",
|
|
7532
7644
|
name: "bnUSD",
|
|
7533
7645
|
vault: hubVaults.bnUSD.address
|
|
7646
|
+
},
|
|
7647
|
+
[spokeChainConfig[NIBIRU_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
|
|
7648
|
+
asset: "0x26cd76cB5622Dc8638670A16E0Da5a51394A8DB1",
|
|
7649
|
+
decimal: 18,
|
|
7650
|
+
symbol: "SODA",
|
|
7651
|
+
name: "SODAX",
|
|
7652
|
+
vault: hubVaults.sodaSODA.address
|
|
7534
7653
|
}
|
|
7535
7654
|
},
|
|
7536
7655
|
[BSC_MAINNET_CHAIN_ID]: {
|
|
@@ -7568,6 +7687,13 @@ var hubAssets = {
|
|
|
7568
7687
|
symbol: "USDC",
|
|
7569
7688
|
name: "USD Coin",
|
|
7570
7689
|
vault: hubVaults.sodaUSDC.address
|
|
7690
|
+
},
|
|
7691
|
+
[spokeChainConfig[BSC_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
|
|
7692
|
+
asset: "0x4d12c72A8633588097D10e57b559ed642588e4C6",
|
|
7693
|
+
decimal: 18,
|
|
7694
|
+
symbol: "SODA",
|
|
7695
|
+
name: "SODAX",
|
|
7696
|
+
vault: hubVaults.sodaSODA.address
|
|
7571
7697
|
}
|
|
7572
7698
|
},
|
|
7573
7699
|
[POLYGON_MAINNET_CHAIN_ID]: {
|
|
@@ -7591,6 +7717,13 @@ var hubAssets = {
|
|
|
7591
7717
|
symbol: "USDC",
|
|
7592
7718
|
name: "USD Coin",
|
|
7593
7719
|
vault: hubVaults.sodaUSDC.address
|
|
7720
|
+
},
|
|
7721
|
+
[spokeChainConfig[POLYGON_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
|
|
7722
|
+
asset: "0x8D78A620E009Ba751Eb40d77A5e9Db48A3F2016b",
|
|
7723
|
+
decimal: 18,
|
|
7724
|
+
symbol: "SODA",
|
|
7725
|
+
name: "SODAX",
|
|
7726
|
+
vault: hubVaults.sodaSODA.address
|
|
7594
7727
|
}
|
|
7595
7728
|
},
|
|
7596
7729
|
[INJECTIVE_MAINNET_CHAIN_ID]: {
|
|
@@ -7614,6 +7747,13 @@ var hubAssets = {
|
|
|
7614
7747
|
symbol: "USDC",
|
|
7615
7748
|
name: "USD Coin",
|
|
7616
7749
|
vault: hubVaults.sodaUSDC.address
|
|
7750
|
+
},
|
|
7751
|
+
[spokeChainConfig[INJECTIVE_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
|
|
7752
|
+
asset: "0x20Ce75CdcEe44B1308365447b91B9c26e2b71Ffd",
|
|
7753
|
+
decimal: 18,
|
|
7754
|
+
symbol: "SODA",
|
|
7755
|
+
name: "SODAX",
|
|
7756
|
+
vault: hubVaults.sodaSODA.address
|
|
7617
7757
|
}
|
|
7618
7758
|
},
|
|
7619
7759
|
[STELLAR_MAINNET_CHAIN_ID]: {
|
|
@@ -7644,6 +7784,13 @@ var hubAssets = {
|
|
|
7644
7784
|
symbol: "legacybnUSD",
|
|
7645
7785
|
name: "legacybnUSD",
|
|
7646
7786
|
vault: hubVaults.IbnUSD.address
|
|
7787
|
+
},
|
|
7788
|
+
[spokeChainConfig[STELLAR_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
|
|
7789
|
+
asset: "0xD749B5FfFED7cEDaa3239abDd16D677179C29AEc",
|
|
7790
|
+
decimal: 7,
|
|
7791
|
+
symbol: "SODA",
|
|
7792
|
+
name: "SODAX",
|
|
7793
|
+
vault: hubVaults.sodaSODA.address
|
|
7647
7794
|
}
|
|
7648
7795
|
},
|
|
7649
7796
|
[SUI_MAINNET_CHAIN_ID]: {
|
|
@@ -7722,6 +7869,13 @@ var hubAssets = {
|
|
|
7722
7869
|
symbol: "bnUSD",
|
|
7723
7870
|
name: "legacybnUSD",
|
|
7724
7871
|
vault: hubVaults.IbnUSD.address
|
|
7872
|
+
},
|
|
7873
|
+
[spokeChainConfig[SUI_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
|
|
7874
|
+
asset: "0x5Db9CEc919f40C50809D9490DC3BbA4F05b0a1D7",
|
|
7875
|
+
decimal: 9,
|
|
7876
|
+
symbol: "SODA",
|
|
7877
|
+
name: "SODAX",
|
|
7878
|
+
vault: hubVaults.sodaSODA.address
|
|
7725
7879
|
}
|
|
7726
7880
|
},
|
|
7727
7881
|
[SOLANA_MAINNET_CHAIN_ID]: {
|
|
@@ -7745,6 +7899,13 @@ var hubAssets = {
|
|
|
7745
7899
|
symbol: "USDC",
|
|
7746
7900
|
name: "USD Coin",
|
|
7747
7901
|
vault: hubVaults.sodaUSDC.address
|
|
7902
|
+
},
|
|
7903
|
+
[spokeChainConfig[SOLANA_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
|
|
7904
|
+
asset: "0x07Db7b1a96ebE474B20F52fF487cEE415adee79e",
|
|
7905
|
+
decimal: 9,
|
|
7906
|
+
symbol: "SODA",
|
|
7907
|
+
name: "SODAX",
|
|
7908
|
+
vault: hubVaults.sodaSODA.address
|
|
7748
7909
|
}
|
|
7749
7910
|
},
|
|
7750
7911
|
[ICON_MAINNET_CHAIN_ID]: {
|
|
@@ -14095,6 +14256,168 @@ var BalnSwapService = class {
|
|
|
14095
14256
|
return spokeProvider.walletProvider.sendTransaction(tx);
|
|
14096
14257
|
}
|
|
14097
14258
|
};
|
|
14259
|
+
|
|
14260
|
+
// src/services/backend/BackendApiService.ts
|
|
14261
|
+
var BackendApiService = class {
|
|
14262
|
+
baseURL;
|
|
14263
|
+
defaultHeaders;
|
|
14264
|
+
timeout;
|
|
14265
|
+
constructor(config) {
|
|
14266
|
+
this.baseURL = config?.baseURL ?? DEFAULT_BACKEND_API_ENDPOINT;
|
|
14267
|
+
this.timeout = config?.timeout ?? DEFAULT_BACKEND_API_TIMEOUT;
|
|
14268
|
+
this.defaultHeaders = config?.headers ?? DEFAULT_BACKEND_API_HEADERS;
|
|
14269
|
+
}
|
|
14270
|
+
/**
|
|
14271
|
+
* Make HTTP request using fetch API
|
|
14272
|
+
* @param endpoint - API endpoint path
|
|
14273
|
+
* @param config - Request configuration
|
|
14274
|
+
* @returns Promise<T>
|
|
14275
|
+
*/
|
|
14276
|
+
async makeRequest(endpoint, config) {
|
|
14277
|
+
const url = `${this.baseURL}${endpoint}`;
|
|
14278
|
+
const headers = { ...this.defaultHeaders, ...config.headers };
|
|
14279
|
+
const controller = new AbortController();
|
|
14280
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
14281
|
+
try {
|
|
14282
|
+
const response = await fetch(url, {
|
|
14283
|
+
method: config.method,
|
|
14284
|
+
headers,
|
|
14285
|
+
body: config.body,
|
|
14286
|
+
signal: controller.signal
|
|
14287
|
+
});
|
|
14288
|
+
clearTimeout(timeoutId);
|
|
14289
|
+
if (!response.ok) {
|
|
14290
|
+
const errorText = await response.text();
|
|
14291
|
+
throw new Error(`HTTP ${response.status}: ${errorText}`);
|
|
14292
|
+
}
|
|
14293
|
+
const data = await response.json();
|
|
14294
|
+
return data;
|
|
14295
|
+
} catch (error) {
|
|
14296
|
+
clearTimeout(timeoutId);
|
|
14297
|
+
if (error instanceof Error) {
|
|
14298
|
+
if (error.name === "AbortError") {
|
|
14299
|
+
throw new Error(`Request timeout after ${this.timeout}ms`);
|
|
14300
|
+
}
|
|
14301
|
+
console.error("[BackendApiService] Request error:", error.message);
|
|
14302
|
+
throw error;
|
|
14303
|
+
}
|
|
14304
|
+
console.error("[BackendApiService] Unknown error:", error);
|
|
14305
|
+
throw new Error("Unknown error occurred");
|
|
14306
|
+
}
|
|
14307
|
+
}
|
|
14308
|
+
// Intent endpoints
|
|
14309
|
+
/**
|
|
14310
|
+
* Get intent details by transaction hash
|
|
14311
|
+
* @param txHash - Transaction hash
|
|
14312
|
+
* @returns Promise<IntentResponse>
|
|
14313
|
+
*/
|
|
14314
|
+
async getIntentByTxHash(txHash) {
|
|
14315
|
+
return this.makeRequest(`/intent/tx/${txHash}`, { method: "GET" });
|
|
14316
|
+
}
|
|
14317
|
+
/**
|
|
14318
|
+
* Get intent details by intent hash
|
|
14319
|
+
* @param intentHash - Intent hash
|
|
14320
|
+
* @returns Promise<IntentResponse>
|
|
14321
|
+
*/
|
|
14322
|
+
async getIntentByHash(intentHash) {
|
|
14323
|
+
return this.makeRequest(`/intent/${intentHash}`, { method: "GET" });
|
|
14324
|
+
}
|
|
14325
|
+
// Solver endpoints
|
|
14326
|
+
/**
|
|
14327
|
+
* Get the solver orderbook
|
|
14328
|
+
* @param params - Object containing offset and limit parameters for pagination
|
|
14329
|
+
* @returns Promise<OrderbookResponse>
|
|
14330
|
+
*/
|
|
14331
|
+
async getOrderbook(params) {
|
|
14332
|
+
const queryParams = new URLSearchParams();
|
|
14333
|
+
queryParams.append("offset", params.offset);
|
|
14334
|
+
queryParams.append("limit", params.limit);
|
|
14335
|
+
const queryString = queryParams.toString();
|
|
14336
|
+
const endpoint = `/solver/orderbook?${queryString}`;
|
|
14337
|
+
return this.makeRequest(endpoint, { method: "GET" });
|
|
14338
|
+
}
|
|
14339
|
+
// Money Market endpoints
|
|
14340
|
+
/**
|
|
14341
|
+
* Get money market position for a specific user
|
|
14342
|
+
* @param userAddress - User's wallet address
|
|
14343
|
+
* @returns Promise<MoneyMarketPosition>
|
|
14344
|
+
*/
|
|
14345
|
+
async getMoneyMarketPosition(userAddress) {
|
|
14346
|
+
return this.makeRequest(`/moneymarket/position/${userAddress}`, { method: "GET" });
|
|
14347
|
+
}
|
|
14348
|
+
/**
|
|
14349
|
+
* Get all money market assets
|
|
14350
|
+
* @returns Promise<MoneyMarketAsset[]>
|
|
14351
|
+
*/
|
|
14352
|
+
async getAllMoneyMarketAssets() {
|
|
14353
|
+
return this.makeRequest("/moneymarket/asset/all", { method: "GET" });
|
|
14354
|
+
}
|
|
14355
|
+
/**
|
|
14356
|
+
* Get specific money market asset details
|
|
14357
|
+
* @param reserveAddress - Reserve contract address
|
|
14358
|
+
* @returns Promise<MoneyMarketAsset>
|
|
14359
|
+
*/
|
|
14360
|
+
async getMoneyMarketAsset(reserveAddress) {
|
|
14361
|
+
return this.makeRequest(`/moneymarket/asset/${reserveAddress}`, { method: "GET" });
|
|
14362
|
+
}
|
|
14363
|
+
/**
|
|
14364
|
+
* Get borrowers for a specific money market asset
|
|
14365
|
+
* @param reserveAddress - Reserve contract address
|
|
14366
|
+
* @param params - Object containing offset and limit parameters for pagination
|
|
14367
|
+
* @returns Promise<MoneyMarketAssetBorrowers>
|
|
14368
|
+
*/
|
|
14369
|
+
async getMoneyMarketAssetBorrowers(reserveAddress, params) {
|
|
14370
|
+
const queryParams = new URLSearchParams();
|
|
14371
|
+
queryParams.append("offset", params.offset);
|
|
14372
|
+
queryParams.append("limit", params.limit);
|
|
14373
|
+
const queryString = queryParams.toString();
|
|
14374
|
+
const endpoint = `/moneymarket/asset/${reserveAddress}/borrowers?${queryString}`;
|
|
14375
|
+
return this.makeRequest(endpoint, { method: "GET" });
|
|
14376
|
+
}
|
|
14377
|
+
/**
|
|
14378
|
+
* Get suppliers for a specific money market asset
|
|
14379
|
+
* @param reserveAddress - Reserve contract address
|
|
14380
|
+
* @param params - Object containing offset and limit parameters for pagination
|
|
14381
|
+
* @returns Promise<MoneyMarketAssetSuppliers>
|
|
14382
|
+
*/
|
|
14383
|
+
async getMoneyMarketAssetSuppliers(reserveAddress, params) {
|
|
14384
|
+
const queryParams = new URLSearchParams();
|
|
14385
|
+
queryParams.append("offset", params.offset);
|
|
14386
|
+
queryParams.append("limit", params.limit);
|
|
14387
|
+
const queryString = queryParams.toString();
|
|
14388
|
+
const endpoint = `/moneymarket/asset/${reserveAddress}/suppliers?${queryString}`;
|
|
14389
|
+
return this.makeRequest(endpoint, { method: "GET" });
|
|
14390
|
+
}
|
|
14391
|
+
/**
|
|
14392
|
+
* Get all money market borrowers
|
|
14393
|
+
* @param params - Object containing offset and limit parameters for pagination
|
|
14394
|
+
* @returns Promise<MoneyMarketBorrowers>
|
|
14395
|
+
*/
|
|
14396
|
+
async getAllMoneyMarketBorrowers(params) {
|
|
14397
|
+
const queryParams = new URLSearchParams();
|
|
14398
|
+
queryParams.append("offset", params.offset);
|
|
14399
|
+
queryParams.append("limit", params.limit);
|
|
14400
|
+
const queryString = queryParams.toString();
|
|
14401
|
+
const endpoint = `/moneymarket/borrowers?${queryString}`;
|
|
14402
|
+
return this.makeRequest(endpoint, { method: "GET" });
|
|
14403
|
+
}
|
|
14404
|
+
/**
|
|
14405
|
+
* Set custom headers for API requests
|
|
14406
|
+
* @param headers - Object containing header key-value pairs
|
|
14407
|
+
*/
|
|
14408
|
+
setHeaders(headers) {
|
|
14409
|
+
Object.entries(headers).forEach(([key, value]) => {
|
|
14410
|
+
this.defaultHeaders[key] = value;
|
|
14411
|
+
});
|
|
14412
|
+
}
|
|
14413
|
+
/**
|
|
14414
|
+
* Get the current base URL
|
|
14415
|
+
* @returns string
|
|
14416
|
+
*/
|
|
14417
|
+
getBaseURL() {
|
|
14418
|
+
return this.baseURL;
|
|
14419
|
+
}
|
|
14420
|
+
};
|
|
14098
14421
|
var BridgeService = class {
|
|
14099
14422
|
hubProvider;
|
|
14100
14423
|
relayerApiEndpoint;
|
|
@@ -14596,6 +14919,8 @@ var Sodax = class {
|
|
|
14596
14919
|
// Money Market service enabling cross-chain lending and borrowing
|
|
14597
14920
|
migration;
|
|
14598
14921
|
// ICX migration service enabling ICX migration to SODA
|
|
14922
|
+
backendApiService;
|
|
14923
|
+
// backend API service enabling backend API endpoints
|
|
14599
14924
|
bridge;
|
|
14600
14925
|
// Bridge service enabling cross-chain transfers
|
|
14601
14926
|
hubProvider;
|
|
@@ -14610,6 +14935,7 @@ var Sodax = class {
|
|
|
14610
14935
|
this.moneyMarket = config && config.moneyMarket ? new MoneyMarketService(config.moneyMarket, this.hubProvider, this.relayerApiEndpoint) : new MoneyMarketService(void 0, this.hubProvider, this.relayerApiEndpoint);
|
|
14611
14936
|
this.migration = config && config.migration ? new MigrationService(this.hubProvider, config.migration) : new MigrationService(this.hubProvider);
|
|
14612
14937
|
this.bridge = config && config.bridge ? new BridgeService(this.hubProvider, this.relayerApiEndpoint, config.bridge) : new BridgeService(this.hubProvider, this.relayerApiEndpoint);
|
|
14938
|
+
this.backendApiService = new BackendApiService(config?.backendApiConfig);
|
|
14613
14939
|
}
|
|
14614
14940
|
};
|
|
14615
14941
|
|
|
@@ -17438,6 +17764,6 @@ var SolverIntentErrorCode = /* @__PURE__ */ ((SolverIntentErrorCode2) => {
|
|
|
17438
17764
|
return SolverIntentErrorCode2;
|
|
17439
17765
|
})(SolverIntentErrorCode || {});
|
|
17440
17766
|
|
|
17441
|
-
export { BalnSwapService, BigIntToHex, BigNumberZeroDecimal, BnUSDMigrationService, BridgeService, ChainIdToIntentRelayChainId, DEFAULT_DEADLINE_OFFSET, 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, HALF_RAY, HALF_WAD, HubVaultSymbols, ICON_TX_RESULT_WAIT_MAX_RETRY, INTENT_RELAY_CHAIN_IDS, IconSpokeProvider, IcxMigrationService, InjectiveSpokeProvider, IntentCreatedEventAbi, IntentDataType, IntentsAbi, LTV_PRECISION, LendingPoolService, LockupMultiplier, LockupPeriod, MAX_UINT256, MigrationService, MoneyMarketDataService, MoneyMarketService, RAY, RAY_DECIMALS, SECONDS_PER_YEAR, STELLAR_DEFAULT_TX_TIMEOUT_SECONDS, STELLAR_PRIORITY_FEE, SodaTokens, SodaTokensAsHubAssets, SodaVaultTokensSet, Sodax, SolanaSpokeProvider, SolverIntentErrorCode, SolverIntentStatusCode, SolverService, SonicSpokeProvider, SonicSpokeService, SpokeService, StellarSpokeProvider, SuiSpokeProvider, SuiSpokeService, SupportedMigrationTokens, USD_DECIMALS, UiPoolDataProviderService, VAULT_TOKEN_DECIMALS, WAD, WAD_RAY_RATIO, WEI_DECIMALS, WalletAbstractionService, adjustAmountByFee, assetManagerAbi, balnSwapAbi, binomialApproximatedRayPow, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bnUSDNewTokens, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, chainIdToHubAssetsMap, connectionAbi, deriveUserWalletAddress, encodeAddress, encodeContractCalls, erc20Abi, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getCompoundedBalance, getEvmViemChain, getHubAssetInfo, getHubChainConfig, getHubVaultTokenByAddress, getIconAddressBytes, getIntentRelayChainId, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getMoneyMarketConfig, getOriginalAssetAddress, getOriginalAssetInfoFromVault, getOriginalTokenFromOriginalAssetAddress, getPacket, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getSolverConfig, getSpokeChainIdFromIntentRelayChainId, getSupportedMoneyMarketTokens, getSupportedSolverTokens, getTransactionPackets, hexToBigInt, hubAssetToOriginalAssetMap, hubAssets, hubVaultTokensMap, hubVaults, hubVaultsAddressSet, intentRelayChainIdToSpokeChainIdMap, isBalnMigrateParams, isConfiguredMoneyMarketConfig, isConfiguredSolverConfig, isEvmHubChainConfig, isEvmInitializedConfig, isEvmSpokeChainConfig, isEvmSpokeProvider, isEvmUninitializedBrowserConfig, isEvmUninitializedConfig, isEvmUninitializedPrivateKeyConfig, isIconAddress, isIconSpokeProvider, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveSpokeProvider, isIntentCreationFailedError, isIntentCreationUnknownError, isIntentPostExecutionFailedError, isIntentRelayChainId, isIntentSubmitTxFailedError, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isMoneyMarketBorrowUnknownError, isMoneyMarketCreateBorrowIntentFailedError, isMoneyMarketCreateRepayIntentFailedError, isMoneyMarketCreateSupplyIntentFailedError, isMoneyMarketCreateWithdrawIntentFailedError, isMoneyMarketRelayTimeoutError, isMoneyMarketRepayUnknownError, isMoneyMarketReserveAsset, isMoneyMarketReserveHubAsset, isMoneyMarketSubmitTxFailedError, isMoneyMarketSupplyUnknownError, isMoneyMarketSupportedToken, isMoneyMarketWithdrawUnknownError, isNativeToken, isNewbnUSDChainId, isNewbnUSDToken, isPartnerFeeAmount, isPartnerFeePercentage, isResponseAddressType, isResponseSigningType, isSodaVaultToken, isSolanaSpokeProvider, isSolverSupportedToken, isSonicSpokeProvider, isStellarSpokeProvider, isSuiSpokeProvider, isUnifiedBnUSDMigrateParams, isValidChainHubAsset, isValidHubAsset, isValidIntentRelayChainId, isValidOriginalAssetAddress, isValidSpokeChainId, isValidVault, isWaitUntilIntentExecutedFailed, moneyMarketReserveAssets, moneyMarketReserveHubAssetsSet, moneyMarketSupportedTokens, nativeToUSD, newbnUSDSpokeChainIds, normalize, normalizeBN, normalizedToUsd, originalAssetTohubAssetMap, poolAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainIdsSet, submitTransaction, supportedHubAssets, supportedHubChains, supportedSodaAssets, supportedSpokeChains, supportedTokensPerChain, uiPoolDataAbi, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, wadToRay, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|
|
17767
|
+
export { BackendApiService, BalnSwapService, BigIntToHex, BigNumberZeroDecimal, BnUSDMigrationService, BridgeService, ChainIdToIntentRelayChainId, DEFAULT_BACKEND_API_ENDPOINT, DEFAULT_BACKEND_API_HEADERS, DEFAULT_BACKEND_API_TIMEOUT, DEFAULT_DEADLINE_OFFSET, 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, HALF_RAY, HALF_WAD, HubVaultSymbols, ICON_TX_RESULT_WAIT_MAX_RETRY, INTENT_RELAY_CHAIN_IDS, IconSpokeProvider, IcxMigrationService, InjectiveSpokeProvider, IntentCreatedEventAbi, IntentDataType, IntentsAbi, LTV_PRECISION, LendingPoolService, LockupMultiplier, LockupPeriod, MAX_UINT256, MigrationService, MoneyMarketDataService, MoneyMarketService, RAY, RAY_DECIMALS, SECONDS_PER_YEAR, STELLAR_DEFAULT_TX_TIMEOUT_SECONDS, STELLAR_PRIORITY_FEE, SodaTokens, SodaTokensAsHubAssets, SodaVaultTokensSet, Sodax, SolanaSpokeProvider, SolverIntentErrorCode, SolverIntentStatusCode, SolverService, SonicSpokeProvider, SonicSpokeService, SpokeService, StellarSpokeProvider, SuiSpokeProvider, SuiSpokeService, SupportedMigrationTokens, USD_DECIMALS, UiPoolDataProviderService, VAULT_TOKEN_DECIMALS, WAD, WAD_RAY_RATIO, WEI_DECIMALS, WalletAbstractionService, adjustAmountByFee, assetManagerAbi, balnSwapAbi, binomialApproximatedRayPow, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bnUSDNewTokens, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, chainIdToHubAssetsMap, connectionAbi, deriveUserWalletAddress, encodeAddress, encodeContractCalls, erc20Abi, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getCompoundedBalance, getEvmViemChain, getHubAssetInfo, getHubChainConfig, getHubVaultTokenByAddress, getIconAddressBytes, getIntentRelayChainId, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getMoneyMarketConfig, getOriginalAssetAddress, getOriginalAssetInfoFromVault, getOriginalTokenFromOriginalAssetAddress, getPacket, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getSolverConfig, getSpokeChainIdFromIntentRelayChainId, getSupportedMoneyMarketTokens, getSupportedSolverTokens, getTransactionPackets, hexToBigInt, hubAssetToOriginalAssetMap, hubAssets, hubVaultTokensMap, hubVaults, hubVaultsAddressSet, intentRelayChainIdToSpokeChainIdMap, isBalnMigrateParams, isConfiguredMoneyMarketConfig, isConfiguredSolverConfig, isEvmHubChainConfig, isEvmInitializedConfig, isEvmSpokeChainConfig, isEvmSpokeProvider, isEvmUninitializedBrowserConfig, isEvmUninitializedConfig, isEvmUninitializedPrivateKeyConfig, isIconAddress, isIconSpokeProvider, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveSpokeProvider, isIntentCreationFailedError, isIntentCreationUnknownError, isIntentPostExecutionFailedError, isIntentRelayChainId, isIntentSubmitTxFailedError, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isMoneyMarketBorrowUnknownError, isMoneyMarketCreateBorrowIntentFailedError, isMoneyMarketCreateRepayIntentFailedError, isMoneyMarketCreateSupplyIntentFailedError, isMoneyMarketCreateWithdrawIntentFailedError, isMoneyMarketRelayTimeoutError, isMoneyMarketRepayUnknownError, isMoneyMarketReserveAsset, isMoneyMarketReserveHubAsset, isMoneyMarketSubmitTxFailedError, isMoneyMarketSupplyUnknownError, isMoneyMarketSupportedToken, isMoneyMarketWithdrawUnknownError, isNativeToken, isNewbnUSDChainId, isNewbnUSDToken, isPartnerFeeAmount, isPartnerFeePercentage, isResponseAddressType, isResponseSigningType, isSodaVaultToken, isSolanaSpokeProvider, isSolverSupportedToken, isSonicSpokeProvider, isStellarSpokeProvider, isSuiSpokeProvider, isUnifiedBnUSDMigrateParams, isValidChainHubAsset, isValidHubAsset, isValidIntentRelayChainId, isValidOriginalAssetAddress, isValidSpokeChainId, isValidVault, isWaitUntilIntentExecutedFailed, moneyMarketReserveAssets, moneyMarketReserveHubAssetsSet, moneyMarketSupportedTokens, nativeToUSD, newbnUSDSpokeChainIds, normalize, normalizeBN, normalizedToUsd, originalAssetTohubAssetMap, poolAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainIdsSet, submitTransaction, supportedHubAssets, supportedHubChains, supportedSodaAssets, supportedSpokeChains, supportedTokensPerChain, uiPoolDataAbi, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, wadToRay, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|
|
17442
17768
|
//# sourceMappingURL=index.mjs.map
|
|
17443
17769
|
//# sourceMappingURL=index.mjs.map
|