Skip to content

Commit

Permalink
revert writel1action base type change
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasrosario committed Oct 25, 2023
1 parent c97c52e commit df4a5d1
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "op-viem",
"version": "0.1.0-alpha-alpha.2",
"version": "0.1.0-alpha-alpha.3",
"type": "module",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
Expand Down
3 changes: 3 additions & 0 deletions src/actions/wallet/L1/writeDepositERC20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export type WriteDepositERC20Parameters<
> =
& { args: DepositERC20Parameters; l1StandardBridge: RawOrContractAddress<_chainId> }
& L1WriteActionBaseType<
typeof ABI,
typeof FUNCTION,
ContractFunctionArgs<typeof ABI, 'nonpayable', typeof FUNCTION>,
TChain,
TAccount,
TChainOverride
Expand Down
9 changes: 8 additions & 1 deletion src/actions/wallet/L1/writeDepositETH.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import type { Account, Chain, Transport, WalletClient, WriteContractReturnType } from 'viem'
import { optimismPortalABI } from '@eth-optimism/contracts-ts'
import type { Account, Chain, ContractFunctionArgs, Transport, WalletClient, WriteContractReturnType } from 'viem'
import { type RawOrContractAddress, resolveAddress } from '../../../types/addresses.js'
import { type DepositETHParameters } from '../../../types/depositETH.js'
import type { L1WriteActionBaseType } from '../../../types/l1Actions.js'
import { writeDepositTransaction, type WriteDepositTransactionParameters } from './writeDepositTransaction.js'

export const ABI = optimismPortalABI
export const FUNCTION = 'depositTransaction'

export type WriteDepositETHParameters<
TChain extends Chain | undefined = Chain,
TAccount extends Account | undefined = Account | undefined,
Expand All @@ -12,6 +16,9 @@ export type WriteDepositETHParameters<
> =
& { args: DepositETHParameters; portal: RawOrContractAddress<_chainId> }
& L1WriteActionBaseType<
typeof ABI,
typeof FUNCTION,
ContractFunctionArgs<typeof ABI, 'payable', typeof FUNCTION>,
TChain,
TAccount,
TChainOverride
Expand Down
3 changes: 3 additions & 0 deletions src/actions/wallet/L1/writeDepositTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export type WriteDepositTransactionParameters<
=
& { args: DepositTransactionParameters; portal: RawOrContractAddress<number> }
& L1WriteActionBaseType<
typeof ABI,
typeof FUNCTION,
ContractFunctionArgs<typeof ABI, 'payable', typeof FUNCTION>,
TChain,
TAccount,
TChainOverride
Expand Down
3 changes: 3 additions & 0 deletions src/actions/wallet/L1/writeFinalizeWithdrawalTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export type WriteFinalizeWithdrawalTransactionParameters<
> =
& { withdrawal: FinalizeWithdrawalTransactionParameters; portal: RawOrContractAddress<_chainId> }
& L1WriteActionBaseType<
typeof ABI,
typeof FUNCTION,
ContractFunctionArgs<typeof ABI, 'nonpayable', typeof FUNCTION>,
TChain,
TAccount,
TChainOverride
Expand Down
3 changes: 3 additions & 0 deletions src/actions/wallet/L1/writeProveWithdrawalTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export type WriteProveWithdrawalTransactionParameters<
> =
& { args: ProveWithdrawalTransactionParameters; portal: RawOrContractAddress<_chainId> }
& L1WriteActionBaseType<
typeof ABI,
typeof FUNCTION,
ContractFunctionArgs<typeof ABI, 'nonpayable', typeof FUNCTION>,
TChain,
TAccount,
TChainOverride
Expand Down
3 changes: 3 additions & 0 deletions src/actions/wallet/L1/writeSendMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export type WriteSendMessageParameters<
> =
& { args: SendMessageParameters; l1CrossDomainMessenger: RawOrContractAddress<_chainId> }
& L1WriteActionBaseType<
typeof ABI,
typeof FUNCTION,
ContractFunctionArgs<typeof ABI, 'payable', typeof FUNCTION>,
TChain,
TAccount,
TChainOverride
Expand Down
20 changes: 13 additions & 7 deletions src/types/l1Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,27 @@ import type {
Chain,
ContractFunctionArgs,
ContractFunctionName,
SendTransactionParameters,
SimulateContractParameters,
WriteContractParameters,
} from 'viem'

export type L1WriteActionBaseType<
TAbi extends Abi | readonly unknown[] = Abi,
TFunctionName extends ContractFunctionName<
TAbi,
'nonpayable' | 'payable'
> = ContractFunctionName<TAbi, 'nonpayable' | 'payable'>,
TArgs extends ContractFunctionArgs<
TAbi,
'nonpayable' | 'payable',
TFunctionName
> = ContractFunctionArgs<TAbi, 'nonpayable' | 'payable', TFunctionName>,
TChain extends Chain | undefined = Chain,
TAccount extends Account | undefined = Account | undefined,
TChainOverride extends Chain | undefined = Chain | undefined,
> = Omit<
SendTransactionParameters<
TChain,
TAccount,
TChainOverride
>,
'chain'
WriteContractParameters<TAbi, TFunctionName, TArgs, TChain, TAccount, TChainOverride>,
'abi' | 'functionName' | 'args' | 'address'
>

export type L1SimulateActionBaseType<
Expand Down

0 comments on commit df4a5d1

Please sign in to comment.