@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.cjs
CHANGED
|
@@ -10,7 +10,7 @@ var web3_js = require('@solana/web3.js');
|
|
|
10
10
|
var splToken = require('@solana/spl-token');
|
|
11
11
|
var bcs = require('@mysten/sui/bcs');
|
|
12
12
|
var client = require('@mysten/sui/client');
|
|
13
|
-
var transactions = require('@mysten/sui/transactions');
|
|
13
|
+
var transactions$1 = require('@mysten/sui/transactions');
|
|
14
14
|
var stellarSdk = require('@stellar/stellar-sdk');
|
|
15
15
|
var BigNumber4 = require('bignumber.js');
|
|
16
16
|
var infinitySdk = require('@pancakeswap/infinity-sdk');
|
|
@@ -18,6 +18,8 @@ var coreProtoTs = require('@injectivelabs/core-proto-ts');
|
|
|
18
18
|
var rlp = require('rlp');
|
|
19
19
|
var anchor = require('@coral-xyz/anchor');
|
|
20
20
|
var BN = require('bn.js');
|
|
21
|
+
var network = require('@stacks/network');
|
|
22
|
+
var transactions = require('@stacks/transactions');
|
|
21
23
|
var bitcoin = require('bitcoinjs-lib');
|
|
22
24
|
var ecc = require('@bitcoinerlab/secp256k1');
|
|
23
25
|
var swapSdkCore = require('@pancakeswap/swap-sdk-core');
|
|
@@ -8743,7 +8745,7 @@ var universalRouterAbi = [
|
|
|
8743
8745
|
];
|
|
8744
8746
|
|
|
8745
8747
|
// ../types/dist/constants/index.js
|
|
8746
|
-
var CONFIG_VERSION =
|
|
8748
|
+
var CONFIG_VERSION = 30;
|
|
8747
8749
|
var AVALANCHE_MAINNET_CHAIN_ID = "0xa86a.avax";
|
|
8748
8750
|
var ARBITRUM_MAINNET_CHAIN_ID = "0xa4b1.arbitrum";
|
|
8749
8751
|
var BASE_MAINNET_CHAIN_ID = "0x2105.base";
|
|
@@ -8763,6 +8765,7 @@ var ETHEREUM_MAINNET_CHAIN_ID = "ethereum";
|
|
|
8763
8765
|
var BITCOIN_MAINNET_CHAIN_ID = "bitcoin";
|
|
8764
8766
|
var REDBELLY_MAINNET_CHAIN_ID = "redbelly";
|
|
8765
8767
|
var KAIA_MAINNET_CHAIN_ID = "0x2019.kaia";
|
|
8768
|
+
var STACKS_MAINNET_CHAIN_ID = "stacks";
|
|
8766
8769
|
var HUB_CHAIN_IDS = [SONIC_MAINNET_CHAIN_ID];
|
|
8767
8770
|
var CHAIN_IDS = [
|
|
8768
8771
|
SONIC_MAINNET_CHAIN_ID,
|
|
@@ -8783,7 +8786,8 @@ var CHAIN_IDS = [
|
|
|
8783
8786
|
ETHEREUM_MAINNET_CHAIN_ID,
|
|
8784
8787
|
BITCOIN_MAINNET_CHAIN_ID,
|
|
8785
8788
|
REDBELLY_MAINNET_CHAIN_ID,
|
|
8786
|
-
KAIA_MAINNET_CHAIN_ID
|
|
8789
|
+
KAIA_MAINNET_CHAIN_ID,
|
|
8790
|
+
STACKS_MAINNET_CHAIN_ID
|
|
8787
8791
|
];
|
|
8788
8792
|
var EVM_CHAIN_IDS = [
|
|
8789
8793
|
AVALANCHE_MAINNET_CHAIN_ID,
|
|
@@ -8913,6 +8917,12 @@ var baseChainInfo = {
|
|
|
8913
8917
|
id: KAIA_MAINNET_CHAIN_ID,
|
|
8914
8918
|
type: "EVM",
|
|
8915
8919
|
chainId: 8217
|
|
8920
|
+
},
|
|
8921
|
+
[STACKS_MAINNET_CHAIN_ID]: {
|
|
8922
|
+
name: "Stacks",
|
|
8923
|
+
id: STACKS_MAINNET_CHAIN_ID,
|
|
8924
|
+
type: "STACKS",
|
|
8925
|
+
chainId: "stacks"
|
|
8916
8926
|
}
|
|
8917
8927
|
};
|
|
8918
8928
|
var ChainIdToIntentRelayChainId = {
|
|
@@ -8934,7 +8944,8 @@ var ChainIdToIntentRelayChainId = {
|
|
|
8934
8944
|
[ETHEREUM_MAINNET_CHAIN_ID]: 2n,
|
|
8935
8945
|
[BITCOIN_MAINNET_CHAIN_ID]: 627463n,
|
|
8936
8946
|
[REDBELLY_MAINNET_CHAIN_ID]: 726564n,
|
|
8937
|
-
[KAIA_MAINNET_CHAIN_ID]: 27489n
|
|
8947
|
+
[KAIA_MAINNET_CHAIN_ID]: 27489n,
|
|
8948
|
+
[STACKS_MAINNET_CHAIN_ID]: 60n
|
|
8938
8949
|
};
|
|
8939
8950
|
var getIntentRelayChainId = (chainId) => ChainIdToIntentRelayChainId[chainId];
|
|
8940
8951
|
var HubVaultSymbols = [
|
|
@@ -8959,7 +8970,8 @@ var HubVaultSymbols = [
|
|
|
8959
8970
|
"sodaWEETH",
|
|
8960
8971
|
"sodaWSTETH",
|
|
8961
8972
|
"sodaNEAR",
|
|
8962
|
-
"sodaKAIA"
|
|
8973
|
+
"sodaKAIA",
|
|
8974
|
+
"sodaSTX"
|
|
8963
8975
|
];
|
|
8964
8976
|
var SodaTokens = {
|
|
8965
8977
|
sodaBNB: {
|
|
@@ -9115,6 +9127,13 @@ var SodaTokens = {
|
|
|
9115
9127
|
decimals: 18,
|
|
9116
9128
|
address: "0xD7d41b5f803b6A40F8A6eAa34E459A4564e39891",
|
|
9117
9129
|
xChainId: SONIC_MAINNET_CHAIN_ID
|
|
9130
|
+
},
|
|
9131
|
+
sodaSTX: {
|
|
9132
|
+
symbol: "sodaSTX",
|
|
9133
|
+
name: "Soda STX",
|
|
9134
|
+
decimals: 18,
|
|
9135
|
+
address: "0x1Fbe5229e9d189F26bEE77E5bFa24309FdA90483",
|
|
9136
|
+
xChainId: SONIC_MAINNET_CHAIN_ID
|
|
9118
9137
|
}
|
|
9119
9138
|
};
|
|
9120
9139
|
var SodaTokensAsHubAssets = Object.values(SodaTokens).reduce((acc, token) => {
|
|
@@ -9213,7 +9232,6 @@ var spokeChainConfig = {
|
|
|
9213
9232
|
assetManager: "AnCCJjheynmGqPp6Vgat9DTirGKD4CtQzP8cwTYV8qKH",
|
|
9214
9233
|
connection: "GxS8i6D9qQjbSeniD487CnomUxU2pXt6V8P96T6MkUXB",
|
|
9215
9234
|
rateLimit: "2Vyy3A3Teju2EMCkdnappEeWqBXyAaF5V2WsrU4hDtsk",
|
|
9216
|
-
testToken: "3Q2HS3png7fLaYerqCun3zw8rnBZo2Ksvdg6RHTyM4Ns",
|
|
9217
9235
|
xTokenManager: ""
|
|
9218
9236
|
},
|
|
9219
9237
|
chain: baseChainInfo[SOLANA_MAINNET_CHAIN_ID],
|
|
@@ -9794,7 +9812,6 @@ var spokeChainConfig = {
|
|
|
9794
9812
|
assetManager: "inj1dg6tm62uup53wn2kn97caeqfwt0sukx3qjk8rw",
|
|
9795
9813
|
connection: "inj1eexvfglsptxwfj9hft96xcnsdrvr7d7dalcm8w",
|
|
9796
9814
|
rateLimit: "inj1x8p2h56edcdrm9tzx7a7zkwe0l334klgrxpqyk",
|
|
9797
|
-
testToken: "",
|
|
9798
9815
|
xTokenManager: ""
|
|
9799
9816
|
},
|
|
9800
9817
|
chain: baseChainInfo[INJECTIVE_MAINNET_CHAIN_ID],
|
|
@@ -9886,8 +9903,7 @@ var spokeChainConfig = {
|
|
|
9886
9903
|
connection: "CDFQDDPUPAM3XPGORHDOEFRNLMKOH3N3X6XTXNLSXJQXIU3RVCM3OPEP",
|
|
9887
9904
|
assetManager: "CCGF33A4CO6D3BXFEKPXVCFCZBK76I3AQOZK6KIKRPAWAZR3632WHCJ3",
|
|
9888
9905
|
xTokenManager: "",
|
|
9889
|
-
rateLimit: "CB6G3ULISTTBPXUN3BI6ADHQGWJEN7BPQINHL45TCB6TDFM5QWU24HAY"
|
|
9890
|
-
testToken: ""
|
|
9906
|
+
rateLimit: "CB6G3ULISTTBPXUN3BI6ADHQGWJEN7BPQINHL45TCB6TDFM5QWU24HAY"
|
|
9891
9907
|
},
|
|
9892
9908
|
trustlineConfigs: [
|
|
9893
9909
|
{
|
|
@@ -9955,8 +9971,7 @@ var spokeChainConfig = {
|
|
|
9955
9971
|
assetManagerConfigId: "0xcb7346339340b7f8dea40fcafb70721dc2fcfa7e8626a89fd954d46c1f928b61",
|
|
9956
9972
|
originalAssetManager: "0xa17a409164d1676db71b411ab50813ba2c7dd547d2df538c699049566f1ff922::asset_manager::0xcb7346339340b7f8dea40fcafb70721dc2fcfa7e8626a89fd954d46c1f928b61",
|
|
9957
9973
|
xTokenManager: "",
|
|
9958
|
-
rateLimit: ""
|
|
9959
|
-
testToken: ""
|
|
9974
|
+
rateLimit: ""
|
|
9960
9975
|
},
|
|
9961
9976
|
supportedTokens: {
|
|
9962
9977
|
SUI: {
|
|
@@ -10384,6 +10399,55 @@ var spokeChainConfig = {
|
|
|
10384
10399
|
xChainId: REDBELLY_MAINNET_CHAIN_ID
|
|
10385
10400
|
}
|
|
10386
10401
|
}
|
|
10402
|
+
},
|
|
10403
|
+
[STACKS_MAINNET_CHAIN_ID]: {
|
|
10404
|
+
addresses: {
|
|
10405
|
+
assetManager: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.asset-manager-state",
|
|
10406
|
+
connection: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.connection-v3",
|
|
10407
|
+
rateLimit: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.rate-limit-state",
|
|
10408
|
+
xTokenManager: ""
|
|
10409
|
+
},
|
|
10410
|
+
chain: baseChainInfo[STACKS_MAINNET_CHAIN_ID],
|
|
10411
|
+
nativeToken: "ST000000000000000000002AMW42H.nativetoken",
|
|
10412
|
+
bnUSD: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.bnusd",
|
|
10413
|
+
supportedTokens: {
|
|
10414
|
+
STX: {
|
|
10415
|
+
symbol: "STX",
|
|
10416
|
+
name: "Stacks",
|
|
10417
|
+
decimals: 6,
|
|
10418
|
+
address: "ST000000000000000000002AMW42H.nativetoken",
|
|
10419
|
+
xChainId: STACKS_MAINNET_CHAIN_ID
|
|
10420
|
+
},
|
|
10421
|
+
bnUSD: {
|
|
10422
|
+
symbol: "bnUSD",
|
|
10423
|
+
name: "bnUSD",
|
|
10424
|
+
decimals: 6,
|
|
10425
|
+
address: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.bnusd",
|
|
10426
|
+
xChainId: STACKS_MAINNET_CHAIN_ID
|
|
10427
|
+
},
|
|
10428
|
+
SODA: {
|
|
10429
|
+
symbol: "SODA",
|
|
10430
|
+
name: "SODAX",
|
|
10431
|
+
decimals: 6,
|
|
10432
|
+
address: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.soda",
|
|
10433
|
+
xChainId: STACKS_MAINNET_CHAIN_ID
|
|
10434
|
+
},
|
|
10435
|
+
sBTC: {
|
|
10436
|
+
symbol: "sBTC",
|
|
10437
|
+
name: "sBTC",
|
|
10438
|
+
decimals: 8,
|
|
10439
|
+
address: "SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token",
|
|
10440
|
+
xChainId: STACKS_MAINNET_CHAIN_ID
|
|
10441
|
+
},
|
|
10442
|
+
USDC: {
|
|
10443
|
+
symbol: "USDC",
|
|
10444
|
+
name: "USD Coin",
|
|
10445
|
+
decimals: 6,
|
|
10446
|
+
address: "SP120SBRBQJ00MCWS7TM5R8WJNTTKD5K0HFRC2CNE.usdcx",
|
|
10447
|
+
xChainId: STACKS_MAINNET_CHAIN_ID
|
|
10448
|
+
}
|
|
10449
|
+
},
|
|
10450
|
+
rpcUrl: "https://api.mainnet.hiro.so"
|
|
10387
10451
|
}
|
|
10388
10452
|
};
|
|
10389
10453
|
var hubAssets = {
|
|
@@ -11378,6 +11442,43 @@ var hubAssets = {
|
|
|
11378
11442
|
vault: SodaTokens.sodaPOL.address
|
|
11379
11443
|
}
|
|
11380
11444
|
},
|
|
11445
|
+
[STACKS_MAINNET_CHAIN_ID]: {
|
|
11446
|
+
[spokeChainConfig[STACKS_MAINNET_CHAIN_ID].nativeToken]: {
|
|
11447
|
+
asset: "0x30b3b1a3e4f1235472772e60a8cd9c0165db641e",
|
|
11448
|
+
decimal: 6,
|
|
11449
|
+
symbol: "STX",
|
|
11450
|
+
name: "Stacks",
|
|
11451
|
+
vault: SodaTokens.sodaSTX.address
|
|
11452
|
+
},
|
|
11453
|
+
[spokeChainConfig[STACKS_MAINNET_CHAIN_ID].bnUSD]: {
|
|
11454
|
+
asset: "0x78093c056fb37ffc1a9ae96daa0a7dd9d372b64d",
|
|
11455
|
+
decimal: 6,
|
|
11456
|
+
symbol: "bnUSD",
|
|
11457
|
+
name: "bnUSD",
|
|
11458
|
+
vault: SodaTokens.bnUSD.address
|
|
11459
|
+
},
|
|
11460
|
+
[spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
|
|
11461
|
+
asset: "0xebd34ddf9f47f9bcdf706e87206d40a579c34822",
|
|
11462
|
+
decimal: 6,
|
|
11463
|
+
symbol: "SODA",
|
|
11464
|
+
name: "SODAX",
|
|
11465
|
+
vault: SodaTokens.sodaSODA.address
|
|
11466
|
+
},
|
|
11467
|
+
[spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.sBTC.address]: {
|
|
11468
|
+
asset: "0x6f6c039b07e25bb86d8223643a84122404963d9b",
|
|
11469
|
+
decimal: 8,
|
|
11470
|
+
symbol: "sBTC",
|
|
11471
|
+
name: "sBTC",
|
|
11472
|
+
vault: SodaTokens.sodaBTC.address
|
|
11473
|
+
},
|
|
11474
|
+
[spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
|
|
11475
|
+
asset: "0x2336917df30f3417986a29ec384274a83adbef16",
|
|
11476
|
+
decimal: 6,
|
|
11477
|
+
symbol: "USDC",
|
|
11478
|
+
name: "USD Coin",
|
|
11479
|
+
vault: SodaTokens.sodaUSDC.address
|
|
11480
|
+
}
|
|
11481
|
+
},
|
|
11381
11482
|
[BITCOIN_MAINNET_CHAIN_ID]: {
|
|
11382
11483
|
[spokeChainConfig[BITCOIN_MAINNET_CHAIN_ID].supportedTokens.BTC.address]: {
|
|
11383
11484
|
asset: "0xeb0393893b5bf98a50073d6740738b08e575058b",
|
|
@@ -11567,6 +11668,13 @@ var swapSupportedTokens = {
|
|
|
11567
11668
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.USDT,
|
|
11568
11669
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
11569
11670
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.SODA
|
|
11671
|
+
],
|
|
11672
|
+
[STACKS_MAINNET_CHAIN_ID]: [
|
|
11673
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.STX,
|
|
11674
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
11675
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.SODA,
|
|
11676
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.sBTC,
|
|
11677
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.USDC
|
|
11570
11678
|
]
|
|
11571
11679
|
};
|
|
11572
11680
|
var getSupportedSolverTokens = (chainId) => swapSupportedTokens[chainId];
|
|
@@ -11739,6 +11847,13 @@ var moneyMarketSupportedTokens = {
|
|
|
11739
11847
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.USDT,
|
|
11740
11848
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.SODA
|
|
11741
11849
|
],
|
|
11850
|
+
[STACKS_MAINNET_CHAIN_ID]: [
|
|
11851
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.STX,
|
|
11852
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
11853
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.SODA,
|
|
11854
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.sBTC,
|
|
11855
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.USDC
|
|
11856
|
+
],
|
|
11742
11857
|
[BITCOIN_MAINNET_CHAIN_ID]: [
|
|
11743
11858
|
spokeChainConfig[BITCOIN_MAINNET_CHAIN_ID].supportedTokens.BTC
|
|
11744
11859
|
]
|
|
@@ -11765,7 +11880,7 @@ var defaultSharedConfig = {
|
|
|
11765
11880
|
};
|
|
11766
11881
|
|
|
11767
11882
|
// ../types/dist/common/index.js
|
|
11768
|
-
var ChainTypeArr = ["ICON", "EVM", "INJECTIVE", "SUI", "STELLAR", "SOLANA", "NEAR", "BITCOIN"];
|
|
11883
|
+
var ChainTypeArr = ["ICON", "EVM", "INJECTIVE", "SUI", "STELLAR", "SOLANA", "STACKS", "NEAR", "BITCOIN"];
|
|
11769
11884
|
|
|
11770
11885
|
// ../types/dist/injective/index.js
|
|
11771
11886
|
var InjectiveExecuteResponse = class _InjectiveExecuteResponse {
|
|
@@ -13160,7 +13275,7 @@ var EvmWalletAbstraction = class {
|
|
|
13160
13275
|
/**
|
|
13161
13276
|
* Get the hub wallet address for a given spoke chain and address.
|
|
13162
13277
|
* @param chainId - The spoke chain ID.
|
|
13163
|
-
* @param address - The address on the spoke chain.
|
|
13278
|
+
* @param address - The encoded address on the spoke chain.
|
|
13164
13279
|
* @param hubProvider - The hub provider.
|
|
13165
13280
|
* @returns The hub wallet address.
|
|
13166
13281
|
*/
|
|
@@ -14064,11 +14179,11 @@ function add(Ah, Al, Bh, Bl) {
|
|
|
14064
14179
|
const l = (Al >>> 0) + (Bl >>> 0);
|
|
14065
14180
|
return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
|
|
14066
14181
|
}
|
|
14067
|
-
var add3L = (Al, Bl,
|
|
14182
|
+
var add3L = (Al, Bl, Cl5) => (Al >>> 0) + (Bl >>> 0) + (Cl5 >>> 0);
|
|
14068
14183
|
var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
|
|
14069
|
-
var add4L = (Al, Bl,
|
|
14184
|
+
var add4L = (Al, Bl, Cl5, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl5 >>> 0) + (Dl >>> 0);
|
|
14070
14185
|
var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
|
|
14071
|
-
var add5L = (Al, Bl,
|
|
14186
|
+
var add5L = (Al, Bl, Cl5, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl5 >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
14072
14187
|
var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
|
|
14073
14188
|
|
|
14074
14189
|
// ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/sha2.js
|
|
@@ -14308,17 +14423,17 @@ var SHA2_64B = class extends HashMD {
|
|
|
14308
14423
|
}
|
|
14309
14424
|
// prettier-ignore
|
|
14310
14425
|
get() {
|
|
14311
|
-
const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
14312
|
-
return [Ah, Al, Bh, Bl, Ch,
|
|
14426
|
+
const { Ah, Al, Bh, Bl, Ch, Cl: Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
14427
|
+
return [Ah, Al, Bh, Bl, Ch, Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];
|
|
14313
14428
|
}
|
|
14314
14429
|
// prettier-ignore
|
|
14315
|
-
set(Ah, Al, Bh, Bl, Ch,
|
|
14430
|
+
set(Ah, Al, Bh, Bl, Ch, Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
|
|
14316
14431
|
this.Ah = Ah | 0;
|
|
14317
14432
|
this.Al = Al | 0;
|
|
14318
14433
|
this.Bh = Bh | 0;
|
|
14319
14434
|
this.Bl = Bl | 0;
|
|
14320
14435
|
this.Ch = Ch | 0;
|
|
14321
|
-
this.Cl =
|
|
14436
|
+
this.Cl = Cl5 | 0;
|
|
14322
14437
|
this.Dh = Dh | 0;
|
|
14323
14438
|
this.Dl = Dl | 0;
|
|
14324
14439
|
this.Eh = Eh | 0;
|
|
@@ -14349,7 +14464,7 @@ var SHA2_64B = class extends HashMD {
|
|
|
14349
14464
|
SHA512_W_H[i] = SUMh | 0;
|
|
14350
14465
|
SHA512_W_L[i] = SUMl | 0;
|
|
14351
14466
|
}
|
|
14352
|
-
let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
14467
|
+
let { Ah, Al, Bh, Bl, Ch, Cl: Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
14353
14468
|
for (let i = 0; i < 80; i++) {
|
|
14354
14469
|
const sigma1h = rotrSH(Eh, El, 14) ^ rotrSH(Eh, El, 18) ^ rotrBH(Eh, El, 41);
|
|
14355
14470
|
const sigma1l = rotrSL(Eh, El, 14) ^ rotrSL(Eh, El, 18) ^ rotrBL(Eh, El, 41);
|
|
@@ -14361,7 +14476,7 @@ var SHA2_64B = class extends HashMD {
|
|
|
14361
14476
|
const sigma0h = rotrSH(Ah, Al, 28) ^ rotrBH(Ah, Al, 34) ^ rotrBH(Ah, Al, 39);
|
|
14362
14477
|
const sigma0l = rotrSL(Ah, Al, 28) ^ rotrBL(Ah, Al, 34) ^ rotrBL(Ah, Al, 39);
|
|
14363
14478
|
const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
|
|
14364
|
-
const MAJl = Al & Bl ^ Al &
|
|
14479
|
+
const MAJl = Al & Bl ^ Al & Cl5 ^ Bl & Cl5;
|
|
14365
14480
|
Hh = Gh | 0;
|
|
14366
14481
|
Hl = Gl | 0;
|
|
14367
14482
|
Gh = Fh | 0;
|
|
@@ -14370,9 +14485,9 @@ var SHA2_64B = class extends HashMD {
|
|
|
14370
14485
|
Fl = El | 0;
|
|
14371
14486
|
({ h: Eh, l: El } = add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
|
|
14372
14487
|
Dh = Ch | 0;
|
|
14373
|
-
Dl =
|
|
14488
|
+
Dl = Cl5 | 0;
|
|
14374
14489
|
Ch = Bh | 0;
|
|
14375
|
-
|
|
14490
|
+
Cl5 = Bl | 0;
|
|
14376
14491
|
Bh = Ah | 0;
|
|
14377
14492
|
Bl = Al | 0;
|
|
14378
14493
|
const All = add3L(T1l, sigma0l, MAJl);
|
|
@@ -14381,13 +14496,13 @@ var SHA2_64B = class extends HashMD {
|
|
|
14381
14496
|
}
|
|
14382
14497
|
({ h: Ah, l: Al } = add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
|
|
14383
14498
|
({ h: Bh, l: Bl } = add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
|
|
14384
|
-
({ h: Ch, l:
|
|
14499
|
+
({ h: Ch, l: Cl5 } = add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl5 | 0));
|
|
14385
14500
|
({ h: Dh, l: Dl } = add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
|
|
14386
14501
|
({ h: Eh, l: El } = add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
|
|
14387
14502
|
({ h: Fh, l: Fl } = add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
|
|
14388
14503
|
({ h: Gh, l: Gl } = add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
|
|
14389
14504
|
({ h: Hh, l: Hl } = add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
|
|
14390
|
-
this.set(Ah, Al, Bh, Bl, Ch,
|
|
14505
|
+
this.set(Ah, Al, Bh, Bl, Ch, Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
|
|
14391
14506
|
}
|
|
14392
14507
|
roundClean() {
|
|
14393
14508
|
clean(SHA512_W_H, SHA512_W_L);
|
|
@@ -23365,6 +23480,203 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
23365
23480
|
}
|
|
23366
23481
|
}
|
|
23367
23482
|
};
|
|
23483
|
+
var StacksBaseSpokeProvider = class {
|
|
23484
|
+
chainConfig;
|
|
23485
|
+
network;
|
|
23486
|
+
constructor(config) {
|
|
23487
|
+
this.chainConfig = config;
|
|
23488
|
+
this.network = network.createNetwork({ network: "mainnet", client: { baseUrl: config.rpcUrl } });
|
|
23489
|
+
}
|
|
23490
|
+
async getSTXBalance(address) {
|
|
23491
|
+
const url = `${this.network.client.baseUrl}/extended/v1/address/${address}/balances`;
|
|
23492
|
+
const response = await fetch(url);
|
|
23493
|
+
if (!response.ok) {
|
|
23494
|
+
throw new Error(`Error fetching STX balance: ${response.statusText}`);
|
|
23495
|
+
}
|
|
23496
|
+
const data = await response.json();
|
|
23497
|
+
return BigInt(data.stx.balance);
|
|
23498
|
+
}
|
|
23499
|
+
async readTokenBalance(token, address) {
|
|
23500
|
+
const [contractAddress, contractName] = transactions.parseContractId(token);
|
|
23501
|
+
const result = await transactions.fetchCallReadOnlyFunction({
|
|
23502
|
+
contractAddress,
|
|
23503
|
+
contractName,
|
|
23504
|
+
functionName: "get-balance",
|
|
23505
|
+
functionArgs: [transactions.Cl.principal(address)],
|
|
23506
|
+
network: this.network,
|
|
23507
|
+
senderAddress: address
|
|
23508
|
+
});
|
|
23509
|
+
return result.value.value;
|
|
23510
|
+
}
|
|
23511
|
+
async getImplContractAddress(stateContract) {
|
|
23512
|
+
const [contractAddress, contractName] = transactions.parseContractId(stateContract);
|
|
23513
|
+
const txParams = {
|
|
23514
|
+
contractAddress,
|
|
23515
|
+
contractName,
|
|
23516
|
+
functionName: "get-asset-manager-impl",
|
|
23517
|
+
functionArgs: []
|
|
23518
|
+
};
|
|
23519
|
+
const implAddress = (await this.walletReadContract(txParams)).value;
|
|
23520
|
+
return implAddress;
|
|
23521
|
+
}
|
|
23522
|
+
};
|
|
23523
|
+
var StacksSpokeProvider = class extends StacksBaseSpokeProvider {
|
|
23524
|
+
walletProvider;
|
|
23525
|
+
constructor(config, walletProvider) {
|
|
23526
|
+
super(config);
|
|
23527
|
+
this.walletProvider = walletProvider;
|
|
23528
|
+
}
|
|
23529
|
+
async walletReadContract(txParams) {
|
|
23530
|
+
return this.walletProvider.readContract(txParams);
|
|
23531
|
+
}
|
|
23532
|
+
};
|
|
23533
|
+
var StacksRawSpokeProvider = class extends StacksBaseSpokeProvider {
|
|
23534
|
+
walletProvider;
|
|
23535
|
+
raw = true;
|
|
23536
|
+
constructor(walletAddress, config) {
|
|
23537
|
+
super(config);
|
|
23538
|
+
this.walletProvider = {
|
|
23539
|
+
getWalletAddress: async () => walletAddress
|
|
23540
|
+
};
|
|
23541
|
+
}
|
|
23542
|
+
async walletReadContract(txParams) {
|
|
23543
|
+
return transactions.fetchCallReadOnlyFunction({
|
|
23544
|
+
contractAddress: txParams.contractAddress,
|
|
23545
|
+
contractName: txParams.contractName,
|
|
23546
|
+
functionName: txParams.functionName,
|
|
23547
|
+
functionArgs: txParams.functionArgs,
|
|
23548
|
+
network: this.network,
|
|
23549
|
+
senderAddress: await this.walletProvider.getWalletAddress()
|
|
23550
|
+
});
|
|
23551
|
+
}
|
|
23552
|
+
};
|
|
23553
|
+
var StacksSpokeService = class _StacksSpokeService {
|
|
23554
|
+
constructor() {
|
|
23555
|
+
}
|
|
23556
|
+
/**
|
|
23557
|
+
* Deposit tokens to the spoke chain.
|
|
23558
|
+
* @param {StacksSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
|
|
23559
|
+
* @param {StacksSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
23560
|
+
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
23561
|
+
* @returns {Promise<Hash>} A promise that resolves to the transaction hash.
|
|
23562
|
+
*/
|
|
23563
|
+
static async deposit(params, spokeProvider, hubProvider, raw) {
|
|
23564
|
+
const userWallet = await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
23565
|
+
spokeProvider.chainConfig.chain.id,
|
|
23566
|
+
encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
23567
|
+
hubProvider
|
|
23568
|
+
);
|
|
23569
|
+
return _StacksSpokeService.transfer(
|
|
23570
|
+
{
|
|
23571
|
+
from: params.from,
|
|
23572
|
+
token: params.token,
|
|
23573
|
+
recipient: params.to ? params.to : userWallet,
|
|
23574
|
+
amount: params.amount,
|
|
23575
|
+
data: params.data
|
|
23576
|
+
},
|
|
23577
|
+
spokeProvider,
|
|
23578
|
+
raw
|
|
23579
|
+
);
|
|
23580
|
+
}
|
|
23581
|
+
/**
|
|
23582
|
+
* Get the balance of the token in the spoke chain.
|
|
23583
|
+
* @param {Address} token - The address of the token to get the balance of.
|
|
23584
|
+
* @param {StacksSpokeProviderType} spokeProvider - The spoke provider.
|
|
23585
|
+
* @returns {Promise<bigint>} The balance of the token.
|
|
23586
|
+
*/
|
|
23587
|
+
static async getDeposit(token, spokeProvider) {
|
|
23588
|
+
const assetManager = spokeProvider.chainConfig.addresses.assetManager;
|
|
23589
|
+
if (token.toLowerCase() === spokeProvider.chainConfig.nativeToken.toLowerCase()) {
|
|
23590
|
+
return spokeProvider.getSTXBalance(assetManager);
|
|
23591
|
+
}
|
|
23592
|
+
return spokeProvider.readTokenBalance(token, assetManager);
|
|
23593
|
+
}
|
|
23594
|
+
/**
|
|
23595
|
+
* Get the simulation parameters for a deposit.
|
|
23596
|
+
* @param {StacksSpokeDepositParams} params - The deposit parameters.
|
|
23597
|
+
* @param {StacksSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
23598
|
+
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
23599
|
+
* @returns {Promise<DepositSimulationParams>} The simulation parameters.
|
|
23600
|
+
*/
|
|
23601
|
+
static async getSimulateDepositParams(params, spokeProvider, hubProvider) {
|
|
23602
|
+
const to = params.to ?? await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
23603
|
+
spokeProvider.chainConfig.chain.id,
|
|
23604
|
+
encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
23605
|
+
hubProvider
|
|
23606
|
+
);
|
|
23607
|
+
return {
|
|
23608
|
+
spokeChainID: spokeProvider.chainConfig.chain.id,
|
|
23609
|
+
token: encodeAddress(spokeProvider.chainConfig.chain.id, params.token),
|
|
23610
|
+
from: encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
23611
|
+
to,
|
|
23612
|
+
amount: params.amount,
|
|
23613
|
+
data: params.data,
|
|
23614
|
+
srcAddress: encodeAddress(spokeProvider.chainConfig.chain.id, spokeProvider.chainConfig.addresses.assetManager)
|
|
23615
|
+
};
|
|
23616
|
+
}
|
|
23617
|
+
/**
|
|
23618
|
+
* Calls a contract on the spoke chain using the user's wallet.
|
|
23619
|
+
* @param {Hex} from - The address of the user on the spoke chain.
|
|
23620
|
+
* @param {Hex} payload - The payload to send to the contract.
|
|
23621
|
+
* @param {StacksSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
23622
|
+
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
23623
|
+
* @returns {Promise<Hash>} A promise that resolves to the transaction hash.
|
|
23624
|
+
*/
|
|
23625
|
+
static async callWallet(from, payload, spokeProvider, hubProvider, raw) {
|
|
23626
|
+
const relayId = getIntentRelayChainId(hubProvider.chainConfig.chain.id);
|
|
23627
|
+
return _StacksSpokeService.call(BigInt(relayId), from, payload, spokeProvider, raw);
|
|
23628
|
+
}
|
|
23629
|
+
/**
|
|
23630
|
+
* Transfers tokens to the hub chain.
|
|
23631
|
+
*/
|
|
23632
|
+
static async transfer({ from, token, recipient, amount, data = "0x" }, spokeProvider, raw) {
|
|
23633
|
+
const assetManagerImpl = await spokeProvider.getImplContractAddress(
|
|
23634
|
+
spokeProvider.chainConfig.addresses.assetManager
|
|
23635
|
+
);
|
|
23636
|
+
const [implAddress, implName] = transactions.parseContractId(assetManagerImpl);
|
|
23637
|
+
const [connectionAddress, connectionName] = transactions.parseContractId(
|
|
23638
|
+
spokeProvider.chainConfig.addresses.connection
|
|
23639
|
+
);
|
|
23640
|
+
const reqData = {
|
|
23641
|
+
contractAddress: implAddress,
|
|
23642
|
+
contractName: implName,
|
|
23643
|
+
functionName: "transfer",
|
|
23644
|
+
functionArgs: [
|
|
23645
|
+
token.toLowerCase() === spokeProvider.chainConfig.nativeToken.toLowerCase() ? transactions.noneCV() : transactions.someCV(transactions.Cl.principal(token)),
|
|
23646
|
+
transactions.Cl.bufferFromHex(recipient),
|
|
23647
|
+
transactions.uintCV(amount),
|
|
23648
|
+
transactions.Cl.bufferFromHex(data),
|
|
23649
|
+
transactions.Cl.contractPrincipal(connectionAddress, connectionName)
|
|
23650
|
+
],
|
|
23651
|
+
postConditionMode: transactions.PostConditionMode.Allow
|
|
23652
|
+
};
|
|
23653
|
+
if (raw || spokeProvider instanceof StacksRawSpokeProvider) {
|
|
23654
|
+
return reqData;
|
|
23655
|
+
}
|
|
23656
|
+
const txId = await spokeProvider.walletProvider.sendTransaction(reqData);
|
|
23657
|
+
return txId;
|
|
23658
|
+
}
|
|
23659
|
+
/**
|
|
23660
|
+
* Sends a message to the hub chain.
|
|
23661
|
+
*/
|
|
23662
|
+
static async call(dstChainId, dstAddress, payload, spokeProvider, raw) {
|
|
23663
|
+
const [connectionAddress, connectionName] = transactions.parseContractId(
|
|
23664
|
+
spokeProvider.chainConfig.addresses.connection
|
|
23665
|
+
);
|
|
23666
|
+
const reqData = {
|
|
23667
|
+
contractAddress: connectionAddress,
|
|
23668
|
+
contractName: connectionName,
|
|
23669
|
+
functionName: "send-message",
|
|
23670
|
+
functionArgs: [transactions.uintCV(dstChainId), transactions.Cl.bufferFromHex(dstAddress), transactions.Cl.bufferFromHex(payload)],
|
|
23671
|
+
postConditionMode: transactions.PostConditionMode.Allow
|
|
23672
|
+
};
|
|
23673
|
+
if (raw || spokeProvider instanceof StacksRawSpokeProvider) {
|
|
23674
|
+
return reqData;
|
|
23675
|
+
}
|
|
23676
|
+
const txId = await spokeProvider.walletProvider.sendTransaction(reqData);
|
|
23677
|
+
return txId;
|
|
23678
|
+
}
|
|
23679
|
+
};
|
|
23368
23680
|
|
|
23369
23681
|
// src/shared/entities/btc/RadfiProvider.ts
|
|
23370
23682
|
var RadfiProvider = class {
|
|
@@ -24566,6 +24878,15 @@ var SpokeService = class _SpokeService {
|
|
|
24566
24878
|
raw
|
|
24567
24879
|
);
|
|
24568
24880
|
}
|
|
24881
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
24882
|
+
await _SpokeService.verifyDepositSimulation(params, spokeProvider, hubProvider, skipSimulation);
|
|
24883
|
+
return StacksSpokeService.deposit(
|
|
24884
|
+
params,
|
|
24885
|
+
spokeProvider,
|
|
24886
|
+
hubProvider,
|
|
24887
|
+
raw
|
|
24888
|
+
);
|
|
24889
|
+
}
|
|
24569
24890
|
if (isBitcoinSpokeProviderType(spokeProvider)) {
|
|
24570
24891
|
await _SpokeService.verifyDepositSimulation(params, spokeProvider, hubProvider, skipSimulation);
|
|
24571
24892
|
return BitcoinSpokeService.deposit(
|
|
@@ -24642,6 +24963,13 @@ var SpokeService = class _SpokeService {
|
|
|
24642
24963
|
hubProvider
|
|
24643
24964
|
);
|
|
24644
24965
|
}
|
|
24966
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
24967
|
+
return StacksSpokeService.getSimulateDepositParams(
|
|
24968
|
+
params,
|
|
24969
|
+
spokeProvider,
|
|
24970
|
+
hubProvider
|
|
24971
|
+
);
|
|
24972
|
+
}
|
|
24645
24973
|
throw new Error("[getSimulateDepositParams] Invalid spoke provider");
|
|
24646
24974
|
}
|
|
24647
24975
|
static async verifyDepositSimulation(params, spokeProvider, hubProvider, skipSimulation) {
|
|
@@ -24681,6 +25009,9 @@ var SpokeService = class _SpokeService {
|
|
|
24681
25009
|
if (isSonicSpokeProviderType(spokeProvider)) {
|
|
24682
25010
|
return SonicSpokeService.getDeposit(token, spokeProvider);
|
|
24683
25011
|
}
|
|
25012
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
25013
|
+
return StacksSpokeService.getDeposit(token, spokeProvider);
|
|
25014
|
+
}
|
|
24684
25015
|
if (isBitcoinSpokeProviderType(spokeProvider)) {
|
|
24685
25016
|
return BitcoinSpokeService.getDeposit(token, spokeProvider);
|
|
24686
25017
|
}
|
|
@@ -24759,6 +25090,16 @@ var SpokeService = class _SpokeService {
|
|
|
24759
25090
|
raw
|
|
24760
25091
|
);
|
|
24761
25092
|
}
|
|
25093
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
25094
|
+
await _SpokeService.verifySimulation(from, payload, spokeProvider, hubProvider, skipSimulation);
|
|
25095
|
+
return await StacksSpokeService.callWallet(
|
|
25096
|
+
from,
|
|
25097
|
+
payload,
|
|
25098
|
+
spokeProvider,
|
|
25099
|
+
hubProvider,
|
|
25100
|
+
raw
|
|
25101
|
+
);
|
|
25102
|
+
}
|
|
24762
25103
|
if (isBitcoinSpokeProviderType(spokeProvider)) {
|
|
24763
25104
|
await _SpokeService.verifySimulation(from, payload, spokeProvider, hubProvider, skipSimulation);
|
|
24764
25105
|
return await BitcoinSpokeService.callWallet(
|
|
@@ -28262,7 +28603,7 @@ var SuiSpokeService = class _SuiSpokeService {
|
|
|
28262
28603
|
* @returns {Promise<bigint>} The estimated computation cost.
|
|
28263
28604
|
*/
|
|
28264
28605
|
static async estimateGas(rawTx, spokeProvider) {
|
|
28265
|
-
const txb = transactions.Transaction.fromKind(rawTx.data);
|
|
28606
|
+
const txb = transactions$1.Transaction.fromKind(rawTx.data);
|
|
28266
28607
|
const result = await spokeProvider.publicClient.devInspectTransactionBlock({
|
|
28267
28608
|
sender: rawTx.from,
|
|
28268
28609
|
transactionBlock: txb
|
|
@@ -28501,7 +28842,7 @@ var SuiBaseSpokeProvider = class {
|
|
|
28501
28842
|
}
|
|
28502
28843
|
async getBalance(walletAddress, token) {
|
|
28503
28844
|
const assetmanager = this.splitAddress(await this.getAssetManagerAddress());
|
|
28504
|
-
const tx = new transactions.Transaction();
|
|
28845
|
+
const tx = new transactions$1.Transaction();
|
|
28505
28846
|
const result = await this.viewContract(
|
|
28506
28847
|
tx,
|
|
28507
28848
|
assetmanager.packageId,
|
|
@@ -28520,7 +28861,7 @@ var SuiBaseSpokeProvider = class {
|
|
|
28520
28861
|
}
|
|
28521
28862
|
async transfer(token, amount, to, data, spokeProvider, raw) {
|
|
28522
28863
|
const isNative = token.toLowerCase() === this.chainConfig.nativeToken.toLowerCase();
|
|
28523
|
-
const tx = new transactions.Transaction();
|
|
28864
|
+
const tx = new transactions$1.Transaction();
|
|
28524
28865
|
const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
|
|
28525
28866
|
const coin = isNative ? await this.getNativeCoin(tx, amount) : await this.getCoin(tx, token, amount, walletAddress);
|
|
28526
28867
|
const connection = this.splitAddress(this.chainConfig.addresses.connection);
|
|
@@ -28554,7 +28895,7 @@ var SuiBaseSpokeProvider = class {
|
|
|
28554
28895
|
return spokeProvider.walletProvider.signAndExecuteTxn(tx);
|
|
28555
28896
|
}
|
|
28556
28897
|
async sendMessage(dst_chain_id, dst_address, data, spokeProvider, raw) {
|
|
28557
|
-
const txb = new transactions.Transaction();
|
|
28898
|
+
const txb = new transactions$1.Transaction();
|
|
28558
28899
|
const connection = this.splitAddress(this.chainConfig.addresses.connection);
|
|
28559
28900
|
txb.moveCall({
|
|
28560
28901
|
target: `${connection.packageId}::${connection.moduleId}::send_message_ua`,
|
|
@@ -28600,7 +28941,7 @@ var SuiSpokeProvider = class extends SuiBaseSpokeProvider {
|
|
|
28600
28941
|
this.walletProvider = wallet_provider;
|
|
28601
28942
|
}
|
|
28602
28943
|
async configureAssetManagerHub(hubNetworkId, hubAssetManager) {
|
|
28603
|
-
const tx = new transactions.Transaction();
|
|
28944
|
+
const tx = new transactions$1.Transaction();
|
|
28604
28945
|
const assetmanager = this.splitAddress(await this.getAssetManagerAddress());
|
|
28605
28946
|
tx.moveCall({
|
|
28606
28947
|
target: `${assetmanager.packageId}::${assetmanager.moduleId}::set_hub_details`,
|
|
@@ -28708,6 +29049,15 @@ function isSuiSpokeProviderType(value) {
|
|
|
28708
29049
|
function isSuiSpokeProvider(value) {
|
|
28709
29050
|
return typeof value === "object" && value !== null && value instanceof SuiSpokeProvider && !("raw" in value) && value.chainConfig.chain.type === "SUI";
|
|
28710
29051
|
}
|
|
29052
|
+
function isStacksSpokeProviderType(value) {
|
|
29053
|
+
return typeof value === "object" && value !== null && (isStacksSpokeProvider(value) || isStacksRawSpokeProvider(value));
|
|
29054
|
+
}
|
|
29055
|
+
function isStacksSpokeProvider(value) {
|
|
29056
|
+
return typeof value === "object" && value !== null && value instanceof StacksSpokeProvider && !("raw" in value) && value.chainConfig.chain.type === "STACKS";
|
|
29057
|
+
}
|
|
29058
|
+
function isStacksRawSpokeProvider(value) {
|
|
29059
|
+
return isRawSpokeProvider(value) && value.chainConfig.chain.type === "STACKS";
|
|
29060
|
+
}
|
|
28711
29061
|
function isConfiguredSolverConfig(value) {
|
|
28712
29062
|
return typeof value === "object" && value !== null && "intentsContract" in value && "solverApiEndpoint" in value;
|
|
28713
29063
|
}
|
|
@@ -28831,6 +29181,9 @@ function isSolanaRawSpokeProviderConfig(value) {
|
|
|
28831
29181
|
function isNearRawSpokeProviderConfig(value) {
|
|
28832
29182
|
return typeof value === "object" && value !== null && "walletAddress" in value && "chainConfig" in value && value.chainConfig.chain.type === "NEAR";
|
|
28833
29183
|
}
|
|
29184
|
+
function isStacksRawSpokeProviderConfig(value) {
|
|
29185
|
+
return typeof value === "object" && value !== null && "walletAddress" in value && "chainConfig" in value && value.chainConfig.chain.type === "STACKS";
|
|
29186
|
+
}
|
|
28834
29187
|
function isSubmitSwapTxResponse(value) {
|
|
28835
29188
|
return typeof value === "object" && value !== null && typeof value.success === "boolean" && typeof value.message === "string";
|
|
28836
29189
|
}
|
|
@@ -29745,6 +30098,8 @@ function encodeAddress(spokeChainId, address) {
|
|
|
29745
30098
|
return viem.toHex(Buffer.from(new web3_js.PublicKey(address).toBytes()));
|
|
29746
30099
|
case "stellar":
|
|
29747
30100
|
return `0x${stellarSdk.Address.fromString(address).toScVal().toXDR("hex")}`;
|
|
30101
|
+
case "stacks":
|
|
30102
|
+
return `0x${transactions.serializeCV(transactions.Cl.principal(address))}`;
|
|
29748
30103
|
case "bitcoin":
|
|
29749
30104
|
case "near":
|
|
29750
30105
|
case "injective-1":
|
|
@@ -29819,11 +30174,43 @@ function constructRawSpokeProvider(config) {
|
|
|
29819
30174
|
invariant6__default.default(isNearRawSpokeProviderConfig(config), "Invalid Near raw spoke provider config");
|
|
29820
30175
|
return new NearRawSpokeProvider(config.chainConfig, config.walletAddress);
|
|
29821
30176
|
}
|
|
30177
|
+
case "STACKS": {
|
|
30178
|
+
invariant6__default.default(isStacksRawSpokeProviderConfig(config), "Invalid Stacks raw spoke provider config");
|
|
30179
|
+
return new StacksRawSpokeProvider(config.walletAddress, config.chainConfig);
|
|
30180
|
+
}
|
|
29822
30181
|
default: {
|
|
29823
30182
|
throw new Error(`Unsupported chain type: ${chainType}`);
|
|
29824
30183
|
}
|
|
29825
30184
|
}
|
|
29826
30185
|
}
|
|
30186
|
+
async function waitForStacksTransaction(txid, rpc_url) {
|
|
30187
|
+
const url = `${rpc_url}/extended/v1/tx/${txid}`;
|
|
30188
|
+
for (let i = 1; i <= 5; i++) {
|
|
30189
|
+
const result = await (await fetch(url)).json();
|
|
30190
|
+
console.log("Waiting for transaction to be processed trying again", i);
|
|
30191
|
+
if (result.tx_status === "success") {
|
|
30192
|
+
return true;
|
|
30193
|
+
}
|
|
30194
|
+
if (result.tx_status === "abort_by_response") {
|
|
30195
|
+
console.log("Transaction aborted by response");
|
|
30196
|
+
return false;
|
|
30197
|
+
}
|
|
30198
|
+
if (result.tx_status === "abort_by_post_condition") {
|
|
30199
|
+
console.log("Transaction aborted by post condition");
|
|
30200
|
+
return false;
|
|
30201
|
+
}
|
|
30202
|
+
await sleep2(2 * i);
|
|
30203
|
+
}
|
|
30204
|
+
return false;
|
|
30205
|
+
}
|
|
30206
|
+
function serializeAddressData(address) {
|
|
30207
|
+
return `0x${transactions.serializeCV(transactions.Cl.principal(address))}`;
|
|
30208
|
+
}
|
|
30209
|
+
async function sleep2(s) {
|
|
30210
|
+
return new Promise((resolve) => {
|
|
30211
|
+
setTimeout(resolve, 1e3 * s);
|
|
30212
|
+
});
|
|
30213
|
+
}
|
|
29827
30214
|
|
|
29828
30215
|
// src/shared/types.ts
|
|
29829
30216
|
var SolverIntentStatusCode = /* @__PURE__ */ ((SolverIntentStatusCode2) => {
|
|
@@ -35802,6 +36189,7 @@ exports.RadfiProvider = RadfiProvider;
|
|
|
35802
36189
|
exports.SECONDS_PER_YEAR = SECONDS_PER_YEAR;
|
|
35803
36190
|
exports.SOLANA_MAINNET_CHAIN_ID = SOLANA_MAINNET_CHAIN_ID;
|
|
35804
36191
|
exports.SONIC_MAINNET_CHAIN_ID = SONIC_MAINNET_CHAIN_ID;
|
|
36192
|
+
exports.STACKS_MAINNET_CHAIN_ID = STACKS_MAINNET_CHAIN_ID;
|
|
35805
36193
|
exports.STELLAR_DEFAULT_TX_TIMEOUT_SECONDS = STELLAR_DEFAULT_TX_TIMEOUT_SECONDS;
|
|
35806
36194
|
exports.STELLAR_MAINNET_CHAIN_ID = STELLAR_MAINNET_CHAIN_ID;
|
|
35807
36195
|
exports.STELLAR_PRIORITY_FEE = STELLAR_PRIORITY_FEE;
|
|
@@ -35821,6 +36209,9 @@ exports.SonicRawSpokeProvider = SonicRawSpokeProvider;
|
|
|
35821
36209
|
exports.SonicSpokeProvider = SonicSpokeProvider;
|
|
35822
36210
|
exports.SonicSpokeService = SonicSpokeService;
|
|
35823
36211
|
exports.SpokeService = SpokeService;
|
|
36212
|
+
exports.StacksRawSpokeProvider = StacksRawSpokeProvider;
|
|
36213
|
+
exports.StacksSpokeProvider = StacksSpokeProvider;
|
|
36214
|
+
exports.StacksSpokeService = StacksSpokeService;
|
|
35824
36215
|
exports.StakingLogic = StakingLogic;
|
|
35825
36216
|
exports.StakingService = StakingService;
|
|
35826
36217
|
exports.StatATokenAddresses = StatATokenAddresses;
|
|
@@ -35984,6 +36375,10 @@ exports.isSonicSpokeProviderType = isSonicSpokeProviderType;
|
|
|
35984
36375
|
exports.isSpokeProvider = isSpokeProvider;
|
|
35985
36376
|
exports.isSpokeProviderObjectType = isSpokeProviderObjectType;
|
|
35986
36377
|
exports.isSpokeProviderType = isSpokeProviderType;
|
|
36378
|
+
exports.isStacksRawSpokeProvider = isStacksRawSpokeProvider;
|
|
36379
|
+
exports.isStacksRawSpokeProviderConfig = isStacksRawSpokeProviderConfig;
|
|
36380
|
+
exports.isStacksSpokeProvider = isStacksSpokeProvider;
|
|
36381
|
+
exports.isStacksSpokeProviderType = isStacksSpokeProviderType;
|
|
35987
36382
|
exports.isStellarRawSpokeProvider = isStellarRawSpokeProvider;
|
|
35988
36383
|
exports.isStellarRawSpokeProviderConfig = isStellarRawSpokeProviderConfig;
|
|
35989
36384
|
exports.isStellarSpokeProvider = isStellarSpokeProvider;
|
|
@@ -36027,6 +36422,7 @@ exports.requestAddress = requestAddress;
|
|
|
36027
36422
|
exports.requestJsonRpc = requestJsonRpc;
|
|
36028
36423
|
exports.requestSigning = requestSigning;
|
|
36029
36424
|
exports.retry = retry;
|
|
36425
|
+
exports.serializeAddressData = serializeAddressData;
|
|
36030
36426
|
exports.sleep = sleep;
|
|
36031
36427
|
exports.solverConfig = solverConfig;
|
|
36032
36428
|
exports.sonicWalletFactoryAbi = sonicWalletFactoryAbi;
|
|
@@ -36046,6 +36442,7 @@ exports.valueToZDBigNumber = valueToZDBigNumber;
|
|
|
36046
36442
|
exports.variableDebtTokenAbi = variableDebtTokenAbi;
|
|
36047
36443
|
exports.vaultTokenAbi = vaultTokenAbi;
|
|
36048
36444
|
exports.wadToRay = wadToRay;
|
|
36445
|
+
exports.waitForStacksTransaction = waitForStacksTransaction;
|
|
36049
36446
|
exports.waitForTransactionReceipt = waitForTransactionReceipt;
|
|
36050
36447
|
exports.waitUntilIntentExecuted = waitUntilIntentExecuted;
|
|
36051
36448
|
exports.walletFactoryAbi = walletFactoryAbi;
|