@matterlabs/zksync-js 0.0.11 → 0.0.13

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 (48) hide show
  1. package/README.md +13 -0
  2. package/dist/adapters/ethers/client.cjs +722 -4
  3. package/dist/adapters/ethers/client.cjs.map +1 -1
  4. package/dist/adapters/ethers/client.js +6 -6
  5. package/dist/adapters/ethers/index.cjs +774 -45
  6. package/dist/adapters/ethers/index.cjs.map +1 -1
  7. package/dist/adapters/ethers/index.js +9 -9
  8. package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +4 -4
  9. package/dist/adapters/ethers/sdk.cjs +772 -41
  10. package/dist/adapters/ethers/sdk.cjs.map +1 -1
  11. package/dist/adapters/ethers/sdk.js +7 -7
  12. package/dist/adapters/viem/client.cjs +2 -4
  13. package/dist/adapters/viem/client.cjs.map +1 -1
  14. package/dist/adapters/viem/client.js +6 -6
  15. package/dist/adapters/viem/index.cjs +38 -33
  16. package/dist/adapters/viem/index.cjs.map +1 -1
  17. package/dist/adapters/viem/index.js +9 -9
  18. package/dist/adapters/viem/resources/deposits/services/gas.d.ts +4 -4
  19. package/dist/adapters/viem/sdk.cjs +36 -29
  20. package/dist/adapters/viem/sdk.cjs.map +1 -1
  21. package/dist/adapters/viem/sdk.js +7 -7
  22. package/dist/{chunk-EWBYKU4G.js → chunk-2RIARDXZ.js} +4 -4
  23. package/dist/{chunk-USXSAFYA.js → chunk-4S4XDA4N.js} +4 -6
  24. package/dist/{chunk-H3BPVVMN.js → chunk-53MC5BR2.js} +1 -1
  25. package/dist/{chunk-IQVH7YZT.js → chunk-5L6EYUJB.js} +2 -2
  26. package/dist/{chunk-QUI3J42E.js → chunk-5R7L5NM5.js} +2 -2
  27. package/dist/{chunk-ZVHFVUDE.js → chunk-E3KP7XCG.js} +1 -1
  28. package/dist/{chunk-CCUAGJ6K.js → chunk-EDWBCPO3.js} +40 -33
  29. package/dist/{chunk-6IT5PEEN.js → chunk-HI64OOAR.js} +1 -1
  30. package/dist/{chunk-TL26ZONW.js → chunk-JHO2UQ5F.js} +56 -45
  31. package/dist/{chunk-C3AGOEHR.js → chunk-QQ2OR434.js} +1 -1
  32. package/dist/{chunk-FXSFLZ6D.js → chunk-R5WRFPK2.js} +4 -4
  33. package/dist/{chunk-QFEYV4O3.js → chunk-RI73VJSH.js} +716 -2
  34. package/dist/{chunk-N4PR5SVB.js → chunk-UDBRUBEK.js} +10 -2
  35. package/dist/core/abi.d.ts +2 -0
  36. package/dist/core/constants.cjs +1 -1
  37. package/dist/core/constants.d.ts +1 -1
  38. package/dist/core/constants.js +1 -1
  39. package/dist/core/index.cjs +716 -4
  40. package/dist/core/index.cjs.map +1 -1
  41. package/dist/core/index.js +5 -5
  42. package/dist/core/internal/abis/IInteropErrors.d.ts +197 -0
  43. package/dist/core/internal/abis/IL1ContractErrors.d.ts +1021 -0
  44. package/dist/core/rpc/types.d.ts +1 -1
  45. package/dist/index.cjs +717 -5
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.js +5 -5
  48. package/package.json +1 -1
@@ -37,7 +37,7 @@ var TX_OVERHEAD_GAS = 10000n;
37
37
  var TX_MEMORY_OVERHEAD_GAS = 10n;
38
38
  var DEFAULT_PUBDATA_BYTES = 155n;
39
39
  var DEFAULT_ABI_BYTES = 400n;
40
- var SAFE_L1_BRIDGE_GAS = 700000n;
40
+ var SAFE_L1_BRIDGE_GAS = 800000n;
41
41
 
42
42
  // src/core/utils/number.ts
43
43
  var isNumber = (x) => typeof x === "number" && Number.isFinite(x);
@@ -4701,6 +4701,718 @@ var InteropRootStorageABI = [
4701
4701
  ];
4702
4702
  var IInteropRootStorage_default = InteropRootStorageABI;
4703
4703
 
