viem 2.22.4 → 2.22.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +8 -2
- package/_cjs/celo/fees.js +14 -3
- package/_cjs/celo/fees.js.map +1 -1
- package/_cjs/chains/definitions/abstractTestnet.js +1 -1
- package/_cjs/chains/definitions/abstractTestnet.js.map +1 -1
- package/_cjs/chains/definitions/berachainTestnetbArtio.js +8 -0
- package/_cjs/chains/definitions/berachainTestnetbArtio.js.map +1 -1
- package/_cjs/chains/definitions/flowMainnet.js +1 -1
- package/_cjs/chains/definitions/flowMainnet.js.map +1 -1
- package/_cjs/chains/definitions/flowTestnet.js +2 -1
- package/_cjs/chains/definitions/flowTestnet.js.map +1 -1
- package/_cjs/chains/definitions/huddle01Mainnet.js +29 -0
- package/_cjs/chains/definitions/huddle01Mainnet.js.map +1 -0
- package/_cjs/chains/definitions/huddle01Testnet.js +29 -0
- package/_cjs/chains/definitions/huddle01Testnet.js.map +1 -0
- package/_cjs/chains/definitions/kroma.js +6 -0
- package/_cjs/chains/definitions/kroma.js.map +1 -1
- package/_cjs/chains/definitions/kromaSepolia.js +6 -0
- package/_cjs/chains/definitions/kromaSepolia.js.map +1 -1
- package/_cjs/chains/definitions/ternoa.js +22 -0
- package/_cjs/chains/definitions/ternoa.js.map +1 -0
- package/_cjs/chains/index.js +13 -7
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/experimental/eip7702/actions/prepareAuthorization.js +9 -8
- package/_cjs/experimental/eip7702/actions/prepareAuthorization.js.map +1 -1
- package/_cjs/op-stack/actions/estimateFinalizeWithdrawalGas.js +11 -4
- package/_cjs/op-stack/actions/estimateFinalizeWithdrawalGas.js.map +1 -1
- package/_cjs/op-stack/actions/finalizeWithdrawal.js +11 -4
- package/_cjs/op-stack/actions/finalizeWithdrawal.js.map +1 -1
- package/_esm/celo/fees.js +14 -3
- package/_esm/celo/fees.js.map +1 -1
- package/_esm/chains/definitions/abstractTestnet.js +1 -1
- package/_esm/chains/definitions/abstractTestnet.js.map +1 -1
- package/_esm/chains/definitions/berachainTestnetbArtio.js +8 -0
- package/_esm/chains/definitions/berachainTestnetbArtio.js.map +1 -1
- package/_esm/chains/definitions/flowMainnet.js +1 -1
- package/_esm/chains/definitions/flowMainnet.js.map +1 -1
- package/_esm/chains/definitions/flowTestnet.js +2 -1
- package/_esm/chains/definitions/flowTestnet.js.map +1 -1
- package/_esm/chains/definitions/huddle01Mainnet.js +26 -0
- package/_esm/chains/definitions/huddle01Mainnet.js.map +1 -0
- package/_esm/chains/definitions/huddle01Testnet.js +26 -0
- package/_esm/chains/definitions/huddle01Testnet.js.map +1 -0
- package/_esm/chains/definitions/kroma.js +6 -0
- package/_esm/chains/definitions/kroma.js.map +1 -1
- package/_esm/chains/definitions/kromaSepolia.js +6 -0
- package/_esm/chains/definitions/kromaSepolia.js.map +1 -1
- package/_esm/chains/definitions/ternoa.js +19 -0
- package/_esm/chains/definitions/ternoa.js.map +1 -0
- package/_esm/chains/index.js +3 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/experimental/eip7702/actions/prepareAuthorization.js +9 -8
- package/_esm/experimental/eip7702/actions/prepareAuthorization.js.map +1 -1
- package/_esm/op-stack/actions/estimateFinalizeWithdrawalGas.js +12 -5
- package/_esm/op-stack/actions/estimateFinalizeWithdrawalGas.js.map +1 -1
- package/_esm/op-stack/actions/finalizeWithdrawal.js +12 -5
- package/_esm/op-stack/actions/finalizeWithdrawal.js.map +1 -1
- package/_types/celo/fees.d.ts.map +1 -1
- package/_types/chains/definitions/abstractTestnet.d.ts +1 -1
- package/_types/chains/definitions/berachainTestnetbArtio.d.ts +8 -0
- package/_types/chains/definitions/berachainTestnetbArtio.d.ts.map +1 -1
- package/_types/chains/definitions/flowMainnet.d.ts +1 -1
- package/_types/chains/definitions/flowTestnet.d.ts +2 -2
- package/_types/chains/definitions/flowTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/huddle01Mainnet.d.ts +39 -0
- package/_types/chains/definitions/huddle01Mainnet.d.ts.map +1 -0
- package/_types/chains/definitions/huddle01Testnet.d.ts +39 -0
- package/_types/chains/definitions/huddle01Testnet.d.ts.map +1 -0
- package/_types/chains/definitions/kroma.d.ts +6 -10
- package/_types/chains/definitions/kroma.d.ts.map +1 -1
- package/_types/chains/definitions/kromaSepolia.d.ts +6 -10
- package/_types/chains/definitions/kromaSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/ternoa.d.ts +37 -0
- package/_types/chains/definitions/ternoa.d.ts.map +1 -0
- package/_types/chains/index.d.ts +3 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/experimental/eip7702/actions/prepareAuthorization.d.ts +5 -1
- package/_types/experimental/eip7702/actions/prepareAuthorization.d.ts.map +1 -1
- package/_types/op-stack/actions/estimateFinalizeWithdrawalGas.d.ts +5 -0
- package/_types/op-stack/actions/estimateFinalizeWithdrawalGas.d.ts.map +1 -1
- package/_types/op-stack/actions/finalizeWithdrawal.d.ts +5 -0
- package/_types/op-stack/actions/finalizeWithdrawal.d.ts.map +1 -1
- package/celo/fees.ts +15 -4
- package/chains/definitions/abstractTestnet.ts +1 -1
- package/chains/definitions/berachainTestnetbArtio.ts +8 -0
- package/chains/definitions/flowMainnet.ts +1 -1
- package/chains/definitions/flowTestnet.ts +2 -1
- package/chains/definitions/huddle01Mainnet.ts +27 -0
- package/chains/definitions/huddle01Testnet.ts +27 -0
- package/chains/definitions/kroma.ts +6 -0
- package/chains/definitions/kromaSepolia.ts +6 -0
- package/chains/definitions/ternoa.ts +19 -0
- package/chains/index.ts +3 -0
- package/errors/version.ts +1 -1
- package/experimental/eip7702/actions/prepareAuthorization.ts +11 -7
- package/op-stack/actions/estimateFinalizeWithdrawalGas.ts +20 -8
- package/op-stack/actions/finalizeWithdrawal.ts +18 -4
- package/package.json +1 -1
@@ -25,13 +25,17 @@ export type PrepareAuthorizationParameters<
|
|
25
25
|
account extends Account | undefined = Account | undefined,
|
26
26
|
> = GetAccountParameter<account> &
|
27
27
|
PartialBy<Authorization, 'chainId' | 'nonce'> & {
|
28
|
+
/**
|
29
|
+
* @deprecated Use `sponsor` instead.
|
30
|
+
*/
|
31
|
+
delegate?: true | Address | Account | undefined
|
28
32
|
/**
|
29
33
|
* Whether the EIP-7702 Transaction will be executed by another Account.
|
30
34
|
*
|
31
35
|
* If not specified, it will be assumed that the EIP-7702 Transaction will
|
32
36
|
* be executed by the Account that signed the Authorization.
|
33
37
|
*/
|
34
|
-
|
38
|
+
sponsor?: true | Address | Account | undefined
|
35
39
|
}
|
36
40
|
|
37
41
|
export type PrepareAuthorizationReturnType = Authorization
|
@@ -95,7 +99,6 @@ export async function prepareAuthorization<
|
|
95
99
|
contractAddress,
|
96
100
|
chainId,
|
97
101
|
nonce,
|
98
|
-
delegate: delegate_,
|
99
102
|
} = parameters
|
100
103
|
|
101
104
|
if (!account_)
|
@@ -104,9 +107,10 @@ export async function prepareAuthorization<
|
|
104
107
|
})
|
105
108
|
const account = parseAccount(account_)
|
106
109
|
|
107
|
-
const
|
108
|
-
|
109
|
-
if (
|
110
|
+
const sponsor = (() => {
|
111
|
+
const sponsor_ = parameters.sponsor ?? parameters.delegate
|
112
|
+
if (typeof sponsor_ === 'boolean') return sponsor_
|
113
|
+
if (sponsor_) return parseAccount(sponsor_)
|
110
114
|
return undefined
|
111
115
|
})()
|
112
116
|
|
@@ -131,8 +135,8 @@ export async function prepareAuthorization<
|
|
131
135
|
blockTag: 'pending',
|
132
136
|
})
|
133
137
|
if (
|
134
|
-
!
|
135
|
-
(
|
138
|
+
!sponsor ||
|
139
|
+
(sponsor !== true && isAddressEqual(account.address, sponsor.address))
|
136
140
|
)
|
137
141
|
authorization.nonce += 1
|
138
142
|
}
|
@@ -15,7 +15,7 @@ import type {
|
|
15
15
|
} from '../../types/chain.js'
|
16
16
|
import type { UnionEvaluate, UnionOmit } from '../../types/utils.js'
|
17
17
|
import type { FormattedTransactionRequest } from '../../utils/formatters/transactionRequest.js'
|
18
|
-
import { portalAbi } from '../abis.js'
|
18
|
+
import { portal2Abi, portalAbi } from '../abis.js'
|
19
19
|
import type { GetContractAddressParameter } from '../types/contract.js'
|
20
20
|
import type { Withdrawal } from '../types/withdrawal.js'
|
21
21
|
|
@@ -42,6 +42,11 @@ export type EstimateFinalizeWithdrawalGasParameters<
|
|
42
42
|
GetContractAddressParameter<_derivedChain, 'portal'> & {
|
43
43
|
/** Gas limit for transaction execution on the L2. */
|
44
44
|
gas?: bigint | undefined
|
45
|
+
/**
|
46
|
+
* Finalize against a specific proof submitter.
|
47
|
+
* If unspecified, the sending account is the default.
|
48
|
+
*/
|
49
|
+
proofSubmitter?: Address | null | undefined
|
45
50
|
withdrawal: Withdrawal
|
46
51
|
}
|
47
52
|
export type EstimateFinalizeWithdrawalGasReturnType = bigint
|
@@ -93,6 +98,7 @@ export async function estimateFinalizeWithdrawalGas<
|
|
93
98
|
maxFeePerGas,
|
94
99
|
maxPriorityFeePerGas,
|
95
100
|
nonce,
|
101
|
+
proofSubmitter,
|
96
102
|
targetChain,
|
97
103
|
withdrawal,
|
98
104
|
} = parameters
|
@@ -103,12 +109,20 @@ export async function estimateFinalizeWithdrawalGas<
|
|
103
109
|
return Object.values(targetChain!.contracts.portal)[0].address
|
104
110
|
})()
|
105
111
|
|
112
|
+
const [functionName, args, abi] = proofSubmitter
|
113
|
+
? [
|
114
|
+
'finalizeWithdrawalTransactionExternalProof',
|
115
|
+
[withdrawal, proofSubmitter],
|
116
|
+
portal2Abi,
|
117
|
+
]
|
118
|
+
: ['finalizeWithdrawalTransaction', [withdrawal], portalAbi]
|
119
|
+
|
106
120
|
const params = {
|
107
121
|
account,
|
108
|
-
abi
|
122
|
+
abi,
|
109
123
|
address: portalAddress,
|
110
|
-
functionName
|
111
|
-
args
|
124
|
+
functionName,
|
125
|
+
args,
|
112
126
|
gas,
|
113
127
|
maxFeePerGas,
|
114
128
|
maxPriorityFeePerGas,
|
@@ -117,9 +131,7 @@ export async function estimateFinalizeWithdrawalGas<
|
|
117
131
|
// in `estimateContractGas` or `estimateGas`
|
118
132
|
// @ts-ignore
|
119
133
|
chain,
|
120
|
-
} satisfies EstimateContractGasParameters
|
121
|
-
|
122
|
-
'finalizeWithdrawalTransaction'
|
123
|
-
>
|
134
|
+
} satisfies EstimateContractGasParameters
|
135
|
+
|
124
136
|
return estimateContractGas(client, params as any)
|
125
137
|
}
|
@@ -16,7 +16,7 @@ import type {
|
|
16
16
|
import type { Hash } from '../../types/misc.js'
|
17
17
|
import type { UnionEvaluate, UnionOmit } from '../../types/utils.js'
|
18
18
|
import type { FormattedTransactionRequest } from '../../utils/formatters/transactionRequest.js'
|
19
|
-
import { portalAbi } from '../abis.js'
|
19
|
+
import { portal2Abi, portalAbi } from '../abis.js'
|
20
20
|
import type { GetContractAddressParameter } from '../types/contract.js'
|
21
21
|
import type { Withdrawal } from '../types/withdrawal.js'
|
22
22
|
import {
|
@@ -51,6 +51,11 @@ export type FinalizeWithdrawalParameters<
|
|
51
51
|
* `null` to skip gas estimation & defer calculation to signer.
|
52
52
|
*/
|
53
53
|
gas?: bigint | null | undefined
|
54
|
+
/**
|
55
|
+
* Finalize against a provided proof submitter.
|
56
|
+
* If unspecified, the sending account is the default.
|
57
|
+
*/
|
58
|
+
proofSubmitter?: Address | null | undefined
|
54
59
|
withdrawal: Withdrawal
|
55
60
|
}
|
56
61
|
export type FinalizeWithdrawalReturnType = Hash
|
@@ -98,6 +103,7 @@ export async function finalizeWithdrawal<
|
|
98
103
|
maxFeePerGas,
|
99
104
|
maxPriorityFeePerGas,
|
100
105
|
nonce,
|
106
|
+
proofSubmitter,
|
101
107
|
targetChain,
|
102
108
|
withdrawal,
|
103
109
|
} = parameters
|
@@ -116,13 +122,21 @@ export async function finalizeWithdrawal<
|
|
116
122
|
)
|
117
123
|
: undefined
|
118
124
|
|
125
|
+
const [functionName, args, abi] = proofSubmitter
|
126
|
+
? [
|
127
|
+
'finalizeWithdrawalTransactionExternalProof',
|
128
|
+
[withdrawal, proofSubmitter],
|
129
|
+
portal2Abi,
|
130
|
+
]
|
131
|
+
: ['finalizeWithdrawalTransaction', [withdrawal], portalAbi]
|
132
|
+
|
119
133
|
return writeContract(client, {
|
120
134
|
account: account!,
|
121
|
-
abi
|
135
|
+
abi,
|
122
136
|
address: portalAddress,
|
123
137
|
chain,
|
124
|
-
functionName
|
125
|
-
args
|
138
|
+
functionName,
|
139
|
+
args,
|
126
140
|
gas: gas_,
|
127
141
|
maxFeePerGas,
|
128
142
|
maxPriorityFeePerGas,
|