@across-protocol/sdk 4.3.139 → 4.3.140-alpha.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/dist/cjs/src/arch/evm/SpokeUtils.d.ts +3 -3
- package/dist/cjs/src/arch/evm/SpokeUtils.js +1 -1
- package/dist/cjs/src/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/src/arch/evm/UpgradeUtils.d.ts +2 -0
- package/dist/cjs/src/arch/evm/UpgradeUtils.js +11 -0
- package/dist/cjs/src/arch/evm/UpgradeUtils.js.map +1 -0
- package/dist/cjs/src/arch/evm/index.d.ts +1 -0
- package/dist/cjs/src/arch/evm/index.js +1 -0
- package/dist/cjs/src/arch/evm/index.js.map +1 -1
- package/dist/cjs/src/arch/index.d.ts +1 -0
- package/dist/cjs/src/arch/index.js +2 -1
- package/dist/cjs/src/arch/index.js.map +1 -1
- package/dist/cjs/src/arch/tvm/SpokeUtils.d.ts +12 -0
- package/dist/cjs/src/arch/tvm/SpokeUtils.js +101 -0
- package/dist/cjs/src/arch/tvm/SpokeUtils.js.map +1 -0
- package/dist/cjs/src/arch/tvm/TransactionUtils.d.ts +16 -0
- package/dist/cjs/src/arch/tvm/TransactionUtils.js +51 -0
- package/dist/cjs/src/arch/tvm/TransactionUtils.js.map +1 -0
- package/dist/cjs/src/arch/tvm/index.d.ts +2 -0
- package/dist/cjs/src/arch/tvm/index.js +6 -0
- package/dist/cjs/src/arch/tvm/index.js.map +1 -0
- package/dist/cjs/src/clients/BundleDataClient/BundleDataClient.js +3 -1
- package/dist/cjs/src/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/cjs/src/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +10 -2
- package/dist/cjs/src/clients/SpokePoolClient/EVMSpokePoolClient.js +40 -14
- package/dist/cjs/src/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/src/gasPriceOracle/oracle.js +1 -0
- package/dist/cjs/src/gasPriceOracle/oracle.js.map +1 -1
- package/dist/cjs/src/relayFeeCalculator/chain-queries/baseQuery.d.ts +3 -3
- package/dist/cjs/src/relayFeeCalculator/chain-queries/baseQuery.js +6 -6
- package/dist/cjs/src/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/src/utils/AddressUtils.d.ts +11 -0
- package/dist/cjs/src/utils/AddressUtils.js +47 -2
- package/dist/cjs/src/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/src/utils/BlockExplorerUtils.js +13 -2
- package/dist/cjs/src/utils/BlockExplorerUtils.js.map +1 -1
- package/dist/cjs/src/utils/Multicall.js +1 -0
- package/dist/cjs/src/utils/Multicall.js.map +1 -1
- package/dist/cjs/src/utils/NetworkUtils.d.ts +1 -0
- package/dist/cjs/src/utils/NetworkUtils.js +8 -3
- package/dist/cjs/src/utils/NetworkUtils.js.map +1 -1
- package/dist/cjs/src/utils/TypeGuards.d.ts +3 -1
- package/dist/cjs/src/utils/TypeGuards.js +4 -0
- package/dist/cjs/src/utils/TypeGuards.js.map +1 -1
- package/dist/cjs/src/utils/abi/typechain/SP1AutoVerifier.d.ts +42 -0
- package/dist/cjs/src/utils/abi/typechain/SP1AutoVerifier.js +3 -0
- package/dist/cjs/src/utils/abi/typechain/SP1AutoVerifier.js.map +1 -0
- package/dist/cjs/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.d.ts +26 -0
- package/dist/cjs/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.js +40 -0
- package/dist/cjs/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.js.map +1 -0
- package/dist/cjs/src/utils/abi/typechain/factories/index.d.ts +1 -0
- package/dist/cjs/src/utils/abi/typechain/factories/index.js +4 -2
- package/dist/cjs/src/utils/abi/typechain/factories/index.js.map +1 -1
- package/dist/cjs/src/utils/abi/typechain/index.d.ts +2 -0
- package/dist/cjs/src/utils/abi/typechain/index.js +4 -2
- package/dist/cjs/src/utils/abi/typechain/index.js.map +1 -1
- package/dist/esm/src/arch/evm/SpokeUtils.d.ts +3 -3
- package/dist/esm/src/arch/evm/SpokeUtils.js +1 -1
- package/dist/esm/src/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/src/arch/evm/UpgradeUtils.d.ts +9 -0
- package/dist/esm/src/arch/evm/UpgradeUtils.js +15 -0
- package/dist/esm/src/arch/evm/UpgradeUtils.js.map +1 -0
- package/dist/esm/src/arch/evm/index.d.ts +1 -0
- package/dist/esm/src/arch/evm/index.js +1 -0
- package/dist/esm/src/arch/evm/index.js.map +1 -1
- package/dist/esm/src/arch/index.d.ts +1 -0
- package/dist/esm/src/arch/index.js +2 -0
- package/dist/esm/src/arch/index.js.map +1 -1
- package/dist/esm/src/arch/tvm/SpokeUtils.d.ts +48 -0
- package/dist/esm/src/arch/tvm/SpokeUtils.js +138 -0
- package/dist/esm/src/arch/tvm/SpokeUtils.js.map +1 -0
- package/dist/esm/src/arch/tvm/TransactionUtils.d.ts +41 -0
- package/dist/esm/src/arch/tvm/TransactionUtils.js +78 -0
- package/dist/esm/src/arch/tvm/TransactionUtils.js.map +1 -0
- package/dist/esm/src/arch/tvm/index.d.ts +2 -0
- package/dist/esm/src/arch/tvm/index.js +3 -0
- package/dist/esm/src/arch/tvm/index.js.map +1 -0
- package/dist/esm/src/clients/BundleDataClient/BundleDataClient.js +4 -2
- package/dist/esm/src/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/esm/src/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +21 -2
- package/dist/esm/src/clients/SpokePoolClient/EVMSpokePoolClient.js +52 -15
- package/dist/esm/src/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/src/gasPriceOracle/oracle.js +1 -0
- package/dist/esm/src/gasPriceOracle/oracle.js.map +1 -1
- package/dist/esm/src/relayFeeCalculator/chain-queries/baseQuery.d.ts +3 -3
- package/dist/esm/src/relayFeeCalculator/chain-queries/baseQuery.js +6 -6
- package/dist/esm/src/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/src/utils/AddressUtils.d.ts +11 -0
- package/dist/esm/src/utils/AddressUtils.js +53 -2
- package/dist/esm/src/utils/AddressUtils.js.map +1 -1
- package/dist/esm/src/utils/BlockExplorerUtils.js +15 -3
- package/dist/esm/src/utils/BlockExplorerUtils.js.map +1 -1
- package/dist/esm/src/utils/Multicall.js +1 -0
- package/dist/esm/src/utils/Multicall.js.map +1 -1
- package/dist/esm/src/utils/NetworkUtils.d.ts +6 -0
- package/dist/esm/src/utils/NetworkUtils.js +12 -3
- package/dist/esm/src/utils/NetworkUtils.js.map +1 -1
- package/dist/esm/src/utils/TypeGuards.d.ts +3 -1
- package/dist/esm/src/utils/TypeGuards.js +3 -0
- package/dist/esm/src/utils/TypeGuards.js.map +1 -1
- package/dist/esm/src/utils/abi/typechain/SP1AutoVerifier.d.ts +42 -0
- package/dist/esm/src/utils/abi/typechain/SP1AutoVerifier.js +2 -0
- package/dist/esm/src/utils/abi/typechain/SP1AutoVerifier.js.map +1 -0
- package/dist/esm/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.d.ts +26 -0
- package/dist/esm/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.js +39 -0
- package/dist/esm/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.js.map +1 -0
- package/dist/esm/src/utils/abi/typechain/factories/index.d.ts +1 -0
- package/dist/esm/src/utils/abi/typechain/factories/index.js +1 -0
- package/dist/esm/src/utils/abi/typechain/factories/index.js.map +1 -1
- package/dist/esm/src/utils/abi/typechain/index.d.ts +2 -0
- package/dist/esm/src/utils/abi/typechain/index.js +1 -0
- package/dist/esm/src/utils/abi/typechain/index.js.map +1 -1
- package/dist/types/src/arch/evm/SpokeUtils.d.ts +3 -3
- package/dist/types/src/arch/evm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/src/arch/evm/UpgradeUtils.d.ts +10 -0
- package/dist/types/src/arch/evm/UpgradeUtils.d.ts.map +1 -0
- package/dist/types/src/arch/evm/index.d.ts +1 -0
- package/dist/types/src/arch/evm/index.d.ts.map +1 -1
- package/dist/types/src/arch/index.d.ts +1 -0
- package/dist/types/src/arch/index.d.ts.map +1 -1
- package/dist/types/src/arch/tvm/SpokeUtils.d.ts +49 -0
- package/dist/types/src/arch/tvm/SpokeUtils.d.ts.map +1 -0
- package/dist/types/src/arch/tvm/TransactionUtils.d.ts +42 -0
- package/dist/types/src/arch/tvm/TransactionUtils.d.ts.map +1 -0
- package/dist/types/src/arch/tvm/index.d.ts +3 -0
- package/dist/types/src/arch/tvm/index.d.ts.map +1 -0
- package/dist/types/src/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
- package/dist/types/src/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +21 -2
- package/dist/types/src/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
- package/dist/types/src/relayFeeCalculator/chain-queries/baseQuery.d.ts +3 -3
- package/dist/types/src/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
- package/dist/types/src/utils/AddressUtils.d.ts +11 -0
- package/dist/types/src/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/src/utils/BlockExplorerUtils.d.ts.map +1 -1
- package/dist/types/src/utils/Multicall.d.ts.map +1 -1
- package/dist/types/src/utils/NetworkUtils.d.ts +6 -0
- package/dist/types/src/utils/NetworkUtils.d.ts.map +1 -1
- package/dist/types/src/utils/TypeGuards.d.ts +3 -1
- package/dist/types/src/utils/TypeGuards.d.ts.map +1 -1
- package/dist/types/src/utils/abi/typechain/SP1AutoVerifier.d.ts +43 -0
- package/dist/types/src/utils/abi/typechain/SP1AutoVerifier.d.ts.map +1 -0
- package/dist/types/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.d.ts +27 -0
- package/dist/types/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.d.ts.map +1 -0
- package/dist/types/src/utils/abi/typechain/factories/index.d.ts +1 -0
- package/dist/types/src/utils/abi/typechain/factories/index.d.ts.map +1 -1
- package/dist/types/src/utils/abi/typechain/index.d.ts +2 -0
- package/dist/types/src/utils/abi/typechain/index.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/arch/evm/SpokeUtils.ts +3 -4
- package/src/arch/evm/UpgradeUtils.ts +18 -0
- package/src/arch/evm/index.ts +1 -0
- package/src/arch/index.ts +1 -0
- package/src/arch/tvm/SpokeUtils.ts +225 -0
- package/src/arch/tvm/TransactionUtils.ts +126 -0
- package/src/arch/tvm/index.ts +2 -0
- package/src/clients/BundleDataClient/BundleDataClient.ts +4 -1
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +69 -21
- package/src/gasPriceOracle/oracle.ts +1 -0
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +24 -8
- package/src/utils/AddressUtils.ts +62 -2
- package/src/utils/BlockExplorerUtils.ts +14 -3
- package/src/utils/Multicall.ts +1 -0
- package/src/utils/NetworkUtils.ts +13 -3
- package/src/utils/TypeGuards.ts +6 -1
- package/src/utils/abi/contracts/SP1AutoVerifier.json +25 -0
- package/src/utils/abi/typechain/SP1AutoVerifier.ts +112 -0
- package/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.ts +49 -0
- package/src/utils/abi/typechain/factories/index.ts +1 -0
- package/src/utils/abi/typechain/index.ts +2 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { isAddress } from "viem";
|
|
2
2
|
import { providers, utils } from "ethers";
|
|
3
3
|
import bs58 from "bs58";
|
|
4
|
-
import {
|
|
4
|
+
import { TronWeb } from "tronweb";
|
|
5
|
+
import { BigNumber, chainIsEvm, chainIsSvm, chainIsTvm } from "./";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Verify whether an address' bytecode resembles an EIP-7702 delegation.
|
|
@@ -105,7 +106,8 @@ export function isValidEvmAddress(address: string): boolean {
|
|
|
105
106
|
export function toAddressType(address: string, chainId: number): Address {
|
|
106
107
|
const rawAddress = address.startsWith("0x") ? utils.arrayify(address) : bs58.decode(address);
|
|
107
108
|
|
|
108
|
-
if (
|
|
109
|
+
if (chainIsTvm(chainId)) return TvmAddress.from(address);
|
|
110
|
+
else if (chainIsEvm(chainId) && EvmAddress.validate(rawAddress)) return new EvmAddress(rawAddress);
|
|
109
111
|
else if (chainIsSvm(chainId) && SvmAddress.validate(rawAddress)) return new SvmAddress(rawAddress);
|
|
110
112
|
|
|
111
113
|
return new RawAddress(rawAddress);
|
|
@@ -187,6 +189,7 @@ export abstract class Address {
|
|
|
187
189
|
isValidOn(chainId: number): boolean {
|
|
188
190
|
if (chainIsEvm(chainId)) return EvmAddress.validate(this.rawAddress);
|
|
189
191
|
if (chainIsSvm(chainId)) return SvmAddress.validate(this.rawAddress);
|
|
192
|
+
if (chainIsTvm(chainId)) return TvmAddress.validate(this.rawAddress);
|
|
190
193
|
return false;
|
|
191
194
|
}
|
|
192
195
|
|
|
@@ -227,6 +230,10 @@ export abstract class Address {
|
|
|
227
230
|
isSVM(): this is SvmAddress {
|
|
228
231
|
return false;
|
|
229
232
|
}
|
|
233
|
+
|
|
234
|
+
isTVM(): this is TvmAddress {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
230
237
|
}
|
|
231
238
|
|
|
232
239
|
// Subclass of address which strictly deals with 20-byte addresses. These addresses are guaranteed to be valid EVM addresses, so `toAddress` will always succeed.
|
|
@@ -304,6 +311,59 @@ export class SvmAddress extends Address {
|
|
|
304
311
|
}
|
|
305
312
|
}
|
|
306
313
|
|
|
314
|
+
// Subclass of address which handles TRON (TVM) addresses. Internally stores a 20-byte address (same as EVM),
|
|
315
|
+
// but toNative() returns the TRON Base58Check-encoded address (T...).
|
|
316
|
+
export class TvmAddress extends Address {
|
|
317
|
+
private readonly _type = "tvm";
|
|
318
|
+
private nativeAddress: string | undefined = undefined;
|
|
319
|
+
|
|
320
|
+
constructor(rawAddress: Uint8Array) {
|
|
321
|
+
if (!TvmAddress.validate(rawAddress)) {
|
|
322
|
+
throw new Error(`${utils.hexlify(rawAddress)} is not a valid TVM address`);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
super(rawAddress);
|
|
326
|
+
this._type; // tsc noUnusedLocals appeasement.
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
static validate(rawAddress: Uint8Array): boolean {
|
|
330
|
+
return (
|
|
331
|
+
rawAddress.length == 20 || (rawAddress.length === 32 && rawAddress.slice(0, 12).every((field) => field === 0))
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
override isTVM(): this is TvmAddress {
|
|
336
|
+
return true;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Returns the TRON Base58Check-encoded address (T...).
|
|
340
|
+
override toNative(): string {
|
|
341
|
+
const computeNative = () => {
|
|
342
|
+
const hexString = utils.hexlify(this.rawAddress);
|
|
343
|
+
// Strip leading zeros to get the 20-byte portion, then convert to TRON format.
|
|
344
|
+
const evmHex = utils.hexZeroPad(utils.hexStripZeros(hexString), 20);
|
|
345
|
+
return TronWeb.address.fromHex(evmHex);
|
|
346
|
+
};
|
|
347
|
+
return (this.nativeAddress ??= computeNative());
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
override toHexString(): string {
|
|
351
|
+
return this.toEvmAddress();
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// Constructs a new TvmAddress from a string. Accepts both 0x-prefixed hex and TRON Base58Check addresses.
|
|
355
|
+
static from(address: string): TvmAddress {
|
|
356
|
+
if (address.startsWith("0x")) {
|
|
357
|
+
return new this(utils.arrayify(address));
|
|
358
|
+
}
|
|
359
|
+
// For base58 Tron addresses, convert via TronWeb to get the hex representation.
|
|
360
|
+
const hex = TronWeb.address.toHex(address);
|
|
361
|
+
// TronWeb returns hex with a 0x41 prefix (TRON's address byte). Strip 0x41 to get 20 bytes.
|
|
362
|
+
const rawHex = "0x" + hex.slice(2);
|
|
363
|
+
return new this(utils.arrayify(rawHex));
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
307
367
|
export class RawAddress extends Address {
|
|
308
368
|
private readonly _type = "raw";
|
|
309
369
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ethers } from "ethers";
|
|
2
2
|
import { PUBLIC_NETWORKS } from "../constants";
|
|
3
3
|
import { createShortenedString } from "./FormattingUtils";
|
|
4
|
-
import { chainIsEvm } from "./NetworkUtils";
|
|
4
|
+
import { chainIsEvm, chainIsTvm } from "./NetworkUtils";
|
|
5
5
|
import { isDefined } from "./TypeGuards";
|
|
6
6
|
import bs58 from "bs58";
|
|
7
7
|
|
|
@@ -59,7 +59,7 @@ function _createBlockExplorerLinkMarkdown(addr: string, chainId = 1): string | n
|
|
|
59
59
|
return `<unsupported chain/hash ${chainId}:${addr}>}`;
|
|
60
60
|
}
|
|
61
61
|
// Ensure that the first two characters are "0x". If they are not, append them.
|
|
62
|
-
if (addr.substring(0, 2) !== "0x" && chainIsEvm(chainId)) {
|
|
62
|
+
if (addr.substring(0, 2) !== "0x" && chainIsEvm(chainId) && !chainIsTvm(chainId)) {
|
|
63
63
|
addr = `0x${addr}`;
|
|
64
64
|
if (!ethers.utils.isHexString(addr)) {
|
|
65
65
|
return null;
|
|
@@ -67,7 +67,18 @@ function _createBlockExplorerLinkMarkdown(addr: string, chainId = 1): string | n
|
|
|
67
67
|
}
|
|
68
68
|
// Resolve the short URL string.
|
|
69
69
|
const shortURLString = createShortenedString(addr);
|
|
70
|
-
if (
|
|
70
|
+
if (chainIsTvm(chainId)) {
|
|
71
|
+
// TronScan-style URLs use `/#/transaction/...` and `/#/address/...`.
|
|
72
|
+
const txHexNoPrefix = addr.startsWith("0x") ? addr.slice(2) : addr;
|
|
73
|
+
if (txHexNoPrefix.length === 64 && ethers.utils.isHexString(`0x${txHexNoPrefix}`)) {
|
|
74
|
+
const txIdForUrl = txHexNoPrefix.toLowerCase();
|
|
75
|
+
return `<${constructURL(explorerDomain, ["#", "transaction", txIdForUrl])} | ${shortURLString}>`;
|
|
76
|
+
}
|
|
77
|
+
if (/^T[1-9A-HJ-NP-Za-km-z]{33}$/.test(addr)) {
|
|
78
|
+
return `<${constructURL(explorerDomain, ["#", "address", addr])} | ${shortURLString}>`;
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
} else if (chainIsEvm(chainId)) {
|
|
71
82
|
// Iterate over the two possible addr lengths.
|
|
72
83
|
for (const [length, route] of [
|
|
73
84
|
[66, "tx"],
|
package/src/utils/Multicall.ts
CHANGED
|
@@ -21,6 +21,7 @@ const MULTICALL_DEPLOYER = "0x05f32B3cC3888453ff71B01135B34FF8e41263F2";
|
|
|
21
21
|
|
|
22
22
|
const NON_DETERMINISTIC_MULTICALL_ADDRESSES = {
|
|
23
23
|
[CHAIN_IDs.LENS]: "0x6b6dEa4D80e3077D076733A04c48F63c3BA49320",
|
|
24
|
+
[CHAIN_IDs.TRON]: "0x32a4f47a74a6810bd0bf861cabab99656a75de9e", // @todo: Base58?
|
|
24
25
|
[CHAIN_IDs.ZK_SYNC]: "0xF9cda624FBC7e059355ce98a31693d299FACd963",
|
|
25
26
|
[CHAIN_IDs.LENS_SEPOLIA]: "0x8A44EDE8a6843a997bC0Cc4659e4dB1Da8f91116",
|
|
26
27
|
};
|
|
@@ -134,6 +134,15 @@ export function chainIsSvm(chainId: number): boolean {
|
|
|
134
134
|
return PUBLIC_NETWORKS[chainId]?.family === ChainFamily.SVM;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Determines whether a chain ID runs on a TVM-like execution layer (e.g. TRON).
|
|
139
|
+
* @param chainId Chain ID to evaluate.
|
|
140
|
+
* @returns True if chain corresponding to chainId has a TVM-like execution layer.
|
|
141
|
+
*/
|
|
142
|
+
export function chainIsTvm(chainId: number): boolean {
|
|
143
|
+
return PUBLIC_NETWORKS[chainId]?.family === ChainFamily.TVM;
|
|
144
|
+
}
|
|
145
|
+
|
|
137
146
|
/**
|
|
138
147
|
* Determines whether a chain ID has a native gas token.
|
|
139
148
|
* @param chainId Chain ID to evaluate.
|
|
@@ -166,13 +175,14 @@ export function chainIsOFTEnabled(chainId: number): boolean {
|
|
|
166
175
|
// This is backwards vs. CCTP logic because Across support for OFTs is limited vs. OFT deployments.
|
|
167
176
|
const oftEnabled = [
|
|
168
177
|
CHAIN_IDs.ARBITRUM,
|
|
169
|
-
CHAIN_IDs.POLYGON,
|
|
170
178
|
CHAIN_IDs.HYPEREVM,
|
|
179
|
+
CHAIN_IDs.INK,
|
|
180
|
+
CHAIN_IDs.MEGAETH,
|
|
171
181
|
CHAIN_IDs.MONAD,
|
|
172
182
|
CHAIN_IDs.PLASMA,
|
|
173
|
-
CHAIN_IDs.
|
|
183
|
+
CHAIN_IDs.POLYGON,
|
|
184
|
+
CHAIN_IDs.TRON, // tbd!!!
|
|
174
185
|
CHAIN_IDs.UNICHAIN,
|
|
175
|
-
CHAIN_IDs.INK,
|
|
176
186
|
];
|
|
177
187
|
return oftEnabled.includes(chainId) && PRODUCTION_NETWORKS[chainId]?.oftEid !== OFT_NO_EID;
|
|
178
188
|
}
|
package/src/utils/TypeGuards.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SVMProvider } from "../arch/svm/types";
|
|
2
2
|
import { EvmProvider } from "../arch/evm/types";
|
|
3
3
|
import { providers } from "ethers";
|
|
4
|
+
import { TronWeb } from "tronweb";
|
|
4
5
|
|
|
5
6
|
export function isPromiseFulfilled<T>(
|
|
6
7
|
promiseSettledResult: PromiseSettledResult<T>
|
|
@@ -18,6 +19,10 @@ export function isDefined<T>(input: T | null | undefined): input is T {
|
|
|
18
19
|
return input !== null && input !== undefined;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
export function
|
|
22
|
+
export function isTvmProvider(provider: EvmProvider | SVMProvider | TronWeb): provider is TronWeb {
|
|
23
|
+
return typeof (provider as TronWeb)?.trx?.getEnergyPrices === "function";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function isEvmProvider(provider: EvmProvider | SVMProvider | TronWeb): provider is EvmProvider {
|
|
22
27
|
return provider instanceof providers.Provider;
|
|
23
28
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "function",
|
|
4
|
+
"name": "verifyProof",
|
|
5
|
+
"inputs": [
|
|
6
|
+
{
|
|
7
|
+
"name": "",
|
|
8
|
+
"type": "bytes32",
|
|
9
|
+
"internalType": "bytes32"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "",
|
|
13
|
+
"type": "bytes",
|
|
14
|
+
"internalType": "bytes"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "",
|
|
18
|
+
"type": "bytes",
|
|
19
|
+
"internalType": "bytes"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"outputs": [],
|
|
23
|
+
"stateMutability": "pure"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
import type {
|
|
5
|
+
BaseContract,
|
|
6
|
+
BigNumber,
|
|
7
|
+
BytesLike,
|
|
8
|
+
CallOverrides,
|
|
9
|
+
PopulatedTransaction,
|
|
10
|
+
Signer,
|
|
11
|
+
utils,
|
|
12
|
+
} from "ethers";
|
|
13
|
+
import type { FunctionFragment, Result } from "@ethersproject/abi";
|
|
14
|
+
import type { Listener, Provider } from "@ethersproject/providers";
|
|
15
|
+
import type {
|
|
16
|
+
TypedEventFilter,
|
|
17
|
+
TypedEvent,
|
|
18
|
+
TypedListener,
|
|
19
|
+
OnEvent,
|
|
20
|
+
} from "./common";
|
|
21
|
+
|
|
22
|
+
export interface SP1AutoVerifierInterface extends utils.Interface {
|
|
23
|
+
functions: {
|
|
24
|
+
"verifyProof(bytes32,bytes,bytes)": FunctionFragment;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
getFunction(nameOrSignatureOrTopic: "verifyProof"): FunctionFragment;
|
|
28
|
+
|
|
29
|
+
encodeFunctionData(
|
|
30
|
+
functionFragment: "verifyProof",
|
|
31
|
+
values: [BytesLike, BytesLike, BytesLike]
|
|
32
|
+
): string;
|
|
33
|
+
|
|
34
|
+
decodeFunctionResult(
|
|
35
|
+
functionFragment: "verifyProof",
|
|
36
|
+
data: BytesLike
|
|
37
|
+
): Result;
|
|
38
|
+
|
|
39
|
+
events: {};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SP1AutoVerifier extends BaseContract {
|
|
43
|
+
connect(signerOrProvider: Signer | Provider | string): this;
|
|
44
|
+
attach(addressOrName: string): this;
|
|
45
|
+
deployed(): Promise<this>;
|
|
46
|
+
|
|
47
|
+
interface: SP1AutoVerifierInterface;
|
|
48
|
+
|
|
49
|
+
queryFilter<TEvent extends TypedEvent>(
|
|
50
|
+
event: TypedEventFilter<TEvent>,
|
|
51
|
+
fromBlockOrBlockhash?: string | number | undefined,
|
|
52
|
+
toBlock?: string | number | undefined
|
|
53
|
+
): Promise<Array<TEvent>>;
|
|
54
|
+
|
|
55
|
+
listeners<TEvent extends TypedEvent>(
|
|
56
|
+
eventFilter?: TypedEventFilter<TEvent>
|
|
57
|
+
): Array<TypedListener<TEvent>>;
|
|
58
|
+
listeners(eventName?: string): Array<Listener>;
|
|
59
|
+
removeAllListeners<TEvent extends TypedEvent>(
|
|
60
|
+
eventFilter: TypedEventFilter<TEvent>
|
|
61
|
+
): this;
|
|
62
|
+
removeAllListeners(eventName?: string): this;
|
|
63
|
+
off: OnEvent<this>;
|
|
64
|
+
on: OnEvent<this>;
|
|
65
|
+
once: OnEvent<this>;
|
|
66
|
+
removeListener: OnEvent<this>;
|
|
67
|
+
|
|
68
|
+
functions: {
|
|
69
|
+
verifyProof(
|
|
70
|
+
arg0: BytesLike,
|
|
71
|
+
arg1: BytesLike,
|
|
72
|
+
arg2: BytesLike,
|
|
73
|
+
overrides?: CallOverrides
|
|
74
|
+
): Promise<[void]>;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
verifyProof(
|
|
78
|
+
arg0: BytesLike,
|
|
79
|
+
arg1: BytesLike,
|
|
80
|
+
arg2: BytesLike,
|
|
81
|
+
overrides?: CallOverrides
|
|
82
|
+
): Promise<void>;
|
|
83
|
+
|
|
84
|
+
callStatic: {
|
|
85
|
+
verifyProof(
|
|
86
|
+
arg0: BytesLike,
|
|
87
|
+
arg1: BytesLike,
|
|
88
|
+
arg2: BytesLike,
|
|
89
|
+
overrides?: CallOverrides
|
|
90
|
+
): Promise<void>;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
filters: {};
|
|
94
|
+
|
|
95
|
+
estimateGas: {
|
|
96
|
+
verifyProof(
|
|
97
|
+
arg0: BytesLike,
|
|
98
|
+
arg1: BytesLike,
|
|
99
|
+
arg2: BytesLike,
|
|
100
|
+
overrides?: CallOverrides
|
|
101
|
+
): Promise<BigNumber>;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
populateTransaction: {
|
|
105
|
+
verifyProof(
|
|
106
|
+
arg0: BytesLike,
|
|
107
|
+
arg1: BytesLike,
|
|
108
|
+
arg2: BytesLike,
|
|
109
|
+
overrides?: CallOverrides
|
|
110
|
+
): Promise<PopulatedTransaction>;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
import { Contract, Signer, utils } from "ethers";
|
|
6
|
+
import type { Provider } from "@ethersproject/providers";
|
|
7
|
+
import type {
|
|
8
|
+
SP1AutoVerifier,
|
|
9
|
+
SP1AutoVerifierInterface,
|
|
10
|
+
} from "../SP1AutoVerifier";
|
|
11
|
+
|
|
12
|
+
const _abi = [
|
|
13
|
+
{
|
|
14
|
+
type: "function",
|
|
15
|
+
name: "verifyProof",
|
|
16
|
+
inputs: [
|
|
17
|
+
{
|
|
18
|
+
name: "",
|
|
19
|
+
type: "bytes32",
|
|
20
|
+
internalType: "bytes32",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "",
|
|
24
|
+
type: "bytes",
|
|
25
|
+
internalType: "bytes",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "",
|
|
29
|
+
type: "bytes",
|
|
30
|
+
internalType: "bytes",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
outputs: [],
|
|
34
|
+
stateMutability: "pure",
|
|
35
|
+
},
|
|
36
|
+
] as const;
|
|
37
|
+
|
|
38
|
+
export class SP1AutoVerifier__factory {
|
|
39
|
+
static readonly abi = _abi;
|
|
40
|
+
static createInterface(): SP1AutoVerifierInterface {
|
|
41
|
+
return new utils.Interface(_abi) as SP1AutoVerifierInterface;
|
|
42
|
+
}
|
|
43
|
+
static connect(
|
|
44
|
+
address: string,
|
|
45
|
+
signerOrProvider: Signer | Provider
|
|
46
|
+
): SP1AutoVerifier {
|
|
47
|
+
return new Contract(address, _abi, signerOrProvider) as SP1AutoVerifier;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -254,6 +254,7 @@ export { ProxyAdmin__factory } from "./ProxyAdmin__factory";
|
|
|
254
254
|
export { ReentrancyGuard__factory } from "./ReentrancyGuard__factory";
|
|
255
255
|
export { ReentrancyGuardUpgradeable__factory } from "./ReentrancyGuardUpgradeable__factory";
|
|
256
256
|
export { Router_Adapter__factory } from "./Router_Adapter__factory";
|
|
257
|
+
export { SP1AutoVerifier__factory } from "./SP1AutoVerifier__factory";
|
|
257
258
|
export { SP1Helios__factory } from "./SP1Helios__factory";
|
|
258
259
|
export { SafeCast__factory } from "./SafeCast__factory";
|
|
259
260
|
export { SafeERC20__factory } from "./SafeERC20__factory";
|
|
@@ -254,6 +254,7 @@ export type { ProxyAdmin } from "./ProxyAdmin";
|
|
|
254
254
|
export type { ReentrancyGuard } from "./ReentrancyGuard";
|
|
255
255
|
export type { ReentrancyGuardUpgradeable } from "./ReentrancyGuardUpgradeable";
|
|
256
256
|
export type { Router_Adapter } from "./Router_Adapter";
|
|
257
|
+
export type { SP1AutoVerifier } from "./SP1AutoVerifier";
|
|
257
258
|
export type { SP1Helios } from "./SP1Helios";
|
|
258
259
|
export type { SafeCast } from "./SafeCast";
|
|
259
260
|
export type { SafeERC20 } from "./SafeERC20";
|
|
@@ -572,6 +573,7 @@ export { ShortStrings__factory } from "./factories/ShortStrings__factory";
|
|
|
572
573
|
export { SimpleContract__factory } from "./factories/SimpleContract__factory";
|
|
573
574
|
export { SkinnyOptimisticOracleInterface__factory } from "./factories/SkinnyOptimisticOracleInterface__factory";
|
|
574
575
|
export { Solana_Adapter__factory } from "./factories/Solana_Adapter__factory";
|
|
576
|
+
export { SP1AutoVerifier__factory } from "./factories/SP1AutoVerifier__factory";
|
|
575
577
|
export { SP1Helios__factory } from "./factories/SP1Helios__factory";
|
|
576
578
|
export { SpokePool__factory } from "./factories/SpokePool__factory";
|
|
577
579
|
export { SpokePoolEIP7702Test__factory } from "./factories/SpokePoolEIP7702Test__factory";
|