@matterlabs/zksync-js 0.0.6 → 0.0.8

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.
Files changed (76) hide show
  1. package/dist/adapters/ethers/client.cjs +243 -79
  2. package/dist/adapters/ethers/client.cjs.map +1 -1
  3. package/dist/adapters/ethers/client.js +6 -6
  4. package/dist/adapters/ethers/errors/error-ops.d.ts +26 -19
  5. package/dist/adapters/ethers/index.cjs +290 -119
  6. package/dist/adapters/ethers/index.cjs.map +1 -1
  7. package/dist/adapters/ethers/index.js +9 -9
  8. package/dist/adapters/ethers/sdk.cjs +78 -59
  9. package/dist/adapters/ethers/sdk.cjs.map +1 -1
  10. package/dist/adapters/ethers/sdk.js +7 -7
  11. package/dist/adapters/viem/client.cjs +192 -34
  12. package/dist/adapters/viem/client.cjs.map +1 -1
  13. package/dist/adapters/viem/client.js +4 -4
  14. package/dist/adapters/viem/errors/error-ops.d.ts +26 -19
  15. package/dist/adapters/viem/index.cjs +290 -119
  16. package/dist/adapters/viem/index.cjs.map +1 -1
  17. package/dist/adapters/viem/index.js +8 -8
  18. package/dist/adapters/viem/sdk.cjs +97 -80
  19. package/dist/adapters/viem/sdk.cjs.map +1 -1
  20. package/dist/adapters/viem/sdk.js +6 -6
  21. package/dist/{chunk-M5J2MM2U.js → chunk-3GFCAGGI.js} +1430 -7
  22. package/dist/chunk-5V2JRM5J.js +75 -0
  23. package/dist/{chunk-WU2LOG2A.js → chunk-63DNJXS3.js} +7 -8
  24. package/dist/{chunk-F2ENUV3A.js → chunk-C3AGOEHR.js} +12 -2
  25. package/dist/{chunk-3MRGU4HV.js → chunk-FGXRG2JS.js} +4 -4
  26. package/dist/{chunk-NTEIA5KA.js → chunk-L343N56B.js} +1 -1
  27. package/dist/{chunk-2MDK3GLO.js → chunk-LNIEQ7AN.js} +9 -54
  28. package/dist/{chunk-LL3WKCFJ.js → chunk-NODVRI3E.js} +2 -2
  29. package/dist/{chunk-XRE7H466.js → chunk-NVULC4JB.js} +3 -47
  30. package/dist/{chunk-YUK547UF.js → chunk-ODMBZ2VX.js} +3 -3
  31. package/dist/{chunk-NEC2ZKHI.js → chunk-QZVYN3YA.js} +30 -7
  32. package/dist/{chunk-6K6VJQAL.js → chunk-SHQQI3UD.js} +175 -20
  33. package/dist/core/abi.d.ts +5 -0
  34. package/dist/core/constants.cjs +11 -1
  35. package/dist/core/constants.cjs.map +1 -1
  36. package/dist/core/constants.d.ts +11 -1
  37. package/dist/core/constants.js +1 -1
  38. package/dist/core/errors/error-ops.d.ts +18 -0
  39. package/dist/core/index.cjs +1737 -131
  40. package/dist/core/index.cjs.map +1 -1
  41. package/dist/core/index.d.ts +2 -1
  42. package/dist/core/index.js +5 -5
  43. package/dist/core/internal/abis/IERC7786Attributes.d.ts +42 -0
  44. package/dist/core/internal/abis/IInteropCenter.d.ts +211 -0
  45. package/dist/core/internal/abis/IInteropHandler.d.ts +166 -0
  46. package/dist/core/internal/abis/InteropCenter.d.ts +578 -0
  47. package/dist/core/internal/abis/InteropRootStorage.d.ts +20 -0
  48. package/dist/core/internal/abis/L2MessageVerification.d.ts +277 -0
  49. package/dist/core/resources/interop/attributes/bundle.d.ts +6 -0
  50. package/dist/core/resources/interop/attributes/call.d.ts +6 -0
  51. package/dist/core/resources/interop/attributes/index.d.ts +4 -0
  52. package/dist/core/resources/interop/attributes/resource.d.ts +12 -0
  53. package/dist/core/resources/interop/attributes/types.d.ts +6 -0
  54. package/dist/core/resources/interop/events.d.ts +7 -0
  55. package/dist/core/resources/interop/finalization.d.ts +61 -0
  56. package/dist/core/resources/interop/plan.d.ts +39 -0
  57. package/dist/core/resources/interop/route.d.ts +15 -0
  58. package/dist/core/rpc/types.d.ts +14 -0
  59. package/dist/core/rpc/zks.d.ts +4 -1
  60. package/dist/core/types/errors.d.ts +43 -2
  61. package/dist/core/types/flows/base.d.ts +1 -1
  62. package/dist/core/types/flows/interop.d.ts +231 -0
  63. package/dist/core/types/flows/withdrawals.d.ts +0 -8
  64. package/dist/core/types/transactions.d.ts +10 -0
  65. package/dist/core/utils/addr.d.ts +2 -2
  66. package/dist/core/utils/events.d.ts +12 -0
  67. package/dist/core/utils/hash.d.ts +5 -0
  68. package/dist/core/utils/index.d.ts +5 -0
  69. package/dist/core/utils/number.d.ts +2 -0
  70. package/dist/index.cjs +1748 -132
  71. package/dist/index.cjs.map +1 -1
  72. package/dist/index.d.ts +2 -1
  73. package/dist/index.js +5 -5
  74. package/package.json +6 -2
  75. package/dist/chunk-NCAIVYBR.js +0 -23
  76. package/dist/core/resources/withdrawals/events.d.ts +0 -9
@@ -25,10 +25,15 @@ __export(abi_exports, {
25
25
  IBaseTokenABI: () => IBaseToken_default,
26
26
  IBridgehubABI: () => IBridgehub_default,
27
27
  IERC20ABI: () => IERC20_default,
28
+ IERC7786AttributesABI: () => IERC7786Attributes_default,
29
+ IInteropHandlerABI: () => IInteropHandler_default,
28
30
  IL1AssetRouterABI: () => IL1AssetRouter_default,
29
31
  IL1NullifierABI: () => IL1Nullifier_default,
30
32
  IL2AssetRouterABI: () => IL2AssetRouter_default,
33
+ InteropCenterABI: () => InteropCenter_default,
34
+ InteropRootStorageABI: () => InteropRootStorage_default,
31
35
  L1NativeTokenVaultABI: () => L1NativeTokenVault_default,
36
+ L2MessageVerificationABI: () => L2MessageVerification_default,
32
37
  L2NativeTokenVaultABI: () => L2NativeTokenVault_default,
33
38
  MailboxABI: () => Mailbox_default
34
39
  });
@@ -4145,6 +4150,63 @@ var IERC20ABI = [
4145
4150
  ];
4146
4151
  var IERC20_default = IERC20ABI;
4147
4152
 
4153
+ // src/core/internal/abis/IERC7786Attributes.ts
4154
+ var IERC7786AttributesABI = [
4155
+ {
4156
+ inputs: [
4157
+ {
4158
+ internalType: "bytes",
4159
+ name: "_executionAddress",
4160
+ type: "bytes"
4161
+ }
4162
+ ],
4163
+ name: "executionAddress",
4164
+ outputs: [],
4165
+ stateMutability: "pure",
4166
+ type: "function"
4167
+ },
4168
+ {
4169
+ inputs: [
4170
+ {
4171
+ internalType: "uint256",
4172
+ name: "_indirectCallMessageValue",
4173
+ type: "uint256"
4174
+ }
4175
+ ],
4176
+ name: "indirectCall",
4177
+ outputs: [],
4178
+ stateMutability: "pure",
4179
+ type: "function"
4180
+ },
4181
+ {
4182
+ inputs: [
4183
+ {
4184
+ internalType: "uint256",
4185
+ name: "_interopCallValue",
4186
+ type: "uint256"
4187
+ }
4188
+ ],
4189
+ name: "interopCallValue",
4190
+ outputs: [],
4191
+ stateMutability: "pure",
4192
+ type: "function"
4193
+ },
4194
+ {
4195
+ inputs: [
4196
+ {
4197
+ internalType: "bytes",
4198
+ name: "_unbundlerAddress",
4199
+ type: "bytes"
4200
+ }
4201
+ ],
4202
+ name: "unbundlerAddress",
4203
+ outputs: [],
4204
+ stateMutability: "pure",
4205
+ type: "function"
4206
+ }
4207
+ ];
4208
+ var IERC7786Attributes_default = IERC7786AttributesABI;
4209
+
4148
4210
  // src/core/internal/abis/Mailbox.ts
