1.1.24 • Published 2 years ago

onebtc.sdk v1.1.24

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

one-btc sdk

Install instructions

NPM:

npm i onebtc.sdk --save

Yarn

yarn add onebtc.sdk

How to use

1. Init SDK instance

import * as onebtcSdk from 'onebtc.sdk';

const onebtcClient = await onebtcSdk.createClientWeb3({
  nodeURL: 'https://api.s0.b.hmny.io',
  btcNodeUrl: 'https://btc2.test.hmny.io',
  contractAddress: '0x2a9B7F9013E701AA71fE050eA9686BbB49E0D105',
  chainId: 2,
  gasLimit: 6721900,
});

1.1 Add account

const PRIVATE_KEY = 'some_private_key';
await onebtcClient.setAccount(PRIVATE_KEY);

2. Request issue

const VAULT_ADDRESS = '0x498554d79612C76d630c613cA5AD143FeE06ccF2';
onebtcClient.requestIssue(10000, VAULT_ADDRESS);

3. Request redeem

const VAULT_ADDRESS = '0x498554d79612C76d630c613cA5AD143FeE06ccF2';
onebtcClient.requestRedeem(10000, VAULT_ADDRESS);

Dashboard API

Init dashboard client

import { DashboardApi, Network } from 'onebtc.sdk/lib/dashboard-api';

export const dashboardClient = new DashboardApi({
  dashboardUrl: 'https://dashboard.btc.test.hmny.io',
  btcNodeUrl: config.bitcoin.btcNodeUrl.testnet,
  network: Network.TESTNET,
});

Load issue

const issueId = '60223755045874313250033704538578944141691614323714641306215289094834832886161'
dashboardClient.loadIssue(issueId).then((issue) => {
  console.log('### issue', issue);
});

Load redeem

const redeemId = '60223755045874313250033704538578944141691614323714641306215289094834832886161'
dashboardClient.loadRedeem(issueId).then((issue) => {
  console.log('### issue', issue);
});
1.1.23

2 years ago

1.1.22

2 years ago

1.1.24

2 years ago

1.1.21

2 years ago

1.1.20

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.16

2 years ago

1.1.15

2 years ago

1.1.14

2 years ago

1.1.13

2 years ago

1.1.19

2 years ago

1.1.18

2 years ago

1.1.17

2 years ago

1.1.9

3 years ago

1.1.10

2 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago