Skip to main content

Responding To Post Transactions Requests

Overview

As a provider usually has access to the network, the post_transactions method allows clients to rely on the provider to send transactions to the network.

Responding to a post transactions request

Once our provider object has been initialized, we can simply listen to events and respond:

const providerId = '02657eaf-be17-4efc-b0a4-19d654b2448e';

// initialized provider
provider.onPostTransactions(({ params }) => {
// ... using the `params.stxns` parameter, the provider posts the transactions to the network and returns the transaction ids

return {
providerId,
txnIDs: [
'OKU6A2Q...',
],
};
});
caution

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

caution

If there is a group of atomic transactions, but the computed group ID doesn't match the assigned ID, then a InvalidGroupIdError should be thrown.

caution

If any of the transactions are malformed, then a InvalidInputError should be thrown.

caution

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