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

Update documentation example #152

Merged
merged 1 commit into from
Oct 26, 2023
Merged
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
14 changes: 9 additions & 5 deletions site/docs/actions/wallet/L1/writeContractDeposit.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@
Creates an L1 to L2 transaction by depositing into a contract on L2. This function serves as a specialized version of Viem's `writeContract`, adapted for L1 -> L2 transactions.

```ts [example.ts]
import { baseAddresses } from 'op-viem/chains'
import { erc721ABI } from 'wagmi'
import { writeContractDeposit } from 'your-library'
import { walletClient } from 'your-library-client-setup'
import { baseAddresses } from 'your-library/chains'

import { createWalletClient } from 'viem'

const walletClient = createWalletClient({
chain: mainnet,
transport: http(),
}).extend(walletL1OpStackActions)

const txHash = await writeContractDeposit(walletClient, {
abi: erc721ABI,
address: '0x6171f829e107f70b58d67594c6b62a7d3eb7f23b',
functionName: 'approve',
args: ['0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', 2048n],
account: '0xYourAccountAddress',
l2GasLimit: 100000n,
...baseAddresses,
})
Expand Down Expand Up @@ -49,7 +53,7 @@ The contract function name to call on L2.

The arguments to pass to the function. Must match the function signature.

### account
### account (Optional)

- **Type:** `Account | Address`

Expand Down
Loading