Class MoneroWalletInterface

Monero wallet interface and default implementations.

Hierarchy

Properties

Methods

addAddressBookEntry addListener changePassword checkReserveProof checkSpendProof checkTxKey checkTxProof close createAccount createSubaddress createTx createTxs decodeIntegratedAddress deleteAddressBookEntry describeMultisigTxSet describeTxSet describeUnsignedTxSet editAddressBookEntry exchangeMultisigKeys exportKeyImages exportMultisigHex exportOutputs freezeOutput getAccount getAccountTags getAccounts getAddress getAddressBookEntries getAddressIndex getAttribute getBalance getConnectionManager getDaemonConnection getDaemonHeight getHeight getHeightByDate getIncomingTransfers getIntegratedAddress getListeners getMultisigInfo getNewKeyImagesFromLastImport getNumBlocksToUnlock getOutgoingTransfers getOutputs getPath getPaymentUri getPrimaryAddress getPrivateSpendKey getPrivateViewKey getPublicSpendKey getPublicViewKey getReserveProofAccount getReserveProofWallet getSeed getSeedLanguage getSpendProof getSubaddress getSubaddresses getTransfers getTx getTxKey getTxNote getTxNotes getTxProof getTxs getUnlockedBalance getVersion importKeyImages importMultisigHex importOutputs isClosed isConnectedToDaemon isMultisig isMultisigImportNeeded isOutputFrozen isViewOnly makeMultisig parsePaymentUri prepareMultisig relayTx relayTxs removeListener rescanBlockchain rescanSpent save scanTxs setAccountLabel setAccountTagLabel setAttribute setConnectionManager setDaemonConnection setSubaddressLabel setTxNote setTxNotes signMessage signMultisigTxHex signTxs startMining startSyncing stopMining stopSyncing submitMultisigTxHex submitTxs sweepDust sweepOutput sweepUnlocked sync tagAccounts thawOutput untagAccounts verifyMessage normalizeCreateTxsConfig normalizeOutputQuery normalizeSweepOutputConfig normalizeSweepUnlockedConfig normalizeTransferQuery normalizeTxQuery

Properties

_isClosed: boolean = false
connectionManager: MoneroConnectionManager
connectionManagerListener: MoneroConnectionManagerListener
listeners: MoneroWalletListener[] = []
DEFAULT_LANGUAGE: "English" = "English"

