@sodax/sdk 1.3.1-beta → 1.4.1-beta
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 +430 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +111 -23
- package/dist/index.d.ts +111 -23
- package/dist/index.mjs +415 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.mjs
CHANGED
|
@@ -16,6 +16,8 @@ import { CosmosTxV1Beta1Tx } from '@injectivelabs/core-proto-ts';
|
|
|
16
16
|
import * as rlp from 'rlp';
|
|
17
17
|
import * as anchor from '@coral-xyz/anchor';
|
|
18
18
|
import BN from 'bn.js';
|
|
19
|
+
import { createNetwork } from '@stacks/network';
|
|
20
|
+
import { fetchCallReadOnlyFunction, parseContractId, PostConditionMode, noneCV, someCV, Cl, uintCV, serializeCV } from '@stacks/transactions';
|
|
19
21
|
import * as bitcoin from 'bitcoinjs-lib';
|
|
20
22
|
import * as ecc from '@bitcoinerlab/secp256k1';
|
|
21
23
|
import { Token, Price } from '@pancakeswap/swap-sdk-core';
|
|
@@ -8712,7 +8714,7 @@ var universalRouterAbi = [
|
|
|
8712
8714
|
];
|
|
8713
8715
|
|
|
8714
8716
|
// ../types/dist/constants/index.js
|
|
8715
|
-
var CONFIG_VERSION =
|
|
8717
|
+
var CONFIG_VERSION = 31;
|
|
8716
8718
|
var AVALANCHE_MAINNET_CHAIN_ID = "0xa86a.avax";
|
|
8717
8719
|
var ARBITRUM_MAINNET_CHAIN_ID = "0xa4b1.arbitrum";
|
|
8718
8720
|
var BASE_MAINNET_CHAIN_ID = "0x2105.base";
|
|
@@ -8732,6 +8734,7 @@ var ETHEREUM_MAINNET_CHAIN_ID = "ethereum";
|
|
|
8732
8734
|
var BITCOIN_MAINNET_CHAIN_ID = "bitcoin";
|
|
8733
8735
|
var REDBELLY_MAINNET_CHAIN_ID = "redbelly";
|
|
8734
8736
|
var KAIA_MAINNET_CHAIN_ID = "0x2019.kaia";
|
|
8737
|
+
var STACKS_MAINNET_CHAIN_ID = "stacks";
|
|
8735
8738
|
var HUB_CHAIN_IDS = [SONIC_MAINNET_CHAIN_ID];
|
|
8736
8739
|
var CHAIN_IDS = [
|
|
8737
8740
|
SONIC_MAINNET_CHAIN_ID,
|
|
@@ -8752,7 +8755,8 @@ var CHAIN_IDS = [
|
|
|
8752
8755
|
ETHEREUM_MAINNET_CHAIN_ID,
|
|
8753
8756
|
BITCOIN_MAINNET_CHAIN_ID,
|
|
8754
8757
|
REDBELLY_MAINNET_CHAIN_ID,
|
|
8755
|
-
KAIA_MAINNET_CHAIN_ID
|
|
8758
|
+
KAIA_MAINNET_CHAIN_ID,
|
|
8759
|
+
STACKS_MAINNET_CHAIN_ID
|
|
8756
8760
|
];
|
|
8757
8761
|
var EVM_CHAIN_IDS = [
|
|
8758
8762
|
AVALANCHE_MAINNET_CHAIN_ID,
|
|
@@ -8882,6 +8886,12 @@ var baseChainInfo = {
|
|
|
8882
8886
|
id: KAIA_MAINNET_CHAIN_ID,
|
|
8883
8887
|
type: "EVM",
|
|
8884
8888
|
chainId: 8217
|
|
8889
|
+
},
|
|
8890
|
+
[STACKS_MAINNET_CHAIN_ID]: {
|
|
8891
|
+
name: "Stacks",
|
|
8892
|
+
id: STACKS_MAINNET_CHAIN_ID,
|
|
8893
|
+
type: "STACKS",
|
|
8894
|
+
chainId: "stacks"
|
|
8885
8895
|
}
|
|
8886
8896
|
};
|
|
8887
8897
|
var ChainIdToIntentRelayChainId = {
|
|
@@ -8903,7 +8913,8 @@ var ChainIdToIntentRelayChainId = {
|
|
|
8903
8913
|
[ETHEREUM_MAINNET_CHAIN_ID]: 2n,
|
|
8904
8914
|
[BITCOIN_MAINNET_CHAIN_ID]: 627463n,
|
|
8905
8915
|
[REDBELLY_MAINNET_CHAIN_ID]: 726564n,
|
|
8906
|
-
[KAIA_MAINNET_CHAIN_ID]: 27489n
|
|
8916
|
+
[KAIA_MAINNET_CHAIN_ID]: 27489n,
|
|
8917
|
+
[STACKS_MAINNET_CHAIN_ID]: 60n
|
|
8907
8918
|
};
|
|
8908
8919
|
var getIntentRelayChainId = (chainId) => ChainIdToIntentRelayChainId[chainId];
|
|
8909
8920
|
var HubVaultSymbols = [
|
|
@@ -8928,7 +8939,8 @@ var HubVaultSymbols = [
|
|
|
8928
8939
|
"sodaWEETH",
|
|
8929
8940
|
"sodaWSTETH",
|
|
8930
8941
|
"sodaNEAR",
|
|
8931
|
-
"sodaKAIA"
|
|
8942
|
+
"sodaKAIA",
|
|
8943
|
+
"sodaSTX"
|
|
8932
8944
|
];
|
|
8933
8945
|
var SodaTokens = {
|
|
8934
8946
|
sodaBNB: {
|
|
@@ -9084,6 +9096,13 @@ var SodaTokens = {
|
|
|
9084
9096
|
decimals: 18,
|
|
9085
9097
|
address: "0xD7d41b5f803b6A40F8A6eAa34E459A4564e39891",
|
|
9086
9098
|
xChainId: SONIC_MAINNET_CHAIN_ID
|
|
9099
|
+
},
|
|
9100
|
+
sodaSTX: {
|
|
9101
|
+
symbol: "sodaSTX",
|
|
9102
|
+
name: "Soda STX",
|
|
9103
|
+
decimals: 18,
|
|
9104
|
+
address: "0x1Fbe5229e9d189F26bEE77E5bFa24309FdA90483",
|
|
9105
|
+
xChainId: SONIC_MAINNET_CHAIN_ID
|
|
9087
9106
|
}
|
|
9088
9107
|
};
|
|
9089
9108
|
var SodaTokensAsHubAssets = Object.values(SodaTokens).reduce((acc, token) => {
|
|
@@ -9182,7 +9201,6 @@ var spokeChainConfig = {
|
|
|
9182
9201
|
assetManager: "AnCCJjheynmGqPp6Vgat9DTirGKD4CtQzP8cwTYV8qKH",
|
|
9183
9202
|
connection: "GxS8i6D9qQjbSeniD487CnomUxU2pXt6V8P96T6MkUXB",
|
|
9184
9203
|
rateLimit: "2Vyy3A3Teju2EMCkdnappEeWqBXyAaF5V2WsrU4hDtsk",
|
|
9185
|
-
testToken: "3Q2HS3png7fLaYerqCun3zw8rnBZo2Ksvdg6RHTyM4Ns",
|
|
9186
9204
|
xTokenManager: ""
|
|
9187
9205
|
},
|
|
9188
9206
|
chain: baseChainInfo[SOLANA_MAINNET_CHAIN_ID],
|
|
@@ -9763,7 +9781,6 @@ var spokeChainConfig = {
|
|
|
9763
9781
|
assetManager: "inj1dg6tm62uup53wn2kn97caeqfwt0sukx3qjk8rw",
|
|
9764
9782
|
connection: "inj1eexvfglsptxwfj9hft96xcnsdrvr7d7dalcm8w",
|
|
9765
9783
|
rateLimit: "inj1x8p2h56edcdrm9tzx7a7zkwe0l334klgrxpqyk",
|
|
9766
|
-
testToken: "",
|
|
9767
9784
|
xTokenManager: ""
|
|
9768
9785
|
},
|
|
9769
9786
|
chain: baseChainInfo[INJECTIVE_MAINNET_CHAIN_ID],
|
|
@@ -9855,8 +9872,7 @@ var spokeChainConfig = {
|
|
|
9855
9872
|
connection: "CDFQDDPUPAM3XPGORHDOEFRNLMKOH3N3X6XTXNLSXJQXIU3RVCM3OPEP",
|
|
9856
9873
|
assetManager: "CCGF33A4CO6D3BXFEKPXVCFCZBK76I3AQOZK6KIKRPAWAZR3632WHCJ3",
|
|
9857
9874
|
xTokenManager: "",
|
|
9858
|
-
rateLimit: "CB6G3ULISTTBPXUN3BI6ADHQGWJEN7BPQINHL45TCB6TDFM5QWU24HAY"
|
|
9859
|
-
testToken: ""
|
|
9875
|
+
rateLimit: "CB6G3ULISTTBPXUN3BI6ADHQGWJEN7BPQINHL45TCB6TDFM5QWU24HAY"
|
|
9860
9876
|
},
|
|
9861
9877
|
trustlineConfigs: [
|
|
9862
9878
|
{
|
|
@@ -9924,8 +9940,7 @@ var spokeChainConfig = {
|
|
|
9924
9940
|
assetManagerConfigId: "0xcb7346339340b7f8dea40fcafb70721dc2fcfa7e8626a89fd954d46c1f928b61",
|
|
9925
9941
|
originalAssetManager: "0xa17a409164d1676db71b411ab50813ba2c7dd547d2df538c699049566f1ff922::asset_manager::0xcb7346339340b7f8dea40fcafb70721dc2fcfa7e8626a89fd954d46c1f928b61",
|
|
9926
9942
|
xTokenManager: "",
|
|
9927
|
-
rateLimit: ""
|
|
9928
|
-
testToken: ""
|
|
9943
|
+
rateLimit: ""
|
|
9929
9944
|
},
|
|
9930
9945
|
supportedTokens: {
|
|
9931
9946
|
SUI: {
|
|
@@ -10353,6 +10368,55 @@ var spokeChainConfig = {
|
|
|
10353
10368
|
xChainId: REDBELLY_MAINNET_CHAIN_ID
|
|
10354
10369
|
}
|
|
10355
10370
|
}
|
|
10371
|
+
},
|
|
10372
|
+
[STACKS_MAINNET_CHAIN_ID]: {
|
|
10373
|
+
addresses: {
|
|
10374
|
+
assetManager: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.asset-manager-state",
|
|
10375
|
+
connection: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.connection-v3",
|
|
10376
|
+
rateLimit: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.rate-limit-state",
|
|
10377
|
+
xTokenManager: ""
|
|
10378
|
+
},
|
|
10379
|
+
chain: baseChainInfo[STACKS_MAINNET_CHAIN_ID],
|
|
10380
|
+
nativeToken: "ST000000000000000000002AMW42H.nativetoken",
|
|
10381
|
+
bnUSD: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.bnusd",
|
|
10382
|
+
supportedTokens: {
|
|
10383
|
+
STX: {
|
|
10384
|
+
symbol: "STX",
|
|
10385
|
+
name: "Stacks",
|
|
10386
|
+
decimals: 6,
|
|
10387
|
+
address: "ST000000000000000000002AMW42H.nativetoken",
|
|
10388
|
+
xChainId: STACKS_MAINNET_CHAIN_ID
|
|
10389
|
+
},
|
|
10390
|
+
bnUSD: {
|
|
10391
|
+
symbol: "bnUSD",
|
|
10392
|
+
name: "bnUSD",
|
|
10393
|
+
decimals: 6,
|
|
10394
|
+
address: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.bnusd",
|
|
10395
|
+
xChainId: STACKS_MAINNET_CHAIN_ID
|
|
10396
|
+
},
|
|
10397
|
+
SODA: {
|
|
10398
|
+
symbol: "SODA",
|
|
10399
|
+
name: "SODAX",
|
|
10400
|
+
decimals: 6,
|
|
10401
|
+
address: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.soda",
|
|
10402
|
+
xChainId: STACKS_MAINNET_CHAIN_ID
|
|
10403
|
+
},
|
|
10404
|
+
sBTC: {
|
|
10405
|
+
symbol: "sBTC",
|
|
10406
|
+
name: "sBTC",
|
|
10407
|
+
decimals: 8,
|
|
10408
|
+
address: "SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token",
|
|
10409
|
+
xChainId: STACKS_MAINNET_CHAIN_ID
|
|
10410
|
+
},
|
|
10411
|
+
USDC: {
|
|
10412
|
+
symbol: "USDC",
|
|
10413
|
+
name: "USD Coin",
|
|
10414
|
+
decimals: 6,
|
|
10415
|
+
address: "SP120SBRBQJ00MCWS7TM5R8WJNTTKD5K0HFRC2CNE.usdcx",
|
|
10416
|
+
xChainId: STACKS_MAINNET_CHAIN_ID
|
|
10417
|
+
}
|
|
10418
|
+
},
|
|
10419
|
+
rpcUrl: "https://api.mainnet.hiro.so"
|
|
10356
10420
|
}
|
|
10357
10421
|
};
|
|
10358
10422
|
var hubAssets = {
|
|
@@ -11347,6 +11411,43 @@ var hubAssets = {
|
|
|
11347
11411
|
vault: SodaTokens.sodaPOL.address
|
|
11348
11412
|
}
|
|
11349
11413
|
},
|
|
11414
|
+
[STACKS_MAINNET_CHAIN_ID]: {
|
|
11415
|
+
[spokeChainConfig[STACKS_MAINNET_CHAIN_ID].nativeToken]: {
|
|
11416
|
+
asset: "0x30b3b1a3e4f1235472772e60a8cd9c0165db641e",
|
|
11417
|
+
decimal: 6,
|
|
11418
|
+
symbol: "STX",
|
|
11419
|
+
name: "Stacks",
|
|
11420
|
+
vault: SodaTokens.sodaSTX.address
|
|
11421
|
+
},
|
|
11422
|
+
[spokeChainConfig[STACKS_MAINNET_CHAIN_ID].bnUSD]: {
|
|
11423
|
+
asset: "0x78093c056fb37ffc1a9ae96daa0a7dd9d372b64d",
|
|
11424
|
+
decimal: 6,
|
|
11425
|
+
symbol: "bnUSD",
|
|
11426
|
+
name: "bnUSD",
|
|
11427
|
+
vault: SodaTokens.bnUSD.address
|
|
11428
|
+
},
|
|
11429
|
+
[spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
|
|
11430
|
+
asset: "0xebd34ddf9f47f9bcdf706e87206d40a579c34822",
|
|
11431
|
+
decimal: 6,
|
|
11432
|
+
symbol: "SODA",
|
|
11433
|
+
name: "SODAX",
|
|
11434
|
+
vault: SodaTokens.sodaSODA.address
|
|
11435
|
+
},
|
|
11436
|
+
[spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.sBTC.address]: {
|
|
11437
|
+
asset: "0x6f6c039b07e25bb86d8223643a84122404963d9b",
|
|
11438
|
+
decimal: 8,
|
|
11439
|
+
symbol: "sBTC",
|
|
11440
|
+
name: "sBTC",
|
|
11441
|
+
vault: SodaTokens.sodaBTC.address
|
|
11442
|
+
},
|
|
11443
|
+
[spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
|
|
11444
|
+
asset: "0x2336917df30f3417986a29ec384274a83adbef16",
|
|
11445
|
+
decimal: 6,
|
|
11446
|
+
symbol: "USDC",
|
|
11447
|
+
name: "USD Coin",
|
|
11448
|
+
vault: SodaTokens.sodaUSDC.address
|
|
11449
|
+
}
|
|
11450
|
+
},
|
|
11350
11451
|
[BITCOIN_MAINNET_CHAIN_ID]: {
|
|
11351
11452
|
[spokeChainConfig[BITCOIN_MAINNET_CHAIN_ID].supportedTokens.BTC.address]: {
|
|
11352
11453
|
asset: "0xeb0393893b5bf98a50073d6740738b08e575058b",
|
|
@@ -11380,7 +11481,8 @@ var swapSupportedTokens = {
|
|
|
11380
11481
|
spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.USDT,
|
|
11381
11482
|
spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.wS,
|
|
11382
11483
|
spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.SODA,
|
|
11383
|
-
spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.bnUSD
|
|
11484
|
+
spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
11485
|
+
...Object.values(SodaTokens)
|
|
11384
11486
|
],
|
|
11385
11487
|
[AVALANCHE_MAINNET_CHAIN_ID]: [
|
|
11386
11488
|
spokeChainConfig[AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.AVAX,
|
|
@@ -11536,6 +11638,13 @@ var swapSupportedTokens = {
|
|
|
11536
11638
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.USDT,
|
|
11537
11639
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
11538
11640
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.SODA
|
|
11641
|
+
],
|
|
11642
|
+
[STACKS_MAINNET_CHAIN_ID]: [
|
|
11643
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.STX,
|
|
11644
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
11645
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.SODA,
|
|
11646
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.sBTC,
|
|
11647
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.USDC
|
|
11539
11648
|
]
|
|
11540
11649
|
};
|
|
11541
11650
|
var getSupportedSolverTokens = (chainId) => swapSupportedTokens[chainId];
|
|
@@ -11708,6 +11817,13 @@ var moneyMarketSupportedTokens = {
|
|
|
11708
11817
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.USDT,
|
|
11709
11818
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.SODA
|
|
11710
11819
|
],
|
|
11820
|
+
[STACKS_MAINNET_CHAIN_ID]: [
|
|
11821
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.STX,
|
|
11822
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
11823
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.SODA,
|
|
11824
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.sBTC,
|
|
11825
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.USDC
|
|
11826
|
+
],
|
|
11711
11827
|
[BITCOIN_MAINNET_CHAIN_ID]: [
|
|
11712
11828
|
spokeChainConfig[BITCOIN_MAINNET_CHAIN_ID].supportedTokens.BTC
|
|
11713
11829
|
]
|
|
@@ -11734,7 +11850,7 @@ var defaultSharedConfig = {
|
|
|
11734
11850
|
};
|
|
11735
11851
|
|
|
11736
11852
|
// ../types/dist/common/index.js
|
|
11737
|
-
var ChainTypeArr = ["ICON", "EVM", "INJECTIVE", "SUI", "STELLAR", "SOLANA", "NEAR", "BITCOIN"];
|
|
11853
|
+
var ChainTypeArr = ["ICON", "EVM", "INJECTIVE", "SUI", "STELLAR", "SOLANA", "STACKS", "NEAR", "BITCOIN"];
|
|
11738
11854
|
|
|
11739
11855
|
// ../types/dist/injective/index.js
|
|
11740
11856
|
var InjectiveExecuteResponse = class _InjectiveExecuteResponse {
|
|
@@ -13129,7 +13245,7 @@ var EvmWalletAbstraction = class {
|
|
|
13129
13245
|
/**
|
|
13130
13246
|
* Get the hub wallet address for a given spoke chain and address.
|
|
13131
13247
|
* @param chainId - The spoke chain ID.
|
|
13132
|
-
* @param address - The address on the spoke chain.
|
|
13248
|
+
* @param address - The encoded address on the spoke chain.
|
|
13133
13249
|
* @param hubProvider - The hub provider.
|
|
13134
13250
|
* @returns The hub wallet address.
|
|
13135
13251
|
*/
|
|
@@ -14033,11 +14149,11 @@ function add(Ah, Al, Bh, Bl) {
|
|
|
14033
14149
|
const l = (Al >>> 0) + (Bl >>> 0);
|
|
14034
14150
|
return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
|
|
14035
14151
|
}
|
|
14036
|
-
var add3L = (Al, Bl,
|
|
14152
|
+
var add3L = (Al, Bl, Cl5) => (Al >>> 0) + (Bl >>> 0) + (Cl5 >>> 0);
|
|
14037
14153
|
var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
|
|
14038
|
-
var add4L = (Al, Bl,
|
|
14154
|
+
var add4L = (Al, Bl, Cl5, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl5 >>> 0) + (Dl >>> 0);
|
|
14039
14155
|
var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
|
|
14040
|
-
var add5L = (Al, Bl,
|
|
14156
|
+
var add5L = (Al, Bl, Cl5, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl5 >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
14041
14157
|
var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
|
|
14042
14158
|
|
|
14043
14159
|
// ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/sha2.js
|
|
@@ -14277,17 +14393,17 @@ var SHA2_64B = class extends HashMD {
|
|
|
14277
14393
|
}
|
|
14278
14394
|
// prettier-ignore
|
|
14279
14395
|
get() {
|
|
14280
|
-
const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
14281
|
-
return [Ah, Al, Bh, Bl, Ch,
|
|
14396
|
+
const { Ah, Al, Bh, Bl, Ch, Cl: Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
14397
|
+
return [Ah, Al, Bh, Bl, Ch, Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];
|
|
14282
14398
|
}
|
|
14283
14399
|
// prettier-ignore
|
|
14284
|
-
set(Ah, Al, Bh, Bl, Ch,
|
|
14400
|
+
set(Ah, Al, Bh, Bl, Ch, Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
|
|
14285
14401
|
this.Ah = Ah | 0;
|
|
14286
14402
|
this.Al = Al | 0;
|
|
14287
14403
|
this.Bh = Bh | 0;
|
|
14288
14404
|
this.Bl = Bl | 0;
|
|
14289
14405
|
this.Ch = Ch | 0;
|
|
14290
|
-
this.Cl =
|
|
14406
|
+
this.Cl = Cl5 | 0;
|
|
14291
14407
|
this.Dh = Dh | 0;
|
|
14292
14408
|
this.Dl = Dl | 0;
|
|
14293
14409
|
this.Eh = Eh | 0;
|
|
@@ -14318,7 +14434,7 @@ var SHA2_64B = class extends HashMD {
|
|
|
14318
14434
|
SHA512_W_H[i] = SUMh | 0;
|
|
14319
14435
|
SHA512_W_L[i] = SUMl | 0;
|
|
14320
14436
|
}
|
|
14321
|
-
let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
14437
|
+
let { Ah, Al, Bh, Bl, Ch, Cl: Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
14322
14438
|
for (let i = 0; i < 80; i++) {
|
|
14323
14439
|
const sigma1h = rotrSH(Eh, El, 14) ^ rotrSH(Eh, El, 18) ^ rotrBH(Eh, El, 41);
|
|
14324
14440
|
const sigma1l = rotrSL(Eh, El, 14) ^ rotrSL(Eh, El, 18) ^ rotrBL(Eh, El, 41);
|
|
@@ -14330,7 +14446,7 @@ var SHA2_64B = class extends HashMD {
|
|
|
14330
14446
|
const sigma0h = rotrSH(Ah, Al, 28) ^ rotrBH(Ah, Al, 34) ^ rotrBH(Ah, Al, 39);
|
|
14331
14447
|
const sigma0l = rotrSL(Ah, Al, 28) ^ rotrBL(Ah, Al, 34) ^ rotrBL(Ah, Al, 39);
|
|
14332
14448
|
const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
|
|
14333
|
-
const MAJl = Al & Bl ^ Al &
|
|
14449
|
+
const MAJl = Al & Bl ^ Al & Cl5 ^ Bl & Cl5;
|
|
14334
14450
|
Hh = Gh | 0;
|
|
14335
14451
|
Hl = Gl | 0;
|
|
14336
14452
|
Gh = Fh | 0;
|
|
@@ -14339,9 +14455,9 @@ var SHA2_64B = class extends HashMD {
|
|
|
14339
14455
|
Fl = El | 0;
|
|
14340
14456
|
({ h: Eh, l: El } = add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
|
|
14341
14457
|
Dh = Ch | 0;
|
|
14342
|
-
Dl =
|
|
14458
|
+
Dl = Cl5 | 0;
|
|
14343
14459
|
Ch = Bh | 0;
|
|
14344
|
-
|
|
14460
|
+
Cl5 = Bl | 0;
|
|
14345
14461
|
Bh = Ah | 0;
|
|
14346
14462
|
Bl = Al | 0;
|
|
14347
14463
|
const All = add3L(T1l, sigma0l, MAJl);
|
|
@@ -14350,13 +14466,13 @@ var SHA2_64B = class extends HashMD {
|
|
|
14350
14466
|
}
|
|
14351
14467
|
({ h: Ah, l: Al } = add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
|
|
14352
14468
|
({ h: Bh, l: Bl } = add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
|
|
14353
|
-
({ h: Ch, l:
|
|
14469
|
+
({ h: Ch, l: Cl5 } = add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl5 | 0));
|
|
14354
14470
|
({ h: Dh, l: Dl } = add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
|
|
14355
14471
|
({ h: Eh, l: El } = add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
|
|
14356
14472
|
({ h: Fh, l: Fl } = add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
|
|
14357
14473
|
({ h: Gh, l: Gl } = add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
|
|
14358
14474
|
({ h: Hh, l: Hl } = add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
|
|
14359
|
-
this.set(Ah, Al, Bh, Bl, Ch,
|
|
14475
|
+
this.set(Ah, Al, Bh, Bl, Ch, Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
|
|
14360
14476
|
}
|
|
14361
14477
|
roundClean() {
|
|
14362
14478
|
clean(SHA512_W_H, SHA512_W_L);
|
|
@@ -23334,6 +23450,203 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
23334
23450
|
}
|
|
23335
23451
|
}
|
|
23336
23452
|
};
|
|
23453
|
+
var StacksBaseSpokeProvider = class {
|
|
23454
|
+
chainConfig;
|
|
23455
|
+
network;
|
|
23456
|
+
constructor(config) {
|
|
23457
|
+
this.chainConfig = config;
|
|
23458
|
+
this.network = createNetwork({ network: "mainnet", client: { baseUrl: config.rpcUrl } });
|
|
23459
|
+
}
|
|
23460
|
+
async getSTXBalance(address) {
|
|
23461
|
+
const url = `${this.network.client.baseUrl}/extended/v1/address/${address}/balances`;
|
|
23462
|
+
const response = await fetch(url);
|
|
23463
|
+
if (!response.ok) {
|
|
23464
|
+
throw new Error(`Error fetching STX balance: ${response.statusText}`);
|
|
23465
|
+
}
|
|
23466
|
+
const data = await response.json();
|
|
23467
|
+
return BigInt(data.stx.balance);
|
|
23468
|
+
}
|
|
23469
|
+
async readTokenBalance(token, address) {
|
|
23470
|
+
const [contractAddress, contractName] = parseContractId(token);
|
|
23471
|
+
const result = await fetchCallReadOnlyFunction({
|
|
23472
|
+
contractAddress,
|
|
23473
|
+
contractName,
|
|
23474
|
+
functionName: "get-balance",
|
|
23475
|
+
functionArgs: [Cl.principal(address)],
|
|
23476
|
+
network: this.network,
|
|
23477
|
+
senderAddress: address
|
|
23478
|
+
});
|
|
23479
|
+
return result.value.value;
|
|
23480
|
+
}
|
|
23481
|
+
async getImplContractAddress(stateContract) {
|
|
23482
|
+
const [contractAddress, contractName] = parseContractId(stateContract);
|
|
23483
|
+
const txParams = {
|
|
23484
|
+
contractAddress,
|
|
23485
|
+
contractName,
|
|
23486
|
+
functionName: "get-asset-manager-impl",
|
|
23487
|
+
functionArgs: []
|
|
23488
|
+
};
|
|
23489
|
+
const implAddress = (await this.walletReadContract(txParams)).value;
|
|
23490
|
+
return implAddress;
|
|
23491
|
+
}
|
|
23492
|
+
};
|
|
23493
|
+
var StacksSpokeProvider = class extends StacksBaseSpokeProvider {
|
|
23494
|
+
walletProvider;
|
|
23495
|
+
constructor(config, walletProvider) {
|
|
23496
|
+
super(config);
|
|
23497
|
+
this.walletProvider = walletProvider;
|
|
23498
|
+
}
|
|
23499
|
+
async walletReadContract(txParams) {
|
|
23500
|
+
return this.walletProvider.readContract(txParams);
|
|
23501
|
+
}
|
|
23502
|
+
};
|
|
23503
|
+
var StacksRawSpokeProvider = class extends StacksBaseSpokeProvider {
|
|
23504
|
+
walletProvider;
|
|
23505
|
+
raw = true;
|
|
23506
|
+
constructor(walletAddress, config) {
|
|
23507
|
+
super(config);
|
|
23508
|
+
this.walletProvider = {
|
|
23509
|
+
getWalletAddress: async () => walletAddress
|
|
23510
|
+
};
|
|
23511
|
+
}
|
|
23512
|
+
async walletReadContract(txParams) {
|
|
23513
|
+
return fetchCallReadOnlyFunction({
|
|
23514
|
+
contractAddress: txParams.contractAddress,
|
|
23515
|
+
contractName: txParams.contractName,
|
|
23516
|
+
functionName: txParams.functionName,
|
|
23517
|
+
functionArgs: txParams.functionArgs,
|
|
23518
|
+
network: this.network,
|
|
23519
|
+
senderAddress: await this.walletProvider.getWalletAddress()
|
|
23520
|
+
});
|
|
23521
|
+
}
|
|
23522
|
+
};
|
|
23523
|
+
var StacksSpokeService = class _StacksSpokeService {
|
|
23524
|
+
constructor() {
|
|
23525
|
+
}
|
|
23526
|
+
/**
|
|
23527
|
+
* Deposit tokens to the spoke chain.
|
|
23528
|
+
* @param {StacksSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
|
|
23529
|
+
* @param {StacksSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
23530
|
+
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
23531
|
+
* @returns {Promise<Hash>} A promise that resolves to the transaction hash.
|
|
23532
|
+
*/
|
|
23533
|
+
static async deposit(params, spokeProvider, hubProvider, raw) {
|
|
23534
|
+
const userWallet = await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
23535
|
+
spokeProvider.chainConfig.chain.id,
|
|
23536
|
+
encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
23537
|
+
hubProvider
|
|
23538
|
+
);
|
|
23539
|
+
return _StacksSpokeService.transfer(
|
|
23540
|
+
{
|
|
23541
|
+
from: params.from,
|
|
23542
|
+
token: params.token,
|
|
23543
|
+
recipient: params.to ? params.to : userWallet,
|
|
23544
|
+
amount: params.amount,
|
|
23545
|
+
data: params.data
|
|
23546
|
+
},
|
|
23547
|
+
spokeProvider,
|
|
23548
|
+
raw
|
|
23549
|
+
);
|
|
23550
|
+
}
|
|
23551
|
+
/**
|
|
23552
|
+
* Get the balance of the token in the spoke chain.
|
|
23553
|
+
* @param {Address} token - The address of the token to get the balance of.
|
|
23554
|
+
* @param {StacksSpokeProviderType} spokeProvider - The spoke provider.
|
|
23555
|
+
* @returns {Promise<bigint>} The balance of the token.
|
|
23556
|
+
*/
|
|
23557
|
+
static async getDeposit(token, spokeProvider) {
|
|
23558
|
+
const assetManager = spokeProvider.chainConfig.addresses.assetManager;
|
|
23559
|
+
if (token.toLowerCase() === spokeProvider.chainConfig.nativeToken.toLowerCase()) {
|
|
23560
|
+
return spokeProvider.getSTXBalance(assetManager);
|
|
23561
|
+
}
|
|
23562
|
+
return spokeProvider.readTokenBalance(token, assetManager);
|
|
23563
|
+
}
|
|
23564
|
+
/**
|
|
23565
|
+
* Get the simulation parameters for a deposit.
|
|
23566
|
+
* @param {StacksSpokeDepositParams} params - The deposit parameters.
|
|
23567
|
+
* @param {StacksSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
23568
|
+
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
23569
|
+
* @returns {Promise<DepositSimulationParams>} The simulation parameters.
|
|
23570
|
+
*/
|
|
23571
|
+
static async getSimulateDepositParams(params, spokeProvider, hubProvider) {
|
|
23572
|
+
const to = params.to ?? await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
23573
|
+
spokeProvider.chainConfig.chain.id,
|
|
23574
|
+
encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
23575
|
+
hubProvider
|
|
23576
|
+
);
|
|
23577
|
+
return {
|
|
23578
|
+
spokeChainID: spokeProvider.chainConfig.chain.id,
|
|
23579
|
+
token: encodeAddress(spokeProvider.chainConfig.chain.id, params.token),
|
|
23580
|
+
from: encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
23581
|
+
to,
|
|
23582
|
+
amount: params.amount,
|
|
23583
|
+
data: params.data,
|
|
23584
|
+
srcAddress: encodeAddress(spokeProvider.chainConfig.chain.id, spokeProvider.chainConfig.addresses.assetManager)
|
|
23585
|
+
};
|
|
23586
|
+
}
|
|
23587
|
+
/**
|
|
23588
|
+
* Calls a contract on the spoke chain using the user's wallet.
|
|
23589
|
+
* @param {Hex} from - The address of the user on the spoke chain.
|
|
23590
|
+
* @param {Hex} payload - The payload to send to the contract.
|
|
23591
|
+
* @param {StacksSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
23592
|
+
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
23593
|
+
* @returns {Promise<Hash>} A promise that resolves to the transaction hash.
|
|
23594
|
+
*/
|
|
23595
|
+
static async callWallet(from, payload, spokeProvider, hubProvider, raw) {
|
|
23596
|
+
const relayId = getIntentRelayChainId(hubProvider.chainConfig.chain.id);
|
|
23597
|
+
return _StacksSpokeService.call(BigInt(relayId), from, payload, spokeProvider, raw);
|
|
23598
|
+
}
|
|
23599
|
+
/**
|
|
23600
|
+
* Transfers tokens to the hub chain.
|
|
23601
|
+
*/
|
|
23602
|
+
static async transfer({ from, token, recipient, amount, data = "0x" }, spokeProvider, raw) {
|
|
23603
|
+
const assetManagerImpl = await spokeProvider.getImplContractAddress(
|
|
23604
|
+
spokeProvider.chainConfig.addresses.assetManager
|
|
23605
|
+
);
|
|
23606
|
+
const [implAddress, implName] = parseContractId(assetManagerImpl);
|
|
23607
|
+
const [connectionAddress, connectionName] = parseContractId(
|
|
23608
|
+
spokeProvider.chainConfig.addresses.connection
|
|
23609
|
+
);
|
|
23610
|
+
const reqData = {
|
|
23611
|
+
contractAddress: implAddress,
|
|
23612
|
+
contractName: implName,
|
|
23613
|
+
functionName: "transfer",
|
|
23614
|
+
functionArgs: [
|
|
23615
|
+
token.toLowerCase() === spokeProvider.chainConfig.nativeToken.toLowerCase() ? noneCV() : someCV(Cl.principal(token)),
|
|
23616
|
+
Cl.bufferFromHex(recipient),
|
|
23617
|
+
uintCV(amount),
|
|
23618
|
+
Cl.bufferFromHex(data),
|
|
23619
|
+
Cl.contractPrincipal(connectionAddress, connectionName)
|
|
23620
|
+
],
|
|
23621
|
+
postConditionMode: PostConditionMode.Allow
|
|
23622
|
+
};
|
|
23623
|
+
if (raw || spokeProvider instanceof StacksRawSpokeProvider) {
|
|
23624
|
+
return reqData;
|
|
23625
|
+
}
|
|
23626
|
+
const txId = await spokeProvider.walletProvider.sendTransaction(reqData);
|
|
23627
|
+
return txId;
|
|
23628
|
+
}
|
|
23629
|
+
/**
|
|
23630
|
+
* Sends a message to the hub chain.
|
|
23631
|
+
*/
|
|
23632
|
+
static async call(dstChainId, dstAddress, payload, spokeProvider, raw) {
|
|
23633
|
+
const [connectionAddress, connectionName] = parseContractId(
|
|
23634
|
+
spokeProvider.chainConfig.addresses.connection
|
|
23635
|
+
);
|
|
23636
|
+
const reqData = {
|
|
23637
|
+
contractAddress: connectionAddress,
|
|
23638
|
+
contractName: connectionName,
|
|
23639
|
+
functionName: "send-message",
|
|
23640
|
+
functionArgs: [uintCV(dstChainId), Cl.bufferFromHex(dstAddress), Cl.bufferFromHex(payload)],
|
|
23641
|
+
postConditionMode: PostConditionMode.Allow
|
|
23642
|
+
};
|
|
23643
|
+
if (raw || spokeProvider instanceof StacksRawSpokeProvider) {
|
|
23644
|
+
return reqData;
|
|
23645
|
+
}
|
|
23646
|
+
const txId = await spokeProvider.walletProvider.sendTransaction(reqData);
|
|
23647
|
+
return txId;
|
|
23648
|
+
}
|
|
23649
|
+
};
|
|
23337
23650
|
|
|
23338
23651
|
// src/shared/entities/btc/RadfiProvider.ts
|
|
23339
23652
|
var RadfiProvider = class {
|
|
@@ -24535,6 +24848,15 @@ var SpokeService = class _SpokeService {
|
|
|
24535
24848
|
raw
|
|
24536
24849
|
);
|
|
24537
24850
|
}
|
|
24851
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
24852
|
+
await _SpokeService.verifyDepositSimulation(params, spokeProvider, hubProvider, skipSimulation);
|
|
24853
|
+
return StacksSpokeService.deposit(
|
|
24854
|
+
params,
|
|
24855
|
+
spokeProvider,
|
|
24856
|
+
hubProvider,
|
|
24857
|
+
raw
|
|
24858
|
+
);
|
|
24859
|
+
}
|
|
24538
24860
|
if (isBitcoinSpokeProviderType(spokeProvider)) {
|
|
24539
24861
|
await _SpokeService.verifyDepositSimulation(params, spokeProvider, hubProvider, skipSimulation);
|
|
24540
24862
|
return BitcoinSpokeService.deposit(
|
|
@@ -24611,6 +24933,13 @@ var SpokeService = class _SpokeService {
|
|
|
24611
24933
|
hubProvider
|
|
24612
24934
|
);
|
|
24613
24935
|
}
|
|
24936
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
24937
|
+
return StacksSpokeService.getSimulateDepositParams(
|
|
24938
|
+
params,
|
|
24939
|
+
spokeProvider,
|
|
24940
|
+
hubProvider
|
|
24941
|
+
);
|
|
24942
|
+
}
|
|
24614
24943
|
throw new Error("[getSimulateDepositParams] Invalid spoke provider");
|
|
24615
24944
|
}
|
|
24616
24945
|
static async verifyDepositSimulation(params, spokeProvider, hubProvider, skipSimulation) {
|
|
@@ -24650,6 +24979,9 @@ var SpokeService = class _SpokeService {
|
|
|
24650
24979
|
if (isSonicSpokeProviderType(spokeProvider)) {
|
|
24651
24980
|
return SonicSpokeService.getDeposit(token, spokeProvider);
|
|
24652
24981
|
}
|
|
24982
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
24983
|
+
return StacksSpokeService.getDeposit(token, spokeProvider);
|
|
24984
|
+
}
|
|
24653
24985
|
if (isBitcoinSpokeProviderType(spokeProvider)) {
|
|
24654
24986
|
return BitcoinSpokeService.getDeposit(token, spokeProvider);
|
|
24655
24987
|
}
|
|
@@ -24728,6 +25060,16 @@ var SpokeService = class _SpokeService {
|
|
|
24728
25060
|
raw
|
|
24729
25061
|
);
|
|
24730
25062
|
}
|
|
25063
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
25064
|
+
await _SpokeService.verifySimulation(from, payload, spokeProvider, hubProvider, skipSimulation);
|
|
25065
|
+
return await StacksSpokeService.callWallet(
|
|
25066
|
+
from,
|
|
25067
|
+
payload,
|
|
25068
|
+
spokeProvider,
|
|
25069
|
+
hubProvider,
|
|
25070
|
+
raw
|
|
25071
|
+
);
|
|
25072
|
+
}
|
|
24731
25073
|
if (isBitcoinSpokeProviderType(spokeProvider)) {
|
|
24732
25074
|
await _SpokeService.verifySimulation(from, payload, spokeProvider, hubProvider, skipSimulation);
|
|
24733
25075
|
return await BitcoinSpokeService.callWallet(
|
|
@@ -28677,6 +29019,15 @@ function isSuiSpokeProviderType(value) {
|
|
|
28677
29019
|
function isSuiSpokeProvider(value) {
|
|
28678
29020
|
return typeof value === "object" && value !== null && value instanceof SuiSpokeProvider && !("raw" in value) && value.chainConfig.chain.type === "SUI";
|
|
28679
29021
|
}
|
|
29022
|
+
function isStacksSpokeProviderType(value) {
|
|
29023
|
+
return typeof value === "object" && value !== null && (isStacksSpokeProvider(value) || isStacksRawSpokeProvider(value));
|
|
29024
|
+
}
|
|
29025
|
+
function isStacksSpokeProvider(value) {
|
|
29026
|
+
return typeof value === "object" && value !== null && value instanceof StacksSpokeProvider && !("raw" in value) && value.chainConfig.chain.type === "STACKS";
|
|
29027
|
+
}
|
|
29028
|
+
function isStacksRawSpokeProvider(value) {
|
|
29029
|
+
return isRawSpokeProvider(value) && value.chainConfig.chain.type === "STACKS";
|
|
29030
|
+
}
|
|
28680
29031
|
function isConfiguredSolverConfig(value) {
|
|
28681
29032
|
return typeof value === "object" && value !== null && "intentsContract" in value && "solverApiEndpoint" in value;
|
|
28682
29033
|
}
|
|
@@ -28800,6 +29151,9 @@ function isSolanaRawSpokeProviderConfig(value) {
|
|
|
28800
29151
|
function isNearRawSpokeProviderConfig(value) {
|
|
28801
29152
|
return typeof value === "object" && value !== null && "walletAddress" in value && "chainConfig" in value && value.chainConfig.chain.type === "NEAR";
|
|
28802
29153
|
}
|
|
29154
|
+
function isStacksRawSpokeProviderConfig(value) {
|
|
29155
|
+
return typeof value === "object" && value !== null && "walletAddress" in value && "chainConfig" in value && value.chainConfig.chain.type === "STACKS";
|
|
29156
|
+
}
|
|
28803
29157
|
function isSubmitSwapTxResponse(value) {
|
|
28804
29158
|
return typeof value === "object" && value !== null && typeof value.success === "boolean" && typeof value.message === "string";
|
|
28805
29159
|
}
|
|
@@ -29714,6 +30068,8 @@ function encodeAddress(spokeChainId, address) {
|
|
|
29714
30068
|
return toHex(Buffer.from(new PublicKey(address).toBytes()));
|
|
29715
30069
|
case "stellar":
|
|
29716
30070
|
return `0x${Address.fromString(address).toScVal().toXDR("hex")}`;
|
|
30071
|
+
case "stacks":
|
|
30072
|
+
return `0x${serializeCV(Cl.principal(address))}`;
|
|
29717
30073
|
case "bitcoin":
|
|
29718
30074
|
case "near":
|
|
29719
30075
|
case "injective-1":
|
|
@@ -29788,11 +30144,43 @@ function constructRawSpokeProvider(config) {
|
|
|
29788
30144
|
invariant6(isNearRawSpokeProviderConfig(config), "Invalid Near raw spoke provider config");
|
|
29789
30145
|
return new NearRawSpokeProvider(config.chainConfig, config.walletAddress);
|
|
29790
30146
|
}
|
|
30147
|
+
case "STACKS": {
|
|
30148
|
+
invariant6(isStacksRawSpokeProviderConfig(config), "Invalid Stacks raw spoke provider config");
|
|
30149
|
+
return new StacksRawSpokeProvider(config.walletAddress, config.chainConfig);
|
|
30150
|
+
}
|
|
29791
30151
|
default: {
|
|
29792
30152
|
throw new Error(`Unsupported chain type: ${chainType}`);
|
|
29793
30153
|
}
|
|
29794
30154
|
}
|
|
29795
30155
|
}
|
|
30156
|
+
async function waitForStacksTransaction(txid, rpc_url) {
|
|
30157
|
+
const url = `${rpc_url}/extended/v1/tx/${txid}`;
|
|
30158
|
+
for (let i = 1; i <= 5; i++) {
|
|
30159
|
+
const result = await (await fetch(url)).json();
|
|
30160
|
+
console.log("Waiting for transaction to be processed trying again", i);
|
|
30161
|
+
if (result.tx_status === "success") {
|
|
30162
|
+
return true;
|
|
30163
|
+
}
|
|
30164
|
+
if (result.tx_status === "abort_by_response") {
|
|
30165
|
+
console.log("Transaction aborted by response");
|
|
30166
|
+
return false;
|
|
30167
|
+
}
|
|
30168
|
+
if (result.tx_status === "abort_by_post_condition") {
|
|
30169
|
+
console.log("Transaction aborted by post condition");
|
|
30170
|
+
return false;
|
|
30171
|
+
}
|
|
30172
|
+
await sleep2(2 * i);
|
|
30173
|
+
}
|
|
30174
|
+
return false;
|
|
30175
|
+
}
|
|
30176
|
+
function serializeAddressData(address) {
|
|
30177
|
+
return `0x${serializeCV(Cl.principal(address))}`;
|
|
30178
|
+
}
|
|
30179
|
+
async function sleep2(s) {
|
|
30180
|
+
return new Promise((resolve) => {
|
|
30181
|
+
setTimeout(resolve, 1e3 * s);
|
|
30182
|
+
});
|
|
30183
|
+
}
|
|
29796
30184
|
|
|
29797
30185
|
// src/shared/types.ts
|
|
29798
30186
|
var SolverIntentStatusCode = /* @__PURE__ */ ((SolverIntentStatusCode2) => {
|
|
@@ -35672,6 +36060,6 @@ var DexService = class {
|
|
|
35672
36060
|
(*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
35673
36061
|
*/
|
|
35674
36062
|
|
|
35675
|
-
export { ARBITRUM_MAINNET_CHAIN_ID, AVALANCHE_MAINNET_CHAIN_ID, AssetService, BASE_MAINNET_CHAIN_ID, BITCOIN_MAINNET_CHAIN_ID, BSC_MAINNET_CHAIN_ID, BackendApiService, BalnSwapService, BigIntToHex, BigNumberZeroDecimal, BitcoinBaseSpokeProvider, BitcoinRawSpokeProvider, BitcoinSpokeProvider, BitcoinSpokeService, BnUSDMigrationService, BridgeService, CHAIN_IDS, CONFIG_VERSION, ChainIdToIntentRelayChainId, ChainTypeArr, ClService, ConfigService, CustomSorobanServer, CustomStellarAccount, DEFAULT_BACKEND_API_ENDPOINT, DEFAULT_BACKEND_API_HEADERS, DEFAULT_BACKEND_API_TIMEOUT, DEFAULT_DEADLINE_OFFSET, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, DexService, ETHEREUM_MAINNET_CHAIN_ID, EVM_CHAIN_IDS, Erc20Service, Erc4626Service, EvmAssetManagerService, EvmBaseSpokeProvider, EvmHubProvider, EvmRawSpokeProvider, EvmSolverService, EvmSpokeProvider, EvmSpokeService, EvmVaultTokenService, EvmWalletAbstraction, FEE_PERCENTAGE_SCALE, HALF_RAY, HALF_WAD, HUB_CHAIN_IDS, HYPEREVM_MAINNET_CHAIN_ID, HubService, HubVaultSymbols, ICON_MAINNET_CHAIN_ID, ICON_TX_RESULT_WAIT_MAX_RETRY, INJECTIVE_MAINNET_CHAIN_ID, IconBaseSpokeProvider, IconRawSpokeProvider, IconSpokeProvider, IconSpokeService, IcxMigrationService, Injective20Token, InjectiveBaseSpokeProvider, InjectiveExecuteResponse, InjectiveRawSpokeProvider, InjectiveSpokeProvider, InjectiveSpokeService, IntentCreatedEventAbi, IntentDataType, IntentFilledEventAbi, IntentsAbi, KAIA_MAINNET_CHAIN_ID, LIGHTLINK_MAINNET_CHAIN_ID, LTV_PRECISION, LendingPoolService, LockupMultiplier, LockupPeriod, MAX_UINT256, MigrationService, MintPositionEventAbi, MoneyMarketDataService, MoneyMarketService, NEAR_MAINNET_CHAIN_ID, NearBaseSpokeProvider, NearRawSpokeProvider, NearSpokeProvider, OPTIMISM_MAINNET_CHAIN_ID, POLYGON_MAINNET_CHAIN_ID, PartnerFeeClaimService, PartnerService, Permit2Service, ProtocolIntentsAbi, RAY, RAY_DECIMALS, REDBELLY_MAINNET_CHAIN_ID, RadfiProvider, SECONDS_PER_YEAR, SOLANA_MAINNET_CHAIN_ID, SONIC_MAINNET_CHAIN_ID, STELLAR_DEFAULT_TX_TIMEOUT_SECONDS, STELLAR_MAINNET_CHAIN_ID, STELLAR_PRIORITY_FEE, SUI_MAINNET_CHAIN_ID, SodaTokens, SodaTokensAsHubAssets, Sodax, SolanaBaseSpokeProvider, SolanaRawSpokeProvider, SolanaSpokeProvider, SolanaSpokeService, SolverApiService, SolverIntentErrorCode, SolverIntentStatusCode, SonicBaseSpokeProvider, SonicRawSpokeProvider, SonicSpokeProvider, SonicSpokeService, SpokeService, StakingLogic, StakingService, StatATokenAddresses, StellarBaseSpokeProvider, StellarRawSpokeProvider, StellarSpokeProvider, StellarSpokeService, SuiBaseSpokeProvider, SuiRawSpokeProvider, SuiSpokeProvider, SuiSpokeService, SupportedMigrationTokens, SwapService, USD_DECIMALS, UiPoolDataProviderService, VAULT_TOKEN_DECIMALS, WAD, WAD_RAY_RATIO, WEI_DECIMALS, WalletAbstractionService, adjustAmountByFee, assetManagerAbi, balnSwapAbi, baseChainInfo, binomialApproximatedRayPow, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bnUSDNewTokens, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, clPoolAbi, clPoolManagerAbi, clPositionManagerAbi, clQuoterAbi, clRouterAbi, clTickLensAbi, connectionAbi, constructRawSpokeProvider, convertTransactionInstructionToRaw, defaultHookAbi, defaultSharedConfig, defaultSodaxConfig, deriveUserWalletAddress, detectBitcoinAddressType, dexPools, encodeAddress, encodeContractCalls, erc20Abi, erc4626Abi, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getCompoundedBalance, getConcentratedLiquidityConfig, getEvmViemChain, getHubChainConfig, getIconAddressBytes, getIntentRelayChainId, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getMoneyMarketConfig, getPacket, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getSolverConfig, getSupportedSolverTokens, getTransactionPackets, hexToBigInt, hexToSolanaAddress, hubAssets, hubChainConfig, hyper, isAddressString, isBalnMigrateParams, isBitcoinRawSpokeProvider, isBitcoinSpokeProvider, isBitcoinSpokeProviderType, isConfiguredMoneyMarketConfig, isConfiguredSolverConfig, isCreateIntentAutoSwapError, isEvmHubChainConfig, isEvmInitializedConfig, isEvmRawSpokeProvider, isEvmRawSpokeProviderConfig, isEvmSpokeChainConfig, isEvmSpokeProvider, isEvmSpokeProviderType, isEvmUninitializedBrowserConfig, isEvmUninitializedConfig, isEvmUninitializedPrivateKeyConfig, isHubSpokeProvider, isIconAddress, isIconRawSpokeProvider, isIconSpokeProvider, isIconSpokeProviderType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveRawSpokeProvider, isInjectiveSpokeProvider, isInjectiveSpokeProviderType, isIntentCreationFailedError, isIntentCreationUnknownError, isIntentPostExecutionFailedError, isIntentRelayChainId, isIntentSubmitTxFailedError, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isMoneyMarketBorrowUnknownError, isMoneyMarketCreateBorrowIntentFailedError, isMoneyMarketCreateRepayIntentFailedError, isMoneyMarketCreateSupplyIntentFailedError, isMoneyMarketCreateWithdrawIntentFailedError, isMoneyMarketRelayTimeoutError, isMoneyMarketRepayUnknownError, isMoneyMarketSubmitTxFailedError, isMoneyMarketSupplyUnknownError, isMoneyMarketWithdrawUnknownError, isNearRawSpokeProvider, isNearRawSpokeProviderConfig, isNearSpokeProvider, isNearSpokeProviderType, isNewbnUSDChainId, isNewbnUSDToken, isPartnerFeeAmount, isPartnerFeePercentage, isRawDestinationParams, isRawSpokeProvider, isResponseAddressType, isResponseSigningType, isSetSwapPreferenceError, isSolanaNativeToken, isSolanaRawSpokeProvider, isSolanaRawSpokeProviderConfig, isSolanaSpokeProvider, isSolanaSpokeProviderType, isSolverErrorResponse, isSonicRawSpokeProvider, isSonicRawSpokeProviderConfig, isSonicSpokeProvider, isSonicSpokeProviderType, isSpokeProvider, isSpokeProviderObjectType, isSpokeProviderType, isStellarRawSpokeProvider, isStellarRawSpokeProviderConfig, isStellarSpokeProvider, isStellarSpokeProviderType, isSubmitSwapTxResponse, isSubmitSwapTxStatusResponse, isSuiRawSpokeProvider, isSuiSpokeProvider, isSuiSpokeProviderType, isSupportedBitcoinAddressType, isSwapSupportedToken, isUnifiedBnUSDMigrateParams, isUnknownIntentAutoSwapError, isWaitIntentAutoSwapError, isWaitUntilIntentExecutedFailed, mintPositionParamsAbi, modifyLiquidityParamsAbi, moneyMarketReserveAssets, moneyMarketSupportedTokens, nativeToUSD, newbnUSDSpokeChainIds, normalize, normalizeBN, normalizePsbtToBase64, normalizedToUsd, pancakeSwapInfinityDefaultHookAbi, pancakeSwapInfinityPoolManagerAbi, pancakeSwapInfinityPositionManagerAbi, parseToStroops, parseTokenArrayFromJson, permit2Abi, poolAbi, poolKeyAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, sleep, solverConfig, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, stakedSodaAbi, stakingRouterAbi, stataTokenFactoryAbi, submitTransaction, supportedSpokeChains, swapExactInSingleParamsAbi, swapSupportedTokens, uiPoolDataAbi, universalRouterAbi, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, wadToRay, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|
|
36063
|
+
export { ARBITRUM_MAINNET_CHAIN_ID, AVALANCHE_MAINNET_CHAIN_ID, AssetService, BASE_MAINNET_CHAIN_ID, BITCOIN_MAINNET_CHAIN_ID, BSC_MAINNET_CHAIN_ID, BackendApiService, BalnSwapService, BigIntToHex, BigNumberZeroDecimal, BitcoinBaseSpokeProvider, BitcoinRawSpokeProvider, BitcoinSpokeProvider, BitcoinSpokeService, BnUSDMigrationService, BridgeService, CHAIN_IDS, CONFIG_VERSION, ChainIdToIntentRelayChainId, ChainTypeArr, ClService, ConfigService, CustomSorobanServer, CustomStellarAccount, DEFAULT_BACKEND_API_ENDPOINT, DEFAULT_BACKEND_API_HEADERS, DEFAULT_BACKEND_API_TIMEOUT, DEFAULT_DEADLINE_OFFSET, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, DexService, ETHEREUM_MAINNET_CHAIN_ID, EVM_CHAIN_IDS, Erc20Service, Erc4626Service, EvmAssetManagerService, EvmBaseSpokeProvider, EvmHubProvider, EvmRawSpokeProvider, EvmSolverService, EvmSpokeProvider, EvmSpokeService, EvmVaultTokenService, EvmWalletAbstraction, FEE_PERCENTAGE_SCALE, HALF_RAY, HALF_WAD, HUB_CHAIN_IDS, HYPEREVM_MAINNET_CHAIN_ID, HubService, HubVaultSymbols, ICON_MAINNET_CHAIN_ID, ICON_TX_RESULT_WAIT_MAX_RETRY, INJECTIVE_MAINNET_CHAIN_ID, IconBaseSpokeProvider, IconRawSpokeProvider, IconSpokeProvider, IconSpokeService, IcxMigrationService, Injective20Token, InjectiveBaseSpokeProvider, InjectiveExecuteResponse, InjectiveRawSpokeProvider, InjectiveSpokeProvider, InjectiveSpokeService, IntentCreatedEventAbi, IntentDataType, IntentFilledEventAbi, IntentsAbi, KAIA_MAINNET_CHAIN_ID, LIGHTLINK_MAINNET_CHAIN_ID, LTV_PRECISION, LendingPoolService, LockupMultiplier, LockupPeriod, MAX_UINT256, MigrationService, MintPositionEventAbi, MoneyMarketDataService, MoneyMarketService, NEAR_MAINNET_CHAIN_ID, NearBaseSpokeProvider, NearRawSpokeProvider, NearSpokeProvider, OPTIMISM_MAINNET_CHAIN_ID, POLYGON_MAINNET_CHAIN_ID, PartnerFeeClaimService, PartnerService, Permit2Service, ProtocolIntentsAbi, RAY, RAY_DECIMALS, REDBELLY_MAINNET_CHAIN_ID, RadfiProvider, SECONDS_PER_YEAR, SOLANA_MAINNET_CHAIN_ID, SONIC_MAINNET_CHAIN_ID, STACKS_MAINNET_CHAIN_ID, STELLAR_DEFAULT_TX_TIMEOUT_SECONDS, STELLAR_MAINNET_CHAIN_ID, STELLAR_PRIORITY_FEE, SUI_MAINNET_CHAIN_ID, SodaTokens, SodaTokensAsHubAssets, Sodax, SolanaBaseSpokeProvider, SolanaRawSpokeProvider, SolanaSpokeProvider, SolanaSpokeService, SolverApiService, SolverIntentErrorCode, SolverIntentStatusCode, SonicBaseSpokeProvider, SonicRawSpokeProvider, SonicSpokeProvider, SonicSpokeService, SpokeService, StacksRawSpokeProvider, StacksSpokeProvider, StacksSpokeService, StakingLogic, StakingService, StatATokenAddresses, StellarBaseSpokeProvider, StellarRawSpokeProvider, StellarSpokeProvider, StellarSpokeService, SuiBaseSpokeProvider, SuiRawSpokeProvider, SuiSpokeProvider, SuiSpokeService, SupportedMigrationTokens, SwapService, USD_DECIMALS, UiPoolDataProviderService, VAULT_TOKEN_DECIMALS, WAD, WAD_RAY_RATIO, WEI_DECIMALS, WalletAbstractionService, adjustAmountByFee, assetManagerAbi, balnSwapAbi, baseChainInfo, binomialApproximatedRayPow, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bnUSDNewTokens, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, clPoolAbi, clPoolManagerAbi, clPositionManagerAbi, clQuoterAbi, clRouterAbi, clTickLensAbi, connectionAbi, constructRawSpokeProvider, convertTransactionInstructionToRaw, defaultHookAbi, defaultSharedConfig, defaultSodaxConfig, deriveUserWalletAddress, detectBitcoinAddressType, dexPools, encodeAddress, encodeContractCalls, erc20Abi, erc4626Abi, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getCompoundedBalance, getConcentratedLiquidityConfig, getEvmViemChain, getHubChainConfig, getIconAddressBytes, getIntentRelayChainId, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getMoneyMarketConfig, getPacket, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getSolverConfig, getSupportedSolverTokens, getTransactionPackets, hexToBigInt, hexToSolanaAddress, hubAssets, hubChainConfig, hyper, isAddressString, isBalnMigrateParams, isBitcoinRawSpokeProvider, isBitcoinSpokeProvider, isBitcoinSpokeProviderType, isConfiguredMoneyMarketConfig, isConfiguredSolverConfig, isCreateIntentAutoSwapError, isEvmHubChainConfig, isEvmInitializedConfig, isEvmRawSpokeProvider, isEvmRawSpokeProviderConfig, isEvmSpokeChainConfig, isEvmSpokeProvider, isEvmSpokeProviderType, isEvmUninitializedBrowserConfig, isEvmUninitializedConfig, isEvmUninitializedPrivateKeyConfig, isHubSpokeProvider, isIconAddress, isIconRawSpokeProvider, isIconSpokeProvider, isIconSpokeProviderType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveRawSpokeProvider, isInjectiveSpokeProvider, isInjectiveSpokeProviderType, isIntentCreationFailedError, isIntentCreationUnknownError, isIntentPostExecutionFailedError, isIntentRelayChainId, isIntentSubmitTxFailedError, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isMoneyMarketBorrowUnknownError, isMoneyMarketCreateBorrowIntentFailedError, isMoneyMarketCreateRepayIntentFailedError, isMoneyMarketCreateSupplyIntentFailedError, isMoneyMarketCreateWithdrawIntentFailedError, isMoneyMarketRelayTimeoutError, isMoneyMarketRepayUnknownError, isMoneyMarketSubmitTxFailedError, isMoneyMarketSupplyUnknownError, isMoneyMarketWithdrawUnknownError, isNearRawSpokeProvider, isNearRawSpokeProviderConfig, isNearSpokeProvider, isNearSpokeProviderType, isNewbnUSDChainId, isNewbnUSDToken, isPartnerFeeAmount, isPartnerFeePercentage, isRawDestinationParams, isRawSpokeProvider, isResponseAddressType, isResponseSigningType, isSetSwapPreferenceError, isSolanaNativeToken, isSolanaRawSpokeProvider, isSolanaRawSpokeProviderConfig, isSolanaSpokeProvider, isSolanaSpokeProviderType, isSolverErrorResponse, isSonicRawSpokeProvider, isSonicRawSpokeProviderConfig, isSonicSpokeProvider, isSonicSpokeProviderType, isSpokeProvider, isSpokeProviderObjectType, isSpokeProviderType, isStacksRawSpokeProvider, isStacksRawSpokeProviderConfig, isStacksSpokeProvider, isStacksSpokeProviderType, isStellarRawSpokeProvider, isStellarRawSpokeProviderConfig, isStellarSpokeProvider, isStellarSpokeProviderType, isSubmitSwapTxResponse, isSubmitSwapTxStatusResponse, isSuiRawSpokeProvider, isSuiSpokeProvider, isSuiSpokeProviderType, isSupportedBitcoinAddressType, isSwapSupportedToken, isUnifiedBnUSDMigrateParams, isUnknownIntentAutoSwapError, isWaitIntentAutoSwapError, isWaitUntilIntentExecutedFailed, mintPositionParamsAbi, modifyLiquidityParamsAbi, moneyMarketReserveAssets, moneyMarketSupportedTokens, nativeToUSD, newbnUSDSpokeChainIds, normalize, normalizeBN, normalizePsbtToBase64, normalizedToUsd, pancakeSwapInfinityDefaultHookAbi, pancakeSwapInfinityPoolManagerAbi, pancakeSwapInfinityPositionManagerAbi, parseToStroops, parseTokenArrayFromJson, permit2Abi, poolAbi, poolKeyAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, serializeAddressData, sleep, solverConfig, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, stakedSodaAbi, stakingRouterAbi, stataTokenFactoryAbi, submitTransaction, supportedSpokeChains, swapExactInSingleParamsAbi, swapSupportedTokens, uiPoolDataAbi, universalRouterAbi, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, wadToRay, waitForStacksTransaction, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|
|
35676
36064
|
//# sourceMappingURL=index.mjs.map
|
|
35677
36065
|
//# sourceMappingURL=index.mjs.map
|