Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dfinity/ckbtc

Package Overview
Dependencies
Maintainers
10
Versions
641
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dfinity/ckbtc

A library for interfacing with ckBTC.

  • 0.0.2-next-2023-02-15
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8K
decreased by-5.92%
Maintainers
10
Weekly downloads
 
Created
Source

ckbtc-js

A library for interfacing with ckBTC on the Internet Computer.

npm version GitHub license

Table of contents

Installation

You can use ckbtc-js by installing it in your project.

npm i @dfinity/ckbtc

The bundle needs peer dependencies, be sure that following resources are available in your project as well.

npm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils

Usage

The features are available through the class LedgerCanister. It has to be instantiated with a canister ID.

e.g. fetching a token metadata.

import { CkBTCCanister } from "@dfinity/ckbtc";
import { createAgent } from "@dfinity/utils";

const agent = await createAgent({
  identity,
  host: HOST,
});

const { getBtcAddress } = CkBTCCanister.create({
  agent,
  canisterId: MY_CKBTC_MINTER_CANISTER_ID,
});

const btcAddress = await getBtcAddress({});

Features

ckbtc-js implements following features:

:factory: CkBTCMinterCanister

Constructors

public

Methods
:gear: create
MethodType
create(options: CkBTCMinterCanisterOptions<_SERVICE>) => CkBTCMinterCanister
:gear: getBtcAddress

Returns a BTC address for a given account.

Note: an update call is required by the Minter canister.

MethodType
getBtcAddress({ owner, subaccount, }: MinterParams) => Promise<string>

Parameters:

  • params: The parameters for which a BTC address should be resolved.
  • params.owner: The owner for which the BTC address should be generated. If not provided, the caller will be use instead.
  • params.subaccount: An optional subaccount to compute the address.
:gear: updateBalance

Notify the minter about the bitcoin transfer.

Upon successful notification, new ckBTC should be available on the targeted address.

MethodType
updateBalance({ owner, subaccount, }: MinterParams) => Promise<UpdateBalanceResult>

Parameters:

  • params: The parameters are the address to which bitcoin where transferred.
  • params.owner: The owner of the address. If not provided, the caller will be use instead.
  • params.subaccount: An optional subaccount of the address.

Resources

Keywords

FAQs

Package last updated on 15 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc