@celo/contractkit › "wrappers/CeloTokenWrapper" › CeloTokenWrapper
Class: CeloTokenWrapper <T>
Contract for Celo native currency that adheres to the ICeloToken and IERC20 interfaces.
Type parameters
▪ T: Ierc20 & ICeloToken
Hierarchy
↳ Erc20Wrapper‹T›
↳ CeloTokenWrapper
Index
Constructors
Properties
- allowance
- approve
- balanceOf
- decimals
- eventTypes
- events
- methodIds
- name
- symbol
- totalSupply
- transfer
- transferFrom
- transferWithComment
Accessors
Methods
Constructors
constructor
+ new CeloTokenWrapper(kit
: ContractKit, contract
: T): CeloTokenWrapper
Inherited from BaseWrapper.constructor
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:30
Parameters:
Name | Type |
---|---|
kit |
ContractKit |
contract |
T |
Returns: CeloTokenWrapper
Properties
allowance
• allowance: function = proxyCall(this.contract.methods.allowance, undefined, valueToBigNumber)
Inherited from Erc20Wrapper.allowance
Defined in packages/sdk/contractkit/src/wrappers/Erc20Wrapper.ts:18
Querying allowance.
param
Account who has given the allowance.
param
Address of account to whom the allowance was given.
returns
Amount of allowance.
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
approve
• approve: function = proxySend(this.kit, this.contract.methods.approve)
Inherited from Erc20Wrapper.approve
Defined in packages/sdk/contractkit/src/wrappers/Erc20Wrapper.ts:32
Approve a user to transfer the token on behalf of another user.
param
The address which is being approved to spend the token.
param
The amount of the token approved to the spender.
returns
True if the transaction succeeds.
Type declaration:
▸ (...args
: InputArgs): CeloTransactionObject‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
balanceOf
• balanceOf: function = proxyCall( this.contract.methods.balanceOf, undefined, valueToBigNumber )
Inherited from Erc20Wrapper.balanceOf
Defined in packages/sdk/contractkit/src/wrappers/Erc20Wrapper.ts:56
Gets the balance of the specified address.
param
The address to query the balance of.
returns
The balance of the specified address.
Type declaration:
▸ (owner
: string): Promise‹BigNumber›
Parameters:
Name | Type |
---|---|
owner |
string |
decimals
• decimals: function = proxyCall(this.contract.methods.decimals, undefined, valueToInt)
Defined in packages/sdk/contractkit/src/wrappers/CeloTokenWrapper.ts:29
Returns the number of decimals used in the token.
returns
Number of decimals.
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
eventTypes
• eventTypes: EventsEnum‹T› = Object.keys(this.events).reduce
Inherited from BaseWrapper.eventTypes
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:61
events
• events: T["events"] = this.contract.events
Inherited from BaseWrapper.events
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:59
methodIds
• methodIds: Record‹keyof T["methods"], string› = Object.keys(this.contract.methods).reduce
acc[method] =
methodABI === undefined
? '0x'
: this.kit.connection.getAbiCoder().encodeFunctionSignature(methodABI)
return acc
},
{} as any
)
Inherited from BaseWrapper.methodIds
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:66
name
• name: function = proxyCall(this.contract.methods.name)
Defined in packages/sdk/contractkit/src/wrappers/CeloTokenWrapper.ts:18
Returns the name of the token.
returns
Name of the token.
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
symbol
• symbol: function = proxyCall(this.contract.methods.symbol)
Defined in packages/sdk/contractkit/src/wrappers/CeloTokenWrapper.ts:24
Returns the three letter symbol of the token.
returns
Symbol of the token.
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
totalSupply
• totalSupply: function = proxyCall(this.contract.methods.totalSupply, undefined, valueToBigNumber)
Inherited from Erc20Wrapper.totalSupply
Defined in packages/sdk/contractkit/src/wrappers/Erc20Wrapper.ts:24
Returns the total supply of the token, that is, the amount of tokens currently minted.
returns
Total supply.
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
transfer
• transfer: function = proxySend(this.kit, this.contract.methods.transfer)
Inherited from Erc20Wrapper.transfer
Defined in packages/sdk/contractkit/src/wrappers/Erc20Wrapper.ts:40
Transfers the token from one address to another.
param
The address to transfer the token to.
param
The amount of the token to transfer.
returns
True if the transaction succeeds.
Type declaration:
▸ (...args
: InputArgs): CeloTransactionObject‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
transferFrom
• transferFrom: function = proxySend(this.kit, this.contract.methods.transferFrom)
Inherited from Erc20Wrapper.transferFrom
Defined in packages/sdk/contractkit/src/wrappers/Erc20Wrapper.ts:49
Transfers the token from one address to another on behalf of a user.
param
The address to transfer the token from.
param
The address to transfer the token to.
param
The amount of the token to transfer.
returns
True if the transaction succeeds.
Type declaration:
▸ (...args
: InputArgs): CeloTransactionObject‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
transferWithComment
• transferWithComment: function = proxySend(this.kit, this.contract.methods.transferWithComment)
Defined in packages/sdk/contractkit/src/wrappers/CeloTokenWrapper.ts:38
Transfers the token from one address to another with a comment.
param
The address to transfer the token to.
param
The amount of the token to transfer.
param
The transfer comment
returns
True if the transaction succeeds.
Type declaration:
▸ (...args
: InputArgs): CeloTransactionObject‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
Accessors
address
• get address(): string
Inherited from BaseWrapper.address
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:35
Contract address
Returns: string
Methods
getPastEvents
▸ getPastEvents(event
: Events‹T›, options
: PastEventOptions): Promise‹EventLog[]›
Inherited from BaseWrapper.getPastEvents
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:55
Contract getPastEvents
Parameters:
Name | Type |
---|---|
event |
Events‹T› |
options |
PastEventOptions |
Returns: Promise‹EventLog[]›
version
▸ version(): Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››
Inherited from BaseWrapper.version
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:39
Returns: Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››