@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.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 = 31;
|
|
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",
|
|
@@ -11411,7 +11512,8 @@ var swapSupportedTokens = {
|
|
|
11411
11512
|
spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.USDT,
|
|
11412
11513
|
spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.wS,
|
|
11413
11514
|
spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.SODA,
|
|
11414
|
-
spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.bnUSD
|
|
11515
|
+
spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
11516
|
+
...Object.values(SodaTokens)
|
|
11415
11517
|
],
|
|
11416
11518
|
[AVALANCHE_MAINNET_CHAIN_ID]: [
|
|
11417
11519
|
spokeChainConfig[AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.AVAX,
|
|
@@ -11567,6 +11669,13 @@ var swapSupportedTokens = {
|
|
|
11567
11669
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.USDT,
|
|
11568
11670
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
11569
11671
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.SODA
|
|
11672
|
+
],
|
|
11673
|
+
[STACKS_MAINNET_CHAIN_ID]: [
|
|
11674
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.STX,
|
|
11675
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
11676
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.SODA,
|
|
11677
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.sBTC,
|
|
11678
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.USDC
|
|
11570
11679
|
]
|
|
11571
11680
|
};
|
|
11572
11681
|
var getSupportedSolverTokens = (chainId) => swapSupportedTokens[chainId];
|
|
@@ -11739,6 +11848,13 @@ var moneyMarketSupportedTokens = {
|
|
|
11739
11848
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.USDT,
|
|
11740
11849
|
spokeChainConfig[KAIA_MAINNET_CHAIN_ID].supportedTokens.SODA
|
|
11741
11850
|
],
|
|
11851
|
+
[STACKS_MAINNET_CHAIN_ID]: [
|
|
11852
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.STX,
|
|
11853
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
11854
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.SODA,
|
|
11855
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.sBTC,
|
|
11856
|
+
spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.USDC
|
|
11857
|
+
],
|
|
11742
11858
|
[BITCOIN_MAINNET_CHAIN_ID]: [
|
|
11743
11859
|
spokeChainConfig[BITCOIN_MAINNET_CHAIN_ID].supportedTokens.BTC
|
|
11744
11860
|
]
|
|
@@ -11765,7 +11881,7 @@ var defaultSharedConfig = {
|
|
|
11765
11881
|
};
|
|
11766
11882
|
|
|
11767
11883
|
// ../types/dist/common/index.js
|
|
11768
|
-
var ChainTypeArr = ["ICON", "EVM", "INJECTIVE", "SUI", "STELLAR", "SOLANA", "NEAR", "BITCOIN"];
|
|
11884
|
+
var ChainTypeArr = ["ICON", "EVM", "INJECTIVE", "SUI", "STELLAR", "SOLANA", "STACKS", "NEAR", "BITCOIN"];
|
|
11769
11885
|
|
|
11770
11886
|
// ../types/dist/injective/index.js
|
|
11771
11887
|
var InjectiveExecuteResponse = class _InjectiveExecuteResponse {
|
|
@@ -13160,7 +13276,7 @@ var EvmWalletAbstraction = class {
|
|
|
13160
13276
|
/**
|
|
13161
13277
|
* Get the hub wallet address for a given spoke chain and address.
|
|
13162
13278
|
* @param chainId - The spoke chain ID.
|
|
13163
|
-
* @param address - The address on the spoke chain.
|
|
13279
|
+
* @param address - The encoded address on the spoke chain.
|
|
13164
13280
|
* @param hubProvider - The hub provider.
|
|
13165
13281
|
* @returns The hub wallet address.
|
|
13166
13282
|
*/
|
|
@@ -14064,11 +14180,11 @@ function add(Ah, Al, Bh, Bl) {
|
|
|
14064
14180
|
const l = (Al >>> 0) + (Bl >>> 0);
|
|
14065
14181
|
return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
|
|
14066
14182
|
}
|
|
14067
|
-
var add3L = (Al, Bl,
|
|
14183
|
+
var add3L = (Al, Bl, Cl5) => (Al >>> 0) + (Bl >>> 0) + (Cl5 >>> 0);
|
|
14068
14184
|
var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
|
|
14069
|
-
var add4L = (Al, Bl,
|
|
14185
|
+
var add4L = (Al, Bl, Cl5, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl5 >>> 0) + (Dl >>> 0);
|
|
14070
14186
|
var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
|
|
14071
|
-
var add5L = (Al, Bl,
|
|
14187
|
+
var add5L = (Al, Bl, Cl5, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl5 >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
14072
14188
|
var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
|
|
14073
14189
|
|
|
14074
14190
|
// ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/sha2.js
|
|
@@ -14308,17 +14424,17 @@ var SHA2_64B = class extends HashMD {
|
|
|
14308
14424
|
}
|
|
14309
14425
|
// prettier-ignore
|
|
14310
14426
|
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,
|
|
14427
|
+
const { Ah, Al, Bh, Bl, Ch, Cl: Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
14428
|
+
return [Ah, Al, Bh, Bl, Ch, Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];
|
|
14313
14429
|
}
|
|
14314
14430
|
// prettier-ignore
|
|
14315
|
-
set(Ah, Al, Bh, Bl, Ch,
|
|
14431
|
+
set(Ah, Al, Bh, Bl, Ch, Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
|
|
14316
14432
|
this.Ah = Ah | 0;
|
|
14317
14433
|
this.Al = Al | 0;
|
|
14318
14434
|
this.Bh = Bh | 0;
|
|
14319
14435
|
this.Bl = Bl | 0;
|
|
14320
14436
|
this.Ch = Ch | 0;
|
|
14321
|
-
this.Cl =
|
|
14437
|
+
this.Cl = Cl5 | 0;
|
|
14322
14438
|
this.Dh = Dh | 0;
|
|
14323
14439
|
this.Dl = Dl | 0;
|
|
14324
14440
|
this.Eh = Eh | 0;
|
|
@@ -14349,7 +14465,7 @@ var SHA2_64B = class extends HashMD {
|
|
|
14349
14465
|
SHA512_W_H[i] = SUMh | 0;
|
|
14350
14466
|
SHA512_W_L[i] = SUMl | 0;
|
|
14351
14467
|
}
|
|
14352
|
-
let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
14468
|
+
let { Ah, Al, Bh, Bl, Ch, Cl: Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
14353
14469
|
for (let i = 0; i < 80; i++) {
|
|
14354
14470
|
const sigma1h = rotrSH(Eh, El, 14) ^ rotrSH(Eh, El, 18) ^ rotrBH(Eh, El, 41);
|
|
14355
14471
|
const sigma1l = rotrSL(Eh, El, 14) ^ rotrSL(Eh, El, 18) ^ rotrBL(Eh, El, 41);
|
|
@@ -14361,7 +14477,7 @@ var SHA2_64B = class extends HashMD {
|
|
|
14361
14477
|
const sigma0h = rotrSH(Ah, Al, 28) ^ rotrBH(Ah, Al, 34) ^ rotrBH(Ah, Al, 39);
|
|
14362
14478
|
const sigma0l = rotrSL(Ah, Al, 28) ^ rotrBL(Ah, Al, 34) ^ rotrBL(Ah, Al, 39);
|
|
14363
14479
|
const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
|
|
14364
|
-
const MAJl = Al & Bl ^ Al &
|
|
14480
|
+
const MAJl = Al & Bl ^ Al & Cl5 ^ Bl & Cl5;
|
|
14365
14481
|
Hh = Gh | 0;
|
|
14366
14482
|
Hl = Gl | 0;
|
|
14367
14483
|
Gh = Fh | 0;
|
|
@@ -14370,9 +14486,9 @@ var SHA2_64B = class extends HashMD {
|
|
|
14370
14486
|
Fl = El | 0;
|
|
14371
14487
|
({ h: Eh, l: El } = add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
|
|
14372
14488
|
Dh = Ch | 0;
|
|
14373
|
-
Dl =
|
|
14489
|
+
Dl = Cl5 | 0;
|
|
14374
14490
|
Ch = Bh | 0;
|
|
14375
|
-
|
|
14491
|
+
Cl5 = Bl | 0;
|
|
14376
14492
|
Bh = Ah | 0;
|
|
14377
14493
|
Bl = Al | 0;
|
|
14378
14494
|
const All = add3L(T1l, sigma0l, MAJl);
|
|
@@ -14381,13 +14497,13 @@ var SHA2_64B = class extends HashMD {
|
|
|
14381
14497
|
}
|
|
14382
14498
|
({ h: Ah, l: Al } = add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
|
|
14383
14499
|
({ h: Bh, l: Bl } = add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
|
|
14384
|
-
({ h: Ch, l:
|
|
14500
|
+
({ h: Ch, l: Cl5 } = add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl5 | 0));
|
|
14385
14501
|
({ h: Dh, l: Dl } = add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
|
|
14386
14502
|
({ h: Eh, l: El } = add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
|
|
14387
14503
|
({ h: Fh, l: Fl } = add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
|
|
14388
14504
|
({ h: Gh, l: Gl } = add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
|
|
14389
14505
|
({ h: Hh, l: Hl } = add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
|
|
14390
|
-
this.set(Ah, Al, Bh, Bl, Ch,
|
|
14506
|
+
this.set(Ah, Al, Bh, Bl, Ch, Cl5, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
|
|
14391
14507
|
}
|
|
14392
14508
|
roundClean() {
|
|
14393
14509
|
clean(SHA512_W_H, SHA512_W_L);
|
|
@@ -23365,6 +23481,203 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
23365
23481
|
}
|
|
23366
23482
|
}
|
|
23367
23483
|
};
|
|
23484
|
+
var StacksBaseSpokeProvider = class {
|
|
23485
|
+
chainConfig;
|
|
23486
|
+
network;
|
|
23487
|
+
constructor(config) {
|
|
23488
|
+
this.chainConfig = config;
|
|
23489
|
+
this.network = network.createNetwork({ network: "mainnet", client: { baseUrl: config.rpcUrl } });
|
|
23490
|
+
}
|
|
23491
|
+
async getSTXBalance(address) {
|
|
23492
|
+
const url = `${this.network.client.baseUrl}/extended/v1/address/${address}/balances`;
|
|
23493
|
+
const response = await fetch(url);
|
|
23494
|
+
if (!response.ok) {
|
|
23495
|
+
throw new Error(`Error fetching STX balance: ${response.statusText}`);
|
|
23496
|
+
}
|
|
23497
|
+
const data = await response.json();
|
|
23498
|
+
return BigInt(data.stx.balance);
|
|
23499
|
+
}
|
|
23500
|
+
async readTokenBalance(token, address) {
|
|
23501
|
+
const [contractAddress, contractName] = transactions.parseContractId(token);
|
|
23502
|
+
const result = await transactions.fetchCallReadOnlyFunction({
|
|
23503
|
+
contractAddress,
|
|
23504
|
+
contractName,
|
|
23505
|
+
functionName: "get-balance",
|
|
23506
|
+
functionArgs: [transactions.Cl.principal(address)],
|
|
23507
|
+
network: this.network,
|
|
23508
|
+
senderAddress: address
|
|
23509
|
+
});
|
|
23510
|
+
return result.value.value;
|
|
23511
|
+
}
|
|
23512
|
+
async getImplContractAddress(stateContract) {
|
|
23513
|
+
const [contractAddress, contractName] = transactions.parseContractId(stateContract);
|
|
23514
|
+
const txParams = {
|
|
23515
|
+
contractAddress,
|
|
23516
|
+
contractName,
|
|
23517
|
+
functionName: "get-asset-manager-impl",
|
|
23518
|
+
functionArgs: []
|
|
23519
|
+
};
|
|
23520
|
+
const implAddress = (await this.walletReadContract(txParams)).value;
|
|
23521
|
+
return implAddress;
|
|
23522
|
+
}
|
|
23523
|
+
};
|
|
23524
|
+
var StacksSpokeProvider = class extends StacksBaseSpokeProvider {
|
|
23525
|
+
walletProvider;
|
|
23526
|
+
constructor(config, walletProvider) {
|
|
23527
|
+
super(config);
|
|
23528
|
+
this.walletProvider = walletProvider;
|
|
23529
|
+
}
|
|
23530
|
+
async walletReadContract(txParams) {
|
|
23531
|
+
return this.walletProvider.readContract(txParams);
|
|
23532
|
+
}
|
|
23533
|
+
};
|
|
23534
|
+
var StacksRawSpokeProvider = class extends StacksBaseSpokeProvider {
|
|
23535
|
+
walletProvider;
|
|
23536
|
+
raw = true;
|
|
23537
|
+
constructor(walletAddress, config) {
|
|
23538
|
+
super(config);
|
|
23539
|
+
this.walletProvider = {
|
|
23540
|
+
getWalletAddress: async () => walletAddress
|
|
23541
|
+
};
|
|
23542
|
+
}
|
|
23543
|
+
async walletReadContract(txParams) {
|
|
23544
|
+
return transactions.fetchCallReadOnlyFunction({
|
|
23545
|
+
contractAddress: txParams.contractAddress,
|
|
23546
|
+
contractName: txParams.contractName,
|
|
23547
|
+
functionName: txParams.functionName,
|
|
23548
|
+
functionArgs: txParams.functionArgs,
|
|
23549
|
+
network: this.network,
|
|
23550
|
+
senderAddress: await this.walletProvider.getWalletAddress()
|
|
23551
|
+
});
|
|
23552
|
+
}
|
|
23553
|
+
};
|
|
23554
|
+
var StacksSpokeService = class _StacksSpokeService {
|
|
23555
|
+
constructor() {
|
|
23556
|
+
}
|
|
23557
|
+
/**
|
|
23558
|
+
* Deposit tokens to the spoke chain.
|
|
23559
|
+
* @param {StacksSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
|
|
23560
|
+
* @param {StacksSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
23561
|
+
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
23562
|
+
* @returns {Promise<Hash>} A promise that resolves to the transaction hash.
|
|
23563
|
+
*/
|
|
23564
|
+
static async deposit(params, spokeProvider, hubProvider, raw) {
|
|
23565
|
+
const userWallet = await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
23566
|
+
spokeProvider.chainConfig.chain.id,
|
|
23567
|
+
encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
23568
|
+
hubProvider
|
|
23569
|
+
);
|
|
23570
|
+
return _StacksSpokeService.transfer(
|
|
23571
|
+
{
|
|
23572
|
+
from: params.from,
|
|
23573
|
+
token: params.token,
|
|
23574
|
+
recipient: params.to ? params.to : userWallet,
|
|
23575
|
+
amount: params.amount,
|
|
23576
|
+
data: params.data
|
|
23577
|
+
},
|
|
23578
|
+
spokeProvider,
|
|
23579
|
+
raw
|
|
23580
|
+
);
|
|
23581
|
+
}
|
|
23582
|
+
/**
|
|
23583
|
+
* Get the balance of the token in the spoke chain.
|
|
23584
|
+
* @param {Address} token - The address of the token to get the balance of.
|
|
23585
|
+
* @param {StacksSpokeProviderType} spokeProvider - The spoke provider.
|
|
23586
|
+
* @returns {Promise<bigint>} The balance of the token.
|
|
23587
|
+
*/
|
|
23588
|
+
static async getDeposit(token, spokeProvider) {
|
|
23589
|
+
const assetManager = spokeProvider.chainConfig.addresses.assetManager;
|
|
23590
|
+
if (token.toLowerCase() === spokeProvider.chainConfig.nativeToken.toLowerCase()) {
|
|
23591
|
+
return spokeProvider.getSTXBalance(assetManager);
|
|
23592
|
+
}
|
|
23593
|
+
return spokeProvider.readTokenBalance(token, assetManager);
|
|
23594
|
+
}
|
|
23595
|
+
/**
|
|
23596
|
+
* Get the simulation parameters for a deposit.
|
|
23597
|
+
* @param {StacksSpokeDepositParams} params - The deposit parameters.
|
|
23598
|
+
* @param {StacksSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
23599
|
+
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
23600
|
+
* @returns {Promise<DepositSimulationParams>} The simulation parameters.
|
|
23601
|
+
*/
|
|
23602
|
+
static async getSimulateDepositParams(params, spokeProvider, hubProvider) {
|
|
23603
|
+
const to = params.to ?? await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
23604
|
+
spokeProvider.chainConfig.chain.id,
|
|
23605
|
+
encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
23606
|
+
hubProvider
|
|
23607
|
+
);
|
|
23608
|
+
return {
|
|
23609
|
+
spokeChainID: spokeProvider.chainConfig.chain.id,
|
|
23610
|
+
token: encodeAddress(spokeProvider.chainConfig.chain.id, params.token),
|
|
23611
|
+
from: encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
23612
|
+
to,
|
|
23613
|
+
amount: params.amount,
|
|
23614
|
+
data: params.data,
|
|
23615
|
+
srcAddress: encodeAddress(spokeProvider.chainConfig.chain.id, spokeProvider.chainConfig.addresses.assetManager)
|
|
23616
|
+
};
|
|
23617
|
+
}
|
|
23618
|
+
/**
|
|
23619
|
+
* Calls a contract on the spoke chain using the user's wallet.
|
|
23620
|
+
* @param {Hex} from - The address of the user on the spoke chain.
|
|
23621
|
+
* @param {Hex} payload - The payload to send to the contract.
|
|
23622
|
+
* @param {StacksSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
23623
|
+
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
23624
|
+
* @returns {Promise<Hash>} A promise that resolves to the transaction hash.
|
|
23625
|
+
*/
|
|
23626
|
+
static async callWallet(from, payload, spokeProvider, hubProvider, raw) {
|
|
23627
|
+
const relayId = getIntentRelayChainId(hubProvider.chainConfig.chain.id);
|
|
23628
|
+
return _StacksSpokeService.call(BigInt(relayId), from, payload, spokeProvider, raw);
|
|
23629
|
+
}
|
|
23630
|
+
/**
|
|
23631
|
+
* Transfers tokens to the hub chain.
|
|
23632
|
+
*/
|
|
23633
|
+
static async transfer({ from, token, recipient, amount, data = "0x" }, spokeProvider, raw) {
|
|
23634
|
+
const assetManagerImpl = await spokeProvider.getImplContractAddress(
|
|
23635
|
+
spokeProvider.chainConfig.addresses.assetManager
|
|
23636
|
+
);
|
|
23637
|
+
const [implAddress, implName] = transactions.parseContractId(assetManagerImpl);
|
|
23638
|
+
const [connectionAddress, connectionName] = transactions.parseContractId(
|
|
23639
|
+
spokeProvider.chainConfig.addresses.connection
|
|
23640
|
+
);
|
|
23641
|
+
const reqData = {
|
|
23642
|
+
contractAddress: implAddress,
|
|
23643
|
+
contractName: implName,
|
|
23644
|
+
functionName: "transfer",
|
|
23645
|
+
functionArgs: [
|
|
23646
|
+
token.toLowerCase() === spokeProvider.chainConfig.nativeToken.toLowerCase() ? transactions.noneCV() : transactions.someCV(transactions.Cl.principal(token)),
|
|
23647
|
+
transactions.Cl.bufferFromHex(recipient),
|
|
23648
|
+
transactions.uintCV(amount),
|
|
23649
|
+
transactions.Cl.bufferFromHex(data),
|
|
23650
|
+
transactions.Cl.contractPrincipal(connectionAddress, connectionName)
|
|
23651
|
+
],
|
|
23652
|
+
postConditionMode: transactions.PostConditionMode.Allow
|
|
23653
|
+
};
|
|
23654
|
+
if (raw || spokeProvider instanceof StacksRawSpokeProvider) {
|
|
23655
|
+
return reqData;
|
|
23656
|
+
}
|
|
23657
|
+
const txId = await spokeProvider.walletProvider.sendTransaction(reqData);
|
|
23658
|
+
return txId;
|
|
23659
|
+
}
|
|
23660
|
+
/**
|
|
23661
|
+
* Sends a message to the hub chain.
|
|
23662
|
+
*/
|
|
23663
|
+
static async call(dstChainId, dstAddress, payload, spokeProvider, raw) {
|
|
23664
|
+
const [connectionAddress, connectionName] = transactions.parseContractId(
|
|
23665
|
+
spokeProvider.chainConfig.addresses.connection
|
|
23666
|
+
);
|
|
23667
|
+
const reqData = {
|
|
23668
|
+
contractAddress: connectionAddress,
|
|
23669
|
+
contractName: connectionName,
|
|
23670
|
+
functionName: "send-message",
|
|
23671
|
+
functionArgs: [transactions.uintCV(dstChainId), transactions.Cl.bufferFromHex(dstAddress), transactions.Cl.bufferFromHex(payload)],
|
|
23672
|
+
postConditionMode: transactions.PostConditionMode.Allow
|
|
23673
|
+
};
|
|
23674
|
+
if (raw || spokeProvider instanceof StacksRawSpokeProvider) {
|
|
23675
|
+
return reqData;
|
|
23676
|
+
}
|
|
23677
|
+
const txId = await spokeProvider.walletProvider.sendTransaction(reqData);
|
|
23678
|
+
return txId;
|
|
23679
|
+
}
|
|
23680
|
+
};
|
|
23368
23681
|
|
|
23369
23682
|
// src/shared/entities/btc/RadfiProvider.ts
|
|
23370
23683
|
var RadfiProvider = class {
|
|
@@ -24566,6 +24879,15 @@ var SpokeService = class _SpokeService {
|
|
|
24566
24879
|
raw
|
|
24567
24880
|
);
|
|
24568
24881
|
}
|
|
24882
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
24883
|
+
await _SpokeService.verifyDepositSimulation(params, spokeProvider, hubProvider, skipSimulation);
|
|
24884
|
+
return StacksSpokeService.deposit(
|
|
24885
|
+
params,
|
|
24886
|
+
spokeProvider,
|
|
24887
|
+
hubProvider,
|
|
24888
|
+
raw
|
|
24889
|
+
);
|
|
24890
|
+
}
|
|
24569
24891
|
if (isBitcoinSpokeProviderType(spokeProvider)) {
|
|
24570
24892
|
await _SpokeService.verifyDepositSimulation(params, spokeProvider, hubProvider, skipSimulation);
|
|
24571
24893
|
return BitcoinSpokeService.deposit(
|
|
@@ -24642,6 +24964,13 @@ var SpokeService = class _SpokeService {
|
|
|
24642
24964
|
hubProvider
|
|
24643
24965
|
);
|
|
24644
24966
|
}
|
|
24967
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
24968
|
+
return StacksSpokeService.getSimulateDepositParams(
|
|
24969
|
+
params,
|
|
24970
|
+
spokeProvider,
|
|
24971
|
+
hubProvider
|
|
24972
|
+
);
|
|
24973
|
+
}
|
|
24645
24974
|
throw new Error("[getSimulateDepositParams] Invalid spoke provider");
|
|
24646
24975
|
}
|
|
24647
24976
|
static async verifyDepositSimulation(params, spokeProvider, hubProvider, skipSimulation) {
|
|
@@ -24681,6 +25010,9 @@ var SpokeService = class _SpokeService {
|
|
|
24681
25010
|
if (isSonicSpokeProviderType(spokeProvider)) {
|
|
24682
25011
|
return SonicSpokeService.getDeposit(token, spokeProvider);
|
|
24683
25012
|
}
|
|
25013
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
25014
|
+
return StacksSpokeService.getDeposit(token, spokeProvider);
|
|
25015
|
+
}
|
|
24684
25016
|
if (isBitcoinSpokeProviderType(spokeProvider)) {
|
|
24685
25017
|
return BitcoinSpokeService.getDeposit(token, spokeProvider);
|
|
24686
25018
|
}
|
|
@@ -24759,6 +25091,16 @@ var SpokeService = class _SpokeService {
|
|
|
24759
25091
|
raw
|
|
24760
25092
|
);
|
|
24761
25093
|
}
|
|
25094
|
+
if (isStacksSpokeProviderType(spokeProvider)) {
|
|
25095
|
+
await _SpokeService.verifySimulation(from, payload, spokeProvider, hubProvider, skipSimulation);
|
|
25096
|
+
return await StacksSpokeService.callWallet(
|
|
25097
|
+
from,
|
|
25098
|
+
payload,
|
|
25099
|
+
spokeProvider,
|
|
25100
|
+
hubProvider,
|
|
25101
|
+
raw
|
|
25102
|
+
);
|
|
25103
|
+
}
|
|
24762
25104
|
if (isBitcoinSpokeProviderType(spokeProvider)) {
|
|
24763
25105
|
await _SpokeService.verifySimulation(from, payload, spokeProvider, hubProvider, skipSimulation);
|
|
24764
25106
|
return await BitcoinSpokeService.callWallet(
|
|
@@ -28262,7 +28604,7 @@ var SuiSpokeService = class _SuiSpokeService {
|
|
|
28262
28604
|
* @returns {Promise<bigint>} The estimated computation cost.
|
|
28263
28605
|
*/
|
|
28264
28606
|
static async estimateGas(rawTx, spokeProvider) {
|
|
28265
|
-
const txb = transactions.Transaction.fromKind(rawTx.data);
|
|
28607
|
+
const txb = transactions$1.Transaction.fromKind(rawTx.data);
|
|
28266
28608
|
const result = await spokeProvider.publicClient.devInspectTransactionBlock({
|
|
28267
28609
|
sender: rawTx.from,
|
|
28268
28610
|
transactionBlock: txb
|
|
@@ -28501,7 +28843,7 @@ var SuiBaseSpokeProvider = class {
|
|
|
28501
28843
|
}
|
|
28502
28844
|
async getBalance(walletAddress, token) {
|
|
28503
28845
|
const assetmanager = this.splitAddress(await this.getAssetManagerAddress());
|
|
28504
|
-
const tx = new transactions.Transaction();
|
|
28846
|
+
const tx = new transactions$1.Transaction();
|
|
28505
28847
|
const result = await this.viewContract(
|
|
28506
28848
|
tx,
|
|
28507
28849
|
assetmanager.packageId,
|
|
@@ -28520,7 +28862,7 @@ var SuiBaseSpokeProvider = class {
|
|
|
28520
28862
|
}
|
|
28521
28863
|
async transfer(token, amount, to, data, spokeProvider, raw) {
|
|
28522
28864
|
const isNative = token.toLowerCase() === this.chainConfig.nativeToken.toLowerCase();
|
|
28523
|
-
const tx = new transactions.Transaction();
|
|
28865
|
+
const tx = new transactions$1.Transaction();
|
|
28524
28866
|
const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
|
|
28525
28867
|
const coin = isNative ? await this.getNativeCoin(tx, amount) : await this.getCoin(tx, token, amount, walletAddress);
|
|
28526
28868
|
const connection = this.splitAddress(this.chainConfig.addresses.connection);
|
|
@@ -28554,7 +28896,7 @@ var SuiBaseSpokeProvider = class {
|
|
|
28554
28896
|
return spokeProvider.walletProvider.signAndExecuteTxn(tx);
|
|
28555
28897
|
}
|
|
28556
28898
|
async sendMessage(dst_chain_id, dst_address, data, spokeProvider, raw) {
|
|
28557
|
-
const txb = new transactions.Transaction();
|
|
28899
|
+
const txb = new transactions$1.Transaction();
|
|
28558
28900
|
const connection = this.splitAddress(this.chainConfig.addresses.connection);
|
|
28559
28901
|
txb.moveCall({
|
|
28560
28902
|
target: `${connection.packageId}::${connection.moduleId}::send_message_ua`,
|
|
@@ -28600,7 +28942,7 @@ var SuiSpokeProvider = class extends SuiBaseSpokeProvider {
|
|
|
28600
28942
|
this.walletProvider = wallet_provider;
|
|
28601
28943
|
}
|
|
28602
28944
|
async configureAssetManagerHub(hubNetworkId, hubAssetManager) {
|
|
28603
|
-
const tx = new transactions.Transaction();
|
|
28945
|
+
const tx = new transactions$1.Transaction();
|
|
28604
28946
|
const assetmanager = this.splitAddress(await this.getAssetManagerAddress());
|
|
28605
28947
|
tx.moveCall({
|
|
28606
28948
|
target: `${assetmanager.packageId}::${assetmanager.moduleId}::set_hub_details`,
|
|
@@ -28708,6 +29050,15 @@ function isSuiSpokeProviderType(value) {
|
|
|
28708
29050
|
function isSuiSpokeProvider(value) {
|
|
28709
29051
|
return typeof value === "object" && value !== null && value instanceof SuiSpokeProvider && !("raw" in value) && value.chainConfig.chain.type === "SUI";
|
|
28710
29052
|
}
|
|
29053
|
+
function isStacksSpokeProviderType(value) {
|
|
29054
|
+
return typeof value === "object" && value !== null && (isStacksSpokeProvider(value) || isStacksRawSpokeProvider(value));
|
|
29055
|
+
}
|
|
29056
|
+
function isStacksSpokeProvider(value) {
|
|
29057
|
+
return typeof value === "object" && value !== null && value instanceof StacksSpokeProvider && !("raw" in value) && value.chainConfig.chain.type === "STACKS";
|
|
29058
|
+
}
|
|
29059
|
+
function isStacksRawSpokeProvider(value) {
|
|
29060
|
+
return isRawSpokeProvider(value) && value.chainConfig.chain.type === "STACKS";
|
|
29061
|
+
}
|
|
28711
29062
|
function isConfiguredSolverConfig(value) {
|
|
28712
29063
|
return typeof value === "object" && value !== null && "intentsContract" in value && "solverApiEndpoint" in value;
|
|
28713
29064
|
}
|
|
@@ -28831,6 +29182,9 @@ function isSolanaRawSpokeProviderConfig(value) {
|
|
|
28831
29182
|
function isNearRawSpokeProviderConfig(value) {
|
|
28832
29183
|
return typeof value === "object" && value !== null && "walletAddress" in value && "chainConfig" in value && value.chainConfig.chain.type === "NEAR";
|
|
28833
29184
|
}
|
|
29185
|
+
function isStacksRawSpokeProviderConfig(value) {
|
|
29186
|
+
return typeof value === "object" && value !== null && "walletAddress" in value && "chainConfig" in value && value.chainConfig.chain.type === "STACKS";
|
|
29187
|
+
}
|
|
28834
29188
|
function isSubmitSwapTxResponse(value) {
|
|
28835
29189
|
return typeof value === "object" && value !== null && typeof value.success === "boolean" && typeof value.message === "string";
|
|
28836
29190
|
}
|
|
@@ -29745,6 +30099,8 @@ function encodeAddress(spokeChainId, address) {
|
|
|
29745
30099
|
return viem.toHex(Buffer.from(new web3_js.PublicKey(address).toBytes()));
|
|
29746
30100
|
case "stellar":
|
|
29747
30101
|
return `0x${stellarSdk.Address.fromString(address).toScVal().toXDR("hex")}`;
|
|
30102
|
+
case "stacks":
|
|
30103
|
+
return `0x${transactions.serializeCV(transactions.Cl.principal(address))}`;
|
|
29748
30104
|
case "bitcoin":
|
|
29749
30105
|
case "near":
|
|
29750
30106
|
case "injective-1":
|
|
@@ -29819,11 +30175,43 @@ function constructRawSpokeProvider(config) {
|
|
|
29819
30175
|
invariant6__default.default(isNearRawSpokeProviderConfig(config), "Invalid Near raw spoke provider config");
|
|
29820
30176
|
return new NearRawSpokeProvider(config.chainConfig, config.walletAddress);
|
|
29821
30177
|
}
|
|
30178
|
+
case "STACKS": {
|
|
30179
|
+
invariant6__default.default(isStacksRawSpokeProviderConfig(config), "Invalid Stacks raw spoke provider config");
|
|
30180
|
+
return new StacksRawSpokeProvider(config.walletAddress, config.chainConfig);
|
|
30181
|
+
}
|
|
29822
30182
|
default: {
|
|
29823
30183
|
throw new Error(`Unsupported chain type: ${chainType}`);
|
|
29824
30184
|
}
|
|
29825
30185
|
}
|
|
29826
30186
|
}
|
|
30187
|
+
async function waitForStacksTransaction(txid, rpc_url) {
|
|
30188
|
+
const url = `${rpc_url}/extended/v1/tx/${txid}`;
|
|
30189
|
+
for (let i = 1; i <= 5; i++) {
|
|
30190
|
+
const result = await (await fetch(url)).json();
|
|
30191
|
+
console.log("Waiting for transaction to be processed trying again", i);
|
|
30192
|
+
if (result.tx_status === "success") {
|
|
30193
|
+
return true;
|
|
30194
|
+
}
|
|
30195
|
+
if (result.tx_status === "abort_by_response") {
|
|
30196
|
+
console.log("Transaction aborted by response");
|
|
30197
|
+
return false;
|
|
30198
|
+
}
|
|
30199
|
+
if (result.tx_status === "abort_by_post_condition") {
|
|
30200
|
+
console.log("Transaction aborted by post condition");
|
|
30201
|
+
return false;
|
|
30202
|
+
}
|
|
30203
|
+
await sleep2(2 * i);
|
|
30204
|
+
}
|
|
30205
|
+
return false;
|
|
30206
|
+
}
|
|
30207
|
+
function serializeAddressData(address) {
|
|
30208
|
+
return `0x${transactions.serializeCV(transactions.Cl.principal(address))}`;
|
|
30209
|
+
}
|
|
30210
|
+
async function sleep2(s) {
|
|
30211
|
+
return new Promise((resolve) => {
|
|
30212
|
+
setTimeout(resolve, 1e3 * s);
|
|
30213
|
+
});
|
|
30214
|
+
}
|
|
29827
30215
|
|
|
29828
30216
|
// src/shared/types.ts
|
|
29829
30217
|
var SolverIntentStatusCode = /* @__PURE__ */ ((SolverIntentStatusCode2) => {
|
|
@@ -35802,6 +36190,7 @@ exports.RadfiProvider = RadfiProvider;
|
|
|
35802
36190
|
exports.SECONDS_PER_YEAR = SECONDS_PER_YEAR;
|
|
35803
36191
|
exports.SOLANA_MAINNET_CHAIN_ID = SOLANA_MAINNET_CHAIN_ID;
|
|
35804
36192
|
exports.SONIC_MAINNET_CHAIN_ID = SONIC_MAINNET_CHAIN_ID;
|
|
36193
|
+
exports.STACKS_MAINNET_CHAIN_ID = STACKS_MAINNET_CHAIN_ID;
|
|
35805
36194
|
exports.STELLAR_DEFAULT_TX_TIMEOUT_SECONDS = STELLAR_DEFAULT_TX_TIMEOUT_SECONDS;
|
|
35806
36195
|
exports.STELLAR_MAINNET_CHAIN_ID = STELLAR_MAINNET_CHAIN_ID;
|
|
35807
36196
|
exports.STELLAR_PRIORITY_FEE = STELLAR_PRIORITY_FEE;
|
|
@@ -35821,6 +36210,9 @@ exports.SonicRawSpokeProvider = SonicRawSpokeProvider;
|
|
|
35821
36210
|
exports.SonicSpokeProvider = SonicSpokeProvider;
|
|
35822
36211
|
exports.SonicSpokeService = SonicSpokeService;
|
|
35823
36212
|
exports.SpokeService = SpokeService;
|
|
36213
|
+
exports.StacksRawSpokeProvider = StacksRawSpokeProvider;
|
|
36214
|
+
exports.StacksSpokeProvider = StacksSpokeProvider;
|
|
36215
|
+
exports.StacksSpokeService = StacksSpokeService;
|
|
35824
36216
|
exports.StakingLogic = StakingLogic;
|
|
35825
36217
|
exports.StakingService = StakingService;
|
|
35826
36218
|
exports.StatATokenAddresses = StatATokenAddresses;
|
|
@@ -35984,6 +36376,10 @@ exports.isSonicSpokeProviderType = isSonicSpokeProviderType;
|
|
|
35984
36376
|
exports.isSpokeProvider = isSpokeProvider;
|
|
35985
36377
|
exports.isSpokeProviderObjectType = isSpokeProviderObjectType;
|
|
35986
36378
|
exports.isSpokeProviderType = isSpokeProviderType;
|
|
36379
|
+
exports.isStacksRawSpokeProvider = isStacksRawSpokeProvider;
|
|
36380
|
+
exports.isStacksRawSpokeProviderConfig = isStacksRawSpokeProviderConfig;
|
|
36381
|
+
exports.isStacksSpokeProvider = isStacksSpokeProvider;
|
|
36382
|
+
exports.isStacksSpokeProviderType = isStacksSpokeProviderType;
|
|
35987
36383
|
exports.isStellarRawSpokeProvider = isStellarRawSpokeProvider;
|
|
35988
36384
|
exports.isStellarRawSpokeProviderConfig = isStellarRawSpokeProviderConfig;
|
|
35989
36385
|
exports.isStellarSpokeProvider = isStellarSpokeProvider;
|
|
@@ -36027,6 +36423,7 @@ exports.requestAddress = requestAddress;
|
|
|
36027
36423
|
exports.requestJsonRpc = requestJsonRpc;
|
|
36028
36424
|
exports.requestSigning = requestSigning;
|
|
36029
36425
|
exports.retry = retry;
|
|
36426
|
+
exports.serializeAddressData = serializeAddressData;
|
|
36030
36427
|
exports.sleep = sleep;
|
|
36031
36428
|
exports.solverConfig = solverConfig;
|
|
36032
36429
|
exports.sonicWalletFactoryAbi = sonicWalletFactoryAbi;
|
|
@@ -36046,6 +36443,7 @@ exports.valueToZDBigNumber = valueToZDBigNumber;
|
|
|
36046
36443
|
exports.variableDebtTokenAbi = variableDebtTokenAbi;
|
|
36047
36444
|
exports.vaultTokenAbi = vaultTokenAbi;
|
|
36048
36445
|
exports.wadToRay = wadToRay;
|
|
36446
|
+
exports.waitForStacksTransaction = waitForStacksTransaction;
|
|
36049
36447
|
exports.waitForTransactionReceipt = waitForTransactionReceipt;
|
|
36050
36448
|
exports.waitUntilIntentExecuted = waitUntilIntentExecuted;
|
|
36051
36449
|
exports.walletFactoryAbi = walletFactoryAbi;
|