viem 2.23.3 → 2.23.4
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 +10 -0
- package/_cjs/chains/definitions/ethernity.js +30 -0
- package/_cjs/chains/definitions/ethernity.js.map +1 -0
- package/_cjs/chains/definitions/xdc.js +1 -1
- package/_cjs/chains/definitions/xdc.js.map +1 -1
- package/_cjs/chains/index.js +11 -9
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/experimental/eip5792/actions/sendCalls.js +3 -3
- package/_cjs/experimental/eip5792/actions/sendCalls.js.map +1 -1
- package/_cjs/op-stack/actions/getWithdrawalStatus.js +17 -7
- package/_cjs/op-stack/actions/getWithdrawalStatus.js.map +1 -1
- package/_esm/chains/definitions/ethernity.js +27 -0
- package/_esm/chains/definitions/ethernity.js.map +1 -0
- package/_esm/chains/definitions/xdc.js +1 -1
- package/_esm/chains/definitions/xdc.js.map +1 -1
- package/_esm/chains/index.js +1 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/experimental/eip5792/actions/sendCalls.js +3 -3
- package/_esm/experimental/eip5792/actions/sendCalls.js.map +1 -1
- package/_esm/op-stack/actions/getWithdrawalStatus.js +17 -7
- package/_esm/op-stack/actions/getWithdrawalStatus.js.map +1 -1
- package/_types/chains/definitions/ethernity.d.ts +33 -0
- package/_types/chains/definitions/ethernity.d.ts.map +1 -0
- package/_types/chains/definitions/xdc.d.ts +1 -1
- package/_types/chains/index.d.ts +1 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/experimental/eip5792/actions/sendCalls.d.ts +2 -2
- package/_types/experimental/eip5792/actions/sendCalls.d.ts.map +1 -1
- package/_types/op-stack/actions/getWithdrawalStatus.d.ts +20 -1
- package/_types/op-stack/actions/getWithdrawalStatus.d.ts.map +1 -1
- package/_types/types/eip1193.d.ts +1 -3
- package/_types/types/eip1193.d.ts.map +1 -1
- package/chains/definitions/ethernity.ts +27 -0
- package/chains/definitions/xdc.ts +1 -1
- package/chains/index.ts +1 -0
- package/errors/version.ts +1 -1
- package/experimental/eip5792/actions/sendCalls.ts +5 -5
- package/op-stack/actions/getWithdrawalStatus.ts +46 -14
- package/package.json +1 -1
- package/types/eip1193.ts +1 -3
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { Address } from 'abitype'
|
1
2
|
import {
|
2
3
|
type ReadContractErrorType,
|
3
4
|
readContract,
|
@@ -12,6 +13,7 @@ import type {
|
|
12
13
|
DeriveChain,
|
13
14
|
GetChainParameter,
|
14
15
|
} from '../../types/chain.js'
|
16
|
+
import type { Hash } from '../../types/misc.js'
|
15
17
|
import type { TransactionReceipt } from '../../types/transaction.js'
|
16
18
|
import type { OneOf } from '../../types/utils.js'
|
17
19
|
import { portal2Abi, portalAbi } from '../abis.js'
|
@@ -62,13 +64,33 @@ export type GetWithdrawalStatusParameters<
|
|
62
64
|
* @default 100
|
63
65
|
*/
|
64
66
|
gameLimit?: number
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
67
|
+
} & OneOf<
|
68
|
+
| {
|
69
|
+
/**
|
70
|
+
* The relative index of the withdrawal in the transaction receipt logs.
|
71
|
+
* @default 0
|
72
|
+
*/
|
73
|
+
logIndex?: number
|
74
|
+
/**
|
75
|
+
* The transaction receipt of the withdrawal.
|
76
|
+
*/
|
77
|
+
receipt: TransactionReceipt
|
78
|
+
}
|
79
|
+
| {
|
80
|
+
/**
|
81
|
+
* The L2 block number of the withdrawal.
|
82
|
+
*/
|
83
|
+
l2BlockNumber: bigint
|
84
|
+
/**
|
85
|
+
* The sender of the withdrawal.
|
86
|
+
*/
|
87
|
+
sender: Address
|
88
|
+
/**
|
89
|
+
* The hash of the withdrawal.
|
90
|
+
*/
|
91
|
+
withdrawalHash: Hash
|
92
|
+
}
|
93
|
+
>
|
72
94
|
export type GetWithdrawalStatusReturnType =
|
73
95
|
| 'waiting-to-prove'
|
74
96
|
| 'ready-to-prove'
|
@@ -138,12 +160,22 @@ export async function getWithdrawalStatus<
|
|
138
160
|
return Object.values(targetChain.contracts.portal)[0].address
|
139
161
|
})()
|
140
162
|
|
141
|
-
const
|
163
|
+
const l2BlockNumber = receipt?.blockNumber ?? parameters.l2BlockNumber
|
142
164
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
165
|
+
const withdrawal = (() => {
|
166
|
+
if (receipt) {
|
167
|
+
const withdrawal = getWithdrawals({ logs: receipt.logs })[logIndex]
|
168
|
+
if (!withdrawal)
|
169
|
+
throw new ReceiptContainsNoWithdrawalsError({
|
170
|
+
hash: receipt.transactionHash,
|
171
|
+
})
|
172
|
+
return withdrawal
|
173
|
+
}
|
174
|
+
return {
|
175
|
+
sender: parameters.sender,
|
176
|
+
withdrawalHash: parameters.withdrawalHash,
|
177
|
+
}
|
178
|
+
})()
|
147
179
|
|
148
180
|
const portalVersion = await getPortalVersion(
|
149
181
|
client,
|
@@ -156,7 +188,7 @@ export async function getWithdrawalStatus<
|
|
156
188
|
await Promise.allSettled([
|
157
189
|
getL2Output(client, {
|
158
190
|
...parameters,
|
159
|
-
l2BlockNumber
|
191
|
+
l2BlockNumber,
|
160
192
|
} as GetL2OutputParameters),
|
161
193
|
readContract(client, {
|
162
194
|
abi: portalAbi,
|
@@ -221,7 +253,7 @@ export async function getWithdrawalStatus<
|
|
221
253
|
await Promise.allSettled([
|
222
254
|
getGame(client, {
|
223
255
|
...parameters,
|
224
|
-
l2BlockNumber
|
256
|
+
l2BlockNumber,
|
225
257
|
limit: gameLimit,
|
226
258
|
} as GetGameParameters),
|
227
259
|
readContract(client, {
|
package/package.json
CHANGED
package/types/eip1193.ts
CHANGED
@@ -210,15 +210,13 @@ export type WalletSendCallsParameters<
|
|
210
210
|
> = [
|
211
211
|
{
|
212
212
|
calls: readonly {
|
213
|
-
chainId?: chainId | undefined
|
214
213
|
to?: Address | undefined
|
215
214
|
data?: Hex | undefined
|
216
215
|
value?: quantity | undefined
|
217
216
|
}[]
|
218
217
|
capabilities?: capabilities | undefined
|
219
|
-
/** @deprecated Use `chainId` on `calls` instead. */
|
220
218
|
chainId?: chainId | undefined
|
221
|
-
from
|
219
|
+
from?: Address | undefined
|
222
220
|
version: string
|
223
221
|
},
|
224
222
|
]
|