Skip to content

Commit

Permalink
chore: tweak proveWithdrawal.md
Browse files Browse the repository at this point in the history
Co-Authored-By: =?UTF-8?q?Daniel=20Sim=C3=A3o?= <rui.daniel.simao@gmail.com>
  • Loading branch information
jxom and danielsimao committed May 19, 2024
1 parent fba3bde commit 3c77ffe
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions site/pages/op-stack/actions/proveWithdrawal.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Internally performs a contract write to the [`proveWithdrawalTransaction` functi
:::code-group

```ts [example.ts]
import { account, publicClientL2, walletClientL1 } from './config'
import { account, publicClientL1, publicClientL2, walletClientL1 } from './config'

const receipt = await getTransactionReceipt(publicClientL2, {
hash: '0xbbdd0957a82a057a76b5f093de251635ac4ddc6e2d0c4aa7fbf82d73e4e11039',
})

const [withdrawal] = getWithdrawals(receipt)
const output = await walletClientL1.getL2Output({
const output = await publicClientL1.getL2Output({
l2BlockNumber: receipt.blockNumber,
targetChain: publicClientL2.chain,
})
Expand All @@ -39,7 +39,12 @@ const hash = await walletClientL1.proveWithdrawal(args) // [!code hl]
import { createPublicClient, createWalletClient, custom, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { mainnet, optimism } from 'viem/chains'
import { publicActionsL2, walletActionsL1 } from 'viem/op-stack'
import { publicActionsL1, publicActionsL2, walletActionsL1 } from 'viem/op-stack'

export const publicClientL1 = createPublicClient({
chain: optimism,
transport: http()
}).extend(publicActionsL1())

export const walletClientL1 = createWalletClient({
chain: mainnet,
Expand Down

0 comments on commit 3c77ffe

Please sign in to comment.