@glacislabs/stablegenie-zerodelta 4.13.0 → 4.13.1
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/LICENSE +21 -21
- package/README.md +223 -223
- package/dist/{chunk-52MY5D3D.js → chunk-6WFIFKZ4.js} +198 -28
- package/dist/{chunk-BYAKXZ5E.js → chunk-M55J3P64.js} +211 -49
- package/dist/core/index.cjs +208 -27
- package/dist/core/index.d.cts +85 -3
- package/dist/core/index.d.ts +85 -3
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +421 -87
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{mount-bKSKIGmW.d.ts → mount-B6soKC-9.d.ts} +1 -1
- package/dist/{mount-BR3wWmjt.d.cts → mount-CEy4Nqky.d.cts} +1 -1
- package/dist/mount.cjs +421 -87
- package/dist/mount.d.cts +2 -2
- package/dist/mount.d.ts +2 -2
- package/dist/mount.js +2 -2
- package/dist/standalone.global.js +10 -9
- package/dist/{verify-DdSA23GJ.d.cts → verify-Y9jZ83T5.d.cts} +3 -0
- package/dist/{verify-DdSA23GJ.d.ts → verify-Y9jZ83T5.d.ts} +3 -0
- package/package.json +134 -134
|
@@ -561,9 +561,9 @@ function encodeSubmitOrder(orders, partnerId = NO_PARTNER_ID) {
|
|
|
561
561
|
const tuples = orders.map(encodeOrderTuple);
|
|
562
562
|
let offset = 32n * BigInt(tuples.length);
|
|
563
563
|
const offsets = tuples.map((tuple) => {
|
|
564
|
-
const
|
|
564
|
+
const word2 = uintWord(offset);
|
|
565
565
|
offset += BigInt(tuple.length / 2);
|
|
566
|
-
return
|
|
566
|
+
return word2;
|
|
567
567
|
}).join("");
|
|
568
568
|
return `0x${SUBMIT_ORDER_SELECTOR.slice(2)}${uintWord(64)}${bytes32Word(partnerId)}${uintWord(tuples.length)}${offsets}${tuples.join("")}`;
|
|
569
569
|
}
|
|
@@ -574,21 +574,21 @@ function decodeSubmitOrderCalldata(data) {
|
|
|
574
574
|
if (`0x${hex.slice(0, 8)}` !== SUBMIT_ORDER_SELECTOR) return null;
|
|
575
575
|
const body = hex.slice(8);
|
|
576
576
|
const totalBytes = body.length / 2;
|
|
577
|
-
const
|
|
577
|
+
const word2 = (byteOffset) => {
|
|
578
578
|
if (!Number.isSafeInteger(byteOffset) || byteOffset < 0 || byteOffset + 32 > totalBytes) return null;
|
|
579
579
|
return BigInt(`0x${body.slice(byteOffset * 2, byteOffset * 2 + 64)}`);
|
|
580
580
|
};
|
|
581
581
|
const addressAt = (byteOffset) => {
|
|
582
|
-
const w =
|
|
582
|
+
const w = word2(byteOffset);
|
|
583
583
|
if (w === null || w >= 1n << 160n) return null;
|
|
584
584
|
return `0x${w.toString(16).padStart(40, "0")}`;
|
|
585
585
|
};
|
|
586
586
|
const uint64At = (byteOffset) => {
|
|
587
|
-
const w =
|
|
587
|
+
const w = word2(byteOffset);
|
|
588
588
|
return w === null || w > MAX_UINT64 ? null : w;
|
|
589
589
|
};
|
|
590
590
|
const keyBytesAt = (byteOffset) => {
|
|
591
|
-
const len =
|
|
591
|
+
const len = word2(byteOffset);
|
|
592
592
|
if (len !== 20n && len !== 32n) return null;
|
|
593
593
|
const length = Number(len);
|
|
594
594
|
const padded = Math.ceil(length / 32) * 32;
|
|
@@ -596,25 +596,25 @@ function decodeSubmitOrderCalldata(data) {
|
|
|
596
596
|
if (content.length !== padded * 2 || content.slice(length * 2) !== "0".repeat((padded - length) * 2)) return null;
|
|
597
597
|
return { value: `0x${content.slice(0, length * 2)}`, size: 32 + padded };
|
|
598
598
|
};
|
|
599
|
-
if (
|
|
600
|
-
if (
|
|
599
|
+
if (word2(0) !== 64n) return null;
|
|
600
|
+
if (word2(32) === null) return null;
|
|
601
601
|
const partnerId = `0x${body.slice(64, 128)}`;
|
|
602
|
-
const count =
|
|
602
|
+
const count = word2(64);
|
|
603
603
|
if (count === null || count < 1n || count > BigInt(MAX_DECODED_ORDERS)) return null;
|
|
604
604
|
const n = Number(count);
|
|
605
605
|
const arrayBase = 96;
|
|
606
606
|
let next = arrayBase + 32 * n;
|
|
607
607
|
const orders = [];
|
|
608
608
|
for (let i = 0; i < n; i += 1) {
|
|
609
|
-
const rel =
|
|
609
|
+
const rel = word2(arrayBase + i * 32);
|
|
610
610
|
if (rel === null || rel !== BigInt(next - arrayBase)) return null;
|
|
611
611
|
const base = next;
|
|
612
612
|
const owner = addressAt(base);
|
|
613
613
|
const bidToken = addressAt(base + 32);
|
|
614
|
-
const bidTokenAmount =
|
|
615
|
-
const askOffset =
|
|
616
|
-
const askTokenAmount =
|
|
617
|
-
const receiverOffset =
|
|
614
|
+
const bidTokenAmount = word2(base + 64);
|
|
615
|
+
const askOffset = word2(base + 96);
|
|
616
|
+
const askTokenAmount = word2(base + 128);
|
|
617
|
+
const receiverOffset = word2(base + 160);
|
|
618
618
|
const destinationChainId = uint64At(base + 192);
|
|
619
619
|
const executionChainId = uint64At(base + 224);
|
|
620
620
|
const deadline = uint64At(base + 256);
|
|
@@ -1361,6 +1361,12 @@ async function previewSolanaSource(api, input) {
|
|
|
1361
1361
|
nativeFeeRaw: "0"
|
|
1362
1362
|
};
|
|
1363
1363
|
}
|
|
1364
|
+
function solanaQuoteCompliance(quote) {
|
|
1365
|
+
for (const value of [quote?.complianceDecision, quote?.compliance]) {
|
|
1366
|
+
if (value && typeof value === "object" && !Array.isArray(value)) return value;
|
|
1367
|
+
}
|
|
1368
|
+
return void 0;
|
|
1369
|
+
}
|
|
1364
1370
|
function denied(value) {
|
|
1365
1371
|
return typeof value === "string" ? value.toUpperCase() === "DENY" : !!value && typeof value === "object" && denied(value.decision);
|
|
1366
1372
|
}
|
|
@@ -1478,6 +1484,7 @@ function createSolanaRpc(api) {
|
|
|
1478
1484
|
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
|
|
1479
1485
|
timeoutMs: 15e3
|
|
1480
1486
|
});
|
|
1487
|
+
if (body.error && solanaLamportShortfall(body.error.data?.logs) !== null) throw new Error(SOL_SHORTFALL_MESSAGE);
|
|
1481
1488
|
if (body.error || body.result === void 0) throw new Error(body.error?.message || "Invalid Solana RPC response.");
|
|
1482
1489
|
return body.result;
|
|
1483
1490
|
};
|
|
@@ -1642,18 +1649,179 @@ async function readSolanaBalance(rpc, owner, mint) {
|
|
|
1642
1649
|
return void 0;
|
|
1643
1650
|
}
|
|
1644
1651
|
}
|
|
1652
|
+
function solanaLamportShortfall(logs) {
|
|
1653
|
+
if (!Array.isArray(logs)) return null;
|
|
1654
|
+
for (const line of logs) {
|
|
1655
|
+
const m = /insufficient lamports (\d+), need (\d+)/.exec(String(line));
|
|
1656
|
+
if (m) {
|
|
1657
|
+
const need = Number(m[2]);
|
|
1658
|
+
return Number.isSafeInteger(need) && need > 0 ? need : null;
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
return null;
|
|
1662
|
+
}
|
|
1663
|
+
var SOL_SHORTFALL_MESSAGE = "Not enough SOL in this wallet for the Solana network fee and account rent. Add a little SOL and try again.";
|
|
1645
1664
|
async function simulateSolanaCost(rpc, plan) {
|
|
1646
1665
|
checkSolanaPlan(plan.txData);
|
|
1647
1666
|
const signer = plan.expected.signer;
|
|
1648
1667
|
const before = await rpc("getAccountInfo", [signer, { encoding: "base64", commitment: "confirmed" }]);
|
|
1649
1668
|
const sim = await rpc("simulateTransaction", [plan.txData[0].transaction, { encoding: "base64", sigVerify: false, replaceRecentBlockhash: true, accounts: { addresses: [signer], encoding: "base64" } }]);
|
|
1650
|
-
if (sim.value?.err) throw new Error(`Simulation failed: ${JSON.stringify(sim.value.err)}`);
|
|
1651
1669
|
const balanceLamports = before.value?.lamports ?? 0, post = sim.value?.accounts?.[0]?.lamports;
|
|
1670
|
+
if (sim.value?.err) {
|
|
1671
|
+
const need = solanaLamportShortfall(sim.value.logs);
|
|
1672
|
+
if (need !== null && Number.isSafeInteger(balanceLamports)) return { lamports: need, balanceLamports, sufficient: false };
|
|
1673
|
+
throw new Error(`Simulation failed: ${JSON.stringify(sim.value.err)}`);
|
|
1674
|
+
}
|
|
1652
1675
|
if (!Number.isSafeInteger(balanceLamports) || balanceLamports < 0 || post !== void 0 && (!Number.isSafeInteger(post) || post < 0)) throw new Error("Invalid simulation lamports.");
|
|
1653
1676
|
const lamports = typeof post === "number" ? Math.max(0, balanceLamports - post) : 0;
|
|
1654
1677
|
return { lamports, balanceLamports, sufficient: balanceLamports >= lamports };
|
|
1655
1678
|
}
|
|
1656
1679
|
|
|
1680
|
+
// src/core/delivery.ts
|
|
1681
|
+
var FAILED = /* @__PURE__ */ new Set(["cancelled", "fill_failed", "delivery_failed", "expired", "failed"]);
|
|
1682
|
+
var ATTENTION = /* @__PURE__ */ new Set(["cancel_pending", "awaiting_claim"]);
|
|
1683
|
+
var TRACKING = Object.freeze({ phase: "tracking", status: "", steps: [] });
|
|
1684
|
+
var word = (v) => typeof v === "string" ? v.trim().toLowerCase() : "";
|
|
1685
|
+
function normalizeDelivery(raw2) {
|
|
1686
|
+
const row = raw2 && typeof raw2 === "object" && !Array.isArray(raw2) ? raw2.data ?? raw2 : null;
|
|
1687
|
+
if (!row || typeof row !== "object" || Array.isArray(row)) return TRACKING;
|
|
1688
|
+
const r = row;
|
|
1689
|
+
const chained = r.isChained === true || Array.isArray(r.legs) && r.legs.length > 1;
|
|
1690
|
+
const journey = word(r.journeyStatus);
|
|
1691
|
+
const own = word(r.status);
|
|
1692
|
+
const status = journey || own;
|
|
1693
|
+
const rawSteps = Array.isArray(r.steps) ? r.steps : [];
|
|
1694
|
+
const steps = rawSteps.filter((s) => s && typeof s === "object" && typeof s.stepName === "string").sort((a, b) => Number(a.stepNumber ?? 0) - Number(b.stepNumber ?? 0)).slice(0, 8).map((s) => ({ name: String(s.stepName).slice(0, 32), done: s.stepStatus === "completed" }));
|
|
1695
|
+
if (!status) return TRACKING;
|
|
1696
|
+
if (FAILED.has(status)) return { phase: "failed", status, steps };
|
|
1697
|
+
if (ATTENTION.has(status)) return { phase: "attention", status, steps };
|
|
1698
|
+
if (status === "delivered" && !(chained && !journey)) return { phase: "delivered", status, steps: steps.map((s) => ({ ...s, done: true })) };
|
|
1699
|
+
return { phase: "in-progress", status: status === "delivered" ? "continuing" : status, steps };
|
|
1700
|
+
}
|
|
1701
|
+
var HASH = /^(?:0x[0-9a-fA-F]{64}|[1-9A-HJ-NP-Za-km-z]{64,88})$/;
|
|
1702
|
+
function sameOrder(raw2, hash) {
|
|
1703
|
+
const row = raw2 && typeof raw2 === "object" ? raw2.data ?? raw2 : null;
|
|
1704
|
+
const got = row && typeof row === "object" ? row.txHash : void 0;
|
|
1705
|
+
if (typeof got !== "string" || !got) return false;
|
|
1706
|
+
return hash.startsWith("0x") ? got.toLowerCase() === hash.toLowerCase() : got === hash;
|
|
1707
|
+
}
|
|
1708
|
+
async function fetchDelivery(api, hash) {
|
|
1709
|
+
if (typeof hash !== "string" || !HASH.test(hash)) return TRACKING;
|
|
1710
|
+
try {
|
|
1711
|
+
const raw2 = await api.apiRequest(`/transactions/${hash}`, { timeoutMs: 8e3 });
|
|
1712
|
+
return sameOrder(raw2, hash) ? normalizeDelivery(raw2) : TRACKING;
|
|
1713
|
+
} catch {
|
|
1714
|
+
return TRACKING;
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
// src/core/history.ts
|
|
1719
|
+
var WALLET_HISTORY_LIMIT = 50;
|
|
1720
|
+
var HASH2 = /^(?:0x[0-9a-fA-F]{64}|[1-9A-HJ-NP-Za-km-z]{64,88})$/;
|
|
1721
|
+
var WALLET = /^(?:0x[0-9a-fA-F]{40}|[1-9A-HJ-NP-Za-km-z]{32,44})$/;
|
|
1722
|
+
function historyKey(value) {
|
|
1723
|
+
return value.startsWith("0x") ? value.toLowerCase() : value;
|
|
1724
|
+
}
|
|
1725
|
+
var str = (v) => typeof v === "string" ? v : typeof v === "number" ? String(v) : "";
|
|
1726
|
+
function tokenAt(tokens, chainId, address) {
|
|
1727
|
+
if (!address) return void 0;
|
|
1728
|
+
const key = historyKey(address);
|
|
1729
|
+
return tokens.find((t) => Number(t.chainId) === chainId && historyKey(String(t.address)) === key);
|
|
1730
|
+
}
|
|
1731
|
+
function amountOf(raw2, token, rowDecimals, rowAmount) {
|
|
1732
|
+
const decimals = token ? Number(token.decimals) : Number(rowDecimals);
|
|
1733
|
+
if (/^\d{1,78}$/.test(raw2) && Number.isInteger(decimals) && decimals > 0 && decimals <= 36) return formatUnits(raw2, decimals);
|
|
1734
|
+
return Number(rowDecimals) > 0 && /^\d+(?:\.\d+)?$/.test(rowAmount) ? rowAmount.slice(0, 40) : "";
|
|
1735
|
+
}
|
|
1736
|
+
function historyEntryFromOrder(raw2, tokens) {
|
|
1737
|
+
if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) return null;
|
|
1738
|
+
const r = raw2;
|
|
1739
|
+
const hash = str(r.txHash);
|
|
1740
|
+
if (!HASH2.test(hash)) return null;
|
|
1741
|
+
const fromChainId = Number(r.sourceChainId) || 0;
|
|
1742
|
+
const toChainId = Number(r.finalDestChainId ?? r.destChainId) || 0;
|
|
1743
|
+
const from = tokenAt(tokens, fromChainId, str(r.fromTokenAddress));
|
|
1744
|
+
const toAddress = str(r.finalToTokenAddress) || str(r.toTokenAddress);
|
|
1745
|
+
const to = tokenAt(tokens, toChainId, toAddress);
|
|
1746
|
+
const fromAsset = (from?.symbol ?? str(r.fromTokenSymbol)).slice(0, 10);
|
|
1747
|
+
const toAsset = (to?.symbol ?? (str(r.finalToTokenSymbol) || str(r.toTokenSymbol))).slice(0, 10);
|
|
1748
|
+
const payAmount = amountOf(str(r.fromTokenRawAmount), from, r.fromTokenDecimals, str(r.fromTokenAmount));
|
|
1749
|
+
const receiveAmount = str(r.finalToTokenRawAmount) ? amountOf(str(r.finalToTokenRawAmount), to, r.finalToTokenDecimals, str(r.finalToTokenAmount)) : amountOf(str(r.toTokenRawAmount), to, r.toTokenDecimals, str(r.toTokenAmount));
|
|
1750
|
+
const delivery = normalizeDelivery(r).phase;
|
|
1751
|
+
const wallet = str(r.wallet);
|
|
1752
|
+
const receiver = str(r.destinationReceiver);
|
|
1753
|
+
const at = str(r.createdAt) || str(r.submittedAt);
|
|
1754
|
+
return {
|
|
1755
|
+
kind: "swap",
|
|
1756
|
+
hash,
|
|
1757
|
+
txKind: "submitOrder",
|
|
1758
|
+
chainId: fromChainId || null,
|
|
1759
|
+
chainName: "",
|
|
1760
|
+
fromAsset,
|
|
1761
|
+
toAsset,
|
|
1762
|
+
fromTicker: from ? tokenTicker(from).slice(0, 12) : void 0,
|
|
1763
|
+
toTicker: to ? tokenTicker(to).slice(0, 12) : void 0,
|
|
1764
|
+
payAmount,
|
|
1765
|
+
receiveAmount,
|
|
1766
|
+
account: WALLET.test(wallet) ? historyKey(wallet) : "",
|
|
1767
|
+
recipient: WALLET.test(receiver) ? receiver : "",
|
|
1768
|
+
settlement: "escrow",
|
|
1769
|
+
status: "submitted",
|
|
1770
|
+
at: Number.isNaN(Date.parse(at)) ? (/* @__PURE__ */ new Date(0)).toISOString() : new Date(at).toISOString(),
|
|
1771
|
+
delivery: delivery === "tracking" || delivery === "unavailable" ? void 0 : delivery,
|
|
1772
|
+
legs: [
|
|
1773
|
+
{
|
|
1774
|
+
index: 1,
|
|
1775
|
+
fromAsset,
|
|
1776
|
+
fromTicker: from ? tokenTicker(from).slice(0, 12) : void 0,
|
|
1777
|
+
fromChainId,
|
|
1778
|
+
fromChainName: "",
|
|
1779
|
+
fromAmount: payAmount,
|
|
1780
|
+
toAsset,
|
|
1781
|
+
toTicker: to ? tokenTicker(to).slice(0, 12) : void 0,
|
|
1782
|
+
toChainId,
|
|
1783
|
+
toChainName: "",
|
|
1784
|
+
toAmount: receiveAmount,
|
|
1785
|
+
executionChainId: Number(r.executionChainId) || 0,
|
|
1786
|
+
executionChainName: ""
|
|
1787
|
+
}
|
|
1788
|
+
]
|
|
1789
|
+
};
|
|
1790
|
+
}
|
|
1791
|
+
async function fetchWalletHistory(api, wallets) {
|
|
1792
|
+
const asked = [...new Set(wallets.filter((w) => WALLET.test(w)).map(historyKey))];
|
|
1793
|
+
if (!asked.length) return [];
|
|
1794
|
+
const tokens = await api.fetchTokens().catch(() => []);
|
|
1795
|
+
const reads = await Promise.all(
|
|
1796
|
+
asked.map(async (wallet) => {
|
|
1797
|
+
try {
|
|
1798
|
+
const rows = await api.apiRequest(`/transactions?wallet=${encodeURIComponent(wallet)}&limit=${WALLET_HISTORY_LIMIT}`, { timeoutMs: 1e4 });
|
|
1799
|
+
if (!Array.isArray(rows)) return null;
|
|
1800
|
+
return rows.filter((row) => historyKey(str(row?.wallet)) === wallet).map((row) => historyEntryFromOrder(row, tokens));
|
|
1801
|
+
} catch {
|
|
1802
|
+
return null;
|
|
1803
|
+
}
|
|
1804
|
+
})
|
|
1805
|
+
);
|
|
1806
|
+
if (reads.every((read) => read === null)) return null;
|
|
1807
|
+
return reads.flatMap((read) => read ?? []).filter((e) => e !== null);
|
|
1808
|
+
}
|
|
1809
|
+
function mergeHistory(local, remote, limit = WALLET_HISTORY_LIMIT) {
|
|
1810
|
+
const byHash = /* @__PURE__ */ new Map();
|
|
1811
|
+
for (const entry of remote ?? []) if (!byHash.has(historyKey(entry.hash))) byHash.set(historyKey(entry.hash), entry);
|
|
1812
|
+
const out = [];
|
|
1813
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1814
|
+
for (const entry of local) {
|
|
1815
|
+
const key = historyKey(entry.hash);
|
|
1816
|
+
if (seen.has(key)) continue;
|
|
1817
|
+
seen.add(key);
|
|
1818
|
+
const known = byHash.get(key);
|
|
1819
|
+
out.push(known ? { ...entry, delivery: known.delivery, legs: entry.legs ?? known.legs } : entry);
|
|
1820
|
+
}
|
|
1821
|
+
for (const [key, entry] of byHash) if (!seen.has(key)) out.push(entry);
|
|
1822
|
+
return out.sort((a, b) => Date.parse(b.at) - Date.parse(a.at)).slice(0, limit);
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1657
1825
|
// src/core/escrow.ts
|
|
1658
1826
|
function checkEscrow(chainId, quoteEscrow, chainsEscrow) {
|
|
1659
1827
|
const fromQuote = normalizeAddress(quoteEscrow);
|
|
@@ -1908,11 +2076,11 @@ function complianceView(compliance, hasQuote = true) {
|
|
|
1908
2076
|
};
|
|
1909
2077
|
}
|
|
1910
2078
|
if (decision === "REVIEW" || decision === "REMEDIATE") {
|
|
1911
|
-
const
|
|
2079
|
+
const word2 = decision.toLowerCase();
|
|
1912
2080
|
return {
|
|
1913
2081
|
tone: "warn",
|
|
1914
|
-
label: `Compliance: ${
|
|
1915
|
-
headline: `Manual ${
|
|
2082
|
+
label: `Compliance: ${word2} required`,
|
|
2083
|
+
headline: `Manual ${word2} required`,
|
|
1916
2084
|
blocked: false,
|
|
1917
2085
|
needsAction: true,
|
|
1918
2086
|
screened
|
|
@@ -2483,7 +2651,7 @@ function routeLabelFor(option, destinationToken, result) {
|
|
|
2483
2651
|
const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
|
|
2484
2652
|
return `Swap ${optionTicker(option)} to ${tokenTicker(destinationToken)} and settle on ZeroDelta${bridge}.`;
|
|
2485
2653
|
}
|
|
2486
|
-
function
|
|
2654
|
+
function tokenAt2(tokens, chainId, address) {
|
|
2487
2655
|
const key = isSolanaChainId(chainId) ? hexToSolanaKey(address) || address : address;
|
|
2488
2656
|
const wanted = isChainAddress(chainId, key) ? chainAddressKey(chainId, key) : null;
|
|
2489
2657
|
if (!wanted || !tokens?.length) return void 0;
|
|
@@ -2507,7 +2675,7 @@ function buildLegs(orders, ctx) {
|
|
|
2507
2675
|
const order = orders[index];
|
|
2508
2676
|
const isLast = index === orders.length - 1;
|
|
2509
2677
|
const toChainId = Number(order.destinationChainId);
|
|
2510
|
-
const askToken = isLast ? ctx.destinationToken :
|
|
2678
|
+
const askToken = isLast ? ctx.destinationToken : tokenAt2(ctx.tokens, toChainId, order.askToken);
|
|
2511
2679
|
const toAsset = isLast ? ctx.destinationToken.symbol : askToken?.symbol ?? "";
|
|
2512
2680
|
const toTicker = askToken ? tokenTicker(askToken) : "";
|
|
2513
2681
|
const toDecimals = askToken ? assetDecimals(askToken) : void 0;
|
|
@@ -2725,7 +2893,7 @@ var CHANNEL_HEADER = "x-zd-channel";
|
|
|
2725
2893
|
var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
|
|
2726
2894
|
var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
|
|
2727
2895
|
var WIDGET_CHANNEL = "widget";
|
|
2728
|
-
var WIDGET_VERSION = "4.13.
|
|
2896
|
+
var WIDGET_VERSION = "4.13.1" ;
|
|
2729
2897
|
var MAX_CHANNEL_VERSION_LEN = 32;
|
|
2730
2898
|
function sanitizeVersion(raw2) {
|
|
2731
2899
|
const v = String(raw2).trim();
|
|
@@ -3384,16 +3552,16 @@ function isHexQuantity(value) {
|
|
|
3384
3552
|
return /^0x[0-9a-fA-F]+$/.test(String(value || "0x0"));
|
|
3385
3553
|
}
|
|
3386
3554
|
function dataWord(data, index) {
|
|
3387
|
-
const
|
|
3388
|
-
return /^[a-fA-F0-9]{64}$/.test(
|
|
3555
|
+
const word2 = String(data || "").slice(10 + index * 64, 10 + (index + 1) * 64);
|
|
3556
|
+
return /^[a-fA-F0-9]{64}$/.test(word2) ? word2 : "";
|
|
3389
3557
|
}
|
|
3390
3558
|
function dataAddress(data, index) {
|
|
3391
|
-
const
|
|
3392
|
-
return
|
|
3559
|
+
const word2 = dataWord(data, index);
|
|
3560
|
+
return word2 ? `0x${word2.slice(24)}` : "";
|
|
3393
3561
|
}
|
|
3394
3562
|
function dataUint(data, index) {
|
|
3395
|
-
const
|
|
3396
|
-
return
|
|
3563
|
+
const word2 = dataWord(data, index);
|
|
3564
|
+
return word2 ? BigInt(`0x${word2}`) : null;
|
|
3397
3565
|
}
|
|
3398
3566
|
function rawEquals(value, expected) {
|
|
3399
3567
|
try {
|
|
@@ -3871,6 +4039,8 @@ function createEngine(config = {}) {
|
|
|
3871
4039
|
executeSolanaPlan: (input) => executeSolanaPlan({ ...input, rpc: input.rpc ?? solanaRpc }),
|
|
3872
4040
|
executeSolanaPlanStaged: (input) => executeSolanaPlanStaged({ ...input, rpc: input.rpc ?? solanaRpc }),
|
|
3873
4041
|
previewSolanaSource: (input) => previewSolanaSource(api, input),
|
|
4042
|
+
trackDelivery: (hash) => fetchDelivery(api, hash),
|
|
4043
|
+
fetchWalletHistory: (wallets) => fetchWalletHistory(api, wallets),
|
|
3874
4044
|
readSolanaBalance: (owner, mint) => readSolanaBalance(solanaRpc, owner, mint),
|
|
3875
4045
|
simulateSolanaCost: (plan) => simulateSolanaCost(solanaRpc, plan),
|
|
3876
4046
|
payerNonceBaseline: verifier.payerNonceBaseline,
|
|
@@ -3889,4 +4059,4 @@ function createEngine(config = {}) {
|
|
|
3889
4059
|
};
|
|
3890
4060
|
}
|
|
3891
4061
|
|
|
3892
|
-
export { API_CACHE_TTL_MS, BLOCK_LABEL_DEFAULT, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CANONICAL_SOLANA_PROGRAM, CHAIN_DISPLAY_NAMES, COMPLIANCE_CHECK_ORDER, COMPLIANCE_DENY_LABEL, DEFAULT_WIDGET_API_BASE, DIRECT_CHECK_IDS, DIRECT_SCOPE_NOTE, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, FLOOR_CATEGORIES, LZ_FEE_BUFFER_BPS, MAX_LZ_MSG_VALUE_WEI, MAX_LZ_MSG_VALUE_WEI_BY_CHAIN, MAX_QUOTE_CANDIDATES, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, PREVIEW_OWNER, QUOTE_BUFFER_BPS, SAME_CLASS_STABLE, SCREENING_BUCKETS, SCREEN_CACHE_TTL_MS, SOLANA_CHAIN_ID, SOLANA_DESTINATION_ASSETS, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_DISCRIMINATOR, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, SolanaSendError, TRADEABLE_RWA_ASSETS, TUNABLE_CATEGORIES, ZERO_ADDRESS, addressWord, allowanceCovers, amountFieldError, apiError, applyLayerZeroBuffer, askCovers, askTokenDecimals, assertAddress, assertChainAddress, assertQuoteMatchesSelection, assertWalletMessage, assetClassOf, assetDecimals, associatedTokenAddress, base58Decode, base58Encode, base64Decode, base64Encode, blockLabelFor, brokenLaneFor, brokenLaneReason, buildCatalogue, buildPayOptions, buildRoute, buildSolanaSourcePlan, buildSwapPlan, bytes32Word, bytesEqual, bytesPayload, canAttachApiKey, categoryLabel, chainAddressKey, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, checkSolanaPlan, checkSolanaProgram, checkSolanaReceiver, checkSolanaRouteBuffer, classifyQuoteError, complianceChecks, complianceControlsEvaluated, complianceControlsLine, complianceReasonHead, complianceReasonTag, complianceTagOf, complianceView, cosignSolanaEvent, counterpartTokens, createApiClient, createEngine, createSolanaRpc, createVerifier, decodeSolanaSubmitOrder, decodeSubmitOrderCalldata, deriveSolanaEvent, destinationAvailability, destinationKeys, directComplianceFromScreens, distinctScreenedWallets, encodeAllowance, encodeApprove, encodeBalanceOf, encodeNextSolanaOrders, encodeSubmitOrder, encodeTransfer, exceedsLaneLimit, executableRoutes, executeSolanaPlan, executeSolanaPlanStaged, executionChainIds, expectedSolanaDelivery, fetchPaymentPlan, finalOf, findProgramAddress, findToken, foldTicker, formatJurisdiction, formatNative, formatUnits, hasReachableDestination, hexBytes, hexToSolanaKey, hubDeliverableSymbols, humanizeComplianceReason, isAddress, isChainAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isOnEd25519Curve, isPreparationInstruction, isSolanaAddress, isSolanaChainId, isSourceToken, isSubmitOrder, laneAvailabilityState, laneKey, laneKeys, laneLimitAmount, laneLimitError, laneLimitFor, laneLimitHint, laneLimitSymbol, limitedLanes, maxDeadlineSeconds, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, overwriteBlockhash, parseAddressLookupTable, parseAllowedApiBase, parseSolanaTransaction, parseUnitsDecimal, placeSignature, planErrorSummary, planMsgValueHex, pollSolanaConfirmation, previewSolanaSource, productAssets, quotePartnerId, quotePayOption, quoteSolanaSource, quoteSwapPreview, readSolanaBalance, recommendedDeadlineSeconds, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSolanaKeys, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, screeningOutcomeOf, serializeSolanaTransaction, sha256, simulateSolanaCost, solanaBridgeOf, solanaDestinationAsset, solanaKeyBytes, solanaKeyHex, solanaPlanNeedsPreparation, solveExactIn, solveExactOut, sourceKeys, stableGenieIntentSchema, strip0x, suppressedLanes, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenKey, tokenTicker, txMatchesPlan, uint64Word, uintWord, unattributedComplianceReasons, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, verifySolanaSubmit, verifySolanaTransaction, withVaultArtwork };
|
|
4062
|
+
export { API_CACHE_TTL_MS, BLOCK_LABEL_DEFAULT, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CANONICAL_SOLANA_PROGRAM, CHAIN_DISPLAY_NAMES, COMPLIANCE_CHECK_ORDER, COMPLIANCE_DENY_LABEL, DEFAULT_WIDGET_API_BASE, DIRECT_CHECK_IDS, DIRECT_SCOPE_NOTE, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, FLOOR_CATEGORIES, LZ_FEE_BUFFER_BPS, MAX_LZ_MSG_VALUE_WEI, MAX_LZ_MSG_VALUE_WEI_BY_CHAIN, MAX_QUOTE_CANDIDATES, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, PREVIEW_OWNER, QUOTE_BUFFER_BPS, SAME_CLASS_STABLE, SCREENING_BUCKETS, SCREEN_CACHE_TTL_MS, SOLANA_CHAIN_ID, SOLANA_DESTINATION_ASSETS, SOL_SHORTFALL_MESSAGE, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_DISCRIMINATOR, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, SolanaSendError, TRACKING, TRADEABLE_RWA_ASSETS, TUNABLE_CATEGORIES, WALLET_HISTORY_LIMIT, ZERO_ADDRESS, addressWord, allowanceCovers, amountFieldError, apiError, applyLayerZeroBuffer, askCovers, askTokenDecimals, assertAddress, assertChainAddress, assertQuoteMatchesSelection, assertWalletMessage, assetClassOf, assetDecimals, associatedTokenAddress, base58Decode, base58Encode, base64Decode, base64Encode, blockLabelFor, brokenLaneFor, brokenLaneReason, buildCatalogue, buildPayOptions, buildRoute, buildSolanaSourcePlan, buildSwapPlan, bytes32Word, bytesEqual, bytesPayload, canAttachApiKey, categoryLabel, chainAddressKey, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, checkSolanaPlan, checkSolanaProgram, checkSolanaReceiver, checkSolanaRouteBuffer, classifyQuoteError, complianceChecks, complianceControlsEvaluated, complianceControlsLine, complianceReasonHead, complianceReasonTag, complianceTagOf, complianceView, cosignSolanaEvent, counterpartTokens, createApiClient, createEngine, createSolanaRpc, createVerifier, decodeSolanaSubmitOrder, decodeSubmitOrderCalldata, deriveSolanaEvent, destinationAvailability, destinationKeys, directComplianceFromScreens, distinctScreenedWallets, encodeAllowance, encodeApprove, encodeBalanceOf, encodeNextSolanaOrders, encodeSubmitOrder, encodeTransfer, exceedsLaneLimit, executableRoutes, executeSolanaPlan, executeSolanaPlanStaged, executionChainIds, expectedSolanaDelivery, fetchDelivery, fetchPaymentPlan, fetchWalletHistory, finalOf, findProgramAddress, findToken, foldTicker, formatJurisdiction, formatNative, formatUnits, hasReachableDestination, hexBytes, hexToSolanaKey, historyEntryFromOrder, historyKey, hubDeliverableSymbols, humanizeComplianceReason, isAddress, isChainAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isOnEd25519Curve, isPreparationInstruction, isSolanaAddress, isSolanaChainId, isSourceToken, isSubmitOrder, laneAvailabilityState, laneKey, laneKeys, laneLimitAmount, laneLimitError, laneLimitFor, laneLimitHint, laneLimitSymbol, limitedLanes, maxDeadlineSeconds, maxNativeFeeWei, mergeHistory, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeDelivery, normalizeOrderRequest, normalizeOrderRequests, overwriteBlockhash, parseAddressLookupTable, parseAllowedApiBase, parseSolanaTransaction, parseUnitsDecimal, placeSignature, planErrorSummary, planMsgValueHex, pollSolanaConfirmation, previewSolanaSource, productAssets, quotePartnerId, quotePayOption, quoteSolanaSource, quoteSwapPreview, readSolanaBalance, recommendedDeadlineSeconds, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSolanaKeys, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, screeningOutcomeOf, serializeSolanaTransaction, sha256, simulateSolanaCost, solanaBridgeOf, solanaDestinationAsset, solanaKeyBytes, solanaKeyHex, solanaLamportShortfall, solanaPlanNeedsPreparation, solanaQuoteCompliance, solveExactIn, solveExactOut, sourceKeys, stableGenieIntentSchema, strip0x, suppressedLanes, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenKey, tokenTicker, txMatchesPlan, uint64Word, uintWord, unattributedComplianceReasons, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, verifySolanaSubmit, verifySolanaTransaction, withVaultArtwork };
|