CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-arweave

JavaScript/TypeScript client library for the Arweave decentralized permanent data storage network

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

wallet-operations.mddocs/

Wallet Operations

Comprehensive wallet management functionality for the Arweave network, including wallet generation, address derivation, balance queries, and transaction history.

Capabilities

Generate Wallet

Generates a new cryptographic wallet using RSA key pair generation.

/**
 * Generate a new RSA wallet key pair
 * @returns Promise resolving to a JWK (JSON Web Key) interface
 */
generate(): Promise<JWKInterface>;

Usage Example:

import Arweave from "arweave";

const arweave = Arweave.init();

// Generate a new wallet
const key = await arweave.wallets.generate();
console.log("Generated wallet:", key);

Get Wallet Address

Convert a JWK to its corresponding wallet address or get address from browser wallet.

/**
 * Convert JWK to wallet address
 * @param jwk - JSON Web Key or "use_wallet" for browser wallet
 * @returns Promise resolving to the wallet address
 */
jwkToAddress(jwk?: JWKInterface | "use_wallet"): Promise<string>;

/**
 * Get wallet address (alias for jwkToAddress)
 * @param jwk - JSON Web Key or "use_wallet" for browser wallet  
 * @returns Promise resolving to the wallet address
 */
getAddress(jwk?: JWKInterface | "use_wallet"): Promise<string>;

Usage Examples:

import Arweave from "arweave";

const arweave = Arweave.init();
const key = await arweave.wallets.generate();

// Convert JWK to address
const address = await arweave.wallets.jwkToAddress(key);
console.log("Wallet address:", address);

// Use browser wallet (web environments only)
const browserAddress = await arweave.wallets.getAddress("use_wallet");

Get Wallet Balance

Retrieve the current balance of a wallet address in winston (smallest unit of AR).

/**
 * Get wallet balance in winston
 * @param address - The wallet address to query
 * @returns Promise resolving to balance in winston as string
 */
getBalance(address: string): Promise<string>;

Usage Example:

import Arweave from "arweave";

const arweave = Arweave.init();

const address = "your-wallet-address";
const balance = await arweave.wallets.getBalance(address);

// Convert winston to AR for display
const balanceInAr = arweave.ar.winstonToAr(balance);
console.log(`Balance: ${balanceInAr} AR`);

Get Last Transaction ID

Retrieve the last transaction ID (anchor) for a wallet address, used for creating new transactions.

/**
 * Get the last transaction ID for a wallet address
 * @param address - The wallet address to query
 * @returns Promise resolving to the last transaction ID
 */
getLastTransactionID(address: string): Promise<string>;

Usage Example:

import Arweave from "arweave";

const arweave = Arweave.init();

const address = "your-wallet-address";
const lastTx = await arweave.wallets.getLastTransactionID(address);
console.log("Last transaction:", lastTx);

Convert Owner to Address

Convert a transaction owner field (public key modulus) to its corresponding wallet address.

/**
 * Convert owner field to wallet address
 * @param owner - The owner field (public key modulus) from a transaction
 * @returns Promise resolving to the wallet address
 */
ownerToAddress(owner: string): Promise<string>;

Usage Example:

import Arweave from "arweave";

const arweave = Arweave.init();

// From a transaction object
const transaction = await arweave.transactions.get("transaction-id");
const ownerAddress = await arweave.wallets.ownerToAddress(transaction.owner);
console.log("Transaction owner address:", ownerAddress);

Types

JWKInterface

interface JWKInterface {
  /** Key type (RSA) */
  kty: string;
  /** Public exponent */  
  e: string;
  /** Modulus (public key) */
  n: string;
  /** Private exponent (optional, for private keys) */
  d?: string;
  /** First prime factor (optional) */
  p?: string;
  /** Second prime factor (optional) */
  q?: string;
  /** First factor CRT exponent (optional) */
  dp?: string;
  /** Second factor CRT exponent (optional) */
  dq?: string;
  /** First CRT coefficient (optional) */
  qi?: string;
}

JWKPublicInterface

interface JWKPublicInterface {
  /** Key type (RSA) */
  kty: string;
  /** Public exponent */
  e: string;
  /** Modulus (public key) */
  n: string;
}

docs

cryptographic-operations.md

currency-utilities.md

data-upload-chunking.md

data-utilities.md

encrypted-storage-silo.md

index.md

network-blockchain.md

transaction-management.md

wallet-operations.md

tile.json