4704
+ // src/core/internal/abis/IInteropErrors.ts
4705
+ var IInteropErrorsABI = [
4706
+ {
4707
+ type: "error",
4708
+ name: "AttributeAlreadySet",
4709
+ inputs: [
4710
+ {
4711
+ name: "selector",
4712
+ type: "bytes4"
4713
+ }
4714
+ ]
4715
+ },
4716
+ {
4717
+ type: "error",
4718
+ name: "AttributeViolatesRestriction",
4719
+ inputs: [
4720
+ {
4721
+ name: "selector",
4722
+ type: "bytes4"
4723
+ },
4724
+ {
4725
+ name: "restriction",
4726
+ type: "uint256"
4727
+ }
4728
+ ]
4729
+ },
4730
+ {
4731
+ type: "error",
4732
+ name: "BundleAlreadyProcessed",
4733
+ inputs: [
4734
+ {
4735
+ name: "bundleHash",
4736
+ type: "bytes32"
4737
+ }
4738
+ ]
4739
+ },
4740
+ {
4741
+ type: "error",
4742
+ name: "CallAlreadyExecuted",
4743
+ inputs: [
4744
+ {
4745
+ name: "bundleHash",
4746
+ type: "bytes32"
4747
+ },
4748
+ {
4749
+ name: "callIndex",
4750
+ type: "uint256"
4751
+ }
4752
+ ]
4753
+ },
4754
+ {
4755
+ type: "error",
4756
+ name: "CallNotExecutable",
4757
+ inputs: [
4758
+ {
4759
+ name: "bundleHash",
4760
+ type: "bytes32"
4761
+ },
4762
+ {
4763
+ name: "callIndex",
4764
+ type: "uint256"
4765
+ }
4766
+ ]
4767
+ },
4768
+ {
4769
+ type: "error",
4770
+ name: "CanNotUnbundle",
4771
+ inputs: [
4772
+ {
4773
+ name: "bundleHash",
4774
+ type: "bytes32"
4775
+ }
4776
+ ]
4777
+ },
4778
+ {
4779
+ type: "error",
4780
+ name: "DestinationChainNotRegistered",
4781
+ inputs: [
4782
+ {
4783
+ name: "destinationChainId",
4784
+ type: "uint256"
4785
+ }
4786
+ ]
4787
+ },
4788
+ {
4789
+ type: "error",
4790
+ name: "ExecutingNotAllowed",
4791
+ inputs: [
4792
+ {
4793
+ name: "bundleHash",
4794
+ type: "bytes32"
4795
+ },
4796
+ {
4797
+ name: "callerAddress",
4798
+ type: "bytes"
4799
+ },
4800
+ {
4801
+ name: "executionAddress",
4802
+ type: "bytes"
4803
+ }
4804
+ ]
4805
+ },
4806
+ {
4807
+ type: "error",
4808
+ name: "FeeWithdrawalFailed",
4809
+ inputs: []
4810
+ },
4811
+ {
4812
+ type: "error",
4813
+ name: "IndirectCallValueMismatch",
4814
+ inputs: [
4815
+ {
4816
+ name: "expected",
4817
+ type: "uint256"
4818
+ },
4819
+ {
4820
+ name: "actual",
4821
+ type: "uint256"
4822
+ }
4823
+ ]
4824
+ },
4825
+ {
4826
+ type: "error",
4827
+ name: "InteroperableAddressChainReferenceNotEmpty",
4828
+ inputs: [
4829
+ {
4830
+ name: "interoperableAddress",
4831
+ type: "bytes"
4832
+ }
4833
+ ]
4834
+ },
4835
+ {
4836
+ type: "error",
4837
+ name: "InteroperableAddressNotEmpty",
4838
+ inputs: [
4839
+ {
4840
+ name: "interoperableAddress",
4841
+ type: "bytes"
4842
+ }
4843
+ ]
4844
+ },
4845
+ {
4846
+ type: "error",
4847
+ name: "InvalidInteropBundleVersion",
4848
+ inputs: []
4849
+ },
4850
+ {
4851
+ type: "error",
4852
+ name: "InvalidInteropCallVersion",
4853
+ inputs: []
4854
+ },
4855
+ {
4856
+ type: "error",
4857
+ name: "InteropRootAlreadyExists",
4858
+ inputs: []
4859
+ },
4860
+ {
4861
+ type: "error",
4862
+ name: "MessageNotIncluded",
4863
+ inputs: []
4864
+ },
4865
+ {
4866
+ type: "error",
4867
+ name: "SidesLengthNotOne",
4868
+ inputs: []
4869
+ },
4870
+ {
4871
+ type: "error",
4872
+ name: "UnauthorizedMessageSender",
4873
+ inputs: [
4874
+ {
4875
+ name: "expected",
4876
+ type: "address"
4877
+ },
4878
+ {
4879
+ name: "actual",
4880
+ type: "address"
4881
+ }
4882
+ ]
4883
+ },
4884
+ {
4885
+ type: "error",
4886
+ name: "UnbundlingNotAllowed",
4887
+ inputs: [
4888
+ {
4889
+ name: "bundleHash",
4890
+ type: "bytes32"
4891
+ },
4892
+ {
4893
+ name: "callerAddress",
4894
+ type: "bytes"
4895
+ },
4896
+ {
4897
+ name: "unbundlerAddress",
4898
+ type: "bytes"
4899
+ }
4900
+ ]
4901
+ },
4902
+ {
4903
+ type: "error",
4904
+ name: "WrongCallStatusLength",
4905
+ inputs: [
4906
+ {
4907
+ name: "bundleCallsLength",
4908
+ type: "uint256"
4909
+ },
4910
+ {
4911
+ name: "providedCallStatusLength",
4912
+ type: "uint256"
4913
+ }
4914
+ ]
4915
+ },
4916
+ {
4917
+ type: "error",
4918
+ name: "WrongDestinationChainId",
4919
+ inputs: [
4920
+ {
4921
+ name: "bundleHash",
4922
+ type: "bytes32"
4923
+ },
4924
+ {
4925
+ name: "expected",
4926
+ type: "uint256"
4927
+ },
4928
+ {
4929
+ name: "actual",
4930
+ type: "uint256"
4931
+ }
4932
+ ]
4933
+ },
4934
+ {
4935
+ type: "error",
4936
+ name: "WrongDestinationBaseTokenAssetId",
4937
+ inputs: [
4938
+ {
4939
+ name: "bundleHash",
4940
+ type: "bytes32"
4941
+ },
4942
+ {
4943
+ name: "expected",
4944
+ type: "bytes32"
4945
+ },
4946
+ {
4947
+ name: "actual",
4948
+ type: "bytes32"
4949
+ }
4950
+ ]
4951
+ },
4952
+ {
4953
+ type: "error",
4954
+ name: "WrongSourceChainId",
4955
+ inputs: [
4956
+ {
4957
+ name: "bundleHash",
4958
+ type: "bytes32"
4959
+ },
4960
+ {
4961
+ name: "expected",
4962
+ type: "uint256"
4963
+ },
4964
+ {
4965
+ name: "actual",
4966
+ type: "uint256"
4967
+ }
4968
+ ]
4969
+ },
4970
+ {
4971
+ type: "error",
4972
+ name: "ZKTokenNotAvailable",
4973
+ inputs: []
4974
+ }
4975
+ ];
4976
+ var IInteropErrors_default = IInteropErrorsABI;
4977
+
4978
+ // src/core/internal/abis/IL1ContractErrors.ts
4979
+ var IL1ContractErrorsABI = [
4980
+ {
4981
+ type: "error",
4982
+ name: "AccessToFallbackDenied",
4983
+ inputs: [
4984
+ { name: "target", type: "address" },
4985
+ { name: "invoker", type: "address" }
4986
+ ]
4987
+ },
4988
+ {
4989
+ type: "error",
4990
+ name: "AccessToFunctionDenied",
4991
+ inputs: [
4992
+ { name: "target", type: "address" },
4993
+ { name: "selector", type: "bytes4" },
4994
+ { name: "invoker", type: "address" }
4995
+ ]
4996
+ },
4997
+ { type: "error", name: "AddressAlreadySet", inputs: [{ name: "addr", type: "address" }] },
4998
+ { type: "error", name: "AddressHasNoCode", inputs: [{ name: "", type: "address" }] },
4999
+ {
5000
+ type: "error",
5001
+ name: "AddressMismatch",
5002
+ inputs: [
5003
+ { name: "expected", type: "address" },
5004
+ { name: "supplied", type: "address" }
5005
+ ]
5006
+ },
5007
+ { type: "error", name: "AlreadyPermanentRollup", inputs: [] },
5008
+ { type: "error", name: "AlreadyWhitelisted", inputs: [{ name: "", type: "address" }] },
5009
+ { type: "error", name: "AmountMustBeGreaterThanZero", inputs: [] },
5010
+ {
5011
+ type: "error",
5012
+ name: "AssetHandlerDoesNotExist",
5013
+ inputs: [{ name: "assetId", type: "bytes32" }]
5014
+ },
5015
+ {
5016
+ type: "error",
5017
+ name: "AssetHandlerNotRegistered",
5018
+ inputs: [{ name: "assetId", type: "bytes32" }]
5019
+ },
5020
+ { type: "error", name: "AssetIdAlreadyRegistered", inputs: [] },
5021
+ {
5022
+ type: "error",
5023
+ name: "AssetIdMismatch",
5024
+ inputs: [
5025
+ { name: "expected", type: "bytes32" },
5026
+ { name: "supplied", type: "bytes32" }
5027
+ ]
5028
+ },
5029
+ { type: "error", name: "AssetIdNotSupported", inputs: [{ name: "assetId", type: "bytes32" }] },
5030
+ { type: "error", name: "AssetRouterAllowanceNotZero", inputs: [] },
5031
+ { type: "error", name: "BaseTokenGasPriceDenominatorNotSet", inputs: [] },
5032
+ {
5033
+ type: "error",
5034
+ name: "BatchHashMismatch",
5035
+ inputs: [
5036
+ { name: "expected", type: "bytes32" },
5037
+ { name: "actual", type: "bytes32" }
5038
+ ]
5039
+ },
5040
+ { type: "error", name: "BatchNotExecuted", inputs: [{ name: "batchNumber", type: "uint256" }] },
5041
+ {
5042
+ type: "error",
5043
+ name: "BatchNumberMismatch",
5044
+ inputs: [
5045
+ { name: "expectedBatchNumber", type: "uint256" },
5046
+ { name: "providedBatchNumber", type: "uint256" }
5047
+ ]
5048
+ },
5049
+ { type: "error", name: "BridgeHubAlreadyRegistered", inputs: [] },
5050
+ { type: "error", name: "BridgeMintNotImplemented", inputs: [] },
5051
+ { type: "error", name: "BurningNativeWETHNotSupported", inputs: [] },
5052
+ {
5053
+ type: "error",
5054
+ name: "BytecodeAlreadyPublished",
5055
+ inputs: [{ name: "bytecodeHash", type: "bytes32" }]
5056
+ },
5057
+ { type: "error", name: "CallerNotTimerAdmin", inputs: [] },
5058
+ { type: "error", name: "CallNotAllowed", inputs: [{ name: "call", type: "bytes" }] },
5059
+ { type: "error", name: "CanOnlyProcessOneBatch", inputs: [] },
5060
+ { type: "error", name: "CantExecuteUnprovenBatches", inputs: [] },
5061
+ { type: "error", name: "CantRevertExecutedBatch", inputs: [] },
5062
+ { type: "error", name: "ChainAlreadyLive", inputs: [] },
5063
+ { type: "error", name: "ChainIdAlreadyExists", inputs: [] },
5064
+ { type: "error", name: "ChainIdCantBeCurrentChain", inputs: [] },
5065
+ { type: "error", name: "ChainIdMismatch", inputs: [] },
5066
+ { type: "error", name: "ChainIdNotRegistered", inputs: [{ name: "chainId", type: "uint256" }] },
5067
+ { type: "error", name: "ChainIdTooBig", inputs: [] },
5068
+ { type: "error", name: "CTMAlreadyRegistered", inputs: [] },
5069
+ { type: "error", name: "CTMNotRegistered", inputs: [] },
5070
+ { type: "error", name: "DeadlineNotYetPassed", inputs: [] },
5071
+ { type: "error", name: "DefaultAdminTransferNotAllowed", inputs: [] },
5072
+ { type: "error", name: "DelegateCallFailed", inputs: [{ name: "returnData", type: "bytes" }] },
5073
+ { type: "error", name: "DenominatorIsZero", inputs: [] },
5074
+ { type: "error", name: "DeployFailed", inputs: [] },
5075
+ { type: "error", name: "DeployingBridgedTokenForNativeToken", inputs: [] },
5076
+ { type: "error", name: "DepositDoesNotExist", inputs: [] },
5077
+ { type: "error", name: "DepositExists", inputs: [] },
5078
+ { type: "error", name: "DiamondAlreadyFrozen", inputs: [] },
5079
+ { type: "error", name: "DiamondNotFrozen", inputs: [] },
5080
+ { type: "error", name: "EmptyAddress", inputs: [] },
5081
+ { type: "error", name: "EmptyAssetId", inputs: [] },
5082
+ { type: "error", name: "EmptyBytes32", inputs: [] },
5083
+ { type: "error", name: "EmptyData", inputs: [] },
5084
+ { type: "error", name: "EmptyDeposit", inputs: [] },
5085
+ { type: "error", name: "EmptyPrecommitData", inputs: [{ name: "batchNumber", type: "uint256" }] },
5086
+ { type: "error", name: "EmptyProofLength", inputs: [] },
5087
+ { type: "error", name: "ETHDepositNotSupported", inputs: [] },
5088
+ {
5089
+ type: "error",
5090
+ name: "FacetExists",
5091
+ inputs: [
5092
+ { name: "selector", type: "bytes4" },
5093
+ { name: "", type: "address" }
5094
+ ]
5095
+ },
5096
+ { type: "error", name: "GasPerPubdataMismatch", inputs: [] },
5097
+ { type: "error", name: "GenesisBatchCommitmentZero", inputs: [] },
5098
+ { type: "error", name: "GenesisBatchHashZero", inputs: [] },
5099
+ { type: "error", name: "GenesisIndexStorageZero", inputs: [] },
5100
+ { type: "error", name: "GenesisUpgradeZero", inputs: [] },
5101
+ { type: "error", name: "HashedLogIsDefault", inputs: [] },
5102
+ {
5103
+ type: "error",
5104
+ name: "HashMismatch",
5105
+ inputs: [
5106
+ { name: "expected", type: "bytes32" },
5107
+ { name: "actual", type: "bytes32" }
5108
+ ]
5109
+ },
5110
+ {
5111
+ type: "error",
5112
+ name: "IncorrectBatchBounds",
5113
+ inputs: [
5114
+ { name: "processFromExpected", type: "uint256" },
5115
+ { name: "processToExpected", type: "uint256" },
5116
+ { name: "processFromProvided", type: "uint256" },
5117
+ { name: "processToProvided", type: "uint256" }
5118
+ ]
5119
+ },
5120
+ {
5121
+ type: "error",
5122
+ name: "IncorrectBridgeHubAddress",
5123
+ inputs: [{ name: "bridgehub", type: "address" }]
5124
+ },
5125
+ {
5126
+ type: "error",
5127
+ name: "IncorrectTokenAddressFromNTV",
5128
+ inputs: [
5129
+ { name: "assetId", type: "bytes32" },
5130
+ { name: "tokenAddress", type: "address" }
5131
+ ]
5132
+ },
5133
+ { type: "error", name: "InsufficientChainBalance", inputs: [] },
5134
+ {
5135
+ type: "error",
5136
+ name: "InvalidBatchNumber",
5137
+ inputs: [
5138
+ { name: "provided", type: "uint256" },
5139
+ { name: "expected", type: "uint256" }
5140
+ ]
5141
+ },
5142
+ { type: "error", name: "InvalidCaller", inputs: [{ name: "", type: "address" }] },
5143
+ { type: "error", name: "InvalidDAForPermanentRollup", inputs: [] },
5144
+ { type: "error", name: "InvalidDelay", inputs: [] },
5145
+ {
5146
+ type: "error",
5147
+ name: "InvalidLogSender",
5148
+ inputs: [
5149
+ { name: "sender", type: "address" },
5150
+ { name: "logKey", type: "uint256" }
5151
+ ]
5152
+ },
5153
+ {
5154
+ type: "error",
5155
+ name: "InvalidMessageRoot",
5156
+ inputs: [
5157
+ { name: "expectedMessageRoot", type: "bytes32" },
5158
+ { name: "providedMessageRoot", type: "bytes32" }
5159
+ ]
5160
+ },
5161
+ { type: "error", name: "InvalidNTVBurnData", inputs: [] },
5162
+ {
5163
+ type: "error",
5164
+ name: "InvalidNumberOfBlobs",
5165
+ inputs: [
5166
+ { name: "expected", type: "uint256" },
5167
+ { name: "numCommitments", type: "uint256" },
5168
+ { name: "numHashes", type: "uint256" }
5169
+ ]
5170
+ },
5171
+ {
5172
+ type: "error",
5173
+ name: "InvalidPackedPrecommitmentLength",
5174
+ inputs: [{ name: "length", type: "uint256" }]
5175
+ },
5176
+ { type: "error", name: "InvalidProof", inputs: [] },
5177
+ { type: "error", name: "InvalidProofLengthForFinalNode", inputs: [] },
5178
+ { type: "error", name: "InvalidProtocolVersion", inputs: [] },
5179
+ { type: "error", name: "InvalidPubdataPricingMode", inputs: [] },
5180
+ { type: "error", name: "InvalidSelector", inputs: [{ name: "func", type: "bytes4" }] },
5181
+ { type: "error", name: "InvalidSystemLogsLength", inputs: [] },
5182
+ { type: "error", name: "InvalidUpgradeTxn", inputs: [{ name: "", type: "uint8" }] },
5183
+ { type: "error", name: "L2TimestampTooBig", inputs: [] },
5184
+ {
5185
+ type: "error",
5186
+ name: "L2WithdrawalMessageWrongLength",
5187
+ inputs: [{ name: "messageLen", type: "uint256" }]
5188
+ },
5189
+ { type: "error", name: "LegacyBridgeNotSet", inputs: [] },
5190
+ { type: "error", name: "LegacyBridgeUsesNonNativeToken", inputs: [] },
5191
+ { type: "error", name: "LegacyEncodingUsedForNonL1Token", inputs: [] },
5192
+ { type: "error", name: "LegacyMethodForNonL1Token", inputs: [] },
5193
+ {
5194
+ type: "error",
5195
+ name: "LengthIsNotDivisibleBy32",
5196
+ inputs: [{ name: "length", type: "uint256" }]
5197
+ },
5198
+ { type: "error", name: "LogAlreadyProcessed", inputs: [{ name: "", type: "uint8" }] },
5199
+ { type: "error", name: "MalformedBytecode", inputs: [{ name: "", type: "uint8" }] },
5200
+ { type: "error", name: "MerkleIndexOrHeightMismatch", inputs: [] },
5201
+ { type: "error", name: "MerkleIndexOutOfBounds", inputs: [] },
5202
+ { type: "error", name: "MerkleNothingToProve", inputs: [] },
5203
+ { type: "error", name: "MerklePathEmpty", inputs: [] },
5204
+ {
5205
+ type: "error",
5206
+ name: "MerklePathLengthMismatch",
5207
+ inputs: [
5208
+ { name: "pathLength", type: "uint256" },
5209
+ { name: "expectedLength", type: "uint256" }
5210
+ ]
5211
+ },
5212
+ { type: "error", name: "MerklePathOutOfBounds", inputs: [] },
5213
+ {
5214
+ type: "error",
5215
+ name: "MerkleWrongIndex",
5216
+ inputs: [
5217
+ { name: "index", type: "uint256" },
5218
+ { name: "maxNodeNumber", type: "uint256" }
5219
+ ]
5220
+ },
5221
+ {
5222
+ type: "error",
5223
+ name: "MerkleWrongLength",
5224
+ inputs: [
5225
+ { name: "newLeavesLength", type: "uint256" },
5226
+ { name: "leafNumber", type: "uint256" }
5227
+ ]
5228
+ },
5229
+ { type: "error", name: "MigrationPaused", inputs: [] },
5230
+ { type: "error", name: "MigrationsNotPaused", inputs: [] },
5231
+ {
5232
+ type: "error",
5233
+ name: "MissingSystemLogs",
5234
+ inputs: [
5235
+ { name: "expected", type: "uint256" },
5236
+ { name: "actual", type: "uint256" }
5237
+ ]
5238
+ },
5239
+ {
5240
+ type: "error",
5241
+ name: "MsgValueMismatch",
5242
+ inputs: [
5243
+ { name: "expectedMsgValue", type: "uint256" },
5244
+ { name: "providedMsgValue", type: "uint256" }
5245
+ ]
5246
+ },
5247
+ {
5248
+ type: "error",
5249
+ name: "MsgValueTooLow",
5250
+ inputs: [
5251
+ { name: "required", type: "uint256" },
5252
+ { name: "provided", type: "uint256" }
5253
+ ]
5254
+ },
5255
+ { type: "error", name: "NewDeadlineExceedsMaxDeadline", inputs: [] },
5256
+ { type: "error", name: "NewDeadlineNotGreaterThanCurrent", inputs: [] },
5257
+ { type: "error", name: "NoCallsProvided", inputs: [] },
5258
+ { type: "error", name: "NoCTMForAssetId", inputs: [{ name: "assetId", type: "bytes32" }] },
5259
+ { type: "error", name: "NoFunctionsForDiamondCut", inputs: [] },
5260
+ { type: "error", name: "NoFundsTransferred", inputs: [] },
5261
+ { type: "error", name: "NoLegacySharedBridge", inputs: [] },
5262
+ { type: "error", name: "NonEmptyCalldata", inputs: [] },
5263
+ { type: "error", name: "NonEmptyMsgValue", inputs: [] },
5264
+ { type: "error", name: "NonIncreasingTimestamp", inputs: [] },
5265
+ { type: "error", name: "NonSequentialBatch", inputs: [] },
5266
+ { type: "error", name: "NonSequentialVersion", inputs: [] },
5267
+ { type: "error", name: "NotAllowed", inputs: [{ name: "addr", type: "address" }] },
5268
+ { type: "error", name: "NotARestriction", inputs: [{ name: "addr", type: "address" }] },
5269
+ { type: "error", name: "NotAZKChain", inputs: [{ name: "addr", type: "address" }] },
5270
+ { type: "error", name: "NotInitializedReentrancyGuard", inputs: [] },
5271
+ { type: "error", name: "NotWhitelisted", inputs: [{ name: "", type: "address" }] },
5272
+ { type: "error", name: "OnlyEraSupported", inputs: [] },
5273
+ { type: "error", name: "OnlySelfAllowed", inputs: [] },
5274
+ { type: "error", name: "OperationExists", inputs: [] },
5275
+ { type: "error", name: "OperationMustBePending", inputs: [] },
5276
+ { type: "error", name: "OperationMustBeReady", inputs: [] },
5277
+ { type: "error", name: "OriginChainIdNotFound", inputs: [] },
5278
+ {
5279
+ type: "error",
5280
+ name: "PrecommitmentMismatch",
5281
+ inputs: [
5282
+ { name: "batchNumber", type: "uint256" },
5283
+ { name: "expected", type: "bytes32" },
5284
+ { name: "found", type: "bytes32" }
5285
+ ]
5286
+ },
5287
+ { type: "error", name: "PreviousOperationNotExecuted", inputs: [] },
5288
+ { type: "error", name: "PriorityOperationsRollingHashMismatch", inputs: [] },
5289
+ { type: "error", name: "PriorityTxPubdataExceedsMaxPubDataPerBatch", inputs: [] },
5290
+ {
5291
+ type: "error",
5292
+ name: "ProtocolIdMismatch",
5293
+ inputs: [
5294
+ { name: "expectedProtocolVersion", type: "uint256" },
5295
+ { name: "providedProtocolId", type: "uint256" }
5296
+ ]
5297
+ },
5298
+ { type: "error", name: "ProtocolIdNotGreater", inputs: [] },
5299
+ {
5300
+ type: "error",
5301
+ name: "PubdataGreaterThanLimit",
5302
+ inputs: [
5303
+ { name: "limit", type: "uint256" },
5304
+ { name: "length", type: "uint256" }
5305
+ ]
5306
+ },
5307
+ { type: "error", name: "QueueIsEmpty", inputs: [] },
5308
+ { type: "error", name: "Reentrancy", inputs: [] },
5309
+ {
5310
+ type: "error",
5311
+ name: "RemoveFunctionFacetAddressNotZero",
5312
+ inputs: [{ name: "facet", type: "address" }]
5313
+ },
5314
+ { type: "error", name: "RemoveFunctionFacetAddressZero", inputs: [] },
5315
+ { type: "error", name: "RemovingPermanentRestriction", inputs: [] },
5316
+ { type: "error", name: "ReplaceFunctionFacetAddressZero", inputs: [] },
5317
+ {
5318
+ type: "error",
5319
+ name: "RestrictionWasAlreadyPresent",
5320
+ inputs: [{ name: "restriction", type: "address" }]
5321
+ },
5322
+ {
5323
+ type: "error",
5324
+ name: "RestrictionWasNotPresent",
5325
+ inputs: [{ name: "restriction", type: "address" }]
5326
+ },
5327
+ { type: "error", name: "RevertedBatchNotAfterNewLastBatch", inputs: [] },
5328
+ {
5329
+ type: "error",
5330
+ name: "RoleAccessDenied",
5331
+ inputs: [
5332
+ { name: "chainAddress", type: "address" },
5333
+ { name: "role", type: "bytes32" },
5334
+ { name: "account", type: "address" }
5335
+ ]
5336
+ },
5337
+ { type: "error", name: "SelectorsMustAllHaveSameFreezability", inputs: [] },
5338
+ { type: "error", name: "SettlementLayersMustSettleOnL1", inputs: [] },
5339
+ { type: "error", name: "SharedBridgeNotSet", inputs: [] },
5340
+ { type: "error", name: "SharedBridgeValueNotSet", inputs: [{ name: "", type: "uint8" }] },
5341
+ { type: "error", name: "SlotOccupied", inputs: [] },
5342
+ { type: "error", name: "SystemLogsSizeTooBig", inputs: [] },
5343
+ {
5344
+ type: "error",
5345
+ name: "TimeNotReached",
5346
+ inputs: [
5347
+ { name: "expectedTimestamp", type: "uint256" },
5348
+ { name: "actualTimestamp", type: "uint256" }
5349
+ ]
5350
+ },
5351
+ { type: "error", name: "TimerAlreadyStarted", inputs: [] },
5352
+ { type: "error", name: "TimestampError", inputs: [] },
5353
+ { type: "error", name: "TokenIsLegacy", inputs: [] },
5354
+ { type: "error", name: "TokenNotLegacy", inputs: [] },
5355
+ { type: "error", name: "TokenNotSupported", inputs: [{ name: "token", type: "address" }] },
5356
+ { type: "error", name: "TokensWithFeesNotSupported", inputs: [] },
5357
+ { type: "error", name: "TooHighDeploymentNonce", inputs: [] },
5358
+ { type: "error", name: "TooManyFactoryDeps", inputs: [] },
5359
+ { type: "error", name: "TooMuchGas", inputs: [] },
5360
+ { type: "error", name: "TransactionNotAllowed", inputs: [] },
5361
+ { type: "error", name: "TxHashMismatch", inputs: [] },
5362
+ { type: "error", name: "TxnBodyGasLimitNotEnoughGas", inputs: [] },
5363
+ {
5364
+ type: "error",
5365
+ name: "UnallowedImplementation",
5366
+ inputs: [{ name: "implementationHash", type: "bytes32" }]
5367
+ },
5368
+ { type: "error", name: "Unauthorized", inputs: [{ name: "caller", type: "address" }] },
5369
+ { type: "error", name: "UndefinedDiamondCutAction", inputs: [] },
5370
+ { type: "error", name: "UnexpectedSystemLog", inputs: [{ name: "logKey", type: "uint256" }] },
5371
+ { type: "error", name: "UnknownVerifierType", inputs: [] },
5372
+ {
5373
+ type: "error",
5374
+ name: "UnsupportedCommitBatchEncoding",
5375
+ inputs: [{ name: "version", type: "uint8" }]
5376
+ },
5377
+ { type: "error", name: "UnsupportedEncodingVersion", inputs: [] },
5378
+ {
5379
+ type: "error",
5380
+ name: "UnsupportedExecuteBatchEncoding",
5381
+ inputs: [{ name: "version", type: "uint8" }]
5382
+ },
5383
+ {
5384
+ type: "error",
5385
+ name: "UnsupportedProofBatchEncoding",
5386
+ inputs: [{ name: "version", type: "uint8" }]
5387
+ },
5388
+ { type: "error", name: "UpgradeBatchNumberIsNotZero", inputs: [] },
5389
+ { type: "error", name: "ValidateTxnNotEnoughGas", inputs: [] },
5390
+ {
5391
+ type: "error",
5392
+ name: "ValueMismatch",
5393
+ inputs: [
5394
+ { name: "expected", type: "uint256" },
5395
+ { name: "actual", type: "uint256" }
5396
+ ]
5397
+ },
5398
+ { type: "error", name: "VerifiedBatchesExceedsCommittedBatches", inputs: [] },
5399
+ { type: "error", name: "WithdrawalAlreadyFinalized", inputs: [] },
5400
+ { type: "error", name: "WithdrawFailed", inputs: [] },
5401
+ { type: "error", name: "WrappedBaseTokenAlreadyRegistered", inputs: [] },
5402
+ {
5403
+ type: "error",
5404
+ name: "WrongMagicValue",
5405
+ inputs: [
5406
+ { name: "expectedMagicValue", type: "uint256" },
5407
+ { name: "providedMagicValue", type: "uint256" }
5408
+ ]
5409
+ },
5410
+ { type: "error", name: "ZeroAddress", inputs: [] },
5411
+ { type: "error", name: "ZeroChainId", inputs: [] },
5412
+ { type: "error", name: "ZKChainLimitReached", inputs: [] }
5413
+ ];
5414
+ var IL1ContractErrors_default = IL1ContractErrorsABI;
5415
+
4704
5416
  // src/core/types/fees.ts
