Commitment enum

Commitments

The commitment describes how finalised a block is at that point in time. When querying the ledger state, it's recommended to use lower levels of commitment to report progress and higher levels to ensure the state will not be rolled back.

For processing many dependent transactions in series, it's recommended to use confirmed commitment, which balances speed with rollback safety. For total safety, it's recommended to use finalized commitment.

The default commitment is finalized.

Only methods that query bank state accept the commitment parameter.

The commitment parameter should be included within the last element in the params array:

curl localhost:8899 -X POST -H "Content-Type: application/json" -d '
  {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getBalance",
    "params": [
      "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
      {
        "commitment": "finalized"
      }
    ]
  }
  '
Inheritance
Available extensions
Annotations
  • @JsonEnum()

Values

processed → const Commitment

The node will query its most recent block. Note that the block may still be skipped by the cluster.

confirmed → const Commitment

The node will query the most recent block that has been voted on by supermajority of the cluster. It incorporates votes from gossip and replay.

  • It incorporates votes from gossip and replay.
  • It does not count votes on descendants of a block, only direct votes on that block.
  • It also upholds "optimistic confirmation" guarantees in release 1.3 and onwards.
finalized → const Commitment

The node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognised this block as finalised.

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

compareTo(Commitment? other) int
Compares this to other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() String
Serialises this class into a JSON object.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

tryFromJson(String? json) Commitment?
Creates an instance of this enum from the provided json data.

Constants

values → const List<Commitment>
A constant List of the values in this enum, in order of their declaration.