npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

waves-da-sdk

v0.12.2

Published

Dapp Abstraction (DA) SDK for Waves

Readme

waves-da-sdk

JavaScript/TypeScript SDK for using DA Wallets on Waves blockchain.

Installation

npm i waves-da-sdk

Quick Start

Step 1: Check if user has a DA wallet

Before anything else, check if the user already has a DA wallet registered.

import { getActiveDAOrNull } from "waves-da-sdk";

const da = await getActiveDAOrNull(nodeUrl, {
  registry: "3N...",    // Registry address (see waves-da.com)
  eoa: userAddress      // User's EOA address
});

if (!da) {
  // User doesn't have a DA wallet yet
  // Option A: Redirect to waves-da.com to create one
  // Option B: Integrate creation into your app (see next section)
} else {
  // DA wallet exists, proceed with authentication + relayer
}

Step 2 (Option B): Create DA wallet in your app

If you want users to create their DA wallet directly in your app, here's how to do it as 4 separate user actions:

Step 2.1: Generate and display the DA account

User clicks "Generate DA Wallet" button:

import { randomSeed, address, publicKey } from "@waves/ts-lib-crypto";

// Generate a new DA account (client-side only)
const daSeed = randomSeed(15);
const daAddress = address({ publicKey: publicKey(daSeed) }, chainId);

// Display to user: "Save this seed securely"
console.log("DA Address:", daAddress);
console.log("DA Seed:", daSeed);  // ⚠️ User must save this!

Step 2.2: Fund the DA account

User clicks "Fund DA Account" button and specifies the amount:

import { Signer } from "@waves/signer";
import { ProviderKeeper } from "@waves/provider-keeper";

// Initialize signer (Waves browser wallet integration)
const signer = new Signer({ NODE_URL: "https://nodes-testnet.wavesnodes.com" });
signer.setProvider(new ProviderKeeper());

// User specifies amount they want to fund
const fundAmount = userInput.amount; // e.g., 3_000_000

// Transfer funds from user wallet to DA address
await signer.transfer({
  amount: fundAmount,
  recipient: daAddress
}).broadcast();

console.log("DA account funded with:", fundAmount);

Step 2.3: Deploy DA smart contract

User clicks "Deploy DA Contract" button:

import { broadcast, waitForTx } from "@waves/waves-transactions";
import { compileDaScript, buildDeployDATx, DA_RIDE_SOURCE } from "waves-da-sdk";

// Compile DA script on the node
const compiled = await compileDaScript(nodeUrl, DA_RIDE_SOURCE);

// Build deployment transaction (requires DA seed from Step 2.1)
const deployTx = buildDeployDATx(
  { chainId, fee: 1_400_000, compiledScript: compiled },
  daSeed  // From Step 2.1
);

// Broadcast and wait for confirmation
await waitForTx((await broadcast(deployTx, nodeUrl)).id, { apiBase: nodeUrl });

console.log("DA contract deployed at:", daAddress);

Step 2.4: Register in Registry

User clicks "Register DA Wallet" button (requires wallet signature):

import { Signer } from "@waves/signer";
import { ProviderKeeper } from "@waves/provider-keeper";

const signer = new Signer({ NODE_URL: nodeUrl });
signer.setProvider(new ProviderKeeper());

// Sign and broadcast registration transaction
const registryAddress = "3N..."; // Your Registry contract address

await signer.invoke({
  dApp: daAddress,      // The DA contract
  call: {
    function: "initAndRegister",
    args: [{ type: "string", value: registryAddress }],
  },
  payment: [],
}).broadcast();

console.log("DA wallet registered! Ready to use.");

Step 3: Authenticate user with relayer

User is now ready to use the relayer. Authenticate once:

import { RelayerAuthClient, RelayerSession } from "waves-da-sdk";
import { Signer } from "@waves/signer";
import { ProviderKeeper } from "@waves/provider-keeper";

const signer = new Signer({ NODE_URL: "https://nodes-testnet.wavesnodes.com" });
signer.setProvider(new ProviderKeeper());

const authClient = new RelayerAuthClient("http://localhost:3000");
const session = new RelayerSession();

// One-step authentication: login + relayer authorization
// Token is automatically stored and reused
const auth = await authClient.loginAndAuthenticate(signer, session);

Step 4: Call your dApp via relayer

Now you can invoke dApp functions using the DA wallet. All Waves callable argument types are supported:

const response = await fetch("http://localhost:3000/invoke", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${auth.token}`,
  },
  body: JSON.stringify({
    eoa: auth.eoa,
    targetDapp: "3YourDApp...",
    function: "deposit",
    args: [
      1000000,                             // Int
      "memo",                              // String
      true,                                // Boolean
      { binary: "AQID" },                  // ByteVector (base64)
      { list: ["tag1", "tag2", "tag3"] },  // List[String]
      { list: [10, 20, 30] },              // List[Int]
    ],
    payments: [{ amount: 500000 }],
  }),
});

const result = await response.json();
console.log("Transaction ID:", result.txId);

Arg types summary:

| Waves type | JSON | SDK (TypeScript) | |------------|------|-----------------| | Int | 42 | 42 | | String | "hello" | "hello" | | Boolean | true | true | | ByteVector | { "binary": "base64..." } | new Uint8Array(...) | | List[...] | { "list": [...] } | [...] (nested array) |


API Reference

Registry

| Function | Returns | Usage | |----------|---------|-------| | getActiveDAOrNull(nodeUrl, {registry, eoa}) | ActiveDA \| null | Get user's DA wallet, or null if none | | getActiveDA(nodeUrl, {registry, eoa}) | ActiveDA | Same as above, throws error if no DA |

DA Wallet Creation

| Function | Usage | |----------|-------| | compileDaScript(nodeUrl, source) | Compile DA script on the blockchain node | | buildDeployDATx(params, daSeed) | Build deployment transaction | | buildSetPendingOwnerDataTx(params, daSeed) | Set EOA as contract owner | | DA_RIDE_SOURCE | Ride source code of DA contract |

Relayer Authentication

| Class | Method | Usage | |-------|--------|-------| | RelayerAuthClient | loginAndAuthenticate(signer, session) | One-step login + relayer auth | | RelayerSession | isValid() / getToken() / clear() | JWT token management |

Types

| Type | Description | |------|-------------| | ActiveDA | { da: string; daPubKey: string } | | RegistryInfo | { registry: string; eoa: string } |


Full Documentation