public class TokenAmount extends Object
It is an unsigned integer where the max value is 2^256 - 1.
Modifier and Type | Field and Description |
---|---|
static BigInteger |
MAX_VALUE
The maximum value of a CIS2 token as per the standard 2^256 - 1.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canEqual(Object other) |
static TokenAmount |
decode(ByteBuffer buffer)
Deserialize a
TokenAmount from the provided buffer. |
byte[] |
encode()
Encode the
TokenAmount in LEB128 unsigned format. |
boolean |
equals(Object o) |
static TokenAmount |
from(long value) |
static TokenAmount |
from(String value) |
BigInteger |
getAmount() |
int |
hashCode() |
String |
toString() |
public static final BigInteger MAX_VALUE
public static TokenAmount from(long value)
public static TokenAmount from(String value)
public byte[] encode()
TokenAmount
in LEB128 unsigned format.RuntimeException
- if the resulting byte array would exceed 37 bytes.public static TokenAmount decode(ByteBuffer buffer)
TokenAmount
from the provided buffer.
This function assumes that the token amounts are LEB128U encoded.buffer
- the buffer to read from.TokenAmount
RuntimeException
- if the encoding is more than 37 bytes.protected boolean canEqual(Object other)
public BigInteger getAmount()
Copyright © 2025. All rights reserved.