Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Web3Pure

Contains common methods, connected with web3, e.g. wei conversion, encoding data, etc.

Hierarchy

  • Web3Pure

Index

Constructors

Properties

ZERO_ADDRESS: "0x0000000000000000000000000000000000000000" = '0x0000000000000000000000000000000000000000'

Accessors

  • get nativeTokenAddress(): string

Methods

  • addressToBytes32(address: string): string
  • asciiToBytes32(address: string): string
  • calculateGasMargin(gasLimit: undefined | string | number | BigNumber, multiplier: number): BigNumber
  • Increases the gas limit value by the specified percentage and rounds to the nearest integer.

    Parameters

    • gasLimit: undefined | string | number | BigNumber

      Gas limit value to increase.

    • multiplier: number

      The multiplier by which the gas limit will be increased.

    Returns BigNumber

  • encodeFunctionCall(contractAbi: AbiItem[], methodName: string, methodArguments: unknown[]): string
  • Encodes a function call using its JSON interface object and given parameters.

    Parameters

    • contractAbi: AbiItem[]

      The JSON interface object of a function.

    • methodName: string

      Method name to encode.

    • methodArguments: unknown[]

      Parameters to encode.

    Returns string

    An ABI encoded function call. Means function signature + parameters.

  • encodeMethodCall(contractAddress: string, contractAbi: AbiItem[], method: string, parameters?: unknown[], value?: string, options?: TransactionGasParams): TransactionConfig
  • Returns transaction config with encoded data.

    Parameters

    • contractAddress: string
    • contractAbi: AbiItem[]
    • method: string
    • parameters: unknown[] = []
    • Optional value: string
    • options: TransactionGasParams = {}

    Returns TransactionConfig

  • fromWei(amountInWei: string | number | BigNumber, decimals?: number): BigNumber
  • isAddressCorrect(address: string): boolean
  • isNativeAddress(address: string): boolean
  • isZeroAddress(address: string): boolean
  • toChecksumAddress(address: string): string
  • toWei(amount: string | number | BigNumber, decimals?: number, roundingMode?: RoundingMode): string
  • Converts amount from Ether to Wei units.

    Parameters

    • amount: string | number | BigNumber

      Amount to convert.

    • decimals: number = 18

      Token decimals.

    • Optional roundingMode: RoundingMode

      BigNumberRoundingMode.

    Returns string

Generated using TypeDoc