Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sdk): Add missing message status index #6254

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bright-mayflies-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/sdk': patch
---

Fixed missing indexes for multicall support
55 changes: 40 additions & 15 deletions packages/sdk/src/cross-chain-messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1563,9 +1563,17 @@ export class CrossChainMessenger {
opts?: {
signer?: Signer
overrides?: Overrides
}
},
/**
* The index of the withdrawal if multiple are made with multicall
roninjin10 marked this conversation as resolved.
Show resolved Hide resolved
*/
messageIndex: number = 0
): Promise<TransactionResponse> {
const tx = await this.populateTransaction.proveMessage(message, opts)
const tx = await this.populateTransaction.proveMessage(
message,
opts,
messageIndex
)
return (opts?.signer || this.l1Signer).sendTransaction(tx)
}

Expand All @@ -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<TransactionResponse> {
return (opts?.signer || this.l1Signer).sendTransaction(
await this.populateTransaction.finalizeMessage(message, opts)
await this.populateTransaction.finalizeMessage(
message,
opts,
messageIndex
)
)
}

Expand Down Expand Up @@ -1810,7 +1826,6 @@ export class CrossChainMessenger {
opts?: {
overrides?: Overrides
},

/**
* The index of the withdrawal if multiple are made with multicall
*/
Expand All @@ -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,
Expand Down Expand Up @@ -1861,7 +1880,6 @@ export class CrossChainMessenger {
opts?: {
overrides?: PayableOverrides
},

/**
* The index of the withdrawal if multiple are made with multicall
*/
Expand Down Expand Up @@ -1921,7 +1939,6 @@ export class CrossChainMessenger {
opts?: {
overrides?: PayableOverrides
},

/**
* The index of the withdrawal if multiple are made with multicall
*/
Expand Down Expand Up @@ -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<BigNumber> => {
return this.l1Provider.estimateGas(
await this.populateTransaction.finalizeMessage(message, opts)
await this.populateTransaction.finalizeMessage(
message,
opts,
messageIndex
)
)
},

Expand Down