@celo/contractkit › "celo-tokens" › CeloTokens
Class: CeloTokens
A helper class to interact with all Celo tokens, ie CELO and stable tokens
Hierarchy
- CeloTokens
Index
Constructors
Properties
Methods
- balancesOf
- forEachCeloToken
- forStableCeloToken
- getAddress
- getAddresses
- getContract
- getExchangeContract
- getExchangesConfigs
- getFeeCurrencyAddress
- getStablesConfigs
- getWrapper
- getWrappers
- isStableToken
- isStableTokenContract
- validCeloTokenInfos
- validStableTokenInfos
Constructors
constructor
+ new CeloTokens(kit
: ContractKit): CeloTokens
Defined in packages/sdk/contractkit/src/celo-tokens.ts:70
Parameters:
Name | Type |
---|---|
kit |
ContractKit |
Returns: CeloTokens
Properties
Readonly
kit
• kit: ContractKit
Defined in packages/sdk/contractkit/src/celo-tokens.ts:71
Methods
balancesOf
▸ balancesOf(address
: string): Promise‹EachCeloToken‹BigNumber››
Defined in packages/sdk/contractkit/src/celo-tokens.ts:79
Gets an address's balance for each celo token.
Parameters:
Name | Type | Description |
---|---|---|
address |
string | the address to look up the balances for |
Returns: Promise‹EachCeloToken‹BigNumber››
a promise resolving to an object containing the address's balance for each celo token
forEachCeloToken
▸ forEachCeloToken<T>(fn
: function): Promise‹EachCeloToken‹T››
Defined in packages/sdk/contractkit/src/celo-tokens.ts:133
Runs fn for each celo token found in celoTokenInfos, and returns the value of each call in an object keyed by the token.
Type parameters:
▪ T
Parameters:
▪ fn: function
the function to be called for each CeloTokenInfo.
▸ (info
: CeloTokenInfo): T | Promise‹T›
Parameters:
Name | Type |
---|---|
info |
CeloTokenInfo |
Returns: Promise‹EachCeloToken‹T››
an object containing the resolved value the call to fn for each celo token.
forStableCeloToken
▸ forStableCeloToken<T>(fn
: function): Promise‹EachCeloToken‹T››
Defined in packages/sdk/contractkit/src/celo-tokens.ts:156
Runs fn for each stable token found in stableTokenInfos, and returns the value of each call in an object keyed by the token.
Type parameters:
▪ T
Parameters:
▪ fn: function
the function to be called for each StableTokenInfo.
▸ (info
: StableTokenInfo): T | Promise‹T›
Parameters:
Name | Type |
---|---|
info |
StableTokenInfo |
Returns: Promise‹EachCeloToken‹T››
an object containing the resolved value the call to fn for each celo token.
getAddress
▸ getAddress(token
: CeloTokenType): Promise‹string›
Defined in packages/sdk/contractkit/src/celo-tokens.ts:260
Gets the address of the contract for the provided token.
Parameters:
Name | Type | Description |
---|---|---|
token |
CeloTokenType | the token to get the (proxy) contract address for |
Returns: Promise‹string›
A promise resolving to the address of the token's contract
getAddresses
▸ getAddresses(): Promise‹EachCeloToken‹string››
Defined in packages/sdk/contractkit/src/celo-tokens.ts:100
Gets the address for each celo token proxy contract.
Returns: Promise‹EachCeloToken‹string››
an promise resolving to an object containing the address for each celo token proxy.
getContract
▸ getContract(token
: StableToken): StableTokenContract
Defined in packages/sdk/contractkit/src/celo-tokens.ts:241
Gets the contract for the provided token
Parameters:
Name | Type | Description |
---|---|---|
token |
StableToken | the token to get the contract of |
Returns: StableTokenContract
The contract for the token
getExchangeContract
▸ getExchangeContract(token
: StableToken): ExchangeContract
Defined in packages/sdk/contractkit/src/celo-tokens.ts:251
Gets the exchange contract for the provided stable token
Parameters:
Name | Type | Description |
---|---|---|
token |
StableToken | the stable token to get exchange contract of |
Returns: ExchangeContract
The exchange contract for the token
getExchangesConfigs
▸ getExchangesConfigs(humanReadable
: boolean): Promise‹EachCeloToken‹ExchangeConfig | object››
Defined in packages/sdk/contractkit/src/celo-tokens.ts:116
Parameters:
Name | Type | Default |
---|---|---|
humanReadable |
boolean | false |
Returns: Promise‹EachCeloToken‹ExchangeConfig | object››
getFeeCurrencyAddress
▸ getFeeCurrencyAddress(token
: CeloTokenType): undefined | Promise‹string›
Defined in packages/sdk/contractkit/src/celo-tokens.ts:269
Gets the address to use as the feeCurrency when paying for gas with the provided token.
Parameters:
Name | Type | Description |
---|---|---|
token |
CeloTokenType | the token to get the feeCurrency address for |
Returns: undefined | Promise‹string›
If not CELO, the address of the token's contract. If CELO, undefined.
getStablesConfigs
▸ getStablesConfigs(humanReadable
: boolean): Promise‹EachCeloToken‹StableTokenConfig | object››
Defined in packages/sdk/contractkit/src/celo-tokens.ts:106
Parameters:
Name | Type | Default |
---|---|---|
humanReadable |
boolean | false |
Returns: Promise‹EachCeloToken‹StableTokenConfig | object››
getWrapper
▸ getWrapper(token
: StableToken): Promise‹StableTokenWrapper›
Defined in packages/sdk/contractkit/src/celo-tokens.ts:229
Gets the wrapper for a given celo token.
Parameters:
Name | Type | Description |
---|---|---|
token |
StableToken | the token to get the appropriate wrapper for |
Returns: Promise‹StableTokenWrapper›
an promise resolving to the wrapper for the token
▸ getWrapper(token
: Token): Promise‹GoldTokenWrapper›
Defined in packages/sdk/contractkit/src/celo-tokens.ts:230
Parameters:
Name | Type |
---|---|
token |
Token |
Returns: Promise‹GoldTokenWrapper›
▸ getWrapper(token
: CeloTokenType): Promise‹CeloTokenWrapper›
Defined in packages/sdk/contractkit/src/celo-tokens.ts:231
Parameters:
Name | Type |
---|---|
token |
CeloTokenType |
Returns: Promise‹CeloTokenWrapper›
getWrappers
▸ getWrappers(): Promise‹EachCeloToken‹CeloTokenWrapper››
Defined in packages/sdk/contractkit/src/celo-tokens.ts:90
Gets the wrapper for each celo token.
Returns: Promise‹EachCeloToken‹CeloTokenWrapper››
an promise resolving to an object containing the wrapper for each celo token.
isStableToken
▸ isStableToken(token
: CeloTokenType): boolean
Defined in packages/sdk/contractkit/src/celo-tokens.ts:281
Returns if the provided token is a StableToken
Parameters:
Name | Type | Description |
---|---|---|
token |
CeloTokenType | the token |
Returns: boolean
if token is a StableToken
isStableTokenContract
▸ isStableTokenContract(contract
: CeloContract): boolean
Defined in packages/sdk/contractkit/src/celo-tokens.ts:286
Parameters:
Name | Type |
---|---|
contract |
CeloContract |
Returns: boolean
validCeloTokenInfos
▸ validCeloTokenInfos(): Promise‹CeloTokenInfo[]›
Defined in packages/sdk/contractkit/src/celo-tokens.ts:189
Returns: Promise‹CeloTokenInfo[]›
validStableTokenInfos
▸ validStableTokenInfos(): Promise‹StableTokenInfo[]›
Defined in packages/sdk/contractkit/src/celo-tokens.ts:206
Returns: Promise‹StableTokenInfo[]›