Skip to content

Commit

Permalink
Merge branch 'main' into bot-ic-update-1725247987
Browse files Browse the repository at this point in the history
  • Loading branch information
dskloetd authored Sep 2, 2024
2 parents de1ad4c + c74b166 commit 67de8a3
Show file tree
Hide file tree
Showing 16 changed files with 197 additions and 261 deletions.
22 changes: 20 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
# Next
# 2024.09.02-0830Z

## Overview

The current status of the libraries at the time of the release is as follows:

| Library | Version | Status |
| ------------------------ | ------- | ------------------- |
| `@dfinity/ckbtc` | v3.0.0 | Breaking Changes ⚠️ |
| `@dfinity/cketh` | v3.3.0 | Maintained ⚙️ |
| `@dfinity/cmc` | v3.2.0 | Maintained ⚙️ |
| `@dfinity/ic-management` | v5.2.0 | Maintained ⚙️ |
| `@dfinity/ledger-icp` | v2.5.0 | Maintained ⚙️ |
| `@dfinity/ledger-icrc` | v2.5.0 | Maintained ⚙️ |
| `@dfinity/nns` | v6.0.0 | Breaking Changes ⚠️ |
| `@dfinity/nns-proto` | v2.0.1 | Maintained ⚙️️ |
| `@dfinity/sns` | v3.2.0 | Maintained ⚙️ |
| `@dfinity/utils` | v2.5.0 | Maintained ⚙️ |

## Breaking changes

- Rename values of enum Topic and NnsFunction to match the backend values.
- Use different request/response types for NNS Governance proposals, and different fields for `InstallCode` proposals.
- The `getUtxos` parameter `filter.min_confirmations` has been renamed to `filter.minConfirmations` for consistency with the general naming conventions used in `@dfinity/ckbtc`.
- Only queries to `getUtxos` of the Bitcoin canister can be executed by external users — i.e., update calls can only be performed by the canister. This is why `getUtxos` now only supports non-certified calls and has been renamed to `getUtxosQuery`.

## Features

- Provide a new utility to convert Candid `Nat` to `BigInt`. This utility is useful for interpreting the fees provided by the SNS Aggregator.
- Support conversion of `InstallCode`, `StopOrStartCanister` and `UpdateCanisterSettings` actions, `SetVisibility` neuron operation, and `Neuron::visibility` attribute.
- Add function `getBalance` to `BitcoinCanister` object of package `@dfinity/ckbtc`, that implements the `bitcoin_get_balance` method of the IC Bitcoin API.
- Add function `getBalanceQuery` to `BitcoinCanister` object of package `@dfinity/ckbtc`, that implements the `bitcoin_get_balance_query` method of the IC Bitcoin API.

## Build

Expand Down
42 changes: 21 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dfinity/ic-js",
"version": "2024.07.22-0645Z",
"version": "2024.09.02-0830Z",
"description": "A collection of library for interfacing with the Internet Computer.",
"license": "Apache-2.0",
"workspaces": [
Expand Down
28 changes: 15 additions & 13 deletions packages/ckbtc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ Parameters:
#### Methods

- [create](#gear-create)
- [getUtxos](#gear-getutxos)
- [getBalance](#gear-getbalance)
- [getUtxosQuery](#gear-getutxosquery)
- [getBalanceQuery](#gear-getbalancequery)

##### :gear: create

Expand All @@ -292,37 +292,39 @@ Parameters:

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/bitcoin.canister.ts#L18)

##### :gear: getUtxos
##### :gear: getUtxosQuery

Given a `get_utxos_request`, which must specify a Bitcoin address and a Bitcoin network (`mainnet` or `testnet`), the function returns all unspent transaction outputs (UTXOs) associated with the provided address in the specified Bitcoin network based on the current view of the Bitcoin blockchain available to the Bitcoin component.

| Method | Type |
| ---------- | --------------------------------------------------------------------------- |
| `getUtxos` | `({ certified, ...params }: GetUtxosParams) => Promise<get_utxos_response>` |
⚠️ Note that this method does not support certified calls because only canisters are allowed to get UTXOs via update calls.

| Method | Type |
| --------------- | ---------------------------------------------------------------- |
| `getUtxosQuery` | `({ ...params }: GetUtxosParams) => Promise<get_utxos_response>` |

Parameters:

- `params.network`: Tesnet or mainnet.
- `params.filter`: The optional filter parameter can be used to restrict the set of returned UTXOs, either providing a minimum number of confirmations or a page reference when pagination is used for addresses with many UTXOs.
- `params.address`: A Bitcoin address.
- `params.certified`: query or update call

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/bitcoin.canister.ts#L41)
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/bitcoin.canister.ts#L42)

##### :gear: getBalance
##### :gear: getBalanceQuery

Given a `get_balance_request`, which must specify a Bitcoin address and a Bitcoin network (`mainnet` or `testnet`), the function returns the current balance of this address in `Satoshi` (10^8 Satoshi = 1 Bitcoin) in the specified Bitcoin network.

| Method | Type |
| ------------ | ----------------------------------------------------------------- |
| `getBalance` | `({ certified, ...params }: GetBalanceParams) => Promise<bigint>` |
⚠️ Note that this method does not support certified calls because only canisters are allowed to get Bitcoin balance via update calls.

| Method | Type |
| ----------------- | ------------------------------------------------------ |
| `getBalanceQuery` | `({ ...params }: GetBalanceParams) => Promise<bigint>` |

Parameters:

- `params.network`: Tesnet or mainnet.
- `params.min_confirmations`: The optional filter parameter can be used to limit the set of considered UTXOs for the calculation of the balance to those with at least the provided number of confirmations in the same manner as for the `bitcoin_get_utxos` call.
- `params.address`: A Bitcoin address.
- `params.certified`: query or update call

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/bitcoin.canister.ts#L64)

Expand Down
4 changes: 2 additions & 2 deletions packages/ckbtc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dfinity/ckbtc",
"version": "2.5.0",
"version": "3.0.0",
"description": "A library for interfacing with ckBTC.",
"license": "Apache-2.0",
"main": "dist/cjs/index.cjs.js",
Expand Down Expand Up @@ -41,7 +41,7 @@
"@dfinity/agent": "^2.0.0",
"@dfinity/candid": "^2.0.0",
"@dfinity/principal": "^2.0.0",
"@dfinity/utils": "^2.4.0"
"@dfinity/utils": "^2.5.0"
},
"dependencies": {
"@noble/hashes": "^1.3.2",
Expand Down
Loading

0 comments on commit 67de8a3

Please sign in to comment.