From b103827bfd408c5a05fab6eea9b9f0f0d078aec2 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 08:13:40 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Documentation=20auto-update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ckbtc/README.md | 43 ++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/packages/ckbtc/README.md b/packages/ckbtc/README.md index 68e01930b..c00ce2cfc 100644 --- a/packages/ckbtc/README.md +++ b/packages/ckbtc/README.md @@ -78,7 +78,7 @@ Parameters: ### :factory: CkBTCMinterCanister -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L33) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L35) #### Methods @@ -87,6 +87,7 @@ Parameters: - [updateBalance](#gear-updatebalance) - [getWithdrawalAccount](#gear-getwithdrawalaccount) - [retrieveBtc](#gear-retrievebtc) +- [retrieveBtcWithApproval](#gear-retrievebtcwithapproval) - [estimateWithdrawalFee](#gear-estimatewithdrawalfee) - [getMinterInfo](#gear-getminterinfo) @@ -96,7 +97,7 @@ Parameters: | -------- | ------------------------------------------------------------------------ | | `create` | `(options: CkBTCMinterCanisterOptions<_SERVICE>) => CkBTCMinterCanister` | -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L34) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L36) ##### :gear: getBtcAddress @@ -114,7 +115,7 @@ Parameters: - `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. -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L55) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L57) ##### :gear: updateBalance @@ -132,7 +133,7 @@ Parameters: - `params.owner`: The owner of the address. If not provided, the `caller` will be use instead. - `params.subaccount`: An optional subaccount of the address. -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L74) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L76) ##### :gear: getWithdrawalAccount @@ -142,7 +143,7 @@ Returns the account to which the caller should deposit ckBTC before withdrawing | ---------------------- | ------------------------ | | `getWithdrawalAccount` | `() => Promise` | -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L97) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L99) ##### :gear: retrieveBtc @@ -166,7 +167,33 @@ Parameters: - `params.address`: The bitcoin address. - `params.amount`: The ckBTC amount. -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L116) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L118) + +##### :gear: retrieveBtcWithApproval + +Submits a request to convert ckBTC to BTC after making an ICRC-2 approval. + +# Note + +The BTC retrieval process is slow. Instead of synchronously waiting for a BTC transaction to settle, this method returns a request ([block_index]) that the caller can use to query the request status. + +# Preconditions + +The caller allowed the minter's principal to spend its funds using +[icrc2_approve] on the ckBTC ledger. + +| Method | Type | +| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | +| `retrieveBtcWithApproval` | `({ address, amount, fromSubaccount, }: { address: string; amount: bigint; fromSubaccount?: Uint8Array; }) => Promise` | + +Parameters: + +- `params.address`: The bitcoin address. +- `params.amount`: The ckBTC amount. +- `params.fromSubaccount`: An optional subaccount from which + the ckBTC should be transferred. + +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L148) ##### :gear: estimateWithdrawalFee @@ -182,7 +209,7 @@ Parameters: - `params.certified`: query or update call - `params.amount`: The optional amount for which the fee should be estimated. -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L135) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L179) ##### :gear: getMinterInfo @@ -197,7 +224,7 @@ Parameters: - `params`: The parameters to get the deposit fee. - `params.certified`: query or update call -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L149) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L193)