@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
@@ -48,7 +48,7 @@ var TX_OVERHEAD_GAS = 10000n;
48
48
  var TX_MEMORY_OVERHEAD_GAS = 10n;
49
49
  var DEFAULT_PUBDATA_BYTES = 155n;
50
50
  var DEFAULT_ABI_BYTES = 400n;
51
- var SAFE_L1_BRIDGE_GAS = 700000n;
51
+ var SAFE_L1_BRIDGE_GAS = 800000n;
52
52
 
53
53
  // src/core/utils/addr.ts
54
54
  function isAddress(x) {
@@ -524,8 +524,8 @@ function ensureHex(value, field, context) {
524
524
  });
525
525
  }
526
526
  function ensureNumber(value, field, opts) {
527
- const operation = opts?.operation ?? "zksrpc.normalizeGenesis";
528
- const messagePrefix = opts?.messagePrefix ?? "Malformed genesis response";
527
+ const operation = opts?.operation;
528
+ const messagePrefix = opts?.messagePrefix;
529
529
  if (isNumber(value)) return value;
530
530
  if (isBigint(value)) return Number(value);
531
531
  if (typeof value === "string" && value.trim() !== "") {
@@ -663,7 +663,6 @@ function normalizeGenesis(raw) {
663
663
  context: { valueType: typeof contractsRaw }
664
664
  });
665
665
  }
666
- const executionVersion = ensureNumber(record["execution_version"], "execution_version");
667
666
  const genesisRoot = ensureHex(record["genesis_root"], "genesis_root", {});
