Skip to main content
@tevm/voltaire
@tevm/voltaire / primitives/Withdrawal

primitives/Withdrawal

Type Aliases

WithdrawalType

WithdrawalType = object
Defined in: src/primitives/Withdrawal/WithdrawalType.ts:16 Withdrawal type - represents Ethereum withdrawal (post-merge) Post-merge (Shanghai/Capella upgrade) withdrawal from beacon chain validators to execution layer accounts

See

Since

0.0.0

Properties

address
readonly address: AddressType
Defined in: src/primitives/Withdrawal/WithdrawalType.ts:22 Address receiving withdrawal
amount
readonly amount: GweiType
Defined in: src/primitives/Withdrawal/WithdrawalType.ts:24 Amount in Gwei
index
readonly index: WithdrawalIndexType
Defined in: src/primitives/Withdrawal/WithdrawalType.ts:18 Withdrawal index (monotonically increasing)
validatorIndex
readonly validatorIndex: ValidatorIndexType
Defined in: src/primitives/Withdrawal/WithdrawalType.ts:20 Validator index on beacon chain

Variables

Withdrawal

const Withdrawal: object
Defined in: src/primitives/Withdrawal/index.ts:8

Type Declaration

equals()
equals: (a, b) => boolean
Check if Withdrawal values are equal
Parameters
a
WithdrawalType First withdrawal
b
WithdrawalType Second withdrawal
Returns
boolean true if equal
See
https://voltaire.tevm.sh/primitives/withdrawal for Withdrawal documentation
Since
0.0.0
Throws
Example
import * as Withdrawal from './primitives/Withdrawal/index.js';
const a = Withdrawal.from({ index: 1n, validatorIndex: 1, address: "0x...", amount: 100n });
const b = Withdrawal.from({ index: 1n, validatorIndex: 1, address: "0x...", amount: 100n });
const result = Withdrawal.equals(a, b); // true
from()
from: (params) => WithdrawalType
Create Withdrawal from components
Parameters
params
Withdrawal parameters
address
string | Uint8Array<ArrayBufferLike> | AddressType Withdrawal recipient address
amount
string | number | bigint | GweiType Amount in Gwei
index
string | number | bigint | WithdrawalIndexType Global withdrawal counter
validatorIndex
string | number | bigint | ValidatorIndexType Validator index
Returns
WithdrawalType Withdrawal
See
https://voltaire.tevm.sh/primitives/withdrawal for Withdrawal documentation
Since
0.0.0
Throws
If any parameter is invalid
Example
import * as Withdrawal from './primitives/Withdrawal/index.js';
const withdrawal = Withdrawal.from({
  index: 1000000n,
  validatorIndex: 123456,
  address: "0x742d35Cc6634C0532925a3b844Bc9e7595f251e3",
  amount: 32000000000n, // 32 ETH in Gwei
});

Functions

equals()

equals(a, b): boolean
Defined in: src/primitives/Withdrawal/equals.js:21 Check if Withdrawal values are equal

Parameters

a
WithdrawalType First withdrawal
b
WithdrawalType Second withdrawal

Returns

boolean true if equal

See

https://voltaire.tevm.sh/primitives/withdrawal for Withdrawal documentation

Since

0.0.0

Throws

Example

import * as Withdrawal from './primitives/Withdrawal/index.js';
const a = Withdrawal.from({ index: 1n, validatorIndex: 1, address: "0x...", amount: 100n });
const b = Withdrawal.from({ index: 1n, validatorIndex: 1, address: "0x...", amount: 100n });
const result = Withdrawal.equals(a, b); // true

from()

from(params): WithdrawalType
Defined in: src/primitives/Withdrawal/from.js:29 Create Withdrawal from components

Parameters

params
Withdrawal parameters
address
string | Uint8Array<ArrayBufferLike> | AddressType Withdrawal recipient address
amount
string | number | bigint | GweiType Amount in Gwei
index
string | number | bigint | WithdrawalIndexType Global withdrawal counter
validatorIndex
string | number | bigint | ValidatorIndexType Validator index

Returns

WithdrawalType Withdrawal

See

https://voltaire.tevm.sh/primitives/withdrawal for Withdrawal documentation

Since

0.0.0

Throws

If any parameter is invalid

Example

import * as Withdrawal from './primitives/Withdrawal/index.js';
const withdrawal = Withdrawal.from({
  index: 1000000n,
  validatorIndex: 123456,
  address: "0x742d35Cc6634C0532925a3b844Bc9e7595f251e3",
  amount: 32000000000n, // 32 ETH in Gwei
});