Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ZilliqaLaya

ZilliqaLaya

Main class to communicate with zilliqa network on Laya platform.

Hierarchy

  • ZilliqaLaya

Index

Constructors

constructor

  • constructor

    Instantiates a ZilliqaLaya instance with providing node url and provider

    Parameters

    • node: string | ZilliqaNet
    • Optional provider: Provider

    Returns ZilliqaLaya

Properties

Private layaStorage

layaStorage: LayaStorage

Private minimumGasPrice

minimumGasPrice: string | undefined

Private msgVersion

msgVersion: number | undefined

netUrl

netUrl: string

netUrl

Zilliqa node url

zilliqaClient

zilliqaClient: Zilliqa

zilliqaClient

Native zilliqa client that provides more features.

Static Private MAIN_NET_URL

MAIN_NET_URL: string = "https://api.zilliqa.com/"

Static Private TEST_NET_URL

TEST_NET_URL: string = "https://dev-api.zilliqa.com"

Methods

callContract

  • callContract(fromAddr: string, contract: Contract, transition: string, args: any, amount: string, gasPrice?: string, gasLimit?: number): Promise<any>
  • callContract

    Call a contract on zilliqa network

    Parameters

    • fromAddr: string
    • contract: Contract
    • transition: string
    • args: any
    • amount: string
    • Optional gasPrice: string
    • Default value gasLimit: number = 100000

    Returns Promise<any>

    Zilliqa transaction if no exception happened

callContractAtAddress

  • callContractAtAddress(fromAddr: string, contractAddr: string, transition: string, args: any, amount: string, gasPrice?: string, gasLimit?: number): Promise<any>
  • callContractAtAddress

    Call a contract on zilliqa network

    Parameters

    • fromAddr: string
    • contractAddr: string
    • transition: string
    • args: any
    • amount: string
    • Optional gasPrice: string
    • Default value gasLimit: number = 100000

    Returns Promise<any>

    Zilliqa transaction

createAccount

  • createAccount

    Creates new account and returns address with corresponding mnemonic

    Returns IAddressWithMnemonic

    Address and mnemonic

deployContract

  • deployContract(fromAddr: string, code: string, gasPrice?: string, gasLimit?: number): Promise<any>
  • deployContract

    Deploys a contract on zilliqa network

    Parameters

    • fromAddr: string
    • code: string
    • Optional gasPrice: string
    • Default value gasLimit: number = 100000

    Returns Promise<any>

    Zilliqa transaction and contract if no exception happened

getAllAddresses

  • getAllAddresses(): string[]
  • getAllAddresses

    Get all addresses of imported or created accounts

    Returns string[]

    Array of address

getBalance

  • getBalance

    Get balance of given address

    Parameters

    • address: string

    Returns Promise<IZilliqaBalanceResult>

    Balance and nonce

getContractStateAtAddress

  • getContractStateAtAddress(contractAddr: string): Promise<State>
  • getContractStateAtAddress

    Gets contract state within given address

    Parameters

    • contractAddr: string

    Returns Promise<State>

    Contract state

getMinimumGasPrice

  • getMinimumGasPrice(): Promise<string>
  • getMinimumGasPrice

    Get minimum gas price of current network

    Returns Promise<string>

    Gas price

Private getMsgVersion

  • getMsgVersion(): Promise<number>
  • getMsgVersion

    Get message version of current network

    Returns Promise<number>

    Message version

getNetworkId

  • getNetworkId(): Promise<string>
  • getNetworkId

    Get ID of current network

    Returns Promise<string>

    Network ID

importAccountFromMnemonic

  • importAccountFromMnemonic(words: string): string
  • importAccountFromMnemonic

    Imports mnemonic words to add account and returns address

    Parameters

    • words: string

    Returns string

    Address

importAccountFromPrivateKey

  • importAccountFromPrivateKey(privateKey: string): string
  • importAccountFromPrivateKey

    Imports existing private key to add account and returns address

    Parameters

    • privateKey: string

    Returns string

    Address

Private saveAccount

  • saveAccount

    Saves account to storage

    Parameters

    Returns boolean

    Result of operation

sendToken

  • sendToken(fromAddr: string, toAddr: string, amount: string, gasPrice?: string, gasLimit?: number): Promise<any>
  • sendToken

    Sends zilliqa token from one address to another address

    Parameters

    • fromAddr: string
    • toAddr: string
    • amount: string
    • Optional gasPrice: string
    • Default value gasLimit: number = 1

    Returns Promise<any>

    Zilliqa transaction if no exception happened

Private setDefaultAddress

  • setDefaultAddress(address: string): boolean
  • setDefaultAddress

    Sets default account

    Parameters

    • address: string

    Returns boolean

    Result of operation

Generated using TypeDoc