@spicenet-io/spiceflow-core 0.1.3 → 0.3.0
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/README.md +82 -0
- package/dist/abis/delegate.d.ts +419 -0
- package/dist/abis/delegate.d.ts.map +1 -0
- package/dist/abis/erc20.d.ts +130 -0
- package/dist/abis/erc20.d.ts.map +1 -0
- package/dist/abis/index.d.ts +5 -0
- package/dist/abis/index.d.ts.map +1 -0
- package/dist/abis/uniV3.d.ts +93 -0
- package/dist/abis/uniV3.d.ts.map +1 -0
- package/dist/abis/wcbtc.d.ts +58 -0
- package/dist/abis/wcbtc.d.ts.map +1 -0
- package/dist/authorization.d.ts +23 -37
- package/dist/authorization.d.ts.map +1 -1
- package/dist/chains/index.d.ts +10 -0
- package/dist/chains/index.d.ts.map +1 -0
- package/dist/chains/list.d.ts +3 -0
- package/dist/chains/list.d.ts.map +1 -0
- package/dist/chains/types.d.ts +19 -0
- package/dist/chains/types.d.ts.map +1 -0
- package/dist/config.d.ts +0 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/core.d.ts +3 -15
- package/dist/core.d.ts.map +1 -1
- package/dist/index.cjs +1002 -41
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +963 -38
- package/dist/logos.d.ts +10 -0
- package/dist/logos.d.ts.map +1 -0
- package/dist/relayer.d.ts +0 -9
- package/dist/relayer.d.ts.map +1 -1
- package/dist/rfqt.d.ts +0 -10
- package/dist/rfqt.d.ts.map +1 -1
- package/dist/status.d.ts +0 -7
- package/dist/status.d.ts.map +1 -1
- package/dist/swap.d.ts +31 -0
- package/dist/swap.d.ts.map +1 -0
- package/dist/tokens/index.d.ts +15 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/list.d.ts +3 -0
- package/dist/tokens/list.d.ts.map +1 -0
- package/dist/tokens/types.d.ts +33 -0
- package/dist/tokens/types.d.ts.map +1 -0
- package/dist/types.d.ts +52 -14
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +11 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
// src/authorization.ts
|
|
2
2
|
import { encodeAbiParameters, keccak256 } from "viem";
|
|
3
|
-
var
|
|
4
|
-
type: "
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
]
|
|
10
|
-
};
|
|
11
|
-
var ChainBatchHashComponentsAbi = [
|
|
3
|
+
var CallComponents = [
|
|
4
|
+
{ name: "to", type: "address" },
|
|
5
|
+
{ name: "value", type: "uint256" },
|
|
6
|
+
{ name: "data", type: "bytes" }
|
|
7
|
+
];
|
|
8
|
+
var ChainBatchHashAbi = [
|
|
12
9
|
{ name: "chainId", type: "uint256" },
|
|
13
|
-
{ name: "calls",
|
|
10
|
+
{ name: "calls", type: "tuple[]", components: CallComponents }
|
|
11
|
+
];
|
|
12
|
+
var IntentHashAbi = [
|
|
13
|
+
{ type: "string" },
|
|
14
|
+
{ type: "uint256" },
|
|
15
|
+
{ type: "uint256" },
|
|
16
|
+
{ type: "bytes32[]" }
|
|
14
17
|
];
|
|
15
18
|
function hashChainBatches(chainCalls) {
|
|
16
19
|
return chainCalls.map(({ chainId, calls }) => {
|
|
17
|
-
|
|
20
|
+
const cid = BigInt(chainId);
|
|
18
21
|
const hash = keccak256(
|
|
19
|
-
encodeAbiParameters(
|
|
22
|
+
encodeAbiParameters(ChainBatchHashAbi, [cid, calls])
|
|
20
23
|
);
|
|
21
|
-
return { hash, chainId, calls };
|
|
24
|
+
return { hash, chainId: cid, calls };
|
|
22
25
|
});
|
|
23
26
|
}
|
|
24
|
-
function getIntentHash(nbf, exp, chainBatches) {
|
|
27
|
+
function getIntentHash(signatureType, nbf, exp, chainBatches) {
|
|
25
28
|
const hashes = chainBatches.map(({ hash }) => hash);
|
|
26
|
-
return keccak256(
|
|
29
|
+
return keccak256(
|
|
30
|
+
encodeAbiParameters(IntentHashAbi, [signatureType, nbf, exp, hashes])
|
|
31
|
+
);
|
|
27
32
|
}
|
|
28
33
|
async function getAccountNonce(address, publicClient) {
|
|
29
34
|
return await publicClient.getTransactionCount({ address });
|
|
@@ -114,10 +119,6 @@ var SpiceFlowCore = class {
|
|
|
114
119
|
getClient(chainId) {
|
|
115
120
|
return this.cfg.publicClientForChain(chainId);
|
|
116
121
|
}
|
|
117
|
-
/**
|
|
118
|
-
* Create EIP‑7702 authorizations for one or more chains.
|
|
119
|
-
* Will load nonces unless explicitly provided.
|
|
120
|
-
*/
|
|
121
122
|
async signDelegations(params) {
|
|
122
123
|
const out = [];
|
|
123
124
|
for (const d of params.delegations) {
|
|
@@ -129,28 +130,19 @@ var SpiceFlowCore = class {
|
|
|
129
130
|
}
|
|
130
131
|
return out;
|
|
131
132
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
for (const c of callsByChain) {
|
|
138
|
-
const recent = typeof c.recentBlock === "bigint" ? c.recentBlock : await getRecentBlock(this.getClient(c.chainId));
|
|
139
|
-
filled.push({ chainId: c.chainId, calls: c.calls, recentBlock: recent });
|
|
140
|
-
}
|
|
141
|
-
const chainBatches = hashChainBatches(filled);
|
|
142
|
-
const digest = getIntentHash(nbf, exp, chainBatches);
|
|
133
|
+
async buildChainBatches(nbf, exp, callsByChain, signatureType = "ecdsa") {
|
|
134
|
+
const chainBatches = hashChainBatches(
|
|
135
|
+
callsByChain.map((c) => ({ chainId: c.chainId, calls: c.calls }))
|
|
136
|
+
);
|
|
137
|
+
const digest = getIntentHash(signatureType, nbf, exp, chainBatches);
|
|
143
138
|
return { chainBatches, digest };
|
|
144
139
|
}
|
|
145
|
-
/** Sign the final intent hash (EIP‑7702). */
|
|
146
140
|
async signIntent(digest) {
|
|
147
141
|
return this.signers.messageSigner(digest);
|
|
148
142
|
}
|
|
149
|
-
/**
|
|
150
|
-
* Submit a signed intent to the SpiceFlow relayer.
|
|
151
|
-
*/
|
|
152
143
|
async submitIntent(req) {
|
|
153
|
-
const
|
|
144
|
+
const signatureType = req.signatureType ?? "ecdsa";
|
|
145
|
+
const signature = req.signature ?? await this.signIntent(getIntentHash(signatureType, req.nbf, req.exp, req.chainBatches));
|
|
154
146
|
const resp = await submitTransaction(this.cfg.txApiUrl, {
|
|
155
147
|
tokenAddress: req.tokenAddress,
|
|
156
148
|
tokenAmount: req.tokenAmount,
|
|
@@ -177,15 +169,948 @@ async function prepareRFQT(txApiUrl, request, retry) {
|
|
|
177
169
|
}, retry);
|
|
178
170
|
return res.json();
|
|
179
171
|
}
|
|
172
|
+
|
|
173
|
+
// src/logos.ts
|
|
174
|
+
var logo_arb = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAjVBMVEVMaXEgMkwgMk0fMUogMkwgMkwgMkwgMUsNOE0gMUwhMk0fMk0fMUsgM00gMkz///8hM04iNVESqf78/P0RIz8hKkEYKkURsv8Rrv8yQ1vq7O7W2d4fQGBXZHhrdohFVGoVjtMbWIOeprETm+XEyM8YdK0SpfQaZZYdS3AWgb+mrbh5hJSKlKG0usOUnakhSCyqAAAADnRSTlMAj2cY0Oqw/QP6KkyHd87n3EEAAAAJcEhZcwAACxMAAAsTAQCanBgAAAPZSURBVHjarZfbeqowEIVBQUBsmEBArHiuVu3h/R9vz4QQIMHD/mwuWmrJuNbkz2TiONYIQ/oxjWcTz48Yi3xvMounYfOfR4NeCmPXizjnAAwHAD5GnhuHz4TAF8ZvHk6BIIoCJkcQRAF94r2N5Qv3v37s+gBBoOa2Az8B8GfjuyJCJxz5+N3W7CYGcH8U3hYROlMPp7M7A0N40xsRUNoo4sHd+aSCR6NBG2EYujx6MF2JcEM7Ajqb8Ig9NSI+GUjE8/NVBFOAOZ/owbXvPPQj9CWEjmvOLwSNApoHU4PbjYD554Exf33d7/fXdVGs5MOXmUo+aiPg+vv95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gfUtacmOYRwMY3t1b7+Xk+f35mK7XQ/BXsQDceauWP9WaKja8fMkd4SxfL/Xy5OluqJovWfgL0a3mw+JH7FGy93mae42f+Y9ur9dJxWh+tfvA+RRRYK2FXwQ83Ebkq88Dh8gchwBYn2bUhEq5T2K3BdB4yHLQ+3v8gBMAAKrdE6J+US63ueXz3ggPzGOZC9M+WFxx+5IoH77mtr3j8/iWXP3DNB4jw+rsXndhVLwP93lWvP3DZ7fev+/2BC4+/f+XzD1x6/QPXfv/AxeccQ+8Xr37/hcvvhSUU1/8fqex/ififZbqhk/AAAAAASUVORK5CYII=";
|
|
182
|
+
|
|
183
|
+
// src/tokens/list.ts
|
|
184
|
+
var TOKENS = [
|
|
185
|
+
{
|
|
186
|
+
symbol: "USDC",
|
|
187
|
+
name: "USD Coin",
|
|
188
|
+
equivalenceGroup: "USDC",
|
|
189
|
+
logo: logo_usdc,
|
|
190
|
+
deployments: [
|
|
191
|
+
{ chainId: 1, address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", decimals: 6, network: "mainnet", swapContracts: [] },
|
|
192
|
+
{ chainId: 8453, address: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", decimals: 6, network: "mainnet", swapContracts: [] },
|
|
193
|
+
{ chainId: 42161, address: "0xaf88d065e77c8cc2239327c5edb3a432268e5831", decimals: 6, network: "mainnet", swapContracts: [] },
|
|
194
|
+
{ chainId: 4114, address: "0xe045e6c36cf77faa2cfb54466d71a3aef7bbe839", decimals: 6, network: "mainnet", swapContracts: [] },
|
|
195
|
+
{ chainId: 11155111, address: "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238", decimals: 6, network: "testnet", swapContracts: [] },
|
|
196
|
+
{ chainId: 421614, address: "0xbeb51deb2018b67b35d5695fd15bb30d452c7868", decimals: 18, network: "testnet", swapContracts: [] },
|
|
197
|
+
{ chainId: 84532, address: "0xf370dc3765f81ac9dd2febd59fb4e710330b0bc8", decimals: 18, network: "testnet", swapContracts: [] }
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
symbol: "ctUSD",
|
|
202
|
+
name: "Citrea USD",
|
|
203
|
+
equivalenceGroup: "USDC",
|
|
204
|
+
logo: logo_usdc,
|
|
205
|
+
deployments: [
|
|
206
|
+
{ chainId: 4114, address: "0x8d82c4e3c936c7b5724a382a9c5a4e6eb7ab6d5d", decimals: 6, network: "mainnet", swapContracts: [] }
|
|
207
|
+
]
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
symbol: "sUSD",
|
|
211
|
+
name: "Spice USD",
|
|
212
|
+
equivalenceGroup: "SUSD",
|
|
213
|
+
logo: logo_usdc,
|
|
214
|
+
deployments: [
|
|
215
|
+
{ chainId: 11155111, address: "0x9bf2d44887be65c4f6337b20814ec79197a092aa", decimals: 18, network: "testnet", swapContracts: [] },
|
|
216
|
+
{ chainId: 421614, address: "0xf370dc3765f81ac9dd2febd59fb4e710330b0bc8", decimals: 18, network: "testnet", swapContracts: [] },
|
|
217
|
+
{ chainId: 84532, address: "0xbeb51deb2018b67b35d5695fd15bb30d452c7868", decimals: 18, network: "testnet", swapContracts: [] }
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
symbol: "USD",
|
|
222
|
+
name: "USD Stable Coin",
|
|
223
|
+
equivalenceGroup: "SUSD",
|
|
224
|
+
logo: logo_usdc,
|
|
225
|
+
deployments: [
|
|
226
|
+
{ chainId: 5115, address: "0xf19308f923582a6f7c465e5ce7a9dc1bec6665b1", decimals: 18, network: "testnet", swapContracts: [] },
|
|
227
|
+
{ chainId: 688689, address: "0x16b90aeb3de140dde993da1d5734bca28574702b", decimals: 6, network: "testnet", swapContracts: [] }
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
symbol: "WBTC",
|
|
232
|
+
name: "Wrapped Bitcoin",
|
|
233
|
+
equivalenceGroup: "WBTC",
|
|
234
|
+
logo: logo_wbtc,
|
|
235
|
+
deployments: [
|
|
236
|
+
{ chainId: 1, address: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", decimals: 8, network: "mainnet", swapContracts: [] },
|
|
237
|
+
{ chainId: 42161, address: "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f", decimals: 8, network: "mainnet", swapContracts: [] },
|
|
238
|
+
{ chainId: 11155111, address: "0x4fc381b6cc6df8cf1c1bd46d184475be5b7a3c62", decimals: 8, network: "testnet", swapContracts: [] },
|
|
239
|
+
{ chainId: 421614, address: "0xba4c54d4cf10c766c22a08f783998cfab237f7c9", decimals: 8, network: "testnet", swapContracts: [] },
|
|
240
|
+
{ chainId: 84532, address: "0x16dd3a855433059be478facb416d9afed6ca96ec", decimals: 8, network: "testnet", swapContracts: [] }
|
|
241
|
+
]
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
symbol: "ETH",
|
|
245
|
+
name: "Ether",
|
|
246
|
+
equivalenceGroup: "ETH",
|
|
247
|
+
logo: logo_eth,
|
|
248
|
+
deployments: [
|
|
249
|
+
{ chainId: 1, address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", decimals: 18, network: "mainnet", swapContracts: [] },
|
|
250
|
+
{ chainId: 8453, address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", decimals: 18, network: "mainnet", swapContracts: [] },
|
|
251
|
+
{ chainId: 42161, address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", decimals: 18, network: "mainnet", swapContracts: [] },
|
|
252
|
+
{ chainId: 11155111, address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", decimals: 18, network: "testnet", swapContracts: [] },
|
|
253
|
+
{ chainId: 421614, address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", decimals: 18, network: "testnet", swapContracts: [] },
|
|
254
|
+
{ chainId: 84532, address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", decimals: 18, network: "testnet", swapContracts: [] }
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
symbol: "cbETH",
|
|
259
|
+
name: "Coinbase Wrapped Staked ETH",
|
|
260
|
+
equivalenceGroup: "ETH",
|
|
261
|
+
logo: logo_eth,
|
|
262
|
+
deployments: [
|
|
263
|
+
{ chainId: 8453, address: "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22", decimals: 18, network: "mainnet", swapContracts: [] }
|
|
264
|
+
]
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
symbol: "cBTC",
|
|
268
|
+
name: "Citrea Bitcoin",
|
|
269
|
+
equivalenceGroup: "CBTC",
|
|
270
|
+
logo: logo_cbtc,
|
|
271
|
+
deployments: [
|
|
272
|
+
{ chainId: 4114, address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", decimals: 18, network: "mainnet", swapContracts: [] }
|
|
273
|
+
]
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
symbol: "WCBTC",
|
|
277
|
+
name: "Wrapped Citrea BTC",
|
|
278
|
+
equivalenceGroup: "CBTC",
|
|
279
|
+
logo: logo_cbtc,
|
|
280
|
+
deployments: [
|
|
281
|
+
{ chainId: 4114, address: "0x3100000000000000000000000000000000000006", decimals: 18, network: "mainnet", swapContracts: [] },
|
|
282
|
+
{ chainId: 5115, address: "0x8d0c9d1c17ae5e40fff9be350f57840e9e66cd93", decimals: 18, network: "testnet", swapContracts: [] }
|
|
283
|
+
]
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
symbol: "eCBTC",
|
|
287
|
+
name: "CBTC Vault",
|
|
288
|
+
equivalenceGroup: "CBTC",
|
|
289
|
+
logo: logo_cbtc,
|
|
290
|
+
deployments: [
|
|
291
|
+
{ chainId: 5115, address: "0x2876a1fb400c238b0a9e4edd2e7e03d3cf9b53c2", decimals: 18, network: "testnet", swapContracts: [] }
|
|
292
|
+
]
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
symbol: "ARB",
|
|
296
|
+
name: "Arbitrum",
|
|
297
|
+
equivalenceGroup: "ARB",
|
|
298
|
+
logo: logo_arb,
|
|
299
|
+
deployments: [
|
|
300
|
+
{ chainId: 42161, address: "0x912ce59144191c1204e64559fe8253a0e49e6548", decimals: 18, network: "mainnet", swapContracts: [] }
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
];
|
|
304
|
+
|
|
305
|
+
// src/tokens/index.ts
|
|
306
|
+
var _addressIndex = /* @__PURE__ */ new Map();
|
|
307
|
+
var _deploymentIndex = /* @__PURE__ */ new Map();
|
|
308
|
+
var _chainIndex = /* @__PURE__ */ new Map();
|
|
309
|
+
var _equivalenceIndex = /* @__PURE__ */ new Map();
|
|
310
|
+
function _buildIndexes() {
|
|
311
|
+
for (const token of TOKENS) {
|
|
312
|
+
const groupAddrs = _equivalenceIndex.get(token.equivalenceGroup) ?? [];
|
|
313
|
+
for (const d of token.deployments) {
|
|
314
|
+
const addr = d.address.toLowerCase();
|
|
315
|
+
const key = `${d.chainId}:${addr}`;
|
|
316
|
+
_addressIndex.set(addr, token);
|
|
317
|
+
_deploymentIndex.set(key, { token, deployment: d });
|
|
318
|
+
const chainEntries = _chainIndex.get(d.chainId) ?? [];
|
|
319
|
+
chainEntries.push({ token, deployment: d });
|
|
320
|
+
_chainIndex.set(d.chainId, chainEntries);
|
|
321
|
+
if (!groupAddrs.includes(addr)) {
|
|
322
|
+
groupAddrs.push(addr);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
_equivalenceIndex.set(token.equivalenceGroup, groupAddrs);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
_buildIndexes();
|
|
329
|
+
function _resolve(token, deployment) {
|
|
330
|
+
return {
|
|
331
|
+
symbol: token.symbol,
|
|
332
|
+
name: token.name,
|
|
333
|
+
equivalenceGroup: token.equivalenceGroup,
|
|
334
|
+
logo: token.logo,
|
|
335
|
+
address: deployment.address,
|
|
336
|
+
chainId: deployment.chainId,
|
|
337
|
+
decimals: deployment.decimals,
|
|
338
|
+
network: deployment.network,
|
|
339
|
+
swapContracts: deployment.swapContracts
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function getTokensForChain(chainId) {
|
|
343
|
+
const entries = _chainIndex.get(chainId);
|
|
344
|
+
if (!entries) return [];
|
|
345
|
+
return entries.map(({ token, deployment }) => _resolve(token, deployment));
|
|
346
|
+
}
|
|
347
|
+
function getTokenByAddress(address, chainId) {
|
|
348
|
+
const entry = _deploymentIndex.get(`${chainId}:${address.toLowerCase()}`);
|
|
349
|
+
if (!entry) return void 0;
|
|
350
|
+
return _resolve(entry.token, entry.deployment);
|
|
351
|
+
}
|
|
352
|
+
function getTokenDefinition(address) {
|
|
353
|
+
return _addressIndex.get(address.toLowerCase());
|
|
354
|
+
}
|
|
355
|
+
function getDeployment(address, chainId) {
|
|
356
|
+
return _deploymentIndex.get(`${chainId}:${address.toLowerCase()}`)?.deployment;
|
|
357
|
+
}
|
|
358
|
+
function getEquivalentAddresses(tokenAddress) {
|
|
359
|
+
const token = _addressIndex.get(tokenAddress.toLowerCase());
|
|
360
|
+
if (!token) return [tokenAddress.toLowerCase()];
|
|
361
|
+
return _equivalenceIndex.get(token.equivalenceGroup) ?? [tokenAddress.toLowerCase()];
|
|
362
|
+
}
|
|
363
|
+
function getEquivalenceGroup(tokenAddress) {
|
|
364
|
+
return _addressIndex.get(tokenAddress.toLowerCase())?.equivalenceGroup;
|
|
365
|
+
}
|
|
366
|
+
function areEquivalent(a, b) {
|
|
367
|
+
const tokenA = _addressIndex.get(a.toLowerCase());
|
|
368
|
+
const tokenB = _addressIndex.get(b.toLowerCase());
|
|
369
|
+
if (!tokenA || !tokenB) return false;
|
|
370
|
+
return tokenA.equivalenceGroup === tokenB.equivalenceGroup;
|
|
371
|
+
}
|
|
372
|
+
var USD_GROUPS = /* @__PURE__ */ new Set(["USDC", "SUSD"]);
|
|
373
|
+
var BTC_GROUPS = /* @__PURE__ */ new Set(["WBTC", "CBTC"]);
|
|
374
|
+
function isUsdDenominated(address) {
|
|
375
|
+
const group = getEquivalenceGroup(address);
|
|
376
|
+
return group !== void 0 && USD_GROUPS.has(group);
|
|
377
|
+
}
|
|
378
|
+
function isBtcDenominated(address) {
|
|
379
|
+
const group = getEquivalenceGroup(address);
|
|
380
|
+
return group !== void 0 && BTC_GROUPS.has(group);
|
|
381
|
+
}
|
|
382
|
+
function resolveTokenRef(ref) {
|
|
383
|
+
const [symbol, chainId] = ref;
|
|
384
|
+
const tokens = getTokensForChain(chainId);
|
|
385
|
+
const match = tokens.find(
|
|
386
|
+
(t) => t.symbol.toUpperCase() === symbol.toUpperCase()
|
|
387
|
+
);
|
|
388
|
+
if (!match) {
|
|
389
|
+
throw new Error(
|
|
390
|
+
`Token "${symbol}" not found on chain ${chainId} in the token registry.`
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
return {
|
|
394
|
+
address: match.address,
|
|
395
|
+
symbol: match.symbol,
|
|
396
|
+
decimals: match.decimals,
|
|
397
|
+
chainId
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// src/chains/list.ts
|
|
402
|
+
var CHAINS = {
|
|
403
|
+
1: {
|
|
404
|
+
id: 1,
|
|
405
|
+
name: "Ethereum",
|
|
406
|
+
displayName: "Ethereum",
|
|
407
|
+
network: "mainnet",
|
|
408
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
409
|
+
delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
|
|
410
|
+
blockExplorer: "https://etherscan.io",
|
|
411
|
+
rpcUrl: "https://eth.llamarpc.com",
|
|
412
|
+
logo: logo_eth,
|
|
413
|
+
moralisId: "0x1"
|
|
414
|
+
},
|
|
415
|
+
8453: {
|
|
416
|
+
id: 8453,
|
|
417
|
+
name: "Base Mainnet",
|
|
418
|
+
displayName: "Base",
|
|
419
|
+
network: "mainnet",
|
|
420
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
421
|
+
delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
|
|
422
|
+
blockExplorer: "https://basescan.org",
|
|
423
|
+
rpcUrl: "https://mainnet.base.org",
|
|
424
|
+
logo: logo_base,
|
|
425
|
+
moralisId: "0x2105"
|
|
426
|
+
},
|
|
427
|
+
42161: {
|
|
428
|
+
id: 42161,
|
|
429
|
+
name: "Arbitrum One",
|
|
430
|
+
displayName: "Arbitrum",
|
|
431
|
+
network: "mainnet",
|
|
432
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
433
|
+
delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
|
|
434
|
+
blockExplorer: "https://arbiscan.io",
|
|
435
|
+
rpcUrl: "https://arb1.arbitrum.io/rpc",
|
|
436
|
+
logo: logo_arb,
|
|
437
|
+
moralisId: "0xa4b1"
|
|
438
|
+
},
|
|
439
|
+
4114: {
|
|
440
|
+
id: 4114,
|
|
441
|
+
name: "Citrea Mainnet",
|
|
442
|
+
displayName: "Citrea",
|
|
443
|
+
network: "mainnet",
|
|
444
|
+
nativeCurrency: { name: "Citrea Bitcoin", symbol: "cBTC", decimals: 18 },
|
|
445
|
+
delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
|
|
446
|
+
blockExplorer: "https://explorer.mainnet.citrea.xyz",
|
|
447
|
+
rpcUrl: "https://rpc.mainnet.citrea.xyz",
|
|
448
|
+
logo: logo_citrea,
|
|
449
|
+
wrappedNativeTokenAddress: "0x3100000000000000000000000000000000000006"
|
|
450
|
+
},
|
|
451
|
+
11155111: {
|
|
452
|
+
id: 11155111,
|
|
453
|
+
name: "Ethereum Sepolia",
|
|
454
|
+
displayName: "Sepolia",
|
|
455
|
+
network: "testnet",
|
|
456
|
+
nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
|
|
457
|
+
delegateContract: "0xDF7d39BB544778F467D10b08B1F5C170fd7fB480",
|
|
458
|
+
blockExplorer: "https://sepolia.etherscan.io",
|
|
459
|
+
rpcUrl: "https://rpc.sepolia.org",
|
|
460
|
+
logo: logo_eth,
|
|
461
|
+
moralisId: "sepolia"
|
|
462
|
+
},
|
|
463
|
+
421614: {
|
|
464
|
+
id: 421614,
|
|
465
|
+
name: "Arbitrum Sepolia",
|
|
466
|
+
displayName: "Arbitrum Sepolia",
|
|
467
|
+
network: "testnet",
|
|
468
|
+
nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
|
|
469
|
+
delegateContract: "0x151755d1bdFeB6082D141EF86e4291b2e902b43F",
|
|
470
|
+
blockExplorer: "https://sepolia.arbiscan.io",
|
|
471
|
+
rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
|
|
472
|
+
logo: logo_arb
|
|
473
|
+
},
|
|
474
|
+
84532: {
|
|
475
|
+
id: 84532,
|
|
476
|
+
name: "Base Sepolia",
|
|
477
|
+
displayName: "Base Sepolia",
|
|
478
|
+
network: "testnet",
|
|
479
|
+
nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
|
|
480
|
+
delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
|
|
481
|
+
blockExplorer: "https://sepolia.basescan.org",
|
|
482
|
+
rpcUrl: "https://sepolia.base.org",
|
|
483
|
+
logo: logo_base,
|
|
484
|
+
moralisId: "0x14a34"
|
|
485
|
+
},
|
|
486
|
+
5115: {
|
|
487
|
+
id: 5115,
|
|
488
|
+
name: "Citrea Testnet",
|
|
489
|
+
displayName: "Citrea Testnet",
|
|
490
|
+
network: "testnet",
|
|
491
|
+
nativeCurrency: { name: "cBTC", symbol: "cBTC", decimals: 18 },
|
|
492
|
+
delegateContract: "0x9DE3D53419a8F821b6E2039A7249c5738004FB94",
|
|
493
|
+
blockExplorer: "https://explorer.testnet.citrea.xyz",
|
|
494
|
+
rpcUrl: "https://rpc.testnet.citrea.xyz",
|
|
495
|
+
logo: logo_citrea,
|
|
496
|
+
wrappedNativeTokenAddress: "0x8d0c9d1c17ae5e40fff9be350f57840e9e66cd93"
|
|
497
|
+
},
|
|
498
|
+
123420001114: {
|
|
499
|
+
id: 123420001114,
|
|
500
|
+
name: "Base Camp Testnet",
|
|
501
|
+
displayName: "Base Camp",
|
|
502
|
+
network: "testnet",
|
|
503
|
+
nativeCurrency: { name: "Ethereum", symbol: "ETH", decimals: 18 },
|
|
504
|
+
delegateContract: "0xA15BFeD4eC0BEdd36b00b9856aFa1C6BCFE61574",
|
|
505
|
+
blockExplorer: "https://basecamp.gelato.network",
|
|
506
|
+
rpcUrl: "https://rpc-campnetwork.xyz",
|
|
507
|
+
logo: logo_base
|
|
508
|
+
},
|
|
509
|
+
688688: {
|
|
510
|
+
id: 688688,
|
|
511
|
+
name: "Pharos Testnet",
|
|
512
|
+
displayName: "Pharos",
|
|
513
|
+
network: "testnet",
|
|
514
|
+
nativeCurrency: { name: "PHRS", symbol: "PHRS", decimals: 18 },
|
|
515
|
+
delegateContract: "0xAd45b774C4c632540d36f2105889C0E6aC28b504",
|
|
516
|
+
blockExplorer: "https://testnet.pharosscan.xyz",
|
|
517
|
+
rpcUrl: "https://testnet.dplabs-internal.com",
|
|
518
|
+
logo: logo_pharos
|
|
519
|
+
},
|
|
520
|
+
688689: {
|
|
521
|
+
id: 688689,
|
|
522
|
+
name: "Pharos Atlantic",
|
|
523
|
+
displayName: "Pharos Atlantic",
|
|
524
|
+
network: "testnet",
|
|
525
|
+
nativeCurrency: { name: "PHRS", symbol: "PHRS", decimals: 18 },
|
|
526
|
+
delegateContract: "0xAd45b774C4c632540d36f2105889C0E6aC28b504",
|
|
527
|
+
blockExplorer: "https://atlantic.pharosscan.xyz",
|
|
528
|
+
rpcUrl: "https://atlantic.dplabs-internal.com",
|
|
529
|
+
logo: logo_pharos
|
|
530
|
+
},
|
|
531
|
+
10143: {
|
|
532
|
+
id: 10143,
|
|
533
|
+
name: "Monad Testnet",
|
|
534
|
+
displayName: "Monad",
|
|
535
|
+
network: "testnet",
|
|
536
|
+
nativeCurrency: { name: "MON", symbol: "MON", decimals: 18 },
|
|
537
|
+
delegateContract: "0xEc4087643A1c5f532Fde98bCa029cebA4E47b053",
|
|
538
|
+
blockExplorer: "https://testnet.monadexplorer.com",
|
|
539
|
+
rpcUrl: "https://testnet-rpc.monad.xyz",
|
|
540
|
+
logo: logo_eth
|
|
541
|
+
},
|
|
542
|
+
97: {
|
|
543
|
+
id: 97,
|
|
544
|
+
name: "BSC Testnet",
|
|
545
|
+
displayName: "BSC Testnet",
|
|
546
|
+
network: "testnet",
|
|
547
|
+
nativeCurrency: { name: "tBNB", symbol: "tBNB", decimals: 18 },
|
|
548
|
+
delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
|
|
549
|
+
blockExplorer: "https://testnet.bscscan.com",
|
|
550
|
+
rpcUrl: "https://bsc-testnet.public.blastapi.io",
|
|
551
|
+
logo: logo_eth
|
|
552
|
+
},
|
|
553
|
+
43113: {
|
|
554
|
+
id: 43113,
|
|
555
|
+
name: "Avalanche Fuji",
|
|
556
|
+
displayName: "Avalanche Fuji",
|
|
557
|
+
network: "testnet",
|
|
558
|
+
nativeCurrency: { name: "AVAX", symbol: "AVAX", decimals: 18 },
|
|
559
|
+
delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
|
|
560
|
+
blockExplorer: "https://testnet.snowtrace.io",
|
|
561
|
+
rpcUrl: "https://avalanche-fuji.drpc.org",
|
|
562
|
+
logo: logo_eth
|
|
563
|
+
},
|
|
564
|
+
80002: {
|
|
565
|
+
id: 80002,
|
|
566
|
+
name: "Polygon Amoy",
|
|
567
|
+
displayName: "Polygon Amoy",
|
|
568
|
+
network: "testnet",
|
|
569
|
+
nativeCurrency: { name: "POL", symbol: "POL", decimals: 18 },
|
|
570
|
+
delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
|
|
571
|
+
blockExplorer: "https://amoy.polygonscan.com",
|
|
572
|
+
rpcUrl: "https://polygon-amoy-public.nodies.app",
|
|
573
|
+
logo: logo_eth
|
|
574
|
+
},
|
|
575
|
+
11155420: {
|
|
576
|
+
id: 11155420,
|
|
577
|
+
name: "Optimism Sepolia",
|
|
578
|
+
displayName: "Optimism Sepolia",
|
|
579
|
+
network: "testnet",
|
|
580
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
581
|
+
delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
|
|
582
|
+
blockExplorer: "https://sepolia-optimism.etherscan.io",
|
|
583
|
+
rpcUrl: "https://sepolia.optimism.io",
|
|
584
|
+
logo: logo_eth
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
// src/chains/index.ts
|
|
589
|
+
function getChainMeta(chainId) {
|
|
590
|
+
return CHAINS[chainId];
|
|
591
|
+
}
|
|
592
|
+
function getChainsByNetwork(network) {
|
|
593
|
+
return Object.values(CHAINS).filter((c) => c.network === network);
|
|
594
|
+
}
|
|
595
|
+
function getChainIdsByNetwork(network) {
|
|
596
|
+
return getChainsByNetwork(network).map((c) => c.id);
|
|
597
|
+
}
|
|
598
|
+
function getMainnetChains() {
|
|
599
|
+
return getChainsByNetwork("mainnet");
|
|
600
|
+
}
|
|
601
|
+
function getTestnetChains() {
|
|
602
|
+
return getChainsByNetwork("testnet");
|
|
603
|
+
}
|
|
604
|
+
function getDelegateContract(chainId) {
|
|
605
|
+
return CHAINS[chainId]?.delegateContract;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
// src/utils.ts
|
|
609
|
+
var NATIVE_TOKEN_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
610
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
611
|
+
var ESCROW_ADDRESS = "0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2";
|
|
612
|
+
function isNativeToken(address) {
|
|
613
|
+
const lower = address.toLowerCase();
|
|
614
|
+
return lower === "0x0" || lower === "0x0000000000000000000000000000000000000000" || lower === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
615
|
+
}
|
|
616
|
+
function normalizeNativeTokenAddress(address) {
|
|
617
|
+
if (isNativeToken(address)) {
|
|
618
|
+
return ZERO_ADDRESS;
|
|
619
|
+
}
|
|
620
|
+
return address;
|
|
621
|
+
}
|
|
622
|
+
function convertAmountBetweenDecimals(amount, fromDecimals, toDecimals) {
|
|
623
|
+
if (fromDecimals === toDecimals) return amount;
|
|
624
|
+
if (fromDecimals < toDecimals) {
|
|
625
|
+
return amount * BigInt(10) ** BigInt(toDecimals - fromDecimals);
|
|
626
|
+
}
|
|
627
|
+
return amount / BigInt(10) ** BigInt(fromDecimals - toDecimals);
|
|
628
|
+
}
|
|
629
|
+
function formatTokenAmount(amount, decimals, maxFractional = 6) {
|
|
630
|
+
const divisor = BigInt(10) ** BigInt(decimals);
|
|
631
|
+
const whole = amount / divisor;
|
|
632
|
+
const remainder = amount % divisor;
|
|
633
|
+
if (remainder === 0n) return whole.toString();
|
|
634
|
+
const fracStr = remainder.toString().padStart(decimals, "0").slice(0, maxFractional).replace(/0+$/, "");
|
|
635
|
+
if (!fracStr) return whole.toString();
|
|
636
|
+
return `${whole}.${fracStr}`;
|
|
637
|
+
}
|
|
638
|
+
function truncateAddress(address, startChars = 6, endChars = 4) {
|
|
639
|
+
if (address.length <= startChars + endChars) return address;
|
|
640
|
+
return `${address.slice(0, startChars)}...${address.slice(-endChars)}`;
|
|
641
|
+
}
|
|
642
|
+
async function withRetry(fn, maxRetries = 3, delayMs = 300) {
|
|
643
|
+
let lastErr;
|
|
644
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
645
|
+
try {
|
|
646
|
+
return await fn();
|
|
647
|
+
} catch (err) {
|
|
648
|
+
lastErr = err;
|
|
649
|
+
if (attempt < maxRetries) {
|
|
650
|
+
await new Promise((r) => setTimeout(r, delayMs * 2 ** attempt));
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
throw lastErr;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
// src/abis/delegate.ts
|
|
658
|
+
var DELEGATE_ABI = [
|
|
659
|
+
{
|
|
660
|
+
type: "fallback",
|
|
661
|
+
stateMutability: "payable"
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
type: "receive",
|
|
665
|
+
stateMutability: "payable"
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
type: "function",
|
|
669
|
+
name: "execute",
|
|
670
|
+
inputs: [
|
|
671
|
+
{
|
|
672
|
+
name: "intent",
|
|
673
|
+
type: "tuple",
|
|
674
|
+
internalType: "struct Delegate.Intent",
|
|
675
|
+
components: [
|
|
676
|
+
{ name: "signatureType", type: "string", internalType: "string" },
|
|
677
|
+
{ name: "signature", type: "bytes", internalType: "bytes" },
|
|
678
|
+
{ name: "nbf", type: "uint256", internalType: "uint256" },
|
|
679
|
+
{ name: "exp", type: "uint256", internalType: "uint256" },
|
|
680
|
+
{
|
|
681
|
+
name: "chainBatches",
|
|
682
|
+
type: "tuple[]",
|
|
683
|
+
internalType: "struct Delegate.ChainBatch[]",
|
|
684
|
+
components: [
|
|
685
|
+
{ name: "hash", type: "bytes32", internalType: "bytes32" },
|
|
686
|
+
{ name: "chainId", type: "uint256", internalType: "uint256" },
|
|
687
|
+
{
|
|
688
|
+
name: "calls",
|
|
689
|
+
type: "tuple[]",
|
|
690
|
+
internalType: "struct Delegate.Call[]",
|
|
691
|
+
components: [
|
|
692
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
693
|
+
{ name: "value", type: "uint256", internalType: "uint256" },
|
|
694
|
+
{ name: "data", type: "bytes", internalType: "bytes" }
|
|
695
|
+
]
|
|
696
|
+
}
|
|
697
|
+
]
|
|
698
|
+
}
|
|
699
|
+
]
|
|
700
|
+
}
|
|
701
|
+
],
|
|
702
|
+
outputs: [],
|
|
703
|
+
stateMutability: "payable"
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
type: "function",
|
|
707
|
+
name: "selfExecute",
|
|
708
|
+
inputs: [
|
|
709
|
+
{
|
|
710
|
+
name: "calls",
|
|
711
|
+
type: "tuple[]",
|
|
712
|
+
internalType: "struct Delegate.Call[]",
|
|
713
|
+
components: [
|
|
714
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
715
|
+
{ name: "value", type: "uint256", internalType: "uint256" },
|
|
716
|
+
{ name: "data", type: "bytes", internalType: "bytes" }
|
|
717
|
+
]
|
|
718
|
+
}
|
|
719
|
+
],
|
|
720
|
+
outputs: [],
|
|
721
|
+
stateMutability: "payable"
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
type: "function",
|
|
725
|
+
name: "isChainBatchProcessed",
|
|
726
|
+
inputs: [
|
|
727
|
+
{ name: "chainBatchHash", type: "bytes32", internalType: "bytes32" }
|
|
728
|
+
],
|
|
729
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
730
|
+
stateMutability: "view"
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
type: "function",
|
|
734
|
+
name: "normalizeIntentAndComputeHash",
|
|
735
|
+
inputs: [
|
|
736
|
+
{
|
|
737
|
+
name: "userIntent",
|
|
738
|
+
type: "tuple",
|
|
739
|
+
internalType: "struct Delegate.Intent",
|
|
740
|
+
components: [
|
|
741
|
+
{ name: "signatureType", type: "string", internalType: "string" },
|
|
742
|
+
{ name: "signature", type: "bytes", internalType: "bytes" },
|
|
743
|
+
{ name: "nbf", type: "uint256", internalType: "uint256" },
|
|
744
|
+
{ name: "exp", type: "uint256", internalType: "uint256" },
|
|
745
|
+
{
|
|
746
|
+
name: "chainBatches",
|
|
747
|
+
type: "tuple[]",
|
|
748
|
+
internalType: "struct Delegate.ChainBatch[]",
|
|
749
|
+
components: [
|
|
750
|
+
{ name: "hash", type: "bytes32", internalType: "bytes32" },
|
|
751
|
+
{ name: "chainId", type: "uint256", internalType: "uint256" },
|
|
752
|
+
{
|
|
753
|
+
name: "calls",
|
|
754
|
+
type: "tuple[]",
|
|
755
|
+
internalType: "struct Delegate.Call[]",
|
|
756
|
+
components: [
|
|
757
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
758
|
+
{ name: "value", type: "uint256", internalType: "uint256" },
|
|
759
|
+
{ name: "data", type: "bytes", internalType: "bytes" }
|
|
760
|
+
]
|
|
761
|
+
}
|
|
762
|
+
]
|
|
763
|
+
}
|
|
764
|
+
]
|
|
765
|
+
}
|
|
766
|
+
],
|
|
767
|
+
outputs: [
|
|
768
|
+
{
|
|
769
|
+
name: "intent",
|
|
770
|
+
type: "tuple",
|
|
771
|
+
internalType: "struct Delegate.Intent",
|
|
772
|
+
components: [
|
|
773
|
+
{ name: "signatureType", type: "string", internalType: "string" },
|
|
774
|
+
{ name: "signature", type: "bytes", internalType: "bytes" },
|
|
775
|
+
{ name: "nbf", type: "uint256", internalType: "uint256" },
|
|
776
|
+
{ name: "exp", type: "uint256", internalType: "uint256" },
|
|
777
|
+
{
|
|
778
|
+
name: "chainBatches",
|
|
779
|
+
type: "tuple[]",
|
|
780
|
+
internalType: "struct Delegate.ChainBatch[]",
|
|
781
|
+
components: [
|
|
782
|
+
{ name: "hash", type: "bytes32", internalType: "bytes32" },
|
|
783
|
+
{ name: "chainId", type: "uint256", internalType: "uint256" },
|
|
784
|
+
{
|
|
785
|
+
name: "calls",
|
|
786
|
+
type: "tuple[]",
|
|
787
|
+
internalType: "struct Delegate.Call[]",
|
|
788
|
+
components: [
|
|
789
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
790
|
+
{ name: "value", type: "uint256", internalType: "uint256" },
|
|
791
|
+
{ name: "data", type: "bytes", internalType: "bytes" }
|
|
792
|
+
]
|
|
793
|
+
}
|
|
794
|
+
]
|
|
795
|
+
}
|
|
796
|
+
]
|
|
797
|
+
},
|
|
798
|
+
{ name: "hash", type: "bytes32", internalType: "bytes32" }
|
|
799
|
+
],
|
|
800
|
+
stateMutability: "pure"
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
type: "event",
|
|
804
|
+
name: "BatchExecuted",
|
|
805
|
+
inputs: [
|
|
806
|
+
{ name: "block", type: "uint256", indexed: true, internalType: "uint256" },
|
|
807
|
+
{
|
|
808
|
+
name: "calls",
|
|
809
|
+
type: "tuple[]",
|
|
810
|
+
indexed: false,
|
|
811
|
+
internalType: "struct Delegate.Call[]",
|
|
812
|
+
components: [
|
|
813
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
814
|
+
{ name: "value", type: "uint256", internalType: "uint256" },
|
|
815
|
+
{ name: "data", type: "bytes", internalType: "bytes" }
|
|
816
|
+
]
|
|
817
|
+
}
|
|
818
|
+
],
|
|
819
|
+
anonymous: false
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
type: "event",
|
|
823
|
+
name: "CallExecuted",
|
|
824
|
+
inputs: [
|
|
825
|
+
{ name: "executor", type: "address", indexed: true, internalType: "address" },
|
|
826
|
+
{ name: "sender", type: "address", indexed: true, internalType: "address" },
|
|
827
|
+
{ name: "to", type: "address", indexed: true, internalType: "address" },
|
|
828
|
+
{ name: "value", type: "uint256", indexed: false, internalType: "uint256" },
|
|
829
|
+
{ name: "data", type: "bytes", indexed: false, internalType: "bytes" },
|
|
830
|
+
{ name: "returnData", type: "bytes", indexed: false, internalType: "bytes" }
|
|
831
|
+
],
|
|
832
|
+
anonymous: false
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
type: "event",
|
|
836
|
+
name: "IntentSubmitted",
|
|
837
|
+
inputs: [
|
|
838
|
+
{ name: "signature", type: "bytes", indexed: true, internalType: "bytes" }
|
|
839
|
+
],
|
|
840
|
+
anonymous: false
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
type: "error",
|
|
844
|
+
name: "CallReverted",
|
|
845
|
+
inputs: [
|
|
846
|
+
{ name: "account", type: "address", internalType: "address" },
|
|
847
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
848
|
+
{ name: "value", type: "uint256", internalType: "uint256" },
|
|
849
|
+
{ name: "data", type: "bytes", internalType: "bytes" },
|
|
850
|
+
{ name: "errorMessage", type: "bytes", internalType: "bytes" }
|
|
851
|
+
]
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
type: "error",
|
|
855
|
+
name: "DuplicateChainBatch",
|
|
856
|
+
inputs: [
|
|
857
|
+
{ name: "intentSignature", type: "bytes", internalType: "bytes" },
|
|
858
|
+
{ name: "chainBatchHash", type: "bytes32", internalType: "bytes32" },
|
|
859
|
+
{ name: "chainBatchId", type: "bytes32", internalType: "bytes32" }
|
|
860
|
+
]
|
|
861
|
+
},
|
|
862
|
+
{ type: "error", name: "ECDSAInvalidSignature", inputs: [] },
|
|
863
|
+
{
|
|
864
|
+
type: "error",
|
|
865
|
+
name: "ECDSAInvalidSignatureLength",
|
|
866
|
+
inputs: [{ name: "length", type: "uint256", internalType: "uint256" }]
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
type: "error",
|
|
870
|
+
name: "ECDSAInvalidSignatureS",
|
|
871
|
+
inputs: [{ name: "s", type: "bytes32", internalType: "bytes32" }]
|
|
872
|
+
},
|
|
873
|
+
{
|
|
874
|
+
type: "error",
|
|
875
|
+
name: "IntentExpired",
|
|
876
|
+
inputs: [
|
|
877
|
+
{ name: "currentTime", type: "uint256", internalType: "uint256" },
|
|
878
|
+
{ name: "exp", type: "uint256", internalType: "uint256" }
|
|
879
|
+
]
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
type: "error",
|
|
883
|
+
name: "IntentTooEarly",
|
|
884
|
+
inputs: [
|
|
885
|
+
{ name: "currentTime", type: "uint256", internalType: "uint256" },
|
|
886
|
+
{ name: "nbf", type: "uint256", internalType: "uint256" }
|
|
887
|
+
]
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
type: "error",
|
|
891
|
+
name: "InvalidAuthority",
|
|
892
|
+
inputs: [
|
|
893
|
+
{ name: "actual", type: "address", internalType: "address" },
|
|
894
|
+
{ name: "expected", type: "address", internalType: "address" }
|
|
895
|
+
]
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
type: "error",
|
|
899
|
+
name: "InvalidChainId",
|
|
900
|
+
inputs: [
|
|
901
|
+
{ name: "actual", type: "uint256", internalType: "uint256" },
|
|
902
|
+
{ name: "expected", type: "uint256", internalType: "uint256" }
|
|
903
|
+
]
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
type: "error",
|
|
907
|
+
name: "InvalidSignature",
|
|
908
|
+
inputs: [
|
|
909
|
+
{ name: "signatureType", type: "string", internalType: "string" },
|
|
910
|
+
{ name: "recovered", type: "address", internalType: "address" },
|
|
911
|
+
{ name: "expected", type: "address", internalType: "address" }
|
|
912
|
+
]
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
type: "error",
|
|
916
|
+
name: "InvalidSignatureType",
|
|
917
|
+
inputs: [{ name: "signatureType", type: "string", internalType: "string" }]
|
|
918
|
+
}
|
|
919
|
+
];
|
|
920
|
+
|
|
921
|
+
// src/abis/erc20.ts
|
|
922
|
+
var ERC20_ABI = [
|
|
923
|
+
{ inputs: [], name: "name", outputs: [{ type: "string" }], stateMutability: "view", type: "function" },
|
|
924
|
+
{ inputs: [], name: "symbol", outputs: [{ type: "string" }], stateMutability: "view", type: "function" },
|
|
925
|
+
{ inputs: [], name: "decimals", outputs: [{ type: "uint8" }], stateMutability: "view", type: "function" },
|
|
926
|
+
{ inputs: [{ name: "account", type: "address" }], name: "balanceOf", outputs: [{ type: "uint256" }], stateMutability: "view", type: "function" },
|
|
927
|
+
{ inputs: [{ name: "to", type: "address" }, { name: "amount", type: "uint256" }], name: "transfer", outputs: [{ type: "bool" }], stateMutability: "nonpayable", type: "function" },
|
|
928
|
+
{ inputs: [{ name: "from", type: "address" }, { name: "to", type: "address" }, { name: "amount", type: "uint256" }], name: "transferFrom", outputs: [{ type: "bool" }], stateMutability: "nonpayable", type: "function" },
|
|
929
|
+
{ inputs: [{ name: "spender", type: "address" }, { name: "amount", type: "uint256" }], name: "approve", outputs: [{ type: "bool" }], stateMutability: "nonpayable", type: "function" },
|
|
930
|
+
{ inputs: [{ name: "owner", type: "address" }, { name: "spender", type: "address" }], name: "allowance", outputs: [{ type: "uint256" }], stateMutability: "view", type: "function" },
|
|
931
|
+
{ anonymous: false, inputs: [{ indexed: true, name: "from", type: "address" }, { indexed: true, name: "to", type: "address" }, { indexed: false, name: "value", type: "uint256" }], name: "Transfer", type: "event" },
|
|
932
|
+
{ anonymous: false, inputs: [{ indexed: true, name: "owner", type: "address" }, { indexed: true, name: "spender", type: "address" }, { indexed: false, name: "value", type: "uint256" }], name: "Approval", type: "event" }
|
|
933
|
+
];
|
|
934
|
+
|
|
935
|
+
// src/abis/wcbtc.ts
|
|
936
|
+
var WCBTC_ABI = [
|
|
937
|
+
{ inputs: [], name: "name", outputs: [{ type: "string" }], stateMutability: "view", type: "function" },
|
|
938
|
+
{ inputs: [], name: "symbol", outputs: [{ type: "string" }], stateMutability: "view", type: "function" },
|
|
939
|
+
{ inputs: [], name: "decimals", outputs: [{ type: "uint8" }], stateMutability: "view", type: "function" },
|
|
940
|
+
{ inputs: [{ name: "account", type: "address" }], name: "balanceOf", outputs: [{ type: "uint256" }], stateMutability: "view", type: "function" },
|
|
941
|
+
{ inputs: [], name: "deposit", outputs: [], stateMutability: "payable", type: "function" },
|
|
942
|
+
{ inputs: [{ name: "amount", type: "uint256" }], name: "withdraw", outputs: [], stateMutability: "nonpayable", type: "function" },
|
|
943
|
+
{ stateMutability: "payable", type: "receive" },
|
|
944
|
+
{ stateMutability: "payable", type: "fallback" }
|
|
945
|
+
];
|
|
946
|
+
|
|
947
|
+
// src/abis/uniV3.ts
|
|
948
|
+
var uniV3QuoterV2Abi = [
|
|
949
|
+
{
|
|
950
|
+
inputs: [
|
|
951
|
+
{
|
|
952
|
+
components: [
|
|
953
|
+
{ internalType: "address", name: "tokenIn", type: "address" },
|
|
954
|
+
{ internalType: "address", name: "tokenOut", type: "address" },
|
|
955
|
+
{ internalType: "uint256", name: "amountIn", type: "uint256" },
|
|
956
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
957
|
+
{
|
|
958
|
+
internalType: "uint160",
|
|
959
|
+
name: "sqrtPriceLimitX96",
|
|
960
|
+
type: "uint160"
|
|
961
|
+
}
|
|
962
|
+
],
|
|
963
|
+
internalType: "struct IQuoterV2.QuoteExactInputSingleParams",
|
|
964
|
+
name: "params",
|
|
965
|
+
type: "tuple"
|
|
966
|
+
}
|
|
967
|
+
],
|
|
968
|
+
name: "quoteExactInputSingle",
|
|
969
|
+
outputs: [
|
|
970
|
+
{ internalType: "uint256", name: "amountOut", type: "uint256" },
|
|
971
|
+
{
|
|
972
|
+
internalType: "uint160",
|
|
973
|
+
name: "sqrtPriceX96After",
|
|
974
|
+
type: "uint160"
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
internalType: "uint32",
|
|
978
|
+
name: "initializedTicksCrossed",
|
|
979
|
+
type: "uint32"
|
|
980
|
+
},
|
|
981
|
+
{ internalType: "uint256", name: "gasEstimate", type: "uint256" }
|
|
982
|
+
],
|
|
983
|
+
stateMutability: "nonpayable",
|
|
984
|
+
type: "function"
|
|
985
|
+
}
|
|
986
|
+
];
|
|
987
|
+
var uniV3SwapRouterAbi = [
|
|
988
|
+
{
|
|
989
|
+
inputs: [
|
|
990
|
+
{
|
|
991
|
+
components: [
|
|
992
|
+
{ internalType: "address", name: "tokenIn", type: "address" },
|
|
993
|
+
{ internalType: "address", name: "tokenOut", type: "address" },
|
|
994
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
995
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
996
|
+
{ internalType: "uint256", name: "amountIn", type: "uint256" },
|
|
997
|
+
{
|
|
998
|
+
internalType: "uint256",
|
|
999
|
+
name: "amountOutMinimum",
|
|
1000
|
+
type: "uint256"
|
|
1001
|
+
},
|
|
1002
|
+
{
|
|
1003
|
+
internalType: "uint160",
|
|
1004
|
+
name: "sqrtPriceLimitX96",
|
|
1005
|
+
type: "uint160"
|
|
1006
|
+
}
|
|
1007
|
+
],
|
|
1008
|
+
internalType: "struct IV3SwapRouter.ExactInputSingleParams",
|
|
1009
|
+
name: "params",
|
|
1010
|
+
type: "tuple"
|
|
1011
|
+
}
|
|
1012
|
+
],
|
|
1013
|
+
name: "exactInputSingle",
|
|
1014
|
+
outputs: [
|
|
1015
|
+
{ internalType: "uint256", name: "amountOut", type: "uint256" }
|
|
1016
|
+
],
|
|
1017
|
+
stateMutability: "payable",
|
|
1018
|
+
type: "function"
|
|
1019
|
+
}
|
|
1020
|
+
];
|
|
1021
|
+
|
|
1022
|
+
// src/swap.ts
|
|
1023
|
+
import { encodeFunctionData, erc20Abi } from "viem";
|
|
1024
|
+
function applySlippage(amount, slippage = 0.03) {
|
|
1025
|
+
const slippageBps = BigInt(Math.floor((1 - slippage) * 1e4));
|
|
1026
|
+
return amount * slippageBps / 10000n;
|
|
1027
|
+
}
|
|
1028
|
+
function buildUniV3SwapCalls(params) {
|
|
1029
|
+
const {
|
|
1030
|
+
tokenIn,
|
|
1031
|
+
tokenOut,
|
|
1032
|
+
amountIn,
|
|
1033
|
+
amountOutMinimum,
|
|
1034
|
+
fee,
|
|
1035
|
+
recipient,
|
|
1036
|
+
config
|
|
1037
|
+
} = params;
|
|
1038
|
+
return [
|
|
1039
|
+
{
|
|
1040
|
+
to: tokenIn,
|
|
1041
|
+
value: 0n,
|
|
1042
|
+
data: encodeFunctionData({
|
|
1043
|
+
abi: erc20Abi,
|
|
1044
|
+
functionName: "approve",
|
|
1045
|
+
args: [config.swapRouter, amountIn]
|
|
1046
|
+
})
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
to: config.swapRouter,
|
|
1050
|
+
value: 0n,
|
|
1051
|
+
data: encodeFunctionData({
|
|
1052
|
+
abi: uniV3SwapRouterAbi,
|
|
1053
|
+
functionName: "exactInputSingle",
|
|
1054
|
+
args: [
|
|
1055
|
+
{
|
|
1056
|
+
tokenIn,
|
|
1057
|
+
tokenOut,
|
|
1058
|
+
fee,
|
|
1059
|
+
recipient,
|
|
1060
|
+
amountIn,
|
|
1061
|
+
amountOutMinimum,
|
|
1062
|
+
sqrtPriceLimitX96: 0n
|
|
1063
|
+
}
|
|
1064
|
+
]
|
|
1065
|
+
})
|
|
1066
|
+
}
|
|
1067
|
+
];
|
|
1068
|
+
}
|
|
180
1069
|
export {
|
|
181
|
-
|
|
182
|
-
|
|
1070
|
+
CHAINS,
|
|
1071
|
+
ChainBatchHashAbi,
|
|
1072
|
+
DELEGATE_ABI,
|
|
1073
|
+
ERC20_ABI,
|
|
1074
|
+
ESCROW_ADDRESS,
|
|
1075
|
+
HttpError,
|
|
1076
|
+
IntentHashAbi,
|
|
1077
|
+
NATIVE_TOKEN_ADDRESS,
|
|
183
1078
|
SpiceFlowCore,
|
|
1079
|
+
TOKENS,
|
|
1080
|
+
WCBTC_ABI,
|
|
1081
|
+
ZERO_ADDRESS,
|
|
1082
|
+
applySlippage,
|
|
1083
|
+
areEquivalent,
|
|
1084
|
+
buildUniV3SwapCalls,
|
|
1085
|
+
convertAmountBetweenDecimals,
|
|
1086
|
+
fetchWithRetry,
|
|
1087
|
+
formatTokenAmount,
|
|
184
1088
|
getAccountNonce,
|
|
1089
|
+
getChainIdsByNetwork,
|
|
1090
|
+
getChainMeta,
|
|
1091
|
+
getChainsByNetwork,
|
|
1092
|
+
getDelegateContract,
|
|
1093
|
+
getDeployment,
|
|
1094
|
+
getEquivalenceGroup,
|
|
1095
|
+
getEquivalentAddresses,
|
|
185
1096
|
getIntentHash,
|
|
186
1097
|
getIntentStepStatus,
|
|
1098
|
+
getMainnetChains,
|
|
187
1099
|
getRecentBlock,
|
|
1100
|
+
getTestnetChains,
|
|
1101
|
+
getTokenByAddress,
|
|
1102
|
+
getTokenDefinition,
|
|
1103
|
+
getTokensForChain,
|
|
188
1104
|
hashChainBatches,
|
|
1105
|
+
isBtcDenominated,
|
|
1106
|
+
isNativeToken,
|
|
1107
|
+
isUsdDenominated,
|
|
1108
|
+
normalizeNativeTokenAddress,
|
|
189
1109
|
prepareRFQT,
|
|
190
|
-
|
|
1110
|
+
resolveTokenRef,
|
|
1111
|
+
submitTransaction,
|
|
1112
|
+
truncateAddress,
|
|
1113
|
+
uniV3QuoterV2Abi,
|
|
1114
|
+
uniV3SwapRouterAbi,
|
|
1115
|
+
withRetry
|
|
191
1116
|
};
|