Skip to content

Commit df4a5d1

Browse files
committed
revert writel1action base type change
1 parent c97c52e commit df4a5d1

8 files changed

+37
-9
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "op-viem",
3-
"version": "0.1.0-alpha-alpha.2",
3+
"version": "0.1.0-alpha-alpha.3",
44
"type": "module",
55
"main": "./dist/cjs/index.js",
66
"module": "./dist/esm/index.js",

src/actions/wallet/L1/writeDepositERC20.ts

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export type WriteDepositERC20Parameters<
2020
> =
2121
& { args: DepositERC20Parameters; l1StandardBridge: RawOrContractAddress<_chainId> }
2222
& L1WriteActionBaseType<
23+
typeof ABI,
24+
typeof FUNCTION,
25+
ContractFunctionArgs<typeof ABI, 'nonpayable', typeof FUNCTION>,
2326
TChain,
2427
TAccount,
2528
TChainOverride

src/actions/wallet/L1/writeDepositETH.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import type { Account, Chain, Transport, WalletClient, WriteContractReturnType } from 'viem'
1+
import { optimismPortalABI } from '@eth-optimism/contracts-ts'
2+
import type { Account, Chain, ContractFunctionArgs, Transport, WalletClient, WriteContractReturnType } from 'viem'
23
import { type RawOrContractAddress, resolveAddress } from '../../../types/addresses.js'
34
import { type DepositETHParameters } from '../../../types/depositETH.js'
45
import type { L1WriteActionBaseType } from '../../../types/l1Actions.js'
56
import { writeDepositTransaction, type WriteDepositTransactionParameters } from './writeDepositTransaction.js'
67

8+
export const ABI = optimismPortalABI
9+
export const FUNCTION = 'depositTransaction'
10+
711
export type WriteDepositETHParameters<
812
TChain extends Chain | undefined = Chain,
913
TAccount extends Account | undefined = Account | undefined,
@@ -12,6 +16,9 @@ export type WriteDepositETHParameters<
1216
> =
1317
& { args: DepositETHParameters; portal: RawOrContractAddress<_chainId> }
1418
& L1WriteActionBaseType<
19+
typeof ABI,
20+
typeof FUNCTION,
21+
ContractFunctionArgs<typeof ABI, 'payable', typeof FUNCTION>,
1522
TChain,
1623
TAccount,
1724
TChainOverride

src/actions/wallet/L1/writeDepositTransaction.ts

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ export type WriteDepositTransactionParameters<
3333
=
3434
& { args: DepositTransactionParameters; portal: RawOrContractAddress<number> }
3535
& L1WriteActionBaseType<
36+
typeof ABI,
37+
typeof FUNCTION,
38+
ContractFunctionArgs<typeof ABI, 'payable', typeof FUNCTION>,
3639
TChain,
3740
TAccount,
3841
TChainOverride

src/actions/wallet/L1/writeFinalizeWithdrawalTransaction.ts

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export type WriteFinalizeWithdrawalTransactionParameters<
2727
> =
2828
& { withdrawal: FinalizeWithdrawalTransactionParameters; portal: RawOrContractAddress<_chainId> }
2929
& L1WriteActionBaseType<
30+
typeof ABI,
31+
typeof FUNCTION,
32+
ContractFunctionArgs<typeof ABI, 'nonpayable', typeof FUNCTION>,
3033
TChain,
3134
TAccount,
3235
TChainOverride

src/actions/wallet/L1/writeProveWithdrawalTransaction.ts

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export type WriteProveWithdrawalTransactionParameters<
2626
> =
2727
& { args: ProveWithdrawalTransactionParameters; portal: RawOrContractAddress<_chainId> }
2828
& L1WriteActionBaseType<
29+
typeof ABI,
30+
typeof FUNCTION,
31+
ContractFunctionArgs<typeof ABI, 'nonpayable', typeof FUNCTION>,
2932
TChain,
3033
TAccount,
3134
TChainOverride

src/actions/wallet/L1/writeSendMessage.ts

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ export type WriteSendMessageParameters<
3131
> =
3232
& { args: SendMessageParameters; l1CrossDomainMessenger: RawOrContractAddress<_chainId> }
3333
& L1WriteActionBaseType<
34+
typeof ABI,
35+
typeof FUNCTION,
36+
ContractFunctionArgs<typeof ABI, 'payable', typeof FUNCTION>,
3437
TChain,
3538
TAccount,
3639
TChainOverride

src/types/l1Actions.ts

+13-7
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,27 @@ import type {
55
Chain,
66
ContractFunctionArgs,
77
ContractFunctionName,
8-
SendTransactionParameters,
98
SimulateContractParameters,
9+
WriteContractParameters,
1010
} from 'viem'
1111

1212
export type L1WriteActionBaseType<
13+
TAbi extends Abi | readonly unknown[] = Abi,
14+
TFunctionName extends ContractFunctionName<
15+
TAbi,
16+
'nonpayable' | 'payable'
17+
> = ContractFunctionName<TAbi, 'nonpayable' | 'payable'>,
18+
TArgs extends ContractFunctionArgs<
19+
TAbi,
20+
'nonpayable' | 'payable',
21+
TFunctionName
22+
> = ContractFunctionArgs<TAbi, 'nonpayable' | 'payable', TFunctionName>,
1323
TChain extends Chain | undefined = Chain,
1424
TAccount extends Account | undefined = Account | undefined,
1525
TChainOverride extends Chain | undefined = Chain | undefined,
1626
> = Omit<
17-
SendTransactionParameters<
18-
TChain,
19-
TAccount,
20-
TChainOverride
21-
>,
22-
'chain'
27+
WriteContractParameters<TAbi, TFunctionName, TArgs, TChain, TAccount, TChainOverride>,
28+
'abi' | 'functionName' | 'args' | 'address'
2329
>
2430

2531
export type L1SimulateActionBaseType<

0 commit comments

Comments
 (0)