@matterlabs/zksync-js 0.0.21 → 0.0.23
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/adapters/ethers/client.cjs +31 -8
- package/dist/adapters/ethers/client.cjs.map +1 -1
- package/dist/adapters/ethers/client.d.ts +11 -0
- package/dist/adapters/ethers/client.js +6 -5
- package/dist/adapters/ethers/index.cjs +1194 -364
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.d.ts +2 -1
- package/dist/adapters/ethers/index.js +10 -8
- package/dist/adapters/ethers/resources/deposits/context.d.ts +2 -0
- package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +3 -0
- package/dist/adapters/ethers/resources/withdrawals/context.d.ts +12 -1
- package/dist/adapters/ethers/resources/withdrawals/index.d.ts +17 -1
- package/dist/adapters/ethers/resources/withdrawals/routes/interop-bundle.d.ts +2 -0
- package/dist/adapters/ethers/resources/withdrawals/services/finalization.d.ts +35 -17
- package/dist/adapters/ethers/resources/withdrawals/services/protocol.d.ts +11 -0
- package/dist/adapters/ethers/sdk.cjs +1166 -370
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.d.ts +3 -1
- package/dist/adapters/ethers/sdk.js +8 -7
- package/dist/adapters/viem/client.cjs +44 -7
- package/dist/adapters/viem/client.cjs.map +1 -1
- package/dist/adapters/viem/client.d.ts +11 -0
- package/dist/adapters/viem/client.js +6 -5
- package/dist/adapters/viem/index.cjs +1237 -383
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.d.ts +2 -1
- package/dist/adapters/viem/index.js +10 -8
- package/dist/adapters/viem/resources/deposits/context.d.ts +2 -0
- package/dist/adapters/viem/resources/deposits/services/gas.d.ts +3 -0
- package/dist/adapters/viem/resources/withdrawals/context.d.ts +12 -1
- package/dist/adapters/viem/resources/withdrawals/index.d.ts +17 -1
- package/dist/adapters/viem/resources/withdrawals/routes/interop-bundle.d.ts +2 -0
- package/dist/adapters/viem/resources/withdrawals/services/finalization.d.ts +36 -18
- package/dist/adapters/viem/resources/withdrawals/services/protocol.d.ts +11 -0
- package/dist/adapters/viem/sdk.cjs +1191 -385
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.d.ts +3 -1
- package/dist/adapters/viem/sdk.js +8 -7
- package/dist/{chunk-UEKFQAOS.js → chunk-2DDJFHHD.js} +304 -9
- package/dist/{chunk-MT4X5FEO.js → chunk-3IPSDGHO.js} +19 -1
- package/dist/{chunk-JSBMIT4S.js → chunk-4GPIHYVF.js} +1 -1
- package/dist/{chunk-SBGBYZJM.js → chunk-4M7VNYGC.js} +2 -2
- package/dist/{chunk-CK5UFAZK.js → chunk-6WIAMFIW.js} +37 -3
- package/dist/chunk-JJ523MOL.js +157 -0
- package/dist/{chunk-7GZDTLHX.js → chunk-NVOFHV3A.js} +666 -304
- package/dist/{chunk-LGTYM5XP.js → chunk-OEUDZFXH.js} +1 -1
- package/dist/{chunk-NJK325XV.js → chunk-TUN6NH5D.js} +2 -2
- package/dist/chunk-UMPAKZCQ.js +19 -0
- package/dist/{chunk-24TE2NNJ.js → chunk-URHDNDFN.js} +24 -4
- package/dist/{chunk-2CGBLD5H.js → chunk-V2TDNGI5.js} +642 -288
- package/dist/{chunk-IDXSGCGF.js → chunk-WPCZNITC.js} +63 -50
- package/dist/{chunk-TYYUG5GA.js → chunk-X2JJDQ4O.js} +1 -1
- package/dist/core/abi.d.ts +1 -0
- package/dist/core/adapters/interfaces.d.ts +2 -0
- package/dist/core/constants.cjs +18 -0
- package/dist/core/constants.cjs.map +1 -1
- package/dist/core/constants.d.ts +17 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/index.cjs +504 -7
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +6 -1
- package/dist/core/index.js +6 -4
- package/dist/core/internal/abis/IERC7786Attributes.d.ts +10 -0
- package/dist/core/internal/abis/IL1NullifierV32.d.ts +221 -0
- package/dist/core/internal/abis/IL2AssetRouter.d.ts +0 -14
- package/dist/core/resources/deposits/priority.d.ts +30 -0
- package/dist/core/resources/interop/attributes/bundle.d.ts +1 -0
- package/dist/core/resources/interop/attributes/resource.d.ts +1 -0
- package/dist/core/resources/protocol/semver.d.ts +18 -0
- package/dist/core/resources/withdrawals/bundle.d.ts +80 -0
- package/dist/core/resources/withdrawals/finalization.d.ts +142 -0
- package/dist/core/resources/withdrawals/protocol.d.ts +55 -0
- package/dist/core/types/flows/withdrawals.d.ts +30 -0
- package/dist/index.cjs +320 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -4
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EthersClient } from './client';
|
|
2
2
|
import { type DepositsResource } from './resources/deposits/index';
|
|
3
|
-
import { type WithdrawalsResource } from './resources/withdrawals/index';
|
|
3
|
+
import { type WithdrawalsResource, type WithdrawalsResourceOptions } from './resources/withdrawals/index';
|
|
4
4
|
import { type InteropResource } from './resources/interop/index';
|
|
5
5
|
import type { TokensResource } from '../../core/types/flows/token';
|
|
6
6
|
import type { ContractsResource } from './resources/contracts/index';
|
|
@@ -8,6 +8,8 @@ import type { InteropConfig } from './resources/interop/types';
|
|
|
8
8
|
export interface EthersSdkOptions {
|
|
9
9
|
/** Configuration required for interop operations. */
|
|
10
10
|
interop?: InteropConfig;
|
|
11
|
+
/** Options for the withdrawals resource, e.g. forcing the withdrawal protocol. */
|
|
12
|
+
withdrawals?: WithdrawalsResourceOptions;
|
|
11
13
|
}
|
|
12
14
|
export interface EthersSdk {
|
|
13
15
|
deposits: DepositsResource;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { createEthersSdk } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
1
|
+
export { createEthersSdk } from '../../chunk-V2TDNGI5.js';
|
|
2
|
+
import '../../chunk-TUN6NH5D.js';
|
|
3
|
+
import '../../chunk-WPCZNITC.js';
|
|
4
|
+
import '../../chunk-JJ523MOL.js';
|
|
5
|
+
import '../../chunk-OEUDZFXH.js';
|
|
6
|
+
import '../../chunk-4GPIHYVF.js';
|
|
7
|
+
import '../../chunk-2DDJFHHD.js';
|
|
8
|
+
import '../../chunk-3IPSDGHO.js';
|
|
@@ -3350,13 +3350,6 @@ var IL2AssetRouterABI = [
|
|
|
3350
3350
|
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
3351
3351
|
stateMutability: "view"
|
|
3352
3352
|
},
|
|
3353
|
-
{
|
|
3354
|
-
type: "function",
|
|
3355
|
-
name: "l1TokenAddress",
|
|
3356
|
-
inputs: [{ name: "_l2Token", type: "address", internalType: "address" }],
|
|
3357
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
3358
|
-
stateMutability: "view"
|
|
3359
|
-
},
|
|
3360
3353
|
{
|
|
3361
3354
|
type: "function",
|
|
3362
3355
|
name: "l2TokenAddress",
|
|
@@ -5949,6 +5942,17 @@ function decodeRevert(e) {
|
|
|
5949
5942
|
// src/adapters/viem/errors/error-ops.ts
|
|
5950
5943
|
var { createErrorHandlers } = createErrorOps(decodeRevert);
|
|
5951
5944
|
|
|
5945
|
+
// src/core/resources/protocol/semver.ts
|
|
5946
|
+
var SEMVER_MINOR_OFFSET = 32n;
|
|
5947
|
+
var SEMVER_MAJOR_OFFSET = 64n;
|
|
5948
|
+
var U32_MASK = 0xffffffffn;
|
|
5949
|
+
function unpackSemver(packed) {
|
|
5950
|
+
const patch = Number(packed & U32_MASK);
|
|
5951
|
+
const minor = Number(packed >> SEMVER_MINOR_OFFSET & U32_MASK);
|
|
5952
|
+
const major = Number(packed >> SEMVER_MAJOR_OFFSET & U32_MASK);
|
|
5953
|
+
return [major, minor, patch];
|
|
5954
|
+
}
|
|
5955
|
+
|
|
5952
5956
|
// src/adapters/viem/client.ts
|
|
5953
5957
|
var { wrap } = createErrorHandlers("client");
|
|
5954
5958
|
var ChainTypeManagerABI = [
|
|
@@ -5958,6 +5962,15 @@ var ChainTypeManagerABI = [
|
|
|
5958
5962
|
inputs: [],
|
|
5959
5963
|
outputs: [{ type: "uint32" }, { type: "uint32" }, { type: "uint32" }],
|
|
5960
5964
|
stateMutability: "view"
|
|
5965
|
+
},
|
|
5966
|
+
{
|
|
5967
|
+
// Per-chain version. `getSemverProtocolVersion` reports the CTM's own (latest) version, which
|
|
5968
|
+
// runs ahead of individual chains mid-upgrade — so capability gating must use this one.
|
|
5969
|
+
type: "function",
|
|
5970
|
+
name: "getProtocolVersion",
|
|
5971
|
+
inputs: [{ name: "_chainId", type: "uint256" }],
|
|
5972
|
+
outputs: [{ type: "uint256" }],
|
|
5973
|
+
stateMutability: "view"
|
|
5961
5974
|
}
|
|
5962
5975
|
];
|
|
5963
5976
|
function createViemClient(args) {
|
|
@@ -6098,6 +6111,29 @@ function createViemClient(args) {
|
|
|
6098
6111
|
);
|
|
6099
6112
|
return semver;
|
|
6100
6113
|
}
|
|
6114
|
+
async function getChainProtocolVersion(chainId) {
|
|
6115
|
+
try {
|
|
6116
|
+
const targetChainId = chainId ?? BigInt(await l2.getChainId());
|
|
6117
|
+
const { bridgehub } = await ensureAddresses();
|
|
6118
|
+
const chainTypeManager = await l1.readContract({
|
|
6119
|
+
address: bridgehub,
|
|
6120
|
+
abi: IBridgehub_default,
|
|
6121
|
+
functionName: "chainTypeManager",
|
|
6122
|
+
args: [targetChainId]
|
|
6123
|
+
});
|
|
6124
|
+
if (chainTypeManager.toLowerCase() === FORMAL_ETH_ADDRESS.toLowerCase()) return void 0;
|
|
6125
|
+
const packed = await l1.readContract({
|
|
6126
|
+
address: chainTypeManager,
|
|
6127
|
+
abi: ChainTypeManagerABI,
|
|
6128
|
+
functionName: "getProtocolVersion",
|
|
6129
|
+
args: [targetChainId]
|
|
6130
|
+
});
|
|
6131
|
+
if (packed === 0n) return void 0;
|
|
6132
|
+
return unpackSemver(packed);
|
|
6133
|
+
} catch {
|
|
6134
|
+
return void 0;
|
|
6135
|
+
}
|
|
6136
|
+
}
|
|
6101
6137
|
let lazyL2;
|
|
6102
6138
|
function getL2Wallet() {
|
|
6103
6139
|
if (l2Wallet) return l2Wallet;
|
|
@@ -6122,6 +6158,7 @@ function createViemClient(args) {
|
|
|
6122
6158
|
refresh,
|
|
6123
6159
|
baseToken,
|
|
6124
6160
|
getProtocolVersion,
|
|
6161
|
+
getChainProtocolVersion,
|
|
6125
6162
|
getL2Wallet
|
|
6126
6163
|
};
|
|
6127
6164
|
}
|