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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Breaking changes:
+ Changed imports generated by `candid_parser::bindings::typescript::compile` from `@dfinity/*` to `@icp-sdk/core/*`

## 2025-12-18

### candid_parser 0.2.4 & didc 0.5.4
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/src/bindings/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,9 @@ fn pp_actor<'a>(env: &'a TypeEnv, ty: &'a Type, syntax: Option<&'a IDLType>) ->
}

pub fn compile(env: &TypeEnv, actor: &Option<Type>, prog: &IDLMergedProg) -> String {
let header = r#"import type { Principal } from '@dfinity/principal';
import type { ActorMethod } from '@dfinity/agent';
import type { IDL } from '@dfinity/candid';
let header = r#"import type { Principal } from '@icp-sdk/core/principal';
import type { ActorMethod } from '@icp-sdk/core/agent';
import type { IDL } from '@icp-sdk/core/candid';
"#;
let syntax_actor = prog.resolve_actor().ok().flatten();
let def_list: Vec<_> = env.0.iter().map(|pair| pair.0.as_ref()).collect();
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/actor.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 type f = ActorMethod<[number], number>;
export type g = f;
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/class.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 type List = [] | [[bigint, List]];
export interface Profile { 'age' : number, 'name' : string }
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/comment.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';

/**
* line comment
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/cyclic.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 type A = [] | [B];
export type B = [] | [C];
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/empty.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 type T = [T];
export interface _SERVICE {
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/escape.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 t {
'\"' : bigint,
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/example.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 type A = B;
export type B = [] | [A];
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/fieldnat.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 non_tuple { _1_ : string, _2_ : string }
export type tuple = [string, string];
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/inline_methods.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 type Fn = ActorMethod<[bigint], bigint>;
export type Gn = Fn;
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/keyword.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 type if_ = {
'branch' : { 'val' : bigint, 'left' : if_, 'right' : if_ }
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/malicious_doc.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';

/**
* *\/ import { malicious } from 'attacker'; console.log('injected!'); /*
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/management.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 type bitcoin_address = string;
export type bitcoin_network = { 'mainnet' : null } |
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/recursion.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 type A = B;
export type B = [] | [A];
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/recursive_class.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 s { 'next' : ActorMethod<[], Principal> }
export interface _SERVICE extends s {}
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/service.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 type Func = ActorMethod<[], Principal>;
export interface Service { 'f' : Func }
Expand Down
6 changes: 3 additions & 3 deletions rust/candid_parser/tests/assets/ok/unicode.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 A {
'\u{e000}' : bigint,
Expand Down