@matterlabs/zksync-js 0.0.1 → 0.0.2
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 +12 -12
- package/dist/adapters/ethers/client.cjs +642 -1
- package/dist/adapters/ethers/client.cjs.map +1 -1
- package/dist/adapters/ethers/client.js +6 -5
- package/dist/adapters/ethers/estimator.d.ts +4 -0
- package/dist/adapters/ethers/index.cjs +934 -801
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.js +9 -8
- package/dist/adapters/ethers/resources/deposits/context.d.ts +5 -5
- package/dist/adapters/ethers/resources/deposits/routes/types.d.ts +2 -6
- package/dist/adapters/ethers/resources/deposits/services/fee.d.ts +6 -0
- package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +40 -0
- package/dist/adapters/ethers/resources/utils.d.ts +4 -15
- package/dist/adapters/ethers/resources/withdrawals/context.d.ts +4 -4
- package/dist/adapters/ethers/resources/withdrawals/routes/types.d.ts +2 -2
- package/dist/adapters/ethers/resources/withdrawals/services/fees.d.ts +14 -0
- package/dist/adapters/ethers/resources/withdrawals/services/gas.d.ts +12 -0
- package/dist/adapters/ethers/sdk.cjs +947 -1292
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.js +7 -6
- package/dist/adapters/viem/client.cjs.map +1 -1
- package/dist/adapters/viem/client.d.ts +1 -1
- package/dist/adapters/viem/client.js +4 -5
- package/dist/adapters/viem/estimator.d.ts +4 -0
- package/dist/adapters/viem/index.cjs +944 -662
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.js +8 -8
- package/dist/adapters/viem/resources/deposits/context.d.ts +5 -5
- package/dist/adapters/viem/resources/deposits/routes/types.d.ts +2 -6
- package/dist/adapters/viem/resources/deposits/services/fee.d.ts +6 -0
- package/dist/adapters/viem/resources/deposits/services/gas.d.ts +36 -0
- package/dist/adapters/viem/resources/utils.d.ts +3 -16
- package/dist/adapters/viem/resources/withdrawals/context.d.ts +3 -6
- package/dist/adapters/viem/resources/withdrawals/routes/types.d.ts +12 -2
- package/dist/adapters/viem/resources/withdrawals/services/fee.d.ts +17 -0
- package/dist/adapters/viem/resources/withdrawals/services/gas.d.ts +12 -0
- package/dist/adapters/viem/sdk.cjs +877 -563
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.d.ts +1 -1
- package/dist/adapters/viem/sdk.js +6 -6
- package/dist/{chunk-3LALBFFE.js → chunk-3MRGU4HV.js} +9 -5
- package/dist/{chunk-4HLJJKIY.js → chunk-6K6VJQAL.js} +2 -2
- package/dist/{chunk-CGO27P7F.js → chunk-BCCKWWOX.js} +540 -741
- package/dist/{chunk-6GCT6TLS.js → chunk-F2ENUV3A.js} +13 -1
- package/dist/{chunk-DI2CJDPZ.js → chunk-HLUANWGN.js} +2 -2
- package/dist/{chunk-Y75OMFK6.js → chunk-M5J2MM2U.js} +351 -1
- package/dist/{chunk-263G6636.js → chunk-NCAIVYBR.js} +1 -14
- package/dist/{chunk-7M4V3FMT.js → chunk-OC6ZVLSP.js} +669 -559
- package/dist/chunk-QJS6ETEE.js +217 -0
- package/dist/chunk-XRE7H466.js +157 -0
- package/dist/{chunk-BD2LUO5T.js → chunk-YUK547UF.js} +3 -3
- package/dist/core/abi.d.ts +9 -0
- package/dist/core/adapters/interfaces.d.ts +25 -0
- package/dist/core/constants.cjs +12 -0
- package/dist/core/constants.cjs.map +1 -1
- package/dist/core/constants.d.ts +6 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/index.cjs +4504 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +4 -4
- package/dist/core/resources/deposits/fee.d.ts +15 -0
- package/dist/core/resources/deposits/gas.d.ts +38 -0
- package/dist/core/resources/withdrawals/gas.d.ts +14 -0
- package/dist/core/types/errors.d.ts +1 -1
- package/dist/core/types/fees.d.ts +40 -0
- package/dist/core/types/flows/base.d.ts +0 -10
- package/dist/core/types/flows/deposits.d.ts +20 -6
- package/dist/core/types/flows/route.d.ts +2 -3
- package/dist/core/types/flows/withdrawals.d.ts +12 -6
- package/dist/index.cjs +4516 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -4
- package/package.json +5 -1
- package/dist/adapters/ethers/resources/withdrawals/routes/eth-nonbase.d.ts +0 -2
- package/dist/adapters/viem/resources/withdrawals/routes/eth-nonbase.d.ts +0 -2
- package/dist/chunk-B77GWPO5.js +0 -339
- package/dist/core/internal/abi-registry.d.ts +0 -9
- package/dist/core/utils/gas.d.ts +0 -13
|
@@ -151,6 +151,9 @@ function isZKsyncError(e) {
|
|
|
151
151
|
const envelope = maybe.envelope;
|
|
152
152
|
return typeof envelope?.type === "string" && typeof envelope?.message === "string";
|
|
153
153
|
}
|
|
154
|
+
var OP_DEPOSITS = {
|
|
155
|
+
base: {
|
|
156
|
+
baseToken: "deposits.erc20-base:baseToken"}};
|
|
154
157
|
|
|
155
158
|
// src/core/errors/factory.ts
|
|
156
159
|
function createError(type, input) {
|
|
@@ -4423,7 +4426,642 @@ var IBaseTokenABI = [
|
|
|
4423
4426
|
];
|
|
4424
4427
|
var IBaseToken_default = IBaseTokenABI;
|
|
4425
4428
|
|
|
4429
|
+
// src/core/internal/abis/IERC20.ts
|
|
4430
|
+
var IERC20ABI = [
|
|
4431
|
+
{
|
|
4432
|
+
type: "constructor",
|
|
4433
|
+
inputs: [
|
|
4434
|
+
{ name: "_name", type: "string", internalType: "string" },
|
|
4435
|
+
{ name: "_symbol", type: "string", internalType: "string" },
|
|
4436
|
+
{ name: "_decimals", type: "uint8", internalType: "uint8" }
|
|
4437
|
+
],
|
|
4438
|
+
stateMutability: "nonpayable"
|
|
4439
|
+
},
|
|
4440
|
+
{
|
|
4441
|
+
type: "function",
|
|
4442
|
+
name: "allowance",
|
|
4443
|
+
inputs: [
|
|
4444
|
+
{ name: "", type: "address", internalType: "address" },
|
|
4445
|
+
{ name: "", type: "address", internalType: "address" }
|
|
4446
|
+
],
|
|
4447
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
4448
|
+
stateMutability: "view"
|
|
4449
|
+
},
|
|
4450
|
+
{
|
|
4451
|
+
type: "function",
|
|
4452
|
+
name: "approve",
|
|
4453
|
+
inputs: [
|
|
4454
|
+
{ name: "spender", type: "address", internalType: "address" },
|
|
4455
|
+
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
4456
|
+
],
|
|
4457
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
4458
|
+
stateMutability: "nonpayable"
|
|
4459
|
+
},
|
|
4460
|
+
{
|
|
4461
|
+
type: "function",
|
|
4462
|
+
name: "balanceOf",
|
|
4463
|
+
inputs: [{ name: "", type: "address", internalType: "address" }],
|
|
4464
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
4465
|
+
stateMutability: "view"
|
|
4466
|
+
},
|
|
4467
|
+
{
|
|
4468
|
+
type: "function",
|
|
4469
|
+
name: "decimals",
|
|
4470
|
+
inputs: [],
|
|
4471
|
+
outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
|
|
4472
|
+
stateMutability: "view"
|
|
4473
|
+
},
|
|
4474
|
+
{
|
|
4475
|
+
type: "function",
|
|
4476
|
+
name: "mint",
|
|
4477
|
+
inputs: [
|
|
4478
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
4479
|
+
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
4480
|
+
],
|
|
4481
|
+
outputs: [],
|
|
4482
|
+
stateMutability: "nonpayable"
|
|
4483
|
+
},
|
|
4484
|
+
{
|
|
4485
|
+
type: "function",
|
|
4486
|
+
name: "name",
|
|
4487
|
+
inputs: [],
|
|
4488
|
+
outputs: [{ name: "", type: "string", internalType: "string" }],
|
|
4489
|
+
stateMutability: "view"
|
|
4490
|
+
},
|
|
4491
|
+
{
|
|
4492
|
+
type: "function",
|
|
4493
|
+
name: "owner",
|
|
4494
|
+
inputs: [],
|
|
4495
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
4496
|
+
stateMutability: "view"
|
|
4497
|
+
},
|
|
4498
|
+
{
|
|
4499
|
+
type: "function",
|
|
4500
|
+
name: "symbol",
|
|
4501
|
+
inputs: [],
|
|
4502
|
+
outputs: [{ name: "", type: "string", internalType: "string" }],
|
|
4503
|
+
stateMutability: "view"
|
|
4504
|
+
},
|
|
4505
|
+
{
|
|
4506
|
+
type: "function",
|
|
4507
|
+
name: "totalSupply",
|
|
4508
|
+
inputs: [],
|
|
4509
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
4510
|
+
stateMutability: "view"
|
|
4511
|
+
},
|
|
4512
|
+
{
|
|
4513
|
+
type: "function",
|
|
4514
|
+
name: "transfer",
|
|
4515
|
+
inputs: [
|
|
4516
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
4517
|
+
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
4518
|
+
],
|
|
4519
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
4520
|
+
stateMutability: "nonpayable"
|
|
4521
|
+
},
|
|
4522
|
+
{
|
|
4523
|
+
type: "function",
|
|
4524
|
+
name: "transferFrom",
|
|
4525
|
+
inputs: [
|
|
4526
|
+
{ name: "from", type: "address", internalType: "address" },
|
|
4527
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
4528
|
+
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
4529
|
+
],
|
|
4530
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
4531
|
+
stateMutability: "nonpayable"
|
|
4532
|
+
},
|
|
4533
|
+
{
|
|
4534
|
+
type: "event",
|
|
4535
|
+
name: "Approval",
|
|
4536
|
+
inputs: [
|
|
4537
|
+
{ name: "owner", type: "address", indexed: true, internalType: "address" },
|
|
4538
|
+
{ name: "spender", type: "address", indexed: true, internalType: "address" },
|
|
4539
|
+
{ name: "value", type: "uint256", indexed: false, internalType: "uint256" }
|
|
4540
|
+
],
|
|
4541
|
+
anonymous: false
|
|
4542
|
+
},
|
|
4543
|
+
{
|
|
4544
|
+
type: "event",
|
|
4545
|
+
name: "Transfer",
|
|
4546
|
+
inputs: [
|
|
4547
|
+
{ name: "from", type: "address", indexed: true, internalType: "address" },
|
|
4548
|
+
{ name: "to", type: "address", indexed: true, internalType: "address" },
|
|
4549
|
+
{ name: "value", type: "uint256", indexed: false, internalType: "uint256" }
|
|
4550
|
+
],
|
|
4551
|
+
anonymous: false
|
|
4552
|
+
},
|
|
4553
|
+
{ type: "error", name: "InsufficientAllowance", inputs: [] },
|
|
4554
|
+
{ type: "error", name: "InsufficientBalance", inputs: [] },
|
|
4555
|
+
{ type: "error", name: "NotOwner", inputs: [] }
|
|
4556
|
+
];
|
|
4557
|
+
var IERC20_default = IERC20ABI;
|
|
4558
|
+
|
|
4559
|
+
// src/core/internal/abis/Mailbox.ts
|
|
4560
|
+
var MailboxABI = [
|
|
4561
|
+
{
|
|
4562
|
+
type: "constructor",
|
|
4563
|
+
inputs: [
|
|
4564
|
+
{ name: "_eraChainId", type: "uint256", internalType: "uint256" },
|
|
4565
|
+
{ name: "_l1ChainId", type: "uint256", internalType: "uint256" }
|
|
4566
|
+
],
|
|
4567
|
+
stateMutability: "nonpayable"
|
|
4568
|
+
},
|
|
4569
|
+
{
|
|
4570
|
+
type: "function",
|
|
4571
|
+
name: "bridgehubRequestL2Transaction",
|
|
4572
|
+
inputs: [
|
|
4573
|
+
{
|
|
4574
|
+
name: "_request",
|
|
4575
|
+
type: "tuple",
|
|
4576
|
+
internalType: "struct BridgehubL2TransactionRequest",
|
|
4577
|
+
components: [
|
|
4578
|
+
{ name: "sender", type: "address", internalType: "address" },
|
|
4579
|
+
{ name: "contractL2", type: "address", internalType: "address" },
|
|
4580
|
+
{ name: "mintValue", type: "uint256", internalType: "uint256" },
|
|
4581
|
+
{ name: "l2Value", type: "uint256", internalType: "uint256" },
|
|
4582
|
+
{ name: "l2Calldata", type: "bytes", internalType: "bytes" },
|
|
4583
|
+
{ name: "l2GasLimit", type: "uint256", internalType: "uint256" },
|
|
4584
|
+
{ name: "l2GasPerPubdataByteLimit", type: "uint256", internalType: "uint256" },
|
|
4585
|
+
{ name: "factoryDeps", type: "bytes[]", internalType: "bytes[]" },
|
|
4586
|
+
{ name: "refundRecipient", type: "address", internalType: "address" }
|
|
4587
|
+
]
|
|
4588
|
+
}
|
|
4589
|
+
],
|
|
4590
|
+
outputs: [{ name: "canonicalTxHash", type: "bytes32", internalType: "bytes32" }],
|
|
4591
|
+
stateMutability: "nonpayable"
|
|
4592
|
+
},
|
|
4593
|
+
{
|
|
4594
|
+
type: "function",
|
|
4595
|
+
name: "bridgehubRequestL2TransactionOnGateway",
|
|
4596
|
+
inputs: [
|
|
4597
|
+
{ name: "_canonicalTxHash", type: "bytes32", internalType: "bytes32" },
|
|
4598
|
+
{ name: "_expirationTimestamp", type: "uint64", internalType: "uint64" }
|
|
4599
|
+
],
|
|
4600
|
+
outputs: [],
|
|
4601
|
+
stateMutability: "nonpayable"
|
|
4602
|
+
},
|
|
4603
|
+
{
|
|
4604
|
+
type: "function",
|
|
4605
|
+
name: "finalizeEthWithdrawal",
|
|
4606
|
+
inputs: [
|
|
4607
|
+
{ name: "_l2BatchNumber", type: "uint256", internalType: "uint256" },
|
|
4608
|
+
{ name: "_l2MessageIndex", type: "uint256", internalType: "uint256" },
|
|
4609
|
+
{ name: "_l2TxNumberInBatch", type: "uint16", internalType: "uint16" },
|
|
4610
|
+
{ name: "_message", type: "bytes", internalType: "bytes" },
|
|
4611
|
+
{ name: "_merkleProof", type: "bytes32[]", internalType: "bytes32[]" }
|
|
4612
|
+
],
|
|
4613
|
+
outputs: [],
|
|
4614
|
+
stateMutability: "nonpayable"
|
|
4615
|
+
},
|
|
4616
|
+
{
|
|
4617
|
+
type: "function",
|
|
4618
|
+
name: "getName",
|
|
4619
|
+
inputs: [],
|
|
4620
|
+
outputs: [{ name: "", type: "string", internalType: "string" }],
|
|
4621
|
+
stateMutability: "view"
|
|
4622
|
+
},
|
|
4623
|
+
{
|
|
4624
|
+
type: "function",
|
|
4625
|
+
name: "l2TransactionBaseCost",
|
|
4626
|
+
inputs: [
|
|
4627
|
+
{ name: "_gasPrice", type: "uint256", internalType: "uint256" },
|
|
4628
|
+
{ name: "_l2GasLimit", type: "uint256", internalType: "uint256" },
|
|
4629
|
+
{ name: "_l2GasPerPubdataByteLimit", type: "uint256", internalType: "uint256" }
|
|
4630
|
+
],
|
|
4631
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
4632
|
+
stateMutability: "view"
|
|
4633
|
+
},
|
|
4634
|
+
{
|
|
4635
|
+
type: "function",
|
|
4636
|
+
name: "proveL1ToL2TransactionStatus",
|
|
4637
|
+
inputs: [
|
|
4638
|
+
{ name: "_l2TxHash", type: "bytes32", internalType: "bytes32" },
|
|
4639
|
+
{ name: "_l2BatchNumber", type: "uint256", internalType: "uint256" },
|
|
4640
|
+
{ name: "_l2MessageIndex", type: "uint256", internalType: "uint256" },
|
|
4641
|
+
{ name: "_l2TxNumberInBatch", type: "uint16", internalType: "uint16" },
|
|
4642
|
+
{ name: "_merkleProof", type: "bytes32[]", internalType: "bytes32[]" },
|
|
4643
|
+
{ name: "_status", type: "uint8", internalType: "enum TxStatus" }
|
|
4644
|
+
],
|
|
4645
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
4646
|
+
stateMutability: "view"
|
|
4647
|
+
},
|
|
4648
|
+
{
|
|
4649
|
+
type: "function",
|
|
4650
|
+
name: "proveL2LeafInclusion",
|
|
4651
|
+
inputs: [
|
|
4652
|
+
{ name: "_batchNumber", type: "uint256", internalType: "uint256" },
|
|
4653
|
+
{ name: "_leafProofMask", type: "uint256", internalType: "uint256" },
|
|
4654
|
+
{ name: "_leaf", type: "bytes32", internalType: "bytes32" },
|
|
4655
|
+
{ name: "_proof", type: "bytes32[]", internalType: "bytes32[]" }
|
|
4656
|
+
],
|
|
4657
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
4658
|
+
stateMutability: "view"
|
|
4659
|
+
},
|
|
4660
|
+
{
|
|
4661
|
+
type: "function",
|
|
4662
|
+
name: "proveL2LeafInclusionShared",
|
|
4663
|
+
inputs: [
|
|
4664
|
+
{ name: "_chainId", type: "uint256", internalType: "uint256" },
|
|
4665
|
+
{ name: "_blockOrBatchNumber", type: "uint256", internalType: "uint256" },
|
|
4666
|
+
{ name: "_leafProofMask", type: "uint256", internalType: "uint256" },
|
|
4667
|
+
{ name: "_leaf", type: "bytes32", internalType: "bytes32" },
|
|
4668
|
+
{ name: "_proof", type: "bytes32[]", internalType: "bytes32[]" }
|
|
4669
|
+
],
|
|
4670
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
4671
|
+
stateMutability: "view"
|
|
4672
|
+
},
|
|
4673
|
+
{
|
|
4674
|
+
type: "function",
|
|
4675
|
+
name: "proveL2LogInclusion",
|
|
4676
|
+
inputs: [
|
|
4677
|
+
{ name: "_batchNumber", type: "uint256", internalType: "uint256" },
|
|
4678
|
+
{ name: "_index", type: "uint256", internalType: "uint256" },
|
|
4679
|
+
{
|
|
4680
|
+
name: "_log",
|
|
4681
|
+
type: "tuple",
|
|
4682
|
+
internalType: "struct L2Log",
|
|
4683
|
+
components: [
|
|
4684
|
+
{ name: "l2ShardId", type: "uint8", internalType: "uint8" },
|
|
4685
|
+
{ name: "isService", type: "bool", internalType: "bool" },
|
|
4686
|
+
{ name: "txNumberInBatch", type: "uint16", internalType: "uint16" },
|
|
4687
|
+
{ name: "sender", type: "address", internalType: "address" },
|
|
4688
|
+
{ name: "key", type: "bytes32", internalType: "bytes32" },
|
|
4689
|
+
{ name: "value", type: "bytes32", internalType: "bytes32" }
|
|
4690
|
+
]
|
|
4691
|
+
},
|
|
4692
|
+
{ name: "_proof", type: "bytes32[]", internalType: "bytes32[]" }
|
|
4693
|
+
],
|
|
4694
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
4695
|
+
stateMutability: "view"
|
|
4696
|
+
},
|
|
4697
|
+
{
|
|
4698
|
+
type: "function",
|
|
4699
|
+
name: "proveL2LogInclusionShared",
|
|
4700
|
+
inputs: [
|
|
4701
|
+
{ name: "_chainId", type: "uint256", internalType: "uint256" },
|
|
4702
|
+
{ name: "_blockOrBatchNumber", type: "uint256", internalType: "uint256" },
|
|
4703
|
+
{ name: "_index", type: "uint256", internalType: "uint256" },
|
|
4704
|
+
{
|
|
4705
|
+
name: "_log",
|
|
4706
|
+
type: "tuple",
|
|
4707
|
+
internalType: "struct L2Log",
|
|
4708
|
+
components: [
|
|
4709
|
+
{ name: "l2ShardId", type: "uint8", internalType: "uint8" },
|
|
4710
|
+
{ name: "isService", type: "bool", internalType: "bool" },
|
|
4711
|
+
{ name: "txNumberInBatch", type: "uint16", internalType: "uint16" },
|
|
4712
|
+
{ name: "sender", type: "address", internalType: "address" },
|
|
4713
|
+
{ name: "key", type: "bytes32", internalType: "bytes32" },
|
|
4714
|
+
{ name: "value", type: "bytes32", internalType: "bytes32" }
|
|
4715
|
+
]
|
|
4716
|
+
},
|
|
4717
|
+
{ name: "_proof", type: "bytes32[]", internalType: "bytes32[]" }
|
|
4718
|
+
],
|
|
4719
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
4720
|
+
stateMutability: "view"
|
|
4721
|
+
},
|
|
4722
|
+
{
|
|
4723
|
+
type: "function",
|
|
4724
|
+
name: "proveL2MessageInclusion",
|
|
4725
|
+
inputs: [
|
|
4726
|
+
{ name: "_batchNumber", type: "uint256", internalType: "uint256" },
|
|
4727
|
+
{ name: "_index", type: "uint256", internalType: "uint256" },
|
|
4728
|
+
{
|
|
4729
|
+
name: "_message",
|
|
4730
|
+
type: "tuple",
|
|
4731
|
+
internalType: "struct L2Message",
|
|
4732
|
+
components: [
|
|
4733
|
+
{ name: "txNumberInBatch", type: "uint16", internalType: "uint16" },
|
|
4734
|
+
{ name: "sender", type: "address", internalType: "address" },
|
|
4735
|
+
{ name: "data", type: "bytes", internalType: "bytes" }
|
|
4736
|
+
]
|
|
4737
|
+
},
|
|
4738
|
+
{ name: "_proof", type: "bytes32[]", internalType: "bytes32[]" }
|
|
4739
|
+
],
|
|
4740
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
4741
|
+
stateMutability: "view"
|
|
4742
|
+
},
|
|
4743
|
+
{
|
|
4744
|
+
type: "function",
|
|
4745
|
+
name: "proveL2MessageInclusionShared",
|
|
4746
|
+
inputs: [
|
|
4747
|
+
{ name: "_chainId", type: "uint256", internalType: "uint256" },
|
|
4748
|
+
{ name: "_blockOrBatchNumber", type: "uint256", internalType: "uint256" },
|
|
4749
|
+
{ name: "_index", type: "uint256", internalType: "uint256" },
|
|
4750
|
+
{
|
|
4751
|
+
name: "_message",
|
|
4752
|
+
type: "tuple",
|
|
4753
|
+
internalType: "struct L2Message",
|
|
4754
|
+
components: [
|
|
4755
|
+
{ name: "txNumberInBatch", type: "uint16", internalType: "uint16" },
|
|
4756
|
+
{ name: "sender", type: "address", internalType: "address" },
|
|
4757
|
+
{ name: "data", type: "bytes", internalType: "bytes" }
|
|
4758
|
+
]
|
|
4759
|
+
},
|
|
4760
|
+
{ name: "_proof", type: "bytes32[]", internalType: "bytes32[]" }
|
|
4761
|
+
],
|
|
4762
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
4763
|
+
stateMutability: "view"
|
|
4764
|
+
},
|
|
4765
|
+
{
|
|
4766
|
+
type: "function",
|
|
4767
|
+
name: "requestL2ServiceTransaction",
|
|
4768
|
+
inputs: [
|
|
4769
|
+
{ name: "_contractL2", type: "address", internalType: "address" },
|
|
4770
|
+
{ name: "_l2Calldata", type: "bytes", internalType: "bytes" }
|
|
4771
|
+
],
|
|
4772
|
+
outputs: [{ name: "canonicalTxHash", type: "bytes32", internalType: "bytes32" }],
|
|
4773
|
+
stateMutability: "nonpayable"
|
|
4774
|
+
},
|
|
4775
|
+
{
|
|
4776
|
+
type: "function",
|
|
4777
|
+
name: "requestL2Transaction",
|
|
4778
|
+
inputs: [
|
|
4779
|
+
{ name: "_contractL2", type: "address", internalType: "address" },
|
|
4780
|
+
{ name: "_l2Value", type: "uint256", internalType: "uint256" },
|
|
4781
|
+
{ name: "_calldata", type: "bytes", internalType: "bytes" },
|
|
4782
|
+
{ name: "_l2GasLimit", type: "uint256", internalType: "uint256" },
|
|
4783
|
+
{ name: "_l2GasPerPubdataByteLimit", type: "uint256", internalType: "uint256" },
|
|
4784
|
+
{ name: "_factoryDeps", type: "bytes[]", internalType: "bytes[]" },
|
|
4785
|
+
{ name: "_refundRecipient", type: "address", internalType: "address" }
|
|
4786
|
+
],
|
|
4787
|
+
outputs: [{ name: "canonicalTxHash", type: "bytes32", internalType: "bytes32" }],
|
|
4788
|
+
stateMutability: "payable"
|
|
4789
|
+
},
|
|
4790
|
+
{
|
|
4791
|
+
type: "function",
|
|
4792
|
+
name: "requestL2TransactionToGatewayMailbox",
|
|
4793
|
+
inputs: [
|
|
4794
|
+
{ name: "_chainId", type: "uint256", internalType: "uint256" },
|
|
4795
|
+
{ name: "_canonicalTxHash", type: "bytes32", internalType: "bytes32" },
|
|
4796
|
+
{ name: "_expirationTimestamp", type: "uint64", internalType: "uint64" }
|
|
4797
|
+
],
|
|
4798
|
+
outputs: [{ name: "canonicalTxHash", type: "bytes32", internalType: "bytes32" }],
|
|
4799
|
+
stateMutability: "nonpayable"
|
|
4800
|
+
},
|
|
4801
|
+
{
|
|
4802
|
+
type: "event",
|
|
4803
|
+
name: "NewPriorityRequest",
|
|
4804
|
+
inputs: [
|
|
4805
|
+
{ name: "txId", type: "uint256", indexed: false, internalType: "uint256" },
|
|
4806
|
+
{ name: "txHash", type: "bytes32", indexed: false, internalType: "bytes32" },
|
|
4807
|
+
{
|
|
4808
|
+
name: "expirationTimestamp",
|
|
4809
|
+
type: "uint64",
|
|
4810
|
+
indexed: false,
|
|
4811
|
+
internalType: "uint64"
|
|
4812
|
+
},
|
|
4813
|
+
{
|
|
4814
|
+
name: "transaction",
|
|
4815
|
+
type: "tuple",
|
|
4816
|
+
indexed: false,
|
|
4817
|
+
internalType: "struct L2CanonicalTransaction",
|
|
4818
|
+
components: [
|
|
4819
|
+
{ name: "txType", type: "uint256", internalType: "uint256" },
|
|
4820
|
+
{ name: "from", type: "uint256", internalType: "uint256" },
|
|
4821
|
+
{ name: "to", type: "uint256", internalType: "uint256" },
|
|
4822
|
+
{ name: "gasLimit", type: "uint256", internalType: "uint256" },
|
|
4823
|
+
{ name: "gasPerPubdataByteLimit", type: "uint256", internalType: "uint256" },
|
|
4824
|
+
{ name: "maxFeePerGas", type: "uint256", internalType: "uint256" },
|
|
4825
|
+
{ name: "maxPriorityFeePerGas", type: "uint256", internalType: "uint256" },
|
|
4826
|
+
{ name: "paymaster", type: "uint256", internalType: "uint256" },
|
|
4827
|
+
{ name: "nonce", type: "uint256", internalType: "uint256" },
|
|
4828
|
+
{ name: "value", type: "uint256", internalType: "uint256" },
|
|
4829
|
+
{ name: "reserved", type: "uint256[4]", internalType: "uint256[4]" },
|
|
4830
|
+
{ name: "data", type: "bytes", internalType: "bytes" },
|
|
4831
|
+
{ name: "signature", type: "bytes", internalType: "bytes" },
|
|
4832
|
+
{ name: "factoryDeps", type: "uint256[]", internalType: "uint256[]" },
|
|
4833
|
+
{ name: "paymasterInput", type: "bytes", internalType: "bytes" },
|
|
4834
|
+
{ name: "reservedDynamic", type: "bytes", internalType: "bytes" }
|
|
4835
|
+
]
|
|
4836
|
+
},
|
|
4837
|
+
{ name: "factoryDeps", type: "bytes[]", indexed: false, internalType: "bytes[]" }
|
|
4838
|
+
],
|
|
4839
|
+
anonymous: false
|
|
4840
|
+
},
|
|
4841
|
+
{
|
|
4842
|
+
type: "event",
|
|
4843
|
+
name: "NewPriorityRequestId",
|
|
4844
|
+
inputs: [
|
|
4845
|
+
{ name: "txId", type: "uint256", indexed: true, internalType: "uint256" },
|
|
4846
|
+
{ name: "txHash", type: "bytes32", indexed: true, internalType: "bytes32" }
|
|
4847
|
+
],
|
|
4848
|
+
anonymous: false
|
|
4849
|
+
},
|
|
4850
|
+
{
|
|
4851
|
+
type: "event",
|
|
4852
|
+
name: "NewRelayedPriorityTransaction",
|
|
4853
|
+
inputs: [
|
|
4854
|
+
{ name: "txId", type: "uint256", indexed: false, internalType: "uint256" },
|
|
4855
|
+
{ name: "txHash", type: "bytes32", indexed: false, internalType: "bytes32" },
|
|
4856
|
+
{
|
|
4857
|
+
name: "expirationTimestamp",
|
|
4858
|
+
type: "uint64",
|
|
4859
|
+
indexed: false,
|
|
4860
|
+
internalType: "uint64"
|
|
4861
|
+
}
|
|
4862
|
+
],
|
|
4863
|
+
anonymous: false
|
|
4864
|
+
},
|
|
4865
|
+
{ type: "error", name: "BaseTokenGasPriceDenominatorNotSet", inputs: [] },
|
|
4866
|
+
{
|
|
4867
|
+
type: "error",
|
|
4868
|
+
name: "BatchNotExecuted",
|
|
4869
|
+
inputs: [{ name: "batchNumber", type: "uint256", internalType: "uint256" }]
|
|
4870
|
+
},
|
|
4871
|
+
{ type: "error", name: "GasPerPubdataMismatch", inputs: [] },
|
|
4872
|
+
{ type: "error", name: "HashedLogIsDefault", inputs: [] },
|
|
4873
|
+
{ type: "error", name: "InvalidChainId", inputs: [] },
|
|
4874
|
+
{ type: "error", name: "InvalidProofLengthForFinalNode", inputs: [] },
|
|
4875
|
+
{
|
|
4876
|
+
type: "error",
|
|
4877
|
+
name: "LengthIsNotDivisibleBy32",
|
|
4878
|
+
inputs: [{ name: "length", type: "uint256", internalType: "uint256" }]
|
|
4879
|
+
},
|
|
4880
|
+
{ type: "error", name: "LocalRootIsZero", inputs: [] },
|
|
4881
|
+
{ type: "error", name: "LocalRootMustBeZero", inputs: [] },
|
|
4882
|
+
{
|
|
4883
|
+
type: "error",
|
|
4884
|
+
name: "MalformedBytecode",
|
|
4885
|
+
inputs: [{ name: "", type: "uint8", internalType: "enum BytecodeError" }]
|
|
4886
|
+
},
|
|
4887
|
+
{ type: "error", name: "MerkleIndexOutOfBounds", inputs: [] },
|
|
4888
|
+
{ type: "error", name: "MerklePathEmpty", inputs: [] },
|
|
4889
|
+
{ type: "error", name: "MerklePathOutOfBounds", inputs: [] },
|
|
4890
|
+
{
|
|
4891
|
+
type: "error",
|
|
4892
|
+
name: "MsgValueTooLow",
|
|
4893
|
+
inputs: [
|
|
4894
|
+
{ name: "required", type: "uint256", internalType: "uint256" },
|
|
4895
|
+
{ name: "provided", type: "uint256", internalType: "uint256" }
|
|
4896
|
+
]
|
|
4897
|
+
},
|
|
4898
|
+
{ type: "error", name: "NotHyperchain", inputs: [] },
|
|
4899
|
+
{ type: "error", name: "NotInitializedReentrancyGuard", inputs: [] },
|
|
4900
|
+
{
|
|
4901
|
+
type: "error",
|
|
4902
|
+
name: "NotL1",
|
|
4903
|
+
inputs: [{ name: "blockChainId", type: "uint256", internalType: "uint256" }]
|
|
4904
|
+
},
|
|
4905
|
+
{ type: "error", name: "NotSettlementLayer", inputs: [] },
|
|
4906
|
+
{ type: "error", name: "OnlyEraSupported", inputs: [] },
|
|
4907
|
+
{
|
|
4908
|
+
type: "error",
|
|
4909
|
+
name: "PubdataGreaterThanLimit",
|
|
4910
|
+
inputs: [
|
|
4911
|
+
{ name: "limit", type: "uint256", internalType: "uint256" },
|
|
4912
|
+
{ name: "length", type: "uint256", internalType: "uint256" }
|
|
4913
|
+
]
|
|
4914
|
+
},
|
|
4915
|
+
{ type: "error", name: "Reentrancy", inputs: [] },
|
|
4916
|
+
{ type: "error", name: "TooManyFactoryDeps", inputs: [] },
|
|
4917
|
+
{ type: "error", name: "TooMuchGas", inputs: [] },
|
|
4918
|
+
{ type: "error", name: "TransactionNotAllowed", inputs: [] },
|
|
4919
|
+
{ type: "error", name: "TxnBodyGasLimitNotEnoughGas", inputs: [] },
|
|
4920
|
+
{
|
|
4921
|
+
type: "error",
|
|
4922
|
+
name: "Unauthorized",
|
|
4923
|
+
inputs: [{ name: "caller", type: "address", internalType: "address" }]
|
|
4924
|
+
},
|
|
4925
|
+
{
|
|
4926
|
+
type: "error",
|
|
4927
|
+
name: "UnsupportedProofMetadataVersion",
|
|
4928
|
+
inputs: [{ name: "metadataVersion", type: "uint256", internalType: "uint256" }]
|
|
4929
|
+
},
|
|
4930
|
+
{ type: "error", name: "ValidateTxnNotEnoughGas", inputs: [] },
|
|
4931
|
+
{ type: "error", name: "ZeroGasPriceL1TxZKSyncOS", inputs: [] }
|
|
4932
|
+
];
|
|
4933
|
+
var Mailbox_default = MailboxABI;
|
|
4934
|
+
var ERROR_IFACES = [];
|
|
4935
|
+
var IFACE_ERROR_STRING = new ethers.Interface(["error Error(string)"]);
|
|
4936
|
+
var IFACE_PANIC = new ethers.Interface(["error Panic(uint256)"]);
|
|
4937
|
+
(function bootstrapDefaultIfaces() {
|
|
4938
|
+
try {
|
|
4939
|
+
ERROR_IFACES.push({
|
|
4940
|
+
name: "IL1Nullifier",
|
|
4941
|
+
iface: new ethers.Interface(IL1Nullifier_default)
|
|
4942
|
+
});
|
|
4943
|
+
} catch {
|
|
4944
|
+
}
|
|
4945
|
+
try {
|
|
4946
|
+
ERROR_IFACES.push({ name: "IERC20", iface: new ethers.Interface(IERC20_default) });
|
|
4947
|
+
} catch {
|
|
4948
|
+
}
|
|
4949
|
+
try {
|
|
4950
|
+
ERROR_IFACES.push({
|
|
4951
|
+
name: "IL1NativeTokenVault",
|
|
4952
|
+
iface: new ethers.Interface(L1NativeTokenVault_default)
|
|
4953
|
+
});
|
|
4954
|
+
} catch {
|
|
4955
|
+
}
|
|
4956
|
+
try {
|
|
4957
|
+
ERROR_IFACES.push({
|
|
4958
|
+
name: "IL2NativeTokenVault",
|
|
4959
|
+
iface: new ethers.Interface(L2NativeTokenVault_default)
|
|
4960
|
+
});
|
|
4961
|
+
} catch {
|
|
4962
|
+
}
|
|
4963
|
+
try {
|
|
4964
|
+
ERROR_IFACES.push({ name: "Mailbox", iface: new ethers.Interface(Mailbox_default) });
|
|
4965
|
+
} catch {
|
|
4966
|
+
}
|
|
4967
|
+
})();
|
|
4968
|
+
function extractRevertData(e) {
|
|
4969
|
+
const maybe = (
|
|
4970
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
4971
|
+
e?.data?.data ?? e?.error?.data ?? e?.data ?? e?.error?.error?.data ?? e?.info?.error?.data
|
|
4972
|
+
);
|
|
4973
|
+
if (typeof maybe === "string" && maybe.startsWith("0x") && maybe.length >= 10) {
|
|
4974
|
+
return maybe;
|
|
4975
|
+
}
|
|
4976
|
+
return void 0;
|
|
4977
|
+
}
|
|
4978
|
+
function decodeRevert(e) {
|
|
4979
|
+
const data = extractRevertData(e);
|
|
4980
|
+
if (!data) return;
|
|
4981
|
+
const selector = `0x${data.slice(2, 10)}`;
|
|
4982
|
+
try {
|
|
4983
|
+
const parsed = IFACE_ERROR_STRING.parseError(data);
|
|
4984
|
+
if (parsed?.name === "Error") {
|
|
4985
|
+
const args = parsed.args ? Array.from(parsed.args) : void 0;
|
|
4986
|
+
return { selector, name: "Error", args };
|
|
4987
|
+
}
|
|
4988
|
+
} catch {
|
|
4989
|
+
}
|
|
4990
|
+
try {
|
|
4991
|
+
const parsed = IFACE_PANIC.parseError(data);
|
|
4992
|
+
if (parsed?.name === "Panic") {
|
|
4993
|
+
const args = parsed.args ? Array.from(parsed.args) : void 0;
|
|
4994
|
+
return { selector, name: "Panic", args };
|
|
4995
|
+
}
|
|
4996
|
+
} catch {
|
|
4997
|
+
}
|
|
4998
|
+
for (const { name, iface } of ERROR_IFACES) {
|
|
4999
|
+
try {
|
|
5000
|
+
const parsed = iface.parseError(data);
|
|
5001
|
+
if (parsed) {
|
|
5002
|
+
const args = parsed.args ? Array.from(parsed.args) : void 0;
|
|
5003
|
+
return {
|
|
5004
|
+
selector,
|
|
5005
|
+
name: parsed.name,
|
|
5006
|
+
args,
|
|
5007
|
+
contract: name
|
|
5008
|
+
};
|
|
5009
|
+
}
|
|
5010
|
+
} catch {
|
|
5011
|
+
}
|
|
5012
|
+
}
|
|
5013
|
+
return { selector };
|
|
5014
|
+
}
|
|
5015
|
+
|
|
5016
|
+
// src/adapters/ethers/errors/error-ops.ts
|
|
5017
|
+
function toZKsyncError(type, base, err) {
|
|
5018
|
+
if (isZKsyncError(err)) return err;
|
|
5019
|
+
const revert = decodeRevert(err);
|
|
5020
|
+
return createError(type, { ...base, ...revert ? { revert } : {}, cause: shapeCause(err) });
|
|
5021
|
+
}
|
|
5022
|
+
function resolveMessage(op, msg) {
|
|
5023
|
+
if (!msg) return `Error during ${op}.`;
|
|
5024
|
+
return typeof msg === "function" ? msg() : msg;
|
|
5025
|
+
}
|
|
5026
|
+
function createErrorHandlers(resource) {
|
|
5027
|
+
async function run(kind, operation, fn, opts) {
|
|
5028
|
+
try {
|
|
5029
|
+
return await fn();
|
|
5030
|
+
} catch (e) {
|
|
5031
|
+
if (isZKsyncError(e)) throw e;
|
|
5032
|
+
const message = resolveMessage(operation, opts?.message);
|
|
5033
|
+
throw toZKsyncError(kind, { resource, operation, context: opts?.ctx ?? {}, message }, e);
|
|
5034
|
+
}
|
|
5035
|
+
}
|
|
5036
|
+
function wrap(operation, fn, opts) {
|
|
5037
|
+
return run("INTERNAL", operation, fn, opts);
|
|
5038
|
+
}
|
|
5039
|
+
function wrapAs2(kind, operation, fn, opts) {
|
|
5040
|
+
return run(kind, operation, fn, opts);
|
|
5041
|
+
}
|
|
5042
|
+
async function toResult(operation, fn, opts) {
|
|
5043
|
+
try {
|
|
5044
|
+
const value = await wrap(operation, fn, opts);
|
|
5045
|
+
return { ok: true, value };
|
|
5046
|
+
} catch (e) {
|
|
5047
|
+
const shaped = isZKsyncError(e) ? e : toZKsyncError(
|
|
5048
|
+
"INTERNAL",
|
|
5049
|
+
{
|
|
5050
|
+
resource,
|
|
5051
|
+
operation,
|
|
5052
|
+
context: opts?.ctx ?? {},
|
|
5053
|
+
message: resolveMessage(operation, opts?.message)
|
|
5054
|
+
},
|
|
5055
|
+
e
|
|
5056
|
+
);
|
|
5057
|
+
return { ok: false, error: shaped };
|
|
5058
|
+
}
|
|
5059
|
+
}
|
|
5060
|
+
return { wrap, wrapAs: wrapAs2, toResult };
|
|
5061
|
+
}
|
|
5062
|
+
|
|
4426
5063
|
// src/adapters/ethers/client.ts
|
|
5064
|
+
var { wrapAs } = createErrorHandlers("client");
|
|
4427
5065
|
function createEthersClient(args) {
|
|
4428
5066
|
const { l1, l2, signer } = args;
|
|
4429
5067
|
let boundSigner = signer;
|
|
@@ -4521,7 +5159,10 @@ function createEthersClient(args) {
|
|
|
4521
5159
|
async function baseToken(chainId) {
|
|
4522
5160
|
const { bridgehub } = await ensureAddresses();
|
|
4523
5161
|
const bh = new ethers.Contract(bridgehub, IBridgehub_default, l1);
|
|
4524
|
-
return await bh.baseToken(chainId)
|
|
5162
|
+
return await wrapAs("CONTRACT", OP_DEPOSITS.base.baseToken, () => bh.baseToken(chainId), {
|
|
5163
|
+
ctx: { where: "bridgehub.baseToken", chainIdL2: chainId },
|
|
5164
|
+
message: "Failed to read base token."
|
|
5165
|
+
});
|
|
4525
5166
|
}
|
|
4526
5167
|
const client = {
|
|
4527
5168
|
kind: "ethers",
|