@anywalletkit/protocol-swap2-stargate 0.0.0-stage → 0.1.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 +202 -0
- package/README.md +502 -2
- package/dist/abi.cjs +91 -0
- package/dist/abi.cjs.map +1 -0
- package/dist/abi.d.cts +810 -0
- package/dist/abi.d.ts +810 -0
- package/dist/abi.js +13 -0
- package/dist/abi.js.map +1 -0
- package/dist/amounts.cjs +73 -0
- package/dist/amounts.cjs.map +1 -0
- package/dist/amounts.d.cts +21 -0
- package/dist/amounts.d.ts +21 -0
- package/dist/amounts.js +15 -0
- package/dist/amounts.js.map +1 -0
- package/dist/bus-Cdw8iwOv.d.cts +59 -0
- package/dist/bus-vAWqTAkq.d.ts +59 -0
- package/dist/bus.cjs +237 -0
- package/dist/bus.cjs.map +1 -0
- package/dist/bus.d.cts +4 -0
- package/dist/bus.d.ts +4 -0
- package/dist/bus.js +22 -0
- package/dist/bus.js.map +1 -0
- package/dist/chunk-3NTMZUAU.js +128 -0
- package/dist/chunk-3NTMZUAU.js.map +1 -0
- package/dist/chunk-4HU46QF2.js +256 -0
- package/dist/chunk-4HU46QF2.js.map +1 -0
- package/dist/chunk-4IDDRIE2.js +125 -0
- package/dist/chunk-4IDDRIE2.js.map +1 -0
- package/dist/chunk-EANM3EI3.js +71 -0
- package/dist/chunk-EANM3EI3.js.map +1 -0
- package/dist/chunk-ERC6LKMN.js +87 -0
- package/dist/chunk-ERC6LKMN.js.map +1 -0
- package/dist/chunk-FLAXDJPE.js +24 -0
- package/dist/chunk-FLAXDJPE.js.map +1 -0
- package/dist/chunk-N54YIG6T.js +33 -0
- package/dist/chunk-N54YIG6T.js.map +1 -0
- package/dist/chunk-OUGUX3JK.js +53 -0
- package/dist/chunk-OUGUX3JK.js.map +1 -0
- package/dist/chunk-PJXDMVW3.js +909 -0
- package/dist/chunk-PJXDMVW3.js.map +1 -0
- package/dist/chunk-QNVTQEOV.js +72 -0
- package/dist/chunk-QNVTQEOV.js.map +1 -0
- package/dist/chunk-UDJL7BUP.js +249 -0
- package/dist/chunk-UDJL7BUP.js.map +1 -0
- package/dist/chunk-YHHV3XHY.js +139 -0
- package/dist/chunk-YHHV3XHY.js.map +1 -0
- package/dist/compose-dex.cjs +148 -0
- package/dist/compose-dex.cjs.map +1 -0
- package/dist/compose-dex.d.cts +113 -0
- package/dist/compose-dex.d.ts +113 -0
- package/dist/compose-dex.js +25 -0
- package/dist/compose-dex.js.map +1 -0
- package/dist/compose-route.cjs +1019 -0
- package/dist/compose-route.cjs.map +1 -0
- package/dist/compose-route.d.cts +93 -0
- package/dist/compose-route.d.ts +93 -0
- package/dist/compose-route.js +45 -0
- package/dist/compose-route.js.map +1 -0
- package/dist/compose.cjs +287 -0
- package/dist/compose.cjs.map +1 -0
- package/dist/compose.d.cts +293 -0
- package/dist/compose.d.ts +293 -0
- package/dist/compose.js +30 -0
- package/dist/compose.js.map +1 -0
- package/dist/deployments.cjs +350 -0
- package/dist/deployments.cjs.map +1 -0
- package/dist/deployments.d.cts +12 -0
- package/dist/deployments.d.ts +12 -0
- package/dist/deployments.js +11 -0
- package/dist/deployments.js.map +1 -0
- package/dist/index.cjs +1862 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/native-drop.cjs +117 -0
- package/dist/native-drop.cjs.map +1 -0
- package/dist/native-drop.d.cts +13 -0
- package/dist/native-drop.d.ts +13 -0
- package/dist/native-drop.js +11 -0
- package/dist/native-drop.js.map +1 -0
- package/dist/pins.cjs +1618 -0
- package/dist/pins.cjs.map +1 -0
- package/dist/pins.d.cts +39 -0
- package/dist/pins.d.ts +39 -0
- package/dist/pins.js +21 -0
- package/dist/pins.js.map +1 -0
- package/dist/protocol.cjs +1851 -0
- package/dist/protocol.cjs.map +1 -0
- package/dist/protocol.d.cts +24 -0
- package/dist/protocol.d.ts +24 -0
- package/dist/protocol.js +18 -0
- package/dist/protocol.js.map +1 -0
- package/dist/provider.cjs +1833 -0
- package/dist/provider.cjs.map +1 -0
- package/dist/provider.d.cts +30 -0
- package/dist/provider.d.ts +30 -0
- package/dist/provider.js +17 -0
- package/dist/provider.js.map +1 -0
- package/dist/quote-r1bA8XbO.d.cts +102 -0
- package/dist/quote-t7UJSxbU.d.ts +102 -0
- package/dist/quote.cjs +618 -0
- package/dist/quote.cjs.map +1 -0
- package/dist/quote.d.cts +3 -0
- package/dist/quote.d.ts +3 -0
- package/dist/quote.js +16 -0
- package/dist/quote.js.map +1 -0
- package/dist/registry.cjs +100 -0
- package/dist/registry.cjs.map +1 -0
- package/dist/registry.d.cts +42 -0
- package/dist/registry.d.ts +42 -0
- package/dist/registry.js +8 -0
- package/dist/registry.js.map +1 -0
- package/dist/tracking.cjs +1143 -0
- package/dist/tracking.cjs.map +1 -0
- package/dist/tracking.d.cts +57 -0
- package/dist/tracking.d.ts +57 -0
- package/dist/tracking.js +23 -0
- package/dist/tracking.js.map +1 -0
- package/package.json +134 -3
package/dist/quote.cjs
ADDED
|
@@ -0,0 +1,618 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/quote.ts
|
|
21
|
+
var quote_exports = {};
|
|
22
|
+
__export(quote_exports, {
|
|
23
|
+
createStargateQuoter: () => createStargateQuoter,
|
|
24
|
+
stargateComposeOptions: () => stargateComposeOptions,
|
|
25
|
+
taxiNativeDrop: () => taxiNativeDrop
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(quote_exports);
|
|
28
|
+
var import_viem4 = require("viem");
|
|
29
|
+
|
|
30
|
+
// src/abi.ts
|
|
31
|
+
var import_viem = require("viem");
|
|
32
|
+
var EXECUTOR_ABI = (0, import_viem.parseAbi)([
|
|
33
|
+
"struct Origin { uint32 srcEid; bytes32 sender; uint64 nonce; }",
|
|
34
|
+
"struct NativeDropParams { address receiver; uint256 amount; }",
|
|
35
|
+
"function endpoint() view returns (address)",
|
|
36
|
+
"function localEid() view returns (uint32)",
|
|
37
|
+
"event NativeDropApplied(Origin origin, uint32 dstEid, address oapp, NativeDropParams[] params, bool[] success)"
|
|
38
|
+
]);
|
|
39
|
+
var ENDPOINT_ABI = (0, import_viem.parseAbi)([
|
|
40
|
+
"struct Origin { uint32 srcEid; bytes32 sender; uint64 nonce; }",
|
|
41
|
+
"function inboundPayloadHash(address receiver, uint32 srcEid, bytes32 sender, uint64 nonce) view returns (bytes32)",
|
|
42
|
+
"function lzReceive(Origin origin, address receiver, bytes32 guid, bytes message, bytes extraData) payable",
|
|
43
|
+
"event PacketSent(bytes encodedPayload, bytes options, address sendLibrary)",
|
|
44
|
+
"event PacketDelivered(Origin origin, address receiver)"
|
|
45
|
+
]);
|
|
46
|
+
var STARGATE_ABI = (0, import_viem.parseAbi)([
|
|
47
|
+
"struct SendParam { uint32 dstEid; bytes32 to; uint256 amountLD; uint256 minAmountLD; bytes extraOptions; bytes composeMsg; bytes oftCmd; }",
|
|
48
|
+
"struct MessagingFee { uint256 nativeFee; uint256 lzTokenFee; }",
|
|
49
|
+
"struct MessagingReceipt { bytes32 guid; uint64 nonce; MessagingFee fee; }",
|
|
50
|
+
"struct OFTLimit { uint256 minAmountLD; uint256 maxAmountLD; }",
|
|
51
|
+
"struct OFTFeeDetail { int256 feeAmountLD; string description; }",
|
|
52
|
+
"struct OFTReceipt { uint256 amountSentLD; uint256 amountReceivedLD; }",
|
|
53
|
+
"struct Ticket { uint72 ticketId; bytes passengerBytes; }",
|
|
54
|
+
"struct AddressConfig { address feeLib; address planner; address treasurer; address tokenMessaging; address creditMessaging; address lzToken; }",
|
|
55
|
+
"function token() view returns (address)",
|
|
56
|
+
"function sharedDecimals() view returns (uint8)",
|
|
57
|
+
"function approvalRequired() pure returns (bool)",
|
|
58
|
+
"function localEid() view returns (uint32)",
|
|
59
|
+
"function endpoint() view returns (address)",
|
|
60
|
+
"function status() view returns (uint8)",
|
|
61
|
+
"function stargateType() pure returns (uint8)",
|
|
62
|
+
"function paths(uint32 eid) view returns (uint64 credit)",
|
|
63
|
+
"function getAddressConfig() view returns (AddressConfig)",
|
|
64
|
+
"function quoteOFT(SendParam s) view returns (OFTLimit limit, OFTFeeDetail[] oftFeeDetails, OFTReceipt receipt)",
|
|
65
|
+
"function quoteSend(SendParam s, bool payInLzToken) view returns (MessagingFee fee)",
|
|
66
|
+
"function send(SendParam s, MessagingFee fee, address refundAddress) payable returns (MessagingReceipt msgReceipt, OFTReceipt oftReceipt)",
|
|
67
|
+
"function sendToken(SendParam s, MessagingFee fee, address refundAddress) payable returns (MessagingReceipt msgReceipt, OFTReceipt oftReceipt, Ticket ticket)",
|
|
68
|
+
"function unreceivedTokens(bytes32 guid, uint8 index) view returns (bytes32)",
|
|
69
|
+
"function retryReceiveToken(bytes32 guid, uint8 index, uint32 srcEid, address receiver, uint256 amountLD, bytes composeMsg)",
|
|
70
|
+
"event OFTSent(bytes32 indexed guid, uint32 dstEid, address indexed fromAddress, uint256 amountSentLD, uint256 amountReceivedLD)",
|
|
71
|
+
"event OFTReceived(bytes32 indexed guid, uint32 srcEid, address indexed toAddress, uint256 amountReceivedLD)",
|
|
72
|
+
"event UnreceivedTokenCached(bytes32 guid, uint8 index, uint32 srcEid, address receiver, uint256 amountLD, bytes composeMsg)"
|
|
73
|
+
]);
|
|
74
|
+
var TOKEN_MESSAGING_ABI = (0, import_viem.parseAbi)([
|
|
75
|
+
"error Bus_InvalidFare(bool nativeDrop)",
|
|
76
|
+
"struct MessagingFee { uint256 nativeFee; uint256 lzTokenFee; }",
|
|
77
|
+
"struct MessagingReceipt { bytes32 guid; uint64 nonce; MessagingFee fee; }",
|
|
78
|
+
"function assetIds(address stargateImpl) view returns (uint16)",
|
|
79
|
+
"function stargateImpls(uint16 assetId) view returns (address)",
|
|
80
|
+
"function peers(uint32 eid) view returns (bytes32)",
|
|
81
|
+
"function endpoint() view returns (address)",
|
|
82
|
+
"function nativeDropAmounts(uint32 eid) view returns (uint128)",
|
|
83
|
+
"function queueCapacity() view returns (uint16)",
|
|
84
|
+
"function busQueues(uint32 eid) view returns (uint8 maxNumPassengers, uint80 busFare, uint80 busAndNativeDropFare, uint16 qLength, uint72 nextTicketId)",
|
|
85
|
+
"function getPassengerHash(uint32 eid, uint16 index) view returns (bytes32)",
|
|
86
|
+
"function quoteDriveBus(uint32 dstEid, bytes passengers) view returns (MessagingFee fee)",
|
|
87
|
+
"function driveBus(uint32 dstEid, bytes passengers) payable returns (MessagingReceipt receipt)",
|
|
88
|
+
"event BusRode(uint32 dstEid, uint72 ticketId, uint80 fare, bytes passenger)",
|
|
89
|
+
"event BusDriven(uint32 dstEid, uint72 startTicketId, uint8 numPassengers, bytes32 guid)",
|
|
90
|
+
"event NativeDropApplied(address receiver, uint128 amount)",
|
|
91
|
+
"event NativeDropFailed(address receiver, uint128 amount)"
|
|
92
|
+
]);
|
|
93
|
+
|
|
94
|
+
// src/amounts.ts
|
|
95
|
+
var UINT64_MAX = (1n << 64n) - 1n;
|
|
96
|
+
var UINT256_MAX = (1n << 256n) - 1n;
|
|
97
|
+
function uint256(amount) {
|
|
98
|
+
if (typeof amount !== "bigint" || amount < 0n || amount > UINT256_MAX) throw new RangeError("stargate: amount must be uint256 bigint");
|
|
99
|
+
}
|
|
100
|
+
function conversionRate(localDecimals, sharedDecimals) {
|
|
101
|
+
if (!Number.isInteger(localDecimals) || !Number.isInteger(sharedDecimals) || sharedDecimals < 0 || localDecimals < sharedDecimals || localDecimals > 255 || localDecimals - sharedDecimals > 77) {
|
|
102
|
+
throw new RangeError("stargate: invalid local/shared decimals");
|
|
103
|
+
}
|
|
104
|
+
return 10n ** BigInt(localDecimals - sharedDecimals);
|
|
105
|
+
}
|
|
106
|
+
function splitSourceAmount(amountLD, localDecimals, sharedDecimals) {
|
|
107
|
+
uint256(amountLD);
|
|
108
|
+
const rate = conversionRate(localDecimals, sharedDecimals);
|
|
109
|
+
const amountSD = amountLD / rate;
|
|
110
|
+
if (amountSD > UINT64_MAX) throw new RangeError("stargate: shared amount exceeds uint64");
|
|
111
|
+
return { amountSD, sentLD: amountSD * rate, dustLD: amountLD % rate };
|
|
112
|
+
}
|
|
113
|
+
function destinationAmount(receivedSourceLD, sourceDecimals, destinationDecimals, sharedDecimals) {
|
|
114
|
+
const { amountSD, dustLD } = splitSourceAmount(receivedSourceLD, sourceDecimals, sharedDecimals);
|
|
115
|
+
if (dustLD !== 0n) throw new RangeError("stargate: quote receipt is not shared-decimal aligned");
|
|
116
|
+
const amount = amountSD * conversionRate(destinationDecimals, sharedDecimals);
|
|
117
|
+
uint256(amount);
|
|
118
|
+
return amount;
|
|
119
|
+
}
|
|
120
|
+
function sourceMinimum(minDestinationLD, sourceDecimals, destinationDecimals, sharedDecimals) {
|
|
121
|
+
uint256(minDestinationLD);
|
|
122
|
+
const destinationRate = conversionRate(destinationDecimals, sharedDecimals);
|
|
123
|
+
const minimumSD = (minDestinationLD + destinationRate - 1n) / destinationRate;
|
|
124
|
+
if (minimumSD > UINT64_MAX) throw new RangeError("stargate: minimum exceeds uint64 shared amount");
|
|
125
|
+
const minimumLD = minimumSD * conversionRate(sourceDecimals, sharedDecimals);
|
|
126
|
+
uint256(minimumLD);
|
|
127
|
+
return minimumLD;
|
|
128
|
+
}
|
|
129
|
+
function splitFeeDetails(details) {
|
|
130
|
+
let feeLD = 0n, rewardLD = 0n;
|
|
131
|
+
for (const { feeAmountLD } of details) {
|
|
132
|
+
if (typeof feeAmountLD !== "bigint" || feeAmountLD < -(1n << 255n) || feeAmountLD >= 1n << 255n) throw new RangeError("stargate: fee must be int256 bigint");
|
|
133
|
+
if (feeAmountLD < 0n) feeLD -= feeAmountLD;
|
|
134
|
+
else rewardLD += feeAmountLD;
|
|
135
|
+
}
|
|
136
|
+
return { feeLD, rewardLD };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// src/registry.ts
|
|
140
|
+
var import_viem2 = require("viem");
|
|
141
|
+
function boundedInteger(value, max, name) {
|
|
142
|
+
if (!Number.isSafeInteger(value) || value <= 0 || value > max) throw new Error(`stargate registry: invalid ${name}`);
|
|
143
|
+
}
|
|
144
|
+
function address(value, nonzero) {
|
|
145
|
+
if (!(0, import_viem2.isAddress)(value) || nonzero && value.toLowerCase() === import_viem2.zeroAddress) throw new Error("stargate registry: invalid address");
|
|
146
|
+
return (0, import_viem2.getAddress)(value);
|
|
147
|
+
}
|
|
148
|
+
function createStargateRegistry(input, inputPaths) {
|
|
149
|
+
const ids = /* @__PURE__ */ new Map();
|
|
150
|
+
const tokens = /* @__PURE__ */ new Map();
|
|
151
|
+
const contracts = /* @__PURE__ */ new Set();
|
|
152
|
+
const chains = /* @__PURE__ */ new Map();
|
|
153
|
+
const eids = /* @__PURE__ */ new Map();
|
|
154
|
+
const shared = /* @__PURE__ */ new Map();
|
|
155
|
+
const deployments2 = Object.freeze(input.map((raw) => {
|
|
156
|
+
boundedInteger(raw.chainId, Number.MAX_SAFE_INTEGER, "chainId");
|
|
157
|
+
boundedInteger(raw.eid, 4294967295, "eid");
|
|
158
|
+
boundedInteger(raw.assetId, 65535, "assetId");
|
|
159
|
+
if (raw.chain !== `eip155:${raw.chainId}`) throw new Error("stargate registry: chainId mismatch");
|
|
160
|
+
conversionRate(raw.localDecimals, raw.sharedDecimals);
|
|
161
|
+
if (!["pool", "oft", "native"].includes(raw.kind) || typeof raw.approvalRequired !== "boolean" || typeof raw.symbol !== "string" || !raw.symbol.trim()) throw new Error("stargate registry: malformed deployment");
|
|
162
|
+
const d = Object.freeze({ ...raw, token: address(raw.token, false), address: address(raw.address, true), tokenMessaging: address(raw.tokenMessaging, true), endpoint: address(raw.endpoint, true) });
|
|
163
|
+
if (d.kind === "native" !== (d.token === import_viem2.zeroAddress)) throw new Error("stargate registry: native token mismatch");
|
|
164
|
+
const identity = `${d.chain}:${d.assetId}`;
|
|
165
|
+
const tokenKey = `${d.chain}:${d.token.toLowerCase()}`;
|
|
166
|
+
const contractKey = `${d.chain}:${d.address.toLowerCase()}`;
|
|
167
|
+
if (ids.has(identity) || tokens.has(tokenKey) || contracts.has(contractKey)) throw new Error("stargate registry: duplicate deployment");
|
|
168
|
+
const chain = chains.get(d.chain);
|
|
169
|
+
if (chain && (chain.eid !== d.eid || chain.tokenMessaging !== d.tokenMessaging || chain.endpoint !== d.endpoint)) throw new Error("stargate registry: inconsistent chain messaging");
|
|
170
|
+
if (eids.has(d.eid) && eids.get(d.eid) !== d.chain) throw new Error("stargate registry: eid names multiple chains");
|
|
171
|
+
if (shared.has(d.assetId) && shared.get(d.assetId) !== d.sharedDecimals) throw new Error("stargate registry: incompatible shared decimals");
|
|
172
|
+
ids.set(identity, d);
|
|
173
|
+
tokens.set(tokenKey, d);
|
|
174
|
+
contracts.add(contractKey);
|
|
175
|
+
chains.set(d.chain, d);
|
|
176
|
+
eids.set(d.eid, d.chain);
|
|
177
|
+
shared.set(d.assetId, d.sharedDecimals);
|
|
178
|
+
return d;
|
|
179
|
+
}));
|
|
180
|
+
const pathKeys = /* @__PURE__ */ new Set();
|
|
181
|
+
const paths2 = Object.freeze(inputPaths.map((path) => {
|
|
182
|
+
if (path.source === path.destination || !chains.has(path.source) || !chains.has(path.destination)) throw new Error("stargate registry: invalid path");
|
|
183
|
+
const key = `${path.source}>${path.destination}`;
|
|
184
|
+
if (pathKeys.has(key)) throw new Error("stargate registry: duplicate path");
|
|
185
|
+
pathKeys.add(key);
|
|
186
|
+
return Object.freeze({ source: path.source, destination: path.destination });
|
|
187
|
+
}));
|
|
188
|
+
const lookup = (chain, token) => chains.has(chain) && (0, import_viem2.isAddress)(token, { strict: false }) ? tokens.get(`${chain}:${token.toLowerCase()}`) : void 0;
|
|
189
|
+
return Object.freeze({
|
|
190
|
+
deployments: deployments2,
|
|
191
|
+
paths: paths2,
|
|
192
|
+
find: lookup,
|
|
193
|
+
route(sourceChain, sourceToken, destinationChain, destinationToken) {
|
|
194
|
+
if (!pathKeys.has(`${sourceChain}>${destinationChain}`)) return void 0;
|
|
195
|
+
const source = lookup(sourceChain, sourceToken), destination = lookup(destinationChain, destinationToken);
|
|
196
|
+
return source && destination && source.assetId === destination.assetId ? { source, destination } : void 0;
|
|
197
|
+
},
|
|
198
|
+
callTargets: (chain) => Object.freeze(deployments2.filter((d) => d.chain === chain).map((d) => d.address)),
|
|
199
|
+
spenders: (chain) => Object.freeze(deployments2.filter((d) => d.chain === chain && d.kind !== "native" && d.approvalRequired).map((d) => d.address))
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// src/deployments.ts
|
|
204
|
+
var STARGATE_REGISTRY_EVIDENCE = Object.freeze({
|
|
205
|
+
"upstreamCommit": "414f47412123d7737520c6ba331c1376ec874a88",
|
|
206
|
+
"capturedAt": "2026-11-16T14:40:36.782Z",
|
|
207
|
+
"sha256": "ab4fba3cc845a3dcb8a804bffc6a53d7f7982bf974b45cec686095eefb70426f"
|
|
208
|
+
});
|
|
209
|
+
var deployments = [
|
|
210
|
+
{ "chain": "eip155:42161", "chainId": 42161, "eid": 30110, "assetId": 1, "symbol": "USDC", "token": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "address": "0xe8CDF27AcD73a434D661C84887215F7598e7d0d3", "tokenMessaging": "0x19cFCE47eD54a88614648DC3f19A5980097007dD", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 6, "sharedDecimals": 6, "kind": "pool", "approvalRequired": true },
|
|
211
|
+
{ "chain": "eip155:42161", "chainId": 42161, "eid": 30110, "assetId": 13, "symbol": "ETH", "token": "0x0000000000000000000000000000000000000000", "address": "0xA45B5130f36CDcA45667738e2a258AB09f4A5f7F", "tokenMessaging": "0x19cFCE47eD54a88614648DC3f19A5980097007dD", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 18, "sharedDecimals": 6, "kind": "native", "approvalRequired": true },
|
|
212
|
+
{ "chain": "eip155:43114", "chainId": 43114, "eid": 30106, "assetId": 1, "symbol": "USDC", "token": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", "address": "0x5634c4a5FEd09819E3c46D86A965Dd9447d86e47", "tokenMessaging": "0x17E450Be3Ba9557F2378E20d64AD417E59Ef9A34", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 6, "sharedDecimals": 6, "kind": "pool", "approvalRequired": true },
|
|
213
|
+
{ "chain": "eip155:43114", "chainId": 43114, "eid": 30106, "assetId": 2, "symbol": "USDt", "token": "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", "address": "0x12dC9256Acc9895B076f6638D628382881e62CeE", "tokenMessaging": "0x17E450Be3Ba9557F2378E20d64AD417E59Ef9A34", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 6, "sharedDecimals": 6, "kind": "pool", "approvalRequired": true },
|
|
214
|
+
{ "chain": "eip155:8453", "chainId": 8453, "eid": 30184, "assetId": 1, "symbol": "USDC", "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x27a16dc786820B16E5c9028b75B99F6f604b5d26", "tokenMessaging": "0x5634c4a5FEd09819E3c46D86A965Dd9447d86e47", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 6, "sharedDecimals": 6, "kind": "pool", "approvalRequired": true },
|
|
215
|
+
{ "chain": "eip155:8453", "chainId": 8453, "eid": 30184, "assetId": 13, "symbol": "ETH", "token": "0x0000000000000000000000000000000000000000", "address": "0xdc181Bd607330aeeBEF6ea62e03e5e1Fb4B6F7C7", "tokenMessaging": "0x5634c4a5FEd09819E3c46D86A965Dd9447d86e47", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 18, "sharedDecimals": 6, "kind": "native", "approvalRequired": true },
|
|
216
|
+
{ "chain": "eip155:56", "chainId": 56, "eid": 30102, "assetId": 1, "symbol": "USDC", "token": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", "address": "0x962Bd449E630b0d928f308Ce63f1A21F02576057", "tokenMessaging": "0x6E3d884C96d640526F273C61dfcF08915eBd7e2B", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 18, "sharedDecimals": 6, "kind": "pool", "approvalRequired": true },
|
|
217
|
+
{ "chain": "eip155:56", "chainId": 56, "eid": 30102, "assetId": 2, "symbol": "USDT", "token": "0x55d398326f99059fF775485246999027B3197955", "address": "0x138EB30f73BC423c6455C53df6D89CB01d9eBc63", "tokenMessaging": "0x6E3d884C96d640526F273C61dfcF08915eBd7e2B", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 18, "sharedDecimals": 6, "kind": "pool", "approvalRequired": true },
|
|
218
|
+
{ "chain": "eip155:1", "chainId": 1, "eid": 30101, "assetId": 1, "symbol": "USDC", "token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "address": "0xc026395860Db2d07ee33e05fE50ed7bD583189C7", "tokenMessaging": "0x6d6620eFa72948C5f68A3C8646d58C00d3f4A980", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 6, "sharedDecimals": 6, "kind": "pool", "approvalRequired": true },
|
|
219
|
+
{ "chain": "eip155:1", "chainId": 1, "eid": 30101, "assetId": 2, "symbol": "USDT", "token": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "address": "0x933597a323Eb81cAe705C5bC29985172fd5A3973", "tokenMessaging": "0x6d6620eFa72948C5f68A3C8646d58C00d3f4A980", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 6, "sharedDecimals": 6, "kind": "pool", "approvalRequired": true },
|
|
220
|
+
{ "chain": "eip155:1", "chainId": 1, "eid": 30101, "assetId": 13, "symbol": "ETH", "token": "0x0000000000000000000000000000000000000000", "address": "0x77b2043768d28E9C9aB44E1aBfC95944bcE57931", "tokenMessaging": "0x6d6620eFa72948C5f68A3C8646d58C00d3f4A980", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 18, "sharedDecimals": 6, "kind": "native", "approvalRequired": true },
|
|
221
|
+
{ "chain": "eip155:14", "chainId": 14, "eid": 30295, "assetId": 1, "symbol": "USDC.e", "token": "0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6", "address": "0x77C71633C34C3784ede189d74223122422492a0f", "tokenMessaging": "0x45d417612e177672958dC0537C45a8f8d754Ac2E", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 6, "sharedDecimals": 6, "kind": "oft", "approvalRequired": true },
|
|
222
|
+
{ "chain": "eip155:14", "chainId": 14, "eid": 30295, "assetId": 13, "symbol": "WETH", "token": "0x1502FA4be69d526124D453619276FacCab275d3D", "address": "0x8e8539e4CcD69123c623a106773F2b0cbbc58746", "tokenMessaging": "0x45d417612e177672958dC0537C45a8f8d754Ac2E", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 18, "sharedDecimals": 6, "kind": "oft", "approvalRequired": true },
|
|
223
|
+
{ "chain": "eip155:5000", "chainId": 5e3, "eid": 30181, "assetId": 1, "symbol": "USDC", "token": "0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9", "address": "0xAc290Ad4e0c891FDc295ca4F0a6214cf6dC6acDC", "tokenMessaging": "0x41B491285A4f888F9f636cEc8a363AB9770a0AEF", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 6, "sharedDecimals": 6, "kind": "pool", "approvalRequired": true },
|
|
224
|
+
{ "chain": "eip155:5000", "chainId": 5e3, "eid": 30181, "assetId": 13, "symbol": "WETH", "token": "0xdEAddEaDdeadDEadDEADDEAddEADDEAddead1111", "address": "0x4c1d3Fc3fC3c177c3b633427c2F769276c547463", "tokenMessaging": "0x41B491285A4f888F9f636cEc8a363AB9770a0AEF", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 18, "sharedDecimals": 6, "kind": "pool", "approvalRequired": true },
|
|
225
|
+
{ "chain": "eip155:5000", "chainId": 5e3, "eid": 30181, "assetId": 22, "symbol": "mETH", "token": "0xcDA86A272531e8640cD7F1a92c01839911B90bb0", "address": "0xF7628d84a2BbD9bb9c8E686AC95BB5d55169F3F1", "tokenMessaging": "0x41B491285A4f888F9f636cEc8a363AB9770a0AEF", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 18, "sharedDecimals": 6, "kind": "pool", "approvalRequired": true },
|
|
226
|
+
{ "chain": "eip155:10", "chainId": 10, "eid": 30111, "assetId": 1, "symbol": "USDC", "token": "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", "address": "0xcE8CcA271Ebc0533920C83d39F417ED6A0abB7D0", "tokenMessaging": "0xF1fCb4CBd57B67d683972A59B6a7b1e2E8Bf27E6", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 6, "sharedDecimals": 6, "kind": "pool", "approvalRequired": true },
|
|
227
|
+
{ "chain": "eip155:10", "chainId": 10, "eid": 30111, "assetId": 13, "symbol": "ETH", "token": "0x0000000000000000000000000000000000000000", "address": "0xe8CDF27AcD73a434D661C84887215F7598e7d0d3", "tokenMessaging": "0xF1fCb4CBd57B67d683972A59B6a7b1e2E8Bf27E6", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 18, "sharedDecimals": 6, "kind": "native", "approvalRequired": true },
|
|
228
|
+
{ "chain": "eip155:9745", "chainId": 9745, "eid": 30383, "assetId": 13, "symbol": "WETH", "token": "0x9895D81bB462A195b4922ED7De0e3ACD007c32CB", "address": "0x0cEb237E109eE22374a567c6b09F373C73FA4cBb", "tokenMessaging": "0x102d758f688a4C1C5a80b116bD945d4455460282", "endpoint": "0x6F475642a6e85809B1c36Fa62763669b1b48DD5B", "localDecimals": 18, "sharedDecimals": 6, "kind": "oft", "approvalRequired": true },
|
|
229
|
+
{ "chain": "eip155:98866", "chainId": 98866, "eid": 30370, "assetId": 13, "symbol": "WETH", "token": "0xca59cA09E5602fAe8B629DeE83FfA819741f14be", "address": "0x4683CE822272CD66CEa73F5F1f9f5cBcaEF4F066", "tokenMessaging": "0xf26d57bbE1D99561B13003783b5e040B71AdCb14", "endpoint": "0xC1b15d3B262bEeC0e3565C11C9e0F6134BdaCB36", "localDecimals": 18, "sharedDecimals": 6, "kind": "oft", "approvalRequired": true },
|
|
230
|
+
{ "chain": "eip155:137", "chainId": 137, "eid": 30109, "assetId": 1, "symbol": "USDC", "token": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", "address": "0x9Aa02D4Fae7F58b8E8f34c66E756cC734DAc7fe4", "tokenMessaging": "0x6CE9bf8CDaB780416AD1fd87b318A077D2f50EaC", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 6, "sharedDecimals": 6, "kind": "pool", "approvalRequired": true },
|
|
231
|
+
{ "chain": "eip155:534352", "chainId": 534352, "eid": 30214, "assetId": 13, "symbol": "ETH", "token": "0x0000000000000000000000000000000000000000", "address": "0xC2b638Cb5042c1B3c5d5C969361fB50569840583", "tokenMessaging": "0x4e422B0aCb2Bd7e3aC70B5c0E5eb806e86a94038", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 18, "sharedDecimals": 6, "kind": "native", "approvalRequired": true },
|
|
232
|
+
{ "chain": "eip155:1329", "chainId": 1329, "eid": 30280, "assetId": 13, "symbol": "WETH", "token": "0x160345fC359604fC6e70E3c5fAcbdE5F7A9342d8", "address": "0x5c386D85b1B82FD9Db681b9176C8a4248bb6345B", "tokenMessaging": "0x1502FA4be69d526124D453619276FacCab275d3D", "endpoint": "0x1a44076050125825900e736c501f859c50fE728c", "localDecimals": 18, "sharedDecimals": 6, "kind": "oft", "approvalRequired": true },
|
|
233
|
+
{ "chain": "eip155:146", "chainId": 146, "eid": 30332, "assetId": 1, "symbol": "USDC", "token": "0x29219dd400f2Bf60E5a23d13Be72B486D4038894", "address": "0xA272fFe20cFfe769CdFc4b63088DCD2C82a2D8F9", "tokenMessaging": "0x2086f755A6d9254045C257ea3d382ef854849B0f", "endpoint": "0x6F475642a6e85809B1c36Fa62763669b1b48DD5B", "localDecimals": 6, "sharedDecimals": 6, "kind": "pool", "approvalRequired": true },
|
|
234
|
+
{ "chain": "eip155:130", "chainId": 130, "eid": 30320, "assetId": 13, "symbol": "ETH", "token": "0x0000000000000000000000000000000000000000", "address": "0xe9aBA835f813ca05E50A6C0ce65D0D74390F7dE7", "tokenMessaging": "0xB1EeAD6959cb5bB9B20417d6689922523B2B86C3", "endpoint": "0x6F475642a6e85809B1c36Fa62763669b1b48DD5B", "localDecimals": 18, "sharedDecimals": 6, "kind": "native", "approvalRequired": true }
|
|
235
|
+
];
|
|
236
|
+
var paths = [
|
|
237
|
+
{ "source": "eip155:1", "destination": "eip155:10" },
|
|
238
|
+
{ "source": "eip155:1", "destination": "eip155:130" },
|
|
239
|
+
{ "source": "eip155:1", "destination": "eip155:1329" },
|
|
240
|
+
{ "source": "eip155:1", "destination": "eip155:137" },
|
|
241
|
+
{ "source": "eip155:1", "destination": "eip155:14" },
|
|
242
|
+
{ "source": "eip155:1", "destination": "eip155:146" },
|
|
243
|
+
{ "source": "eip155:1", "destination": "eip155:42161" },
|
|
244
|
+
{ "source": "eip155:1", "destination": "eip155:43114" },
|
|
245
|
+
{ "source": "eip155:1", "destination": "eip155:5000" },
|
|
246
|
+
{ "source": "eip155:1", "destination": "eip155:534352" },
|
|
247
|
+
{ "source": "eip155:1", "destination": "eip155:56" },
|
|
248
|
+
{ "source": "eip155:1", "destination": "eip155:8453" },
|
|
249
|
+
{ "source": "eip155:1", "destination": "eip155:9745" },
|
|
250
|
+
{ "source": "eip155:1", "destination": "eip155:98866" },
|
|
251
|
+
{ "source": "eip155:10", "destination": "eip155:1" },
|
|
252
|
+
{ "source": "eip155:10", "destination": "eip155:130" },
|
|
253
|
+
{ "source": "eip155:10", "destination": "eip155:1329" },
|
|
254
|
+
{ "source": "eip155:10", "destination": "eip155:137" },
|
|
255
|
+
{ "source": "eip155:10", "destination": "eip155:14" },
|
|
256
|
+
{ "source": "eip155:10", "destination": "eip155:146" },
|
|
257
|
+
{ "source": "eip155:10", "destination": "eip155:42161" },
|
|
258
|
+
{ "source": "eip155:10", "destination": "eip155:43114" },
|
|
259
|
+
{ "source": "eip155:10", "destination": "eip155:5000" },
|
|
260
|
+
{ "source": "eip155:10", "destination": "eip155:534352" },
|
|
261
|
+
{ "source": "eip155:10", "destination": "eip155:56" },
|
|
262
|
+
{ "source": "eip155:10", "destination": "eip155:8453" },
|
|
263
|
+
{ "source": "eip155:10", "destination": "eip155:9745" },
|
|
264
|
+
{ "source": "eip155:10", "destination": "eip155:98866" },
|
|
265
|
+
{ "source": "eip155:130", "destination": "eip155:1" },
|
|
266
|
+
{ "source": "eip155:130", "destination": "eip155:10" },
|
|
267
|
+
{ "source": "eip155:130", "destination": "eip155:1329" },
|
|
268
|
+
{ "source": "eip155:130", "destination": "eip155:137" },
|
|
269
|
+
{ "source": "eip155:130", "destination": "eip155:14" },
|
|
270
|
+
{ "source": "eip155:130", "destination": "eip155:146" },
|
|
271
|
+
{ "source": "eip155:130", "destination": "eip155:42161" },
|
|
272
|
+
{ "source": "eip155:130", "destination": "eip155:43114" },
|
|
273
|
+
{ "source": "eip155:130", "destination": "eip155:5000" },
|
|
274
|
+
{ "source": "eip155:130", "destination": "eip155:534352" },
|
|
275
|
+
{ "source": "eip155:130", "destination": "eip155:56" },
|
|
276
|
+
{ "source": "eip155:130", "destination": "eip155:8453" },
|
|
277
|
+
{ "source": "eip155:130", "destination": "eip155:9745" },
|
|
278
|
+
{ "source": "eip155:130", "destination": "eip155:98866" },
|
|
279
|
+
{ "source": "eip155:1329", "destination": "eip155:1" },
|
|
280
|
+
{ "source": "eip155:1329", "destination": "eip155:10" },
|
|
281
|
+
{ "source": "eip155:1329", "destination": "eip155:130" },
|
|
282
|
+
{ "source": "eip155:1329", "destination": "eip155:137" },
|
|
283
|
+
{ "source": "eip155:1329", "destination": "eip155:14" },
|
|
284
|
+
{ "source": "eip155:1329", "destination": "eip155:146" },
|
|
285
|
+
{ "source": "eip155:1329", "destination": "eip155:42161" },
|
|
286
|
+
{ "source": "eip155:1329", "destination": "eip155:43114" },
|
|
287
|
+
{ "source": "eip155:1329", "destination": "eip155:5000" },
|
|
288
|
+
{ "source": "eip155:1329", "destination": "eip155:534352" },
|
|
289
|
+
{ "source": "eip155:1329", "destination": "eip155:56" },
|
|
290
|
+
{ "source": "eip155:1329", "destination": "eip155:8453" },
|
|
291
|
+
{ "source": "eip155:1329", "destination": "eip155:9745" },
|
|
292
|
+
{ "source": "eip155:1329", "destination": "eip155:98866" },
|
|
293
|
+
{ "source": "eip155:137", "destination": "eip155:1" },
|
|
294
|
+
{ "source": "eip155:137", "destination": "eip155:10" },
|
|
295
|
+
{ "source": "eip155:137", "destination": "eip155:130" },
|
|
296
|
+
{ "source": "eip155:137", "destination": "eip155:1329" },
|
|
297
|
+
{ "source": "eip155:137", "destination": "eip155:14" },
|
|
298
|
+
{ "source": "eip155:137", "destination": "eip155:146" },
|
|
299
|
+
{ "source": "eip155:137", "destination": "eip155:42161" },
|
|
300
|
+
{ "source": "eip155:137", "destination": "eip155:43114" },
|
|
301
|
+
{ "source": "eip155:137", "destination": "eip155:5000" },
|
|
302
|
+
{ "source": "eip155:137", "destination": "eip155:534352" },
|
|
303
|
+
{ "source": "eip155:137", "destination": "eip155:56" },
|
|
304
|
+
{ "source": "eip155:137", "destination": "eip155:8453" },
|
|
305
|
+
{ "source": "eip155:137", "destination": "eip155:9745" },
|
|
306
|
+
{ "source": "eip155:137", "destination": "eip155:98866" },
|
|
307
|
+
{ "source": "eip155:14", "destination": "eip155:1" },
|
|
308
|
+
{ "source": "eip155:14", "destination": "eip155:10" },
|
|
309
|
+
{ "source": "eip155:14", "destination": "eip155:130" },
|
|
310
|
+
{ "source": "eip155:14", "destination": "eip155:1329" },
|
|
311
|
+
{ "source": "eip155:14", "destination": "eip155:137" },
|
|
312
|
+
{ "source": "eip155:14", "destination": "eip155:146" },
|
|
313
|
+
{ "source": "eip155:14", "destination": "eip155:42161" },
|
|
314
|
+
{ "source": "eip155:14", "destination": "eip155:43114" },
|
|
315
|
+
{ "source": "eip155:14", "destination": "eip155:5000" },
|
|
316
|
+
{ "source": "eip155:14", "destination": "eip155:534352" },
|
|
317
|
+
{ "source": "eip155:14", "destination": "eip155:56" },
|
|
318
|
+
{ "source": "eip155:14", "destination": "eip155:8453" },
|
|
319
|
+
{ "source": "eip155:14", "destination": "eip155:9745" },
|
|
320
|
+
{ "source": "eip155:14", "destination": "eip155:98866" },
|
|
321
|
+
{ "source": "eip155:146", "destination": "eip155:1" },
|
|
322
|
+
{ "source": "eip155:146", "destination": "eip155:10" },
|
|
323
|
+
{ "source": "eip155:146", "destination": "eip155:130" },
|
|
324
|
+
{ "source": "eip155:146", "destination": "eip155:1329" },
|
|
325
|
+
{ "source": "eip155:146", "destination": "eip155:137" },
|
|
326
|
+
{ "source": "eip155:146", "destination": "eip155:14" },
|
|
327
|
+
{ "source": "eip155:146", "destination": "eip155:42161" },
|
|
328
|
+
{ "source": "eip155:146", "destination": "eip155:43114" },
|
|
329
|
+
{ "source": "eip155:146", "destination": "eip155:5000" },
|
|
330
|
+
{ "source": "eip155:146", "destination": "eip155:534352" },
|
|
331
|
+
{ "source": "eip155:146", "destination": "eip155:56" },
|
|
332
|
+
{ "source": "eip155:146", "destination": "eip155:8453" },
|
|
333
|
+
{ "source": "eip155:146", "destination": "eip155:9745" },
|
|
334
|
+
{ "source": "eip155:146", "destination": "eip155:98866" },
|
|
335
|
+
{ "source": "eip155:42161", "destination": "eip155:1" },
|
|
336
|
+
{ "source": "eip155:42161", "destination": "eip155:10" },
|
|
337
|
+
{ "source": "eip155:42161", "destination": "eip155:130" },
|
|
338
|
+
{ "source": "eip155:42161", "destination": "eip155:1329" },
|
|
339
|
+
{ "source": "eip155:42161", "destination": "eip155:137" },
|
|
340
|
+
{ "source": "eip155:42161", "destination": "eip155:14" },
|
|
341
|
+
{ "source": "eip155:42161", "destination": "eip155:146" },
|
|
342
|
+
{ "source": "eip155:42161", "destination": "eip155:43114" },
|
|
343
|
+
{ "source": "eip155:42161", "destination": "eip155:5000" },
|
|
344
|
+
{ "source": "eip155:42161", "destination": "eip155:534352" },
|
|
345
|
+
{ "source": "eip155:42161", "destination": "eip155:56" },
|
|
346
|
+
{ "source": "eip155:42161", "destination": "eip155:8453" },
|
|
347
|
+
{ "source": "eip155:42161", "destination": "eip155:9745" },
|
|
348
|
+
{ "source": "eip155:42161", "destination": "eip155:98866" },
|
|
349
|
+
{ "source": "eip155:43114", "destination": "eip155:1" },
|
|
350
|
+
{ "source": "eip155:43114", "destination": "eip155:10" },
|
|
351
|
+
{ "source": "eip155:43114", "destination": "eip155:130" },
|
|
352
|
+
{ "source": "eip155:43114", "destination": "eip155:1329" },
|
|
353
|
+
{ "source": "eip155:43114", "destination": "eip155:137" },
|
|
354
|
+
{ "source": "eip155:43114", "destination": "eip155:14" },
|
|
355
|
+
{ "source": "eip155:43114", "destination": "eip155:146" },
|
|
356
|
+
{ "source": "eip155:43114", "destination": "eip155:42161" },
|
|
357
|
+
{ "source": "eip155:43114", "destination": "eip155:5000" },
|
|
358
|
+
{ "source": "eip155:43114", "destination": "eip155:534352" },
|
|
359
|
+
{ "source": "eip155:43114", "destination": "eip155:56" },
|
|
360
|
+
{ "source": "eip155:43114", "destination": "eip155:8453" },
|
|
361
|
+
{ "source": "eip155:43114", "destination": "eip155:9745" },
|
|
362
|
+
{ "source": "eip155:43114", "destination": "eip155:98866" },
|
|
363
|
+
{ "source": "eip155:5000", "destination": "eip155:1" },
|
|
364
|
+
{ "source": "eip155:5000", "destination": "eip155:10" },
|
|
365
|
+
{ "source": "eip155:5000", "destination": "eip155:130" },
|
|
366
|
+
{ "source": "eip155:5000", "destination": "eip155:1329" },
|
|
367
|
+
{ "source": "eip155:5000", "destination": "eip155:137" },
|
|
368
|
+
{ "source": "eip155:5000", "destination": "eip155:14" },
|
|
369
|
+
{ "source": "eip155:5000", "destination": "eip155:146" },
|
|
370
|
+
{ "source": "eip155:5000", "destination": "eip155:42161" },
|
|
371
|
+
{ "source": "eip155:5000", "destination": "eip155:43114" },
|
|
372
|
+
{ "source": "eip155:5000", "destination": "eip155:534352" },
|
|
373
|
+
{ "source": "eip155:5000", "destination": "eip155:56" },
|
|
374
|
+
{ "source": "eip155:5000", "destination": "eip155:8453" },
|
|
375
|
+
{ "source": "eip155:5000", "destination": "eip155:9745" },
|
|
376
|
+
{ "source": "eip155:5000", "destination": "eip155:98866" },
|
|
377
|
+
{ "source": "eip155:534352", "destination": "eip155:1" },
|
|
378
|
+
{ "source": "eip155:534352", "destination": "eip155:10" },
|
|
379
|
+
{ "source": "eip155:534352", "destination": "eip155:130" },
|
|
380
|
+
{ "source": "eip155:534352", "destination": "eip155:1329" },
|
|
381
|
+
{ "source": "eip155:534352", "destination": "eip155:137" },
|
|
382
|
+
{ "source": "eip155:534352", "destination": "eip155:14" },
|
|
383
|
+
{ "source": "eip155:534352", "destination": "eip155:146" },
|
|
384
|
+
{ "source": "eip155:534352", "destination": "eip155:42161" },
|
|
385
|
+
{ "source": "eip155:534352", "destination": "eip155:43114" },
|
|
386
|
+
{ "source": "eip155:534352", "destination": "eip155:5000" },
|
|
387
|
+
{ "source": "eip155:534352", "destination": "eip155:56" },
|
|
388
|
+
{ "source": "eip155:534352", "destination": "eip155:8453" },
|
|
389
|
+
{ "source": "eip155:534352", "destination": "eip155:9745" },
|
|
390
|
+
{ "source": "eip155:534352", "destination": "eip155:98866" },
|
|
391
|
+
{ "source": "eip155:56", "destination": "eip155:1" },
|
|
392
|
+
{ "source": "eip155:56", "destination": "eip155:10" },
|
|
393
|
+
{ "source": "eip155:56", "destination": "eip155:130" },
|
|
394
|
+
{ "source": "eip155:56", "destination": "eip155:1329" },
|
|
395
|
+
{ "source": "eip155:56", "destination": "eip155:137" },
|
|
396
|
+
{ "source": "eip155:56", "destination": "eip155:14" },
|
|
397
|
+
{ "source": "eip155:56", "destination": "eip155:146" },
|
|
398
|
+
{ "source": "eip155:56", "destination": "eip155:42161" },
|
|
399
|
+
{ "source": "eip155:56", "destination": "eip155:43114" },
|
|
400
|
+
{ "source": "eip155:56", "destination": "eip155:5000" },
|
|
401
|
+
{ "source": "eip155:56", "destination": "eip155:534352" },
|
|
402
|
+
{ "source": "eip155:56", "destination": "eip155:8453" },
|
|
403
|
+
{ "source": "eip155:56", "destination": "eip155:9745" },
|
|
404
|
+
{ "source": "eip155:56", "destination": "eip155:98866" },
|
|
405
|
+
{ "source": "eip155:8453", "destination": "eip155:1" },
|
|
406
|
+
{ "source": "eip155:8453", "destination": "eip155:10" },
|
|
407
|
+
{ "source": "eip155:8453", "destination": "eip155:130" },
|
|
408
|
+
{ "source": "eip155:8453", "destination": "eip155:1329" },
|
|
409
|
+
{ "source": "eip155:8453", "destination": "eip155:137" },
|
|
410
|
+
{ "source": "eip155:8453", "destination": "eip155:14" },
|
|
411
|
+
{ "source": "eip155:8453", "destination": "eip155:146" },
|
|
412
|
+
{ "source": "eip155:8453", "destination": "eip155:42161" },
|
|
413
|
+
{ "source": "eip155:8453", "destination": "eip155:43114" },
|
|
414
|
+
{ "source": "eip155:8453", "destination": "eip155:5000" },
|
|
415
|
+
{ "source": "eip155:8453", "destination": "eip155:534352" },
|
|
416
|
+
{ "source": "eip155:8453", "destination": "eip155:56" },
|
|
417
|
+
{ "source": "eip155:8453", "destination": "eip155:9745" },
|
|
418
|
+
{ "source": "eip155:8453", "destination": "eip155:98866" },
|
|
419
|
+
{ "source": "eip155:9745", "destination": "eip155:1" },
|
|
420
|
+
{ "source": "eip155:9745", "destination": "eip155:10" },
|
|
421
|
+
{ "source": "eip155:9745", "destination": "eip155:130" },
|
|
422
|
+
{ "source": "eip155:9745", "destination": "eip155:1329" },
|
|
423
|
+
{ "source": "eip155:9745", "destination": "eip155:137" },
|
|
424
|
+
{ "source": "eip155:9745", "destination": "eip155:14" },
|
|
425
|
+
{ "source": "eip155:9745", "destination": "eip155:146" },
|
|
426
|
+
{ "source": "eip155:9745", "destination": "eip155:42161" },
|
|
427
|
+
{ "source": "eip155:9745", "destination": "eip155:43114" },
|
|
428
|
+
{ "source": "eip155:9745", "destination": "eip155:5000" },
|
|
429
|
+
{ "source": "eip155:9745", "destination": "eip155:534352" },
|
|
430
|
+
{ "source": "eip155:9745", "destination": "eip155:56" },
|
|
431
|
+
{ "source": "eip155:9745", "destination": "eip155:8453" },
|
|
432
|
+
{ "source": "eip155:9745", "destination": "eip155:98866" },
|
|
433
|
+
{ "source": "eip155:98866", "destination": "eip155:1" },
|
|
434
|
+
{ "source": "eip155:98866", "destination": "eip155:10" },
|
|
435
|
+
{ "source": "eip155:98866", "destination": "eip155:130" },
|
|
436
|
+
{ "source": "eip155:98866", "destination": "eip155:1329" },
|
|
437
|
+
{ "source": "eip155:98866", "destination": "eip155:137" },
|
|
438
|
+
{ "source": "eip155:98866", "destination": "eip155:14" },
|
|
439
|
+
{ "source": "eip155:98866", "destination": "eip155:146" },
|
|
440
|
+
{ "source": "eip155:98866", "destination": "eip155:42161" },
|
|
441
|
+
{ "source": "eip155:98866", "destination": "eip155:43114" },
|
|
442
|
+
{ "source": "eip155:98866", "destination": "eip155:5000" },
|
|
443
|
+
{ "source": "eip155:98866", "destination": "eip155:534352" },
|
|
444
|
+
{ "source": "eip155:98866", "destination": "eip155:56" },
|
|
445
|
+
{ "source": "eip155:98866", "destination": "eip155:8453" },
|
|
446
|
+
{ "source": "eip155:98866", "destination": "eip155:9745" }
|
|
447
|
+
];
|
|
448
|
+
var stargateRegistry = createStargateRegistry(deployments, paths);
|
|
449
|
+
|
|
450
|
+
// src/availability.ts
|
|
451
|
+
var STARGATE_BUS_RETIRED = "Stargate Bus is retired for new transfers; use Taxi";
|
|
452
|
+
function stargateChainCutoff(chain) {
|
|
453
|
+
return chain === "eip155:534352" ? Date.UTC(2026, 11, 8) : Infinity;
|
|
454
|
+
}
|
|
455
|
+
function stargateChainActive(chain, now = Date.now()) {
|
|
456
|
+
return now < stargateChainCutoff(chain);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// src/rpc.ts
|
|
460
|
+
var import_viem3 = require("viem");
|
|
461
|
+
var StargateReadError = class extends Error {
|
|
462
|
+
constructor(message) {
|
|
463
|
+
super(`stargate: ${message}`);
|
|
464
|
+
this.name = "StargateReadError";
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
var auxiliaryAbi = (0, import_viem3.parseAbi)(["function decimals() view returns (uint8)", "function eid() view returns (uint32)"]);
|
|
468
|
+
var sameAddress = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
469
|
+
function assertStargate(condition, message) {
|
|
470
|
+
if (!condition) throw new StargateReadError(message);
|
|
471
|
+
}
|
|
472
|
+
function assertNotAborted(signal) {
|
|
473
|
+
if (signal?.aborted) throw new StargateReadError("request cancelled");
|
|
474
|
+
}
|
|
475
|
+
function stargateRpc(config) {
|
|
476
|
+
const urls = new Map(Object.entries(config.rpcUrls).map(([chain, value]) => {
|
|
477
|
+
const list = typeof value === "string" ? [value] : [...value];
|
|
478
|
+
assertStargate(list.length && list.every((url) => /^https?:\/\//.test(url)), "invalid RPC configuration");
|
|
479
|
+
return [chain, list];
|
|
480
|
+
}));
|
|
481
|
+
function client(chain, signal) {
|
|
482
|
+
const list = urls.get(chain);
|
|
483
|
+
assertStargate(list, `no RPC configured for ${chain}`);
|
|
484
|
+
assertNotAborted(signal);
|
|
485
|
+
const transport = (url) => (0, import_viem3.http)(url, { timeout: 12e3, retryCount: 0, ...config.fetchImpl ? { fetchFn: config.fetchImpl } : {}, ...signal ? { fetchOptions: { signal } } : {} });
|
|
486
|
+
return (0, import_viem3.createPublicClient)({ transport: list.length === 1 ? transport(list[0]) : (0, import_viem3.fallback)(list.map(transport), { retryCount: 0 }), ccipRead: false });
|
|
487
|
+
}
|
|
488
|
+
async function snapshot(c, chainId) {
|
|
489
|
+
const [actual, block] = await Promise.all([c.getChainId(), c.getBlock({ blockTag: "latest" })]);
|
|
490
|
+
assertStargate(actual === chainId, "RPC chain id mismatch");
|
|
491
|
+
assertStargate(block.hash && block.number !== null, "RPC returned an unmined block");
|
|
492
|
+
const now = BigInt(Math.floor(Date.now() / 1e3));
|
|
493
|
+
assertStargate(block.timestamp >= now - 300n && block.timestamp <= now + 60n, "RPC block is stale or in the future");
|
|
494
|
+
return Object.freeze({ number: block.number, hash: block.hash, timestamp: block.timestamp });
|
|
495
|
+
}
|
|
496
|
+
async function verify(c, d, peer, block) {
|
|
497
|
+
const at = { blockNumber: block.number };
|
|
498
|
+
const pool = { address: d.address, abi: STARGATE_ABI, ...at };
|
|
499
|
+
const messaging = { address: d.tokenMessaging, abi: TOKEN_MESSAGING_ABI, ...at };
|
|
500
|
+
const [token, shared, approval, eid, endpoint, status, kind, roles, assetId, implementation, messagingEndpoint, remotePeer, endpointEid, decimals] = await Promise.all([
|
|
501
|
+
c.readContract({ ...pool, functionName: "token" }),
|
|
502
|
+
c.readContract({ ...pool, functionName: "sharedDecimals" }),
|
|
503
|
+
c.readContract({ ...pool, functionName: "approvalRequired" }),
|
|
504
|
+
c.readContract({ ...pool, functionName: "localEid" }),
|
|
505
|
+
c.readContract({ ...pool, functionName: "endpoint" }),
|
|
506
|
+
c.readContract({ ...pool, functionName: "status" }),
|
|
507
|
+
c.readContract({ ...pool, functionName: "stargateType" }),
|
|
508
|
+
c.readContract({ ...pool, functionName: "getAddressConfig" }),
|
|
509
|
+
c.readContract({ ...messaging, functionName: "assetIds", args: [d.address] }),
|
|
510
|
+
c.readContract({ ...messaging, functionName: "stargateImpls", args: [d.assetId] }),
|
|
511
|
+
c.readContract({ ...messaging, functionName: "endpoint" }),
|
|
512
|
+
c.readContract({ ...messaging, functionName: "peers", args: [peer.eid] }),
|
|
513
|
+
c.readContract({ address: d.endpoint, abi: auxiliaryAbi, functionName: "eid", ...at }),
|
|
514
|
+
d.kind === "native" ? Promise.resolve(d.localDecimals) : c.readContract({ address: d.token, abi: auxiliaryAbi, functionName: "decimals", ...at })
|
|
515
|
+
]);
|
|
516
|
+
assertStargate(sameAddress(token, d.token) && shared === d.sharedDecimals && decimals === d.localDecimals && approval === d.approvalRequired && eid === d.eid && endpointEid === d.eid && sameAddress(endpoint, d.endpoint) && sameAddress(messagingEndpoint, d.endpoint) && sameAddress(roles.tokenMessaging, d.tokenMessaging) && assetId === d.assetId && sameAddress(implementation, d.address) && kind === (d.kind === "oft" ? 1 : 0), `deployment identity changed on ${d.chain}`);
|
|
517
|
+
assertStargate(status === 1, `deployment is not active on ${d.chain}`);
|
|
518
|
+
assertStargate(sameAddress(remotePeer, (0, import_viem3.pad)(peer.tokenMessaging, { size: 32 })), `messaging peer mismatch on ${d.chain}`);
|
|
519
|
+
}
|
|
520
|
+
async function unchanged(c, block) {
|
|
521
|
+
assertStargate((await c.getBlock({ blockNumber: block.number })).hash === block.hash, "block changed during quote");
|
|
522
|
+
}
|
|
523
|
+
return { has: (chain) => urls.has(chain), client, snapshot, verify, unchanged };
|
|
524
|
+
}
|
|
525
|
+
function safeReadError(error) {
|
|
526
|
+
return error instanceof StargateReadError ? error : new StargateReadError("RPC read, quote or decoding failed");
|
|
527
|
+
}
|
|
528
|
+
function nonzeroAddress(value) {
|
|
529
|
+
return /^0x[0-9a-fA-F]{40}$/.test(value) && !/^0x0{40}$/.test(value);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// src/quote.ts
|
|
533
|
+
var UINT64_MAX2 = (1n << 64n) - 1n;
|
|
534
|
+
var UINT256_MAX2 = (1n << 256n) - 1n;
|
|
535
|
+
function stargateComposeOptions(gas) {
|
|
536
|
+
assertStargate(typeof gas === "bigint" && gas > 0n && gas < 1n << 128n, "compose gas must be a positive uint128");
|
|
537
|
+
return (0, import_viem4.encodePacked)(["uint16", "uint8", "uint16", "uint8", "uint16", "uint128"], [3, 1, 19, 3, 0, gas]);
|
|
538
|
+
}
|
|
539
|
+
function taxiNativeDrop(amount, recipient) {
|
|
540
|
+
assertStargate(typeof amount === "bigint" && amount > 0n && amount < 1n << 128n, "native drop must be a positive uint128");
|
|
541
|
+
assertStargate(nonzeroAddress(recipient), "invalid native drop recipient");
|
|
542
|
+
return (0, import_viem4.encodePacked)(["uint16", "uint8", "uint16", "uint8", "uint128", "bytes32"], [3, 1, 49, 2, amount, (0, import_viem4.pad)(recipient, { size: 32 })]);
|
|
543
|
+
}
|
|
544
|
+
function createStargateQuoter(config) {
|
|
545
|
+
const registry = config.registry ?? stargateRegistry;
|
|
546
|
+
const rpc = stargateRpc(config);
|
|
547
|
+
const ttl = config.quoteTtlMs ?? 6e4;
|
|
548
|
+
const headroom = config.feeHeadroomBps ?? 2500;
|
|
549
|
+
assertStargate(Number.isSafeInteger(ttl) && ttl > 0 && ttl <= 3e5, "invalid quote lifetime");
|
|
550
|
+
assertStargate(Number.isInteger(headroom) && headroom >= 0 && headroom <= 1e4, "invalid messaging fee headroom");
|
|
551
|
+
function supportsRoute(sourceChain, sourceToken, destinationChain, destinationToken) {
|
|
552
|
+
return stargateChainActive(sourceChain) && stargateChainActive(destinationChain) && rpc.has(sourceChain) && rpc.has(destinationChain) && !!registry.route(sourceChain, sourceToken, destinationChain, destinationToken);
|
|
553
|
+
}
|
|
554
|
+
async function quote(input, signal) {
|
|
555
|
+
const request = { ...input, ...input.nativeDrop ? { nativeDrop: { ...input.nativeDrop } } : {} };
|
|
556
|
+
const started = Date.now();
|
|
557
|
+
try {
|
|
558
|
+
assertNotAborted(signal);
|
|
559
|
+
assertStargate(request.mode === "taxi" || request.mode === "bus", "invalid transport mode");
|
|
560
|
+
assertStargate(request.mode !== "bus", STARGATE_BUS_RETIRED);
|
|
561
|
+
assertStargate(stargateChainActive(request.sourceChain) && stargateChainActive(request.destinationChain), "chain support has ended for new transfers");
|
|
562
|
+
const route = registry.route(request.sourceChain, request.sourceToken, request.destinationChain, request.destinationToken);
|
|
563
|
+
assertStargate(route, "unsupported token route");
|
|
564
|
+
const { source, destination } = route;
|
|
565
|
+
assertStargate(nonzeroAddress(request.sender) && nonzeroAddress(request.recipient), "sender and recipient must be nonzero EVM addresses");
|
|
566
|
+
const sender = (0, import_viem4.getAddress)(request.sender), recipient = (0, import_viem4.getAddress)(request.recipient);
|
|
567
|
+
const slippage = request.slippageBps ?? 0;
|
|
568
|
+
assertStargate(Number.isInteger(slippage) && slippage >= 0 && slippage < 1e4, "invalid slippage");
|
|
569
|
+
const minimum = request.minimum ?? 0n;
|
|
570
|
+
assertStargate(typeof minimum === "bigint" && minimum >= 0n && minimum <= UINT256_MAX2, "invalid minimum");
|
|
571
|
+
const split = splitSourceAmount(request.amount, source.localDecimals, source.sharedDecimals);
|
|
572
|
+
assertStargate(split.amountSD > 0n, "amount is below shared-decimal precision");
|
|
573
|
+
const src = rpc.client(source.chain, signal), dst = rpc.client(destination.chain, signal);
|
|
574
|
+
const [sourceBlock, destinationBlock] = await Promise.all([rpc.snapshot(src, source.chainId), rpc.snapshot(dst, destination.chainId)]);
|
|
575
|
+
await Promise.all([rpc.verify(src, source, destination, sourceBlock), rpc.verify(dst, destination, source, destinationBlock)]);
|
|
576
|
+
assertNotAborted(signal);
|
|
577
|
+
const at = { address: source.address, abi: STARGATE_ABI, blockNumber: sourceBlock.number, account: sender };
|
|
578
|
+
const creditSD = await src.readContract({ ...at, functionName: "paths", args: [destination.eid] });
|
|
579
|
+
let extraOptions = "0x", nativeDrop = 0n;
|
|
580
|
+
const compose = request.compose;
|
|
581
|
+
assertStargate(!compose || !request.nativeDrop && slippage === 0 && minimum === 0n, "compose takes an exact bridge output without native drop");
|
|
582
|
+
if (request.nativeDrop) {
|
|
583
|
+
assertStargate("amount" in request.nativeDrop && !("bus" in request.nativeDrop), "Taxi requires an explicit native drop amount");
|
|
584
|
+
nativeDrop = request.nativeDrop.amount;
|
|
585
|
+
extraOptions = taxiNativeDrop(nativeDrop, recipient);
|
|
586
|
+
}
|
|
587
|
+
const probe = { dstEid: destination.eid, to: (0, import_viem4.pad)(recipient, { size: 32 }), amountLD: request.amount, minAmountLD: 0n, extraOptions, composeMsg: "0x", oftCmd: "0x" };
|
|
588
|
+
const [limit, details, receipt] = await src.readContract({ ...at, functionName: "quoteOFT", args: [probe] });
|
|
589
|
+
assertStargate(limit.minAmountLD <= split.sentLD && split.sentLD <= limit.maxAmountLD, "amount exceeds available OFT limits");
|
|
590
|
+
assertStargate(receipt.amountSentLD === split.sentLD, "quote clipped the exact input amount");
|
|
591
|
+
const received = destinationAmount(receipt.amountReceivedLD, source.localDecimals, destination.localDecimals, source.sharedDecimals);
|
|
592
|
+
assertStargate(received > 0n, "quote has no output");
|
|
593
|
+
const receivedSD = receipt.amountReceivedLD / conversionRate(source.localDecimals, source.sharedDecimals);
|
|
594
|
+
assertStargate(creditSD === UINT64_MAX2 || receivedSD <= creditSD, "insufficient credits for output including reward");
|
|
595
|
+
const fees = splitFeeDetails(details);
|
|
596
|
+
assertStargate(receipt.amountSentLD - fees.feeLD + fees.rewardLD === receipt.amountReceivedLD, "protocol fee accounting mismatch");
|
|
597
|
+
const slipFloor = (received * BigInt(1e4 - slippage) + 9999n) / 10000n;
|
|
598
|
+
const minAmountLD = sourceMinimum(minimum > slipFloor ? minimum : slipFloor, source.localDecimals, destination.localDecimals, source.sharedDecimals);
|
|
599
|
+
assertStargate(minAmountLD <= receipt.amountReceivedLD, "output is below the caller's minimum");
|
|
600
|
+
const sendParam = Object.freeze(compose ? { ...probe, minAmountLD, extraOptions: stargateComposeOptions(compose.gas), composeMsg: await compose.message(received, signal) } : { ...probe, minAmountLD });
|
|
601
|
+
assertNotAborted(signal);
|
|
602
|
+
const fee = await src.readContract({ ...at, functionName: "quoteSend", args: [sendParam, false] });
|
|
603
|
+
assertStargate(fee.lzTokenFee === 0n, "LZ token fees are unsupported");
|
|
604
|
+
const cap = fee.nativeFee + (fee.nativeFee * BigInt(headroom) + 9999n) / 10000n;
|
|
605
|
+
const nativeValue = cap + (source.kind === "native" ? request.amount : 0n);
|
|
606
|
+
assertStargate(nativeValue <= UINT256_MAX2, "native value overflow");
|
|
607
|
+
await Promise.all([rpc.unchanged(src, sourceBlock), rpc.unchanged(dst, destinationBlock)]);
|
|
608
|
+
assertNotAborted(signal);
|
|
609
|
+
const validUntilMs = Math.min(started + ttl, stargateChainCutoff(source.chain), stargateChainCutoff(destination.chain));
|
|
610
|
+
assertStargate(Date.now() < validUntilMs, "quote expired during RPC reads");
|
|
611
|
+
return Object.freeze({ mode: request.mode, source, destination, sender, recipient, sourceBlock, destinationBlock, requestedAmount: request.amount, sentAmount: split.sentLD, dust: split.dustLD, destinationAmount: received, minimumDestinationAmount: destinationAmount(minAmountLD, source.localDecimals, destination.localDecimals, source.sharedDecimals), protocolFee: fees.feeLD, protocolReward: fees.rewardLD, messagingFee: fee.nativeFee, messagingFeeCap: cap, nativeValue, nativeDrop, creditSD, sendParam, validUntilMs, liquidityReserved: false, etaSeconds: null, sourceGas: null, approvalGas: null });
|
|
612
|
+
} catch (error) {
|
|
613
|
+
throw safeReadError(error);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
return Object.freeze({ supportsRoute, quote });
|
|
617
|
+
}
|
|
618
|
+
//# sourceMappingURL=quote.cjs.map
|