4149
4211
  var MailboxABI = [
4150
4212
  {
@@ -4434,92 +4496,1449 @@ var MailboxABI = [
4434
4496
  { name: "txId", type: "uint256", indexed: true, internalType: "uint256" },
4435
4497
  { name: "txHash", type: "bytes32", indexed: true, internalType: "bytes32" }
4436
4498
  ],
4437
- anonymous: false
4499
+ anonymous: false
4500
+ },
4501
+ {
4502
+ type: "event",
4503
+ name: "NewRelayedPriorityTransaction",
4504
+ inputs: [
4505
+ { name: "txId", type: "uint256", indexed: false, internalType: "uint256" },
4506
+ { name: "txHash", type: "bytes32", indexed: false, internalType: "bytes32" },
4507
+ {
4508
+ name: "expirationTimestamp",
4509
+ type: "uint64",
4510
+ indexed: false,
4511
+ internalType: "uint64"
4512
+ }
4513
+ ],
4514
+ anonymous: false
4515
+ },
4516
+ { type: "error", name: "BaseTokenGasPriceDenominatorNotSet", inputs: [] },
4517
+ {
4518
+ type: "error",
4519
+ name: "BatchNotExecuted",
4520
+ inputs: [{ name: "batchNumber", type: "uint256", internalType: "uint256" }]
4521
+ },
4522
+ { type: "error", name: "GasPerPubdataMismatch", inputs: [] },
4523
+ { type: "error", name: "HashedLogIsDefault", inputs: [] },
4524
+ { type: "error", name: "InvalidChainId", inputs: [] },
4525
+ { type: "error", name: "InvalidProofLengthForFinalNode", inputs: [] },
4526
+ {
4527
+ type: "error",
4528
+ name: "LengthIsNotDivisibleBy32",
4529
+ inputs: [{ name: "length", type: "uint256", internalType: "uint256" }]
4530
+ },
4531
+ { type: "error", name: "LocalRootIsZero", inputs: [] },
4532
+ { type: "error", name: "LocalRootMustBeZero", inputs: [] },
4533
+ {
4534
+ type: "error",
4535
+ name: "MalformedBytecode",
4536
+ inputs: [{ name: "", type: "uint8", internalType: "enum BytecodeError" }]
4537
+ },
4538
+ { type: "error", name: "MerkleIndexOutOfBounds", inputs: [] },
4539
+ { type: "error", name: "MerklePathEmpty", inputs: [] },
4540
+ { type: "error", name: "MerklePathOutOfBounds", inputs: [] },
4541
+ {
4542
+ type: "error",
4543
+ name: "MsgValueTooLow",
4544
+ inputs: [
4545
+ { name: "required", type: "uint256", internalType: "uint256" },
4546
+ { name: "provided", type: "uint256", internalType: "uint256" }
4547
+ ]
4548
+ },
4549
+ { type: "error", name: "NotHyperchain", inputs: [] },
4550
+ { type: "error", name: "NotInitializedReentrancyGuard", inputs: [] },
4551
+ {
4552
+ type: "error",
4553
+ name: "NotL1",
4554
+ inputs: [{ name: "blockChainId", type: "uint256", internalType: "uint256" }]
4555
+ },
4556
+ { type: "error", name: "NotSettlementLayer", inputs: [] },
4557
+ { type: "error", name: "OnlyEraSupported", inputs: [] },
4558
+ {
4559
+ type: "error",
4560
+ name: "PubdataGreaterThanLimit",
4561
+ inputs: [
4562
+ { name: "limit", type: "uint256", internalType: "uint256" },
4563
+ { name: "length", type: "uint256", internalType: "uint256" }
4564
+ ]
4565
+ },
4566
+ { type: "error", name: "Reentrancy", inputs: [] },
4567
+ { type: "error", name: "TooManyFactoryDeps", inputs: [] },
4568
+ { type: "error", name: "TooMuchGas", inputs: [] },
4569
+ { type: "error", name: "TransactionNotAllowed", inputs: [] },
4570
+ { type: "error", name: "TxnBodyGasLimitNotEnoughGas", inputs: [] },
4571
+ {
4572
+ type: "error",
4573
+ name: "Unauthorized",
4574
+ inputs: [{ name: "caller", type: "address", internalType: "address" }]
4575
+ },
4576
+ {
4577
+ type: "error",
4578
+ name: "UnsupportedProofMetadataVersion",
4579
+ inputs: [{ name: "metadataVersion", type: "uint256", internalType: "uint256" }]
4580
+ },
4581
+ { type: "error", name: "ValidateTxnNotEnoughGas", inputs: [] },
4582
+ { type: "error", name: "ZeroGasPriceL1TxZKSyncOS", inputs: [] }
4583
+ ];
4584
+ var Mailbox_default = MailboxABI;
4585
+
4586
+ // src/core/internal/abis/InteropCenter.ts
4587
+ var InteropCenterABI = [
4588
+ {
4589
+ inputs: [
4590
+ {
4591
+ internalType: "bytes4",
4592
+ name: "selector",
4593
+ type: "bytes4"
4594
+ }
4595
+ ],
4596
+ name: "AttributeAlreadySet",
4597
+ type: "error"
4598
+ },
4599
+ {
4600
+ inputs: [
4601
+ {
4602
+ internalType: "bytes4",
4603
+ name: "selector",
4604
+ type: "bytes4"
4605
+ },
4606
+ {
4607
+ internalType: "uint256",
4608
+ name: "restriction",
4609
+ type: "uint256"
4610
+ }
4611
+ ],
4612
+ name: "AttributeViolatesRestriction",
4613
+ type: "error"
4614
+ },
4615
+ {
4616
+ inputs: [
4617
+ {
4618
+ internalType: "uint256",
4619
+ name: "expected",
4620
+ type: "uint256"
4621
+ },
4622
+ {
4623
+ internalType: "uint256",
4624
+ name: "actual",
4625
+ type: "uint256"
4626
+ }
4627
+ ],
4628
+ name: "IndirectCallValueMismatch",
4629
+ type: "error"
4630
+ },
4631
+ {
4632
+ inputs: [
4633
+ {
4634
+ internalType: "bytes",
4635
+ name: "interoperableAddress",
4636
+ type: "bytes"
4637
+ }
4638
+ ],
4639
+ name: "InteroperableAddressChainReferenceNotEmpty",
4640
+ type: "error"
4641
+ },
4642
+ {
4643
+ inputs: [
4644
+ {
4645
+ internalType: "bytes",
4646
+ name: "interoperableAddress",
4647
+ type: "bytes"
4648
+ }
4649
+ ],
4650
+ name: "InteroperableAddressNotEmpty",
4651
+ type: "error"
4652
+ },
4653
+ {
4654
+ inputs: [
4655
+ {
4656
+ internalType: "bytes",
4657
+ name: "",
4658
+ type: "bytes"
4659
+ }
4660
+ ],
4661
+ name: "InteroperableAddressParsingError",
4662
+ type: "error"
4663
+ },
4664
+ {
4665
+ inputs: [
4666
+ {
4667
+ internalType: "uint256",
4668
+ name: "expectedMsgValue",
4669
+ type: "uint256"
4670
+ },
4671
+ {
4672
+ internalType: "uint256",
4673
+ name: "providedMsgValue",
4674
+ type: "uint256"
4675
+ }
4676
+ ],
4677
+ name: "MsgValueMismatch",
4678
+ type: "error"
4679
+ },
4680
+ {
4681
+ inputs: [],
4682
+ name: "NotInGatewayMode",
4683
+ type: "error"
4684
+ },
4685
+ {
4686
+ inputs: [
4687
+ {
4688
+ internalType: "uint256",
4689
+ name: "sourceChainId",
4690
+ type: "uint256"
4691
+ },
4692
+ {
4693
+ internalType: "uint256",
4694
+ name: "destinationChainId",
4695
+ type: "uint256"
4696
+ }
4697
+ ],
4698
+ name: "NotL2ToL2",
4699
+ type: "error"
4700
+ },
4701
+ {
4702
+ inputs: [],
4703
+ name: "SlotOccupied",
4704
+ type: "error"
4705
+ },
4706
+ {
4707
+ inputs: [
4708
+ {
4709
+ internalType: "address",
4710
+ name: "caller",
4711
+ type: "address"
4712
+ }
4713
+ ],
4714
+ name: "Unauthorized",
4715
+ type: "error"
4716
+ },
4717
+ {
4718
+ inputs: [
4719
+ {
4720
+ internalType: "bytes4",
4721
+ name: "selector",
4722
+ type: "bytes4"
4723
+ }
4724
+ ],
4725
+ name: "UnsupportedAttribute",
4726
+ type: "error"
4727
+ },
4728
+ {
4729
+ anonymous: false,
4730
+ inputs: [
4731
+ {
4732
+ indexed: false,
4733
+ internalType: "uint8",
4734
+ name: "version",
4735
+ type: "uint8"
4736
+ }
4737
+ ],
4738
+ name: "Initialized",
4739
+ type: "event"
4740
+ },
4741
+ {
4742
+ anonymous: false,
4743
+ inputs: [
4744
+ {
4745
+ indexed: false,
4746
+ internalType: "bytes32",
4747
+ name: "l2l1MsgHash",
4748
+ type: "bytes32"
4749
+ },
4750
+ {
4751
+ indexed: false,
4752
+ internalType: "bytes32",
4753
+ name: "interopBundleHash",
4754
+ type: "bytes32"
4755
+ },
4756
+ {
4757
+ components: [
4758
+ {
4759
+ internalType: "bytes1",
4760
+ name: "version",
4761
+ type: "bytes1"
4762
+ },
4763
+ {
4764
+ internalType: "uint256",
4765
+ name: "sourceChainId",
4766
+ type: "uint256"
4767
+ },
4768
+ {
4769
+ internalType: "uint256",
4770
+ name: "destinationChainId",
4771
+ type: "uint256"
4772
+ },
4773
+ {
4774
+ internalType: "bytes32",
4775
+ name: "interopBundleSalt",
4776
+ type: "bytes32"
4777
+ },
4778
+ {
4779
+ components: [
4780
+ {
4781
+ internalType: "bytes1",
4782
+ name: "version",
4783
+ type: "bytes1"
4784
+ },
4785
+ {
4786
+ internalType: "bool",
4787
+ name: "shadowAccount",
4788
+ type: "bool"
4789
+ },
4790
+ {
4791
+ internalType: "address",
4792
+ name: "to",
4793
+ type: "address"
4794
+ },
4795
+ {
4796
+ internalType: "address",
4797
+ name: "from",
4798
+ type: "address"
4799
+ },
4800
+ {
4801
+ internalType: "uint256",
4802
+ name: "value",
4803
+ type: "uint256"
4804
+ },
4805
+ {
4806
+ internalType: "bytes",
4807
+ name: "data",
4808
+ type: "bytes"
4809
+ }
4810
+ ],
4811
+ internalType: "struct InteropCall[]",
4812
+ name: "calls",
4813
+ type: "tuple[]"
4814
+ },
4815
+ {
4816
+ components: [
4817
+ {
4818
+ internalType: "bytes",
4819
+ name: "executionAddress",
4820
+ type: "bytes"
4821
+ },
4822
+ {
4823
+ internalType: "bytes",
4824
+ name: "unbundlerAddress",
4825
+ type: "bytes"
4826
+ }
4827
+ ],
4828
+ internalType: "struct BundleAttributes",
4829
+ name: "bundleAttributes",
4830
+ type: "tuple"
4831
+ }
4832
+ ],
4833
+ indexed: false,
4834
+ internalType: "struct InteropBundle",
4835
+ name: "interopBundle",
4836
+ type: "tuple"
4837
+ }
4838
+ ],
4839
+ name: "InteropBundleSent",
4840
+ type: "event"
4841
+ },
4842
+ {
4843
+ anonymous: false,
4844
+ inputs: [
4845
+ {
4846
+ indexed: true,
4847
+ internalType: "bytes32",
4848
+ name: "sendId",
4849
+ type: "bytes32"
4850
+ },
4851
+ {
4852
+ indexed: false,
4853
+ internalType: "bytes",
4854
+ name: "sender",
4855
+ type: "bytes"
4856
+ },
4857
+ {
4858
+ indexed: false,
4859
+ internalType: "bytes",
4860
+ name: "recipient",
4861
+ type: "bytes"
4862
+ },
4863
+ {
4864
+ indexed: false,
4865
+ internalType: "bytes",
4866
+ name: "payload",
4867
+ type: "bytes"
4868
+ },
4869
+ {
4870
+ indexed: false,
4871
+ internalType: "uint256",
4872
+ name: "value",
4873
+ type: "uint256"
4874
+ },
4875
+ {
4876
+ indexed: false,
4877
+ internalType: "bytes[]",
4878
+ name: "attributes",
4879
+ type: "bytes[]"
4880
+ }
4881
+ ],
4882
+ name: "MessageSent",
4883
+ type: "event"
4884
+ },
4885
+ {
4886
+ anonymous: false,
4887
+ inputs: [
4888
+ {
4889
+ indexed: true,
4890
+ internalType: "address",
4891
+ name: "oldAssetRouter",
4892
+ type: "address"
4893
+ },
4894
+ {
4895
+ indexed: true,
4896
+ internalType: "address",
4897
+ name: "newAssetRouter",
4898
+ type: "address"
4899
+ }
4900
+ ],
4901
+ name: "NewAssetRouter",
4902
+ type: "event"
4903
+ },
4904
+ {
4905
+ anonymous: false,
4906
+ inputs: [
4907
+ {
4908
+ indexed: true,
4909
+ internalType: "address",
4910
+ name: "oldAssetTracker",
4911
+ type: "address"
4912
+ },
4913
+ {
4914
+ indexed: true,
4915
+ internalType: "address",
4916
+ name: "newAssetTracker",
4917
+ type: "address"
4918
+ }
4919
+ ],
4920
+ name: "NewAssetTracker",
4921
+ type: "event"
4922
+ },
4923
+ {
4924
+ anonymous: false,
4925
+ inputs: [
4926
+ {
4927
+ indexed: true,
4928
+ internalType: "address",
4929
+ name: "previousOwner",
4930
+ type: "address"
4931
+ },
4932
+ {
4933
+ indexed: true,
4934
+ internalType: "address",
4935
+ name: "newOwner",
4936
+ type: "address"
4937
+ }
4938
+ ],
4939
+ name: "OwnershipTransferStarted",
4940
+ type: "event"
4941
+ },
4942
+ {
4943
+ anonymous: false,
4944
+ inputs: [
4945
+ {
4946
+ indexed: true,
4947
+ internalType: "address",
4948
+ name: "previousOwner",
4949
+ type: "address"
4950
+ },
4951
+ {
4952
+ indexed: true,
4953
+ internalType: "address",
4954
+ name: "newOwner",
4955
+ type: "address"
4956
+ }
4957
+ ],
4958
+ name: "OwnershipTransferred",
4959
+ type: "event"
4960
+ },
4961
+ {
4962
+ anonymous: false,
4963
+ inputs: [
4964
+ {
4965
+ indexed: false,
4966
+ internalType: "address",
4967
+ name: "account",
4968
+ type: "address"
4969
+ }
4970
+ ],
4971
+ name: "Paused",
4972
+ type: "event"
4973
+ },
4974
+ {
4975
+ anonymous: false,
4976
+ inputs: [
4977
+ {
4978
+ indexed: false,
4979
+ internalType: "address",
4980
+ name: "account",
4981
+ type: "address"
4982
+ }
4983
+ ],
4984
+ name: "Unpaused",
4985
+ type: "event"
4986
+ },
4987
+ {
4988
+ inputs: [],
4989
+ name: "L1_CHAIN_ID",
4990
+ outputs: [
4991
+ {
4992
+ internalType: "uint256",
4993
+ name: "",
4994
+ type: "uint256"
4995
+ }
4996
+ ],
4997
+ stateMutability: "view",
4998
+ type: "function"
4999
+ },
5000
+ {
5001
+ inputs: [],
5002
+ name: "acceptOwnership",
5003
+ outputs: [],
5004
+ stateMutability: "nonpayable",
5005
+ type: "function"
5006
+ },
5007
+ {
5008
+ inputs: [
5009
+ {
5010
+ internalType: "uint256",
5011
+ name: "_chainId",
5012
+ type: "uint256"
5013
+ },
5014
+ {
5015
+ internalType: "bytes32",
5016
+ name: "_canonicalTxHash",
5017
+ type: "bytes32"
5018
+ },
5019
+ {
5020
+ internalType: "uint64",
5021
+ name: "_expirationTimestamp",
5022
+ type: "uint64"
5023
+ },
5024
+ {
5025
+ components: [
5026
+ {
5027
+ internalType: "bytes1",
5028
+ name: "version",
5029
+ type: "bytes1"
5030
+ },
5031
+ {
5032
+ internalType: "address",
5033
+ name: "originToken",
5034
+ type: "address"
5035
+ },
5036
+ {
5037
+ internalType: "bytes32",
5038
+ name: "baseTokenAssetId",
5039
+ type: "bytes32"
5040
+ },
5041
+ {
5042
+ internalType: "uint256",
5043
+ name: "baseTokenAmount",
5044
+ type: "uint256"
5045
+ },
5046
+ {
5047
+ internalType: "bytes32",
5048
+ name: "assetId",
5049
+ type: "bytes32"
5050
+ },
5051
+ {
5052
+ internalType: "uint256",
5053
+ name: "amount",
5054
+ type: "uint256"
5055
+ },
5056
+ {
5057
+ internalType: "uint256",
5058
+ name: "tokenOriginChainId",
5059
+ type: "uint256"
5060
+ }
5061
+ ],
5062
+ internalType: "struct BalanceChange",
5063
+ name: "_balanceChange",
5064
+ type: "tuple"
5065
+ }
5066
+ ],
5067
+ name: "forwardTransactionOnGatewayWithBalanceChange",
5068
+ outputs: [],
5069
+ stateMutability: "nonpayable",
5070
+ type: "function"
5071
+ },
5072
+ {
5073
+ inputs: [
5074
+ {
5075
+ internalType: "uint256",
5076
+ name: "_l1ChainId",
5077
+ type: "uint256"
5078
+ },
5079
+ {
5080
+ internalType: "address",
5081
+ name: "_owner",
5082
+ type: "address"
5083
+ }
5084
+ ],
5085
+ name: "initL2",
5086
+ outputs: [],
5087
+ stateMutability: "nonpayable",
5088
+ type: "function"
5089
+ },
5090
+ {
5091
+ inputs: [
5092
+ {
5093
+ internalType: "address",
5094
+ name: "sender",
5095
+ type: "address"
5096
+ }
5097
+ ],
5098
+ name: "interopBundleNonce",
5099
+ outputs: [
5100
+ {
5101
+ internalType: "uint256",
5102
+ name: "numberOfBundlesSent",
5103
+ type: "uint256"
5104
+ }
5105
+ ],
5106
+ stateMutability: "view",
5107
+ type: "function"
5108
+ },
5109
+ {
5110
+ inputs: [],
5111
+ name: "owner",
5112
+ outputs: [
5113
+ {
5114
+ internalType: "address",
5115
+ name: "",
5116
+ type: "address"
5117
+ }
5118
+ ],
5119
+ stateMutability: "view",
5120
+ type: "function"
5121
+ },
5122
+ {
5123
+ inputs: [
5124
+ {
5125
+ internalType: "bytes[]",
5126
+ name: "_attributes",
5127
+ type: "bytes[]"
5128
+ },
5129
+ {
5130
+ internalType: "enum IInteropCenter.AttributeParsingRestrictions",
5131
+ name: "_restriction",
5132
+ type: "uint8"
5133
+ }
5134
+ ],
5135
+ name: "parseAttributes",
5136
+ outputs: [
5137
+ {
5138
+ components: [
5139
+ {
5140
+ internalType: "uint256",
5141
+ name: "interopCallValue",
5142
+ type: "uint256"
5143
+ },
5144
+ {
5145
+ internalType: "bool",
5146
+ name: "indirectCall",
5147
+ type: "bool"
5148
+ },
5149
+ {
5150
+ internalType: "uint256",
5151
+ name: "indirectCallMessageValue",
5152
+ type: "uint256"
5153
+ }
5154
+ ],
5155
+ internalType: "struct CallAttributes",
5156
+ name: "callAttributes",
5157
+ type: "tuple"
5158
+ },
5159
+ {
5160
+ components: [
5161
+ {
5162
+ internalType: "bytes",
5163
+ name: "executionAddress",
5164
+ type: "bytes"
5165
+ },
5166
+ {
5167
+ internalType: "bytes",
5168
+ name: "unbundlerAddress",
5169
+ type: "bytes"
5170
+ }
5171
+ ],
5172
+ internalType: "struct BundleAttributes",
5173
+ name: "bundleAttributes",
5174
+ type: "tuple"
5175
+ }
5176
+ ],
5177
+ stateMutability: "pure",
5178
+ type: "function"
5179
+ },
5180
+ {
5181
+ inputs: [],
5182
+ name: "pause",
5183
+ outputs: [],
5184
+ stateMutability: "nonpayable",
5185
+ type: "function"
5186
+ },
5187
+ {
5188
+ inputs: [],
5189
+ name: "paused",
5190
+ outputs: [
5191
+ {
5192
+ internalType: "bool",
5193
+ name: "",
5194
+ type: "bool"
5195
+ }
5196
+ ],
5197
+ stateMutability: "view",
5198
+ type: "function"
5199
+ },
5200
+ {
5201
+ inputs: [],
5202
+ name: "pendingOwner",
5203
+ outputs: [
5204
+ {
5205
+ internalType: "address",
5206
+ name: "",
5207
+ type: "address"
5208
+ }
5209
+ ],
5210
+ stateMutability: "view",
5211
+ type: "function"
5212
+ },
5213
+ {
5214
+ inputs: [],
5215
+ name: "renounceOwnership",
5216
+ outputs: [],
5217
+ stateMutability: "nonpayable",
5218
+ type: "function"
5219
+ },
5220
+ {
5221
+ inputs: [
5222
+ {
5223
+ internalType: "bytes",
5224
+ name: "_destinationChainId",
5225
+ type: "bytes"
5226
+ },
5227
+ {
5228
+ components: [
5229
+ {
5230
+ internalType: "bytes",
5231
+ name: "to",
5232
+ type: "bytes"
5233
+ },
5234
+ {
5235
+ internalType: "bytes",
5236
+ name: "data",
5237
+ type: "bytes"
5238
+ },
5239
+ {
5240
+ internalType: "bytes[]",
5241
+ name: "callAttributes",
5242
+ type: "bytes[]"
5243
+ }
5244
+ ],
5245
+ internalType: "struct InteropCallStarter[]",
5246
+ name: "_callStarters",
5247
+ type: "tuple[]"
5248
+ },
5249
+ {
5250
+ internalType: "bytes[]",
5251
+ name: "_bundleAttributes",
5252
+ type: "bytes[]"
5253
+ }
5254
+ ],
5255
+ name: "sendBundle",
5256
+ outputs: [
5257
+ {
5258
+ internalType: "bytes32",
5259
+ name: "bundleHash",
5260
+ type: "bytes32"
5261
+ }
5262
+ ],
5263
+ stateMutability: "payable",
5264
+ type: "function"
5265
+ },
5266
+ {
5267
+ inputs: [
5268
+ {
5269
+ internalType: "bytes",
5270
+ name: "recipient",
5271
+ type: "bytes"
5272
+ },
5273
+ {
5274
+ internalType: "bytes",
5275
+ name: "payload",
5276
+ type: "bytes"
5277
+ },
5278
+ {
5279
+ internalType: "bytes[]",
5280
+ name: "attributes",
5281
+ type: "bytes[]"
5282
+ }
5283
+ ],
5284
+ name: "sendMessage",
5285
+ outputs: [
5286
+ {
5287
+ internalType: "bytes32",
5288
+ name: "sendId",
5289
+ type: "bytes32"
5290
+ }
5291
+ ],
5292
+ stateMutability: "payable",
5293
+ type: "function"
5294
+ },
5295
+ {
5296
+ inputs: [
5297
+ {
5298
+ internalType: "bytes4",
5299
+ name: "_attributeSelector",
5300
+ type: "bytes4"
5301
+ }
5302
+ ],
5303
+ name: "supportsAttribute",
5304
+ outputs: [
5305
+ {
5306
+ internalType: "bool",
5307
+ name: "",
5308
+ type: "bool"
5309
+ }
5310
+ ],
5311
+ stateMutability: "pure",
5312
+ type: "function"
5313
+ },
5314
+ {
5315
+ inputs: [
5316
+ {
5317
+ internalType: "address",
5318
+ name: "newOwner",
5319
+ type: "address"
5320
+ }
5321
+ ],
5322
+ name: "transferOwnership",
5323
+ outputs: [],
5324
+ stateMutability: "nonpayable",
5325
+ type: "function"
5326
+ },
5327
+ {
5328
+ inputs: [],
5329
+ name: "unpause",
5330
+ outputs: [],
5331
+ stateMutability: "nonpayable",
5332
+ type: "function"
5333
+ }
5334
+ ];
5335
+ var InteropCenter_default = InteropCenterABI;
5336
+
5337
+ // src/core/internal/abis/IInteropHandler.ts
5338
+ var IInteropHandlerABI = [
5339
+ {
5340
+ anonymous: false,
5341
+ inputs: [
5342
+ {
5343
+ indexed: true,
5344
+ internalType: "bytes32",
5345
+ name: "bundleHash",
5346
+ type: "bytes32"
5347
+ }
5348
+ ],
5349
+ name: "BundleExecuted",
5350
+ type: "event"
5351
+ },
5352
+ {
5353
+ anonymous: false,
5354
+ inputs: [
5355
+ {
5356
+ indexed: true,
5357
+ internalType: "bytes32",
5358
+ name: "bundleHash",
5359
+ type: "bytes32"
5360
+ }
5361
+ ],
5362
+ name: "BundleUnbundled",
5363
+ type: "event"
5364
+ },
5365
+ {
5366
+ anonymous: false,
5367
+ inputs: [
5368
+ {
5369
+ indexed: true,
5370
+ internalType: "bytes32",
5371
+ name: "bundleHash",
5372
+ type: "bytes32"
5373
+ }
5374
+ ],
5375
+ name: "BundleVerified",
5376
+ type: "event"
5377
+ },
5378
+ {
5379
+ anonymous: false,
5380
+ inputs: [
5381
+ {
5382
+ indexed: true,
5383
+ internalType: "bytes32",
5384
+ name: "bundleHash",
5385
+ type: "bytes32"
5386
+ },
5387
+ {
5388
+ indexed: true,
5389
+ internalType: "uint256",
5390
+ name: "callIndex",
5391
+ type: "uint256"
5392
+ },
5393
+ {
5394
+ indexed: false,
5395
+ internalType: "enum CallStatus",
5396
+ name: "status",
5397
+ type: "uint8"
5398
+ }
5399
+ ],
5400
+ name: "CallProcessed",
5401
+ type: "event"
5402
+ },
5403
+ {
5404
+ inputs: [
5405
+ {
5406
+ internalType: "bytes",
5407
+ name: "_bundle",
5408
+ type: "bytes"
5409
+ },
5410
+ {
5411
+ components: [
5412
+ {
5413
+ internalType: "uint256",
5414
+ name: "chainId",
5415
+ type: "uint256"
5416
+ },
5417
+ {
5418
+ internalType: "uint256",
5419
+ name: "l1BatchNumber",
5420
+ type: "uint256"
5421
+ },
5422
+ {
5423
+ internalType: "uint256",
5424
+ name: "l2MessageIndex",
5425
+ type: "uint256"
5426
+ },
5427
+ {
5428
+ components: [
5429
+ {
5430
+ internalType: "uint16",
5431
+ name: "txNumberInBatch",
5432
+ type: "uint16"
5433
+ },
5434
+ {
5435
+ internalType: "address",
5436
+ name: "sender",
5437
+ type: "address"
5438
+ },
5439
+ {
5440
+ internalType: "bytes",
5441
+ name: "data",
5442
+ type: "bytes"
5443
+ }
5444
+ ],
5445
+ internalType: "struct L2Message",
5446
+ name: "message",
5447
+ type: "tuple"
5448
+ },
5449
+ {
5450
+ internalType: "bytes32[]",
5451
+ name: "proof",
5452
+ type: "bytes32[]"
5453
+ }
5454
+ ],
5455
+ internalType: "struct MessageInclusionProof",
5456
+ name: "_proof",
5457
+ type: "tuple"
5458
+ }
5459
+ ],
5460
+ name: "executeBundle",
5461
+ outputs: [],
5462
+ stateMutability: "nonpayable",
5463
+ type: "function"
5464
+ },
5465
+ {
5466
+ inputs: [
5467
+ {
5468
+ internalType: "uint256",
5469
+ name: "_sourceChainId",
5470
+ type: "uint256"
5471
+ },
5472
+ {
5473
+ internalType: "bytes",
5474
+ name: "_bundle",
5475
+ type: "bytes"
5476
+ },
5477
+ {
5478
+ internalType: "enum CallStatus[]",
5479
+ name: "_callStatus",
5480
+ type: "uint8[]"
5481
+ }
5482
+ ],
5483
+ name: "unbundleBundle",
5484
+ outputs: [],
5485
+ stateMutability: "nonpayable",
5486
+ type: "function"
5487
+ },
5488
+ {
5489
+ inputs: [
5490
+ {
5491
+ internalType: "bytes",
5492
+ name: "_bundle",
5493
+ type: "bytes"
5494
+ },
5495
+ {
5496
+ components: [
5497
+ {
5498
+ internalType: "uint256",
5499
+ name: "chainId",
5500
+ type: "uint256"
5501
+ },
5502
+ {
5503
+ internalType: "uint256",
5504
+ name: "l1BatchNumber",
5505
+ type: "uint256"
5506
+ },
5507
+ {
5508
+ internalType: "uint256",
5509
+ name: "l2MessageIndex",
5510
+ type: "uint256"
5511
+ },
5512
+ {
5513
+ components: [
5514
+ {
5515
+ internalType: "uint16",
5516
+ name: "txNumberInBatch",
5517
+ type: "uint16"
5518
+ },
5519
+ {
5520
+ internalType: "address",
5521
+ name: "sender",
5522
+ type: "address"
5523
+ },
5524
+ {
5525
+ internalType: "bytes",
5526
+ name: "data",
5527
+ type: "bytes"
5528
+ }
5529
+ ],
5530
+ internalType: "struct L2Message",
5531
+ name: "message",
5532
+ type: "tuple"
5533
+ },
5534
+ {
5535
+ internalType: "bytes32[]",
5536
+ name: "proof",
5537
+ type: "bytes32[]"
5538
+ }
5539
+ ],
5540
+ internalType: "struct MessageInclusionProof",
5541
+ name: "_proof",
5542
+ type: "tuple"
5543
+ }
5544
+ ],
5545
+ name: "verifyBundle",
5546
+ outputs: [],
5547
+ stateMutability: "nonpayable",
5548
+ type: "function"
5549
+ }
5550
+ ];
5551
+ var IInteropHandler_default = IInteropHandlerABI;
5552
+
5553
+ // src/core/internal/abis/InteropRootStorage.ts
5554
+ var InteropRootStorageABI = [
5555
+ {
5556
+ inputs: [
5557
+ {
5558
+ internalType: "uint256",
5559
+ name: "chainId",
5560
+ type: "uint256"
5561
+ },
5562
+ {
5563
+ internalType: "uint256",
5564
+ name: "batchNumber",
5565
+ type: "uint256"
5566
+ }
5567
+ ],
5568
+ name: "interopRoots",
5569
+ outputs: [
5570
+ {
5571
+ internalType: "bytes32",
5572
+ name: "",
5573
+ type: "bytes32"
5574
+ }
5575
+ ],
5576
+ stateMutability: "view",
5577
+ type: "function"
5578
+ }
5579
+ ];
5580
+ var InteropRootStorage_default = InteropRootStorageABI;
5581
+
5582
+ // src/core/internal/abis/L2MessageVerification.ts
5583
+ var L2MessageVerificationABI = [
5584
+ {
5585
+ inputs: [],
5586
+ name: "DepthMoreThanOneForRecursiveMerkleProof",
5587
+ type: "error"
5588
+ },
5589
+ {
5590
+ inputs: [],
5591
+ name: "HashedLogIsDefault",
5592
+ type: "error"
5593
+ },
5594
+ {
5595
+ inputs: [],
5596
+ name: "InvalidProofLengthForFinalNode",
5597
+ type: "error"
5598
+ },
5599
+ {
5600
+ inputs: [],
5601
+ name: "MerkleIndexOutOfBounds",
5602
+ type: "error"
5603
+ },
5604
+ {
5605
+ inputs: [],
5606
+ name: "MerklePathEmpty",
5607
+ type: "error"
5608
+ },
5609
+ {
5610
+ inputs: [],
5611
+ name: "MerklePathOutOfBounds",
5612
+ type: "error"
5613
+ },
5614
+ {
5615
+ inputs: [
5616
+ {
5617
+ internalType: "uint256",
5618
+ name: "metadataVersion",
5619
+ type: "uint256"
5620
+ }
5621
+ ],
5622
+ name: "UnsupportedProofMetadataVersion",
5623
+ type: "error"
5624
+ },
5625
+ {
5626
+ inputs: [
5627
+ {
5628
+ components: [
5629
+ {
5630
+ internalType: "uint256",
5631
+ name: "chainId",
5632
+ type: "uint256"
5633
+ },
5634
+ {
5635
+ internalType: "uint256",
5636
+ name: "l2BatchNumber",
5637
+ type: "uint256"
5638
+ },
5639
+ {
5640
+ internalType: "uint256",
5641
+ name: "l2MessageIndex",
5642
+ type: "uint256"
5643
+ },
5644
+ {
5645
+ internalType: "address",
5646
+ name: "l2Sender",
5647
+ type: "address"
5648
+ },
5649
+ {
5650
+ internalType: "uint16",
5651
+ name: "l2TxNumberInBatch",
5652
+ type: "uint16"
5653
+ },
5654
+ {
5655
+ internalType: "bytes",
5656
+ name: "message",
5657
+ type: "bytes"
5658
+ },
5659
+ {
5660
+ internalType: "bytes32[]",
5661
+ name: "merkleProof",
5662
+ type: "bytes32[]"
5663
+ }
5664
+ ],
5665
+ internalType: "struct FinalizeL1DepositParams",
5666
+ name: "_finalizeWithdrawalParams",
5667
+ type: "tuple"
5668
+ }
5669
+ ],
5670
+ name: "proveL1DepositParamsInclusion",
5671
+ outputs: [
5672
+ {
5673
+ internalType: "bool",
5674
+ name: "success",
5675
+ type: "bool"
5676
+ }
5677
+ ],
5678
+ stateMutability: "view",
5679
+ type: "function"
5680
+ },
5681
+ {
5682
+ inputs: [
5683
+ {
5684
+ internalType: "uint256",
5685
+ name: "_chainId",
5686
+ type: "uint256"
5687
+ },
5688
+ {
5689
+ internalType: "bytes32",
5690
+ name: "_l2TxHash",
5691
+ type: "bytes32"
5692
+ },
5693
+ {
5694
+ internalType: "uint256",
5695
+ name: "_l2BatchNumber",
5696
+ type: "uint256"
5697
+ },
5698
+ {
5699
+ internalType: "uint256",
5700
+ name: "_l2MessageIndex",
5701
+ type: "uint256"
5702
+ },
5703
+ {
5704
+ internalType: "uint16",
5705
+ name: "_l2TxNumberInBatch",
5706
+ type: "uint16"
5707
+ },
5708
+ {
5709
+ internalType: "bytes32[]",
5710
+ name: "_merkleProof",
5711
+ type: "bytes32[]"
5712
+ },
5713
+ {
5714
+ internalType: "enum TxStatus",
5715
+ name: "_status",
5716
+ type: "uint8"
5717
+ }
5718
+ ],
5719
+ name: "proveL1ToL2TransactionStatusShared",
5720
+ outputs: [
5721
+ {
5722
+ internalType: "bool",
5723
+ name: "",
5724
+ type: "bool"
5725
+ }
5726
+ ],
5727
+ stateMutability: "view",
5728
+ type: "function"
5729
+ },
5730
+ {
5731
+ inputs: [
5732
+ {
5733
+ internalType: "uint256",
5734
+ name: "_chainId",
5735
+ type: "uint256"
5736
+ },
5737
+ {
5738
+ internalType: "uint256",
5739
+ name: "_blockOrBatchNumber",
5740
+ type: "uint256"
5741
+ },
5742
+ {
5743
+ internalType: "uint256",
5744
+ name: "_leafProofMask",
5745
+ type: "uint256"
5746
+ },
5747
+ {
5748
+ internalType: "bytes32",
5749
+ name: "_leaf",
5750
+ type: "bytes32"
5751
+ },
5752
+ {
5753
+ internalType: "bytes32[]",
5754
+ name: "_proof",
5755
+ type: "bytes32[]"
5756
+ }
5757
+ ],
5758
+ name: "proveL2LeafInclusionShared",
5759
+ outputs: [
5760
+ {
5761
+ internalType: "bool",
5762
+ name: "",
5763
+ type: "bool"
5764
+ }
5765
+ ],
5766
+ stateMutability: "view",
5767
+ type: "function"
5768
+ },
5769
+ {
5770
+ inputs: [
5771
+ {
5772
+ internalType: "uint256",
5773
+ name: "_chainId",
5774
+ type: "uint256"
5775
+ },
5776
+ {
5777
+ internalType: "uint256",
5778
+ name: "_blockOrBatchNumber",
5779
+ type: "uint256"
5780
+ },
5781
+ {
5782
+ internalType: "uint256",
5783
+ name: "_leafProofMask",
5784
+ type: "uint256"
5785
+ },
5786
+ {
5787
+ internalType: "bytes32",
5788
+ name: "_leaf",
5789
+ type: "bytes32"
5790
+ },
5791
+ {
5792
+ internalType: "bytes32[]",
5793
+ name: "_proof",
5794
+ type: "bytes32[]"
5795
+ },
5796
+ {
5797
+ internalType: "uint256",
5798
+ name: "_depth",
5799
+ type: "uint256"
5800
+ }
5801
+ ],
5802
+ name: "proveL2LeafInclusionSharedRecursive",
5803
+ outputs: [
5804
+ {
5805
+ internalType: "bool",
5806
+ name: "",
5807
+ type: "bool"
5808
+ }
5809
+ ],
5810
+ stateMutability: "view",
5811
+ type: "function"
5812
+ },
5813
+ {
5814
+ inputs: [
5815
+ {
5816
+ internalType: "uint256",
5817
+ name: "_chainId",
5818
+ type: "uint256"
5819
+ },
5820
+ {
5821
+ internalType: "uint256",
5822
+ name: "_blockOrBatchNumber",
5823
+ type: "uint256"
5824
+ },
5825
+ {
5826
+ internalType: "uint256",
5827
+ name: "_index",
5828
+ type: "uint256"
5829
+ },
5830
+ {
5831
+ components: [
5832
+ {
5833
+ internalType: "uint8",
5834
+ name: "l2ShardId",
5835
+ type: "uint8"
5836
+ },
5837
+ {
5838
+ internalType: "bool",
5839
+ name: "isService",
5840
+ type: "bool"
5841
+ },
5842
+ {
5843
+ internalType: "uint16",
5844
+ name: "txNumberInBatch",
5845
+ type: "uint16"
5846
+ },
5847
+ {
5848
+ internalType: "address",
5849
+ name: "sender",
5850
+ type: "address"
5851
+ },
5852
+ {
5853
+ internalType: "bytes32",
5854
+ name: "key",
5855
+ type: "bytes32"
5856
+ },
5857
+ {
5858
+ internalType: "bytes32",
5859
+ name: "value",
5860
+ type: "bytes32"
5861
+ }
5862
+ ],
5863
+ internalType: "struct L2Log",
5864
+ name: "_log",
5865
+ type: "tuple"
5866
+ },
5867
+ {
5868
+ internalType: "bytes32[]",
5869
+ name: "_proof",
5870
+ type: "bytes32[]"
5871
+ }
5872
+ ],
5873
+ name: "proveL2LogInclusionShared",
5874
+ outputs: [
5875
+ {
5876
+ internalType: "bool",
5877
+ name: "",
5878
+ type: "bool"
5879
+ }
5880
+ ],
5881
+ stateMutability: "view",
5882
+ type: "function"
4438
5883
  },
4439
5884
  {
4440
- type: "event",
4441
- name: "NewRelayedPriorityTransaction",
4442
5885
  inputs: [
4443
- { name: "txId", type: "uint256", indexed: false, internalType: "uint256" },
4444
- { name: "txHash", type: "bytes32", indexed: false, internalType: "bytes32" },
4445
5886
  {
4446
- name: "expirationTimestamp",
4447
- type: "uint64",
4448
- indexed: false,
4449
- internalType: "uint64"
5887
+ internalType: "uint256",
5888
+ name: "_chainId",
5889
+ type: "uint256"
5890
+ },
5891
+ {
5892
+ internalType: "uint256",
5893
+ name: "_blockOrBatchNumber",
5894
+ type: "uint256"
5895
+ },
5896
+ {
5897
+ internalType: "uint256",
5898
+ name: "_index",
5899
+ type: "uint256"
5900
+ },
5901
+ {
5902
+ components: [
5903
+ {
5904
+ internalType: "uint16",
5905
+ name: "txNumberInBatch",
5906
+ type: "uint16"
5907
+ },
5908
+ {
5909
+ internalType: "address",
5910
+ name: "sender",
5911
+ type: "address"
5912
+ },
5913
+ {
5914
+ internalType: "bytes",
5915
+ name: "data",
5916
+ type: "bytes"
5917
+ }
5918
+ ],
5919
+ internalType: "struct L2Message",
5920
+ name: "_message",
5921
+ type: "tuple"
5922
+ },
5923
+ {
5924
+ internalType: "bytes32[]",
5925
+ name: "_proof",
5926
+ type: "bytes32[]"
4450
5927
  }
4451
5928
  ],
4452
- anonymous: false
4453
- },
4454
- { type: "error", name: "BaseTokenGasPriceDenominatorNotSet", inputs: [] },
4455
- {
4456
- type: "error",
4457
- name: "BatchNotExecuted",
4458
- inputs: [{ name: "batchNumber", type: "uint256", internalType: "uint256" }]
4459
- },
4460
- { type: "error", name: "GasPerPubdataMismatch", inputs: [] },
4461
- { type: "error", name: "HashedLogIsDefault", inputs: [] },
4462
- { type: "error", name: "InvalidChainId", inputs: [] },
4463
- { type: "error", name: "InvalidProofLengthForFinalNode", inputs: [] },
4464
- {
4465
- type: "error",
4466
- name: "LengthIsNotDivisibleBy32",
4467
- inputs: [{ name: "length", type: "uint256", internalType: "uint256" }]
4468
- },
4469
- { type: "error", name: "LocalRootIsZero", inputs: [] },
4470
- { type: "error", name: "LocalRootMustBeZero", inputs: [] },
4471
- {
4472
- type: "error",
4473
- name: "MalformedBytecode",
4474
- inputs: [{ name: "", type: "uint8", internalType: "enum BytecodeError" }]
4475
- },
4476
- { type: "error", name: "MerkleIndexOutOfBounds", inputs: [] },
4477
- { type: "error", name: "MerklePathEmpty", inputs: [] },
4478
- { type: "error", name: "MerklePathOutOfBounds", inputs: [] },
4479
- {
4480
- type: "error",
4481
- name: "MsgValueTooLow",
4482
- inputs: [
4483
- { name: "required", type: "uint256", internalType: "uint256" },
4484
- { name: "provided", type: "uint256", internalType: "uint256" }
4485
- ]
4486
- },
4487
- { type: "error", name: "NotHyperchain", inputs: [] },
4488
- { type: "error", name: "NotInitializedReentrancyGuard", inputs: [] },
4489
- {
4490
- type: "error",
4491
- name: "NotL1",
4492
- inputs: [{ name: "blockChainId", type: "uint256", internalType: "uint256" }]
4493
- },
4494
- { type: "error", name: "NotSettlementLayer", inputs: [] },
4495
- { type: "error", name: "OnlyEraSupported", inputs: [] },
4496
- {
4497
- type: "error",
4498
- name: "PubdataGreaterThanLimit",
4499
- inputs: [
4500
- { name: "limit", type: "uint256", internalType: "uint256" },
4501
- { name: "length", type: "uint256", internalType: "uint256" }
4502
- ]
4503
- },
4504
- { type: "error", name: "Reentrancy", inputs: [] },
4505
- { type: "error", name: "TooManyFactoryDeps", inputs: [] },
4506
- { type: "error", name: "TooMuchGas", inputs: [] },
4507
- { type: "error", name: "TransactionNotAllowed", inputs: [] },
4508
- { type: "error", name: "TxnBodyGasLimitNotEnoughGas", inputs: [] },
4509
- {
4510
- type: "error",
4511
- name: "Unauthorized",
4512
- inputs: [{ name: "caller", type: "address", internalType: "address" }]
4513
- },
4514
- {
4515
- type: "error",
4516
- name: "UnsupportedProofMetadataVersion",
4517
- inputs: [{ name: "metadataVersion", type: "uint256", internalType: "uint256" }]
4518
- },
4519
- { type: "error", name: "ValidateTxnNotEnoughGas", inputs: [] },
4520
- { type: "error", name: "ZeroGasPriceL1TxZKSyncOS", inputs: [] }
5929
+ name: "proveL2MessageInclusionShared",
5930
+ outputs: [
5931
+ {
5932
+ internalType: "bool",
5933
+ name: "",
5934
+ type: "bool"
5935
+ }
5936
+ ],
5937
+ stateMutability: "view",
5938
+ type: "function"
5939
+ }
4521
5940
  ];
