Home | SDKs

API Documentation

ConnectionManager

connect()

public connect(host: string, name = "main")

Connect to the given connection.

Parameters

Type Name Required Description
string host Yes Node URL
string name No Network name

Return Value

Connection

disconnect()

public disconnect(name?: string)

Disconnect from the given connection.

Parameters

Type Name Required Description
string name No Network Name

Return Value

void

connection()

public connection(name?: string)

Get a connection instance.

Parameters

Type Name Required Description
string name No Network Name

Return Value

Connection

getDefaultConnection()

public getDefaultConnection()

Get the default connection name.

Return Value

string

setDefaultConnection()

public setDefaultConnection(name: string)

Set the default connection name.

Parameters

Type Name Required Description
string name No Network Name

Return Value

void

getConnections()

public getConnections()

Return all of the created connections.

Return Value

Record<string, Connection>

Connection

constructor()

public constructor(private readonly host: string)

Create a new Connection class instance.

Parameters

Type Name Required Description
string host Yes Node URL

api()

public api(name: string)

Instantiate new Api.

Parameters

Type Name Required Description
string name Yes Network name

Return Value

T

Type Name Required Description
string host Yes Node URL

withOptions()

public withOptions(opts: Record)

Apply options to future connection requests.

Parameters

Type Name Required Description
string opts Yes Connection options

Return Value

this

get()

public async get(url: string, opts?: Record)

Send a GET request with query parameters.

Parameters

Type Name Required Description
string url Yes Endpoint
Record opts? No Query parameters

Return Value

Promise<IResponse<T>>

post()

public async post(url: string, opts?: Record): Promise>

Send a POST request with JSON-encoded parameters.

Parameters

Type Name Required Description
string url Yes Endpoint
Record opts? No Query parameters

Return Value

Promise<IResponse<T>>

RequestError

constructor()

public constructor(error)

Create a new RequestError class instance.

Parameters

Type Name Required Description
string error Yes Error

Resources\Blocks

all()

public async all(query?: Record)

Get all blocks.

Parameters

Type Name Required Description
Record query No Query parameters

Return Value

Promise<IResponse<T>>

get()

public async get(id: string)

Get a block by the given id.

Parameters

Type Name Required Description
string id Yes Block ID

Return Value

Promise<IResponse<T>>

transactions()

public async transactions(id: string, query?: Record)

Get all transactions by the given block.

Parameters

Type Name Required Description
string id Yes Block ID
Record query No Query parameters

Return Value

Promise<IResponse<T>>

search()

public async search(payload?: Record)

Filter all blocks by the given parameters.

Parameters

Type Name Required Description
Record payload No Search parameters

Return Value

Promise<IResponse<T>>

Resources\Bridgechains

all()

public async all(query?: Record)

Get all bridgechains.

Parameters

Type Name Required Description
Record query No Query parameters

Return Value

Promise<IResponse<T>>

get()

public async get(id: string)

Get a bridgechain by the given id.

Parameters

Type Name Required Description
string id Yes Bridgechain identifier

Return Value

Promise<IResponse<T>>

search()

public async search(payload?: Record)

Search for a bridgechain with the given payload.

Parameters

Type Name Required Description
Record payload No Search parameters

Return Value

Promise<IResponse<T>>

Resources\Businesses

all()

public async all(query?: Record)

Get all businesses.

Parameters

Type Name Required Description
Record query No Query parameters

Return Value

Promise<IResponse<T>>

get()

public async get(id: string)

Get a business by the given id.

Parameters

Type Name Required Description
string id Yes Bridgechain identifier

Return Value

Promise<IResponse<T>>

bridgechains()

public async bridgechains(id: string, query?: Record)

Get all bridgechains for a business.

Parameters

Type Name Required Description
string id Yes Business identifier
Record payload No Search parameters

Return Value

Promise<IResponse<T>>

search()

public async search(payload?: Record)

Search for a business with the given payload.

Parameters

Type Name Required Description
Record payload No Search parameters

Return Value

Promise<IResponse<T>>

Resources\Locks

all()

public async all(query?: Record)

Get all locks.

Parameters

Type Name Required Description
Record query No Query parameters

Return Value

Promise<IResponse<T>>

get()

public async get(id: string)

Get a lock by the given id.

Parameters

Type Name Required Description
string id Yes Bridgechain identifier

Return Value

Promise<IResponse<T>>

search()

public async search(payload?: Record)

Search for locks with given payload.

Parameters

Type Name Required Description
Record payload No Search parameters

Return Value

Promise<IResponse<T>>

unlocked()

public async unlocked(payload?: Record)

Search for unlocked locks.

Parameters

Type Name Required Description
Record payload No Search parameters

Return Value

Promise<IResponse<T>>

Resources\Delegates

all()

public async all(query?: Record)

Get all accounts.

Parameters

Type Name Required Description
Record query No Query parameters

Return Value

Promise<IResponse<T>>

get()

public async get(id: string)

Get a delegate by the given id.

Parameters

Type Name Required Description
string id Yes Delegate identifier

Return Value

Promise<IResponse<T>>

blocks()

public async blocks(id: string, query?: Record)

