diff --git a/package.json b/package.json index 0dd2064..b98992c 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/actions/wallet/L1/writeDepositERC20.ts b/src/actions/wallet/L1/writeDepositERC20.ts index ef4d2d7..4bd2f2f 100644 --- a/src/actions/wallet/L1/writeDepositERC20.ts +++ b/src/actions/wallet/L1/writeDepositERC20.ts @@ -20,6 +20,9 @@ export type WriteDepositERC20Parameters< > = & { args: DepositERC20Parameters; l1StandardBridge: RawOrContractAddress<_chainId> } & L1WriteActionBaseType< + typeof ABI, + typeof FUNCTION, + ContractFunctionArgs, TChain, TAccount, TChainOverride diff --git a/src/actions/wallet/L1/writeDepositETH.ts b/src/actions/wallet/L1/writeDepositETH.ts index 2b8a3d2..7b37320 100644 --- a/src/actions/wallet/L1/writeDepositETH.ts +++ b/src/actions/wallet/L1/writeDepositETH.ts @@ -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, @@ -12,6 +16,9 @@ export type WriteDepositETHParameters< > = & { args: DepositETHParameters; portal: RawOrContractAddress<_chainId> } & L1WriteActionBaseType< + typeof ABI, + typeof FUNCTION, + ContractFunctionArgs, TChain, TAccount, TChainOverride diff --git a/src/actions/wallet/L1/writeDepositTransaction.ts b/src/actions/wallet/L1/writeDepositTransaction.ts index 1e342dc..2a1a156 100644 --- a/src/actions/wallet/L1/writeDepositTransaction.ts +++ b/src/actions/wallet/L1/writeDepositTransaction.ts @@ -33,6 +33,9 @@ export type WriteDepositTransactionParameters< = & { args: DepositTransactionParameters; portal: RawOrContractAddress } & L1WriteActionBaseType< + typeof ABI, + typeof FUNCTION, + ContractFunctionArgs, TChain, TAccount, TChainOverride diff --git a/src/actions/wallet/L1/writeFinalizeWithdrawalTransaction.ts b/src/actions/wallet/L1/writeFinalizeWithdrawalTransaction.ts index 7549da4..ef509ff 100644 --- a/src/actions/wallet/L1/writeFinalizeWithdrawalTransaction.ts +++ b/src/actions/wallet/L1/writeFinalizeWithdrawalTransaction.ts @@ -27,6 +27,9 @@ export type WriteFinalizeWithdrawalTransactionParameters< > = & { withdrawal: FinalizeWithdrawalTransactionParameters; portal: RawOrContractAddress<_chainId> } & L1WriteActionBaseType< + typeof ABI, + typeof FUNCTION, + ContractFunctionArgs, TChain, TAccount, TChainOverride diff --git a/src/actions/wallet/L1/writeProveWithdrawalTransaction.ts b/src/actions/wallet/L1/writeProveWithdrawalTransaction.ts index be412c2..324e6dc 100644 --- a/src/actions/wallet/L1/writeProveWithdrawalTransaction.ts +++ b/src/actions/wallet/L1/writeProveWithdrawalTransaction.ts @@ -26,6 +26,9 @@ export type WriteProveWithdrawalTransactionParameters< > = & { args: ProveWithdrawalTransactionParameters; portal: RawOrContractAddress<_chainId> } & L1WriteActionBaseType< + typeof ABI, + typeof FUNCTION, + ContractFunctionArgs, TChain, TAccount, TChainOverride diff --git a/src/actions/wallet/L1/writeSendMessage.ts b/src/actions/wallet/L1/writeSendMessage.ts index 0f8a1c2..e80cb8a 100644 --- a/src/actions/wallet/L1/writeSendMessage.ts +++ b/src/actions/wallet/L1/writeSendMessage.ts @@ -31,6 +31,9 @@ export type WriteSendMessageParameters< > = & { args: SendMessageParameters; l1CrossDomainMessenger: RawOrContractAddress<_chainId> } & L1WriteActionBaseType< + typeof ABI, + typeof FUNCTION, + ContractFunctionArgs, TChain, TAccount, TChainOverride diff --git a/src/types/l1Actions.ts b/src/types/l1Actions.ts index 22fee5f..c989d59 100644 --- a/src/types/l1Actions.ts +++ b/src/types/l1Actions.ts @@ -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, + TArgs extends ContractFunctionArgs< + TAbi, + 'nonpayable' | 'payable', + TFunctionName + > = ContractFunctionArgs, TChain extends Chain | undefined = Chain, TAccount extends Account | undefined = Account | undefined, TChainOverride extends Chain | undefined = Chain | undefined, > = Omit< - SendTransactionParameters< - TChain, - TAccount, - TChainOverride - >, - 'chain' + WriteContractParameters, + 'abi' | 'functionName' | 'args' | 'address' > export type L1SimulateActionBaseType<