Typed
The Typed class to wrap values providing explicit type information.
Properties
Property | Modifier | Type | Description |
---|---|---|---|
type | readonly | string | The type, as a Solidity-compatible type. |
value | readonly | any | The actual value. |
Accessors
arrayLength
Returns the length of a typed array.
Throws
If this is not an array.
Returns
null
| number
The length of the array type or -1
if it is dynamic.
Source
tupleName
Returns the tuple name.
Throws
If this is not a tuple.
Returns
null
| string
The tuple name if this is a tuple.
Source
Methods
defaultValue()
The default value returned by this type.
Returns
string
| number
| bigint
| Result
The default value for this type.
Source
format()
Format the type as a Human-Readable type.
Returns
string
The human-readable type for the provided type.
Throws
If the type is array or dynamic array.
Source
isBigInt()
Returns whether this is a TypedBigInt | TypedBigInt. If true, a type guard is provided.
Returns
this is TypedBigInt
true
if this is a big integer.
Source
isData()
Returns whether this is a TypedData | TypedData. If true, a type guard is provided.
Returns
this is TypedData
true
if this is a number.
Source
isString()
Return whether this is a TypedString | TypedString. If true, a type guard is provided.
Returns
this is TypedString
true
if this is a string.
Source
maxValue()
The maximum value for numeric types.
Returns
string
| number
| bigint
The maximum value for the provided numeric type.
Source
minValue()
The minimum value for numeric types.
Returns
string
| number
| bigint
The minimum value for the provided numeric type.
Source
address()
Return a new address
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | string | Addressable | The value to convert to an address . |
Returns
A new address
type for v
.
Source
array()
Return a new array
type for v, allowing dynamic length.
Parameters
Parameter | Type | Description |
---|---|---|
v | any [] | The value to convert to an array . |
dynamic ? | null | boolean | Whether the array is dynamic. |
Returns
A new array
type for v
.
Source
bool()
Return a new bool
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | any | The value to convert to a bool . |
Returns
A new bool
type for v
.
Source
bytes()
Return a new bytes
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes . |
Returns
A new bytes
type for v
.
Source
bytes1()
Return a new bytes1
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes1 . |
Returns
A new bytes1
type for v
.
Source
bytes10()
Return a new bytes10
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes10 . |
Returns
A new bytes10
type for v
.
Source
bytes11()
Return a new bytes11
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes11 . |
Returns
A new bytes11
type for v
.
Source
bytes12()
Return a new bytes12
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes12 . |
Returns
A new bytes12
type for v
.
Source
bytes13()
Return a new bytes13
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes13 . |
Returns
A new bytes13
type for v
.
Source
bytes14()
Return a new bytes14
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes14 . |
Returns
A new bytes14
type for v
.
Source
bytes15()
Return a new bytes15
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes15 . |
Returns
A new bytes15
type for v
.
Source
bytes16()
Return a new bytes16
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes16 . |
Returns
A new bytes16
type for v
.
Source
bytes17()
Return a new bytes17
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes17 . |
Returns
A new bytes17
type for v
.
Source
bytes18()
Return a new bytes18
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes18 . |
Returns
A new bytes18
type for v
.
Source
bytes19()
Return a new bytes19
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes19 . |
Returns
A new bytes19
type for v
.
Source
bytes2()
Return a new bytes2
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes2 . |
Returns
A new bytes2
type for v
.
Source
bytes20()
Return a new bytes20
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes20 . |
Returns
A new bytes20
type for v
.
Source
bytes21()
Return a new bytes21
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes21 . |
Returns
A new bytes21
type for v
.
Source
bytes22()
Return a new bytes22
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes22 . |
Returns
A new bytes22
type for v
.
Source
bytes23()
Return a new bytes23
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes23 . |
Returns
A new bytes23
type for v
.
Source
bytes24()
Return a new bytes24
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes24 . |
Returns
A new bytes24
type for v
.
Source
bytes25()
Return a new bytes25
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes25 . |
Returns
A new bytes25
type for v
.
Source
bytes26()
Return a new bytes26
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes26 . |
Returns
A new bytes26
type for v
.
Source
bytes27()
Return a new bytes27
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes27 . |
Returns
A new bytes27
type for v
.
Source
bytes28()
Return a new bytes28
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes28 . |
Returns
A new bytes28
type for v
.
Source
bytes29()
Return a new bytes29
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes29 . |
Returns
A new bytes29
type for v
.
Source
bytes3()
Return a new bytes3
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes3 . |
Returns
A new bytes3
type for v
.
Source
bytes30()
Return a new bytes30
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes30 . |
Returns
A new bytes30
type for v
.
Source
bytes31()
Return a new bytes31
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes31 . |
Returns
A new bytes31
type for v
.
Source
bytes32()
Return a new bytes32
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes32 . |
Returns
A new bytes32
type for v
.
Source
bytes4()
Return a new bytes4
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes4 . |
Returns
A new bytes4
type for v
.
Source
bytes5()
Return a new bytes5
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes5 . |
Returns
A new bytes5
type for v
.
Source
bytes6()
Return a new bytes6
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes6 . |
Returns
A new bytes6
type for v
.
Source
bytes7()
Return a new bytes7
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes7 . |
Returns
A new bytes7
type for v
.
Source
bytes8()
Return a new bytes8
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes8 . |
Returns
A new bytes8
type for v
.
Source
bytes9()
Return a new bytes9
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BytesLike | The value to convert to a bytes9 . |
Returns
A new bytes9
type for v
.
Source
dereference()
If the value is a Typed instance, validates the underlying value and returns it, otherwise returns value directly.
This is useful for functions that with to accept either a Typed object or values.
Type parameters
Type parameter |
---|
T |
Parameters
Parameter | Type | Description |
---|---|---|
value | Typed | T | The value to dereference. |
type | string | The dereferenced value. |
Returns
T
Source
from()
Returns a new Typed of type
with the value
.
Parameters
Parameter | Type | Description |
---|---|---|
type | string | The type to use. |
value | any | The value to use. |
Returns
Source
int()
Return a new int256
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int256 . |
Returns
A new int256
type for v
.
Source
int104()
Return a new int104
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int104 . |
Returns
A new int104
type for v
.
Source
int112()
Return a new int112
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int112 . |
Returns
A new int112
type for v
.
Source
int120()
Return a new int120
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int120 . |
Returns
A new int120
type for v
.
Source
int128()
Return a new int128
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int128 . |
Returns
A new int128
type for v
.
Source
int136()
Return a new int136
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int136 . |
Returns
A new int136
type for v
.
Source
int144()
Return a new int144
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int144 . |
Returns
A new int144
type for v
.
Source
int152()
Return a new int152
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int152 . |
Returns
A new int152
type for v
.
Source
int16()
Return a new int16
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int16 . |
Returns
A new int16
type for v
.
Source
int160()
Return a new int160
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int160 . |
Returns
A new int160
type for v
.
Source
int168()
Return a new int168
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int168 . |
Returns
A new int168
type for v
.
Source
int176()
Return a new int176
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int176 . |
Returns
A new int176
type for v
.
Source
int184()
Return a new int184
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int184 . |
Returns
A new int184
type for v
.
Source
int192()
Return a new int192
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int192 . |
Returns
A new int192
type for v
.
Source
int200()
Return a new int200
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int200 . |
Returns
A new int200
type for v
.
Source
int208()
Return a new int208
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int208 . |
Returns
A new int208
type for v
.
Source
int216()
Return a new int216
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int216 . |
Returns
A new int216
type for v
.
Source
int224()
Return a new int224
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int224 . |
Returns
A new int224
type for v
.
Source
int232()
Return a new int232
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int232 . |
Returns
A new int232
type for v
.
Source
int24()
Return a new int24
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int24 . |
Returns
A new int24
type for v
.
Source
int240()
Return a new int240
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int240 . |
Returns
A new int240
type for v
.
Source
int248()
Return a new int248
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int248 . |
Returns
A new int248
type for v
.
Source
int256()
Return a new int256
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int256 . |
Returns
A new int256
type for v
.
Source
int32()
Return a new int32
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int32 . |
Returns
A new int32
type for v
.
Source
int40()
Return a new int40
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int40 . |
Returns
A new int40
type for v
.
Source
int48()
Return a new int48
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int48 . |
Returns
A new int48
type for v
.
Source
int56()
Return a new int56
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int56 . |
Returns
A new int56
type for v
.
Source
int64()
Return a new int64
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int64 . |
Returns
A new int64
type for v
.
Source
int72()
Return a new int72
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int72 . |
Returns
A new int72
type for v
.
Source
int8()
Return a new int8
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int8 . |
Returns
A new int8
type for v
.
Source
int80()
Return a new int80
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int80 . |
Returns
A new int80
type for v
.
Source
int88()
Return a new int88
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int88 . |
Returns
A new int88
type for v
.
Source
int96()
Return a new int96
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to an int96 . |
Returns
A new int96
type for v
.
Source
isTyped()
Returns true only if value
is a Typed instance.
Parameters
Parameter | Type | Description |
---|---|---|
value | any | The value to check. |
Returns
value is Typed
True if value
is a Typed instance.
Source
overrides()
Return a new overrides
type with the provided properties.
Parameters
Parameter | Type | Description |
---|---|---|
v | Record <string , any > | A record containing the properties to be included in the overrides type. |
Returns
A new overrides
type with the given properties.
Source
string()
Return a new string
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | string | The value to convert to a string . |
Returns
A new string
type for v
.
Source
tuple()
Return a new tuple
type for v, with the optional name.
Parameters
Parameter | Type | Description |
---|---|---|
v | any [] | Record <string , any > | The value to convert to a tuple . |
name ? | string | The name of the tuple. |
Returns
A new tuple
type for v
.
Source
uint()
Return a new uint256
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint256 . |
Returns
A new uint256
type for v
.
Source
uint104()
Return a new uint104
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint104 . |
Returns
A new uint104
type for v
.
Source
uint112()
Return a new uint112
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint112 . |
Returns
A new uint112
type for v
.
Source
uint120()
Return a new uint120
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint120 . |
Returns
A new uint120
type for v
.
Source
uint128()
Return a new uint128
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint128 . |
Returns
A new uint128
type for v
.
Source
uint136()
Return a new uint136
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint136 . |
Returns
A new uint136
type for v
.
Source
uint144()
Return a new uint144
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint144 . |
Returns
A new uint144
type for v
.
Source
uint152()
Return a new uint152
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint152 . |
Returns
A new uint152
type for v
.
Source
uint16()
Return a new uint16
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint16 . |
Returns
A new uint16
type for v
.
Source
uint160()
Return a new uint160
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint160 . |
Returns
A new uint160
type for v
.
Source
uint168()
Return a new uint168
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint168 . |
Returns
A new uint168
type for v
.
Source
uint176()
Return a new uint176
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint176 . |
Returns
A new uint176
type for v
.
Source
uint184()
Return a new uint184
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint184 . |
Returns
A new uint184
type for v
.
Source
uint192()
Return a new uint192
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint192 . |
Returns
A new uint192
type for v
.
Source
uint200()
Return a new uint200
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint200 . |
Returns
A new uint200
type for v
.
Source
uint208()
Return a new uint208
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint208 . |
Returns
A new uint208
type for v
.
Source
uint216()
Return a new uint216
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint216 . |
Returns
A new uint216
type for v
.
Source
uint224()
Return a new uint224
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint224 . |
Returns
A new uint224
type for v
.
Source
uint232()
Return a new uint232
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint232 . |
Returns
A new uint232
type for v
.
Source
uint24()
Return a new uint24
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint24 . |
Returns
A new uint24
type for v
.
Source
uint240()
Return a new uint240
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint240 . |
Returns
A new uint240
type for v
.
Source
uint248()
Return a new uint248
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint248 . |
Returns
A new uint248
type for v
.
Source
uint256()
Return a new uint256
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint256 . |
Returns
A new uint256
type for v
.
Source
uint32()
Return a new uint32
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint32 . |
Returns
A new uint32
type for v
.
Source
uint40()
Return a new uint40
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint40 . |
Returns
A new uint40
type for v
.
Source
uint48()
Return a new uint48
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint48 . |
Returns
A new uint48
type for v
.
Source
uint56()
Return a new uint56
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint56 . |
Returns
A new uint56
type for v
.
Source
uint64()
Return a new uint64
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint64 . |
Returns
A new uint64
type for v
.
Source
uint72()
Return a new uint72
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint72 . |
Returns
A new uint72
type for v
.
Source
uint8()
Return a new uint8
type for v.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint8 . |
Returns
A new uint8
type for v
.
Source
uint80()
Return a new uint80
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint80 . |
Returns
A new uint80
type for v
.
Source
uint88()
Return a new uint88
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint88 . |
Returns
A new uint88
type for v
.
Source
uint96()
Return a new uint96
type for v
.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The value to convert to a uint96 . |
Returns
A new uint96
type for v
.
Source
Was this page helpful?