Wallet
This class defines a wallet interface. A wallet is a set of payment destinations that are being tracked on a particular blockchain.
Inheritors
Types
Provide various wallet statistics
Properties
Control whether saving the wallet to underlying storage is automatic (true, default), or initiated by API calls Wallet performance could improve if automaticFlush is false and the wallet is saved rarely. However state may be lost!
This wallet finds its coins on this blockchain
Give this wallet access to the historical price (epoch seconds) of its token in the provided fiat currency code
Returns the current position of this wallet in the blockchain by block time. Since a fork may have occurred, this information does not unambiguously locate the wallet, but it is valuable for UI.
Returns the current position of this wallet in the blockchain by block hash. Since a fork may have occurred, this information does not unambiguously locate the wallet, but it is valuable for UI.
Returns the current position of this wallet in the blockchain by block height. Since a fork may have occurred, this information does not unambiguously locate the wallet, but it is valuable for UI.
Functions
Abort this transaction, whose inputs were reserved by "prepareSend". Update the wallet to release all inputs reserved by this transaction
Return all configured identity domains
This function will split the wallet's native coin so that there are numUtxos of amt satoshis. If the wallet already has some UTXOs that fit the requirements, they count. So its possible that no transactions will be created
This function will split the wallet's Tokens so that there are numUtxos of amt satoshis. If the wallet already has some UTXOs that fit the requirements, they count. So its possible that no transactions will be created
Free up any UTXOs that have been allocated for pending transactions to be used again. This means that they might be double spent if that old reservation is still in progress.
Forget about all unconfirmed transactions in the wallet. It the transactions are in the network and are confirmed they will be added to the wallet at that point. This API is used to clear out tx that will never confirm for some reason. This API causes the wallet to forget about the inputs that weren't confirmed. "Rediscover" can get those back
Forget about certain transactions in the wallet. If the transactions are in the network and are later confirmed they will be added to the wallet then. This API is used to clear out tx that will never confirm for some reason. This API causes the wallet to forget about the inputs that weren't confirmed. "Rediscover" can get those back
Get a repeatable destination, generally used for identity purposes. Given 2 different seeds, this API should at a minimum be statistically unlikely to produce the same address The seed may be public data (a domain name, for example) so wallet security must not depend on it being a secret.
Low level API to generate a new address to receive funds, called by newDestination. Use "newDestination()" in almost all cases. This API does not pre-generate (so may be slow), and does not install the destination into bloom filters, etc, before returning. This means that there may be a race condition between the use of the destination returned here and the wallet's monitoring of that destination which could cause funds to be received but not noticed by this wallet.
Get the current address to receive funds. Different wallets may support different payment destination types. This API returns whatever is the "default" type for this wallet. This allows generic algorithms to be created that can be applied to many different wallet types. When this API returns, the destination is ready for use (monitoring is installed in remote nodes, IF any remote nodes exist). This API may pre-generate destinations. This address will be returned until activity is detected on-chain, or until markAddressUsed is called
Gets a new address: convenience function that is functionally similar to @newDestination but mirrors the bitcoin-cli command
Get a new address to receive funds. This will return and "retire" the current address. Different wallets may support different payment destination types. This API returns whatever is the "default" type for this wallet. This allows generic algorithms to be created that can be applied to many different wallet types. When this API returns, the destination is ready for use (monitoring is installed in remote nodes, IF any remote nodes exist). This API may pre-generate destinations.
Wallet implementations may allow access to addresses generated from specific private keys or nonstandard HD derivation paths. The wallet will never offer these destinations as current payment targets. It will only spend them (and show their balance).
wallet history by transaction
all UTXOs that this wallet is capable of spending (and how to spend them) READ ONLY
Return identity domain data if this domain has previously been used
Mark an address as 'used' so it will not be provided any longer. Note that if an address is 'seen' on the blockchain, this happens automatically.
Get a new address to receive funds. Different wallets may support different payment destination types. This API returns whatever is the "default" type for this wallet. This allows generic algorithms to be created that can be applied to many different wallet types. When this API returns, the destination is ready for use (monitoring is installed in remote nodes, IF any remote nodes exist). This API may pre-generate destinations.
Tell the wallet that now is a good time to top-up a cache of unused destinations
Creates an unsigned transaction that sends to a list of outputs. This function will select input coins from the wallet to fill the passed quantity and sign the transaction, but will not relay the transaction to the network.
Forget all transaction and blockchain state, and asynchronously redo the search for wallet transactions. This is intended for testing and debug
Remove identity domain data
Remove identity information
Remove a callback handler for whenever this wallet changes. You must pass the handler you set to ensure you have the wallet change callback.
Post this transaction and update the wallet based on any inputs spent. Typically the provided tx came from calling prepareSend
Send funds to multiple destinations. This function will select input coins from the wallet to fill the passed quantity
Send tokens to a destination. This is a convenience function to send to one destination. Use send(vararg outputs:iTxOutput...) to send multiple token types at once.
Send funds to this destination. This function will select input coins from the wallet to fill the passed quantity
Send funds to multiple destinations (native coin only). This function will select input coins from the wallet to fill the passed quantity
Install a callback handler for whenever this wallet changes
Sign (using blockchain compatible SHA256 and Schnorr) the provided data with the provided address (this wallet must have the private key for that address), or pass null to use the common identity.
Sign (using blockchain compatible Schnorr) the provided data with the provided address (this wallet must have the private key for that address), or pass null to use the common identity.
Report various wallet statistics, see WalletStatistics
Calculate a suggested fee for this transaction
Return whether this wallet is synced with its underlying blockchain. If it is not synced, properties like balance and balanceUnconfirmed express some previous state. In the unsynced case, this API will wait for it to do so, but no more than the provided time in milliseconds. If a height is provided, this API returns true if the wallet is synced up to or beyond this height If a height is not provided (or is -1), this API assumes you mean up to "now". This is special cased with an extra check that the blockchain's tip timestamp is within an hour of now. Of course, since blocks can be discovered at any time, and connected nodes can be slow at processing blocks one cannot ever absolutely know whether the wallet is really synced up to "now", so this function is more accurately described as "nearly synced" for any "now" call.
Return whether this wallet is synced with its underlying blockchain. If it is not synced, properties like balance and balanceUnconfirmed express some previous state. In the unsynced case, this API will wait for it to do so, but no more than the provided time in milliseconds. If a height is provided, this API returns true if the wallet is synced up to or beyond this height If a height is not provided (or is -1), this API assumes you mean up to "now". This is special cased with an extra check that the blockchain's tip timestamp is within an hour of now. Of course, since blocks can be discovered at any time, and connected nodes can be slow at processing blocks one cannot ever absolutely know whether the wallet is really synced up to "now", so this function is more accurately described as "nearly synced" for any "now" call.
Modify the passed transaction to complete it to the extent possible by this wallet, including: Find inputs needed to supply satoshis and/or group tokens for this transaction. If change outputs are required, add them. If mint baton passing outputs are possible then add them if equalizeAuthorities=true If outputs are not fully specified, supply the missing constraints. The order of inputs and outputs is NOT changed.
Add or update identity domain data
Add or update identity data
verify (using blockchain compatible SHA256 and Schnorr) the provided data (the message) with the provided address (this wallet must have the private key for that address), or pass null to use the common identity. Use libnexa.verifySignedHashSchnorr or libnexa.verifySignedDataSchnorr if you need to verify a non-wallet signature with a public key. Use verifySigForHash you may use if the data has already been run through a cryptgraphic hash function.
verify (using blockchain compatible SHA256 and Schnorr) the provided data with the provided address (this wallet must have the private key for that address), or pass null to use the common identity. Use libnexa.verifySignedHashSchnorr or libnexa.verifySignedDataSchnorr if you need to verify a non-wallet signature with a public key. You may call verifySigForData instead as a shortcut if you have the data "preimage" not the hash and want to automatically use the standard cryptographic hash for this blockchain.