You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
821 B
30 lines
821 B
import type { ErrorType } from '../../errors/utils.js'
|
|
import type { Hash } from '../../types/misc.js'
|
|
import {
|
|
type EncodeAbiParametersErrorType,
|
|
encodeAbiParameters,
|
|
} from '../../utils/abi/encodeAbiParameters.js'
|
|
import {
|
|
type Keccak256ErrorType,
|
|
keccak256,
|
|
} from '../../utils/hash/keccak256.js'
|
|
|
|
export type GetWithdrawalHashStorageSlotParameters = {
|
|
withdrawalHash: Hash
|
|
}
|
|
export type GetWithdrawalHashStorageSlotReturnType = Hash
|
|
export type GetWithdrawalHashStorageSlotErrorType =
|
|
| EncodeAbiParametersErrorType
|
|
| Keccak256ErrorType
|
|
| ErrorType
|
|
|
|
export function getWithdrawalHashStorageSlot({
|
|
withdrawalHash,
|
|
}: GetWithdrawalHashStorageSlotParameters) {
|
|
const data = encodeAbiParameters(
|
|
[{ type: 'bytes32' }, { type: 'uint256' }],
|
|
[withdrawalHash, 0n],
|
|
)
|
|
return keccak256(data)
|
|
}
|