668
667
  const initialContracts = contractsRaw.map(
669
668
  (entry, index) => normalizeContractTuple(entry, index)
@@ -672,7 +671,6 @@ function normalizeGenesis(raw) {
672
671
  return {
673
672
  initialContracts,
674
673
  additionalStorage,
675
- executionVersion,
676
674
  genesisRoot
677
675
  };
678
676
  } catch (e) {
@@ -6764,6 +6762,718 @@ var L2MessageVerificationABI = [
6764
6762
  ];
6765
6763
  var L2MessageVerification_default = L2MessageVerificationABI;
6766
6764
 
6765
+ // src/core/internal/abis/IInteropErrors.ts
6766
+ var IInteropErrorsABI = [
6767
+ {
6768
+ type: "error",
6769
+ name: "AttributeAlreadySet",
6770
+ inputs: [
6771
+ {
6772
+ name: "selector",
6773
+ type: "bytes4"
6774
+ }
6775
+ ]
6776
+ },
6777
+ {
6778
+ type: "error",
6779
+ name: "AttributeViolatesRestriction",
6780
+ inputs: [
6781
+ {
6782
+ name: "selector",
6783
+ type: "bytes4"
6784
+ },
6785
+ {
6786
+ name: "restriction",
6787
+ type: "uint256"
6788
+ }
6789
+ ]
6790
+ },
6791
+ {
6792
+ type: "error",
6793
+ name: "BundleAlreadyProcessed",
6794
+ inputs: [
6795
+ {
6796
+ name: "bundleHash",
6797
+ type: "bytes32"
6798
+ }
6799
+ ]
6800
+ },
6801
+ {
6802
+ type: "error",
6803
+ name: "CallAlreadyExecuted",
6804
+ inputs: [
6805
+ {
6806
+ name: "bundleHash",
6807
+ type: "bytes32"
6808
+ },
6809
+ {
6810
+ name: "callIndex",
6811
+ type: "uint256"
6812
+ }
6813
+ ]
6814
+ },
6815
+ {
6816
+ type: "error",
6817
+ name: "CallNotExecutable",
6818
+ inputs: [
6819
+ {
6820
+ name: "bundleHash",
6821
+ type: "bytes32"
6822
+ },
6823
+ {
6824
+ name: "callIndex",
6825
+ type: "uint256"
6826
+ }
6827
+ ]
6828
+ },
6829
+ {
6830
+ type: "error",
6831
+ name: "CanNotUnbundle",
6832
+ inputs: [
6833
+ {
6834
+ name: "bundleHash",
6835
+ type: "bytes32"
6836
+ }
6837
+ ]
6838
+ },
6839
+ {
6840
+ type: "error",
6841
+ name: "DestinationChainNotRegistered",
6842
+ inputs: [
6843
+ {
6844
+ name: "destinationChainId",
6845
+ type: "uint256"
6846
+ }
6847
+ ]
6848
+ },
6849
+ {
6850
+ type: "error",
6851
+ name: "ExecutingNotAllowed",
6852
+ inputs: [
6853
+ {
6854
+ name: "bundleHash",
6855
+ type: "bytes32"
6856
+ },
6857
+ {
6858
+ name: "callerAddress",
6859
+ type: "bytes"
6860
+ },
6861
+ {
6862
+ name: "executionAddress",
6863
+ type: "bytes"
6864
+ }
6865
+ ]
6866
+ },
6867
+ {
6868
+ type: "error",
6869
+ name: "FeeWithdrawalFailed",
6870
+ inputs: []
6871
+ },
6872
+ {
6873
+ type: "error",
6874
+ name: "IndirectCallValueMismatch",
6875
+ inputs: [
6876
+ {
6877
+ name: "expected",
6878
+ type: "uint256"
6879
+ },
6880
+ {
6881
+ name: "actual",
6882
+ type: "uint256"
6883
+ }
6884
+ ]
6885
+ },
6886
+ {
6887
+ type: "error",
6888
+ name: "InteroperableAddressChainReferenceNotEmpty",
6889
+ inputs: [
6890
+ {
6891
+ name: "interoperableAddress",
6892
+ type: "bytes"
6893
+ }
6894
+ ]
6895
+ },
6896
+ {
6897
+ type: "error",
6898
+ name: "InteroperableAddressNotEmpty",
6899
+ inputs: [
6900
+ {
6901
+ name: "interoperableAddress",
6902
+ type: "bytes"
6903
+ }
6904
+ ]
6905
+ },
6906
+ {
6907
+ type: "error",
6908
+ name: "InvalidInteropBundleVersion",
6909
+ inputs: []
6910
+ },
6911
+ {
6912
+ type: "error",
6913
+ name: "InvalidInteropCallVersion",
6914
+ inputs: []
6915
+ },
6916
+ {
6917
+ type: "error",
6918
+ name: "InteropRootAlreadyExists",
6919
+ inputs: []
6920
+ },
6921
+ {
6922
+ type: "error",
6923
+ name: "MessageNotIncluded",
6924
+ inputs: []
6925
+ },
6926
+ {
6927
+ type: "error",
6928
+ name: "SidesLengthNotOne",
6929
+ inputs: []
6930
+ },
6931
+ {
6932
+ type: "error",
6933
+ name: "UnauthorizedMessageSender",
6934
+ inputs: [
6935
+ {
6936
+ name: "expected",
6937
+ type: "address"
6938
+ },
6939
+ {
6940
+ name: "actual",
6941
+ type: "address"
6942
+ }
6943
+ ]
6944
+ },
6945
+ {
6946
+ type: "error",
6947
+ name: "UnbundlingNotAllowed",
6948
+ inputs: [
6949
+ {
6950
+ name: "bundleHash",
6951
+ type: "bytes32"
6952
+ },
6953
+ {
6954
+ name: "callerAddress",
6955
+ type: "bytes"
6956
+ },
6957
+ {
6958
+ name: "unbundlerAddress",
6959
+ type: "bytes"
6960
+ }
6961
+ ]
6962
+ },
6963
+ {
6964
+ type: "error",
6965
+ name: "WrongCallStatusLength",
6966
+ inputs: [
6967
+ {
6968
+ name: "bundleCallsLength",
6969
+ type: "uint256"
6970
+ },
6971
+ {
6972
+ name: "providedCallStatusLength",
6973
+ type: "uint256"
6974
+ }
6975
+ ]
6976
+ },
6977
+ {
6978
+ type: "error",
6979
+ name: "WrongDestinationChainId",
6980
+ inputs: [
6981
+ {
6982
+ name: "bundleHash",
6983
+ type: "bytes32"
6984
+ },
6985
+ {
6986
+ name: "expected",
6987
+ type: "uint256"
6988
+ },
6989
+ {
6990
+ name: "actual",
6991
+ type: "uint256"
6992
+ }
6993
+ ]
6994
+ },
6995
+ {
6996
+ type: "error",
6997
+ name: "WrongDestinationBaseTokenAssetId",
6998
+ inputs: [
6999
+ {
7000
+ name: "bundleHash",
7001
+ type: "bytes32"
7002
+ },
7003
+ {
7004
+ name: "expected",
7005
+ type: "bytes32"
7006
+ },
7007
+ {
7008
+ name: "actual",
7009
+ type: "bytes32"
7010
+ }
7011
+ ]
7012
+ },
7013
+ {
7014
+ type: "error",
7015
+ name: "WrongSourceChainId",
7016
+ inputs: [
7017
+ {
7018
+ name: "bundleHash",
7019
+ type: "bytes32"
7020
+ },
7021
+ {
7022
+ name: "expected",
7023
+ type: "uint256"
7024
+ },
7025
+ {
7026
+ name: "actual",
7027
+ type: "uint256"
7028
+ }
7029
+ ]
7030
+ },
7031
+ {
7032
+ type: "error",
7033
+ name: "ZKTokenNotAvailable",
7034
+ inputs: []
7035
+ }
7036
+ ];
7037
+ var IInteropErrors_default = IInteropErrorsABI;
7038
+
7039
+ // src/core/internal/abis/IL1ContractErrors.ts
7040
+ var IL1ContractErrorsABI = [
7041
+ {
7042
+ type: "error",
7043
+ name: "AccessToFallbackDenied",
7044
+ inputs: [
7045
+ { name: "target", type: "address" },
7046
+ { name: "invoker", type: "address" }
7047
+ ]
7048
+ },
7049
+ {
7050
+ type: "error",
7051
+ name: "AccessToFunctionDenied",
7052
+ inputs: [
7053
+ { name: "target", type: "address" },
7054
+ { name: "selector", type: "bytes4" },
7055
+ { name: "invoker", type: "address" }
7056
+ ]
7057
+ },
7058
+ { type: "error", name: "AddressAlreadySet", inputs: [{ name: "addr", type: "address" }] },
7059
+ { type: "error", name: "AddressHasNoCode", inputs: [{ name: "", type: "address" }] },
7060
+ {
7061
+ type: "error",
7062
+ name: "AddressMismatch",
7063
+ inputs: [
7064
+ { name: "expected", type: "address" },
7065
+ { name: "supplied", type: "address" }
7066
+ ]
7067
+ },
7068
+ { type: "error", name: "AlreadyPermanentRollup", inputs: [] },
7069
+ { type: "error", name: "AlreadyWhitelisted", inputs: [{ name: "", type: "address" }] },
7070
+ { type: "error", name: "AmountMustBeGreaterThanZero", inputs: [] },
7071
+ {
7072
+ type: "error",
7073
+ name: "AssetHandlerDoesNotExist",
7074
+ inputs: [{ name: "assetId", type: "bytes32" }]
7075
+ },
7076
+ {
7077
+ type: "error",
7078
+ name: "AssetHandlerNotRegistered",
7079
+ inputs: [{ name: "assetId", type: "bytes32" }]
7080
+ },
7081
+ { type: "error", name: "AssetIdAlreadyRegistered", inputs: [] },
7082
+ {
7083
+ type: "error",
7084
+ name: "AssetIdMismatch",
7085
+ inputs: [
7086
+ { name: "expected", type: "bytes32" },
7087
+ { name: "supplied", type: "bytes32" }
7088
+ ]
7089
+ },
7090
+ { type: "error", name: "AssetIdNotSupported", inputs: [{ name: "assetId", type: "bytes32" }] },
7091
+ { type: "error", name: "AssetRouterAllowanceNotZero", inputs: [] },
7092
+ { type: "error", name: "BaseTokenGasPriceDenominatorNotSet", inputs: [] },
7093
+ {
7094
+ type: "error",
7095
+ name: "BatchHashMismatch",
7096
+ inputs: [
7097
+ { name: "expected", type: "bytes32" },
7098
+ { name: "actual", type: "bytes32" }
7099
+ ]
7100
+ },
7101
+ { type: "error", name: "BatchNotExecuted", inputs: [{ name: "batchNumber", type: "uint256" }] },
7102
+ {
7103
+ type: "error",
7104
+ name: "BatchNumberMismatch",
7105
+ inputs: [
7106
+ { name: "expectedBatchNumber", type: "uint256" },
7107
+ { name: "providedBatchNumber", type: "uint256" }
7108
+ ]
7109
+ },
7110
+ { type: "error", name: "BridgeHubAlreadyRegistered", inputs: [] },
7111
+ { type: "error", name: "BridgeMintNotImplemented", inputs: [] },
7112
+ { type: "error", name: "BurningNativeWETHNotSupported", inputs: [] },
7113
+ {
7114
+ type: "error",
7115
+ name: "BytecodeAlreadyPublished",
7116
+ inputs: [{ name: "bytecodeHash", type: "bytes32" }]
7117
+ },
7118
+ { type: "error", name: "CallerNotTimerAdmin", inputs: [] },
7119
+ { type: "error", name: "CallNotAllowed", inputs: [{ name: "call", type: "bytes" }] },
7120
+ { type: "error", name: "CanOnlyProcessOneBatch", inputs: [] },
7121
+ { type: "error", name: "CantExecuteUnprovenBatches", inputs: [] },
7122
+ { type: "error", name: "CantRevertExecutedBatch", inputs: [] },
7123
+ { type: "error", name: "ChainAlreadyLive", inputs: [] },
7124
+ { type: "error", name: "ChainIdAlreadyExists", inputs: [] },
7125
+ { type: "error", name: "ChainIdCantBeCurrentChain", inputs: [] },
7126
+ { type: "error", name: "ChainIdMismatch", inputs: [] },
7127
+ { type: "error", name: "ChainIdNotRegistered", inputs: [{ name: "chainId", type: "uint256" }] },
7128
+ { type: "error", name: "ChainIdTooBig", inputs: [] },
7129
+ { type: "error", name: "CTMAlreadyRegistered", inputs: [] },
7130
+ { type: "error", name: "CTMNotRegistered", inputs: [] },
7131
+ { type: "error", name: "DeadlineNotYetPassed", inputs: [] },
7132
+ { type: "error", name: "DefaultAdminTransferNotAllowed", inputs: [] },
7133
+ { type: "error", name: "DelegateCallFailed", inputs: [{ name: "returnData", type: "bytes" }] },
7134
+ { type: "error", name: "DenominatorIsZero", inputs: [] },
7135
+ { type: "error", name: "DeployFailed", inputs: [] },
7136
+ { type: "error", name: "DeployingBridgedTokenForNativeToken", inputs: [] },
7137
+ { type: "error", name: "DepositDoesNotExist", inputs: [] },
7138
+ { type: "error", name: "DepositExists", inputs: [] },
7139
+ { type: "error", name: "DiamondAlreadyFrozen", inputs: [] },
7140
+ { type: "error", name: "DiamondNotFrozen", inputs: [] },
7141
+ { type: "error", name: "EmptyAddress", inputs: [] },
7142
+ { type: "error", name: "EmptyAssetId", inputs: [] },
7143
+ { type: "error", name: "EmptyBytes32", inputs: [] },
7144
+ { type: "error", name: "EmptyData", inputs: [] },
7145
+ { type: "error", name: "EmptyDeposit", inputs: [] },
7146
+ { type: "error", name: "EmptyPrecommitData", inputs: [{ name: "batchNumber", type: "uint256" }] },
7147
+ { type: "error", name: "EmptyProofLength", inputs: [] },
7148
+ { type: "error", name: "ETHDepositNotSupported", inputs: [] },
7149
+ {
7150
+ type: "error",
7151
+ name: "FacetExists",
7152
+ inputs: [
7153
+ { name: "selector", type: "bytes4" },
7154
+ { name: "", type: "address" }
7155
+ ]
7156
+ },
7157
+ { type: "error", name: "GasPerPubdataMismatch", inputs: [] },
7158
+ { type: "error", name: "GenesisBatchCommitmentZero", inputs: [] },
7159
+ { type: "error", name: "GenesisBatchHashZero", inputs: [] },
7160
+ { type: "error", name: "GenesisIndexStorageZero", inputs: [] },
7161
+ { type: "error", name: "GenesisUpgradeZero", inputs: [] },
7162
+ { type: "error", name: "HashedLogIsDefault", inputs: [] },
7163
+ {
7164
+ type: "error",
7165
+ name: "HashMismatch",
7166
+ inputs: [
7167
+ { name: "expected", type: "bytes32" },
7168
+ { name: "actual", type: "bytes32" }
7169
+ ]
7170
+ },
7171
+ {
7172
+ type: "error",
7173
+ name: "IncorrectBatchBounds",
7174
+ inputs: [
7175
+ { name: "processFromExpected", type: "uint256" },
7176
+ { name: "processToExpected", type: "uint256" },
7177
+ { name: "processFromProvided", type: "uint256" },
7178
+ { name: "processToProvided", type: "uint256" }
7179
+ ]
7180
+ },
7181
+ {
7182
+ type: "error",
7183
+ name: "IncorrectBridgeHubAddress",
7184
+ inputs: [{ name: "bridgehub", type: "address" }]
7185
+ },
7186
+ {
7187
+ type: "error",
7188
+ name: "IncorrectTokenAddressFromNTV",
7189
+ inputs: [
7190
+ { name: "assetId", type: "bytes32" },
7191
+ { name: "tokenAddress", type: "address" }
7192
+ ]
7193
+ },
7194
+ { type: "error", name: "InsufficientChainBalance", inputs: [] },
7195
+ {
7196
+ type: "error",
7197
+ name: "InvalidBatchNumber",
7198
+ inputs: [
7199
+ { name: "provided", type: "uint256" },
7200
+ { name: "expected", type: "uint256" }
7201
+ ]
7202
+ },
7203
+ { type: "error", name: "InvalidCaller", inputs: [{ name: "", type: "address" }] },
7204
+ { type: "error", name: "InvalidDAForPermanentRollup", inputs: [] },
7205
+ { type: "error", name: "InvalidDelay", inputs: [] },
7206
+ {
7207
+ type: "error",
7208
+ name: "InvalidLogSender",
7209
+ inputs: [
7210
+ { name: "sender", type: "address" },
7211
+ { name: "logKey", type: "uint256" }
7212
+ ]
7213
+ },
7214
+ {
7215
+ type: "error",
7216
+ name: "InvalidMessageRoot",
7217
+ inputs: [
7218
+ { name: "expectedMessageRoot", type: "bytes32" },
7219
+ { name: "providedMessageRoot", type: "bytes32" }
7220
+ ]
7221
+ },
7222
+ { type: "error", name: "InvalidNTVBurnData", inputs: [] },
7223
+ {
7224
+ type: "error",
7225
+ name: "InvalidNumberOfBlobs",
7226
+ inputs: [
7227
+ { name: "expected", type: "uint256" },
7228
+ { name: "numCommitments", type: "uint256" },
7229
+ { name: "numHashes", type: "uint256" }
7230
+ ]
7231
+ },
7232
+ {
7233
+ type: "error",
7234
+ name: "InvalidPackedPrecommitmentLength",
7235
+ inputs: [{ name: "length", type: "uint256" }]
7236
+ },
7237
+ { type: "error", name: "InvalidProof", inputs: [] },
7238
+ { type: "error", name: "InvalidProofLengthForFinalNode", inputs: [] },
7239
+ { type: "error", name: "InvalidProtocolVersion", inputs: [] },
7240
+ { type: "error", name: "InvalidPubdataPricingMode", inputs: [] },
7241
+ { type: "error", name: "InvalidSelector", inputs: [{ name: "func", type: "bytes4" }] },
7242
+ { type: "error", name: "InvalidSystemLogsLength", inputs: [] },
7243
+ { type: "error", name: "InvalidUpgradeTxn", inputs: [{ name: "", type: "uint8" }] },
7244
+ { type: "error", name: "L2TimestampTooBig", inputs: [] },
7245
+ {
7246
+ type: "error",
7247
+ name: "L2WithdrawalMessageWrongLength",
7248
+ inputs: [{ name: "messageLen", type: "uint256" }]
7249
+ },
7250
+ { type: "error", name: "LegacyBridgeNotSet", inputs: [] },
7251
+ { type: "error", name: "LegacyBridgeUsesNonNativeToken", inputs: [] },
7252
+ { type: "error", name: "LegacyEncodingUsedForNonL1Token", inputs: [] },
7253
+ { type: "error", name: "LegacyMethodForNonL1Token", inputs: [] },
7254
+ {
7255
+ type: "error",
7256
+ name: "LengthIsNotDivisibleBy32",
7257
+ inputs: [{ name: "length", type: "uint256" }]
7258
+ },
7259
+ { type: "error", name: "LogAlreadyProcessed", inputs: [{ name: "", type: "uint8" }] },
7260
+ { type: "error", name: "MalformedBytecode", inputs: [{ name: "", type: "uint8" }] },
7261
+ { type: "error", name: "MerkleIndexOrHeightMismatch", inputs: [] },
7262
+ { type: "error", name: "MerkleIndexOutOfBounds", inputs: [] },
7263
+ { type: "error", name: "MerkleNothingToProve", inputs: [] },
7264
+ { type: "error", name: "MerklePathEmpty", inputs: [] },
7265
+ {
7266
+ type: "error",
7267
+ name: "MerklePathLengthMismatch",
7268
+ inputs: [
7269
+ { name: "pathLength", type: "uint256" },
7270
+ { name: "expectedLength", type: "uint256" }
7271
+ ]
7272
+ },
7273
+ { type: "error", name: "MerklePathOutOfBounds", inputs: [] },
7274
+ {
7275
+ type: "error",
7276
+ name: "MerkleWrongIndex",
7277
+ inputs: [
7278
+ { name: "index", type: "uint256" },
7279
+ { name: "maxNodeNumber", type: "uint256" }
7280
+ ]
7281
+ },
7282
+ {
7283
+ type: "error",
7284
+ name: "MerkleWrongLength",
7285
+ inputs: [
7286
+ { name: "newLeavesLength", type: "uint256" },
7287
+ { name: "leafNumber", type: "uint256" }
7288
+ ]
7289
+ },
7290
+ { type: "error", name: "MigrationPaused", inputs: [] },
7291
+ { type: "error", name: "MigrationsNotPaused", inputs: [] },
7292
+ {
7293
+ type: "error",
7294
+ name: "MissingSystemLogs",
7295
+ inputs: [
7296
+ { name: "expected", type: "uint256" },
7297
+ { name: "actual", type: "uint256" }
7298
+ ]
7299
+ },
7300
+ {
7301
+ type: "error",
7302
+ name: "MsgValueMismatch",
7303
+ inputs: [
7304
+ { name: "expectedMsgValue", type: "uint256" },
7305
+ { name: "providedMsgValue", type: "uint256" }
7306
+ ]
7307
+ },
7308
+ {
7309
+ type: "error",
7310
+ name: "MsgValueTooLow",
7311
+ inputs: [
7312
+ { name: "required", type: "uint256" },
7313
+ { name: "provided", type: "uint256" }
7314
+ ]
7315
+ },
7316
+ { type: "error", name: "NewDeadlineExceedsMaxDeadline", inputs: [] },
7317
+ { type: "error", name: "NewDeadlineNotGreaterThanCurrent", inputs: [] },
7318
+ { type: "error", name: "NoCallsProvided", inputs: [] },
7319
+ { type: "error", name: "NoCTMForAssetId", inputs: [{ name: "assetId", type: "bytes32" }] },
7320
+ { type: "error", name: "NoFunctionsForDiamondCut", inputs: [] },
7321
+ { type: "error", name: "NoFundsTransferred", inputs: [] },
7322
+ { type: "error", name: "NoLegacySharedBridge", inputs: [] },
7323
+ { type: "error", name: "NonEmptyCalldata", inputs: [] },
7324
+ { type: "error", name: "NonEmptyMsgValue", inputs: [] },
7325
+ { type: "error", name: "NonIncreasingTimestamp", inputs: [] },
7326
+ { type: "error", name: "NonSequentialBatch", inputs: [] },
7327
+ { type: "error", name: "NonSequentialVersion", inputs: [] },
7328
+ { type: "error", name: "NotAllowed", inputs: [{ name: "addr", type: "address" }] },
7329
+ { type: "error", name: "NotARestriction", inputs: [{ name: "addr", type: "address" }] },
7330
+ { type: "error", name: "NotAZKChain", inputs: [{ name: "addr", type: "address" }] },
7331
+ { type: "error", name: "NotInitializedReentrancyGuard", inputs: [] },
7332
+ { type: "error", name: "NotWhitelisted", inputs: [{ name: "", type: "address" }] },
7333
+ { type: "error", name: "OnlyEraSupported", inputs: [] },
7334
+ { type: "error", name: "OnlySelfAllowed", inputs: [] },
7335
+ { type: "error", name: "OperationExists", inputs: [] },
7336
+ { type: "error", name: "OperationMustBePending", inputs: [] },
7337
+ { type: "error", name: "OperationMustBeReady", inputs: [] },
7338
+ { type: "error", name: "OriginChainIdNotFound", inputs: [] },
7339
+ {
7340
+ type: "error",
7341
+ name: "PrecommitmentMismatch",
7342
+ inputs: [
7343
+ { name: "batchNumber", type: "uint256" },
7344
+ { name: "expected", type: "bytes32" },
7345
+ { name: "found", type: "bytes32" }
7346
+ ]
7347
+ },
7348
+ { type: "error", name: "PreviousOperationNotExecuted", inputs: [] },
7349
+ { type: "error", name: "PriorityOperationsRollingHashMismatch", inputs: [] },
7350
+ { type: "error", name: "PriorityTxPubdataExceedsMaxPubDataPerBatch", inputs: [] },
7351
+ {
7352
+ type: "error",
7353
+ name: "ProtocolIdMismatch",
7354
+ inputs: [
7355
+ { name: "expectedProtocolVersion", type: "uint256" },
7356
+ { name: "providedProtocolId", type: "uint256" }
7357
+ ]
7358
+ },
7359
+ { type: "error", name: "ProtocolIdNotGreater", inputs: [] },
7360
+ {
7361
+ type: "error",
7362
+ name: "PubdataGreaterThanLimit",
7363
+ inputs: [
7364
+ { name: "limit", type: "uint256" },
7365
+ { name: "length", type: "uint256" }
7366
+ ]
7367
+ },
7368
+ { type: "error", name: "QueueIsEmpty", inputs: [] },
7369
+ { type: "error", name: "Reentrancy", inputs: [] },
7370
+ {
7371
+ type: "error",
7372
+ name: "RemoveFunctionFacetAddressNotZero",
7373
+ inputs: [{ name: "facet", type: "address" }]
7374
+ },
7375
+ { type: "error", name: "RemoveFunctionFacetAddressZero", inputs: [] },
7376
+ { type: "error", name: "RemovingPermanentRestriction", inputs: [] },
7377
+ { type: "error", name: "ReplaceFunctionFacetAddressZero", inputs: [] },
7378
+ {
7379
+ type: "error",
7380
+ name: "RestrictionWasAlreadyPresent",
7381
+ inputs: [{ name: "restriction", type: "address" }]
7382
+ },
7383
+ {
7384
+ type: "error",
7385
+ name: "RestrictionWasNotPresent",
7386
+ inputs: [{ name: "restriction", type: "address" }]
7387
+ },
7388
+ { type: "error", name: "RevertedBatchNotAfterNewLastBatch", inputs: [] },
7389
+ {
7390
+ type: "error",
7391
+ name: "RoleAccessDenied",
7392
+ inputs: [
7393
+ { name: "chainAddress", type: "address" },
7394
+ { name: "role", type: "bytes32" },
7395
+ { name: "account", type: "address" }
7396
+ ]
7397
+ },
7398
+ { type: "error", name: "SelectorsMustAllHaveSameFreezability", inputs: [] },
7399
+ { type: "error", name: "SettlementLayersMustSettleOnL1", inputs: [] },
7400
+ { type: "error", name: "SharedBridgeNotSet", inputs: [] },
7401
+ { type: "error", name: "SharedBridgeValueNotSet", inputs: [{ name: "", type: "uint8" }] },
7402
+ { type: "error", name: "SlotOccupied", inputs: [] },
7403
+ { type: "error", name: "SystemLogsSizeTooBig", inputs: [] },
7404
+ {
7405
+ type: "error",
7406
+ name: "TimeNotReached",
7407
+ inputs: [
7408
+ { name: "expectedTimestamp", type: "uint256" },
7409
+ { name: "actualTimestamp", type: "uint256" }
7410
+ ]
7411
+ },
7412
+ { type: "error", name: "TimerAlreadyStarted", inputs: [] },
7413
+ { type: "error", name: "TimestampError", inputs: [] },
7414
+ { type: "error", name: "TokenIsLegacy", inputs: [] },
7415
+ { type: "error", name: "TokenNotLegacy", inputs: [] },
7416
+ { type: "error", name: "TokenNotSupported", inputs: [{ name: "token", type: "address" }] },
7417
+ { type: "error", name: "TokensWithFeesNotSupported", inputs: [] },
7418
+ { type: "error", name: "TooHighDeploymentNonce", inputs: [] },
7419
+ { type: "error", name: "TooManyFactoryDeps", inputs: [] },
7420
+ { type: "error", name: "TooMuchGas", inputs: [] },
7421
+ { type: "error", name: "TransactionNotAllowed", inputs: [] },
7422
+ { type: "error", name: "TxHashMismatch", inputs: [] },
7423
+ { type: "error", name: "TxnBodyGasLimitNotEnoughGas", inputs: [] },
7424
+ {
7425
+ type: "error",
7426
+ name: "UnallowedImplementation",
7427
+ inputs: [{ name: "implementationHash", type: "bytes32" }]
7428
+ },
7429
+ { type: "error", name: "Unauthorized", inputs: [{ name: "caller", type: "address" }] },
7430
+ { type: "error", name: "UndefinedDiamondCutAction", inputs: [] },
7431
+ { type: "error", name: "UnexpectedSystemLog", inputs: [{ name: "logKey", type: "uint256" }] },
7432
+ { type: "error", name: "UnknownVerifierType", inputs: [] },
7433
+ {
7434
+ type: "error",
7435
+ name: "UnsupportedCommitBatchEncoding",
7436
+ inputs: [{ name: "version", type: "uint8" }]
7437
+ },
7438
+ { type: "error", name: "UnsupportedEncodingVersion", inputs: [] },
7439
+ {
7440
+ type: "error",
7441
+ name: "UnsupportedExecuteBatchEncoding",
7442
+ inputs: [{ name: "version", type: "uint8" }]
7443
+ },
7444
+ {
7445
+ type: "error",
7446
+ name: "UnsupportedProofBatchEncoding",
7447
+ inputs: [{ name: "version", type: "uint8" }]
7448
+ },
7449
+ { type: "error", name: "UpgradeBatchNumberIsNotZero", inputs: [] },
7450
+ { type: "error", name: "ValidateTxnNotEnoughGas", inputs: [] },
7451
+ {
7452
+ type: "error",
7453
+ name: "ValueMismatch",
7454
+ inputs: [
7455
+ { name: "expected", type: "uint256" },
7456
+ { name: "actual", type: "uint256" }
7457
+ ]
7458
+ },
7459
+ { type: "error", name: "VerifiedBatchesExceedsCommittedBatches", inputs: [] },
7460
+ { type: "error", name: "WithdrawalAlreadyFinalized", inputs: [] },
7461
+ { type: "error", name: "WithdrawFailed", inputs: [] },
7462
+ { type: "error", name: "WrappedBaseTokenAlreadyRegistered", inputs: [] },
7463
+ {
7464
+ type: "error",
7465
+ name: "WrongMagicValue",
7466
+ inputs: [
7467
+ { name: "expectedMagicValue", type: "uint256" },
7468
+ { name: "providedMagicValue", type: "uint256" }
7469
+ ]
7470
+ },
7471
+ { type: "error", name: "ZeroAddress", inputs: [] },
7472
+ { type: "error", name: "ZeroChainId", inputs: [] },
7473
+ { type: "error", name: "ZKChainLimitReached", inputs: [] }
7474
+ ];
7475
+ var IL1ContractErrors_default = IL1ContractErrorsABI;
7476
+
6767
7477
  // src/core/types/primitives.ts
6768
7478
  var ZERO_HASH = "0x0000000000000000000000000000000000000000000000000000000000000000";
6769
7479
 
@@ -6873,6 +7583,14 @@ var IFACE_PANIC = new ethers.Interface(["error Panic(uint256)"]);
6873
7583
  ERROR_IFACES.push({ name: "Mailbox", iface: new ethers.Interface(Mailbox_default) });
6874
7584
  } catch {
6875
7585
  }
7586
+ try {
7587
+ ERROR_IFACES.push({ name: "IL1ContractErrors", iface: new ethers.Interface(IL1ContractErrors_default) });
7588
+ } catch {
7589
+ }
7590
+ try {
7591
+ ERROR_IFACES.push({ name: "IInteropErrors", iface: new ethers.Interface(IInteropErrors_default) });
7592
+ } catch {
7593
+ }
6876
7594
  })();
