Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Token

Ethereum ERC-20 compatible token.

Hierarchy

Index

Constructors

constructor

Properties

ascii

ascii: string

Protected blockchain

blockchain: Blockchain

Private decimalsBigNumber

decimalsBigNumber: function = this.contractProperty<BigNumber>('decimals')

Type declaration

    • (): Promise<T>
    • Returns Promise<T>

Private decimals_

decimals_: number | undefined

name

name: function = this.contractProperty<string>('name')

Returns token name.

Type declaration

    • (): Promise<T>
    • Returns Promise<T>

Private name_

name_: string | undefined

Private propertyCache

propertyCache: object

Cache for contract properties.

Type declaration

  • [key: string]: any

symbol

symbol: function = this.contractProperty<string>('symbol')

Returns token symbol.

Type declaration

    • (): Promise<T>
    • Returns Promise<T>

Private symbol_

symbol_: string | undefined

Methods

allowance

  • Returns this token's allowance of an address and spender.

    Parameters

    Returns Promise<BigNumber>

    Balance in this token.

approve

  • approve(spender: Address, value: BigNumber): Promise<void>
  • Sets this token's allowance of a spender from the current coinbase.

    Parameters

    • spender: Address

      Spender of tokens.

    • value: BigNumber

      New allowance for this spender.

    Returns Promise<void>

    Balance in this token.

balance

  • balance(token: Token): Promise<BigNumber>
  • Returns a token's balance of this address.

    Parameters

    • token: Token

      ERC20 compatible token.

    Returns Promise<BigNumber>

    balance

balanceOf

  • balanceOf(address: Address): Promise<BigNumber>
  • Returns this token's balance of an address.

    Parameters

    • address: Address

      Address of which balance to get.

    Returns Promise<BigNumber>

    Balance in this token.

Protected contractProperty

  • contractProperty<T>(key: string): function
  • Returns a caching getter for a constant contract property.

    Type parameters

    • T

    Parameters

    • key: string

      Name of contract property.

    Returns function

    Getter for contract property.

      • (): Promise<T>
      • Returns Promise<T>

decimals

  • decimals(): Promise<BigNumber>
  • Returns token decimal places count.

    TODO(q3k): Replace this once our smart contracts start returning uint8, per ERC20.

    Returns Promise<BigNumber>

eq

  • Compares two addresses for equality, ie. if they are the same address.

    Parameters

    • other: Address

      Address to compare with.

    Returns boolean

    Whether addresses are equal.

humanize

  • humanize(internal: BigNumber): Promise<BigNumber>
  • Converts an integer representation of the tokan into a human-friendly decimal point representation.

    Parameters

    • internal: BigNumber

      Token amount as integer.

    Returns Promise<BigNumber>

    Human-readable decimal point representation.

integerize

  • integerize(human: BigNumber): Promise<BigNumber>
  • Converts a decimal representation of the token into the internal integer representation.

    Parameters

    • human: BigNumber

      Token amount with decimal point.

    Returns Promise<BigNumber>

    Internal integer representation.

printable

proto

  • proto(): pb.Address
  • Converts this address to a proto representation.

    Returns pb.Address

    This address as a protobuf.

token

Generated using TypeDoc