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

@smontero/smartvaults-js-client

v0.0.65

Published

SmartVaults javascript client

Readme

Install dependencies

npm install

Build

npx tsc

Usage examples

Install

npm install @smontero/smartvaults-js-client @smontero/smartvaults-wasm @smontero/nostr-ual --save

Import modules

import { NostrClient, SmartVaults, Contact } from '@smontero/smartvaults-js-client';
import { DirectPrivateKeyAuthenticator } from '@smontero/nostr-ual'
import {
  Wallet,
  miniscript_to_descriptor as miniScriptToDescriptor,
  can_finalize_psbt as canFinalizePsbt,
  get_trx_id as getTrxIdWasm,
  get_fee as getFeeWasm,
  MiniscriptBuilder,
  get_psbt_utxos as getPsbtUtxos,
  descriptor_to_miniscript as descriptorToMiniscript
} from '@smontero/smartvaults-wasm'
import { generatePrivateKey } from 'nostr-tools'

Initializing SmartVaults

Parameters for Initialization:

  1. authenticator: An instance of an Authenticator
  2. bitcoinUtil: Utility functions related to Bitcoin transactions
  3. nostrClient: An instance of NostrClient for interacting with Nostr relays
const authenticator = new DirectPrivateKeyAuthenticator(generatePrivateKey())
const bitcoinUtil = {
        walletSyncTimeGap: 3, 
        toDescriptor: miniScriptToDescriptor,
        createWallet: (descriptor) => {
          return new Wallet(
            descriptor,
            'https://mempool.space/testnet/api',
            'testnet',
             15
          )
        },
        canFinalizePsbt: (psbts) => canFinalizePsbt(psbts),
        getTrxId: (trx) => getTrxIdWasm(trx),
        getFee: (psbt) => getFeeWasm(psbt),
        getPsbtUtxos: (psbt) => getPsbtUtxos(psbt),
        toMiniscript: (descriptor) => descriptorToMiniscript(descriptor)
}
const nostrClient = new NostrClient(['wss://test.relay.report'])
const smartVaults = new SmartVaults ({authenticator, bitcoinUtil, nostrClient})

Example: Set profile and Contacts

// Define the metadata object
const metadata = { name:'Bob', about:'Learning about Smart Vaults!'}
// Set profile
await smartVaults.setProfile(metadata)
const myPublicKey = authenticator.getPublicKey()
// Fetch profile
const myProfile = await smartVaults.getProfile(myPublicKey)
// Create another account to add as contact
const otherAuthenticator = new DirectPrivateKeyAuthenticator(generatePrivateKey())
const contactPubKey = otherAuthenticator.getPublicKey()
const contact = new Contact({publicKey: contactPubKey})
// Add contact
await smartVaults.upsertContacts(contact);
// Fetch contacts
const contacts = await smartVaults.getContacts()
// Fetch contacts including their metadata ( profile )
const contactsProfiles = await smartVaults.getContactProfiles()

Example: Create an 2-of-2 Multisig Vault

// For this example lets assume that we have created an account using one of the Smart Vaults apps ( iOs, Android or Desktop ).

// Get your Signers
const mySigners = await smartVaults.getOwnedSigners()
// For simplicity lets assume that we only have one signer
const mySigner = mySigners[0]
// Get your signer's Key
const mySignerKey = mySigner.key
// Get co-Signer's Key
const coSigner = await smartVaults.getSharedSigners()
const coSignerKey = coSigner[0].key
const keys = [mySignerKey, coSignerKey]
// Define the threshold
const threshold = 2
// Create the multisig miniscript
const miniscript = MiniscriptBuilder.multisig({threshold, keys})
// Define the other parameters
const name = 'My First Vault'
const description = "2 of 2 Multisig"
const nostrPublicKeys = [myPublicKey, contactPubKey]

// Create the vault
await smartVaults.savePolicy({ name, description, miniscript, nostrPublicKeys })