Methods

  • Add an address book entry.

    Parameters

    • address: string

      entry address

    • Optional description: string

      entry description (optional)

    Returns Promise<number>

    the index of the added entry

  • Register a listener to receive wallet notifications.

    Parameters

    Returns Promise<void>

  • Change the wallet password.

    Parameters

    • oldPassword: string

      the wallet's old password

    • newPassword: string

      the wallet's new password

    Returns Promise<void>

  • Proves a wallet has a disposable reserve using a signature.

    Parameters

    • address: string

      public wallet address

    • message: string

      message included with the signature to further authenticate the proof (optional)

    • signature: string

      reserve proof signature to check

    Returns Promise<MoneroCheckReserve>

    the result of checking the signature proof

  • Prove a spend using a signature. Unlike proving a transaction, it does not require the destination public address.

    Parameters

    • txHash: string

      transaction to prove

    • message: string

      message included with the signature to further authenticate the proof (optional)

    • signature: string

      transaction signature to confirm

    Returns Promise<boolean>

    true if the signature is good, false otherwise

  • Check a transaction in the blockchain with its secret key.

    Parameters

    • txHash: string

      transaction to check

    • txKey: string

      transaction's secret key

    • address: string

      destination public address of the transaction

    Returns Promise<MoneroCheckTx>

    the result of the check

  • Prove a transaction by checking its signature.

    Parameters

    • txHash: string

      transaction to prove

    • address: string

      destination public address of the transaction

    • message: string

      message included with the signature to further authenticate the proof

    • signature: string

      transaction signature to confirm

    Returns Promise<MoneroCheckTx>

    the result of the check

  • Optionally save then close the wallet.

    Parameters

    • Optional save: boolean = false

      specifies if the wallet should be saved before being closed (default false)

    Returns Promise<void>

  • Create a new account with a label for the first subaddress.

    Parameters

    • Optional label: string

      label for account's first subaddress (optional)

    Returns Promise<MoneroAccount>

    the created account

  • Create a subaddress within an account.

    Parameters

    • accountIdx: number

      index of the account to create the subaddress within

    • Optional label: string

      the label for the subaddress (optional)

    Returns Promise<MoneroSubaddress>

    the created subaddress

  • Create a transaction to transfer funds from this wallet.

    Parameters

    • config: Partial<MoneroTxConfig>

      configures the transaction to create (required)

    Returns Promise<MoneroTxWallet>

    the created transaction

  • Create one or more transactions to transfer funds from this wallet.

    Parameters

    • config: Partial<MoneroTxConfig>

      configures the transactions to create (required)

    Returns Promise<MoneroTxWallet[]>

    the created transactions

  • Decode an integrated address to get its standard address and payment id.

    Parameters

    • integratedAddress: string

      integrated address to decode

    Returns Promise<MoneroIntegratedAddress>

    the decoded integrated address including standard address and payment id

  • Delete an address book entry.

    Parameters

    • entryIdx: number

      index of the entry to delete

    Returns Promise<void>

  • Describe a tx set from multisig tx hex.

    Parameters

    • multisigTxHex: string

      multisig tx hex

    Returns Promise<MoneroTxSet>

    the tx set containing structured transactions

  • Describe a tx set containing unsigned or multisig tx hex to a new tx set containing structured transactions.

    Parameters

    • txSet: MoneroTxSet

      a tx set containing unsigned or multisig tx hex

    Returns Promise<MoneroTxSet>

    txSet - the tx set containing structured transactions

  • Describe a tx set from unsigned tx hex.

    Parameters

    • unsignedTxHex: string

      unsigned tx hex

    Returns Promise<MoneroTxSet>

    the tx set containing structured transactions

  • Edit an address book entry.

    Parameters

    • index: number

      index of the address book entry to edit

    • setAddress: boolean

      specifies if the address should be updated

    • address: string

      updated address

    • setDescription: boolean

      specifies if the description should be updated

    • description: string

      updated description

    Returns Promise<void>

  • Exchange multisig hex with participants in a M/N multisig wallet.

    This process must be repeated with participants exactly N-M times.

    Parameters

    • multisigHexes: string[]

      are multisig hex from each participant

    • password: string

      wallet's password // TODO monero-project: redundant? wallet is created with password

    Returns Promise<MoneroMultisigInitResult>

    the result which has the multisig's address xor this wallet's multisig hex to share with participants iff not done

  • Export signed key images.

    Parameters

    • Optional all: boolean = false

      export all key images if true, else export the key images since the last export (default false)

    Returns Promise<MoneroKeyImage[]>

    the wallet's signed key images

  • Export this wallet's multisig info as hex for other participants.

    Returns Promise<string>

    this wallet's multisig info as hex for other participants

  • Export outputs in hex format.

    Parameters

    • Optional all: boolean = false

      export all outputs if true, else export the outputs since the last export (default false)

    Returns Promise<string>

    outputs in hex format

  • Freeze an output.

    Parameters

    • keyImage: string

      key image of the output to freeze

    Returns Promise<void>

  • Get an account.

    Parameters

    • accountIdx: number

      index of the account to get

    • Optional includeSubaddresses: boolean

      include subaddresses if true

    Returns Promise<MoneroAccount>

    the retrieved account

  • Get accounts with a given tag.

    Parameters

    • Optional includeSubaddresses: boolean

      include subaddresses if true

    • Optional tag: string

      tag for filtering accounts, all accounts if undefined

    Returns Promise<MoneroAccount[]>

    all accounts with the given tag

  • Get the address of a specific subaddress.

    Parameters

    • accountIdx: number

      the account index of the address's subaddress

    • subaddressIdx: number

      the subaddress index within the account

    Returns Promise<string>

    the receive address of the specified subaddress

  • Get address book entries.

    Parameters

    • Optional entryIndices: number[]

      indices of the entries to get

    Returns Promise<MoneroAddressBookEntry[]>

    the address book entries

  • Get the account and subaddress index of the given address.

    Parameters

    • address: string

      address to get the account and subaddress index from

    Returns Promise<MoneroSubaddress>

    the account and subaddress indices

  • Get an attribute.

    Parameters

    • key: string

      attribute to get the value of

    Returns Promise<string>

    the attribute's value

  • Get the balance of the wallet, account, or subaddress.

    Parameters

    • Optional accountIdx: number

      index of the account to get the balance of (default all accounts)

    • Optional subaddressIdx: number

      index of the subaddress to get the balance of (default all subaddresses)

    Returns Promise<bigint>

    the balance of the wallet, account, or subaddress

  • Get the blockchain's height.

    Returns Promise<number>

    the blockchain's height

  • Get the block height that the wallet is synced to.

    Returns Promise<number>

    the block height that the wallet is synced to

  • Get the blockchain's height by date as a conservative estimate for scanning.

    Parameters

    • year: number

      year of the height to get

    • month: number

      month of the height to get as a number between 1 and 12

    • day: number

      day of the height to get as a number between 1 and 31

    Returns Promise<number>

    the blockchain's approximate height at the given date

  • Get an integrated address based on the given standard address and payment ID. Uses the wallet's primary address if an address is not given. Generates a random payment ID if a payment ID is not given.

    Parameters

    • Optional standardAddress: string

      is the standard address to generate the integrated address from (wallet's primary address if undefined)

    • Optional paymentId: string

      is the payment ID to generate an integrated address from (randomly generated if undefined)

    Returns Promise<MoneroIntegratedAddress>

    the integrated address

  • Get new key images from the last imported outputs.

    Returns Promise<MoneroKeyImage[]>

    the key images from the last imported outputs

  • Get the number of blocks until the next and last funds unlock.

    Returns Promise<number[]>

    the number of blocks until the next and last funds unlock in elements 0 and 1, respectively, or undefined if no balance

  • Get outputs created from previous transactions that belong to the wallet (i.e. that the wallet can spend one time). Outputs are part of transactions which are stored in blocks on the blockchain.

    Results can be filtered by passing a query object. Outputs must meet every criteria defined in the query in order to be returned. All filtering is optional and no filtering is applied when not defined.

    Parameters

    Returns Promise<MoneroOutputWallet[]>

    the queried outputs

  • Get the wallet's path.

    Returns Promise<string>

    the path the wallet can be opened with

  • Creates a payment URI from a send configuration.

    Parameters

    Returns Promise<string>

    the payment uri

  • Get the wallet's primary address.

    Returns Promise<string>

    the wallet's primary address

  • Get the wallet's private spend key.

    Returns Promise<string>

    the wallet's private spend key

  • Get the wallet's private view key.

    Returns Promise<string>

    the wallet's private view key

  • Get the wallet's public spend key.

    Returns Promise<string>

    the wallet's public spend key

  • Get the wallet's public view key.

    Returns Promise<string>

    the wallet's public view key

  • Generate a signature to prove an available amount in an account.

    Parameters

    • accountIdx: number

      account to prove ownership of the amount

    • amount: bigint

      minimum amount to prove as available in the account

    • Optional message: string

      message to include with the signature to further authenticate the proof (optional)

    Returns Promise<string>

    the reserve proof signature

  • Generate a signature to prove the entire balance of the wallet.

    Parameters

    • Optional message: string

      message included with the signature to further authenticate the proof (optional)

    Returns Promise<string>

    the reserve proof signature

  • Get the wallet's mnemonic phrase or seed.

    Returns Promise<string>

    the wallet's mnemonic phrase or seed.

  • Get the language of the wallet's mnemonic phrase or seed.

    Returns Promise<string>

    the language of the wallet's mnemonic phrase or seed.

  • Generate a signature to prove a spend. Unlike proving a transaction, it does not require the destination public address.

    Parameters

    • txHash: string

      transaction to prove

    • Optional message: string

      message to include with the signature to further authenticate the proof (optional)

    Returns Promise<string>

    the transaction signature

  • Get a subaddress.

    Parameters

    • accountIdx: number

      index of the subaddress's account

    • subaddressIdx: number

      index of the subaddress within the account

    Returns Promise<MoneroSubaddress>

    the retrieved subaddress

  • Get subaddresses in an account.

    Parameters

    • accountIdx: number

      account to get subaddresses within

    • Optional subaddressIndices: number[]

      indices of subaddresses to get (optional)

    Returns Promise<MoneroSubaddress[]>

    the retrieved subaddresses

  • Get incoming and outgoing transfers to and from this wallet. An outgoing transfer represents a total amount sent from one or more subaddresses within an account to individual destination addresses, each with their own amount. An incoming transfer represents a total amount received into a subaddress within an account. Transfers belong to transactions which are stored on the blockchain.

    Results can be filtered by passing a query object. Transfers must meet every criteria defined in the query in order to be returned. All criteria are optional and no filtering is applied when not defined.

    Parameters

    Returns Promise<MoneroTransfer[]>

    wallet transfers that meet the query

  • Get a wallet transaction by hash.

    Parameters

    • txHash: string

      hash of a transaction to get

    Returns Promise<MoneroTxWallet>

    the identified transaction or undefined if not found

  • Get a transaction's secret key from its hash.

    Parameters

    • txHash: string

      transaction's hash

    Returns Promise<string>

    • transaction's secret key
  • Get a transaction note.

    Parameters

    • txHash: string

      transaction to get the note of

    Returns Promise<string>

    the tx note

  • Get notes for multiple transactions.

    Parameters

    • txHashes: string[]

      hashes of the transactions to get notes for

    Returns Promise<string[]>

    notes for the transactions

  • Get a transaction signature to prove it.

    Parameters

    • txHash: string

      transaction to prove

    • address: string

      destination public address of the transaction

    • Optional message: string

      message to include with the signature to further authenticate the proof (optional)

    Returns Promise<string>

    the transaction signature

  • Get wallet transactions. Wallet transactions contain one or more transfers that are either incoming or outgoing to the wallet.

    Results can be filtered by passing a query object. Transactions must meet every criteria defined in the query in order to be returned. All criteria are optional and no filtering is applied when not defined.

    Parameters

    • Optional query: string[] | Partial<MoneroTxQuery>

      configures the query (optional)

    Returns Promise<MoneroTxWallet[]>

    wallet transactions per the configuration

  • Get the unlocked balance of the wallet, account, or subaddress.

    Parameters

    • Optional accountIdx: number

      index of the account to get the unlocked balance of (optional)

    • Optional subaddressIdx: number

      index of the subaddress to get the unlocked balance of (optional)

    Returns Promise<bigint>

    the unlocked balance of the wallet, account, or subaddress

  • Import multisig info as hex from other participants.

    Parameters

    • multisigHexes: string[]

      multisig hex from each participant

    Returns Promise<number>

    the number of outputs signed with the given multisig hex

  • Import outputs in hex format.

    Parameters

    • outputsHex: string

      outputs in hex format

    Returns Promise<number>

    the number of outputs imported

  • Indicates if this wallet is closed or not.

    Returns Promise<boolean>

    true if the wallet is closed, false otherwise

  • Indicates if the wallet is connected to daemon.

    Returns Promise<boolean>

    true if the wallet is connected to a daemon, false otherwise

  • Indicates if this wallet is a multisig wallet.

    Returns Promise<boolean>

    true if this is a multisig wallet, false otherwise

  • Indicates if importing multisig data is needed for returning a correct balance.

    Returns Promise<boolean>

    true if importing multisig data is needed for returning a correct balance, false otherwise

  • Check if an output is frozen.

    Parameters

    • keyImage: string

      key image of the output to check if frozen

    Returns Promise<boolean>

    true if the output is frozen, false otherwise

  • Indicates if the wallet is view-only, meaning it does not have the private spend key and can therefore only observe incoming outputs.

    Returns Promise<boolean>

    true if the wallet is view-only, false otherwise

  • Make this wallet multisig by importing multisig hex from participants.

    Parameters

    • multisigHexes: string[]

      multisig hex from each participant

    • threshold: number

      number of signatures needed to sign transfers

    • password: string

      wallet password

    Returns Promise<string>

    this wallet's multisig hex to share with participants

  • Parses a payment URI to a tx config.

    Parameters

    • uri: string

      payment uri to parse

    Returns Promise<MoneroTxConfig>

    the send configuration parsed from the uri

  • Get multisig info as hex to share with participants to begin creating a multisig wallet.

    Returns Promise<string>

    this wallet's multisig hex to share with participants

  • Relay a previously created transaction.

    Parameters

    • txOrMetadata: string | MoneroTxWallet

      transaction or its metadata to relay

    Returns Promise<string>

    the hash of the relayed tx

  • Relay previously created transactions.

    Parameters

    • txsOrMetadatas: (string | MoneroTxWallet)[]

      transactions or their metadata to relay

    Returns Promise<string[]>

    the hashes of the relayed txs

  • Unregister a listener to receive wallet notifications.

    Parameters

    • listener: any

      listener to unregister

    Returns Promise<void>

  • Rescan the blockchain from scratch, losing any information which cannot be recovered from the blockchain itself.

    WARNING: This method discards local wallet data like destination addresses, tx secret keys, tx notes, etc.

    Returns Promise<void>

  • Rescan the blockchain for spent outputs.

    Note: this can only be called with a trusted daemon.

    Example use case: peer multisig hex is import when connected to an untrusted daemon, so the wallet will not rescan spent outputs. Then the wallet connects to a trusted daemon. This method should be manually invoked to rescan outputs.

    Returns Promise<void>

  • Save the wallet at its current path.

    Returns Promise<void>

  • Scan transactions by their hash/id.

    Parameters

    • txHashes: string[]

      tx hashes to scan

    Returns Promise<void>

  • Set an account label.

    Parameters

    • accountIdx: number

      index of the account to set the label for

    • label: string

      the label to set

    Returns Promise<void>

  • Sets a human-readable description for a tag.

    Parameters

    • tag: string

      tag to set a description for

    • label: string

      label to set for the tag

    Returns Promise<void>

  • Set an arbitrary attribute.

    Parameters

    • key: string

      attribute key

    • val: string

      attribute value

    Returns Promise<void>

  • Set the wallet's daemon connection manager.

    Parameters

    Returns Promise<void>

  • Set the wallet's daemon connection.

    Parameters

    • Optional uriOrConnection: string | MoneroRpcConnection

      daemon's URI or connection (defaults to offline)

    Returns Promise<void>

  • Set a subaddress label.

    Parameters

    • accountIdx: number

      index of the account to set the label for

    • subaddressIdx: number

      index of the subaddress to set the label for

    • label: string

      the label to set

    Returns Promise<void>

  • Set a note for a specific transaction.

    Parameters

    • txHash: string

      hash of the transaction to set a note for

    • note: string

      the transaction note

    Returns Promise<void>

  • Set notes for multiple transactions.

    Parameters

    • txHashes: string[]

      transactions to set notes for

    • notes: string[]

      notes to set for the transactions

    Returns Promise<void>

  • Sign a message.

    Parameters

    • message: string

      the message to sign

    • Optional signatureType: MoneroMessageSignatureType = MoneroMessageSignatureType.SIGN_WITH_SPEND_KEY

      sign with spend key or view key (default spend key)

    • Optional accountIdx: number = 0

      the account index of the message signature (default 0)

    • Optional subaddressIdx: number = 0

      the subaddress index of the message signature (default 0)

    Returns Promise<string>

    the signature

  • Sign multisig transactions from a multisig wallet.

    Parameters

    • multisigTxHex: string

      unsigned multisig transactions as hex

    Returns Promise<MoneroMultisigSignResult>

    the result of signing the multisig transactions

  • Sign unsigned transactions from a view-only wallet.

    Parameters

    • unsignedTxHex: string

      unsigned transaction hex from when the transactions were created

    Returns Promise<MoneroTxSet>

    the signed transaction set

  • Start mining.

    Parameters

    • Optional numThreads: number

      number of threads created for mining (optional)

    • Optional backgroundMining: boolean

      specifies if mining should occur in the background (optional)

    • Optional ignoreBattery: boolean

      specifies if the battery should be ignored for mining (optional)

    Returns Promise<void>

  • Start background synchronizing with a maximum period between syncs.

    Parameters

    • Optional syncPeriodInMs: number

      maximum period between syncs in milliseconds (default is wallet-specific)

    Returns Promise<void>

  • Stop mining.

    Returns Promise<void>

  • Stop synchronizing the wallet with the daemon.

    Returns Promise<void>

  • Submit signed multisig transactions from a multisig wallet.

    Parameters

    • signedMultisigTxHex: string

      signed multisig hex returned from signMultisigTxHex()

    Returns Promise<string[]>

    the resulting transaction hashes

  • Submit signed transactions from a view-only wallet.

    Parameters

    • signedTxHex: string

      signed transaction hex from signTxs()

    Returns Promise<string[]>

    the resulting transaction hashes

  • Sweep all unmixable dust outputs back to the wallet to make them easier to spend and mix.

    NOTE: Dust only exists pre RCT, so this method will throw "no dust to sweep" on new wallets.

    Parameters

    • Optional relay: boolean

      specifies if the resulting transaction should be relayed (default false)

    Returns Promise<MoneroTxWallet[]>

    the created transactions

  • Sweep an output by key image.

    Parameters

    • config: Partial<MoneroTxConfig>

      configures the transaction to create (required)

    Returns Promise<MoneroTxWallet>

    the created transaction

  • Sweep all unlocked funds according to the given configuration.

    Parameters

    • config: Partial<MoneroTxConfig>

      configures the transactions to create (required)

    Returns Promise<MoneroTxWallet[]>

    the created transactions

  • Synchronize the wallet with the daemon as a one-time synchronous process.

    Parameters

    • Optional listenerOrStartHeight: number | MoneroWalletListener

      listener xor start height (defaults to no sync listener, the last synced block)

    • Optional startHeight: number

      startHeight if not given in first arg (defaults to last synced block)

    Returns Promise<MoneroSyncResult>

  • Tag accounts.

    Parameters

    • tag: string

      tag to apply to the specified accounts

    • accountIndices: number[]

      indices of the accounts to tag

    Returns Promise<void>

  • Thaw a frozen output.

    Parameters

    • keyImage: string

      key image of the output to thaw

    Returns Promise<void>

  • Untag accounts.

    Parameters

    • accountIndices: number[]

      indices of the accounts to untag

    Returns Promise<void>

  • Verify a signature on a message.

    Parameters

    • message: string

      signed message

    • address: string

      signing address

    • signature: string

      signature

    Returns Promise<MoneroMessageSignatureResult>

    true if the signature is good, false otherwise

  • Parameters

    • config: any

    Returns any

  • Parameters

    • query: any

    Returns any

  • Parameters

    • config: any

    Returns any

  • Parameters

    • config: any

    Returns any

  • Parameters

    • query: any

    Returns any

  • Parameters

    • query: any

    Returns any

Generated using TypeDoc