sendTransaction(txObject)
Feature
Requests the wallet to sign and broadcast a transaction to the network.
Parameters
object transactionObject (hinted object)
Return Value
Promise<string>
example
// 1. Create the operation using the 'Mitum' class
const mitum = new Mitum("**API Endpoint**");
const userAddress = (await provider.getAccounts())[0];
const op = mitum.currency.transfer(userAddress, recipientAddress, currencyID, 100);
const txObject = op.toHintedObject(); // 2. Convert to JSON-compatible object
// 3. Send the object to the wallet for signing and submission
async function submit() {
try {
const factHash = await provider.sendTransaction(txObject);
console.log('Transaction Fact Hash:', factHash);
alert('Transaction sent!');
} catch (error) {
// User rejected the signature
console.error(error.message);
alert(`Transaction failed: ${error.message}`);
}
}Last updated