githubEdit

Sign Transaction

Wander Injected API sign() function

To submit a transaction to the Arweave Network, it first has to be signed using a private key. The sign() function is meant to replicate the behavior of the transactions.sign() function of arweave-jsarrow-up-right, but instead of mutating the transaction object, it returns a new and signed transaction instance.

Argument
Type
Description

transaction

A valid Arweave transaction instance (without a keyfile)

options?

Arweave transaction signature options

circle-info

Note: This function requires the SIGN_TRANSACTION permission.

circle-info

Note: The options argument is optional, if it is not provided, the extension will use the default signature options (default salt length) to sign the transaction.

circle-exclamation
circle-exclamation

Example usage

import Arweave from "arweave";

// create arweave client
const arweave = new Arweave({
  host: "ar-io.net",
  port: 443,
  protocol: "https"
});

// connect to the extension
await window.arweaveWallet.connect(["SIGN_TRANSACTION"]);

// create a transaction
const transaction = await arweave.createTransaction({
  data: '<html><head><meta charset="UTF-8"><title>Hello permanent world! This was signed via Wander!!!</title></head><body></body></html>'
});

// sign using arweave-js
await arweave.transactions.sign(transaction);

// TODO: post the transaction to the network

Directly using Wander

Last updated

Was this helpful?