Skip to main content

Posting Transactions

Overview

Providers, if supported, can commit transactions to the network using their connection to a node.

Sending transactions to the provider

note

Posting transactions requires the ID of the provider.

// initialized client
client.onPostTransactions(({ error, result }) => {
if (error) {
console.error('error:', error);

return;
}

console.log(result);
/*
{
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
txnIDs: [
'OKU6A2Q...',
],
}
*/
});

// send a post transactions request
client.postTransactions({
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
stxns: [
'gqNzaWfEQ...',
],
});
caution

If this method is not supported, then a MethodNotSupportedError should be thrown.

caution

If the transactions fail to be accepted by the network, then a FailedToPostSomeTransactionsError should be thrown.