Package foundation.omni.txsigner
Class OmniRpcClientSendingService
java.lang.Object
foundation.omni.txsigner.OmniRpcClientSendingService
- All Implemented Interfaces:
OmniSendingService
A service to sign and send Omni Transactions (similar to functionality in Omni Core). Uses a JSON-RPC client to
connect to a ConsensusJ SPV-wallet-daemon. (In the future we may support Bitcoin Core and Omni Core nodes as well.)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionassembleSimpleSend
(org.bitcoinj.base.Address fromAddress, org.bitcoinj.base.Address toAddress, CurrencyID currency, OmniValue amount) Build a complete, unsigned SimpleSend ("signing request") transaction.getInputsFor
(org.bitcoinj.base.Address fromAddress) Fetch inputs for an addressCompletableFuture
<org.bitcoinj.base.Sha256Hash> omniSend
(UnsignedTxSimpleSend simpleSend) Sign and Send an Omni Simple Send transaction.CompletableFuture
<org.bitcoinj.base.Sha256Hash> omniSend
(org.bitcoinj.base.Address fromAddress, org.bitcoinj.base.Address toAddress, CurrencyID currency, OmniValue amount) Find inputs, Sign and Send an Omni Simple Send transactionCompletableFuture
<org.bitcoinj.base.Sha256Hash> sendRawTransactionAsync
(org.bitcoinj.core.Transaction tx)
-
Constructor Details
-
OmniRpcClientSendingService
-
-
Method Details
-
omniSend
public CompletableFuture<org.bitcoinj.base.Sha256Hash> omniSend(org.bitcoinj.base.Address fromAddress, org.bitcoinj.base.Address toAddress, CurrencyID currency, OmniValue amount) throws IOException Description copied from interface:OmniSendingService
Find inputs, Sign and Send an Omni Simple Send transactionThis method is compatible with the Omni Core
omni_send
JSON-RPC method and if made available from a JSON-RPC server should work equivalently. (The last two, optional arguments are not currently implemented.)- Specified by:
omniSend
in interfaceOmniSendingService
- Parameters:
fromAddress
- Omni address sending fundstoAddress
- Omni address receiving fundscurrency
- Currency typeamount
- amount- Returns:
- A future for the transaction hash
- Throws:
IOException
- A failure occurred fetching inputs or broadcasting the transaction
-
omniSend
public CompletableFuture<org.bitcoinj.base.Sha256Hash> omniSend(UnsignedTxSimpleSend simpleSend) throws IOException Description copied from interface:OmniSendingService
Sign and Send an Omni Simple Send transaction. Incubating.- Specified by:
omniSend
in interfaceOmniSendingService
- Parameters:
simpleSend
- An object holding all the parameters (including UTXO inputs) for a simple send transaction- Returns:
- A future for the transaction hash
- Throws:
IOException
- A failure occurred fetching broadcasting the transaction
-
assembleSimpleSend
public UnsignedTxSimpleSend assembleSimpleSend(org.bitcoinj.base.Address fromAddress, org.bitcoinj.base.Address toAddress, CurrencyID currency, OmniValue amount) throws IOException Build a complete, unsigned SimpleSend ("signing request") transaction. Fetches the transaction inputs, assembles the payload, etc.- Specified by:
assembleSimpleSend
in interfaceOmniSendingService
- Parameters:
fromAddress
- Omni address sending fundstoAddress
- Omni address receiving fundscurrency
- Currency typeamount
- amount- Returns:
- A record containing all necessary data for signing
- Throws:
IOException
- if an error occurred fetching inputs
-
getInputsFor
public List<TransactionInputData> getInputsFor(org.bitcoinj.base.Address fromAddress) throws IOException Fetch inputs for an address- Specified by:
getInputsFor
in interfaceOmniSendingService
- Parameters:
fromAddress
- Address with zero or more UTXOs- Returns:
- a list of all UTXOs for this address
- Throws:
IOException
- if an error occurred fetching inputs
-
sendRawTransactionAsync
public CompletableFuture<org.bitcoinj.base.Sha256Hash> sendRawTransactionAsync(org.bitcoinj.core.Transaction tx) - Specified by:
sendRawTransactionAsync
in interfaceOmniSendingService
-