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.- TypeScript
- C#
- Python
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()
Prerequisites
- .NET SDK
Install
dotnet add package Second.Barkd
Usage
using Second.Barkd.Api;
using Second.Barkd.Client;
using Second.Barkd.Model;
var config = new Configuration
{
BasePath = "http://localhost:3000"
};
var walletApi = new WalletApi(config);
// Create wallet
await walletApi.CreateWalletAsync(new CreateWalletRequest(
arkServer: "https://ark.signet.2nd.dev",
chainSource: new ChainSourceConfig(
new ChainSourceConfigOneOf1(
new ChainSourceConfigOneOf1Esplora("https://esplora.signet.2nd.dev")
)
),
network: BarkNetwork.Signet,
mnemonic: "your seed phrase"
));
// Get address
var address = await walletApi.AddressAsync();
// Get balance
var balance = await walletApi.BalanceAsync();
Prerequisites
- Python 3.9+
Install
pip install barkd-client
Usage
import barkd_client
from barkd_client import (
Configuration,
WalletApi,
CreateWalletRequest,
ChainSourceConfig,
ChainSourceConfigOneOf1,
ChainSourceConfigOneOf1Esplora,
BarkNetwork,
)
config = Configuration(host='http://localhost:3000')
with barkd_client.ApiClient(config) as api_client:
wallet_api = WalletApi(api_client)
# Create wallet
wallet_api.create_wallet(CreateWalletRequest(
ark_server='https://ark.signet.2nd.dev',
chain_source=ChainSourceConfig(actual_instance=ChainSourceConfigOneOf1(
esplora=ChainSourceConfigOneOf1Esplora(url='https://esplora.signet.2nd.dev')
)),
network=BarkNetwork.SIGNET,
mnemonic='your seed phrase',
))
# Get address
address = wallet_api.address().address
# Get balance
balance = wallet_api.balance()
Need a client for another language? Generate one yourself from the OpenAPI spec using openapi-generator.