OthentKMS dispatch() function
The dispatch()
function allows you to quickly sign and post a transaction to the Arweave network in a bundled format. It is best for smaller data sizes and smart contract interactions. If the bundled transaction cannot be submitted, it will fall back to a base layer transaction.
To use the dispatch()
function, import it from the @othent/kms
package and call it within an asynchronous function as follows:
import { dispatch } from "@othent/kms";
const handleDispatch = async () => {
// code to create transaction
const res = await dispatch(
transaction,
"<https://turbo.ardrive.io>",
arweave,
);
console.log(res);
};
The dispatch()
function supports the following arguments:
arweave.net
on port 443
.<aside> ⚠️ Note: A user must be logged in to an application to successfully decrypt data.
</aside>
On successful execution, the function returns an object with the transaction id of the dispatched transaction as follows:
{
id: "gySYprQ1nIQ6T6uHxmQQFcjBaxNzDOuB9zWM0piT7p0"
}
Applications can then display this id or use it for other operations.