@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
|
@@ -3356,13 +3356,6 @@ var IL2AssetRouterABI = [
|
|
|
3356
3356
|
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
3357
3357
|
stateMutability: "view"
|
|
3358
3358
|
},
|
|
3359
|
-
{
|
|
3360
|
-
type: "function",
|
|
3361
|
-
name: "l1TokenAddress",
|
|
3362
|
-
inputs: [{ name: "_l2Token", type: "address", internalType: "address" }],
|
|
3363
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
3364
|
-
stateMutability: "view"
|
|
3365
|
-
},
|
|
3366
3359
|
{
|
|
3367
3360
|
type: "function",
|
|
3368
3361
|
name: "l2TokenAddress",
|
|
@@ -7271,10 +7264,24 @@ function decodeRevert(e) {
|
|
|
7271
7264
|
// src/adapters/ethers/errors/error-ops.ts
|
|
7272
7265
|
var { createErrorHandlers } = createErrorOps(decodeRevert);
|
|
7273
7266
|
|
|
7267
|
+
// src/core/resources/protocol/semver.ts
|
|
7268
|
+
var SEMVER_MINOR_OFFSET = 32n;
|
|
7269
|
+
var SEMVER_MAJOR_OFFSET = 64n;
|
|
7270
|
+
var U32_MASK = 0xffffffffn;
|
|
7271
|
+
function unpackSemver(packed) {
|
|
7272
|
+
const patch = Number(packed & U32_MASK);
|
|
7273
|
+
const minor = Number(packed >> SEMVER_MINOR_OFFSET & U32_MASK);
|
|
7274
|
+
const major = Number(packed >> SEMVER_MAJOR_OFFSET & U32_MASK);
|
|
7275
|
+
return [major, minor, patch];
|
|
7276
|
+
}
|
|
7277
|
+
|
|
7274
7278
|
// src/adapters/ethers/client.ts
|
|
7275
7279
|
var { wrapAs, wrap } = createErrorHandlers("client");
|
|
7276
7280
|
var ChainTypeManagerABI = [
|
|
7277
|
-
"function getSemverProtocolVersion() view returns (uint32,uint32,uint32)"
|
|
7281
|
+
"function getSemverProtocolVersion() view returns (uint32,uint32,uint32)",
|
|
7282
|
+
// Per-chain version. `getSemverProtocolVersion` reports the CTM's own (latest) version, which
|
|
7283
|
+
// runs ahead of individual chains mid-upgrade — so capability gating must use this one.
|
|
7284
|
+
"function getProtocolVersion(uint256 _chainId) view returns (uint256)"
|
|
7278
7285
|
];
|
|
7279
7286
|
function createEthersClient(args) {
|
|
7280
7287
|
const { l1, l2, signer } = args;
|
|
@@ -7433,6 +7440,21 @@ function createEthersClient(args) {
|
|
|
7433
7440
|
);
|
|
7434
7441
|
return semver;
|
|
7435
7442
|
}
|
|
7443
|
+
async function getChainProtocolVersion(chainId) {
|
|
7444
|
+
try {
|
|
7445
|
+
const targetChainId = chainId ?? (await l2.getNetwork()).chainId;
|
|
7446
|
+
const { bridgehub } = await ensureAddresses();
|
|
7447
|
+
const bh = new ethers.Contract(bridgehub, IBridgehub_default, l1);
|
|
7448
|
+
const chainTypeManager = await bh.chainTypeManager(targetChainId);
|
|
7449
|
+
if (chainTypeManager.toLowerCase() === FORMAL_ETH_ADDRESS) return void 0;
|
|
7450
|
+
const ctm = new ethers.Contract(chainTypeManager, ChainTypeManagerABI, l1);
|
|
7451
|
+
const packed = await ctm.getProtocolVersion(targetChainId);
|
|
7452
|
+
if (packed === 0n) return void 0;
|
|
7453
|
+
return unpackSemver(packed);
|
|
7454
|
+
} catch {
|
|
7455
|
+
return void 0;
|
|
7456
|
+
}
|
|
7457
|
+
}
|
|
7436
7458
|
function signerFor(target) {
|
|
7437
7459
|
if (target === "l1") {
|
|
7438
7460
|
return boundSigner.provider === l1 ? boundSigner : boundSigner.connect(l1);
|
|
@@ -7457,6 +7479,7 @@ function createEthersClient(args) {
|
|
|
7457
7479
|
refresh,
|
|
7458
7480
|
baseToken,
|
|
7459
7481
|
getProtocolVersion,
|
|
7482
|
+
getChainProtocolVersion,
|
|
7460
7483
|
signerFor
|
|
7461
7484
|
};
|
|
7462
7485
|
return client;
|