Package zephyr.wallet

Class ZephyrWalletRpc

java.lang.Object
zephyr.wallet.ZephyrWalletRpc
All Implemented Interfaces:
ZephyrWallet

public class ZephyrWalletRpc extends Object
Implements a Zephyr wallet using zephyr-wallet-rpc. First pass: zephyr-wallet-rpc reports single balances; this class reports them as the base coin ZPH. Per-asset balances, the per-subaddress balance map, the reserve info and the circulating supply are not supported until the RPC port.
  • Field Details

  • Constructor Details

    • ZephyrWalletRpc

      public ZephyrWalletRpc(String uri)
    • ZephyrWalletRpc

      public ZephyrWalletRpc(String uri, String username, String password)
    • ZephyrWalletRpc

      public ZephyrWalletRpc(String uri, String username, String password, String zmqUri)
    • ZephyrWalletRpc

      public ZephyrWalletRpc(ZephyrRpcConnection rpc)
    • ZephyrWalletRpc

      public ZephyrWalletRpc(List<String> cmd) throws IOException
      Create an internal process running zephyr-wallet-rpc and connect to it. Use `stopProcess()` to stop the newly created process.
      Parameters:
      cmd - path then arguments to external zephyr-wallet-rpc executable
      Throws:
      IOException - if input/output error with process
  • Method Details

    • getProcess

      public Process getProcess()
      Get the internal process running zephyr-wallet-rpc.
      Returns:
      the process running zephyr-wallet-rpc, null if not created from new process
    • stopProcess

      public int stopProcess()
      Stop the internal process running zephyr-wallet-rpc, if applicable.
      Returns:
      the error code from stopping the process
    • stopProcess

      public int stopProcess(boolean force)
      Stop the internal process running zephyr-wallet-rpc, if applicable.
      Parameters:
      force - specifies if the process should be destroyed forcibly
      Returns:
      the error code from stopping the process
    • getRpcConnection

      public ZephyrRpcConnection getRpcConnection()
      Get the wallet's RPC connection.
      Returns:
      the wallet's rpc connection
    • openWallet

      public ZephyrWalletRpc openWallet(String name, String password)
      Open an existing wallet on the zephyr-wallet-rpc server.
      Parameters:
      name - is the name of the wallet file to open
      password - is the wallet's password
      Returns:
      this wallet client
    • openWallet

      public ZephyrWalletRpc openWallet(ZephyrWalletConfig config)

      Open an existing wallet on the zephyr-wallet-rpc server.

      Example:

      ZephyrWallet walletRpc = new ZephyrWalletRpc("http://localhost:38083", "rpc_user", "abc123");
      walletRpc.openWallet("mywallet1", "supersecretpassword");
      walletRpc.openWallet(new ZephyrWalletConfig()
         .setPath("mywallet")
         .setPassword("abc123")
         .setServerUri("http://localhost:38081"));

      All supported configuration:
         path - path of the wallet to create (optional, in-memory wallet if not given)
         password - password of the wallet to create
         serverUri - uri of a daemon to use (optional, zephyr-wallet-rpc usually started with daemon config)
         serverUsername - username to authenticate with the daemon (optional)
         serverPassword - password to authenticate with the daemon (optional)
         server - ZephyrRpcConnection providing daemon configuration (optional)

      Parameters:
      config - configures the wallet to open
      Returns:
      this wallet client
    • createWallet

      public ZephyrWalletRpc createWallet(ZephyrWalletConfig config)

      Create and open a wallet on the zephyr-wallet-rpc server.

      Example:

      ZephyrWallet walletRpc = new ZephyrWalletRpc("http://localhost:38083", "rpc_user", "abc123");
      walletRpc.createWallet(new ZephyrWalletConfig()
         .setPath("mywallet")
         .setPassword("supersecretpassword")
         .setMnemonic("coexist igloo pamphlet lagoon...")
         .setRestoreHeight(1543218l));

      All supported configuration:
         path - path of the wallet to create (optional, in-memory wallet if not given)
         password - password of the wallet to create
         mnemonic - mnemonic of the wallet to create (optional, random wallet created if neither mnemonic nor keys given)
         seedOffset - the offset used to derive a new seed from the given mnemonic to recover a secret wallet from the mnemonic phrase
         primaryAddress - primary address of the wallet to create (only provide if restoring from keys)
         privateViewKey - private view key of the wallet to create (optional)
         privateSpendKey - private spend key of the wallet to create (optional)
         restoreHeight - block height to start scanning from (defaults to 0 unless generating random wallet)
         language - language of the wallet's mnemonic phrase (defaults to "English" or auto-detected)
         serverUri - uri of the daemon to use (optional, zephyr-wallet-rpc usually started with daemon config)
         serverUsername - username to authenticate with the daemon (optional)
         serverPassword - password to authenticate with the daemon (optional)
         server - ZephyrRpcConnection providing server configuration (optional)

      Parameters:
      config - configures the wallet to create
      Returns:
      this wallet client
    • getMnemonicLanguages

      public List<String> getMnemonicLanguages()
      Get a list of available languages for the wallet's mnemonic phrase.
      Returns:
      the available languages for the wallet's mnemonic phrase
    • stop

      public void stop()
      Save and close the current wallet and stop the RPC server.
    • addListener

      public void addListener(ZephyrWalletListenerI listener)
      Description copied from interface: ZephyrWallet
      Register a listener to receive wallet notifications.
      Specified by:
      addListener in interface ZephyrWallet
      Parameters:
      listener - is the listener to receive wallet notifications
    • removeListener

      public void removeListener(ZephyrWalletListenerI listener)
      Description copied from interface: ZephyrWallet
      Unregister a listener to receive wallet notifications.
      Specified by:
      removeListener in interface ZephyrWallet
      Parameters:
      listener - is the listener to unregister
    • isViewOnly

      public boolean isViewOnly()
      Description copied from interface: ZephyrWallet
      Indicates if the wallet is view-only, meaning it does not have the private spend key and can therefore only observe incoming outputs.
      Returns:
      {bool} true if the wallet is view-only, false otherwise
    • setDaemonConnection

      public void setDaemonConnection(ZephyrRpcConnection connection)
      Description copied from interface: ZephyrWallet
      Set the wallet's daemon connection
      Parameters:
      connection - manages daemon connection information
    • setDaemonConnection

      public void setDaemonConnection(ZephyrRpcConnection connection, Boolean isTrusted, SslOptions sslOptions)
    • setProxyUri

      public void setProxyUri(String uri)
      Description copied from interface: ZephyrWallet
      Set the Tor proxy to the daemon.
      Parameters:
      uri - the Tor proxy URI
    • getDaemonConnection

      public ZephyrRpcConnection getDaemonConnection()
      Description copied from interface: ZephyrWallet
      Get the wallet's daemon connection.
      Returns:
      the wallet's daemon connection
    • isConnectedToDaemon

      public boolean isConnectedToDaemon()
      Description copied from interface: ZephyrWallet
      Indicates if the wallet is connected a daemon.
      Returns:
      true if the wallet is connected to a daemon, false otherwise
    • getVersion

      public ZephyrVersion getVersion()
      Description copied from interface: ZephyrWallet
      Returns the wallet version.
      Returns:
      the wallet version
    • getPath

      public String getPath()
      Description copied from interface: ZephyrWallet
      Get the wallet's path.
      Returns:
      the path the wallet can be opened with
    • getMnemonic

      public String getMnemonic()
      Description copied from interface: ZephyrWallet
      Get the wallet's mnemonic phrase.
      Returns:
      the wallet's mnemonic phrase
    • getMnemonicLanguage

      public String getMnemonicLanguage()
      Description copied from interface: ZephyrWallet
      Get the language of the wallet's mnemonic phrase.
      Returns:
      the language of the wallet's mnemonic phrase
    • getPrivateViewKey

      public String getPrivateViewKey()
      Description copied from interface: ZephyrWallet
      Get the wallet's private view key.
      Returns:
      the wallet's private view key
    • getPublicViewKey

      public String getPublicViewKey()
      Description copied from interface: ZephyrWallet
      Get the wallet's public view key.
      Returns:
      the wallet's public view key
    • getPublicSpendKey

      public String getPublicSpendKey()
      Description copied from interface: ZephyrWallet
      Get the wallet's public spend key.
      Returns:
      the wallet's public spend key
    • getPrivateSpendKey

      public String getPrivateSpendKey()
      Description copied from interface: ZephyrWallet
      Get the wallet's private spend key.
      Returns:
      the wallet's private spend key
    • getAddress

      public String getAddress(int accountIdx, int subaddressIdx)
      Description copied from interface: ZephyrWallet
      Get the address of a specific subaddress.
      Parameters:
      accountIdx - specifies the account index of the address's subaddress
      subaddressIdx - specifies the subaddress index within the account
      Returns:
      the receive address of the specified subaddress
    • getAddressIndex

      public ZephyrSubaddress getAddressIndex(String address)
      Description copied from interface: ZephyrWallet
      Get the account and subaddress index of the given address.
      Parameters:
      address - is the address to get the account and subaddress index from
      Returns:
      the account and subaddress indices
    • getIntegratedAddress

      public ZephyrIntegratedAddress getIntegratedAddress(String standardAddress, String paymentId)
      Description copied from interface: ZephyrWallet
      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:
      standardAddress - is the standard address to generate the integrated address from (wallet's primary address if null)
      paymentId - is the payment ID to generate an integrated address from (randomly generated if null)
      Returns:
      the integrated address
    • decodeIntegratedAddress

      public ZephyrIntegratedAddress decodeIntegratedAddress(String integratedAddress)
      Description copied from interface: ZephyrWallet
      Decode an integrated address to get its standard address and payment id.
      Parameters:
      integratedAddress - is an integrated address to decode
      Returns:
      the decoded integrated address including standard address and payment id
    • getHeight

      public long getHeight()
      Description copied from interface: ZephyrWallet
      Get the block height that the wallet is synced to.
      Returns:
      the block height that the wallet is synced to
    • getDaemonHeight

      public long getDaemonHeight()
      Description copied from interface: ZephyrWallet
      Get the blockchain's height.
      Returns:
      the blockchain's height
    • getHeightByDate

      public long getHeightByDate(int year, int month, int day)
      Description copied from interface: ZephyrWallet
      Get the blockchain's height by date as a conservative estimate for scanning.
      Parameters:
      year - year of the height to get
      month - month of the height to get as a number between 1 and 12
      day - day of the height to get as a number between 1 and 31
      Returns:
      the blockchain's approximate height at the given date
    • sync

      public ZephyrSyncResult sync(Long startHeight, ZephyrWalletListenerI listener)
      Description copied from interface: ZephyrWallet
      Synchronize the wallet with the daemon as a one-time synchronous process.
      Specified by:
      sync in interface ZephyrWallet
      Parameters:
      startHeight - is the start height to sync from (defaults to the last synced block)
      listener - listener to receive notifications during synchronization
      Returns:
      the sync result
    • startSyncing

      public void startSyncing(Long syncPeriodInMs)
      Description copied from interface: ZephyrWallet
      Start background synchronizing with a maximum period between syncs.
      Parameters:
      syncPeriodInMs - maximum period between syncs in milliseconds
    • stopSyncing

      public void stopSyncing()
      Description copied from interface: ZephyrWallet
      Stop synchronizing the wallet with the daemon.
    • scanTxs

      public void scanTxs(Collection<String> txHashes)
      Description copied from interface: ZephyrWallet
      Scan transactions by their hash/id.
      Parameters:
      txHashes - tx hashes to scan
    • rescanSpent

      public void rescanSpent()
      Description copied from interface: ZephyrWallet
      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.
    • rescanBlockchain

      public void rescanBlockchain()
      Description copied from interface: ZephyrWallet
      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.
    • getBalance

      public ZephyrBalance getBalance()
      Returns the RPC wallet's single balance reported as ZPH (first pass).
      Returns:
      the balance, holding ZPH only
    • getBalance

      public Map<Integer,ZephyrBalance> getBalance(Integer accountIdx)
      Description copied from interface: ZephyrWallet
      Get the balance of each subaddress of an account, per asset. The map is keyed by subaddress index and may omit subaddresses that never held funds. Amounts are in atomic units (10^12 per coin for every asset). The asset is an open string; the constants of the current assets are in ZephyrAssets.
      Parameters:
      accountIdx - index of the account to get the balances of (required)
      Returns:
      the balance per asset of each subaddress of the account, keyed by subaddress index
    • getBalance

      public BigInteger getBalance(String assetType, Integer accountIdx, Integer subaddressIdx)
      Description copied from interface: ZephyrWallet
      Get a subaddress's balance of one asset. Throws ZephyrError "Must provide account index" if the account index is null, which includes a subaddress index given without an account index.
      Parameters:
      assetType - the asset to get the balance of (an open string, see ZephyrAssets)
      accountIdx - index of the account to get the balance of (required)
      subaddressIdx - index of the subaddress to get the balance of (the whole account if null)
      Returns:
      the requested balance of the asset in atomic units (10^12 per coin)
    • getUnlockedBalance

      public ZephyrBalance getUnlockedBalance()
      Returns the RPC wallet's single unlocked balance reported as ZPH (first pass).
      Returns:
      the unlocked balance, holding ZPH only
    • getUnlockedBalance

      public Map<Integer,ZephyrBalance> getUnlockedBalance(Integer accountIdx)
      Description copied from interface: ZephyrWallet
      Get the unlocked balance of each subaddress of an account, per asset. The map is keyed by subaddress index and may omit subaddresses that never held funds. Amounts are in atomic units (10^12 per coin for every asset). The asset is an open string; the constants of the current assets are in ZephyrAssets.
      Parameters:
      accountIdx - index of the account to get the unlocked balances of (required)
      Returns:
      the unlocked balance per asset of each subaddress of the account, keyed by subaddress index
    • getUnlockedBalance

      public BigInteger getUnlockedBalance(String assetType, Integer accountIdx, Integer subaddressIdx)
      Description copied from interface: ZephyrWallet
      Get a subaddress's unlocked balance of one asset. Throws ZephyrError "Must provide account index" if the account index is null, which includes a subaddress index given without an account index.
      Parameters:
      assetType - the asset to get the unlocked balance of (an open string, see ZephyrAssets)
      accountIdx - index of the account to get the unlocked balance of (required)
      subaddressIdx - index of the subaddress to get the unlocked balance of (the whole account if null)
      Returns:
      the requested unlocked balance of the asset in atomic units (10^12 per coin)
    • getReserveInfo

      public ZephyrReserveInfo getReserveInfo()
      Description copied from interface: ZephyrWallet
      Get the state of the Zephyr reserve as the core reports it.
      Returns:
      the reserve state (amounts in atomic units, ratios dimensionless)
    • getCirculatingSupply

      public Map<String,BigInteger> getCirculatingSupply()
      Description copied from interface: ZephyrWallet
      Get the circulating supply per asset.
      Returns:
      the circulating supply per asset in atomic units (10^12 per coin for every asset)
    • getAccounts

      public List<ZephyrAccount> getAccounts(boolean includeSubaddresses, String tag)
      Description copied from interface: ZephyrWallet
      Get accounts with a given tag.
      Parameters:
      includeSubaddresses - specifies if subaddresses should be included
      tag - is the tag for filtering accounts, all accounts if null
      Returns:
      all accounts with the given tag
    • getAccounts

      public List<ZephyrAccount> getAccounts(boolean includeSubaddresses, String tag, boolean skipBalances)
    • getAccount

      public ZephyrAccount getAccount(int accountIdx, boolean includeSubaddresses)
      Description copied from interface: ZephyrWallet
      Get an account.
      Parameters:
      accountIdx - specifies the account to get
      includeSubaddresses - specifies if subaddresses should be included
      Returns:
      the retrieved account
    • getAccount

      public ZephyrAccount getAccount(int accountIdx, boolean includeSubaddresses, boolean skipBalances)
    • createAccount

      public ZephyrAccount createAccount(String label)
      Description copied from interface: ZephyrWallet
      Create a new account with a label for the first subaddress.
      Parameters:
      label - specifies the label for account's first subaddress (optional)
      Returns:
      the created account
    • getSubaddresses

      public List<ZephyrSubaddress> getSubaddresses(int accountIdx, List<Integer> subaddressIndices)
      Description copied from interface: ZephyrWallet
      Get subaddresses in an account.
      Parameters:
      accountIdx - specifies the account to get subaddresses within
      subaddressIndices - are specific subaddresses to get (optional)
      Returns:
      the retrieved subaddresses
    • getSubaddresses

      public List<ZephyrSubaddress> getSubaddresses(int accountIdx, List<Integer> subaddressIndices, boolean skipBalances)
    • createSubaddress

      public ZephyrSubaddress createSubaddress(int accountIdx, String label)
      Description copied from interface: ZephyrWallet
      Create a subaddress within an account.
      Parameters:
      accountIdx - specifies the index of the account to create the subaddress within
      label - specifies the the label for the subaddress (optional)
      Returns:
      the created subaddress
    • setSubaddressLabel

      public void setSubaddressLabel(int accountIdx, int subaddressIdx, String label)
      Description copied from interface: ZephyrWallet
      Set a subaddress label.
      Parameters:
      accountIdx - index of the account to set the label for
      subaddressIdx - index of the subaddress to set the label for
      label - the label to set
    • getTxs

      public List<ZephyrTxWallet> getTxs(ZephyrTxQuery query, Collection<String> missingTxHashes)
      Description copied from interface: ZephyrWallet

      Get wallet transactions that meet the criteria defined in 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.

      If querying transactions by hash, unfound or unmet transaction hashes are added to the provided collection.

      All supported query criteria:
         isConfirmed - path of the wallet to open
         password - password of the wallet to open
         networkType - network type of the wallet to open (one of ZephyrNetworkType.MAINNET|TESTNET|STAGENET)
         serverUri - uri of the wallet's daemon (optional)
         serverUsername - username to authenticate with the daemon (optional)
         serverPassword - password to authenticate with the daemon (optional)
         server - ZephyrRpcConnection providing server configuration (optional)
         isConfirmed - get txs that are confirmed or not (optional)
         inTxPool - get txs that are in the tx pool or not (optional)
         isRelayed - get txs that are relayed or not (optional)
         isFailed - get txs that are failed or not (optional)
         isMinerTx - get miner txs or not (optional)
         hash - get a tx with the hash (optional)
         hashes - get txs with the hashes (optional)
         paymentId - get transactions with the payment id (optional)
         paymentIds - get transactions with the payment ids (optional)
         hasPaymentId - get transactions with a payment id or not (optional)
         minHeight - get txs with height greater than or equal to the given height (optional)
         maxHeight - get txs with height less than or equal to the given height (optional)
         isOutgoing - get txs with an outgoing transfer or not (optional)
         isIncoming - get txs with an incoming transfer or not (optional)
         transferQuery - get txs that have a transfer that meets this query (optional)
         includeOutputs - specifies that tx outputs should be returned with tx results (optional)

      Parameters:
      query - specifies properties of the transactions to get
      missingTxHashes - populated with hashes of unfound or unmet transactions that were queried by hash (throws error if null and queried transaction hashes are unfound or unmet)
      Returns:
      wallet transactions that meet the query
    • getTransfers

      public List<ZephyrTransfer> getTransfers(ZephyrTransferQuery query)
      Description copied from interface: ZephyrWallet

      Get tranfsers that meet the criteria defined in 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.

      All supported query criteria:
         isOutgoing - get transfers that are outgoing or not (optional)
         isIncoming - get transfers that are incoming or not (optional)
         address - wallet's address that a transfer either originated from (if outgoing) or is destined for (if incoming) (optional)
         accountIndex - get transfers that either originated from (if outgoing) or are destined for (if incoming) a specific account index (optional)
         subaddressIndex - get transfers that either originated from (if outgoing) or are destined for (if incoming) a specific subaddress index (optional)
         subaddressIndices - get transfers that either originated from (if outgoing) or are destined for (if incoming) specific subaddress indices (optional)
         amount - amount being transferred (optional)
         destinations - individual destinations of an outgoing transfer, which is local wallet data and NOT recoverable from the blockchain (optional)
         hasDestinations - get transfers that have destinations or not (optional)
         txQuery - get transfers whose transaction meets this query (optional)
      Parameters:
      query - specifies attributes of transfers to get
      Returns:
      wallet transfers that meet the query
    • getOutputs

      public List<ZephyrOutputWallet> getOutputs(ZephyrOutputQuery query)
      Get the outputs which meet the criteria defined in a query object.

      Zephyr: zephyr-wallet-rpc returns the asset of every output (asset_type in incoming_transfers), which this first-pass RPC client does not read yet, so the outputs carry no asset (ZephyrOutputWallet.getAssetType() is null). Planned with the port to zephyr-wallet-rpc.

      Parameters:
      query - specifies attributes of outputs to get
      Returns:
      the queried outputs
    • exportOutputs

      public String exportOutputs(boolean all)
      Description copied from interface: ZephyrWallet
      Export outputs in hex format.
      Parameters:
      all - exports all outputs if true, else exports the outputs since the last export
      Returns:
      outputs in hex format
    • importOutputs

      public int importOutputs(String outputsHex)
      Description copied from interface: ZephyrWallet
      Import outputs in hex format.
      Parameters:
      outputsHex - are outputs in hex format
      Returns:
      the number of outputs imported
    • exportKeyImages

      public List<ZephyrKeyImage> exportKeyImages(boolean all)
      Description copied from interface: ZephyrWallet
      Export signed key images.
      Parameters:
      all - exports all key images if true, else exports the key images since the last export
      Returns:
      signed key images
    • importKeyImages

      public ZephyrKeyImageImportResult importKeyImages(List<ZephyrKeyImage> keyImages)
      Description copied from interface: ZephyrWallet
      Import signed key images and verify their spent status.
      Parameters:
      keyImages - are key images to import and verify (requires hex and signature)
      Returns:
      results of the import
    • getNewKeyImagesFromLastImport

      public List<ZephyrKeyImage> getNewKeyImagesFromLastImport()
      Description copied from interface: ZephyrWallet
      Get new key images from the last imported outputs.
      Returns:
      the key images from the last imported outputs
    • freezeOutput

      public void freezeOutput(String keyImage)
      Description copied from interface: ZephyrWallet
      Freeze an output.
      Parameters:
      keyImage - key image of the output to freeze
    • thawOutput

      public void thawOutput(String keyImage)
      Description copied from interface: ZephyrWallet
      Thaw a frozen output.
      Parameters:
      keyImage - key image of the output to thaw
    • isOutputFrozen

      public boolean isOutputFrozen(String keyImage)
      Description copied from interface: ZephyrWallet
      Check if an output is frozen.
      Parameters:
      keyImage - key image of the output to check if frozen
      Returns:
      true if the output is frozen, false otherwise
    • createTxs

      public List<ZephyrTxWallet> createTxs(ZephyrTxConfig config)
      Description copied from interface: ZephyrWallet
      Create one or more transactions to transfer funds from this wallet.

      All supported configuration:
         address - single destination address (required unless `destinations` provided)
         amount - single destination amount (required unless `destinations` provided)
         accountIndex - source account index to transfer funds from (required)
         subaddressIndex - source subaddress index to transfer funds from (optional)
         subaddressIndices - source subaddress indices to transfer funds from (optional)
         relay - relay the transactions to peers to commit to the blockchain (default false)
         priority - transaction priority (default ZephyrTxPriority.NORMAL)
         destinations - addresses and amounts in a multi-destination tx (required unless `address` and `amount` provided)
         paymentId - transaction payment ID (optional)
         unlockHeight - minimum height for the transactions to unlock (default 0)
         canSplit - allow funds to be transferred using multiple transactions (default true)

      Parameters:
      config - configures the transactions to create
      Returns:
      the created transactions
    • sweepOutput

      public ZephyrTxWallet sweepOutput(ZephyrTxConfig config)
      Description copied from interface: ZephyrWallet
      Sweep an output with a given key image.

      All supported configuration:
         address - single destination address (required)
         keyImage - key image to sweep (required)
         relay - relay the transaction to peers to commit to the blockchain (default false)
         unlockHeight - minimum height for the transaction to unlock (default 0)
         priority - transaction priority (default ZephyrTxPriority.NORMAL)

      Parameters:
      config - configures the sweep transaction
      Returns:
      the created transaction
    • sweepUnlocked

      public List<ZephyrTxWallet> sweepUnlocked(ZephyrTxConfig config)
      Description copied from interface: ZephyrWallet
      Sweep all unlocked funds according to the given config.

      All supported configuration:
         address - single destination address (required)
         accountIndex - source account index to sweep from (optional, defaults to all accounts)
         subaddressIndex - source subaddress index to sweep from (optional, defaults to all subaddresses)
         subaddressIndices - source subaddress indices to sweep from (optional)
         relay - relay the transactions to peers to commit to the blockchain (default false)
         priority - transaction priority (default ZephyrTxPriority.NORMAL)
         unlockHeight - minimum height for the transactions to unlock (default 0)
         sweepEachSubaddress - sweep each subaddress individually if true (default false)

      Parameters:
      config - is the sweep configuration
      Returns:
      the created transactions
    • sweepDust

      public List<ZephyrTxWallet> sweepDust(boolean relay)
      Description copied from interface: ZephyrWallet
      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:
      relay - specifies if the resulting transaction should be relayed (defaults to false i.e. not relayed)
      Returns:
      the created transactions
    • relayTxs

      public List<String> relayTxs(Collection<String> txMetadatas)
      Description copied from interface: ZephyrWallet
      Relay previously created transactions.
      Parameters:
      txMetadatas - are transaction metadata previously created without relaying
      Returns:
      the hashes of the relayed txs
    • describeTxSet

      public ZephyrTxSet describeTxSet(ZephyrTxSet txSet)
      Description copied from interface: ZephyrWallet
      Describe a tx set containing unsigned or multisig tx hex to a new tx set containing structured transactions.
      Parameters:
      txSet - is a tx set containing unsigned or multisig tx hex
      Returns:
      the tx set containing structured transactions
    • signTxs

      public String signTxs(String unsignedTxHex)
      Description copied from interface: ZephyrWallet
      Sign unsigned transactions from a view-only wallet.
      Parameters:
      unsignedTxHex - is unsigned transaction hex from when the transactions were created
      Returns:
      the signed transaction hex
    • submitTxs

      public List<String> submitTxs(String signedTxHex)
      Description copied from interface: ZephyrWallet
      Submit signed transactions from a view-only wallet.
      Parameters:
      signedTxHex - is signed transaction hex from signTxs()
      Returns:
      the resulting transaction hashes
    • signMessage

      public String signMessage(String msg, ZephyrMessageSignatureType signatureType, int accountIdx, int subaddressIdx)
      Description copied from interface: ZephyrWallet
      Sign a message.
      Parameters:
      msg - the message to sign
      signatureType - sign with spend key or view key
      accountIdx - the account index of the message signature (default 0)
      subaddressIdx - the subaddress index of the message signature (default 0)
      Returns:
      the signature
    • verifyMessage

      public ZephyrMessageSignatureResult verifyMessage(String msg, String address, String signature)
      Description copied from interface: ZephyrWallet
      Verify a signature on a message.
      Parameters:
      msg - is the signed message
      address - is the signing address
      signature - is the signature
      Returns:
      the message signature verification result
    • getTxKey

      public String getTxKey(String txHash)
      Description copied from interface: ZephyrWallet
      Get a transaction's secret key from its hash.
      Parameters:
      txHash - is the transaction's hash
      Returns:
      is the transaction's secret key
    • checkTxKey

      public ZephyrCheckTx checkTxKey(String txHash, String txKey, String address)
      Check a transaction in the blockchain with its secret key.

      Zephyr: zephyr-wallet-rpc returns the received amount per asset (received_assets, received_amounts), which this first-pass RPC client does not read yet, so ZephyrCheckTx.getReceivedAmount() comes back null; ZephyrCheck.isGood() and the confirmations are read. Planned with the port to zephyr-wallet-rpc. Until then read the amount from ZephyrWallet.getTxs(String...), as for the full wallet.

      Parameters:
      txHash - specifies the transaction to check
      txKey - is the transaction's secret key
      address - is the destination public address of the transaction
      Returns:
      the result of the check
    • getTxProof

      public String getTxProof(String txHash, String address, String message)
      Description copied from interface: ZephyrWallet
      Get a transaction signature to prove it.
      Parameters:
      txHash - specifies the transaction to prove
      address - is the destination public address of the transaction
      message - is a message to include with the signature to further authenticate the proof (optional)
      Returns:
      the transaction signature
    • checkTxProof

      public ZephyrCheckTx checkTxProof(String txHash, String address, String message, String signature)
      Prove a transaction by checking its signature.

      Zephyr: zephyr-wallet-rpc returns the received amount per asset (received_assets, received_amounts), which this first-pass RPC client does not read yet, so ZephyrCheckTx.getReceivedAmount() comes back null; ZephyrCheck.isGood() and the confirmations are read. Planned with the port to zephyr-wallet-rpc. Until then read the amount from ZephyrWallet.getTxs(String...), as for the full wallet.

      Parameters:
      txHash - specifies the transaction to prove
      address - is the destination public address of the transaction
      message - is a message included with the signature to further authenticate the proof (optional)
      signature - is the transaction signature to confirm
      Returns:
      the result of the check
    • getSpendProof

      public String getSpendProof(String txHash, String message)
      Description copied from interface: ZephyrWallet
      Generate a signature to prove a spend. Unlike proving a transaction, it does not require the destination public address.
      Parameters:
      txHash - specifies the transaction to prove
      message - is a message to include with the signature to further authenticate the proof (optional)
      Returns:
      the transaction signature
    • checkSpendProof

      public boolean checkSpendProof(String txHash, String message, String signature)
      Description copied from interface: ZephyrWallet
      Prove a spend using a signature. Unlike proving a transaction, it does not require the destination public address.
      Parameters:
      txHash - specifies the transaction to prove
      message - is a message included with the signature to further authenticate the proof (optional)
      signature - is the transaction signature to confirm
      Returns:
      true if the signature is good, false otherwise
    • getReserveProofWallet

      public String getReserveProofWallet(String message)
      Description copied from interface: ZephyrWallet
      Generate a signature to prove the entire balance of the wallet.
      Parameters:
      message - is a message included with the signature to further authenticate the proof (optional)
      Returns:
      the reserve proof signature
    • getReserveProofAccount

      public String getReserveProofAccount(int accountIdx, BigInteger amount, String message)
      Description copied from interface: ZephyrWallet
      Generate a signature to prove an available amount in an account.
      Parameters:
      accountIdx - specifies the account to prove ownership of the amount
      amount - is the minimum amount to prove as available in the account
      message - is a message to include with the signature to further authenticate the proof (optional)
      Returns:
      the reserve proof signature
    • checkReserveProof

      public ZephyrCheckReserve checkReserveProof(String address, String message, String signature)
      Description copied from interface: ZephyrWallet
      Proves a wallet has a disposable reserve using a signature.
      Parameters:
      address - is the public wallet address
      message - is a message included with the signature to further authenticate the proof (optional)
      signature - is the reserve proof signature to check
      Returns:
      the result of checking the signature proof
    • getTxNotes

      public List<String> getTxNotes(List<String> txHashes)
      Description copied from interface: ZephyrWallet
      Get notes for multiple transactions.
      Parameters:
      txHashes - identify the transactions to get notes for
      Returns:
      notes for the transactions
    • setTxNotes

      public void setTxNotes(List<String> txHashes, List<String> notes)
      Description copied from interface: ZephyrWallet
      Set notes for multiple transactions.
      Parameters:
      txHashes - specify the transactions to set notes for
      notes - are the notes to set for the transactions
    • getAddressBookEntries

      public List<ZephyrAddressBookEntry> getAddressBookEntries(List<Integer> entryIndices)
      Description copied from interface: ZephyrWallet
      Get address book entries.
      Parameters:
      entryIndices - are indices of the entries to get (optional)
      Returns:
      the address book entries
    • addAddressBookEntry

      public int addAddressBookEntry(String address, String description)
      Description copied from interface: ZephyrWallet
      Add an address book entry.
      Parameters:
      address - is the entry address
      description - is the entry description (optional)
      Returns:
      the index of the added entry
    • editAddressBookEntry

      public void editAddressBookEntry(int index, boolean setAddress, String address, boolean setDescription, String description)
      Description copied from interface: ZephyrWallet
      Edit an address book entry.
      Parameters:
      index - is the index of the address book entry to edit
      setAddress - specifies if the address should be updated
      address - is the updated address
      setDescription - specifies if the description should be updated
      description - is the updated description
    • deleteAddressBookEntry

      public void deleteAddressBookEntry(int entryIdx)
      Description copied from interface: ZephyrWallet
      Delete an address book entry.
      Parameters:
      entryIdx - is the index of the entry to delete
    • tagAccounts

      public void tagAccounts(String tag, Collection<Integer> accountIndices)
      Description copied from interface: ZephyrWallet
      Tag accounts.
      Parameters:
      tag - is the tag to apply to the specified accounts
      accountIndices - are the indices of the accounts to tag
    • untagAccounts

      public void untagAccounts(Collection<Integer> accountIndices)
      Description copied from interface: ZephyrWallet
      Untag acconts.
      Parameters:
      accountIndices - are the indices of the accounts to untag
    • getAccountTags

      public List<ZephyrAccountTag> getAccountTags()
      Description copied from interface: ZephyrWallet
      Return all account tags.
      Returns:
      the wallet's account tags
    • setAccountTagLabel

      public void setAccountTagLabel(String tag, String label)
      Description copied from interface: ZephyrWallet
      Sets a human-readable description for a tag.
      Parameters:
      tag - is the tag to set a description for
      label - is the label to set for the tag
    • getPaymentUri

      public String getPaymentUri(ZephyrTxConfig config)
      Description copied from interface: ZephyrWallet
      Creates a payment URI from a send configuration.
      Parameters:
      config - specifies configuration for a potential tx
      Returns:
      the payment uri
    • parsePaymentUri

      public ZephyrTxConfig parsePaymentUri(String uri)
      Description copied from interface: ZephyrWallet
      Parses a payment URI to a transaction configuration.
      Parameters:
      uri - is the payment uri to parse
      Returns:
      the send configuration parsed from the uri
    • getAttribute

      public String getAttribute(String key)
      Description copied from interface: ZephyrWallet
      Get an attribute.
      Parameters:
      key - is the attribute to get the value of
      Returns:
      the attribute's value
    • setAttribute

      public void setAttribute(String key, String val)
      Description copied from interface: ZephyrWallet
      Set an arbitrary attribute.
      Parameters:
      key - is the attribute key
      val - is the attribute value
    • startMining

      public void startMining(Long numThreads, Boolean backgroundMining, Boolean ignoreBattery)
      Description copied from interface: ZephyrWallet
      Start mining.
      Parameters:
      numThreads - is the number of threads created for mining (optional)
      backgroundMining - specifies if mining should occur in the background (optional)
      ignoreBattery - specifies if the battery should be ignored for mining (optional)
    • stopMining

      public void stopMining()
      Description copied from interface: ZephyrWallet
      Stop mining.
    • isMultisigImportNeeded

      public boolean isMultisigImportNeeded()
      Description copied from interface: ZephyrWallet
      Indicates if importing multisig data is needed for returning a correct balance.
      Returns:
      true if importing multisig data is needed for returning a correct balance, false otherwise
    • getMultisigInfo

      public ZephyrMultisigInfo getMultisigInfo()
      Description copied from interface: ZephyrWallet
      Get multisig info about this wallet.
      Returns:
      multisig info about this wallet
    • prepareMultisig

      public String prepareMultisig()
      Description copied from interface: ZephyrWallet
      Get multisig info as hex to share with participants to begin creating a multisig wallet.
      Returns:
      this wallet's multisig hex to share with participants
    • makeMultisig

      public String makeMultisig(List<String> multisigHexes, int threshold, String password)
      Description copied from interface: ZephyrWallet
      Make this wallet multisig by importing multisig hex from participants.
      Parameters:
      multisigHexes - are multisig hex from each participant
      threshold - is the number of signatures needed to sign transfers
      password - is the wallet password
      Returns:
      this wallet's multisig hex to share with participants
    • exchangeMultisigKeys

      public ZephyrMultisigInitResult exchangeMultisigKeys(List<String> multisigHexes, String password)
      Description copied from interface: ZephyrWallet
      Exchange multisig hex with participants in a M/N multisig wallet. This process must be repeated with participants exactly N-M times.
      Parameters:
      multisigHexes - are multisig hex from each participant
      password - is the wallet's password // TODO zephyr: redundant? wallet is created with password
      Returns:
      the result which has the multisig's address xor this wallet's multisig hex to share with participants iff not done
    • exportMultisigHex

      public String exportMultisigHex()
      Description copied from interface: ZephyrWallet
      Export this wallet's multisig info as hex for other participants.
      Returns:
      this wallet's multisig info as hex for other participants
    • importMultisigHex

      public int importMultisigHex(List<String> multisigHexes)
      Description copied from interface: ZephyrWallet
      Import multisig info as hex from other participants.
      Parameters:
      multisigHexes - are multisig hex from each participant
      Returns:
      the number of outputs signed with the given multisig hex
    • signMultisigTxHex

      public ZephyrMultisigSignResult signMultisigTxHex(String multisigTxHex)
      Description copied from interface: ZephyrWallet
      Sign multisig transactions from a multisig wallet.
      Parameters:
      multisigTxHex - represents unsigned multisig transactions as hex
      Returns:
      the result of signing the multisig transactions
    • submitMultisigTxHex

      public List<String> submitMultisigTxHex(String signedMultisigTxHex)
      Description copied from interface: ZephyrWallet
      Submit signed multisig transactions from a multisig wallet.
      Parameters:
      signedMultisigTxHex - is signed multisig hex returned from signMultisigTxHex()
      Returns:
      the resulting transaction hashes
    • changePassword

      public void changePassword(String oldPassword, String newPassword)
      Description copied from interface: ZephyrWallet
      Change the wallet password.
      Parameters:
      oldPassword - is the wallet's old password
      newPassword - is the wallet's new password
    • save

      public void save()
      Description copied from interface: ZephyrWallet
      Save the wallet at its current path.
    • close

      public void close(boolean save)
      Description copied from interface: ZephyrWallet
      Optionally save then close the wallet.
      Parameters:
      save - specifies if the wallet should be saved before being closed (default false)
    • isClosed

      public boolean isClosed()
      Indicates if this wallet is closed or not. The wallet counts as closed when the RPC server answers "No wallet file" with error code -8 (monero-wallet-rpc) or -13 (zephyr-wallet-rpc v2.3.0).
      Returns:
      true if the wallet is closed, false otherwise
    • getListeners

      public Set<ZephyrWalletListenerI> getListeners()
      Description copied from interface: ZephyrWallet
      Get the listeners registered with the wallet.
      Specified by:
      getListeners in interface ZephyrWallet
      Returns:
      the registered listeners
    • setDaemonConnection

      public void setDaemonConnection(String uri)
      Description copied from interface: ZephyrWallet
      Set the wallet's daemon connection.
      Specified by:
      setDaemonConnection in interface ZephyrWallet
      Parameters:
      uri - is the uri of the daemon for the wallet to use
    • setDaemonConnection

      public void setDaemonConnection(String uri, String username, String password)
      Description copied from interface: ZephyrWallet
      Set the wallet's daemon connection.
      Specified by:
      setDaemonConnection in interface ZephyrWallet
      Parameters:
      uri - is the daemon's URI
      username - is the username to authenticate with the daemon (optional)
      password - is the password to authenticate with the daemon (optional)
    • getPrimaryAddress

      public String getPrimaryAddress()
      Description copied from interface: ZephyrWallet
      Get the wallet's primary address.
      Specified by:
      getPrimaryAddress in interface ZephyrWallet
      Returns:
      the wallet's primary address
    • getIntegratedAddress

      public ZephyrIntegratedAddress getIntegratedAddress()
      Description copied from interface: ZephyrWallet
      Get an integrated address based on this wallet's primary address and a randomly generated payment ID.
      Specified by:
      getIntegratedAddress in interface ZephyrWallet
      Returns:
      the integrated address
    • sync

      public ZephyrSyncResult sync()
      Description copied from interface: ZephyrWallet
      Synchronize the wallet with the daemon as a one-time synchronous process.
      Specified by:
      sync in interface ZephyrWallet
      Returns:
      the sync result
    • sync

      public ZephyrSyncResult sync(ZephyrWalletListenerI listener)
      Description copied from interface: ZephyrWallet
      Synchronize the wallet with the daemon as a one-time synchronous process.
      Specified by:
      sync in interface ZephyrWallet
      Parameters:
      listener - listener to receive notifications during synchronization
      Returns:
      the sync result
    • sync

      public ZephyrSyncResult sync(Long startHeight)
      Description copied from interface: ZephyrWallet
      Synchronize the wallet with the daemon as a one-time synchronous process.
      Specified by:
      sync in interface ZephyrWallet
      Parameters:
      startHeight - is the start height to sync from (defaults to the last synced block)
      Returns:
      the sync result
    • startSyncing

      public void startSyncing()
      Description copied from interface: ZephyrWallet
      Start background synchronizing.
      Specified by:
      startSyncing in interface ZephyrWallet
    • getBalance

      public BigInteger getBalance(String assetType, Integer accountIdx)
      Description copied from interface: ZephyrWallet
      Get an account's balance of one asset. Throws ZephyrError "Must provide account index" if the account index is null.
      Specified by:
      getBalance in interface ZephyrWallet
      Parameters:
      assetType - the asset to get the balance of (an open string, see ZephyrAssets)
      accountIdx - index of the account to get the balance of (required)
      Returns:
      the account's balance of the asset in atomic units (10^12 per coin)
    • getUnlockedBalance

      public BigInteger getUnlockedBalance(String assetType, Integer accountIdx)
      Description copied from interface: ZephyrWallet
      Get an account's unlocked balance of one asset. Throws ZephyrError "Must provide account index" if the account index is null.
      Specified by:
      getUnlockedBalance in interface ZephyrWallet
      Parameters:
      assetType - the asset to get the unlocked balance of (an open string, see ZephyrAssets)
      accountIdx - index of the account to get the unlocked balance of (required)
      Returns:
      the account's unlocked balance of the asset in atomic units (10^12 per coin)
    • getAccounts

      public List<ZephyrAccount> getAccounts()
      Description copied from interface: ZephyrWallet
      Get all accounts.
      Specified by:
      getAccounts in interface ZephyrWallet
      Returns:
      all accounts
    • getAccounts

      public List<ZephyrAccount> getAccounts(boolean includeSubaddresses)
      Description copied from interface: ZephyrWallet
      Get all accounts.
      Specified by:
      getAccounts in interface ZephyrWallet
      Parameters:
      includeSubaddresses - specifies if subaddresses should be included
      Returns:
      all accounts
    • getAccounts

      public List<ZephyrAccount> getAccounts(String tag)
      Description copied from interface: ZephyrWallet
      Get accounts with a given tag.
      Specified by:
      getAccounts in interface ZephyrWallet
      Parameters:
      tag - is the tag for filtering accounts, all accounts if null
      Returns:
      all accounts with the given tag
    • getAccount

      public ZephyrAccount getAccount(int accountIdx)
      Description copied from interface: ZephyrWallet
      Get an account without subaddress information.
      Specified by:
      getAccount in interface ZephyrWallet
      Parameters:
      accountIdx - specifies the account to get
      Returns:
      the retrieved account
    • createAccount

      public ZephyrAccount createAccount()
      Description copied from interface: ZephyrWallet
      Create a new account.
      Specified by:
      createAccount in interface ZephyrWallet
      Returns:
      the created account
    • setAccountLabel

      public void setAccountLabel(int accountIdx, String label)
      Description copied from interface: ZephyrWallet
      Set an account label.
      Specified by:
      setAccountLabel in interface ZephyrWallet
      Parameters:
      accountIdx - index of the account to set the label for
      label - the label to set
    • getSubaddresses

      public List<ZephyrSubaddress> getSubaddresses(int accountIdx)
      Description copied from interface: ZephyrWallet
      Get all subaddresses in an account.
      Specified by:
      getSubaddresses in interface ZephyrWallet
      Parameters:
      accountIdx - specifies the account to get subaddresses within
      Returns:
      the retrieved subaddresses
    • getSubaddress

      public ZephyrSubaddress getSubaddress(int accountIdx, int subaddressIdx)
      Description copied from interface: ZephyrWallet
      Get a subaddress.
      Specified by:
      getSubaddress in interface ZephyrWallet
      Parameters:
      accountIdx - specifies the index of the subaddress's account
      subaddressIdx - specifies index of the subaddress within the account
      Returns:
      the retrieved subaddress
    • createSubaddress

      public ZephyrSubaddress createSubaddress(int accountIdx)
      Description copied from interface: ZephyrWallet
      Create a subaddress within an account and without a label.
      Specified by:
      createSubaddress in interface ZephyrWallet
      Parameters:
      accountIdx - specifies the index of the account to create the subaddress within
      Returns:
      the created subaddress
    • getTx

      public ZephyrTxWallet getTx(String txHash)
      Description copied from interface: ZephyrWallet
      Get a wallet transaction by hash.
      Specified by:
      getTx in interface ZephyrWallet
      Parameters:
      txHash - is the hash of a transaction to get
      Returns:
      the identified transaction or throw if not found
    • getTxs

      public List<ZephyrTxWallet> getTxs()
      Description copied from interface: ZephyrWallet
      Get all wallet transactions. Wallet transactions contain one or more transfers that are either incoming or outgoing to the wallet.
      Specified by:
      getTxs in interface ZephyrWallet
      Returns:
      all wallet transactions
    • getTxs

      public List<ZephyrTxWallet> getTxs(String... txHashes)
      Description copied from interface: ZephyrWallet
      Get wallet transactions by hash.
      Specified by:
      getTxs in interface ZephyrWallet
      Parameters:
      txHashes - are hashes of transactions to get
      Returns:
      the identified transactions or throw if a transaction is not found
    • getTxs

      public List<ZephyrTxWallet> getTxs(List<String> txHashes)
      Description copied from interface: ZephyrWallet
      Get wallet transactions by hash.
      Specified by:
      getTxs in interface ZephyrWallet
      Parameters:
      txHashes - are hashes of transactions to get
      Returns:
      the identified transactions or throw if a transaction is not found
    • getTxs

      public List<ZephyrTxWallet> getTxs(List<String> txHashes, Collection<String> missingTxHashes)
      Description copied from interface: ZephyrWallet
      Get wallet transactions by hash and collect missing tx hashes.
      Specified by:
      getTxs in interface ZephyrWallet
      Parameters:
      txHashes - are hashes of transactions to get
      missingTxHashes - is populated with requested but missing tx hashes
      Returns:
      the found transactions
    • getTxs

      public List<ZephyrTxWallet> getTxs(ZephyrTxQuery query)
      Description copied from interface: ZephyrWallet

      Get wallet transactions that meet the criteria defined in 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.

      All supported query criteria:
         isConfirmed - path of the wallet to open
         password - password of the wallet to open
         networkType - network type of the wallet to open (one of ZephyrNetworkType.MAINNET|TESTNET|STAGENET)
         serverUri - uri of the wallet's daemon (optional)
         serverUsername - username to authenticate with the daemon (optional)
         serverPassword - password to authenticate with the daemon (optional)
         server - ZephyrRpcConnection providing server configuration (optional)
         isConfirmed - get txs that are confirmed or not (optional)
         inTxPool - get txs that are in the tx pool or not (optional)
         isRelayed - get txs that are relayed or not (optional)
         isFailed - get txs that are failed or not (optional)
         isMinerTx - get miner txs or not (optional)
         hash - get a tx with the hash (optional)
         hashes - get txs with the hashes (optional)
         paymentId - get transactions with the payment id (optional)
         paymentIds - get transactions with the payment ids (optional)
         hasPaymentId - get transactions with a payment id or not (optional)
         minHeight - get txs with height greater than or equal to the given height (optional)
         maxHeight - get txs with height less than or equal to the given height (optional)
         isOutgoing - get txs with an outgoing transfer or not (optional)
         isIncoming - get txs with an incoming transfer or not (optional)
         transferQuery - get txs that have a transfer that meets this query (optional)
         includeOutputs - specifies that tx outputs should be returned with tx results (optional)

      Specified by:
      getTxs in interface ZephyrWallet
      Parameters:
      query - specifies properties of the transactions to get
      Returns:
      wallet transactions that meet the query
    • getTransfers

      public List<ZephyrTransfer> getTransfers()
      Description copied from interface: ZephyrWallet
      Get all 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.
      Specified by:
      getTransfers in interface ZephyrWallet
      Returns:
      all wallet transfers
    • getTransfers

      public List<ZephyrTransfer> getTransfers(int accountIdx)
      Description copied from interface: ZephyrWallet
      Get incoming and outgoing transfers to and from an account. 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.
      Specified by:
      getTransfers in interface ZephyrWallet
      Parameters:
      accountIdx - is the index of the account to get transfers from
      Returns:
      transfers to/from the account
    • getTransfers

      public List<ZephyrTransfer> getTransfers(int accountIdx, int subaddressIdx)
      Description copied from interface: ZephyrWallet
      Get incoming and outgoing transfers to and from a subaddress. 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.
      Specified by:
      getTransfers in interface ZephyrWallet
      Parameters:
      accountIdx - is the index of the account to get transfers from
      subaddressIdx - is the index of the subaddress to get transfers from
      Returns:
      transfers to/from the subaddress
    • getIncomingTransfers

      public List<ZephyrIncomingTransfer> getIncomingTransfers()
      Description copied from interface: ZephyrWallet
      Get all of the wallet's incoming transfers.
      Specified by:
      getIncomingTransfers in interface ZephyrWallet
      Returns:
      the wallet's incoming transfers
    • getIncomingTransfers

      public List<ZephyrIncomingTransfer> getIncomingTransfers(ZephyrTransferQuery query)
      Description copied from interface: ZephyrWallet

      Get incoming transfers that meet a query.

      All supported query criteria:
         address - get incoming transfers to a specific address in the wallet (optional)
         accountIndex - get incoming transfers to a specific account index (optional)
         subaddressIndex - get incoming transfers to a specific subaddress index (optional)
         subaddressIndices - get transfers destined for specific subaddress indices (optional)
         amount - amount being transferred (optional)
         txQuery - get transfers whose transaction meets this query (optional)

      Specified by:
      getIncomingTransfers in interface ZephyrWallet
      Parameters:
      query - specifies which incoming transfers to get
      Returns:
      incoming transfers that meet the query
    • getOutgoingTransfers

      public List<ZephyrOutgoingTransfer> getOutgoingTransfers()
      Description copied from interface: ZephyrWallet
      Get all of the wallet's outgoing transfers.
      Specified by:
      getOutgoingTransfers in interface ZephyrWallet
      Returns:
      the wallet's outgoing transfers
    • getOutgoingTransfers

      public List<ZephyrOutgoingTransfer> getOutgoingTransfers(ZephyrTransferQuery query)
      Description copied from interface: ZephyrWallet

      Get outgoing transfers that meet a query.

      All supported query criteria:
         address - get outgoing transfers from a specific address in the wallet (optional)
         accountIndex - get outgoing transfers from a specific account index (optional)
         subaddressIndex - get outgoing transfers from a specific subaddress index (optional)
         subaddressIndices - get outgoing transfers from specific subaddress indices (optional)
         amount - amount being transferred (optional)
         destinations - individual destinations of an outgoing transfer, which is local wallet data and NOT recoverable from the blockchain (optional)
         hasDestinations - get transfers that have destinations or not (optional)
         txQuery - get transfers whose transaction meets this query (optional)

      Specified by:
      getOutgoingTransfers in interface ZephyrWallet
      Parameters:
      query - specifies which outgoing transfers to get
      Returns:
      outgoing transfers that meet the query
    • getOutputs

      public List<ZephyrOutputWallet> getOutputs()
      Description copied from interface: ZephyrWallet
      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.

      Zephyr: in the full wallet (ZephyrWalletFull) the outputs carry no asset (ZephyrOutputWallet.getAssetType() is null): the core keeps an output's asset but does not serialize it. ZephyrWallet.getOutputAssetType(ZephyrOutputWallet) takes the asset from the output's transaction. See the user guide, docs/guide/08-known-limitations.md, section "getOutputs() reports no asset".

      Specified by:
      getOutputs in interface ZephyrWallet
      Returns:
      all wallet outputs
    • exportOutputs

      public String exportOutputs()
      Description copied from interface: ZephyrWallet
      Export outputs since the last export.
      Specified by:
      exportOutputs in interface ZephyrWallet
      Returns:
      outputs since the last export in hex format
    • exportKeyImages

      public List<ZephyrKeyImage> exportKeyImages()
      Description copied from interface: ZephyrWallet
      Export key images since the last export.
      Specified by:
      exportKeyImages in interface ZephyrWallet
      Returns:
      signed key images since the last export
    • createTx

      public ZephyrTxWallet createTx(ZephyrTxConfig config)
      Description copied from interface: ZephyrWallet
      Create a transaction to transfer funds from this wallet.

      All supported configuration:
         address - single destination address (required unless `destinations` provided)
         amount - single destination amount (required unless `destinations` provided)
         accountIndex - source account index to transfer funds from (required)
         subaddressIndex - source subaddress index to transfer funds from (optional)
         subaddressIndices - source subaddress indices to transfer funds from (optional)
         relay - relay the transaction to peers to commit to the blockchain (default false)
         priority - transaction priority (default ZephyrTxPriority.NORMAL)
         destinations - addresses and amounts in a multi-destination tx (required unless `address` and `amount` provided)
         paymentId - transaction payment ID (optional)
         unlockHeight - minimum height for the transaction to unlock (default 0)

      Specified by:
      createTx in interface ZephyrWallet
      Parameters:
      config - configures the transaction to create
      Returns:
      the created transaction
    • relayTx

      public String relayTx(String txMetadata)
      Description copied from interface: ZephyrWallet
      Relay a previously created transaction.
      Specified by:
      relayTx in interface ZephyrWallet
      Parameters:
      txMetadata - is transaction metadata previously created without relaying
      Returns:
      the hash of the relayed tx
    • relayTx

      public String relayTx(ZephyrTxWallet tx)
      Description copied from interface: ZephyrWallet
      Relay a previously created transaction.
      Specified by:
      relayTx in interface ZephyrWallet
      Parameters:
      tx - is the transaction to relay
      Returns:
      the hash of the relayed tx
    • relayTxs

      public List<String> relayTxs(List<ZephyrTxWallet> txs)
      Description copied from interface: ZephyrWallet
      Relay previously created transactions.
      Specified by:
      relayTxs in interface ZephyrWallet
      Parameters:
      txs - are the transactions to relay
      Returns:
      the hashes of the relayed txs
    • describeUnsignedTxSet

      public ZephyrTxSet describeUnsignedTxSet(String unsignedTxHex)
      Description copied from interface: ZephyrWallet
      Describe a tx set from unsigned tx hex.
      Specified by:
      describeUnsignedTxSet in interface ZephyrWallet
      Parameters:
      unsignedTxHex - unsigned tx hex
      Returns:
      the tx set containing structured transactions
    • describeMultisigTxSet

      public ZephyrTxSet describeMultisigTxSet(String multisigTxHex)
      Description copied from interface: ZephyrWallet
      Describe a tx set from multisig tx hex.
      Specified by:
      describeMultisigTxSet in interface ZephyrWallet
      Parameters:
      multisigTxHex - multisig tx hex
      Returns:
      the tx set containing structured transactions
    • signMessage

      public String signMessage(String message)
      Description copied from interface: ZephyrWallet
      Sign a message.
      Specified by:
      signMessage in interface ZephyrWallet
      Parameters:
      message - is the message to sign
      Returns:
      the signature
    • getTxProof

      public String getTxProof(String txHash, String address)
      Description copied from interface: ZephyrWallet
      Get a transaction signature to prove it.
      Specified by:
      getTxProof in interface ZephyrWallet
      Parameters:
      txHash - specifies the transaction to prove
      address - is the destination public address of the transaction
      Returns:
      the transaction signature
    • getSpendProof

      public String getSpendProof(String txHash)
      Description copied from interface: ZephyrWallet
      Generate a signature to prove a spend. Unlike proving a transaction, it does not require the destination public address.
      Specified by:
      getSpendProof in interface ZephyrWallet
      Parameters:
      txHash - specifies the transaction to prove
      Returns:
      the transaction signature
    • getTxNote

      public String getTxNote(String txHash)
      Description copied from interface: ZephyrWallet
      Get a transaction note.
      Specified by:
      getTxNote in interface ZephyrWallet
      Parameters:
      txHash - specifies the transaction to get the note of
      Returns:
      the tx note
    • setTxNote

      public void setTxNote(String txHash, String note)
      Description copied from interface: ZephyrWallet
      Set a note for a specific transaction.
      Specified by:
      setTxNote in interface ZephyrWallet
      Parameters:
      txHash - specifies the transaction
      note - specifies the note
    • getAddressBookEntries

      public List<ZephyrAddressBookEntry> getAddressBookEntries()
      Description copied from interface: ZephyrWallet
      Get all address book entries.
      Specified by:
      getAddressBookEntries in interface ZephyrWallet
      Returns:
      the address book entries
    • isMultisig

      public boolean isMultisig()
      Description copied from interface: ZephyrWallet
      Indicates if this wallet is a multisig wallet.
      Specified by:
      isMultisig in interface ZephyrWallet
      Returns:
      true if this is a multisig wallet, false otherwise
    • importMultisigHex

      public int importMultisigHex(String... multisigHexes)
      Description copied from interface: ZephyrWallet
      Import multisig info as hex from other participants.
      Specified by:
      importMultisigHex in interface ZephyrWallet
      Parameters:
      multisigHexes - are multisig hex from each participant
      Returns:
      the number of outputs signed with the given multisig hex
    • close

      public void close()
      Description copied from interface: ZephyrWallet
      Close the wallet (does not save).
      Specified by:
      close in interface ZephyrWallet
    • normalizeTransferQuery

      protected ZephyrTransferQuery normalizeTransferQuery(ZephyrTransferQuery query)
      Returns a copy of the query (a new query for null) whose tx query refers back to it, so that the transfer filter and the tx filter can be applied together.
      Parameters:
      query - is the transfer query (null for every transfer)
      Returns:
      the normalized copy