@sodax/sdk 2.2.0-rc.2 → 2.2.0-rc.4
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 +1783 -230
- package/dist/index.d.cts +374 -7
- package/dist/index.d.ts +374 -7
- package/dist/index.mjs +1781 -234
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { getAbiItem, parseAbi, isAddress, toHex, hexToBytes, encodeAbiParameters, parseAbiParameters,
|
|
1
|
+
import { getAbiItem, parseAbi, defineChain, isAddress, toHex, hexToBytes, encodeAbiParameters, parseAbiParameters, encodeFunctionData, erc20Abi as erc20Abi$1, createPublicClient, http, bytesToHex, keccak256, stringToBytes, fromHex, encodePacked, decodeAbiParameters, parseEventLogs, isHex, maxUint160, maxUint48, fallback } from 'viem';
|
|
2
|
+
import { initEccLib, address, networks, Transaction, Psbt, payments, opcodes, script } from 'bitcoinjs-lib';
|
|
2
3
|
import { bcs } from '@mysten/sui/bcs';
|
|
3
4
|
import { PublicKey, Connection, VersionedTransaction, SystemProgram, ComputeBudgetProgram, TransactionMessage, TransactionInstruction } from '@solana/web3.js';
|
|
4
5
|
import { rpc, Address, xdr, Account, Horizon, Contract, TransactionBuilder, nativeToScVal, TimeoutInfinite, scValToBigInt, Operation, Asset, FeeBumpTransaction, NotFoundError, Networks, Keypair } from '@stellar/stellar-sdk';
|
|
5
|
-
import { serializeCV, Cl, deserializeCV, cvToString, createNetwork, fetchFeeEstimateTransaction, fetchCallReadOnlyFunction, parseContractId,
|
|
6
|
+
import { serializeCV, Cl, deserializeCV, cvToString, createNetwork, fetchFeeEstimateTransaction, fetchCallReadOnlyFunction, parseContractId, noneCV, someCV, uintCV, getAddressFromPublicKey, makeUnsignedContractCall, serializePayloadBytes, PostConditionMode, Pc } from '@sodax/libs/stacks/core';
|
|
6
7
|
import { hedera, kaia, redbellyMainnet, mainnet, lightlinkPhoenix, polygon, bsc, optimism, base, arbitrum, avalanche, sonic } from 'viem/chains';
|
|
7
8
|
import * as rlp from 'rlp';
|
|
8
|
-
import { initEccLib, networks, Transaction, Psbt, payments, opcodes, script } from 'bitcoinjs-lib';
|
|
9
9
|
import * as ecc from '@bitcoinerlab/secp256k1';
|
|
10
10
|
import { CLPositionManagerAbi, encodeCLPositionManagerMintCalldata, encodeCLPositionManagerIncreaseLiquidityCalldata, encodeCLPositionManagerDecreaseLiquidityCalldata, getPoolId, CLPoolManagerAbi, decodePoolKey } from '@pancakeswap/infinity-sdk';
|
|
11
11
|
import { Transaction as Transaction$1 } from '@mysten/sui/transactions';
|
|
@@ -18,7 +18,7 @@ import { ChainGrpcWasmApi, IndexerGrpcAccountPortfolioApi, TxGrpcApi, toBase64,
|
|
|
18
18
|
import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx.js';
|
|
19
19
|
import { getNetworkEndpoints, Network } from '@injectivelabs/networks';
|
|
20
20
|
import * as v from 'valibot';
|
|
21
|
-
import { SwapsApi, SwapsApiError } from '@sodax/swaps-api';
|
|
21
|
+
import { SwapsApi, SwapsApiError, rawTxSchemaForChainKey as rawTxSchemaForChainKey$1, makeQuoteResponseSchema, DeadlineResponseSchema, AllowanceCheckResponseSchema, makeApproveResponseSchema, makeCreateIntentResponseSchema, SubmitIntentResponseSchema, StatusResponseSchema, makeCancelIntentResponseSchema, IntentHashResponseSchema, IntentPacketResponseSchema, RelayExtraDataResponseSchema as RelayExtraDataResponseSchema$1, IntentStateSchema, IntentResponseSchema as IntentResponseSchema$1, GasEstimateResponseSchema, FeeResponseSchema, SubmitTxResponseSchema, SubmitTxStatusResponseSchema } from '@sodax/swaps-api';
|
|
22
22
|
export { SwapsApiError } from '@sodax/swaps-api';
|
|
23
23
|
import BigNumber5, { BigNumber } from 'bignumber.js';
|
|
24
24
|
import { Token, Price } from '@pancakeswap/swap-sdk-core';
|
|
@@ -94,8 +94,8 @@ function serializeCause(cause, depth) {
|
|
|
94
94
|
}
|
|
95
95
|
function sanitizeContext(value, depth) {
|
|
96
96
|
const out = {};
|
|
97
|
-
for (const [key,
|
|
98
|
-
out[key] = sanitizeValue(
|
|
97
|
+
for (const [key, v12] of Object.entries(value)) {
|
|
98
|
+
out[key] = sanitizeValue(v12, depth + 1);
|
|
99
99
|
}
|
|
100
100
|
return out;
|
|
101
101
|
}
|
|
@@ -106,13 +106,13 @@ function sanitizeValue(value, depth) {
|
|
|
106
106
|
if (t === "bigint") return value.toString();
|
|
107
107
|
if (t === "string" || t === "number" || t === "boolean") return value;
|
|
108
108
|
if (t === "function" || t === "symbol") return safeString(value);
|
|
109
|
-
if (Array.isArray(value)) return value.map((
|
|
109
|
+
if (Array.isArray(value)) return value.map((v12) => sanitizeValue(v12, depth + 1));
|
|
110
110
|
if (value instanceof Date) return value.toISOString();
|
|
111
111
|
if (value instanceof Map) {
|
|
112
|
-
return Array.from(value.entries()).map(([k,
|
|
112
|
+
return Array.from(value.entries()).map(([k, v12]) => [sanitizeValue(k, depth + 1), sanitizeValue(v12, depth + 1)]);
|
|
113
113
|
}
|
|
114
114
|
if (value instanceof Set) {
|
|
115
|
-
return Array.from(value.values()).map((
|
|
115
|
+
return Array.from(value.values()).map((v12) => sanitizeValue(v12, depth + 1));
|
|
116
116
|
}
|
|
117
117
|
if (value instanceof Error) return { name: value.name, message: value.message };
|
|
118
118
|
if (t === "object") {
|
|
@@ -124,9 +124,9 @@ function sanitizeValue(value, depth) {
|
|
|
124
124
|
}
|
|
125
125
|
return safeString(value);
|
|
126
126
|
}
|
|
127
|
-
function safeString(
|
|
127
|
+
function safeString(v12) {
|
|
128
128
|
try {
|
|
129
|
-
return String(
|
|
129
|
+
return String(v12);
|
|
130
130
|
} catch {
|
|
131
131
|
return "[unserializable]";
|
|
132
132
|
}
|
|
@@ -325,7 +325,20 @@ var HubVaultSymbols = [
|
|
|
325
325
|
"sodaHBAR",
|
|
326
326
|
"sodaJITOSOL",
|
|
327
327
|
"sodaUSDS",
|
|
328
|
-
"sodaUSSD"
|
|
328
|
+
"sodaUSSD",
|
|
329
|
+
"SPCX",
|
|
330
|
+
"NVDA",
|
|
331
|
+
"GME",
|
|
332
|
+
"MSTR",
|
|
333
|
+
"AAPL",
|
|
334
|
+
"TSLA",
|
|
335
|
+
"MU",
|
|
336
|
+
"SNDK",
|
|
337
|
+
"SPY",
|
|
338
|
+
"QQQ",
|
|
339
|
+
"SGOV",
|
|
340
|
+
"USO",
|
|
341
|
+
"SLV"
|
|
329
342
|
];
|
|
330
343
|
var SodaTokens = {
|
|
331
344
|
sodaBNB: {
|
|
@@ -588,9 +601,126 @@ var SodaTokens = {
|
|
|
588
601
|
chainKey: ChainKeys.SONIC_MAINNET,
|
|
589
602
|
hubAsset: "0xb780e09576C2667ba9F5B80FbAb2e6b8A0a21e37",
|
|
590
603
|
vault: "0xb780e09576C2667ba9F5B80FbAb2e6b8A0a21e37"
|
|
604
|
+
},
|
|
605
|
+
SPCX: {
|
|
606
|
+
symbol: "SPCX",
|
|
607
|
+
name: "Space Exploration Technologies Corp. Class A Common Stock \u2022 Robinhood Token",
|
|
608
|
+
decimals: 18,
|
|
609
|
+
address: "0xB585e2EEa070eB4E4D877A707aEC3B718edb2373",
|
|
610
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
611
|
+
hubAsset: "0xB585e2EEa070eB4E4D877A707aEC3B718edb2373",
|
|
612
|
+
vault: "0xB585e2EEa070eB4E4D877A707aEC3B718edb2373"
|
|
613
|
+
},
|
|
614
|
+
NVDA: {
|
|
615
|
+
symbol: "NVDA",
|
|
616
|
+
name: "NVIDIA \u2022 Robinhood Token",
|
|
617
|
+
decimals: 18,
|
|
618
|
+
address: "0x2D5D2250EE426cA318efBd03ddf926B23c96f74B",
|
|
619
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
620
|
+
hubAsset: "0x2D5D2250EE426cA318efBd03ddf926B23c96f74B",
|
|
621
|
+
vault: "0x2D5D2250EE426cA318efBd03ddf926B23c96f74B"
|
|
622
|
+
},
|
|
623
|
+
GME: {
|
|
624
|
+
symbol: "GME",
|
|
625
|
+
name: "GameStop \u2022 Robinhood Token",
|
|
626
|
+
decimals: 18,
|
|
627
|
+
address: "0x996e5591e4692e2B7d8fB6926DeA4EE1950Ef394",
|
|
628
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
629
|
+
hubAsset: "0x996e5591e4692e2B7d8fB6926DeA4EE1950Ef394",
|
|
630
|
+
vault: "0x996e5591e4692e2B7d8fB6926DeA4EE1950Ef394"
|
|
631
|
+
},
|
|
632
|
+
MSTR: {
|
|
633
|
+
symbol: "MSTR",
|
|
634
|
+
name: "Strategy Inc. \u2022 Robinhood Token",
|
|
635
|
+
decimals: 18,
|
|
636
|
+
address: "0xE0E2aF45EBf5700a90E63c41B0ecE042A240Fab1",
|
|
637
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
638
|
+
hubAsset: "0xE0E2aF45EBf5700a90E63c41B0ecE042A240Fab1",
|
|
639
|
+
vault: "0xE0E2aF45EBf5700a90E63c41B0ecE042A240Fab1"
|
|
640
|
+
},
|
|
641
|
+
AAPL: {
|
|
642
|
+
symbol: "AAPL",
|
|
643
|
+
name: "Apple \u2022 Robinhood Token",
|
|
644
|
+
decimals: 18,
|
|
645
|
+
address: "0x4712D2D49Ba3be41DA334FCB3616FDdc0d745185",
|
|
646
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
647
|
+
hubAsset: "0x4712D2D49Ba3be41DA334FCB3616FDdc0d745185",
|
|
648
|
+
vault: "0x4712D2D49Ba3be41DA334FCB3616FDdc0d745185"
|
|
649
|
+
},
|
|
650
|
+
TSLA: {
|
|
651
|
+
symbol: "TSLA",
|
|
652
|
+
name: "Tesla \u2022 Robinhood Token",
|
|
653
|
+
decimals: 18,
|
|
654
|
+
address: "0x8B7F46967Ed9367A70b2e046D5e26a03625d53b1",
|
|
655
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
656
|
+
hubAsset: "0x8B7F46967Ed9367A70b2e046D5e26a03625d53b1",
|
|
657
|
+
vault: "0x8B7F46967Ed9367A70b2e046D5e26a03625d53b1"
|
|
658
|
+
},
|
|
659
|
+
MU: {
|
|
660
|
+
symbol: "MU",
|
|
661
|
+
name: "Micron Technology \u2022 Robinhood Token",
|
|
662
|
+
decimals: 18,
|
|
663
|
+
address: "0x108147b16186B895344F5752468190B9EE0e3A22",
|
|
664
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
665
|
+
hubAsset: "0x108147b16186B895344F5752468190B9EE0e3A22",
|
|
666
|
+
vault: "0x108147b16186B895344F5752468190B9EE0e3A22"
|
|
667
|
+
},
|
|
668
|
+
SNDK: {
|
|
669
|
+
symbol: "SNDK",
|
|
670
|
+
name: "Sandisk Corporation \u2022 Robinhood Token",
|
|
671
|
+
decimals: 18,
|
|
672
|
+
address: "0x568F29855B7B46EdA38ed95771FAeC498c507EF7",
|
|
673
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
674
|
+
hubAsset: "0x568F29855B7B46EdA38ed95771FAeC498c507EF7",
|
|
675
|
+
vault: "0x568F29855B7B46EdA38ed95771FAeC498c507EF7"
|
|
676
|
+
},
|
|
677
|
+
SPY: {
|
|
678
|
+
symbol: "SPY",
|
|
679
|
+
name: "SPDR S&P 500 ETF Trust \u2022 Robinhood Token",
|
|
680
|
+
decimals: 18,
|
|
681
|
+
address: "0x1816E408f0448D0CaD3e0D490bd2590d921Bb0c8",
|
|
682
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
683
|
+
hubAsset: "0x1816E408f0448D0CaD3e0D490bd2590d921Bb0c8",
|
|
684
|
+
vault: "0x1816E408f0448D0CaD3e0D490bd2590d921Bb0c8"
|
|
685
|
+
},
|
|
686
|
+
QQQ: {
|
|
687
|
+
symbol: "QQQ",
|
|
688
|
+
name: "Invesco QQQ \u2022 Robinhood Token",
|
|
689
|
+
decimals: 18,
|
|
690
|
+
address: "0x454ab3DeFd9df0749d450b145D4516e317E3e500",
|
|
691
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
692
|
+
hubAsset: "0x454ab3DeFd9df0749d450b145D4516e317E3e500",
|
|
693
|
+
vault: "0x454ab3DeFd9df0749d450b145D4516e317E3e500"
|
|
694
|
+
},
|
|
695
|
+
SGOV: {
|
|
696
|
+
symbol: "SGOV",
|
|
697
|
+
name: "iShares 0-3 Month Treasury Bond \u2022 Robinhood Token",
|
|
698
|
+
decimals: 18,
|
|
699
|
+
address: "0xf6938087cf794B08739b926B41FF8F1E90816E74",
|
|
700
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
701
|
+
hubAsset: "0xf6938087cf794B08739b926B41FF8F1E90816E74",
|
|
702
|
+
vault: "0xf6938087cf794B08739b926B41FF8F1E90816E74"
|
|
703
|
+
},
|
|
704
|
+
USO: {
|
|
705
|
+
symbol: "USO",
|
|
706
|
+
name: "United States Oil Fund \u2022 Robinhood Token",
|
|
707
|
+
decimals: 18,
|
|
708
|
+
address: "0x8DaBbADcecfc1a0B91fc68c72301090bc220D2bc",
|
|
709
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
710
|
+
hubAsset: "0x8DaBbADcecfc1a0B91fc68c72301090bc220D2bc",
|
|
711
|
+
vault: "0x8DaBbADcecfc1a0B91fc68c72301090bc220D2bc"
|
|
712
|
+
},
|
|
713
|
+
SLV: {
|
|
714
|
+
symbol: "SLV",
|
|
715
|
+
name: "iShares Silver Trust \u2022 Robinhood Token",
|
|
716
|
+
decimals: 18,
|
|
717
|
+
address: "0x690B92c27ac80015E57DB8cc02A81255814f49A2",
|
|
718
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
719
|
+
hubAsset: "0x690B92c27ac80015E57DB8cc02A81255814f49A2",
|
|
720
|
+
vault: "0x690B92c27ac80015E57DB8cc02A81255814f49A2"
|
|
591
721
|
}
|
|
592
722
|
};
|
|
593
|
-
var LsodaSymbols = ["lsodaWEETH", "lsodaWSTETH", "lsodaJITOSOL"];
|
|
723
|
+
var LsodaSymbols = ["lsodaWEETH", "lsodaWSTETH", "lsodaJITOSOL", "lsodaSUSDS"];
|
|
594
724
|
var LsodaTokens = {
|
|
595
725
|
lsodaWEETH: {
|
|
596
726
|
symbol: "lsodaWEETH",
|
|
@@ -618,6 +748,15 @@ var LsodaTokens = {
|
|
|
618
748
|
chainKey: ChainKeys.SONIC_MAINNET,
|
|
619
749
|
hubAsset: "0xD7Ae4853E0f93682F5DaA14734F5D18cBa09Bd78",
|
|
620
750
|
vault: "0xD7Ae4853E0f93682F5DaA14734F5D18cBa09Bd78"
|
|
751
|
+
},
|
|
752
|
+
lsodaSUSDS: {
|
|
753
|
+
symbol: "lsodaSUSDS",
|
|
754
|
+
name: "Leveraged Soda sUSDS",
|
|
755
|
+
decimals: 18,
|
|
756
|
+
address: "0x758532F160D9D338bf662A4a59BA31a5B918A7cb",
|
|
757
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
758
|
+
hubAsset: "0x758532F160D9D338bf662A4a59BA31a5B918A7cb",
|
|
759
|
+
vault: "0x758532F160D9D338bf662A4a59BA31a5B918A7cb"
|
|
621
760
|
}
|
|
622
761
|
};
|
|
623
762
|
var sonicSupportedTokens = {
|
|
@@ -2181,6 +2320,123 @@ var stellarSupportedTokens = {
|
|
|
2181
2320
|
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2182
2321
|
hubAsset: "0xE36b8F88651004e29FD2001aEace777671731d65",
|
|
2183
2322
|
vault: SodaTokens.sodaUSDS.address
|
|
2323
|
+
},
|
|
2324
|
+
SPCX: {
|
|
2325
|
+
symbol: "SPCX",
|
|
2326
|
+
name: "SpaceX Class A",
|
|
2327
|
+
decimals: 7,
|
|
2328
|
+
address: "CAI4HHAYO57QICZOZ4JF7R66RLGJRD7BGTX7H6MILCITVEYYEFRYFISK",
|
|
2329
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2330
|
+
hubAsset: "0xd24B7ba6c066E024A86e76BAb3baBd4625c346C0",
|
|
2331
|
+
vault: SodaTokens.SPCX.address
|
|
2332
|
+
},
|
|
2333
|
+
NVDA: {
|
|
2334
|
+
symbol: "NVDA",
|
|
2335
|
+
name: "NVIDIA",
|
|
2336
|
+
decimals: 7,
|
|
2337
|
+
address: "CCQFCT4FHJURUQ4RQA4NHYW5GQRHCBDXF33ADXZRTDTDVGKOJO3ZPEMY",
|
|
2338
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2339
|
+
hubAsset: "0x46609A9bEDb673caade4F36c4114dAc758564e76",
|
|
2340
|
+
vault: SodaTokens.NVDA.address
|
|
2341
|
+
},
|
|
2342
|
+
GME: {
|
|
2343
|
+
symbol: "GME",
|
|
2344
|
+
name: "GameStop",
|
|
2345
|
+
decimals: 7,
|
|
2346
|
+
address: "CAPSLSLCTFOZM22SUIPQENMM54T24GTDRHZ5STYAO6EYMK5GGGYVKWBX",
|
|
2347
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2348
|
+
hubAsset: "0x7A45571d28E8d2D8548a56965837bd7F35d5Fb20",
|
|
2349
|
+
vault: SodaTokens.GME.address
|
|
2350
|
+
},
|
|
2351
|
+
MSTR: {
|
|
2352
|
+
symbol: "MSTR",
|
|
2353
|
+
name: "Strategy",
|
|
2354
|
+
decimals: 7,
|
|
2355
|
+
address: "CAFQQXZSECLJNU76OS2OKLJQJBQHYJCVAYZJ4KGEN7VHXH5BTGNLVQND",
|
|
2356
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2357
|
+
hubAsset: "0xaC6Ab7ef0F46aAb624f1Cfd811a7f2229F7FFC1c",
|
|
2358
|
+
vault: SodaTokens.MSTR.address
|
|
2359
|
+
},
|
|
2360
|
+
AAPL: {
|
|
2361
|
+
symbol: "AAPL",
|
|
2362
|
+
name: "Apple",
|
|
2363
|
+
decimals: 7,
|
|
2364
|
+
address: "CAZSFDNSSR2RKJ2LIIB2Y4G4WOSYYKC4646EUJ63PQLDDHOVQYZ4HDTK",
|
|
2365
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2366
|
+
hubAsset: "0x9B37F4b9d9E47f5b4fA5eC3566a55D52030AEC4C",
|
|
2367
|
+
vault: SodaTokens.AAPL.address
|
|
2368
|
+
},
|
|
2369
|
+
TSLA: {
|
|
2370
|
+
symbol: "TSLA",
|
|
2371
|
+
name: "Tesla",
|
|
2372
|
+
decimals: 7,
|
|
2373
|
+
address: "CARLFQDI2S2FSYFB47AZLKGUFZVGBEUVNW77SCJHHHGL2KPGT3TN5PAB",
|
|
2374
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2375
|
+
hubAsset: "0x595bA45dA064bA4fF4de821A0b5105dbDfac5C9f",
|
|
2376
|
+
vault: SodaTokens.TSLA.address
|
|
2377
|
+
},
|
|
2378
|
+
MU: {
|
|
2379
|
+
symbol: "MU",
|
|
2380
|
+
name: "Micron",
|
|
2381
|
+
decimals: 7,
|
|
2382
|
+
address: "CBPTKA32BTUEX4VFAER6AUFWQZCWJKQAMLV2PMFFN7EHLGLJN4JWIZ3F",
|
|
2383
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2384
|
+
hubAsset: "0x14a28CFb7ef407EdEfD377c4Fe59e86e9B050A20",
|
|
2385
|
+
vault: SodaTokens.MU.address
|
|
2386
|
+
},
|
|
2387
|
+
SNDK: {
|
|
2388
|
+
symbol: "SNDK",
|
|
2389
|
+
name: "SanDisk",
|
|
2390
|
+
decimals: 7,
|
|
2391
|
+
address: "CDXNTHFMGQM33UGQBSLZI3BV5UWW62QGZLCEKOXJKMFN2W3KQZKE3LTQ",
|
|
2392
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2393
|
+
hubAsset: "0xeb6a0595F42Ba66AF7716d92F8Db45633FFec29f",
|
|
2394
|
+
vault: SodaTokens.SNDK.address
|
|
2395
|
+
},
|
|
2396
|
+
SPY: {
|
|
2397
|
+
symbol: "SPY",
|
|
2398
|
+
name: "SPDR S&P 500 ETF Trust",
|
|
2399
|
+
decimals: 7,
|
|
2400
|
+
address: "CD3ZMWOS4PZS2RQITEHBOTS27DTDP4QKOK7IEO5IB64GQKHRJYTVL3SW",
|
|
2401
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2402
|
+
hubAsset: "0x31FBa56e8b2e539B2f295fD35d76Fa0AE4f9d4DE",
|
|
2403
|
+
vault: SodaTokens.SPY.address
|
|
2404
|
+
},
|
|
2405
|
+
QQQ: {
|
|
2406
|
+
symbol: "QQQ",
|
|
2407
|
+
name: "Invesco QQQ Trust",
|
|
2408
|
+
decimals: 7,
|
|
2409
|
+
address: "CC7DQX43J2KBK5MJACQWTNHENIYB5GUVCFXGDKQWDLUWA4VKLOOU5PWB",
|
|
2410
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2411
|
+
hubAsset: "0xbf6d4C1C71A7E0Df2e5a9AE4b10d7488fb1A09D3",
|
|
2412
|
+
vault: SodaTokens.QQQ.address
|
|
2413
|
+
},
|
|
2414
|
+
SGOV: {
|
|
2415
|
+
symbol: "SGOV",
|
|
2416
|
+
name: "iShares 0-3 Month Treasury Bond ETF",
|
|
2417
|
+
decimals: 7,
|
|
2418
|
+
address: "CBQMRO2JTUJ6NXVBQ3XGJV34PDTXR34DD74TLLRCW5SV2CV2NN2VDMLH",
|
|
2419
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2420
|
+
hubAsset: "0xFB92b29Cf80Fb600fe8C51B0f0e932529C1509dF",
|
|
2421
|
+
vault: SodaTokens.SGOV.address
|
|
2422
|
+
},
|
|
2423
|
+
USO: {
|
|
2424
|
+
symbol: "USO",
|
|
2425
|
+
name: "United States Oil Fund LP",
|
|
2426
|
+
decimals: 7,
|
|
2427
|
+
address: "CCFRCTIW5EK2OK626V6C4YRTJCKACIRDI2GHOKWM57ZXACK2ZTWWWLC7",
|
|
2428
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2429
|
+
hubAsset: "0xa9f388938Eb8956BDe9fE047885a175e38Fa90C1",
|
|
2430
|
+
vault: SodaTokens.USO.address
|
|
2431
|
+
},
|
|
2432
|
+
SLV: {
|
|
2433
|
+
symbol: "SLV",
|
|
2434
|
+
name: "iShares Silver Trust",
|
|
2435
|
+
decimals: 7,
|
|
2436
|
+
address: "CBY3U32O5T2B555HNJLX6C6HW3O2FLRSJGH472UOOHT6H6ZMGMSSZTLW",
|
|
2437
|
+
chainKey: ChainKeys.STELLAR_MAINNET,
|
|
2438
|
+
hubAsset: "0x7eaF987431ce072feBEB2124fEB4d1cEf8Cf4e2e",
|
|
2439
|
+
vault: SodaTokens.SLV.address
|
|
2184
2440
|
}
|
|
2185
2441
|
};
|
|
2186
2442
|
var suiSupportedTokens = {
|
|
@@ -2853,6 +3109,123 @@ var hederaSupportedTokens = {
|
|
|
2853
3109
|
chainKey: ChainKeys.HEDERA_MAINNET,
|
|
2854
3110
|
hubAsset: "0xce6260224897fe05aad4b00df6cf9d318fe4ae23",
|
|
2855
3111
|
vault: SodaTokens.sodaXLM.address
|
|
3112
|
+
},
|
|
3113
|
+
SPCX: {
|
|
3114
|
+
symbol: "SPCX",
|
|
3115
|
+
name: "SpaceX Class A",
|
|
3116
|
+
decimals: 8,
|
|
3117
|
+
address: "0x0000000000000000000000000000000000a5669e",
|
|
3118
|
+
chainKey: ChainKeys.HEDERA_MAINNET,
|
|
3119
|
+
hubAsset: "0x5b31b616600531e80e28d266526D8d2F4dB2B46c",
|
|
3120
|
+
vault: SodaTokens.SPCX.address
|
|
3121
|
+
},
|
|
3122
|
+
NVDA: {
|
|
3123
|
+
symbol: "NVDA",
|
|
3124
|
+
name: "NVIDIA",
|
|
3125
|
+
decimals: 8,
|
|
3126
|
+
address: "0x0000000000000000000000000000000000a5669f",
|
|
3127
|
+
chainKey: ChainKeys.HEDERA_MAINNET,
|
|
3128
|
+
hubAsset: "0xfef4B7437485062D07EfdC46C667163E4beaa451",
|
|
3129
|
+
vault: SodaTokens.NVDA.address
|
|
3130
|
+
},
|
|
3131
|
+
GME: {
|
|
3132
|
+
symbol: "GME",
|
|
3133
|
+
name: "GameStop",
|
|
3134
|
+
decimals: 8,
|
|
3135
|
+
address: "0x0000000000000000000000000000000000a567d9",
|
|
3136
|
+
chainKey: ChainKeys.HEDERA_MAINNET,
|
|
3137
|
+
hubAsset: "0x074B3035D7046D5f75Dfc8e2aD1848a915BD308E",
|
|
3138
|
+
vault: SodaTokens.GME.address
|
|
3139
|
+
},
|
|
3140
|
+
MSTR: {
|
|
3141
|
+
symbol: "MSTR",
|
|
3142
|
+
name: "Strategy",
|
|
3143
|
+
decimals: 8,
|
|
3144
|
+
address: "0x0000000000000000000000000000000000a567e0",
|
|
3145
|
+
chainKey: ChainKeys.HEDERA_MAINNET,
|
|
3146
|
+
hubAsset: "0xa8b6f37FDc7D084A6C2530cc1De597ccEC526570",
|
|
3147
|
+
vault: SodaTokens.MSTR.address
|
|
3148
|
+
},
|
|
3149
|
+
AAPL: {
|
|
3150
|
+
symbol: "AAPL",
|
|
3151
|
+
name: "Apple",
|
|
3152
|
+
decimals: 8,
|
|
3153
|
+
address: "0x0000000000000000000000000000000000a567e1",
|
|
3154
|
+
chainKey: ChainKeys.HEDERA_MAINNET,
|
|
3155
|
+
hubAsset: "0xFDFf1e1Bec68fC9c75A2c89474C848A31Be49242",
|
|
3156
|
+
vault: SodaTokens.AAPL.address
|
|
3157
|
+
},
|
|
3158
|
+
TSLA: {
|
|
3159
|
+
symbol: "TSLA",
|
|
3160
|
+
name: "Tesla",
|
|
3161
|
+
decimals: 8,
|
|
3162
|
+
address: "0x0000000000000000000000000000000000a567e2",
|
|
3163
|
+
chainKey: ChainKeys.HEDERA_MAINNET,
|
|
3164
|
+
hubAsset: "0x1ff47B26bfd9019671f543E6dd8c61b06f1358b4",
|
|
3165
|
+
vault: SodaTokens.TSLA.address
|
|
3166
|
+
},
|
|
3167
|
+
MU: {
|
|
3168
|
+
symbol: "MU",
|
|
3169
|
+
name: "Micron",
|
|
3170
|
+
decimals: 8,
|
|
3171
|
+
address: "0x0000000000000000000000000000000000a567e3",
|
|
3172
|
+
chainKey: ChainKeys.HEDERA_MAINNET,
|
|
3173
|
+
hubAsset: "0x3b94E6d81FA505F20dda3cC25A18b80E921b8580",
|
|
3174
|
+
vault: SodaTokens.MU.address
|
|
3175
|
+
},
|
|
3176
|
+
SNDK: {
|
|
3177
|
+
symbol: "SNDK",
|
|
3178
|
+
name: "SanDisk",
|
|
3179
|
+
decimals: 8,
|
|
3180
|
+
address: "0x0000000000000000000000000000000000a567e5",
|
|
3181
|
+
chainKey: ChainKeys.HEDERA_MAINNET,
|
|
3182
|
+
hubAsset: "0x2D27112f45275F3B6B00A2a8A1434CA0E36488Ef",
|
|
3183
|
+
vault: SodaTokens.SNDK.address
|
|
3184
|
+
},
|
|
3185
|
+
SPY: {
|
|
3186
|
+
symbol: "SPY",
|
|
3187
|
+
name: "SPDR S&P 500 ETF Trust",
|
|
3188
|
+
decimals: 8,
|
|
3189
|
+
address: "0x0000000000000000000000000000000000a567e7",
|
|
3190
|
+
chainKey: ChainKeys.HEDERA_MAINNET,
|
|
3191
|
+
hubAsset: "0x555f6A769C3c20E8Ec3e77a2DD61c774997Bf9Eb",
|
|
3192
|
+
vault: SodaTokens.SPY.address
|
|
3193
|
+
},
|
|
3194
|
+
QQQ: {
|
|
3195
|
+
symbol: "QQQ",
|
|
3196
|
+
name: "Invesco QQQ Trust",
|
|
3197
|
+
decimals: 8,
|
|
3198
|
+
address: "0x0000000000000000000000000000000000a567ea",
|
|
3199
|
+
chainKey: ChainKeys.HEDERA_MAINNET,
|
|
3200
|
+
hubAsset: "0x49E76ce05878B1eCaAaA8683eA6C9773862F7F6C",
|
|
3201
|
+
vault: SodaTokens.QQQ.address
|
|
3202
|
+
},
|
|
3203
|
+
SGOV: {
|
|
3204
|
+
symbol: "SGOV",
|
|
3205
|
+
name: "iShares 0-3 Month Treasury Bond ETF",
|
|
3206
|
+
decimals: 8,
|
|
3207
|
+
address: "0x0000000000000000000000000000000000a567ec",
|
|
3208
|
+
chainKey: ChainKeys.HEDERA_MAINNET,
|
|
3209
|
+
hubAsset: "0x7E0b366d53B9f45aB02048DAD426bec55c36181C",
|
|
3210
|
+
vault: SodaTokens.SGOV.address
|
|
3211
|
+
},
|
|
3212
|
+
USO: {
|
|
3213
|
+
symbol: "USO",
|
|
3214
|
+
name: "United States Oil Fund LP",
|
|
3215
|
+
decimals: 8,
|
|
3216
|
+
address: "0x0000000000000000000000000000000000a567ed",
|
|
3217
|
+
chainKey: ChainKeys.HEDERA_MAINNET,
|
|
3218
|
+
hubAsset: "0x7bbd99721639c5862B16E109eE9Ae1f14C50B5f8",
|
|
3219
|
+
vault: SodaTokens.USO.address
|
|
3220
|
+
},
|
|
3221
|
+
SLV: {
|
|
3222
|
+
symbol: "SLV",
|
|
3223
|
+
name: "iShares Silver Trust",
|
|
3224
|
+
decimals: 8,
|
|
3225
|
+
address: "0x0000000000000000000000000000000000a567f2",
|
|
3226
|
+
chainKey: ChainKeys.HEDERA_MAINNET,
|
|
3227
|
+
hubAsset: "0x914672C5336f5E00126e431368005f7C22aCe952",
|
|
3228
|
+
vault: SodaTokens.SLV.address
|
|
2856
3229
|
}
|
|
2857
3230
|
};
|
|
2858
3231
|
var robinhoodSupportedTokens = {
|
|
@@ -2891,6 +3264,128 @@ var robinhoodSupportedTokens = {
|
|
|
2891
3264
|
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
2892
3265
|
hubAsset: "0xb2e81dddffcc9e49e9c9ded644091dfecf4ff4e7",
|
|
2893
3266
|
vault: SodaTokens.sodaUSDC.address
|
|
3267
|
+
},
|
|
3268
|
+
// Tokenized stocks, ETFs and commodity ETPs — Robinhood's own "<Company> •
|
|
3269
|
+
// Robinhood Token" product. No dedicated Sonic vault exists for any of these
|
|
3270
|
+
// yet, so `vault` mirrors `hubAsset` (same convention as the Solana xStock
|
|
3271
|
+
// entries). DJT, GLD and RDDT are intentionally omitted — no Chainlink price
|
|
3272
|
+
// feed exists for them, so the solver cannot price or swap them.
|
|
3273
|
+
SPCX: {
|
|
3274
|
+
symbol: "SPCX",
|
|
3275
|
+
name: "SpaceX Class A",
|
|
3276
|
+
decimals: 18,
|
|
3277
|
+
address: "0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa",
|
|
3278
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
3279
|
+
hubAsset: "0x2676b346bea3a760fe5386014e51760b511f65fb",
|
|
3280
|
+
vault: SodaTokens.SPCX.address
|
|
3281
|
+
},
|
|
3282
|
+
NVDA: {
|
|
3283
|
+
symbol: "NVDA",
|
|
3284
|
+
name: "NVIDIA",
|
|
3285
|
+
decimals: 18,
|
|
3286
|
+
address: "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC",
|
|
3287
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
3288
|
+
hubAsset: "0xa754bf15f0289b539aae5ce1a453e28898b7704e",
|
|
3289
|
+
vault: SodaTokens.NVDA.address
|
|
3290
|
+
},
|
|
3291
|
+
GME: {
|
|
3292
|
+
symbol: "GME",
|
|
3293
|
+
name: "GameStop",
|
|
3294
|
+
decimals: 18,
|
|
3295
|
+
address: "0x1b0E319c6A659F002271B69dB8A7df2F911c153E",
|
|
3296
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
3297
|
+
hubAsset: "0x9f9a7d7283a897b2d4b16eb6dd07faa40fead168",
|
|
3298
|
+
vault: SodaTokens.GME.address
|
|
3299
|
+
},
|
|
3300
|
+
MSTR: {
|
|
3301
|
+
symbol: "MSTR",
|
|
3302
|
+
name: "Strategy",
|
|
3303
|
+
decimals: 18,
|
|
3304
|
+
address: "0xec262a75e413fAfD0dF80480274532C79D42da09",
|
|
3305
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
3306
|
+
hubAsset: "0x3dea14c781e6750e8524c47cb2a9becc1c63d599",
|
|
3307
|
+
vault: SodaTokens.MSTR.address
|
|
3308
|
+
},
|
|
3309
|
+
AAPL: {
|
|
3310
|
+
symbol: "AAPL",
|
|
3311
|
+
name: "Apple",
|
|
3312
|
+
decimals: 18,
|
|
3313
|
+
address: "0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9",
|
|
3314
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
3315
|
+
hubAsset: "0xf66a3327066c97c00915d5017262fb37d000a5df",
|
|
3316
|
+
vault: SodaTokens.AAPL.address
|
|
3317
|
+
},
|
|
3318
|
+
TSLA: {
|
|
3319
|
+
symbol: "TSLA",
|
|
3320
|
+
name: "Tesla",
|
|
3321
|
+
decimals: 18,
|
|
3322
|
+
address: "0x322F0929c4625eD5bAd873c95208D54E1c003b2d",
|
|
3323
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
3324
|
+
hubAsset: "0x22bd6dc64fca01887818b5c701bf3f8cc5679461",
|
|
3325
|
+
vault: SodaTokens.TSLA.address
|
|
3326
|
+
},
|
|
3327
|
+
MU: {
|
|
3328
|
+
symbol: "MU",
|
|
3329
|
+
name: "Micron",
|
|
3330
|
+
decimals: 18,
|
|
3331
|
+
address: "0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD",
|
|
3332
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
3333
|
+
hubAsset: "0xab01212d77d27b1098bf64b812300f81e1448f37",
|
|
3334
|
+
vault: SodaTokens.MU.address
|
|
3335
|
+
},
|
|
3336
|
+
SNDK: {
|
|
3337
|
+
symbol: "SNDK",
|
|
3338
|
+
name: "SanDisk",
|
|
3339
|
+
decimals: 18,
|
|
3340
|
+
address: "0xB90A19fF0Af67f7779afF50A882A9CfF42446400",
|
|
3341
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
3342
|
+
hubAsset: "0xc30bf06eafff781cddb65b3bd337a214be9ff7f7",
|
|
3343
|
+
vault: SodaTokens.SNDK.address
|
|
3344
|
+
},
|
|
3345
|
+
SPY: {
|
|
3346
|
+
symbol: "SPY",
|
|
3347
|
+
name: "SPDR S&P 500 ETF Trust",
|
|
3348
|
+
decimals: 18,
|
|
3349
|
+
address: "0x117cc2133c37B721F49dE2A7a74833232B3B4C0C",
|
|
3350
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
3351
|
+
hubAsset: "0x6ec91122458067b436c84bd8c0be5d8cd5f222e8",
|
|
3352
|
+
vault: SodaTokens.SPY.address
|
|
3353
|
+
},
|
|
3354
|
+
QQQ: {
|
|
3355
|
+
symbol: "QQQ",
|
|
3356
|
+
name: "Invesco QQQ Trust",
|
|
3357
|
+
decimals: 18,
|
|
3358
|
+
address: "0xD5f3879160bc7c32ebb4dC785F8a4F505888de68",
|
|
3359
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
3360
|
+
hubAsset: "0xb3b0b8ae18c34545d8e0234d3e4ba86db46eca5b",
|
|
3361
|
+
vault: SodaTokens.QQQ.address
|
|
3362
|
+
},
|
|
3363
|
+
SGOV: {
|
|
3364
|
+
symbol: "SGOV",
|
|
3365
|
+
name: "iShares 0-3 Month Treasury Bond ETF",
|
|
3366
|
+
decimals: 18,
|
|
3367
|
+
address: "0x92FD66527192E3e61d4DDd13322Aa222DE86F9B5",
|
|
3368
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
3369
|
+
hubAsset: "0x8f33dbcbdc6572adb8b030508a02b599380f3cc7",
|
|
3370
|
+
vault: SodaTokens.SGOV.address
|
|
3371
|
+
},
|
|
3372
|
+
USO: {
|
|
3373
|
+
symbol: "USO",
|
|
3374
|
+
name: "United States Oil Fund LP",
|
|
3375
|
+
decimals: 18,
|
|
3376
|
+
address: "0xa30FA36Db767ad9eD3f7a60fC79526fB4d56D344",
|
|
3377
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
3378
|
+
hubAsset: "0x9c188579ba2ed2e8ea15e5f53392820add3af9ce",
|
|
3379
|
+
vault: SodaTokens.USO.address
|
|
3380
|
+
},
|
|
3381
|
+
SLV: {
|
|
3382
|
+
symbol: "SLV",
|
|
3383
|
+
name: "iShares Silver Trust",
|
|
3384
|
+
decimals: 18,
|
|
3385
|
+
address: "0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f",
|
|
3386
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
3387
|
+
hubAsset: "0x17348849806c8b1b5d1d3abbcb527d05d21d09d5",
|
|
3388
|
+
vault: SodaTokens.SLV.address
|
|
2894
3389
|
}
|
|
2895
3390
|
};
|
|
2896
3391
|
var stacksSupportedTokens = {
|
|
@@ -3645,6 +4140,71 @@ var spokeChainConfig = {
|
|
|
3645
4140
|
assetCode: "USDS",
|
|
3646
4141
|
contractId: "CC552JLYIJROE24VZFSMO7GBKQOOIQ6R52E3VQSQYC7NMFYAVMC7GQHS",
|
|
3647
4142
|
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
4143
|
+
},
|
|
4144
|
+
{
|
|
4145
|
+
assetCode: "SPCX",
|
|
4146
|
+
contractId: "CAI4HHAYO57QICZOZ4JF7R66RLGJRD7BGTX7H6MILCITVEYYEFRYFISK",
|
|
4147
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
4148
|
+
},
|
|
4149
|
+
{
|
|
4150
|
+
assetCode: "NVDA",
|
|
4151
|
+
contractId: "CCQFCT4FHJURUQ4RQA4NHYW5GQRHCBDXF33ADXZRTDTDVGKOJO3ZPEMY",
|
|
4152
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
4153
|
+
},
|
|
4154
|
+
{
|
|
4155
|
+
assetCode: "GME",
|
|
4156
|
+
contractId: "CAPSLSLCTFOZM22SUIPQENMM54T24GTDRHZ5STYAO6EYMK5GGGYVKWBX",
|
|
4157
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
4158
|
+
},
|
|
4159
|
+
{
|
|
4160
|
+
assetCode: "MSTR",
|
|
4161
|
+
contractId: "CAFQQXZSECLJNU76OS2OKLJQJBQHYJCVAYZJ4KGEN7VHXH5BTGNLVQND",
|
|
4162
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
4163
|
+
},
|
|
4164
|
+
{
|
|
4165
|
+
assetCode: "AAPL",
|
|
4166
|
+
contractId: "CAZSFDNSSR2RKJ2LIIB2Y4G4WOSYYKC4646EUJ63PQLDDHOVQYZ4HDTK",
|
|
4167
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
4168
|
+
},
|
|
4169
|
+
{
|
|
4170
|
+
assetCode: "TSLA",
|
|
4171
|
+
contractId: "CARLFQDI2S2FSYFB47AZLKGUFZVGBEUVNW77SCJHHHGL2KPGT3TN5PAB",
|
|
4172
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
4173
|
+
},
|
|
4174
|
+
{
|
|
4175
|
+
assetCode: "MU",
|
|
4176
|
+
contractId: "CBPTKA32BTUEX4VFAER6AUFWQZCWJKQAMLV2PMFFN7EHLGLJN4JWIZ3F",
|
|
4177
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
4178
|
+
},
|
|
4179
|
+
{
|
|
4180
|
+
assetCode: "SNDK",
|
|
4181
|
+
contractId: "CDXNTHFMGQM33UGQBSLZI3BV5UWW62QGZLCEKOXJKMFN2W3KQZKE3LTQ",
|
|
4182
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
4183
|
+
},
|
|
4184
|
+
{
|
|
4185
|
+
assetCode: "SPY",
|
|
4186
|
+
contractId: "CD3ZMWOS4PZS2RQITEHBOTS27DTDP4QKOK7IEO5IB64GQKHRJYTVL3SW",
|
|
4187
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
4188
|
+
},
|
|
4189
|
+
{
|
|
4190
|
+
assetCode: "QQQ",
|
|
4191
|
+
contractId: "CC7DQX43J2KBK5MJACQWTNHENIYB5GUVCFXGDKQWDLUWA4VKLOOU5PWB",
|
|
4192
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
4193
|
+
},
|
|
4194
|
+
{
|
|
4195
|
+
assetCode: "SGOV",
|
|
4196
|
+
contractId: "CBQMRO2JTUJ6NXVBQ3XGJV34PDTXR34DD74TLLRCW5SV2CV2NN2VDMLH",
|
|
4197
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
4198
|
+
},
|
|
4199
|
+
{
|
|
4200
|
+
assetCode: "USO",
|
|
4201
|
+
contractId: "CCFRCTIW5EK2OK626V6C4YRTJCKACIRDI2GHOKWM57ZXACK2ZTWWWLC7",
|
|
4202
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
4203
|
+
},
|
|
4204
|
+
{
|
|
4205
|
+
assetCode: "SLV",
|
|
4206
|
+
contractId: "CBY3U32O5T2B555HNJLX6C6HW3O2FLRSJGH472UOOHT6H6ZMGMSSZTLW",
|
|
4207
|
+
assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
|
|
3648
4208
|
}
|
|
3649
4209
|
],
|
|
3650
4210
|
supportedTokens: stellarSupportedTokens,
|
|
@@ -3845,7 +4405,7 @@ var DEFAULT_BACKEND_API_HEADERS = {
|
|
|
3845
4405
|
"Content-Type": "application/json",
|
|
3846
4406
|
Accept: "application/json"
|
|
3847
4407
|
};
|
|
3848
|
-
var DEFAULT_RELAYER_API_ENDPOINT = "https://
|
|
4408
|
+
var DEFAULT_RELAYER_API_ENDPOINT = "https://api.sodax.com/v1/relay";
|
|
3849
4409
|
var VAULT_TOKEN_DECIMALS = 18;
|
|
3850
4410
|
var DEFAULT_SPONSORING_API_ENDPOINT = "https://api.sodax.com/v1";
|
|
3851
4411
|
var SPONSORING_API_STELLAR_BASE_PATH = "/sponsorships/stellar";
|
|
@@ -3866,6 +4426,37 @@ var relayConfig = {
|
|
|
3866
4426
|
};
|
|
3867
4427
|
|
|
3868
4428
|
// ../types/dist/moneyMarket/moneyMarket.js
|
|
4429
|
+
var moneyMarketHubVaults = [
|
|
4430
|
+
SodaTokens.sodaBNB,
|
|
4431
|
+
SodaTokens.sodaAVAX,
|
|
4432
|
+
SodaTokens.sodaETH,
|
|
4433
|
+
SodaTokens.sodaBTC,
|
|
4434
|
+
SodaTokens.sodaWBTC,
|
|
4435
|
+
SodaTokens.sodaSOL,
|
|
4436
|
+
SodaTokens.sodaXLM,
|
|
4437
|
+
SodaTokens.sodaINJ,
|
|
4438
|
+
SodaTokens.sodaSUI,
|
|
4439
|
+
SodaTokens.bnUSD,
|
|
4440
|
+
SodaTokens.sodaUSDC,
|
|
4441
|
+
SodaTokens.sodaUSDT,
|
|
4442
|
+
SodaTokens.IbnUSD,
|
|
4443
|
+
SodaTokens.sodaS,
|
|
4444
|
+
SodaTokens.sodaPOL,
|
|
4445
|
+
SodaTokens.sodaSODA,
|
|
4446
|
+
SodaTokens.sodaHYPE,
|
|
4447
|
+
SodaTokens.sodaRBNT,
|
|
4448
|
+
SodaTokens.sodaLL,
|
|
4449
|
+
SodaTokens.sodaWEETH,
|
|
4450
|
+
SodaTokens.sodaWSTETH,
|
|
4451
|
+
SodaTokens.sodaNEAR,
|
|
4452
|
+
SodaTokens.sodaKAIA,
|
|
4453
|
+
SodaTokens.sodaSTX,
|
|
4454
|
+
SodaTokens.sodaSUSDS,
|
|
4455
|
+
SodaTokens.sodaHBAR,
|
|
4456
|
+
SodaTokens.sodaJITOSOL,
|
|
4457
|
+
SodaTokens.sodaUSDS,
|
|
4458
|
+
SodaTokens.sodaUSSD
|
|
4459
|
+
];
|
|
3869
4460
|
var moneyMarketSupportedTokens = {
|
|
3870
4461
|
[ChainKeys.AVALANCHE_MAINNET]: [
|
|
3871
4462
|
spokeChainConfig[ChainKeys.AVALANCHE_MAINNET].supportedTokens.AVAX,
|
|
@@ -4008,7 +4599,7 @@ var moneyMarketSupportedTokens = {
|
|
|
4008
4599
|
spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.wS,
|
|
4009
4600
|
spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.SODA,
|
|
4010
4601
|
spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.USSD,
|
|
4011
|
-
...
|
|
4602
|
+
...moneyMarketHubVaults
|
|
4012
4603
|
],
|
|
4013
4604
|
[ChainKeys.NEAR_MAINNET]: [
|
|
4014
4605
|
spokeChainConfig[ChainKeys.NEAR_MAINNET].supportedTokens.NEAR,
|
|
@@ -4088,7 +4679,7 @@ var moneyMarketSupportedTokens = {
|
|
|
4088
4679
|
]
|
|
4089
4680
|
};
|
|
4090
4681
|
var moneyMarketReserveAssets = [
|
|
4091
|
-
...
|
|
4682
|
+
...moneyMarketHubVaults.map((vault) => vault.address),
|
|
4092
4683
|
hubConfig.bnUSD
|
|
4093
4684
|
];
|
|
4094
4685
|
var moneyMarketConfig = {
|
|
@@ -4262,9 +4853,49 @@ var swapSupportedTokens = {
|
|
|
4262
4853
|
spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.wS,
|
|
4263
4854
|
spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.SODA,
|
|
4264
4855
|
// spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.USSD, // NOTE: Not Implemented
|
|
4265
|
-
//
|
|
4266
|
-
|
|
4267
|
-
|
|
4856
|
+
// Swap membership is per-vault, not every SodaTokens entry: sodaSUSDS is staging-only,
|
|
4857
|
+
// and sodaUSDS / sodaUSSD are parked until the solver fills them.
|
|
4858
|
+
SodaTokens.sodaBNB,
|
|
4859
|
+
SodaTokens.sodaAVAX,
|
|
4860
|
+
SodaTokens.sodaETH,
|
|
4861
|
+
SodaTokens.sodaBTC,
|
|
4862
|
+
SodaTokens.sodaWBTC,
|
|
4863
|
+
SodaTokens.sodaSOL,
|
|
4864
|
+
SodaTokens.sodaXLM,
|
|
4865
|
+
SodaTokens.sodaINJ,
|
|
4866
|
+
SodaTokens.sodaSUI,
|
|
4867
|
+
SodaTokens.bnUSD,
|
|
4868
|
+
SodaTokens.sodaUSDC,
|
|
4869
|
+
SodaTokens.sodaUSDT,
|
|
4870
|
+
SodaTokens.IbnUSD,
|
|
4871
|
+
SodaTokens.sodaS,
|
|
4872
|
+
SodaTokens.sodaPOL,
|
|
4873
|
+
SodaTokens.sodaSODA,
|
|
4874
|
+
SodaTokens.sodaHYPE,
|
|
4875
|
+
SodaTokens.sodaRBNT,
|
|
4876
|
+
SodaTokens.sodaLL,
|
|
4877
|
+
SodaTokens.sodaWEETH,
|
|
4878
|
+
SodaTokens.sodaWSTETH,
|
|
4879
|
+
SodaTokens.sodaNEAR,
|
|
4880
|
+
SodaTokens.sodaKAIA,
|
|
4881
|
+
SodaTokens.sodaSTX,
|
|
4882
|
+
SodaTokens.sodaHBAR,
|
|
4883
|
+
SodaTokens.sodaJITOSOL,
|
|
4884
|
+
...Object.values(LsodaTokens),
|
|
4885
|
+
// Robinhood tokenized equities — swap-only, deliberately absent from the money market.
|
|
4886
|
+
SodaTokens.SPCX,
|
|
4887
|
+
SodaTokens.NVDA,
|
|
4888
|
+
SodaTokens.GME,
|
|
4889
|
+
SodaTokens.MSTR,
|
|
4890
|
+
SodaTokens.AAPL,
|
|
4891
|
+
SodaTokens.TSLA,
|
|
4892
|
+
SodaTokens.MU,
|
|
4893
|
+
SodaTokens.SNDK,
|
|
4894
|
+
SodaTokens.SPY,
|
|
4895
|
+
SodaTokens.QQQ,
|
|
4896
|
+
SodaTokens.SGOV,
|
|
4897
|
+
SodaTokens.USO,
|
|
4898
|
+
SodaTokens.SLV
|
|
4268
4899
|
],
|
|
4269
4900
|
[ChainKeys.AVALANCHE_MAINNET]: [
|
|
4270
4901
|
spokeChainConfig[ChainKeys.AVALANCHE_MAINNET].supportedTokens.AVAX,
|
|
@@ -4423,7 +5054,20 @@ var swapSupportedTokens = {
|
|
|
4423
5054
|
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.HYPE,
|
|
4424
5055
|
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.NEAR,
|
|
4425
5056
|
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.HBAR,
|
|
4426
|
-
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.USDS
|
|
5057
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.USDS,
|
|
5058
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.SPCX,
|
|
5059
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.NVDA,
|
|
5060
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.GME,
|
|
5061
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.MSTR,
|
|
5062
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.AAPL,
|
|
5063
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.TSLA,
|
|
5064
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.MU,
|
|
5065
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.SNDK,
|
|
5066
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.SPY,
|
|
5067
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.QQQ,
|
|
5068
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.SGOV,
|
|
5069
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.USO,
|
|
5070
|
+
spokeChainConfig[ChainKeys.STELLAR_MAINNET].supportedTokens.SLV
|
|
4427
5071
|
],
|
|
4428
5072
|
[ChainKeys.SUI_MAINNET]: [
|
|
4429
5073
|
spokeChainConfig[ChainKeys.SUI_MAINNET].supportedTokens.SUI,
|
|
@@ -4529,13 +5173,41 @@ var swapSupportedTokens = {
|
|
|
4529
5173
|
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.HYPE,
|
|
4530
5174
|
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.NEAR,
|
|
4531
5175
|
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.USDS,
|
|
4532
|
-
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.XLM
|
|
5176
|
+
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.XLM,
|
|
5177
|
+
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.SPCX,
|
|
5178
|
+
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.NVDA,
|
|
5179
|
+
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.GME,
|
|
5180
|
+
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.MSTR,
|
|
5181
|
+
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.AAPL,
|
|
5182
|
+
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.TSLA,
|
|
5183
|
+
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.MU,
|
|
5184
|
+
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.SNDK,
|
|
5185
|
+
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.SPY,
|
|
5186
|
+
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.QQQ,
|
|
5187
|
+
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.SGOV,
|
|
5188
|
+
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.USO,
|
|
5189
|
+
spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.SLV
|
|
4533
5190
|
],
|
|
4534
5191
|
[ChainKeys.ROBINHOOD_MAINNET]: [
|
|
4535
5192
|
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.ETH,
|
|
4536
5193
|
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.bnUSD,
|
|
4537
5194
|
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.SODA,
|
|
4538
|
-
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.USDG
|
|
5195
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.USDG,
|
|
5196
|
+
// Tokenized equities / ETFs — oracle-priced only, so DJT, GLD and RDDT are excluded
|
|
5197
|
+
// (no Chainlink feed). Production membership is what the staging union reads too.
|
|
5198
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.SPCX,
|
|
5199
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.NVDA,
|
|
5200
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.GME,
|
|
5201
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.MSTR,
|
|
5202
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.AAPL,
|
|
5203
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.TSLA,
|
|
5204
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.MU,
|
|
5205
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.SNDK,
|
|
5206
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.SPY,
|
|
5207
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.QQQ,
|
|
5208
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.SGOV,
|
|
5209
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.USO,
|
|
5210
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.SLV
|
|
4539
5211
|
]
|
|
4540
5212
|
};
|
|
4541
5213
|
var stagingSwapSupportedTokens = {
|
|
@@ -4628,6 +5300,21 @@ var leverageYieldVaults = [
|
|
|
4628
5300
|
fallbackAprPct: 5.5,
|
|
4629
5301
|
label: "Jito (JitoSOL)"
|
|
4630
5302
|
}
|
|
5303
|
+
},
|
|
5304
|
+
{
|
|
5305
|
+
name: LsodaTokens.lsodaSUSDS.symbol,
|
|
5306
|
+
vault: LsodaTokens.lsodaSUSDS.vault,
|
|
5307
|
+
asset: SodaTokens.sodaSUSDS.address,
|
|
5308
|
+
// sodaSUSDS (sUSDS) on Sonic — eMode-3 collateral
|
|
5309
|
+
borrowToken: SodaTokens.sodaUSSD.address,
|
|
5310
|
+
// sodaUSSD (USSD) on Sonic — eMode-3 borrowable
|
|
5311
|
+
lsdSource: {
|
|
5312
|
+
// DefiLlama pool for the Sky Savings Rate on sUSDS (project: 'sky-lending', Ethereum).
|
|
5313
|
+
// sUSDS appreciates against USDS at the SSR — yield AAVE's currentLiquidityRate omits.
|
|
5314
|
+
poolId: "d8c4eff5-c8a9-46fc-a888-057c4c668e72",
|
|
5315
|
+
fallbackAprPct: 3.5,
|
|
5316
|
+
label: "Sky (sUSDS)"
|
|
5317
|
+
}
|
|
4631
5318
|
}
|
|
4632
5319
|
];
|
|
4633
5320
|
var leverageYieldConfig = {
|
|
@@ -4864,7 +5551,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
|
|
|
4864
5551
|
}
|
|
4865
5552
|
|
|
4866
5553
|
// ../types/dist/index.js
|
|
4867
|
-
var CONFIG_VERSION =
|
|
5554
|
+
var CONFIG_VERSION = 234;
|
|
4868
5555
|
|
|
4869
5556
|
// src/shared/utils/resolveTimeoutMs.ts
|
|
4870
5557
|
function resolveTimeoutMs(timeout, fallbackMs) {
|
|
@@ -4877,6 +5564,33 @@ function isEvmSpokeChainConfig(value) {
|
|
|
4877
5564
|
function isIconAddress(value) {
|
|
4878
5565
|
return typeof value === "string" && /^hx[a-f0-9]{40}$|^cx[a-f0-9]{40}$/.test(value);
|
|
4879
5566
|
}
|
|
5567
|
+
var NEAR_ACCOUNT_ID_REGEX = /^(([a-z\d]+[-_])*[a-z\d]+\.)*([a-z\d]+[-_])*[a-z\d]+$/;
|
|
5568
|
+
function isValidNearAccountId(accountId) {
|
|
5569
|
+
return accountId.length >= 2 && accountId.length <= 64 && NEAR_ACCOUNT_ID_REGEX.test(accountId);
|
|
5570
|
+
}
|
|
5571
|
+
var INJECTIVE_ADDRESS_REGEX = /^inj1(?:[02-9ac-hj-np-z]{38}|[02-9ac-hj-np-z]{58})$/;
|
|
5572
|
+
var BECH32_CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
|
|
5573
|
+
var BECH32_GENERATOR = [996825010, 642813549, 513874426, 1027748829, 705979059];
|
|
5574
|
+
function bech32ChecksumVerifies(hrp, dataChars) {
|
|
5575
|
+
const values = [
|
|
5576
|
+
...[...hrp].map((c) => c.charCodeAt(0) >>> 5),
|
|
5577
|
+
0,
|
|
5578
|
+
...[...hrp].map((c) => c.charCodeAt(0) & 31),
|
|
5579
|
+
...[...dataChars].map((c) => BECH32_CHARSET.indexOf(c))
|
|
5580
|
+
];
|
|
5581
|
+
let chk = 1;
|
|
5582
|
+
for (const value of values) {
|
|
5583
|
+
const top = chk >>> 25;
|
|
5584
|
+
chk = (chk & 33554431) << 5 ^ value;
|
|
5585
|
+
for (let i = 0; i < 5; i++) {
|
|
5586
|
+
if (top >>> i & 1) chk ^= BECH32_GENERATOR[i];
|
|
5587
|
+
}
|
|
5588
|
+
}
|
|
5589
|
+
return chk === 1;
|
|
5590
|
+
}
|
|
5591
|
+
function isValidInjectiveAddress(address) {
|
|
5592
|
+
return INJECTIVE_ADDRESS_REGEX.test(address) && bech32ChecksumVerifies("inj", address.slice(4));
|
|
5593
|
+
}
|
|
4880
5594
|
function isResponseAddressType(value) {
|
|
4881
5595
|
return typeof value === "object" && value !== null && "type" in value && "payload" in value && value.type === "RESPONSE_ADDRESS" && isIconAddress(value.payload);
|
|
4882
5596
|
}
|
|
@@ -4984,6 +5698,81 @@ function isUndefinedOrValidWalletProviderForChainKey(chainKey, walletProvider) {
|
|
|
4984
5698
|
function isOptionalBitcoinWalletProviderType(walletProvider) {
|
|
4985
5699
|
return walletProvider === void 0 || isBitcoinWalletProviderType(walletProvider);
|
|
4986
5700
|
}
|
|
5701
|
+
var BITCOIN_FEE_SAFETY_VBYTES = 20;
|
|
5702
|
+
function calcOpReturnOutputVbytes(payloadByteLength) {
|
|
5703
|
+
let scriptSize;
|
|
5704
|
+
if (payloadByteLength <= 75) {
|
|
5705
|
+
scriptSize = 3 + payloadByteLength;
|
|
5706
|
+
} else if (payloadByteLength <= 255) {
|
|
5707
|
+
scriptSize = 4 + payloadByteLength;
|
|
5708
|
+
} else {
|
|
5709
|
+
scriptSize = 5 + payloadByteLength;
|
|
5710
|
+
}
|
|
5711
|
+
const scriptLenVarint = scriptSize <= 252 ? 1 : 3;
|
|
5712
|
+
return 8 + scriptLenVarint + scriptSize;
|
|
5713
|
+
}
|
|
5714
|
+
function estimateBitcoinTxSize(inputCount, outputCount, addressType, opReturnOutputVbytes = 44) {
|
|
5715
|
+
let inputWeight;
|
|
5716
|
+
switch (addressType) {
|
|
5717
|
+
case "P2PKH":
|
|
5718
|
+
inputWeight = 148;
|
|
5719
|
+
break;
|
|
5720
|
+
case "P2SH":
|
|
5721
|
+
inputWeight = 91;
|
|
5722
|
+
break;
|
|
5723
|
+
case "P2TR":
|
|
5724
|
+
inputWeight = 58;
|
|
5725
|
+
break;
|
|
5726
|
+
default:
|
|
5727
|
+
inputWeight = 68;
|
|
5728
|
+
break;
|
|
5729
|
+
}
|
|
5730
|
+
return Math.ceil(
|
|
5731
|
+
10.5 + opReturnOutputVbytes + BITCOIN_FEE_SAFETY_VBYTES + inputCount * inputWeight + outputCount * 31
|
|
5732
|
+
);
|
|
5733
|
+
}
|
|
5734
|
+
function encodeBtcPayloadToBytes(payload) {
|
|
5735
|
+
const isBase58Check = payload.address_type === "P2PKH" || payload.address_type === "P2SH";
|
|
5736
|
+
return JSON.stringify({
|
|
5737
|
+
src_address: isBase58Check ? payload.src_address : payload.src_address.toLowerCase(),
|
|
5738
|
+
data: payload.data.toLowerCase(),
|
|
5739
|
+
src_chain_id: payload.src_chain_id,
|
|
5740
|
+
dst_chain_id: payload.dst_chain_id,
|
|
5741
|
+
wallet_used: payload.wallet_used,
|
|
5742
|
+
timestamp: payload.timestamp,
|
|
5743
|
+
address_type: payload.address_type
|
|
5744
|
+
});
|
|
5745
|
+
}
|
|
5746
|
+
function isValidBitcoinAddress(address$1) {
|
|
5747
|
+
try {
|
|
5748
|
+
const { prefix: prefix2, version, data } = address.fromBech32(address$1);
|
|
5749
|
+
if (prefix2 !== "bc" && prefix2 !== "tb") return false;
|
|
5750
|
+
return version === 0 && (data.length === 20 || data.length === 32) || version === 1 && data.length === 32;
|
|
5751
|
+
} catch {
|
|
5752
|
+
}
|
|
5753
|
+
try {
|
|
5754
|
+
const { version } = address.fromBase58Check(address$1);
|
|
5755
|
+
return version === 0 || version === 5 || version === 111 || version === 196;
|
|
5756
|
+
} catch {
|
|
5757
|
+
return false;
|
|
5758
|
+
}
|
|
5759
|
+
}
|
|
5760
|
+
function canonicalizeBitcoinAddress(address$1) {
|
|
5761
|
+
try {
|
|
5762
|
+
address.fromBech32(address$1);
|
|
5763
|
+
return address$1.toLowerCase();
|
|
5764
|
+
} catch {
|
|
5765
|
+
return address$1;
|
|
5766
|
+
}
|
|
5767
|
+
}
|
|
5768
|
+
function normalizePsbtToBase64(signedPsbt) {
|
|
5769
|
+
const isHex2 = /^[0-9a-fA-F]+$/.test(signedPsbt);
|
|
5770
|
+
return isHex2 ? Buffer.from(signedPsbt, "hex").toString("base64") : signedPsbt;
|
|
5771
|
+
}
|
|
5772
|
+
function normalizeSignatureToBase64(signature) {
|
|
5773
|
+
const isHex2 = /^[0-9a-fA-F]+$/.test(signature);
|
|
5774
|
+
return isHex2 ? Buffer.from(signature, "hex").toString("base64") : signature;
|
|
5775
|
+
}
|
|
4987
5776
|
function isNativeBitcoinTransfer(config, chainKey, token) {
|
|
4988
5777
|
return isBitcoinChainKeyType(chainKey) && !!token && isNativeBitcoinToken(config.getChainConfig(chainKey), token.address);
|
|
4989
5778
|
}
|
|
@@ -5003,11 +5792,10 @@ async function retry(action, retryCount = DEFAULT_MAX_RETRY, delayMs = DEFAULT_R
|
|
|
5003
5792
|
throw new Error(`Retry exceeded MAX_RETRY_DEFAULT=${DEFAULT_MAX_RETRY}`);
|
|
5004
5793
|
}
|
|
5005
5794
|
function getRandomBytes(length) {
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
array3[i] = Math.floor(Math.random() * 256);
|
|
5795
|
+
if (!globalThis.crypto?.getRandomValues) {
|
|
5796
|
+
throw new Error("Web Crypto (crypto.getRandomValues) is unavailable in this runtime");
|
|
5009
5797
|
}
|
|
5010
|
-
return
|
|
5798
|
+
return globalThis.crypto.getRandomValues(new Uint8Array(length));
|
|
5011
5799
|
}
|
|
5012
5800
|
function randomUint256() {
|
|
5013
5801
|
const bytes = getRandomBytes(32);
|
|
@@ -5056,6 +5844,7 @@ function encodeAddress(spokeChainId, address) {
|
|
|
5056
5844
|
const chainType = getChainType(spokeChainId);
|
|
5057
5845
|
switch (chainType) {
|
|
5058
5846
|
case "EVM":
|
|
5847
|
+
invariant(isAddress(address), `Invalid EVM address: ${address}`);
|
|
5059
5848
|
return address;
|
|
5060
5849
|
case "ICON": {
|
|
5061
5850
|
invariant(isIconAddress(address), `Invalid ICON address: ${address}`);
|
|
@@ -5071,8 +5860,13 @@ function encodeAddress(spokeChainId, address) {
|
|
|
5071
5860
|
case "STACKS":
|
|
5072
5861
|
return `0x${serializeCV(Cl.principal(address))}`;
|
|
5073
5862
|
case "BITCOIN":
|
|
5863
|
+
invariant(isValidBitcoinAddress(address), `Invalid Bitcoin address: ${address}`);
|
|
5864
|
+
return toHex(Buffer.from(canonicalizeBitcoinAddress(address), "utf-8"));
|
|
5074
5865
|
case "NEAR":
|
|
5866
|
+
invariant(isValidNearAccountId(address), `Invalid NEAR account id: ${address}`);
|
|
5867
|
+
return toHex(Buffer.from(address, "utf-8"));
|
|
5075
5868
|
case "INJECTIVE":
|
|
5869
|
+
invariant(isValidInjectiveAddress(address), `Invalid Injective address: ${address}`);
|
|
5076
5870
|
return toHex(Buffer.from(address, "utf-8"));
|
|
5077
5871
|
default: {
|
|
5078
5872
|
const exhaustiveCheck = chainType;
|
|
@@ -5080,6 +5874,16 @@ function encodeAddress(spokeChainId, address) {
|
|
|
5080
5874
|
}
|
|
5081
5875
|
}
|
|
5082
5876
|
}
|
|
5877
|
+
function encodeTokenIdentifier(spokeChainId, token) {
|
|
5878
|
+
switch (getChainType(spokeChainId)) {
|
|
5879
|
+
case "BITCOIN":
|
|
5880
|
+
case "NEAR":
|
|
5881
|
+
case "INJECTIVE":
|
|
5882
|
+
return toHex(Buffer.from(token, "utf-8"));
|
|
5883
|
+
default:
|
|
5884
|
+
return encodeAddress(spokeChainId, token);
|
|
5885
|
+
}
|
|
5886
|
+
}
|
|
5083
5887
|
function reverseEncodeAddress(spokeChainId, encoded) {
|
|
5084
5888
|
const chainType = getChainType(spokeChainId);
|
|
5085
5889
|
switch (chainType) {
|
|
@@ -14779,6 +15583,11 @@ var ConfigService = class {
|
|
|
14779
15583
|
get bridgeUseBackendSubmitTx() {
|
|
14780
15584
|
return this.bridge.useBackendSubmitTx ?? this.sodax.bridgeOptions?.useBackendSubmitTx ?? true;
|
|
14781
15585
|
}
|
|
15586
|
+
// Opt-in (default OFF), unlike the swaps/bridge toggles above: the leverage-yield submit-tx
|
|
15587
|
+
// backend path is newer, so an omitted flag keeps the proven client-side relay.
|
|
15588
|
+
get leverageYieldUseBackendSubmitTx() {
|
|
15589
|
+
return this.leverageYield.useBackendSubmitTx ?? false;
|
|
15590
|
+
}
|
|
14782
15591
|
get dex() {
|
|
14783
15592
|
return this.sodax.dex;
|
|
14784
15593
|
}
|
|
@@ -14830,7 +15639,7 @@ function mergeSodaxConfig(base2, override) {
|
|
|
14830
15639
|
}
|
|
14831
15640
|
function encodeContractCalls(calls) {
|
|
14832
15641
|
return encodeAbiParameters(parseAbiParameters("(address,uint256,bytes)[]"), [
|
|
14833
|
-
calls.map((
|
|
15642
|
+
calls.map((v12) => [v12.address, v12.value, v12.data])
|
|
14834
15643
|
]);
|
|
14835
15644
|
}
|
|
14836
15645
|
async function waitForTransactionReceipt(hash, provider) {
|
|
@@ -15033,16 +15842,20 @@ var EvmVaultTokenService = class {
|
|
|
15033
15842
|
*/
|
|
15034
15843
|
static async deposit(vault, token, amount, walletProvider) {
|
|
15035
15844
|
const from = await walletProvider.getWalletAddress();
|
|
15036
|
-
return walletProvider.sendTransaction(
|
|
15037
|
-
|
|
15038
|
-
|
|
15039
|
-
|
|
15040
|
-
|
|
15041
|
-
|
|
15042
|
-
|
|
15043
|
-
|
|
15044
|
-
|
|
15045
|
-
|
|
15845
|
+
return walletProvider.sendTransaction(
|
|
15846
|
+
{
|
|
15847
|
+
from,
|
|
15848
|
+
to: vault,
|
|
15849
|
+
value: 0n,
|
|
15850
|
+
data: encodeFunctionData({
|
|
15851
|
+
abi: vaultTokenAbi,
|
|
15852
|
+
functionName: "deposit",
|
|
15853
|
+
args: [token, amount]
|
|
15854
|
+
})
|
|
15855
|
+
},
|
|
15856
|
+
// Vaults live on the hub; refuse to broadcast from a wallet on another EVM network.
|
|
15857
|
+
{ expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id }
|
|
15858
|
+
);
|
|
15046
15859
|
}
|
|
15047
15860
|
/**
|
|
15048
15861
|
* Withdraws a specified amount of a token from the vault.
|
|
@@ -15054,16 +15867,19 @@ var EvmVaultTokenService = class {
|
|
|
15054
15867
|
*/
|
|
15055
15868
|
static async withdraw(vault, token, amount, provider) {
|
|
15056
15869
|
const from = await provider.getWalletAddress();
|
|
15057
|
-
return provider.sendTransaction(
|
|
15058
|
-
|
|
15059
|
-
|
|
15060
|
-
|
|
15061
|
-
|
|
15062
|
-
|
|
15063
|
-
|
|
15064
|
-
|
|
15065
|
-
|
|
15066
|
-
|
|
15870
|
+
return provider.sendTransaction(
|
|
15871
|
+
{
|
|
15872
|
+
from,
|
|
15873
|
+
to: vault,
|
|
15874
|
+
value: 0n,
|
|
15875
|
+
data: encodeFunctionData({
|
|
15876
|
+
abi: vaultTokenAbi,
|
|
15877
|
+
functionName: "withdraw",
|
|
15878
|
+
args: [token, amount]
|
|
15879
|
+
})
|
|
15880
|
+
},
|
|
15881
|
+
{ expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id }
|
|
15882
|
+
);
|
|
15067
15883
|
}
|
|
15068
15884
|
/**
|
|
15069
15885
|
* Encodes the deposit transaction data for the vault.
|
|
@@ -15264,7 +16080,9 @@ var Erc20Service = class _Erc20Service {
|
|
|
15264
16080
|
if (params.raw) {
|
|
15265
16081
|
return rawTx;
|
|
15266
16082
|
}
|
|
15267
|
-
return await params.walletProvider.sendTransaction(rawTx
|
|
16083
|
+
return await params.walletProvider.sendTransaction(rawTx, {
|
|
16084
|
+
expectedChainId: params.expectedChainId
|
|
16085
|
+
});
|
|
15268
16086
|
}
|
|
15269
16087
|
/**
|
|
15270
16088
|
* Encodes a transfer transaction for a token.
|
|
@@ -15577,7 +16395,9 @@ var EvmSpokeService = class {
|
|
|
15577
16395
|
if (params.raw === true) {
|
|
15578
16396
|
return rawTx;
|
|
15579
16397
|
}
|
|
15580
|
-
return params.walletProvider.sendTransaction(rawTx
|
|
16398
|
+
return params.walletProvider.sendTransaction(rawTx, {
|
|
16399
|
+
expectedChainId: getEvmViemChain(srcChainKey).id
|
|
16400
|
+
});
|
|
15581
16401
|
}
|
|
15582
16402
|
/**
|
|
15583
16403
|
* Get the balance of the token deposited in the spoke chain asset manager.
|
|
@@ -15690,7 +16510,9 @@ var EvmSpokeService = class {
|
|
|
15690
16510
|
if (params.raw) {
|
|
15691
16511
|
return rawTx;
|
|
15692
16512
|
}
|
|
15693
|
-
return params.walletProvider.sendTransaction(rawTx
|
|
16513
|
+
return params.walletProvider.sendTransaction(rawTx, {
|
|
16514
|
+
expectedChainId: getEvmViemChain(srcChainKey).id
|
|
16515
|
+
});
|
|
15694
16516
|
}
|
|
15695
16517
|
async waitForTransactionReceipt(params) {
|
|
15696
16518
|
try {
|
|
@@ -15782,6 +16604,24 @@ var StacksSpokeService = class {
|
|
|
15782
16604
|
});
|
|
15783
16605
|
return result.value.value;
|
|
15784
16606
|
}
|
|
16607
|
+
ftAssetNames = /* @__PURE__ */ new Map();
|
|
16608
|
+
/** Post-conditions need the on-chain `define-fungible-token` names; SIP-10 exposes no read for them. */
|
|
16609
|
+
async getFtAssetNames(tokenContractId) {
|
|
16610
|
+
const cached = this.ftAssetNames.get(tokenContractId);
|
|
16611
|
+
if (cached) return cached;
|
|
16612
|
+
const [address, name] = parseContractId(tokenContractId);
|
|
16613
|
+
const response = await fetch(`${this.network.client.baseUrl}/v2/contracts/interface/${address}/${name}`);
|
|
16614
|
+
if (!response.ok) {
|
|
16615
|
+
throw new Error(`Failed to fetch the contract interface for ${tokenContractId}: ${response.statusText}`);
|
|
16616
|
+
}
|
|
16617
|
+
const abi = await response.json();
|
|
16618
|
+
const assetNames = (abi.fungible_tokens ?? []).map((token) => token.name);
|
|
16619
|
+
if (assetNames.length === 0) {
|
|
16620
|
+
throw new Error(`${tokenContractId} defines no fungible token \u2014 not a SIP-10 contract`);
|
|
16621
|
+
}
|
|
16622
|
+
this.ftAssetNames.set(tokenContractId, assetNames);
|
|
16623
|
+
return assetNames;
|
|
16624
|
+
}
|
|
15785
16625
|
async getImplContractAddress(stateContract) {
|
|
15786
16626
|
const [contractAddress, contractName] = parseContractId(stateContract);
|
|
15787
16627
|
const txParams = {
|
|
@@ -15804,18 +16644,18 @@ var StacksSpokeService = class {
|
|
|
15804
16644
|
const assetManagerImpl = await this.getImplContractAddress(chainConfig.addresses.assetManager);
|
|
15805
16645
|
const [implAddress, implName] = parseContractId(assetManagerImpl);
|
|
15806
16646
|
const [connectionAddress, connectionName] = parseContractId(chainConfig.addresses.connection);
|
|
16647
|
+
const isNative = isNativeToken(params.srcChainKey, params.token);
|
|
15807
16648
|
const reqData = {
|
|
15808
16649
|
contractAddress: implAddress,
|
|
15809
16650
|
contractName: implName,
|
|
15810
16651
|
functionName: "transfer",
|
|
15811
16652
|
functionArgs: [
|
|
15812
|
-
|
|
16653
|
+
isNative ? noneCV() : someCV(Cl.principal(params.token)),
|
|
15813
16654
|
Cl.bufferFromHex(params.to),
|
|
15814
16655
|
uintCV(params.amount),
|
|
15815
16656
|
Cl.bufferFromHex(params.data),
|
|
15816
16657
|
Cl.contractPrincipal(connectionAddress, connectionName)
|
|
15817
|
-
]
|
|
15818
|
-
postConditionMode: PostConditionMode.Allow
|
|
16658
|
+
]
|
|
15819
16659
|
};
|
|
15820
16660
|
if (params.raw === true) {
|
|
15821
16661
|
if (!params.srcPublicKey) {
|
|
@@ -15844,9 +16684,25 @@ var StacksSpokeService = class {
|
|
|
15844
16684
|
payload: bytesToHex(serializePayloadBytes(tx.payload))
|
|
15845
16685
|
};
|
|
15846
16686
|
}
|
|
15847
|
-
const txId = await params.walletProvider.sendTransaction(
|
|
16687
|
+
const txId = await params.walletProvider.sendTransaction({
|
|
16688
|
+
...reqData,
|
|
16689
|
+
postConditionMode: PostConditionMode.Deny,
|
|
16690
|
+
postConditions: await this.depositPostConditions(params.srcAddress, params.token, params.amount, isNative)
|
|
16691
|
+
});
|
|
15848
16692
|
return txId;
|
|
15849
16693
|
}
|
|
16694
|
+
/**
|
|
16695
|
+
* Caps for a Deny-mode deposit: asset-manager-state.deposit moves exactly `amount` from the
|
|
16696
|
+
* caller, so cap the sender at `amount` — one cap per FT the token contract defines (sBTC has
|
|
16697
|
+
* two; the unmoved ones pass at 0 trivially), or uSTX for native.
|
|
16698
|
+
*/
|
|
16699
|
+
async depositPostConditions(srcAddress, token, amount, isNative) {
|
|
16700
|
+
if (isNative) return [Pc.principal(srcAddress).willSendLte(amount).ustx()];
|
|
16701
|
+
const assetNames = await this.getFtAssetNames(token);
|
|
16702
|
+
return assetNames.map(
|
|
16703
|
+
(assetName) => Pc.principal(srcAddress).willSendLte(amount).ft(token, assetName)
|
|
16704
|
+
);
|
|
16705
|
+
}
|
|
15850
16706
|
/**
|
|
15851
16707
|
* Get the balance of the token deposited in the spoke chain asset manager.
|
|
15852
16708
|
* @param {GetDepositParams<StacksChainKey>} params - The parameters for the deposit, including the user's address, token address, and chain id.
|
|
@@ -15896,8 +16752,7 @@ var StacksSpokeService = class {
|
|
|
15896
16752
|
contractAddress: connectionAddress,
|
|
15897
16753
|
contractName: connectionName,
|
|
15898
16754
|
functionName: "send-message",
|
|
15899
|
-
functionArgs: [uintCV(dstRelayChainId), Cl.bufferFromHex(params.dstAddress), Cl.bufferFromHex(params.payload)]
|
|
15900
|
-
postConditionMode: PostConditionMode.Allow
|
|
16755
|
+
functionArgs: [uintCV(dstRelayChainId), Cl.bufferFromHex(params.dstAddress), Cl.bufferFromHex(params.payload)]
|
|
15901
16756
|
};
|
|
15902
16757
|
if (params.raw === true) {
|
|
15903
16758
|
const tx = await makeUnsignedContractCall({
|
|
@@ -15912,7 +16767,12 @@ var StacksSpokeService = class {
|
|
|
15912
16767
|
payload: bytesToHex(serializePayloadBytes(tx.payload))
|
|
15913
16768
|
};
|
|
15914
16769
|
}
|
|
15915
|
-
const txId = await params.walletProvider.sendTransaction(
|
|
16770
|
+
const txId = await params.walletProvider.sendTransaction({
|
|
16771
|
+
...reqData,
|
|
16772
|
+
// send-message moves no assets — deny with no conditions aborts if it ever tries.
|
|
16773
|
+
postConditionMode: PostConditionMode.Deny,
|
|
16774
|
+
postConditions: []
|
|
16775
|
+
});
|
|
15916
16776
|
return txId;
|
|
15917
16777
|
}
|
|
15918
16778
|
async waitForTransactionReceipt(params) {
|
|
@@ -16359,60 +17219,6 @@ var RadfiProvider = class {
|
|
|
16359
17219
|
}
|
|
16360
17220
|
};
|
|
16361
17221
|
|
|
16362
|
-
// src/shared/entities/btc/btc-utils.ts
|
|
16363
|
-
var BITCOIN_FEE_SAFETY_VBYTES = 20;
|
|
16364
|
-
function calcOpReturnOutputVbytes(payloadByteLength) {
|
|
16365
|
-
let scriptSize;
|
|
16366
|
-
if (payloadByteLength <= 75) {
|
|
16367
|
-
scriptSize = 3 + payloadByteLength;
|
|
16368
|
-
} else if (payloadByteLength <= 255) {
|
|
16369
|
-
scriptSize = 4 + payloadByteLength;
|
|
16370
|
-
} else {
|
|
16371
|
-
scriptSize = 5 + payloadByteLength;
|
|
16372
|
-
}
|
|
16373
|
-
const scriptLenVarint = scriptSize <= 252 ? 1 : 3;
|
|
16374
|
-
return 8 + scriptLenVarint + scriptSize;
|
|
16375
|
-
}
|
|
16376
|
-
function estimateBitcoinTxSize(inputCount, outputCount, addressType, opReturnOutputVbytes = 44) {
|
|
16377
|
-
let inputWeight;
|
|
16378
|
-
switch (addressType) {
|
|
16379
|
-
case "P2PKH":
|
|
16380
|
-
inputWeight = 148;
|
|
16381
|
-
break;
|
|
16382
|
-
case "P2SH":
|
|
16383
|
-
inputWeight = 91;
|
|
16384
|
-
break;
|
|
16385
|
-
case "P2TR":
|
|
16386
|
-
inputWeight = 58;
|
|
16387
|
-
break;
|
|
16388
|
-
default:
|
|
16389
|
-
inputWeight = 68;
|
|
16390
|
-
break;
|
|
16391
|
-
}
|
|
16392
|
-
return Math.ceil(
|
|
16393
|
-
10.5 + opReturnOutputVbytes + BITCOIN_FEE_SAFETY_VBYTES + inputCount * inputWeight + outputCount * 31
|
|
16394
|
-
);
|
|
16395
|
-
}
|
|
16396
|
-
function encodeBtcPayloadToBytes(payload) {
|
|
16397
|
-
return JSON.stringify({
|
|
16398
|
-
src_address: payload.src_address.toLowerCase(),
|
|
16399
|
-
data: payload.data.toLowerCase(),
|
|
16400
|
-
src_chain_id: payload.src_chain_id,
|
|
16401
|
-
dst_chain_id: payload.dst_chain_id,
|
|
16402
|
-
wallet_used: payload.wallet_used,
|
|
16403
|
-
timestamp: payload.timestamp,
|
|
16404
|
-
address_type: payload.address_type
|
|
16405
|
-
});
|
|
16406
|
-
}
|
|
16407
|
-
function normalizePsbtToBase64(signedPsbt) {
|
|
16408
|
-
const isHex2 = /^[0-9a-fA-F]+$/.test(signedPsbt);
|
|
16409
|
-
return isHex2 ? Buffer.from(signedPsbt, "hex").toString("base64") : signedPsbt;
|
|
16410
|
-
}
|
|
16411
|
-
function normalizeSignatureToBase64(signature) {
|
|
16412
|
-
const isHex2 = /^[0-9a-fA-F]+$/.test(signature);
|
|
16413
|
-
return isHex2 ? Buffer.from(signature, "hex").toString("base64") : signature;
|
|
16414
|
-
}
|
|
16415
|
-
|
|
16416
17222
|
// src/shared/services/spoke/BitcoinSpokeService.ts
|
|
16417
17223
|
initEccLib(ecc);
|
|
16418
17224
|
var BITCOIN_DEFAULT_FEE_RATE = 3;
|
|
@@ -17070,7 +17876,7 @@ function hexToBytes2(hex) {
|
|
|
17070
17876
|
const al = hl / 2;
|
|
17071
17877
|
if (hl % 2)
|
|
17072
17878
|
throw new Error("hex string expected, got unpadded hex of length " + hl);
|
|
17073
|
-
const
|
|
17879
|
+
const array4 = new Uint8Array(al);
|
|
17074
17880
|
for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
|
|
17075
17881
|
const n1 = asciiToBase16(hex.charCodeAt(hi));
|
|
17076
17882
|
const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
|
|
@@ -17078,9 +17884,9 @@ function hexToBytes2(hex) {
|
|
|
17078
17884
|
const char = hex[hi] + hex[hi + 1];
|
|
17079
17885
|
throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
|
|
17080
17886
|
}
|
|
17081
|
-
|
|
17887
|
+
array4[ai] = n1 * 16 + n2;
|
|
17082
17888
|
}
|
|
17083
|
-
return
|
|
17889
|
+
return array4;
|
|
17084
17890
|
}
|
|
17085
17891
|
function concatBytes(...arrays) {
|
|
17086
17892
|
let sum = 0;
|
|
@@ -17710,22 +18516,22 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
17710
18516
|
const byte0 = Uint8Array.of(0);
|
|
17711
18517
|
const byte1 = Uint8Array.of(1);
|
|
17712
18518
|
const _maxDrbgIters = 1e3;
|
|
17713
|
-
let
|
|
18519
|
+
let v12 = u8n(hashLen);
|
|
17714
18520
|
let k = u8n(hashLen);
|
|
17715
18521
|
let i = 0;
|
|
17716
18522
|
const reset = () => {
|
|
17717
|
-
|
|
18523
|
+
v12.fill(1);
|
|
17718
18524
|
k.fill(0);
|
|
17719
18525
|
i = 0;
|
|
17720
18526
|
};
|
|
17721
|
-
const h = (...msgs) => hmacFn(k, concatBytes(
|
|
18527
|
+
const h = (...msgs) => hmacFn(k, concatBytes(v12, ...msgs));
|
|
17722
18528
|
const reseed = (seed = NULL) => {
|
|
17723
18529
|
k = h(byte0, seed);
|
|
17724
|
-
|
|
18530
|
+
v12 = h();
|
|
17725
18531
|
if (seed.length === 0)
|
|
17726
18532
|
return;
|
|
17727
18533
|
k = h(byte1, seed);
|
|
17728
|
-
|
|
18534
|
+
v12 = h();
|
|
17729
18535
|
};
|
|
17730
18536
|
const gen = () => {
|
|
17731
18537
|
if (i++ >= _maxDrbgIters)
|
|
@@ -17733,10 +18539,10 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
17733
18539
|
let len = 0;
|
|
17734
18540
|
const out = [];
|
|
17735
18541
|
while (len < qByteLen) {
|
|
17736
|
-
|
|
17737
|
-
const sl =
|
|
18542
|
+
v12 = h();
|
|
18543
|
+
const sl = v12.slice();
|
|
17738
18544
|
out.push(sl);
|
|
17739
|
-
len +=
|
|
18545
|
+
len += v12.length;
|
|
17740
18546
|
}
|
|
17741
18547
|
return concatBytes(...out);
|
|
17742
18548
|
};
|
|
@@ -17751,18 +18557,18 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
17751
18557
|
};
|
|
17752
18558
|
return genUntil;
|
|
17753
18559
|
}
|
|
17754
|
-
function validateObject(
|
|
17755
|
-
if (!
|
|
18560
|
+
function validateObject(object6, fields = {}, optFields = {}) {
|
|
18561
|
+
if (!object6 || typeof object6 !== "object")
|
|
17756
18562
|
throw new Error("expected valid options object");
|
|
17757
18563
|
function checkField(fieldName, expectedType, isOpt) {
|
|
17758
|
-
const val =
|
|
18564
|
+
const val = object6[fieldName];
|
|
17759
18565
|
if (isOpt && val === void 0)
|
|
17760
18566
|
return;
|
|
17761
18567
|
const current = typeof val;
|
|
17762
18568
|
if (current !== expectedType || val === null)
|
|
17763
18569
|
throw new Error(`param "${fieldName}" is invalid: expected ${expectedType}, got ${current}`);
|
|
17764
18570
|
}
|
|
17765
|
-
const iter = (f, isOpt) => Object.entries(f).forEach(([k,
|
|
18571
|
+
const iter = (f, isOpt) => Object.entries(f).forEach(([k, v12]) => checkField(k, v12, isOpt));
|
|
17766
18572
|
iter(fields, false);
|
|
17767
18573
|
iter(optFields, true);
|
|
17768
18574
|
}
|
|
@@ -17801,12 +18607,12 @@ function pow2(x, power, modulo) {
|
|
|
17801
18607
|
}
|
|
17802
18608
|
return res;
|
|
17803
18609
|
}
|
|
17804
|
-
function invert(
|
|
17805
|
-
if (
|
|
18610
|
+
function invert(number6, modulo) {
|
|
18611
|
+
if (number6 === _0n2)
|
|
17806
18612
|
throw new Error("invert: expected non-zero number");
|
|
17807
18613
|
if (modulo <= _0n2)
|
|
17808
18614
|
throw new Error("invert: expected positive modulus, got " + modulo);
|
|
17809
|
-
let a = mod(
|
|
18615
|
+
let a = mod(number6, modulo);
|
|
17810
18616
|
let b = modulo;
|
|
17811
18617
|
let x = _0n2, u = _1n2;
|
|
17812
18618
|
while (a !== _0n2) {
|
|
@@ -17833,9 +18639,9 @@ function sqrt3mod4(Fp, n) {
|
|
|
17833
18639
|
function sqrt5mod8(Fp, n) {
|
|
17834
18640
|
const p5div8 = (Fp.ORDER - _5n) / _8n;
|
|
17835
18641
|
const n2 = Fp.mul(n, _2n);
|
|
17836
|
-
const
|
|
17837
|
-
const nv = Fp.mul(n,
|
|
17838
|
-
const i = Fp.mul(Fp.mul(nv, _2n),
|
|
18642
|
+
const v12 = Fp.pow(n2, p5div8);
|
|
18643
|
+
const nv = Fp.mul(n, v12);
|
|
18644
|
+
const i = Fp.mul(Fp.mul(nv, _2n), v12);
|
|
17839
18645
|
const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
|
|
17840
18646
|
assertIsSquare(Fp, root, n);
|
|
17841
18647
|
return root;
|
|
@@ -18417,9 +19223,9 @@ function edwards(params, extraOpts = {}) {
|
|
|
18417
19223
|
validateObject(extraOpts, {}, { uvRatio: "function" });
|
|
18418
19224
|
const MASK = _2n2 << BigInt(Fn.BYTES * 8) - _1n4;
|
|
18419
19225
|
const modP = (n) => Fp.create(n);
|
|
18420
|
-
const uvRatio2 = extraOpts.uvRatio || ((u,
|
|
19226
|
+
const uvRatio2 = extraOpts.uvRatio || ((u, v12) => {
|
|
18421
19227
|
try {
|
|
18422
|
-
return { isValid: true, value: Fp.sqrt(Fp.div(u,
|
|
19228
|
+
return { isValid: true, value: Fp.sqrt(Fp.div(u, v12)) };
|
|
18423
19229
|
} catch (e) {
|
|
18424
19230
|
return { isValid: false, value: _0n4 };
|
|
18425
19231
|
}
|
|
@@ -18515,8 +19321,8 @@ function edwards(params, extraOpts = {}) {
|
|
|
18515
19321
|
aInRange("point.y", y, _0n4, max);
|
|
18516
19322
|
const y2 = modP(y * y);
|
|
18517
19323
|
const u = modP(y2 - _1n4);
|
|
18518
|
-
const
|
|
18519
|
-
let { isValid, value: x } = uvRatio2(u,
|
|
19324
|
+
const v12 = modP(d * y2 - a);
|
|
19325
|
+
let { isValid, value: x } = uvRatio2(u, v12);
|
|
18520
19326
|
if (!isValid)
|
|
18521
19327
|
throw new Error("bad point: invalid y coordinate");
|
|
18522
19328
|
const isXOdd = (x & _1n4) === _1n4;
|
|
@@ -18856,13 +19662,13 @@ function adjustScalarBytes(bytes) {
|
|
|
18856
19662
|
return bytes;
|
|
18857
19663
|
}
|
|
18858
19664
|
var ED25519_SQRT_M1 = /* @__PURE__ */ BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");
|
|
18859
|
-
function uvRatio(u,
|
|
19665
|
+
function uvRatio(u, v12) {
|
|
18860
19666
|
const P = ed25519_CURVE_p;
|
|
18861
|
-
const v32 = mod(
|
|
18862
|
-
const v72 = mod(v32 * v32 *
|
|
19667
|
+
const v32 = mod(v12 * v12 * v12, P);
|
|
19668
|
+
const v72 = mod(v32 * v32 * v12, P);
|
|
18863
19669
|
const pow = ed25519_pow_2_252_3(u * v72).pow_p_5_8;
|
|
18864
19670
|
let x = mod(u * v32 * pow, P);
|
|
18865
|
-
const vx2 = mod(
|
|
19671
|
+
const vx2 = mod(v12 * x * x, P);
|
|
18866
19672
|
const root1 = x;
|
|
18867
19673
|
const root2 = mod(x * ED25519_SQRT_M1, P);
|
|
18868
19674
|
const useRoot1 = vx2 === u;
|
|
@@ -19193,7 +19999,7 @@ function findSeatPrice(validators, maxNumberOfSeats, minimumStakeRatio, protocol
|
|
|
19193
19999
|
return findSeatPriceForProtocolAfter49(validators, maxNumberOfSeats, minimumStakeRatio);
|
|
19194
20000
|
}
|
|
19195
20001
|
function findSeatPriceForProtocolBefore49(validators, numSeats) {
|
|
19196
|
-
const stakes = validators.map((
|
|
20002
|
+
const stakes = validators.map((v12) => BigInt(v12.stake)).sort(sortBigIntAsc);
|
|
19197
20003
|
const num = BigInt(numSeats);
|
|
19198
20004
|
const stakesSum = stakes.reduce((a, b) => a + b);
|
|
19199
20005
|
if (stakesSum < num) {
|
|
@@ -19222,7 +20028,7 @@ function findSeatPriceForProtocolAfter49(validators, maxNumberOfSeats, minimumSt
|
|
|
19222
20028
|
if (minimumStakeRatio.length != 2) {
|
|
19223
20029
|
throw Error("minimumStakeRatio should have 2 elements");
|
|
19224
20030
|
}
|
|
19225
|
-
const stakes = validators.map((
|
|
20031
|
+
const stakes = validators.map((v12) => BigInt(v12.stake)).sort(sortBigIntAsc);
|
|
19226
20032
|
const stakesSum = stakes.reduce((a, b) => a + b);
|
|
19227
20033
|
if (validators.length < maxNumberOfSeats) {
|
|
19228
20034
|
return stakesSum * BigInt(minimumStakeRatio[0]) / BigInt(minimumStakeRatio[1]);
|
|
@@ -19394,10 +20200,10 @@ var DER = {
|
|
|
19394
20200
|
if (length < 128)
|
|
19395
20201
|
throw new E("tlv.decode(long): not minimal encoding");
|
|
19396
20202
|
}
|
|
19397
|
-
const
|
|
19398
|
-
if (
|
|
20203
|
+
const v12 = data.subarray(pos, pos + length);
|
|
20204
|
+
if (v12.length !== length)
|
|
19399
20205
|
throw new E("tlv.decode: wrong value length");
|
|
19400
|
-
return { v:
|
|
20206
|
+
return { v: v12, l: data.subarray(pos + length) };
|
|
19401
20207
|
}
|
|
19402
20208
|
},
|
|
19403
20209
|
// https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
|
|
@@ -19965,9 +20771,9 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
19965
20771
|
extraEntropy: false
|
|
19966
20772
|
};
|
|
19967
20773
|
const hasLargeCofactor = CURVE_ORDER * _2n4 < Fp.ORDER;
|
|
19968
|
-
function isBiggerThanHalfOrder(
|
|
20774
|
+
function isBiggerThanHalfOrder(number6) {
|
|
19969
20775
|
const HALF = CURVE_ORDER >> _1n6;
|
|
19970
|
-
return
|
|
20776
|
+
return number6 > HALF;
|
|
19971
20777
|
}
|
|
19972
20778
|
function validateRS(title, num) {
|
|
19973
20779
|
if (!Fn.isValidNot0(num))
|
|
@@ -20150,8 +20956,8 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
20150
20956
|
const R = Point.BASE.multiplyUnsafe(u1).add(P.multiplyUnsafe(u2));
|
|
20151
20957
|
if (R.is0())
|
|
20152
20958
|
return false;
|
|
20153
|
-
const
|
|
20154
|
-
return
|
|
20959
|
+
const v12 = Fn.create(R.x);
|
|
20960
|
+
return v12 === r;
|
|
20155
20961
|
} catch (e) {
|
|
20156
20962
|
return false;
|
|
20157
20963
|
}
|
|
@@ -23839,7 +24645,9 @@ var SonicSpokeService = class {
|
|
|
23839
24645
|
if (params.raw === true) {
|
|
23840
24646
|
return rawTx;
|
|
23841
24647
|
}
|
|
23842
|
-
return params.walletProvider.sendTransaction(rawTx
|
|
24648
|
+
return params.walletProvider.sendTransaction(rawTx, {
|
|
24649
|
+
expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id
|
|
24650
|
+
});
|
|
23843
24651
|
}
|
|
23844
24652
|
static async createSwapIntent(params) {
|
|
23845
24653
|
const { createIntentParams, creatorHubWalletAddress, solverConfig: solverConfig2, fee, hubProvider } = params;
|
|
@@ -23889,7 +24697,9 @@ var SonicSpokeService = class {
|
|
|
23889
24697
|
return [rawTx, intent, feeAmount, txData.data];
|
|
23890
24698
|
}
|
|
23891
24699
|
return [
|
|
23892
|
-
await params.walletProvider.sendTransaction(rawTx
|
|
24700
|
+
await params.walletProvider.sendTransaction(rawTx, {
|
|
24701
|
+
expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id
|
|
24702
|
+
}),
|
|
23893
24703
|
intent,
|
|
23894
24704
|
feeAmount,
|
|
23895
24705
|
txData.data
|
|
@@ -24020,7 +24830,9 @@ var SonicSpokeService = class {
|
|
|
24020
24830
|
if (params.raw === true) {
|
|
24021
24831
|
return rawTx;
|
|
24022
24832
|
}
|
|
24023
|
-
return params.walletProvider.sendTransaction(rawTx
|
|
24833
|
+
return params.walletProvider.sendTransaction(rawTx, {
|
|
24834
|
+
expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id
|
|
24835
|
+
});
|
|
24024
24836
|
}
|
|
24025
24837
|
};
|
|
24026
24838
|
async function toMystenTransaction(txn) {
|
|
@@ -24105,16 +24917,16 @@ var SuiGrpcTransport = class {
|
|
|
24105
24917
|
return effects.gasUsed;
|
|
24106
24918
|
}
|
|
24107
24919
|
async fetchLatestPackageId(objectId) {
|
|
24108
|
-
let
|
|
24920
|
+
let object6;
|
|
24109
24921
|
try {
|
|
24110
|
-
({ object:
|
|
24922
|
+
({ object: object6 } = await this.client.core.getObject({ objectId, include: { json: true } }));
|
|
24111
24923
|
} catch (error) {
|
|
24112
24924
|
throw new Error("Failed to fetch asset manager id", { cause: error });
|
|
24113
24925
|
}
|
|
24114
|
-
if (!
|
|
24926
|
+
if (!object6) {
|
|
24115
24927
|
throw new Error("Asset manager id not found (no data)");
|
|
24116
24928
|
}
|
|
24117
|
-
const fields =
|
|
24929
|
+
const fields = object6.json;
|
|
24118
24930
|
if (!fields) {
|
|
24119
24931
|
throw new Error("Asset manager id not found (not a move object)");
|
|
24120
24932
|
}
|
|
@@ -26171,7 +26983,9 @@ var SpokeService = class _SpokeService {
|
|
|
26171
26983
|
from: params.owner,
|
|
26172
26984
|
spender: params.spender,
|
|
26173
26985
|
raw: false,
|
|
26174
|
-
walletProvider
|
|
26986
|
+
walletProvider,
|
|
26987
|
+
// Covers the reset leg too — an approval must not broadcast on the wrong EVM network.
|
|
26988
|
+
expectedChainId: getEvmViemChain(params.srcChainKey).id
|
|
26175
26989
|
});
|
|
26176
26990
|
if (plan.resetAmount !== void 0) {
|
|
26177
26991
|
const resetHash = await sendApprove(plan.resetAmount);
|
|
@@ -26378,7 +27192,8 @@ var SpokeService = class _SpokeService {
|
|
|
26378
27192
|
return this.sui.encodeSimulationParams(token, assetManager);
|
|
26379
27193
|
default:
|
|
26380
27194
|
return {
|
|
26381
|
-
|
|
27195
|
+
// Token identifiers on BITCOIN/NEAR/INJECTIVE are not addresses — recipient validation stays on the address leg only.
|
|
27196
|
+
encodedToken: encodeTokenIdentifier(srcChainKey, token),
|
|
26382
27197
|
encodedSrcAddress: encodeAddress(srcChainKey, assetManager)
|
|
26383
27198
|
};
|
|
26384
27199
|
}
|
|
@@ -27005,6 +27820,7 @@ var SpokeService = class _SpokeService {
|
|
|
27005
27820
|
}
|
|
27006
27821
|
}
|
|
27007
27822
|
};
|
|
27823
|
+
var HUB_CHAIN_ID = getEvmViemChain(ChainKeys.SONIC_MAINNET).id;
|
|
27008
27824
|
var Erc4626Service = class {
|
|
27009
27825
|
constructor() {
|
|
27010
27826
|
}
|
|
@@ -27183,7 +27999,7 @@ var Erc4626Service = class {
|
|
|
27183
27999
|
if (raw) {
|
|
27184
28000
|
return rawTx;
|
|
27185
28001
|
}
|
|
27186
|
-
return walletProvider.sendTransaction(rawTx);
|
|
28002
|
+
return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID });
|
|
27187
28003
|
}
|
|
27188
28004
|
/**
|
|
27189
28005
|
* Get the maximum amount of shares that can be minted
|
|
@@ -27260,7 +28076,7 @@ var Erc4626Service = class {
|
|
|
27260
28076
|
if (raw) {
|
|
27261
28077
|
return rawTx;
|
|
27262
28078
|
}
|
|
27263
|
-
return walletProvider.sendTransaction(rawTx);
|
|
28079
|
+
return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID });
|
|
27264
28080
|
}
|
|
27265
28081
|
/**
|
|
27266
28082
|
* Get the maximum amount of assets that can be withdrawn
|
|
@@ -27338,7 +28154,7 @@ var Erc4626Service = class {
|
|
|
27338
28154
|
if (raw) {
|
|
27339
28155
|
return rawTx;
|
|
27340
28156
|
}
|
|
27341
|
-
return walletProvider.sendTransaction(rawTx);
|
|
28157
|
+
return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID });
|
|
27342
28158
|
}
|
|
27343
28159
|
/**
|
|
27344
28160
|
* Get the maximum amount of shares that can be redeemed
|
|
@@ -27416,7 +28232,7 @@ var Erc4626Service = class {
|
|
|
27416
28232
|
if (raw) {
|
|
27417
28233
|
return rawTx;
|
|
27418
28234
|
}
|
|
27419
|
-
return walletProvider.sendTransaction(rawTx);
|
|
28235
|
+
return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID });
|
|
27420
28236
|
}
|
|
27421
28237
|
/**
|
|
27422
28238
|
* Encodes a deposit transaction for a vault.
|
|
@@ -27493,6 +28309,7 @@ var Erc4626Service = class {
|
|
|
27493
28309
|
};
|
|
27494
28310
|
}
|
|
27495
28311
|
};
|
|
28312
|
+
var HUB_CHAIN_ID2 = getEvmViemChain(ChainKeys.SONIC_MAINNET).id;
|
|
27496
28313
|
var Permit2Service = class _Permit2Service {
|
|
27497
28314
|
constructor() {
|
|
27498
28315
|
}
|
|
@@ -27581,7 +28398,7 @@ var Permit2Service = class _Permit2Service {
|
|
|
27581
28398
|
if (raw) {
|
|
27582
28399
|
return rawTx;
|
|
27583
28400
|
}
|
|
27584
|
-
return walletProvider.sendTransaction(rawTx);
|
|
28401
|
+
return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID2 });
|
|
27585
28402
|
}
|
|
27586
28403
|
/**
|
|
27587
28404
|
* Execute a permit for a single token
|
|
@@ -27606,7 +28423,7 @@ var Permit2Service = class _Permit2Service {
|
|
|
27606
28423
|
if (raw) {
|
|
27607
28424
|
return rawTx;
|
|
27608
28425
|
}
|
|
27609
|
-
return walletProvider.sendTransaction(rawTx);
|
|
28426
|
+
return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID2 });
|
|
27610
28427
|
}
|
|
27611
28428
|
/**
|
|
27612
28429
|
* Execute a permit for multiple tokens
|
|
@@ -27631,7 +28448,7 @@ var Permit2Service = class _Permit2Service {
|
|
|
27631
28448
|
if (raw) {
|
|
27632
28449
|
return rawTx;
|
|
27633
28450
|
}
|
|
27634
|
-
return walletProvider.sendTransaction(rawTx);
|
|
28451
|
+
return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID2 });
|
|
27635
28452
|
}
|
|
27636
28453
|
/**
|
|
27637
28454
|
* Transfer tokens from one address to another using Permit2
|
|
@@ -27657,7 +28474,7 @@ var Permit2Service = class _Permit2Service {
|
|
|
27657
28474
|
if (raw) {
|
|
27658
28475
|
return rawTx;
|
|
27659
28476
|
}
|
|
27660
|
-
return walletProvider.sendTransaction(rawTx);
|
|
28477
|
+
return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID2 });
|
|
27661
28478
|
}
|
|
27662
28479
|
/**
|
|
27663
28480
|
* Transfer multiple tokens in a batch using Permit2
|
|
@@ -27680,7 +28497,7 @@ var Permit2Service = class _Permit2Service {
|
|
|
27680
28497
|
if (raw) {
|
|
27681
28498
|
return rawTx;
|
|
27682
28499
|
}
|
|
27683
|
-
return walletProvider.sendTransaction(rawTx);
|
|
28500
|
+
return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID2 });
|
|
27684
28501
|
}
|
|
27685
28502
|
/**
|
|
27686
28503
|
* Lockdown approvals to prevent malicious usage
|
|
@@ -27703,7 +28520,7 @@ var Permit2Service = class _Permit2Service {
|
|
|
27703
28520
|
if (raw) {
|
|
27704
28521
|
return rawTx;
|
|
27705
28522
|
}
|
|
27706
|
-
return walletProvider.sendTransaction(rawTx);
|
|
28523
|
+
return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID2 });
|
|
27707
28524
|
}
|
|
27708
28525
|
/**
|
|
27709
28526
|
* Invalidate nonces to prevent replay attacks
|
|
@@ -27728,7 +28545,7 @@ var Permit2Service = class _Permit2Service {
|
|
|
27728
28545
|
if (raw) {
|
|
27729
28546
|
return rawTx;
|
|
27730
28547
|
}
|
|
27731
|
-
return walletProvider.sendTransaction(rawTx);
|
|
28548
|
+
return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID2 });
|
|
27732
28549
|
}
|
|
27733
28550
|
/**
|
|
27734
28551
|
* Encodes an approve transaction for Permit2.
|
|
@@ -30986,7 +31803,9 @@ var BalnSwapService = class {
|
|
|
30986
31803
|
if (walletProviderSlot.raw) {
|
|
30987
31804
|
return tx;
|
|
30988
31805
|
}
|
|
30989
|
-
return walletProviderSlot.walletProvider.sendTransaction(tx
|
|
31806
|
+
return walletProviderSlot.walletProvider.sendTransaction(tx, {
|
|
31807
|
+
expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id
|
|
31808
|
+
});
|
|
30990
31809
|
}
|
|
30991
31810
|
};
|
|
30992
31811
|
|
|
@@ -32125,6 +32944,9 @@ function resolveSponsoringApiConfig(layers) {
|
|
|
32125
32944
|
function resolveBridgeApiConfig(layers) {
|
|
32126
32945
|
return resolveSharedApiConfig(layers);
|
|
32127
32946
|
}
|
|
32947
|
+
function resolveLeverageYieldApiConfig(layers) {
|
|
32948
|
+
return resolveSharedApiConfig(layers);
|
|
32949
|
+
}
|
|
32128
32950
|
var SwapsApiService = class _SwapsApiService {
|
|
32129
32951
|
// Fully-resolved swaps-API config supplied by the caller (BackendApiService resolves the
|
|
32130
32952
|
// `ApiConfig` union via `resolveSwapsApiConfig`); this service does not resolve the union.
|
|
@@ -32850,6 +33672,623 @@ var BridgeApiService = class {
|
|
|
32850
33672
|
return this.config.timeout;
|
|
32851
33673
|
}
|
|
32852
33674
|
};
|
|
33675
|
+
var LsdSourceSchema = v.object({
|
|
33676
|
+
poolId: v.string(),
|
|
33677
|
+
fallbackAprPct: v.number(),
|
|
33678
|
+
label: v.string()
|
|
33679
|
+
});
|
|
33680
|
+
var LeverageVaultSchema = v.object({
|
|
33681
|
+
name: v.string(),
|
|
33682
|
+
vault: v.string(),
|
|
33683
|
+
asset: v.string(),
|
|
33684
|
+
borrowToken: v.string(),
|
|
33685
|
+
lsdSource: v.optional(LsdSourceSchema)
|
|
33686
|
+
});
|
|
33687
|
+
var GetLeverageVaultsResponseSchema = v.array(LeverageVaultSchema);
|
|
33688
|
+
var GetLeverageVaultResponseSchema = LeverageVaultSchema;
|
|
33689
|
+
var VaultAssetResponseSchema = v.object({
|
|
33690
|
+
asset: v.string()
|
|
33691
|
+
});
|
|
33692
|
+
var LeverageYieldPositionSchema = v.object({
|
|
33693
|
+
collateral: v.string(),
|
|
33694
|
+
debt: v.string(),
|
|
33695
|
+
ltv: v.string(),
|
|
33696
|
+
healthFactor: v.string(),
|
|
33697
|
+
idleAsset: v.string()
|
|
33698
|
+
});
|
|
33699
|
+
var LeverageYieldAprSchema = v.object({
|
|
33700
|
+
supplyAprRay: v.string(),
|
|
33701
|
+
borrowAprRay: v.string(),
|
|
33702
|
+
targetLtvBps: v.string(),
|
|
33703
|
+
leverageMultiplierWad: v.string(),
|
|
33704
|
+
netAprRay: v.string()
|
|
33705
|
+
});
|
|
33706
|
+
var LeverageYieldLsdAprSchema = v.object({
|
|
33707
|
+
aprRay: v.string(),
|
|
33708
|
+
label: v.string(),
|
|
33709
|
+
stale: v.boolean()
|
|
33710
|
+
});
|
|
33711
|
+
var LeverageYieldEffectiveAprSchema = v.object({
|
|
33712
|
+
supplyAprRay: v.string(),
|
|
33713
|
+
borrowAprRay: v.string(),
|
|
33714
|
+
targetLtvBps: v.string(),
|
|
33715
|
+
leverageMultiplierWad: v.string(),
|
|
33716
|
+
netAprRay: v.string(),
|
|
33717
|
+
lsdApr: LeverageYieldLsdAprSchema,
|
|
33718
|
+
effectiveSupplyAprRay: v.string(),
|
|
33719
|
+
effectiveNetAprRay: v.string()
|
|
33720
|
+
});
|
|
33721
|
+
var VaultTotalAssetsResponseSchema = v.object({
|
|
33722
|
+
totalAssets: v.string()
|
|
33723
|
+
});
|
|
33724
|
+
var PreviewDepositResponseSchema = v.object({
|
|
33725
|
+
shares: v.string()
|
|
33726
|
+
});
|
|
33727
|
+
var PreviewWithdrawResponseSchema = v.object({
|
|
33728
|
+
shares: v.string()
|
|
33729
|
+
});
|
|
33730
|
+
var PreviewRedeemResponseSchema = v.object({
|
|
33731
|
+
assets: v.string()
|
|
33732
|
+
});
|
|
33733
|
+
var ShareBalanceResponseSchema = v.object({
|
|
33734
|
+
balance: v.string()
|
|
33735
|
+
});
|
|
33736
|
+
var MaxWithdrawResponseSchema = v.object({
|
|
33737
|
+
maxWithdraw: v.string()
|
|
33738
|
+
});
|
|
33739
|
+
|
|
33740
|
+
// src/backendApi/LeverageYieldApiService.ts
|
|
33741
|
+
var LeverageYieldApiService = class _LeverageYieldApiService {
|
|
33742
|
+
// Fully-resolved API config supplied by the caller (BackendApiService resolves the ApiConfig
|
|
33743
|
+
// union via `resolveBaseApiConfig`); leverage-yield endpoints are sub-paths under the base URL.
|
|
33744
|
+
config;
|
|
33745
|
+
headers;
|
|
33746
|
+
logger;
|
|
33747
|
+
/** See {@link LeverageYieldApiServiceOptions.trimLegacyOverrides}. */
|
|
33748
|
+
trimsLegacyOverrides;
|
|
33749
|
+
constructor(config, logger = consoleLogger, options = {}) {
|
|
33750
|
+
this.config = config;
|
|
33751
|
+
this.headers = { ...config.headers };
|
|
33752
|
+
this.logger = logger;
|
|
33753
|
+
this.trimsLegacyOverrides = options.trimLegacyOverrides ?? true;
|
|
33754
|
+
}
|
|
33755
|
+
/**
|
|
33756
|
+
* Issues a single HTTP request, validates the JSON body against `schema`, and wraps the
|
|
33757
|
+
* result in `Result<T>`. Mirrors `SwapsApiService.request`; every public method delegates here.
|
|
33758
|
+
*/
|
|
33759
|
+
async request(endpoint, config, schema, overrideConfig) {
|
|
33760
|
+
try {
|
|
33761
|
+
const raw = await makeRequest({
|
|
33762
|
+
endpoint,
|
|
33763
|
+
config: { baseURL: this.config.baseURL, timeout: this.config.timeout, headers: this.headers, ...config },
|
|
33764
|
+
// Normalized like a configured base URL: the override is the gateway root, so a legacy
|
|
33765
|
+
// `/be`-suffixed value must not nest `/leverage-yield/*` under the data API's mount — unless the
|
|
33766
|
+
// config opted out of the legacy trim, in which case the per-call value is left as given.
|
|
33767
|
+
overrideConfig: this.trimsLegacyOverrides ? normalizeOverrideBaseURL(overrideConfig) : overrideConfig,
|
|
33768
|
+
logger: this.logger,
|
|
33769
|
+
serviceLabel: "LeverageYieldApiService"
|
|
33770
|
+
});
|
|
33771
|
+
const parsed = v.safeParse(schema, raw);
|
|
33772
|
+
if (!parsed.success) {
|
|
33773
|
+
return {
|
|
33774
|
+
ok: false,
|
|
33775
|
+
error: toInvalidResponseShapeError({
|
|
33776
|
+
api: "leverageYield",
|
|
33777
|
+
feature: "backend",
|
|
33778
|
+
endpoint,
|
|
33779
|
+
issues: v.flatten(parsed.issues)
|
|
33780
|
+
})
|
|
33781
|
+
};
|
|
33782
|
+
}
|
|
33783
|
+
return { ok: true, value: parsed.output };
|
|
33784
|
+
} catch (error) {
|
|
33785
|
+
return { ok: false, error: toExternalApiError({ api: "leverageYield", feature: "backend", endpoint, error }) };
|
|
33786
|
+
}
|
|
33787
|
+
}
|
|
33788
|
+
/**
|
|
33789
|
+
* Drop the SDK-only display field `feeAmount` before an intent reaches the strict wire serializer.
|
|
33790
|
+
* `sodax.leverageYield.createVaultIntent` returns `Intent & FeeAmount`, which is structurally
|
|
33791
|
+
* assignable to the wire `IntentRequestV2` and so gets passed straight into the intent-carrying
|
|
33792
|
+
* endpoints; the lenient JSON serializer would send the extra bigint wholesale. Mirrors
|
|
33793
|
+
* `SwapsApiService.toWireIntent`; a no-op for an already-clean `IntentRequestV2`.
|
|
33794
|
+
*/
|
|
33795
|
+
static toWireIntent(intent) {
|
|
33796
|
+
const { feeAmount: _feeAmount, ...rest } = intent;
|
|
33797
|
+
return rest;
|
|
33798
|
+
}
|
|
33799
|
+
/** Append `params` to `base` as a query string, returning `base` unchanged when `params` is empty. */
|
|
33800
|
+
withQuery(base2, params) {
|
|
33801
|
+
const queryString = new URLSearchParams(params).toString();
|
|
33802
|
+
return queryString.length > 0 ? `${base2}?${queryString}` : base2;
|
|
33803
|
+
}
|
|
33804
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
33805
|
+
// Vault registry
|
|
33806
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
33807
|
+
/**
|
|
33808
|
+
* Fetch the registry of deployed leverage-yield vaults.
|
|
33809
|
+
*
|
|
33810
|
+
* @returns `Result<GetLeverageVaultsResponseV2>` — array of vault descriptors.
|
|
33811
|
+
*/
|
|
33812
|
+
async getVaults(config) {
|
|
33813
|
+
return this.request("/leverage-yield/vaults", { method: "GET" }, GetLeverageVaultsResponseSchema, config);
|
|
33814
|
+
}
|
|
33815
|
+
/**
|
|
33816
|
+
* Fetch a single vault descriptor by its lsoda* share-token name (e.g. `lsodaWEETH`).
|
|
33817
|
+
*
|
|
33818
|
+
* @returns `Result<GetLeverageVaultResponseV2>` — the vault descriptor.
|
|
33819
|
+
*/
|
|
33820
|
+
async getVault(name, config) {
|
|
33821
|
+
return this.request(
|
|
33822
|
+
`/leverage-yield/vaults/${name}`,
|
|
33823
|
+
{ method: "GET" },
|
|
33824
|
+
GetLeverageVaultResponseSchema,
|
|
33825
|
+
config
|
|
33826
|
+
);
|
|
33827
|
+
}
|
|
33828
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
33829
|
+
// Vault reads
|
|
33830
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
33831
|
+
/**
|
|
33832
|
+
* Get the vault's underlying hub asset (Sodax vault-token wrapper).
|
|
33833
|
+
*
|
|
33834
|
+
* @returns `Result<VaultAssetResponseV2>` — `{ asset }`.
|
|
33835
|
+
*/
|
|
33836
|
+
async getAsset(query, config) {
|
|
33837
|
+
return this.request(
|
|
33838
|
+
this.withQuery("/leverage-yield/asset", { vault: query.vault }),
|
|
33839
|
+
{ method: "GET" },
|
|
33840
|
+
VaultAssetResponseSchema,
|
|
33841
|
+
config
|
|
33842
|
+
);
|
|
33843
|
+
}
|
|
33844
|
+
/**
|
|
33845
|
+
* Get a leveraged-position snapshot for the vault.
|
|
33846
|
+
*
|
|
33847
|
+
* @returns `Result<LeverageYieldPositionV2>` — `{ collateral, debt, ltv, healthFactor, idleAsset }` (decimal strings).
|
|
33848
|
+
*/
|
|
33849
|
+
async getPosition(query, config) {
|
|
33850
|
+
return this.request(
|
|
33851
|
+
this.withQuery("/leverage-yield/position", { vault: query.vault }),
|
|
33852
|
+
{ method: "GET" },
|
|
33853
|
+
LeverageYieldPositionSchema,
|
|
33854
|
+
config
|
|
33855
|
+
);
|
|
33856
|
+
}
|
|
33857
|
+
/**
|
|
33858
|
+
* Get the AAVE-only steady-state APR for the vault (goes negative when the LSD yield is the alpha).
|
|
33859
|
+
*
|
|
33860
|
+
* @returns `Result<LeverageYieldAprV2>` — RAY-denominated rates as decimal strings.
|
|
33861
|
+
*/
|
|
33862
|
+
async getApr(query, config) {
|
|
33863
|
+
return this.request(
|
|
33864
|
+
this.withQuery("/leverage-yield/apr", { vault: query.vault }),
|
|
33865
|
+
{ method: "GET" },
|
|
33866
|
+
LeverageYieldAprSchema,
|
|
33867
|
+
config
|
|
33868
|
+
);
|
|
33869
|
+
}
|
|
33870
|
+
/**
|
|
33871
|
+
* Get the honest combined AAVE + LSD effective APR for the vault.
|
|
33872
|
+
*
|
|
33873
|
+
* @returns `Result<LeverageYieldEffectiveAprV2>` — includes `effectiveNetAprRay` (the headline number).
|
|
33874
|
+
*/
|
|
33875
|
+
async getEffectiveApr(query, config) {
|
|
33876
|
+
return this.request(
|
|
33877
|
+
this.withQuery("/leverage-yield/apr/effective", { vault: query.vault }),
|
|
33878
|
+
{ method: "GET" },
|
|
33879
|
+
LeverageYieldEffectiveAprSchema,
|
|
33880
|
+
config
|
|
33881
|
+
);
|
|
33882
|
+
}
|
|
33883
|
+
/**
|
|
33884
|
+
* Get the off-chain LSD staking-APR snapshot for the vault's underlying asset.
|
|
33885
|
+
*
|
|
33886
|
+
* @returns `Result<LeverageYieldLsdAprV2>` — `{ aprRay, label, stale }`.
|
|
33887
|
+
*/
|
|
33888
|
+
async getLsdApr(query, config) {
|
|
33889
|
+
return this.request(
|
|
33890
|
+
this.withQuery("/leverage-yield/apr/lsd", { vault: query.vault }),
|
|
33891
|
+
{ method: "GET" },
|
|
33892
|
+
LeverageYieldLsdAprSchema,
|
|
33893
|
+
config
|
|
33894
|
+
);
|
|
33895
|
+
}
|
|
33896
|
+
/**
|
|
33897
|
+
* Get the total assets managed by the vault.
|
|
33898
|
+
*
|
|
33899
|
+
* @returns `Result<VaultTotalAssetsResponseV2>` — `{ totalAssets }` (decimal string).
|
|
33900
|
+
*/
|
|
33901
|
+
async getTotalAssets(query, config) {
|
|
33902
|
+
return this.request(
|
|
33903
|
+
this.withQuery("/leverage-yield/total-assets", { vault: query.vault }),
|
|
33904
|
+
{ method: "GET" },
|
|
33905
|
+
VaultTotalAssetsResponseSchema,
|
|
33906
|
+
config
|
|
33907
|
+
);
|
|
33908
|
+
}
|
|
33909
|
+
/**
|
|
33910
|
+
* Preview the shares minted for depositing `assets` into the vault (ERC-4626 `previewDeposit`).
|
|
33911
|
+
*
|
|
33912
|
+
* @returns `Result<PreviewDepositResponseV2>` — `{ shares }` (decimal string).
|
|
33913
|
+
*/
|
|
33914
|
+
async previewDeposit(query, config) {
|
|
33915
|
+
return this.request(
|
|
33916
|
+
this.withQuery("/leverage-yield/preview/deposit", { vault: query.vault, assets: query.assets }),
|
|
33917
|
+
{ method: "GET" },
|
|
33918
|
+
PreviewDepositResponseSchema,
|
|
33919
|
+
config
|
|
33920
|
+
);
|
|
33921
|
+
}
|
|
33922
|
+
/**
|
|
33923
|
+
* Preview the shares burned to withdraw `assets` from the vault (ERC-4626 `previewWithdraw`).
|
|
33924
|
+
*
|
|
33925
|
+
* @returns `Result<PreviewWithdrawResponseV2>` — `{ shares }` (decimal string).
|
|
33926
|
+
*/
|
|
33927
|
+
async previewWithdraw(query, config) {
|
|
33928
|
+
return this.request(
|
|
33929
|
+
this.withQuery("/leverage-yield/preview/withdraw", { vault: query.vault, assets: query.assets }),
|
|
33930
|
+
{ method: "GET" },
|
|
33931
|
+
PreviewWithdrawResponseSchema,
|
|
33932
|
+
config
|
|
33933
|
+
);
|
|
33934
|
+
}
|
|
33935
|
+
/**
|
|
33936
|
+
* Preview the assets returned for redeeming `shares` from the vault (ERC-4626 `previewRedeem`).
|
|
33937
|
+
*
|
|
33938
|
+
* @returns `Result<PreviewRedeemResponseV2>` — `{ assets }` (decimal string).
|
|
33939
|
+
*/
|
|
33940
|
+
async previewRedeem(query, config) {
|
|
33941
|
+
return this.request(
|
|
33942
|
+
this.withQuery("/leverage-yield/preview/redeem", { vault: query.vault, shares: query.shares }),
|
|
33943
|
+
{ method: "GET" },
|
|
33944
|
+
PreviewRedeemResponseSchema,
|
|
33945
|
+
config
|
|
33946
|
+
);
|
|
33947
|
+
}
|
|
33948
|
+
/**
|
|
33949
|
+
* Get an owner's vault share (lsoda*) balance.
|
|
33950
|
+
*
|
|
33951
|
+
* @returns `Result<ShareBalanceResponseV2>` — `{ balance }` (decimal string).
|
|
33952
|
+
*/
|
|
33953
|
+
async getShareBalance(query, config) {
|
|
33954
|
+
return this.request(
|
|
33955
|
+
this.withQuery("/leverage-yield/share-balance", { vault: query.vault, owner: query.owner }),
|
|
33956
|
+
{ method: "GET" },
|
|
33957
|
+
ShareBalanceResponseSchema,
|
|
33958
|
+
config
|
|
33959
|
+
);
|
|
33960
|
+
}
|
|
33961
|
+
/**
|
|
33962
|
+
* Get an owner's RAW ERC-4626 `maxWithdraw` — NOT dust-trimmed, unlike the SDK-local
|
|
33963
|
+
* `sodax.leverageYield.getMaxWithdrawForUser`. Apply a margin before using it as a withdraw amount.
|
|
33964
|
+
*
|
|
33965
|
+
* @returns `Result<MaxWithdrawResponseV2>` — `{ maxWithdraw }` (decimal string).
|
|
33966
|
+
*/
|
|
33967
|
+
async getMaxWithdraw(query, config) {
|
|
33968
|
+
return this.request(
|
|
33969
|
+
this.withQuery("/leverage-yield/max-withdraw", { vault: query.vault, owner: query.owner }),
|
|
33970
|
+
{ method: "GET" },
|
|
33971
|
+
MaxWithdrawResponseSchema,
|
|
33972
|
+
config
|
|
33973
|
+
);
|
|
33974
|
+
}
|
|
33975
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
33976
|
+
// Quote · deadline
|
|
33977
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
33978
|
+
/**
|
|
33979
|
+
* Quote a swap-style deposit: any solver-supported `tokenSrc` → the vault's lsoda* shares.
|
|
33980
|
+
* Pass `query.includeTxData = true` to also build the unsigned create-intent tx (`srcAddress`
|
|
33981
|
+
* required in the body then).
|
|
33982
|
+
*
|
|
33983
|
+
* @returns `Result<QuoteResponseV2>` — `quotedAmount` (shares) and optional `txData`.
|
|
33984
|
+
*/
|
|
33985
|
+
async getDepositQuote(body, query, config) {
|
|
33986
|
+
const endpoint = query?.includeTxData ? "/leverage-yield/quote/deposit?includeTxData=true" : "/leverage-yield/quote/deposit";
|
|
33987
|
+
const txSchema = rawTxSchemaForChainKey$1(body.tokenSrcChainKey);
|
|
33988
|
+
return this.request(
|
|
33989
|
+
endpoint,
|
|
33990
|
+
{ method: "POST", body: toJsonBody(body) },
|
|
33991
|
+
makeQuoteResponseSchema(txSchema),
|
|
33992
|
+
config
|
|
33993
|
+
);
|
|
33994
|
+
}
|
|
33995
|
+
/**
|
|
33996
|
+
* Quote a swap-style withdraw: the vault's lsoda* shares → any solver-supported `tokenDst`.
|
|
33997
|
+
* Pass `query.includeTxData = true` to also build the unsigned tx (signed on `srcChainKey`;
|
|
33998
|
+
* `srcAddress`/`dstAddress` required in the body then).
|
|
33999
|
+
*
|
|
34000
|
+
* @returns `Result<QuoteResponseV2>` — `quotedAmount` (output token) and optional `txData`.
|
|
34001
|
+
*/
|
|
34002
|
+
async getWithdrawQuote(body, query, config) {
|
|
34003
|
+
const endpoint = query?.includeTxData ? "/leverage-yield/quote/withdraw?includeTxData=true" : "/leverage-yield/quote/withdraw";
|
|
34004
|
+
const txSchema = rawTxSchemaForChainKey$1(body.srcChainKey);
|
|
34005
|
+
return this.request(
|
|
34006
|
+
endpoint,
|
|
34007
|
+
{ method: "POST", body: toJsonBody(body) },
|
|
34008
|
+
makeQuoteResponseSchema(txSchema),
|
|
34009
|
+
config
|
|
34010
|
+
);
|
|
34011
|
+
}
|
|
34012
|
+
/**
|
|
34013
|
+
* Compute a deposit/withdraw deadline (hub timestamp + `offsetSeconds`, default 300s).
|
|
34014
|
+
*
|
|
34015
|
+
* @returns `Result<DeadlineResponseV2>` — unix-seconds deadline (decimal string).
|
|
34016
|
+
*/
|
|
34017
|
+
async getDeadline(query, config) {
|
|
34018
|
+
const params = {};
|
|
34019
|
+
if (query?.offsetSeconds !== void 0) params.offsetSeconds = String(query.offsetSeconds);
|
|
34020
|
+
return this.request(
|
|
34021
|
+
this.withQuery("/leverage-yield/deadline", params),
|
|
34022
|
+
{ method: "GET" },
|
|
34023
|
+
DeadlineResponseSchema,
|
|
34024
|
+
config
|
|
34025
|
+
);
|
|
34026
|
+
}
|
|
34027
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
34028
|
+
// Deposit allowance · approve · create intent (deposit / withdraw)
|
|
34029
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
34030
|
+
/**
|
|
34031
|
+
* Check whether the deposit input-token allowance is already sufficient for the intent.
|
|
34032
|
+
* (Withdraw needs no spoke allowance — it spends lsoda* from the hub wallet.)
|
|
34033
|
+
*
|
|
34034
|
+
* @returns `Result<AllowanceCheckResponseV2>` — `{ valid }`.
|
|
34035
|
+
*/
|
|
34036
|
+
async checkAllowance(body, config) {
|
|
34037
|
+
return this.request(
|
|
34038
|
+
"/leverage-yield/allowance/check",
|
|
34039
|
+
{ method: "POST", body: toJsonBody(body) },
|
|
34040
|
+
AllowanceCheckResponseSchema,
|
|
34041
|
+
config
|
|
34042
|
+
);
|
|
34043
|
+
}
|
|
34044
|
+
/**
|
|
34045
|
+
* Build an unsigned token-approval transaction for the deposit input token.
|
|
34046
|
+
*
|
|
34047
|
+
* @returns `Result<ApproveResponseV2>` — `{ tx }` (chain-specific unsigned tx).
|
|
34048
|
+
*/
|
|
34049
|
+
async approve(body, config) {
|
|
34050
|
+
const txSchema = rawTxSchemaForChainKey$1(body.srcChainKey);
|
|
34051
|
+
return this.request(
|
|
34052
|
+
"/leverage-yield/approve",
|
|
34053
|
+
{ method: "POST", body: toJsonBody(body) },
|
|
34054
|
+
makeApproveResponseSchema(txSchema),
|
|
34055
|
+
config
|
|
34056
|
+
);
|
|
34057
|
+
}
|
|
34058
|
+
/**
|
|
34059
|
+
* Build an unsigned deposit create-intent transaction (any token → lsoda* shares).
|
|
34060
|
+
*
|
|
34061
|
+
* @returns `Result<CreateIntentResponseV2>` — `{ tx, intent, relayData }`.
|
|
34062
|
+
*/
|
|
34063
|
+
async createDepositIntent(body, config) {
|
|
34064
|
+
const txSchema = rawTxSchemaForChainKey$1(body.srcChainKey);
|
|
34065
|
+
return this.request(
|
|
34066
|
+
"/leverage-yield/intents/deposit",
|
|
34067
|
+
{ method: "POST", body: toJsonBody(body) },
|
|
34068
|
+
makeCreateIntentResponseSchema(txSchema),
|
|
34069
|
+
config
|
|
34070
|
+
);
|
|
34071
|
+
}
|
|
34072
|
+
/**
|
|
34073
|
+
* Build an unsigned withdraw create-intent transaction (lsoda* shares → any token). The backend
|
|
34074
|
+
* sets `hubWalletSwap` internally so the swap spends the lsoda* held in the user's hub wallet.
|
|
34075
|
+
*
|
|
34076
|
+
* @returns `Result<CreateIntentResponseV2>` — `{ tx, intent, relayData }`.
|
|
34077
|
+
*/
|
|
34078
|
+
async createWithdrawIntent(body, config) {
|
|
34079
|
+
const txSchema = rawTxSchemaForChainKey$1(body.srcChainKey);
|
|
34080
|
+
return this.request(
|
|
34081
|
+
"/leverage-yield/intents/withdraw",
|
|
34082
|
+
{ method: "POST", body: toJsonBody(body) },
|
|
34083
|
+
makeCreateIntentResponseSchema(txSchema),
|
|
34084
|
+
config
|
|
34085
|
+
);
|
|
34086
|
+
}
|
|
34087
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
34088
|
+
// Intent lifecycle: submit · status · cancel · hash · packet · extra-data
|
|
34089
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
34090
|
+
/**
|
|
34091
|
+
* Submit the broadcast intent tx to the relay.
|
|
34092
|
+
*
|
|
34093
|
+
* @returns `Result<SubmitIntentResponseV2>` — `{ result }` (opaque relay response).
|
|
34094
|
+
*/
|
|
34095
|
+
async submitIntent(body, config) {
|
|
34096
|
+
return this.request(
|
|
34097
|
+
"/leverage-yield/intents/submit",
|
|
34098
|
+
{ method: "POST", body: toJsonBody(body) },
|
|
34099
|
+
SubmitIntentResponseSchema,
|
|
34100
|
+
config
|
|
34101
|
+
);
|
|
34102
|
+
}
|
|
34103
|
+
/**
|
|
34104
|
+
* Poll the solver for intent execution status.
|
|
34105
|
+
*
|
|
34106
|
+
* @returns `Result<StatusResponseV2>` — `{ status, fillTxHash? }`.
|
|
34107
|
+
*/
|
|
34108
|
+
async getStatus(body, config) {
|
|
34109
|
+
return this.request(
|
|
34110
|
+
"/leverage-yield/intents/status",
|
|
34111
|
+
{ method: "POST", body: toJsonBody(body) },
|
|
34112
|
+
StatusResponseSchema,
|
|
34113
|
+
config
|
|
34114
|
+
);
|
|
34115
|
+
}
|
|
34116
|
+
/**
|
|
34117
|
+
* Build an unsigned cancel-intent transaction. The `intent` field carries `bigint` numerics —
|
|
34118
|
+
* {@link toJsonBody} serializes them to decimal strings.
|
|
34119
|
+
*
|
|
34120
|
+
* @returns `Result<CancelIntentResponseV2>` — `{ tx }`.
|
|
34121
|
+
*/
|
|
34122
|
+
async cancelIntent(body, config) {
|
|
34123
|
+
const txSchema = rawTxSchemaForChainKey$1(body.srcChainKey);
|
|
34124
|
+
return this.request(
|
|
34125
|
+
"/leverage-yield/intents/cancel",
|
|
34126
|
+
{ method: "POST", body: toJsonBody({ ...body, intent: _LeverageYieldApiService.toWireIntent(body.intent) }) },
|
|
34127
|
+
makeCancelIntentResponseSchema(txSchema),
|
|
34128
|
+
config
|
|
34129
|
+
);
|
|
34130
|
+
}
|
|
34131
|
+
/**
|
|
34132
|
+
* Compute the keccak256 hash of an Intent struct. The `intent` field carries `bigint` numerics.
|
|
34133
|
+
*
|
|
34134
|
+
* @returns `Result<IntentHashResponseV2>` — `{ hash }`.
|
|
34135
|
+
*/
|
|
34136
|
+
async getIntentHash(body, config) {
|
|
34137
|
+
return this.request(
|
|
34138
|
+
"/leverage-yield/intents/hash",
|
|
34139
|
+
{ method: "POST", body: toJsonBody({ ...body, intent: _LeverageYieldApiService.toWireIntent(body.intent) }) },
|
|
34140
|
+
IntentHashResponseSchema,
|
|
34141
|
+
config
|
|
34142
|
+
);
|
|
34143
|
+
}
|
|
34144
|
+
/**
|
|
34145
|
+
* Long-poll the relayer until the fill packet lands on the destination chain.
|
|
34146
|
+
*
|
|
34147
|
+
* @returns `Result<IntentPacketResponseV2>` — delivered packet data.
|
|
34148
|
+
*/
|
|
34149
|
+
async getSolvedIntentPacket(body, config) {
|
|
34150
|
+
return this.request(
|
|
34151
|
+
"/leverage-yield/intents/packet",
|
|
34152
|
+
{ method: "POST", body: toJsonBody(body) },
|
|
34153
|
+
IntentPacketResponseSchema,
|
|
34154
|
+
config
|
|
34155
|
+
);
|
|
34156
|
+
}
|
|
34157
|
+
/**
|
|
34158
|
+
* Recover the relay extra data needed by `/leverage-yield/intents/submit`. Provide EITHER
|
|
34159
|
+
* `txHash` OR `intent` (whose `bigint` numerics {@link toJsonBody} serializes).
|
|
34160
|
+
*
|
|
34161
|
+
* @returns `Result<IntentExtraDataResponseV2>` — `{ address, payload }`.
|
|
34162
|
+
*/
|
|
34163
|
+
async getIntentSubmitTxExtraData(body, config) {
|
|
34164
|
+
const normalized = body.intent ? { ...body, intent: _LeverageYieldApiService.toWireIntent(body.intent) } : body;
|
|
34165
|
+
return this.request(
|
|
34166
|
+
"/leverage-yield/intents/extra-data",
|
|
34167
|
+
{ method: "POST", body: toJsonBody(normalized) },
|
|
34168
|
+
RelayExtraDataResponseSchema$1,
|
|
34169
|
+
config
|
|
34170
|
+
);
|
|
34171
|
+
}
|
|
34172
|
+
/**
|
|
34173
|
+
* Get the on-chain fill state for an intent by its hub-chain tx hash.
|
|
34174
|
+
*
|
|
34175
|
+
* @returns `Result<IntentStateV2>` — `{ exists, remainingInput, receivedOutput, pendingPayment }`.
|
|
34176
|
+
*/
|
|
34177
|
+
async getFilledIntent(txHash, config) {
|
|
34178
|
+
return this.request(
|
|
34179
|
+
`/leverage-yield/intents/${txHash}/fill`,
|
|
34180
|
+
{ method: "GET" },
|
|
34181
|
+
IntentStateSchema,
|
|
34182
|
+
config
|
|
34183
|
+
);
|
|
34184
|
+
}
|
|
34185
|
+
/**
|
|
34186
|
+
* Look up an Intent struct by its hub-chain creation tx hash.
|
|
34187
|
+
*
|
|
34188
|
+
* @returns `Result<GetIntentResponseV2>` — the decoded intent (bigint fields as decimal strings).
|
|
34189
|
+
*/
|
|
34190
|
+
async getIntent(txHash, config) {
|
|
34191
|
+
return this.request(`/leverage-yield/intents/${txHash}`, { method: "GET" }, IntentResponseSchema$1, config);
|
|
34192
|
+
}
|
|
34193
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
34194
|
+
// Gas · fees
|
|
34195
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
34196
|
+
/**
|
|
34197
|
+
* Estimate gas for a raw transaction on a spoke chain.
|
|
34198
|
+
*
|
|
34199
|
+
* @returns `Result<GasEstimateResponseV2>` — `{ gas }` (chain-specific shape).
|
|
34200
|
+
*/
|
|
34201
|
+
async estimateGas(body, config) {
|
|
34202
|
+
return this.request(
|
|
34203
|
+
"/leverage-yield/gas/estimate",
|
|
34204
|
+
{ method: "POST", body: toJsonBody(body) },
|
|
34205
|
+
GasEstimateResponseSchema,
|
|
34206
|
+
config
|
|
34207
|
+
);
|
|
34208
|
+
}
|
|
34209
|
+
/**
|
|
34210
|
+
* Compute the partner fee for a given input amount.
|
|
34211
|
+
*
|
|
34212
|
+
* @returns `Result<FeeResponseV2>` — `{ fee }` (decimal string).
|
|
34213
|
+
*/
|
|
34214
|
+
async getPartnerFee(query, config) {
|
|
34215
|
+
return this.request(
|
|
34216
|
+
this.withQuery("/leverage-yield/fees/partner", { amount: query.amount }),
|
|
34217
|
+
{ method: "GET" },
|
|
34218
|
+
FeeResponseSchema,
|
|
34219
|
+
config
|
|
34220
|
+
);
|
|
34221
|
+
}
|
|
34222
|
+
/**
|
|
34223
|
+
* Compute the protocol (solver) fee for a given input amount.
|
|
34224
|
+
*
|
|
34225
|
+
* @returns `Result<FeeResponseV2>` — `{ fee }` (decimal string).
|
|
34226
|
+
*/
|
|
34227
|
+
async getSolverFee(query, config) {
|
|
34228
|
+
return this.request(
|
|
34229
|
+
this.withQuery("/leverage-yield/fees/solver", { amount: query.amount }),
|
|
34230
|
+
{ method: "GET" },
|
|
34231
|
+
FeeResponseSchema,
|
|
34232
|
+
config
|
|
34233
|
+
);
|
|
34234
|
+
}
|
|
34235
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
34236
|
+
// Submit-tx state machine
|
|
34237
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
34238
|
+
/**
|
|
34239
|
+
* Submit a vault-swap transaction to be processed (relay, post-execution, etc.). The `intent`
|
|
34240
|
+
* field carries `bigint` numerics — {@link toJsonBody} serializes them. Idempotent on
|
|
34241
|
+
* `(txHash, srcChainKey)`.
|
|
34242
|
+
*
|
|
34243
|
+
* @returns `Result<SubmitTxResponseV2>` — `{ success, data: { status, message } }`.
|
|
34244
|
+
*/
|
|
34245
|
+
async submitTx(body, config) {
|
|
34246
|
+
return this.request(
|
|
34247
|
+
"/leverage-yield/submit-tx",
|
|
34248
|
+
{ method: "POST", body: toJsonBody({ ...body, intent: _LeverageYieldApiService.toWireIntent(body.intent) }) },
|
|
34249
|
+
SubmitTxResponseSchema,
|
|
34250
|
+
config
|
|
34251
|
+
);
|
|
34252
|
+
}
|
|
34253
|
+
/**
|
|
34254
|
+
* Get the processing status of a submitted vault-swap transaction by `(txHash, srcChainKey)`.
|
|
34255
|
+
*
|
|
34256
|
+
* @returns `Result<SubmitTxStatusResponseV2>` — `{ success, data }` (processing state).
|
|
34257
|
+
*/
|
|
34258
|
+
async getSubmitTxStatus(query, config) {
|
|
34259
|
+
return this.request(
|
|
34260
|
+
this.withQuery("/leverage-yield/submit-tx/status", { txHash: query.txHash, srcChainKey: query.srcChainKey }),
|
|
34261
|
+
{ method: "GET" },
|
|
34262
|
+
SubmitTxStatusResponseSchema,
|
|
34263
|
+
config
|
|
34264
|
+
);
|
|
34265
|
+
}
|
|
34266
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
34267
|
+
// Utilities (parity with SwapsApiService)
|
|
34268
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
34269
|
+
/**
|
|
34270
|
+
* Merge additional headers into the service's default header set. Existing keys are
|
|
34271
|
+
* overwritten; keys absent from `headers` are preserved.
|
|
34272
|
+
*/
|
|
34273
|
+
setHeaders(headers) {
|
|
34274
|
+
assignHeaders(this.headers, headers);
|
|
34275
|
+
}
|
|
34276
|
+
/** Return the base URL the service is currently pointing at. */
|
|
34277
|
+
getBaseURL() {
|
|
34278
|
+
return this.config.baseURL;
|
|
34279
|
+
}
|
|
34280
|
+
/**
|
|
34281
|
+
* Return the effective per-request timeout (ms).
|
|
34282
|
+
*
|
|
34283
|
+
* Callers bounding a request tighter than this need it as the CEILING, because a
|
|
34284
|
+
* `RequestOverrideConfig.timeout` REPLACES the service value rather than lowering it: an override
|
|
34285
|
+
* derived from a caller budget alone would raise the bound whenever that budget is the larger of the
|
|
34286
|
+
* two. `SubmitTxAttempt.requestTimeout` clamps against both (`min(budget left in the attempt, this)`).
|
|
34287
|
+
*/
|
|
34288
|
+
getTimeout() {
|
|
34289
|
+
return this.config.timeout;
|
|
34290
|
+
}
|
|
34291
|
+
};
|
|
32853
34292
|
|
|
32854
34293
|
// src/backendApi/BackendApiService.ts
|
|
32855
34294
|
var BackendApiService = class {
|
|
@@ -32857,6 +34296,7 @@ var BackendApiService = class {
|
|
|
32857
34296
|
swaps;
|
|
32858
34297
|
sponsoring;
|
|
32859
34298
|
bridge;
|
|
34299
|
+
leverageYield;
|
|
32860
34300
|
// resolved base-API config: the flat fields of the ApiConfig union with any `baseApiConfig` layered on
|
|
32861
34301
|
// top. `baseURL` is the gateway root; `basePath` is this service's own mount below it.
|
|
32862
34302
|
config;
|
|
@@ -32885,6 +34325,7 @@ var BackendApiService = class {
|
|
|
32885
34325
|
const swapsConfig2 = resolveSwapsApiConfig(config);
|
|
32886
34326
|
const sponsoringConfig = resolveSponsoringApiConfig(config);
|
|
32887
34327
|
const bridgeConfig2 = resolveBridgeApiConfig(config);
|
|
34328
|
+
const leverageYieldConfig2 = resolveLeverageYieldApiConfig(config);
|
|
32888
34329
|
const shortRoots = [
|
|
32889
34330
|
["backendApi", this.config.baseURL],
|
|
32890
34331
|
["api.swaps", swapsConfig2.baseURL],
|
|
@@ -32909,6 +34350,11 @@ var BackendApiService = class {
|
|
|
32909
34350
|
inheritedApiKeyBaseURLs: [DEFAULT_SPONSORING_API_ENDPOINT, this.config.baseURL]
|
|
32910
34351
|
});
|
|
32911
34352
|
this.bridge = new BridgeApiService(withApiKey(bridgeConfig2, options.apiKey), this.logger, overrideOptions);
|
|
34353
|
+
this.leverageYield = new LeverageYieldApiService(
|
|
34354
|
+
withApiKey(leverageYieldConfig2, options.apiKey),
|
|
34355
|
+
this.logger,
|
|
34356
|
+
overrideOptions
|
|
34357
|
+
);
|
|
32912
34358
|
}
|
|
32913
34359
|
/**
|
|
32914
34360
|
* Issue the HTTP call for a route.
|
|
@@ -33312,15 +34758,17 @@ var BackendApiService = class {
|
|
|
33312
34758
|
* without constructing a new service instance. Existing header keys are
|
|
33313
34759
|
* overwritten; keys absent from `headers` are preserved.
|
|
33314
34760
|
*
|
|
33315
|
-
* Headers also reach `swaps` and `
|
|
33316
|
-
* base-API credentials must not be forwarded to whatever origin it points at. Note
|
|
33317
|
-
* retargeted to another origin via `swapsApiConfig`, in which case a header set
|
|
34761
|
+
* Headers also reach `swaps`, `bridge` and `leverageYield`, but never `sponsoring`: it is configured
|
|
34762
|
+
* independently, so base-API credentials must not be forwarded to whatever origin it points at. Note
|
|
34763
|
+
* `swaps` can also be retargeted to another origin via `swapsApiConfig`, in which case a header set
|
|
34764
|
+
* here follows it.
|
|
33318
34765
|
*
|
|
33319
34766
|
* @param headers - Key-value pairs to add or overwrite in the default headers.
|
|
33320
34767
|
*/
|
|
33321
34768
|
setHeaders(headers) {
|
|
33322
34769
|
assignHeaders(this.headers, headers);
|
|
33323
34770
|
this.swaps.setHeaders(headers);
|
|
34771
|
+
this.leverageYield.setHeaders(headers);
|
|
33324
34772
|
this.bridge.setHeaders(headers);
|
|
33325
34773
|
}
|
|
33326
34774
|
/**
|
|
@@ -36262,7 +37710,7 @@ var AssetService = class {
|
|
|
36262
37710
|
ok: true,
|
|
36263
37711
|
value: {
|
|
36264
37712
|
tx: txResult.value,
|
|
36265
|
-
relayData: { address:
|
|
37713
|
+
relayData: { address: fromHubWallet, payload: data }
|
|
36266
37714
|
}
|
|
36267
37715
|
};
|
|
36268
37716
|
} catch (error) {
|
|
@@ -41546,7 +42994,9 @@ var PartnerFeeClaimService = class {
|
|
|
41546
42994
|
isEvmWalletProviderType(walletProvider),
|
|
41547
42995
|
"PartnerFeeClaimService only supports Evm (sonic) wallet provider"
|
|
41548
42996
|
);
|
|
41549
|
-
const txHash = await walletProvider.sendTransaction(rawTx
|
|
42997
|
+
const txHash = await walletProvider.sendTransaction(rawTx, {
|
|
42998
|
+
expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id
|
|
42999
|
+
});
|
|
41550
43000
|
return {
|
|
41551
43001
|
ok: true,
|
|
41552
43002
|
value: txHash
|
|
@@ -41741,7 +43191,9 @@ var PartnerFeeClaimService = class {
|
|
|
41741
43191
|
value: rawTx
|
|
41742
43192
|
};
|
|
41743
43193
|
}
|
|
41744
|
-
const txHash = await _params.walletProvider.sendTransaction(rawTx
|
|
43194
|
+
const txHash = await _params.walletProvider.sendTransaction(rawTx, {
|
|
43195
|
+
expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id
|
|
43196
|
+
});
|
|
41745
43197
|
return {
|
|
41746
43198
|
ok: true,
|
|
41747
43199
|
value: txHash
|
|
@@ -41888,7 +43340,9 @@ var PartnerFeeClaimService = class {
|
|
|
41888
43340
|
value: rawTx
|
|
41889
43341
|
};
|
|
41890
43342
|
}
|
|
41891
|
-
const txHash = await _params.walletProvider.sendTransaction(rawTx
|
|
43343
|
+
const txHash = await _params.walletProvider.sendTransaction(rawTx, {
|
|
43344
|
+
expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id
|
|
43345
|
+
});
|
|
41892
43346
|
return {
|
|
41893
43347
|
ok: true,
|
|
41894
43348
|
value: txHash
|
|
@@ -42265,10 +43719,20 @@ var LeverageYieldService = class {
|
|
|
42265
43719
|
hubProvider;
|
|
42266
43720
|
config;
|
|
42267
43721
|
spoke;
|
|
42268
|
-
|
|
43722
|
+
backendApi;
|
|
43723
|
+
/**
|
|
43724
|
+
* Effective backend submit-tx flow (`leverageYield.useBackendSubmitTx`, default off). Read live off
|
|
43725
|
+
* `ConfigService`, like `config.leverageYieldPartnerFee`, so the config object and the behavior can
|
|
43726
|
+
* never disagree.
|
|
43727
|
+
*/
|
|
43728
|
+
get useBackendSubmitTx() {
|
|
43729
|
+
return this.config.leverageYieldUseBackendSubmitTx;
|
|
43730
|
+
}
|
|
43731
|
+
constructor({ hubProvider, config, spoke, backendApi }) {
|
|
42269
43732
|
this.hubProvider = hubProvider;
|
|
42270
43733
|
this.config = config;
|
|
42271
43734
|
this.spoke = spoke;
|
|
43735
|
+
this.backendApi = backendApi;
|
|
42272
43736
|
}
|
|
42273
43737
|
// ─── Registry ──────────────────────────────────────────────────────────
|
|
42274
43738
|
/** Returns the static registry of known leverage-yield vaults. */
|
|
@@ -42277,7 +43741,7 @@ var LeverageYieldService = class {
|
|
|
42277
43741
|
}
|
|
42278
43742
|
/** Looks up a vault by its `name` field. Returns `undefined` when not registered. */
|
|
42279
43743
|
getVault(name) {
|
|
42280
|
-
return this.listVaults().find((
|
|
43744
|
+
return this.listVaults().find((v12) => v12.name === name);
|
|
42281
43745
|
}
|
|
42282
43746
|
/**
|
|
42283
43747
|
* Looks up a registered vault by its on-chain proxy address (case-insensitive).
|
|
@@ -42285,7 +43749,7 @@ var LeverageYieldService = class {
|
|
|
42285
43749
|
*/
|
|
42286
43750
|
getVaultByAddress(address) {
|
|
42287
43751
|
const normalized = address.toLowerCase();
|
|
42288
|
-
return this.listVaults().find((
|
|
43752
|
+
return this.listVaults().find((v12) => v12.vault.toLowerCase() === normalized);
|
|
42289
43753
|
}
|
|
42290
43754
|
/**
|
|
42291
43755
|
* Resolves the intent `deadline`: returns the caller-supplied value verbatim, otherwise
|
|
@@ -42708,62 +44172,21 @@ var LeverageYieldService = class {
|
|
|
42708
44172
|
"vaultSwap",
|
|
42709
44173
|
async () => {
|
|
42710
44174
|
try {
|
|
42711
|
-
const timeout = _params.timeout;
|
|
42712
44175
|
const createIntentResult = await this.createVaultIntent(_params);
|
|
42713
44176
|
if (!createIntentResult.ok) {
|
|
42714
44177
|
return { ok: false, error: createIntentResult.error };
|
|
42715
44178
|
}
|
|
42716
|
-
const
|
|
42717
|
-
const
|
|
42718
|
-
|
|
42719
|
-
|
|
42720
|
-
|
|
42721
|
-
|
|
42722
|
-
|
|
42723
|
-
|
|
42724
|
-
|
|
42725
|
-
};
|
|
42726
|
-
}
|
|
42727
|
-
let dstIntentTxHash;
|
|
42728
|
-
if (isHubChainKeyType(srcChainKey)) {
|
|
42729
|
-
dstIntentTxHash = spokeTxHash;
|
|
42730
|
-
} else {
|
|
42731
|
-
const packet = await relayTxAndWaitPacket({
|
|
42732
|
-
srcTxHash: spokeTxHash,
|
|
42733
|
-
data: relayData,
|
|
42734
|
-
chainKey: srcChainKey,
|
|
42735
|
-
relayerApiEndpoint: this.config.relay.relayerApiEndpoint,
|
|
42736
|
-
timeout
|
|
42737
|
-
});
|
|
42738
|
-
if (!packet.ok) {
|
|
42739
|
-
return {
|
|
42740
|
-
ok: false,
|
|
42741
|
-
error: mapRelayFailure(packet.error, { feature: "leverageYield", ...baseCtx })
|
|
42742
|
-
};
|
|
42743
|
-
}
|
|
42744
|
-
dstIntentTxHash = packet.value.dst_tx_hash;
|
|
42745
|
-
}
|
|
42746
|
-
const postExecResult = await this.notifySolver({
|
|
42747
|
-
intent_tx_hash: dstIntentTxHash
|
|
42748
|
-
});
|
|
42749
|
-
if (!postExecResult.ok) {
|
|
42750
|
-
return { ok: false, error: postExecResult.error };
|
|
44179
|
+
const created = createIntentResult.value;
|
|
44180
|
+
const timeoutMs = resolveTimeoutMs(_params.timeout, DEFAULT_RELAY_TX_TIMEOUT);
|
|
44181
|
+
if (this.useBackendSubmitTx) {
|
|
44182
|
+
const submitted = await this.submitTx(_params, created, createSubmitTxAttempt(timeoutMs));
|
|
44183
|
+
if (submitted.ok) return submitted;
|
|
44184
|
+
this.config.logger.warn(
|
|
44185
|
+
"[leverageYield] backend submit-tx did not complete; falling back to the client-side relay",
|
|
44186
|
+
{ error: submitted.error }
|
|
44187
|
+
);
|
|
42751
44188
|
}
|
|
42752
|
-
return
|
|
42753
|
-
ok: true,
|
|
42754
|
-
value: {
|
|
42755
|
-
solverExecutionResponse: postExecResult.value,
|
|
42756
|
-
intent,
|
|
42757
|
-
intentDeliveryInfo: {
|
|
42758
|
-
srcChainKey,
|
|
42759
|
-
srcTxHash: spokeTxHash,
|
|
42760
|
-
srcAddress: params.srcAddress,
|
|
42761
|
-
dstChainKey: params.dstChainKey,
|
|
42762
|
-
dstTxHash: dstIntentTxHash,
|
|
42763
|
-
dstAddress: params.dstAddress
|
|
42764
|
-
}
|
|
42765
|
-
}
|
|
42766
|
-
};
|
|
44189
|
+
return this.fallbackVaultSwapSteps(_params, created, timeoutMs);
|
|
42767
44190
|
} catch (error) {
|
|
42768
44191
|
if (isLeverageYieldSwapError(error)) return { ok: false, error };
|
|
42769
44192
|
return {
|
|
@@ -42791,6 +44214,129 @@ var LeverageYieldService = class {
|
|
|
42791
44214
|
}
|
|
42792
44215
|
);
|
|
42793
44216
|
}
|
|
44217
|
+
/**
|
|
44218
|
+
* Client-side vault-swap completion (the default path): verify the broadcast intent tx landed,
|
|
44219
|
+
* relay it to the hub (Sonic) — or use it directly when the source IS the hub — then notify the
|
|
44220
|
+
* solver via {@link LeverageYieldService.notifySolver} and build the {@link VaultSwapResponse}.
|
|
44221
|
+
* Extracted from `vaultSwap()` so the opt-in backend 2-step path ({@link LeverageYieldService.submitTx})
|
|
44222
|
+
* can fall back to it on any non-success. Leverage-yield copy of `SwapService.fallbackSwapSteps`.
|
|
44223
|
+
*/
|
|
44224
|
+
async fallbackVaultSwapSteps(_params, created, timeoutMs) {
|
|
44225
|
+
const { params } = _params;
|
|
44226
|
+
const srcChainKey = params.srcChainKey;
|
|
44227
|
+
const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey, action: "vaultSwap" };
|
|
44228
|
+
const { tx: spokeTxHash, intent, relayData } = created;
|
|
44229
|
+
const verifyTxHashResult = await this.spoke.verifyTxHash({
|
|
44230
|
+
txHash: spokeTxHash,
|
|
44231
|
+
chainKey: srcChainKey
|
|
44232
|
+
});
|
|
44233
|
+
if (!verifyTxHashResult.ok) {
|
|
44234
|
+
return { ok: false, error: verifyFailed("leverageYield", verifyTxHashResult.error, baseCtx) };
|
|
44235
|
+
}
|
|
44236
|
+
let dstIntentTxHash;
|
|
44237
|
+
if (isHubChainKeyType(srcChainKey)) {
|
|
44238
|
+
dstIntentTxHash = spokeTxHash;
|
|
44239
|
+
} else {
|
|
44240
|
+
const packet = await relayTxAndWaitPacket({
|
|
44241
|
+
srcTxHash: spokeTxHash,
|
|
44242
|
+
data: relayData,
|
|
44243
|
+
chainKey: srcChainKey,
|
|
44244
|
+
relayerApiEndpoint: this.config.relay.relayerApiEndpoint,
|
|
44245
|
+
// The caller's full `timeout`, starting HERE — whether this runs as the only path or as the
|
|
44246
|
+
// backend's fallback, so a stalled backend attempt cannot shorten the relay wait. The floor
|
|
44247
|
+
// covers a sub-floor caller `timeout`: `relayTxAndWaitPacket` SUBMITS before `timeout` bounds
|
|
44248
|
+
// anything, so a zero budget would strand an already-landed tx unrelayed.
|
|
44249
|
+
timeout: Math.max(timeoutMs, RELAY_FALLBACK_FLOOR_MS)
|
|
44250
|
+
});
|
|
44251
|
+
if (!packet.ok) {
|
|
44252
|
+
return { ok: false, error: mapRelayFailure(packet.error, { feature: "leverageYield", ...baseCtx }) };
|
|
44253
|
+
}
|
|
44254
|
+
dstIntentTxHash = packet.value.dst_tx_hash;
|
|
44255
|
+
}
|
|
44256
|
+
const postExecResult = await this.notifySolver({
|
|
44257
|
+
intent_tx_hash: dstIntentTxHash
|
|
44258
|
+
});
|
|
44259
|
+
if (!postExecResult.ok) {
|
|
44260
|
+
return { ok: false, error: postExecResult.error };
|
|
44261
|
+
}
|
|
44262
|
+
return {
|
|
44263
|
+
ok: true,
|
|
44264
|
+
value: {
|
|
44265
|
+
solverExecutionResponse: postExecResult.value,
|
|
44266
|
+
intent,
|
|
44267
|
+
intentDeliveryInfo: {
|
|
44268
|
+
srcChainKey,
|
|
44269
|
+
srcTxHash: spokeTxHash,
|
|
44270
|
+
srcAddress: params.srcAddress,
|
|
44271
|
+
dstChainKey: params.dstChainKey,
|
|
44272
|
+
dstTxHash: dstIntentTxHash,
|
|
44273
|
+
dstAddress: params.dstAddress
|
|
44274
|
+
}
|
|
44275
|
+
}
|
|
44276
|
+
};
|
|
44277
|
+
}
|
|
44278
|
+
/**
|
|
44279
|
+
* Backend 2-step vault-swap path (opt-in via `leverageYield.useBackendSubmitTx`): hand the
|
|
44280
|
+
* broadcast intent tx to the leverage-yield API (`POST /leverage-yield/submit-tx`); the backend
|
|
44281
|
+
* relays + post-executes server-side. Polls `getSubmitTxStatus` until `solved`, then reconstructs
|
|
44282
|
+
* the same {@link VaultSwapResponse} the client-side path returns.
|
|
44283
|
+
*
|
|
44284
|
+
* Never throws — returns `{ ok: false }` on any non-success (submit `!ok`, a 200 the backend did not
|
|
44285
|
+
* accept, terminal `failed` / abandoned, or poll timeout) so `vaultSwap()` falls back to
|
|
44286
|
+
* {@link LeverageYieldService.fallbackVaultSwapSteps}. Falling back is safe: re-relaying / re-posting
|
|
44287
|
+
* an already-processed vault swap is idempotent (the relay dedups the `executed` packet and the solver
|
|
44288
|
+
* re-affirms the intent — no double-fill), and load-bearing rather than belt-and-braces: the backend
|
|
44289
|
+
* keeps processing after this attempt gives up, so the fallback's relay can race the backend's own.
|
|
44290
|
+
*
|
|
44291
|
+
* The attempt itself — POST, budget clamps, status poll — is {@link runBackendSubmitTx}, shared with
|
|
44292
|
+
* swaps and bridge. What is leverage-yield-specific and lives here: the request body (including the
|
|
44293
|
+
* `operation` discriminator), the `solved` terminal status, the mapping to a
|
|
44294
|
+
* {@link VaultSwapResponse}, and the leverage-yield error taxonomy.
|
|
44295
|
+
*
|
|
44296
|
+
* `attempt` bounds this attempt alone — the POST and every status request draw on it, and the
|
|
44297
|
+
* client-side fallback holds a separate fresh `timeout`.
|
|
44298
|
+
*/
|
|
44299
|
+
async submitTx(_params, created, attempt) {
|
|
44300
|
+
const { params } = _params;
|
|
44301
|
+
const srcChainKey = params.srcChainKey;
|
|
44302
|
+
const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey, action: "vaultSwap" };
|
|
44303
|
+
const { tx: spokeTxHash, intent, relayData } = created;
|
|
44304
|
+
try {
|
|
44305
|
+
const outcome = await runBackendSubmitTx({
|
|
44306
|
+
attempt,
|
|
44307
|
+
api: this.backendApi.leverageYield,
|
|
44308
|
+
body: {
|
|
44309
|
+
txHash: spokeTxHash,
|
|
44310
|
+
srcChainKey,
|
|
44311
|
+
walletAddress: params.srcAddress,
|
|
44312
|
+
intent,
|
|
44313
|
+
relayData: relayData.payload,
|
|
44314
|
+
// `withdraw` sets `hubWalletSwap: true` (spends the hub-wallet lsoda*); a plain deposit doesn't.
|
|
44315
|
+
operation: _params.hubWalletSwap ? "withdraw" : "deposit"
|
|
44316
|
+
},
|
|
44317
|
+
statusQuery: { txHash: spokeTxHash, srcChainKey },
|
|
44318
|
+
// A vault deposit/withdraw IS a solver swap, so terminal success is `solved` — not bridge's
|
|
44319
|
+
// `executed`.
|
|
44320
|
+
terminalStatus: "solved",
|
|
44321
|
+
onExecuted: (result) => result?.dstIntentTxHash && result.intent_hash ? {
|
|
44322
|
+
// Backend serializes the hex intent_hash as a plain string; brand it at the boundary.
|
|
44323
|
+
solverExecutionResponse: { answer: "OK", intent_hash: result.intent_hash },
|
|
44324
|
+
intent,
|
|
44325
|
+
intentDeliveryInfo: {
|
|
44326
|
+
srcChainKey,
|
|
44327
|
+
srcTxHash: spokeTxHash,
|
|
44328
|
+
srcAddress: params.srcAddress,
|
|
44329
|
+
dstChainKey: params.dstChainKey,
|
|
44330
|
+
dstTxHash: result.dstIntentTxHash,
|
|
44331
|
+
dstAddress: params.dstAddress
|
|
44332
|
+
}
|
|
44333
|
+
} : void 0
|
|
44334
|
+
});
|
|
44335
|
+
return outcome.ok ? { ok: true, value: outcome.value } : { ok: false, error: executionFailed("leverageYield", outcome.cause, baseCtx) };
|
|
44336
|
+
} catch (error) {
|
|
44337
|
+
return { ok: false, error: unknownFailed("leverageYield", error, baseCtx) };
|
|
44338
|
+
}
|
|
44339
|
+
}
|
|
42794
44340
|
/**
|
|
42795
44341
|
* Notifies the solver that the vault intent landed on the hub, triggering it to fill.
|
|
42796
44342
|
* Leverage-yield copy of the swap domain's `postExecution` — emits only
|
|
@@ -43802,7 +45348,8 @@ var Sodax = class {
|
|
|
43802
45348
|
this.leverageYield = new LeverageYieldService({
|
|
43803
45349
|
hubProvider: this.hubProvider,
|
|
43804
45350
|
config: this.config,
|
|
43805
|
-
spoke: this.spoke
|
|
45351
|
+
spoke: this.spoke,
|
|
45352
|
+
backendApi: this.backendApi
|
|
43806
45353
|
});
|
|
43807
45354
|
this.sponsoring = new SponsoringService({
|
|
43808
45355
|
config: this.config,
|
|
@@ -43850,4 +45397,4 @@ var isPartnerError = isCodeMember(PARTNER_CODES);
|
|
|
43850
45397
|
(*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
43851
45398
|
*/
|
|
43852
45399
|
|
|
43853
|
-
export { ALLOWANCE_CHECK_CODES, APPROVE_CODES, AssetService, BACKEND_API_BASE_PATH, BITCOIN_CHAIN_KEYS, BITCOIN_CHAIN_KEYS_SET, BITCOIN_DUST_SATS, BTC_WALLET_ADDRESS_TYPES, BackendApiService, BackendHttpError, BalnSwapService, BigIntToHex, BigNumberZeroDecimal, BitcoinSpokeService, BnUSDMigrationService, BridgeApiService, BridgeService, CHAIN_KEYS, CHAIN_LOGO_BASE_URL, CONFIG_VERSION, CREATE_INTENT_CODES, ChainKeys, ChainTypeArr, ClService, ConfigService, CustomSorobanServer, CustomStellarAccount, DEFAULT_API_BASE_URL, 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, DEFAULT_SPONSORING_API_ENDPOINT, DETAILED_STATUS_NOT_DELIVERED, DexService, EVM_CHAIN_ID_TO_KEY, EVM_CHAIN_KEYS, EVM_CHAIN_KEYS_SET, EVM_SPOKE_ONLY_CHAIN_KEYS, EVM_SPOKE_ONLY_CHAIN_KEYS_SET, Erc20Service, Erc4626Service, EvmAssetManagerService, EvmHubProvider, EvmSolverService, EvmSpokeService, EvmVaultTokenService, FEE_PERCENTAGE_SCALE, GAS_ESTIMATION_CODES, HALF_RAY, HALF_WAD, HUB_CHAIN_KEY, HookKind, HookService, HttpRelayError, HubVaultSymbols, ICON_CHAIN_KEYS, ICON_CHAIN_KEYS_SET, ICON_TX_RESULT_WAIT_MAX_RETRY, INJECTIVE_CHAIN_KEYS, INJECTIVE_CHAIN_KEYS_SET, INTENT_CHAIN_IDS, IconSpokeService, IcxMigrationService, Injective20Token, InjectiveSpokeService, IntentCreatedEventAbi, IntentDataService, IntentDataType, IntentFilledEventAbi, IntentRelayChainIdToChainKey, IntentsAbi, LOOKUP_CODES, LTV_PRECISION, LendingPoolService, LeverageYieldService, LockupMultiplier, LockupPeriod, LsodaSymbols, LsodaTokens, MAX_UINT256, MigrationService, MintPositionEventAbi, MoneyMarketDataService, MoneyMarketService, NEAR_CHAIN_KEYS, NEAR_CHAIN_KEYS_SET, NEAR_DEFAULT_GAS, NEAR_STORAGE_DEPOSIT, NearSpokeService, ORACLE_CANDLE_INTERVALS, PartnerFeeClaimService, PartnerService, Permit2Service, ProtocolIntentsAbi, RAY, RAY_DECIMALS, RELAY_ERROR_CODES, RELAY_FALLBACK_FLOOR_MS, RELAY_REQUEST_TIMEOUT_MS, RadfiApiError, RadfiProvider, RecoveryService, RelayChainIdMap, SECONDS_PER_YEAR, SODAX_ERROR_CODES, SODAX_FEATURES, SOLANA_CHAIN_KEYS, SOLANA_CHAIN_KEYS_SET, SONIC_CHAIN_KEYS, SONIC_CHAIN_KEYS_SET, SPEED_TIER_SECONDS, SPEED_TIER_THRESHOLDS, SPONSORING_API_ERROR_CODES, SPONSORING_API_STELLAR_BASE_PATH, SPONSOR_CONFIG_TTL_MS, STACKS_CHAIN_KEYS, STACKS_CHAIN_KEYS_SET, STELLAR_BASE_RESERVE_TTL_MS, STELLAR_CHAIN_KEYS, STELLAR_CHAIN_KEYS_SET, STELLAR_TRUSTLINE_MIN_XLM_STROOPS, SUI_CHAIN_KEYS, SUI_CHAIN_KEYS_SET, SodaTokens, Sodax, SodaxError, SolanaSpokeService, SolverApiService, SolverIntentErrorCode, SolverIntentStatusCode, SonicSpokeService, SpokeService, SponsoringApiService, SponsoringService, StacksSpokeService, StakingLogic, StakingService, StatATokenAddresses, StellarSpokeService, SuiGrpcTransport, SuiSpokeService, SupportedMigrationTokens, SwapService, SwapsApiService, TOKEN_LOGO_BASE_URL, USD_DECIMALS, UiPoolDataProviderService, VAULT_TOKEN_DECIMALS, WAD, WAD_RAY_RATIO, WEI_DECIMALS, adjustAmountByFee, allowanceCheckFailed, apiConfig, approveFailed, arbitrumSupportedTokens, assetManagerAbi, avalancheSupportedTokens, balnSwapAbi, baseChainInfo, baseSupportedTokens, binomialApproximatedRayPow, bitcoinSupportedTokens, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bridgeConfig, bridgeInvariant, bscSupportedTokens, calcOpReturnOutputVbytes, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, clPoolAbi, clPoolManagerAbi, clPositionManagerAbi, clQuoterAbi, clRouterAbi, clTickLensAbi, classifySponsorError, concentratedLiquidityConfig, connectionAbi, consoleLogger, convertTransactionInstructionToRaw, createBalanceCollector, createInvariant, deepMerge, defaultHookAbi, detectBitcoinAddressType, dexConfig, dexInvariant, dexPools, encodeAddress, encodeBtcPayloadToBytes, encodeContractCalls, erc20Abi, erc4626Abi, estimateBitcoinTxSize, estimateSwapSpeedTier, ethereumSupportedTokens, executionFailed, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, gasEstimationFailed, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getAssetManagerIdl, getAssetManagerProgram, getChainKeyFromRelayChainId, getChainType, getCompoundedBalance, getConcentratedLiquidityConfig, getConnectionIdl, getConnectionProgram, getEvmChainKeyByChainId, getEvmViemChain, getIconAddressBytes, getIntentRelayChainId, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getProvider, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getSolverConfig, getSpokeHook, getSpokeHooks, getStagingSolverTokens, getSupportedSolverTokens, getTransactionPackets, getbnUSDToken, hederaSupportedTokens, hexToBigInt, hexToSolanaAddress, hubConfig, hyper, hyperevmSupportedTokens, iconSupportedTokens, injectiveSupportedTokens, intentCreationFailed, isApprovalSupportedChainKeyType, isAuthFailure, isAuthStatus, isBackendHttpError, isBalnMigrateParams, isBitcoinChainKey, isBitcoinChainKeyType, isBitcoinWalletProviderType, isBridgeAllowanceCheckError, isBridgeApproveError, isBridgeCreateIntentError, isBridgeError, isBridgeLookupError, isBridgeOrchestrationError, isCodeMember, isDexApproveError, isDexCreateIntentError, isDexError, isEvmChainKey, isEvmChainKeyType, isEvmSpokeChainConfig, isEvmSpokeOnlyChainKey, isEvmSpokeOnlyChainKeyType, isEvmWalletProviderType, isFeatureError, isFillEvent, isHookSupportedToken, isHubChainKey, isHubChainKeyType, isIconAddress, isIconChainKey, isIconChainKeyType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveChainKey, isInjectiveChainKeyType, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isLeverageYieldAllowanceCheckError, isLeverageYieldApproveError, isLeverageYieldCreateIntentError, isLeverageYieldError, isLeverageYieldLookupError, isLeverageYieldPostExecutionError, isLeverageYieldSwapError, isMigrateOrchestrationError, isMigrationAllowanceCheckError, isMigrationApproveError, isMigrationCreateIntentError, isMigrationError, isMigrationLookupError, isMoneyMarketAllowanceCheckError, isMoneyMarketApproveError, isMoneyMarketCreateIntentError, isMoneyMarketError, isMoneyMarketGasEstimationError, isMoneyMarketOrchestrationError, isNativeBitcoinToken, isNativeBitcoinTransfer, isNativeToken, isNearChainKey, isNearChainKeyType, isNewbnUSDChainId, isNewbnUSDToken, isOptionalBitcoinWalletProviderType, isOptionalEvmWalletProviderType, isOptionalStellarWalletProviderType, isOracleCandleInterval, isPartnerError, isPartnerFeeAmount, isPartnerFeePercentage, isPostExecutionError, isRawDestinationParams, isRecoveryError, isResponseAddressType, isResponseSigningType, isRevertMigrationOrchestrationError, isSodaxError, isSolanaChainKey, isSolanaChainKeyType, isSolanaNativeToken, isSonicChainKey, isSonicChainKeyType, isSpokeApproveParamsEvmSpoke, isSpokeApproveParamsHub, isSpokeApproveParamsStellar, isSpokeChainKey, isSpokeIsAllowanceValidParamsEvmSpoke, isSpokeIsAllowanceValidParamsHub, isSpokeIsAllowanceValidParamsStellar, isSponsoringConfigError, isSponsoringLookupError, isSponsoringOrchestrationError, isStacksChainKey, isStacksChainKeyType, isStakeOrchestrationError, isStakingAllowanceCheckError, isStakingApproveError, isStakingCreateIntentError, isStakingError, isStakingInfoFetchError, isStakingOrchestrationError, isStellarChainKey, isStellarChainKeyType, isStellarWalletProviderType, isSuiChainKey, isSuiChainKeyType, isSupportedBitcoinAddressType, isSwapCreateIntentError, isSwapError, isSwapSupportedToken, isUndefinedOrValidWalletProviderForChainKey, isUnifiedBnUSDMigrateParams, isValidWalletProviderForChainKey, kaiaSupportedTokens, leverageYieldConfig, leverageYieldInvariant, leverageYieldVaults, lightlinkSupportedTokens, lookupFailed, mapRelayFailure, mergeSodaxConfig, messageOf, migrationInvariant, mintPositionParamsAbi, mmInvariant, modifyLiquidityParamsAbi, moneyMarketConfig, moneyMarketReserveAssets, moneyMarketSupportedTokens, nativeToUSD, nearSupportedTokens, newbnUSDSpokeChainIds, noopAnalytics, normalize, normalizeBN, normalizePsbtToBase64, normalizeSignatureToBase64, normalizedToUsd, optimismSupportedTokens, pancakeSwapInfinityDefaultHookAbi, pancakeSwapInfinityPoolManagerAbi, pancakeSwapInfinityPositionManagerAbi, parseToStroops, parseTokenArrayFromJson, partnerInvariant, permit2Abi, polygonSupportedTokens, poolAbi, poolKeyAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, recoveryInvariant, redbellySupportedTokens, relayConfig, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, resolveAnalytics, resolveLogger, retry, reverseEncodeAddress, robinhoodChain, robinhoodSupportedTokens, serializeAddressData, settleWalletBalances, silentLogger, sleep, sodaxConfig, sodaxInvariant, solanaSupportedTokens, solverConfig, sonicSupportedTokens, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainKeysSet, spokeHooks, sponsoringInvariant, stacksSupportedTokens, stagingSwapSupportedTokens, stakedSodaAbi, stakingInvariant, stakingRouterAbi, stataTokenFactoryAbi, stellarSupportedTokens, submitTransaction, suiSupportedTokens, supportedSpokeChains, supportedTokensByChain, swapExactInSingleParamsAbi, swapInvariant, swapSupportedTokens, swapsConfig, toCreateBridgeIntentParamsV2, toSuiExecutionResult, toSuiExecutionStatus, toSuiPaginatedCoins, tokenLogo, tokenLogoSlug, uiPoolDataAbi, universalRouterAbi, unknownFailed, usesBip322MessageSigning, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, verifyFailed, wadToRay, waitForStacksTransaction, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|
|
45400
|
+
export { ALLOWANCE_CHECK_CODES, APPROVE_CODES, AssetService, BACKEND_API_BASE_PATH, BITCOIN_CHAIN_KEYS, BITCOIN_CHAIN_KEYS_SET, BITCOIN_DUST_SATS, BTC_WALLET_ADDRESS_TYPES, BackendApiService, BackendHttpError, BalnSwapService, BigIntToHex, BigNumberZeroDecimal, BitcoinSpokeService, BnUSDMigrationService, BridgeApiService, BridgeService, CHAIN_KEYS, CHAIN_LOGO_BASE_URL, CONFIG_VERSION, CREATE_INTENT_CODES, ChainKeys, ChainTypeArr, ClService, ConfigService, CustomSorobanServer, CustomStellarAccount, DEFAULT_API_BASE_URL, 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, DEFAULT_SPONSORING_API_ENDPOINT, DETAILED_STATUS_NOT_DELIVERED, DexService, EVM_CHAIN_ID_TO_KEY, EVM_CHAIN_KEYS, EVM_CHAIN_KEYS_SET, EVM_SPOKE_ONLY_CHAIN_KEYS, EVM_SPOKE_ONLY_CHAIN_KEYS_SET, Erc20Service, Erc4626Service, EvmAssetManagerService, EvmHubProvider, EvmSolverService, EvmSpokeService, EvmVaultTokenService, FEE_PERCENTAGE_SCALE, GAS_ESTIMATION_CODES, HALF_RAY, HALF_WAD, HUB_CHAIN_KEY, HookKind, HookService, HttpRelayError, HubVaultSymbols, ICON_CHAIN_KEYS, ICON_CHAIN_KEYS_SET, ICON_TX_RESULT_WAIT_MAX_RETRY, INJECTIVE_CHAIN_KEYS, INJECTIVE_CHAIN_KEYS_SET, INTENT_CHAIN_IDS, IconSpokeService, IcxMigrationService, Injective20Token, InjectiveSpokeService, IntentCreatedEventAbi, IntentDataService, IntentDataType, IntentFilledEventAbi, IntentRelayChainIdToChainKey, IntentsAbi, LOOKUP_CODES, LTV_PRECISION, LendingPoolService, LeverageYieldApiService, LeverageYieldService, LockupMultiplier, LockupPeriod, LsodaSymbols, LsodaTokens, MAX_UINT256, MigrationService, MintPositionEventAbi, MoneyMarketDataService, MoneyMarketService, NEAR_CHAIN_KEYS, NEAR_CHAIN_KEYS_SET, NEAR_DEFAULT_GAS, NEAR_STORAGE_DEPOSIT, NearSpokeService, ORACLE_CANDLE_INTERVALS, PartnerFeeClaimService, PartnerService, Permit2Service, ProtocolIntentsAbi, RAY, RAY_DECIMALS, RELAY_ERROR_CODES, RELAY_FALLBACK_FLOOR_MS, RELAY_REQUEST_TIMEOUT_MS, RadfiApiError, RadfiProvider, RecoveryService, RelayChainIdMap, SECONDS_PER_YEAR, SODAX_ERROR_CODES, SODAX_FEATURES, SOLANA_CHAIN_KEYS, SOLANA_CHAIN_KEYS_SET, SONIC_CHAIN_KEYS, SONIC_CHAIN_KEYS_SET, SPEED_TIER_SECONDS, SPEED_TIER_THRESHOLDS, SPONSORING_API_ERROR_CODES, SPONSORING_API_STELLAR_BASE_PATH, SPONSOR_CONFIG_TTL_MS, STACKS_CHAIN_KEYS, STACKS_CHAIN_KEYS_SET, STELLAR_BASE_RESERVE_TTL_MS, STELLAR_CHAIN_KEYS, STELLAR_CHAIN_KEYS_SET, STELLAR_TRUSTLINE_MIN_XLM_STROOPS, SUI_CHAIN_KEYS, SUI_CHAIN_KEYS_SET, SodaTokens, Sodax, SodaxError, SolanaSpokeService, SolverApiService, SolverIntentErrorCode, SolverIntentStatusCode, SonicSpokeService, SpokeService, SponsoringApiService, SponsoringService, StacksSpokeService, StakingLogic, StakingService, StatATokenAddresses, StellarSpokeService, SuiGrpcTransport, SuiSpokeService, SupportedMigrationTokens, SwapService, SwapsApiService, TOKEN_LOGO_BASE_URL, USD_DECIMALS, UiPoolDataProviderService, VAULT_TOKEN_DECIMALS, WAD, WAD_RAY_RATIO, WEI_DECIMALS, adjustAmountByFee, allowanceCheckFailed, apiConfig, approveFailed, arbitrumSupportedTokens, assetManagerAbi, avalancheSupportedTokens, balnSwapAbi, baseChainInfo, baseSupportedTokens, binomialApproximatedRayPow, bitcoinSupportedTokens, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bridgeConfig, bridgeInvariant, bscSupportedTokens, calcOpReturnOutputVbytes, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, canonicalizeBitcoinAddress, clPoolAbi, clPoolManagerAbi, clPositionManagerAbi, clQuoterAbi, clRouterAbi, clTickLensAbi, classifySponsorError, concentratedLiquidityConfig, connectionAbi, consoleLogger, convertTransactionInstructionToRaw, createBalanceCollector, createInvariant, deepMerge, defaultHookAbi, detectBitcoinAddressType, dexConfig, dexInvariant, dexPools, encodeAddress, encodeBtcPayloadToBytes, encodeContractCalls, encodeTokenIdentifier, erc20Abi, erc4626Abi, estimateBitcoinTxSize, estimateSwapSpeedTier, ethereumSupportedTokens, executionFailed, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, gasEstimationFailed, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getAssetManagerIdl, getAssetManagerProgram, getChainKeyFromRelayChainId, getChainType, getCompoundedBalance, getConcentratedLiquidityConfig, getConnectionIdl, getConnectionProgram, getEvmChainKeyByChainId, getEvmViemChain, getIconAddressBytes, getIntentRelayChainId, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getProvider, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getSolverConfig, getSpokeHook, getSpokeHooks, getStagingSolverTokens, getSupportedSolverTokens, getTransactionPackets, getbnUSDToken, hederaSupportedTokens, hexToBigInt, hexToSolanaAddress, hubConfig, hyper, hyperevmSupportedTokens, iconSupportedTokens, injectiveSupportedTokens, intentCreationFailed, isApprovalSupportedChainKeyType, isAuthFailure, isAuthStatus, isBackendHttpError, isBalnMigrateParams, isBitcoinChainKey, isBitcoinChainKeyType, isBitcoinWalletProviderType, isBridgeAllowanceCheckError, isBridgeApproveError, isBridgeCreateIntentError, isBridgeError, isBridgeLookupError, isBridgeOrchestrationError, isCodeMember, isDexApproveError, isDexCreateIntentError, isDexError, isEvmChainKey, isEvmChainKeyType, isEvmSpokeChainConfig, isEvmSpokeOnlyChainKey, isEvmSpokeOnlyChainKeyType, isEvmWalletProviderType, isFeatureError, isFillEvent, isHookSupportedToken, isHubChainKey, isHubChainKeyType, isIconAddress, isIconChainKey, isIconChainKeyType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveChainKey, isInjectiveChainKeyType, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isLeverageYieldAllowanceCheckError, isLeverageYieldApproveError, isLeverageYieldCreateIntentError, isLeverageYieldError, isLeverageYieldLookupError, isLeverageYieldPostExecutionError, isLeverageYieldSwapError, isMigrateOrchestrationError, isMigrationAllowanceCheckError, isMigrationApproveError, isMigrationCreateIntentError, isMigrationError, isMigrationLookupError, isMoneyMarketAllowanceCheckError, isMoneyMarketApproveError, isMoneyMarketCreateIntentError, isMoneyMarketError, isMoneyMarketGasEstimationError, isMoneyMarketOrchestrationError, isNativeBitcoinToken, isNativeBitcoinTransfer, isNativeToken, isNearChainKey, isNearChainKeyType, isNewbnUSDChainId, isNewbnUSDToken, isOptionalBitcoinWalletProviderType, isOptionalEvmWalletProviderType, isOptionalStellarWalletProviderType, isOracleCandleInterval, isPartnerError, isPartnerFeeAmount, isPartnerFeePercentage, isPostExecutionError, isRawDestinationParams, isRecoveryError, isResponseAddressType, isResponseSigningType, isRevertMigrationOrchestrationError, isSodaxError, isSolanaChainKey, isSolanaChainKeyType, isSolanaNativeToken, isSonicChainKey, isSonicChainKeyType, isSpokeApproveParamsEvmSpoke, isSpokeApproveParamsHub, isSpokeApproveParamsStellar, isSpokeChainKey, isSpokeIsAllowanceValidParamsEvmSpoke, isSpokeIsAllowanceValidParamsHub, isSpokeIsAllowanceValidParamsStellar, isSponsoringConfigError, isSponsoringLookupError, isSponsoringOrchestrationError, isStacksChainKey, isStacksChainKeyType, isStakeOrchestrationError, isStakingAllowanceCheckError, isStakingApproveError, isStakingCreateIntentError, isStakingError, isStakingInfoFetchError, isStakingOrchestrationError, isStellarChainKey, isStellarChainKeyType, isStellarWalletProviderType, isSuiChainKey, isSuiChainKeyType, isSupportedBitcoinAddressType, isSwapCreateIntentError, isSwapError, isSwapSupportedToken, isUndefinedOrValidWalletProviderForChainKey, isUnifiedBnUSDMigrateParams, isValidBitcoinAddress, isValidInjectiveAddress, isValidNearAccountId, isValidWalletProviderForChainKey, kaiaSupportedTokens, leverageYieldConfig, leverageYieldInvariant, leverageYieldVaults, lightlinkSupportedTokens, lookupFailed, mapRelayFailure, mergeSodaxConfig, messageOf, migrationInvariant, mintPositionParamsAbi, mmInvariant, modifyLiquidityParamsAbi, moneyMarketConfig, moneyMarketReserveAssets, moneyMarketSupportedTokens, nativeToUSD, nearSupportedTokens, newbnUSDSpokeChainIds, noopAnalytics, normalize, normalizeBN, normalizePsbtToBase64, normalizeSignatureToBase64, normalizedToUsd, optimismSupportedTokens, pancakeSwapInfinityDefaultHookAbi, pancakeSwapInfinityPoolManagerAbi, pancakeSwapInfinityPositionManagerAbi, parseToStroops, parseTokenArrayFromJson, partnerInvariant, permit2Abi, polygonSupportedTokens, poolAbi, poolKeyAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, recoveryInvariant, redbellySupportedTokens, relayConfig, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, resolveAnalytics, resolveLogger, retry, reverseEncodeAddress, robinhoodChain, robinhoodSupportedTokens, serializeAddressData, settleWalletBalances, silentLogger, sleep, sodaxConfig, sodaxInvariant, solanaSupportedTokens, solverConfig, sonicSupportedTokens, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainKeysSet, spokeHooks, sponsoringInvariant, stacksSupportedTokens, stagingSwapSupportedTokens, stakedSodaAbi, stakingInvariant, stakingRouterAbi, stataTokenFactoryAbi, stellarSupportedTokens, submitTransaction, suiSupportedTokens, supportedSpokeChains, supportedTokensByChain, swapExactInSingleParamsAbi, swapInvariant, swapSupportedTokens, swapsConfig, toCreateBridgeIntentParamsV2, toSuiExecutionResult, toSuiExecutionStatus, toSuiPaginatedCoins, tokenLogo, tokenLogoSlug, uiPoolDataAbi, universalRouterAbi, unknownFailed, usesBip322MessageSigning, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, verifyFailed, wadToRay, waitForStacksTransaction, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|