Get all blocks for the given delegate.

Parameters

Type Name Required Description
string id Yes Delegate identifier
Record query No Query parameters

Return Value

Promise<IResponse<T>>

voters()

public async voters(id: string, query?: Record)

Get all voters for the given delegate.

Parameters

Type Name Required Description
string id Yes Delegate identifier
Record query No Query parameters

Return Value

Promise<IResponse<T>>

Resources\Node

configuration()

public async configuration()

Get the node configuration.

Return Value

Promise<IResponse<T>>

status()

public async status()

Get the node status.

Return Value

Promise<IResponse<T>>

syncing()

public async syncing()

Get the node syncing status.

Return Value

Promise<IResponse<T>>

crypto()

public async crypto()

Get the node crypto configuration.

Return Value

Promise<IResponse<T>>

fees()

public async fees(days: number)

Get the node fee statistics.

Parameters

Type Name Required Description
number days Yes Days

Return Value

Promise<IResponse<T>>

Resources\Peers

all()

public async all(query?: Record)

Get all peers.

Parameters

Type Name Required Description
Record query No Query parameters

Return Value

Promise<IResponse<T>>

get()

public async get(ip: string)

Get a peer by the given IP address.

Parameters

Type Name Required Description
string ip Yes IP address

Return Value

Promise<IResponse<T>>

Resources\Rounds

delegates()

public async delegates(id: number)

Get delegates for a round.

Parameters

Type Name Required Description
number id yes Round number

Return Value

Promise<IResponse<T>>

Resources\Transactions

create()

public async create(payload: object[])

Create a new transaction.

Parameters

Type Name Required Description
object[] payload Yes Transaction(s) to broadcast

Return Value

Promise<IResponse<T>>

get()

public async get(id: string)

Get a transaction by the given id.

Parameters

Type Name Required Description
string id Yes Transaction ID

Return Value

Promise<IResponse<T>>

all()

public async all(query?: Record)

Get all transactions.

Parameters

Type Name Required Description
Record query No Query parameters

Return Value

Promise<IResponse<T>>

allUnconfirmed()

public async allUnconfirmed(query?: Record)

Get all unconfirmed transactions.

Parameters

Type Name Required Description
Record query No Query parameters

Return Value

Promise<IResponse<T>>

getUnconfirmed()

public async getUnconfirmed(id: string)

Get an unconfirmed transaction by the given id.

Parameters

Type Name Required Description
string id Yes Transaction ID

Return Value

Promise<IResponse<T>>

search()

public async search(payload: Record)

Filter all transactions by the given parameters.

Parameters

Type Name Required Description
Record payload Yes Search parameters

Return Value

Promise<IResponse<T>>

types()

public async types()

Get a list of valid transaction types.

Return Value

Promise<IResponse<T>>

fees()

public async fees(): Promise>

Get the node fee statistics.

Return Value

Promise<IResponse<T>>

Resources\Votes

all()

public async all(query?: Record)

Get all votes.

Parameters

Type Name Required Description
Record query No Query parameters

Return Value

Promise<IResponse<T>>

get()

public async get(id: string)

Get a vote by the given id.

Parameters

Type Name Required Description
string id Yes Vote ID

Return Value

Promise<IResponse<T>>

Resources\Wallets

all()

public async all(query?: Record)

Get all wallets.

Parameters

Type Name Required Description
Record query No Query parameters

Return Value

Promise<IResponse<T>>

get()

public async get(id: string)

Get a wallet by the given id.

Parameters

Type Name Required Description
string id Yes Wallet identifier

Return Value

Promise<IResponse<T>>

locks()

public async locks(id: string, query?: Record)

Get a wallet by the given id.

Parameters

Type Name Required Description
string id Yes Wallet identifier
Record query No Search parameters

Return Value

Promise<IResponse<T>>

transactions()

public async transactions(id: string, query?: Record)

Get all transactions for the given wallet.

Parameters

Type Name Required Description
string id Yes Wallet identifier
Record query Yes Query parameters

Return Value

Promise<IResponse<T>>

transactionsReceived()

public async transactionsReceived(id: string, query?: Record)

Get all transactions received by the given wallet.

Parameters

Type Name Required Description
string id Yes Wallet identifier
Record query Yes Query parameters

Return Value

Promise<IResponse<T>>

transactionsSent()

public async transactionsSent(id: string, query?: Record)

Get all transactions sent by the given wallet.

Parameters

Type Name Required Description
string id Yes Wallet identifier
Record query Yes Query parameters

Return Value

Promise<IResponse<T>>

votes()

public async votes(id: string)

Get all votes by the given wallet.

Parameters

Type Name Required Description
string id Yes Wallet identifier

Return Value

Promise<IResponse<T>>

top()

public async top(query?: Record)

Get all wallets sorted by balance in descending order.

Parameters

Type Name Required Description
Record query Yes Query parameters

Return Value

Promise<IResponse<T>>

search()

public async search(payload: Record)

Filter all wallets by the given parameters.

Parameters

Type Name Required Description
Record payload Yes Search parameters

Return Value

Promise<IResponse<T>>


2020 © ARK.io | All rights reserved | An ARK.io Product