AVMWebProvider
Static Methods
init([options])
Initializes the AVM web provider object. If no options are supplied, a default configuration is used.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
providerId | string | yes | - | This ID of the provider. It is recommended you use a UUIDv4 compliant string. |
options | IAVMWebProviderInitOptions | no | - | An object to change the initial configuration. |
Returns
Type | Description |
---|---|
AVMWebProvider | An initialized AVM web provider object. |
Methods
getConfig()
Returns the configuration.
Returns
Type | Description |
---|---|
IAVMWebProviderConfig | The provider's configuration. |
onDisable(callback)
Listens to
disable
messages sent from clients.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
callback | (options : IAVMWebProviderCallbackOptions ) => (IDisableResult | Promise<IDiscoverResult> ) | yes | - | The listener to call when the request message is sent. |
Returns
Type | Description |
---|---|
string | the ID of the listener. |
onDiscover(callback)
Listens to
discover
messages sent from clients.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
callback | (options : IAVMWebProviderCallbackOptions ) => (IDiscoverResult | Promise<IDiscoverResult> ) | yes | - | The listener to call when the request message is sent. |
Returns
Type | Description |
---|---|
string | the ID of the listener. |
onEnable(callback)
Listens to
enable
messages sent from clients.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
callback | (options : IAVMWebProviderCallbackOptions ) => (IEnableResult | Promise<IEnableResult> ) | yes | - | The listener to call when the request message is sent. |
Returns
Type | Description |
---|---|
string | the ID of the listener. |
onPostTransactions(callback)
Listens to
post_transactions
messages sent from clients.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
callback | (options : IAVMWebProviderCallbackOptions ) => (IPostTransactionsResult | Promise<IPostTransactionsResult> ) | yes | - | The listener to call when the request message is sent. |
Returns
Type | Description |
---|---|
string | the ID of the listener. |
onSignAndPostTransactions(callback)
Listens to
sign_and_post_transactions
messages sent from clients.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
callback | (options : IAVMWebProviderCallbackOptions ) => (IPostTransactionsResult | Promise<IPostTransactionsResult> ) | yes | - | The listener to call when the request message is sent. |
Returns
Type | Description |
---|---|
string | the ID of the listener. |
onSignMessage(callback)
Listens to
sign_message
messages sent from clients.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
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
Name | Type | Required | Default | Description |
---|---|---|---|---|
callback | (options : IAVMWebProviderCallbackOptions ) => (ISignTransactionsResult | Promise<ISignTransactionsResult> ) | yes | - | The listener to call when the request message is sent. |
Returns
Type | Description |
---|---|
string | the ID of the listener. |
removeAllListeners()
Removes all listeners.
Returns
Type | Description |
---|---|
void | - |
removeListener(id)
Removes the listener, by the ID.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
id | string | yes | - | The listener ID to remove. |
Returns
Type | Description |
---|---|
void | - |