Search documentation of Cartouche

# Cartouche.Block.Withdrawal (Cartouche v0.1.3)

Copy Markdown View Source

A validator withdrawal entry from a post-Shanghai block (EIP-4895).

Embedded in `Cartouche.Block.t().withdrawals` when the block is post-Shanghai (block ≥ 17,034,870 on mainnet).

## Summary

### Types

t()

### Functions

deserialize(params)

Deserializes a withdrawal object from JSON-RPC.

## Types

# t()

    @type t() :: %Cartouche.Block.Withdrawal{
      address: <<_::160>>,
      amount: integer(),
      index: integer(),
      validator_index: integer()
    }

## Functions

# deserialize(params)

    @spec deserialize(map()) :: t() | no_return()

Deserializes a withdrawal object from JSON-RPC.

## Examples

    iex> use Cartouche.Hex
    iex> %{
    ...>   "index" => "0x4d8f7d",
    ...>   "validatorIndex" => "0xc8a5f",
    ...>   "address" => "0x1f9090aae28b8a3dceadf281b0f12828e676c326",
    ...>   "amount" => "0x111c8c2"
    ...> }
    ...> |> Cartouche.Block.Withdrawal.deserialize()
    %Cartouche.Block.Withdrawal{
      index: 0x4d8f7d,
      validator_index: 0xc8a5f,
      address: ~h[0x1f9090aae28b8a3dceadf281b0f12828e676c326],
      amount: 0x111c8c2
    }