Sign DataItem
Wander Injected API signDataItem() function
Last updated
Was this helpful?
Was this helpful?
import { DataItem } from "@dha-team/arbundles";
// connect to the extension
await window.arweaveWallet.connect(["SIGN_TRANSACTION"]);
// sign the data item
const signed = await window.arweaveWallet.signDataItem({
data: "This is an example data",
tags: [
{
name: "Content-Type",
value: "text/plain",
},
],
});
// load the result into a DataItem instance
const dataItem = new DataItem(signed);
// now you can submit it to a bunder
await fetch(`https://upload.ardrive.io/v1/tx`, {
method: "POST",
headers: {
"Content-Type": "application/octet-stream",
},
body: dataItem.getRaw(),
});