Skip to content

Commit

Permalink
chore: merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker committed Jul 3, 2023
2 parents acdbd84 + a9ab75c commit 8a2816c
Show file tree
Hide file tree
Showing 12 changed files with 491 additions and 109 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- utils `v0.0.19`
- nns-proto `v0.0.5`

# 0.18.0 (wip)
# 0.18.0 (2023-07-03)

## Release

Expand All @@ -32,6 +32,13 @@
## Features

- add a new utils function `decodePayment` to the `@dfinity/ledger` library. Useful to decode payment through QR code that contains target address and amount
- add provisional create canister with cycles method
- `CreateServiceNervousSystem` <-> `RawCreateServiceNervousSystem` transformations for Nns proposal
- decode payment code (early support and not yet specified. see ICRC-22)

## Build

- bump `semver`

# 0.17.2 (2023-06-21)

Expand Down
16 changes: 8 additions & 8 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
Expand Up @@ -55,7 +55,7 @@
"text-encoding": "^0.7.0",
"ts-jest": "^29.1.0",
"ts-protoc-gen": "^0.15.0",
"tsdoc-markdown": "^0.0.1",
"tsdoc-markdown": "^0.0.4",
"typescript": "^4.9.5",
"whatwg-fetch": "^3.6.2"
},
Expand Down
26 changes: 17 additions & 9 deletions packages/ckbtc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,11 @@ Parameters:
- `params`: The Bitcoin address and network to parse
- `params.network`: Optional. Default BtcNetwork is Mainnet

### :factory: CkBTCMinterCanister

#### Constructors

`public`
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/utils/btc.utils.ts#L194)

Parameters:
### :factory: CkBTCMinterCanister

- `id`
- `service`
- `certifiedService`
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L33)

#### Methods

Expand All @@ -102,6 +96,8 @@ Parameters:
| -------- | ------------------------------------------------------------------------ |
| `create` | `(options: CkBTCMinterCanisterOptions<_SERVICE>) => CkBTCMinterCanister` |

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

##### :gear: getBtcAddress

Returns a BTC address for a given account.
Expand All @@ -118,6 +114,8 @@ 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)

##### :gear: updateBalance

Notify the minter about the bitcoin transfer.
Expand All @@ -134,6 +132,8 @@ 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)

##### :gear: getWithdrawalAccount

Returns the account to which the caller should deposit ckBTC before withdrawing BTC using the [retrieveBtc] endpoint.
Expand All @@ -142,6 +142,8 @@ Returns the account to which the caller should deposit ckBTC before withdrawing
| ---------------------- | ------------------------ |
| `getWithdrawalAccount` | `() => Promise<Account>` |

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

##### :gear: retrieveBtc

Submits a request to convert ckBTC to BTC.
Expand All @@ -164,6 +166,8 @@ 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)

##### :gear: estimateWithdrawalFee

Returns an estimation of the user's fee (in Satoshi) for a retrieve_btc request based on the current status of the Bitcoin network and the fee related to the minter.
Expand All @@ -178,6 +182,8 @@ 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)

##### :gear: getMinterInfo

Returns internal minter parameters such as the minimal amount to retrieve BTC, minimal number of confirmations or KYT fee.
Expand All @@ -191,6 +197,8 @@ 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)

<!-- TSDOC_END -->

## Resources
Expand Down
10 changes: 10 additions & 0 deletions packages/cmc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const rate = await getIcpToCyclesConversionRate();

### :factory: CMCCanister

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

#### Methods

