Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,555 changes: 415 additions & 1,140 deletions bun.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions docs/src/content/docs/guides/canister-declarations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ There are four files generated by DFX for a canister. To use a `counter` caniste
- `counter.did.d.ts` - Exports the canister's Candid as a TypeScript interface. This file is missing the `idlFactory` and `init` exports that are present in the `counter.did.js` file.

```ts
import type { Principal } from '@dfinity/principal';
import type { ActorMethod } from '@dfinity/agent';
import type { Principal } from '@icp-sdk/core/principal';
import type { ActorMethod } from '@icp-sdk/core/agent';

export interface Counter {
// redacted...
Expand All @@ -44,9 +44,9 @@ There are four files generated by DFX for a canister. To use a `counter` caniste
HttpAgentOptions,
ActorConfig,
Agent,
} from '@dfinity/agent';
import type { Principal } from '@dfinity/principal';
import type { IDL } from '@dfinity/candid';
} from '@icp-sdk/core/agent';
import type { Principal } from '@icp-sdk/core/principal';
import type { IDL } from '@icp-sdk/core/candid';

import { _SERVICE } from './counter.did';

Expand All @@ -68,7 +68,7 @@ There are four files generated by DFX for a canister. To use a `counter` caniste
- `index.js` - Exports TypeScript interfaces for actor creation utilities. This file re-exports the `idlFactory`, but not the `init` declarations from `clock.did.js` and also exports an auto-created canister actor which will throw exceptions outside of the browser due to `window.location` missing.

```js
import { Actor, HttpAgent } from '@dfinity/agent';
import { Actor, HttpAgent } from '@icp-sdk/core/agent';

import { idlFactory } from './counter.did.js';
export { idlFactory } from './counter.did.js';
Expand Down Expand Up @@ -99,7 +99,7 @@ Fixes for these issues are already merged into Candid, but they need to be relea
- `index.d.ts`

