Users will need the ability to send funds to other MobileCoin wallets. This enables the user to do things such as make purchases or transfer funds to other apps/services (sending to exchanges, etc.).
Two things should be done before sending a transaction:
- Obtain
PublicAddress
of recipient (see share-public-address) - Estimate total transaction fee (see calculate-fee)
The rest is fairly simple. The code provided below can be used to create and submit a transaction:
PendingTransaction pendingTransaction = client.prepareTransaction(
recipientPublicAddress,
amountToSend,
fee
);
client.submitTransaction(pendingTransaction.getTransaction());