Skip to content

Commit 15e16ed

Browse files
authored
docs: v5 upgrading guide touches (#1265)
# Description Minor updates to the v5 upgrading guide, mainly adding more links to the API.
1 parent 2a22106 commit 15e16ed

File tree

2 files changed

+47
-13
lines changed

2 files changed

+47
-13
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## [Unreleased]
44

5+
See the [v5 upgrading guide](https://js.icp.build/core/v5/upgrading/v5/) for more information.
6+
57
- feat(core)!: removes `@dfinity/{agent,candid,identity,identity-secp256k1,principal}` peer dependencies and moves their source code to the `@icp-sdk/core` package
68
- feat(agent)!: use `/api/v4` for call requests
79
- Renames `v3ResponseBody` to `v4ResponseBody`

docs/src/content/docs/upgrading/v5.md

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ This release completes the migration of all `@dfinity/*` packages into `@icp-sdk
1414
## TL;DR
1515

1616
- **New API versions**: Agent now uses the latest IC API endpoints: `/api/v4` for calls and `/api/v3` for queries/read_state.
17-
- **Local replica upgrade required**: Use dfx >=v0.30.1 or PocketIC >=v11.0.0.
17+
- **Local replica upgrade required**: Use dfx >=[v0.30.1](https://github.com/dfinity/sdk/releases/tag/0.30.1) or PocketIC >=[v11.0.0](https://github.com/dfinity/pocketic/releases/tag/11.0.0).
1818
- **Peer dependencies removed**: `@dfinity/*` packages are no longer peer dependencies. Remove them before upgrading.
1919

2020
## Before You Begin
2121

22-
Before upgrading to v5, you **must** remove the `@dfinity/*` peer dependencies from your project. These packages are now fully integrated into `@icp-sdk/core` and are no longer required as separate dependencies.
22+
Before upgrading to v5, you **must** remove the `@dfinity/{agent,candid,identity,identity-secp256k1,principal}` (peer) dependencies from your project. These packages are now fully integrated into `@icp-sdk/core` and are no longer required as separate dependencies.
2323

2424
```shell
2525
npm remove @dfinity/{agent,candid,identity,identity-secp256k1,principal}
@@ -31,14 +31,32 @@ Then, upgrade `@icp-sdk/core` to the latest version:
3131
npm install @icp-sdk/core@latest
3232
```
3333

34+
> **NOTE**: If your project is using any package from the old `ic-js` suite (see [Legacy single-entry packages](https://github.com/dfinity/icp-js-canisters/blob/5fc7e162f0622dd335bb163f2dc3ab2c5325d16c/README.md#-legacy-single-entry-packages)), you should migrate to the new [`@icp-sdk/canisters`](https://js.icp.build/canisters/) package, which also doesn't depend on the `@dfinity/{agent,candid,identity,identity-secp256k1,principal}` packages.
35+
3436
## Breaking Changes
3537

3638
### Source Code Moved to `@icp-sdk/core`
3739

3840
In v4, `@icp-sdk/core` re-exported the `@dfinity/*` packages as peer dependencies. In v5, the source code of all core packages has been moved directly into `@icp-sdk/core`. This means:
3941

4042
- You no longer need to install `@dfinity/agent`, `@dfinity/candid`, `@dfinity/identity`, `@dfinity/identity-secp256k1`, or `@dfinity/principal` as separate packages.
41-
- All imports should use `@icp-sdk/core/*` submodules, as described in the [v4 upgrading guide](https://js.icp.build/core/latest/upgrading/v4/).
43+
- All imports should use `@icp-sdk/core/*` submodules:
44+
| Old Import | New Import |
45+
| ----------------------------- | ---------------------------------- |
46+
| `@dfinity/agent` | `@icp-sdk/core/agent` |
47+
| `@dfinity/candid` | `@icp-sdk/core/candid` |
48+
| `@dfinity/identity` | `@icp-sdk/core/identity` |
49+
| `@dfinity/identity-secp256k1` | `@icp-sdk/core/identity/secp256k1` |
50+
| `@dfinity/principal` | `@icp-sdk/core/principal` |
51+
52+
E.g.
53+
54+
```ts
55+
- import { HttpAgent } from '@dfinity/agent';
56+
+ import { HttpAgent } from '@icp-sdk/core/agent';
57+
```
58+
59+
See more details in the [v4 upgrading guide](../upgrading/v4.md).
4260

4361
### API Version Upgrades
4462

@@ -49,15 +67,17 @@ The agent now uses the latest IC API endpoints:
4967

5068
If you were using internal types related to these API versions, you'll need to update them:
5169

52-
| Old Name | New Name |
53-
| ------------------------------- | ------------------------------- |
54-
| `v3ResponseBody` | `v4ResponseBody` |
55-
| `isV3ResponseBody` | `isV4ResponseBody` |
56-
| `HttpV3ApiNotSupportedErrorCode`| `HttpV4ApiNotSupportedErrorCode`|
70+
| Old Name | New Name |
71+
| ------------------------------- | ----------------------------------------------------------------------------------------------- |
72+
| `v3ResponseBody` | [`v4ResponseBody`](../libs/agent/api/interfaces/v4ResponseBody.md) |
73+
| `isV3ResponseBody` | [`isV4ResponseBody`](../libs/agent/api/functions/isV4ResponseBody.md) |
74+
| `HttpV3ApiNotSupportedErrorCode`| [`HttpV4ApiNotSupportedErrorCode`](../libs/agent/api/classes/HttpV4ApiNotSupportedErrorCode.md) |
75+
76+
> If you're developing locally with **dfx**, make sure you upgrade to [v0.30.1](https://github.com/dfinity/sdk/releases/tag/0.30.1) or later.
5777
58-
> If you're developing locally, make sure you upgrade to [dfx v0.30.1](https://github.com/dfinity/sdk/releases/tag/0.30.1) or later.
78+
> If you're using **PocketIC** for testing, upgrade to [v11.0.0](https://github.com/dfinity/pocketic/releases/tag/11.0.0) or later.
5979
60-
> If you're using PocketIC for testing, upgrade to [v11](https://github.com/dfinity/pocketic/releases/tag/11.0.0) or later.
80+
> If you're using [`@dfinity/pic-js`](https://js.icp.build/pic-js/) for testing, upgrade to [v0.17.0](https://github.com/dfinity/pic-js/releases/tag/0.17.0) or later.
6181
6282
### Certificate Verification: `canisterId` Replaced with `principal`
6383

@@ -101,6 +121,8 @@ const certificate = await Certificate.create({
101121
});
102122
```
103123

124+
See more details in the [`CreateCertificateOptions`](../libs/agent/api/interfaces/CreateCertificateOptions.md) API docs.
125+
104126
## New Features
105127

106128
### Subnet State Methods
@@ -122,6 +144,12 @@ const subnetState = await agent.readSubnetState(subnetId, paths);
122144
await agent.syncTimeWithSubnet(subnetId);
123145
```
124146

147+
API docs:
148+
149+
- [`HttpAgent.getSubnetIdFromCanister`](../libs/agent/api/classes/HttpAgent.md#getsubnetidfromcanister)
150+
- [`HttpAgent.readSubnetState`](../libs/agent/api/classes/HttpAgent.md#readsubnetstate)
151+
- [`HttpAgent.syncTimeWithSubnet`](../libs/agent/api/classes/HttpAgent.md#synctimewithsubnet)
152+
125153
### Canister Ranges Lookup
126154

127155
New utility functions for looking up canister ranges from certificate trees:
@@ -148,9 +176,13 @@ const ranges = decodeCanisterRanges(canisterRanges);
148176
console.log(ranges);
149177
```
150178

179+
API docs:
180+
- [`lookupCanisterRanges`](../libs/agent/api/functions/lookupCanisterRanges.md)
181+
- [`decodeCanisterRanges`](../libs/agent/api/functions/decodeCanisterRanges.md)
182+
151183
### Subnet Status Utility
152184

153-
A new `SubnetStatus` namespace has been introduced to request subnet information directly from the IC public API:
185+
A new [`SubnetStatus`](../libs/agent/api/namespaces/SubnetStatus/index.md) namespace has been introduced to request subnet information directly from the IC public API:
154186

155187
```typescript
156188
import { SubnetStatus } from '@icp-sdk/core/agent';
@@ -172,8 +204,8 @@ console.log(nodeKeys);
172204

173205
### Certificate Utilities
174206

175-
- `getSubnetIdFromCertificate`: Read the subnet ID from a certificate tree
176-
- `IC_STATE_ROOT_DOMAIN_SEPARATOR`: Exported constant for certificate verification
207+
- `getSubnetIdFromCertificate`: Read the subnet ID from a certificate tree ([API docs](../libs/agent/api/functions/getSubnetIdFromCertificate.md))
208+
- `IC_STATE_ROOT_DOMAIN_SEPARATOR`: Exported constant for certificate verification ([API docs](../libs/agent/api/variables/IC_STATE_ROOT_DOMAIN_SEPARATOR.md))
177209

178210
## `@dfinity/auth-client` has been deprecated
179211

0 commit comments

Comments
 (0)