From e6dbe8f502c8d71642f3194b12a6b095b8d755c7 Mon Sep 17 00:00:00 2001 From: tre Date: Fri, 25 Oct 2024 17:27:30 -0700 Subject: [PATCH] feat(viem): add withdrawSuperchainWETH --- .changeset/fluffy-wombats-drive.md | 5 + packages/viem/docs/README.md | 7 + .../docs/functions/createInteropMessage.md | 2 +- .../createInteropSentL2ToL2Messages.md | 2 +- .../docs/functions/decodeExecutingMessages.md | 2 +- .../functions/decodeRelayedL2ToL2Messages.md | 2 +- .../functions/decodeSentL2ToL2Messages.md | 2 +- .../docs/functions/depositSuperchainWETH.md | 2 +- .../estimateDepositSuperchainWETHGas.md | 2 +- .../estimateRelayL2ToL2MessageGas.md | 2 +- .../functions/estimateSendL2ToL2MessageGas.md | 2 +- .../docs/functions/estimateSendSupERC20Gas.md | 2 +- .../estimateSendSuperchainWETHGas.md | 2 +- .../estimateWithdrawSuperchainWETHGas.md | 39 +++++ .../viem/docs/functions/relayL2ToL2Message.md | 2 +- .../viem/docs/functions/sendL2ToL2Message.md | 2 +- packages/viem/docs/functions/sendSupERC20.md | 2 +- .../viem/docs/functions/sendSuperchainWETH.md | 2 +- .../simulateDepositSuperchainWETH.md | 2 +- .../functions/simulateRelayL2ToL2Message.md | 2 +- .../functions/simulateSendL2ToL2Message.md | 2 +- .../docs/functions/simulateSendSupERC20.md | 2 +- .../functions/simulateSendSuperchainWETH.md | 2 +- .../simulateWithdrawSuperchainWETH.md | 39 +++++ .../docs/functions/withdrawSuperchainWETH.md | 39 +++++ .../CreateInteropMessageParameters.md | 2 +- .../CreateInteropMessageReturnType.md | 2 +- ...eateInteropSentL2ToL2MessagesParameters.md | 2 +- ...eateInteropSentL2ToL2MessagesReturnType.md | 2 +- .../DecodeExecutingMessagesParameters.md | 2 +- .../DecodeExecutingMessagesReturnType.md | 2 +- .../DecodeRelayedL2ToL2MessagesParameters.md | 2 +- .../DecodeRelayedL2ToL2MessagesReturnType.md | 2 +- .../DecodeSentL2ToL2MessagesParameters.md | 2 +- .../DecodeSentL2ToL2MessagesReturnType.md | 2 +- ...DepositSuperchainWETHContractReturnType.md | 2 +- .../DepositSuperchainWETHErrorType.md | 2 +- .../DepositSuperchainWETHParameters.md | 2 +- .../DepositSuperchainWETHReturnType.md | 2 +- .../docs/type-aliases/MessageIdentifier.md | 2 +- .../RelayL2ToL2MessageContractReturnType.md | 2 +- .../RelayL2ToL2MessageErrorType.md | 2 +- .../RelayL2ToL2MessageParameters.md | 2 +- .../RelayL2ToL2MessageReturnType.md | 2 +- .../SendL2ToL2MessageContractReturnType.md | 2 +- .../SendL2ToL2MessageErrorType.md | 2 +- .../SendL2ToL2MessageParameters.md | 2 +- .../SendL2ToL2MessageReturnType.md | 2 +- .../SendSupERC20ContractReturnType.md | 2 +- .../type-aliases/SendSupERC20ErrorType.md | 2 +- .../type-aliases/SendSupERC20Parameters.md | 2 +- .../type-aliases/SendSupERC20ReturnType.md | 2 +- .../SendSuperchainWETHParameters.md | 2 +- ...ithdrawSuperchainWETHContractReturnType.md | 13 ++ .../WithdrawSuperchainWETHErrorType.md | 13 ++ .../WithdrawSuperchainWETHParameters.md | 31 ++++ .../WithdrawSuperchainWETHReturnType.md | 13 ++ packages/viem/docs/variables/contracts.md | 2 +- .../viem/docs/variables/crossL2InboxABI.md | 2 +- .../l2ToL2CrossDomainMessengerABI.md | 2 +- .../viem/docs/variables/superchainERC20ABI.md | 2 +- .../variables/superchainTokenBridgeABI.md | 2 +- .../viem/docs/variables/superchainWETHABI.md | 2 +- packages/viem/docs/variables/supersimL1.md | 2 +- packages/viem/docs/variables/supersimL2A.md | 2 +- packages/viem/docs/variables/supersimL2B.md | 2 +- .../actions/withdrawSuperchainWETH.spec.ts | 77 +++++++++ .../src/actions/withdrawSuperchainWETH.ts | 150 ++++++++++++++++++ packages/viem/src/decorators/publicL2.ts | 30 ++++ packages/viem/src/decorators/walletL2.ts | 9 ++ packages/viem/src/index.ts | 11 ++ packages/viem/src/test/e2e/interop.spec.ts | 28 +++- 72 files changed, 557 insertions(+), 61 deletions(-) create mode 100644 .changeset/fluffy-wombats-drive.md create mode 100644 packages/viem/docs/functions/estimateWithdrawSuperchainWETHGas.md create mode 100644 packages/viem/docs/functions/simulateWithdrawSuperchainWETH.md create mode 100644 packages/viem/docs/functions/withdrawSuperchainWETH.md create mode 100644 packages/viem/docs/type-aliases/WithdrawSuperchainWETHContractReturnType.md create mode 100644 packages/viem/docs/type-aliases/WithdrawSuperchainWETHErrorType.md create mode 100644 packages/viem/docs/type-aliases/WithdrawSuperchainWETHParameters.md create mode 100644 packages/viem/docs/type-aliases/WithdrawSuperchainWETHReturnType.md create mode 100644 packages/viem/src/actions/withdrawSuperchainWETH.spec.ts create mode 100644 packages/viem/src/actions/withdrawSuperchainWETH.ts diff --git a/.changeset/fluffy-wombats-drive.md b/.changeset/fluffy-wombats-drive.md new file mode 100644 index 00000000..13055e36 --- /dev/null +++ b/.changeset/fluffy-wombats-drive.md @@ -0,0 +1,5 @@ +--- +"@eth-optimism/viem": patch +--- + +add withdrawSuperchainWETH diff --git a/packages/viem/docs/README.md b/packages/viem/docs/README.md index fa00be08..baef03de 100644 --- a/packages/viem/docs/README.md +++ b/packages/viem/docs/README.md @@ -19,6 +19,7 @@ - [simulateSendL2ToL2Message](functions/simulateSendL2ToL2Message.md) - [simulateSendSupERC20](functions/simulateSendSupERC20.md) - [simulateSendSuperchainWETH](functions/simulateSendSuperchainWETH.md) +- [simulateWithdrawSuperchainWETH](functions/simulateWithdrawSuperchainWETH.md) ## L2 Wallet Actions @@ -28,10 +29,12 @@ - [estimateSendL2ToL2MessageGas](functions/estimateSendL2ToL2MessageGas.md) - [estimateSendSupERC20Gas](functions/estimateSendSupERC20Gas.md) - [estimateSendSuperchainWETHGas](functions/estimateSendSuperchainWETHGas.md) +- [estimateWithdrawSuperchainWETHGas](functions/estimateWithdrawSuperchainWETHGas.md) - [relayL2ToL2Message](functions/relayL2ToL2Message.md) - [sendL2ToL2Message](functions/sendL2ToL2Message.md) - [sendSupERC20](functions/sendSupERC20.md) - [sendSuperchainWETH](functions/sendSuperchainWETH.md) +- [withdrawSuperchainWETH](functions/withdrawSuperchainWETH.md) ## Other @@ -76,6 +79,10 @@ - [SendSupERC20Parameters](type-aliases/SendSupERC20Parameters.md) - [SendSupERC20ReturnType](type-aliases/SendSupERC20ReturnType.md) - [SendSuperchainWETHParameters](type-aliases/SendSuperchainWETHParameters.md) +- [WithdrawSuperchainWETHContractReturnType](type-aliases/WithdrawSuperchainWETHContractReturnType.md) +- [WithdrawSuperchainWETHErrorType](type-aliases/WithdrawSuperchainWETHErrorType.md) +- [WithdrawSuperchainWETHParameters](type-aliases/WithdrawSuperchainWETHParameters.md) +- [WithdrawSuperchainWETHReturnType](type-aliases/WithdrawSuperchainWETHReturnType.md) ## Utils diff --git a/packages/viem/docs/functions/createInteropMessage.md b/packages/viem/docs/functions/createInteropMessage.md index ccfdccaf..7c55c768 100644 --- a/packages/viem/docs/functions/createInteropMessage.md +++ b/packages/viem/docs/functions/createInteropMessage.md @@ -1375,4 +1375,4 @@ created interop message Message ## Defined in -[packages/viem/src/utils/interop.ts:32](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/interop.ts#L32) +[packages/viem/src/utils/interop.ts:32](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/interop.ts#L32) diff --git a/packages/viem/docs/functions/createInteropSentL2ToL2Messages.md b/packages/viem/docs/functions/createInteropSentL2ToL2Messages.md index 39299a82..88ce5b11 100644 --- a/packages/viem/docs/functions/createInteropSentL2ToL2Messages.md +++ b/packages/viem/docs/functions/createInteropSentL2ToL2Messages.md @@ -1375,4 +1375,4 @@ Decoded interop messages [CreateInteropSentL2ToL2MessagesReturnType](../type-ali ## Defined in -[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:60](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L60) +[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:60](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L60) diff --git a/packages/viem/docs/functions/decodeExecutingMessages.md b/packages/viem/docs/functions/decodeExecutingMessages.md index af4aba6c..fa2150fe 100644 --- a/packages/viem/docs/functions/decodeExecutingMessages.md +++ b/packages/viem/docs/functions/decodeExecutingMessages.md @@ -24,4 +24,4 @@ Decoded cross-chain calls [DecodeExecutingMessagesReturnType](../type-aliases/De ## Defined in -[packages/viem/src/utils/interop.ts:66](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/interop.ts#L66) +[packages/viem/src/utils/interop.ts:66](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/interop.ts#L66) diff --git a/packages/viem/docs/functions/decodeRelayedL2ToL2Messages.md b/packages/viem/docs/functions/decodeRelayedL2ToL2Messages.md index 5081ec8a..549d9557 100644 --- a/packages/viem/docs/functions/decodeRelayedL2ToL2Messages.md +++ b/packages/viem/docs/functions/decodeRelayedL2ToL2Messages.md @@ -24,4 +24,4 @@ Identified relayed messages [DecodeRelayedL2ToL2MessagesReturnType](../type-alia ## Defined in -[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:106](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L106) +[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:106](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L106) diff --git a/packages/viem/docs/functions/decodeSentL2ToL2Messages.md b/packages/viem/docs/functions/decodeSentL2ToL2Messages.md index b7de0be6..f0217366 100644 --- a/packages/viem/docs/functions/decodeSentL2ToL2Messages.md +++ b/packages/viem/docs/functions/decodeSentL2ToL2Messages.md @@ -24,4 +24,4 @@ Decoded cross-chain calls [DecodeSentL2ToL2MessagesReturnType](../type-aliases/D ## Defined in -[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:85](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L85) +[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:85](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L85) diff --git a/packages/viem/docs/functions/depositSuperchainWETH.md b/packages/viem/docs/functions/depositSuperchainWETH.md index 83262e88..6e6728cf 100644 --- a/packages/viem/docs/functions/depositSuperchainWETH.md +++ b/packages/viem/docs/functions/depositSuperchainWETH.md @@ -36,4 +36,4 @@ The depositSuperchainWETH transaction hash. [DepositSuperchainWETHReturnType](.. ## Defined in -[packages/viem/src/actions/depositSuperchainWETH.ts:64](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/depositSuperchainWETH.ts#L64) +[packages/viem/src/actions/depositSuperchainWETH.ts:64](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/depositSuperchainWETH.ts#L64) diff --git a/packages/viem/docs/functions/estimateDepositSuperchainWETHGas.md b/packages/viem/docs/functions/estimateDepositSuperchainWETHGas.md index 9bb17f40..d98b2356 100644 --- a/packages/viem/docs/functions/estimateDepositSuperchainWETHGas.md +++ b/packages/viem/docs/functions/estimateDepositSuperchainWETHGas.md @@ -36,4 +36,4 @@ The estimated gas value. ## Defined in -[packages/viem/src/actions/depositSuperchainWETH.ts:91](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/depositSuperchainWETH.ts#L91) +[packages/viem/src/actions/depositSuperchainWETH.ts:91](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/depositSuperchainWETH.ts#L91) diff --git a/packages/viem/docs/functions/estimateRelayL2ToL2MessageGas.md b/packages/viem/docs/functions/estimateRelayL2ToL2MessageGas.md index 13cf2d12..ba14db54 100644 --- a/packages/viem/docs/functions/estimateRelayL2ToL2MessageGas.md +++ b/packages/viem/docs/functions/estimateRelayL2ToL2MessageGas.md @@ -36,4 +36,4 @@ The estimated gas value. ## Defined in -[packages/viem/src/actions/relayL2ToL2Message.ts:103](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/relayL2ToL2Message.ts#L103) +[packages/viem/src/actions/relayL2ToL2Message.ts:103](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/relayL2ToL2Message.ts#L103) diff --git a/packages/viem/docs/functions/estimateSendL2ToL2MessageGas.md b/packages/viem/docs/functions/estimateSendL2ToL2MessageGas.md index 7f75f274..cc4c6f0e 100644 --- a/packages/viem/docs/functions/estimateSendL2ToL2MessageGas.md +++ b/packages/viem/docs/functions/estimateSendL2ToL2MessageGas.md @@ -36,4 +36,4 @@ The estimated gas value. ## Defined in -[packages/viem/src/actions/sendL2ToL2Message.ts:105](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendL2ToL2Message.ts#L105) +[packages/viem/src/actions/sendL2ToL2Message.ts:105](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendL2ToL2Message.ts#L105) diff --git a/packages/viem/docs/functions/estimateSendSupERC20Gas.md b/packages/viem/docs/functions/estimateSendSupERC20Gas.md index 03d471f3..d6fd2b31 100644 --- a/packages/viem/docs/functions/estimateSendSupERC20Gas.md +++ b/packages/viem/docs/functions/estimateSendSupERC20Gas.md @@ -36,4 +36,4 @@ The estimated gas value. ## Defined in -[packages/viem/src/actions/sendSupERC20.ts:106](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendSupERC20.ts#L106) +[packages/viem/src/actions/sendSupERC20.ts:106](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendSupERC20.ts#L106) diff --git a/packages/viem/docs/functions/estimateSendSuperchainWETHGas.md b/packages/viem/docs/functions/estimateSendSuperchainWETHGas.md index 5c28d748..5d8f7aed 100644 --- a/packages/viem/docs/functions/estimateSendSuperchainWETHGas.md +++ b/packages/viem/docs/functions/estimateSendSuperchainWETHGas.md @@ -36,4 +36,4 @@ The estimated gas value. ## Defined in -[packages/viem/src/actions/sendSuperchainWETH.ts:74](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendSuperchainWETH.ts#L74) +[packages/viem/src/actions/sendSuperchainWETH.ts:74](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendSuperchainWETH.ts#L74) diff --git a/packages/viem/docs/functions/estimateWithdrawSuperchainWETHGas.md b/packages/viem/docs/functions/estimateWithdrawSuperchainWETHGas.md new file mode 100644 index 00000000..cbb36fd8 --- /dev/null +++ b/packages/viem/docs/functions/estimateWithdrawSuperchainWETHGas.md @@ -0,0 +1,39 @@ +[**@eth-optimism/viem**](../README.md) • **Docs** + +*** + +[@eth-optimism/viem](../README.md) / estimateWithdrawSuperchainWETHGas + +# estimateWithdrawSuperchainWETHGas() + +> **estimateWithdrawSuperchainWETHGas**\<`TChain`, `TAccount`, `TChainOverride`\>(`client`, `parameters`): `Promise`\<`bigint`\> + +Estimates gas for [withdrawSuperchainWETH](withdrawSuperchainWETH.md) + +## Type Parameters + +• **TChain** *extends* `undefined` \| `Chain` + +• **TAccount** *extends* `undefined` \| `Account` + +• **TChainOverride** *extends* `undefined` \| `Chain` = `undefined` + +## Parameters + +• **client**: `Client`\<`Transport`, `TChain`, `TAccount`\> + +L2 Wallet Client + +• **parameters**: [`WithdrawSuperchainWETHParameters`](../type-aliases/WithdrawSuperchainWETHParameters.md)\<`TChain`, `TAccount`, `TChainOverride`, `DeriveChain`\<`TChain`, `TChainOverride`\>\> + +[WithdrawSuperchainWETHParameters](../type-aliases/WithdrawSuperchainWETHParameters.md) + +## Returns + +`Promise`\<`bigint`\> + +The estimated gas value. + +## Defined in + +[packages/viem/src/actions/withdrawSuperchainWETH.ts:96](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/withdrawSuperchainWETH.ts#L96) diff --git a/packages/viem/docs/functions/relayL2ToL2Message.md b/packages/viem/docs/functions/relayL2ToL2Message.md index ddaa9c35..97e465e1 100644 --- a/packages/viem/docs/functions/relayL2ToL2Message.md +++ b/packages/viem/docs/functions/relayL2ToL2Message.md @@ -36,4 +36,4 @@ The relayMessage transaction hash. [RelayL2ToL2MessageReturnType](../type-aliase ## Defined in -[packages/viem/src/actions/relayL2ToL2Message.ts:74](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/relayL2ToL2Message.ts#L74) +[packages/viem/src/actions/relayL2ToL2Message.ts:74](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/relayL2ToL2Message.ts#L74) diff --git a/packages/viem/docs/functions/sendL2ToL2Message.md b/packages/viem/docs/functions/sendL2ToL2Message.md index 1c878376..96b1915d 100644 --- a/packages/viem/docs/functions/sendL2ToL2Message.md +++ b/packages/viem/docs/functions/sendL2ToL2Message.md @@ -36,4 +36,4 @@ The sendL2ToL2Message transaction hash. [SendL2ToL2MessageReturnType](../type-al ## Defined in -[packages/viem/src/actions/sendL2ToL2Message.ts:76](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendL2ToL2Message.ts#L76) +[packages/viem/src/actions/sendL2ToL2Message.ts:76](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendL2ToL2Message.ts#L76) diff --git a/packages/viem/docs/functions/sendSupERC20.md b/packages/viem/docs/functions/sendSupERC20.md index eca874b5..448be0d3 100644 --- a/packages/viem/docs/functions/sendSupERC20.md +++ b/packages/viem/docs/functions/sendSupERC20.md @@ -36,4 +36,4 @@ The sendSupERC20 transaction hash. [SendSupERC20ReturnType](../type-aliases/Send ## Defined in -[packages/viem/src/actions/sendSupERC20.ts:77](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendSupERC20.ts#L77) +[packages/viem/src/actions/sendSupERC20.ts:77](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendSupERC20.ts#L77) diff --git a/packages/viem/docs/functions/sendSuperchainWETH.md b/packages/viem/docs/functions/sendSuperchainWETH.md index 1e914c2c..a73491e1 100644 --- a/packages/viem/docs/functions/sendSuperchainWETH.md +++ b/packages/viem/docs/functions/sendSuperchainWETH.md @@ -36,4 +36,4 @@ The sendSuperchainWETH transaction hash. [SendSupERC20ReturnType](../type-aliase ## Defined in -[packages/viem/src/actions/sendSuperchainWETH.ts:53](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendSuperchainWETH.ts#L53) +[packages/viem/src/actions/sendSuperchainWETH.ts:53](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendSuperchainWETH.ts#L53) diff --git a/packages/viem/docs/functions/simulateDepositSuperchainWETH.md b/packages/viem/docs/functions/simulateDepositSuperchainWETH.md index f60e7622..f9f5e0d8 100644 --- a/packages/viem/docs/functions/simulateDepositSuperchainWETH.md +++ b/packages/viem/docs/functions/simulateDepositSuperchainWETH.md @@ -36,4 +36,4 @@ The contract functions return value. depositSuperchainWETHContractReturnType ## Defined in -[packages/viem/src/actions/depositSuperchainWETH.ts:115](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/depositSuperchainWETH.ts#L115) +[packages/viem/src/actions/depositSuperchainWETH.ts:115](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/depositSuperchainWETH.ts#L115) diff --git a/packages/viem/docs/functions/simulateRelayL2ToL2Message.md b/packages/viem/docs/functions/simulateRelayL2ToL2Message.md index 98dbe7bf..4ac00c0d 100644 --- a/packages/viem/docs/functions/simulateRelayL2ToL2Message.md +++ b/packages/viem/docs/functions/simulateRelayL2ToL2Message.md @@ -36,4 +36,4 @@ The contract functions return value. [RelayL2ToL2MessageContractReturnType](../t ## Defined in -[packages/viem/src/actions/relayL2ToL2Message.ts:129](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/relayL2ToL2Message.ts#L129) +[packages/viem/src/actions/relayL2ToL2Message.ts:129](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/relayL2ToL2Message.ts#L129) diff --git a/packages/viem/docs/functions/simulateSendL2ToL2Message.md b/packages/viem/docs/functions/simulateSendL2ToL2Message.md index 325bd71b..362db9e2 100644 --- a/packages/viem/docs/functions/simulateSendL2ToL2Message.md +++ b/packages/viem/docs/functions/simulateSendL2ToL2Message.md @@ -36,4 +36,4 @@ The contract functions return value. [SendL2ToL2MessageContractReturnType](../ty ## Defined in -[packages/viem/src/actions/sendL2ToL2Message.ts:131](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendL2ToL2Message.ts#L131) +[packages/viem/src/actions/sendL2ToL2Message.ts:131](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendL2ToL2Message.ts#L131) diff --git a/packages/viem/docs/functions/simulateSendSupERC20.md b/packages/viem/docs/functions/simulateSendSupERC20.md index 625ebdfa..ba921fa9 100644 --- a/packages/viem/docs/functions/simulateSendSupERC20.md +++ b/packages/viem/docs/functions/simulateSendSupERC20.md @@ -36,4 +36,4 @@ The contract functions return value. [SendSupERC20ContractReturnType](../type-al ## Defined in -[packages/viem/src/actions/sendSupERC20.ts:132](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendSupERC20.ts#L132) +[packages/viem/src/actions/sendSupERC20.ts:132](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendSupERC20.ts#L132) diff --git a/packages/viem/docs/functions/simulateSendSuperchainWETH.md b/packages/viem/docs/functions/simulateSendSuperchainWETH.md index ad9dcf3a..be6d6d10 100644 --- a/packages/viem/docs/functions/simulateSendSuperchainWETH.md +++ b/packages/viem/docs/functions/simulateSendSuperchainWETH.md @@ -36,4 +36,4 @@ The contract functions return value. [SendSupERC20ContractReturnType](../type-al ## Defined in -[packages/viem/src/actions/sendSuperchainWETH.ts:95](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendSuperchainWETH.ts#L95) +[packages/viem/src/actions/sendSuperchainWETH.ts:95](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendSuperchainWETH.ts#L95) diff --git a/packages/viem/docs/functions/simulateWithdrawSuperchainWETH.md b/packages/viem/docs/functions/simulateWithdrawSuperchainWETH.md new file mode 100644 index 00000000..88c136a2 --- /dev/null +++ b/packages/viem/docs/functions/simulateWithdrawSuperchainWETH.md @@ -0,0 +1,39 @@ +[**@eth-optimism/viem**](../README.md) • **Docs** + +*** + +[@eth-optimism/viem](../README.md) / simulateWithdrawSuperchainWETH + +# simulateWithdrawSuperchainWETH() + +> **simulateWithdrawSuperchainWETH**\<`TChain`, `TAccount`, `TChainOverride`\>(`client`, `parameters`): `Promise`\<[`WithdrawSuperchainWETHContractReturnType`](../type-aliases/WithdrawSuperchainWETHContractReturnType.md)\> + +Simulate contract call for [withdrawSuperchainWETH](withdrawSuperchainWETH.md) + +## Type Parameters + +• **TChain** *extends* `undefined` \| `Chain` + +• **TAccount** *extends* `undefined` \| `Account` + +• **TChainOverride** *extends* `undefined` \| `Chain` = `undefined` + +## Parameters + +• **client**: `Client`\<`Transport`, `TChain`, `TAccount`\> + +L2 Public Client + +• **parameters**: [`WithdrawSuperchainWETHParameters`](../type-aliases/WithdrawSuperchainWETHParameters.md)\<`TChain`, `TAccount`, `TChainOverride`, `DeriveChain`\<`TChain`, `TChainOverride`\>\> + +[WithdrawSuperchainWETHParameters](../type-aliases/WithdrawSuperchainWETHParameters.md) + +## Returns + +`Promise`\<[`WithdrawSuperchainWETHContractReturnType`](../type-aliases/WithdrawSuperchainWETHContractReturnType.md)\> + +The contract functions return value. withdrawSuperchainWETHContractReturnType + +## Defined in + +[packages/viem/src/actions/withdrawSuperchainWETH.ts:126](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/withdrawSuperchainWETH.ts#L126) diff --git a/packages/viem/docs/functions/withdrawSuperchainWETH.md b/packages/viem/docs/functions/withdrawSuperchainWETH.md new file mode 100644 index 00000000..64c728e8 --- /dev/null +++ b/packages/viem/docs/functions/withdrawSuperchainWETH.md @@ -0,0 +1,39 @@ +[**@eth-optimism/viem**](../README.md) • **Docs** + +*** + +[@eth-optimism/viem](../README.md) / withdrawSuperchainWETH + +# withdrawSuperchainWETH() + +> **withdrawSuperchainWETH**\<`chain`, `account`, `chainOverride`\>(`client`, `parameters`): `Promise`\<[`WithdrawSuperchainWETHReturnType`](../type-aliases/WithdrawSuperchainWETHReturnType.md)\> + +Deposits ETH to the SuperchainWETH contract. + +## Type Parameters + +• **chain** *extends* `undefined` \| `Chain` + +• **account** *extends* `undefined` \| `Account` + +• **chainOverride** *extends* `undefined` \| `Chain` = `undefined` + +## Parameters + +• **client**: `Client`\<`Transport`, `chain`, `account`\> + +L2 Wallet Client + +• **parameters**: [`WithdrawSuperchainWETHParameters`](../type-aliases/WithdrawSuperchainWETHParameters.md)\<`chain`, `account`, `chainOverride`, `DeriveChain`\<`chain`, `chainOverride`\>\> + +[WithdrawSuperchainWETHParameters](../type-aliases/WithdrawSuperchainWETHParameters.md) + +## Returns + +`Promise`\<[`WithdrawSuperchainWETHReturnType`](../type-aliases/WithdrawSuperchainWETHReturnType.md)\> + +The withdrawSuperchainWETH transaction hash. [WithdrawSuperchainWETHReturnType](../type-aliases/WithdrawSuperchainWETHReturnType.md) + +## Defined in + +[packages/viem/src/actions/withdrawSuperchainWETH.ts:67](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/withdrawSuperchainWETH.ts#L67) diff --git a/packages/viem/docs/type-aliases/CreateInteropMessageParameters.md b/packages/viem/docs/type-aliases/CreateInteropMessageParameters.md index 8a93bf46..2d982228 100644 --- a/packages/viem/docs/type-aliases/CreateInteropMessageParameters.md +++ b/packages/viem/docs/type-aliases/CreateInteropMessageParameters.md @@ -16,4 +16,4 @@ ## Defined in -[packages/viem/src/utils/interop.ts:15](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/interop.ts#L15) +[packages/viem/src/utils/interop.ts:15](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/interop.ts#L15) diff --git a/packages/viem/docs/type-aliases/CreateInteropMessageReturnType.md b/packages/viem/docs/type-aliases/CreateInteropMessageReturnType.md index 91461640..662dcd69 100644 --- a/packages/viem/docs/type-aliases/CreateInteropMessageReturnType.md +++ b/packages/viem/docs/type-aliases/CreateInteropMessageReturnType.md @@ -20,4 +20,4 @@ ## Defined in -[packages/viem/src/utils/interop.ts:16](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/interop.ts#L16) +[packages/viem/src/utils/interop.ts:16](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/interop.ts#L16) diff --git a/packages/viem/docs/type-aliases/CreateInteropSentL2ToL2MessagesParameters.md b/packages/viem/docs/type-aliases/CreateInteropSentL2ToL2MessagesParameters.md index 4121d8ac..1c6e4328 100644 --- a/packages/viem/docs/type-aliases/CreateInteropSentL2ToL2MessagesParameters.md +++ b/packages/viem/docs/type-aliases/CreateInteropSentL2ToL2MessagesParameters.md @@ -16,4 +16,4 @@ ## Defined in -[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:24](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L24) +[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:24](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L24) diff --git a/packages/viem/docs/type-aliases/CreateInteropSentL2ToL2MessagesReturnType.md b/packages/viem/docs/type-aliases/CreateInteropSentL2ToL2MessagesReturnType.md index ab1586c9..0895f108 100644 --- a/packages/viem/docs/type-aliases/CreateInteropSentL2ToL2MessagesReturnType.md +++ b/packages/viem/docs/type-aliases/CreateInteropSentL2ToL2MessagesReturnType.md @@ -16,4 +16,4 @@ ## Defined in -[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:27](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L27) +[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:27](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L27) diff --git a/packages/viem/docs/type-aliases/DecodeExecutingMessagesParameters.md b/packages/viem/docs/type-aliases/DecodeExecutingMessagesParameters.md index f20150cd..880a6de5 100644 --- a/packages/viem/docs/type-aliases/DecodeExecutingMessagesParameters.md +++ b/packages/viem/docs/type-aliases/DecodeExecutingMessagesParameters.md @@ -16,4 +16,4 @@ ## Defined in -[packages/viem/src/utils/interop.ts:21](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/interop.ts#L21) +[packages/viem/src/utils/interop.ts:21](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/interop.ts#L21) diff --git a/packages/viem/docs/type-aliases/DecodeExecutingMessagesReturnType.md b/packages/viem/docs/type-aliases/DecodeExecutingMessagesReturnType.md index 3b8b3e7b..576fdf09 100644 --- a/packages/viem/docs/type-aliases/DecodeExecutingMessagesReturnType.md +++ b/packages/viem/docs/type-aliases/DecodeExecutingMessagesReturnType.md @@ -16,4 +16,4 @@ ## Defined in -[packages/viem/src/utils/interop.ts:22](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/interop.ts#L22) +[packages/viem/src/utils/interop.ts:22](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/interop.ts#L22) diff --git a/packages/viem/docs/type-aliases/DecodeRelayedL2ToL2MessagesParameters.md b/packages/viem/docs/type-aliases/DecodeRelayedL2ToL2MessagesParameters.md index 0e6acbab..cc75cac3 100644 --- a/packages/viem/docs/type-aliases/DecodeRelayedL2ToL2MessagesParameters.md +++ b/packages/viem/docs/type-aliases/DecodeRelayedL2ToL2MessagesParameters.md @@ -16,4 +16,4 @@ ## Defined in -[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:43](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L43) +[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:43](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L43) diff --git a/packages/viem/docs/type-aliases/DecodeRelayedL2ToL2MessagesReturnType.md b/packages/viem/docs/type-aliases/DecodeRelayedL2ToL2MessagesReturnType.md index ca0b2ce5..540d3d66 100644 --- a/packages/viem/docs/type-aliases/DecodeRelayedL2ToL2MessagesReturnType.md +++ b/packages/viem/docs/type-aliases/DecodeRelayedL2ToL2MessagesReturnType.md @@ -16,4 +16,4 @@ ## Defined in -[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:46](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L46) +[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:46](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L46) diff --git a/packages/viem/docs/type-aliases/DecodeSentL2ToL2MessagesParameters.md b/packages/viem/docs/type-aliases/DecodeSentL2ToL2MessagesParameters.md index 3834b9ae..76d8c167 100644 --- a/packages/viem/docs/type-aliases/DecodeSentL2ToL2MessagesParameters.md +++ b/packages/viem/docs/type-aliases/DecodeSentL2ToL2MessagesParameters.md @@ -16,4 +16,4 @@ ## Defined in -[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:31](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L31) +[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:31](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L31) diff --git a/packages/viem/docs/type-aliases/DecodeSentL2ToL2MessagesReturnType.md b/packages/viem/docs/type-aliases/DecodeSentL2ToL2MessagesReturnType.md index ab3933fc..0aeeec63 100644 --- a/packages/viem/docs/type-aliases/DecodeSentL2ToL2MessagesReturnType.md +++ b/packages/viem/docs/type-aliases/DecodeSentL2ToL2MessagesReturnType.md @@ -16,4 +16,4 @@ ## Defined in -[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:32](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L32) +[packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts:32](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/utils/l2ToL2CrossDomainMessenger.ts#L32) diff --git a/packages/viem/docs/type-aliases/DepositSuperchainWETHContractReturnType.md b/packages/viem/docs/type-aliases/DepositSuperchainWETHContractReturnType.md index e0042ab1..612b4747 100644 --- a/packages/viem/docs/type-aliases/DepositSuperchainWETHContractReturnType.md +++ b/packages/viem/docs/type-aliases/DepositSuperchainWETHContractReturnType.md @@ -10,4 +10,4 @@ ## Defined in -[packages/viem/src/actions/depositSuperchainWETH.ts:46](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/depositSuperchainWETH.ts#L46) +[packages/viem/src/actions/depositSuperchainWETH.ts:46](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/depositSuperchainWETH.ts#L46) diff --git a/packages/viem/docs/type-aliases/DepositSuperchainWETHErrorType.md b/packages/viem/docs/type-aliases/DepositSuperchainWETHErrorType.md index dc65a75f..853d3e0d 100644 --- a/packages/viem/docs/type-aliases/DepositSuperchainWETHErrorType.md +++ b/packages/viem/docs/type-aliases/DepositSuperchainWETHErrorType.md @@ -10,4 +10,4 @@ ## Defined in -[packages/viem/src/actions/depositSuperchainWETH.ts:52](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/depositSuperchainWETH.ts#L52) +[packages/viem/src/actions/depositSuperchainWETH.ts:52](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/depositSuperchainWETH.ts#L52) diff --git a/packages/viem/docs/type-aliases/DepositSuperchainWETHParameters.md b/packages/viem/docs/type-aliases/DepositSuperchainWETHParameters.md index 99a4fbce..1e6c4ed7 100644 --- a/packages/viem/docs/type-aliases/DepositSuperchainWETHParameters.md +++ b/packages/viem/docs/type-aliases/DepositSuperchainWETHParameters.md @@ -20,4 +20,4 @@ ## Defined in -[packages/viem/src/actions/depositSuperchainWETH.ts:26](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/depositSuperchainWETH.ts#L26) +[packages/viem/src/actions/depositSuperchainWETH.ts:26](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/depositSuperchainWETH.ts#L26) diff --git a/packages/viem/docs/type-aliases/DepositSuperchainWETHReturnType.md b/packages/viem/docs/type-aliases/DepositSuperchainWETHReturnType.md index 39f23d91..6f23e516 100644 --- a/packages/viem/docs/type-aliases/DepositSuperchainWETHReturnType.md +++ b/packages/viem/docs/type-aliases/DepositSuperchainWETHReturnType.md @@ -10,4 +10,4 @@ ## Defined in -[packages/viem/src/actions/depositSuperchainWETH.ts:41](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/depositSuperchainWETH.ts#L41) +[packages/viem/src/actions/depositSuperchainWETH.ts:41](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/depositSuperchainWETH.ts#L41) diff --git a/packages/viem/docs/type-aliases/MessageIdentifier.md b/packages/viem/docs/type-aliases/MessageIdentifier.md index 774977f0..647405c0 100644 --- a/packages/viem/docs/type-aliases/MessageIdentifier.md +++ b/packages/viem/docs/type-aliases/MessageIdentifier.md @@ -44,4 +44,4 @@ The timestamp that the log was emitted. Used to enforce the timestamp invariant ## Defined in -[packages/viem/src/types/interop.ts:7](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/types/interop.ts#L7) +[packages/viem/src/types/interop.ts:7](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/types/interop.ts#L7) diff --git a/packages/viem/docs/type-aliases/RelayL2ToL2MessageContractReturnType.md b/packages/viem/docs/type-aliases/RelayL2ToL2MessageContractReturnType.md index d45e6100..c378aafa 100644 --- a/packages/viem/docs/type-aliases/RelayL2ToL2MessageContractReturnType.md +++ b/packages/viem/docs/type-aliases/RelayL2ToL2MessageContractReturnType.md @@ -10,4 +10,4 @@ ## Defined in -[packages/viem/src/actions/relayL2ToL2Message.ts:53](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/relayL2ToL2Message.ts#L53) +[packages/viem/src/actions/relayL2ToL2Message.ts:53](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/relayL2ToL2Message.ts#L53) diff --git a/packages/viem/docs/type-aliases/RelayL2ToL2MessageErrorType.md b/packages/viem/docs/type-aliases/RelayL2ToL2MessageErrorType.md index 70a0adf2..f260791e 100644 --- a/packages/viem/docs/type-aliases/RelayL2ToL2MessageErrorType.md +++ b/packages/viem/docs/type-aliases/RelayL2ToL2MessageErrorType.md @@ -10,4 +10,4 @@ ## Defined in -[packages/viem/src/actions/relayL2ToL2Message.ts:62](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/relayL2ToL2Message.ts#L62) +[packages/viem/src/actions/relayL2ToL2Message.ts:62](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/relayL2ToL2Message.ts#L62) diff --git a/packages/viem/docs/type-aliases/RelayL2ToL2MessageParameters.md b/packages/viem/docs/type-aliases/RelayL2ToL2MessageParameters.md index 585f1811..e43dabc2 100644 --- a/packages/viem/docs/type-aliases/RelayL2ToL2MessageParameters.md +++ b/packages/viem/docs/type-aliases/RelayL2ToL2MessageParameters.md @@ -34,4 +34,4 @@ MessagePayload of the SentMessage event * ## Defined in -[packages/viem/src/actions/relayL2ToL2Message.ts:28](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/relayL2ToL2Message.ts#L28) +[packages/viem/src/actions/relayL2ToL2Message.ts:28](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/relayL2ToL2Message.ts#L28) diff --git a/packages/viem/docs/type-aliases/RelayL2ToL2MessageReturnType.md b/packages/viem/docs/type-aliases/RelayL2ToL2MessageReturnType.md index faa57761..376fc763 100644 --- a/packages/viem/docs/type-aliases/RelayL2ToL2MessageReturnType.md +++ b/packages/viem/docs/type-aliases/RelayL2ToL2MessageReturnType.md @@ -10,4 +10,4 @@ ## Defined in -[packages/viem/src/actions/relayL2ToL2Message.ts:48](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/relayL2ToL2Message.ts#L48) +[packages/viem/src/actions/relayL2ToL2Message.ts:48](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/relayL2ToL2Message.ts#L48) diff --git a/packages/viem/docs/type-aliases/SendL2ToL2MessageContractReturnType.md b/packages/viem/docs/type-aliases/SendL2ToL2MessageContractReturnType.md index 98565c29..cd59326a 100644 --- a/packages/viem/docs/type-aliases/SendL2ToL2MessageContractReturnType.md +++ b/packages/viem/docs/type-aliases/SendL2ToL2MessageContractReturnType.md @@ -10,4 +10,4 @@ ## Defined in -[packages/viem/src/actions/sendL2ToL2Message.ts:55](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendL2ToL2Message.ts#L55) +[packages/viem/src/actions/sendL2ToL2Message.ts:55](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendL2ToL2Message.ts#L55) diff --git a/packages/viem/docs/type-aliases/SendL2ToL2MessageErrorType.md b/packages/viem/docs/type-aliases/SendL2ToL2MessageErrorType.md index c7d806b9..11b6f080 100644 --- a/packages/viem/docs/type-aliases/SendL2ToL2MessageErrorType.md +++ b/packages/viem/docs/type-aliases/SendL2ToL2MessageErrorType.md @@ -10,4 +10,4 @@ ## Defined in -[packages/viem/src/actions/sendL2ToL2Message.ts:64](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendL2ToL2Message.ts#L64) +[packages/viem/src/actions/sendL2ToL2Message.ts:64](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendL2ToL2Message.ts#L64) diff --git a/packages/viem/docs/type-aliases/SendL2ToL2MessageParameters.md b/packages/viem/docs/type-aliases/SendL2ToL2MessageParameters.md index b3910b0f..7bfcaeef 100644 --- a/packages/viem/docs/type-aliases/SendL2ToL2MessageParameters.md +++ b/packages/viem/docs/type-aliases/SendL2ToL2MessageParameters.md @@ -40,4 +40,4 @@ Target contract or wallet address. ## Defined in -[packages/viem/src/actions/sendL2ToL2Message.ts:28](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendL2ToL2Message.ts#L28) +[packages/viem/src/actions/sendL2ToL2Message.ts:28](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendL2ToL2Message.ts#L28) diff --git a/packages/viem/docs/type-aliases/SendL2ToL2MessageReturnType.md b/packages/viem/docs/type-aliases/SendL2ToL2MessageReturnType.md index e5a79425..e91d58a9 100644 --- a/packages/viem/docs/type-aliases/SendL2ToL2MessageReturnType.md +++ b/packages/viem/docs/type-aliases/SendL2ToL2MessageReturnType.md @@ -10,4 +10,4 @@ ## Defined in -[packages/viem/src/actions/sendL2ToL2Message.ts:50](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendL2ToL2Message.ts#L50) +[packages/viem/src/actions/sendL2ToL2Message.ts:50](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendL2ToL2Message.ts#L50) diff --git a/packages/viem/docs/type-aliases/SendSupERC20ContractReturnType.md b/packages/viem/docs/type-aliases/SendSupERC20ContractReturnType.md index 983cc9ac..96dd8a26 100644 --- a/packages/viem/docs/type-aliases/SendSupERC20ContractReturnType.md +++ b/packages/viem/docs/type-aliases/SendSupERC20ContractReturnType.md @@ -10,4 +10,4 @@ ## Defined in -[packages/viem/src/actions/sendSupERC20.ts:56](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendSupERC20.ts#L56) +[packages/viem/src/actions/sendSupERC20.ts:56](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendSupERC20.ts#L56) diff --git a/packages/viem/docs/type-aliases/SendSupERC20ErrorType.md b/packages/viem/docs/type-aliases/SendSupERC20ErrorType.md index d3b4e3ff..c5c0158b 100644 --- a/packages/viem/docs/type-aliases/SendSupERC20ErrorType.md +++ b/packages/viem/docs/type-aliases/SendSupERC20ErrorType.md @@ -10,4 +10,4 @@ ## Defined in -[packages/viem/src/actions/sendSupERC20.ts:65](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendSupERC20.ts#L65) +[packages/viem/src/actions/sendSupERC20.ts:65](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendSupERC20.ts#L65) diff --git a/packages/viem/docs/type-aliases/SendSupERC20Parameters.md b/packages/viem/docs/type-aliases/SendSupERC20Parameters.md index 9e7c454c..0d674210 100644 --- a/packages/viem/docs/type-aliases/SendSupERC20Parameters.md +++ b/packages/viem/docs/type-aliases/SendSupERC20Parameters.md @@ -46,4 +46,4 @@ Token to send. ## Defined in -[packages/viem/src/actions/sendSupERC20.ts:27](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendSupERC20.ts#L27) +[packages/viem/src/actions/sendSupERC20.ts:27](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendSupERC20.ts#L27) diff --git a/packages/viem/docs/type-aliases/SendSupERC20ReturnType.md b/packages/viem/docs/type-aliases/SendSupERC20ReturnType.md index de818ff8..8ddaa754 100644 --- a/packages/viem/docs/type-aliases/SendSupERC20ReturnType.md +++ b/packages/viem/docs/type-aliases/SendSupERC20ReturnType.md @@ -10,4 +10,4 @@ ## Defined in -[packages/viem/src/actions/sendSupERC20.ts:51](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendSupERC20.ts#L51) +[packages/viem/src/actions/sendSupERC20.ts:51](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendSupERC20.ts#L51) diff --git a/packages/viem/docs/type-aliases/SendSuperchainWETHParameters.md b/packages/viem/docs/type-aliases/SendSuperchainWETHParameters.md index d370b6a2..09b2cdd7 100644 --- a/packages/viem/docs/type-aliases/SendSuperchainWETHParameters.md +++ b/packages/viem/docs/type-aliases/SendSuperchainWETHParameters.md @@ -40,4 +40,4 @@ Address to send tokens to. ## Defined in -[packages/viem/src/actions/sendSuperchainWETH.ts:27](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/actions/sendSuperchainWETH.ts#L27) +[packages/viem/src/actions/sendSuperchainWETH.ts:27](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/sendSuperchainWETH.ts#L27) diff --git a/packages/viem/docs/type-aliases/WithdrawSuperchainWETHContractReturnType.md b/packages/viem/docs/type-aliases/WithdrawSuperchainWETHContractReturnType.md new file mode 100644 index 00000000..5950edc0 --- /dev/null +++ b/packages/viem/docs/type-aliases/WithdrawSuperchainWETHContractReturnType.md @@ -0,0 +1,13 @@ +[**@eth-optimism/viem**](../README.md) • **Docs** + +*** + +[@eth-optimism/viem](../README.md) / WithdrawSuperchainWETHContractReturnType + +# WithdrawSuperchainWETHContractReturnType + +> **WithdrawSuperchainWETHContractReturnType**: `ContractFunctionReturnType`\<*typeof* [`superchainWETHABI`](../variables/superchainWETHABI.md), `"nonpayable"`, `"withdraw"`\> + +## Defined in + +[packages/viem/src/actions/withdrawSuperchainWETH.ts:49](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/withdrawSuperchainWETH.ts#L49) diff --git a/packages/viem/docs/type-aliases/WithdrawSuperchainWETHErrorType.md b/packages/viem/docs/type-aliases/WithdrawSuperchainWETHErrorType.md new file mode 100644 index 00000000..78caeae8 --- /dev/null +++ b/packages/viem/docs/type-aliases/WithdrawSuperchainWETHErrorType.md @@ -0,0 +1,13 @@ +[**@eth-optimism/viem**](../README.md) • **Docs** + +*** + +[@eth-optimism/viem](../README.md) / WithdrawSuperchainWETHErrorType + +# WithdrawSuperchainWETHErrorType + +> **WithdrawSuperchainWETHErrorType**: `EstimateContractGasErrorType` \| `WriteContractErrorType` \| `ErrorType` + +## Defined in + +[packages/viem/src/actions/withdrawSuperchainWETH.ts:55](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/withdrawSuperchainWETH.ts#L55) diff --git a/packages/viem/docs/type-aliases/WithdrawSuperchainWETHParameters.md b/packages/viem/docs/type-aliases/WithdrawSuperchainWETHParameters.md new file mode 100644 index 00000000..d7b1088a --- /dev/null +++ b/packages/viem/docs/type-aliases/WithdrawSuperchainWETHParameters.md @@ -0,0 +1,31 @@ +[**@eth-optimism/viem**](../README.md) • **Docs** + +*** + +[@eth-optimism/viem](../README.md) / WithdrawSuperchainWETHParameters + +# WithdrawSuperchainWETHParameters\ + +> **WithdrawSuperchainWETHParameters**\<`TChain`, `TAccount`, `TChainOverride`, `TDerivedChain`\>: `BaseWriteContractActionParameters`\<`TChain`, `TAccount`, `TChainOverride`, `TDerivedChain`\> & `object` + +## Type declaration + +### amount + +> **amount**: `bigint` + +Amount of SuperchainWETH to withdraw. + +## Type Parameters + +• **TChain** *extends* `Chain` \| `undefined` = `Chain` \| `undefined` + +• **TAccount** *extends* `Account` \| `undefined` = `Account` \| `undefined` + +• **TChainOverride** *extends* `Chain` \| `undefined` = `Chain` \| `undefined` + +• **TDerivedChain** *extends* `Chain` \| `undefined` = `DeriveChain`\<`TChain`, `TChainOverride`\> + +## Defined in + +[packages/viem/src/actions/withdrawSuperchainWETH.ts:26](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/withdrawSuperchainWETH.ts#L26) diff --git a/packages/viem/docs/type-aliases/WithdrawSuperchainWETHReturnType.md b/packages/viem/docs/type-aliases/WithdrawSuperchainWETHReturnType.md new file mode 100644 index 00000000..825193e1 --- /dev/null +++ b/packages/viem/docs/type-aliases/WithdrawSuperchainWETHReturnType.md @@ -0,0 +1,13 @@ +[**@eth-optimism/viem**](../README.md) • **Docs** + +*** + +[@eth-optimism/viem](../README.md) / WithdrawSuperchainWETHReturnType + +# WithdrawSuperchainWETHReturnType + +> **WithdrawSuperchainWETHReturnType**: `Hash` + +## Defined in + +[packages/viem/src/actions/withdrawSuperchainWETH.ts:44](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/actions/withdrawSuperchainWETH.ts#L44) diff --git a/packages/viem/docs/variables/contracts.md b/packages/viem/docs/variables/contracts.md index d62c8efc..919ecaa1 100644 --- a/packages/viem/docs/variables/contracts.md +++ b/packages/viem/docs/variables/contracts.md @@ -94,4 +94,4 @@ OP Stack Predeploy Addresses ## Defined in -[packages/viem/src/contracts.ts:8](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/contracts.ts#L8) +[packages/viem/src/contracts.ts:8](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/contracts.ts#L8) diff --git a/packages/viem/docs/variables/crossL2InboxABI.md b/packages/viem/docs/variables/crossL2InboxABI.md index 0aeaef55..6286452e 100644 --- a/packages/viem/docs/variables/crossL2InboxABI.md +++ b/packages/viem/docs/variables/crossL2InboxABI.md @@ -12,4 +12,4 @@ ABI for the OP Stack contract `CrossL2Inbox` ## Defined in -[packages/viem/src/abis.ts:7](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/abis.ts#L7) +[packages/viem/src/abis.ts:7](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/abis.ts#L7) diff --git a/packages/viem/docs/variables/l2ToL2CrossDomainMessengerABI.md b/packages/viem/docs/variables/l2ToL2CrossDomainMessengerABI.md index 83c6b40b..db37a853 100644 --- a/packages/viem/docs/variables/l2ToL2CrossDomainMessengerABI.md +++ b/packages/viem/docs/variables/l2ToL2CrossDomainMessengerABI.md @@ -12,4 +12,4 @@ ABI for the OP Stack contract `L2ToL2CrossDomainMessenger` ## Defined in -[packages/viem/src/abis.ts:293](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/abis.ts#L293) +[packages/viem/src/abis.ts:293](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/abis.ts#L293) diff --git a/packages/viem/docs/variables/superchainERC20ABI.md b/packages/viem/docs/variables/superchainERC20ABI.md index 6f6563d1..29061a95 100644 --- a/packages/viem/docs/variables/superchainERC20ABI.md +++ b/packages/viem/docs/variables/superchainERC20ABI.md @@ -12,4 +12,4 @@ ABI for the OP Stack contract `SuperchainERC20` ## Defined in -[packages/viem/src/abis.ts:980](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/abis.ts#L980) +[packages/viem/src/abis.ts:980](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/abis.ts#L980) diff --git a/packages/viem/docs/variables/superchainTokenBridgeABI.md b/packages/viem/docs/variables/superchainTokenBridgeABI.md index 271dc227..1a995b07 100644 --- a/packages/viem/docs/variables/superchainTokenBridgeABI.md +++ b/packages/viem/docs/variables/superchainTokenBridgeABI.md @@ -12,4 +12,4 @@ ABI for the OP Stack contract `SuperchainTokenBridge` ## Defined in -[packages/viem/src/abis.ts:1411](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/abis.ts#L1411) +[packages/viem/src/abis.ts:1411](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/abis.ts#L1411) diff --git a/packages/viem/docs/variables/superchainWETHABI.md b/packages/viem/docs/variables/superchainWETHABI.md index 1e9f678d..aecf7666 100644 --- a/packages/viem/docs/variables/superchainWETHABI.md +++ b/packages/viem/docs/variables/superchainWETHABI.md @@ -12,4 +12,4 @@ ABI for the OP Stack contract `SuperchainWETH` ## Defined in -[packages/viem/src/abis.ts:588](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/abis.ts#L588) +[packages/viem/src/abis.ts:588](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/abis.ts#L588) diff --git a/packages/viem/docs/variables/supersimL1.md b/packages/viem/docs/variables/supersimL1.md index f5f870b6..bd81b9b9 100644 --- a/packages/viem/docs/variables/supersimL1.md +++ b/packages/viem/docs/variables/supersimL1.md @@ -152,4 +152,4 @@ Flag for test networks ## Defined in -[packages/viem/src/chains/supersim.ts:8](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/chains/supersim.ts#L8) +[packages/viem/src/chains/supersim.ts:8](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/chains/supersim.ts#L8) diff --git a/packages/viem/docs/variables/supersimL2A.md b/packages/viem/docs/variables/supersimL2A.md index 327d9ec8..895903ab 100644 --- a/packages/viem/docs/variables/supersimL2A.md +++ b/packages/viem/docs/variables/supersimL2A.md @@ -504,4 +504,4 @@ Flag for test networks ## Defined in -[packages/viem/src/chains/supersim.ts:24](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/chains/supersim.ts#L24) +[packages/viem/src/chains/supersim.ts:24](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/chains/supersim.ts#L24) diff --git a/packages/viem/docs/variables/supersimL2B.md b/packages/viem/docs/variables/supersimL2B.md index 391ae373..5bf20024 100644 --- a/packages/viem/docs/variables/supersimL2B.md +++ b/packages/viem/docs/variables/supersimL2B.md @@ -504,4 +504,4 @@ Flag for test networks ## Defined in -[packages/viem/src/chains/supersim.ts:41](https://github.com/ethereum-optimism/ecosystem/blob/13a9597363979821622ee318a8281c7048f1a00b/packages/viem/src/chains/supersim.ts#L41) +[packages/viem/src/chains/supersim.ts:41](https://github.com/ethereum-optimism/ecosystem/blob/5b57c542e6f02774701a464de238b830e81b7ecb/packages/viem/src/chains/supersim.ts#L41) diff --git a/packages/viem/src/actions/withdrawSuperchainWETH.spec.ts b/packages/viem/src/actions/withdrawSuperchainWETH.spec.ts new file mode 100644 index 00000000..b1d10815 --- /dev/null +++ b/packages/viem/src/actions/withdrawSuperchainWETH.spec.ts @@ -0,0 +1,77 @@ +import { beforeAll, describe, expect, it } from 'vitest' + +import { superchainWETHABI } from '@/abis.js' +import { contracts } from '@/contracts.js' +import { publicClientA, testAccount, walletClientA } from '@/test/clients.js' +import { SUPERSIM_SUPERC20_ADDRESS } from '@/test/supERC20.js' + +const AMOUNT_TO_WITHDRAW = 10n + +describe('withdrawSuperchainWETH', () => { + beforeAll(async () => { + const hash = await walletClientA.depositSuperchainWETH({ + value: 1000n, + }) + + await publicClientA.waitForTransactionReceipt({ hash }) + }) + + describe('write contract', () => { + it('should return expected request', async () => { + const startingSuperchainWETHBalance = await publicClientA.readContract({ + address: contracts.superchainWETH.address, + abi: superchainWETHABI, + functionName: 'balanceOf', + args: [testAccount.address], + }) + const startingETHBalance = await publicClientA.getBalance({ + address: testAccount.address, + }) + + const hash = await walletClientA.withdrawSuperchainWETH({ + amount: AMOUNT_TO_WITHDRAW, + }) + const receipt = await publicClientA.waitForTransactionReceipt({ hash }) + + const endingSuperchainWETHBalance = await publicClientA.readContract({ + address: contracts.superchainWETH.address, + abi: superchainWETHABI, + functionName: 'balanceOf', + args: [testAccount.address], + }) + const endingETHBalance = await publicClientA.getBalance({ + address: testAccount.address, + }) + + expect(endingSuperchainWETHBalance).toEqual( + startingSuperchainWETHBalance - AMOUNT_TO_WITHDRAW, + ) + const gasPaid = receipt.gasUsed * receipt.effectiveGasPrice + expect(endingETHBalance).toEqual( + startingETHBalance + AMOUNT_TO_WITHDRAW - gasPaid, + ) + }) + }) + + describe('estimate gas', () => { + it('should estimate gas', async () => { + const gas = await publicClientA.estimateWithdrawSuperchainWETHGas({ + account: testAccount.address, + amount: AMOUNT_TO_WITHDRAW, + }) + + expect(gas).toBeDefined() + }) + }) + + describe('simulate', () => { + it('should simulate', async () => { + expect(() => + publicClientA.simulateWithdrawSuperchainWETH({ + account: testAccount.address, + amount: AMOUNT_TO_WITHDRAW, + }), + ).not.throw() + }) + }) +}) diff --git a/packages/viem/src/actions/withdrawSuperchainWETH.ts b/packages/viem/src/actions/withdrawSuperchainWETH.ts new file mode 100644 index 00000000..8022c404 --- /dev/null +++ b/packages/viem/src/actions/withdrawSuperchainWETH.ts @@ -0,0 +1,150 @@ +/** @module withdrawSuperchainWETH */ +import type { + Account, + Chain, + Client, + ContractFunctionReturnType, + DeriveChain, + EstimateContractGasErrorType, + EstimateContractGasParameters, + Hash, + SimulateContractParameters, + Transport, + WriteContractErrorType, +} from 'viem' +import { estimateContractGas, simulateContract } from 'viem/actions' + +import { superchainWETHABI } from '@/abis.js' +import { contracts } from '@/contracts.js' +import type { BaseWriteContractActionParameters } from '@/core/baseWriteAction.js' +import { baseWriteAction } from '@/core/baseWriteAction.js' +import type { ErrorType } from '@/types/utils.js' + +/** + * @category Types + */ +export type WithdrawSuperchainWETHParameters< + TChain extends Chain | undefined = Chain | undefined, + TAccount extends Account | undefined = Account | undefined, + TChainOverride extends Chain | undefined = Chain | undefined, + TDerivedChain extends Chain | undefined = DeriveChain, +> = BaseWriteContractActionParameters< + TChain, + TAccount, + TChainOverride, + TDerivedChain +> & { + /** Amount of SuperchainWETH to withdraw. */ + amount: bigint +} + +/** + * @category Types + */ +export type WithdrawSuperchainWETHReturnType = Hash + +/** + * @category Types + */ +export type WithdrawSuperchainWETHContractReturnType = + ContractFunctionReturnType + +/** + * @category Types + */ +export type WithdrawSuperchainWETHErrorType = + | EstimateContractGasErrorType + | WriteContractErrorType + | ErrorType + +/** + * Deposits ETH to the SuperchainWETH contract. + * @category L2 Wallet Actions + * @param client - L2 Wallet Client + * @param parameters - {@link WithdrawSuperchainWETHParameters} + * @returns The withdrawSuperchainWETH transaction hash. {@link WithdrawSuperchainWETHReturnType} + */ +export async function withdrawSuperchainWETH< + chain extends Chain | undefined, + account extends Account | undefined, + chainOverride extends Chain | undefined = undefined, +>( + client: Client, + parameters: WithdrawSuperchainWETHParameters, +): Promise { + const { amount, ...txParameters } = parameters + + return baseWriteAction( + client, + { + abi: superchainWETHABI, + contractAddress: contracts.superchainWETH.address, + contractFunctionName: 'withdraw', + contractArgs: [amount], + }, + txParameters as BaseWriteContractActionParameters, + ) +} + +/** + * Estimates gas for {@link withdrawSuperchainWETH} + * @category L2 Wallet Actions + * @param client - L2 Wallet Client + * @param parameters - {@link WithdrawSuperchainWETHParameters} + * @returns The estimated gas value. + */ +export async function estimateWithdrawSuperchainWETHGas< + TChain extends Chain | undefined, + TAccount extends Account | undefined, + TChainOverride extends Chain | undefined = undefined, +>( + client: Client, + parameters: WithdrawSuperchainWETHParameters< + TChain, + TAccount, + TChainOverride + >, +): Promise { + const { amount, ...txParameters } = parameters + + return estimateContractGas(client, { + abi: superchainWETHABI, + address: contracts.superchainWETH.address, + functionName: 'withdraw', + args: [amount], + ...txParameters, + } as EstimateContractGasParameters) +} + +/** + * Simulate contract call for {@link withdrawSuperchainWETH} + * @category L2 Public Actions + * @param client - L2 Public Client + * @param parameters - {@link WithdrawSuperchainWETHParameters} + * @returns The contract functions return value. {@link withdrawSuperchainWETHContractReturnType} + */ +export async function simulateWithdrawSuperchainWETH< + TChain extends Chain | undefined, + TAccount extends Account | undefined, + TChainOverride extends Chain | undefined = undefined, +>( + client: Client, + parameters: WithdrawSuperchainWETHParameters< + TChain, + TAccount, + TChainOverride + >, +): Promise { + const { account, amount } = parameters + + const res = await simulateContract(client, { + account, + abi: superchainWETHABI, + address: contracts.superchainWETH.address, + chain: client.chain, + functionName: 'withdraw', + args: [amount], + } as SimulateContractParameters) + + return res.result as WithdrawSuperchainWETHContractReturnType +} diff --git a/packages/viem/src/decorators/publicL2.ts b/packages/viem/src/decorators/publicL2.ts index fc5d335d..d5291de4 100644 --- a/packages/viem/src/decorators/publicL2.ts +++ b/packages/viem/src/decorators/publicL2.ts @@ -39,6 +39,12 @@ import { estimateSendSuperchainWETHGas, simulateSendSuperchainWETH, } from '@/actions/sendSuperchainWETH.js' +import { + estimateWithdrawSuperchainWETHGas, + simulateWithdrawSuperchainWETH, + type WithdrawSuperchainWETHContractReturnType, + type WithdrawSuperchainWETHParameters, +} from '@/actions/withdrawSuperchainWETH.js' export type PublicActionsL2< TChain extends Chain | undefined = Chain | undefined, @@ -72,6 +78,16 @@ export type PublicActionsL2< >, ) => Promise + estimateWithdrawSuperchainWETHGas: < + TChainOverride extends Chain | undefined = undefined, + >( + parameters: WithdrawSuperchainWETHParameters< + TChain, + TAccount, + TChainOverride + >, + ) => Promise + estimateSendSuperchainWETHGas: < TChainOverride extends Chain | undefined = undefined, >( @@ -104,6 +120,16 @@ export type PublicActionsL2< >, ) => Promise + simulateWithdrawSuperchainWETH: < + TChainOverride extends Chain | undefined = undefined, + >( + parameters: WithdrawSuperchainWETHParameters< + TChain, + TAccount, + TChainOverride + >, + ) => Promise + simulateSendSuperchainWETH: < TChainOverride extends Chain | undefined = undefined, >( @@ -130,6 +156,8 @@ export function publicActionsL2() { estimateSendSuperchainWETHGas(client, args), estimateDepositSuperchainWETHGas: (args) => estimateDepositSuperchainWETHGas(client, args), + estimateWithdrawSuperchainWETHGas: (args) => + estimateWithdrawSuperchainWETHGas(client, args), simulateSendL2ToL2Message: (args) => simulateSendL2ToL2Message(client, args), simulateRelayL2ToL2Message: (args) => @@ -137,6 +165,8 @@ export function publicActionsL2() { simulateSendSupERC20: (args) => simulateSendSupERC20(client, args), simulateDepositSuperchainWETH: (args) => simulateDepositSuperchainWETH(client, args), + simulateWithdrawSuperchainWETH: (args) => + simulateWithdrawSuperchainWETH(client, args), simulateSendSuperchainWETH: (args) => simulateSendSuperchainWETH(client, args), } as PublicActionsL2 diff --git a/packages/viem/src/decorators/walletL2.ts b/packages/viem/src/decorators/walletL2.ts index 2d80a7c5..b2e337a5 100644 --- a/packages/viem/src/decorators/walletL2.ts +++ b/packages/viem/src/decorators/walletL2.ts @@ -24,6 +24,11 @@ import type { import { sendSupERC20 } from '@/actions/sendSupERC20.js' import type { SendSuperchainWETHParameters } from '@/actions/sendSuperchainWETH.js' import { sendSuperchainWETH } from '@/actions/sendSuperchainWETH.js' +import { + withdrawSuperchainWETH, + type WithdrawSuperchainWETHParameters, + type WithdrawSuperchainWETHReturnType, +} from '@/actions/withdrawSuperchainWETH.js' export type WalletActionsL2< chain extends Chain | undefined = Chain | undefined, @@ -44,6 +49,9 @@ export type WalletActionsL2< depositSuperchainWETH: ( parameters: DepositSuperchainWETHParameters, ) => Promise + withdrawSuperchainWETH: ( + parameters: WithdrawSuperchainWETHParameters, + ) => Promise } export function walletActionsL2() { @@ -61,6 +69,7 @@ export function walletActionsL2() { sendSupERC20: (args) => sendSupERC20(client, args), sendSuperchainWETH: (args) => sendSuperchainWETH(client, args), depositSuperchainWETH: (args) => depositSuperchainWETH(client, args), + withdrawSuperchainWETH: (args) => withdrawSuperchainWETH(client, args), } as WalletActionsL2 } } diff --git a/packages/viem/src/index.ts b/packages/viem/src/index.ts index 7b19e857..073186d6 100644 --- a/packages/viem/src/index.ts +++ b/packages/viem/src/index.ts @@ -61,6 +61,17 @@ export { sendSuperchainWETH, simulateSendSuperchainWETH, } from '@/actions/sendSuperchainWETH.js' +export type { + WithdrawSuperchainWETHContractReturnType, + WithdrawSuperchainWETHErrorType, + WithdrawSuperchainWETHParameters, + WithdrawSuperchainWETHReturnType, +} from '@/actions/withdrawSuperchainWETH.js' +export { + estimateWithdrawSuperchainWETHGas, + simulateWithdrawSuperchainWETH, + withdrawSuperchainWETH, +} from '@/actions/withdrawSuperchainWETH.js' // utils export type { diff --git a/packages/viem/src/test/e2e/interop.spec.ts b/packages/viem/src/test/e2e/interop.spec.ts index f5538d2c..17b41f5d 100644 --- a/packages/viem/src/test/e2e/interop.spec.ts +++ b/packages/viem/src/test/e2e/interop.spec.ts @@ -126,6 +126,8 @@ describe('SuperchainERC20 Flow', () => { }) describe('SuperchainWETH Flow', () => { + const AMOUNT_TO_SEND = 10n + beforeAll(async () => { const hash = await walletClientA.depositSuperchainWETH({ value: 1000n, @@ -135,7 +137,7 @@ describe('SuperchainWETH Flow', () => { }) it('should send SuperchainWETH and relay cross chain message to burn/mint tokens', async () => { - const startingBalance = await publicClientB.readContract({ + const startingWETHBalance = await publicClientB.readContract({ address: contracts.superchainWETH.address, abi: superchainWETHABI, functionName: 'balanceOf', @@ -144,7 +146,7 @@ describe('SuperchainWETH Flow', () => { const hash = await walletClientA.sendSuperchainWETH({ to: testAccount.address, - amount: 10n, + amount: AMOUNT_TO_SEND, chainId: supersimL2B.id, }) @@ -171,13 +173,31 @@ describe('SuperchainWETH Flow', () => { }) expect(successfulMessages).length(1) - const endingBalance = await publicClientB.readContract({ + const endingWETHBalance = await publicClientB.readContract({ address: contracts.superchainWETH.address, abi: superchainWETHABI, functionName: 'balanceOf', args: [testAccount.address], }) - expect(endingBalance).toEqual(startingBalance + 10n) + expect(endingWETHBalance).toEqual(startingWETHBalance + AMOUNT_TO_SEND) + + const startingETHBalance = await publicClientB.getBalance({ + address: testAccount.address, + }) + const withdrawHash = await walletClientB.withdrawSuperchainWETH({ + amount: AMOUNT_TO_SEND, + }) + const withdrawReceipt = await publicClientB.waitForTransactionReceipt({ + hash: withdrawHash, + }) + + const gasPaid = withdrawReceipt.gasUsed * withdrawReceipt.effectiveGasPrice + const endingETHBalance = await publicClientB.getBalance({ + address: testAccount.address, + }) + expect(endingETHBalance).toEqual( + startingETHBalance + AMOUNT_TO_SEND - gasPaid, + ) }) })