4522
- var Mailbox_default = MailboxABI;
5941
+ var L2MessageVerification_default = L2MessageVerificationABI;
4523
5942
 
4524
5943
  // src/core/errors/factory.ts
4525
5944
  var factory_exports = {};
@@ -4528,6 +5947,45 @@ __export(factory_exports, {
4528
5947
  shapeCause: () => shapeCause
4529
5948
  });
4530
5949
 
5950
+ // src/core/utils/hash.ts
5951
+ var RegExpHex = /^0x[0-9a-fA-F]*$/;
5952
+ var isHash = (x, length) => {
5953
+ if (!x || typeof x !== "string") return false;
5954
+ return (length === void 0 || x.length === length) && RegExpHex.test(x);
5955
+ };
5956
+ var isHashArray = (x, length) => {
5957
+ if (!Array.isArray(x)) return false;
5958
+ return x.every((item) => isHash(item, length));
5959
+ };
5960
+ var isHash66 = (x) => isHash(x, 66);
5961
+ var isHash66Array = (x) => isHashArray(x, 66);
5962
+
5963
+ // src/core/utils/number.ts
5964
+ var isNumber = (x) => typeof x === "number" && Number.isFinite(x);
5965
+ var isBigint = (x) => typeof x === "bigint";
5966
+
5967
+ // src/core/utils/addr.ts
5968
+ function isAddress(x) {
5969
+ return isHash(x, 42);
5970
+ }
5971
+ function isAddressEq(a, b) {
5972
+ return a.toLowerCase() === b.toLowerCase();
5973
+ }
5974
+ function isETH(token) {
5975
+ return isAddressEq(token, FORMAL_ETH_ADDRESS) || isAddressEq(token, L2_BASE_TOKEN_ADDRESS) || isAddressEq(token, ETH_ADDRESS);
5976
+ }
5977
+ function normalizeAddrEq(a, b) {
5978
+ if (!a || !b) return false;
5979
+ const normalize = (s) => {
5980
+ const hasPrefix = s.slice(0, 2).toLowerCase() === "0x";
5981
+ const body = hasPrefix ? s.slice(2) : s;
5982
+ return `0x${body.toLowerCase()}`;
5983
+ };
5984
+ return normalize(a) === normalize(b);
5985
+ }
5986
+ var hexEq = (a, b) => a.toLowerCase() === b.toLowerCase();
5987
+ var normalizeL1Token = (token) => isAddressEq(token, FORMAL_ETH_ADDRESS) ? ETH_ADDRESS : token;
5988
+
4531
5989
  // src/core/errors/formatter.ts
