@sodax/sdk 1.3.1-beta → 1.4.0-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 +428 -31
- 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 +413 -26
- 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 = 30;
|
|
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",
|
|
@@ -11536,6 +11637,13 @@ var swapSupportedTokens = {
|
|
|
11536
11637
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.USDT,
|
|
11537
11638
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
11538
11639
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.SODA
|
|
11640
|
+
],
|
|
11641
|
+
[STACKS_MAINNET_CHAIN_ID]: [
|
|
11642
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.STX,
|
|
11643
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
11644
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.SODA,
|
|
11645
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.sBTC,
|
|
11646
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.USDC
|
|
11539
11647
|
]
|
|
11540
11648
|
};
|
|
11541
11649
|
var getSupportedSolverTokens = (chainId) => swapSupportedTokens[chainId];
|
|
@@ -11708,6 +11816,13 @@ var moneyMarketSupportedTokens = {
|
|
|
11708
11816
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.USDT,
|
|
11709
11817
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.SODA
|
|
11710
11818
|
],
|
|
11819
|
+
[STACKS_MAINNET_CHAIN_ID]: [
|
|
11820
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.STX,
|
|
11821
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
11822
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.SODA,
|
|
11823
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.sBTC,
|
|
11824
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.USDC
|
|
11825
|
+
],
|
|
11711
11826
|
[BITCOIN_MAINNET_CHAIN_ID]: [
|
|
11712
11827
|
spokeChainConfig[BITCOIN_MAINNET_CHAIN_ID].supportedTokens.BTC
|
|
11713
11828
|
]
|
|
@@ -11734,7 +11849,7 @@ var defaultSharedConfig = {
|
|
|
11734
11849
|
};
|
|
11735
11850
|
|
|
11736
11851
|
// ../types/dist/common/index.js
|
|
11737
|
-
var ChainTypeArr = ["ICON", "EVM", "INJECTIVE", "SUI", "STELLAR", "SOLANA", "NEAR", "BITCOIN"];
|
|
11852
|
+
var ChainTypeArr = ["ICON", "EVM", "INJECTIVE", "SUI", "STELLAR", "SOLANA", "STACKS", "NEAR", "BITCOIN"];
|
|
11738
11853
|
|
|
11739
11854
|
// ../types/dist/injective/index.js
|
|
11740
11855
|
var InjectiveExecuteResponse = class _InjectiveExecuteResponse {
|
|
@@ -13129,7 +13244,7 @@ var EvmWalletAbstraction = class {
|
|
|
13129
13244
|
/**
|
|
13130
13245
|
* Get the hub wallet address for a given spoke chain and address.
|
|
13131
13246
|
* @param chainId - The spoke chain ID.
|
|
13132
|
-
* @param address - The address on the spoke chain.
|
|
13247
|
+
* @param address - The encoded address on the spoke chain.
|
|
13133
13248
|
* @param hubProvider - The hub provider.
|
|
13134
13249
|
* @returns The hub wallet address.
|
|
13135
13250
|
*/
|
|
@@ -14033,11 +14148,11 @@ function add(Ah, Al, Bh, Bl) {
|
|
|
14033
14148
|
const l = (Al >>> 0) + (Bl >>> 0);
|
|
14034
14149
|
return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
|
|
14035
14150
|
}
|
|
14036
|
-
var add3L = (Al, Bl,
|
|
14151
|
+
var add3L = (Al, Bl, Cl5) => (Al >>> 0) + (Bl >>> 0) + (Cl5 >>> 0);
|
|
14037
14152
|
var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
|
|
14038
|
-
var add4L = (Al, Bl,
|
|
14153
|
+
var add4L = (Al, Bl, Cl5, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl5 >>> 0) + (Dl >>> 0);
|
|
14039
14154
|
var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
|
|
14040
|
-
var add5L = (Al, Bl,
|
|
14155
|
+
var add5L = (Al, Bl, Cl5, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl5 >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
14041
14156
|
var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
|
|
14042
14157
|
|
|
14043
14158
|
// ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/sha2.js
|
|
@@ -14277,17 +14392,17 @@ var SHA2_64B = class extends HashMD {
|
|
|
14277
14392
|
}
|
|
14278
14393
|
// prettier-ignore
|
|
14279
14394
|
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,
|
|
14395
|
+
const { Ah, Al, Bh, Bl, Ch, Cl: Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
14396
|
+
return [Ah, Al, Bh, Bl, Ch, Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];
|
|
14282
14397
|
}
|
|
14283
14398
|
// prettier-ignore
|
|
14284
|
-
set(Ah, Al, Bh, Bl, Ch,
|
|
14399
|
+
set(Ah, Al, Bh, Bl, Ch, Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
|
|
14285
14400
|
this.Ah = Ah | 0;
|
|
14286
14401
|
this.Al = Al | 0;
|
|
14287
14402
|
this.Bh = Bh | 0;
|
|
14288
14403
|
this.Bl = Bl | 0;
|
|
14289
14404
|
this.Ch = Ch | 0;
|
|
14290
|
-
this.Cl =
|
|
14405
|
+
this.Cl = Cl5 | 0;
|
|
14291
14406
|
this.Dh = Dh | 0;
|
|
14292
14407
|
this.Dl = Dl | 0;
|
|
14293
14408
|
this.Eh = Eh | 0;
|
|
@@ -14318,7 +14433,7 @@ var SHA2_64B = class extends HashMD {
|
|
|
14318
14433
|
SHA512_W_H[i] = SUMh | 0;
|
|
14319
14434
|
SHA512_W_L[i] = SUMl | 0;
|
|
14320
14435
|
}
|
|
14321
|
-
let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
14436
|
+
let { Ah, Al, Bh, Bl, Ch, Cl: Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
14322
14437
|
for (let i = 0; i < 80; i++) {
|
|
14323
14438
|
const sigma1h = rotrSH(Eh, El, 14) ^ rotrSH(Eh, El, 18) ^ rotrBH(Eh, El, 41);
|
|
14324
14439
|
const sigma1l = rotrSL(Eh, El, 14) ^ rotrSL(Eh, El, 18) ^ rotrBL(Eh, El, 41);
|
|
@@ -14330,7 +14445,7 @@ var SHA2_64B = class extends HashMD {
|
|
|
14330
14445
|
const sigma0h = rotrSH(Ah, Al, 28) ^ rotrBH(Ah, Al, 34) ^ rotrBH(Ah, Al, 39);
|
|
14331
14446
|
const sigma0l = rotrSL(Ah, Al, 28) ^ rotrBL(Ah, Al, 34) ^ rotrBL(Ah, Al, 39);
|
|
14332
14447
|
const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
|
|
14333
|
-
const MAJl = Al & Bl ^ Al &
|
|
14448
|
+
const MAJl = Al & Bl ^ Al & Cl5 ^ Bl & Cl5;
|
|
14334
14449
|
Hh = Gh | 0;
|
|
14335
14450
|
Hl = Gl | 0;
|
|
14336
14451
|
Gh = Fh | 0;
|
|
@@ -14339,9 +14454,9 @@ var SHA2_64B = class extends HashMD {
|
|
|
14339
14454
|
Fl = El | 0;
|
|
14340
14455
|
({ h: Eh, l: El } = add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
|
|
14341
14456
|
Dh = Ch | 0;
|
|
14342
|
-
Dl =
|
|
14457
|
+
Dl = Cl5 | 0;
|
|
14343
14458
|
Ch = Bh | 0;
|
|
14344
|
-
|
|
14459
|
+
Cl5 = Bl | 0;
|
|
14345
14460
|
Bh = Ah | 0;
|
|
14346
14461
|
Bl = Al | 0;
|
|
14347
14462
|
const All = add3L(T1l, sigma0l, MAJl);
|
|
@@ -14350,13 +14465,13 @@ var SHA2_64B = class extends HashMD {
|
|
|
14350
14465
|
}
|
|
14351
14466
|
({ h: Ah, l: Al } = add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
|
|
14352
14467
|
({ h: Bh, l: Bl } = add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
|
|
14353
|
-
({ h: Ch, l:
|
|
14468
|
+
({ h: Ch, l: Cl5 } = add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl5 | 0));
|
|
14354
14469
|
({ h: Dh, l: Dl } = add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
|
|
14355
14470
|
({ h: Eh, l: El } = add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
|
|
14356
14471
|
({ h: Fh, l: Fl } = add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
|
|
14357
14472
|
({ h: Gh, l: Gl } = add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
|
|
14358
14473
|
({ h: Hh, l: Hl } = add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
|
|
14359
|
-
this.set(Ah, Al, Bh, Bl, Ch,
|
|
14474
|
+
this.set(Ah, Al, Bh, Bl, Ch, Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
|
|
14360
14475
|
}
|
|
14361
14476
|
roundClean() {
|
|
14362
14477
|
clean(SHA512_W_H, SHA512_W_L);
|
|
@@ -23334,6 +23449,203 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
23334
23449
|
}
|
|
23335
23450
|
}
|
|
23336
23451
|
};
|
|
23452
|
+
var StacksBaseSpokeProvider = class {
|
|
23453
|
+
chainConfig;
|
|
23454
|
+
network;
|
|
23455
|
+
constructor(config) {
|
|
23456
|
+
this.chainConfig = config;
|
|
23457
|
+
this.network = createNetwork({ network: "mainnet", client: { baseUrl: config.rpcUrl } });
|
|
23458
|
+
}
|
|
23459
|
+
async getSTXBalance(address) {
|
|
23460
|
+
const url = `${this.network.client.baseUrl}/extended/v1/address/${address}/balances`;
|
|
23461
|
+
const response = await fetch(url);
|
|
23462
|
+
if (!response.ok) {
|
|
23463
|
+
throw new Error(`Error fetching STX balance: ${response.statusText}`);
|
|
23464
|
+
}
|
|
23465
|
+
const data = await response.json();
|
|
23466
|
+
return BigInt(data.stx.balance);
|
|
23467
|
+
}
|
|
23468
|
+
async readTokenBalance(token, address) {
|
|
23469
|
+
const [contractAddress, contractName] = parseContractId(token);
|
|
23470
|
+
const result = await fetchCallReadOnlyFunction({
|
|
23471
|
+
contractAddress,
|
|
23472
|
+
contractName,
|
|
23473
|
+
functionName: "get-balance",
|
|
23474
|
+
functionArgs: [Cl.principal(address)],
|
|
23475
|
+
network: this.network,
|
|
23476
|
+
senderAddress: address
|
|
23477
|
+
});
|
|
23478
|
+
return result.value.value;
|
|
23479
|
+
}
|
|
23480
|
+
async getImplContractAddress(stateContract) {
|
|
23481
|
+
const [contractAddress, contractName] = parseContractId(stateContract);
|
|
23482
|
+
const txParams = {
|
|
23483
|
+
contractAddress,
|
|
23484
|
+
contractName,
|
|
23485
|
+
functionName: "get-asset-manager-impl",
|
|
23486
|
+
functionArgs: []
|
|
23487
|
+
};
|
|
23488
|
+
const implAddress = (await this.walletReadContract(txParams)).value;
|
|
23489
|
+
return implAddress;
|
|
23490
|
+
}
|
|
23491
|
+
};
|
|
23492
|
+
var StacksSpokeProvider = class extends StacksBaseSpokeProvider {
|
|
23493
|
+
walletProvider;
|
|
23494
|
+
constructor(config, walletProvider) {
|
|
23495
|
+
super(config);
|
|
23496
|
+
this.walletProvider = walletProvider;
|
|
23497
|
+
}
|
|
23498
|
+
async walletReadContract(txParams) {
|
|
23499
|
+
return this.walletProvider.readContract(txParams);
|
|
23500
|
+
}
|
|
23501
|
+
};
|
|
23502
|
+
var StacksRawSpokeProvider = class extends StacksBaseSpokeProvider {
|
|
23503
|
+
walletProvider;
|
|
23504
|
+
raw = true;
|
|
23505
|
+
constructor(walletAddress, config) {
|
|
23506
|
+
super(config);
|
|
23507
|
+
this.walletProvider = {
|
|
23508
|
+
getWalletAddress: async () => walletAddress
|
|
23509
|
+
};
|
|
23510
|
+
}
|
|
23511
|
+
async walletReadContract(txParams) {
|
|
23512
|
+
return fetchCallReadOnlyFunction({
|
|
23513
|
+
contractAddress: txParams.contractAddress,
|
|
23514
|
+
contractName: txParams.contractName,
|
|
23515
|
+
functionName: txParams.functionName,
|
|
23516
|
+
functionArgs: txParams.functionArgs,
|
|
23517
|
+
network: this.network,
|
|
23518
|
+
senderAddress: await this.walletProvider.getWalletAddress()
|
|
23519
|
+
});
|
|
23520
|
+
}
|
|
23521
|
+
};
|
|
23522
|
+
var StacksSpokeService = class _StacksSpokeService {
|
|
23523
|
+
constructor() {
|
|
23524
|
+
}
|
|
23525
|
+
/**
|
|
23526
|
+
* Deposit tokens to the spoke chain.
|
|
23527
|
+
* @param {StacksSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
|
|
23528
|
+
* @param {StacksSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
23529
|
+
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
23530
|
+
* @returns {Promise<Hash>} A promise that resolves to the transaction hash.
|
|
23531
|
+
*/
|
|
23532
|
+
static async deposit(params, spokeProvider, hubProvider, raw) {
|
|
23533
|
+
const userWallet = await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
23534
|
+
spokeProvider.chainConfig.chain.id,
|
|
23535
|
+
encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
23536
|
+
hubProvider
|
|
23537
|
+
);
|
|
23538
|
+
return _StacksSpokeService.transfer(
|
|
23539
|
+
{
|
|
23540
|
+
from: params.from,
|
|
23541
|
+
token: params.token,
|
|
23542
|
+
recipient: params.to ? params.to : userWallet,
|
|
23543
|
+
amount: params.amount,
|
|
23544
|
+
data: params.data
|
|
23545
|
+
},
|
|
23546
|
+
spokeProvider,
|
|
23547
|
+
raw
|
|
23548
|
+
);
|
|
23549
|
+
}
|
|
23550
|
+
/**
|
|
23551
|
+
* Get the balance of the token in the spoke chain.
|
|
23552
|
+
* @param {Address} token - The address of the token to get the balance of.
|
|
23553
|
+
* @param {StacksSpokeProviderType} spokeProvider - The spoke provider.
|
|
23554
|
+
* @returns {Promise<bigint>} The balance of the token.
|
|
23555
|
+
*/
|
|
23556
|
+
static async getDeposit(token, spokeProvider) {
|
|
23557
|
+
const assetManager = spokeProvider.chainConfig.addresses.assetManager;
|
|
23558
|
+
if (token.toLowerCase() === spokeProvider.chainConfig.nativeToken.toLowerCase()) {
|
|
23559
|
+
return spokeProvider.getSTXBalance(assetManager);
|
|
23560
|
+
}
|
|
23561
|
+
return spokeProvider.readTokenBalance(token, assetManager);
|
|
23562
|
+
}
|
|
23563
|
+
/**
|
|
23564
|
+
* Get the simulation parameters for a deposit.
|
|
23565
|
+
* @param {StacksSpokeDepositParams} params - The deposit parameters.
|
|
23566
|
+
* @param {StacksSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
23567
|
+
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
23568
|
+
* @returns {Promise<DepositSimulationParams>} The simulation parameters.
|
|
23569
|
+
*/
|
|
23570
|
+
static async getSimulateDepositParams(params, spokeProvider, hubProvider) {
|
|
23571
|
+
const to = params.to ?? await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
23572
|
+
spokeProvider.chainConfig.chain.id,
|
|
23573
|
+
encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
23574
|
+
hubProvider
|
|
23575
|
+
);
|
|
23576
|
+
return {
|
|
23577
|
+
spokeChainID: spokeProvider.chainConfig.chain.id,
|
|
23578
|
+
token: encodeAddress(spokeProvider.chainConfig.chain.id, params.token),
|
|
23579
|
+
from: encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
23580
|
+
to,
|
|
23581
|
+
amount: params.amount,
|
|
23582
|
+
data: params.data,
|
|
23583
|
+
srcAddress: encodeAddress(spokeProvider.chainConfig.chain.id, spokeProvider.chainConfig.addresses.assetManager)
|
|
23584
|
+
};
|
|
23585
|
+
}
|
|
23586
|
+
/**
|
|
23587
|
+
* Calls a contract on the spoke chain using the user's wallet.
|
|
23588
|
+
* @param {Hex} from - The address of the user on the spoke chain.
|
|
23589
|
+
* @param {Hex} payload - The payload to send to the contract.
|
|
23590
|
+
* @param {StacksSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
23591
|
+
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
23592
|
+
* @returns {Promise<Hash>} A promise that resolves to the transaction hash.
|
|
23593
|
+
*/
|
|
23594
|
+
static async callWallet(from, payload, spokeProvider, hubProvider, raw) {
|
|
23595
|
+
const relayId = getIntentRelayChainId(hubProvider.chainConfig.chain.id);
|
|
23596
|
+
return _StacksSpokeService.call(BigInt(relayId), from, payload, spokeProvider, raw);
|
|
23597
|
+
}
|
|
23598
|
+
/**
|
|
23599
|
+
* Transfers tokens to the hub chain.
|
|
23600
|
+
*/
|
|
23601
|
+
static async transfer({ from, token, recipient, amount, data = "0x" }, spokeProvider, raw) {
|
|
23602
|
+
const assetManagerImpl = await spokeProvider.getImplContractAddress(
|
|
23603
|
+
spokeProvider.chainConfig.addresses.assetManager
|
|
23604
|
+
);
|
|
23605
|
+
const [implAddress, implName] = parseContractId(assetManagerImpl);
|
|
23606
|
+
const [connectionAddress, connectionName] = parseContractId(
|
|
23607
|
+
spokeProvider.chainConfig.addresses.connection
|
|
23608
|
+
);
|
|
23609
|
+
const reqData = {
|
|
23610
|
+
contractAddress: implAddress,
|
|
23611
|
+
contractName: implName,
|
|
23612
|
+
functionName: "transfer",
|
|
23613
|
+
functionArgs: [
|
|
23614
|
+
token.toLowerCase() === spokeProvider.chainConfig.nativeToken.toLowerCase() ? noneCV() : someCV(Cl.principal(token)),
|
|
23615
|
+
Cl.bufferFromHex(recipient),
|
|
23616
|
+
uintCV(amount),
|
|
23617
|
+
Cl.bufferFromHex(data),
|
|
23618
|
+
Cl.contractPrincipal(connectionAddress, connectionName)
|
|
23619
|
+
],
|
|
23620
|
+
postConditionMode: PostConditionMode.Allow
|
|
23621
|
+
};
|
|
23622
|
+
if (raw || spokeProvider instanceof StacksRawSpokeProvider) {
|
|
23623
|
+
return reqData;
|
|
23624
|
+
}
|
|
23625
|
+
const txId = await spokeProvider.walletProvider.sendTransaction(reqData);
|
|
23626
|
+
return txId;
|
|
23627
|
+
}
|
|
23628
|
+
/**
|
|
23629
|
+
* Sends a message to the hub chain.
|
|
23630
|
+
*/
|
|
23631
|
+
static async call(dstChainId, dstAddress, payload, spokeProvider, raw) {
|
|
23632
|
+
const [connectionAddress, connectionName] = parseContractId(
|
|
23633
|
+
spokeProvider.chainConfig.addresses.connection
|
|
23634
|
+
);
|
|
23635
|
+
const reqData = {
|
|
23636
|
+
contractAddress: connectionAddress,
|
|
23637
|
+
contractName: connectionName,
|
|
23638
|
+
functionName: "send-message",
|
|
23639
|
+
functionArgs: [uintCV(dstChainId), Cl.bufferFromHex(dstAddress), Cl.bufferFromHex(payload)],
|
|
23640
|
+
postConditionMode: PostConditionMode.Allow
|
|
23641
|
+
};
|
|
23642
|
+
if (raw || spokeProvider instanceof StacksRawSpokeProvider) {
|
|
23643
|
+
return reqData;
|
|
23644
|
+
}
|
|
23645
|
+
const txId = await spokeProvider.walletProvider.sendTransaction(reqData);
|
|
23646
|
+
return txId;
|
|
23647
|
+
}
|
|
23648
|
+
};
|
|
23337
23649
|
|
|
23338
23650
|
// src/shared/entities/btc/RadfiProvider.ts
|
|
23339
23651
|
var RadfiProvider = class {
|
|
@@ -24535,6 +24847,15 @@ var SpokeService = class _SpokeService {
|
|
|
24535
24847
|
raw
|
|
24536
24848
|
);
|
|
24537
24849
|
}
|
|
24850
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
24851
|
+
await _SpokeService.verifyDepositSimulation(params, spokeProvider, hubProvider, skipSimulation);
|
|
24852
|
+
return StacksSpokeService.deposit(
|
|
24853
|
+
params,
|
|
24854
|
+
spokeProvider,
|
|
24855
|
+
hubProvider,
|
|
24856
|
+
raw
|
|
24857
|
+
);
|
|
24858
|
+
}
|
|
24538
24859
|
if (isBitcoinSpokeProviderType(spokeProvider)) {
|
|
24539
24860
|
await _SpokeService.verifyDepositSimulation(params, spokeProvider, hubProvider, skipSimulation);
|
|
24540
24861
|
return BitcoinSpokeService.deposit(
|
|
@@ -24611,6 +24932,13 @@ var SpokeService = class _SpokeService {
|
|
|
24611
24932
|
hubProvider
|
|
24612
24933
|
);
|
|
24613
24934
|
}
|
|
24935
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
24936
|
+
return StacksSpokeService.getSimulateDepositParams(
|
|
24937
|
+
params,
|
|
24938
|
+
spokeProvider,
|
|
24939
|
+
hubProvider
|
|
24940
|
+
);
|
|
24941
|
+
}
|
|
24614
24942
|
throw new Error("[getSimulateDepositParams] Invalid spoke provider");
|
|
24615
24943
|
}
|
|
24616
24944
|
static async verifyDepositSimulation(params, spokeProvider, hubProvider, skipSimulation) {
|
|
@@ -24650,6 +24978,9 @@ var SpokeService = class _SpokeService {
|
|
|
24650
24978
|
if (isSonicSpokeProviderType(spokeProvider)) {
|
|
24651
24979
|
return SonicSpokeService.getDeposit(token, spokeProvider);
|
|
24652
24980
|
}
|
|
24981
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
24982
|
+
return StacksSpokeService.getDeposit(token, spokeProvider);
|
|
24983
|
+
}
|
|
24653
24984
|
if (isBitcoinSpokeProviderType(spokeProvider)) {
|
|
24654
24985
|
return BitcoinSpokeService.getDeposit(token, spokeProvider);
|
|
24655
24986
|
}
|
|
@@ -24728,6 +25059,16 @@ var SpokeService = class _SpokeService {
|
|
|
24728
25059
|
raw
|
|
24729
25060
|
);
|
|
24730
25061
|
}
|
|
25062
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
25063
|
+
await _SpokeService.verifySimulation(from, payload, spokeProvider, hubProvider, skipSimulation);
|
|
25064
|
+
return await StacksSpokeService.callWallet(
|
|
25065
|
+
from,
|
|
25066
|
+
payload,
|
|
25067
|
+
spokeProvider,
|
|
25068
|
+
hubProvider,
|
|
25069
|
+
raw
|
|
25070
|
+
);
|
|
25071
|
+
}
|
|
24731
25072
|
if (isBitcoinSpokeProviderType(spokeProvider)) {
|
|
24732
25073
|
await _SpokeService.verifySimulation(from, payload, spokeProvider, hubProvider, skipSimulation);
|
|
24733
25074
|
return await BitcoinSpokeService.callWallet(
|
|
@@ -28677,6 +29018,15 @@ function isSuiSpokeProviderType(value) {
|
|
|
28677
29018
|
function isSuiSpokeProvider(value) {
|
|
28678
29019
|
return typeof value === "object" && value !== null && value instanceof SuiSpokeProvider && !("raw" in value) && value.chainConfig.chain.type === "SUI";
|
|
28679
29020
|
}
|
|
29021
|
+
function isStacksSpokeProviderType(value) {
|
|
29022
|
+
return typeof value === "object" && value !== null && (isStacksSpokeProvider(value) || isStacksRawSpokeProvider(value));
|
|
29023
|
+
}
|
|
29024
|
+
function isStacksSpokeProvider(value) {
|
|
29025
|
+
return typeof value === "object" && value !== null && value instanceof StacksSpokeProvider && !("raw" in value) && value.chainConfig.chain.type === "STACKS";
|
|
29026
|
+
}
|
|
29027
|
+
function isStacksRawSpokeProvider(value) {
|
|
29028
|
+
return isRawSpokeProvider(value) && value.chainConfig.chain.type === "STACKS";
|
|
29029
|
+
}
|
|
28680
29030
|
function isConfiguredSolverConfig(value) {
|
|
28681
29031
|
return typeof value === "object" && value !== null && "intentsContract" in value && "solverApiEndpoint" in value;
|
|
28682
29032
|
}
|
|
@@ -28800,6 +29150,9 @@ function isSolanaRawSpokeProviderConfig(value) {
|
|
|
28800
29150
|
function isNearRawSpokeProviderConfig(value) {
|
|
28801
29151
|
return typeof value === "object" && value !== null && "walletAddress" in value && "chainConfig" in value && value.chainConfig.chain.type === "NEAR";
|
|
28802
29152
|
}
|
|
29153
|
+
function isStacksRawSpokeProviderConfig(value) {
|
|
29154
|
+
return typeof value === "object" && value !== null && "walletAddress" in value && "chainConfig" in value && value.chainConfig.chain.type === "STACKS";
|
|
29155
|
+
}
|
|
28803
29156
|
function isSubmitSwapTxResponse(value) {
|
|
28804
29157
|
return typeof value === "object" && value !== null && typeof value.success === "boolean" && typeof value.message === "string";
|
|
28805
29158
|
}
|
|
@@ -29714,6 +30067,8 @@ function encodeAddress(spokeChainId, address) {
|
|
|
29714
30067
|
return toHex(Buffer.from(new PublicKey(address).toBytes()));
|
|
29715
30068
|
case "stellar":
|
|
29716
30069
|
return `0x${Address.fromString(address).toScVal().toXDR("hex")}`;
|
|
30070
|
+
case "stacks":
|
|
30071
|
+
return `0x${serializeCV(Cl.principal(address))}`;
|
|
29717
30072
|
case "bitcoin":
|
|
29718
30073
|
case "near":
|
|
29719
30074
|
case "injective-1":
|
|
@@ -29788,11 +30143,43 @@ function constructRawSpokeProvider(config) {
|
|
|
29788
30143
|
invariant6(isNearRawSpokeProviderConfig(config), "Invalid Near raw spoke provider config");
|
|
29789
30144
|
return new NearRawSpokeProvider(config.chainConfig, config.walletAddress);
|
|
29790
30145
|
}
|
|
30146
|
+
case "STACKS": {
|
|
30147
|
+
invariant6(isStacksRawSpokeProviderConfig(config), "Invalid Stacks raw spoke provider config");
|
|
30148
|
+
return new StacksRawSpokeProvider(config.walletAddress, config.chainConfig);
|
|
30149
|
+
}
|
|
29791
30150
|
default: {
|
|
29792
30151
|
throw new Error(`Unsupported chain type: ${chainType}`);
|
|
29793
30152
|
}
|
|
29794
30153
|
}
|
|
29795
30154
|
}
|
|
30155
|
+
async function waitForStacksTransaction(txid, rpc_url) {
|
|
30156
|
+
const url = `${rpc_url}/extended/v1/tx/${txid}`;
|
|
30157
|
+
for (let i = 1; i <= 5; i++) {
|
|
30158
|
+
const result = await (await fetch(url)).json();
|
|
30159
|
+
console.log("Waiting for transaction to be processed trying again", i);
|
|
30160
|
+
if (result.tx_status === "success") {
|
|
30161
|
+
return true;
|
|
30162
|
+
}
|
|
30163
|
+
if (result.tx_status === "abort_by_response") {
|
|
30164
|
+
console.log("Transaction aborted by response");
|
|
30165
|
+
return false;
|
|
30166
|
+
}
|
|
30167
|
+
if (result.tx_status === "abort_by_post_condition") {
|
|
30168
|
+
console.log("Transaction aborted by post condition");
|
|
30169
|
+
return false;
|
|
30170
|
+
}
|
|
30171
|
+
await sleep2(2 * i);
|
|
30172
|
+
}
|
|
30173
|
+
return false;
|
|
30174
|
+
}
|
|
30175
|
+
function serializeAddressData(address) {
|
|
30176
|
+
return `0x${serializeCV(Cl.principal(address))}`;
|
|
30177
|
+
}
|
|
30178
|
+
async function sleep2(s) {
|
|
30179
|
+
return new Promise((resolve) => {
|
|
30180
|
+
setTimeout(resolve, 1e3 * s);
|
|
30181
|
+
});
|
|
30182
|
+
}
|
|
29796
30183
|
|
|
29797
30184
|
// src/shared/types.ts
|
|
29798
30185
|
var SolverIntentStatusCode = /* @__PURE__ */ ((SolverIntentStatusCode2) => {
|
|
@@ -35672,6 +36059,6 @@ var DexService = class {
|
|
|
35672
36059
|
(*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
35673
36060
|
*/
|
|
35674
36061
|
|
|
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 };
|
|
36062
|
+
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
36063
|
//# sourceMappingURL=index.mjs.map
|
|
35677
36064
|
//# sourceMappingURL=index.mjs.map
|