@matterlabs/zksync-js 0.0.19 → 0.0.21

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.
@@ -1,5 +1,5 @@
1
1
  export { pickDepositRoute } from '../chunk-TYYUG5GA.js';
2
- export { findL1MessageSentLog, isL1MessageSentLog, messengerLogIndex, pickWithdrawRoute } from '../chunk-3HHUZXSV.js';
2
+ export { findL1MessageSentLog, isL1MessageSentLog, l1MessageSentSender, messengerLogIndex, pickWithdrawRoute } from '../chunk-LGTYM5XP.js';
3
3
  export { makeTransportFromEthers, makeTransportFromViem } from '../chunk-BWKWWLY4.js';
4
4
  export { abi_exports as abi, factory_exports as errors, formatEnvelopePretty, hexEq, isAddress, isAddressEq, isETH, isHash, isHash66, isHash66Array, isHashArray, normalizeAddrEq, normalizeL1Token, zks_exports as zksRpc } from '../chunk-UEKFQAOS.js';
5
5
  export { ETH_ADDRESS, FORMAL_ETH_ADDRESS, L1_MESSENGER_ADDRESS, L1_SOPH_TOKEN_ADDRESS, L2_ASSET_ROUTER_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS } from '../chunk-MT4X5FEO.js';
@@ -0,0 +1,5 @@
1
+ import type { FinalizeReadiness, WithdrawalPhase } from '../../types/flows/withdrawals';
2
+ export declare function phaseFromReadiness(r: FinalizeReadiness): {
3
+ phase: WithdrawalPhase;
4
+ reason?: string;
5
+ };
@@ -53,12 +53,13 @@ export type WithdrawalKey = {
53
53
  l2BatchNumber: bigint;
54
54
  l2MessageIndex: bigint;
55
55
  };
56
- type WithdrawalPhase = 'L2_PENDING' | 'L2_INCLUDED' | 'PENDING' | 'READY_TO_FINALIZE' | 'FINALIZING' | 'FINALIZED' | 'FINALIZE_FAILED' | 'UNKNOWN';
56
+ export type WithdrawalPhase = 'L2_PENDING' | 'L2_INCLUDED' | 'PENDING' | 'READY_TO_FINALIZE' | 'FINALIZING' | 'FINALIZED' | 'FINALIZE_FAILED' | 'UNFINALIZABLE' | 'UNKNOWN';
57
57
  export type WithdrawalStatus = {
58
58
  phase: WithdrawalPhase;
59
59
  l2TxHash: Hex;
60
60
  l1FinalizeTxHash?: Hex;
61
61
  key?: WithdrawalKey;
62
+ reason?: string;
62
63
  };
63
64
  export type FinalizeReadiness = {
64
65
  kind: 'READY';
@@ -78,4 +79,3 @@ export interface FinalizationEstimate {
78
79
  maxFeePerGas: bigint;
79
80
  maxPriorityFeePerGas: bigint;
80
81
  }
81
- export {};
@@ -1,4 +1,5 @@
1
1
  import type { Log, TxReceipt } from '../types/transactions';
2
+ import type { Address } from '../types/primitives';
2
3
  type Prefer = 'messenger' | 'assetRouter' | {
3
4
  address: string;
4
5
  };
@@ -9,4 +10,5 @@ export declare function findL1MessageSentLog(receipt: TxReceipt, opts?: {
9
10
  export declare function isL1MessageSentLog(log: Log, opts?: {
10
11
  prefer?: Prefer;
11
12
  }): boolean;
13
+ export declare function l1MessageSentSender(log: Log): Address;
12
14
  export {};
package/dist/index.cjs CHANGED
@@ -7432,6 +7432,14 @@ function isL1MessageSentLog(log, opts) {
7432
7432
  const preferAddr = extractPreferAddress(opts);
7433
7433
  return log.address.toLowerCase() === preferAddr && (topic === TOPIC_L1_MESSAGE_SENT_LEG.toLowerCase() || topic === TOPIC_L1_MESSAGE_SENT_NEW.toLowerCase());
7434
7434
  }
7435
+ var SENDER_TOPIC = /^0x0{24}([0-9a-fA-F]{40})$/;
7436
+ function l1MessageSentSender(log) {
7437
+ const sender = SENDER_TOPIC.exec(log.topics?.[1] ?? "")?.[1];
7438
+ if (!sender) {
7439
+ throw new Error("L1MessageSent log has no valid sender topic.");
7440
+ }
7441
+ return `0x${sender.toLowerCase()}`;
7442
+ }
7435
7443
 
7436
7444
  // src/core/resources/withdrawals/logs.ts
7437
7445
  function messengerLogIndex(raw, opts) {
@@ -7459,6 +7467,7 @@ exports.isHash66 = isHash66;
7459
7467
  exports.isHash66Array = isHash66Array;
7460
7468
  exports.isHashArray = isHashArray;
7461
7469
  exports.isL1MessageSentLog = isL1MessageSentLog;
7470
+ exports.l1MessageSentSender = l1MessageSentSender;
7462
7471
  exports.makeTransportFromEthers = makeTransportFromEthers;
7463
7472
  exports.makeTransportFromViem = makeTransportFromViem;
7464
7473
  exports.messengerLogIndex = messengerLogIndex;