- [create](#gear-create)
Expand All @@ -68,6 +70,8 @@ const rate = await getIcpToCyclesConversionRate();
| -------- | ---------------------------------------------- |
| `create` | `(options: CMCCanisterOptions) => CMCCanister` |

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

##### :gear: getIcpToCyclesConversionRate

Returns conversion rate of ICP to Cycles
Expand All @@ -76,6 +80,8 @@ Returns conversion rate of ICP to Cycles
| ------------------------------ | ----------------------- |
| `getIcpToCyclesConversionRate` | `() => Promise<bigint>` |

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

##### :gear: notifyCreateCanister

Notifies Cycles Minting Canister of the creation of a new canister.
Expand All @@ -85,6 +91,8 @@ It returns the new canister principal.
| ---------------------- | ---------------------------------------------------------- |
| `notifyCreateCanister` | `(request: NotifyCreateCanisterArg) => Promise<Principal>` |

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

##### :gear: notifyTopUp

Notifies Cycles Minting Canister of new cycles being added to canister.
Expand All @@ -94,4 +102,6 @@ It returns the new Cycles of the canister.
| ------------- | ---------------------------------------------- |
| `notifyTopUp` | `(request: NotifyTopUpArg) => Promise<bigint>` |

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

<!-- TSDOC_END -->
38 changes: 31 additions & 7 deletions packages/ic-management/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ic-management-js

A library for interfacing with [Internet Computer (IC) management canister](https://internetcomputer.org/docs/current/developer-docs/integrations/https-outcalls/https-outcalls-how-to-use/#ic-management-canister).
A library for interfacing with the [Internet Computer (IC) management canister](https://internetcomputer.org/docs/current/developer-docs/integrations/https-outcalls/https-outcalls-how-to-use/#ic-management-canister).

[![npm version](https://img.shields.io/npm/v/@dfinity/ic-management.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ic-management) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Expand Down Expand Up @@ -54,6 +54,8 @@ const { status, memory_size, ...rest } = await canisterStatus(YOUR_CANISTER_ID);

### :factory: ICManagementCanister

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

#### Methods

- [create](#gear-create)
Expand All @@ -74,6 +76,8 @@ const { status, memory_size, ...rest } = await canisterStatus(YOUR_CANISTER_ID);
| -------- | ---------------------------------------------------------------- |
| `create` | `(options: ICManagementCanisterOptions) => ICManagementCanister` |

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

##### :gear: createCanister

Create a new canister
Expand All @@ -82,6 +86,8 @@ Create a new canister
| ---------------- | ------------------------------------------------------------------------------------ |
| `createCanister` | `({ settings, senderCanisterVerion, }?: CreateCanisterParams) => Promise<Principal>` |

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

##### :gear: updateSettings

Update canister settings
Expand All @@ -90,6 +96,8 @@ Update canister settings
| ---------------- | ------------------------------------------------------------------------------------------ |
| `updateSettings` | `({ canisterId, senderCanisterVerion, settings, }: UpdateSettingsParams) => Promise<void>` |

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

##### :gear: installCode

Install code to a canister
Expand All @@ -98,6 +106,8 @@ Install code to a canister
| ------------- | ---------------------------------------------------------------------------------------------------- |
| `installCode` | `({ mode, canisterId, wasmModule, arg, senderCanisterVerion, }: InstallCodeParams) => Promise<void>` |

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

##### :gear: uninstallCode

Uninstall code from a canister
Expand All @@ -106,6 +116,8 @@ Uninstall code from a canister
| --------------- | ------------------------------------------------------------------------------- |
| `uninstallCode` | `({ canisterId, senderCanisterVerion, }: UninstallCodeParams) => Promise<void>` |

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

##### :gear: startCanister

Start a canister
Expand All @@ -114,6 +126,8 @@ Start a canister
| --------------- | ------------------------------------------ |
| `startCanister` | `(canisterId: Principal) => Promise<void>` |

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

##### :gear: stopCanister

Stop a canister
Expand All @@ -122,21 +136,27 @@ Stop a canister
| -------------- | ------------------------------------------ |
| `stopCanister` | `(canisterId: Principal) => Promise<void>` |

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

##### :gear: canisterStatus

Get canister details (memory size, status, etc.)

| Method | Type |
| ---------------- | --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `canisterStatus` | `(canisterId: Principal) => Promise<{ status: { stopped: null; } or { stopping: null; } | { running: null; }; memory_size: bigint; cycles: bigint; settings: definite_canister_settings; idle_cycles_burned_per_day: bigint; module_hash: [] | [...]; }>` |
| Method | Type |
| ---------------- | ---------------------------------------------------------------------------------- |
| `canisterStatus` | `(canisterId: Principal) => Promise<ServiceResponse<_SERVICE, "canister_status">>` |

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

##### :gear: canisterInfo

Get canister info (controllers, module hash, changes, etc.)

| Method | Type |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `canisterInfo` | `({ canisterId, numRequestChanges, }: CanisterInfoParams) => Promise<{ controllers: Principal[]; module_hash: [] or [Uint8Array]; recent_changes: change[]; total_num_changes: bigint; }>` |
| Method | Type |
| -------------- | ----------------------------------------------------------------------------------------------------------------- |
| `canisterInfo` | `({ canisterId, numRequestChanges, }: CanisterInfoParams) => Promise<ServiceResponse<_SERVICE, "canister_info">>` |

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

##### :gear: deleteCanister

Expand All @@ -146,6 +166,8 @@ Deletes a canister
| ---------------- | ------------------------------------------ |
| `deleteCanister` | `(canisterId: Principal) => Promise<void>` |

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

##### :gear: provisionalCreateCanisterWithCycles

Creates a canister. Only available on development instances.
Expand All @@ -154,6 +176,8 @@ Creates a canister. Only available on development instances.
| ------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `provisionalCreateCanisterWithCycles` | `({ settings, amount, canisterId, }?: ProvisionalCreateCanisterWithCyclesParams) => Promise<Principal>` |

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

<!-- TSDOC_END -->

## Resources
Expand Down
Loading

0 comments on commit 8a2816c

Please sign in to comment.