npm i @leofcoin/endpoint-clients
import WsClient from '@leofcoin/endpoint-clients/ws'
import HttpClient from '@leofcoin/endpoint-clients/http'
const networkVersion = 'peach'
const ws = new WsClient('ws://localhost:4040', networkVersion)
const http = new HttpClient('http://localhost:8080', networkVersion)
address
: desired address
set default account to given address
await client.selectAccount(address)
index
: index of the block to fetch
await client.getBlock(10)
amount
: the amount to slice
await client.blocks(-25)
createTransactionFrom(from: string
, to: string
, method: string
, parameters: array
, nonce: number
| undefined
)
from
:
to
:
method
:
parameters
:
nonce
:
await client.createTransactionFrom(from, to, method, parameters, nonce)
name
: name of the contract to lookup the address and owner of
await client.lookup('contractName')
address
:
await client.participate(address)
contract
: contract address todo the call on
method
: method/function to call
params
: array containing params needed to call the desired method
await client.staticCall(contract, method, params)
owner
: address of the deployer
code
: contract as a string
params
: contract constructor params
const address = await client.createContractAddress(owner, code, params)
code
: contract as a string
params
: contract constructor params
const tx = await client.deployContract(code, params)
await client.accounts()
await client.hasTransactionToHandle()
returns all balances
await client.balances()
address
: The address to check
format
: Wether or not to format
returns the balance of given address as BigNumber or string (when format is true)
await client.balanceOf(address, true)
await client.selectedAccount()
await client.peerId()
await client.peers()
await client.validators()
await client.nativeBurns()
await client.contracts()
await client.nativeMints()
await client.nativeToken()
await client. nativeTransfers()
await client.totalSize()
await client.totalTransactions()
await client.totalBlocks()
await client.nativeCalls()
await client.participating()