Class: MoneroWalletRpc

MoneroWalletRpc(config, param2, param3)

Implements a Monero wallet using monero-wallet-rpc.

Constructor

new MoneroWalletRpc(config, param2, param3)

Constructs the wallet rpc instance.
Parameters:
Name Type Description
config object defines the rpc configuration
Properties
Name Type Description
uri string is the uri of the rpc endpoint
protocol string is the protocol of the rpc endpoint
host string is the host of the rpc endpoint
port int is the port of the rpc endpoint
user string is a username to authenticate with the rpc endpoint
pass string is a password to authenticate with the rpc endpoint
maxRequestsPerSecond string is the maximum requests per second to allow
param2 string is the username to authenticate with (optional)
param3 string is the password to authenticate with (optional)
Source:

Methods

(static) _compareIncomingTransfers()

Compares two transfers by ascending account and subaddress indices.
Source:

(static) _compareOutputs()

Compares two outputs by ascending account and subaddress indices.
Source:

(static) _compareTxsByHeight()

Compares two transactions by their height.
Source:

(static) _convertRpcSentTxsToTxSet(rpcTxs, txs)

Initializes a MoneroTxSet from from a list of rpc txs.
Parameters:
Name Type Description
rpcTxs are sent rpc txs to initialize the set from
txs are existing txs to further initialize (optional)
Source:
Returns:
the converted tx set

(static) _convertRpcTxSet(rpcMap)

Initializes a tx set from a RPC map excluding txs.
Parameters:
Name Type Description
rpcMap is the map to initialize the tx set from
Source:
Returns:
  • MoneroTxSet is the initialized tx set
  • the resulting tx set

(static) _convertRpcTxToTxSet(rpcTx, tx, isOutgoing)

Converts a rpc tx with a transfer to a tx set with a tx and transfer.
Parameters:
Name Type Description
rpcTx is the rpc tx to build from
tx is an existing tx to continue initializing (optional)
isOutgoing specifies if the tx is outgoing if true, incoming if false, or decodes from type if undefined
Source:
Returns:
the initialized tx set with a tx

(static) _convertRpcTxWithTransfer(rpcTx, tx, isOutgoing) → {MoneroTxWallet}

Builds a MoneroTxWallet from a RPC tx.
Parameters:
Name Type Description
rpcTx is the rpc tx to build from
tx is an existing tx to continue initializing (optional)
isOutgoing specifies if the tx is outgoing if true, incoming if false, or decodes from type if undefined
Source:
Returns:
is the initialized tx
Type
MoneroTxWallet

(static) _decodeRpcType(rpcType, tx) → {boolean}

Decodes a "type" from monero-wallet-rpc to initialize type and state fields in the given transaction. TODO: these should be safe set
Parameters:
Name Type Description
rpcType is the type to decode
tx is the transaction to decode known fields to
Source:
Returns:
true if the rpc type indicates outgoing xor incoming
Type
boolean

(static) _initSentTxWallet(request, is) → {MoneroTxWallet}

Initializes a sent transaction.
Parameters:
Name Type Description
request MoneroSendRequest is the send request
is MoneroTxWallet an existing transaction to initialize (optional)
Source:
Returns:
is the initialized send tx
Type
MoneroTxWallet

(static) _mergeTx(tx, txMap, blockMap, skipIfAbsent)

Merges a transaction into a unique set of transactions. TODO monero core: skipIfAbsent only necessary because incoming payments not returned when sent from/to same account #4500
Parameters:
Name Type Description
tx is the transaction to merge into the existing txs
txMap maps tx hashes to txs
blockMap maps block heights to blocks
skipIfAbsent specifies if the tx should not be added if it doesn't already exist
Source:

(async) _rpcExportKeyImages(all) → {Array.<MoneroKeyImage>}

Common method to get key images.
Parameters:
Name Type Description
all specifies to get all xor only new images from last import
Source:
Returns:
are the key images
Type
Array.<MoneroKeyImage>

(async) createWalletFromKeys(name, password, networkType, address, viewKey, spendKey, daemonConnection, restoreHeight, language)

Create a wallet on the RPC server from an address, view key, and (optionally) spend key.
Parameters:
Name Type Description
name is the name of the wallet to create on the RPC server
password is the password encrypt the wallet
networkType is the wallet's network type
address is the address of the wallet to construct
viewKey is the view key of the wallet to construct
spendKey is the spend key of the wallet to construct or null to create a view-only wallet
daemonConnection is connection configuration to a daemon (default = an unconnected wallet)
restoreHeight is the block height to restore (i.e. scan the chain) from (default = 0)
language is the wallet and mnemonic's language (default = "English")
Source:

(async) createWalletFromMnemonic(name, password, mnemonic, restoreHeight, language, seedOffset, saveCurrent)

Create and open a wallet from an existing mnemonic phrase on the RPC server, closing the currently open wallet if applicable.
Parameters:
Name Type Description
name string is the name of the wallet to create on the RPC server
password string is the wallet's password
mnemonic string is the mnemonic of the wallet to construct
restoreHeight int is the block height to restore from (default = 0)
language string is the language of the mnemonic in case the old language is invalid
seedOffset string is the offset used to derive a new seed from the given mnemonic to recover a secret wallet from the mnemonic phrase
saveCurrent boolean specifies if the current RPC wallet should be saved before being closed
Source:

(async) createWalletRandom(name, password, language)

Create and open a new wallet with a randomly generated seed on the RPC server.
Parameters:
Name Type Description
name string is the name of the wallet file to create
password string is the wallet's password
language string is the language for the wallet's mnemonic phrase
Source:

(async) getMnemonicLanguages() → {Array.<string>}

Get a list of available languages for the wallet's mnemonic phrase.
Source:
Returns:
the available languages for the wallet's mnemonic phrase
Type
Array.<string>

getRpcConnection() → {MoneroWalletRpc}

Get the wallet's RPC connection.
Source:
Returns:
the wallet's rpc connection
Type
MoneroWalletRpc

(async) openWallet(name, password)

Open an existing wallet on the RPC server.
Parameters:
Name Type Description
name string is the name of the wallet file to open
password string is the password to decrypt the wallet file
Source:

(async) stop()

Save and close the current wallet and stop the RPC server.
Source: