Skip to content

Commit

Permalink
Update IC commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gix-bot authored Dec 18, 2023
1 parent a47a614 commit df6c495
Show file tree
Hide file tree
Showing 39 changed files with 998 additions and 169 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 a8e25a31a (2023-12-12) 'rs/bitcoin/ckbtc/minter/ckbtc_minter.did' by import-candid
// Generated from IC repo commit 91d71f0 (2023-12-13 tags: release-2023-12-13_23-01) '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
59 changes: 59 additions & 0 deletions packages/cmc/candid/cmc.certified.idl.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,37 @@ export const idlFactory = ({ IDL }) => {
'minting_account_id' : IDL.Opt(AccountIdentifier),
'ledger_canister_id' : IDL.Opt(IDL.Principal),
});
const SubnetFilter = IDL.Record({ 'subnet_type' : IDL.Opt(IDL.Text) });
const SubnetSelection = IDL.Variant({
'Filter' : SubnetFilter,
'Subnet' : IDL.Record({ 'subnet' : IDL.Principal }),
});
const CanisterSettings = IDL.Record({
'freezing_threshold' : IDL.Opt(IDL.Nat),
'controllers' : IDL.Opt(IDL.Vec(IDL.Principal)),
'reserved_cycles_limit' : IDL.Opt(IDL.Nat),
'memory_allocation' : IDL.Opt(IDL.Nat),
'compute_allocation' : IDL.Opt(IDL.Nat),
});
const CreateCanisterArg = IDL.Record({
'subnet_selection' : IDL.Opt(SubnetSelection),
'settings' : IDL.Opt(CanisterSettings),
'subnet_type' : IDL.Opt(IDL.Text),
});
const CreateCanisterError = IDL.Variant({
'Refunded' : IDL.Record({
'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,
'Err' : CreateCanisterError,
});
const IcpXdrConversionRate = IDL.Record({
'xdr_permyriad_per_icp' : IDL.Nat64,
'timestamp_seconds' : IDL.Nat64,
Expand All @@ -31,6 +62,8 @@ export const idlFactory = ({ IDL }) => {
const NotifyCreateCanisterArg = IDL.Record({
'controller' : IDL.Principal,
'block_index' : BlockIndex,
'subnet_selection' : IDL.Opt(IDL.Vec(SubnetSelection)),
'settings' : IDL.Opt(CanisterSettings),
'subnet_type' : IDL.Opt(IDL.Text),
});
const NotifyError = IDL.Variant({
Expand All @@ -50,13 +83,34 @@ export const idlFactory = ({ IDL }) => {
'Ok' : IDL.Principal,
'Err' : NotifyError,
});
const Memo = IDL.Nat64;
const Subaccount = IDL.Vec(IDL.Nat8);
const NotifyMintCyclesArg = IDL.Record({
'block_index' : BlockIndex,
'deposit_memo' : Memo,
'to_subaccount' : Subaccount,
});
const NotifyMintCyclesSuccess = IDL.Record({
'balance' : IDL.Nat,
'block_index' : IDL.Nat,
'minted' : IDL.Nat,
});
const NotifyMintCyclesResult = IDL.Variant({
'Ok' : NotifyMintCyclesSuccess,
'Err' : NotifyError,
});
const NotifyTopUpArg = IDL.Record({
'block_index' : BlockIndex,
'canister_id' : IDL.Principal,
});
const Cycles = IDL.Nat;
const NotifyTopUpResult = IDL.Variant({ 'Ok' : Cycles, 'Err' : NotifyError });
return IDL.Service({
'create_canister' : IDL.Func(
[CreateCanisterArg],
[CreateCanisterResult],
[],
),
'get_icp_xdr_conversion_rate' : IDL.Func(
[],
[IcpXdrConversionRateResponse],
Expand All @@ -77,6 +131,11 @@ export const idlFactory = ({ IDL }) => {
[NotifyCreateCanisterResult],
[],
),
'notify_mint_cycles' : IDL.Func(
[NotifyMintCyclesArg],
[NotifyMintCyclesResult],
[],
),
'notify_top_up' : IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),
});
};
Expand Down
48 changes: 48 additions & 0 deletions packages/cmc/candid/cmc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ export interface AccountIdentifier {
bytes: Uint8Array | number[];
}
export type BlockIndex = bigint;
export interface CanisterSettings {
freezing_threshold: [] | [bigint];
controllers: [] | [Array<Principal>];
reserved_cycles_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];
Expand All @@ -23,9 +43,12 @@ export interface IcpXdrConversionRateResponse {
data: IcpXdrConversionRate;
hash_tree: Uint8Array | number[];
}
export type Memo = bigint;
export interface NotifyCreateCanisterArg {
controller: Principal;
block_index: BlockIndex;
subnet_selection: [] | [Array<SubnetSelection>];
settings: [] | [CanisterSettings];
subnet_type: [] | [string];
}
export type NotifyCreateCanisterResult =
Expand All @@ -39,6 +62,19 @@ export type NotifyError =
| { 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;
Expand All @@ -47,10 +83,18 @@ 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 interface _SERVICE {
create_canister: ActorMethod<[CreateCanisterArg], CreateCanisterResult>;
get_icp_xdr_conversion_rate: ActorMethod<[], IcpXdrConversionRateResponse>;
get_principals_authorized_to_create_canisters_to_subnets: ActorMethod<
[],
Expand All @@ -61,5 +105,9 @@ export interface _SERVICE {
[NotifyCreateCanisterArg],
NotifyCreateCanisterResult
>;
notify_mint_cycles: ActorMethod<
[NotifyMintCyclesArg],
NotifyMintCyclesResult
>;
notify_top_up: ActorMethod<[NotifyTopUpArg], NotifyTopUpResult>;
}
102 changes: 100 additions & 2 deletions packages/cmc/candid/cmc.did
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
// Generated from IC repo commit d2331ec4b3c60f408b876427d7238ec15fb16ad5 'rs/nns/cmc/cmc.did' by import-candid
// Generated from IC repo commit 91d71f0 (2023-12-13 tags: release-2023-12-13_23-01) 'rs/nns/cmc/cmc.did' by import-candid
type Cycles = nat;
type BlockIndex = nat64;
type CanisterSettings = record {
controllers : opt vec principal;
compute_allocation : opt nat;
memory_allocation : opt nat;
freezing_threshold : opt nat;
reserved_cycles_limit: opt nat;
};
type Subaccount = blob;
type Memo = nat64;

// The argument of the [notify_top_up] method.
type NotifyTopUpArg = record {
Expand All @@ -11,6 +20,35 @@ type NotifyTopUpArg = record {
canister_id : principal;
};


type SubnetSelection = variant {
/// Choose a specific subnet
Subnet : record {
subnet: principal;
};
/// Choose a random subnet that fulfills the specified properties
Filter : SubnetFilter;
};

type SubnetFilter = record {
subnet_type: opt text;
};

// The argument of the [create_canister] method.
type CreateCanisterArg = record {
// Optional canister settings that, if set, are applied to the newly created canister.
// If not specified, the caller is the controller of the canister and the other settings are set to default values.
settings : opt CanisterSettings;

// An optional subnet type that, if set, determines what type of subnet
// the new canister will be created on.
// Deprecated. Use subnet_selection instead.
subnet_type: opt text;

// Optional instructions to select on which subnet the new canister will be created on.
subnet_selection: opt SubnetSelection;
};

// The argument of the [notify_create_canister] method.
type NotifyCreateCanisterArg = record {
// Index of the block on the ICP ledger that contains the payment.
Expand All @@ -21,7 +59,35 @@ type NotifyCreateCanisterArg = record {

// An optional subnet type that, if set, determines what type of subnet
// the new canister will be created on.
// Deprecated. Use subnet_selection instead.
subnet_type: opt text;

// Optional instructions to select on which subnet the new canister will be created on.
// vec may contain no more than one element.
subnet_selection: opt vec SubnetSelection;

// Optional canister settings that, if set, are applied to the newly created canister.
// If not specified, the caller is the controller of the canister and the other settings are set to default values.
settings : opt CanisterSettings;
};

// Canister creation failed and the cycles attached to the call were returned to the calling canister.
// A small fee may be charged.
type CreateCanisterError = variant {
Refunded : record {
// The amount of cycles returned to the calling canister
refund_amount: nat;

// 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 Expand Up @@ -58,6 +124,12 @@ type NotifyTopUpResult = variant {
Err : NotifyError;
};

type CreateCanisterResult = variant {
// The principal of the newly created canister.
Ok : principal;
Err : CreateCanisterError;
};

type NotifyCreateCanisterResult = variant {
// The principal of the newly created canister.
Ok : principal;
Expand Down Expand Up @@ -123,14 +195,40 @@ type CyclesCanisterInitPayload = record {
exchange_rate_canister: opt ExchangeRateCanister;
};

type NotifyMintCyclesArg = record {
block_index: BlockIndex;
to_subaccount: Subaccount;
deposit_memo: Memo;
};

type NotifyMintCyclesResult = variant {
Ok: NotifyMintCyclesSuccess;
Err: NotifyError;
};

type NotifyMintCyclesSuccess = record {
// Cycles ledger block index of deposit
block_index: nat;
// Amount of cycles that were minted and deposited to the cycles ledger
minted: nat;
// New balance of the cycles ledger account
balance: nat;
};

service : (opt CyclesCanisterInitPayload) -> {
// Propmts the cycles minting canister to process a payment by converting ICP
// Prompts the cycles minting canister to process a payment by converting ICP
// into cycles and sending the cycles the specified canister.
notify_top_up : (NotifyTopUpArg) -> (NotifyTopUpResult);

// Creates a canister using the cycles attached to the function call.
create_canister : (CreateCanisterArg) -> (CreateCanisterResult);

// Prompts the cycles minting canister to process a payment for canister creation.
notify_create_canister : (NotifyCreateCanisterArg) -> (NotifyCreateCanisterResult);

// Mints cycles and deposits them to the cycles ledger
notify_mint_cycles : (NotifyMintCyclesArg) -> (NotifyMintCyclesResult);

// Returns the ICP/XDR conversion rate.
get_icp_xdr_conversion_rate : () -> (IcpXdrConversionRateResponse) query;

Expand Down
Loading

0 comments on commit df6c495

Please sign in to comment.