Skip to main content

AVMWebClient

Static Methods

init([options])

Initializes the AVM web client object. If no options are supplied, a default configuration is used.

Parameters

NameTypeRequiredDefaultDescription
optionsIAVMWebClientInitOptionsno-An object to change the initial configuration.

Returns

TypeDescription
AVMWebClientAn initialized AVM web client object.

Methods

disable([params])

Sends a request to remove the client from providers.

Parameters

NameTypeRequiredDefaultDescription
paramsIDisableParamsno-Params that specify which provider,network and/or specific session IDs.

Returns

TypeDescription
stringthe ID of the request message.

discover([params])

Sends a request to get information relating to available providers. This should be called before interacting with any providers to ensure networks and methods are supported.

Parameters

NameTypeRequiredDefaultDescription
paramsIDiscoverParamsno-Params that specify which provider to target.

Returns

TypeDescription
stringthe ID of the request message.

enable([params])

Enables to a client with providers. If the ID of the provider and/or network is specified, that provider/network is used, otherwise the all providers available providers are used.

Parameters

NameTypeRequiredDefaultDescription
paramsIEnableParamsno-Params that specify the provider and/or the network.

Returns

TypeDescription
stringthe ID of the request message.

getConfig()

Returns the configuration.

Returns

TypeDescription
IAVMWebClientConfigThe client's configuration.

onDisable(callback)

Listens to disable messages sent from providers.

Parameters

NameTypeRequiredDefaultDescription
callback(options: IAVMWebClientCallbackOptions) => (void | Promise<void>)yes-The callback is called when a response message is received. If the result was successful, the error parameter will be null.

Returns

TypeDescription
stringthe ID of the listener.

onDiscover(callback)

Listens to discover messages sent from providers.

Parameters

NameTypeRequiredDefaultDescription
callback(options: IAVMWebClientCallbackOptions) => (void | Promise<void>)yes-The callback is called when a response message is received. If the result was successful, the error parameter will be null.

Returns

TypeDescription
stringthe ID of the listener.

onEnable(callback)

Listens to enable messages sent from providers.

Parameters

NameTypeRequiredDefaultDescription
callback(options: IAVMWebClientCallbackOptions) => (void | Promise<void>)yes-The callback is called when a response message is received. If the result was successful, the error parameter will be null.

Returns

TypeDescription
stringthe ID of the listener.

onPostTransactions(callback)

Listens to post_transactions messages sent from providers.

Parameters

NameTypeRequiredDefaultDescription
callback(options: IAVMWebClientCallbackOptions) => (void | Promise<void>)yes-The callback is called when a response message is received. If the result was successful, the error parameter will be null.

Returns

TypeDescription
stringthe ID of the listener.

onSignAndPostTransactions(callback)

Listens to sign_and_post_transactions messages sent from providers.

Parameters

NameTypeRequiredDefaultDescription
callback(options: IAVMWebClientCallbackOptions) => (void | Promise<void>)yes-The callback is called when a response message is received. If the result was successful, the error parameter will be null.

Returns

TypeDescription
stringthe ID of the listener.

onSignMessage(callback)

Listens to sign_message messages sent from providers.

Parameters

NameTypeRequiredDefaultDescription
callback(options: IAVMWebClientCallbackOptions) => (void | Promise<void>)yes-The callback is called when a response message is received. If the result was successful, the error parameter will be null.

onSignTransactions(callback)

Listens to sign_transactions messages sent from providers.

Parameters

NameTypeRequiredDefaultDescription
callback(options: IAVMWebClientCallbackOptions) => (void | Promise<void>)yes-The callback is called when a response message is received. If the result was successful, the error parameter will be null.

Returns

TypeDescription
stringthe ID of the listener.

postTransactions([params])

Request providers to post a list of signed transactions to the network.

Parameters

NameTypeRequiredDefaultDescription
paramsIPostTransactionsParamsyes-Params that specify the provider and the signed transactions.

Returns

TypeDescription
stringthe ID of the request message.

removeAllListeners()

Removes all listeners.

Returns

TypeDescription
void-

removeListener(id)

Removes the listener, by the ID.

Parameters

NameTypeRequiredDefaultDescription
idstringyes-The listener ID to remove.

Returns

TypeDescription
void-

signAndpostTransactions([params])

Request providers to sign and post a list of unsigned transactions to the network.

Parameters

NameTypeRequiredDefaultDescription
paramsISignTransactionsParamsyes-Params that specify the unsigned transactions and the provider.

Returns

TypeDescription
stringthe ID of the request message.

signMessage([params])

Request providers sign a UTF-8 encoded message.

Parameters

NameTypeRequiredDefaultDescription
paramsISignMessageParamsyes-Params that specify the message to sign, the signer and the provider.

Returns

TypeDescription
stringthe ID of the request message.

signTransactions([params])

Request providers to sign a list of unsigned transactions.

Parameters

NameTypeRequiredDefaultDescription
paramsISignTransactionsParamsyes-Params that specify the unsigned transactions and the provider.

Returns

TypeDescription
stringthe ID of the request message.