@matterlabs/zksync-js 0.0.20 → 0.0.22
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 -1
- 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 +1057 -290
- 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/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 +1010 -274
- 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 -0
- 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 +1094 -296
- 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/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 +1048 -295
- 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-SBGBYZJM.js → chunk-2D3FBCZC.js} +2 -2
- package/dist/{chunk-3HHUZXSV.js → chunk-32N6TI6K.js} +10 -2
- package/dist/{chunk-6LYAENO6.js → chunk-3SPDWWRD.js} +6 -4
- package/dist/{chunk-3T5V4HKS.js → chunk-4K4LOCQJ.js} +569 -259
- package/dist/{chunk-UEKFQAOS.js → chunk-AMRHBZIY.js} +304 -2
- package/dist/{chunk-E2XKJCI5.js → chunk-CP4SQ5PM.js} +537 -242
- package/dist/{chunk-NJK325XV.js → chunk-CPNHKNI4.js} +2 -2
- package/dist/{chunk-TYYUG5GA.js → chunk-CUBUD4J4.js} +1 -1
- package/dist/{chunk-CK5UFAZK.js → chunk-JXBLQQEN.js} +37 -3
- package/dist/{chunk-JSBMIT4S.js → chunk-KL6ZCPWJ.js} +1 -1
- package/dist/{chunk-MT4X5FEO.js → chunk-NQRYXL3K.js} +3 -1
- package/dist/{chunk-24TE2NNJ.js → chunk-PI4PF6WT.js} +24 -4
- package/dist/chunk-QUAPG3ZR.js +157 -0
- package/dist/chunk-UMPAKZCQ.js +19 -0
- package/dist/core/abi.d.ts +1 -0
- package/dist/core/constants.cjs +2 -0
- package/dist/core/constants.cjs.map +1 -1
- package/dist/core/constants.d.ts +9 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/index.cjs +513 -0
- 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/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/resources/withdrawals/status.d.ts +5 -0
- package/dist/core/types/flows/withdrawals.d.ts +32 -2
- package/dist/core/utils/events.d.ts +2 -0
- package/dist/index.cjs +313 -0
- 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-CP4SQ5PM.js';
|
|
2
|
+
import '../../chunk-CPNHKNI4.js';
|
|
3
|
+
import '../../chunk-3SPDWWRD.js';
|
|
4
|
+
import '../../chunk-QUAPG3ZR.js';
|
|
5
|
+
import '../../chunk-32N6TI6K.js';
|
|
6
|
+
import '../../chunk-KL6ZCPWJ.js';
|
|
7
|
+
import '../../chunk-AMRHBZIY.js';
|
|
8
|
+
import '../../chunk-NQRYXL3K.js';
|
|
@@ -5949,6 +5949,17 @@ function decodeRevert(e) {
|
|
|
5949
5949
|
// src/adapters/viem/errors/error-ops.ts
|
|
5950
5950
|
var { createErrorHandlers } = createErrorOps(decodeRevert);
|
|
5951
5951
|
|
|
5952
|
+
// src/core/resources/protocol/semver.ts
|
|
5953
|
+
var SEMVER_MINOR_OFFSET = 32n;
|
|
5954
|
+
var SEMVER_MAJOR_OFFSET = 64n;
|
|
5955
|
+
var U32_MASK = 0xffffffffn;
|
|
5956
|
+
function unpackSemver(packed) {
|
|
5957
|
+
const patch = Number(packed & U32_MASK);
|
|
5958
|
+
const minor = Number(packed >> SEMVER_MINOR_OFFSET & U32_MASK);
|
|
5959
|
+
const major = Number(packed >> SEMVER_MAJOR_OFFSET & U32_MASK);
|
|
5960
|
+
return [major, minor, patch];
|
|
5961
|
+
}
|
|
5962
|
+
|
|
5952
5963
|
// src/adapters/viem/client.ts
|
|
5953
5964
|
var { wrap } = createErrorHandlers("client");
|
|
5954
5965
|
var ChainTypeManagerABI = [
|
|
@@ -5958,6 +5969,15 @@ var ChainTypeManagerABI = [
|
|
|
5958
5969
|
inputs: [],
|
|
5959
5970
|
outputs: [{ type: "uint32" }, { type: "uint32" }, { type: "uint32" }],
|
|
5960
5971
|
stateMutability: "view"
|
|
5972
|
+
},
|
|
5973
|
+
{
|
|
5974
|
+
// Per-chain version. `getSemverProtocolVersion` reports the CTM's own (latest) version, which
|
|
5975
|
+
// runs ahead of individual chains mid-upgrade — so capability gating must use this one.
|
|
5976
|
+
type: "function",
|
|
5977
|
+
name: "getProtocolVersion",
|
|
5978
|
+
inputs: [{ name: "_chainId", type: "uint256" }],
|
|
5979
|
+
outputs: [{ type: "uint256" }],
|
|
5980
|
+
stateMutability: "view"
|
|
5961
5981
|
}
|
|
5962
5982
|
];
|
|
5963
5983
|
function createViemClient(args) {
|
|
@@ -6098,6 +6118,29 @@ function createViemClient(args) {
|
|
|
6098
6118
|
);
|
|
6099
6119
|
return semver;
|
|
6100
6120
|
}
|
|
6121
|
+
async function getChainProtocolVersion(chainId) {
|
|
6122
|
+
try {
|
|
6123
|
+
const targetChainId = chainId ?? BigInt(await l2.getChainId());
|
|
6124
|
+
const { bridgehub } = await ensureAddresses();
|
|
6125
|
+
const chainTypeManager = await l1.readContract({
|
|
6126
|
+
address: bridgehub,
|
|
6127
|
+
abi: IBridgehub_default,
|
|
6128
|
+
functionName: "chainTypeManager",
|
|
6129
|
+
args: [targetChainId]
|
|
6130
|
+
});
|
|
6131
|
+
if (chainTypeManager.toLowerCase() === FORMAL_ETH_ADDRESS.toLowerCase()) return void 0;
|
|
6132
|
+
const packed = await l1.readContract({
|
|
6133
|
+
address: chainTypeManager,
|
|
6134
|
+
abi: ChainTypeManagerABI,
|
|
6135
|
+
functionName: "getProtocolVersion",
|
|
6136
|
+
args: [targetChainId]
|
|
6137
|
+
});
|
|
6138
|
+
if (packed === 0n) return void 0;
|
|
6139
|
+
return unpackSemver(packed);
|
|
6140
|
+
} catch {
|
|
6141
|
+
return void 0;
|
|
6142
|
+
}
|
|
6143
|
+
}
|
|
6101
6144
|
let lazyL2;
|
|
6102
6145
|
function getL2Wallet() {
|
|
6103
6146
|
if (l2Wallet) return l2Wallet;
|
|
@@ -6122,6 +6165,7 @@ function createViemClient(args) {
|
|
|
6122
6165
|
refresh,
|
|
6123
6166
|
baseToken,
|
|
6124
6167
|
getProtocolVersion,
|
|
6168
|
+
getChainProtocolVersion,
|
|
6125
6169
|
getL2Wallet
|
|
6126
6170
|
};
|
|
6127
6171
|
}
|