@sodax/sdk 0.0.1-rc.37 → 0.0.1-rc.39
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 +13 -2
- package/dist/index.cjs +555 -130
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +370 -76
- package/dist/index.d.ts +370 -76
- package/dist/index.mjs +550 -126
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var chains = require('viem/chains');
|
|
|
5
5
|
var types = require('@sodax/types');
|
|
6
6
|
var sdkTs = require('@injectivelabs/sdk-ts');
|
|
7
7
|
var networks = require('@injectivelabs/networks');
|
|
8
|
-
var
|
|
8
|
+
var iconSdkJs = require('icon-sdk-js');
|
|
9
9
|
var stellarSdk = require('@stellar/stellar-sdk');
|
|
10
10
|
var bcs = require('@mysten/sui/bcs');
|
|
11
11
|
var client = require('@mysten/sui/client');
|
|
@@ -39,7 +39,6 @@ function _interopNamespace(e) {
|
|
|
39
39
|
return Object.freeze(n);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
var IconSdkRaw__namespace = /*#__PURE__*/_interopNamespace(IconSdkRaw);
|
|
43
42
|
var rlp__namespace = /*#__PURE__*/_interopNamespace(rlp);
|
|
44
43
|
var anchor__namespace = /*#__PURE__*/_interopNamespace(anchor);
|
|
45
44
|
var BN__default = /*#__PURE__*/_interopDefault(BN);
|
|
@@ -6148,22 +6147,6 @@ var DEFAULT_BACKEND_API_HEADERS = {
|
|
|
6148
6147
|
Accept: "application/json"
|
|
6149
6148
|
};
|
|
6150
6149
|
var VAULT_TOKEN_DECIMALS = 18;
|
|
6151
|
-
var INTENT_RELAY_CHAIN_IDS = {
|
|
6152
|
-
AVAX: 6n,
|
|
6153
|
-
SUI: 21n,
|
|
6154
|
-
SONIC: 146n,
|
|
6155
|
-
STELLAR: 27n,
|
|
6156
|
-
INJ: 19n,
|
|
6157
|
-
SOL: 1n,
|
|
6158
|
-
ICON: 1768124270n,
|
|
6159
|
-
BASE: 30n,
|
|
6160
|
-
BINANCE: 4n,
|
|
6161
|
-
OPTIMISM: 24n,
|
|
6162
|
-
POLYGON: 5n,
|
|
6163
|
-
ARBITRUM: 23n,
|
|
6164
|
-
NIBIRU: 7235938n,
|
|
6165
|
-
HYPER: 26745n
|
|
6166
|
-
};
|
|
6167
6150
|
var EVM_CHAIN_IDS = [
|
|
6168
6151
|
types.AVALANCHE_MAINNET_CHAIN_ID,
|
|
6169
6152
|
types.ARBITRUM_MAINNET_CHAIN_ID,
|
|
@@ -6173,34 +6156,25 @@ var EVM_CHAIN_IDS = [
|
|
|
6173
6156
|
types.OPTIMISM_MAINNET_CHAIN_ID,
|
|
6174
6157
|
types.POLYGON_MAINNET_CHAIN_ID,
|
|
6175
6158
|
types.NIBIRU_MAINNET_CHAIN_ID,
|
|
6176
|
-
types.HYPEREVM_MAINNET_CHAIN_ID
|
|
6177
|
-
|
|
6178
|
-
var EVM_SPOKE_CHAIN_IDS = [
|
|
6179
|
-
types.AVALANCHE_MAINNET_CHAIN_ID,
|
|
6180
|
-
types.ARBITRUM_MAINNET_CHAIN_ID,
|
|
6181
|
-
types.BASE_MAINNET_CHAIN_ID,
|
|
6182
|
-
types.BSC_MAINNET_CHAIN_ID,
|
|
6183
|
-
types.OPTIMISM_MAINNET_CHAIN_ID,
|
|
6184
|
-
types.POLYGON_MAINNET_CHAIN_ID,
|
|
6185
|
-
types.NIBIRU_MAINNET_CHAIN_ID,
|
|
6186
|
-
types.SONIC_MAINNET_CHAIN_ID,
|
|
6187
|
-
types.HYPEREVM_MAINNET_CHAIN_ID
|
|
6159
|
+
types.HYPEREVM_MAINNET_CHAIN_ID,
|
|
6160
|
+
types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
6188
6161
|
];
|
|
6189
6162
|
var ChainIdToIntentRelayChainId = {
|
|
6190
|
-
[types.AVALANCHE_MAINNET_CHAIN_ID]:
|
|
6191
|
-
[types.ARBITRUM_MAINNET_CHAIN_ID]:
|
|
6192
|
-
[types.BASE_MAINNET_CHAIN_ID]:
|
|
6193
|
-
[types.BSC_MAINNET_CHAIN_ID]:
|
|
6194
|
-
[types.INJECTIVE_MAINNET_CHAIN_ID]:
|
|
6195
|
-
[types.SONIC_MAINNET_CHAIN_ID]:
|
|
6196
|
-
[types.OPTIMISM_MAINNET_CHAIN_ID]:
|
|
6197
|
-
[types.POLYGON_MAINNET_CHAIN_ID]:
|
|
6198
|
-
[types.SOLANA_MAINNET_CHAIN_ID]:
|
|
6199
|
-
[types.SUI_MAINNET_CHAIN_ID]:
|
|
6200
|
-
[types.STELLAR_MAINNET_CHAIN_ID]:
|
|
6201
|
-
[types.ICON_MAINNET_CHAIN_ID]:
|
|
6202
|
-
[types.NIBIRU_MAINNET_CHAIN_ID]:
|
|
6203
|
-
[types.HYPEREVM_MAINNET_CHAIN_ID]:
|
|
6163
|
+
[types.AVALANCHE_MAINNET_CHAIN_ID]: 6n,
|
|
6164
|
+
[types.ARBITRUM_MAINNET_CHAIN_ID]: 23n,
|
|
6165
|
+
[types.BASE_MAINNET_CHAIN_ID]: 30n,
|
|
6166
|
+
[types.BSC_MAINNET_CHAIN_ID]: 4n,
|
|
6167
|
+
[types.INJECTIVE_MAINNET_CHAIN_ID]: 19n,
|
|
6168
|
+
[types.SONIC_MAINNET_CHAIN_ID]: 146n,
|
|
6169
|
+
[types.OPTIMISM_MAINNET_CHAIN_ID]: 24n,
|
|
6170
|
+
[types.POLYGON_MAINNET_CHAIN_ID]: 5n,
|
|
6171
|
+
[types.SOLANA_MAINNET_CHAIN_ID]: 1n,
|
|
6172
|
+
[types.SUI_MAINNET_CHAIN_ID]: 21n,
|
|
6173
|
+
[types.STELLAR_MAINNET_CHAIN_ID]: 27n,
|
|
6174
|
+
[types.ICON_MAINNET_CHAIN_ID]: 1768124270n,
|
|
6175
|
+
[types.NIBIRU_MAINNET_CHAIN_ID]: 7235938n,
|
|
6176
|
+
[types.HYPEREVM_MAINNET_CHAIN_ID]: 26745n,
|
|
6177
|
+
[types.LIGHTLINK_MAINNET_CHAIN_ID]: 27756n
|
|
6204
6178
|
};
|
|
6205
6179
|
var getIntentRelayChainId = (chainId) => ChainIdToIntentRelayChainId[chainId];
|
|
6206
6180
|
var hyper = /* @__PURE__ */ viem.defineChain({
|
|
@@ -6247,6 +6221,8 @@ function getEvmViemChain(id) {
|
|
|
6247
6221
|
return chains.nibiru;
|
|
6248
6222
|
case types.HYPEREVM_MAINNET_CHAIN_ID:
|
|
6249
6223
|
return hyper;
|
|
6224
|
+
case types.LIGHTLINK_MAINNET_CHAIN_ID:
|
|
6225
|
+
return chains.lightlinkPhoenix;
|
|
6250
6226
|
default:
|
|
6251
6227
|
throw new Error(`Unsupported EVM chain ID: ${id}`);
|
|
6252
6228
|
}
|
|
@@ -6962,6 +6938,119 @@ var spokeChainConfig = {
|
|
|
6962
6938
|
}
|
|
6963
6939
|
}
|
|
6964
6940
|
},
|
|
6941
|
+
[types.LIGHTLINK_MAINNET_CHAIN_ID]: {
|
|
6942
|
+
chain: {
|
|
6943
|
+
name: "lightlink phoenix",
|
|
6944
|
+
id: types.LIGHTLINK_MAINNET_CHAIN_ID,
|
|
6945
|
+
type: "EVM"
|
|
6946
|
+
},
|
|
6947
|
+
addresses: {
|
|
6948
|
+
assetManager: "0x4A1C82744cDDeE675A255fB289Cb0917A482e7C7",
|
|
6949
|
+
connection: "0x6D2126DB97dd88AfA85127253807D04A066b6746"
|
|
6950
|
+
},
|
|
6951
|
+
nativeToken: "0x0000000000000000000000000000000000000000",
|
|
6952
|
+
bnUSD: "0x36134A03dcD03Bbe858B8F7ED28a71AAC608F9E7",
|
|
6953
|
+
supportedTokens: {
|
|
6954
|
+
ETH: {
|
|
6955
|
+
symbol: "ETH",
|
|
6956
|
+
name: "ETH",
|
|
6957
|
+
decimals: 18,
|
|
6958
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
6959
|
+
xChainId: types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
6960
|
+
},
|
|
6961
|
+
bnUSD: {
|
|
6962
|
+
symbol: "bnUSD",
|
|
6963
|
+
name: "bnUSD",
|
|
6964
|
+
decimals: 18,
|
|
6965
|
+
address: "0x36134A03dcD03Bbe858B8F7ED28a71AAC608F9E7",
|
|
6966
|
+
xChainId: types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
6967
|
+
},
|
|
6968
|
+
SODA: {
|
|
6969
|
+
symbol: "SODA",
|
|
6970
|
+
name: "SODAX",
|
|
6971
|
+
decimals: 18,
|
|
6972
|
+
address: "0x6BC8C37cba91F76E68C9e6d689A9C21E4d32079B",
|
|
6973
|
+
xChainId: types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
6974
|
+
},
|
|
6975
|
+
USDC: {
|
|
6976
|
+
symbol: "USDC",
|
|
6977
|
+
name: "USD Coin",
|
|
6978
|
+
decimals: 6,
|
|
6979
|
+
address: "0xbCF8C1B03bBDDA88D579330BDF236B58F8bb2cFd",
|
|
6980
|
+
xChainId: types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
6981
|
+
},
|
|
6982
|
+
"BTC.LL": {
|
|
6983
|
+
symbol: "BTC.LL",
|
|
6984
|
+
name: "Bitcoin LightLINK",
|
|
6985
|
+
decimals: 18,
|
|
6986
|
+
address: "0x5E921D8B7709b409132628258A53449D1fD82341",
|
|
6987
|
+
xChainId: types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
6988
|
+
},
|
|
6989
|
+
"AVAX.LL": {
|
|
6990
|
+
symbol: "AVAX.LL",
|
|
6991
|
+
name: "Avalanche LightLINK",
|
|
6992
|
+
decimals: 18,
|
|
6993
|
+
address: "0x373d9c5390535e9e30185E52826d45b76df09aBb",
|
|
6994
|
+
xChainId: types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
6995
|
+
},
|
|
6996
|
+
"BNB.LL": {
|
|
6997
|
+
symbol: "BNB.LL",
|
|
6998
|
+
name: "BNB LightLINK",
|
|
6999
|
+
decimals: 18,
|
|
7000
|
+
address: "0xe80c2B7674dCdF47b199697E2c61730231b8da89",
|
|
7001
|
+
xChainId: types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
7002
|
+
},
|
|
7003
|
+
"SOL.LL": {
|
|
7004
|
+
symbol: "SOL.LL",
|
|
7005
|
+
name: "Solana LightLINK",
|
|
7006
|
+
decimals: 18,
|
|
7007
|
+
address: "0xba9af7029Ae5c1054Fc367d5D6a47Dc3D5c0D6bA",
|
|
7008
|
+
xChainId: types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
7009
|
+
},
|
|
7010
|
+
"XLM.LL": {
|
|
7011
|
+
symbol: "XLM.LL",
|
|
7012
|
+
name: "Stellar LightLINK",
|
|
7013
|
+
decimals: 18,
|
|
7014
|
+
address: "0x03beDD719b6d8de11f5B2671b2f30085a626F8Da",
|
|
7015
|
+
xChainId: types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
7016
|
+
},
|
|
7017
|
+
"INJ.LL": {
|
|
7018
|
+
symbol: "INJ.LL",
|
|
7019
|
+
name: "Injective LightLINK",
|
|
7020
|
+
decimals: 18,
|
|
7021
|
+
address: "0x8a4C8B1A899Fa9D9246a112E8D43EC0C97b77B8C",
|
|
7022
|
+
xChainId: types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
7023
|
+
},
|
|
7024
|
+
"SUI.LL": {
|
|
7025
|
+
symbol: "SUI.LL",
|
|
7026
|
+
name: "Sui LightLINK",
|
|
7027
|
+
decimals: 18,
|
|
7028
|
+
address: "0x59e68e2F5147F74F27FD173397a7419C1e5d9999",
|
|
7029
|
+
xChainId: types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
7030
|
+
},
|
|
7031
|
+
"S.LL": {
|
|
7032
|
+
symbol: "S.LL",
|
|
7033
|
+
name: "Sonic LightLINK",
|
|
7034
|
+
decimals: 18,
|
|
7035
|
+
address: "0xb3A47798CB6585Ea0d31a7986f2a04b25C60247f",
|
|
7036
|
+
xChainId: types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
7037
|
+
},
|
|
7038
|
+
"POL.LL": {
|
|
7039
|
+
symbol: "POL.LL",
|
|
7040
|
+
name: "Polygon LightLINK",
|
|
7041
|
+
decimals: 18,
|
|
7042
|
+
address: "0xE963bfb4757fC8Ae66BC68E11e636f8fbafAfCb4",
|
|
7043
|
+
xChainId: types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
7044
|
+
},
|
|
7045
|
+
"HYPE.LL": {
|
|
7046
|
+
symbol: "HYPE.LL",
|
|
7047
|
+
name: "HyperEVM LightLINK",
|
|
7048
|
+
decimals: 18,
|
|
7049
|
+
address: "0x127b64fb645279F8aca786c507b94dde81F02d16",
|
|
7050
|
+
xChainId: types.LIGHTLINK_MAINNET_CHAIN_ID
|
|
7051
|
+
}
|
|
7052
|
+
}
|
|
7053
|
+
},
|
|
6965
7054
|
[types.INJECTIVE_MAINNET_CHAIN_ID]: {
|
|
6966
7055
|
addresses: {
|
|
6967
7056
|
assetManager: "inj1dg6tm62uup53wn2kn97caeqfwt0sukx3qjk8rw",
|
|
@@ -7023,6 +7112,23 @@ var spokeChainConfig = {
|
|
|
7023
7112
|
rateLimit: "CB6G3ULISTTBPXUN3BI6ADHQGWJEN7BPQINHL45TCB6TDFM5QWU24HAY",
|
|
7024
7113
|
testToken: ""
|
|
7025
7114
|
},
|
|
7115
|
+
trustlineConfigs: [
|
|
7116
|
+
{
|
|
7117
|
+
assetCode: "USDC",
|
|
7118
|
+
contractId: "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75",
|
|
7119
|
+
assetIssuer: "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN"
|
|
7120
|
+
},
|
|
7121
|
+
{
|
|
7122
|
+
assetCode: "bnUSD",
|
|
7123
|
+
contractId: "CD6YBFFWMU2UJHX2NGRJ7RN76IJVTCC7MRA46DUBXNB7E6W7H7JRJ2CX",
|
|
7124
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
7125
|
+
},
|
|
7126
|
+
{
|
|
7127
|
+
assetCode: "SODA",
|
|
7128
|
+
contractId: "CAH5LKJC2ZB4RVUVEVL2QWJWNJLHQE2UF767ILLQ5EQ4O3OURR2XIUGM",
|
|
7129
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
7130
|
+
}
|
|
7131
|
+
],
|
|
7026
7132
|
supportedTokens: {
|
|
7027
7133
|
bnUSD: {
|
|
7028
7134
|
symbol: "bnUSD",
|
|
@@ -7238,7 +7344,8 @@ var hubVaults = {
|
|
|
7238
7344
|
address: "0x62ecc3eeb80a162c57624b3ff80313fe69f5203e",
|
|
7239
7345
|
reserves: [
|
|
7240
7346
|
// hub asset addresses contained in the vault
|
|
7241
|
-
"0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38"
|
|
7347
|
+
"0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38",
|
|
7348
|
+
"0xb592d2631ccf245119532e025d11188cfadb6777"
|
|
7242
7349
|
]
|
|
7243
7350
|
},
|
|
7244
7351
|
[SodaTokens.sodaNIBI.symbol]: {
|
|
@@ -7333,8 +7440,10 @@ var hubVaults = {
|
|
|
7333
7440
|
// Arbitrum ETH hub asset
|
|
7334
7441
|
"0x57fc2ac5701e463ae261adbd6c99fbeb48ce5293",
|
|
7335
7442
|
// BSC ETH hub asset
|
|
7336
|
-
"0x50c42deacd8fc9773493ed674b675be577f2634b"
|
|
7443
|
+
"0x50c42deacd8fc9773493ed674b675be577f2634b",
|
|
7337
7444
|
// Sonic WETH hub asset
|
|
7445
|
+
"0x19920ef8fe1a9d51fdb0914abbb2f970c74dca68"
|
|
7446
|
+
// Lightlink ETH hub asset
|
|
7338
7447
|
]
|
|
7339
7448
|
},
|
|
7340
7449
|
[SodaTokens.sodaBTC.symbol]: {
|
|
@@ -7443,7 +7552,7 @@ var bnUSDLegacySpokeChainIds = [
|
|
|
7443
7552
|
types.SUI_MAINNET_CHAIN_ID,
|
|
7444
7553
|
types.STELLAR_MAINNET_CHAIN_ID
|
|
7445
7554
|
];
|
|
7446
|
-
var newbnUSDSpokeChainIds = types.
|
|
7555
|
+
var newbnUSDSpokeChainIds = types.CHAIN_IDS.filter((chainId) => chainId !== types.ICON_MAINNET_CHAIN_ID);
|
|
7447
7556
|
var bnUSDLegacyTokens = [
|
|
7448
7557
|
spokeChainConfig[types.ICON_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
7449
7558
|
spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.legacybnUSD,
|
|
@@ -7477,14 +7586,14 @@ var getAllLegacybnUSDTokens = () => {
|
|
|
7477
7586
|
var hubAssets = {
|
|
7478
7587
|
[types.SONIC_MAINNET_CHAIN_ID]: {
|
|
7479
7588
|
[spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].nativeToken]: {
|
|
7480
|
-
asset: spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.
|
|
7589
|
+
asset: spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.wS.address,
|
|
7481
7590
|
decimal: 18,
|
|
7482
7591
|
symbol: "S",
|
|
7483
7592
|
name: "Sonic",
|
|
7484
7593
|
vault: hubVaults.sodaS.address
|
|
7485
7594
|
},
|
|
7486
7595
|
[spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].bnUSD]: {
|
|
7487
|
-
asset:
|
|
7596
|
+
asset: spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].bnUSD,
|
|
7488
7597
|
decimal: 18,
|
|
7489
7598
|
symbol: "bnUSD",
|
|
7490
7599
|
name: "bnUSD",
|
|
@@ -7857,6 +7966,106 @@ var hubAssets = {
|
|
|
7857
7966
|
vault: hubVaults.sodaSODA.address
|
|
7858
7967
|
}
|
|
7859
7968
|
},
|
|
7969
|
+
[types.LIGHTLINK_MAINNET_CHAIN_ID]: {
|
|
7970
|
+
[spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].nativeToken]: {
|
|
7971
|
+
asset: "0x19920ef8fe1a9d51fdb0914abbb2f970c74dca68",
|
|
7972
|
+
decimal: 18,
|
|
7973
|
+
symbol: "ETH",
|
|
7974
|
+
name: "ETH",
|
|
7975
|
+
vault: hubVaults.sodaETH.address
|
|
7976
|
+
},
|
|
7977
|
+
[spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].bnUSD]: {
|
|
7978
|
+
asset: "0x14ab2ab7a76838b9205488efc3f700d0632ce8c7",
|
|
7979
|
+
decimal: 18,
|
|
7980
|
+
symbol: "bnUSD",
|
|
7981
|
+
name: "bnUSD",
|
|
7982
|
+
vault: hubVaults.bnUSD.address
|
|
7983
|
+
},
|
|
7984
|
+
[spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
|
|
7985
|
+
asset: "0xe4faab621fb6716e32057b7ea7356219936519ac",
|
|
7986
|
+
decimal: 18,
|
|
7987
|
+
symbol: "SODA",
|
|
7988
|
+
name: "SODAX",
|
|
7989
|
+
vault: hubVaults.sodaSODA.address
|
|
7990
|
+
},
|
|
7991
|
+
[spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
|
|
7992
|
+
asset: "0xe5159e2a89aeec2fc63d6c25adda3541670af101",
|
|
7993
|
+
decimal: 6,
|
|
7994
|
+
symbol: "USDC",
|
|
7995
|
+
name: "USD Coin",
|
|
7996
|
+
vault: hubVaults.sodaUSDC.address
|
|
7997
|
+
},
|
|
7998
|
+
[spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["BTC.LL"].address]: {
|
|
7999
|
+
asset: "0x54582cdb0c145398b532e34f0851ffc1bbc88b4e",
|
|
8000
|
+
decimal: 18,
|
|
8001
|
+
symbol: "BTC.LL",
|
|
8002
|
+
name: "Bitcoin LightLINK",
|
|
8003
|
+
vault: hubVaults.sodaBTC.address
|
|
8004
|
+
},
|
|
8005
|
+
[spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["AVAX.LL"].address]: {
|
|
8006
|
+
asset: "0x415ff3ea8c905ef65cd82665c5534d0e4ff9221a",
|
|
8007
|
+
decimal: 18,
|
|
8008
|
+
symbol: "AVAX.LL",
|
|
8009
|
+
name: "Avalanche LightLINK",
|
|
8010
|
+
vault: hubVaults.sodaAVAX.address
|
|
8011
|
+
},
|
|
8012
|
+
[spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["BNB.LL"].address]: {
|
|
8013
|
+
asset: "0xd32e524da9d64db4c37a50f1ee197b591e97dc05",
|
|
8014
|
+
decimal: 18,
|
|
8015
|
+
symbol: "BNB.LL",
|
|
8016
|
+
name: "BNB LightLINK",
|
|
8017
|
+
vault: hubVaults.sodaBNB.address
|
|
8018
|
+
},
|
|
8019
|
+
[spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["SOL.LL"].address]: {
|
|
8020
|
+
asset: "0xd70c16f1e2c4207dc4c44bc69c8a1b82b50cf9e2",
|
|
8021
|
+
decimal: 18,
|
|
8022
|
+
symbol: "SOL.LL",
|
|
8023
|
+
name: "Solana LightLINK",
|
|
8024
|
+
vault: hubVaults.sodaSOL.address
|
|
8025
|
+
},
|
|
8026
|
+
[spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["XLM.LL"].address]: {
|
|
8027
|
+
asset: "0x18008b18964bc2c90521a7596ff9988743c97fd4",
|
|
8028
|
+
decimal: 18,
|
|
8029
|
+
symbol: "XLM.LL",
|
|
8030
|
+
name: "Stellar LightLINK",
|
|
8031
|
+
vault: hubVaults.sodaXLM.address
|
|
8032
|
+
},
|
|
8033
|
+
[spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["INJ.LL"].address]: {
|
|
8034
|
+
asset: "0xb036daab0c772b080babb84b8695c3ca858925b6",
|
|
8035
|
+
decimal: 18,
|
|
8036
|
+
symbol: "INJ.LL",
|
|
8037
|
+
name: "Injective LightLINK",
|
|
8038
|
+
vault: hubVaults.sodaINJ.address
|
|
8039
|
+
},
|
|
8040
|
+
[spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["SUI.LL"].address]: {
|
|
8041
|
+
asset: "0x425852cca84e5f44d7b8ebb964b21bde585b4571",
|
|
8042
|
+
decimal: 18,
|
|
8043
|
+
symbol: "SUI.LL",
|
|
8044
|
+
name: "Sui LightLINK",
|
|
8045
|
+
vault: hubVaults.sodaSUI.address
|
|
8046
|
+
},
|
|
8047
|
+
[spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["S.LL"].address]: {
|
|
8048
|
+
asset: "0xb592d2631ccf245119532e025d11188cfadb6777",
|
|
8049
|
+
decimal: 18,
|
|
8050
|
+
symbol: "S.LL",
|
|
8051
|
+
name: "Sonic LightLINK",
|
|
8052
|
+
vault: hubVaults.sodaS.address
|
|
8053
|
+
},
|
|
8054
|
+
[spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["POL.LL"].address]: {
|
|
8055
|
+
asset: "0x15ba35f87f259b9b50d53a2fec271bb10020b090",
|
|
8056
|
+
decimal: 18,
|
|
8057
|
+
symbol: "POL.LL",
|
|
8058
|
+
name: "Polygon LightLINK",
|
|
8059
|
+
vault: hubVaults.sodaPOL.address
|
|
8060
|
+
},
|
|
8061
|
+
[spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["HYPE.LL"].address]: {
|
|
8062
|
+
asset: "0xea7e97b4597f724844426c32248ba80bd29c75f8",
|
|
8063
|
+
decimal: 18,
|
|
8064
|
+
symbol: "HYPE.LL",
|
|
8065
|
+
name: "HyperEVM LightLINK",
|
|
8066
|
+
vault: hubVaults.sodaHYPE.address
|
|
8067
|
+
}
|
|
8068
|
+
},
|
|
7860
8069
|
[types.INJECTIVE_MAINNET_CHAIN_ID]: {
|
|
7861
8070
|
[spokeChainConfig[types.INJECTIVE_MAINNET_CHAIN_ID].supportedTokens.INJ.address]: {
|
|
7862
8071
|
asset: "0xd375590b4955f6ea5623f799153f9b787a3bd319",
|
|
@@ -8053,7 +8262,7 @@ var hubAssets = {
|
|
|
8053
8262
|
decimal: 18,
|
|
8054
8263
|
symbol: "wICX",
|
|
8055
8264
|
name: "ICON",
|
|
8056
|
-
vault: "
|
|
8265
|
+
vault: "0x"
|
|
8057
8266
|
},
|
|
8058
8267
|
[spokeChainConfig[types.ICON_MAINNET_CHAIN_ID].bnUSD]: {
|
|
8059
8268
|
asset: "0x654dddf32a9a2ac53f5fb54bf1e93f66791f8047",
|
|
@@ -8134,6 +8343,22 @@ var solverSupportedTokens = {
|
|
|
8134
8343
|
spokeChainConfig[types.BSC_MAINNET_CHAIN_ID].supportedTokens.USDC
|
|
8135
8344
|
],
|
|
8136
8345
|
[types.HYPEREVM_MAINNET_CHAIN_ID]: [],
|
|
8346
|
+
[types.LIGHTLINK_MAINNET_CHAIN_ID]: [
|
|
8347
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens.ETH,
|
|
8348
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
8349
|
+
// spokeChainConfig[LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens.SODA,
|
|
8350
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens.USDC,
|
|
8351
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["BTC.LL"],
|
|
8352
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["AVAX.LL"],
|
|
8353
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["BNB.LL"],
|
|
8354
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["SOL.LL"],
|
|
8355
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["XLM.LL"],
|
|
8356
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["INJ.LL"],
|
|
8357
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["SUI.LL"],
|
|
8358
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["S.LL"],
|
|
8359
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["POL.LL"]
|
|
8360
|
+
// spokeChainConfig[LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens['HYPE.LL'],
|
|
8361
|
+
],
|
|
8137
8362
|
[types.SOLANA_MAINNET_CHAIN_ID]: [
|
|
8138
8363
|
spokeChainConfig[types.SOLANA_MAINNET_CHAIN_ID].supportedTokens.SOL,
|
|
8139
8364
|
spokeChainConfig[types.SOLANA_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
@@ -8243,6 +8468,21 @@ var moneyMarketSupportedTokens = {
|
|
|
8243
8468
|
spokeChainConfig[types.HYPEREVM_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
8244
8469
|
spokeChainConfig[types.HYPEREVM_MAINNET_CHAIN_ID].supportedTokens.SODA
|
|
8245
8470
|
],
|
|
8471
|
+
[types.LIGHTLINK_MAINNET_CHAIN_ID]: [
|
|
8472
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens.ETH,
|
|
8473
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
8474
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens.USDC,
|
|
8475
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["AVAX.LL"],
|
|
8476
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["BNB.LL"],
|
|
8477
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["SOL.LL"],
|
|
8478
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["XLM.LL"],
|
|
8479
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["INJ.LL"],
|
|
8480
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["SUI.LL"],
|
|
8481
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["S.LL"],
|
|
8482
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["POL.LL"],
|
|
8483
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens["HYPE.LL"],
|
|
8484
|
+
spokeChainConfig[types.LIGHTLINK_MAINNET_CHAIN_ID].supportedTokens.SODA
|
|
8485
|
+
],
|
|
8246
8486
|
[types.SOLANA_MAINNET_CHAIN_ID]: [
|
|
8247
8487
|
spokeChainConfig[types.SOLANA_MAINNET_CHAIN_ID].supportedTokens.SOL,
|
|
8248
8488
|
spokeChainConfig[types.SOLANA_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
@@ -8319,7 +8559,7 @@ var supportedHubAssets = new Set(
|
|
|
8319
8559
|
var supportedSodaAssets = new Set(
|
|
8320
8560
|
Object.values(hubAssets).flatMap((assets) => Object.values(assets).map((info) => info.vault.toLowerCase()))
|
|
8321
8561
|
);
|
|
8322
|
-
var spokeChainIdsSet = new Set(types.
|
|
8562
|
+
var spokeChainIdsSet = new Set(types.CHAIN_IDS);
|
|
8323
8563
|
var getOriginalAssetInfoFromVault = (chainId, vault) => {
|
|
8324
8564
|
const assets = hubAssets[chainId];
|
|
8325
8565
|
if (!assets) {
|
|
@@ -8342,7 +8582,7 @@ var isValidHubAsset = (hubAsset) => supportedHubAssets.has(hubAsset.toLowerCase(
|
|
|
8342
8582
|
var isValidVault = (vault) => supportedSodaAssets.has(vault.toLowerCase());
|
|
8343
8583
|
var isValidChainHubAsset = (chainId, hubAsset) => chainIdToHubAssetsMap.get(chainId)?.has(hubAsset.toLowerCase()) ?? false;
|
|
8344
8584
|
var isValidSpokeChainId = (chainId) => spokeChainIdsSet.has(chainId);
|
|
8345
|
-
var isValidIntentRelayChainId = (chainId) => Object.values(
|
|
8585
|
+
var isValidIntentRelayChainId = (chainId) => Object.values(ChainIdToIntentRelayChainId).some((id) => id === chainId);
|
|
8346
8586
|
var supportedHubChains = Object.keys(hubChainConfig);
|
|
8347
8587
|
var supportedSpokeChains = Object.keys(spokeChainConfig);
|
|
8348
8588
|
var intentRelayChainIdToSpokeChainIdMap = new Map(
|
|
@@ -8500,7 +8740,6 @@ var InjectiveSpokeProvider = class {
|
|
|
8500
8740
|
return num.toString();
|
|
8501
8741
|
}
|
|
8502
8742
|
};
|
|
8503
|
-
var IconSdk = "default" in IconSdkRaw__namespace.default ? IconSdkRaw__namespace.default : IconSdkRaw__namespace;
|
|
8504
8743
|
var IconSpokeProvider = class {
|
|
8505
8744
|
walletProvider;
|
|
8506
8745
|
chainConfig;
|
|
@@ -8509,7 +8748,7 @@ var IconSpokeProvider = class {
|
|
|
8509
8748
|
constructor(walletProvider, chainConfig, rpcUrl = "https://ctz.solidwallet.io/api/v3", debugRpcUrl = "https://ctz.solidwallet.io/api/v3d") {
|
|
8510
8749
|
this.walletProvider = walletProvider;
|
|
8511
8750
|
this.chainConfig = chainConfig;
|
|
8512
|
-
this.iconService = new
|
|
8751
|
+
this.iconService = new iconSdkJs.IconService(new iconSdkJs.IconService.HttpProvider(rpcUrl));
|
|
8513
8752
|
this.debugRpcUrl = debugRpcUrl;
|
|
8514
8753
|
}
|
|
8515
8754
|
};
|
|
@@ -8579,42 +8818,6 @@ var EvmSpokeProvider = class {
|
|
|
8579
8818
|
}
|
|
8580
8819
|
}
|
|
8581
8820
|
};
|
|
8582
|
-
var CustomStellarAccount = class {
|
|
8583
|
-
accountId;
|
|
8584
|
-
sequenceNumber;
|
|
8585
|
-
startingSequenceNumber;
|
|
8586
|
-
constructor({ account_id, sequence }) {
|
|
8587
|
-
this.accountId = account_id;
|
|
8588
|
-
this.sequenceNumber = BigInt(sequence);
|
|
8589
|
-
this.startingSequenceNumber = BigInt(sequence);
|
|
8590
|
-
}
|
|
8591
|
-
getSequenceNumber() {
|
|
8592
|
-
return this.sequenceNumber;
|
|
8593
|
-
}
|
|
8594
|
-
getStartingSequenceNumber() {
|
|
8595
|
-
return this.startingSequenceNumber;
|
|
8596
|
-
}
|
|
8597
|
-
getAccountId() {
|
|
8598
|
-
return this.accountId;
|
|
8599
|
-
}
|
|
8600
|
-
getAccountClone() {
|
|
8601
|
-
return new stellarSdk.Account(this.accountId, this.sequenceNumber.toString());
|
|
8602
|
-
}
|
|
8603
|
-
incrementSequenceNumber() {
|
|
8604
|
-
this.sequenceNumber++;
|
|
8605
|
-
}
|
|
8606
|
-
decrementSequenceNumber() {
|
|
8607
|
-
if (this.sequenceNumber > this.startingSequenceNumber) {
|
|
8608
|
-
this.sequenceNumber--;
|
|
8609
|
-
}
|
|
8610
|
-
throw new Error(
|
|
8611
|
-
`Sequence number cannot be decremented below the starting sequence number: ${this.startingSequenceNumber}`
|
|
8612
|
-
);
|
|
8613
|
-
}
|
|
8614
|
-
resetSequenceNumber() {
|
|
8615
|
-
this.sequenceNumber = this.startingSequenceNumber;
|
|
8616
|
-
}
|
|
8617
|
-
};
|
|
8618
8821
|
var CustomSorobanServer = class extends stellarSdk.SorobanRpc.Server {
|
|
8619
8822
|
customHeaders;
|
|
8620
8823
|
constructor(serverUrl, customHeaders) {
|
|
@@ -8707,6 +8910,44 @@ var CustomSorobanServer = class extends stellarSdk.SorobanRpc.Server {
|
|
|
8707
8910
|
return response.json().then((json) => json.result);
|
|
8708
8911
|
}
|
|
8709
8912
|
};
|
|
8913
|
+
|
|
8914
|
+
// src/entities/stellar/StellarSpokeProvider.ts
|
|
8915
|
+
var CustomStellarAccount = class {
|
|
8916
|
+
accountId;
|
|
8917
|
+
sequenceNumber;
|
|
8918
|
+
startingSequenceNumber;
|
|
8919
|
+
constructor({ account_id, sequence }) {
|
|
8920
|
+
this.accountId = account_id;
|
|
8921
|
+
this.sequenceNumber = BigInt(sequence);
|
|
8922
|
+
this.startingSequenceNumber = BigInt(sequence);
|
|
8923
|
+
}
|
|
8924
|
+
getSequenceNumber() {
|
|
8925
|
+
return this.sequenceNumber;
|
|
8926
|
+
}
|
|
8927
|
+
getStartingSequenceNumber() {
|
|
8928
|
+
return this.startingSequenceNumber;
|
|
8929
|
+
}
|
|
8930
|
+
getAccountId() {
|
|
8931
|
+
return this.accountId;
|
|
8932
|
+
}
|
|
8933
|
+
getAccountClone() {
|
|
8934
|
+
return new stellarSdk.Account(this.accountId, this.sequenceNumber.toString());
|
|
8935
|
+
}
|
|
8936
|
+
incrementSequenceNumber() {
|
|
8937
|
+
this.sequenceNumber++;
|
|
8938
|
+
}
|
|
8939
|
+
decrementSequenceNumber() {
|
|
8940
|
+
if (this.sequenceNumber > this.startingSequenceNumber) {
|
|
8941
|
+
this.sequenceNumber--;
|
|
8942
|
+
}
|
|
8943
|
+
throw new Error(
|
|
8944
|
+
`Sequence number cannot be decremented below the starting sequence number: ${this.startingSequenceNumber}`
|
|
8945
|
+
);
|
|
8946
|
+
}
|
|
8947
|
+
resetSequenceNumber() {
|
|
8948
|
+
this.sequenceNumber = this.startingSequenceNumber;
|
|
8949
|
+
}
|
|
8950
|
+
};
|
|
8710
8951
|
var StellarSpokeProvider = class {
|
|
8711
8952
|
server;
|
|
8712
8953
|
sorobanServer;
|
|
@@ -10102,8 +10343,6 @@ async function estimateStepCost(rawTx, debugRpcUrl) {
|
|
|
10102
10343
|
}
|
|
10103
10344
|
|
|
10104
10345
|
// src/services/spoke/IconSpokeService.ts
|
|
10105
|
-
var IconSdk2 = "default" in IconSdkRaw__namespace.default ? IconSdkRaw__namespace.default : IconSdkRaw__namespace;
|
|
10106
|
-
var { Converter, CallTransactionBuilder, CallBuilder } = IconSdk2;
|
|
10107
10346
|
var IconSpokeService = class _IconSpokeService {
|
|
10108
10347
|
constructor() {
|
|
10109
10348
|
}
|
|
@@ -10142,7 +10381,7 @@ var IconSpokeService = class _IconSpokeService {
|
|
|
10142
10381
|
* @returns {Promise<bigint>} The balance of the token
|
|
10143
10382
|
*/
|
|
10144
10383
|
static async getDeposit(token, spokeProvider) {
|
|
10145
|
-
const transaction = new CallBuilder().to(token).method("balanceOf").params({ _owner: spokeProvider.chainConfig.addresses.assetManager }).build();
|
|
10384
|
+
const transaction = new iconSdkJs.CallBuilder().to(token).method("balanceOf").params({ _owner: spokeProvider.chainConfig.addresses.assetManager }).build();
|
|
10146
10385
|
const result = await spokeProvider.iconService.call(transaction).execute();
|
|
10147
10386
|
return BigInt(result.value);
|
|
10148
10387
|
}
|
|
@@ -10201,8 +10440,8 @@ var IconSpokeService = class _IconSpokeService {
|
|
|
10201
10440
|
const value = isNativeToken(spokeProvider.chainConfig.chain.id, token) ? BigIntToHex(amount) : "0x0";
|
|
10202
10441
|
const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
|
|
10203
10442
|
const to = isNativeToken(spokeProvider.chainConfig.chain.id, token) ? spokeProvider.chainConfig.addresses.wICX : token;
|
|
10204
|
-
const rawTransaction = Converter.toRawTransaction(
|
|
10205
|
-
new CallTransactionBuilder().from(walletAddress).to(to).stepLimit(Converter.toBigNumber("2000000")).nid(spokeProvider.chainConfig.nid).version("0x3").timestamp((/* @__PURE__ */ new Date()).getTime() * 1e3).value(value).method("transfer").params(params).build()
|
|
10443
|
+
const rawTransaction = iconSdkJs.Converter.toRawTransaction(
|
|
10444
|
+
new iconSdkJs.CallTransactionBuilder().from(walletAddress).to(to).stepLimit(iconSdkJs.Converter.toBigNumber("2000000")).nid(spokeProvider.chainConfig.nid).version("0x3").timestamp((/* @__PURE__ */ new Date()).getTime() * 1e3).value(value).method("transfer").params(params).build()
|
|
10206
10445
|
);
|
|
10207
10446
|
if (raw) {
|
|
10208
10447
|
return rawTransaction;
|
|
@@ -10226,9 +10465,9 @@ var IconSpokeService = class _IconSpokeService {
|
|
|
10226
10465
|
payload
|
|
10227
10466
|
};
|
|
10228
10467
|
const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
|
|
10229
|
-
const transaction = new CallTransactionBuilder().from(walletAddress).to(spokeProvider.chainConfig.addresses.connection).stepLimit(Converter.toBigNumber("2000000")).nid(spokeProvider.chainConfig.nid).version("0x3").timestamp((/* @__PURE__ */ new Date()).getTime() * 1e3).method("sendMessage").params(params).build();
|
|
10468
|
+
const transaction = new iconSdkJs.CallTransactionBuilder().from(walletAddress).to(spokeProvider.chainConfig.addresses.connection).stepLimit(iconSdkJs.Converter.toBigNumber("2000000")).nid(spokeProvider.chainConfig.nid).version("0x3").timestamp((/* @__PURE__ */ new Date()).getTime() * 1e3).method("sendMessage").params(params).build();
|
|
10230
10469
|
if (raw) {
|
|
10231
|
-
return Converter.toRawTransaction(transaction);
|
|
10470
|
+
return iconSdkJs.Converter.toRawTransaction(transaction);
|
|
10232
10471
|
}
|
|
10233
10472
|
return spokeProvider.walletProvider.sendTransaction({
|
|
10234
10473
|
from: walletAddress,
|
|
@@ -10538,6 +10777,83 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
10538
10777
|
var StellarSpokeService = class _StellarSpokeService {
|
|
10539
10778
|
constructor() {
|
|
10540
10779
|
}
|
|
10780
|
+
/**
|
|
10781
|
+
* Check if the user has sufficent trustline established for the token.
|
|
10782
|
+
* @param token - The token address to check the trustline for.
|
|
10783
|
+
* @param amount - The amount of tokens to check the trustline for.
|
|
10784
|
+
* @param spokeProvider - The Stellar spoke provider.
|
|
10785
|
+
* @returns True if the user has sufficent trustline established for the token, false otherwise.
|
|
10786
|
+
*/
|
|
10787
|
+
static async hasSufficientTrustline(token, amount, spokeProvider) {
|
|
10788
|
+
if (token.toLowerCase() === spokeProvider.chainConfig.nativeToken.toLowerCase() || token.toLowerCase() === spokeChainConfig[types.STELLAR_MAINNET_CHAIN_ID].supportedTokens.legacybnUSD.address.toLowerCase()) {
|
|
10789
|
+
return true;
|
|
10790
|
+
}
|
|
10791
|
+
const trustlineConfig = spokeProvider.chainConfig.trustlineConfigs.find(
|
|
10792
|
+
(config) => config.contractId.toLowerCase() === token.toLowerCase()
|
|
10793
|
+
);
|
|
10794
|
+
if (!trustlineConfig) {
|
|
10795
|
+
throw new Error(`Trustline config not found for token: ${token}`);
|
|
10796
|
+
}
|
|
10797
|
+
const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
|
|
10798
|
+
const { balances } = await spokeProvider.server.accounts().accountId(walletAddress).call();
|
|
10799
|
+
const tokenBalance = balances.find(
|
|
10800
|
+
(balance2) => "limit" in balance2 && "balance" in balance2 && "asset_code" in balance2 && trustlineConfig.assetCode.toLowerCase() === balance2.asset_code?.toLowerCase() && "asset_issuer" in balance2 && trustlineConfig.assetIssuer.toLowerCase() === balance2.asset_issuer?.toLowerCase()
|
|
10801
|
+
);
|
|
10802
|
+
if (!tokenBalance) {
|
|
10803
|
+
console.error(`No token balances found for token: ${token}`);
|
|
10804
|
+
return false;
|
|
10805
|
+
}
|
|
10806
|
+
const limit = parseToStroops(tokenBalance.limit);
|
|
10807
|
+
const balance = parseToStroops(tokenBalance.balance);
|
|
10808
|
+
const availableTrustAmount = limit - balance;
|
|
10809
|
+
return availableTrustAmount >= amount;
|
|
10810
|
+
}
|
|
10811
|
+
/**
|
|
10812
|
+
* Request a trustline for a given token and amount.
|
|
10813
|
+
* @param token - The token address to request the trustline for.
|
|
10814
|
+
* @param amount - The amount of tokens to request the trustline for.
|
|
10815
|
+
* @param spokeProvider - The spoke provider.
|
|
10816
|
+
* @param raw - Whether to return the raw transaction data.
|
|
10817
|
+
* @returns The transaction result.
|
|
10818
|
+
*/
|
|
10819
|
+
static async requestTrustline(token, amount, spokeProvider, raw) {
|
|
10820
|
+
try {
|
|
10821
|
+
const asset = spokeProvider.chainConfig.trustlineConfigs.find(
|
|
10822
|
+
(t) => t.contractId.toLowerCase() === token.toLowerCase()
|
|
10823
|
+
);
|
|
10824
|
+
if (!asset) {
|
|
10825
|
+
throw new Error(`Asset ${token} not found. Cannot proceed with trustline.`);
|
|
10826
|
+
}
|
|
10827
|
+
const [network, walletAddress] = await Promise.all([
|
|
10828
|
+
spokeProvider.sorobanServer.getNetwork(),
|
|
10829
|
+
spokeProvider.walletProvider.getWalletAddress()
|
|
10830
|
+
]);
|
|
10831
|
+
const accountResponse = await spokeProvider.server.loadAccount(walletAddress);
|
|
10832
|
+
const stellarAccount = new CustomStellarAccount(accountResponse);
|
|
10833
|
+
const transaction = new stellarSdk.TransactionBuilder(stellarAccount.getAccountClone(), {
|
|
10834
|
+
fee: stellarSdk.BASE_FEE,
|
|
10835
|
+
networkPassphrase: network.passphrase
|
|
10836
|
+
}).addOperation(
|
|
10837
|
+
stellarSdk.Operation.changeTrust({
|
|
10838
|
+
asset: new stellarSdk.Asset(asset?.assetCode, asset?.assetIssuer)
|
|
10839
|
+
})
|
|
10840
|
+
).setTimeout(STELLAR_DEFAULT_TX_TIMEOUT_SECONDS).build();
|
|
10841
|
+
if (raw) {
|
|
10842
|
+
const transactionXdr = transaction.toXDR();
|
|
10843
|
+
return {
|
|
10844
|
+
from: walletAddress,
|
|
10845
|
+
to: spokeProvider.chainConfig.addresses.assetManager,
|
|
10846
|
+
value: amount,
|
|
10847
|
+
data: transactionXdr
|
|
10848
|
+
};
|
|
10849
|
+
}
|
|
10850
|
+
const hash = await spokeProvider.signAndSendTransaction(transaction);
|
|
10851
|
+
return `${hash}`;
|
|
10852
|
+
} catch (error) {
|
|
10853
|
+
console.error("Error during requestTrustline:", error);
|
|
10854
|
+
throw error;
|
|
10855
|
+
}
|
|
10856
|
+
}
|
|
10541
10857
|
/**
|
|
10542
10858
|
* Estimate the gas for a transaction.
|
|
10543
10859
|
* @param rawTx - The raw transaction to estimate the gas for.
|
|
@@ -10755,11 +11071,8 @@ var SonicSpokeService = class _SonicSpokeService {
|
|
|
10755
11071
|
return spokeProvider.walletProvider.sendTransaction(rawTx);
|
|
10756
11072
|
}
|
|
10757
11073
|
static async createSwapIntent(createIntentParams, creatorHubWalletAddress, solverConfig2, fee, spokeProvider, hubProvider, raw) {
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
inputToken = hubProvider.chainConfig.nativeToken;
|
|
10761
|
-
}
|
|
10762
|
-
const outputToken = getHubAssetInfo(createIntentParams.dstChain, createIntentParams.outputToken)?.asset;
|
|
11074
|
+
const inputToken = createIntentParams.inputToken;
|
|
11075
|
+
const outputToken = createIntentParams.dstChain !== types.SONIC_MAINNET_CHAIN_ID ? getHubAssetInfo(createIntentParams.dstChain, createIntentParams.outputToken)?.asset : createIntentParams.outputToken;
|
|
10763
11076
|
invariant12__default.default(
|
|
10764
11077
|
inputToken,
|
|
10765
11078
|
`hub asset not found for spoke chain token (intent.inputToken): ${createIntentParams.inputToken}`
|
|
@@ -11076,7 +11389,7 @@ function isJsonRpcPayloadResponse(value) {
|
|
|
11076
11389
|
return typeof value === "object" && value !== null && "id" in value && "result" in value && typeof value.result === "string";
|
|
11077
11390
|
}
|
|
11078
11391
|
function isIntentRelayChainId(value) {
|
|
11079
|
-
return typeof value === "bigint" && value >= 0n && Object.values(
|
|
11392
|
+
return typeof value === "bigint" && value >= 0n && Object.values(ChainIdToIntentRelayChainId).includes(value);
|
|
11080
11393
|
}
|
|
11081
11394
|
function isPartnerFeeAmount(value) {
|
|
11082
11395
|
return typeof value === "object" && value !== null && "address" in value && "amount" in value;
|
|
@@ -11696,11 +12009,8 @@ var EvmSolverService = class _EvmSolverService {
|
|
|
11696
12009
|
* @returns {Promise<[Hex, Intent, bigint]>} The encoded contract call, intent and fee amount
|
|
11697
12010
|
*/
|
|
11698
12011
|
static constructCreateIntentData(createIntentParams, creatorHubWalletAddress, solverConfig2, fee, hubProvider) {
|
|
11699
|
-
|
|
11700
|
-
|
|
11701
|
-
inputToken = hubProvider.chainConfig.wrappedNativeToken;
|
|
11702
|
-
}
|
|
11703
|
-
const outputToken = getHubAssetInfo(createIntentParams.dstChain, createIntentParams.outputToken)?.asset;
|
|
12012
|
+
const inputToken = createIntentParams.srcChain !== types.SONIC_MAINNET_CHAIN_ID ? getHubAssetInfo(createIntentParams.srcChain, createIntentParams.inputToken)?.asset : createIntentParams.inputToken;
|
|
12013
|
+
const outputToken = createIntentParams.dstChain !== types.SONIC_MAINNET_CHAIN_ID ? getHubAssetInfo(createIntentParams.dstChain, createIntentParams.outputToken)?.asset : createIntentParams.outputToken;
|
|
11704
12014
|
invariant12__default.default(
|
|
11705
12015
|
inputToken,
|
|
11706
12016
|
`hub asset not found for spoke chain token (intent.inputToken): ${createIntentParams.inputToken}`
|
|
@@ -12475,6 +12785,12 @@ var SolverService = class {
|
|
|
12475
12785
|
spokeProvider
|
|
12476
12786
|
);
|
|
12477
12787
|
}
|
|
12788
|
+
if (spokeProvider instanceof StellarSpokeProvider) {
|
|
12789
|
+
return {
|
|
12790
|
+
ok: true,
|
|
12791
|
+
value: await StellarSpokeService.hasSufficientTrustline(params.inputToken, params.inputAmount, spokeProvider)
|
|
12792
|
+
};
|
|
12793
|
+
}
|
|
12478
12794
|
return {
|
|
12479
12795
|
ok: true,
|
|
12480
12796
|
value: true
|
|
@@ -12556,9 +12872,21 @@ var SolverService = class {
|
|
|
12556
12872
|
value: result
|
|
12557
12873
|
};
|
|
12558
12874
|
}
|
|
12875
|
+
if (spokeProvider instanceof StellarSpokeProvider) {
|
|
12876
|
+
const result = await StellarSpokeService.requestTrustline(
|
|
12877
|
+
params.inputToken,
|
|
12878
|
+
params.inputAmount,
|
|
12879
|
+
spokeProvider,
|
|
12880
|
+
raw
|
|
12881
|
+
);
|
|
12882
|
+
return {
|
|
12883
|
+
ok: true,
|
|
12884
|
+
value: result
|
|
12885
|
+
};
|
|
12886
|
+
}
|
|
12559
12887
|
return {
|
|
12560
12888
|
ok: false,
|
|
12561
|
-
error: new Error("Approve only supported for EVM spoke chains")
|
|
12889
|
+
error: new Error("Approve only supported for EVM (approve) and Stellar (trustline) spoke chains")
|
|
12562
12890
|
};
|
|
12563
12891
|
} catch (error) {
|
|
12564
12892
|
return {
|
|
@@ -13361,6 +13689,12 @@ var MigrationService = class {
|
|
|
13361
13689
|
evmSpokeProvider
|
|
13362
13690
|
);
|
|
13363
13691
|
}
|
|
13692
|
+
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider instanceof StellarSpokeProvider) {
|
|
13693
|
+
return {
|
|
13694
|
+
ok: true,
|
|
13695
|
+
value: await StellarSpokeService.hasSufficientTrustline(params.srcbnUSD, params.amount, spokeProvider)
|
|
13696
|
+
};
|
|
13697
|
+
}
|
|
13364
13698
|
return {
|
|
13365
13699
|
ok: true,
|
|
13366
13700
|
value: true
|
|
@@ -13387,6 +13721,29 @@ var MigrationService = class {
|
|
|
13387
13721
|
evmSpokeProvider
|
|
13388
13722
|
);
|
|
13389
13723
|
}
|
|
13724
|
+
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
|
|
13725
|
+
const evmSpokeProvider = spokeProvider;
|
|
13726
|
+
let spender;
|
|
13727
|
+
const wallet = await spokeProvider.walletProvider.getWalletAddress();
|
|
13728
|
+
if (spokeProvider instanceof SonicSpokeProvider) {
|
|
13729
|
+
spender = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
|
|
13730
|
+
} else {
|
|
13731
|
+
spender = evmSpokeProvider.chainConfig.addresses.assetManager;
|
|
13732
|
+
}
|
|
13733
|
+
return await Erc20Service.isAllowanceValid(
|
|
13734
|
+
params.srcbnUSD,
|
|
13735
|
+
params.amount,
|
|
13736
|
+
wallet,
|
|
13737
|
+
spender,
|
|
13738
|
+
evmSpokeProvider
|
|
13739
|
+
);
|
|
13740
|
+
}
|
|
13741
|
+
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider instanceof StellarSpokeProvider) {
|
|
13742
|
+
return {
|
|
13743
|
+
ok: true,
|
|
13744
|
+
value: await StellarSpokeService.hasSufficientTrustline(params.srcbnUSD, params.amount, spokeProvider)
|
|
13745
|
+
};
|
|
13746
|
+
}
|
|
13390
13747
|
if (spokeProvider instanceof SonicSpokeProvider && isIcxCreateRevertMigrationParams(params)) {
|
|
13391
13748
|
const wallet = await spokeProvider.walletProvider.getWalletAddress();
|
|
13392
13749
|
const userRouter = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
|
|
@@ -13449,6 +13806,13 @@ var MigrationService = class {
|
|
|
13449
13806
|
value: result
|
|
13450
13807
|
};
|
|
13451
13808
|
}
|
|
13809
|
+
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider instanceof StellarSpokeProvider) {
|
|
13810
|
+
const result = await StellarSpokeService.requestTrustline(params.srcbnUSD, params.amount, spokeProvider, raw);
|
|
13811
|
+
return {
|
|
13812
|
+
ok: true,
|
|
13813
|
+
value: result
|
|
13814
|
+
};
|
|
13815
|
+
}
|
|
13452
13816
|
return {
|
|
13453
13817
|
ok: false,
|
|
13454
13818
|
error: new Error("Invalid params for migrate action")
|
|
@@ -13479,6 +13843,13 @@ var MigrationService = class {
|
|
|
13479
13843
|
value: result
|
|
13480
13844
|
};
|
|
13481
13845
|
}
|
|
13846
|
+
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider instanceof StellarSpokeProvider) {
|
|
13847
|
+
const result = await StellarSpokeService.requestTrustline(params.srcbnUSD, params.amount, spokeProvider, raw);
|
|
13848
|
+
return {
|
|
13849
|
+
ok: true,
|
|
13850
|
+
value: result
|
|
13851
|
+
};
|
|
13852
|
+
}
|
|
13482
13853
|
if (spokeProvider instanceof SonicSpokeProvider && isIcxCreateRevertMigrationParams(params)) {
|
|
13483
13854
|
const wallet = await spokeProvider.walletProvider.getWalletAddress();
|
|
13484
13855
|
const userRouter = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
|
|
@@ -13572,6 +13943,14 @@ var MigrationService = class {
|
|
|
13572
13943
|
if (!packetResult.ok) {
|
|
13573
13944
|
return packetResult;
|
|
13574
13945
|
}
|
|
13946
|
+
if (!(params.srcChainId === types.SONIC_MAINNET_CHAIN_ID || params.dstChainId === types.SONIC_MAINNET_CHAIN_ID)) {
|
|
13947
|
+
await waitUntilIntentExecuted({
|
|
13948
|
+
intentRelayChainId: getIntentRelayChainId(types.SONIC_MAINNET_CHAIN_ID).toString(),
|
|
13949
|
+
spokeTxHash: packetResult.value.dst_tx_hash,
|
|
13950
|
+
timeout,
|
|
13951
|
+
apiUrl: this.config.relayerApiEndpoint
|
|
13952
|
+
});
|
|
13953
|
+
}
|
|
13575
13954
|
return { ok: true, value: [spokeTxHash, packetResult.value.dst_tx_hash] };
|
|
13576
13955
|
} catch (error) {
|
|
13577
13956
|
return {
|
|
@@ -14653,6 +15032,26 @@ var BridgeService = class {
|
|
|
14653
15032
|
value: allowanceResult.value
|
|
14654
15033
|
};
|
|
14655
15034
|
}
|
|
15035
|
+
if (spokeProvider instanceof StellarSpokeProvider) {
|
|
15036
|
+
const allowanceResult = await StellarSpokeService.hasSufficientTrustline(
|
|
15037
|
+
params.srcAsset,
|
|
15038
|
+
params.amount,
|
|
15039
|
+
spokeProvider
|
|
15040
|
+
);
|
|
15041
|
+
if (!allowanceResult) {
|
|
15042
|
+
return {
|
|
15043
|
+
ok: false,
|
|
15044
|
+
error: {
|
|
15045
|
+
code: "ALLOWANCE_CHECK_FAILED",
|
|
15046
|
+
error: allowanceResult
|
|
15047
|
+
}
|
|
15048
|
+
};
|
|
15049
|
+
}
|
|
15050
|
+
return {
|
|
15051
|
+
ok: true,
|
|
15052
|
+
value: allowanceResult
|
|
15053
|
+
};
|
|
15054
|
+
}
|
|
14656
15055
|
if (spokeProvider instanceof SonicSpokeProvider) {
|
|
14657
15056
|
invariant12__default.default(viem.isAddress(params.srcAsset), "Invalid source asset address for Sonic chain");
|
|
14658
15057
|
const userRouter = await SonicSpokeService.getUserRouter(walletAddress, spokeProvider);
|
|
@@ -14721,6 +15120,13 @@ var BridgeService = class {
|
|
|
14721
15120
|
value: result
|
|
14722
15121
|
};
|
|
14723
15122
|
}
|
|
15123
|
+
if (spokeProvider instanceof StellarSpokeProvider) {
|
|
15124
|
+
const result = await StellarSpokeService.requestTrustline(params.srcAsset, params.amount, spokeProvider, raw);
|
|
15125
|
+
return {
|
|
15126
|
+
ok: true,
|
|
15127
|
+
value: result
|
|
15128
|
+
};
|
|
15129
|
+
}
|
|
14724
15130
|
if (spokeProvider instanceof SonicSpokeProvider) {
|
|
14725
15131
|
invariant12__default.default(viem.isAddress(params.srcAsset), "Invalid source asset address for Sonic chain");
|
|
14726
15132
|
const userRouter = await SonicSpokeService.getUserRouter(
|
|
@@ -14936,7 +15342,19 @@ var BridgeService = class {
|
|
|
14936
15342
|
}
|
|
14937
15343
|
const encodedRecipientAddress = encodeAddress(params.dstChainId, params.recipient);
|
|
14938
15344
|
if (params.dstChainId === this.hubProvider.chainConfig.chain.id) {
|
|
14939
|
-
|
|
15345
|
+
if (params.dstAsset.toLowerCase() === this.hubProvider.chainConfig.nativeToken.toLowerCase()) {
|
|
15346
|
+
calls.push({
|
|
15347
|
+
address: dstAssetInfo.asset,
|
|
15348
|
+
value: 0n,
|
|
15349
|
+
data: viem.encodeFunctionData({
|
|
15350
|
+
abi: wrappedSonicAbi,
|
|
15351
|
+
functionName: "withdrawTo",
|
|
15352
|
+
args: [encodedRecipientAddress, translatedWithdrawAmount]
|
|
15353
|
+
})
|
|
15354
|
+
});
|
|
15355
|
+
} else {
|
|
15356
|
+
calls.push(Erc20Service.encodeTransfer(dstAssetInfo.asset, encodedRecipientAddress, translatedWithdrawAmount));
|
|
15357
|
+
}
|
|
14940
15358
|
} else {
|
|
14941
15359
|
invariant12__default.default(dstAssetInfo, `Unsupported hub chain (${params.dstChainId}) token: ${params.dstAsset}`);
|
|
14942
15360
|
calls.push(
|
|
@@ -15244,6 +15662,9 @@ async function deriveUserWalletAddress(spokeProvider, hubProvider, walletAddress
|
|
|
15244
15662
|
const address = walletAddress ?? await spokeProvider.walletProvider.getWalletAddress();
|
|
15245
15663
|
return spokeProvider.chainConfig.chain.id === hubProvider.chainConfig.chain.id ? address : await WalletAbstractionService.getUserAbstractedWalletAddress(address, spokeProvider, hubProvider);
|
|
15246
15664
|
}
|
|
15665
|
+
function parseToStroops(amount) {
|
|
15666
|
+
return BigInt(Math.round(Number.parseFloat(amount) * 1e7));
|
|
15667
|
+
}
|
|
15247
15668
|
var BigNumberZeroDecimal = BigNumber4.BigNumber.clone({
|
|
15248
15669
|
DECIMAL_PLACES: 0,
|
|
15249
15670
|
ROUNDING_MODE: BigNumber4.BigNumber.ROUND_DOWN
|
|
@@ -16777,6 +17198,12 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
16777
17198
|
`Unsupported spoke chain (${spokeProvider.chainConfig.chain.id}) token: ${params.token}`
|
|
16778
17199
|
);
|
|
16779
17200
|
const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
|
|
17201
|
+
if (spokeProvider instanceof StellarSpokeProvider && (params.action === "supply" || params.action === "repay")) {
|
|
17202
|
+
return {
|
|
17203
|
+
ok: true,
|
|
17204
|
+
value: await StellarSpokeService.hasSufficientTrustline(params.token, params.amount, spokeProvider)
|
|
17205
|
+
};
|
|
17206
|
+
}
|
|
16780
17207
|
if (spokeProvider instanceof EvmSpokeProvider && (params.action === "supply" || params.action === "repay")) {
|
|
16781
17208
|
return await Erc20Service.isAllowanceValid(
|
|
16782
17209
|
params.token,
|
|
@@ -16874,6 +17301,17 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
16874
17301
|
`Unsupported spoke chain (${spokeProvider.chainConfig.chain.id}) token: ${params.token}`
|
|
16875
17302
|
);
|
|
16876
17303
|
const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
|
|
17304
|
+
if (spokeProvider instanceof StellarSpokeProvider) {
|
|
17305
|
+
invariant12__default.default(
|
|
17306
|
+
params.action === "supply" || params.action === "repay",
|
|
17307
|
+
"Invalid action (only supply and repay are supported on stellar)"
|
|
17308
|
+
);
|
|
17309
|
+
const result = await StellarSpokeService.requestTrustline(params.token, params.amount, spokeProvider, raw);
|
|
17310
|
+
return {
|
|
17311
|
+
ok: true,
|
|
17312
|
+
value: result
|
|
17313
|
+
};
|
|
17314
|
+
}
|
|
16877
17315
|
if (spokeProvider instanceof EvmSpokeProvider) {
|
|
16878
17316
|
invariant12__default.default(
|
|
16879
17317
|
params.action === "supply" || params.action === "repay",
|
|
@@ -17578,14 +18016,9 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
17578
18016
|
const calls = [];
|
|
17579
18017
|
const assetConfig = getHubAssetInfo(spokeChainId, token);
|
|
17580
18018
|
invariant12__default.default(assetConfig, `hub asset not found for spoke chain token (token): ${token}`);
|
|
17581
|
-
|
|
18019
|
+
const assetAddress = assetConfig.asset;
|
|
17582
18020
|
const vaultAddress = assetConfig.vault;
|
|
17583
18021
|
const lendingPool = this.config.lendingPool;
|
|
17584
|
-
if (spokeChainId === this.hubProvider.chainConfig.chain.id) {
|
|
17585
|
-
if (token.toLowerCase() === spokeChainConfig[this.hubProvider.chainConfig.chain.id].nativeToken.toLowerCase()) {
|
|
17586
|
-
assetAddress = spokeChainConfig[this.hubProvider.chainConfig.chain.id].supportedTokens.wS.address;
|
|
17587
|
-
}
|
|
17588
|
-
}
|
|
17589
18022
|
calls.push(Erc20Service.encodeApprove(assetAddress, vaultAddress, amount));
|
|
17590
18023
|
calls.push(EvmVaultTokenService.encodeDeposit(vaultAddress, assetAddress, amount));
|
|
17591
18024
|
const translatedAmount = EvmVaultTokenService.translateIncomingDecimals(assetConfig.decimal, amount);
|
|
@@ -17615,15 +18048,10 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
17615
18048
|
);
|
|
17616
18049
|
const assetConfig = getHubAssetInfo(spokeChainId, token);
|
|
17617
18050
|
invariant12__default.default(assetConfig, `hub asset not found for spoke chain token (token): ${token}`);
|
|
17618
|
-
|
|
18051
|
+
const assetAddress = assetConfig.asset;
|
|
17619
18052
|
const vaultAddress = assetConfig.vault;
|
|
17620
18053
|
const bnUSDVault = this.config.bnUSDVault;
|
|
17621
18054
|
const bnUSD = this.config.bnUSD;
|
|
17622
|
-
if (spokeChainId === this.hubProvider.chainConfig.chain.id) {
|
|
17623
|
-
if (token.toLowerCase() === spokeChainConfig[this.hubProvider.chainConfig.chain.id].nativeToken.toLowerCase()) {
|
|
17624
|
-
assetAddress = spokeChainConfig[this.hubProvider.chainConfig.chain.id].supportedTokens.wS.address;
|
|
17625
|
-
}
|
|
17626
|
-
}
|
|
17627
18055
|
const feeAmount = calculateFeeAmount(amount, this.config.partnerFee);
|
|
17628
18056
|
const calls = [];
|
|
17629
18057
|
if (bnUSDVault && bnUSD && bnUSDVault.toLowerCase() === vaultAddress.toLowerCase()) {
|
|
@@ -17744,15 +18172,10 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
17744
18172
|
if (!assetConfig) {
|
|
17745
18173
|
throw new Error("[buildRepayData] Hub asset not found");
|
|
17746
18174
|
}
|
|
17747
|
-
|
|
18175
|
+
const assetAddress = assetConfig.asset;
|
|
17748
18176
|
const vaultAddress = assetConfig.vault;
|
|
17749
18177
|
const bnUSDVault = this.config.bnUSDVault;
|
|
17750
18178
|
const bnUSD = this.config.bnUSD;
|
|
17751
|
-
if (spokeChainId === this.hubProvider.chainConfig.chain.id) {
|
|
17752
|
-
if (token.toLowerCase() === spokeChainConfig[this.hubProvider.chainConfig.chain.id].nativeToken.toLowerCase()) {
|
|
17753
|
-
assetAddress = spokeChainConfig[this.hubProvider.chainConfig.chain.id].supportedTokens.wS.address;
|
|
17754
|
-
}
|
|
17755
|
-
}
|
|
17756
18179
|
calls.push(Erc20Service.encodeApprove(assetAddress, vaultAddress, amount));
|
|
17757
18180
|
calls.push(EvmVaultTokenService.encodeDeposit(vaultAddress, assetAddress, amount));
|
|
17758
18181
|
const translatedAmount = EvmVaultTokenService.translateIncomingDecimals(assetConfig.decimal, amount);
|
|
@@ -17945,6 +18368,8 @@ exports.BigNumberZeroDecimal = BigNumberZeroDecimal;
|
|
|
17945
18368
|
exports.BnUSDMigrationService = BnUSDMigrationService;
|
|
17946
18369
|
exports.BridgeService = BridgeService;
|
|
17947
18370
|
exports.ChainIdToIntentRelayChainId = ChainIdToIntentRelayChainId;
|
|
18371
|
+
exports.CustomSorobanServer = CustomSorobanServer;
|
|
18372
|
+
exports.CustomStellarAccount = CustomStellarAccount;
|
|
17948
18373
|
exports.DEFAULT_BACKEND_API_ENDPOINT = DEFAULT_BACKEND_API_ENDPOINT;
|
|
17949
18374
|
exports.DEFAULT_BACKEND_API_HEADERS = DEFAULT_BACKEND_API_HEADERS;
|
|
17950
18375
|
exports.DEFAULT_BACKEND_API_TIMEOUT = DEFAULT_BACKEND_API_TIMEOUT;
|
|
@@ -17954,7 +18379,6 @@ exports.DEFAULT_RELAYER_API_ENDPOINT = DEFAULT_RELAYER_API_ENDPOINT;
|
|
|
17954
18379
|
exports.DEFAULT_RELAY_TX_TIMEOUT = DEFAULT_RELAY_TX_TIMEOUT;
|
|
17955
18380
|
exports.DEFAULT_RETRY_DELAY_MS = DEFAULT_RETRY_DELAY_MS;
|
|
17956
18381
|
exports.EVM_CHAIN_IDS = EVM_CHAIN_IDS;
|
|
17957
|
-
exports.EVM_SPOKE_CHAIN_IDS = EVM_SPOKE_CHAIN_IDS;
|
|
17958
18382
|
exports.Erc20Service = Erc20Service;
|
|
17959
18383
|
exports.EvmAssetManagerService = EvmAssetManagerService;
|
|
17960
18384
|
exports.EvmHubProvider = EvmHubProvider;
|
|
@@ -17968,7 +18392,6 @@ exports.HALF_RAY = HALF_RAY;
|
|
|
17968
18392
|
exports.HALF_WAD = HALF_WAD;
|
|
17969
18393
|
exports.HubVaultSymbols = HubVaultSymbols;
|
|
17970
18394
|
exports.ICON_TX_RESULT_WAIT_MAX_RETRY = ICON_TX_RESULT_WAIT_MAX_RETRY;
|
|
17971
|
-
exports.INTENT_RELAY_CHAIN_IDS = INTENT_RELAY_CHAIN_IDS;
|
|
17972
18395
|
exports.IconSpokeProvider = IconSpokeProvider;
|
|
17973
18396
|
exports.IcxMigrationService = IcxMigrationService;
|
|
17974
18397
|
exports.InjectiveSpokeProvider = InjectiveSpokeProvider;
|
|
@@ -18000,6 +18423,7 @@ exports.SonicSpokeProvider = SonicSpokeProvider;
|
|
|
18000
18423
|
exports.SonicSpokeService = SonicSpokeService;
|
|
18001
18424
|
exports.SpokeService = SpokeService;
|
|
18002
18425
|
exports.StellarSpokeProvider = StellarSpokeProvider;
|
|
18426
|
+
exports.StellarSpokeService = StellarSpokeService;
|
|
18003
18427
|
exports.SuiSpokeProvider = SuiSpokeProvider;
|
|
18004
18428
|
exports.SuiSpokeService = SuiSpokeService;
|
|
18005
18429
|
exports.SupportedMigrationTokens = SupportedMigrationTokens;
|
|
@@ -18142,6 +18566,7 @@ exports.normalize = normalize;
|
|
|
18142
18566
|
exports.normalizeBN = normalizeBN;
|
|
18143
18567
|
exports.normalizedToUsd = normalizedToUsd;
|
|
18144
18568
|
exports.originalAssetTohubAssetMap = originalAssetTohubAssetMap;
|
|
18569
|
+
exports.parseToStroops = parseToStroops;
|
|
18145
18570
|
exports.poolAbi = poolAbi;
|
|
18146
18571
|
exports.randomUint256 = randomUint256;
|
|
18147
18572
|
exports.rayDiv = rayDiv;
|