@sodax/sdk 2.1.0-rc.5 → 2.1.0-rc.6
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 +493 -303
- package/dist/index.d.cts +141 -5
- package/dist/index.d.ts +141 -5
- package/dist/index.mjs +491 -304
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -19,7 +19,7 @@ var IconSdkRaw = require('icon-sdk-js');
|
|
|
19
19
|
var sdkTs = require('@injectivelabs/sdk-ts');
|
|
20
20
|
var tx_js = require('cosmjs-types/cosmos/tx/v1beta1/tx.js');
|
|
21
21
|
var networks = require('@injectivelabs/networks');
|
|
22
|
-
var
|
|
22
|
+
var v = require('valibot');
|
|
23
23
|
var swapsApi = require('@sodax/swaps-api');
|
|
24
24
|
var BigNumber5 = require('bignumber.js');
|
|
25
25
|
var swapSdkCore = require('@pancakeswap/swap-sdk-core');
|
|
@@ -49,7 +49,7 @@ var rlp__namespace = /*#__PURE__*/_interopNamespace(rlp);
|
|
|
49
49
|
var ecc__namespace = /*#__PURE__*/_interopNamespace(ecc);
|
|
50
50
|
var BN__default = /*#__PURE__*/_interopDefault(BN);
|
|
51
51
|
var IconSdkRaw__namespace = /*#__PURE__*/_interopNamespace(IconSdkRaw);
|
|
52
|
-
var
|
|
52
|
+
var v__namespace = /*#__PURE__*/_interopNamespace(v);
|
|
53
53
|
var BigNumber5__default = /*#__PURE__*/_interopDefault(BigNumber5);
|
|
54
54
|
|
|
55
55
|
// src/errors/SodaxError.ts
|
|
@@ -122,8 +122,8 @@ function serializeCause(cause, depth) {
|
|
|
122
122
|
}
|
|
123
123
|
function sanitizeContext(value, depth) {
|
|
124
124
|
const out = {};
|
|
125
|
-
for (const [key,
|
|
126
|
-
out[key] = sanitizeValue(
|
|
125
|
+
for (const [key, v10] of Object.entries(value)) {
|
|
126
|
+
out[key] = sanitizeValue(v10, depth + 1);
|
|
127
127
|
}
|
|
128
128
|
return out;
|
|
129
129
|
}
|
|
@@ -134,13 +134,13 @@ function sanitizeValue(value, depth) {
|
|
|
134
134
|
if (t === "bigint") return value.toString();
|
|
135
135
|
if (t === "string" || t === "number" || t === "boolean") return value;
|
|
136
136
|
if (t === "function" || t === "symbol") return safeString(value);
|
|
137
|
-
if (Array.isArray(value)) return value.map((
|
|
137
|
+
if (Array.isArray(value)) return value.map((v10) => sanitizeValue(v10, depth + 1));
|
|
138
138
|
if (value instanceof Date) return value.toISOString();
|
|
139
139
|
if (value instanceof Map) {
|
|
140
|
-
return Array.from(value.entries()).map(([k,
|
|
140
|
+
return Array.from(value.entries()).map(([k, v10]) => [sanitizeValue(k, depth + 1), sanitizeValue(v10, depth + 1)]);
|
|
141
141
|
}
|
|
142
142
|
if (value instanceof Set) {
|
|
143
|
-
return Array.from(value.values()).map((
|
|
143
|
+
return Array.from(value.values()).map((v10) => sanitizeValue(v10, depth + 1));
|
|
144
144
|
}
|
|
145
145
|
if (value instanceof Error) return { name: value.name, message: value.message };
|
|
146
146
|
if (t === "object") {
|
|
@@ -152,9 +152,9 @@ function sanitizeValue(value, depth) {
|
|
|
152
152
|
}
|
|
153
153
|
return safeString(value);
|
|
154
154
|
}
|
|
155
|
-
function safeString(
|
|
155
|
+
function safeString(v10) {
|
|
156
156
|
try {
|
|
157
|
-
return String(
|
|
157
|
+
return String(v10);
|
|
158
158
|
} catch {
|
|
159
159
|
return "[unserializable]";
|
|
160
160
|
}
|
|
@@ -4458,7 +4458,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
|
|
|
4458
4458
|
}
|
|
4459
4459
|
|
|
4460
4460
|
// ../types/dist/index.js
|
|
4461
|
-
var CONFIG_VERSION =
|
|
4461
|
+
var CONFIG_VERSION = 226;
|
|
4462
4462
|
|
|
4463
4463
|
// src/shared/utils/resolveTimeoutMs.ts
|
|
4464
4464
|
function resolveTimeoutMs(timeout, fallbackMs) {
|
|
@@ -4845,10 +4845,11 @@ async function submitTransaction(payload, apiUrl) {
|
|
|
4845
4845
|
return { ok: false, error };
|
|
4846
4846
|
}
|
|
4847
4847
|
}
|
|
4848
|
-
async function getTransactionPackets(payload, apiUrl) {
|
|
4848
|
+
async function getTransactionPackets(payload, apiUrl, timeoutMs) {
|
|
4849
4849
|
invariant(payload.params.chain_id.length > 0, "Invalid input parameters. source_chain_id empty");
|
|
4850
4850
|
invariant(payload.params.tx_hash.length > 0, "Invalid input parameters. tx_hash empty");
|
|
4851
|
-
return postRequest(payload, apiUrl);
|
|
4851
|
+
if (timeoutMs === void 0) return postRequest(payload, apiUrl);
|
|
4852
|
+
return pollTransactionPackets(payload, apiUrl, Date.now() + resolveTimeoutMs(timeoutMs, RELAY_REQUEST_TIMEOUT_MS));
|
|
4852
4853
|
}
|
|
4853
4854
|
async function getPacket(payload, apiUrl) {
|
|
4854
4855
|
invariant(payload.params.chain_id.length > 0, "Invalid input parameters. source_chain_id empty");
|
|
@@ -14395,7 +14396,7 @@ function mergeSodaxConfig(base2, override) {
|
|
|
14395
14396
|
}
|
|
14396
14397
|
function encodeContractCalls(calls) {
|
|
14397
14398
|
return viem.encodeAbiParameters(viem.parseAbiParameters("(address,uint256,bytes)[]"), [
|
|
14398
|
-
calls.map((
|
|
14399
|
+
calls.map((v10) => [v10.address, v10.value, v10.data])
|
|
14399
14400
|
]);
|
|
14400
14401
|
}
|
|
14401
14402
|
async function waitForTransactionReceipt(hash, provider) {
|
|
@@ -15808,12 +15809,12 @@ function encodeBtcPayloadToBytes(payload) {
|
|
|
15808
15809
|
});
|
|
15809
15810
|
}
|
|
15810
15811
|
function normalizePsbtToBase64(signedPsbt) {
|
|
15811
|
-
const
|
|
15812
|
-
return
|
|
15812
|
+
const isHex2 = /^[0-9a-fA-F]+$/.test(signedPsbt);
|
|
15813
|
+
return isHex2 ? Buffer.from(signedPsbt, "hex").toString("base64") : signedPsbt;
|
|
15813
15814
|
}
|
|
15814
15815
|
function normalizeSignatureToBase64(signature) {
|
|
15815
|
-
const
|
|
15816
|
-
return
|
|
15816
|
+
const isHex2 = /^[0-9a-fA-F]+$/.test(signature);
|
|
15817
|
+
return isHex2 ? Buffer.from(signature, "hex").toString("base64") : signature;
|
|
15817
15818
|
}
|
|
15818
15819
|
|
|
15819
15820
|
// src/shared/services/spoke/BitcoinSpokeService.ts
|
|
@@ -17087,22 +17088,22 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
17087
17088
|
const byte0 = Uint8Array.of(0);
|
|
17088
17089
|
const byte1 = Uint8Array.of(1);
|
|
17089
17090
|
const _maxDrbgIters = 1e3;
|
|
17090
|
-
let
|
|
17091
|
+
let v10 = u8n(hashLen);
|
|
17091
17092
|
let k = u8n(hashLen);
|
|
17092
17093
|
let i = 0;
|
|
17093
17094
|
const reset = () => {
|
|
17094
|
-
|
|
17095
|
+
v10.fill(1);
|
|
17095
17096
|
k.fill(0);
|
|
17096
17097
|
i = 0;
|
|
17097
17098
|
};
|
|
17098
|
-
const h = (...msgs) => hmacFn(k, concatBytes(
|
|
17099
|
+
const h = (...msgs) => hmacFn(k, concatBytes(v10, ...msgs));
|
|
17099
17100
|
const reseed = (seed = NULL) => {
|
|
17100
17101
|
k = h(byte0, seed);
|
|
17101
|
-
|
|
17102
|
+
v10 = h();
|
|
17102
17103
|
if (seed.length === 0)
|
|
17103
17104
|
return;
|
|
17104
17105
|
k = h(byte1, seed);
|
|
17105
|
-
|
|
17106
|
+
v10 = h();
|
|
17106
17107
|
};
|
|
17107
17108
|
const gen = () => {
|
|
17108
17109
|
if (i++ >= _maxDrbgIters)
|
|
@@ -17110,10 +17111,10 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
17110
17111
|
let len = 0;
|
|
17111
17112
|
const out = [];
|
|
17112
17113
|
while (len < qByteLen) {
|
|
17113
|
-
|
|
17114
|
-
const sl =
|
|
17114
|
+
v10 = h();
|
|
17115
|
+
const sl = v10.slice();
|
|
17115
17116
|
out.push(sl);
|
|
17116
|
-
len +=
|
|
17117
|
+
len += v10.length;
|
|
17117
17118
|
}
|
|
17118
17119
|
return concatBytes(...out);
|
|
17119
17120
|
};
|
|
@@ -17139,7 +17140,7 @@ function validateObject(object5, fields = {}, optFields = {}) {
|
|
|
17139
17140
|
if (current !== expectedType || val === null)
|
|
17140
17141
|
throw new Error(`param "${fieldName}" is invalid: expected ${expectedType}, got ${current}`);
|
|
17141
17142
|
}
|
|
17142
|
-
const iter = (f, isOpt) => Object.entries(f).forEach(([k,
|
|
17143
|
+
const iter = (f, isOpt) => Object.entries(f).forEach(([k, v10]) => checkField(k, v10, isOpt));
|
|
17143
17144
|
iter(fields, false);
|
|
17144
17145
|
iter(optFields, true);
|
|
17145
17146
|
}
|
|
@@ -17210,9 +17211,9 @@ function sqrt3mod4(Fp, n) {
|
|
|
17210
17211
|
function sqrt5mod8(Fp, n) {
|
|
17211
17212
|
const p5div8 = (Fp.ORDER - _5n) / _8n;
|
|
17212
17213
|
const n2 = Fp.mul(n, _2n);
|
|
17213
|
-
const
|
|
17214
|
-
const nv = Fp.mul(n,
|
|
17215
|
-
const i = Fp.mul(Fp.mul(nv, _2n),
|
|
17214
|
+
const v10 = Fp.pow(n2, p5div8);
|
|
17215
|
+
const nv = Fp.mul(n, v10);
|
|
17216
|
+
const i = Fp.mul(Fp.mul(nv, _2n), v10);
|
|
17216
17217
|
const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
|
|
17217
17218
|
assertIsSquare(Fp, root, n);
|
|
17218
17219
|
return root;
|
|
@@ -17794,9 +17795,9 @@ function edwards(params, extraOpts = {}) {
|
|
|
17794
17795
|
validateObject(extraOpts, {}, { uvRatio: "function" });
|
|
17795
17796
|
const MASK = _2n2 << BigInt(Fn.BYTES * 8) - _1n4;
|
|
17796
17797
|
const modP = (n) => Fp.create(n);
|
|
17797
|
-
const uvRatio2 = extraOpts.uvRatio || ((u,
|
|
17798
|
+
const uvRatio2 = extraOpts.uvRatio || ((u, v10) => {
|
|
17798
17799
|
try {
|
|
17799
|
-
return { isValid: true, value: Fp.sqrt(Fp.div(u,
|
|
17800
|
+
return { isValid: true, value: Fp.sqrt(Fp.div(u, v10)) };
|
|
17800
17801
|
} catch (e) {
|
|
17801
17802
|
return { isValid: false, value: _0n4 };
|
|
17802
17803
|
}
|
|
@@ -17892,8 +17893,8 @@ function edwards(params, extraOpts = {}) {
|
|
|
17892
17893
|
aInRange("point.y", y, _0n4, max);
|
|
17893
17894
|
const y2 = modP(y * y);
|
|
17894
17895
|
const u = modP(y2 - _1n4);
|
|
17895
|
-
const
|
|
17896
|
-
let { isValid, value: x } = uvRatio2(u,
|
|
17896
|
+
const v10 = modP(d * y2 - a);
|
|
17897
|
+
let { isValid, value: x } = uvRatio2(u, v10);
|
|
17897
17898
|
if (!isValid)
|
|
17898
17899
|
throw new Error("bad point: invalid y coordinate");
|
|
17899
17900
|
const isXOdd = (x & _1n4) === _1n4;
|
|
@@ -18233,13 +18234,13 @@ function adjustScalarBytes(bytes) {
|
|
|
18233
18234
|
return bytes;
|
|
18234
18235
|
}
|
|
18235
18236
|
var ED25519_SQRT_M1 = /* @__PURE__ */ BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");
|
|
18236
|
-
function uvRatio(u,
|
|
18237
|
+
function uvRatio(u, v10) {
|
|
18237
18238
|
const P = ed25519_CURVE_p;
|
|
18238
|
-
const v32 = mod(
|
|
18239
|
-
const v72 = mod(v32 * v32 *
|
|
18239
|
+
const v32 = mod(v10 * v10 * v10, P);
|
|
18240
|
+
const v72 = mod(v32 * v32 * v10, P);
|
|
18240
18241
|
const pow = ed25519_pow_2_252_3(u * v72).pow_p_5_8;
|
|
18241
18242
|
let x = mod(u * v32 * pow, P);
|
|
18242
|
-
const vx2 = mod(
|
|
18243
|
+
const vx2 = mod(v10 * x * x, P);
|
|
18243
18244
|
const root1 = x;
|
|
18244
18245
|
const root2 = mod(x * ED25519_SQRT_M1, P);
|
|
18245
18246
|
const useRoot1 = vx2 === u;
|
|
@@ -18570,7 +18571,7 @@ function findSeatPrice(validators, maxNumberOfSeats, minimumStakeRatio, protocol
|
|
|
18570
18571
|
return findSeatPriceForProtocolAfter49(validators, maxNumberOfSeats, minimumStakeRatio);
|
|
18571
18572
|
}
|
|
18572
18573
|
function findSeatPriceForProtocolBefore49(validators, numSeats) {
|
|
18573
|
-
const stakes = validators.map((
|
|
18574
|
+
const stakes = validators.map((v10) => BigInt(v10.stake)).sort(sortBigIntAsc);
|
|
18574
18575
|
const num = BigInt(numSeats);
|
|
18575
18576
|
const stakesSum = stakes.reduce((a, b) => a + b);
|
|
18576
18577
|
if (stakesSum < num) {
|
|
@@ -18599,7 +18600,7 @@ function findSeatPriceForProtocolAfter49(validators, maxNumberOfSeats, minimumSt
|
|
|
18599
18600
|
if (minimumStakeRatio.length != 2) {
|
|
18600
18601
|
throw Error("minimumStakeRatio should have 2 elements");
|
|
18601
18602
|
}
|
|
18602
|
-
const stakes = validators.map((
|
|
18603
|
+
const stakes = validators.map((v10) => BigInt(v10.stake)).sort(sortBigIntAsc);
|
|
18603
18604
|
const stakesSum = stakes.reduce((a, b) => a + b);
|
|
18604
18605
|
if (validators.length < maxNumberOfSeats) {
|
|
18605
18606
|
return stakesSum * BigInt(minimumStakeRatio[0]) / BigInt(minimumStakeRatio[1]);
|
|
@@ -18771,10 +18772,10 @@ var DER = {
|
|
|
18771
18772
|
if (length < 128)
|
|
18772
18773
|
throw new E("tlv.decode(long): not minimal encoding");
|
|
18773
18774
|
}
|
|
18774
|
-
const
|
|
18775
|
-
if (
|
|
18775
|
+
const v10 = data.subarray(pos, pos + length);
|
|
18776
|
+
if (v10.length !== length)
|
|
18776
18777
|
throw new E("tlv.decode: wrong value length");
|
|
18777
|
-
return { v:
|
|
18778
|
+
return { v: v10, l: data.subarray(pos + length) };
|
|
18778
18779
|
}
|
|
18779
18780
|
},
|
|
18780
18781
|
// https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
|
|
@@ -19521,14 +19522,14 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
19521
19522
|
return false;
|
|
19522
19523
|
const { r, s } = sig;
|
|
19523
19524
|
const h = bits2int_modN(message);
|
|
19524
|
-
const
|
|
19525
|
-
const u1 = Fn.create(h *
|
|
19526
|
-
const u2 = Fn.create(r *
|
|
19525
|
+
const is3 = Fn.inv(s);
|
|
19526
|
+
const u1 = Fn.create(h * is3);
|
|
19527
|
+
const u2 = Fn.create(r * is3);
|
|
19527
19528
|
const R = Point.BASE.multiplyUnsafe(u1).add(P.multiplyUnsafe(u2));
|
|
19528
19529
|
if (R.is0())
|
|
19529
19530
|
return false;
|
|
19530
|
-
const
|
|
19531
|
-
return
|
|
19531
|
+
const v10 = Fn.create(R.x);
|
|
19532
|
+
return v10 === r;
|
|
19532
19533
|
} catch (e) {
|
|
19533
19534
|
return false;
|
|
19534
19535
|
}
|
|
@@ -26923,19 +26924,32 @@ var SolverApiService = class {
|
|
|
26923
26924
|
*
|
|
26924
26925
|
* @param request - Object containing `intent_tx_hash` — the hub-chain tx hash of the intent.
|
|
26925
26926
|
* @param config - Solver endpoint configuration.
|
|
26927
|
+
* @param logger - Diagnostics sink; defaults to the silent logger.
|
|
26928
|
+
* @param timeoutMs - Optional budget for the request. Omit it and the call is unbounded, as it has
|
|
26929
|
+
* always been. Supply it when a stalled solver must not hold the caller open — a status read
|
|
26930
|
+
* polled on a short interval, say. An expiry surfaces as `UNKNOWN`, like any other failure.
|
|
26931
|
+
* A non-finite value (`NaN` out of `Number(process.env.X)`, or `Infinity`) is treated as no
|
|
26932
|
+
* budget at all rather than passed to `setTimeout`, which would coerce it to ~0 and fail every
|
|
26933
|
+
* request instantly. A non-positive one is a real budget of zero: the request aborts at once.
|
|
26934
|
+
* The relay's `getTransactionPackets` takes the same parameter but degrades a non-finite value
|
|
26935
|
+
* to its own per-request budget instead; the divergence is deliberate, and explained inline.
|
|
26926
26936
|
* @returns A `Result` containing `{ status: SolverIntentStatusCode, fill_tx_hash?: string }`.
|
|
26927
26937
|
* `fill_tx_hash` is set only when `status === SolverIntentStatusCode.SOLVED (3)`.
|
|
26928
26938
|
* @throws Invariant error if `intent_tx_hash` is empty (thrown before the async request).
|
|
26929
26939
|
*/
|
|
26930
|
-
static async getStatus(request, config, logger = silentLogger) {
|
|
26940
|
+
static async getStatus(request, config, logger = silentLogger, timeoutMs) {
|
|
26931
26941
|
invariant(request.intent_tx_hash.length > 0, "Empty intent_tx_hash");
|
|
26942
|
+
const budgetMs = timeoutMs !== void 0 && Number.isFinite(timeoutMs) ? Math.max(0, timeoutMs) : void 0;
|
|
26943
|
+
const controller = budgetMs === void 0 ? void 0 : new AbortController();
|
|
26944
|
+
const timeoutId = controller ? setTimeout(() => controller.abort(), budgetMs) : void 0;
|
|
26932
26945
|
try {
|
|
26933
26946
|
const response = await fetch(`${config.solverApiEndpoint}/status`, {
|
|
26934
26947
|
method: "POST",
|
|
26935
26948
|
headers: {
|
|
26936
26949
|
"Content-Type": "application/json"
|
|
26937
26950
|
},
|
|
26938
|
-
body: JSON.stringify(request)
|
|
26951
|
+
body: JSON.stringify(request),
|
|
26952
|
+
signal: controller?.signal
|
|
26939
26953
|
});
|
|
26940
26954
|
if (!response.ok) {
|
|
26941
26955
|
return {
|
|
@@ -26957,10 +26971,12 @@ var SolverApiService = class {
|
|
|
26957
26971
|
error: {
|
|
26958
26972
|
detail: {
|
|
26959
26973
|
code: exports.SolverIntentErrorCode.UNKNOWN,
|
|
26960
|
-
message: e ? JSON.stringify(e, bigintReplacer) : "Unknown error"
|
|
26974
|
+
message: controller?.signal.aborted ? `solver /status timed out after ${budgetMs}ms` : e ? JSON.stringify(e, bigintReplacer) : "Unknown error"
|
|
26961
26975
|
}
|
|
26962
26976
|
}
|
|
26963
26977
|
};
|
|
26978
|
+
} finally {
|
|
26979
|
+
clearTimeout(timeoutId);
|
|
26964
26980
|
}
|
|
26965
26981
|
}
|
|
26966
26982
|
};
|
|
@@ -27054,6 +27070,152 @@ async function runBackendSubmitTx({
|
|
|
27054
27070
|
});
|
|
27055
27071
|
return polled.ok ? { ok: true, value: polled.value } : { ok: false, cause: polled.cause };
|
|
27056
27072
|
}
|
|
27073
|
+
var ChainKeySchema = v__namespace.custom((input) => typeof input === "string");
|
|
27074
|
+
var SpokeChainKeySchema = v__namespace.custom((input) => typeof input === "string");
|
|
27075
|
+
var AddressSchema = v__namespace.custom((input) => typeof input === "string");
|
|
27076
|
+
var XTokenSchema = v__namespace.object({
|
|
27077
|
+
symbol: v__namespace.string(),
|
|
27078
|
+
name: v__namespace.string(),
|
|
27079
|
+
decimals: v__namespace.number(),
|
|
27080
|
+
address: v__namespace.string(),
|
|
27081
|
+
chainKey: ChainKeySchema,
|
|
27082
|
+
hubAsset: AddressSchema,
|
|
27083
|
+
vault: AddressSchema,
|
|
27084
|
+
access: v__namespace.optional(v__namespace.picklist(["withdrawOnly", "depositOnly"]))
|
|
27085
|
+
});
|
|
27086
|
+
var IntentStructSchema = v__namespace.object({
|
|
27087
|
+
intentId: v__namespace.string(),
|
|
27088
|
+
creator: v__namespace.string(),
|
|
27089
|
+
inputToken: v__namespace.string(),
|
|
27090
|
+
outputToken: v__namespace.string(),
|
|
27091
|
+
inputAmount: v__namespace.string(),
|
|
27092
|
+
minOutputAmount: v__namespace.string(),
|
|
27093
|
+
deadline: v__namespace.string(),
|
|
27094
|
+
allowPartialFill: v__namespace.boolean(),
|
|
27095
|
+
srcChain: v__namespace.number(),
|
|
27096
|
+
dstChain: v__namespace.number(),
|
|
27097
|
+
srcAddress: v__namespace.string(),
|
|
27098
|
+
dstAddress: v__namespace.string(),
|
|
27099
|
+
solver: v__namespace.string(),
|
|
27100
|
+
data: v__namespace.string()
|
|
27101
|
+
});
|
|
27102
|
+
var FillEventSchema = v__namespace.object({
|
|
27103
|
+
eventType: v__namespace.literal("intent-filled"),
|
|
27104
|
+
// The hub-chain fill tx; an empty one is no use as `fill_tx_hash`.
|
|
27105
|
+
txHash: v__namespace.pipe(v__namespace.string(), v__namespace.nonEmpty()),
|
|
27106
|
+
// Terminality. An intent created with `allowPartialFill` emits a fill event per fill, so the
|
|
27107
|
+
// event alone does not mean the intent is done — only `remainingInput === '0'` does. Required:
|
|
27108
|
+
// without it there is no proof of completion, and claiming SOLVED on a partial fill would report
|
|
27109
|
+
// an unfinished swap as complete.
|
|
27110
|
+
intentState: v__namespace.object({
|
|
27111
|
+
remainingInput: v__namespace.string()
|
|
27112
|
+
})
|
|
27113
|
+
});
|
|
27114
|
+
var IntentResponseSchema = v__namespace.object({
|
|
27115
|
+
intentHash: v__namespace.string(),
|
|
27116
|
+
txHash: v__namespace.string(),
|
|
27117
|
+
logIndex: v__namespace.number(),
|
|
27118
|
+
chainId: v__namespace.number(),
|
|
27119
|
+
blockNumber: v__namespace.number(),
|
|
27120
|
+
open: v__namespace.boolean(),
|
|
27121
|
+
intent: IntentStructSchema,
|
|
27122
|
+
events: v__namespace.array(v__namespace.unknown())
|
|
27123
|
+
});
|
|
27124
|
+
var UserIntentsResponseSchema = v__namespace.object({
|
|
27125
|
+
total: v__namespace.number(),
|
|
27126
|
+
offset: v__namespace.number(),
|
|
27127
|
+
limit: v__namespace.number(),
|
|
27128
|
+
items: v__namespace.array(IntentResponseSchema)
|
|
27129
|
+
});
|
|
27130
|
+
var OrderbookResponseSchema = v__namespace.object({
|
|
27131
|
+
total: v__namespace.number(),
|
|
27132
|
+
data: v__namespace.array(
|
|
27133
|
+
v__namespace.object({
|
|
27134
|
+
intentState: v__namespace.object({
|
|
27135
|
+
exists: v__namespace.boolean(),
|
|
27136
|
+
remainingInput: v__namespace.string(),
|
|
27137
|
+
receivedOutput: v__namespace.string(),
|
|
27138
|
+
pendingPayment: v__namespace.boolean()
|
|
27139
|
+
}),
|
|
27140
|
+
intentData: v__namespace.object({
|
|
27141
|
+
intentId: v__namespace.string(),
|
|
27142
|
+
creator: v__namespace.string(),
|
|
27143
|
+
inputToken: v__namespace.string(),
|
|
27144
|
+
outputToken: v__namespace.string(),
|
|
27145
|
+
inputAmount: v__namespace.string(),
|
|
27146
|
+
minOutputAmount: v__namespace.string(),
|
|
27147
|
+
deadline: v__namespace.string(),
|
|
27148
|
+
allowPartialFill: v__namespace.boolean(),
|
|
27149
|
+
srcChain: v__namespace.number(),
|
|
27150
|
+
dstChain: v__namespace.number(),
|
|
27151
|
+
srcAddress: v__namespace.string(),
|
|
27152
|
+
dstAddress: v__namespace.string(),
|
|
27153
|
+
solver: v__namespace.string(),
|
|
27154
|
+
data: v__namespace.string(),
|
|
27155
|
+
intentHash: v__namespace.string(),
|
|
27156
|
+
txHash: v__namespace.string(),
|
|
27157
|
+
blockNumber: v__namespace.number()
|
|
27158
|
+
})
|
|
27159
|
+
})
|
|
27160
|
+
)
|
|
27161
|
+
});
|
|
27162
|
+
var MoneyMarketPositionSchema = v__namespace.object({
|
|
27163
|
+
userAddress: v__namespace.string(),
|
|
27164
|
+
positions: v__namespace.array(
|
|
27165
|
+
v__namespace.object({
|
|
27166
|
+
reserveAddress: v__namespace.string(),
|
|
27167
|
+
aTokenAddress: v__namespace.string(),
|
|
27168
|
+
variableDebtTokenAddress: v__namespace.string(),
|
|
27169
|
+
aTokenBalance: v__namespace.string(),
|
|
27170
|
+
variableDebtTokenBalance: v__namespace.string(),
|
|
27171
|
+
blockNumber: v__namespace.number()
|
|
27172
|
+
})
|
|
27173
|
+
)
|
|
27174
|
+
});
|
|
27175
|
+
var MoneyMarketAssetSchema = v__namespace.object({
|
|
27176
|
+
reserveAddress: v__namespace.string(),
|
|
27177
|
+
aTokenAddress: v__namespace.string(),
|
|
27178
|
+
totalATokenBalance: v__namespace.string(),
|
|
27179
|
+
variableDebtTokenAddress: v__namespace.string(),
|
|
27180
|
+
totalVariableDebtTokenBalance: v__namespace.string(),
|
|
27181
|
+
liquidityRate: v__namespace.string(),
|
|
27182
|
+
symbol: v__namespace.string(),
|
|
27183
|
+
totalSuppliers: v__namespace.number(),
|
|
27184
|
+
totalBorrowers: v__namespace.number(),
|
|
27185
|
+
variableBorrowRate: v__namespace.string(),
|
|
27186
|
+
stableBorrowRate: v__namespace.string(),
|
|
27187
|
+
liquidityIndex: v__namespace.string(),
|
|
27188
|
+
variableBorrowIndex: v__namespace.string(),
|
|
27189
|
+
blockNumber: v__namespace.number()
|
|
27190
|
+
});
|
|
27191
|
+
var MoneyMarketAssetsSchema = v__namespace.array(MoneyMarketAssetSchema);
|
|
27192
|
+
var MoneyMarketAssetBorrowersSchema = v__namespace.object({
|
|
27193
|
+
borrowers: v__namespace.array(v__namespace.string()),
|
|
27194
|
+
total: v__namespace.number(),
|
|
27195
|
+
offset: v__namespace.number(),
|
|
27196
|
+
limit: v__namespace.number()
|
|
27197
|
+
});
|
|
27198
|
+
var MoneyMarketAssetSuppliersSchema = v__namespace.object({
|
|
27199
|
+
suppliers: v__namespace.array(v__namespace.string()),
|
|
27200
|
+
total: v__namespace.number(),
|
|
27201
|
+
offset: v__namespace.number(),
|
|
27202
|
+
limit: v__namespace.number()
|
|
27203
|
+
});
|
|
27204
|
+
var MoneyMarketBorrowersSchema = v__namespace.object({
|
|
27205
|
+
borrowers: v__namespace.array(v__namespace.string()),
|
|
27206
|
+
total: v__namespace.number(),
|
|
27207
|
+
offset: v__namespace.number(),
|
|
27208
|
+
limit: v__namespace.number()
|
|
27209
|
+
});
|
|
27210
|
+
var GetChainsResponseSchema = v__namespace.array(SpokeChainKeySchema);
|
|
27211
|
+
var TokensByChainMapSchema = v__namespace.custom(
|
|
27212
|
+
(input) => typeof input === "object" && input !== null && Object.values(input).every((tokens) => Array.isArray(tokens) && tokens.every((t) => v__namespace.is(XTokenSchema, t)))
|
|
27213
|
+
);
|
|
27214
|
+
var TokensListSchema = v__namespace.array(XTokenSchema);
|
|
27215
|
+
var ReserveAssetsSchema = v__namespace.array(AddressSchema);
|
|
27216
|
+
|
|
27217
|
+
// src/backendApi/guards.ts
|
|
27218
|
+
var isFillEvent = (value) => v__namespace.is(FillEventSchema, value);
|
|
27057
27219
|
function decodePacketIntentTarget(payload) {
|
|
27058
27220
|
try {
|
|
27059
27221
|
const hex = payload.startsWith("0x") ? payload.slice(2) : payload;
|
|
@@ -27073,6 +27235,12 @@ function selectSolvedIntentPacket(packets, intentsContract) {
|
|
|
27073
27235
|
return packets.reduce((highest, packet) => packet.conn_sn > highest.conn_sn ? packet : highest);
|
|
27074
27236
|
}
|
|
27075
27237
|
|
|
27238
|
+
// src/swap/detailedStatus.ts
|
|
27239
|
+
var DETAILED_STATUS_NOT_DELIVERED = "relay_not_delivered";
|
|
27240
|
+
function isBackendSubmitTxAbandoned(data) {
|
|
27241
|
+
return data.status === "failed" || Boolean(data.abandonedAt);
|
|
27242
|
+
}
|
|
27243
|
+
|
|
27076
27244
|
// src/swap/errors.ts
|
|
27077
27245
|
var swapInvariant = createInvariant("swap");
|
|
27078
27246
|
var POST_EXECUTION_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
@@ -27097,6 +27265,8 @@ var isPostExecutionError = isCodeMember(POST_EXECUTION_ERROR_CODES);
|
|
|
27097
27265
|
var isSwapError = isCodeMember(SWAP_ERROR_CODES);
|
|
27098
27266
|
|
|
27099
27267
|
// src/swap/SwapService.ts
|
|
27268
|
+
var RECONCILE_TIMEOUT_MS = 5e3;
|
|
27269
|
+
var DETAILED_STATUS_SOLVER_TIMEOUT_MS = 5e3;
|
|
27100
27270
|
var SwapService = class {
|
|
27101
27271
|
// dependent services
|
|
27102
27272
|
hubProvider;
|
|
@@ -27197,7 +27367,8 @@ var SwapService = class {
|
|
|
27197
27367
|
return calculatePercentageFeeAmount(inputAmount, 10);
|
|
27198
27368
|
}
|
|
27199
27369
|
/**
|
|
27200
|
-
* Polls the solver API for the current execution status of an intent.
|
|
27370
|
+
* Polls the solver API for the current execution status of an intent. A `NOT_FOUND` or a failed
|
|
27371
|
+
* request is cross-checked against the backend's durable intent record.
|
|
27201
27372
|
*
|
|
27202
27373
|
* The `intent_tx_hash` in the request must be the hub-chain (Sonic) transaction hash where
|
|
27203
27374
|
* the intent was registered — this is the `dst_tx_hash` from the relay packet returned by
|
|
@@ -27208,7 +27379,145 @@ var SwapService = class {
|
|
|
27208
27379
|
* `fill_tx_hash` is populated only when `status === SolverIntentStatusCode.SOLVED (3)`.
|
|
27209
27380
|
*/
|
|
27210
27381
|
async getStatus(request) {
|
|
27211
|
-
return
|
|
27382
|
+
return this.resolveSolverStatus(request);
|
|
27383
|
+
}
|
|
27384
|
+
/**
|
|
27385
|
+
* {@link SwapService.getStatus} with an optional budget for the solver leg. Public `getStatus` is a
|
|
27386
|
+
* one-shot read a caller bounds however it likes, so it stays unbounded; `getDetailedStatus` is
|
|
27387
|
+
* polled and passes {@link DETAILED_STATUS_SOLVER_TIMEOUT_MS}. Both go through here so the
|
|
27388
|
+
* durable-intent reconcile below is written once.
|
|
27389
|
+
*
|
|
27390
|
+
* `timeoutMs` bounds the solver request alone. The reconcile that a failed or NOT_FOUND solver read
|
|
27391
|
+
* falls through to carries its own {@link RECONCILE_TIMEOUT_MS}, so a bounded call can cost both.
|
|
27392
|
+
*/
|
|
27393
|
+
async resolveSolverStatus(request, timeoutMs) {
|
|
27394
|
+
const solverResult = await SolverApiService.getStatus(request, this.solver, this.config.logger, timeoutMs);
|
|
27395
|
+
const forgotten = !solverResult.ok || solverResult.value.status === exports.SolverIntentStatusCode.NOT_FOUND;
|
|
27396
|
+
if (!forgotten) return solverResult;
|
|
27397
|
+
const timeout = Math.min(RECONCILE_TIMEOUT_MS, this.backendApi.requestTimeoutMs);
|
|
27398
|
+
const intent = await this.backendApi.getIntentByTxHash(request.intent_tx_hash, { timeout });
|
|
27399
|
+
const settled = intent.ok ? intent.value.events.filter(isFillEvent).find((fill) => fill.intentState.remainingInput === "0") : void 0;
|
|
27400
|
+
if (settled) return { ok: true, value: { status: exports.SolverIntentStatusCode.SOLVED, fill_tx_hash: settled.txHash } };
|
|
27401
|
+
const backendAnswered = intent.ok || isSodaxError(intent.error) && intent.error.context?.status === 404;
|
|
27402
|
+
if (solverResult.ok && !backendAnswered) {
|
|
27403
|
+
return {
|
|
27404
|
+
ok: false,
|
|
27405
|
+
error: {
|
|
27406
|
+
detail: {
|
|
27407
|
+
code: exports.SolverIntentErrorCode.UNKNOWN,
|
|
27408
|
+
message: "solver reported NOT_FOUND and the durable intent record could not be read to verify it"
|
|
27409
|
+
}
|
|
27410
|
+
}
|
|
27411
|
+
};
|
|
27412
|
+
}
|
|
27413
|
+
return solverResult;
|
|
27414
|
+
}
|
|
27415
|
+
/**
|
|
27416
|
+
* Reads a swap's status from its source-chain transaction — the identifier a caller always holds.
|
|
27417
|
+
*
|
|
27418
|
+
* **Routes; does not translate.** Returns the backend submit-tx record while it is in play,
|
|
27419
|
+
* otherwise the solver's answer via the hub tx hash resolved from the relay packet. The result is
|
|
27420
|
+
* tagged with `source` (discriminate on it) and carries that source's payload unmodified.
|
|
27421
|
+
*
|
|
27422
|
+
* **Any** unusable backend response routes to the solver — a 404, a transport or server error, or
|
|
27423
|
+
* a record the backend gave up on. See `docs/SWAPS.md` § Get Detailed Status for why.
|
|
27424
|
+
*
|
|
27425
|
+
* A point-in-time read; poll it yourself, or use dapp-kit's `useDetailedStatus`.
|
|
27426
|
+
*
|
|
27427
|
+
* @param params - `srcChainKey` and `srcTxHash` of the source-chain swap transaction.
|
|
27428
|
+
* @returns A `Result` containing a {@link DetailedSwapStatus}. Fails with `LOOKUP_FAILED` when no
|
|
27429
|
+
* source can answer yet — usually the relay has not delivered the packet, so there is no hub tx
|
|
27430
|
+
* hash for the solver to be asked about.
|
|
27431
|
+
*/
|
|
27432
|
+
async getDetailedStatus(params) {
|
|
27433
|
+
try {
|
|
27434
|
+
const record3 = await this.backendApi.swaps.getSubmitTxStatus({
|
|
27435
|
+
txHash: params.srcTxHash,
|
|
27436
|
+
srcChainKey: params.srcChainKey
|
|
27437
|
+
});
|
|
27438
|
+
if (record3.ok && record3.value.success && !isBackendSubmitTxAbandoned(record3.value.data)) {
|
|
27439
|
+
return { ok: true, value: { source: "backend", data: record3.value.data } };
|
|
27440
|
+
}
|
|
27441
|
+
const backendAnswered = record3.ok || isSodaxError(record3.error) && record3.error.context?.status === 404;
|
|
27442
|
+
const dstTxHash = await this.resolveHubTxHash(params, backendAnswered);
|
|
27443
|
+
if (!dstTxHash.ok) return dstTxHash;
|
|
27444
|
+
const solver = await this.resolveSolverStatus(
|
|
27445
|
+
{ intent_tx_hash: dstTxHash.value },
|
|
27446
|
+
DETAILED_STATUS_SOLVER_TIMEOUT_MS
|
|
27447
|
+
);
|
|
27448
|
+
if (!solver.ok) {
|
|
27449
|
+
return { ok: false, error: this.detailedStatusLookupFailed(solver.error, params.srcChainKey) };
|
|
27450
|
+
}
|
|
27451
|
+
return { ok: true, value: { source: "solver", dstTxHash: dstTxHash.value, data: solver.value } };
|
|
27452
|
+
} catch (error) {
|
|
27453
|
+
return { ok: false, error: this.detailedStatusLookupFailed(error, params.srcChainKey) };
|
|
27454
|
+
}
|
|
27455
|
+
}
|
|
27456
|
+
/**
|
|
27457
|
+
* The hub-chain tx hash the solver is keyed on. A hub-source swap has no relay leg — the source
|
|
27458
|
+
* tx *is* the hub tx. Otherwise the delivered relay packet carries it, so an undelivered packet
|
|
27459
|
+
* is simply "no hash yet".
|
|
27460
|
+
*/
|
|
27461
|
+
async resolveHubTxHash(key, backendAnswered) {
|
|
27462
|
+
const missReason = backendAnswered ? DETAILED_STATUS_NOT_DELIVERED : void 0;
|
|
27463
|
+
let hubTxHash = key.srcTxHash;
|
|
27464
|
+
if (!isHubChainKeyType(key.srcChainKey)) {
|
|
27465
|
+
const relayChainId = getIntentRelayChainId(key.srcChainKey);
|
|
27466
|
+
const packets = await getTransactionPackets(
|
|
27467
|
+
{
|
|
27468
|
+
action: "get_transaction_packets",
|
|
27469
|
+
params: { chain_id: relayChainId.toString(), tx_hash: key.srcTxHash }
|
|
27470
|
+
},
|
|
27471
|
+
this.relayerApiEndpoint,
|
|
27472
|
+
RELAY_REQUEST_TIMEOUT_MS
|
|
27473
|
+
);
|
|
27474
|
+
if (!packets.ok) {
|
|
27475
|
+
const notIndexed = packets.error instanceof HttpRelayError && packets.error.status === 404;
|
|
27476
|
+
return {
|
|
27477
|
+
ok: false,
|
|
27478
|
+
error: this.detailedStatusLookupFailed(packets.error, key.srcChainKey, notIndexed ? missReason : void 0)
|
|
27479
|
+
};
|
|
27480
|
+
}
|
|
27481
|
+
if (!packets.value?.success || !Array.isArray(packets.value.data)) {
|
|
27482
|
+
return {
|
|
27483
|
+
ok: false,
|
|
27484
|
+
error: this.detailedStatusLookupFailed(
|
|
27485
|
+
new Error("relay returned no usable transaction packets"),
|
|
27486
|
+
key.srcChainKey
|
|
27487
|
+
)
|
|
27488
|
+
};
|
|
27489
|
+
}
|
|
27490
|
+
const delivered = packets.value.data.find(
|
|
27491
|
+
(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
|
|
27492
|
+
);
|
|
27493
|
+
if (!delivered) {
|
|
27494
|
+
return {
|
|
27495
|
+
ok: false,
|
|
27496
|
+
error: this.detailedStatusLookupFailed(
|
|
27497
|
+
new Error("relay has not delivered the intent to the hub yet"),
|
|
27498
|
+
key.srcChainKey,
|
|
27499
|
+
missReason
|
|
27500
|
+
)
|
|
27501
|
+
};
|
|
27502
|
+
}
|
|
27503
|
+
hubTxHash = delivered.dst_tx_hash;
|
|
27504
|
+
}
|
|
27505
|
+
if (viem.isHex(hubTxHash)) return { ok: true, value: hubTxHash };
|
|
27506
|
+
return {
|
|
27507
|
+
ok: false,
|
|
27508
|
+
error: this.detailedStatusLookupFailed(
|
|
27509
|
+
new Error(`hub tx hash is not a hex string: ${hubTxHash}`),
|
|
27510
|
+
key.srcChainKey
|
|
27511
|
+
)
|
|
27512
|
+
};
|
|
27513
|
+
}
|
|
27514
|
+
/**
|
|
27515
|
+
* `reason` is set only for {@link DETAILED_STATUS_NOT_DELIVERED} — the miss a caller can bound
|
|
27516
|
+
* with a retry budget. Leaving it off marks a dependency that is failing right now, which a
|
|
27517
|
+
* caller should keep retrying rather than give up on.
|
|
27518
|
+
*/
|
|
27519
|
+
detailedStatusLookupFailed(cause, srcChainKey, reason) {
|
|
27520
|
+
return lookupFailed("swap", "getDetailedStatus", cause, { srcChainKey, action: "swap", reason });
|
|
27212
27521
|
}
|
|
27213
27522
|
/**
|
|
27214
27523
|
* Notifies the solver API that an intent has been registered on the hub chain, triggering
|
|
@@ -30523,7 +30832,7 @@ var SwapsApiService = class _SwapsApiService {
|
|
|
30523
30832
|
if (error.code === "VALIDATION_ERROR" && error.context.issues !== void 0) {
|
|
30524
30833
|
context.reason = "invalid_response_shape";
|
|
30525
30834
|
const issues = error.context.issues;
|
|
30526
|
-
context.issues = issues instanceof
|
|
30835
|
+
context.issues = issues instanceof v__namespace.ValiError ? v__namespace.flatten(issues.issues) : issues;
|
|
30527
30836
|
}
|
|
30528
30837
|
if (error.context.status !== void 0) context.status = error.context.status;
|
|
30529
30838
|
}
|
|
@@ -30698,21 +31007,21 @@ var SwapsApiService = class _SwapsApiService {
|
|
|
30698
31007
|
return this.config.timeout ?? DEFAULT_BACKEND_API_TIMEOUT;
|
|
30699
31008
|
}
|
|
30700
31009
|
};
|
|
30701
|
-
var StellarSponsorConfigSchema =
|
|
30702
|
-
sponsorAccount:
|
|
30703
|
-
networkPassphrase:
|
|
30704
|
-
minTotalFeeStroops:
|
|
30705
|
-
maxTotalFeeStroops:
|
|
30706
|
-
operationCount:
|
|
30707
|
-
minPerOperationFeeStroops:
|
|
30708
|
-
maxPerOperationFeeStroops:
|
|
30709
|
-
recommendedPerOperationFeeStroops:
|
|
30710
|
-
maxTimeboundSeconds:
|
|
30711
|
-
requiredStartingBalance:
|
|
31010
|
+
var StellarSponsorConfigSchema = v__namespace.object({
|
|
31011
|
+
sponsorAccount: v__namespace.string(),
|
|
31012
|
+
networkPassphrase: v__namespace.string(),
|
|
31013
|
+
minTotalFeeStroops: v__namespace.string(),
|
|
31014
|
+
maxTotalFeeStroops: v__namespace.string(),
|
|
31015
|
+
operationCount: v__namespace.number(),
|
|
31016
|
+
minPerOperationFeeStroops: v__namespace.string(),
|
|
31017
|
+
maxPerOperationFeeStroops: v__namespace.string(),
|
|
31018
|
+
recommendedPerOperationFeeStroops: v__namespace.string(),
|
|
31019
|
+
maxTimeboundSeconds: v__namespace.number(),
|
|
31020
|
+
requiredStartingBalance: v__namespace.string()
|
|
30712
31021
|
});
|
|
30713
|
-
var StellarSponsoredAccountResponseSchema =
|
|
30714
|
-
|
|
30715
|
-
|
|
31022
|
+
var StellarSponsoredAccountResponseSchema = v__namespace.variant("alreadyActive", [
|
|
31023
|
+
v__namespace.object({ hash: v__namespace.string(), alreadyActive: v__namespace.literal(false) }),
|
|
31024
|
+
v__namespace.object({ hash: v__namespace.null(), alreadyActive: v__namespace.literal(true) })
|
|
30716
31025
|
]);
|
|
30717
31026
|
|
|
30718
31027
|
// src/backendApi/SponsoringApiService.ts
|
|
@@ -30740,7 +31049,7 @@ var SponsoringApiService = class {
|
|
|
30740
31049
|
logger: this.logger,
|
|
30741
31050
|
serviceLabel: "SponsoringApiService"
|
|
30742
31051
|
});
|
|
30743
|
-
const parsed =
|
|
31052
|
+
const parsed = v__namespace.safeParse(schema, raw);
|
|
30744
31053
|
if (!parsed.success) {
|
|
30745
31054
|
return {
|
|
30746
31055
|
ok: false,
|
|
@@ -30748,7 +31057,7 @@ var SponsoringApiService = class {
|
|
|
30748
31057
|
api: "sponsoring",
|
|
30749
31058
|
feature: "backend",
|
|
30750
31059
|
endpoint,
|
|
30751
|
-
issues:
|
|
31060
|
+
issues: v__namespace.flatten(parsed.issues)
|
|
30752
31061
|
})
|
|
30753
31062
|
};
|
|
30754
31063
|
}
|
|
@@ -30786,141 +31095,141 @@ var SponsoringApiService = class {
|
|
|
30786
31095
|
return this.config.baseURL;
|
|
30787
31096
|
}
|
|
30788
31097
|
};
|
|
30789
|
-
var RelayExtraDataResponseSchema =
|
|
30790
|
-
address:
|
|
30791
|
-
payload:
|
|
31098
|
+
var RelayExtraDataResponseSchema = v__namespace.object({
|
|
31099
|
+
address: v__namespace.string(),
|
|
31100
|
+
payload: v__namespace.string()
|
|
30792
31101
|
});
|
|
30793
|
-
var BridgeTokenSchema =
|
|
30794
|
-
symbol:
|
|
30795
|
-
name:
|
|
30796
|
-
decimals:
|
|
30797
|
-
address:
|
|
30798
|
-
chainKey:
|
|
30799
|
-
hubAsset:
|
|
30800
|
-
vault:
|
|
31102
|
+
var BridgeTokenSchema = v__namespace.object({
|
|
31103
|
+
symbol: v__namespace.string(),
|
|
31104
|
+
name: v__namespace.string(),
|
|
31105
|
+
decimals: v__namespace.number(),
|
|
31106
|
+
address: v__namespace.string(),
|
|
31107
|
+
chainKey: v__namespace.string(),
|
|
31108
|
+
hubAsset: v__namespace.string(),
|
|
31109
|
+
vault: v__namespace.string()
|
|
30801
31110
|
});
|
|
30802
|
-
var BridgeTokensResponseSchema =
|
|
30803
|
-
var BridgeTokensByChainResponseSchema =
|
|
30804
|
-
var BridgeAllowanceCheckResponseSchema =
|
|
30805
|
-
valid:
|
|
31111
|
+
var BridgeTokensResponseSchema = v__namespace.record(v__namespace.string(), v__namespace.array(BridgeTokenSchema));
|
|
31112
|
+
var BridgeTokensByChainResponseSchema = v__namespace.array(BridgeTokenSchema);
|
|
31113
|
+
var BridgeAllowanceCheckResponseSchema = v__namespace.object({
|
|
31114
|
+
valid: v__namespace.boolean()
|
|
30806
31115
|
});
|
|
30807
|
-
var makeBridgeApproveResponseSchema = (txSchema) =>
|
|
30808
|
-
var makeCreateBridgeIntentResponseSchema = (txSchema) =>
|
|
31116
|
+
var makeBridgeApproveResponseSchema = (txSchema) => v__namespace.object({ tx: txSchema });
|
|
31117
|
+
var makeCreateBridgeIntentResponseSchema = (txSchema) => v__namespace.object({
|
|
30809
31118
|
tx: txSchema,
|
|
30810
31119
|
relayData: RelayExtraDataResponseSchema
|
|
30811
31120
|
});
|
|
30812
|
-
var BridgeSubmitTxResponseSchema =
|
|
30813
|
-
success:
|
|
30814
|
-
data:
|
|
30815
|
-
status:
|
|
30816
|
-
message:
|
|
31121
|
+
var BridgeSubmitTxResponseSchema = v__namespace.object({
|
|
31122
|
+
success: v__namespace.boolean(),
|
|
31123
|
+
data: v__namespace.object({
|
|
31124
|
+
status: v__namespace.picklist(["inserted", "duplicate"]),
|
|
31125
|
+
message: v__namespace.string()
|
|
30817
31126
|
})
|
|
30818
31127
|
});
|
|
30819
|
-
var BridgePacketDataSchema =
|
|
30820
|
-
src_chain_id:
|
|
30821
|
-
src_tx_hash:
|
|
30822
|
-
src_address:
|
|
30823
|
-
status:
|
|
30824
|
-
dst_chain_id:
|
|
30825
|
-
conn_sn:
|
|
30826
|
-
dst_address:
|
|
30827
|
-
dst_tx_hash:
|
|
30828
|
-
signatures:
|
|
30829
|
-
payload:
|
|
31128
|
+
var BridgePacketDataSchema = v__namespace.object({
|
|
31129
|
+
src_chain_id: v__namespace.number(),
|
|
31130
|
+
src_tx_hash: v__namespace.string(),
|
|
31131
|
+
src_address: v__namespace.string(),
|
|
31132
|
+
status: v__namespace.picklist(["pending", "validating", "executing", "executed"]),
|
|
31133
|
+
dst_chain_id: v__namespace.number(),
|
|
31134
|
+
conn_sn: v__namespace.number(),
|
|
31135
|
+
dst_address: v__namespace.string(),
|
|
31136
|
+
dst_tx_hash: v__namespace.string(),
|
|
31137
|
+
signatures: v__namespace.array(v__namespace.string()),
|
|
31138
|
+
payload: v__namespace.string()
|
|
30830
31139
|
});
|
|
30831
|
-
var BridgeSubmitTxStatusResultSchema =
|
|
30832
|
-
dstIntentTxHash:
|
|
30833
|
-
packetData:
|
|
31140
|
+
var BridgeSubmitTxStatusResultSchema = v__namespace.object({
|
|
31141
|
+
dstIntentTxHash: v__namespace.string(),
|
|
31142
|
+
packetData: v__namespace.optional(BridgePacketDataSchema)
|
|
30834
31143
|
});
|
|
30835
|
-
var BridgeSubmitTxStatusDataSchema =
|
|
30836
|
-
txHash:
|
|
30837
|
-
srcChainKey:
|
|
30838
|
-
status:
|
|
30839
|
-
failedAtStep:
|
|
30840
|
-
failureReason:
|
|
30841
|
-
processingAttempts:
|
|
30842
|
-
abandonedAt:
|
|
30843
|
-
result:
|
|
30844
|
-
userMessage:
|
|
31144
|
+
var BridgeSubmitTxStatusDataSchema = v__namespace.object({
|
|
31145
|
+
txHash: v__namespace.string(),
|
|
31146
|
+
srcChainKey: v__namespace.string(),
|
|
31147
|
+
status: v__namespace.string(),
|
|
31148
|
+
failedAtStep: v__namespace.optional(v__namespace.string()),
|
|
31149
|
+
failureReason: v__namespace.optional(v__namespace.string()),
|
|
31150
|
+
processingAttempts: v__namespace.number(),
|
|
31151
|
+
abandonedAt: v__namespace.optional(v__namespace.string()),
|
|
31152
|
+
result: v__namespace.optional(BridgeSubmitTxStatusResultSchema),
|
|
31153
|
+
userMessage: v__namespace.optional(v__namespace.string())
|
|
30845
31154
|
});
|
|
30846
|
-
var BridgeSubmitTxStatusResponseSchema =
|
|
30847
|
-
success:
|
|
31155
|
+
var BridgeSubmitTxStatusResponseSchema = v__namespace.object({
|
|
31156
|
+
success: v__namespace.boolean(),
|
|
30848
31157
|
data: BridgeSubmitTxStatusDataSchema
|
|
30849
31158
|
});
|
|
30850
|
-
var BridgeFeeResponseSchema =
|
|
30851
|
-
var BridgeLimitSchema =
|
|
30852
|
-
amount:
|
|
30853
|
-
decimals:
|
|
30854
|
-
type:
|
|
31159
|
+
var BridgeFeeResponseSchema = v__namespace.object({ fee: v__namespace.string() });
|
|
31160
|
+
var BridgeLimitSchema = v__namespace.object({
|
|
31161
|
+
amount: v__namespace.string(),
|
|
31162
|
+
decimals: v__namespace.number(),
|
|
31163
|
+
type: v__namespace.picklist(["DEPOSIT_LIMIT", "WITHDRAWAL_LIMIT"])
|
|
30855
31164
|
});
|
|
30856
|
-
var BridgeableAmountResponseSchema =
|
|
30857
|
-
var BridgeableCheckResponseSchema =
|
|
30858
|
-
var
|
|
30859
|
-
var HexSchema =
|
|
30860
|
-
var BigintFromString =
|
|
30861
|
-
var BytesFromIndexRecord =
|
|
30862
|
-
|
|
30863
|
-
|
|
31165
|
+
var BridgeableAmountResponseSchema = v__namespace.object({ limit: BridgeLimitSchema });
|
|
31166
|
+
var BridgeableCheckResponseSchema = v__namespace.object({ bridgeable: v__namespace.boolean() });
|
|
31167
|
+
var AddressSchema2 = v__namespace.custom((input) => typeof input === "string");
|
|
31168
|
+
var HexSchema = v__namespace.custom((input) => typeof input === "string");
|
|
31169
|
+
var BigintFromString = v__namespace.pipe(v__namespace.string(), v__namespace.toBigint());
|
|
31170
|
+
var BytesFromIndexRecord = v__namespace.pipe(
|
|
31171
|
+
v__namespace.record(v__namespace.string(), v__namespace.number()),
|
|
31172
|
+
v__namespace.transform((indexed) => Uint8Array.from(Object.values(indexed)))
|
|
30864
31173
|
);
|
|
30865
|
-
var EvmRawTxSchema =
|
|
30866
|
-
from:
|
|
30867
|
-
to:
|
|
31174
|
+
var EvmRawTxSchema = v__namespace.object({
|
|
31175
|
+
from: AddressSchema2,
|
|
31176
|
+
to: AddressSchema2,
|
|
30868
31177
|
value: BigintFromString,
|
|
30869
31178
|
data: HexSchema
|
|
30870
31179
|
});
|
|
30871
|
-
var SolanaRawTxSchema =
|
|
30872
|
-
from:
|
|
30873
|
-
to:
|
|
31180
|
+
var SolanaRawTxSchema = v__namespace.object({
|
|
31181
|
+
from: v__namespace.string(),
|
|
31182
|
+
to: v__namespace.string(),
|
|
30874
31183
|
value: BigintFromString,
|
|
30875
|
-
data:
|
|
31184
|
+
data: v__namespace.string()
|
|
30876
31185
|
});
|
|
30877
|
-
var SuiRawTxSchema =
|
|
31186
|
+
var SuiRawTxSchema = v__namespace.object({
|
|
30878
31187
|
from: HexSchema,
|
|
30879
|
-
to:
|
|
31188
|
+
to: v__namespace.string(),
|
|
30880
31189
|
value: BigintFromString,
|
|
30881
|
-
data:
|
|
31190
|
+
data: v__namespace.string()
|
|
30882
31191
|
});
|
|
30883
|
-
var StellarRawTxSchema =
|
|
30884
|
-
from:
|
|
30885
|
-
to:
|
|
31192
|
+
var StellarRawTxSchema = v__namespace.object({
|
|
31193
|
+
from: v__namespace.string(),
|
|
31194
|
+
to: v__namespace.string(),
|
|
30886
31195
|
value: BigintFromString,
|
|
30887
|
-
data:
|
|
31196
|
+
data: v__namespace.string()
|
|
30888
31197
|
});
|
|
30889
|
-
var BitcoinRawTxSchema =
|
|
30890
|
-
from:
|
|
30891
|
-
to:
|
|
31198
|
+
var BitcoinRawTxSchema = v__namespace.object({
|
|
31199
|
+
from: v__namespace.string(),
|
|
31200
|
+
to: v__namespace.string(),
|
|
30892
31201
|
value: BigintFromString,
|
|
30893
|
-
data:
|
|
31202
|
+
data: v__namespace.string()
|
|
30894
31203
|
});
|
|
30895
|
-
var InjectiveRawTxSchema =
|
|
31204
|
+
var InjectiveRawTxSchema = v__namespace.object({
|
|
30896
31205
|
from: HexSchema,
|
|
30897
31206
|
to: HexSchema,
|
|
30898
|
-
signedDoc:
|
|
31207
|
+
signedDoc: v__namespace.object({
|
|
30899
31208
|
bodyBytes: BytesFromIndexRecord,
|
|
30900
31209
|
authInfoBytes: BytesFromIndexRecord,
|
|
30901
|
-
chainId:
|
|
31210
|
+
chainId: v__namespace.string(),
|
|
30902
31211
|
accountNumber: BigintFromString
|
|
30903
31212
|
})
|
|
30904
31213
|
});
|
|
30905
|
-
var NearRawTxSchema =
|
|
30906
|
-
signerId:
|
|
30907
|
-
params:
|
|
30908
|
-
contractId:
|
|
30909
|
-
method:
|
|
30910
|
-
args:
|
|
30911
|
-
gas:
|
|
30912
|
-
deposit:
|
|
31214
|
+
var NearRawTxSchema = v__namespace.object({
|
|
31215
|
+
signerId: v__namespace.string(),
|
|
31216
|
+
params: v__namespace.object({
|
|
31217
|
+
contractId: v__namespace.string(),
|
|
31218
|
+
method: v__namespace.string(),
|
|
31219
|
+
args: v__namespace.custom((input) => typeof input === "object" && input !== null),
|
|
31220
|
+
gas: v__namespace.optional(BigintFromString),
|
|
31221
|
+
deposit: v__namespace.optional(BigintFromString)
|
|
30913
31222
|
})
|
|
30914
31223
|
});
|
|
30915
|
-
var IconRawTxSchema =
|
|
30916
|
-
|
|
30917
|
-
|
|
31224
|
+
var IconRawTxSchema = v__namespace.record(
|
|
31225
|
+
v__namespace.string(),
|
|
31226
|
+
v__namespace.union([v__namespace.string(), v__namespace.custom((input) => typeof input === "object" && input !== null)])
|
|
30918
31227
|
);
|
|
30919
|
-
var StacksRawTxSchema =
|
|
30920
|
-
payload:
|
|
30921
|
-
estimatedLength:
|
|
31228
|
+
var StacksRawTxSchema = v__namespace.object({
|
|
31229
|
+
payload: v__namespace.string(),
|
|
31230
|
+
estimatedLength: v__namespace.optional(v__namespace.number())
|
|
30922
31231
|
});
|
|
30923
|
-
var AnyRawTxSchema =
|
|
31232
|
+
var AnyRawTxSchema = v__namespace.custom((input) => typeof input === "object" && input !== null);
|
|
30924
31233
|
function rawTxSchemaForChainKey(chainKey) {
|
|
30925
31234
|
let chainType;
|
|
30926
31235
|
try {
|
|
@@ -30999,13 +31308,13 @@ var BridgeApiService = class {
|
|
|
30999
31308
|
logger: this.logger,
|
|
31000
31309
|
serviceLabel: "BridgeApiService"
|
|
31001
31310
|
});
|
|
31002
|
-
const parsed =
|
|
31311
|
+
const parsed = v__namespace.safeParse(schema, raw);
|
|
31003
31312
|
if (!parsed.success) {
|
|
31004
31313
|
return {
|
|
31005
31314
|
ok: false,
|
|
31006
31315
|
error: new SodaxError("EXTERNAL_API_ERROR", `Invalid response shape from bridge API for ${endpoint}`, {
|
|
31007
31316
|
feature: "backend",
|
|
31008
|
-
context: { api: "bridge", endpoint, reason: "invalid_response_shape", issues:
|
|
31317
|
+
context: { api: "bridge", endpoint, reason: "invalid_response_shape", issues: v__namespace.flatten(parsed.issues) }
|
|
31009
31318
|
})
|
|
31010
31319
|
};
|
|
31011
31320
|
}
|
|
@@ -31200,137 +31509,6 @@ var BridgeApiService = class {
|
|
|
31200
31509
|
return this.config.timeout;
|
|
31201
31510
|
}
|
|
31202
31511
|
};
|
|
31203
|
-
var ChainKeySchema = v7__namespace.custom((input) => typeof input === "string");
|
|
31204
|
-
var SpokeChainKeySchema = v7__namespace.custom((input) => typeof input === "string");
|
|
31205
|
-
var AddressSchema2 = v7__namespace.custom((input) => typeof input === "string");
|
|
31206
|
-
var XTokenSchema = v7__namespace.object({
|
|
31207
|
-
symbol: v7__namespace.string(),
|
|
31208
|
-
name: v7__namespace.string(),
|
|
31209
|
-
decimals: v7__namespace.number(),
|
|
31210
|
-
address: v7__namespace.string(),
|
|
31211
|
-
chainKey: ChainKeySchema,
|
|
31212
|
-
hubAsset: AddressSchema2,
|
|
31213
|
-
vault: AddressSchema2,
|
|
31214
|
-
access: v7__namespace.optional(v7__namespace.picklist(["withdrawOnly", "depositOnly"]))
|
|
31215
|
-
});
|
|
31216
|
-
var IntentStructSchema = v7__namespace.object({
|
|
31217
|
-
intentId: v7__namespace.string(),
|
|
31218
|
-
creator: v7__namespace.string(),
|
|
31219
|
-
inputToken: v7__namespace.string(),
|
|
31220
|
-
outputToken: v7__namespace.string(),
|
|
31221
|
-
inputAmount: v7__namespace.string(),
|
|
31222
|
-
minOutputAmount: v7__namespace.string(),
|
|
31223
|
-
deadline: v7__namespace.string(),
|
|
31224
|
-
allowPartialFill: v7__namespace.boolean(),
|
|
31225
|
-
srcChain: v7__namespace.number(),
|
|
31226
|
-
dstChain: v7__namespace.number(),
|
|
31227
|
-
srcAddress: v7__namespace.string(),
|
|
31228
|
-
dstAddress: v7__namespace.string(),
|
|
31229
|
-
solver: v7__namespace.string(),
|
|
31230
|
-
data: v7__namespace.string()
|
|
31231
|
-
});
|
|
31232
|
-
var IntentResponseSchema = v7__namespace.object({
|
|
31233
|
-
intentHash: v7__namespace.string(),
|
|
31234
|
-
txHash: v7__namespace.string(),
|
|
31235
|
-
logIndex: v7__namespace.number(),
|
|
31236
|
-
chainId: v7__namespace.number(),
|
|
31237
|
-
blockNumber: v7__namespace.number(),
|
|
31238
|
-
open: v7__namespace.boolean(),
|
|
31239
|
-
intent: IntentStructSchema,
|
|
31240
|
-
events: v7__namespace.array(v7__namespace.unknown())
|
|
31241
|
-
});
|
|
31242
|
-
var UserIntentsResponseSchema = v7__namespace.object({
|
|
31243
|
-
total: v7__namespace.number(),
|
|
31244
|
-
offset: v7__namespace.number(),
|
|
31245
|
-
limit: v7__namespace.number(),
|
|
31246
|
-
items: v7__namespace.array(IntentResponseSchema)
|
|
31247
|
-
});
|
|
31248
|
-
var OrderbookResponseSchema = v7__namespace.object({
|
|
31249
|
-
total: v7__namespace.number(),
|
|
31250
|
-
data: v7__namespace.array(
|
|
31251
|
-
v7__namespace.object({
|
|
31252
|
-
intentState: v7__namespace.object({
|
|
31253
|
-
exists: v7__namespace.boolean(),
|
|
31254
|
-
remainingInput: v7__namespace.string(),
|
|
31255
|
-
receivedOutput: v7__namespace.string(),
|
|
31256
|
-
pendingPayment: v7__namespace.boolean()
|
|
31257
|
-
}),
|
|
31258
|
-
intentData: v7__namespace.object({
|
|
31259
|
-
intentId: v7__namespace.string(),
|
|
31260
|
-
creator: v7__namespace.string(),
|
|
31261
|
-
inputToken: v7__namespace.string(),
|
|
31262
|
-
outputToken: v7__namespace.string(),
|
|
31263
|
-
inputAmount: v7__namespace.string(),
|
|
31264
|
-
minOutputAmount: v7__namespace.string(),
|
|
31265
|
-
deadline: v7__namespace.string(),
|
|
31266
|
-
allowPartialFill: v7__namespace.boolean(),
|
|
31267
|
-
srcChain: v7__namespace.number(),
|
|
31268
|
-
dstChain: v7__namespace.number(),
|
|
31269
|
-
srcAddress: v7__namespace.string(),
|
|
31270
|
-
dstAddress: v7__namespace.string(),
|
|
31271
|
-
solver: v7__namespace.string(),
|
|
31272
|
-
data: v7__namespace.string(),
|
|
31273
|
-
intentHash: v7__namespace.string(),
|
|
31274
|
-
txHash: v7__namespace.string(),
|
|
31275
|
-
blockNumber: v7__namespace.number()
|
|
31276
|
-
})
|
|
31277
|
-
})
|
|
31278
|
-
)
|
|
31279
|
-
});
|
|
31280
|
-
var MoneyMarketPositionSchema = v7__namespace.object({
|
|
31281
|
-
userAddress: v7__namespace.string(),
|
|
31282
|
-
positions: v7__namespace.array(
|
|
31283
|
-
v7__namespace.object({
|
|
31284
|
-
reserveAddress: v7__namespace.string(),
|
|
31285
|
-
aTokenAddress: v7__namespace.string(),
|
|
31286
|
-
variableDebtTokenAddress: v7__namespace.string(),
|
|
31287
|
-
aTokenBalance: v7__namespace.string(),
|
|
31288
|
-
variableDebtTokenBalance: v7__namespace.string(),
|
|
31289
|
-
blockNumber: v7__namespace.number()
|
|
31290
|
-
})
|
|
31291
|
-
)
|
|
31292
|
-
});
|
|
31293
|
-
var MoneyMarketAssetSchema = v7__namespace.object({
|
|
31294
|
-
reserveAddress: v7__namespace.string(),
|
|
31295
|
-
aTokenAddress: v7__namespace.string(),
|
|
31296
|
-
totalATokenBalance: v7__namespace.string(),
|
|
31297
|
-
variableDebtTokenAddress: v7__namespace.string(),
|
|
31298
|
-
totalVariableDebtTokenBalance: v7__namespace.string(),
|
|
31299
|
-
liquidityRate: v7__namespace.string(),
|
|
31300
|
-
symbol: v7__namespace.string(),
|
|
31301
|
-
totalSuppliers: v7__namespace.number(),
|
|
31302
|
-
totalBorrowers: v7__namespace.number(),
|
|
31303
|
-
variableBorrowRate: v7__namespace.string(),
|
|
31304
|
-
stableBorrowRate: v7__namespace.string(),
|
|
31305
|
-
liquidityIndex: v7__namespace.string(),
|
|
31306
|
-
variableBorrowIndex: v7__namespace.string(),
|
|
31307
|
-
blockNumber: v7__namespace.number()
|
|
31308
|
-
});
|
|
31309
|
-
var MoneyMarketAssetsSchema = v7__namespace.array(MoneyMarketAssetSchema);
|
|
31310
|
-
var MoneyMarketAssetBorrowersSchema = v7__namespace.object({
|
|
31311
|
-
borrowers: v7__namespace.array(v7__namespace.string()),
|
|
31312
|
-
total: v7__namespace.number(),
|
|
31313
|
-
offset: v7__namespace.number(),
|
|
31314
|
-
limit: v7__namespace.number()
|
|
31315
|
-
});
|
|
31316
|
-
var MoneyMarketAssetSuppliersSchema = v7__namespace.object({
|
|
31317
|
-
suppliers: v7__namespace.array(v7__namespace.string()),
|
|
31318
|
-
total: v7__namespace.number(),
|
|
31319
|
-
offset: v7__namespace.number(),
|
|
31320
|
-
limit: v7__namespace.number()
|
|
31321
|
-
});
|
|
31322
|
-
var MoneyMarketBorrowersSchema = v7__namespace.object({
|
|
31323
|
-
borrowers: v7__namespace.array(v7__namespace.string()),
|
|
31324
|
-
total: v7__namespace.number(),
|
|
31325
|
-
offset: v7__namespace.number(),
|
|
31326
|
-
limit: v7__namespace.number()
|
|
31327
|
-
});
|
|
31328
|
-
var GetChainsResponseSchema = v7__namespace.array(SpokeChainKeySchema);
|
|
31329
|
-
var TokensByChainMapSchema = v7__namespace.custom(
|
|
31330
|
-
(input) => typeof input === "object" && input !== null && Object.values(input).every((tokens) => Array.isArray(tokens) && tokens.every((t) => v7__namespace.is(XTokenSchema, t)))
|
|
31331
|
-
);
|
|
31332
|
-
var TokensListSchema = v7__namespace.array(XTokenSchema);
|
|
31333
|
-
var ReserveAssetsSchema = v7__namespace.array(AddressSchema2);
|
|
31334
31512
|
|
|
31335
31513
|
// src/backendApi/BackendApiService.ts
|
|
31336
31514
|
var BackendApiService = class {
|
|
@@ -31343,6 +31521,15 @@ var BackendApiService = class {
|
|
|
31343
31521
|
config;
|
|
31344
31522
|
headers;
|
|
31345
31523
|
logger;
|
|
31524
|
+
/**
|
|
31525
|
+
* The resolved request timeout. Exposed so a caller wanting a *shorter* per-call budget can clamp
|
|
31526
|
+
* to it: a `RequestOverrideConfig.timeout` replaces the configured value rather than capping it,
|
|
31527
|
+
* so passing a fixed override would silently lengthen requests for a consumer who configured a
|
|
31528
|
+
* stricter timeout.
|
|
31529
|
+
*/
|
|
31530
|
+
get requestTimeoutMs() {
|
|
31531
|
+
return this.config.timeout;
|
|
31532
|
+
}
|
|
31346
31533
|
/**
|
|
31347
31534
|
* Whether a legacy `/be` suffix is trimmed off a per-call `baseURL` override. Mirrors the config-level
|
|
31348
31535
|
* decision: an explicit `basePath` means the consumer writes complete roots, so their per-call value is
|
|
@@ -31413,7 +31600,7 @@ var BackendApiService = class {
|
|
|
31413
31600
|
async request(endpoint, config, schema) {
|
|
31414
31601
|
try {
|
|
31415
31602
|
const raw = await this.send(endpoint, config);
|
|
31416
|
-
const parsed =
|
|
31603
|
+
const parsed = v__namespace.safeParse(schema, raw);
|
|
31417
31604
|
if (!parsed.success) {
|
|
31418
31605
|
return {
|
|
31419
31606
|
ok: false,
|
|
@@ -31421,7 +31608,7 @@ var BackendApiService = class {
|
|
|
31421
31608
|
api: "backend",
|
|
31422
31609
|
feature: "backend",
|
|
31423
31610
|
endpoint,
|
|
31424
|
-
issues:
|
|
31611
|
+
issues: v__namespace.flatten(parsed.issues)
|
|
31425
31612
|
})
|
|
31426
31613
|
};
|
|
31427
31614
|
}
|
|
@@ -40643,7 +40830,7 @@ var LeverageYieldService = class {
|
|
|
40643
40830
|
}
|
|
40644
40831
|
/** Looks up a vault by its `name` field. Returns `undefined` when not registered. */
|
|
40645
40832
|
getVault(name) {
|
|
40646
|
-
return this.listVaults().find((
|
|
40833
|
+
return this.listVaults().find((v10) => v10.name === name);
|
|
40647
40834
|
}
|
|
40648
40835
|
/**
|
|
40649
40836
|
* Looks up a registered vault by its on-chain proxy address (case-insensitive).
|
|
@@ -40651,7 +40838,7 @@ var LeverageYieldService = class {
|
|
|
40651
40838
|
*/
|
|
40652
40839
|
getVaultByAddress(address) {
|
|
40653
40840
|
const normalized = address.toLowerCase();
|
|
40654
|
-
return this.listVaults().find((
|
|
40841
|
+
return this.listVaults().find((v10) => v10.vault.toLowerCase() === normalized);
|
|
40655
40842
|
}
|
|
40656
40843
|
/**
|
|
40657
40844
|
* Resolves the intent `deadline`: returns the caller-supplied value verbatim, otherwise
|
|
@@ -42249,6 +42436,7 @@ exports.DEFAULT_RELAYER_API_ENDPOINT = DEFAULT_RELAYER_API_ENDPOINT;
|
|
|
42249
42436
|
exports.DEFAULT_RELAY_TX_TIMEOUT = DEFAULT_RELAY_TX_TIMEOUT;
|
|
42250
42437
|
exports.DEFAULT_RETRY_DELAY_MS = DEFAULT_RETRY_DELAY_MS;
|
|
42251
42438
|
exports.DEFAULT_SPONSORING_API_ENDPOINT = DEFAULT_SPONSORING_API_ENDPOINT;
|
|
42439
|
+
exports.DETAILED_STATUS_NOT_DELIVERED = DETAILED_STATUS_NOT_DELIVERED;
|
|
42252
42440
|
exports.DexService = DexService;
|
|
42253
42441
|
exports.EVM_CHAIN_ID_TO_KEY = EVM_CHAIN_ID_TO_KEY;
|
|
42254
42442
|
exports.EVM_CHAIN_KEYS = EVM_CHAIN_KEYS;
|
|
@@ -42313,6 +42501,7 @@ exports.RAY = RAY;
|
|
|
42313
42501
|
exports.RAY_DECIMALS = RAY_DECIMALS;
|
|
42314
42502
|
exports.RELAY_ERROR_CODES = RELAY_ERROR_CODES;
|
|
42315
42503
|
exports.RELAY_FALLBACK_FLOOR_MS = RELAY_FALLBACK_FLOOR_MS;
|
|
42504
|
+
exports.RELAY_REQUEST_TIMEOUT_MS = RELAY_REQUEST_TIMEOUT_MS;
|
|
42316
42505
|
exports.RadfiApiError = RadfiApiError;
|
|
42317
42506
|
exports.RadfiProvider = RadfiProvider;
|
|
42318
42507
|
exports.RecoveryService = RecoveryService;
|
|
@@ -42485,6 +42674,7 @@ exports.isEvmSpokeOnlyChainKey = isEvmSpokeOnlyChainKey;
|
|
|
42485
42674
|
exports.isEvmSpokeOnlyChainKeyType = isEvmSpokeOnlyChainKeyType;
|
|
42486
42675
|
exports.isEvmWalletProviderType = isEvmWalletProviderType;
|
|
42487
42676
|
exports.isFeatureError = isFeatureError;
|
|
42677
|
+
exports.isFillEvent = isFillEvent;
|
|
42488
42678
|
exports.isHookSupportedToken = isHookSupportedToken;
|
|
42489
42679
|
exports.isHubChainKey = isHubChainKey;
|
|
42490
42680
|
exports.isHubChainKeyType = isHubChainKeyType;
|