6877
7595
  function registerErrorAbi(name, abi2) {
6878
7596
  const existing = ERROR_IFACES.findIndex((x) => x.name === name);
@@ -7500,6 +8218,8 @@ async function quoteL2BaseCost2(input) {
7500
8218
  }
7501
8219
 
7502
8220
  // src/adapters/ethers/resources/deposits/services/gas.ts
8221
+ var DEFAULT_SAFE_NONBASE_L2_GAS_LIMIT = 3000000n;
8222
+ var ZERO_L2_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
7503
8223
  async function quoteL1Gas2(input) {
7504
8224
  const { ctx, tx, overrides, fallbackGasLimit } = input;
7505
8225
  const estimator = ethersToGasEstimator(ctx.client.l1);
@@ -7523,24 +8243,24 @@ async function quoteL2Gas2(input) {
7523
8243
  stateOverrides: input.stateOverrides
7524
8244
  });
7525
8245
  }
7526
- async function determineErc20L2Gas(input) {
7527
- const { ctx, l1Token } = input;
7528
- const DEFAULT_SAFE_L2_GAS_LIMIT = 3000000n;
8246
+ async function determineNonBaseL2Gas(input) {
8247
+ const { ctx, l1Token, route } = input;
8248
+ const fallbackQuote = () => quoteL2Gas2({
8249
+ ctx,
8250
+ route,
8251
+ overrideGasLimit: DEFAULT_SAFE_NONBASE_L2_GAS_LIMIT
8252
+ });
7529
8253
  if (ctx.l2GasLimit != null) {
7530
8254
  return quoteL2Gas2({
7531
8255
  ctx,
7532
- route: "erc20-nonbase",
8256
+ route,
7533
8257
  overrideGasLimit: ctx.l2GasLimit
7534
8258
  });
7535
8259
  }
7536
8260
  try {
7537
- const l2TokenAddress = ctx.tokens ? await ctx.tokens.toL2Address(l1Token) : await (await ctx.contracts.l2NativeTokenVault()).l2TokenAddress(l1Token);
7538
- if (l2TokenAddress === "0x0000000000000000000000000000000000000000") {
7539
- return quoteL2Gas2({
7540
- ctx,
7541
- route: "erc20-nonbase",
7542
- overrideGasLimit: DEFAULT_SAFE_L2_GAS_LIMIT
7543
- });
8261
+ const l2TokenAddress = input.knownL2Token ?? (ctx.tokens ? await ctx.tokens.toL2Address(l1Token) : await (await ctx.contracts.l2NativeTokenVault()).l2TokenAddress(l1Token));
8262
+ if (l2TokenAddress === ZERO_L2_TOKEN_ADDRESS) {
8263
+ return fallbackQuote();
7544
8264
  }
7545
8265
  const modelTx = {
7546
8266
  to: input.modelTx?.to ?? ctx.sender,
@@ -7550,26 +8270,34 @@ async function determineErc20L2Gas(input) {
7550
8270
  };
7551
8271
  const gas = await quoteL2Gas2({
7552
8272
  ctx,
7553
- route: "erc20-nonbase",
8273
+ route,
7554
8274
  l2TxForModeling: modelTx
7555
8275
  });
7556
- if (!gas) {
7557
- return quoteL2Gas2({
7558
- ctx,
7559
- route: "erc20-nonbase",
7560
- overrideGasLimit: DEFAULT_SAFE_L2_GAS_LIMIT
7561
- });
8276
+ if (!gas || gas.gasLimit === 0n) {
8277
+ return fallbackQuote();
7562
8278
  }
7563
8279
  return gas;
7564
8280
  } catch (err) {
7565
- console.warn("Failed to determine ERC20 L2 gas; defaulting to safe gas limit.", err);
7566
- return quoteL2Gas2({
7567
- ctx,
7568
- route: "erc20-nonbase",
7569
- overrideGasLimit: DEFAULT_SAFE_L2_GAS_LIMIT
7570
- });
8281
+ console.warn("Failed to determine non-base deposit L2 gas; defaulting to safe gas limit.", err);
8282
+ return fallbackQuote();
7571
8283
  }
7572
8284
  }
8285
+ async function determineErc20L2Gas(input) {
8286
+ return determineNonBaseL2Gas({
8287
+ ...input,
8288
+ route: "erc20-nonbase",
8289
+ knownL2Token: input.ctx.resolvedToken?.l2
8290
+ });
8291
+ }
8292
+ async function determineEthNonBaseL2Gas(input) {
8293
+ return determineNonBaseL2Gas({
8294
+ ctx: input.ctx,
8295
+ route: "eth-nonbase",
8296
+ l1Token: input.ctx.resolvedToken?.l1 ?? FORMAL_ETH_ADDRESS,
8297
+ knownL2Token: input.ctx.resolvedToken?.l2,
8298
+ modelTx: input.modelTx
8299
+ });
8300
+ }
7573
8301
 
7574
8302
  // src/core/resources/deposits/fee.ts
7575
8303
  function buildFeeBreakdown(p) {
@@ -7884,11 +8612,9 @@ function routeEthNonBase() {
7884
8612
  data: "0x",
7885
8613
  value: 0n
7886
8614
  };
7887
- const l2GasParams = await quoteL2Gas2({
8615
+ const l2GasParams = await determineEthNonBaseL2Gas({
7888
8616
  ctx,
7889
- route: "eth-nonbase",
7890
- l2TxForModeling: l2TxModel,
7891
- overrideGasLimit: ctx.l2GasLimit
8617
+ modelTx: l2TxModel
7892
8618
  });
7893
8619
  if (!l2GasParams) throw new Error("Failed to estimate L2 gas parameters.");
7894
8620
  const baseCost = await quoteL2BaseCost2({ ctx, l2GasLimit: l2GasParams.gasLimit });
@@ -7908,7 +8634,7 @@ function routeEthNonBase() {
7908
8634
  if (allowance < mintValue) {
7909
8635
  approvals.push({ token: baseToken, spender: ctx.l1AssetRouter, amount: mintValue });
7910
8636
  steps.push({
7911
- key: `approve:${baseToken}`,
8637
+ key: `approve:${baseToken}:${ctx.l1AssetRouter}`,
7912
8638
  kind: "approve",
7913
8639
  description: `Approve base token for fees (mintValue)`,
7914
8640
  tx: {
@@ -9115,7 +9841,7 @@ function createFinalizationServices(client) {
9115
9841
  chainId: BigInt(chainId),
9116
9842
  l2BatchNumber: proof.batchNumber,
9117
9843
  l2MessageIndex: proof.id,
9118
- l2Sender: L2_ASSET_ROUTER_ADDRESS,
9844
+ l2Sender: parsed.to,
9119
9845
  l2TxNumberInBatch: txIndex,
9120
9846
  message,
9121
9847
  merkleProof: proof.proof
@@ -10833,17 +11559,20 @@ function createInteropResource(client, tokens, contracts, attributes) {
10833
11559
  }
10834
11560
  } catch (e) {
10835
11561
  if (isZKsyncError(e)) throw e;
10836
- throw createError("EXECUTION", {
10837
- resource: "interop",
10838
- operation: "interop.create.sendTransaction",
10839
- message: "Failed to send or confirm an interop transaction step.",
10840
- context: {
10841
- step: step.key,
10842
- txHash: hash,
10843
- nonce: Number(step.tx.nonce ?? -1)
11562
+ throw toZKsyncError(
11563
+ "EXECUTION",
11564
+ {
11565
+ resource: "interop",
11566
+ operation: "interop.create.sendTransaction",
11567
+ message: "Failed to send or confirm an interop transaction step.",
11568
+ context: {
11569
+ step: step.key,
11570
+ txHash: hash,
11571
+ nonce: Number(step.tx.nonce ?? -1)
11572
+ }
10844
11573
  },
10845
- cause: e
10846
- });
11574
+ e
11575
+ );
10847
11576
  }
10848
11577
  }
10849
11578
  const last = Object.values(stepHashes).pop();