4532
5990
  function elideMiddle(s, max = 96) {
4533
5991
  if (s.length <= max) return s;
@@ -4538,7 +5996,7 @@ function shortJSON(v, max = 240) {
4538
5996
  try {
4539
5997
  const s = JSON.stringify(
4540
5998
  v,
4541
- (_k, val) => typeof val === "bigint" ? `${val.toString()}n` : val
5999
+ (_k, val) => isBigint(val) ? `${val.toString()}n` : val
4542
6000
  );
4543
6001
  return s.length > max ? elideMiddle(s, max) : s;
4544
6002
  } catch {
@@ -4558,7 +6016,7 @@ function formatContextLine(ctx) {
4558
6016
  if (txHash !== void 0)
4559
6017
  parts.push(`txHash=${typeof txHash === "string" ? txHash : shortJSON(txHash, 96)}`);
4560
6018
  if (nonce !== void 0) {
4561
- const nonceStr = typeof nonce === "string" || typeof nonce === "number" || typeof nonce === "bigint" ? String(nonce) : shortJSON(nonce, 48);
6019
+ const nonceStr = typeof nonce === "string" || isNumber(nonce) || isBigint(nonce) ? String(nonce) : shortJSON(nonce, 48);
4562
6020
  parts.push(`nonce=${nonceStr}`);
4563
6021
  }
4564
6022
  return parts.length ? ` ${kv("Context", parts.join(" \u2022 "))}` : void 0;
@@ -4588,17 +6046,17 @@ function formatCause(c) {
4588
6046
  const head = [];
4589
6047
  if (obj.name !== void 0) {
4590
6048
  const nameVal = obj.name;
4591
- const nameStr = typeof nameVal === "string" || typeof nameVal === "number" || typeof nameVal === "bigint" || typeof nameVal === "boolean" ? String(nameVal) : shortJSON(nameVal, 120);
6049
+ const nameStr = typeof nameVal === "string" || isNumber(nameVal) || isBigint(nameVal) || typeof nameVal === "boolean" ? String(nameVal) : shortJSON(nameVal, 120);
4592
6050
  head.push(`name=${nameStr}`);
4593
6051
  }
4594
6052
  if (obj.code !== void 0) {
4595
6053
  const codeVal = obj.code;
4596
- const codeStr = typeof codeVal === "string" || typeof codeVal === "number" || typeof codeVal === "bigint" || typeof codeVal === "boolean" ? String(codeVal) : shortJSON(codeVal, 120);
6054
+ const codeStr = typeof codeVal === "string" || isNumber(codeVal) || isBigint(codeVal) || typeof codeVal === "boolean" ? String(codeVal) : shortJSON(codeVal, 120);
4597
6055
  head.push(`code=${codeStr}`);
4598
6056
  }
4599
6057
  if (head.length) out.push(` ${kv("Cause", head.join(" "))}`);
4600
6058
  if (obj.message) {
4601
- const messageStr = typeof obj.message === "string" || typeof obj.message === "number" || typeof obj.message === "bigint" || typeof obj.message === "boolean" ? String(obj.message) : shortJSON(obj.message, 600);
6059
+ const messageStr = typeof obj.message === "string" || isNumber(obj.message) || isBigint(obj.message) || typeof obj.message === "boolean" ? String(obj.message) : shortJSON(obj.message, 600);
4602
6060
  out.push(` message=${elideMiddle(messageStr, 600)}`);
4603
6061
  }
4604
6062
  if (obj.data) {
@@ -4674,20 +6132,20 @@ function createError(type, input) {
4674
6132
  return new ZKsyncError({ ...input, type });
4675
6133
  }
4676
6134
  function shapeCause(err) {
4677
- const isRecord = (x) => x !== null && typeof x === "object";
6135
+ const isRecord2 = (x) => x !== null && typeof x === "object";
4678
6136
  let data = void 0;
4679
- if (isRecord(err)) {
6137
+ if (isRecord2(err)) {
4680
6138
  const r2 = err;
4681
6139
  const d = r2.data;
4682
- if (isRecord(d) && "data" in d) {
6140
+ if (isRecord2(d) && "data" in d) {
4683
6141
  data = d.data;
4684
- } else if ("error" in r2 && isRecord(r2.error) && "data" in r2.error) {
6142
+ } else if ("error" in r2 && isRecord2(r2.error) && "data" in r2.error) {
4685
6143
  data = r2.error.data;
4686
6144
  } else if ("data" in r2) {
4687
6145
  data = r2.data;
4688
6146
  }
4689
6147
  }
4690
- const r = isRecord(err) ? err : void 0;
6148
+ const r = isRecord2(err) ? err : void 0;
4691
6149
  const name = r && typeof r.name === "string" ? r.name : void 0;
4692
6150
  const message = r && typeof r.message === "string" ? r.message : r && typeof r.shortMessage === "string" ? r.shortMessage : void 0;
4693
6151
  const code = r && "code" in r ? r.code : void 0;
@@ -4703,6 +6161,7 @@ function shapeCause(err) {
4703
6161
  var zks_exports = {};
4704
6162
  __export(zks_exports, {
4705
6163
  createZksRpc: () => createZksRpc,
6164
+ normalizeBlockMetadata: () => normalizeBlockMetadata,
4706
6165
  normalizeGenesis: () => normalizeGenesis,
4707
6166
  normalizeProof: () => normalizeProof
4708
6167
  });
@@ -4728,6 +6187,8 @@ var METHODS = {
4728
6187
  getBridgehub: "zks_getBridgehubContract",
4729
6188
  getL2ToL1LogProof: "zks_getL2ToL1LogProof",
4730
6189
  getReceipt: "eth_getTransactionReceipt",
6190
+ getBytecodeSupplier: "zks_getBytecodeSupplierContract",
6191
+ getBlockMetadataByNumber: "zks_getBlockMetadataByNumber",
4731
6192
  getGenesis: "zks_getGenesis"
4732
6193
  };
4733
6194
  function toHexArray(arr) {
@@ -4747,7 +6208,7 @@ function normalizeProof(p) {
4747
6208
  context: { keys: Object.keys(raw ?? {}) }
4748
6209
  });
4749
6210
  }
4750
- const toBig = (x) => typeof x === "bigint" ? x : typeof x === "number" ? BigInt(x) : typeof x === "string" ? BigInt(x) : (() => {
6211
+ const toBig = (x) => isBigint(x) ? x : isNumber(x) ? BigInt(x) : typeof x === "string" ? BigInt(x) : (() => {
4751
6212
  throw createError("RPC", {
4752
6213
  resource: "zksrpc",
4753
6214
  operation: "zksrpc.normalizeProof",
@@ -4758,7 +6219,8 @@ function normalizeProof(p) {
4758
6219
  return {
4759
6220
  id: toBig(idRaw),
4760
6221
  batchNumber: toBig(bnRaw),
4761
- proof: toHexArray(raw?.proof)
6222
+ proof: toHexArray(raw?.proof),
6223
+ root: raw.root
4762
6224
  };
4763
6225
  } catch (e) {
4764
6226
  if (isZKsyncError(e)) throw e;
@@ -4780,20 +6242,53 @@ function ensureHex(value, field, context) {
4780
6242
  context: { field, valueType: typeof value, ...context }
4781
6243
  });
4782
6244
  }
4783
- function ensureNumber(value, field) {
4784
- if (typeof value === "number" && Number.isFinite(value)) return value;
4785
- if (typeof value === "bigint") return Number(value);
6245
+ function ensureNumber(value, field, opts) {
6246
+ const operation = opts?.operation ?? "zksrpc.normalizeGenesis";
6247
+ const messagePrefix = opts?.messagePrefix ?? "Malformed genesis response";
6248
+ if (isNumber(value)) return value;
6249
+ if (isBigint(value)) return Number(value);
4786
6250
  if (typeof value === "string" && value.trim() !== "") {
4787
6251
  const parsed = Number(value);
4788
6252
  if (Number.isFinite(parsed)) return parsed;
4789
6253
  }
4790
6254
  throw createError("RPC", {
4791
6255
  resource: "zksrpc",
4792
- operation: "zksrpc.normalizeGenesis",
4793
- message: "Malformed genesis response: expected numeric value.",
6256
+ operation,
6257
+ message: `${messagePrefix}: expected numeric value.`,
6258
+ context: { field, valueType: typeof value }
6259
+ });
6260
+ }
6261
+ function ensureBigInt(value, field, opts) {
6262
+ const operation = opts?.operation ?? "zksrpc.normalizeBlockMetadata";
6263
+ const messagePrefix = opts?.messagePrefix ?? "Malformed block metadata response";
6264
+ if (isBigint(value)) return value;
6265
+ if (isNumber(value)) {
6266
+ if (!Number.isInteger(value)) {
6267
+ throw createError("RPC", {
6268
+ resource: "zksrpc",
6269
+ operation,
6270
+ message: `${messagePrefix}: expected integer value.`,
6271
+ context: { field, valueType: typeof value }
6272
+ });
6273
+ }
6274
+ return BigInt(value);
6275
+ }
6276
+ if (typeof value === "string" && value.trim() !== "") {
6277
+ try {
6278
+ return BigInt(value);
6279
+ } catch {
6280
+ }
6281
+ }
6282
+ throw createError("RPC", {
6283
+ resource: "zksrpc",
6284
+ operation,
6285
+ message: `${messagePrefix}: expected bigint-compatible value.`,
4794
6286
  context: { field, valueType: typeof value }
4795
6287
  });
4796
6288
  }
6289
+ function isRecord(x) {
6290
+ return !!x && typeof x === "object" && !Array.isArray(x);
6291
+ }
4797
6292
  function normalizeContractTuple(tuple, index) {
4798
6293
  if (!Array.isArray(tuple) || tuple.length < 2) {
4799
6294
  throw createError("RPC", {
@@ -4809,7 +6304,7 @@ function normalizeContractTuple(tuple, index) {
4809
6304
  bytecode: ensureHex(bytecodeRaw, "initial_contracts.bytecode", { index })
4810
6305
  };
4811
6306
  }
4812
- function normalizeStorageTuple(tuple, index) {
6307
+ function normalizeRawStorageTuple(tuple, index) {
4813
6308
  if (!Array.isArray(tuple) || tuple.length < 2) {
4814
6309
  throw createError("RPC", {
4815
6310
  resource: "zksrpc",
@@ -4820,10 +6315,53 @@ function normalizeStorageTuple(tuple, index) {
4820
6315
  }
4821
6316
  const [keyRaw, valueRaw] = tuple;
4822
6317
  return {
6318
+ format: "raw",
4823
6319
  key: ensureHex(keyRaw, "additional_storage.key", { index }),
4824
6320
  value: ensureHex(valueRaw, "additional_storage.value", { index })
4825
6321
  };
4826
6322
  }
6323
+ function normalizeAdditionalStorage(value, record) {
6324
+ const effective = value ?? record["additional_storage_raw"];
6325
+ if (Array.isArray(effective)) {
6326
+ return effective.map((entry, index) => {
6327
+ const kv2 = normalizeRawStorageTuple(entry, index);
6328
+ return { format: "raw", key: kv2.key, value: kv2.value };
6329
+ });
6330
+ }
6331
+ if (isRecord(effective)) {
6332
+ const out = [];
6333
+ for (const [addrRaw, slotsRaw] of Object.entries(effective)) {
6334
+ const address = ensureHex(addrRaw, "additional_storage.address", {});
6335
+ if (!isRecord(slotsRaw)) {
6336
+ throw createError("RPC", {
6337
+ resource: "zksrpc",
6338
+ operation: "zksrpc.normalizeGenesis",
6339
+ message: "Malformed genesis response: additional_storage[address] must be an object map.",
6340
+ context: { address, valueType: typeof slotsRaw }
6341
+ });
6342
+ }
6343
+ for (const [slotRaw, valRaw] of Object.entries(slotsRaw)) {
6344
+ out.push({
6345
+ format: "pretty",
6346
+ address,
6347
+ key: ensureHex(slotRaw, "additional_storage.key", { address }),
6348
+ value: ensureHex(valRaw, "additional_storage.value", { address, key: slotRaw })
6349
+ });
6350
+ }
6351
+ }
6352
+ return out;
6353
+ }
6354
+ throw createError("RPC", {
6355
+ resource: "zksrpc",
6356
+ operation: "zksrpc.normalizeGenesis",
6357
+ message: "Malformed genesis response: additional_storage must be an array (raw) or an object map (pretty).",
6358
+ context: {
6359
+ valueType: typeof effective,
6360
+ hasAdditionalStorage: "additional_storage" in record,
6361
+ hasAdditionalStorageRaw: "additional_storage_raw" in record
6362
+ }
6363
+ });
6364
+ }
4827
6365
  function normalizeGenesis(raw) {
4828
6366
  try {
4829
6367
  if (!raw || typeof raw !== "object") {
@@ -4844,21 +6382,12 @@ function normalizeGenesis(raw) {
4844
6382
  context: { valueType: typeof contractsRaw }
4845
6383
  });
4846
6384
  }
4847
- const storageRaw = record["additional_storage"];
4848
- if (!Array.isArray(storageRaw)) {
4849
- throw createError("RPC", {
4850
- resource: "zksrpc",
4851
- operation: "zksrpc.normalizeGenesis",
4852
- message: "Malformed genesis response: additional_storage must be an array.",
4853
- context: { valueType: typeof storageRaw }
4854
- });
4855
- }
4856
6385
  const executionVersion = ensureNumber(record["execution_version"], "execution_version");
4857
6386
  const genesisRoot = ensureHex(record["genesis_root"], "genesis_root", {});
4858
6387
  const initialContracts = contractsRaw.map(
4859
6388
  (entry, index) => normalizeContractTuple(entry, index)
4860
6389
  );
4861
- const additionalStorage = storageRaw.map((entry, index) => normalizeStorageTuple(entry, index));
6390
+ const additionalStorage = normalizeAdditionalStorage(record["additional_storage"], record);
4862
6391
  return {
4863
6392
  initialContracts,
4864
6393
  additionalStorage,
@@ -4876,6 +6405,57 @@ function normalizeGenesis(raw) {
4876
6405
  });
4877
6406
  }
4878
6407
  }
6408
+ function normalizeBlockMetadata(raw) {
6409
+ try {
6410
+ if (!raw || typeof raw !== "object") {
6411
+ throw createError("RPC", {
6412
+ resource: "zksrpc",
6413
+ operation: "zksrpc.normalizeBlockMetadata",
6414
+ message: "Malformed block metadata response: expected object.",
6415
+ context: { receivedType: typeof raw }
6416
+ });
6417
+ }
6418
+ const record = raw;
6419
+ const pubdataPricePerByte = ensureBigInt(
6420
+ record["pubdata_price_per_byte"] ?? record["pubdataPricePerByte"],
6421
+ "pubdata_price_per_byte",
6422
+ {
6423
+ operation: "zksrpc.normalizeBlockMetadata",
6424
+ messagePrefix: "Malformed block metadata response"
6425
+ }
6426
+ );
6427
+ const nativePrice = ensureBigInt(
6428
+ record["native_price"] ?? record["nativePrice"],
6429
+ "native_price",
6430
+ {
6431
+ operation: "zksrpc.normalizeBlockMetadata",
6432
+ messagePrefix: "Malformed block metadata response"
6433
+ }
6434
+ );
6435
+ const executionVersion = ensureNumber(
6436
+ record["execution_version"] ?? record["executionVersion"],
6437
+ "execution_version",
6438
+ {
6439
+ operation: "zksrpc.normalizeBlockMetadata",
6440
+ messagePrefix: "Malformed block metadata response"
6441
+ }
6442
+ );
6443
+ return {
6444
+ pubdataPricePerByte,
6445
+ nativePrice,
6446
+ executionVersion
6447
+ };
6448
+ } catch (e) {
6449
+ if (isZKsyncError(e)) throw e;
6450
+ throw createError("RPC", {
6451
+ resource: "zksrpc",
6452
+ operation: "zksrpc.normalizeBlockMetadata",
6453
+ message: "Failed to normalize block metadata response.",
6454
+ context: { receivedType: typeof raw },
6455
+ cause: shapeCause(e)
6456
+ });
6457
+ }
6458
+ }
4879
6459
  function createZksRpc(transport) {
4880
6460
  return {
4881
6461
  // Fetches the Bridgehub contract address.
@@ -4898,6 +6478,26 @@ function createZksRpc(transport) {
4898
6478
  }
4899
6479
  );
4900
6480
  },
6481
+ // Fetches the Bytecode Supplier contract address.
6482
+ async getBytecodeSupplierAddress() {
6483
+ return withRpcOp(
6484
+ "zksrpc.getBytecodeSupplierAddress",
6485
+ "Failed to fetch Bytecode Supplier address.",
6486
+ {},
6487
+ async () => {
6488
+ const addrRaw = await transport(METHODS.getBytecodeSupplier, []);
6489
+ if (typeof addrRaw !== "string" || !addrRaw.startsWith("0x")) {
6490
+ throw createError("RPC", {
6491
+ resource: "zksrpc",
6492
+ operation: "zksrpc.getBytecodeSupplierAddress",
6493
+ message: "Unexpected Bytecode Supplier address response.",
6494
+ context: { valueType: typeof addrRaw }
6495
+ });
6496
+ }
6497
+ return addrRaw;
6498
+ }
6499
+ );
6500
+ },
4901
6501
  // Fetches a proof for an L2→L1 log emitted in the given transaction.
4902
6502
  async getL2ToL1LogProof(txHash, index) {
4903
6503
  return withRpcOp(
@@ -4934,6 +6534,19 @@ function createZksRpc(transport) {
4934
6534
  }
4935
6535
  );
4936
6536
  },
6537
+ // Fetches block metadata for the given block number.
6538
+ async getBlockMetadataByNumber(blockNumber) {
6539
+ return withRpcOp(
6540
+ "zksrpc.getBlockMetadataByNumber",
6541
+ "Failed to fetch block metadata.",
6542
+ { blockNumber },
6543
+ async () => {
6544
+ const raw = await transport(METHODS.getBlockMetadataByNumber, [blockNumber]);
6545
+ if (raw == null) return null;
6546
+ return normalizeBlockMetadata(raw);
6547
+ }
6548
+ );
6549
+ },
4937
6550
  // Fetches the genesis configuration returned by `zks_getGenesis`.
4938
6551
  async getGenesis() {
4939
6552
  return withRpcOp(
@@ -4957,26 +6570,6 @@ function makeTransportFromViem(client) {
4957
6570
  return (m, p = []) => client.request({ method: m, params: p });
4958
6571
  }
4959
6572
 
4960
- // src/core/utils/addr.ts
4961
- var isHash66 = (x) => !!x && x.startsWith("0x") && x.length === 66;
4962
- function isAddressEq(a, b) {
4963
- return a.toLowerCase() === b.toLowerCase();
4964
- }
4965
- function isETH(token) {
4966
- return isAddressEq(token, FORMAL_ETH_ADDRESS) || isAddressEq(token, L2_BASE_TOKEN_ADDRESS) || isAddressEq(token, ETH_ADDRESS);
4967
- }
4968
- function normalizeAddrEq(a, b) {
4969
- if (!a || !b) return false;
4970
- const normalize = (s) => {
4971
- const hasPrefix = s.slice(0, 2).toLowerCase() === "0x";
4972
- const body = hasPrefix ? s.slice(2) : s;
4973
- return `0x${body.toLowerCase()}`;
4974
- };
4975
- return normalize(a) === normalize(b);
4976
- }
4977
- var hexEq = (a, b) => a.toLowerCase() === b.toLowerCase();
4978
- var normalizeL1Token = (token) => isAddressEq(token, FORMAL_ETH_ADDRESS) ? ETH_ADDRESS : token;
4979
-
4980
6573
  // src/core/resources/deposits/route.ts
4981
6574
  async function pickDepositRoute(client, chainIdL2, token) {
4982
6575
  if (isETH(token)) {
@@ -5000,11 +6593,14 @@ function pickWithdrawRoute(args) {
5000
6593
  return "erc20-nonbase";
5001
6594
  }
5002
6595
 
5003
- // src/core/resources/withdrawals/events.ts
6596
+ // src/core/utils/events.ts
6597
+ function extractPreferAddress(opts) {
6598
+ const preferAddr = typeof opts?.prefer === "object" ? opts.prefer.address : opts?.prefer === "assetRouter" ? L2_ASSET_ROUTER_ADDRESS : L1_MESSENGER_ADDRESS;
6599
+ return (preferAddr || L1_MESSENGER_ADDRESS).toLowerCase();
6600
+ }
5004
6601
  function findL1MessageSentLog(receipt, opts) {
5005
6602
  const index = opts?.index ?? 0;
5006
- const preferAddr = typeof opts?.prefer === "object" ? opts?.prefer.address : opts?.prefer === "assetRouter" ? L2_ASSET_ROUTER_ADDRESS : L1_MESSENGER_ADDRESS;
5007
- const prefer = (preferAddr ?? L1_MESSENGER_ADDRESS).toLowerCase();
6603
+ const preferAddr = extractPreferAddress(opts);
5008
6604
  const matches = receipt.logs.filter((lg) => {
5009
6605
  const t0 = (lg.topics?.[0] ?? "").toLowerCase();
5010
6606
  return t0 === TOPIC_L1_MESSAGE_SENT_NEW || t0 === TOPIC_L1_MESSAGE_SENT_LEG;
@@ -5012,13 +6608,18 @@ function findL1MessageSentLog(receipt, opts) {
5012
6608
  if (!matches.length) {
5013
6609
  throw new Error("No L1MessageSent event found in L2 receipt logs.");
5014
6610
  }
5015
- const preferred = matches.find((lg) => (lg.address ?? "").toLowerCase() === prefer);
6611
+ const preferred = matches.find((lg) => (lg.address ?? "").toLowerCase() === preferAddr);
5016
6612
  const chosen = preferred ?? matches[index] ?? matches[0];
5017
6613
  if (!chosen) {
5018
6614
  throw new Error("No suitable L1MessageSent event found.");
5019
6615
  }
5020
6616
  return chosen;
5021
6617
  }
6618
+ function isL1MessageSentLog(log, opts) {
6619
+ const topic = log.topics[0].toLowerCase();
6620
+ const preferAddr = extractPreferAddress(opts);
6621
+ return log.address.toLowerCase() === preferAddr && (topic === TOPIC_L1_MESSAGE_SENT_LEG.toLowerCase() || topic === TOPIC_L1_MESSAGE_SENT_NEW.toLowerCase());
6622
+ }
5022
6623
 
5023
6624
  // src/core/resources/withdrawals/logs.ts
5024
6625
  function messengerLogIndex(raw, opts) {
@@ -5044,9 +6645,14 @@ exports.errors = factory_exports;
5044
6645
  exports.findL1MessageSentLog = findL1MessageSentLog;
5045
6646
  exports.formatEnvelopePretty = formatEnvelopePretty;
5046
6647
  exports.hexEq = hexEq;
6648
+ exports.isAddress = isAddress;
5047
6649
  exports.isAddressEq = isAddressEq;
5048
6650
  exports.isETH = isETH;
6651
+ exports.isHash = isHash;
5049
6652
  exports.isHash66 = isHash66;
6653
+ exports.isHash66Array = isHash66Array;
6654
+ exports.isHashArray = isHashArray;
6655
+ exports.isL1MessageSentLog = isL1MessageSentLog;
5050
6656
  exports.makeTransportFromEthers = makeTransportFromEthers;
5051
6657
  exports.makeTransportFromViem = makeTransportFromViem;
5052
6658
  exports.messengerLogIndex = messengerLogIndex;