Skip to main content
We publish typed client packages that wrap the barkd REST API, so you can call it from typed code without writing raw HTTP. The packages are generated from the OpenAPI spec and live in the barkd-clients repository.
These examples create a signet wallet for free testing. To go live, set arkServer and the Esplora chainSource to Second’s mainnet endpoints from Test on mainnet, and set the network to bitcoin.

Prerequisites

  • Node.js

Install

npm install @secondts/barkd

Usage

import { Configuration, WalletApi } from '@secondts/barkd'

const config = new Configuration({
  basePath: 'http://localhost:3000'
})

const walletApi = new WalletApi(config)

// Create wallet
await walletApi.createWallet({
  createWalletRequest: {
    arkServer: 'https://ark.signet.2nd.dev',
    chainSource: { esplora: { url: 'https://esplora.signet.2nd.dev' } },
    network: 'signet',
    mnemonic: 'your seed phrase'
  }
})

// Get address
const { address } = await walletApi.address()

// Get balance
const balance = await walletApi.balance()
Need a client for another language? Generate one yourself from the OpenAPI spec using openapi-generator.