Skip to main content

AVMWebProvider

Static Methods

init([options])

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

Parameters

NameTypeRequiredDefaultDescription
providerIdstringyes-This ID of the provider. It is recommended you use a UUIDv4 compliant string.
optionsIAVMWebProviderInitOptionsno-An object to change the initial configuration.

Returns

TypeDescription
AVMWebProviderAn initialized AVM web provider object.

Methods

getConfig()

Returns the configuration.

Returns

TypeDescription
IAVMWebProviderConfigThe provider's configuration.

onDisable(callback)

Listens to disable messages sent from clients.

Parameters

NameTypeRequiredDefaultDescription
callback(options: IAVMWebProviderCallbackOptions) => (IDisableResult | Promise<IDiscoverResult>)yes-The listener to call when the request message is sent.

Returns

TypeDescription
stringthe ID of the listener.

onDiscover(callback)

Listens to discover messages sent from clients.

Parameters

NameTypeRequiredDefaultDescription
callback(options: IAVMWebProviderCallbackOptions) => (IDiscoverResult | Promise<IDiscoverResult>)yes-The listener to call when the request message is sent.

Returns

TypeDescription
stringthe ID of the listener.

onEnable(callback)

Listens to enable messages sent from clients.

Parameters

NameTypeRequiredDefaultDescription
callback(options: IAVMWebProviderCallbackOptions) => (IEnableResult | Promise<IEnableResult>)yes-The listener to call when the request message is sent.

Returns

TypeDescription
stringthe ID of the listener.

onPostTransactions(callback)

Listens to post_transactions messages sent from clients.

Parameters

NameTypeRequiredDefaultDescription
callback(options: IAVMWebProviderCallbackOptions) => (IPostTransactionsResult | Promise<IPostTransactionsResult>)yes-The listener to call when the request message is sent.

Returns

TypeDescription
stringthe ID of the listener.

onSignAndPostTransactions(callback)

Listens to sign_and_post_transactions messages sent from clients.

Parameters

NameTypeRequiredDefaultDescription
callback(options: IAVMWebProviderCallbackOptions) => (IPostTransactionsResult | Promise<IPostTransactionsResult>)yes-The listener to call when the request message is sent.

Returns

TypeDescription
stringthe ID of the listener.

onSignMessage(callback)

Listens to sign_message messages sent from clients.

Parameters

NameTypeRequiredDefaultDescription
callback(options: IAVMWebProviderCallbackOptions) => (ISignMessageResult | Promise<ISignMessageResult>)yes-The listener to call when the request message is sent.

onSignTransactions(callback)

Listens to sign_transactions messages sent from clients.

Parameters

NameTypeRequiredDefaultDescription
callback(options: IAVMWebProviderCallbackOptions) => (ISignTransactionsResult | Promise<ISignTransactionsResult>)yes-The listener to call when the request message is sent.

Returns

TypeDescription
stringthe ID of the listener.

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-