0.1.1 • Published 1 year ago

@hellobtu/sdk v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@hellobtu/sdk

npm version npm downloads bundle License

Hello BTU Library

A TypeScript library for HelloBTU protocol.

Usage

Installation

npm install @hellobtu/sdk
# or
yarn add @hellobtu/sdk

Preparation

Downloads secp256k1.wasm to public/

Fetch channel info

import { getProInfo } from '@hellobtu/sdk'

const info = await getProInfo('bitcoin_testnet', 'tb1...')

Upgrade to PRO

import { getProInfo } from '@hellobtu/sdk'

const info = await upgradeToPro('bitcoin_testnet', 'tb1...')

Stake Bitcoin

import { stakeBitcoin } from '@hellobtu/sdk'

const stakeProps = {
  address: 'your-bitcoin-address',
  pubkey: 'your-public-key',
  committee: 'committee-address',
  amount: '1000000', // amount in satoshis
  feeRate: 5, // in sat/vB
  chainId: 11155111, // destination chain ID
  recipient: 'recipient-address',
  signer: 'your-wallet-provider, with signPsbt implemented'
}

// Stake Bitcoin
const txHash = await stakeBitcoin('bitcoin_testnet', stakeProps)
console.log('Transaction Hash:', txHash)

License

MIT

0.1.1

1 year ago

0.1.0

1 year ago