@sodax/sdk 2.0.0-rc.13 → 2.0.0-rc.14
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 +314 -73
- package/dist/index.d.cts +97 -45
- package/dist/index.d.ts +97 -45
- package/dist/index.mjs +315 -76
- package/package.json +5 -4
package/dist/index.cjs
CHANGED
|
@@ -17,6 +17,7 @@ var anchor = require('@coral-xyz/anchor');
|
|
|
17
17
|
var BN = require('bn.js');
|
|
18
18
|
var IconSdkRaw = require('icon-sdk-js');
|
|
19
19
|
var sdkTs = require('@injectivelabs/sdk-ts');
|
|
20
|
+
var tx_js = require('cosmjs-types/cosmos/tx/v1beta1/tx.js');
|
|
20
21
|
var networks = require('@injectivelabs/networks');
|
|
21
22
|
var BigNumber5 = require('bignumber.js');
|
|
22
23
|
var swapSdkCore = require('@pancakeswap/swap-sdk-core');
|
|
@@ -331,7 +332,8 @@ var HubVaultSymbols = [
|
|
|
331
332
|
"sodaNEAR",
|
|
332
333
|
"sodaKAIA",
|
|
333
334
|
"sodaSTX",
|
|
334
|
-
"sodaUSDS"
|
|
335
|
+
"sodaUSDS",
|
|
336
|
+
"sodaJITOSOL"
|
|
335
337
|
];
|
|
336
338
|
var SodaTokens = {
|
|
337
339
|
sodaBNB: {
|
|
@@ -558,9 +560,18 @@ var SodaTokens = {
|
|
|
558
560
|
chainKey: ChainKeys.SONIC_MAINNET,
|
|
559
561
|
hubAsset: "0x243b0c26c8b38793908d7C64e8510f21B19B4613",
|
|
560
562
|
vault: "0x243b0c26c8b38793908d7C64e8510f21B19B4613"
|
|
563
|
+
},
|
|
564
|
+
sodaJITOSOL: {
|
|
565
|
+
symbol: "sodaJITOSOL",
|
|
566
|
+
name: "Soda JITOSOL",
|
|
567
|
+
decimals: 18,
|
|
568
|
+
address: "0xe1bad4400d947Bc4fa66f9c0A143D800002083a0",
|
|
569
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
570
|
+
hubAsset: "0xe1bad4400d947Bc4fa66f9c0A143D800002083a0",
|
|
571
|
+
vault: "0xe1bad4400d947Bc4fa66f9c0A143D800002083a0"
|
|
561
572
|
}
|
|
562
573
|
};
|
|
563
|
-
var LsodaSymbols = ["lsodaWEETH", "lsodaWSTETH"];
|
|
574
|
+
var LsodaSymbols = ["lsodaWEETH", "lsodaWSTETH", "lsodaJITOSOL"];
|
|
564
575
|
var LsodaTokens = {
|
|
565
576
|
lsodaWEETH: {
|
|
566
577
|
symbol: "lsodaWEETH",
|
|
@@ -579,6 +590,15 @@ var LsodaTokens = {
|
|
|
579
590
|
chainKey: ChainKeys.SONIC_MAINNET,
|
|
580
591
|
hubAsset: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a",
|
|
581
592
|
vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a"
|
|
593
|
+
},
|
|
594
|
+
lsodaJITOSOL: {
|
|
595
|
+
symbol: "lsodaJITOSOL",
|
|
596
|
+
name: "Leveraged Soda JITOSOL",
|
|
597
|
+
decimals: 18,
|
|
598
|
+
address: "0xD7Ae4853E0f93682F5DaA14734F5D18cBa09Bd78",
|
|
599
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
600
|
+
hubAsset: "0xD7Ae4853E0f93682F5DaA14734F5D18cBa09Bd78",
|
|
601
|
+
vault: "0xD7Ae4853E0f93682F5DaA14734F5D18cBa09Bd78"
|
|
582
602
|
}
|
|
583
603
|
};
|
|
584
604
|
var sonicSupportedTokens = {
|
|
@@ -856,7 +876,7 @@ var solanaSupportedTokens = {
|
|
|
856
876
|
address: "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn",
|
|
857
877
|
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
858
878
|
hubAsset: "0x942f89a324d2652e447b9fcf08effc9f9776a680",
|
|
859
|
-
vault:
|
|
879
|
+
vault: SodaTokens.sodaJITOSOL.address
|
|
860
880
|
},
|
|
861
881
|
mSOL: {
|
|
862
882
|
symbol: "mSOL",
|
|
@@ -1289,6 +1309,15 @@ var baseSupportedTokens = {
|
|
|
1289
1309
|
chainKey: ChainKeys.BASE_MAINNET,
|
|
1290
1310
|
hubAsset: "0xaa81bb5ba3c972ab53605d3ba7e443a3de6d1cb9",
|
|
1291
1311
|
vault: "0xaa81bb5ba3c972ab53605d3ba7e443a3de6d1cb9"
|
|
1312
|
+
},
|
|
1313
|
+
AERO: {
|
|
1314
|
+
symbol: "AERO",
|
|
1315
|
+
name: "Aerodrome Finance",
|
|
1316
|
+
decimals: 18,
|
|
1317
|
+
address: "0x940181a94A35A4569e4529A3CDfB74e38FD98631",
|
|
1318
|
+
chainKey: ChainKeys.BASE_MAINNET,
|
|
1319
|
+
hubAsset: "0x348e086ab6f424dfc575a325c28624ed23973173",
|
|
1320
|
+
vault: "0x348e086ab6f424dfc575a325c28624ed23973173"
|
|
1292
1321
|
}
|
|
1293
1322
|
};
|
|
1294
1323
|
var optimismSupportedTokens = {
|
|
@@ -1971,6 +2000,33 @@ var stellarSupportedTokens = {
|
|
|
1971
2000
|
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
1972
2001
|
hubAsset: "0xD749B5FfFED7cEDaa3239abDd16D677179C29AEc",
|
|
1973
2002
|
vault: SodaTokens.sodaSODA.address
|
|
2003
|
+
},
|
|
2004
|
+
sodaETH: {
|
|
2005
|
+
symbol: "sodaETH",
|
|
2006
|
+
name: "Soda ETH",
|
|
2007
|
+
decimals: 7,
|
|
2008
|
+
address: "CDK5EWVTZLGSLI6D5OSES7XUKWZUKBXDRNOWUVDNPP5RJRP5EYWCW7SL",
|
|
2009
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2010
|
+
hubAsset: "0x4985a4b72ac723723e9ae82382d12d77e9a715de",
|
|
2011
|
+
vault: SodaTokens.sodaETH.address
|
|
2012
|
+
},
|
|
2013
|
+
sodaBTC: {
|
|
2014
|
+
symbol: "sodaBTC",
|
|
2015
|
+
name: "Soda BTC",
|
|
2016
|
+
decimals: 7,
|
|
2017
|
+
address: "CD6XWBW74YVFDQQYUM2GALCULMA5MAWGP6NTCWF3ZYXP4Z7MEVY4JKBX",
|
|
2018
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2019
|
+
hubAsset: "0xddee01f63c18843e2bac30cb702864d7632c83a2",
|
|
2020
|
+
vault: SodaTokens.sodaBTC.address
|
|
2021
|
+
},
|
|
2022
|
+
sodaBNB: {
|
|
2023
|
+
symbol: "sodaBNB",
|
|
2024
|
+
name: "Soda BNB",
|
|
2025
|
+
decimals: 7,
|
|
2026
|
+
address: "CCXTXZAFLVNTMORVWYB6BGL7YEW3U3ONDAL2FGBRGDUQH7AGANVQPRS6",
|
|
2027
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2028
|
+
hubAsset: "0xa10be5f5c2dea7d272555dc73ea2a7317c3c5b63",
|
|
2029
|
+
vault: SodaTokens.sodaBNB.address
|
|
1974
2030
|
}
|
|
1975
2031
|
};
|
|
1976
2032
|
var suiSupportedTokens = {
|
|
@@ -3110,6 +3166,21 @@ var spokeChainConfig = {
|
|
|
3110
3166
|
assetCode: "SODA",
|
|
3111
3167
|
contractId: "CAH5LKJC2ZB4RVUVEVL2QWJWNJLHQE2UF767ILLQ5EQ4O3OURR2XIUGM",
|
|
3112
3168
|
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
3169
|
+
},
|
|
3170
|
+
{
|
|
3171
|
+
assetCode: "sodaETH",
|
|
3172
|
+
contractId: "CDK5EWVTZLGSLI6D5OSES7XUKWZUKBXDRNOWUVDNPP5RJRP5EYWCW7SL",
|
|
3173
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
3174
|
+
},
|
|
3175
|
+
{
|
|
3176
|
+
assetCode: "sodaBTC",
|
|
3177
|
+
contractId: "CD6XWBW74YVFDQQYUM2GALCULMA5MAWGP6NTCWF3ZYXP4Z7MEVY4JKBX",
|
|
3178
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
3179
|
+
},
|
|
3180
|
+
{
|
|
3181
|
+
assetCode: "sodaBNB",
|
|
3182
|
+
contractId: "CCXTXZAFLVNTMORVWYB6BGL7YEW3U3ONDAL2FGBRGDUQH7AGANVQPRS6",
|
|
3183
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
3113
3184
|
}
|
|
3114
3185
|
],
|
|
3115
3186
|
supportedTokens: stellarSupportedTokens,
|
|
@@ -3385,7 +3456,8 @@ var moneyMarketSupportedTokens = {
|
|
|
3385
3456
|
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.bnUSD,
|
|
3386
3457
|
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.USDC,
|
|
3387
3458
|
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.SODA,
|
|
3388
|
-
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.USDT
|
|
3459
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.USDT,
|
|
3460
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.JitoSOL
|
|
3389
3461
|
],
|
|
3390
3462
|
[ChainKeys.ICON_MAINNET]: [
|
|
3391
3463
|
// spokeChainConfig[ChainKeys.ICON].supportedTokens.ICX,
|
|
@@ -3396,7 +3468,10 @@ var moneyMarketSupportedTokens = {
|
|
|
3396
3468
|
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.XLM,
|
|
3397
3469
|
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.bnUSD,
|
|
3398
3470
|
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.SODA,
|
|
3399
|
-
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.USDC
|
|
3471
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.USDC,
|
|
3472
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.sodaETH,
|
|
3473
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.sodaBTC,
|
|
3474
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.sodaBNB
|
|
3400
3475
|
],
|
|
3401
3476
|
[ChainKeys.SUI_MAINNET]: [
|
|
3402
3477
|
spokeChainConfig[ChainKeys.SUI_MAINNET].supportedTokens.SUI,
|
|
@@ -3647,7 +3722,8 @@ var swapSupportedTokens = {
|
|
|
3647
3722
|
spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.USDT,
|
|
3648
3723
|
spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.wS,
|
|
3649
3724
|
spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.SODA,
|
|
3650
|
-
|
|
3725
|
+
// sodaUSDS is staging-only — see stagingSwapSupportedTokens
|
|
3726
|
+
...Object.values(SodaTokens).filter((t) => t !== SodaTokens.sodaUSDS),
|
|
3651
3727
|
...Object.values(LsodaTokens)
|
|
3652
3728
|
],
|
|
3653
3729
|
[ChainKeys.AVALANCHE_MAINNET]: [
|
|
@@ -3667,36 +3743,35 @@ var swapSupportedTokens = {
|
|
|
3667
3743
|
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.tBTC,
|
|
3668
3744
|
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.USDC,
|
|
3669
3745
|
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.USDT,
|
|
3670
|
-
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.SODA,
|
|
3671
3746
|
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.ARB,
|
|
3672
3747
|
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.AAVE,
|
|
3673
3748
|
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.LINK,
|
|
3674
3749
|
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.UNI,
|
|
3675
3750
|
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.CRV,
|
|
3676
3751
|
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.PENDLE,
|
|
3677
|
-
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.rETH
|
|
3752
|
+
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.rETH,
|
|
3753
|
+
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.SODA
|
|
3678
3754
|
],
|
|
3679
3755
|
[ChainKeys.BASE_MAINNET]: [
|
|
3680
3756
|
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.ETH,
|
|
3681
|
-
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.bnUSD,
|
|
3682
3757
|
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.weETH,
|
|
3683
3758
|
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.USDC,
|
|
3684
3759
|
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.wstETH,
|
|
3685
3760
|
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.cbBTC,
|
|
3686
|
-
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.SODA,
|
|
3687
3761
|
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.VIRTUAL,
|
|
3688
|
-
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.cbETH
|
|
3762
|
+
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.cbETH,
|
|
3763
|
+
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.SODA
|
|
3689
3764
|
],
|
|
3690
3765
|
[ChainKeys.OPTIMISM_MAINNET]: [
|
|
3691
3766
|
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.ETH,
|
|
3692
|
-
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.bnUSD,
|
|
3693
3767
|
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.USDC,
|
|
3694
3768
|
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.wstETH,
|
|
3695
3769
|
// spokeChainConfig[OPTIMISM_MAINNET_CHAIN_ID].supportedTokens.weETH, // NOTE: Not Implemented
|
|
3696
3770
|
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.USDT,
|
|
3697
3771
|
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.SODA,
|
|
3698
3772
|
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.OP,
|
|
3699
|
-
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.WBTC
|
|
3773
|
+
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.WBTC,
|
|
3774
|
+
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.bnUSD
|
|
3700
3775
|
],
|
|
3701
3776
|
[ChainKeys.POLYGON_MAINNET]: [
|
|
3702
3777
|
spokeChainConfig[ChainKeys.POLYGON_MAINNET].supportedTokens.POL,
|
|
@@ -3752,7 +3827,6 @@ var swapSupportedTokens = {
|
|
|
3752
3827
|
spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["SUI.LL"],
|
|
3753
3828
|
spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["S.LL"],
|
|
3754
3829
|
spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["POL.LL"],
|
|
3755
|
-
spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["HYPE.LL"],
|
|
3756
3830
|
spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens.LL
|
|
3757
3831
|
],
|
|
3758
3832
|
[ChainKeys.SOLANA_MAINNET]: [
|
|
@@ -3791,7 +3865,10 @@ var swapSupportedTokens = {
|
|
|
3791
3865
|
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.bnUSD,
|
|
3792
3866
|
// NOTE: Not Implemented
|
|
3793
3867
|
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.USDC,
|
|
3794
|
-
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.SODA
|
|
3868
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.SODA,
|
|
3869
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.sodaETH,
|
|
3870
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.sodaBTC,
|
|
3871
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.sodaBNB
|
|
3795
3872
|
],
|
|
3796
3873
|
[ChainKeys.SUI_MAINNET]: [
|
|
3797
3874
|
spokeChainConfig[ChainKeys.SUI_MAINNET].supportedTokens.SUI,
|
|
@@ -3809,12 +3886,8 @@ var swapSupportedTokens = {
|
|
|
3809
3886
|
spokeChainConfig[ChainKeys.SUI_MAINNET].supportedTokens.WAL,
|
|
3810
3887
|
spokeChainConfig[ChainKeys.SUI_MAINNET].supportedTokens.NAVX
|
|
3811
3888
|
],
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
spokeChainConfig[ChainKeys.INJECTIVE_MAINNET].supportedTokens.bnUSD,
|
|
3815
|
-
spokeChainConfig[ChainKeys.INJECTIVE_MAINNET].supportedTokens.USDC
|
|
3816
|
-
// spokeChainConfig[ChainKeys.INJECTIVE_MAINNET].supportedTokens.SODA, // NOTE: not in solver wiki
|
|
3817
|
-
],
|
|
3889
|
+
// Injective is currently staging-only — see stagingSwapSupportedTokens
|
|
3890
|
+
[ChainKeys.INJECTIVE_MAINNET]: [],
|
|
3818
3891
|
[ChainKeys.NEAR_MAINNET]: [
|
|
3819
3892
|
spokeChainConfig[ChainKeys.NEAR_MAINNET].supportedTokens.NEAR,
|
|
3820
3893
|
spokeChainConfig[ChainKeys.NEAR_MAINNET].supportedTokens.bnUSD,
|
|
@@ -3881,12 +3954,53 @@ var swapSupportedTokens = {
|
|
|
3881
3954
|
spokeChainConfig[ChainKeys.STACKS_MAINNET].supportedTokens.USDC
|
|
3882
3955
|
]
|
|
3883
3956
|
};
|
|
3957
|
+
var stagingSwapSupportedTokens = {
|
|
3958
|
+
[ChainKeys.SONIC_MAINNET]: [SodaTokens.sodaUSDS],
|
|
3959
|
+
[ChainKeys.AVALANCHE_MAINNET]: [],
|
|
3960
|
+
[ChainKeys.ARBITRUM_MAINNET]: [],
|
|
3961
|
+
[ChainKeys.BASE_MAINNET]: [
|
|
3962
|
+
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.bnUSD,
|
|
3963
|
+
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.AERO
|
|
3964
|
+
],
|
|
3965
|
+
[ChainKeys.OPTIMISM_MAINNET]: [],
|
|
3966
|
+
[ChainKeys.POLYGON_MAINNET]: [
|
|
3967
|
+
spokeChainConfig[ChainKeys.POLYGON_MAINNET].supportedTokens.USDT,
|
|
3968
|
+
spokeChainConfig[ChainKeys.POLYGON_MAINNET].supportedTokens.wstETH
|
|
3969
|
+
],
|
|
3970
|
+
[ChainKeys.BSC_MAINNET]: [],
|
|
3971
|
+
[ChainKeys.HYPEREVM_MAINNET]: [],
|
|
3972
|
+
[ChainKeys.LIGHTLINK_MAINNET]: [
|
|
3973
|
+
spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["HYPE.LL"]
|
|
3974
|
+
],
|
|
3975
|
+
[ChainKeys.SOLANA_MAINNET]: [],
|
|
3976
|
+
[ChainKeys.ICON_MAINNET]: [],
|
|
3977
|
+
[ChainKeys.STELLAR_MAINNET]: [],
|
|
3978
|
+
[ChainKeys.SUI_MAINNET]: [spokeChainConfig[ChainKeys.SUI_MAINNET].supportedTokens.USDT],
|
|
3979
|
+
[ChainKeys.INJECTIVE_MAINNET]: [
|
|
3980
|
+
spokeChainConfig[ChainKeys.INJECTIVE_MAINNET].supportedTokens.INJ,
|
|
3981
|
+
spokeChainConfig[ChainKeys.INJECTIVE_MAINNET].supportedTokens.bnUSD,
|
|
3982
|
+
spokeChainConfig[ChainKeys.INJECTIVE_MAINNET].supportedTokens.USDC
|
|
3983
|
+
// spokeChainConfig[ChainKeys.INJECTIVE_MAINNET].supportedTokens.SODA, // NOTE: not in solver wiki
|
|
3984
|
+
],
|
|
3985
|
+
[ChainKeys.NEAR_MAINNET]: [],
|
|
3986
|
+
[ChainKeys.BITCOIN_MAINNET]: [],
|
|
3987
|
+
[ChainKeys.ETHEREUM_MAINNET]: [
|
|
3988
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.wstETH,
|
|
3989
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.weETH
|
|
3990
|
+
],
|
|
3991
|
+
[ChainKeys.REDBELLY_MAINNET]: [],
|
|
3992
|
+
[ChainKeys.KAIA_MAINNET]: [],
|
|
3993
|
+
[ChainKeys.STACKS_MAINNET]: []
|
|
3994
|
+
};
|
|
3884
3995
|
var swapsConfig = {
|
|
3885
|
-
partnerFee: void 0,
|
|
3886
3996
|
supportedTokens: swapSupportedTokens
|
|
3887
3997
|
};
|
|
3888
3998
|
var getSupportedSolverTokens = (chainId) => swapSupportedTokens[chainId];
|
|
3889
|
-
var
|
|
3999
|
+
var getStagingSolverTokens = (chainId) => [
|
|
4000
|
+
...swapSupportedTokens[chainId],
|
|
4001
|
+
...stagingSwapSupportedTokens[chainId]
|
|
4002
|
+
];
|
|
4003
|
+
var isSwapSupportedToken = (chainId, token) => [...swapSupportedTokens[chainId], ...stagingSwapSupportedTokens[chainId]].some((t) => t.address.toLowerCase() === token.toLowerCase());
|
|
3890
4004
|
|
|
3891
4005
|
// ../types/dist/leverageYield/leverageYield.js
|
|
3892
4006
|
var leverageYieldVaults = [
|
|
@@ -3917,6 +4031,20 @@ var leverageYieldVaults = [
|
|
|
3917
4031
|
fallbackAprPct: 2.4,
|
|
3918
4032
|
label: "Lido (stETH)"
|
|
3919
4033
|
}
|
|
4034
|
+
},
|
|
4035
|
+
{
|
|
4036
|
+
name: LsodaTokens.lsodaJITOSOL.symbol,
|
|
4037
|
+
vault: LsodaTokens.lsodaJITOSOL.vault,
|
|
4038
|
+
asset: SodaTokens.sodaJITOSOL.address,
|
|
4039
|
+
// sodaJITOSOL on Sonic
|
|
4040
|
+
borrowToken: SodaTokens.sodaSOL.address,
|
|
4041
|
+
// sodaSOL on Sonic
|
|
4042
|
+
lsdSource: {
|
|
4043
|
+
// DefiLlama pool for Jito's JitoSOL native staking on Solana (project: 'jito-liquid-staking').
|
|
4044
|
+
poolId: "0e7d0722-9054-4907-8593-567b353c0900",
|
|
4045
|
+
fallbackAprPct: 5.5,
|
|
4046
|
+
label: "Jito (JitoSOL)"
|
|
4047
|
+
}
|
|
3920
4048
|
}
|
|
3921
4049
|
];
|
|
3922
4050
|
var leverageYieldConfig = {
|
|
@@ -3924,11 +4052,8 @@ var leverageYieldConfig = {
|
|
|
3924
4052
|
};
|
|
3925
4053
|
|
|
3926
4054
|
// ../types/dist/sodax-config/sodax-config.js
|
|
3927
|
-
var bridgeConfig = {
|
|
3928
|
-
partnerFee: void 0
|
|
3929
|
-
};
|
|
4055
|
+
var bridgeConfig = {};
|
|
3930
4056
|
var sodaxConfig = {
|
|
3931
|
-
fee: void 0,
|
|
3932
4057
|
chains: spokeChainConfig,
|
|
3933
4058
|
swaps: swapsConfig,
|
|
3934
4059
|
moneyMarket: moneyMarketConfig,
|
|
@@ -4076,7 +4201,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
|
|
|
4076
4201
|
}
|
|
4077
4202
|
|
|
4078
4203
|
// ../types/dist/index.js
|
|
4079
|
-
var CONFIG_VERSION =
|
|
4204
|
+
var CONFIG_VERSION = 212;
|
|
4080
4205
|
function isEvmSpokeChainConfig(value) {
|
|
4081
4206
|
return typeof value === "object" && value !== null && value.chain.type === "EVM" && value.chain.key !== HUB_CHAIN_KEY;
|
|
4082
4207
|
}
|
|
@@ -4463,7 +4588,10 @@ async function pollForExecutedPacket(payload) {
|
|
|
4463
4588
|
}
|
|
4464
4589
|
const txPackets = txPacketsResult.value;
|
|
4465
4590
|
if (txPackets.success && txPackets.data.length > 0) {
|
|
4466
|
-
const
|
|
4591
|
+
const candidates = txPackets.data.filter(
|
|
4592
|
+
(packet2) => packet2.src_tx_hash.toLowerCase() === payload.srcTxHash.toLowerCase()
|
|
4593
|
+
);
|
|
4594
|
+
const packet = payload.selectPacket ? payload.selectPacket(candidates) : candidates[0];
|
|
4467
4595
|
if (packet?.status === "executed") {
|
|
4468
4596
|
return { kind: "found", packet };
|
|
4469
4597
|
}
|
|
@@ -13353,14 +13481,7 @@ function deepMerge(target, source) {
|
|
|
13353
13481
|
|
|
13354
13482
|
// src/shared/config/mergeSodaxConfig.ts
|
|
13355
13483
|
function mergeSodaxConfig(base2, override) {
|
|
13356
|
-
|
|
13357
|
-
if (override.fee !== void 0) {
|
|
13358
|
-
merged.fee = override.fee;
|
|
13359
|
-
}
|
|
13360
|
-
if (override.bridge?.partnerFee !== void 0) {
|
|
13361
|
-
merged.bridge.partnerFee = override.bridge.partnerFee;
|
|
13362
|
-
}
|
|
13363
|
-
return merged;
|
|
13484
|
+
return deepMerge(base2, override);
|
|
13364
13485
|
}
|
|
13365
13486
|
|
|
13366
13487
|
// src/shared/logger.ts
|
|
@@ -13400,6 +13521,12 @@ var ConfigService = class {
|
|
|
13400
13521
|
* {@link initialize}'s dynamic-config swap never clobbers it. Read by services via `config.logger`.
|
|
13401
13522
|
*/
|
|
13402
13523
|
logger;
|
|
13524
|
+
/**
|
|
13525
|
+
* Global partner fee. Resolved once at construction and kept independent of {@link sodax} so that
|
|
13526
|
+
* {@link initialize}'s dynamic-config swap never clobbers it. The backend never supplies it — it is
|
|
13527
|
+
* a client-side option set via `new Sodax({ fee })`. Per-feature overrides live on the feature config.
|
|
13528
|
+
*/
|
|
13529
|
+
fee;
|
|
13403
13530
|
initialized = false;
|
|
13404
13531
|
// data structures for quick lookup
|
|
13405
13532
|
supportedHubAssetsSet;
|
|
@@ -13411,11 +13538,12 @@ var ConfigService = class {
|
|
|
13411
13538
|
stakedATokenAddressesSet;
|
|
13412
13539
|
chainToSupportedTokenAddressMap;
|
|
13413
13540
|
hubAssetToXTokenMap;
|
|
13414
|
-
constructor({ api, config, userConfig, logger }) {
|
|
13541
|
+
constructor({ api, config, userConfig, logger, fee }) {
|
|
13415
13542
|
this.api = api;
|
|
13416
13543
|
this.sodax = config;
|
|
13417
13544
|
this.userConfig = userConfig;
|
|
13418
13545
|
this.logger = logger ?? resolveLogger(void 0);
|
|
13546
|
+
this.fee = fee;
|
|
13419
13547
|
this.loadSodaxConfigDataStructures(config);
|
|
13420
13548
|
}
|
|
13421
13549
|
async initialize() {
|
|
@@ -13648,6 +13776,24 @@ var ConfigService = class {
|
|
|
13648
13776
|
get moneyMarket() {
|
|
13649
13777
|
return this.sodax.moneyMarket;
|
|
13650
13778
|
}
|
|
13779
|
+
get leverageYield() {
|
|
13780
|
+
return this.sodax.leverageYield;
|
|
13781
|
+
}
|
|
13782
|
+
// Effective partner fee per feature: the feature-specific override if set, otherwise the global
|
|
13783
|
+
// `fee` client option ({@link fee}). The global fee is the default, overridable per-feature. `??`
|
|
13784
|
+
// (never a merge) keeps the chosen PartnerFee variant intact — no discriminated-union hybrid.
|
|
13785
|
+
get swapPartnerFee() {
|
|
13786
|
+
return this.swaps.partnerFee ?? this.fee;
|
|
13787
|
+
}
|
|
13788
|
+
get moneyMarketPartnerFee() {
|
|
13789
|
+
return this.moneyMarket.partnerFee ?? this.fee;
|
|
13790
|
+
}
|
|
13791
|
+
get bridgePartnerFee() {
|
|
13792
|
+
return this.bridge.partnerFee ?? this.fee;
|
|
13793
|
+
}
|
|
13794
|
+
get leverageYieldPartnerFee() {
|
|
13795
|
+
return this.leverageYield.partnerFee ?? this.fee;
|
|
13796
|
+
}
|
|
13651
13797
|
get dex() {
|
|
13652
13798
|
return this.sodax.dex;
|
|
13653
13799
|
}
|
|
@@ -14459,12 +14605,23 @@ var StacksSpokeService = class {
|
|
|
14459
14605
|
postConditionMode: core.PostConditionMode.Allow
|
|
14460
14606
|
};
|
|
14461
14607
|
if (params.raw === true) {
|
|
14462
|
-
if (
|
|
14463
|
-
throw new Error(
|
|
14608
|
+
if (!params.srcPublicKey) {
|
|
14609
|
+
throw new Error("Stacks raw transactions require srcPublicKey (the signer public key for srcAddress).");
|
|
14610
|
+
}
|
|
14611
|
+
let derivedAddress;
|
|
14612
|
+
try {
|
|
14613
|
+
derivedAddress = core.getAddressFromPublicKey(params.srcPublicKey, this.network);
|
|
14614
|
+
} catch (error) {
|
|
14615
|
+
throw new Error(`srcPublicKey is not a valid Stacks public key: ${error.message}`);
|
|
14616
|
+
}
|
|
14617
|
+
if (derivedAddress !== params.srcAddress) {
|
|
14618
|
+
throw new Error(
|
|
14619
|
+
`srcPublicKey does not match srcAddress: it derives ${derivedAddress}, but srcAddress is ${params.srcAddress}.`
|
|
14620
|
+
);
|
|
14464
14621
|
}
|
|
14465
14622
|
const tx = await core.makeUnsignedContractCall({
|
|
14466
14623
|
...reqData,
|
|
14467
|
-
publicKey: params.
|
|
14624
|
+
publicKey: params.srcPublicKey,
|
|
14468
14625
|
network: this.network,
|
|
14469
14626
|
fee: 0,
|
|
14470
14627
|
// placeholder — we'll estimate
|
|
@@ -17420,8 +17577,8 @@ function chain(...args) {
|
|
|
17420
17577
|
const id = (a) => a;
|
|
17421
17578
|
const wrap = (a, b) => (c) => a(b(c));
|
|
17422
17579
|
const encode3 = args.map((x) => x.encode).reduceRight(wrap, id);
|
|
17423
|
-
const
|
|
17424
|
-
return { encode: encode3, decode };
|
|
17580
|
+
const decode2 = args.map((x) => x.decode).reduce(wrap, id);
|
|
17581
|
+
return { encode: encode3, decode: decode2 };
|
|
17425
17582
|
}
|
|
17426
17583
|
// @__NO_SIDE_EFFECTS__
|
|
17427
17584
|
function alphabet(letters) {
|
|
@@ -23522,6 +23679,8 @@ var IconSpokeService = class {
|
|
|
23522
23679
|
};
|
|
23523
23680
|
}
|
|
23524
23681
|
};
|
|
23682
|
+
var GAS_BUFFER_MULTIPLIER = 1.2;
|
|
23683
|
+
var GAS_PRICE_REGEX = /^(\d+)(.*)$/;
|
|
23525
23684
|
var InjectiveSpokeService = class {
|
|
23526
23685
|
config;
|
|
23527
23686
|
chainGrpcWasmApi;
|
|
@@ -23529,6 +23688,7 @@ var InjectiveSpokeService = class {
|
|
|
23529
23688
|
endpoints;
|
|
23530
23689
|
pollingIntervalMs;
|
|
23531
23690
|
maxTimeoutMs;
|
|
23691
|
+
gasPrice;
|
|
23532
23692
|
constructor(config) {
|
|
23533
23693
|
this.config = config;
|
|
23534
23694
|
this.endpoints = networks.getNetworkEndpoints(networks.Network.Mainnet);
|
|
@@ -23536,6 +23696,16 @@ var InjectiveSpokeService = class {
|
|
|
23536
23696
|
this.txClient = new sdkTs.TxGrpcApi(this.endpoints.grpc);
|
|
23537
23697
|
this.pollingIntervalMs = this.config.sodaxConfig.chains[ChainKeys.INJECTIVE_MAINNET].pollingConfig.pollingIntervalMs;
|
|
23538
23698
|
this.maxTimeoutMs = this.config.sodaxConfig.chains[ChainKeys.INJECTIVE_MAINNET].pollingConfig.maxTimeoutMs;
|
|
23699
|
+
this.gasPrice = this.config.getChainConfig(ChainKeys.INJECTIVE_MAINNET).gasPrice;
|
|
23700
|
+
}
|
|
23701
|
+
/** Parse a chain-config gas price like `"500000000inj"` into its numeric price and denom. */
|
|
23702
|
+
parseGasPrice(gasPrice) {
|
|
23703
|
+
const match = GAS_PRICE_REGEX.exec(gasPrice);
|
|
23704
|
+
const price = match?.[1];
|
|
23705
|
+
if (price === void 0) {
|
|
23706
|
+
throw new Error(`Invalid Injective gasPrice config: ${gasPrice}`);
|
|
23707
|
+
}
|
|
23708
|
+
return { price: BigInt(price), denom: match?.[2] || "inj" };
|
|
23539
23709
|
}
|
|
23540
23710
|
/**
|
|
23541
23711
|
* Estimate the gas for a transaction.
|
|
@@ -23544,7 +23714,7 @@ var InjectiveSpokeService = class {
|
|
|
23544
23714
|
* @returns {Promise<InjectiveGasEstimate>} The estimated gas for the transaction.
|
|
23545
23715
|
*/
|
|
23546
23716
|
async estimateGas({ tx }) {
|
|
23547
|
-
const txRaw =
|
|
23717
|
+
const txRaw = tx_js.TxRaw.fromPartial({
|
|
23548
23718
|
bodyBytes: tx.signedDoc.bodyBytes,
|
|
23549
23719
|
authInfoBytes: tx.signedDoc.authInfoBytes,
|
|
23550
23720
|
signatures: []
|
|
@@ -23583,7 +23753,9 @@ var InjectiveSpokeService = class {
|
|
|
23583
23753
|
chainConfig.networkId,
|
|
23584
23754
|
from,
|
|
23585
23755
|
chainConfig.addresses.assetManager,
|
|
23586
|
-
msg
|
|
23756
|
+
msg,
|
|
23757
|
+
void 0,
|
|
23758
|
+
funds
|
|
23587
23759
|
);
|
|
23588
23760
|
}
|
|
23589
23761
|
const res = await params.walletProvider.execute(from, chainConfig.addresses.assetManager, msg, funds);
|
|
@@ -23604,27 +23776,50 @@ var InjectiveSpokeService = class {
|
|
|
23604
23776
|
);
|
|
23605
23777
|
return BigInt(sdkTs.fromBase64(response.data));
|
|
23606
23778
|
}
|
|
23607
|
-
async getRawTransaction(chainId, senderAddress, contractAddress, msg, memo) {
|
|
23779
|
+
async getRawTransaction(chainId, senderAddress, contractAddress, msg, memo, funds = []) {
|
|
23608
23780
|
const msgExec = sdkTs.MsgExecuteContract.fromJSON({
|
|
23609
23781
|
contractAddress,
|
|
23610
23782
|
sender: senderAddress,
|
|
23611
23783
|
msg,
|
|
23612
|
-
funds
|
|
23784
|
+
funds
|
|
23613
23785
|
});
|
|
23614
|
-
const
|
|
23786
|
+
const accountResponse = await new sdkTs.ChainRestAuthApi(this.endpoints.rest).fetchCosmosAccount(senderAddress);
|
|
23787
|
+
const baseAccount = sdkTs.BaseAccount.fromRestCosmosApi(accountResponse);
|
|
23788
|
+
const pubKey = baseAccount.pubKey.key;
|
|
23789
|
+
if (!pubKey) {
|
|
23790
|
+
throw new Error(`The pubKey for ${senderAddress} is missing \u2014 the account has not signed a transaction yet.`);
|
|
23791
|
+
}
|
|
23792
|
+
const txArgs = {
|
|
23615
23793
|
message: msgExec,
|
|
23616
23794
|
memo: memo || "",
|
|
23617
|
-
|
|
23618
|
-
|
|
23795
|
+
pubKey,
|
|
23796
|
+
sequence: baseAccount.sequence,
|
|
23797
|
+
accountNumber: baseAccount.accountNumber,
|
|
23619
23798
|
chainId
|
|
23620
|
-
}
|
|
23799
|
+
};
|
|
23800
|
+
const draft = sdkTs.createTransaction(txArgs);
|
|
23801
|
+
const { gasInfo } = await this.txClient.simulate(
|
|
23802
|
+
tx_js.TxRaw.fromPartial({
|
|
23803
|
+
bodyBytes: draft.txRaw.bodyBytes,
|
|
23804
|
+
authInfoBytes: draft.txRaw.authInfoBytes,
|
|
23805
|
+
signatures: []
|
|
23806
|
+
// not required for simulation
|
|
23807
|
+
})
|
|
23808
|
+
);
|
|
23809
|
+
const gas = Math.ceil(gasInfo.gasUsed * GAS_BUFFER_MULTIPLIER);
|
|
23810
|
+
const { price, denom } = this.parseGasPrice(this.gasPrice);
|
|
23811
|
+
const fee = {
|
|
23812
|
+
amount: [{ denom, amount: (BigInt(gas) * price).toString() }],
|
|
23813
|
+
gas: gas.toString()
|
|
23814
|
+
};
|
|
23815
|
+
const { txRaw, signDoc } = sdkTs.createTransaction({ ...txArgs, fee });
|
|
23621
23816
|
const rawTx = {
|
|
23622
23817
|
from: senderAddress,
|
|
23623
23818
|
to: contractAddress,
|
|
23624
23819
|
signedDoc: {
|
|
23625
23820
|
bodyBytes: txRaw.bodyBytes,
|
|
23626
23821
|
chainId,
|
|
23627
|
-
accountNumber: BigInt(
|
|
23822
|
+
accountNumber: BigInt(signDoc.accountNumber),
|
|
23628
23823
|
authInfoBytes: txRaw.authInfoBytes
|
|
23629
23824
|
}
|
|
23630
23825
|
};
|
|
@@ -25763,6 +25958,24 @@ var SolverApiService = class {
|
|
|
25763
25958
|
}
|
|
25764
25959
|
}
|
|
25765
25960
|
};
|
|
25961
|
+
function decodePacketIntentTarget(payload) {
|
|
25962
|
+
try {
|
|
25963
|
+
const hex = payload.startsWith("0x") ? payload.slice(2) : payload;
|
|
25964
|
+
const decoded = rlp__namespace.decode(Buffer.from(hex, "hex"));
|
|
25965
|
+
const field1 = decoded?.[1];
|
|
25966
|
+
if (!field1 || field1.length === 0) return void 0;
|
|
25967
|
+
return `0x${Buffer.from(field1).toString("hex")}`.toLowerCase();
|
|
25968
|
+
} catch {
|
|
25969
|
+
return void 0;
|
|
25970
|
+
}
|
|
25971
|
+
}
|
|
25972
|
+
function selectSolvedIntentPacket(packets, intentsContract) {
|
|
25973
|
+
if (packets.length <= 1) return packets[0];
|
|
25974
|
+
const target = intentsContract.toLowerCase();
|
|
25975
|
+
const matched = packets.find((packet) => decodePacketIntentTarget(packet.payload) === target);
|
|
25976
|
+
if (matched) return matched;
|
|
25977
|
+
return packets.reduce((highest, packet) => packet.conn_sn > highest.conn_sn ? packet : highest);
|
|
25978
|
+
}
|
|
25766
25979
|
|
|
25767
25980
|
// src/swap/errors.ts
|
|
25768
25981
|
var swapInvariant = createInvariant("swap");
|
|
@@ -25798,7 +26011,7 @@ var SwapService = class {
|
|
|
25798
26011
|
relayerApiEndpoint;
|
|
25799
26012
|
constructor({ config, hubProvider, spoke }) {
|
|
25800
26013
|
this.solver = config.solver;
|
|
25801
|
-
this.partnerFee = config.
|
|
26014
|
+
this.partnerFee = config.swapPartnerFee;
|
|
25802
26015
|
this.relayerApiEndpoint = config.relay.relayerApiEndpoint;
|
|
25803
26016
|
this.config = config;
|
|
25804
26017
|
this.hubProvider = hubProvider;
|
|
@@ -25816,10 +26029,13 @@ var SwapService = class {
|
|
|
25816
26029
|
/**
|
|
25817
26030
|
* Requests a price quote from the solver API for a given token pair and amount.
|
|
25818
26031
|
*
|
|
25819
|
-
* Adjusts `payload.amount` by the
|
|
25820
|
-
*
|
|
26032
|
+
* Adjusts `payload.amount` by the partner fee before forwarding to the solver, so the returned
|
|
26033
|
+
* `quoted_amount` reflects the net output the user actually receives. Pass `partnerFee` to match
|
|
26034
|
+
* a per-action override supplied to `createIntent` (`extras.partnerFee`); omit it to use the
|
|
26035
|
+
* configured swap fee.
|
|
25821
26036
|
*
|
|
25822
|
-
* @param payload -
|
|
26037
|
+
* @param payload - The solver quote request, optionally carrying a per-call `partnerFee` override
|
|
26038
|
+
* (defaults to the configured swap partner fee). `partnerFee` is stripped before forwarding.
|
|
25823
26039
|
* @returns A `Result` containing `{ quoted_amount: bigint }` on success, or a
|
|
25824
26040
|
* `SolverErrorResponse` (with a `SolverIntentErrorCode`) on failure.
|
|
25825
26041
|
*
|
|
@@ -25835,11 +26051,12 @@ var SwapService = class {
|
|
|
25835
26051
|
* if (response.ok) console.log('Quoted amount:', response.value.quoted_amount);
|
|
25836
26052
|
*/
|
|
25837
26053
|
async getQuote(payload) {
|
|
25838
|
-
|
|
25839
|
-
|
|
25840
|
-
|
|
26054
|
+
const { partnerFee = this.partnerFee, ...request } = payload;
|
|
26055
|
+
const adjustedPayload = {
|
|
26056
|
+
...request,
|
|
26057
|
+
amount: adjustAmountByFee(request.amount, partnerFee, request.quote_type)
|
|
25841
26058
|
};
|
|
25842
|
-
return SolverApiService.getQuote(
|
|
26059
|
+
return SolverApiService.getQuote(adjustedPayload, this.solver, this.config);
|
|
25843
26060
|
}
|
|
25844
26061
|
/**
|
|
25845
26062
|
* Calculates the partner fee that will be deducted from the given input amount.
|
|
@@ -26189,7 +26406,8 @@ var SwapService = class {
|
|
|
26189
26406
|
* - `UNKNOWN` — defensive fallback.
|
|
26190
26407
|
*/
|
|
26191
26408
|
async createIntent(_params) {
|
|
26192
|
-
const { params, skipSimulation } = _params;
|
|
26409
|
+
const { params, skipSimulation, extras } = _params;
|
|
26410
|
+
const partnerFee = extras?.partnerFee ?? this.partnerFee;
|
|
26193
26411
|
const baseCtx = { srcChainKey: params.srcChainKey, dstChainKey: params.dstChainKey };
|
|
26194
26412
|
try {
|
|
26195
26413
|
swapInvariant(
|
|
@@ -26224,6 +26442,13 @@ var SwapService = class {
|
|
|
26224
26442
|
{ ...baseCtx, field: "minOutputAmount" }
|
|
26225
26443
|
);
|
|
26226
26444
|
}
|
|
26445
|
+
if (isStacksChainKeyType(params.srcChainKey) && _params.raw === true) {
|
|
26446
|
+
swapInvariant(
|
|
26447
|
+
extras?.srcPublicKey !== void 0,
|
|
26448
|
+
"srcPublicKey is required for Stacks createIntent (raw) \u2014 the source tx is built unsigned and needs the signer public key",
|
|
26449
|
+
{ ...baseCtx, field: "srcPublicKey" }
|
|
26450
|
+
);
|
|
26451
|
+
}
|
|
26227
26452
|
const personalAddress = params.srcAddress;
|
|
26228
26453
|
let walletAddress = personalAddress;
|
|
26229
26454
|
if (isBitcoinChainKeyType(params.srcChainKey) && _params.raw === false) {
|
|
@@ -26241,7 +26466,7 @@ var SwapService = class {
|
|
|
26241
26466
|
createIntentParams: params,
|
|
26242
26467
|
creatorHubWalletAddress,
|
|
26243
26468
|
solverConfig: this.solver,
|
|
26244
|
-
fee:
|
|
26469
|
+
fee: partnerFee,
|
|
26245
26470
|
hubProvider: this.hubProvider
|
|
26246
26471
|
};
|
|
26247
26472
|
const [txResult2, intent2, feeAmount2, data2] = await SonicSpokeService.createSwapIntent(
|
|
@@ -26267,11 +26492,12 @@ var SwapService = class {
|
|
|
26267
26492
|
},
|
|
26268
26493
|
creatorHubWalletAddress,
|
|
26269
26494
|
this.config,
|
|
26270
|
-
|
|
26495
|
+
partnerFee
|
|
26271
26496
|
);
|
|
26272
26497
|
const coreDepositParams = {
|
|
26273
26498
|
srcChainKey: params.srcChainKey,
|
|
26274
26499
|
srcAddress: walletAddress,
|
|
26500
|
+
srcPublicKey: extras?.srcPublicKey,
|
|
26275
26501
|
to: creatorHubWalletAddress,
|
|
26276
26502
|
token: params.inputToken,
|
|
26277
26503
|
amount: params.inputAmount,
|
|
@@ -26590,6 +26816,11 @@ var SwapService = class {
|
|
|
26590
26816
|
* Use this after `getStatus` returns `SolverIntentStatusCode.SOLVED (3)` to obtain the
|
|
26591
26817
|
* destination-chain transaction hash from `packet.dst_tx_hash`.
|
|
26592
26818
|
*
|
|
26819
|
+
* A single solver fill tx emits multiple relay packets sharing the same `src_tx_hash`. The
|
|
26820
|
+
* user-facing `IntentFilled` delivery is the packet whose payload targets the hub intents
|
|
26821
|
+
* contract; `selectSolvedIntentPacket` disambiguates so the returned `dst_tx_hash` is the
|
|
26822
|
+
* destination delivery tx rather than an internal hop.
|
|
26823
|
+
*
|
|
26593
26824
|
* @param chainId - The destination spoke chain key (where output tokens are delivered).
|
|
26594
26825
|
* @param fillTxHash - The solver's fill transaction hash, obtained from `getStatus.fill_tx_hash`.
|
|
26595
26826
|
* @param timeout - Poll timeout in milliseconds. Defaults to `DEFAULT_RELAY_TX_TIMEOUT` (120 s).
|
|
@@ -26605,7 +26836,8 @@ var SwapService = class {
|
|
|
26605
26836
|
intentRelayChainId: getIntentRelayChainId(chainId).toString(),
|
|
26606
26837
|
srcTxHash: fillTxHash,
|
|
26607
26838
|
timeout,
|
|
26608
|
-
apiUrl: this.relayerApiEndpoint
|
|
26839
|
+
apiUrl: this.relayerApiEndpoint,
|
|
26840
|
+
selectPacket: (packets) => selectSolvedIntentPacket(packets, this.solver.intentsContract)
|
|
26609
26841
|
});
|
|
26610
26842
|
}
|
|
26611
26843
|
/**
|
|
@@ -29130,10 +29362,10 @@ var BridgeService = class {
|
|
|
29130
29362
|
* @returns Fee amount to be deducted, in the same units as `inputAmount`.
|
|
29131
29363
|
*/
|
|
29132
29364
|
getFee(inputAmount) {
|
|
29133
|
-
if (!this.config.
|
|
29365
|
+
if (!this.config.bridgePartnerFee) {
|
|
29134
29366
|
return 0n;
|
|
29135
29367
|
}
|
|
29136
|
-
return calculateFeeAmount(inputAmount, this.config.
|
|
29368
|
+
return calculateFeeAmount(inputAmount, this.config.bridgePartnerFee);
|
|
29137
29369
|
}
|
|
29138
29370
|
/**
|
|
29139
29371
|
* Checks whether the caller has sufficient token allowance to execute the bridge.
|
|
@@ -29410,7 +29642,7 @@ var BridgeService = class {
|
|
|
29410
29642
|
}
|
|
29411
29643
|
const hubWallet = await this.hubProvider.getUserHubWalletAddress(walletAddress, params.srcChainKey);
|
|
29412
29644
|
const effectiveSkipSimulation = skipSimulation || isBitcoinChainKeyType(params.srcChainKey) && this.spoke.bitcoin.walletMode === "USER";
|
|
29413
|
-
const data = this.buildBridgeData(params, srcToken, dstToken, this.config.
|
|
29645
|
+
const data = this.buildBridgeData(params, srcToken, dstToken, this.config.bridgePartnerFee);
|
|
29414
29646
|
const coreParams = {
|
|
29415
29647
|
srcChainKey: params.srcChainKey,
|
|
29416
29648
|
srcAddress: walletAddress,
|
|
@@ -35289,7 +35521,7 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
35289
35521
|
this.config = config;
|
|
35290
35522
|
this.hubProvider = hubProvider;
|
|
35291
35523
|
this.spoke = spoke;
|
|
35292
|
-
this.partnerFee = config.
|
|
35524
|
+
this.partnerFee = config.moneyMarketPartnerFee;
|
|
35293
35525
|
this.relayerApiEndpoint = config.relay.relayerApiEndpoint;
|
|
35294
35526
|
this.data = new MoneyMarketDataService({ hubProvider, config });
|
|
35295
35527
|
}
|
|
@@ -37431,7 +37663,7 @@ var LeverageYieldService = class {
|
|
|
37431
37663
|
* `UNKNOWN` (defensive fallback).
|
|
37432
37664
|
*/
|
|
37433
37665
|
async createVaultIntent(_params) {
|
|
37434
|
-
const { params, skipSimulation, hubWalletSwap, partnerFee = this.config.
|
|
37666
|
+
const { params, skipSimulation, hubWalletSwap, partnerFee = this.config.swapPartnerFee } = _params;
|
|
37435
37667
|
const baseCtx = { srcChainKey: params.srcChainKey, dstChainKey: params.dstChainKey };
|
|
37436
37668
|
try {
|
|
37437
37669
|
leverageYieldInvariant(
|
|
@@ -38063,11 +38295,18 @@ var Sodax = class {
|
|
|
38063
38295
|
// hub provider for the hub chain (e.g. Sonic mainnet)
|
|
38064
38296
|
spoke;
|
|
38065
38297
|
// spoke service enabling spoke chain operations
|
|
38066
|
-
constructor(
|
|
38067
|
-
const logger = resolveLogger(
|
|
38068
|
-
|
|
38298
|
+
constructor(options) {
|
|
38299
|
+
const logger = resolveLogger(options?.logger);
|
|
38300
|
+
const fee = options?.fee;
|
|
38301
|
+
this.instanceConfig = options ? mergeSodaxConfig(sodaxConfig, options) : sodaxConfig;
|
|
38069
38302
|
this.backendApi = new BackendApiService(this.instanceConfig.api, logger);
|
|
38070
|
-
this.config = new ConfigService({
|
|
38303
|
+
this.config = new ConfigService({
|
|
38304
|
+
api: this.backendApi,
|
|
38305
|
+
config: this.instanceConfig,
|
|
38306
|
+
userConfig: options,
|
|
38307
|
+
logger,
|
|
38308
|
+
fee
|
|
38309
|
+
});
|
|
38071
38310
|
this.hubProvider = new EvmHubProvider({ config: this.config });
|
|
38072
38311
|
this.spoke = new SpokeService({ config: this.config, hubProvider: this.hubProvider });
|
|
38073
38312
|
this.swaps = new SwapService({
|
|
@@ -38362,6 +38601,7 @@ exports.getReserveNormalizedIncome = getReserveNormalizedIncome;
|
|
|
38362
38601
|
exports.getReservesEModes = getReservesEModes;
|
|
38363
38602
|
exports.getSolanaAddressBytes = getSolanaAddressBytes;
|
|
38364
38603
|
exports.getSolverConfig = getSolverConfig;
|
|
38604
|
+
exports.getStagingSolverTokens = getStagingSolverTokens;
|
|
38365
38605
|
exports.getSupportedSolverTokens = getSupportedSolverTokens;
|
|
38366
38606
|
exports.getTransactionPackets = getTransactionPackets;
|
|
38367
38607
|
exports.getbnUSDToken = getbnUSDToken;
|
|
@@ -38539,6 +38779,7 @@ exports.spokeAssetManagerAbi = spokeAssetManagerAbi;
|
|
|
38539
38779
|
exports.spokeChainConfig = spokeChainConfig;
|
|
38540
38780
|
exports.spokeChainKeysSet = spokeChainKeysSet;
|
|
38541
38781
|
exports.stacksSupportedTokens = stacksSupportedTokens;
|
|
38782
|
+
exports.stagingSwapSupportedTokens = stagingSwapSupportedTokens;
|
|
38542
38783
|
exports.stakedSodaAbi = stakedSodaAbi;
|
|
38543
38784
|
exports.stakingInvariant = stakingInvariant;
|
|
38544
38785
|
exports.stakingRouterAbi = stakingRouterAbi;
|