From a666c4f2082253abbb68c0678e5a0a1ed0c00f4b Mon Sep 17 00:00:00 2001 From: Will Cory Date: Tue, 11 Jul 2023 07:54:33 -0700 Subject: [PATCH] fix(sdk): Add missing message statuses --- .changeset/bright-mayflies-jog.md | 5 +++ packages/sdk/src/cross-chain-messenger.ts | 55 ++++++++++++++++------- 2 files changed, 45 insertions(+), 15 deletions(-) create mode 100644 .changeset/bright-mayflies-jog.md diff --git a/.changeset/bright-mayflies-jog.md b/.changeset/bright-mayflies-jog.md new file mode 100644 index 000000000000..d2d1e2db0abe --- /dev/null +++ b/.changeset/bright-mayflies-jog.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/sdk': patch +--- + +Fixed missing indexes for multicall support diff --git a/packages/sdk/src/cross-chain-messenger.ts b/packages/sdk/src/cross-chain-messenger.ts index 5edae66822f3..b498a8f9869d 100644 --- a/packages/sdk/src/cross-chain-messenger.ts +++ b/packages/sdk/src/cross-chain-messenger.ts @@ -1563,9 +1563,17 @@ export class CrossChainMessenger { opts?: { signer?: Signer overrides?: Overrides - } + }, + /** + * The index of the withdrawal if multiple are made with multicall + */ + messageIndex: number = 0 ): Promise { - const tx = await this.populateTransaction.proveMessage(message, opts) + const tx = await this.populateTransaction.proveMessage( + message, + opts, + messageIndex + ) return (opts?.signer || this.l1Signer).sendTransaction(tx) } @@ -1584,10 +1592,18 @@ export class CrossChainMessenger { opts?: { signer?: Signer overrides?: PayableOverrides - } + }, + /** + * The index of the withdrawal if multiple are made with multicall + */ + messageIndex = 0 ): Promise { return (opts?.signer || this.l1Signer).sendTransaction( - await this.populateTransaction.finalizeMessage(message, opts) + await this.populateTransaction.finalizeMessage( + message, + opts, + messageIndex + ) ) } @@ -1810,7 +1826,6 @@ export class CrossChainMessenger { opts?: { overrides?: Overrides }, - /** * The index of the withdrawal if multiple are made with multicall */ @@ -1822,13 +1837,17 @@ export class CrossChainMessenger { } if (this.bedrock) { - return this.populateTransaction.finalizeMessage(resolved, { - ...(opts || {}), - overrides: { - ...opts?.overrides, - gasLimit: messageGasLimit, + return this.populateTransaction.finalizeMessage( + resolved, + { + ...(opts || {}), + overrides: { + ...opts?.overrides, + gasLimit: messageGasLimit, + }, }, - }) + messageIndex + ) } else { const legacyL1XDM = new ethers.Contract( this.contracts.l1.L1CrossDomainMessenger.address, @@ -1861,7 +1880,6 @@ export class CrossChainMessenger { opts?: { overrides?: PayableOverrides }, - /** * The index of the withdrawal if multiple are made with multicall */ @@ -1921,7 +1939,6 @@ export class CrossChainMessenger { opts?: { overrides?: PayableOverrides }, - /** * The index of the withdrawal if multiple are made with multicall */ @@ -2229,10 +2246,18 @@ export class CrossChainMessenger { message: MessageLike, opts?: { overrides?: CallOverrides - } + }, + /** + * The index of the withdrawal if multiple are made with multicall + */ + messageIndex = 0 ): Promise => { return this.l1Provider.estimateGas( - await this.populateTransaction.finalizeMessage(message, opts) + await this.populateTransaction.finalizeMessage( + message, + opts, + messageIndex + ) ) },