@sodax/sdk 2.1.0-rc.5 → 2.1.0-rc.7
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 +660 -356
- package/dist/index.d.cts +155 -7
- package/dist/index.d.ts +155 -7
- package/dist/index.mjs +654 -357
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAbiItem, parseAbi, isAddress, toHex, hexToBytes, encodeAbiParameters, parseAbiParameters, defineChain, encodeFunctionData, erc20Abi as erc20Abi$1, createPublicClient, http, bytesToHex, keccak256, stringToBytes, fromHex, encodePacked, decodeAbiParameters, parseEventLogs, maxUint160, maxUint48, fallback } from 'viem';
|
|
1
|
+
import { getAbiItem, parseAbi, isAddress, toHex, hexToBytes, encodeAbiParameters, parseAbiParameters, defineChain, encodeFunctionData, erc20Abi as erc20Abi$1, createPublicClient, http, bytesToHex, keccak256, stringToBytes, fromHex, encodePacked, decodeAbiParameters, parseEventLogs, isHex, maxUint160, maxUint48, fallback } from 'viem';
|
|
2
2
|
import { bcs } from '@mysten/sui/bcs';
|
|
3
3
|
import { PublicKey, Connection, VersionedTransaction, SystemProgram, ComputeBudgetProgram, TransactionMessage, TransactionInstruction } from '@solana/web3.js';
|
|
4
4
|
import { rpc, Address, xdr, Account, Horizon, Contract, TransactionBuilder, nativeToScVal, TimeoutInfinite, scValToBigInt, Operation, Asset, FeeBumpTransaction, NotFoundError, Networks, Keypair } from '@stellar/stellar-sdk';
|
|
@@ -9,7 +9,7 @@ import { initEccLib, networks, Transaction, Psbt, payments, opcodes, script } fr
|
|
|
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';
|
|
12
|
-
import {
|
|
12
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
13
13
|
import { TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, getAssociatedTokenAddress } from '@solana/spl-token';
|
|
14
14
|
import { AnchorProvider, Program } from '@coral-xyz/anchor';
|
|
15
15
|
import BN from 'bn.js';
|
|
@@ -17,7 +17,7 @@ import * as IconSdkRaw from 'icon-sdk-js';
|
|
|
17
17
|
import { ChainGrpcWasmApi, TxGrpcApi, toBase64, fromBase64, MsgExecuteContract, ChainRestAuthApi, BaseAccount, createTransaction } from '@injectivelabs/sdk-ts';
|
|
18
18
|
import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx.js';
|
|
19
19
|
import { getNetworkEndpoints, Network } from '@injectivelabs/networks';
|
|
20
|
-
import * as
|
|
20
|
+
import * as v from 'valibot';
|
|
21
21
|
import { SwapsApi, SwapsApiError } from '@sodax/swaps-api';
|
|
22
22
|
export { SwapsApiError } from '@sodax/swaps-api';
|
|
23
23
|
import BigNumber5, { BigNumber } from 'bignumber.js';
|
|
@@ -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, v10] of Object.entries(value)) {
|
|
98
|
+
out[key] = sanitizeValue(v10, 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((v10) => sanitizeValue(v10, 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, v10]) => [sanitizeValue(k, depth + 1), sanitizeValue(v10, depth + 1)]);
|
|
113
113
|
}
|
|
114
114
|
if (value instanceof Set) {
|
|
115
|
-
return Array.from(value.values()).map((
|
|
115
|
+
return Array.from(value.values()).map((v10) => sanitizeValue(v10, 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(v10) {
|
|
128
128
|
try {
|
|
129
|
-
return String(
|
|
129
|
+
return String(v10);
|
|
130
130
|
} catch {
|
|
131
131
|
return "[unserializable]";
|
|
132
132
|
}
|
|
@@ -1359,7 +1359,7 @@ var baseSupportedTokens = {
|
|
|
1359
1359
|
symbol: "AERO",
|
|
1360
1360
|
name: "Aerodrome Finance",
|
|
1361
1361
|
decimals: 18,
|
|
1362
|
-
address: "
|
|
1362
|
+
address: "0x940181a94A35A4569E4529A3CDfB74e38FD98631",
|
|
1363
1363
|
chainKey: ChainKeys.BASE_MAINNET,
|
|
1364
1364
|
hubAsset: "0x348e086ab6f424dfc575a325c28624ed23973173",
|
|
1365
1365
|
vault: "0x348e086ab6f424dfc575a325c28624ed23973173"
|
|
@@ -1671,7 +1671,7 @@ var polygonSupportedTokens = {
|
|
|
1671
1671
|
symbol: "WBTC",
|
|
1672
1672
|
name: "Wrapped BTC",
|
|
1673
1673
|
decimals: 8,
|
|
1674
|
-
address: "
|
|
1674
|
+
address: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",
|
|
1675
1675
|
chainKey: ChainKeys.POLYGON_MAINNET,
|
|
1676
1676
|
hubAsset: "0xf3182ae79be69d9e0cad5da8273d4300a7d585d3",
|
|
1677
1677
|
vault: "0xf3182ae79be69d9e0cad5da8273d4300a7d585d3"
|
|
@@ -1689,7 +1689,7 @@ var polygonSupportedTokens = {
|
|
|
1689
1689
|
symbol: "LINK",
|
|
1690
1690
|
name: "ChainLink Token",
|
|
1691
1691
|
decimals: 18,
|
|
1692
|
-
address: "
|
|
1692
|
+
address: "0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39",
|
|
1693
1693
|
chainKey: ChainKeys.POLYGON_MAINNET,
|
|
1694
1694
|
hubAsset: "0x30d1be6ae96e9832674f1fcf429c5176bd891e1f",
|
|
1695
1695
|
vault: "0x30d1be6ae96e9832674f1fcf429c5176bd891e1f"
|
|
@@ -3337,7 +3337,7 @@ var spokeChainConfig = {
|
|
|
3337
3337
|
supportedTokens: suiSupportedTokens,
|
|
3338
3338
|
nativeToken: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
3339
3339
|
bnUSD: "0xff4de2b2b57dd7611d2812d231a467d007b702a101fd5c7ad3b278257cddb507::bnusd::BNUSD",
|
|
3340
|
-
|
|
3340
|
+
grpc_url: "https://fullnode.mainnet.sui.io",
|
|
3341
3341
|
chain: baseChainInfo[ChainKeys.SUI_MAINNET],
|
|
3342
3342
|
pollingConfig: {
|
|
3343
3343
|
pollingIntervalMs: 500,
|
|
@@ -4316,6 +4316,29 @@ var isHookSupportedToken = (chainKey, kind, token) => {
|
|
|
4316
4316
|
return !hook.supportedTokens || hook.supportedTokens.some((t) => t.toLowerCase() === token.toLowerCase());
|
|
4317
4317
|
};
|
|
4318
4318
|
|
|
4319
|
+
// ../types/dist/sui/core.js
|
|
4320
|
+
function toSuiPaginatedCoins(response, coinType) {
|
|
4321
|
+
return {
|
|
4322
|
+
data: response.objects.map((coin) => ({
|
|
4323
|
+
balance: coin.balance,
|
|
4324
|
+
coinObjectId: coin.objectId,
|
|
4325
|
+
coinType,
|
|
4326
|
+
digest: coin.digest,
|
|
4327
|
+
version: coin.version
|
|
4328
|
+
})),
|
|
4329
|
+
hasNextPage: response.hasNextPage,
|
|
4330
|
+
nextCursor: response.cursor
|
|
4331
|
+
};
|
|
4332
|
+
}
|
|
4333
|
+
function toSuiExecutionResult(command) {
|
|
4334
|
+
return {
|
|
4335
|
+
returnValues: command.returnValues.map((value) => [Array.from(value.bcs), ""])
|
|
4336
|
+
};
|
|
4337
|
+
}
|
|
4338
|
+
function toSuiExecutionStatus(status) {
|
|
4339
|
+
return status.success ? { status: "success" } : { status: "failure", error: status.error.message };
|
|
4340
|
+
}
|
|
4341
|
+
|
|
4319
4342
|
// ../types/dist/utils/utils.js
|
|
4320
4343
|
function isHubChainKey(chainId) {
|
|
4321
4344
|
return chainId === HUB_CHAIN_KEY;
|
|
@@ -4430,7 +4453,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
|
|
|
4430
4453
|
}
|
|
4431
4454
|
|
|
4432
4455
|
// ../types/dist/index.js
|
|
4433
|
-
var CONFIG_VERSION =
|
|
4456
|
+
var CONFIG_VERSION = 227;
|
|
4434
4457
|
|
|
4435
4458
|
// src/shared/utils/resolveTimeoutMs.ts
|
|
4436
4459
|
function resolveTimeoutMs(timeout, fallbackMs) {
|
|
@@ -4817,10 +4840,11 @@ async function submitTransaction(payload, apiUrl) {
|
|
|
4817
4840
|
return { ok: false, error };
|
|
4818
4841
|
}
|
|
4819
4842
|
}
|
|
4820
|
-
async function getTransactionPackets(payload, apiUrl) {
|
|
4843
|
+
async function getTransactionPackets(payload, apiUrl, timeoutMs) {
|
|
4821
4844
|
invariant(payload.params.chain_id.length > 0, "Invalid input parameters. source_chain_id empty");
|
|
4822
4845
|
invariant(payload.params.tx_hash.length > 0, "Invalid input parameters. tx_hash empty");
|
|
4823
|
-
return postRequest(payload, apiUrl);
|
|
4846
|
+
if (timeoutMs === void 0) return postRequest(payload, apiUrl);
|
|
4847
|
+
return pollTransactionPackets(payload, apiUrl, Date.now() + resolveTimeoutMs(timeoutMs, RELAY_REQUEST_TIMEOUT_MS));
|
|
4824
4848
|
}
|
|
4825
4849
|
async function getPacket(payload, apiUrl) {
|
|
4826
4850
|
invariant(payload.params.chain_id.length > 0, "Invalid input parameters. source_chain_id empty");
|
|
@@ -14367,7 +14391,7 @@ function mergeSodaxConfig(base2, override) {
|
|
|
14367
14391
|
}
|
|
14368
14392
|
function encodeContractCalls(calls) {
|
|
14369
14393
|
return encodeAbiParameters(parseAbiParameters("(address,uint256,bytes)[]"), [
|
|
14370
|
-
calls.map((
|
|
14394
|
+
calls.map((v10) => [v10.address, v10.value, v10.data])
|
|
14371
14395
|
]);
|
|
14372
14396
|
}
|
|
14373
14397
|
async function waitForTransactionReceipt(hash, provider) {
|
|
@@ -15780,12 +15804,12 @@ function encodeBtcPayloadToBytes(payload) {
|
|
|
15780
15804
|
});
|
|
15781
15805
|
}
|
|
15782
15806
|
function normalizePsbtToBase64(signedPsbt) {
|
|
15783
|
-
const
|
|
15784
|
-
return
|
|
15807
|
+
const isHex2 = /^[0-9a-fA-F]+$/.test(signedPsbt);
|
|
15808
|
+
return isHex2 ? Buffer.from(signedPsbt, "hex").toString("base64") : signedPsbt;
|
|
15785
15809
|
}
|
|
15786
15810
|
function normalizeSignatureToBase64(signature) {
|
|
15787
|
-
const
|
|
15788
|
-
return
|
|
15811
|
+
const isHex2 = /^[0-9a-fA-F]+$/.test(signature);
|
|
15812
|
+
return isHex2 ? Buffer.from(signature, "hex").toString("base64") : signature;
|
|
15789
15813
|
}
|
|
15790
15814
|
|
|
15791
15815
|
// src/shared/services/spoke/BitcoinSpokeService.ts
|
|
@@ -17059,22 +17083,22 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
17059
17083
|
const byte0 = Uint8Array.of(0);
|
|
17060
17084
|
const byte1 = Uint8Array.of(1);
|
|
17061
17085
|
const _maxDrbgIters = 1e3;
|
|
17062
|
-
let
|
|
17086
|
+
let v10 = u8n(hashLen);
|
|
17063
17087
|
let k = u8n(hashLen);
|
|
17064
17088
|
let i = 0;
|
|
17065
17089
|
const reset = () => {
|
|
17066
|
-
|
|
17090
|
+
v10.fill(1);
|
|
17067
17091
|
k.fill(0);
|
|
17068
17092
|
i = 0;
|
|
17069
17093
|
};
|
|
17070
|
-
const h = (...msgs) => hmacFn(k, concatBytes(
|
|
17094
|
+
const h = (...msgs) => hmacFn(k, concatBytes(v10, ...msgs));
|
|
17071
17095
|
const reseed = (seed = NULL) => {
|
|
17072
17096
|
k = h(byte0, seed);
|
|
17073
|
-
|
|
17097
|
+
v10 = h();
|
|
17074
17098
|
if (seed.length === 0)
|
|
17075
17099
|
return;
|
|
17076
17100
|
k = h(byte1, seed);
|
|
17077
|
-
|
|
17101
|
+
v10 = h();
|
|
17078
17102
|
};
|
|
17079
17103
|
const gen = () => {
|
|
17080
17104
|
if (i++ >= _maxDrbgIters)
|
|
@@ -17082,10 +17106,10 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
17082
17106
|
let len = 0;
|
|
17083
17107
|
const out = [];
|
|
17084
17108
|
while (len < qByteLen) {
|
|
17085
|
-
|
|
17086
|
-
const sl =
|
|
17109
|
+
v10 = h();
|
|
17110
|
+
const sl = v10.slice();
|
|
17087
17111
|
out.push(sl);
|
|
17088
|
-
len +=
|
|
17112
|
+
len += v10.length;
|
|
17089
17113
|
}
|
|
17090
17114
|
return concatBytes(...out);
|
|
17091
17115
|
};
|
|
@@ -17111,7 +17135,7 @@ function validateObject(object5, fields = {}, optFields = {}) {
|
|
|
17111
17135
|
if (current !== expectedType || val === null)
|
|
17112
17136
|
throw new Error(`param "${fieldName}" is invalid: expected ${expectedType}, got ${current}`);
|
|
17113
17137
|
}
|
|
17114
|
-
const iter = (f, isOpt) => Object.entries(f).forEach(([k,
|
|
17138
|
+
const iter = (f, isOpt) => Object.entries(f).forEach(([k, v10]) => checkField(k, v10, isOpt));
|
|
17115
17139
|
iter(fields, false);
|
|
17116
17140
|
iter(optFields, true);
|
|
17117
17141
|
}
|
|
@@ -17182,9 +17206,9 @@ function sqrt3mod4(Fp, n) {
|
|
|
17182
17206
|
function sqrt5mod8(Fp, n) {
|
|
17183
17207
|
const p5div8 = (Fp.ORDER - _5n) / _8n;
|
|
17184
17208
|
const n2 = Fp.mul(n, _2n);
|
|
17185
|
-
const
|
|
17186
|
-
const nv = Fp.mul(n,
|
|
17187
|
-
const i = Fp.mul(Fp.mul(nv, _2n),
|
|
17209
|
+
const v10 = Fp.pow(n2, p5div8);
|
|
17210
|
+
const nv = Fp.mul(n, v10);
|
|
17211
|
+
const i = Fp.mul(Fp.mul(nv, _2n), v10);
|
|
17188
17212
|
const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
|
|
17189
17213
|
assertIsSquare(Fp, root, n);
|
|
17190
17214
|
return root;
|
|
@@ -17766,9 +17790,9 @@ function edwards(params, extraOpts = {}) {
|
|
|
17766
17790
|
validateObject(extraOpts, {}, { uvRatio: "function" });
|
|
17767
17791
|
const MASK = _2n2 << BigInt(Fn.BYTES * 8) - _1n4;
|
|
17768
17792
|
const modP = (n) => Fp.create(n);
|
|
17769
|
-
const uvRatio2 = extraOpts.uvRatio || ((u,
|
|
17793
|
+
const uvRatio2 = extraOpts.uvRatio || ((u, v10) => {
|
|
17770
17794
|
try {
|
|
17771
|
-
return { isValid: true, value: Fp.sqrt(Fp.div(u,
|
|
17795
|
+
return { isValid: true, value: Fp.sqrt(Fp.div(u, v10)) };
|
|
17772
17796
|
} catch (e) {
|
|
17773
17797
|
return { isValid: false, value: _0n4 };
|
|
17774
17798
|
}
|
|
@@ -17864,8 +17888,8 @@ function edwards(params, extraOpts = {}) {
|
|
|
17864
17888
|
aInRange("point.y", y, _0n4, max);
|
|
17865
17889
|
const y2 = modP(y * y);
|
|
17866
17890
|
const u = modP(y2 - _1n4);
|
|
17867
|
-
const
|
|
17868
|
-
let { isValid, value: x } = uvRatio2(u,
|
|
17891
|
+
const v10 = modP(d * y2 - a);
|
|
17892
|
+
let { isValid, value: x } = uvRatio2(u, v10);
|
|
17869
17893
|
if (!isValid)
|
|
17870
17894
|
throw new Error("bad point: invalid y coordinate");
|
|
17871
17895
|
const isXOdd = (x & _1n4) === _1n4;
|
|
@@ -18205,13 +18229,13 @@ function adjustScalarBytes(bytes) {
|
|
|
18205
18229
|
return bytes;
|
|
18206
18230
|
}
|
|
18207
18231
|
var ED25519_SQRT_M1 = /* @__PURE__ */ BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");
|
|
18208
|
-
function uvRatio(u,
|
|
18232
|
+
function uvRatio(u, v10) {
|
|
18209
18233
|
const P = ed25519_CURVE_p;
|
|
18210
|
-
const v32 = mod(
|
|
18211
|
-
const v72 = mod(v32 * v32 *
|
|
18234
|
+
const v32 = mod(v10 * v10 * v10, P);
|
|
18235
|
+
const v72 = mod(v32 * v32 * v10, P);
|
|
18212
18236
|
const pow = ed25519_pow_2_252_3(u * v72).pow_p_5_8;
|
|
18213
18237
|
let x = mod(u * v32 * pow, P);
|
|
18214
|
-
const vx2 = mod(
|
|
18238
|
+
const vx2 = mod(v10 * x * x, P);
|
|
18215
18239
|
const root1 = x;
|
|
18216
18240
|
const root2 = mod(x * ED25519_SQRT_M1, P);
|
|
18217
18241
|
const useRoot1 = vx2 === u;
|
|
@@ -18542,7 +18566,7 @@ function findSeatPrice(validators, maxNumberOfSeats, minimumStakeRatio, protocol
|
|
|
18542
18566
|
return findSeatPriceForProtocolAfter49(validators, maxNumberOfSeats, minimumStakeRatio);
|
|
18543
18567
|
}
|
|
18544
18568
|
function findSeatPriceForProtocolBefore49(validators, numSeats) {
|
|
18545
|
-
const stakes = validators.map((
|
|
18569
|
+
const stakes = validators.map((v10) => BigInt(v10.stake)).sort(sortBigIntAsc);
|
|
18546
18570
|
const num = BigInt(numSeats);
|
|
18547
18571
|
const stakesSum = stakes.reduce((a, b) => a + b);
|
|
18548
18572
|
if (stakesSum < num) {
|
|
@@ -18571,7 +18595,7 @@ function findSeatPriceForProtocolAfter49(validators, maxNumberOfSeats, minimumSt
|
|
|
18571
18595
|
if (minimumStakeRatio.length != 2) {
|
|
18572
18596
|
throw Error("minimumStakeRatio should have 2 elements");
|
|
18573
18597
|
}
|
|
18574
|
-
const stakes = validators.map((
|
|
18598
|
+
const stakes = validators.map((v10) => BigInt(v10.stake)).sort(sortBigIntAsc);
|
|
18575
18599
|
const stakesSum = stakes.reduce((a, b) => a + b);
|
|
18576
18600
|
if (validators.length < maxNumberOfSeats) {
|
|
18577
18601
|
return stakesSum * BigInt(minimumStakeRatio[0]) / BigInt(minimumStakeRatio[1]);
|
|
@@ -18743,10 +18767,10 @@ var DER = {
|
|
|
18743
18767
|
if (length < 128)
|
|
18744
18768
|
throw new E("tlv.decode(long): not minimal encoding");
|
|
18745
18769
|
}
|
|
18746
|
-
const
|
|
18747
|
-
if (
|
|
18770
|
+
const v10 = data.subarray(pos, pos + length);
|
|
18771
|
+
if (v10.length !== length)
|
|
18748
18772
|
throw new E("tlv.decode: wrong value length");
|
|
18749
|
-
return { v:
|
|
18773
|
+
return { v: v10, l: data.subarray(pos + length) };
|
|
18750
18774
|
}
|
|
18751
18775
|
},
|
|
18752
18776
|
// https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
|
|
@@ -19493,14 +19517,14 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
19493
19517
|
return false;
|
|
19494
19518
|
const { r, s } = sig;
|
|
19495
19519
|
const h = bits2int_modN(message);
|
|
19496
|
-
const
|
|
19497
|
-
const u1 = Fn.create(h *
|
|
19498
|
-
const u2 = Fn.create(r *
|
|
19520
|
+
const is3 = Fn.inv(s);
|
|
19521
|
+
const u1 = Fn.create(h * is3);
|
|
19522
|
+
const u2 = Fn.create(r * is3);
|
|
19499
19523
|
const R = Point.BASE.multiplyUnsafe(u1).add(P.multiplyUnsafe(u2));
|
|
19500
19524
|
if (R.is0())
|
|
19501
19525
|
return false;
|
|
19502
|
-
const
|
|
19503
|
-
return
|
|
19526
|
+
const v10 = Fn.create(R.x);
|
|
19527
|
+
return v10 === r;
|
|
19504
19528
|
} catch (e) {
|
|
19505
19529
|
return false;
|
|
19506
19530
|
}
|
|
@@ -23269,8 +23293,133 @@ var SonicSpokeService = class {
|
|
|
23269
23293
|
return params.walletProvider.sendTransaction(rawTx);
|
|
23270
23294
|
}
|
|
23271
23295
|
};
|
|
23296
|
+
async function toMystenTransaction(txn) {
|
|
23297
|
+
if (txn instanceof Transaction$1) return txn;
|
|
23298
|
+
return Transaction$1.from(await txn.toJSON());
|
|
23299
|
+
}
|
|
23300
|
+
function isTimeoutError(error) {
|
|
23301
|
+
if (typeof error === "object" && error !== null && "name" in error) {
|
|
23302
|
+
const { name } = error;
|
|
23303
|
+
if (name === "TimeoutError" || name === "AbortError") {
|
|
23304
|
+
return true;
|
|
23305
|
+
}
|
|
23306
|
+
}
|
|
23307
|
+
return error instanceof Error && /timed?\s?out|timeout/i.test(error.message);
|
|
23308
|
+
}
|
|
23309
|
+
var DEFAULT_GET_COINS_LIMIT = 10;
|
|
23310
|
+
function toSuiObjectOwner(owner) {
|
|
23311
|
+
switch (owner?.$kind) {
|
|
23312
|
+
case "AddressOwner":
|
|
23313
|
+
return { AddressOwner: owner.AddressOwner };
|
|
23314
|
+
case "ObjectOwner":
|
|
23315
|
+
return { ObjectOwner: owner.ObjectOwner };
|
|
23316
|
+
case "Shared":
|
|
23317
|
+
return { Shared: { initial_shared_version: owner.Shared.initialSharedVersion } };
|
|
23318
|
+
default:
|
|
23319
|
+
return "Immutable";
|
|
23320
|
+
}
|
|
23321
|
+
}
|
|
23322
|
+
function toSuiTransactionEffects(effects, executedEpoch) {
|
|
23323
|
+
const gasObject = effects.gasObject;
|
|
23324
|
+
return {
|
|
23325
|
+
messageVersion: "v1",
|
|
23326
|
+
status: toSuiExecutionStatus(effects.status),
|
|
23327
|
+
executedEpoch,
|
|
23328
|
+
gasUsed: effects.gasUsed,
|
|
23329
|
+
transactionDigest: effects.transactionDigest,
|
|
23330
|
+
gasObject: {
|
|
23331
|
+
owner: toSuiObjectOwner(gasObject?.outputOwner ?? null),
|
|
23332
|
+
reference: {
|
|
23333
|
+
objectId: gasObject?.objectId ?? "",
|
|
23334
|
+
version: gasObject?.outputVersion ?? "",
|
|
23335
|
+
digest: gasObject?.outputDigest ?? ""
|
|
23336
|
+
}
|
|
23337
|
+
},
|
|
23338
|
+
dependencies: effects.dependencies,
|
|
23339
|
+
eventsDigest: effects.eventsDigest
|
|
23340
|
+
};
|
|
23341
|
+
}
|
|
23342
|
+
var SuiGrpcTransport = class {
|
|
23343
|
+
endpoint;
|
|
23344
|
+
client;
|
|
23345
|
+
constructor(endpoint) {
|
|
23346
|
+
this.endpoint = endpoint;
|
|
23347
|
+
this.client = new SuiGrpcClient({ network: "mainnet", baseUrl: endpoint });
|
|
23348
|
+
}
|
|
23349
|
+
async getCoins(owner, coinType, limit = DEFAULT_GET_COINS_LIMIT) {
|
|
23350
|
+
const response = await this.client.core.listCoins({ owner, coinType, limit });
|
|
23351
|
+
return toSuiPaginatedCoins(response, coinType);
|
|
23352
|
+
}
|
|
23353
|
+
async simulate(tx, sender) {
|
|
23354
|
+
const transaction = await toMystenTransaction(tx);
|
|
23355
|
+
transaction.setSenderIfNotSet(sender);
|
|
23356
|
+
const result = await this.client.core.simulateTransaction({
|
|
23357
|
+
transaction,
|
|
23358
|
+
include: { commandResults: true },
|
|
23359
|
+
checksEnabled: false
|
|
23360
|
+
});
|
|
23361
|
+
const command = result.commandResults?.[0];
|
|
23362
|
+
if (!command) {
|
|
23363
|
+
throw new Error(`transaction didn't return any values: ${JSON.stringify(result, null, 2)}`);
|
|
23364
|
+
}
|
|
23365
|
+
return toSuiExecutionResult(command);
|
|
23366
|
+
}
|
|
23367
|
+
async estimateGas(tx, sender) {
|
|
23368
|
+
const transaction = await toMystenTransaction(tx);
|
|
23369
|
+
transaction.setSenderIfNotSet(sender);
|
|
23370
|
+
const result = await this.client.core.simulateTransaction({ transaction, include: { effects: true } });
|
|
23371
|
+
const effects = (result.Transaction ?? result.FailedTransaction)?.effects;
|
|
23372
|
+
if (!effects) {
|
|
23373
|
+
throw new Error("Transaction simulation returned no effects");
|
|
23374
|
+
}
|
|
23375
|
+
return effects.gasUsed;
|
|
23376
|
+
}
|
|
23377
|
+
async fetchLatestPackageId(objectId) {
|
|
23378
|
+
let object5;
|
|
23379
|
+
try {
|
|
23380
|
+
({ object: object5 } = await this.client.core.getObject({ objectId, include: { json: true } }));
|
|
23381
|
+
} catch (error) {
|
|
23382
|
+
throw new Error("Failed to fetch asset manager id", { cause: error });
|
|
23383
|
+
}
|
|
23384
|
+
if (!object5) {
|
|
23385
|
+
throw new Error("Asset manager id not found (no data)");
|
|
23386
|
+
}
|
|
23387
|
+
const fields = object5.json;
|
|
23388
|
+
if (!fields) {
|
|
23389
|
+
throw new Error("Asset manager id not found (not a move object)");
|
|
23390
|
+
}
|
|
23391
|
+
if (!("latest_package_id" in fields)) {
|
|
23392
|
+
throw new Error("Asset manager id not found (no latest package id)");
|
|
23393
|
+
}
|
|
23394
|
+
const latestPackageId = fields["latest_package_id"];
|
|
23395
|
+
if (typeof latestPackageId !== "string") {
|
|
23396
|
+
throw new Error("Asset manager id invalid (latest package id is not a string)");
|
|
23397
|
+
}
|
|
23398
|
+
if (!latestPackageId) {
|
|
23399
|
+
throw new Error("Asset manager id not found (no latest package id)");
|
|
23400
|
+
}
|
|
23401
|
+
return latestPackageId;
|
|
23402
|
+
}
|
|
23403
|
+
async waitForTransaction(params) {
|
|
23404
|
+
const result = await this.client.core.waitForTransaction({
|
|
23405
|
+
digest: params.digest,
|
|
23406
|
+
include: { effects: true },
|
|
23407
|
+
timeout: params.timeoutMs,
|
|
23408
|
+
pollSchedule: [0, Math.max(1, params.pollingIntervalMs)]
|
|
23409
|
+
});
|
|
23410
|
+
const transaction = result.Transaction ?? result.FailedTransaction;
|
|
23411
|
+
return {
|
|
23412
|
+
digest: transaction.digest,
|
|
23413
|
+
effects: transaction.effects ? toSuiTransactionEffects(transaction.effects, transaction.epoch ?? "0") : void 0
|
|
23414
|
+
};
|
|
23415
|
+
}
|
|
23416
|
+
};
|
|
23417
|
+
|
|
23418
|
+
// src/shared/services/spoke/SuiSpokeService.ts
|
|
23272
23419
|
var SuiSpokeService = class {
|
|
23273
23420
|
config;
|
|
23421
|
+
transport;
|
|
23422
|
+
/** @deprecated Renamed to `transport`, and no longer a raw `@mysten/sui` client. */
|
|
23274
23423
|
publicClient;
|
|
23275
23424
|
assetManagerAddress;
|
|
23276
23425
|
pollingIntervalMs;
|
|
@@ -23278,12 +23427,13 @@ var SuiSpokeService = class {
|
|
|
23278
23427
|
constructor(config) {
|
|
23279
23428
|
this.config = config;
|
|
23280
23429
|
const chainConfig = config.getChainConfig(ChainKeys.SUI_MAINNET);
|
|
23281
|
-
this.
|
|
23430
|
+
this.transport = new SuiGrpcTransport(chainConfig.rpc_url ?? chainConfig.grpc_url);
|
|
23431
|
+
this.publicClient = this.transport;
|
|
23282
23432
|
this.pollingIntervalMs = chainConfig.pollingConfig.pollingIntervalMs;
|
|
23283
23433
|
this.maxTimeoutMs = chainConfig.pollingConfig.maxTimeoutMs;
|
|
23284
23434
|
}
|
|
23285
23435
|
async getCoins(address, token) {
|
|
23286
|
-
return this.
|
|
23436
|
+
return this.transport.getCoins(address, token);
|
|
23287
23437
|
}
|
|
23288
23438
|
async getCoin(tx, coin, amount, address) {
|
|
23289
23439
|
const coins = await this.getCoins(address, coin);
|
|
@@ -23344,14 +23494,7 @@ var SuiSpokeService = class {
|
|
|
23344
23494
|
arguments: args,
|
|
23345
23495
|
typeArguments: typeArgs
|
|
23346
23496
|
});
|
|
23347
|
-
|
|
23348
|
-
transactionBlock: tx,
|
|
23349
|
-
sender
|
|
23350
|
-
});
|
|
23351
|
-
if (txResults.results && txResults.results[0] !== void 0) {
|
|
23352
|
-
return txResults.results[0];
|
|
23353
|
-
}
|
|
23354
|
-
throw Error(`transaction didn't return any values: ${JSON.stringify(txResults, null, 2)}`);
|
|
23497
|
+
return this.transport.simulate(tx, sender);
|
|
23355
23498
|
}
|
|
23356
23499
|
/**
|
|
23357
23500
|
* Deposit tokens to the spoke chain.
|
|
@@ -23418,12 +23561,7 @@ var SuiSpokeService = class {
|
|
|
23418
23561
|
* @returns {Promise<bigint>} The estimated computation cost.
|
|
23419
23562
|
*/
|
|
23420
23563
|
async estimateGas({ tx }) {
|
|
23421
|
-
|
|
23422
|
-
const result = await this.publicClient.devInspectTransactionBlock({
|
|
23423
|
-
sender: tx.from,
|
|
23424
|
-
transactionBlock: txb
|
|
23425
|
-
});
|
|
23426
|
-
return result.effects.gasUsed;
|
|
23564
|
+
return this.transport.estimateGas(Transaction$1.from(tx.data), tx.from);
|
|
23427
23565
|
}
|
|
23428
23566
|
/**
|
|
23429
23567
|
* Get the balance of the token in the spoke chain.
|
|
@@ -23464,40 +23602,14 @@ var SuiSpokeService = class {
|
|
|
23464
23602
|
* @returns {Promise<string>} The latest asset manager package id.
|
|
23465
23603
|
*/
|
|
23466
23604
|
async fetchLatestAssetManagerPackageId(chainId) {
|
|
23467
|
-
|
|
23468
|
-
id: this.config.getChainConfig(chainId).addresses.assetManagerConfigId,
|
|
23469
|
-
options: {
|
|
23470
|
-
showContent: true
|
|
23471
|
-
}
|
|
23472
|
-
});
|
|
23473
|
-
if (configData.error) {
|
|
23474
|
-
throw new Error(`Failed to fetch asset manager id. Details: ${JSON.stringify(configData.error)}`);
|
|
23475
|
-
}
|
|
23476
|
-
if (!configData.data) {
|
|
23477
|
-
throw new Error("Asset manager id not found (no data)");
|
|
23478
|
-
}
|
|
23479
|
-
if (configData.data.content?.dataType !== "moveObject") {
|
|
23480
|
-
throw new Error("Asset manager id not found (not a move object)");
|
|
23481
|
-
}
|
|
23482
|
-
if (!("latest_package_id" in configData.data.content.fields)) {
|
|
23483
|
-
throw new Error("Asset manager id not found (no latest package id)");
|
|
23484
|
-
}
|
|
23485
|
-
const latestPackageId = configData.data.content.fields["latest_package_id"];
|
|
23486
|
-
if (typeof latestPackageId !== "string") {
|
|
23487
|
-
throw new Error("Asset manager id invalid (latest package id is not a string)");
|
|
23488
|
-
}
|
|
23489
|
-
if (!latestPackageId) {
|
|
23490
|
-
throw new Error("Asset manager id not found (no latest package id)");
|
|
23491
|
-
}
|
|
23492
|
-
return latestPackageId.toString();
|
|
23605
|
+
return this.transport.fetchLatestPackageId(this.config.getChainConfig(chainId).addresses.assetManagerConfigId);
|
|
23493
23606
|
}
|
|
23494
23607
|
async waitForTransactionReceipt(params) {
|
|
23495
23608
|
try {
|
|
23496
|
-
const result = await this.
|
|
23609
|
+
const result = await this.transport.waitForTransaction({
|
|
23497
23610
|
digest: params.txHash,
|
|
23498
|
-
|
|
23499
|
-
|
|
23500
|
-
options: { showEffects: true }
|
|
23611
|
+
timeoutMs: params.maxTimeoutMs ?? this.maxTimeoutMs,
|
|
23612
|
+
pollingIntervalMs: params.pollingIntervalMs ?? this.pollingIntervalMs
|
|
23501
23613
|
});
|
|
23502
23614
|
if (!result.effects?.status) {
|
|
23503
23615
|
return {
|
|
@@ -23519,11 +23631,10 @@ var SuiSpokeService = class {
|
|
|
23519
23631
|
}
|
|
23520
23632
|
return { ok: true, value: { status: "success", receipt: result } };
|
|
23521
23633
|
} catch (error) {
|
|
23522
|
-
const isTimeout = error instanceof Error && error.message.includes("timeout");
|
|
23523
23634
|
return {
|
|
23524
23635
|
ok: true,
|
|
23525
23636
|
value: {
|
|
23526
|
-
status:
|
|
23637
|
+
status: isTimeoutError(error) ? "timeout" : "failure",
|
|
23527
23638
|
error: error instanceof Error ? error : new Error(String(error))
|
|
23528
23639
|
}
|
|
23529
23640
|
};
|
|
@@ -26895,19 +27006,32 @@ var SolverApiService = class {
|
|
|
26895
27006
|
*
|
|
26896
27007
|
* @param request - Object containing `intent_tx_hash` — the hub-chain tx hash of the intent.
|
|
26897
27008
|
* @param config - Solver endpoint configuration.
|
|
27009
|
+
* @param logger - Diagnostics sink; defaults to the silent logger.
|
|
27010
|
+
* @param timeoutMs - Optional budget for the request. Omit it and the call is unbounded, as it has
|
|
27011
|
+
* always been. Supply it when a stalled solver must not hold the caller open — a status read
|
|
27012
|
+
* polled on a short interval, say. An expiry surfaces as `UNKNOWN`, like any other failure.
|
|
27013
|
+
* A non-finite value (`NaN` out of `Number(process.env.X)`, or `Infinity`) is treated as no
|
|
27014
|
+
* budget at all rather than passed to `setTimeout`, which would coerce it to ~0 and fail every
|
|
27015
|
+
* request instantly. A non-positive one is a real budget of zero: the request aborts at once.
|
|
27016
|
+
* The relay's `getTransactionPackets` takes the same parameter but degrades a non-finite value
|
|
27017
|
+
* to its own per-request budget instead; the divergence is deliberate, and explained inline.
|
|
26898
27018
|
* @returns A `Result` containing `{ status: SolverIntentStatusCode, fill_tx_hash?: string }`.
|
|
26899
27019
|
* `fill_tx_hash` is set only when `status === SolverIntentStatusCode.SOLVED (3)`.
|
|
26900
27020
|
* @throws Invariant error if `intent_tx_hash` is empty (thrown before the async request).
|
|
26901
27021
|
*/
|
|
26902
|
-
static async getStatus(request, config, logger = silentLogger) {
|
|
27022
|
+
static async getStatus(request, config, logger = silentLogger, timeoutMs) {
|
|
26903
27023
|
invariant(request.intent_tx_hash.length > 0, "Empty intent_tx_hash");
|
|
27024
|
+
const budgetMs = timeoutMs !== void 0 && Number.isFinite(timeoutMs) ? Math.max(0, timeoutMs) : void 0;
|
|
27025
|
+
const controller = budgetMs === void 0 ? void 0 : new AbortController();
|
|
27026
|
+
const timeoutId = controller ? setTimeout(() => controller.abort(), budgetMs) : void 0;
|
|
26904
27027
|
try {
|
|
26905
27028
|
const response = await fetch(`${config.solverApiEndpoint}/status`, {
|
|
26906
27029
|
method: "POST",
|
|
26907
27030
|
headers: {
|
|
26908
27031
|
"Content-Type": "application/json"
|
|
26909
27032
|
},
|
|
26910
|
-
body: JSON.stringify(request)
|
|
27033
|
+
body: JSON.stringify(request),
|
|
27034
|
+
signal: controller?.signal
|
|
26911
27035
|
});
|
|
26912
27036
|
if (!response.ok) {
|
|
26913
27037
|
return {
|
|
@@ -26929,10 +27053,12 @@ var SolverApiService = class {
|
|
|
26929
27053
|
error: {
|
|
26930
27054
|
detail: {
|
|
26931
27055
|
code: SolverIntentErrorCode.UNKNOWN,
|
|
26932
|
-
message: e ? JSON.stringify(e, bigintReplacer) : "Unknown error"
|
|
27056
|
+
message: controller?.signal.aborted ? `solver /status timed out after ${budgetMs}ms` : e ? JSON.stringify(e, bigintReplacer) : "Unknown error"
|
|
26933
27057
|
}
|
|
26934
27058
|
}
|
|
26935
27059
|
};
|
|
27060
|
+
} finally {
|
|
27061
|
+
clearTimeout(timeoutId);
|
|
26936
27062
|
}
|
|
26937
27063
|
}
|
|
26938
27064
|
};
|
|
@@ -27026,6 +27152,152 @@ async function runBackendSubmitTx({
|
|
|
27026
27152
|
});
|
|
27027
27153
|
return polled.ok ? { ok: true, value: polled.value } : { ok: false, cause: polled.cause };
|
|
27028
27154
|
}
|
|
27155
|
+
var ChainKeySchema = v.custom((input) => typeof input === "string");
|
|
27156
|
+
var SpokeChainKeySchema = v.custom((input) => typeof input === "string");
|
|
27157
|
+
var AddressSchema = v.custom((input) => typeof input === "string");
|
|
27158
|
+
var XTokenSchema = v.object({
|
|
27159
|
+
symbol: v.string(),
|
|
27160
|
+
name: v.string(),
|
|
27161
|
+
decimals: v.number(),
|
|
27162
|
+
address: v.string(),
|
|
27163
|
+
chainKey: ChainKeySchema,
|
|
27164
|
+
hubAsset: AddressSchema,
|
|
27165
|
+
vault: AddressSchema,
|
|
27166
|
+
access: v.optional(v.picklist(["withdrawOnly", "depositOnly"]))
|
|
27167
|
+
});
|
|
27168
|
+
var IntentStructSchema = v.object({
|
|
27169
|
+
intentId: v.string(),
|
|
27170
|
+
creator: v.string(),
|
|
27171
|
+
inputToken: v.string(),
|
|
27172
|
+
outputToken: v.string(),
|
|
27173
|
+
inputAmount: v.string(),
|
|
27174
|
+
minOutputAmount: v.string(),
|
|
27175
|
+
deadline: v.string(),
|
|
27176
|
+
allowPartialFill: v.boolean(),
|
|
27177
|
+
srcChain: v.number(),
|
|
27178
|
+
dstChain: v.number(),
|
|
27179
|
+
srcAddress: v.string(),
|
|
27180
|
+
dstAddress: v.string(),
|
|
27181
|
+
solver: v.string(),
|
|
27182
|
+
data: v.string()
|
|
27183
|
+
});
|
|
27184
|
+
var FillEventSchema = v.object({
|
|
27185
|
+
eventType: v.literal("intent-filled"),
|
|
27186
|
+
// The hub-chain fill tx; an empty one is no use as `fill_tx_hash`.
|
|
27187
|
+
txHash: v.pipe(v.string(), v.nonEmpty()),
|
|
27188
|
+
// Terminality. An intent created with `allowPartialFill` emits a fill event per fill, so the
|
|
27189
|
+
// event alone does not mean the intent is done — only `remainingInput === '0'` does. Required:
|
|
27190
|
+
// without it there is no proof of completion, and claiming SOLVED on a partial fill would report
|
|
27191
|
+
// an unfinished swap as complete.
|
|
27192
|
+
intentState: v.object({
|
|
27193
|
+
remainingInput: v.string()
|
|
27194
|
+
})
|
|
27195
|
+
});
|
|
27196
|
+
var IntentResponseSchema = v.object({
|
|
27197
|
+
intentHash: v.string(),
|
|
27198
|
+
txHash: v.string(),
|
|
27199
|
+
logIndex: v.number(),
|
|
27200
|
+
chainId: v.number(),
|
|
27201
|
+
blockNumber: v.number(),
|
|
27202
|
+
open: v.boolean(),
|
|
27203
|
+
intent: IntentStructSchema,
|
|
27204
|
+
events: v.array(v.unknown())
|
|
27205
|
+
});
|
|
27206
|
+
var UserIntentsResponseSchema = v.object({
|
|
27207
|
+
total: v.number(),
|
|
27208
|
+
offset: v.number(),
|
|
27209
|
+
limit: v.number(),
|
|
27210
|
+
items: v.array(IntentResponseSchema)
|
|
27211
|
+
});
|
|
27212
|
+
var OrderbookResponseSchema = v.object({
|
|
27213
|
+
total: v.number(),
|
|
27214
|
+
data: v.array(
|
|
27215
|
+
v.object({
|
|
27216
|
+
intentState: v.object({
|
|
27217
|
+
exists: v.boolean(),
|
|
27218
|
+
remainingInput: v.string(),
|
|
27219
|
+
receivedOutput: v.string(),
|
|
27220
|
+
pendingPayment: v.boolean()
|
|
27221
|
+
}),
|
|
27222
|
+
intentData: v.object({
|
|
27223
|
+
intentId: v.string(),
|
|
27224
|
+
creator: v.string(),
|
|
27225
|
+
inputToken: v.string(),
|
|
27226
|
+
outputToken: v.string(),
|
|
27227
|
+
inputAmount: v.string(),
|
|
27228
|
+
minOutputAmount: v.string(),
|
|
27229
|
+
deadline: v.string(),
|
|
27230
|
+
allowPartialFill: v.boolean(),
|
|
27231
|
+
srcChain: v.number(),
|
|
27232
|
+
dstChain: v.number(),
|
|
27233
|
+
srcAddress: v.string(),
|
|
27234
|
+
dstAddress: v.string(),
|
|
27235
|
+
solver: v.string(),
|
|
27236
|
+
data: v.string(),
|
|
27237
|
+
intentHash: v.string(),
|
|
27238
|
+
txHash: v.string(),
|
|
27239
|
+
blockNumber: v.number()
|
|
27240
|
+
})
|
|
27241
|
+
})
|
|
27242
|
+
)
|
|
27243
|
+
});
|
|
27244
|
+
var MoneyMarketPositionSchema = v.object({
|
|
27245
|
+
userAddress: v.string(),
|
|
27246
|
+
positions: v.array(
|
|
27247
|
+
v.object({
|
|
27248
|
+
reserveAddress: v.string(),
|
|
27249
|
+
aTokenAddress: v.string(),
|
|
27250
|
+
variableDebtTokenAddress: v.string(),
|
|
27251
|
+
aTokenBalance: v.string(),
|
|
27252
|
+
variableDebtTokenBalance: v.string(),
|
|
27253
|
+
blockNumber: v.number()
|
|
27254
|
+
})
|
|
27255
|
+
)
|
|
27256
|
+
});
|
|
27257
|
+
var MoneyMarketAssetSchema = v.object({
|
|
27258
|
+
reserveAddress: v.string(),
|
|
27259
|
+
aTokenAddress: v.string(),
|
|
27260
|
+
totalATokenBalance: v.string(),
|
|
27261
|
+
variableDebtTokenAddress: v.string(),
|
|
27262
|
+
totalVariableDebtTokenBalance: v.string(),
|
|
27263
|
+
liquidityRate: v.string(),
|
|
27264
|
+
symbol: v.string(),
|
|
27265
|
+
totalSuppliers: v.number(),
|
|
27266
|
+
totalBorrowers: v.number(),
|
|
27267
|
+
variableBorrowRate: v.string(),
|
|
27268
|
+
stableBorrowRate: v.string(),
|
|
27269
|
+
liquidityIndex: v.string(),
|
|
27270
|
+
variableBorrowIndex: v.string(),
|
|
27271
|
+
blockNumber: v.number()
|
|
27272
|
+
});
|
|
27273
|
+
var MoneyMarketAssetsSchema = v.array(MoneyMarketAssetSchema);
|
|
27274
|
+
var MoneyMarketAssetBorrowersSchema = v.object({
|
|
27275
|
+
borrowers: v.array(v.string()),
|
|
27276
|
+
total: v.number(),
|
|
27277
|
+
offset: v.number(),
|
|
27278
|
+
limit: v.number()
|
|
27279
|
+
});
|
|
27280
|
+
var MoneyMarketAssetSuppliersSchema = v.object({
|
|
27281
|
+
suppliers: v.array(v.string()),
|
|
27282
|
+
total: v.number(),
|
|
27283
|
+
offset: v.number(),
|
|
27284
|
+
limit: v.number()
|
|
27285
|
+
});
|
|
27286
|
+
var MoneyMarketBorrowersSchema = v.object({
|
|
27287
|
+
borrowers: v.array(v.string()),
|
|
27288
|
+
total: v.number(),
|
|
27289
|
+
offset: v.number(),
|
|
27290
|
+
limit: v.number()
|
|
27291
|
+
});
|
|
27292
|
+
var GetChainsResponseSchema = v.array(SpokeChainKeySchema);
|
|
27293
|
+
var TokensByChainMapSchema = v.custom(
|
|
27294
|
+
(input) => typeof input === "object" && input !== null && Object.values(input).every((tokens) => Array.isArray(tokens) && tokens.every((t) => v.is(XTokenSchema, t)))
|
|
27295
|
+
);
|
|
27296
|
+
var TokensListSchema = v.array(XTokenSchema);
|
|
27297
|
+
var ReserveAssetsSchema = v.array(AddressSchema);
|
|
27298
|
+
|
|
27299
|
+
// src/backendApi/guards.ts
|
|
27300
|
+
var isFillEvent = (value) => v.is(FillEventSchema, value);
|
|
27029
27301
|
function decodePacketIntentTarget(payload) {
|
|
27030
27302
|
try {
|
|
27031
27303
|
const hex = payload.startsWith("0x") ? payload.slice(2) : payload;
|
|
@@ -27045,6 +27317,12 @@ function selectSolvedIntentPacket(packets, intentsContract) {
|
|
|
27045
27317
|
return packets.reduce((highest, packet) => packet.conn_sn > highest.conn_sn ? packet : highest);
|
|
27046
27318
|
}
|
|
27047
27319
|
|
|
27320
|
+
// src/swap/detailedStatus.ts
|
|
27321
|
+
var DETAILED_STATUS_NOT_DELIVERED = "relay_not_delivered";
|
|
27322
|
+
function isBackendSubmitTxAbandoned(data) {
|
|
27323
|
+
return data.status === "failed" || Boolean(data.abandonedAt);
|
|
27324
|
+
}
|
|
27325
|
+
|
|
27048
27326
|
// src/swap/errors.ts
|
|
27049
27327
|
var swapInvariant = createInvariant("swap");
|
|
27050
27328
|
var POST_EXECUTION_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
@@ -27069,6 +27347,8 @@ var isPostExecutionError = isCodeMember(POST_EXECUTION_ERROR_CODES);
|
|
|
27069
27347
|
var isSwapError = isCodeMember(SWAP_ERROR_CODES);
|
|
27070
27348
|
|
|
27071
27349
|
// src/swap/SwapService.ts
|
|
27350
|
+
var RECONCILE_TIMEOUT_MS = 5e3;
|
|
27351
|
+
var DETAILED_STATUS_SOLVER_TIMEOUT_MS = 5e3;
|
|
27072
27352
|
var SwapService = class {
|
|
27073
27353
|
// dependent services
|
|
27074
27354
|
hubProvider;
|
|
@@ -27169,7 +27449,8 @@ var SwapService = class {
|
|
|
27169
27449
|
return calculatePercentageFeeAmount(inputAmount, 10);
|
|
27170
27450
|
}
|
|
27171
27451
|
/**
|
|
27172
|
-
* Polls the solver API for the current execution status of an intent.
|
|
27452
|
+
* Polls the solver API for the current execution status of an intent. A `NOT_FOUND` or a failed
|
|
27453
|
+
* request is cross-checked against the backend's durable intent record.
|
|
27173
27454
|
*
|
|
27174
27455
|
* The `intent_tx_hash` in the request must be the hub-chain (Sonic) transaction hash where
|
|
27175
27456
|
* the intent was registered — this is the `dst_tx_hash` from the relay packet returned by
|
|
@@ -27180,7 +27461,145 @@ var SwapService = class {
|
|
|
27180
27461
|
* `fill_tx_hash` is populated only when `status === SolverIntentStatusCode.SOLVED (3)`.
|
|
27181
27462
|
*/
|
|
27182
27463
|
async getStatus(request) {
|
|
27183
|
-
return
|
|
27464
|
+
return this.resolveSolverStatus(request);
|
|
27465
|
+
}
|
|
27466
|
+
/**
|
|
27467
|
+
* {@link SwapService.getStatus} with an optional budget for the solver leg. Public `getStatus` is a
|
|
27468
|
+
* one-shot read a caller bounds however it likes, so it stays unbounded; `getDetailedStatus` is
|
|
27469
|
+
* polled and passes {@link DETAILED_STATUS_SOLVER_TIMEOUT_MS}. Both go through here so the
|
|
27470
|
+
* durable-intent reconcile below is written once.
|
|
27471
|
+
*
|
|
27472
|
+
* `timeoutMs` bounds the solver request alone. The reconcile that a failed or NOT_FOUND solver read
|
|
27473
|
+
* falls through to carries its own {@link RECONCILE_TIMEOUT_MS}, so a bounded call can cost both.
|
|
27474
|
+
*/
|
|
27475
|
+
async resolveSolverStatus(request, timeoutMs) {
|
|
27476
|
+
const solverResult = await SolverApiService.getStatus(request, this.solver, this.config.logger, timeoutMs);
|
|
27477
|
+
const forgotten = !solverResult.ok || solverResult.value.status === SolverIntentStatusCode.NOT_FOUND;
|
|
27478
|
+
if (!forgotten) return solverResult;
|
|
27479
|
+
const timeout = Math.min(RECONCILE_TIMEOUT_MS, this.backendApi.requestTimeoutMs);
|
|
27480
|
+
const intent = await this.backendApi.getIntentByTxHash(request.intent_tx_hash, { timeout });
|
|
27481
|
+
const settled = intent.ok ? intent.value.events.filter(isFillEvent).find((fill) => fill.intentState.remainingInput === "0") : void 0;
|
|
27482
|
+
if (settled) return { ok: true, value: { status: SolverIntentStatusCode.SOLVED, fill_tx_hash: settled.txHash } };
|
|
27483
|
+
const backendAnswered = intent.ok || isSodaxError(intent.error) && intent.error.context?.status === 404;
|
|
27484
|
+
if (solverResult.ok && !backendAnswered) {
|
|
27485
|
+
return {
|
|
27486
|
+
ok: false,
|
|
27487
|
+
error: {
|
|
27488
|
+
detail: {
|
|
27489
|
+
code: SolverIntentErrorCode.UNKNOWN,
|
|
27490
|
+
message: "solver reported NOT_FOUND and the durable intent record could not be read to verify it"
|
|
27491
|
+
}
|
|
27492
|
+
}
|
|
27493
|
+
};
|
|
27494
|
+
}
|
|
27495
|
+
return solverResult;
|
|
27496
|
+
}
|
|
27497
|
+
/**
|
|
27498
|
+
* Reads a swap's status from its source-chain transaction — the identifier a caller always holds.
|
|
27499
|
+
*
|
|
27500
|
+
* **Routes; does not translate.** Returns the backend submit-tx record while it is in play,
|
|
27501
|
+
* otherwise the solver's answer via the hub tx hash resolved from the relay packet. The result is
|
|
27502
|
+
* tagged with `source` (discriminate on it) and carries that source's payload unmodified.
|
|
27503
|
+
*
|
|
27504
|
+
* **Any** unusable backend response routes to the solver — a 404, a transport or server error, or
|
|
27505
|
+
* a record the backend gave up on. See `docs/SWAPS.md` § Get Detailed Status for why.
|
|
27506
|
+
*
|
|
27507
|
+
* A point-in-time read; poll it yourself, or use dapp-kit's `useDetailedStatus`.
|
|
27508
|
+
*
|
|
27509
|
+
* @param params - `srcChainKey` and `srcTxHash` of the source-chain swap transaction.
|
|
27510
|
+
* @returns A `Result` containing a {@link DetailedSwapStatus}. Fails with `LOOKUP_FAILED` when no
|
|
27511
|
+
* source can answer yet — usually the relay has not delivered the packet, so there is no hub tx
|
|
27512
|
+
* hash for the solver to be asked about.
|
|
27513
|
+
*/
|
|
27514
|
+
async getDetailedStatus(params) {
|
|
27515
|
+
try {
|
|
27516
|
+
const record3 = await this.backendApi.swaps.getSubmitTxStatus({
|
|
27517
|
+
txHash: params.srcTxHash,
|
|
27518
|
+
srcChainKey: params.srcChainKey
|
|
27519
|
+
});
|
|
27520
|
+
if (record3.ok && record3.value.success && !isBackendSubmitTxAbandoned(record3.value.data)) {
|
|
27521
|
+
return { ok: true, value: { source: "backend", data: record3.value.data } };
|
|
27522
|
+
}
|
|
27523
|
+
const backendAnswered = record3.ok || isSodaxError(record3.error) && record3.error.context?.status === 404;
|
|
27524
|
+
const dstTxHash = await this.resolveHubTxHash(params, backendAnswered);
|
|
27525
|
+
if (!dstTxHash.ok) return dstTxHash;
|
|
27526
|
+
const solver = await this.resolveSolverStatus(
|
|
27527
|
+
{ intent_tx_hash: dstTxHash.value },
|
|
27528
|
+
DETAILED_STATUS_SOLVER_TIMEOUT_MS
|
|
27529
|
+
);
|
|
27530
|
+
if (!solver.ok) {
|
|
27531
|
+
return { ok: false, error: this.detailedStatusLookupFailed(solver.error, params.srcChainKey) };
|
|
27532
|
+
}
|
|
27533
|
+
return { ok: true, value: { source: "solver", dstTxHash: dstTxHash.value, data: solver.value } };
|
|
27534
|
+
} catch (error) {
|
|
27535
|
+
return { ok: false, error: this.detailedStatusLookupFailed(error, params.srcChainKey) };
|
|
27536
|
+
}
|
|
27537
|
+
}
|
|
27538
|
+
/**
|
|
27539
|
+
* The hub-chain tx hash the solver is keyed on. A hub-source swap has no relay leg — the source
|
|
27540
|
+
* tx *is* the hub tx. Otherwise the delivered relay packet carries it, so an undelivered packet
|
|
27541
|
+
* is simply "no hash yet".
|
|
27542
|
+
*/
|
|
27543
|
+
async resolveHubTxHash(key, backendAnswered) {
|
|
27544
|
+
const missReason = backendAnswered ? DETAILED_STATUS_NOT_DELIVERED : void 0;
|
|
27545
|
+
let hubTxHash = key.srcTxHash;
|
|
27546
|
+
if (!isHubChainKeyType(key.srcChainKey)) {
|
|
27547
|
+
const relayChainId = getIntentRelayChainId(key.srcChainKey);
|
|
27548
|
+
const packets = await getTransactionPackets(
|
|
27549
|
+
{
|
|
27550
|
+
action: "get_transaction_packets",
|
|
27551
|
+
params: { chain_id: relayChainId.toString(), tx_hash: key.srcTxHash }
|
|
27552
|
+
},
|
|
27553
|
+
this.relayerApiEndpoint,
|
|
27554
|
+
RELAY_REQUEST_TIMEOUT_MS
|
|
27555
|
+
);
|
|
27556
|
+
if (!packets.ok) {
|
|
27557
|
+
const notIndexed = packets.error instanceof HttpRelayError && packets.error.status === 404;
|
|
27558
|
+
return {
|
|
27559
|
+
ok: false,
|
|
27560
|
+
error: this.detailedStatusLookupFailed(packets.error, key.srcChainKey, notIndexed ? missReason : void 0)
|
|
27561
|
+
};
|
|
27562
|
+
}
|
|
27563
|
+
if (!packets.value?.success || !Array.isArray(packets.value.data)) {
|
|
27564
|
+
return {
|
|
27565
|
+
ok: false,
|
|
27566
|
+
error: this.detailedStatusLookupFailed(
|
|
27567
|
+
new Error("relay returned no usable transaction packets"),
|
|
27568
|
+
key.srcChainKey
|
|
27569
|
+
)
|
|
27570
|
+
};
|
|
27571
|
+
}
|
|
27572
|
+
const delivered = packets.value.data.find(
|
|
27573
|
+
(packet) => typeof packet?.src_tx_hash === "string" && packet.src_tx_hash.toLowerCase() === key.srcTxHash.toLowerCase() && packet.src_chain_id === Number(relayChainId) && packet.status === "executed" && typeof packet.dst_tx_hash === "string" && packet.dst_tx_hash.length > 0
|
|
27574
|
+
);
|
|
27575
|
+
if (!delivered) {
|
|
27576
|
+
return {
|
|
27577
|
+
ok: false,
|
|
27578
|
+
error: this.detailedStatusLookupFailed(
|
|
27579
|
+
new Error("relay has not delivered the intent to the hub yet"),
|
|
27580
|
+
key.srcChainKey,
|
|
27581
|
+
missReason
|
|
27582
|
+
)
|
|
27583
|
+
};
|
|
27584
|
+
}
|
|
27585
|
+
hubTxHash = delivered.dst_tx_hash;
|
|
27586
|
+
}
|
|
27587
|
+
if (isHex(hubTxHash)) return { ok: true, value: hubTxHash };
|
|
27588
|
+
return {
|
|
27589
|
+
ok: false,
|
|
27590
|
+
error: this.detailedStatusLookupFailed(
|
|
27591
|
+
new Error(`hub tx hash is not a hex string: ${hubTxHash}`),
|
|
27592
|
+
key.srcChainKey
|
|
27593
|
+
)
|
|
27594
|
+
};
|
|
27595
|
+
}
|
|
27596
|
+
/**
|
|
27597
|
+
* `reason` is set only for {@link DETAILED_STATUS_NOT_DELIVERED} — the miss a caller can bound
|
|
27598
|
+
* with a retry budget. Leaving it off marks a dependency that is failing right now, which a
|
|
27599
|
+
* caller should keep retrying rather than give up on.
|
|
27600
|
+
*/
|
|
27601
|
+
detailedStatusLookupFailed(cause, srcChainKey, reason) {
|
|
27602
|
+
return lookupFailed("swap", "getDetailedStatus", cause, { srcChainKey, action: "swap", reason });
|
|
27184
27603
|
}
|
|
27185
27604
|
/**
|
|
27186
27605
|
* Notifies the solver API that an intent has been registered on the hub chain, triggering
|
|
@@ -30495,7 +30914,7 @@ var SwapsApiService = class _SwapsApiService {
|
|
|
30495
30914
|
if (error.code === "VALIDATION_ERROR" && error.context.issues !== void 0) {
|
|
30496
30915
|
context.reason = "invalid_response_shape";
|
|
30497
30916
|
const issues = error.context.issues;
|
|
30498
|
-
context.issues = issues instanceof
|
|
30917
|
+
context.issues = issues instanceof v.ValiError ? v.flatten(issues.issues) : issues;
|
|
30499
30918
|
}
|
|
30500
30919
|
if (error.context.status !== void 0) context.status = error.context.status;
|
|
30501
30920
|
}
|
|
@@ -30670,21 +31089,21 @@ var SwapsApiService = class _SwapsApiService {
|
|
|
30670
31089
|
return this.config.timeout ?? DEFAULT_BACKEND_API_TIMEOUT;
|
|
30671
31090
|
}
|
|
30672
31091
|
};
|
|
30673
|
-
var StellarSponsorConfigSchema =
|
|
30674
|
-
sponsorAccount:
|
|
30675
|
-
networkPassphrase:
|
|
30676
|
-
minTotalFeeStroops:
|
|
30677
|
-
maxTotalFeeStroops:
|
|
30678
|
-
operationCount:
|
|
30679
|
-
minPerOperationFeeStroops:
|
|
30680
|
-
maxPerOperationFeeStroops:
|
|
30681
|
-
recommendedPerOperationFeeStroops:
|
|
30682
|
-
maxTimeboundSeconds:
|
|
30683
|
-
requiredStartingBalance:
|
|
31092
|
+
var StellarSponsorConfigSchema = v.object({
|
|
31093
|
+
sponsorAccount: v.string(),
|
|
31094
|
+
networkPassphrase: v.string(),
|
|
31095
|
+
minTotalFeeStroops: v.string(),
|
|
31096
|
+
maxTotalFeeStroops: v.string(),
|
|
31097
|
+
operationCount: v.number(),
|
|
31098
|
+
minPerOperationFeeStroops: v.string(),
|
|
31099
|
+
maxPerOperationFeeStroops: v.string(),
|
|
31100
|
+
recommendedPerOperationFeeStroops: v.string(),
|
|
31101
|
+
maxTimeboundSeconds: v.number(),
|
|
31102
|
+
requiredStartingBalance: v.string()
|
|
30684
31103
|
});
|
|
30685
|
-
var StellarSponsoredAccountResponseSchema =
|
|
30686
|
-
|
|
30687
|
-
|
|
31104
|
+
var StellarSponsoredAccountResponseSchema = v.variant("alreadyActive", [
|
|
31105
|
+
v.object({ hash: v.string(), alreadyActive: v.literal(false) }),
|
|
31106
|
+
v.object({ hash: v.null(), alreadyActive: v.literal(true) })
|
|
30688
31107
|
]);
|
|
30689
31108
|
|
|
30690
31109
|
// src/backendApi/SponsoringApiService.ts
|
|
@@ -30712,7 +31131,7 @@ var SponsoringApiService = class {
|
|
|
30712
31131
|
logger: this.logger,
|
|
30713
31132
|
serviceLabel: "SponsoringApiService"
|
|
30714
31133
|
});
|
|
30715
|
-
const parsed =
|
|
31134
|
+
const parsed = v.safeParse(schema, raw);
|
|
30716
31135
|
if (!parsed.success) {
|
|
30717
31136
|
return {
|
|
30718
31137
|
ok: false,
|
|
@@ -30720,7 +31139,7 @@ var SponsoringApiService = class {
|
|
|
30720
31139
|
api: "sponsoring",
|
|
30721
31140
|
feature: "backend",
|
|
30722
31141
|
endpoint,
|
|
30723
|
-
issues:
|
|
31142
|
+
issues: v.flatten(parsed.issues)
|
|
30724
31143
|
})
|
|
30725
31144
|
};
|
|
30726
31145
|
}
|
|
@@ -30758,141 +31177,141 @@ var SponsoringApiService = class {
|
|
|
30758
31177
|
return this.config.baseURL;
|
|
30759
31178
|
}
|
|
30760
31179
|
};
|
|
30761
|
-
var RelayExtraDataResponseSchema =
|
|
30762
|
-
address:
|
|
30763
|
-
payload:
|
|
31180
|
+
var RelayExtraDataResponseSchema = v.object({
|
|
31181
|
+
address: v.string(),
|
|
31182
|
+
payload: v.string()
|
|
30764
31183
|
});
|
|
30765
|
-
var BridgeTokenSchema =
|
|
30766
|
-
symbol:
|
|
30767
|
-
name:
|
|
30768
|
-
decimals:
|
|
30769
|
-
address:
|
|
30770
|
-
chainKey:
|
|
30771
|
-
hubAsset:
|
|
30772
|
-
vault:
|
|
31184
|
+
var BridgeTokenSchema = v.object({
|
|
31185
|
+
symbol: v.string(),
|
|
31186
|
+
name: v.string(),
|
|
31187
|
+
decimals: v.number(),
|
|
31188
|
+
address: v.string(),
|
|
31189
|
+
chainKey: v.string(),
|
|
31190
|
+
hubAsset: v.string(),
|
|
31191
|
+
vault: v.string()
|
|
30773
31192
|
});
|
|
30774
|
-
var BridgeTokensResponseSchema =
|
|
30775
|
-
var BridgeTokensByChainResponseSchema =
|
|
30776
|
-
var BridgeAllowanceCheckResponseSchema =
|
|
30777
|
-
valid:
|
|
31193
|
+
var BridgeTokensResponseSchema = v.record(v.string(), v.array(BridgeTokenSchema));
|
|
31194
|
+
var BridgeTokensByChainResponseSchema = v.array(BridgeTokenSchema);
|
|
31195
|
+
var BridgeAllowanceCheckResponseSchema = v.object({
|
|
31196
|
+
valid: v.boolean()
|
|
30778
31197
|
});
|
|
30779
|
-
var makeBridgeApproveResponseSchema = (txSchema) =>
|
|
30780
|
-
var makeCreateBridgeIntentResponseSchema = (txSchema) =>
|
|
31198
|
+
var makeBridgeApproveResponseSchema = (txSchema) => v.object({ tx: txSchema });
|
|
31199
|
+
var makeCreateBridgeIntentResponseSchema = (txSchema) => v.object({
|
|
30781
31200
|
tx: txSchema,
|
|
30782
31201
|
relayData: RelayExtraDataResponseSchema
|
|
30783
31202
|
});
|
|
30784
|
-
var BridgeSubmitTxResponseSchema =
|
|
30785
|
-
success:
|
|
30786
|
-
data:
|
|
30787
|
-
status:
|
|
30788
|
-
message:
|
|
31203
|
+
var BridgeSubmitTxResponseSchema = v.object({
|
|
31204
|
+
success: v.boolean(),
|
|
31205
|
+
data: v.object({
|
|
31206
|
+
status: v.picklist(["inserted", "duplicate"]),
|
|
31207
|
+
message: v.string()
|
|
30789
31208
|
})
|
|
30790
31209
|
});
|
|
30791
|
-
var BridgePacketDataSchema =
|
|
30792
|
-
src_chain_id:
|
|
30793
|
-
src_tx_hash:
|
|
30794
|
-
src_address:
|
|
30795
|
-
status:
|
|
30796
|
-
dst_chain_id:
|
|
30797
|
-
conn_sn:
|
|
30798
|
-
dst_address:
|
|
30799
|
-
dst_tx_hash:
|
|
30800
|
-
signatures:
|
|
30801
|
-
payload:
|
|
31210
|
+
var BridgePacketDataSchema = v.object({
|
|
31211
|
+
src_chain_id: v.number(),
|
|
31212
|
+
src_tx_hash: v.string(),
|
|
31213
|
+
src_address: v.string(),
|
|
31214
|
+
status: v.picklist(["pending", "validating", "executing", "executed"]),
|
|
31215
|
+
dst_chain_id: v.number(),
|
|
31216
|
+
conn_sn: v.number(),
|
|
31217
|
+
dst_address: v.string(),
|
|
31218
|
+
dst_tx_hash: v.string(),
|
|
31219
|
+
signatures: v.array(v.string()),
|
|
31220
|
+
payload: v.string()
|
|
30802
31221
|
});
|
|
30803
|
-
var BridgeSubmitTxStatusResultSchema =
|
|
30804
|
-
dstIntentTxHash:
|
|
30805
|
-
packetData:
|
|
31222
|
+
var BridgeSubmitTxStatusResultSchema = v.object({
|
|
31223
|
+
dstIntentTxHash: v.string(),
|
|
31224
|
+
packetData: v.optional(BridgePacketDataSchema)
|
|
30806
31225
|
});
|
|
30807
|
-
var BridgeSubmitTxStatusDataSchema =
|
|
30808
|
-
txHash:
|
|
30809
|
-
srcChainKey:
|
|
30810
|
-
status:
|
|
30811
|
-
failedAtStep:
|
|
30812
|
-
failureReason:
|
|
30813
|
-
processingAttempts:
|
|
30814
|
-
abandonedAt:
|
|
30815
|
-
result:
|
|
30816
|
-
userMessage:
|
|
31226
|
+
var BridgeSubmitTxStatusDataSchema = v.object({
|
|
31227
|
+
txHash: v.string(),
|
|
31228
|
+
srcChainKey: v.string(),
|
|
31229
|
+
status: v.string(),
|
|
31230
|
+
failedAtStep: v.optional(v.string()),
|
|
31231
|
+
failureReason: v.optional(v.string()),
|
|
31232
|
+
processingAttempts: v.number(),
|
|
31233
|
+
abandonedAt: v.optional(v.string()),
|
|
31234
|
+
result: v.optional(BridgeSubmitTxStatusResultSchema),
|
|
31235
|
+
userMessage: v.optional(v.string())
|
|
30817
31236
|
});
|
|
30818
|
-
var BridgeSubmitTxStatusResponseSchema =
|
|
30819
|
-
success:
|
|
31237
|
+
var BridgeSubmitTxStatusResponseSchema = v.object({
|
|
31238
|
+
success: v.boolean(),
|
|
30820
31239
|
data: BridgeSubmitTxStatusDataSchema
|
|
30821
31240
|
});
|
|
30822
|
-
var BridgeFeeResponseSchema =
|
|
30823
|
-
var BridgeLimitSchema =
|
|
30824
|
-
amount:
|
|
30825
|
-
decimals:
|
|
30826
|
-
type:
|
|
31241
|
+
var BridgeFeeResponseSchema = v.object({ fee: v.string() });
|
|
31242
|
+
var BridgeLimitSchema = v.object({
|
|
31243
|
+
amount: v.string(),
|
|
31244
|
+
decimals: v.number(),
|
|
31245
|
+
type: v.picklist(["DEPOSIT_LIMIT", "WITHDRAWAL_LIMIT"])
|
|
30827
31246
|
});
|
|
30828
|
-
var BridgeableAmountResponseSchema =
|
|
30829
|
-
var BridgeableCheckResponseSchema =
|
|
30830
|
-
var
|
|
30831
|
-
var HexSchema =
|
|
30832
|
-
var BigintFromString =
|
|
30833
|
-
var BytesFromIndexRecord =
|
|
30834
|
-
|
|
30835
|
-
|
|
31247
|
+
var BridgeableAmountResponseSchema = v.object({ limit: BridgeLimitSchema });
|
|
31248
|
+
var BridgeableCheckResponseSchema = v.object({ bridgeable: v.boolean() });
|
|
31249
|
+
var AddressSchema2 = v.custom((input) => typeof input === "string");
|
|
31250
|
+
var HexSchema = v.custom((input) => typeof input === "string");
|
|
31251
|
+
var BigintFromString = v.pipe(v.string(), v.toBigint());
|
|
31252
|
+
var BytesFromIndexRecord = v.pipe(
|
|
31253
|
+
v.record(v.string(), v.number()),
|
|
31254
|
+
v.transform((indexed) => Uint8Array.from(Object.values(indexed)))
|
|
30836
31255
|
);
|
|
30837
|
-
var EvmRawTxSchema =
|
|
30838
|
-
from:
|
|
30839
|
-
to:
|
|
31256
|
+
var EvmRawTxSchema = v.object({
|
|
31257
|
+
from: AddressSchema2,
|
|
31258
|
+
to: AddressSchema2,
|
|
30840
31259
|
value: BigintFromString,
|
|
30841
31260
|
data: HexSchema
|
|
30842
31261
|
});
|
|
30843
|
-
var SolanaRawTxSchema =
|
|
30844
|
-
from:
|
|
30845
|
-
to:
|
|
31262
|
+
var SolanaRawTxSchema = v.object({
|
|
31263
|
+
from: v.string(),
|
|
31264
|
+
to: v.string(),
|
|
30846
31265
|
value: BigintFromString,
|
|
30847
|
-
data:
|
|
31266
|
+
data: v.string()
|
|
30848
31267
|
});
|
|
30849
|
-
var SuiRawTxSchema =
|
|
31268
|
+
var SuiRawTxSchema = v.object({
|
|
30850
31269
|
from: HexSchema,
|
|
30851
|
-
to:
|
|
31270
|
+
to: v.string(),
|
|
30852
31271
|
value: BigintFromString,
|
|
30853
|
-
data:
|
|
31272
|
+
data: v.string()
|
|
30854
31273
|
});
|
|
30855
|
-
var StellarRawTxSchema =
|
|
30856
|
-
from:
|
|
30857
|
-
to:
|
|
31274
|
+
var StellarRawTxSchema = v.object({
|
|
31275
|
+
from: v.string(),
|
|
31276
|
+
to: v.string(),
|
|
30858
31277
|
value: BigintFromString,
|
|
30859
|
-
data:
|
|
31278
|
+
data: v.string()
|
|
30860
31279
|
});
|
|
30861
|
-
var BitcoinRawTxSchema =
|
|
30862
|
-
from:
|
|
30863
|
-
to:
|
|
31280
|
+
var BitcoinRawTxSchema = v.object({
|
|
31281
|
+
from: v.string(),
|
|
31282
|
+
to: v.string(),
|
|
30864
31283
|
value: BigintFromString,
|
|
30865
|
-
data:
|
|
31284
|
+
data: v.string()
|
|
30866
31285
|
});
|
|
30867
|
-
var InjectiveRawTxSchema =
|
|
31286
|
+
var InjectiveRawTxSchema = v.object({
|
|
30868
31287
|
from: HexSchema,
|
|
30869
31288
|
to: HexSchema,
|
|
30870
|
-
signedDoc:
|
|
31289
|
+
signedDoc: v.object({
|
|
30871
31290
|
bodyBytes: BytesFromIndexRecord,
|
|
30872
31291
|
authInfoBytes: BytesFromIndexRecord,
|
|
30873
|
-
chainId:
|
|
31292
|
+
chainId: v.string(),
|
|
30874
31293
|
accountNumber: BigintFromString
|
|
30875
31294
|
})
|
|
30876
31295
|
});
|
|
30877
|
-
var NearRawTxSchema =
|
|
30878
|
-
signerId:
|
|
30879
|
-
params:
|
|
30880
|
-
contractId:
|
|
30881
|
-
method:
|
|
30882
|
-
args:
|
|
30883
|
-
gas:
|
|
30884
|
-
deposit:
|
|
31296
|
+
var NearRawTxSchema = v.object({
|
|
31297
|
+
signerId: v.string(),
|
|
31298
|
+
params: v.object({
|
|
31299
|
+
contractId: v.string(),
|
|
31300
|
+
method: v.string(),
|
|
31301
|
+
args: v.custom((input) => typeof input === "object" && input !== null),
|
|
31302
|
+
gas: v.optional(BigintFromString),
|
|
31303
|
+
deposit: v.optional(BigintFromString)
|
|
30885
31304
|
})
|
|
30886
31305
|
});
|
|
30887
|
-
var IconRawTxSchema =
|
|
30888
|
-
|
|
30889
|
-
|
|
31306
|
+
var IconRawTxSchema = v.record(
|
|
31307
|
+
v.string(),
|
|
31308
|
+
v.union([v.string(), v.custom((input) => typeof input === "object" && input !== null)])
|
|
30890
31309
|
);
|
|
30891
|
-
var StacksRawTxSchema =
|
|
30892
|
-
payload:
|
|
30893
|
-
estimatedLength:
|
|
31310
|
+
var StacksRawTxSchema = v.object({
|
|
31311
|
+
payload: v.string(),
|
|
31312
|
+
estimatedLength: v.optional(v.number())
|
|
30894
31313
|
});
|
|
30895
|
-
var AnyRawTxSchema =
|
|
31314
|
+
var AnyRawTxSchema = v.custom((input) => typeof input === "object" && input !== null);
|
|
30896
31315
|
function rawTxSchemaForChainKey(chainKey) {
|
|
30897
31316
|
let chainType;
|
|
30898
31317
|
try {
|
|
@@ -30971,13 +31390,13 @@ var BridgeApiService = class {
|
|
|
30971
31390
|
logger: this.logger,
|
|
30972
31391
|
serviceLabel: "BridgeApiService"
|
|
30973
31392
|
});
|
|
30974
|
-
const parsed =
|
|
31393
|
+
const parsed = v.safeParse(schema, raw);
|
|
30975
31394
|
if (!parsed.success) {
|
|
30976
31395
|
return {
|
|
30977
31396
|
ok: false,
|
|
30978
31397
|
error: new SodaxError("EXTERNAL_API_ERROR", `Invalid response shape from bridge API for ${endpoint}`, {
|
|
30979
31398
|
feature: "backend",
|
|
30980
|
-
context: { api: "bridge", endpoint, reason: "invalid_response_shape", issues:
|
|
31399
|
+
context: { api: "bridge", endpoint, reason: "invalid_response_shape", issues: v.flatten(parsed.issues) }
|
|
30981
31400
|
})
|
|
30982
31401
|
};
|
|
30983
31402
|
}
|
|
@@ -31172,137 +31591,6 @@ var BridgeApiService = class {
|
|
|
31172
31591
|
return this.config.timeout;
|
|
31173
31592
|
}
|
|
31174
31593
|
};
|
|
31175
|
-
var ChainKeySchema = v7.custom((input) => typeof input === "string");
|
|
31176
|
-
var SpokeChainKeySchema = v7.custom((input) => typeof input === "string");
|
|
31177
|
-
var AddressSchema2 = v7.custom((input) => typeof input === "string");
|
|
31178
|
-
var XTokenSchema = v7.object({
|
|
31179
|
-
symbol: v7.string(),
|
|
31180
|
-
name: v7.string(),
|
|
31181
|
-
decimals: v7.number(),
|
|
31182
|
-
address: v7.string(),
|
|
31183
|
-
chainKey: ChainKeySchema,
|
|
31184
|
-
hubAsset: AddressSchema2,
|
|
31185
|
-
vault: AddressSchema2,
|
|
31186
|
-
access: v7.optional(v7.picklist(["withdrawOnly", "depositOnly"]))
|
|
31187
|
-
});
|
|
31188
|
-
var IntentStructSchema = v7.object({
|
|
31189
|
-
intentId: v7.string(),
|
|
31190
|
-
creator: v7.string(),
|
|
31191
|
-
inputToken: v7.string(),
|
|
31192
|
-
outputToken: v7.string(),
|
|
31193
|
-
inputAmount: v7.string(),
|
|
31194
|
-
minOutputAmount: v7.string(),
|
|
31195
|
-
deadline: v7.string(),
|
|
31196
|
-
allowPartialFill: v7.boolean(),
|
|
31197
|
-
srcChain: v7.number(),
|
|
31198
|
-
dstChain: v7.number(),
|
|
31199
|
-
srcAddress: v7.string(),
|
|
31200
|
-
dstAddress: v7.string(),
|
|
31201
|
-
solver: v7.string(),
|
|
31202
|
-
data: v7.string()
|
|
31203
|
-
});
|
|
31204
|
-
var IntentResponseSchema = v7.object({
|
|
31205
|
-
intentHash: v7.string(),
|
|
31206
|
-
txHash: v7.string(),
|
|
31207
|
-
logIndex: v7.number(),
|
|
31208
|
-
chainId: v7.number(),
|
|
31209
|
-
blockNumber: v7.number(),
|
|
31210
|
-
open: v7.boolean(),
|
|
31211
|
-
intent: IntentStructSchema,
|
|
31212
|
-
events: v7.array(v7.unknown())
|
|
31213
|
-
});
|
|
31214
|
-
var UserIntentsResponseSchema = v7.object({
|
|
31215
|
-
total: v7.number(),
|
|
31216
|
-
offset: v7.number(),
|
|
31217
|
-
limit: v7.number(),
|
|
31218
|
-
items: v7.array(IntentResponseSchema)
|
|
31219
|
-
});
|
|
31220
|
-
var OrderbookResponseSchema = v7.object({
|
|
31221
|
-
total: v7.number(),
|
|
31222
|
-
data: v7.array(
|
|
31223
|
-
v7.object({
|
|
31224
|
-
intentState: v7.object({
|
|
31225
|
-
exists: v7.boolean(),
|
|
31226
|
-
remainingInput: v7.string(),
|
|
31227
|
-
receivedOutput: v7.string(),
|
|
31228
|
-
pendingPayment: v7.boolean()
|
|
31229
|
-
}),
|
|
31230
|
-
intentData: v7.object({
|
|
31231
|
-
intentId: v7.string(),
|
|
31232
|
-
creator: v7.string(),
|
|
31233
|
-
inputToken: v7.string(),
|
|
31234
|
-
outputToken: v7.string(),
|
|
31235
|
-
inputAmount: v7.string(),
|
|
31236
|
-
minOutputAmount: v7.string(),
|
|
31237
|
-
deadline: v7.string(),
|
|
31238
|
-
allowPartialFill: v7.boolean(),
|
|
31239
|
-
srcChain: v7.number(),
|
|
31240
|
-
dstChain: v7.number(),
|
|
31241
|
-
srcAddress: v7.string(),
|
|
31242
|
-
dstAddress: v7.string(),
|
|
31243
|
-
solver: v7.string(),
|
|
31244
|
-
data: v7.string(),
|
|
31245
|
-
intentHash: v7.string(),
|
|
31246
|
-
txHash: v7.string(),
|
|
31247
|
-
blockNumber: v7.number()
|
|
31248
|
-
})
|
|
31249
|
-
})
|
|
31250
|
-
)
|
|
31251
|
-
});
|
|
31252
|
-
var MoneyMarketPositionSchema = v7.object({
|
|
31253
|
-
userAddress: v7.string(),
|
|
31254
|
-
positions: v7.array(
|
|
31255
|
-
v7.object({
|
|
31256
|
-
reserveAddress: v7.string(),
|
|
31257
|
-
aTokenAddress: v7.string(),
|
|
31258
|
-
variableDebtTokenAddress: v7.string(),
|
|
31259
|
-
aTokenBalance: v7.string(),
|
|
31260
|
-
variableDebtTokenBalance: v7.string(),
|
|
31261
|
-
blockNumber: v7.number()
|
|
31262
|
-
})
|
|
31263
|
-
)
|
|
31264
|
-
});
|
|
31265
|
-
var MoneyMarketAssetSchema = v7.object({
|
|
31266
|
-
reserveAddress: v7.string(),
|
|
31267
|
-
aTokenAddress: v7.string(),
|
|
31268
|
-
totalATokenBalance: v7.string(),
|
|
31269
|
-
variableDebtTokenAddress: v7.string(),
|
|
31270
|
-
totalVariableDebtTokenBalance: v7.string(),
|
|
31271
|
-
liquidityRate: v7.string(),
|
|
31272
|
-
symbol: v7.string(),
|
|
31273
|
-
totalSuppliers: v7.number(),
|
|
31274
|
-
totalBorrowers: v7.number(),
|
|
31275
|
-
variableBorrowRate: v7.string(),
|
|
31276
|
-
stableBorrowRate: v7.string(),
|
|
31277
|
-
liquidityIndex: v7.string(),
|
|
31278
|
-
variableBorrowIndex: v7.string(),
|
|
31279
|
-
blockNumber: v7.number()
|
|
31280
|
-
});
|
|
31281
|
-
var MoneyMarketAssetsSchema = v7.array(MoneyMarketAssetSchema);
|
|
31282
|
-
var MoneyMarketAssetBorrowersSchema = v7.object({
|
|
31283
|
-
borrowers: v7.array(v7.string()),
|
|
31284
|
-
total: v7.number(),
|
|
31285
|
-
offset: v7.number(),
|
|
31286
|
-
limit: v7.number()
|
|
31287
|
-
});
|
|
31288
|
-
var MoneyMarketAssetSuppliersSchema = v7.object({
|
|
31289
|
-
suppliers: v7.array(v7.string()),
|
|
31290
|
-
total: v7.number(),
|
|
31291
|
-
offset: v7.number(),
|
|
31292
|
-
limit: v7.number()
|
|
31293
|
-
});
|
|
31294
|
-
var MoneyMarketBorrowersSchema = v7.object({
|
|
31295
|
-
borrowers: v7.array(v7.string()),
|
|
31296
|
-
total: v7.number(),
|
|
31297
|
-
offset: v7.number(),
|
|
31298
|
-
limit: v7.number()
|
|
31299
|
-
});
|
|
31300
|
-
var GetChainsResponseSchema = v7.array(SpokeChainKeySchema);
|
|
31301
|
-
var TokensByChainMapSchema = v7.custom(
|
|
31302
|
-
(input) => typeof input === "object" && input !== null && Object.values(input).every((tokens) => Array.isArray(tokens) && tokens.every((t) => v7.is(XTokenSchema, t)))
|
|
31303
|
-
);
|
|
31304
|
-
var TokensListSchema = v7.array(XTokenSchema);
|
|
31305
|
-
var ReserveAssetsSchema = v7.array(AddressSchema2);
|
|
31306
31594
|
|
|
31307
31595
|
// src/backendApi/BackendApiService.ts
|
|
31308
31596
|
var BackendApiService = class {
|
|
@@ -31315,6 +31603,15 @@ var BackendApiService = class {
|
|
|
31315
31603
|
config;
|
|
31316
31604
|
headers;
|
|
31317
31605
|
logger;
|
|
31606
|
+
/**
|
|
31607
|
+
* The resolved request timeout. Exposed so a caller wanting a *shorter* per-call budget can clamp
|
|
31608
|
+
* to it: a `RequestOverrideConfig.timeout` replaces the configured value rather than capping it,
|
|
31609
|
+
* so passing a fixed override would silently lengthen requests for a consumer who configured a
|
|
31610
|
+
* stricter timeout.
|
|
31611
|
+
*/
|
|
31612
|
+
get requestTimeoutMs() {
|
|
31613
|
+
return this.config.timeout;
|
|
31614
|
+
}
|
|
31318
31615
|
/**
|
|
31319
31616
|
* Whether a legacy `/be` suffix is trimmed off a per-call `baseURL` override. Mirrors the config-level
|
|
31320
31617
|
* decision: an explicit `basePath` means the consumer writes complete roots, so their per-call value is
|
|
@@ -31385,7 +31682,7 @@ var BackendApiService = class {
|
|
|
31385
31682
|
async request(endpoint, config, schema) {
|
|
31386
31683
|
try {
|
|
31387
31684
|
const raw = await this.send(endpoint, config);
|
|
31388
|
-
const parsed =
|
|
31685
|
+
const parsed = v.safeParse(schema, raw);
|
|
31389
31686
|
if (!parsed.success) {
|
|
31390
31687
|
return {
|
|
31391
31688
|
ok: false,
|
|
@@ -31393,7 +31690,7 @@ var BackendApiService = class {
|
|
|
31393
31690
|
api: "backend",
|
|
31394
31691
|
feature: "backend",
|
|
31395
31692
|
endpoint,
|
|
31396
|
-
issues:
|
|
31693
|
+
issues: v.flatten(parsed.issues)
|
|
31397
31694
|
})
|
|
31398
31695
|
};
|
|
31399
31696
|
}
|
|
@@ -40615,7 +40912,7 @@ var LeverageYieldService = class {
|
|
|
40615
40912
|
}
|
|
40616
40913
|
/** Looks up a vault by its `name` field. Returns `undefined` when not registered. */
|
|
40617
40914
|
getVault(name) {
|
|
40618
|
-
return this.listVaults().find((
|
|
40915
|
+
return this.listVaults().find((v10) => v10.name === name);
|
|
40619
40916
|
}
|
|
40620
40917
|
/**
|
|
40621
40918
|
* Looks up a registered vault by its on-chain proxy address (case-insensitive).
|
|
@@ -40623,7 +40920,7 @@ var LeverageYieldService = class {
|
|
|
40623
40920
|
*/
|
|
40624
40921
|
getVaultByAddress(address) {
|
|
40625
40922
|
const normalized = address.toLowerCase();
|
|
40626
|
-
return this.listVaults().find((
|
|
40923
|
+
return this.listVaults().find((v10) => v10.vault.toLowerCase() === normalized);
|
|
40627
40924
|
}
|
|
40628
40925
|
/**
|
|
40629
40926
|
* Resolves the intent `deadline`: returns the caller-supplied value verbatim, otherwise
|
|
@@ -42180,4 +42477,4 @@ var isPartnerError = isCodeMember(PARTNER_CODES);
|
|
|
42180
42477
|
(*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
42181
42478
|
*/
|
|
42182
42479
|
|
|
42183
|
-
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, 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, PartnerFeeClaimService, PartnerService, Permit2Service, ProtocolIntentsAbi, RAY, RAY_DECIMALS, RELAY_ERROR_CODES, RELAY_FALLBACK_FLOOR_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, 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, 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, createInvariant, deepMerge, defaultHookAbi, detectBitcoinAddressType, dexConfig, dexInvariant, dexPools, encodeAddress, encodeBtcPayloadToBytes, encodeContractCalls, erc20Abi, erc4626Abi, estimateBitcoinTxSize, 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, isBackendHttpError, isBalnMigrateParams, isBitcoinChainKey, isBitcoinChainKeyType, isBitcoinWalletProviderType, isBridgeAllowanceCheckError, isBridgeApproveError, isBridgeCreateIntentError, isBridgeError, isBridgeLookupError, isBridgeOrchestrationError, isCodeMember, isDexApproveError, isDexCreateIntentError, isDexError, isEvmChainKey, isEvmChainKeyType, isEvmSpokeChainConfig, isEvmSpokeOnlyChainKey, isEvmSpokeOnlyChainKeyType, isEvmWalletProviderType, isFeatureError, 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, 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, serializeAddressData, 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, tokenLogo, tokenLogoSlug, uiPoolDataAbi, universalRouterAbi, unknownFailed, usesBip322MessageSigning, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, verifyFailed, wadToRay, waitForStacksTransaction, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|
|
42480
|
+
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, 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, 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, createInvariant, deepMerge, defaultHookAbi, detectBitcoinAddressType, dexConfig, dexInvariant, dexPools, encodeAddress, encodeBtcPayloadToBytes, encodeContractCalls, erc20Abi, erc4626Abi, estimateBitcoinTxSize, 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, 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, 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, serializeAddressData, 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 };
|