Skip to content

Commit

Permalink
feat: cmc & governance (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker authored May 14, 2024
1 parent b7ba96d commit 087a20b
Show file tree
Hide file tree
Showing 17 changed files with 3,774 additions and 18 deletions.
109 changes: 94 additions & 15 deletions cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@
"@babel/preset-typescript": "^7.24.1",
"@dfinity/agent": "^1.3.0",
"@dfinity/candid": "^1.3.0",
"@dfinity/ic-management": "^3.2.0",
"@dfinity/ic-management": "^4.0.0",
"@dfinity/identity": "^1.3.0",
"@dfinity/nns": "^5.1.0",
"@dfinity/nns-proto": "^2.0.0",
"@dfinity/principal": "^1.3.0",
"@dfinity/utils": "^2.2.0",
"@dfinity/sns": "^3.0.4",
"@dfinity/utils": "^2.3.0",
"@junobuild/admin": "^0.0.48",
"@junobuild/cli-tools": "^0.0.9",
"@junobuild/config": "^0.0.6",
Expand Down
7 changes: 7 additions & 0 deletions cli/src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,11 @@ export const deploy = async (args?: string[]) => {
await mod.install(context);
})
);

// 5. Some canisters may require post installation configuration that needs to be executed only once like that dev-painful Governance canister
await Promise.all(
rest.map(async (mod) => {
await mod.postInstall(context);
})
);
};
106 changes: 106 additions & 0 deletions cli/src/declarations/cmc.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import type {ActorMethod} from '@dfinity/agent';
import type {IDL} from '@dfinity/candid';
import type {Principal} from '@dfinity/principal';

export type AccountIdentifier = string;
export type BlockIndex = bigint;
export interface CanisterSettings {
controller: [] | [Principal];
freezing_threshold: [] | [bigint];
controllers: [] | [Array<Principal>];
reserved_cycles_limit: [] | [bigint];
log_visibility: [] | [log_visibility];
wasm_memory_limit: [] | [bigint];
memory_allocation: [] | [bigint];
compute_allocation: [] | [bigint];
}
export interface CreateCanisterArg {
subnet_selection: [] | [SubnetSelection];
settings: [] | [CanisterSettings];
subnet_type: [] | [string];
}
export type CreateCanisterError =
| {
Refunded: {create_error: string; refund_amount: bigint};
}
| {RefundFailed: {create_error: string; refund_error: string}};
export type CreateCanisterResult = {Ok: Principal} | {Err: CreateCanisterError};
export type Cycles = bigint;
export interface CyclesCanisterInitPayload {
exchange_rate_canister: [] | [ExchangeRateCanister];
cycles_ledger_canister_id: [] | [Principal];
last_purged_notification: [] | [bigint];
governance_canister_id: [] | [Principal];
minting_account_id: [] | [AccountIdentifier];
ledger_canister_id: [] | [Principal];
}
export type ExchangeRateCanister = {Set: Principal} | {Unset: null};
export interface IcpXdrConversionRate {
xdr_permyriad_per_icp: bigint;
timestamp_seconds: bigint;
}
export interface IcpXdrConversionRateResponse {
certificate: Uint8Array | number[];
data: IcpXdrConversionRate;
hash_tree: Uint8Array | number[];
}
export type Memo = [] | [Uint8Array | number[]];
export interface NotifyCreateCanisterArg {
controller: Principal;
block_index: BlockIndex;
subnet_selection: [] | [SubnetSelection];
settings: [] | [CanisterSettings];
subnet_type: [] | [string];
}
export type NotifyCreateCanisterResult = {Ok: Principal} | {Err: NotifyError};
export type NotifyError =
| {
Refunded: {block_index: [] | [BlockIndex]; reason: string};
}
| {InvalidTransaction: string}
| {Other: {error_message: string; error_code: bigint}}
| {Processing: null}
| {TransactionTooOld: BlockIndex};
export interface NotifyMintCyclesArg {
block_index: BlockIndex;
deposit_memo: Memo;
to_subaccount: Subaccount;
}
export type NotifyMintCyclesResult = {Ok: NotifyMintCyclesSuccess} | {Err: NotifyError};
export interface NotifyMintCyclesSuccess {
balance: bigint;
block_index: bigint;
minted: bigint;
}
export interface NotifyTopUpArg {
block_index: BlockIndex;
canister_id: Principal;
}
export type NotifyTopUpResult = {Ok: Cycles} | {Err: NotifyError};
export interface PrincipalsAuthorizedToCreateCanistersToSubnetsResponse {
data: Array<[Principal, Array<Principal>]>;
}
export type Subaccount = [] | [Uint8Array | number[]];
export interface SubnetFilter {
subnet_type: [] | [string];
}
export type SubnetSelection = {Filter: SubnetFilter} | {Subnet: {subnet: Principal}};
export interface SubnetTypesToSubnetsResponse {
data: Array<[string, Array<Principal>]>;
}
export type log_visibility = {controllers: null} | {public: null};
export interface _SERVICE {
create_canister: ActorMethod<[CreateCanisterArg], CreateCanisterResult>;
get_build_metadata: ActorMethod<[], string>;
get_icp_xdr_conversion_rate: ActorMethod<[], IcpXdrConversionRateResponse>;
get_principals_authorized_to_create_canisters_to_subnets: ActorMethod<
[],
PrincipalsAuthorizedToCreateCanistersToSubnetsResponse
>;
get_subnet_types_to_subnets: ActorMethod<[], SubnetTypesToSubnetsResponse>;
notify_create_canister: ActorMethod<[NotifyCreateCanisterArg], NotifyCreateCanisterResult>;
notify_mint_cycles: ActorMethod<[NotifyMintCyclesArg], NotifyMintCyclesResult>;
notify_top_up: ActorMethod<[NotifyTopUpArg], NotifyTopUpResult>;
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: (args: {IDL: typeof IDL}) => IDL.Type[];
Loading

0 comments on commit 087a20b

Please sign in to comment.