4705
5417
  function toGasOverrides(overrides) {
4706
5418
  const { nonce: _, ...gas } = overrides;
@@ -5081,6 +5793,14 @@ var IFACE_PANIC = new ethers.Interface(["error Panic(uint256)"]);
5081
5793
  ERROR_IFACES.push({ name: "Mailbox", iface: new ethers.Interface(Mailbox_default) });
5082
5794
  } catch {
5083
5795
  }
5796
+ try {
5797
+ ERROR_IFACES.push({ name: "IL1ContractErrors", iface: new ethers.Interface(IL1ContractErrors_default) });
5798
+ } catch {
5799
+ }
5800
+ try {
5801
+ ERROR_IFACES.push({ name: "IInteropErrors", iface: new ethers.Interface(IInteropErrors_default) });
5802
+ } catch {
5803
+ }
5084
5804
  })();
5085
5805
  function extractRevertData(e) {
5086
5806
  const maybe = (
@@ -5174,6 +5894,8 @@ async function quoteL2BaseCost2(input) {
5174
5894
  }
5175
5895
 
5176
5896
  // src/adapters/ethers/resources/deposits/services/gas.ts
5897
+ var DEFAULT_SAFE_NONBASE_L2_GAS_LIMIT = 3000000n;
5898
+ var ZERO_L2_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
5177
5899
  async function quoteL1Gas2(input) {
5178
5900
  const { ctx, tx, overrides, fallbackGasLimit } = input;
5179
5901
  const estimator = ethersToGasEstimator(ctx.client.l1);
@@ -5197,24 +5919,24 @@ async function quoteL2Gas2(input) {
5197
5919
  stateOverrides: input.stateOverrides
5198
5920
  });
5199
5921
  }
5200
- async function determineErc20L2Gas(input) {
5201
- const { ctx, l1Token } = input;
5202
- const DEFAULT_SAFE_L2_GAS_LIMIT = 3000000n;
5922
+ async function determineNonBaseL2Gas(input) {
5923
+ const { ctx, l1Token, route } = input;
5924
+ const fallbackQuote = () => quoteL2Gas2({
5925
+ ctx,
5926
+ route,
5927
+ overrideGasLimit: DEFAULT_SAFE_NONBASE_L2_GAS_LIMIT
5928
+ });
5203
5929
  if (ctx.l2GasLimit != null) {
5204
5930
  return quoteL2Gas2({
5205
5931
  ctx,
5206
- route: "erc20-nonbase",
5932
+ route,
5207
5933
  overrideGasLimit: ctx.l2GasLimit
5208
5934
  });
5209
5935
  }
5210
5936
  try {
5211
- const l2TokenAddress = ctx.tokens ? await ctx.tokens.toL2Address(l1Token) : await (await ctx.contracts.l2NativeTokenVault()).l2TokenAddress(l1Token);
5212
- if (l2TokenAddress === "0x0000000000000000000000000000000000000000") {
5213
- return quoteL2Gas2({
5214
- ctx,
5215
- route: "erc20-nonbase",
5216
- overrideGasLimit: DEFAULT_SAFE_L2_GAS_LIMIT
5217
- });
5937
+ const l2TokenAddress = input.knownL2Token ?? (ctx.tokens ? await ctx.tokens.toL2Address(l1Token) : await (await ctx.contracts.l2NativeTokenVault()).l2TokenAddress(l1Token));
5938
+ if (l2TokenAddress === ZERO_L2_TOKEN_ADDRESS) {
5939
+ return fallbackQuote();
5218
5940
  }
5219
5941
  const modelTx = {
5220
5942
  to: input.modelTx?.to ?? ctx.sender,
@@ -5224,26 +5946,34 @@ async function determineErc20L2Gas(input) {
5224
5946
  };
5225
5947
  const gas = await quoteL2Gas2({
5226
5948
  ctx,
5227
- route: "erc20-nonbase",
5949
+ route,
5228
5950
  l2TxForModeling: modelTx
5229
5951
  });
5230
- if (!gas) {
5231
- return quoteL2Gas2({
5232
- ctx,
5233
- route: "erc20-nonbase",
5234
- overrideGasLimit: DEFAULT_SAFE_L2_GAS_LIMIT
5235
- });
5952
+ if (!gas || gas.gasLimit === 0n) {
5953
+ return fallbackQuote();
5236
5954
  }
5237
5955
  return gas;
5238
5956
  } catch (err) {
5239
- console.warn("Failed to determine ERC20 L2 gas; defaulting to safe gas limit.", err);
5240
- return quoteL2Gas2({
5241
- ctx,
5242
- route: "erc20-nonbase",
5243
- overrideGasLimit: DEFAULT_SAFE_L2_GAS_LIMIT
5244
- });
5957
+ console.warn("Failed to determine non-base deposit L2 gas; defaulting to safe gas limit.", err);
5958
+ return fallbackQuote();
5245
5959
  }
5246
5960
  }
5961
+ async function determineErc20L2Gas(input) {
5962
+ return determineNonBaseL2Gas({
5963
+ ...input,
5964
+ route: "erc20-nonbase",
5965
+ knownL2Token: input.ctx.resolvedToken?.l2
5966
+ });
5967
+ }
5968
+ async function determineEthNonBaseL2Gas(input) {
5969
+ return determineNonBaseL2Gas({
5970
+ ctx: input.ctx,
5971
+ route: "eth-nonbase",
5972
+ l1Token: input.ctx.resolvedToken?.l1 ?? FORMAL_ETH_ADDRESS,
5973
+ knownL2Token: input.ctx.resolvedToken?.l2,
5974
+ modelTx: input.modelTx
5975
+ });
5976
+ }
5247
5977
 
5248
5978
  // src/core/resources/deposits/fee.ts
5249
5979
  function buildFeeBreakdown(p) {
@@ -5563,11 +6293,9 @@ function routeEthNonBase() {
5563
6293
  data: "0x",
5564
6294
  value: 0n
5565
6295
  };
5566
- const l2GasParams = await quoteL2Gas2({
6296
+ const l2GasParams = await determineEthNonBaseL2Gas({
5567
6297
  ctx,
5568
- route: "eth-nonbase",
5569
- l2TxForModeling: l2TxModel,
5570
- overrideGasLimit: ctx.l2GasLimit
6298
+ modelTx: l2TxModel
5571
6299
  });
5572
6300
  if (!l2GasParams) throw new Error("Failed to estimate L2 gas parameters.");
5573
6301
  const baseCost = await quoteL2BaseCost2({ ctx, l2GasLimit: l2GasParams.gasLimit });
@@ -5587,7 +6315,7 @@ function routeEthNonBase() {
5587
6315
  if (allowance < mintValue) {
5588
6316
  approvals.push({ token: baseToken, spender: ctx.l1AssetRouter, amount: mintValue });
5589
6317
  steps.push({
5590
- key: `approve:${baseToken}`,
6318
+ key: `approve:${baseToken}:${ctx.l1AssetRouter}`,
5591
6319
  kind: "approve",
5592
6320
  description: `Approve base token for fees (mintValue)`,
5593
6321
  tx: {
@@ -6794,7 +7522,7 @@ function createFinalizationServices(client) {
6794
7522
  chainId: BigInt(chainId),
6795
7523
  l2BatchNumber: proof.batchNumber,
6796
7524
  l2MessageIndex: proof.id,
6797
- l2Sender: L2_ASSET_ROUTER_ADDRESS,
7525
+ l2Sender: parsed.to,
6798
7526
  l2TxNumberInBatch: txIndex,
6799
7527
  message,
6800
7528
  merkleProof: proof.proof
@@ -8512,17 +9240,20 @@ function createInteropResource(client, tokens, contracts, attributes) {
8512
9240
  }
8513
9241
  } catch (e) {
8514
9242
  if (isZKsyncError(e)) throw e;
8515
- throw createError("EXECUTION", {
8516
- resource: "interop",
8517
- operation: "interop.create.sendTransaction",
8518
- message: "Failed to send or confirm an interop transaction step.",
8519
- context: {
8520
- step: step.key,
8521
- txHash: hash,
8522
- nonce: Number(step.tx.nonce ?? -1)
9243
+ throw toZKsyncError(
9244
+ "EXECUTION",
9245
+ {
9246
+ resource: "interop",
9247
+ operation: "interop.create.sendTransaction",
9248
+ message: "Failed to send or confirm an interop transaction step.",
9249
+ context: {
9250
+ step: step.key,
9251
+ txHash: hash,
9252
+ nonce: Number(step.tx.nonce ?? -1)
9253
+ }
8523
9254
  },
8524
- cause: e
8525
- });
9255
+ e
9256
+ );
8526
9257
  }
8527
9258
  }
8528
9259
  const last = Object.values(stepHashes).pop();