```ts
import { IDL } from '@dfinity/candid';
import { IDL } from '@icp-sdk/core/candid';
import { Actor } from '@dfinity/pic';
import { _SERVICE } from '../../declarations/counter.did';

Expand Down
4 changes: 2 additions & 2 deletions examples/clock/tests/src/clock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { resolve } from 'node:path';
import { Principal } from '@dfinity/principal';
import { Principal } from '@icp-sdk/core/principal';
import { Actor, generateRandomIdentity, PocketIc } from '@dfinity/pic';
import { Identity } from '@dfinity/agent';
import { Identity } from '@icp-sdk/core/agent';

import { _SERVICE, idlFactory } from '../../declarations/clock.did';

Expand Down
4 changes: 2 additions & 2 deletions examples/counter/tests/src/counter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { resolve } from 'node:path';
import { Principal } from '@dfinity/principal';
import { Principal } from '@icp-sdk/core/principal';
import { Actor, PocketIc } from '@dfinity/pic';
import { IDL } from '@dfinity/candid';
import { IDL } from '@icp-sdk/core/candid';
import { describe, beforeEach, afterEach, it, expect, inject } from 'vitest';

import { _SERVICE, idlFactory, init } from '../../declarations/counter.did.js';
Expand Down
2 changes: 1 addition & 1 deletion examples/google_search/tests/src/google-search.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { resolve } from 'node:path';
import { Principal } from '@dfinity/principal';
import { Principal } from '@icp-sdk/core/principal';
import { PocketIc, DeferredActor } from '@dfinity/pic';

import { _SERVICE, idlFactory } from '../../declarations/google_search.did';
Expand Down
2 changes: 1 addition & 1 deletion examples/icp_features/tests/src/icp-features.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { resolve } from 'path';
import { Actor, IcpFeaturesConfig, PocketIc } from '@dfinity/pic';
import { type _SERVICE, idlFactory } from '../../declarations/icp_features.did';
import { Principal } from '@dfinity/principal';
import { Principal } from '@icp-sdk/core/principal';

const WASM_PATH = resolve(
__dirname,
Expand Down
2 changes: 1 addition & 1 deletion examples/multicanister/tests/src/multicanister.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { resolve } from 'path';
import { Actor, PocketIc, SubnetStateType } from '@dfinity/pic';
import { IDL } from '@dfinity/candid';
import { IDL } from '@icp-sdk/core/candid';

import {
PhoneBookEntry,
Expand Down
6 changes: 3 additions & 3 deletions examples/nns_proxy/tests/src/canisters/governance.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Principal } from '@dfinity/principal';
import type { ActorMethod } from '@dfinity/agent';
import type { IDL } from '@dfinity/candid';
import type { Principal } from '@icp-sdk/core/principal';
import type { ActorMethod } from '@icp-sdk/core/agent';
import type { IDL } from '@icp-sdk/core/candid';

export interface AccountIdentifier {
hash: Uint8Array | number[];
Expand Down
6 changes: 3 additions & 3 deletions examples/nns_proxy/tests/src/canisters/ledger.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Principal } from '@dfinity/principal';
import type { ActorMethod } from '@dfinity/agent';
import type { IDL } from '@dfinity/candid';
import type { Principal } from '@icp-sdk/core/principal';
import type { ActorMethod } from '@icp-sdk/core/agent';
import type { IDL } from '@icp-sdk/core/candid';

export interface Account {
owner: Principal;
Expand Down
2 changes: 1 addition & 1 deletion examples/nns_proxy/tests/src/support/candid.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IDL } from '@dfinity/candid';
import { IDL } from '@icp-sdk/core/candid';

const UpdateElectedReplicaVersionsPayload = IDL.Record({
release_package_urls: IDL.Vec(IDL.Text),
Expand Down
4 changes: 2 additions & 2 deletions examples/nns_proxy/tests/src/support/governance.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Actor, PocketIc } from '@dfinity/pic';
import { AnonymousIdentity, Identity } from '@dfinity/agent';
import { Principal } from '@dfinity/principal';
import { AnonymousIdentity, Identity } from '@icp-sdk/core/agent';
import { Principal } from '@icp-sdk/core/principal';
import { createHash, randomBytes } from 'node:crypto';
import {
_SERVICE as GovernanceService,
Expand Down
2 changes: 1 addition & 1 deletion examples/nns_proxy/tests/src/support/identity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Ed25519KeyIdentity } from '@dfinity/identity';
import { Ed25519KeyIdentity } from '@icp-sdk/core/identity';

const base64ToUInt8Array = (base64String: string): Uint8Array => {
return Buffer.from(base64String, 'base64');
Expand Down
4 changes: 2 additions & 2 deletions examples/nns_proxy/tests/src/support/ledger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AnonymousIdentity, Identity } from '@dfinity/agent';
import { Principal } from '@dfinity/principal';
import { AnonymousIdentity, Identity } from '@icp-sdk/core/agent';
import { Principal } from '@icp-sdk/core/principal';
import { Actor, PocketIc } from '@dfinity/pic';
import {
_SERVICE as LedgerService,
Expand Down
4 changes: 2 additions & 2 deletions examples/todo/tests/src/todo.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { resolve } from 'node:path';
import { Principal } from '@dfinity/principal';
import { AnonymousIdentity } from '@dfinity/agent';
import { Principal } from '@icp-sdk/core/principal';
import { AnonymousIdentity } from '@icp-sdk/core/agent';
import { Actor, PocketIc, createIdentity } from '@dfinity/pic';
import { _SERVICE, idlFactory } from '../../declarations/todo.did';

Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"pnpm": "^10",
"npm": "please use pnpm"
},
"type": "module",
"packageManager": "pnpm@10.19.0+sha512.c9fc7236e92adf5c8af42fd5bf1612df99c2ceb62f27047032f4720b33f8eacdde311865e91c411f2774f618d82f320808ecb51718bfa82c060c4ba7c76a32b8",
"workspaces": [
"examples/clock/tests",
Expand Down Expand Up @@ -45,10 +46,12 @@
"postinstall": "tar -xvf examples/nns_proxy/tests/state/nns_state.tar.xz -C examples/nns_proxy/tests/state"
},
"devDependencies": {
"@dfinity/agent": "^3.2.4",
"@dfinity/candid": "^3.2.4",
"@dfinity/identity": "^3.2.4",
"@dfinity/principal": "^3.2.4",
"@dfinity/agent": "3.4.3",
"@dfinity/candid": "3.4.3",
"@dfinity/identity": "3.4.3",
"@dfinity/identity-secp256k1": "3.4.3",
"@dfinity/principal": "3.4.3",
"@icp-sdk/core": "^4.2.3",
"@swc/core": "^1.15.3",
"@swc/jest": "^0.2.39",
"@tsconfig/node24": "^24.0.3",
Expand Down
5 changes: 1 addition & 4 deletions packages/pic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
"postinstall": "node ./postinstall.mjs"
},
"dependencies": {
"@dfinity/agent": "^3.2.4",
"@dfinity/candid": "^3.2.4",
"@dfinity/identity": "^3.2.4",
"@dfinity/principal": "^3.2.4",
"@icp-sdk/core": "^4.2.3",
"bip39": "^3.1.0",
"json-with-bigint": "3.4.4"
}
Expand Down
8 changes: 4 additions & 4 deletions packages/pic/src/identity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { randomBytes, createHash } from 'node:crypto';
import { entropyToMnemonic } from 'bip39';
import { Identity } from '@dfinity/agent';
import { Ed25519KeyIdentity } from '@dfinity/identity';
import { Identity } from '@icp-sdk/core/agent';
import { Ed25519KeyIdentity } from '@icp-sdk/core/identity';

/**
* Create an Identity from a seed phrase.
Expand All @@ -23,7 +23,7 @@ import { Ed25519KeyIdentity } from '@dfinity/identity';
* @example
* ```ts
* import { PocketIc, PocketIcServer, createIdentity } from '@dfinity/pic';
* import { AnonymousIdentity } from '@dfinity/agent';
* import { AnonymousIdentity } from '@icp-sdk/core/agent';
* import { _SERVICE, idlFactory } from '../declarations';
*
* const wasmPath = resolve('..', '..', 'canister.wasm');
Expand Down Expand Up @@ -72,7 +72,7 @@ function generateMnemonic(): string {
* @example
* ```ts
* import { PocketIc, PocketIcServer, generateRandomIdentity } from '@dfinity/pic';
* import { AnonymousIdentity } from '@dfinity/agent';
* import { AnonymousIdentity } from '@icp-sdk/core/agent';
* import { _SERVICE, idlFactory } from '../declarations';
*
* const wasmPath = resolve('..', '..', 'canister.wasm');
Expand Down
4 changes: 2 additions & 2 deletions packages/pic/src/management-canister.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IDL } from '@dfinity/candid';
import { Principal } from '@dfinity/principal';
import { IDL } from '@icp-sdk/core/candid';
import { Principal } from '@icp-sdk/core/principal';
import { decodeCandid, isNil } from './util';

export const MANAGEMENT_CANISTER_ID = Principal.fromText('aaaaa-aa');
Expand Down
10 changes: 5 additions & 5 deletions packages/pic/src/pocket-ic-actor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IDL } from '@dfinity/candid';
import { Principal } from '@dfinity/principal';
import { Identity } from '@dfinity/agent';
import { IDL } from '@icp-sdk/core/candid';
import { Principal } from '@icp-sdk/core/principal';
import { Identity } from '@icp-sdk/core/agent';
import { PocketIcClient } from './pocket-ic-client';
import { decodeCandid } from './util';

Expand Down Expand Up @@ -45,7 +45,7 @@ export type Actor<T extends ActorInterface<T> = ActorInterface> = T & {
* @example
* ```ts
* import { PocketIc } from '@dfinity/pic';
* import { Principal } from '@dfinity/principal';
* import { Principal } from '@icp-sdk/core/principal';
* import { _SERVICE, idlFactory } from '../declarations';
*
* const wasmPath = resolve('..', '..', 'canister.wasm');
Expand All @@ -72,7 +72,7 @@ export type Actor<T extends ActorInterface<T> = ActorInterface> = T & {
* @example
* ```ts
* import { PocketIc } from '@dfinity/pic';
* import { AnonymousIdentity } from '@dfinity/agent';
* import { AnonymousIdentity } from '@icp-sdk/core/agent';
* import { _SERVICE, idlFactory } from '../declarations';
*
* const wasmPath = resolve('..', '..', 'canister.wasm');
Expand Down
2 changes: 1 addition & 1 deletion packages/pic/src/pocket-ic-client-types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Principal } from '@dfinity/principal';
import { Principal } from '@icp-sdk/core/principal';
import {
base64Decode,
base64DecodePrincipal,
Expand Down
2 changes: 1 addition & 1 deletion packages/pic/src/pocket-ic-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ import {
encodeGetControllersRequest,
} from './pocket-ic-client-types';
import { base64DecodePrincipal, isNotNil } from './util';
import { Principal } from '@dfinity/principal';
import { Principal } from '@icp-sdk/core/principal';

const PROCESSING_TIME_VALUE_MS = 30_000;
const AWAIT_INGRESS_STATUS_ROUNDS = 100;
Expand Down
10 changes: 5 additions & 5 deletions packages/pic/src/pocket-ic-deferred-actor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IDL } from '@dfinity/candid';
import { Principal } from '@dfinity/principal';
import { Identity } from '@dfinity/agent';
import { IDL } from '@icp-sdk/core/candid';
import { Principal } from '@icp-sdk/core/principal';
import { Identity } from '@icp-sdk/core/agent';
import { PocketIcClient } from './pocket-ic-client';
import { ActorInterface, ActorMethod } from './pocket-ic-actor';
import { decodeCandid } from './util';
Expand Down Expand Up @@ -35,7 +35,7 @@ export type DeferredActor<T extends ActorInterface<T> = ActorInterface> =
* @example
* ```ts
* import { PocketIc } from '@dfinity/pic';
* import { Principal } from '@dfinity/principal';
* import { Principal } from '@icp-sdk/core/principal';
* import { _SERVICE, idlFactory } from '../declarations';
*
* const wasmPath = resolve('..', '..', 'canister.wasm');
Expand All @@ -62,7 +62,7 @@ export type DeferredActor<T extends ActorInterface<T> = ActorInterface> =
* @example
* ```ts
* import { PocketIc } from '@dfinity/pic';
* import { AnonymousIdentity } from '@dfinity/agent';
* import { AnonymousIdentity } from '@icp-sdk/core/agent';
* import { _SERVICE, idlFactory } from '../declarations';
*
* const wasmPath = resolve('..', '..', 'canister.wasm');
Expand Down
4 changes: 2 additions & 2 deletions packages/pic/src/pocket-ic-types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Principal } from '@dfinity/principal';
import { Principal } from '@icp-sdk/core/principal';
import { ActorInterface, Actor } from './pocket-ic-actor';
import { IDL } from '@dfinity/candid';
import { IDL } from '@icp-sdk/core/candid';
import { CanisterInstallModeUpgradeOptions } from './management-canister';

// Needed for the docs
Expand Down
Loading