@celo/contractkit"wrappers/Erc20Wrapper"Erc20Wrapper

Class: Erc20Wrapper <T>

ERC-20 contract only containing the non-optional functions

Type parameters

T: Ierc20

Hierarchy

Erc20Wrapper

CeloTokenWrapper

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

+ new Erc20Wrapper(kit: ContractKit, contract: T): Erc20Wrapper

Inherited from BaseWrapper.constructor

Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:30

Parameters:

Name Type
kit ContractKit
contract T

Returns: Erc20Wrapper

Properties

allowance

allowance: function = proxyCall(this.contract.methods.allowance, undefined, valueToBigNumber)

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)

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 )

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

eventTypes

eventTypes: EventsEnum‹T› = Object.keys(this.events).reduce>( (acc, key) => ({ ...acc, [key]: key }), {} as any )

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, string>>( (acc, method: Methods) => { const methodABI = this.contract.options.jsonInterface.find((item) => item.name === method)

  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


totalSupply

totalSupply: function = proxyCall(this.contract.methods.totalSupply, undefined, valueToBigNumber)

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)

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)

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

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››