Skip to content

æpp

@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc

RPC handler for AEPP side

Example

import ContentScriptBridge from '@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc'

exports.AeppRpc(param, onAddressChange, onDisconnect, onNetworkChange, connection) ⇒ Object

Contain functionality for wallet interaction and connect it to sdk

Kind: Exported function
rtype: Stamp

Param Type Description
param Object Init params object
[param.name] String Aepp name
onAddressChange function Call-back function for update address event
onDisconnect function Call-back function for disconnect event
onNetworkChange function Call-back function for update network event
connection Object Wallet connection object

exports.AeppRpc.connectToWallet(connection) ⇒ void

Connect to wallet

Kind: instance method of exports.AeppRpc
rtype: (connection: Object) => void

Param Type Description
connection Object Wallet connection object

exports.AeppRpc.disconnectWallet(force) ⇒ void

Disconnect from wallet

Kind: instance method of exports.AeppRpc
rtype: (force: Boolean = false) => void

Param Type Default Description
force Boolean false Force sending close connection message

exports.AeppRpc.askAddresses() ⇒ Promise

Ask address from wallet

Kind: instance method of exports.AeppRpc
Returns: Promise - Address from wallet
rtype: () => Promise

exports.AeppRpc.subscribeAddress(type, value) ⇒ Promise

Subscribe for addresses from wallet

Kind: instance method of exports.AeppRpc
Returns: Promise - Address from wallet
rtype: (type: String, value: String) => Promise

Param Type Description
type String Type of subscription can be one of ['current'(just for selected account updates), 'connected(all accounts)']
value String Subscription action('subscribe'

exports.AeppRpc.signTransaction() ⇒ Promise.<String>

Overwriting of signTransaction AE method All sdk API which use it will be send notification to wallet and wait for callBack

Kind: instance method of exports.AeppRpc
Returns: Promise.<String> - Signed transaction
rtype: (tx: String, options = {}) => Promise

exports.AeppRpc.sendConnectRequest() ⇒ Promise

Send connection request to wallet

Kind: instance method of exports.AeppRpc
Returns: Promise - Connection response
rtype: () => Promise

exports.AeppRpc.send(tx, [options]) ⇒ Promise.<Object>

Overwriting of send AE method All sdk API which use it will be send notification to wallet and wait for callBack This method will sign, broadcast and wait until transaction will be accepted using rpc communication with wallet

Kind: instance method of exports.AeppRpc
Returns: Promise.<Object> - Transaction broadcast result
rtype: (tx: String, options = {}) => Promise

Param Type Default
tx String
[options] Object {}
[options.walletBroadcast] Object {}