KyberSwap Docs
Search
K
Comment on page

Token

Token represents an ERC20 token with a unique address and additional data on whether the token is a native currency. The Token class ensures Token equivalence when executing functions.
GitHub File: token.ts

Extends

Properties

Public

Property
Type
Modifier
Description
address
string
readonly
The token contract address.
chainId
ChainId
readonly
The chain ID on which this currency resides. See supported chains.
chainType
ChainType
readonly
The virtual machine environment. Currently supports EVM only.
decimals
number
readonly
Number of decimals for the currency.
symbol
string
readonly
The currency symbol. Optional.
name
string
readonly
The currency name. Optional.
isNative
boolean
readonly
Whether the currency is native to the chain and must be wrapped.
isToken
boolean
readonly
Whether the currency meets the ERC20 standard and if not, needs to be wrapped.
Note that the mint property was previously used to manage Solana tokens but support for Solana on KyberSwap has since been deprecated.

Constructor

Parameters

Params
Type
Description
chainId
number
The chain ID on which this currency resides. See supported chains.
address
string
The token contract address.
decimals
number
Number of decimals for the currency.
symbol
string
The currency symbol. Optional.
name
string
The currency name. Optional.

Methods

equals() - public

Returns whether the token passed in the argument is functionally equivalent to the token implementing this class (i.e. same contract address on the same chain).

Parameters

Params
Type
Description
other
Token
The token to check against.

Returns

Type
Description
boolean
Indicates whether the token passed in the argument is functionally equivalent to the token implementing this class.

sortsBefore() - public

Returns true if the token's contract address sorts before the input token contract address. Also checks if the tokens are equivalent else throws an error (i.e. same contract address and chain).

Parameters

Params
Type
Description
other
Token
The currency to check against.

Returns

Type
Description
boolean
true = Token's contract address sorts before input token address. false = Token's contract address sorts after input token address.

wrapped() - public get

Accessor that returns this ERC20 token.

Returns

Type
Description
Token
The token implementing this class.