dispatch() (transaction)

Othent JS SDK dispatch() function

The dispatch() function allows you to quickly sign and send a transaction to the network in a bundled format. It is best for smaller datas and contract interactions. If the bundled transaction cannot be submitted, it will fall back to a base layer transaction. The function returns the result of the API call.

Tip: If you are trying to sign a larger piece of data (> 5 MB), make sure to notify the user to not switch / close the browser tab. Larger transactions are split into chunks in the background and will take longer to sign.

Tip: The function uses the default bundler node, or the one passed as an option. Consider using the signDataItem() function to create and sign a DataItem and manually send it to a custom bundler.

API

dispatch(
  transaction: Transaction,
  options?: DispatchOptions,
): Promise<ArDriveBundledTransactionData | UploadedTransactionData>;

transaction: Transaction

A valid Arweave Transaction instance, without a keyfile.

options?: DispatchOptions

  • options?.node?: UrlString (string)

    Node used for bundling transactions. Defaults to ArDrive Turbo's node.

  • options?.arweave?: Arweave

    Custom Arweave instance. Defaults to an instance connected to https://arweave.net:443.

return Promise<ArDriveBundledTransactionData | UploadedTransactionData>

A Promise containing the result of the upload request, including the ID of the submitted transaction, as as well as a type property indicating if it was uploaded by a bundle or directly to the base layer, as well as some additional properties:

Example usage

Last updated