Skip to content

Commit

Permalink
Update Candid Files (#718)
Browse files Browse the repository at this point in the history
# Motivation
The canisters APIs have been updated.

# Changes
* Updated the candid interface files for the canisters used in this
library.
* Updated the javascript bindings for the latest candid interfaces.

# Tests
- [ ] Please check the API updates for any breaking changes that affect
our code.

---------

Signed-off-by: David Dal Busco <[email protected]>
Co-authored-by: gix-bot <[email protected]>
Co-authored-by: David Dal Busco <[email protected]>
  • Loading branch information
3 people authored Sep 16, 2024
1 parent 1b6baa3 commit 19c0b5e
Show file tree
Hide file tree
Showing 24 changed files with 151 additions and 37 deletions.
2 changes: 1 addition & 1 deletion packages/ckbtc/candid/minter.did
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from IC repo commit 843e71b (2024-08-14 tags: release-2024-09-06_01-30-canister-snapshots) 'rs/bitcoin/ckbtc/minter/ckbtc_minter.did' by import-candid
// Generated from IC repo commit afe1a18 (2024-09-11 tags: release-2024-09-12_01-30-base) 'rs/bitcoin/ckbtc/minter/ckbtc_minter.did' by import-candid
// Represents an account on the ckBTC ledger.
type Account = record { owner : principal; subaccount : opt blob };

Expand Down
2 changes: 1 addition & 1 deletion packages/cketh/candid/minter.did
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from IC repo commit 843e71b (2024-08-14 tags: release-2024-09-06_01-30-canister-snapshots) 'rs/ethereum/cketh/minter/cketh_minter.did' by import-candid
// Generated from IC repo commit afe1a18 (2024-09-11 tags: release-2024-09-12_01-30-base) 'rs/ethereum/cketh/minter/cketh_minter.did' by import-candid
type EthereumNetwork = variant {
// The public Ethereum mainnet.
Mainnet;
Expand Down
29 changes: 29 additions & 0 deletions packages/cketh/candid/orchestrator.certified.idl.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/cketh/candid/orchestrator.did */
export const idlFactory = ({ IDL }) => {
const InstalledCanister = IDL.Record({
'canister_id' : IDL.Principal,
'installed_wasm_hash' : IDL.Text,
});
const InstalledLedgerSuite = IDL.Record({
'token_symbol' : IDL.Text,
'ledger' : InstalledCanister,
'index' : InstalledCanister,
'archives' : IDL.Opt(IDL.Vec(IDL.Principal)),
});
const UpdateCyclesManagement = IDL.Record({
'cycles_top_up_increment' : IDL.Opt(IDL.Nat),
'cycles_for_ledger_creation' : IDL.Opt(IDL.Nat),
'cycles_for_archive_creation' : IDL.Opt(IDL.Nat),
'cycles_for_index_creation' : IDL.Opt(IDL.Nat),
});
const UpgradeArg = IDL.Record({
'manage_ledger_suites' : IDL.Opt(IDL.Vec(InstalledLedgerSuite)),
'cycles_management' : IDL.Opt(UpdateCyclesManagement),
'archive_compressed_wasm_hash' : IDL.Opt(IDL.Text),
'git_commit_hash' : IDL.Opt(IDL.Text),
Expand Down Expand Up @@ -91,6 +102,12 @@ export const idlFactory = ({ IDL }) => {
'archives' : IDL.Vec(IDL.Principal),
'ckerc20_token_symbol' : IDL.Text,
});
const ManagedLedgerSuite = IDL.Record({
'token_symbol' : IDL.Text,
'ledger' : IDL.Opt(ManagedCanisterStatus),
'index' : IDL.Opt(ManagedCanisterStatus),
'archives' : IDL.Vec(IDL.Principal),
});
const LedgerSuiteVersion = IDL.Record({
'archive_compressed_wasm_hash' : IDL.Text,
'ledger_compressed_wasm_hash' : IDL.Text,
Expand All @@ -99,6 +116,7 @@ export const idlFactory = ({ IDL }) => {
const OrchestratorInfo = IDL.Record({
'cycles_management' : CyclesManagement,
'managed_canisters' : IDL.Vec(ManagedCanisters),
'managed_pre_existing_ledger_suites' : IDL.Opt(IDL.Vec(ManagedLedgerSuite)),
'more_controller_ids' : IDL.Vec(IDL.Principal),
'ledger_suite_version' : IDL.Opt(LedgerSuiteVersion),
'minter_id' : IDL.Opt(IDL.Principal),
Expand All @@ -114,13 +132,24 @@ export const idlFactory = ({ IDL }) => {
});
};
export const init = ({ IDL }) => {
const InstalledCanister = IDL.Record({
'canister_id' : IDL.Principal,
'installed_wasm_hash' : IDL.Text,
});
const InstalledLedgerSuite = IDL.Record({
'token_symbol' : IDL.Text,
'ledger' : InstalledCanister,
'index' : InstalledCanister,
'archives' : IDL.Opt(IDL.Vec(IDL.Principal)),
});
const UpdateCyclesManagement = IDL.Record({
'cycles_top_up_increment' : IDL.Opt(IDL.Nat),
'cycles_for_ledger_creation' : IDL.Opt(IDL.Nat),
'cycles_for_archive_creation' : IDL.Opt(IDL.Nat),
'cycles_for_index_creation' : IDL.Opt(IDL.Nat),
});
const UpgradeArg = IDL.Record({
'manage_ledger_suites' : IDL.Opt(IDL.Vec(InstalledLedgerSuite)),
'cycles_management' : IDL.Opt(UpdateCyclesManagement),
'archive_compressed_wasm_hash' : IDL.Opt(IDL.Text),
'git_commit_hash' : IDL.Opt(IDL.Text),
Expand Down
18 changes: 18 additions & 0 deletions packages/cketh/candid/orchestrator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ export interface InitArg {
more_controller_ids: Array<Principal>;
minter_id: [] | [Principal];
}
export interface InstalledCanister {
canister_id: Principal;
installed_wasm_hash: string;
}
export interface InstalledLedgerSuite {
token_symbol: string;
ledger: InstalledCanister;
index: InstalledCanister;
archives: [] | [Array<Principal>];
}
export interface LedgerInitArg {
decimals: number;
token_symbol: string;
Expand Down Expand Up @@ -73,13 +83,20 @@ export interface ManagedCanisters {
archives: Array<Principal>;
ckerc20_token_symbol: string;
}
export interface ManagedLedgerSuite {
token_symbol: string;
ledger: [] | [ManagedCanisterStatus];
index: [] | [ManagedCanisterStatus];
archives: Array<Principal>;
}
export type OrchestratorArg =
| { UpgradeArg: UpgradeArg }
| { InitArg: InitArg }
| { AddErc20Arg: AddErc20Arg };
export interface OrchestratorInfo {
cycles_management: CyclesManagement;
managed_canisters: Array<ManagedCanisters>;
managed_pre_existing_ledger_suites: [] | [Array<ManagedLedgerSuite>];
more_controller_ids: Array<Principal>;
ledger_suite_version: [] | [LedgerSuiteVersion];
minter_id: [] | [Principal];
Expand All @@ -97,6 +114,7 @@ export interface UpdateCyclesManagement {
cycles_for_index_creation: [] | [bigint];
}
export interface UpgradeArg {
manage_ledger_suites: [] | [Array<InstalledLedgerSuite>];
cycles_management: [] | [UpdateCyclesManagement];
archive_compressed_wasm_hash: [] | [string];
git_commit_hash: [] | [string];
Expand Down
45 changes: 44 additions & 1 deletion packages/cketh/candid/orchestrator.did
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from IC repo commit 843e71b (2024-08-14 tags: release-2024-09-06_01-30-canister-snapshots) 'rs/ethereum/ledger-suite-orchestrator/ledger_suite_orchestrator.did' by import-candid
// Generated from IC repo commit afe1a18 (2024-09-11 tags: release-2024-09-12_01-30-base) 'rs/ethereum/ledger-suite-orchestrator/ledger_suite_orchestrator.did' by import-candid
type OrchestratorArg = variant {
UpgradeArg : UpgradeArg;
InitArg : InitArg;
Expand Down Expand Up @@ -45,6 +45,11 @@ type UpgradeArg = record {

// Update the cycles management of the canisters managed by the orchestrator.
cycles_management: opt UpdateCyclesManagement;

// Add already installed ledger suites to the canisters managed by the orchestrator.
// Those ledger suites are *NOT* necessarily ckERC20 tokens.
// This assumes that the orchestrator is a controller of all the canisters in the list.
manage_ledger_suites: opt vec InstalledLedgerSuite;
};

type AddErc20Arg = record {
Expand Down Expand Up @@ -97,6 +102,26 @@ type ManagedCanisterStatus = variant {
Installed : record { canister_id : principal; installed_wasm_hash : text };
};

type InstalledCanister = record {
canister_id : principal;
installed_wasm_hash : text
};

type InstalledLedgerSuite = record {
// Token symbol on the ledger
token_symbol : text;

// Ledger canister
ledger : InstalledCanister;

// Index canister
index : InstalledCanister;

// List of archive canister ids
archives : opt vec principal;
};


type ManagedCanisters = record {
// Corresponding ERC20 contract
erc20_contract: Erc20Contract;
Expand All @@ -114,6 +139,20 @@ type ManagedCanisters = record {
archives : vec principal;
};

type ManagedLedgerSuite = record {
// Token symbol
token_symbol : text;

// Status of the ledger canister
ledger : opt ManagedCanisterStatus;

// Status of the index canister
index : opt ManagedCanisterStatus;

// List of archive canister ids
archives : vec principal;
};

type OrchestratorInfo = record {
// List of managed canisters data for each ERC20 contract.
managed_canisters : vec ManagedCanisters;
Expand All @@ -129,6 +168,10 @@ type OrchestratorInfo = record {

// Ledger suite version that will be used to spawn off a new ledger suite (ledger and index canisters) when an ERC-20 token is added.
ledger_suite_version: opt LedgerSuiteVersion;

// List of managed ledger suites that were not initially installed by the orchestrator.
// Those ledger suites are *NOT* necessarily ckERC20 tokens.
managed_pre_existing_ledger_suites: opt vec ManagedLedgerSuite;
};

type LedgerSuiteVersion = record {
Expand Down
29 changes: 29 additions & 0 deletions packages/cketh/candid/orchestrator.idl.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/cketh/candid/orchestrator.did */
export const idlFactory = ({ IDL }) => {
const InstalledCanister = IDL.Record({
'canister_id' : IDL.Principal,
'installed_wasm_hash' : IDL.Text,
});
const InstalledLedgerSuite = IDL.Record({
'token_symbol' : IDL.Text,
'ledger' : InstalledCanister,
'index' : InstalledCanister,
'archives' : IDL.Opt(IDL.Vec(IDL.Principal)),
});
const UpdateCyclesManagement = IDL.Record({
'cycles_top_up_increment' : IDL.Opt(IDL.Nat),
'cycles_for_ledger_creation' : IDL.Opt(IDL.Nat),
'cycles_for_archive_creation' : IDL.Opt(IDL.Nat),
'cycles_for_index_creation' : IDL.Opt(IDL.Nat),
});
const UpgradeArg = IDL.Record({
'manage_ledger_suites' : IDL.Opt(IDL.Vec(InstalledLedgerSuite)),
'cycles_management' : IDL.Opt(UpdateCyclesManagement),
'archive_compressed_wasm_hash' : IDL.Opt(IDL.Text),
'git_commit_hash' : IDL.Opt(IDL.Text),
Expand Down Expand Up @@ -91,6 +102,12 @@ export const idlFactory = ({ IDL }) => {
'archives' : IDL.Vec(IDL.Principal),
'ckerc20_token_symbol' : IDL.Text,
});
const ManagedLedgerSuite = IDL.Record({
'token_symbol' : IDL.Text,
'ledger' : IDL.Opt(ManagedCanisterStatus),
'index' : IDL.Opt(ManagedCanisterStatus),
'archives' : IDL.Vec(IDL.Principal),
});
const LedgerSuiteVersion = IDL.Record({
'archive_compressed_wasm_hash' : IDL.Text,
'ledger_compressed_wasm_hash' : IDL.Text,
Expand All @@ -99,6 +116,7 @@ export const idlFactory = ({ IDL }) => {
const OrchestratorInfo = IDL.Record({
'cycles_management' : CyclesManagement,
'managed_canisters' : IDL.Vec(ManagedCanisters),
'managed_pre_existing_ledger_suites' : IDL.Opt(IDL.Vec(ManagedLedgerSuite)),
'more_controller_ids' : IDL.Vec(IDL.Principal),
'ledger_suite_version' : IDL.Opt(LedgerSuiteVersion),
'minter_id' : IDL.Opt(IDL.Principal),
Expand All @@ -114,13 +132,24 @@ export const idlFactory = ({ IDL }) => {
});
};
export const init = ({ IDL }) => {
const InstalledCanister = IDL.Record({
'canister_id' : IDL.Principal,
'installed_wasm_hash' : IDL.Text,
});
const InstalledLedgerSuite = IDL.Record({
'token_symbol' : IDL.Text,
'ledger' : InstalledCanister,
'index' : InstalledCanister,
'archives' : IDL.Opt(IDL.Vec(IDL.Principal)),
});
const UpdateCyclesManagement = IDL.Record({
'cycles_top_up_increment' : IDL.Opt(IDL.Nat),
'cycles_for_ledger_creation' : IDL.Opt(IDL.Nat),
'cycles_for_archive_creation' : IDL.Opt(IDL.Nat),
'cycles_for_index_creation' : IDL.Opt(IDL.Nat),
});
const UpgradeArg = IDL.Record({
'manage_ledger_suites' : IDL.Opt(IDL.Vec(InstalledLedgerSuite)),
'cycles_management' : IDL.Opt(UpdateCyclesManagement),
'archive_compressed_wasm_hash' : IDL.Opt(IDL.Text),
'git_commit_hash' : IDL.Opt(IDL.Text),
Expand Down
12 changes: 12 additions & 0 deletions packages/cketh/src/orchestrator.canister.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ describe("ckETH orchestrator canister", () => {
},
};

const mockCanisterId = Principal.from("yfumr-cyaaa-aaaar-qaela-cai");

const orchestratorInfoMock: OrchestratorInfo = {
minter_id: [minterCanisterIdMock],
more_controller_ids: [],
Expand All @@ -65,6 +67,16 @@ describe("ckETH orchestrator canister", () => {
index_compressed_wasm_hash: "efgdh",
},
],
managed_pre_existing_ledger_suites: [
[
{
token_symbol: "def",
ledger: [{ Created: { canister_id: mockCanisterId } }],
index: [{ Created: { canister_id: mockCanisterId } }],
archives: [mockCanisterId],
},
],
],
};

const service = mock<ActorSubclass<CkETHOrchestratorService>>();
Expand Down
4 changes: 0 additions & 4 deletions packages/cmc/candid/cmc.certified.idl.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ export const idlFactory = ({ IDL }) => {
'create_error' : IDL.Text,
'refund_amount' : IDL.Nat,
}),
'RefundFailed' : IDL.Record({
'create_error' : IDL.Text,
'refund_error' : IDL.Text,
}),
});
const CreateCanisterResult = IDL.Variant({
'Ok' : IDL.Principal,
Expand Down
8 changes: 3 additions & 5 deletions packages/cmc/candid/cmc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ export interface CreateCanisterArg {
settings: [] | [CanisterSettings];
subnet_type: [] | [string];
}
export type CreateCanisterError =
| {
Refunded: { create_error: string; refund_amount: bigint };
}
| { RefundFailed: { create_error: string; refund_error: string } };
export type CreateCanisterError = {
Refunded: { create_error: string; refund_amount: bigint };
};
export type CreateCanisterResult =
| { Ok: Principal }
| { Err: CreateCanisterError };
Expand Down
9 changes: 1 addition & 8 deletions packages/cmc/candid/cmc.did
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from IC repo commit 843e71b (2024-08-14 tags: release-2024-09-06_01-30-canister-snapshots) 'rs/nns/cmc/cmc.did' by import-candid
// Generated from IC repo commit afe1a18 (2024-09-11 tags: release-2024-09-12_01-30-base) 'rs/nns/cmc/cmc.did' by import-candid
type Cycles = nat;
type BlockIndex = nat64;
type log_visibility = variant {
Expand Down Expand Up @@ -87,13 +87,6 @@ type CreateCanisterError = variant {
// The reason why creating a canister failed.
create_error : text;
};
RefundFailed : record {
// The reason why creating a canister failed.
create_error : text;

// The reason why refunding cycles failed.
refund_error : text;
};
};

type NotifyError = variant {
Expand Down
4 changes: 0 additions & 4 deletions packages/cmc/candid/cmc.idl.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ export const idlFactory = ({ IDL }) => {
'create_error' : IDL.Text,
'refund_amount' : IDL.Nat,
}),
'RefundFailed' : IDL.Record({
'create_error' : IDL.Text,
'refund_error' : IDL.Text,
}),
});
const CreateCanisterResult = IDL.Variant({
'Ok' : IDL.Principal,
Expand Down
2 changes: 1 addition & 1 deletion packages/ledger-icp/candid/index.did
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from IC repo commit 843e71b (2024-08-14 tags: release-2024-09-06_01-30-canister-snapshots) 'rs/rosetta-api/icp_ledger/index/index.did' by import-candid
// Generated from IC repo commit afe1a18 (2024-09-11 tags: release-2024-09-12_01-30-base) 'rs/rosetta-api/icp_ledger/index/index.did' by import-candid
type Account = record { owner : principal; subaccount : opt vec nat8 };
type GetAccountIdentifierTransactionsArgs = record {
max_results : nat64;
Expand Down
2 changes: 1 addition & 1 deletion packages/ledger-icp/candid/ledger.did
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from IC repo commit 843e71b (2024-08-14 tags: release-2024-09-06_01-30-canister-snapshots) 'rs/rosetta-api/icp_ledger/ledger.did' by import-candid
// Generated from IC repo commit afe1a18 (2024-09-11 tags: release-2024-09-12_01-30-base) 'rs/rosetta-api/icp_ledger/ledger.did' by import-candid
// This is the official Ledger interface that is guaranteed to be backward compatible.

// Amount of tokens, measured in 10^-8 of a token.
Expand Down
2 changes: 1 addition & 1 deletion packages/ledger-icrc/candid/icrc_index-ng.did
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from IC repo commit 843e71b (2024-08-14 tags: release-2024-09-06_01-30-canister-snapshots) 'rs/rosetta-api/icrc1/index-ng/index-ng.did' by import-candid
// Generated from IC repo commit afe1a18 (2024-09-11 tags: release-2024-09-12_01-30-base) 'rs/rosetta-api/icrc1/index-ng/index-ng.did' by import-candid
type Tokens = nat;

type InitArg = record {
Expand Down
2 changes: 1 addition & 1 deletion packages/ledger-icrc/candid/icrc_index.did
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from IC repo commit 843e71b (2024-08-14 tags: release-2024-09-06_01-30-canister-snapshots) 'rs/rosetta-api/icrc1/index/index.did' by import-candid
// Generated from IC repo commit afe1a18 (2024-09-11 tags: release-2024-09-12_01-30-base) 'rs/rosetta-api/icrc1/index/index.did' by import-candid
type TxId = nat;

type Account = record { owner : principal; subaccount : opt blob };
Expand Down
2 changes: 1 addition & 1 deletion packages/ledger-icrc/candid/icrc_ledger.did
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from IC repo commit 843e71b (2024-08-14 tags: release-2024-09-06_01-30-canister-snapshots) 'rs/rosetta-api/icrc1/ledger/ledger.did' by import-candid
// Generated from IC repo commit afe1a18 (2024-09-11 tags: release-2024-09-12_01-30-base) 'rs/rosetta-api/icrc1/ledger/ledger.did' by import-candid
type BlockIndex = nat;
type Subaccount = blob;
// Number of nanoseconds since the UNIX epoch in UTC timezone.
Expand Down
2 changes: 1 addition & 1 deletion packages/nns/candid/genesis_token.did
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from IC repo commit 843e71b (2024-08-14 tags: release-2024-09-06_01-30-canister-snapshots) 'rs/nns/gtc/canister/gtc.did' by import-candid
// Generated from IC repo commit afe1a18 (2024-09-11 tags: release-2024-09-12_01-30-base) 'rs/nns/gtc/canister/gtc.did' by import-candid
type AccountState = record {
authenticated_principal_id : opt principal;
successfully_transferred_neurons : vec TransferredNeuron;
Expand Down
2 changes: 1 addition & 1 deletion packages/nns/candid/governance.did
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from IC repo commit 843e71b (2024-08-14 tags: release-2024-09-06_01-30-canister-snapshots) 'rs/nns/governance/canister/governance.did' by import-candid
// Generated from IC repo commit afe1a18 (2024-09-11 tags: release-2024-09-12_01-30-base) 'rs/nns/governance/canister/governance.did' by import-candid
type AccountIdentifier = record {
hash : blob;
};
Expand Down
Loading

0 comments on commit 19c0b5e

Please sign in to comment.