Error importing ckBtccanister from @dfnity/ckbtc package

Bug Report

I am trying to do a basic frontend integration for the ckBtc minter canister and according to the documentation, the initial steps should be

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({});

but then I am getting a TypeScript error that says: Module ‘“@dfinity/ckbtc”’ has no exported member ‘CkBTCCanister’.

It’s not a “Bug Report” but, I’m guessing a typo in the README.

The correct feature exposed by the library is CkBTCMinterCanister.

import { CkBTCMinterCanister } from “@dfinity/ckbtc”;

...

I just tried out your recommendation, and it works fine, Thank you

1 Like

You’re welcome.

I’ve provided a PR to fix the typo in the README: https://github.com/dfinity/ic-js/pull/553