arweave.wallets(): Promise<Wallet[]>
await arweave.wallets();
// ["U2SjcTBXhsVs0kuSvNhPf84H2slCRiTBZtCCKoWMzvR"]
Trigger the extension to ask the user to authorize the app to access their wallet address. If authorized, the promise will resolve with a list of a single address, otherwise, the promise will reject.
arweave.network(): Promise<{
network: string,
host: string
}>
await arweave.network();
// {
// network: "arweave.N.1",
// host: "https://arweave.net"
// }
Lets the application retrieve the network and host to which the extension is currently connected to. Rejects if the extension fails to connect to the selected network.
arweave.signMessage(message: ArrayBuffer): Promise<Uint8Array>
const te = new TextEncoder();
const message = te.encode("hello");
await arweave.signMessage(message);
// Uint8Array [ ... ]
Triggers the extension to ask the user to allow signing the given message. The resulting signature should start with the prefix ARWEAVE_SIGNED_MESSAGE:
. Rejects if the user denies signing the message.
arweave.sendTransaction(foo: {
recipient?: Wallet,
amount?: Winston,
fee?: Winston,
data?: ArrayBuffer,
tags?: [string, string][],
}): Promise<string>
const te = new TextEncoder();
await arweave.sendTransaction({
data: te.encode('{"foo":"bar"}'),
tags: [
["app_name", "foobar"],
["Content-Type", "application/json"]
]
});
// "NpeIbi93igKhE5lKUMhH5dFmyEsNGC0fb2Qysggd-kM"
Triggers the extension to present the user with a transaction dialog letting the user see the cost of that transaction and adjust its fee. Resolves to the new transaction's ID if successfully submitted to the network. Rejects otherwise.
arweave.getStatus(txid: string): Promise<string>
await arweave.getStatus("NpeIbi93igKhE5lKUMhH5dFmyEsNGC0fb2Qysggd-kM");
// "pending"
Gets a transactions current status.
Should this be
.getPrice
?
arweave.getFee(byteSize?: number, recipient?: Wallet): Promise<Winston>
await arweave.getFee(1048576, "U2SjcTBXhsVs0kuSvNhPf84H2slCRiTBZtCCKoWMzvR");
// "6523795207"
Gets the estimated fee for the given byte size and recipient.
arweave.on("walletsChange", handleWalletsChange: (wallets: Wallet[]) => void): void
arweave.on("walletsChange", newWallets => {
// Update app state...
});
arweave.on("networkChange", handleNetworkChange: (network: { network: string, host: string }) => void): void
arweave.on("networkChange", newNetwork => {
// Update app state...
});
type Wallet = string;
type Winston = string;