diff --git a/cli/package-lock.json b/cli/package-lock.json index d6078a7..c154aea 100755 --- a/cli/package-lock.json +++ b/cli/package-lock.json @@ -14,10 +14,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", @@ -655,14 +658,14 @@ } }, "node_modules/@dfinity/ic-management": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@dfinity/ic-management/-/ic-management-3.2.0.tgz", - "integrity": "sha512-xhfchrvczE8Q5TLiWFNJschKs97dkhKJjcvtGd167+Y0l6zk0Qsd4IiNZv+TO1+PmBq1Cy2E2UXe3bNGdY3tLg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@dfinity/ic-management/-/ic-management-4.0.0.tgz", + "integrity": "sha512-h5e/tE4lzgrbvROcBI2G6dKBild4urs9kFN7PdtLO5trQ5lIzlxcWpuoNYxRgGLIG4mK1TIPFFQjZwxeZX9HYA==", "peerDependencies": { - "@dfinity/agent": "^1.2.1", - "@dfinity/candid": "^1.2.1", - "@dfinity/principal": "^1.2.1", - "@dfinity/utils": "^2.2.0" + "@dfinity/agent": "^1.3.0", + "@dfinity/candid": "^1.3.0", + "@dfinity/principal": "^1.3.0", + "@dfinity/utils": "^2.3.0" } }, "node_modules/@dfinity/identity": { @@ -680,6 +683,54 @@ "@peculiar/webcrypto": "^1.4.0" } }, + "node_modules/@dfinity/ledger-icp": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@dfinity/ledger-icp/-/ledger-icp-2.2.4.tgz", + "integrity": "sha512-xeeu5Qi9sMkhDbfDHbEGUiNe2eiLeKerlIL/rJP+/lxHlcusandMZaYQWb6Me3EXi2Z7hlKaFKamSBEM+W5ZDw==", + "peer": true, + "peerDependencies": { + "@dfinity/agent": "^1.3.0", + "@dfinity/candid": "^1.3.0", + "@dfinity/principal": "^1.3.0", + "@dfinity/utils": "^2.3.0" + } + }, + "node_modules/@dfinity/ledger-icrc": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@dfinity/ledger-icrc/-/ledger-icrc-2.3.1.tgz", + "integrity": "sha512-aHkVDIwEwOqZLSUzxd1Ed6jgVfCyIwNK8ExRebKhRmPX+WMj110fHyTXFLefr65qLY23FWpqGsQjhyf5XuRC7Q==", + "peer": true, + "peerDependencies": { + "@dfinity/agent": "^1.3.0", + "@dfinity/candid": "^1.3.0", + "@dfinity/principal": "^1.3.0", + "@dfinity/utils": "^2.3.0" + } + }, + "node_modules/@dfinity/nns": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@dfinity/nns/-/nns-5.1.0.tgz", + "integrity": "sha512-5+eug/cP5PUqDp5hk4gY81x0sWi4VbTdiPmxxNk4L4NYMj1vaEdCNhmtsEgWdNa2pcvYHX58OVHqb5QFlU9a0A==", + "dependencies": { + "@noble/hashes": "^1.3.2", + "randombytes": "^2.1.0" + }, + "peerDependencies": { + "@dfinity/agent": "^1.3.0", + "@dfinity/candid": "^1.3.0", + "@dfinity/ledger-icp": "^2.2.4", + "@dfinity/principal": "^1.3.0", + "@dfinity/utils": "^2.3.0" + } + }, + "node_modules/@dfinity/nns-proto": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@dfinity/nns-proto/-/nns-proto-2.0.0.tgz", + "integrity": "sha512-LLs4TdIDhoWdZnulB2b5FI3QD4ZOXE3xfA2REnj3voq2AZiqCgu2aYBJPFrh71RneEAhCbLKtM1A2dreOo0BhQ==", + "dependencies": { + "google-protobuf": "^3.21.2" + } + }, "node_modules/@dfinity/principal": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-1.3.0.tgz", @@ -688,14 +739,29 @@ "@noble/hashes": "^1.3.1" } }, + "node_modules/@dfinity/sns": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@dfinity/sns/-/sns-3.0.4.tgz", + "integrity": "sha512-9pt8EOvu7KF6+Wbhp8p6vR6jmykvptKu1Z3h7t+OFkua6yU8rrW2D44KOg+iTZ2G4bynODkHO3C/8oHUreXYfA==", + "dependencies": { + "@noble/hashes": "^1.3.2" + }, + "peerDependencies": { + "@dfinity/agent": "^1.3.0", + "@dfinity/candid": "^1.3.0", + "@dfinity/ledger-icrc": "^2.3.1", + "@dfinity/principal": "^1.3.0", + "@dfinity/utils": "^2.3.0" + } + }, "node_modules/@dfinity/utils": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@dfinity/utils/-/utils-2.2.0.tgz", - "integrity": "sha512-vOBjmP4z03yBSP3xGxPBWXiAqaHBoNccfsQPvXS92pHsQrfosfWPPfiUg9xkFRvqn1SnUMaskWmlOq2Q3rOE/w==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@dfinity/utils/-/utils-2.3.0.tgz", + "integrity": "sha512-Zif8JqSBiIWQFtJdsh3DHIGbUfDr7P4lu99fFfW4Dve99ohO9XhJsTl+fxsNs4OLt3pNJzSGS6hmQ6fZfkdyTA==", "peerDependencies": { - "@dfinity/agent": "^1.2.1", - "@dfinity/candid": "^1.2.1", - "@dfinity/principal": "^1.2.1" + "@dfinity/agent": "^1.3.0", + "@dfinity/candid": "^1.3.0", + "@dfinity/principal": "^1.3.0" } }, "node_modules/@esbuild/aix-ppc64": { @@ -3404,6 +3470,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/google-protobuf": { + "version": "3.21.2", + "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.21.2.tgz", + "integrity": "sha512-3MSOYFO5U9mPGikIYCzK0SaThypfGgS6bHqrUGXG3DPHCrb+txNqeEcns1W0lkGfk0rCyNXm7xB9rMxnCiZOoA==" + }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -4389,6 +4460,14 @@ } ] }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, "node_modules/readable-stream": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", diff --git a/cli/package.json b/cli/package.json index bc0b8fc..487a1e5 100755 --- a/cli/package.json +++ b/cli/package.json @@ -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", diff --git a/cli/src/commands/deploy.ts b/cli/src/commands/deploy.ts index e1b4436..0de3b4d 100644 --- a/cli/src/commands/deploy.ts +++ b/cli/src/commands/deploy.ts @@ -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); + }) + ); }; diff --git a/cli/src/declarations/cmc.d.ts b/cli/src/declarations/cmc.d.ts new file mode 100644 index 0000000..d53ca9d --- /dev/null +++ b/cli/src/declarations/cmc.d.ts @@ -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]; + 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]>; +} +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]>; +} +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[]; diff --git a/cli/src/declarations/cmc.did b/cli/src/declarations/cmc.did new file mode 100644 index 0000000..a7885ea --- /dev/null +++ b/cli/src/declarations/cmc.did @@ -0,0 +1,248 @@ +type Cycles = nat; +type BlockIndex = nat64; +type log_visibility = variant { + controllers; + public; +}; +type CanisterSettings = record { + controller : opt principal; + controllers : opt vec principal; + compute_allocation : opt nat; + memory_allocation : opt nat; + freezing_threshold : opt nat; + reserved_cycles_limit: opt nat; + log_visibility : opt log_visibility; + wasm_memory_limit: opt nat; +}; +type Subaccount = opt blob; +type Memo = opt blob; + +// The argument of the [notify_top_up] method. +type NotifyTopUpArg = record { + // Index of the block on the ICP ledger that contains the payment. + block_index : BlockIndex; + + // The canister to top up. + 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. + block_index : BlockIndex; + + // The controller of canister to create. + controller : principal; + + // 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 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 { + // The payment processing failed and the payment was returned the caller. + // This is a non-retriable error. + Refunded : record { + // The reason for the refund. + reason : text; + // The index of the block containing the refund. + block_index : opt BlockIndex; + }; + + // The same payment is already being processed by a concurrent request. + // This is a retriable error. + Processing; + + // The payment was too old to be processed. + // The value of the variant is the oldest block index that can still be processed. + // This a non-retriable error. + TransactionTooOld : BlockIndex; + + // The transaction does not satisfy the cycle minting canister payment protocol. + // The text contains the description of the problem. + // This is a non-retriable error. + InvalidTransaction : text; + + // Other error. + Other : record { error_code : nat64; error_message : text }; +}; + +type NotifyTopUpResult = variant { + // The amount of cycles sent to the specified canister. + Ok : Cycles; + 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; + Err : NotifyError; +}; + +type IcpXdrConversionRate = record { + // The time for which the market data was queried, expressed in UNIX epoch + // time in seconds. + timestamp_seconds : nat64; + + // The number of 10,000ths of IMF SDR (currency code XDR) that corresponds + // to 1 ICP. This value reflects the current market price of one ICP token. + xdr_permyriad_per_icp : nat64; +}; + + +type IcpXdrConversionRateResponse = record { + // The latest ICP/XDR conversion rate. + data : IcpXdrConversionRate; + + // CBOR-serialized hash tree as specified in + // https://internetcomputer.org/docs/interface-spec/index.html#certification-encoding + // The hash tree is used for certification and hash the following structure: + // ``` + // * + // | + // +-- ICP_XDR_CONVERSION_RATE -- [ Candid encoded IcpXdrConversionRate ] + // | + // `-- AVERAGE_ICP_XDR_CONVERSION_RATE -- [ Candid encoded IcpXdrConversionRate ] + // ``` + hash_tree : blob; + + // System certificate as specified in + // https://internetcomputer.org/docs/interface-spec/index.html#certification-encoding + certificate : blob; +}; + +type SubnetTypesToSubnetsResponse = record { + data: vec record { text; vec principal }; +}; + +type PrincipalsAuthorizedToCreateCanistersToSubnetsResponse = record { + data: vec record { principal; vec principal }; +}; + +type AccountIdentifier = text; + +type ExchangeRateCanister = variant { + /// Enables the exchange rate canister with the given canister ID. + Set: principal; + /// Disable the exchange rate canister. + Unset; +}; + +type CyclesCanisterInitPayload = record { + ledger_canister_id: opt principal; + governance_canister_id: opt principal; + minting_account_id: opt AccountIdentifier; + last_purged_notification: opt nat64; + exchange_rate_canister: opt ExchangeRateCanister; + cycles_ledger_canister_id: opt principal; +}; + +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) -> { + // 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; + + // Returns the current mapping of subnet types to subnets. + get_subnet_types_to_subnets : () -> (SubnetTypesToSubnetsResponse) query; + + // Returns the mapping from principals to subnets in which they are authorized + // to create canisters. + get_principals_authorized_to_create_canisters_to_subnets : () -> (PrincipalsAuthorizedToCreateCanistersToSubnetsResponse) query; + + get_build_metadata : () -> (text) query; +} diff --git a/cli/src/declarations/cmc.idl.js b/cli/src/declarations/cmc.idl.js new file mode 100644 index 0000000..00169f7 --- /dev/null +++ b/cli/src/declarations/cmc.idl.js @@ -0,0 +1,145 @@ +export const idlFactory = ({IDL}) => { + const ExchangeRateCanister = IDL.Variant({ + Set: IDL.Principal, + Unset: IDL.Null + }); + const AccountIdentifier = IDL.Text; + const CyclesCanisterInitPayload = IDL.Record({ + exchange_rate_canister: IDL.Opt(ExchangeRateCanister), + cycles_ledger_canister_id: IDL.Opt(IDL.Principal), + last_purged_notification: IDL.Opt(IDL.Nat64), + governance_canister_id: IDL.Opt(IDL.Principal), + 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 log_visibility = IDL.Variant({ + controllers: IDL.Null, + public: IDL.Null + }); + const CanisterSettings = IDL.Record({ + controller: IDL.Opt(IDL.Principal), + freezing_threshold: IDL.Opt(IDL.Nat), + controllers: IDL.Opt(IDL.Vec(IDL.Principal)), + reserved_cycles_limit: IDL.Opt(IDL.Nat), + log_visibility: IDL.Opt(log_visibility), + wasm_memory_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 + }); + const IcpXdrConversionRateResponse = IDL.Record({ + certificate: IDL.Vec(IDL.Nat8), + data: IcpXdrConversionRate, + hash_tree: IDL.Vec(IDL.Nat8) + }); + const PrincipalsAuthorizedToCreateCanistersToSubnetsResponse = IDL.Record({ + data: IDL.Vec(IDL.Tuple(IDL.Principal, IDL.Vec(IDL.Principal))) + }); + const SubnetTypesToSubnetsResponse = IDL.Record({ + data: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Principal))) + }); + const BlockIndex = IDL.Nat64; + const NotifyCreateCanisterArg = IDL.Record({ + controller: IDL.Principal, + block_index: BlockIndex, + subnet_selection: IDL.Opt(SubnetSelection), + settings: IDL.Opt(CanisterSettings), + subnet_type: IDL.Opt(IDL.Text) + }); + const NotifyError = IDL.Variant({ + Refunded: IDL.Record({ + block_index: IDL.Opt(BlockIndex), + reason: IDL.Text + }), + InvalidTransaction: IDL.Text, + Other: IDL.Record({ + error_message: IDL.Text, + error_code: IDL.Nat64 + }), + Processing: IDL.Null, + TransactionTooOld: BlockIndex + }); + const NotifyCreateCanisterResult = IDL.Variant({ + Ok: IDL.Principal, + Err: NotifyError + }); + const Memo = IDL.Opt(IDL.Vec(IDL.Nat8)); + const Subaccount = IDL.Opt(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_build_metadata: IDL.Func([], [IDL.Text], ['query']), + get_icp_xdr_conversion_rate: IDL.Func([], [IcpXdrConversionRateResponse], ['query']), + get_principals_authorized_to_create_canisters_to_subnets: IDL.Func( + [], + [PrincipalsAuthorizedToCreateCanistersToSubnetsResponse], + ['query'] + ), + get_subnet_types_to_subnets: IDL.Func([], [SubnetTypesToSubnetsResponse], ['query']), + notify_create_canister: IDL.Func([NotifyCreateCanisterArg], [NotifyCreateCanisterResult], []), + notify_mint_cycles: IDL.Func([NotifyMintCyclesArg], [NotifyMintCyclesResult], []), + notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []) + }); +}; +export const init = ({IDL}) => { + const ExchangeRateCanister = IDL.Variant({ + Set: IDL.Principal, + Unset: IDL.Null + }); + const AccountIdentifier = IDL.Text; + const CyclesCanisterInitPayload = IDL.Record({ + exchange_rate_canister: IDL.Opt(ExchangeRateCanister), + cycles_ledger_canister_id: IDL.Opt(IDL.Principal), + last_purged_notification: IDL.Opt(IDL.Nat64), + governance_canister_id: IDL.Opt(IDL.Principal), + minting_account_id: IDL.Opt(AccountIdentifier), + ledger_canister_id: IDL.Opt(IDL.Principal) + }); + return [IDL.Opt(CyclesCanisterInitPayload)]; +}; diff --git a/cli/src/declarations/governance.d.ts b/cli/src/declarations/governance.d.ts new file mode 100644 index 0000000..1dfb5ea --- /dev/null +++ b/cli/src/declarations/governance.d.ts @@ -0,0 +1,804 @@ +import type {ActorMethod} from '@dfinity/agent'; +import type {IDL} from '@dfinity/candid'; +import type {Principal} from '@dfinity/principal'; + +export interface AccountIdentifier { + hash: Uint8Array | number[]; +} +export type Action = + | {RegisterKnownNeuron: KnownNeuron} + | {ManageNeuron: ManageNeuron} + | {CreateServiceNervousSystem: CreateServiceNervousSystem} + | {ExecuteNnsFunction: ExecuteNnsFunction} + | {RewardNodeProvider: RewardNodeProvider} + | {OpenSnsTokenSwap: OpenSnsTokenSwap} + | {SetSnsTokenSwapOpenTimeWindow: SetSnsTokenSwapOpenTimeWindow} + | {SetDefaultFollowees: SetDefaultFollowees} + | {RewardNodeProviders: RewardNodeProviders} + | {ManageNetworkEconomics: NetworkEconomics} + | {ApproveGenesisKyc: ApproveGenesisKyc} + | {AddOrRemoveNodeProvider: AddOrRemoveNodeProvider} + | {Motion: Motion}; +export interface AddHotKey { + new_hot_key: [] | [Principal]; +} +export interface AddOrRemoveNodeProvider { + change: [] | [Change]; +} +export interface Amount { + e8s: bigint; +} +export interface ApproveGenesisKyc { + principals: Array; +} +export interface Ballot { + vote: number; + voting_power: bigint; +} +export interface BallotInfo { + vote: number; + proposal_id: [] | [NeuronId]; +} +export type By = + | {NeuronIdOrSubaccount: {}} + | {MemoAndController: ClaimOrRefreshNeuronFromAccount} + | {Memo: bigint}; +export interface Canister { + id: [] | [Principal]; +} +export interface CanisterStatusResultV2 { + status: [] | [number]; + freezing_threshold: [] | [bigint]; + controllers: Array; + memory_size: [] | [bigint]; + cycles: [] | [bigint]; + idle_cycles_burned_per_day: [] | [bigint]; + module_hash: Uint8Array | number[]; +} +export interface CanisterSummary { + status: [] | [CanisterStatusResultV2]; + canister_id: [] | [Principal]; +} +export interface CfNeuron { + has_created_neuron_recipes: [] | [boolean]; + nns_neuron_id: bigint; + amount_icp_e8s: bigint; +} +export interface CfParticipant { + hotkey_principal: string; + cf_neurons: Array; +} +export type Change = {ToRemove: NodeProvider} | {ToAdd: NodeProvider}; +export interface ChangeAutoStakeMaturity { + requested_setting_for_auto_stake_maturity: boolean; +} +export interface ClaimOrRefresh { + by: [] | [By]; +} +export interface ClaimOrRefreshNeuronFromAccount { + controller: [] | [Principal]; + memo: bigint; +} +export interface ClaimOrRefreshNeuronFromAccountResponse { + result: [] | [Result_1]; +} +export interface ClaimOrRefreshResponse { + refreshed_neuron_id: [] | [NeuronId]; +} +export type Command = + | {Spawn: Spawn} + | {Split: Split} + | {Follow: Follow} + | {ClaimOrRefresh: ClaimOrRefresh} + | {Configure: Configure} + | {RegisterVote: RegisterVote} + | {Merge: Merge} + | {DisburseToNeuron: DisburseToNeuron} + | {MakeProposal: Proposal} + | {StakeMaturity: StakeMaturity} + | {MergeMaturity: MergeMaturity} + | {Disburse: Disburse}; +export type Command_1 = + | {Error: GovernanceError} + | {Spawn: SpawnResponse} + | {Split: SpawnResponse} + | {Follow: {}} + | {ClaimOrRefresh: ClaimOrRefreshResponse} + | {Configure: {}} + | {RegisterVote: {}} + | {Merge: MergeResponse} + | {DisburseToNeuron: SpawnResponse} + | {MakeProposal: MakeProposalResponse} + | {StakeMaturity: StakeMaturityResponse} + | {MergeMaturity: MergeMaturityResponse} + | {Disburse: DisburseResponse}; +export type Command_2 = + | {Spawn: NeuronId} + | {Split: Split} + | {Configure: Configure} + | {Merge: Merge} + | {DisburseToNeuron: DisburseToNeuron} + | {SyncCommand: {}} + | {ClaimOrRefreshNeuron: ClaimOrRefresh} + | {MergeMaturity: MergeMaturity} + | {Disburse: Disburse}; +export interface Committed { + total_direct_contribution_icp_e8s: [] | [bigint]; + total_neurons_fund_contribution_icp_e8s: [] | [bigint]; + sns_governance_canister_id: [] | [Principal]; +} +export interface Committed_1 { + total_direct_participation_icp_e8s: [] | [bigint]; + total_neurons_fund_participation_icp_e8s: [] | [bigint]; + sns_governance_canister_id: [] | [Principal]; +} +export interface Configure { + operation: [] | [Operation]; +} +export interface Countries { + iso_codes: Array; +} +export interface CreateServiceNervousSystem { + url: [] | [string]; + governance_parameters: [] | [GovernanceParameters]; + fallback_controller_principal_ids: Array; + logo: [] | [Image]; + name: [] | [string]; + ledger_parameters: [] | [LedgerParameters]; + description: [] | [string]; + dapp_canisters: Array; + swap_parameters: [] | [SwapParameters]; + initial_token_distribution: [] | [InitialTokenDistribution]; +} +export interface Decimal { + human_readable: [] | [string]; +} +export interface DerivedProposalInformation { + swap_background_information: [] | [SwapBackgroundInformation]; +} +export interface DeveloperDistribution { + developer_neurons: Array; +} +export interface Disburse { + to_account: [] | [AccountIdentifier]; + amount: [] | [Amount]; +} +export interface DisburseResponse { + transfer_block_height: bigint; +} +export interface DisburseToNeuron { + dissolve_delay_seconds: bigint; + kyc_verified: boolean; + amount_e8s: bigint; + new_controller: [] | [Principal]; + nonce: bigint; +} +export type DissolveState = + | {DissolveDelaySeconds: bigint} + | {WhenDissolvedTimestampSeconds: bigint}; +export interface Duration { + seconds: [] | [bigint]; +} +export interface ExecuteNnsFunction { + nns_function: number; + payload: Uint8Array | number[]; +} +export interface Follow { + topic: number; + followees: Array; +} +export interface Followees { + followees: Array; +} +export interface Followers { + followers: Array; +} +export interface FollowersMap { + followers_map: Array<[bigint, Followers]>; +} +export interface GetNeuronsFundAuditInfoRequest { + nns_proposal_id: [] | [NeuronId]; +} +export interface GetNeuronsFundAuditInfoResponse { + result: [] | [Result_6]; +} +export interface GlobalTimeOfDay { + seconds_after_utc_midnight: [] | [bigint]; +} +export interface Governance { + default_followees: Array<[number, Followees]>; + making_sns_proposal: [] | [MakingSnsProposal]; + most_recent_monthly_node_provider_rewards: [] | [MostRecentMonthlyNodeProviderRewards]; + maturity_modulation_last_updated_at_timestamp_seconds: [] | [bigint]; + wait_for_quiet_threshold_seconds: bigint; + metrics: [] | [GovernanceCachedMetrics]; + neuron_management_voting_period_seconds: [] | [bigint]; + node_providers: Array; + cached_daily_maturity_modulation_basis_points: [] | [number]; + economics: [] | [NetworkEconomics]; + restore_aging_summary: [] | [RestoreAgingSummary]; + spawning_neurons: [] | [boolean]; + latest_reward_event: [] | [RewardEvent]; + to_claim_transfers: Array; + short_voting_period_seconds: bigint; + topic_followee_index: Array<[number, FollowersMap]>; + migrations: [] | [Migrations]; + proposals: Array<[bigint, ProposalData]>; + xdr_conversion_rate: [] | [XdrConversionRate]; + in_flight_commands: Array<[bigint, NeuronInFlightCommand]>; + neurons: Array<[bigint, Neuron]>; + genesis_timestamp_seconds: bigint; +} +export interface GovernanceCachedMetrics { + total_maturity_e8s_equivalent: bigint; + not_dissolving_neurons_e8s_buckets: Array<[bigint, number]>; + dissolving_neurons_staked_maturity_e8s_equivalent_sum: bigint; + garbage_collectable_neurons_count: bigint; + dissolving_neurons_staked_maturity_e8s_equivalent_buckets: Array<[bigint, number]>; + neurons_with_invalid_stake_count: bigint; + not_dissolving_neurons_count_buckets: Array<[bigint, bigint]>; + ect_neuron_count: bigint; + total_supply_icp: bigint; + neurons_with_less_than_6_months_dissolve_delay_count: bigint; + dissolved_neurons_count: bigint; + community_fund_total_maturity_e8s_equivalent: bigint; + total_staked_e8s_seed: bigint; + total_staked_maturity_e8s_equivalent_ect: bigint; + total_staked_e8s: bigint; + not_dissolving_neurons_count: bigint; + total_locked_e8s: bigint; + neurons_fund_total_active_neurons: bigint; + total_staked_maturity_e8s_equivalent: bigint; + not_dissolving_neurons_e8s_buckets_ect: Array<[bigint, number]>; + total_staked_e8s_ect: bigint; + not_dissolving_neurons_staked_maturity_e8s_equivalent_sum: bigint; + dissolved_neurons_e8s: bigint; + dissolving_neurons_e8s_buckets_seed: Array<[bigint, number]>; + neurons_with_less_than_6_months_dissolve_delay_e8s: bigint; + not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets: Array<[bigint, number]>; + dissolving_neurons_count_buckets: Array<[bigint, bigint]>; + dissolving_neurons_e8s_buckets_ect: Array<[bigint, number]>; + dissolving_neurons_count: bigint; + dissolving_neurons_e8s_buckets: Array<[bigint, number]>; + total_staked_maturity_e8s_equivalent_seed: bigint; + community_fund_total_staked_e8s: bigint; + not_dissolving_neurons_e8s_buckets_seed: Array<[bigint, number]>; + timestamp_seconds: bigint; + seed_neuron_count: bigint; +} +export interface GovernanceError { + error_message: string; + error_type: number; +} +export interface GovernanceParameters { + neuron_maximum_dissolve_delay_bonus: [] | [Percentage]; + neuron_maximum_age_for_age_bonus: [] | [Duration]; + neuron_maximum_dissolve_delay: [] | [Duration]; + neuron_minimum_dissolve_delay_to_vote: [] | [Duration]; + neuron_maximum_age_bonus: [] | [Percentage]; + neuron_minimum_stake: [] | [Tokens]; + proposal_wait_for_quiet_deadline_increase: [] | [Duration]; + proposal_initial_voting_period: [] | [Duration]; + proposal_rejection_fee: [] | [Tokens]; + voting_reward_parameters: [] | [VotingRewardParameters]; +} +export interface IdealMatchedParticipationFunction { + serialized_representation: [] | [string]; +} +export interface Image { + base64_encoding: [] | [string]; +} +export interface IncreaseDissolveDelay { + additional_dissolve_delay_seconds: number; +} +export interface InitialTokenDistribution { + treasury_distribution: [] | [SwapDistribution]; + developer_distribution: [] | [DeveloperDistribution]; + swap_distribution: [] | [SwapDistribution]; +} +export interface KnownNeuron { + id: [] | [NeuronId]; + known_neuron_data: [] | [KnownNeuronData]; +} +export interface KnownNeuronData { + name: string; + description: [] | [string]; +} +export interface LedgerParameters { + transaction_fee: [] | [Tokens]; + token_symbol: [] | [string]; + token_logo: [] | [Image]; + token_name: [] | [string]; +} +export interface ListKnownNeuronsResponse { + known_neurons: Array; +} +export interface ListNeurons { + neuron_ids: BigUint64Array | bigint[]; + include_neurons_readable_by_caller: boolean; +} +export interface ListNeuronsResponse { + neuron_infos: Array<[bigint, NeuronInfo]>; + full_neurons: Array; +} +export interface ListNodeProvidersResponse { + node_providers: Array; +} +export interface ListProposalInfo { + include_reward_status: Int32Array | number[]; + omit_large_fields: [] | [boolean]; + before_proposal: [] | [NeuronId]; + limit: number; + exclude_topic: Int32Array | number[]; + include_all_manage_neuron_proposals: [] | [boolean]; + include_status: Int32Array | number[]; +} +export interface ListProposalInfoResponse { + proposal_info: Array; +} +export interface MakeProposalResponse { + message: [] | [string]; + proposal_id: [] | [NeuronId]; +} +export interface MakingSnsProposal { + proposal: [] | [Proposal]; + caller: [] | [Principal]; + proposer_id: [] | [NeuronId]; +} +export interface ManageNeuron { + id: [] | [NeuronId]; + command: [] | [Command]; + neuron_id_or_subaccount: [] | [NeuronIdOrSubaccount]; +} +export interface ManageNeuronResponse { + command: [] | [Command_1]; +} +export interface Merge { + source_neuron_id: [] | [NeuronId]; +} +export interface MergeMaturity { + percentage_to_merge: number; +} +export interface MergeMaturityResponse { + merged_maturity_e8s: bigint; + new_stake_e8s: bigint; +} +export interface MergeResponse { + target_neuron: [] | [Neuron]; + source_neuron: [] | [Neuron]; + target_neuron_info: [] | [NeuronInfo]; + source_neuron_info: [] | [NeuronInfo]; +} +export interface Migration { + status: [] | [number]; + failure_reason: [] | [string]; + progress: [] | [Progress]; +} +export interface Migrations { + neuron_indexes_migration: [] | [Migration]; + copy_inactive_neurons_to_stable_memory_migration: [] | [Migration]; +} +export interface MostRecentMonthlyNodeProviderRewards { + timestamp: bigint; + rewards: Array; +} +export interface Motion { + motion_text: string; +} +export interface NetworkEconomics { + neuron_minimum_stake_e8s: bigint; + max_proposals_to_keep_per_topic: number; + neuron_management_fee_per_proposal_e8s: bigint; + reject_cost_e8s: bigint; + transaction_fee_e8s: bigint; + neuron_spawn_dissolve_delay_seconds: bigint; + minimum_icp_xdr_rate: bigint; + maximum_node_provider_rewards_e8s: bigint; + neurons_fund_economics: [] | [NeuronsFundEconomics]; +} +export interface Neuron { + id: [] | [NeuronId]; + staked_maturity_e8s_equivalent: [] | [bigint]; + controller: [] | [Principal]; + recent_ballots: Array; + kyc_verified: boolean; + neuron_type: [] | [number]; + not_for_profit: boolean; + maturity_e8s_equivalent: bigint; + cached_neuron_stake_e8s: bigint; + created_timestamp_seconds: bigint; + auto_stake_maturity: [] | [boolean]; + aging_since_timestamp_seconds: bigint; + hot_keys: Array; + account: Uint8Array | number[]; + joined_community_fund_timestamp_seconds: [] | [bigint]; + dissolve_state: [] | [DissolveState]; + followees: Array<[number, Followees]>; + neuron_fees_e8s: bigint; + transfer: [] | [NeuronStakeTransfer]; + known_neuron_data: [] | [KnownNeuronData]; + spawn_at_timestamp_seconds: [] | [bigint]; +} +export interface NeuronBasketConstructionParameters { + dissolve_delay_interval: [] | [Duration]; + count: [] | [bigint]; +} +export interface NeuronBasketConstructionParameters_1 { + dissolve_delay_interval_seconds: bigint; + count: bigint; +} +export interface NeuronDistribution { + controller: [] | [Principal]; + dissolve_delay: [] | [Duration]; + memo: [] | [bigint]; + vesting_period: [] | [Duration]; + stake: [] | [Tokens]; +} +export interface NeuronId { + id: bigint; +} +export type NeuronIdOrSubaccount = {Subaccount: Uint8Array | number[]} | {NeuronId: NeuronId}; +export interface NeuronInFlightCommand { + command: [] | [Command_2]; + timestamp: bigint; +} +export interface NeuronInfo { + dissolve_delay_seconds: bigint; + recent_ballots: Array; + neuron_type: [] | [number]; + created_timestamp_seconds: bigint; + state: number; + stake_e8s: bigint; + joined_community_fund_timestamp_seconds: [] | [bigint]; + retrieved_at_timestamp_seconds: bigint; + known_neuron_data: [] | [KnownNeuronData]; + voting_power: bigint; + age_seconds: bigint; +} +export interface NeuronStakeTransfer { + to_subaccount: Uint8Array | number[]; + neuron_stake_e8s: bigint; + from: [] | [Principal]; + memo: bigint; + from_subaccount: Uint8Array | number[]; + transfer_timestamp: bigint; + block_height: bigint; +} +export interface NeuronsFundAuditInfo { + final_neurons_fund_participation: [] | [NeuronsFundParticipation]; + initial_neurons_fund_participation: [] | [NeuronsFundParticipation]; + neurons_fund_refunds: [] | [NeuronsFundSnapshot]; +} +export interface NeuronsFundData { + final_neurons_fund_participation: [] | [NeuronsFundParticipation]; + initial_neurons_fund_participation: [] | [NeuronsFundParticipation]; + neurons_fund_refunds: [] | [NeuronsFundSnapshot]; +} +export interface NeuronsFundEconomics { + maximum_icp_xdr_rate: [] | [Percentage]; + neurons_fund_matched_funding_curve_coefficients: + | [] + | [NeuronsFundMatchedFundingCurveCoefficients]; + max_theoretical_neurons_fund_participation_amount_xdr: [] | [Decimal]; + minimum_icp_xdr_rate: [] | [Percentage]; +} +export interface NeuronsFundMatchedFundingCurveCoefficients { + contribution_threshold_xdr: [] | [Decimal]; + one_third_participation_milestone_xdr: [] | [Decimal]; + full_participation_milestone_xdr: [] | [Decimal]; +} +export interface NeuronsFundNeuron { + hotkey_principal: [] | [string]; + is_capped: [] | [boolean]; + nns_neuron_id: [] | [bigint]; + amount_icp_e8s: [] | [bigint]; +} +export interface NeuronsFundNeuronPortion { + hotkey_principal: [] | [Principal]; + is_capped: [] | [boolean]; + maturity_equivalent_icp_e8s: [] | [bigint]; + nns_neuron_id: [] | [NeuronId]; + amount_icp_e8s: [] | [bigint]; +} +export interface NeuronsFundParticipation { + total_maturity_equivalent_icp_e8s: [] | [bigint]; + intended_neurons_fund_participation_icp_e8s: [] | [bigint]; + direct_participation_icp_e8s: [] | [bigint]; + swap_participation_limits: [] | [SwapParticipationLimits]; + max_neurons_fund_swap_participation_icp_e8s: [] | [bigint]; + neurons_fund_reserves: [] | [NeuronsFundSnapshot]; + ideal_matched_participation_function: [] | [IdealMatchedParticipationFunction]; + allocated_neurons_fund_participation_icp_e8s: [] | [bigint]; +} +export interface NeuronsFundSnapshot { + neurons_fund_neuron_portions: Array; +} +export interface NodeProvider { + id: [] | [Principal]; + reward_account: [] | [AccountIdentifier]; +} +export interface Ok { + neurons_fund_audit_info: [] | [NeuronsFundAuditInfo]; +} +export interface Ok_1 { + neurons_fund_neuron_portions: Array; +} +export interface OpenSnsTokenSwap { + community_fund_investment_e8s: [] | [bigint]; + target_swap_canister_id: [] | [Principal]; + params: [] | [Params]; +} +export type Operation = + | {RemoveHotKey: RemoveHotKey} + | {AddHotKey: AddHotKey} + | {ChangeAutoStakeMaturity: ChangeAutoStakeMaturity} + | {StopDissolving: {}} + | {StartDissolving: {}} + | {IncreaseDissolveDelay: IncreaseDissolveDelay} + | {JoinCommunityFund: {}} + | {LeaveCommunityFund: {}} + | {SetDissolveTimestamp: SetDissolveTimestamp}; +export interface Params { + min_participant_icp_e8s: bigint; + neuron_basket_construction_parameters: [] | [NeuronBasketConstructionParameters_1]; + max_icp_e8s: bigint; + swap_due_timestamp_seconds: bigint; + min_participants: number; + sns_token_e8s: bigint; + sale_delay_seconds: [] | [bigint]; + max_participant_icp_e8s: bigint; + min_direct_participation_icp_e8s: [] | [bigint]; + min_icp_e8s: bigint; + max_direct_participation_icp_e8s: [] | [bigint]; +} +export interface Percentage { + basis_points: [] | [bigint]; +} +export type Progress = {LastNeuronId: NeuronId}; +export interface Proposal { + url: string; + title: [] | [string]; + action: [] | [Action]; + summary: string; +} +export interface ProposalData { + id: [] | [NeuronId]; + failure_reason: [] | [GovernanceError]; + cf_participants: Array; + ballots: Array<[bigint, Ballot]>; + proposal_timestamp_seconds: bigint; + reward_event_round: bigint; + failed_timestamp_seconds: bigint; + neurons_fund_data: [] | [NeuronsFundData]; + reject_cost_e8s: bigint; + derived_proposal_information: [] | [DerivedProposalInformation]; + latest_tally: [] | [Tally]; + sns_token_swap_lifecycle: [] | [number]; + decided_timestamp_seconds: bigint; + proposal: [] | [Proposal]; + proposer: [] | [NeuronId]; + wait_for_quiet_state: [] | [WaitForQuietState]; + executed_timestamp_seconds: bigint; + original_total_community_fund_maturity_e8s_equivalent: [] | [bigint]; +} +export interface ProposalInfo { + id: [] | [NeuronId]; + status: number; + topic: number; + failure_reason: [] | [GovernanceError]; + ballots: Array<[bigint, Ballot]>; + proposal_timestamp_seconds: bigint; + reward_event_round: bigint; + deadline_timestamp_seconds: [] | [bigint]; + failed_timestamp_seconds: bigint; + reject_cost_e8s: bigint; + derived_proposal_information: [] | [DerivedProposalInformation]; + latest_tally: [] | [Tally]; + reward_status: number; + decided_timestamp_seconds: bigint; + proposal: [] | [Proposal]; + proposer: [] | [NeuronId]; + executed_timestamp_seconds: bigint; +} +export interface RegisterVote { + vote: number; + proposal: [] | [NeuronId]; +} +export interface RemoveHotKey { + hot_key_to_remove: [] | [Principal]; +} +export interface RestoreAgingNeuronGroup { + count: [] | [bigint]; + previous_total_stake_e8s: [] | [bigint]; + current_total_stake_e8s: [] | [bigint]; + group_type: number; +} +export interface RestoreAgingSummary { + groups: Array; + timestamp_seconds: [] | [bigint]; +} +export type Result = {Ok: null} | {Err: GovernanceError}; +export type Result_1 = {Error: GovernanceError} | {NeuronId: NeuronId}; +export type Result_10 = {Ok: Ok_1} | {Err: GovernanceError}; +export type Result_2 = {Ok: Neuron} | {Err: GovernanceError}; +export type Result_3 = {Ok: GovernanceCachedMetrics} | {Err: GovernanceError}; +export type Result_4 = {Ok: RewardNodeProviders} | {Err: GovernanceError}; +export type Result_5 = {Ok: NeuronInfo} | {Err: GovernanceError}; +export type Result_6 = {Ok: Ok} | {Err: GovernanceError}; +export type Result_7 = {Ok: NodeProvider} | {Err: GovernanceError}; +export type Result_8 = {Committed: Committed} | {Aborted: {}}; +export type Result_9 = {Committed: Committed_1} | {Aborted: {}}; +export interface RewardEvent { + rounds_since_last_distribution: [] | [bigint]; + day_after_genesis: bigint; + actual_timestamp_seconds: bigint; + total_available_e8s_equivalent: bigint; + latest_round_available_e8s_equivalent: [] | [bigint]; + distributed_e8s_equivalent: bigint; + settled_proposals: Array; +} +export type RewardMode = {RewardToNeuron: RewardToNeuron} | {RewardToAccount: RewardToAccount}; +export interface RewardNodeProvider { + node_provider: [] | [NodeProvider]; + reward_mode: [] | [RewardMode]; + amount_e8s: bigint; +} +export interface RewardNodeProviders { + use_registry_derived_rewards: [] | [boolean]; + rewards: Array; +} +export interface RewardToAccount { + to_account: [] | [AccountIdentifier]; +} +export interface RewardToNeuron { + dissolve_delay_seconds: bigint; +} +export interface SetDefaultFollowees { + default_followees: Array<[number, Followees]>; +} +export interface SetDissolveTimestamp { + dissolve_timestamp_seconds: bigint; +} +export interface SetOpenTimeWindowRequest { + open_time_window: [] | [TimeWindow]; +} +export interface SetSnsTokenSwapOpenTimeWindow { + request: [] | [SetOpenTimeWindowRequest]; + swap_canister_id: [] | [Principal]; +} +export interface SettleCommunityFundParticipation { + result: [] | [Result_8]; + open_sns_token_swap_proposal_id: [] | [bigint]; +} +export interface SettleNeuronsFundParticipationRequest { + result: [] | [Result_9]; + nns_proposal_id: [] | [bigint]; +} +export interface SettleNeuronsFundParticipationResponse { + result: [] | [Result_10]; +} +export interface Spawn { + percentage_to_spawn: [] | [number]; + new_controller: [] | [Principal]; + nonce: [] | [bigint]; +} +export interface SpawnResponse { + created_neuron_id: [] | [NeuronId]; +} +export interface Split { + amount_e8s: bigint; +} +export interface StakeMaturity { + percentage_to_stake: [] | [number]; +} +export interface StakeMaturityResponse { + maturity_e8s: bigint; + staked_maturity_e8s: bigint; +} +export interface SwapBackgroundInformation { + ledger_index_canister_summary: [] | [CanisterSummary]; + fallback_controller_principal_ids: Array; + ledger_archive_canister_summaries: Array; + ledger_canister_summary: [] | [CanisterSummary]; + swap_canister_summary: [] | [CanisterSummary]; + governance_canister_summary: [] | [CanisterSummary]; + root_canister_summary: [] | [CanisterSummary]; + dapp_canister_summaries: Array; +} +export interface SwapDistribution { + total: [] | [Tokens]; +} +export interface SwapParameters { + minimum_participants: [] | [bigint]; + neurons_fund_participation: [] | [boolean]; + duration: [] | [Duration]; + neuron_basket_construction_parameters: [] | [NeuronBasketConstructionParameters]; + confirmation_text: [] | [string]; + maximum_participant_icp: [] | [Tokens]; + minimum_icp: [] | [Tokens]; + minimum_direct_participation_icp: [] | [Tokens]; + minimum_participant_icp: [] | [Tokens]; + start_time: [] | [GlobalTimeOfDay]; + maximum_direct_participation_icp: [] | [Tokens]; + maximum_icp: [] | [Tokens]; + neurons_fund_investment_icp: [] | [Tokens]; + restricted_countries: [] | [Countries]; +} +export interface SwapParticipationLimits { + min_participant_icp_e8s: [] | [bigint]; + max_participant_icp_e8s: [] | [bigint]; + min_direct_participation_icp_e8s: [] | [bigint]; + max_direct_participation_icp_e8s: [] | [bigint]; +} +export interface Tally { + no: bigint; + yes: bigint; + total: bigint; + timestamp_seconds: bigint; +} +export interface TimeWindow { + start_timestamp_seconds: bigint; + end_timestamp_seconds: bigint; +} +export interface Tokens { + e8s: [] | [bigint]; +} +export interface UpdateNodeProvider { + reward_account: [] | [AccountIdentifier]; +} +export interface VotingRewardParameters { + reward_rate_transition_duration: [] | [Duration]; + initial_reward_rate: [] | [Percentage]; + final_reward_rate: [] | [Percentage]; +} +export interface WaitForQuietState { + current_deadline_timestamp_seconds: bigint; +} +export interface XdrConversionRate { + xdr_permyriad_per_icp: [] | [bigint]; + timestamp_seconds: [] | [bigint]; +} +export interface _SERVICE { + claim_gtc_neurons: ActorMethod<[Principal, Array], Result>; + claim_or_refresh_neuron_from_account: ActorMethod< + [ClaimOrRefreshNeuronFromAccount], + ClaimOrRefreshNeuronFromAccountResponse + >; + get_build_metadata: ActorMethod<[], string>; + get_full_neuron: ActorMethod<[bigint], Result_2>; + get_full_neuron_by_id_or_subaccount: ActorMethod<[NeuronIdOrSubaccount], Result_2>; + get_latest_reward_event: ActorMethod<[], RewardEvent>; + get_metrics: ActorMethod<[], Result_3>; + get_monthly_node_provider_rewards: ActorMethod<[], Result_4>; + get_most_recent_monthly_node_provider_rewards: ActorMethod< + [], + [] | [MostRecentMonthlyNodeProviderRewards] + >; + get_network_economics_parameters: ActorMethod<[], NetworkEconomics>; + get_neuron_ids: ActorMethod<[], BigUint64Array | bigint[]>; + get_neuron_info: ActorMethod<[bigint], Result_5>; + get_neuron_info_by_id_or_subaccount: ActorMethod<[NeuronIdOrSubaccount], Result_5>; + get_neurons_fund_audit_info: ActorMethod< + [GetNeuronsFundAuditInfoRequest], + GetNeuronsFundAuditInfoResponse + >; + get_node_provider_by_caller: ActorMethod<[null], Result_7>; + get_pending_proposals: ActorMethod<[], Array>; + get_proposal_info: ActorMethod<[bigint], [] | [ProposalInfo]>; + get_restore_aging_summary: ActorMethod<[], RestoreAgingSummary>; + list_known_neurons: ActorMethod<[], ListKnownNeuronsResponse>; + list_neurons: ActorMethod<[ListNeurons], ListNeuronsResponse>; + list_node_providers: ActorMethod<[], ListNodeProvidersResponse>; + list_proposals: ActorMethod<[ListProposalInfo], ListProposalInfoResponse>; + manage_neuron: ActorMethod<[ManageNeuron], ManageNeuronResponse>; + settle_community_fund_participation: ActorMethod<[SettleCommunityFundParticipation], Result>; + settle_neurons_fund_participation: ActorMethod< + [SettleNeuronsFundParticipationRequest], + SettleNeuronsFundParticipationResponse + >; + simulate_manage_neuron: ActorMethod<[ManageNeuron], ManageNeuronResponse>; + transfer_gtc_neuron: ActorMethod<[NeuronId, NeuronId], Result>; + update_node_provider: ActorMethod<[UpdateNodeProvider], Result>; +} +export declare const idlFactory: IDL.InterfaceFactory; +export declare const init: (args: {IDL: typeof IDL}) => IDL.Type[]; diff --git a/cli/src/declarations/governance.did b/cli/src/declarations/governance.did new file mode 100644 index 0000000..40eaf16 --- /dev/null +++ b/cli/src/declarations/governance.did @@ -0,0 +1,703 @@ +type AccountIdentifier = record { hash : blob }; +type Action = variant { + RegisterKnownNeuron : KnownNeuron; + ManageNeuron : ManageNeuron; + CreateServiceNervousSystem : CreateServiceNervousSystem; + ExecuteNnsFunction : ExecuteNnsFunction; + RewardNodeProvider : RewardNodeProvider; + OpenSnsTokenSwap : OpenSnsTokenSwap; + SetSnsTokenSwapOpenTimeWindow : SetSnsTokenSwapOpenTimeWindow; + SetDefaultFollowees : SetDefaultFollowees; + RewardNodeProviders : RewardNodeProviders; + ManageNetworkEconomics : NetworkEconomics; + ApproveGenesisKyc : ApproveGenesisKyc; + AddOrRemoveNodeProvider : AddOrRemoveNodeProvider; + Motion : Motion; +}; +type AddHotKey = record { new_hot_key : opt principal }; +type AddOrRemoveNodeProvider = record { change : opt Change }; +type Amount = record { e8s : nat64 }; +type ApproveGenesisKyc = record { principals : vec principal }; +type Ballot = record { vote : int32; voting_power : nat64 }; +type BallotInfo = record { vote : int32; proposal_id : opt NeuronId }; +type By = variant { + NeuronIdOrSubaccount : record {}; + MemoAndController : ClaimOrRefreshNeuronFromAccount; + Memo : nat64; +}; +type Canister = record { id : opt principal }; +type CanisterStatusResultV2 = record { + status : opt int32; + freezing_threshold : opt nat64; + controllers : vec principal; + memory_size : opt nat64; + cycles : opt nat64; + idle_cycles_burned_per_day : opt nat64; + module_hash : blob; +}; +type CanisterSummary = record { + status : opt CanisterStatusResultV2; + canister_id : opt principal; +}; +type CfNeuron = record { + has_created_neuron_recipes : opt bool; + nns_neuron_id : nat64; + amount_icp_e8s : nat64; +}; +type CfParticipant = record { + hotkey_principal : text; + cf_neurons : vec CfNeuron; +}; +type Change = variant { ToRemove : NodeProvider; ToAdd : NodeProvider }; +type ChangeAutoStakeMaturity = record { + requested_setting_for_auto_stake_maturity : bool; +}; +type ClaimOrRefresh = record { by : opt By }; +type ClaimOrRefreshNeuronFromAccount = record { + controller : opt principal; + memo : nat64; +}; +type ClaimOrRefreshNeuronFromAccountResponse = record { result : opt Result_1 }; +type ClaimOrRefreshResponse = record { refreshed_neuron_id : opt NeuronId }; +type Command = variant { + Spawn : Spawn; + Split : Split; + Follow : Follow; + ClaimOrRefresh : ClaimOrRefresh; + Configure : Configure; + RegisterVote : RegisterVote; + Merge : Merge; + DisburseToNeuron : DisburseToNeuron; + MakeProposal : Proposal; + StakeMaturity : StakeMaturity; + MergeMaturity : MergeMaturity; + Disburse : Disburse; +}; +type Command_1 = variant { + Error : GovernanceError; + Spawn : SpawnResponse; + Split : SpawnResponse; + Follow : record {}; + ClaimOrRefresh : ClaimOrRefreshResponse; + Configure : record {}; + RegisterVote : record {}; + Merge : MergeResponse; + DisburseToNeuron : SpawnResponse; + MakeProposal : MakeProposalResponse; + StakeMaturity : StakeMaturityResponse; + MergeMaturity : MergeMaturityResponse; + Disburse : DisburseResponse; +}; +type Command_2 = variant { + Spawn : NeuronId; + Split : Split; + Configure : Configure; + Merge : Merge; + DisburseToNeuron : DisburseToNeuron; + SyncCommand : record {}; + ClaimOrRefreshNeuron : ClaimOrRefresh; + MergeMaturity : MergeMaturity; + Disburse : Disburse; +}; +type Committed = record { + total_direct_contribution_icp_e8s : opt nat64; + total_neurons_fund_contribution_icp_e8s : opt nat64; + sns_governance_canister_id : opt principal; +}; +type Committed_1 = record { + total_direct_participation_icp_e8s : opt nat64; + total_neurons_fund_participation_icp_e8s : opt nat64; + sns_governance_canister_id : opt principal; +}; +type Configure = record { operation : opt Operation }; +type Countries = record { iso_codes : vec text }; +type CreateServiceNervousSystem = record { + url : opt text; + governance_parameters : opt GovernanceParameters; + fallback_controller_principal_ids : vec principal; + logo : opt Image; + name : opt text; + ledger_parameters : opt LedgerParameters; + description : opt text; + dapp_canisters : vec Canister; + swap_parameters : opt SwapParameters; + initial_token_distribution : opt InitialTokenDistribution; +}; +type Decimal = record { human_readable : opt text }; +type DerivedProposalInformation = record { + swap_background_information : opt SwapBackgroundInformation; +}; +type DeveloperDistribution = record { + developer_neurons : vec NeuronDistribution; +}; +type Disburse = record { + to_account : opt AccountIdentifier; + amount : opt Amount; +}; +type DisburseResponse = record { transfer_block_height : nat64 }; +type DisburseToNeuron = record { + dissolve_delay_seconds : nat64; + kyc_verified : bool; + amount_e8s : nat64; + new_controller : opt principal; + nonce : nat64; +}; +type DissolveState = variant { + DissolveDelaySeconds : nat64; + WhenDissolvedTimestampSeconds : nat64; +}; +type Duration = record { seconds : opt nat64 }; +type ExecuteNnsFunction = record { nns_function : int32; payload : blob }; +type Follow = record { topic : int32; followees : vec NeuronId }; +type Followees = record { followees : vec NeuronId }; +type Followers = record { followers : vec NeuronId }; +type FollowersMap = record { followers_map : vec record { nat64; Followers } }; +type GetNeuronsFundAuditInfoRequest = record { nns_proposal_id : opt NeuronId }; +type GetNeuronsFundAuditInfoResponse = record { result : opt Result_6 }; +type GlobalTimeOfDay = record { seconds_after_utc_midnight : opt nat64 }; +type Governance = record { + default_followees : vec record { int32; Followees }; + making_sns_proposal : opt MakingSnsProposal; + most_recent_monthly_node_provider_rewards : opt MostRecentMonthlyNodeProviderRewards; + maturity_modulation_last_updated_at_timestamp_seconds : opt nat64; + wait_for_quiet_threshold_seconds : nat64; + metrics : opt GovernanceCachedMetrics; + neuron_management_voting_period_seconds : opt nat64; + node_providers : vec NodeProvider; + cached_daily_maturity_modulation_basis_points : opt int32; + economics : opt NetworkEconomics; + restore_aging_summary : opt RestoreAgingSummary; + spawning_neurons : opt bool; + latest_reward_event : opt RewardEvent; + to_claim_transfers : vec NeuronStakeTransfer; + short_voting_period_seconds : nat64; + topic_followee_index : vec record { int32; FollowersMap }; + migrations : opt Migrations; + proposals : vec record { nat64; ProposalData }; + xdr_conversion_rate : opt XdrConversionRate; + in_flight_commands : vec record { nat64; NeuronInFlightCommand }; + neurons : vec record { nat64; Neuron }; + genesis_timestamp_seconds : nat64; +}; +type GovernanceCachedMetrics = record { + total_maturity_e8s_equivalent : nat64; + not_dissolving_neurons_e8s_buckets : vec record { nat64; float64 }; + dissolving_neurons_staked_maturity_e8s_equivalent_sum : nat64; + garbage_collectable_neurons_count : nat64; + dissolving_neurons_staked_maturity_e8s_equivalent_buckets : vec record { + nat64; + float64; + }; + neurons_with_invalid_stake_count : nat64; + not_dissolving_neurons_count_buckets : vec record { nat64; nat64 }; + ect_neuron_count : nat64; + total_supply_icp : nat64; + neurons_with_less_than_6_months_dissolve_delay_count : nat64; + dissolved_neurons_count : nat64; + community_fund_total_maturity_e8s_equivalent : nat64; + total_staked_e8s_seed : nat64; + total_staked_maturity_e8s_equivalent_ect : nat64; + total_staked_e8s : nat64; + not_dissolving_neurons_count : nat64; + total_locked_e8s : nat64; + neurons_fund_total_active_neurons : nat64; + total_staked_maturity_e8s_equivalent : nat64; + not_dissolving_neurons_e8s_buckets_ect : vec record { nat64; float64 }; + total_staked_e8s_ect : nat64; + not_dissolving_neurons_staked_maturity_e8s_equivalent_sum : nat64; + dissolved_neurons_e8s : nat64; + dissolving_neurons_e8s_buckets_seed : vec record { nat64; float64 }; + neurons_with_less_than_6_months_dissolve_delay_e8s : nat64; + not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets : vec record { + nat64; + float64; + }; + dissolving_neurons_count_buckets : vec record { nat64; nat64 }; + dissolving_neurons_e8s_buckets_ect : vec record { nat64; float64 }; + dissolving_neurons_count : nat64; + dissolving_neurons_e8s_buckets : vec record { nat64; float64 }; + total_staked_maturity_e8s_equivalent_seed : nat64; + community_fund_total_staked_e8s : nat64; + not_dissolving_neurons_e8s_buckets_seed : vec record { nat64; float64 }; + timestamp_seconds : nat64; + seed_neuron_count : nat64; +}; +type GovernanceError = record { error_message : text; error_type : int32 }; +type GovernanceParameters = record { + neuron_maximum_dissolve_delay_bonus : opt Percentage; + neuron_maximum_age_for_age_bonus : opt Duration; + neuron_maximum_dissolve_delay : opt Duration; + neuron_minimum_dissolve_delay_to_vote : opt Duration; + neuron_maximum_age_bonus : opt Percentage; + neuron_minimum_stake : opt Tokens; + proposal_wait_for_quiet_deadline_increase : opt Duration; + proposal_initial_voting_period : opt Duration; + proposal_rejection_fee : opt Tokens; + voting_reward_parameters : opt VotingRewardParameters; +}; +type IdealMatchedParticipationFunction = record { + serialized_representation : opt text; +}; +type Image = record { base64_encoding : opt text }; +type IncreaseDissolveDelay = record { + additional_dissolve_delay_seconds : nat32; +}; +type InitialTokenDistribution = record { + treasury_distribution : opt SwapDistribution; + developer_distribution : opt DeveloperDistribution; + swap_distribution : opt SwapDistribution; +}; +type KnownNeuron = record { + id : opt NeuronId; + known_neuron_data : opt KnownNeuronData; +}; +type KnownNeuronData = record { name : text; description : opt text }; +type LedgerParameters = record { + transaction_fee : opt Tokens; + token_symbol : opt text; + token_logo : opt Image; + token_name : opt text; +}; +type ListKnownNeuronsResponse = record { known_neurons : vec KnownNeuron }; +type ListNeurons = record { + neuron_ids : vec nat64; + include_neurons_readable_by_caller : bool; +}; +type ListNeuronsResponse = record { + neuron_infos : vec record { nat64; NeuronInfo }; + full_neurons : vec Neuron; +}; +type ListNodeProvidersResponse = record { node_providers : vec NodeProvider }; +type ListProposalInfo = record { + include_reward_status : vec int32; + omit_large_fields : opt bool; + before_proposal : opt NeuronId; + limit : nat32; + exclude_topic : vec int32; + include_all_manage_neuron_proposals : opt bool; + include_status : vec int32; +}; +type ListProposalInfoResponse = record { proposal_info : vec ProposalInfo }; +type MakeProposalResponse = record { + message : opt text; + proposal_id : opt NeuronId; +}; +type MakingSnsProposal = record { + proposal : opt Proposal; + caller : opt principal; + proposer_id : opt NeuronId; +}; +type ManageNeuron = record { + id : opt NeuronId; + command : opt Command; + neuron_id_or_subaccount : opt NeuronIdOrSubaccount; +}; +type ManageNeuronResponse = record { command : opt Command_1 }; +type Merge = record { source_neuron_id : opt NeuronId }; +type MergeMaturity = record { percentage_to_merge : nat32 }; +type MergeMaturityResponse = record { + merged_maturity_e8s : nat64; + new_stake_e8s : nat64; +}; +type MergeResponse = record { + target_neuron : opt Neuron; + source_neuron : opt Neuron; + target_neuron_info : opt NeuronInfo; + source_neuron_info : opt NeuronInfo; +}; +type Migration = record { + status : opt int32; + failure_reason : opt text; + progress : opt Progress; +}; +type Migrations = record { + neuron_indexes_migration : opt Migration; + copy_inactive_neurons_to_stable_memory_migration : opt Migration; +}; +type MostRecentMonthlyNodeProviderRewards = record { + timestamp : nat64; + rewards : vec RewardNodeProvider; +}; +type Motion = record { motion_text : text }; +type NetworkEconomics = record { + neuron_minimum_stake_e8s : nat64; + max_proposals_to_keep_per_topic : nat32; + neuron_management_fee_per_proposal_e8s : nat64; + reject_cost_e8s : nat64; + transaction_fee_e8s : nat64; + neuron_spawn_dissolve_delay_seconds : nat64; + minimum_icp_xdr_rate : nat64; + maximum_node_provider_rewards_e8s : nat64; + neurons_fund_economics : opt NeuronsFundEconomics; +}; +type Neuron = record { + id : opt NeuronId; + staked_maturity_e8s_equivalent : opt nat64; + controller : opt principal; + recent_ballots : vec BallotInfo; + kyc_verified : bool; + neuron_type : opt int32; + not_for_profit : bool; + maturity_e8s_equivalent : nat64; + cached_neuron_stake_e8s : nat64; + created_timestamp_seconds : nat64; + auto_stake_maturity : opt bool; + aging_since_timestamp_seconds : nat64; + hot_keys : vec principal; + account : blob; + joined_community_fund_timestamp_seconds : opt nat64; + dissolve_state : opt DissolveState; + followees : vec record { int32; Followees }; + neuron_fees_e8s : nat64; + transfer : opt NeuronStakeTransfer; + known_neuron_data : opt KnownNeuronData; + spawn_at_timestamp_seconds : opt nat64; +}; +type NeuronBasketConstructionParameters = record { + dissolve_delay_interval : opt Duration; + count : opt nat64; +}; +type NeuronBasketConstructionParameters_1 = record { + dissolve_delay_interval_seconds : nat64; + count : nat64; +}; +type NeuronDistribution = record { + controller : opt principal; + dissolve_delay : opt Duration; + memo : opt nat64; + vesting_period : opt Duration; + stake : opt Tokens; +}; +type NeuronId = record { id : nat64 }; +type NeuronIdOrSubaccount = variant { Subaccount : blob; NeuronId : NeuronId }; +type NeuronInFlightCommand = record { + command : opt Command_2; + timestamp : nat64; +}; +type NeuronInfo = record { + dissolve_delay_seconds : nat64; + recent_ballots : vec BallotInfo; + neuron_type : opt int32; + created_timestamp_seconds : nat64; + state : int32; + stake_e8s : nat64; + joined_community_fund_timestamp_seconds : opt nat64; + retrieved_at_timestamp_seconds : nat64; + known_neuron_data : opt KnownNeuronData; + voting_power : nat64; + age_seconds : nat64; +}; +type NeuronStakeTransfer = record { + to_subaccount : blob; + neuron_stake_e8s : nat64; + from : opt principal; + memo : nat64; + from_subaccount : blob; + transfer_timestamp : nat64; + block_height : nat64; +}; +type NeuronsFundAuditInfo = record { + final_neurons_fund_participation : opt NeuronsFundParticipation; + initial_neurons_fund_participation : opt NeuronsFundParticipation; + neurons_fund_refunds : opt NeuronsFundSnapshot; +}; +type NeuronsFundData = record { + final_neurons_fund_participation : opt NeuronsFundParticipation; + initial_neurons_fund_participation : opt NeuronsFundParticipation; + neurons_fund_refunds : opt NeuronsFundSnapshot; +}; +type NeuronsFundEconomics = record { + maximum_icp_xdr_rate : opt Percentage; + neurons_fund_matched_funding_curve_coefficients : opt NeuronsFundMatchedFundingCurveCoefficients; + max_theoretical_neurons_fund_participation_amount_xdr : opt Decimal; + minimum_icp_xdr_rate : opt Percentage; +}; +type NeuronsFundMatchedFundingCurveCoefficients = record { + contribution_threshold_xdr : opt Decimal; + one_third_participation_milestone_xdr : opt Decimal; + full_participation_milestone_xdr : opt Decimal; +}; +type NeuronsFundNeuron = record { + hotkey_principal : opt text; + is_capped : opt bool; + nns_neuron_id : opt nat64; + amount_icp_e8s : opt nat64; +}; +type NeuronsFundNeuronPortion = record { + hotkey_principal : opt principal; + is_capped : opt bool; + maturity_equivalent_icp_e8s : opt nat64; + nns_neuron_id : opt NeuronId; + amount_icp_e8s : opt nat64; +}; +type NeuronsFundParticipation = record { + total_maturity_equivalent_icp_e8s : opt nat64; + intended_neurons_fund_participation_icp_e8s : opt nat64; + direct_participation_icp_e8s : opt nat64; + swap_participation_limits : opt SwapParticipationLimits; + max_neurons_fund_swap_participation_icp_e8s : opt nat64; + neurons_fund_reserves : opt NeuronsFundSnapshot; + ideal_matched_participation_function : opt IdealMatchedParticipationFunction; + allocated_neurons_fund_participation_icp_e8s : opt nat64; +}; +type NeuronsFundSnapshot = record { + neurons_fund_neuron_portions : vec NeuronsFundNeuronPortion; +}; +type NodeProvider = record { + id : opt principal; + reward_account : opt AccountIdentifier; +}; +type Ok = record { neurons_fund_audit_info : opt NeuronsFundAuditInfo }; +type Ok_1 = record { neurons_fund_neuron_portions : vec NeuronsFundNeuron }; +type OpenSnsTokenSwap = record { + community_fund_investment_e8s : opt nat64; + target_swap_canister_id : opt principal; + params : opt Params; +}; +type Operation = variant { + RemoveHotKey : RemoveHotKey; + AddHotKey : AddHotKey; + ChangeAutoStakeMaturity : ChangeAutoStakeMaturity; + StopDissolving : record {}; + StartDissolving : record {}; + IncreaseDissolveDelay : IncreaseDissolveDelay; + JoinCommunityFund : record {}; + LeaveCommunityFund : record {}; + SetDissolveTimestamp : SetDissolveTimestamp; +}; +type Params = record { + min_participant_icp_e8s : nat64; + neuron_basket_construction_parameters : opt NeuronBasketConstructionParameters_1; + max_icp_e8s : nat64; + swap_due_timestamp_seconds : nat64; + min_participants : nat32; + sns_token_e8s : nat64; + sale_delay_seconds : opt nat64; + max_participant_icp_e8s : nat64; + min_direct_participation_icp_e8s : opt nat64; + min_icp_e8s : nat64; + max_direct_participation_icp_e8s : opt nat64; +}; +type Percentage = record { basis_points : opt nat64 }; +type Progress = variant { LastNeuronId : NeuronId }; +type Proposal = record { + url : text; + title : opt text; + action : opt Action; + summary : text; +}; +type ProposalData = record { + id : opt NeuronId; + failure_reason : opt GovernanceError; + cf_participants : vec CfParticipant; + ballots : vec record { nat64; Ballot }; + proposal_timestamp_seconds : nat64; + reward_event_round : nat64; + failed_timestamp_seconds : nat64; + neurons_fund_data : opt NeuronsFundData; + reject_cost_e8s : nat64; + derived_proposal_information : opt DerivedProposalInformation; + latest_tally : opt Tally; + sns_token_swap_lifecycle : opt int32; + decided_timestamp_seconds : nat64; + proposal : opt Proposal; + proposer : opt NeuronId; + wait_for_quiet_state : opt WaitForQuietState; + executed_timestamp_seconds : nat64; + original_total_community_fund_maturity_e8s_equivalent : opt nat64; +}; +type ProposalInfo = record { + id : opt NeuronId; + status : int32; + topic : int32; + failure_reason : opt GovernanceError; + ballots : vec record { nat64; Ballot }; + proposal_timestamp_seconds : nat64; + reward_event_round : nat64; + deadline_timestamp_seconds : opt nat64; + failed_timestamp_seconds : nat64; + reject_cost_e8s : nat64; + derived_proposal_information : opt DerivedProposalInformation; + latest_tally : opt Tally; + reward_status : int32; + decided_timestamp_seconds : nat64; + proposal : opt Proposal; + proposer : opt NeuronId; + executed_timestamp_seconds : nat64; +}; +type RegisterVote = record { vote : int32; proposal : opt NeuronId }; +type RemoveHotKey = record { hot_key_to_remove : opt principal }; +type RestoreAgingNeuronGroup = record { + count : opt nat64; + previous_total_stake_e8s : opt nat64; + current_total_stake_e8s : opt nat64; + group_type : int32; +}; +type RestoreAgingSummary = record { + groups : vec RestoreAgingNeuronGroup; + timestamp_seconds : opt nat64; +}; +type Result = variant { Ok; Err : GovernanceError }; +type Result_1 = variant { Error : GovernanceError; NeuronId : NeuronId }; +type Result_10 = variant { Ok : Ok_1; Err : GovernanceError }; +type Result_2 = variant { Ok : Neuron; Err : GovernanceError }; +type Result_3 = variant { Ok : GovernanceCachedMetrics; Err : GovernanceError }; +type Result_4 = variant { Ok : RewardNodeProviders; Err : GovernanceError }; +type Result_5 = variant { Ok : NeuronInfo; Err : GovernanceError }; +type Result_6 = variant { Ok : Ok; Err : GovernanceError }; +type Result_7 = variant { Ok : NodeProvider; Err : GovernanceError }; +type Result_8 = variant { Committed : Committed; Aborted : record {} }; +type Result_9 = variant { Committed : Committed_1; Aborted : record {} }; +type RewardEvent = record { + rounds_since_last_distribution : opt nat64; + day_after_genesis : nat64; + actual_timestamp_seconds : nat64; + total_available_e8s_equivalent : nat64; + latest_round_available_e8s_equivalent : opt nat64; + distributed_e8s_equivalent : nat64; + settled_proposals : vec NeuronId; +}; +type RewardMode = variant { + RewardToNeuron : RewardToNeuron; + RewardToAccount : RewardToAccount; +}; +type RewardNodeProvider = record { + node_provider : opt NodeProvider; + reward_mode : opt RewardMode; + amount_e8s : nat64; +}; +type RewardNodeProviders = record { + use_registry_derived_rewards : opt bool; + rewards : vec RewardNodeProvider; +}; +type RewardToAccount = record { to_account : opt AccountIdentifier }; +type RewardToNeuron = record { dissolve_delay_seconds : nat64 }; +type SetDefaultFollowees = record { + default_followees : vec record { int32; Followees }; +}; +type SetDissolveTimestamp = record { dissolve_timestamp_seconds : nat64 }; +type SetOpenTimeWindowRequest = record { open_time_window : opt TimeWindow }; +type SetSnsTokenSwapOpenTimeWindow = record { + request : opt SetOpenTimeWindowRequest; + swap_canister_id : opt principal; +}; +type SettleCommunityFundParticipation = record { + result : opt Result_8; + open_sns_token_swap_proposal_id : opt nat64; +}; +type SettleNeuronsFundParticipationRequest = record { + result : opt Result_9; + nns_proposal_id : opt nat64; +}; +type SettleNeuronsFundParticipationResponse = record { result : opt Result_10 }; +type Spawn = record { + percentage_to_spawn : opt nat32; + new_controller : opt principal; + nonce : opt nat64; +}; +type SpawnResponse = record { created_neuron_id : opt NeuronId }; +type Split = record { amount_e8s : nat64 }; +type StakeMaturity = record { percentage_to_stake : opt nat32 }; +type StakeMaturityResponse = record { + maturity_e8s : nat64; + staked_maturity_e8s : nat64; +}; +type SwapBackgroundInformation = record { + ledger_index_canister_summary : opt CanisterSummary; + fallback_controller_principal_ids : vec principal; + ledger_archive_canister_summaries : vec CanisterSummary; + ledger_canister_summary : opt CanisterSummary; + swap_canister_summary : opt CanisterSummary; + governance_canister_summary : opt CanisterSummary; + root_canister_summary : opt CanisterSummary; + dapp_canister_summaries : vec CanisterSummary; +}; +type SwapDistribution = record { total : opt Tokens }; +type SwapParameters = record { + minimum_participants : opt nat64; + neurons_fund_participation : opt bool; + duration : opt Duration; + neuron_basket_construction_parameters : opt NeuronBasketConstructionParameters; + confirmation_text : opt text; + maximum_participant_icp : opt Tokens; + minimum_icp : opt Tokens; + minimum_direct_participation_icp : opt Tokens; + minimum_participant_icp : opt Tokens; + start_time : opt GlobalTimeOfDay; + maximum_direct_participation_icp : opt Tokens; + maximum_icp : opt Tokens; + neurons_fund_investment_icp : opt Tokens; + restricted_countries : opt Countries; +}; +type SwapParticipationLimits = record { + min_participant_icp_e8s : opt nat64; + max_participant_icp_e8s : opt nat64; + min_direct_participation_icp_e8s : opt nat64; + max_direct_participation_icp_e8s : opt nat64; +}; +type Tally = record { + no : nat64; + yes : nat64; + total : nat64; + timestamp_seconds : nat64; +}; +type TimeWindow = record { + start_timestamp_seconds : nat64; + end_timestamp_seconds : nat64; +}; +type Tokens = record { e8s : opt nat64 }; +type UpdateNodeProvider = record { reward_account : opt AccountIdentifier }; +type VotingRewardParameters = record { + reward_rate_transition_duration : opt Duration; + initial_reward_rate : opt Percentage; + final_reward_rate : opt Percentage; +}; +type WaitForQuietState = record { current_deadline_timestamp_seconds : nat64 }; +type XdrConversionRate = record { + xdr_permyriad_per_icp : opt nat64; + timestamp_seconds : opt nat64; +}; +service : (Governance) -> { + claim_gtc_neurons : (principal, vec NeuronId) -> (Result); + claim_or_refresh_neuron_from_account : (ClaimOrRefreshNeuronFromAccount) -> ( + ClaimOrRefreshNeuronFromAccountResponse, + ); + get_build_metadata : () -> (text) query; + get_full_neuron : (nat64) -> (Result_2) query; + get_full_neuron_by_id_or_subaccount : (NeuronIdOrSubaccount) -> ( + Result_2, + ) query; + get_latest_reward_event : () -> (RewardEvent) query; + get_metrics : () -> (Result_3) query; + get_monthly_node_provider_rewards : () -> (Result_4); + get_most_recent_monthly_node_provider_rewards : () -> ( + opt MostRecentMonthlyNodeProviderRewards, + ) query; + get_network_economics_parameters : () -> (NetworkEconomics) query; + get_neuron_ids : () -> (vec nat64) query; + get_neuron_info : (nat64) -> (Result_5) query; + get_neuron_info_by_id_or_subaccount : (NeuronIdOrSubaccount) -> ( + Result_5, + ) query; + get_neurons_fund_audit_info : (GetNeuronsFundAuditInfoRequest) -> ( + GetNeuronsFundAuditInfoResponse, + ) query; + get_node_provider_by_caller : (null) -> (Result_7) query; + get_pending_proposals : () -> (vec ProposalInfo) query; + get_proposal_info : (nat64) -> (opt ProposalInfo) query; + get_restore_aging_summary : () -> (RestoreAgingSummary) query; + list_known_neurons : () -> (ListKnownNeuronsResponse) query; + list_neurons : (ListNeurons) -> (ListNeuronsResponse) query; + list_node_providers : () -> (ListNodeProvidersResponse) query; + list_proposals : (ListProposalInfo) -> (ListProposalInfoResponse) query; + manage_neuron : (ManageNeuron) -> (ManageNeuronResponse); + settle_community_fund_participation : (SettleCommunityFundParticipation) -> ( + Result, + ); + settle_neurons_fund_participation : ( + SettleNeuronsFundParticipationRequest, + ) -> (SettleNeuronsFundParticipationResponse); + simulate_manage_neuron : (ManageNeuron) -> (ManageNeuronResponse); + transfer_gtc_neuron : (NeuronId, NeuronId) -> (Result); + update_node_provider : (UpdateNodeProvider) -> (Result); +} \ No newline at end of file diff --git a/cli/src/declarations/governance.idl.js b/cli/src/declarations/governance.idl.js new file mode 100644 index 0000000..ff79aab --- /dev/null +++ b/cli/src/declarations/governance.idl.js @@ -0,0 +1,1363 @@ +export const idlFactory = ({IDL}) => { + const Proposal = IDL.Rec(); + const NeuronId = IDL.Record({id: IDL.Nat64}); + const Followees = IDL.Record({followees: IDL.Vec(NeuronId)}); + const KnownNeuronData = IDL.Record({ + name: IDL.Text, + description: IDL.Opt(IDL.Text) + }); + const KnownNeuron = IDL.Record({ + id: IDL.Opt(NeuronId), + known_neuron_data: IDL.Opt(KnownNeuronData) + }); + const Spawn = IDL.Record({ + percentage_to_spawn: IDL.Opt(IDL.Nat32), + new_controller: IDL.Opt(IDL.Principal), + nonce: IDL.Opt(IDL.Nat64) + }); + const Split = IDL.Record({amount_e8s: IDL.Nat64}); + const Follow = IDL.Record({ + topic: IDL.Int32, + followees: IDL.Vec(NeuronId) + }); + const ClaimOrRefreshNeuronFromAccount = IDL.Record({ + controller: IDL.Opt(IDL.Principal), + memo: IDL.Nat64 + }); + const By = IDL.Variant({ + NeuronIdOrSubaccount: IDL.Record({}), + MemoAndController: ClaimOrRefreshNeuronFromAccount, + Memo: IDL.Nat64 + }); + const ClaimOrRefresh = IDL.Record({by: IDL.Opt(By)}); + const RemoveHotKey = IDL.Record({ + hot_key_to_remove: IDL.Opt(IDL.Principal) + }); + const AddHotKey = IDL.Record({new_hot_key: IDL.Opt(IDL.Principal)}); + const ChangeAutoStakeMaturity = IDL.Record({ + requested_setting_for_auto_stake_maturity: IDL.Bool + }); + const IncreaseDissolveDelay = IDL.Record({ + additional_dissolve_delay_seconds: IDL.Nat32 + }); + const SetDissolveTimestamp = IDL.Record({ + dissolve_timestamp_seconds: IDL.Nat64 + }); + const Operation = IDL.Variant({ + RemoveHotKey: RemoveHotKey, + AddHotKey: AddHotKey, + ChangeAutoStakeMaturity: ChangeAutoStakeMaturity, + StopDissolving: IDL.Record({}), + StartDissolving: IDL.Record({}), + IncreaseDissolveDelay: IncreaseDissolveDelay, + JoinCommunityFund: IDL.Record({}), + LeaveCommunityFund: IDL.Record({}), + SetDissolveTimestamp: SetDissolveTimestamp + }); + const Configure = IDL.Record({operation: IDL.Opt(Operation)}); + const RegisterVote = IDL.Record({ + vote: IDL.Int32, + proposal: IDL.Opt(NeuronId) + }); + const Merge = IDL.Record({source_neuron_id: IDL.Opt(NeuronId)}); + const DisburseToNeuron = IDL.Record({ + dissolve_delay_seconds: IDL.Nat64, + kyc_verified: IDL.Bool, + amount_e8s: IDL.Nat64, + new_controller: IDL.Opt(IDL.Principal), + nonce: IDL.Nat64 + }); + const StakeMaturity = IDL.Record({ + percentage_to_stake: IDL.Opt(IDL.Nat32) + }); + const MergeMaturity = IDL.Record({percentage_to_merge: IDL.Nat32}); + const AccountIdentifier = IDL.Record({hash: IDL.Vec(IDL.Nat8)}); + const Amount = IDL.Record({e8s: IDL.Nat64}); + const Disburse = IDL.Record({ + to_account: IDL.Opt(AccountIdentifier), + amount: IDL.Opt(Amount) + }); + const Command = IDL.Variant({ + Spawn: Spawn, + Split: Split, + Follow: Follow, + ClaimOrRefresh: ClaimOrRefresh, + Configure: Configure, + RegisterVote: RegisterVote, + Merge: Merge, + DisburseToNeuron: DisburseToNeuron, + MakeProposal: Proposal, + StakeMaturity: StakeMaturity, + MergeMaturity: MergeMaturity, + Disburse: Disburse + }); + const NeuronIdOrSubaccount = IDL.Variant({ + Subaccount: IDL.Vec(IDL.Nat8), + NeuronId: NeuronId + }); + const ManageNeuron = IDL.Record({ + id: IDL.Opt(NeuronId), + command: IDL.Opt(Command), + neuron_id_or_subaccount: IDL.Opt(NeuronIdOrSubaccount) + }); + const Percentage = IDL.Record({basis_points: IDL.Opt(IDL.Nat64)}); + const Duration = IDL.Record({seconds: IDL.Opt(IDL.Nat64)}); + const Tokens = IDL.Record({e8s: IDL.Opt(IDL.Nat64)}); + const VotingRewardParameters = IDL.Record({ + reward_rate_transition_duration: IDL.Opt(Duration), + initial_reward_rate: IDL.Opt(Percentage), + final_reward_rate: IDL.Opt(Percentage) + }); + const GovernanceParameters = IDL.Record({ + neuron_maximum_dissolve_delay_bonus: IDL.Opt(Percentage), + neuron_maximum_age_for_age_bonus: IDL.Opt(Duration), + neuron_maximum_dissolve_delay: IDL.Opt(Duration), + neuron_minimum_dissolve_delay_to_vote: IDL.Opt(Duration), + neuron_maximum_age_bonus: IDL.Opt(Percentage), + neuron_minimum_stake: IDL.Opt(Tokens), + proposal_wait_for_quiet_deadline_increase: IDL.Opt(Duration), + proposal_initial_voting_period: IDL.Opt(Duration), + proposal_rejection_fee: IDL.Opt(Tokens), + voting_reward_parameters: IDL.Opt(VotingRewardParameters) + }); + const Image = IDL.Record({base64_encoding: IDL.Opt(IDL.Text)}); + const LedgerParameters = IDL.Record({ + transaction_fee: IDL.Opt(Tokens), + token_symbol: IDL.Opt(IDL.Text), + token_logo: IDL.Opt(Image), + token_name: IDL.Opt(IDL.Text) + }); + const Canister = IDL.Record({id: IDL.Opt(IDL.Principal)}); + const NeuronBasketConstructionParameters = IDL.Record({ + dissolve_delay_interval: IDL.Opt(Duration), + count: IDL.Opt(IDL.Nat64) + }); + const GlobalTimeOfDay = IDL.Record({ + seconds_after_utc_midnight: IDL.Opt(IDL.Nat64) + }); + const Countries = IDL.Record({iso_codes: IDL.Vec(IDL.Text)}); + const SwapParameters = IDL.Record({ + minimum_participants: IDL.Opt(IDL.Nat64), + neurons_fund_participation: IDL.Opt(IDL.Bool), + duration: IDL.Opt(Duration), + neuron_basket_construction_parameters: IDL.Opt(NeuronBasketConstructionParameters), + confirmation_text: IDL.Opt(IDL.Text), + maximum_participant_icp: IDL.Opt(Tokens), + minimum_icp: IDL.Opt(Tokens), + minimum_direct_participation_icp: IDL.Opt(Tokens), + minimum_participant_icp: IDL.Opt(Tokens), + start_time: IDL.Opt(GlobalTimeOfDay), + maximum_direct_participation_icp: IDL.Opt(Tokens), + maximum_icp: IDL.Opt(Tokens), + neurons_fund_investment_icp: IDL.Opt(Tokens), + restricted_countries: IDL.Opt(Countries) + }); + const SwapDistribution = IDL.Record({total: IDL.Opt(Tokens)}); + const NeuronDistribution = IDL.Record({ + controller: IDL.Opt(IDL.Principal), + dissolve_delay: IDL.Opt(Duration), + memo: IDL.Opt(IDL.Nat64), + vesting_period: IDL.Opt(Duration), + stake: IDL.Opt(Tokens) + }); + const DeveloperDistribution = IDL.Record({ + developer_neurons: IDL.Vec(NeuronDistribution) + }); + const InitialTokenDistribution = IDL.Record({ + treasury_distribution: IDL.Opt(SwapDistribution), + developer_distribution: IDL.Opt(DeveloperDistribution), + swap_distribution: IDL.Opt(SwapDistribution) + }); + const CreateServiceNervousSystem = IDL.Record({ + url: IDL.Opt(IDL.Text), + governance_parameters: IDL.Opt(GovernanceParameters), + fallback_controller_principal_ids: IDL.Vec(IDL.Principal), + logo: IDL.Opt(Image), + name: IDL.Opt(IDL.Text), + ledger_parameters: IDL.Opt(LedgerParameters), + description: IDL.Opt(IDL.Text), + dapp_canisters: IDL.Vec(Canister), + swap_parameters: IDL.Opt(SwapParameters), + initial_token_distribution: IDL.Opt(InitialTokenDistribution) + }); + const ExecuteNnsFunction = IDL.Record({ + nns_function: IDL.Int32, + payload: IDL.Vec(IDL.Nat8) + }); + const NodeProvider = IDL.Record({ + id: IDL.Opt(IDL.Principal), + reward_account: IDL.Opt(AccountIdentifier) + }); + const RewardToNeuron = IDL.Record({dissolve_delay_seconds: IDL.Nat64}); + const RewardToAccount = IDL.Record({ + to_account: IDL.Opt(AccountIdentifier) + }); + const RewardMode = IDL.Variant({ + RewardToNeuron: RewardToNeuron, + RewardToAccount: RewardToAccount + }); + const RewardNodeProvider = IDL.Record({ + node_provider: IDL.Opt(NodeProvider), + reward_mode: IDL.Opt(RewardMode), + amount_e8s: IDL.Nat64 + }); + const NeuronBasketConstructionParameters_1 = IDL.Record({ + dissolve_delay_interval_seconds: IDL.Nat64, + count: IDL.Nat64 + }); + const Params = IDL.Record({ + min_participant_icp_e8s: IDL.Nat64, + neuron_basket_construction_parameters: IDL.Opt(NeuronBasketConstructionParameters_1), + max_icp_e8s: IDL.Nat64, + swap_due_timestamp_seconds: IDL.Nat64, + min_participants: IDL.Nat32, + sns_token_e8s: IDL.Nat64, + sale_delay_seconds: IDL.Opt(IDL.Nat64), + max_participant_icp_e8s: IDL.Nat64, + min_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), + min_icp_e8s: IDL.Nat64, + max_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const OpenSnsTokenSwap = IDL.Record({ + community_fund_investment_e8s: IDL.Opt(IDL.Nat64), + target_swap_canister_id: IDL.Opt(IDL.Principal), + params: IDL.Opt(Params) + }); + const TimeWindow = IDL.Record({ + start_timestamp_seconds: IDL.Nat64, + end_timestamp_seconds: IDL.Nat64 + }); + const SetOpenTimeWindowRequest = IDL.Record({ + open_time_window: IDL.Opt(TimeWindow) + }); + const SetSnsTokenSwapOpenTimeWindow = IDL.Record({ + request: IDL.Opt(SetOpenTimeWindowRequest), + swap_canister_id: IDL.Opt(IDL.Principal) + }); + const SetDefaultFollowees = IDL.Record({ + default_followees: IDL.Vec(IDL.Tuple(IDL.Int32, Followees)) + }); + const RewardNodeProviders = IDL.Record({ + use_registry_derived_rewards: IDL.Opt(IDL.Bool), + rewards: IDL.Vec(RewardNodeProvider) + }); + const Decimal = IDL.Record({human_readable: IDL.Opt(IDL.Text)}); + const NeuronsFundMatchedFundingCurveCoefficients = IDL.Record({ + contribution_threshold_xdr: IDL.Opt(Decimal), + one_third_participation_milestone_xdr: IDL.Opt(Decimal), + full_participation_milestone_xdr: IDL.Opt(Decimal) + }); + const NeuronsFundEconomics = IDL.Record({ + maximum_icp_xdr_rate: IDL.Opt(Percentage), + neurons_fund_matched_funding_curve_coefficients: IDL.Opt( + NeuronsFundMatchedFundingCurveCoefficients + ), + max_theoretical_neurons_fund_participation_amount_xdr: IDL.Opt(Decimal), + minimum_icp_xdr_rate: IDL.Opt(Percentage) + }); + const NetworkEconomics = IDL.Record({ + neuron_minimum_stake_e8s: IDL.Nat64, + max_proposals_to_keep_per_topic: IDL.Nat32, + neuron_management_fee_per_proposal_e8s: IDL.Nat64, + reject_cost_e8s: IDL.Nat64, + transaction_fee_e8s: IDL.Nat64, + neuron_spawn_dissolve_delay_seconds: IDL.Nat64, + minimum_icp_xdr_rate: IDL.Nat64, + maximum_node_provider_rewards_e8s: IDL.Nat64, + neurons_fund_economics: IDL.Opt(NeuronsFundEconomics) + }); + const ApproveGenesisKyc = IDL.Record({ + principals: IDL.Vec(IDL.Principal) + }); + const Change = IDL.Variant({ + ToRemove: NodeProvider, + ToAdd: NodeProvider + }); + const AddOrRemoveNodeProvider = IDL.Record({change: IDL.Opt(Change)}); + const Motion = IDL.Record({motion_text: IDL.Text}); + const Action = IDL.Variant({ + RegisterKnownNeuron: KnownNeuron, + ManageNeuron: ManageNeuron, + CreateServiceNervousSystem: CreateServiceNervousSystem, + ExecuteNnsFunction: ExecuteNnsFunction, + RewardNodeProvider: RewardNodeProvider, + OpenSnsTokenSwap: OpenSnsTokenSwap, + SetSnsTokenSwapOpenTimeWindow: SetSnsTokenSwapOpenTimeWindow, + SetDefaultFollowees: SetDefaultFollowees, + RewardNodeProviders: RewardNodeProviders, + ManageNetworkEconomics: NetworkEconomics, + ApproveGenesisKyc: ApproveGenesisKyc, + AddOrRemoveNodeProvider: AddOrRemoveNodeProvider, + Motion: Motion + }); + Proposal.fill( + IDL.Record({ + url: IDL.Text, + title: IDL.Opt(IDL.Text), + action: IDL.Opt(Action), + summary: IDL.Text + }) + ); + const MakingSnsProposal = IDL.Record({ + proposal: IDL.Opt(Proposal), + caller: IDL.Opt(IDL.Principal), + proposer_id: IDL.Opt(NeuronId) + }); + const MostRecentMonthlyNodeProviderRewards = IDL.Record({ + timestamp: IDL.Nat64, + rewards: IDL.Vec(RewardNodeProvider) + }); + const GovernanceCachedMetrics = IDL.Record({ + total_maturity_e8s_equivalent: IDL.Nat64, + not_dissolving_neurons_e8s_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + dissolving_neurons_staked_maturity_e8s_equivalent_sum: IDL.Nat64, + garbage_collectable_neurons_count: IDL.Nat64, + dissolving_neurons_staked_maturity_e8s_equivalent_buckets: IDL.Vec( + IDL.Tuple(IDL.Nat64, IDL.Float64) + ), + neurons_with_invalid_stake_count: IDL.Nat64, + not_dissolving_neurons_count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + ect_neuron_count: IDL.Nat64, + total_supply_icp: IDL.Nat64, + neurons_with_less_than_6_months_dissolve_delay_count: IDL.Nat64, + dissolved_neurons_count: IDL.Nat64, + community_fund_total_maturity_e8s_equivalent: IDL.Nat64, + total_staked_e8s_seed: IDL.Nat64, + total_staked_maturity_e8s_equivalent_ect: IDL.Nat64, + total_staked_e8s: IDL.Nat64, + not_dissolving_neurons_count: IDL.Nat64, + total_locked_e8s: IDL.Nat64, + neurons_fund_total_active_neurons: IDL.Nat64, + total_staked_maturity_e8s_equivalent: IDL.Nat64, + not_dissolving_neurons_e8s_buckets_ect: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + total_staked_e8s_ect: IDL.Nat64, + not_dissolving_neurons_staked_maturity_e8s_equivalent_sum: IDL.Nat64, + dissolved_neurons_e8s: IDL.Nat64, + dissolving_neurons_e8s_buckets_seed: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + neurons_with_less_than_6_months_dissolve_delay_e8s: IDL.Nat64, + not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets: IDL.Vec( + IDL.Tuple(IDL.Nat64, IDL.Float64) + ), + dissolving_neurons_count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + dissolving_neurons_e8s_buckets_ect: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + dissolving_neurons_count: IDL.Nat64, + dissolving_neurons_e8s_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + total_staked_maturity_e8s_equivalent_seed: IDL.Nat64, + community_fund_total_staked_e8s: IDL.Nat64, + not_dissolving_neurons_e8s_buckets_seed: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + timestamp_seconds: IDL.Nat64, + seed_neuron_count: IDL.Nat64 + }); + const RestoreAgingNeuronGroup = IDL.Record({ + count: IDL.Opt(IDL.Nat64), + previous_total_stake_e8s: IDL.Opt(IDL.Nat64), + current_total_stake_e8s: IDL.Opt(IDL.Nat64), + group_type: IDL.Int32 + }); + const RestoreAgingSummary = IDL.Record({ + groups: IDL.Vec(RestoreAgingNeuronGroup), + timestamp_seconds: IDL.Opt(IDL.Nat64) + }); + const RewardEvent = IDL.Record({ + rounds_since_last_distribution: IDL.Opt(IDL.Nat64), + day_after_genesis: IDL.Nat64, + actual_timestamp_seconds: IDL.Nat64, + total_available_e8s_equivalent: IDL.Nat64, + latest_round_available_e8s_equivalent: IDL.Opt(IDL.Nat64), + distributed_e8s_equivalent: IDL.Nat64, + settled_proposals: IDL.Vec(NeuronId) + }); + const NeuronStakeTransfer = IDL.Record({ + to_subaccount: IDL.Vec(IDL.Nat8), + neuron_stake_e8s: IDL.Nat64, + from: IDL.Opt(IDL.Principal), + memo: IDL.Nat64, + from_subaccount: IDL.Vec(IDL.Nat8), + transfer_timestamp: IDL.Nat64, + block_height: IDL.Nat64 + }); + const Followers = IDL.Record({followers: IDL.Vec(NeuronId)}); + const FollowersMap = IDL.Record({ + followers_map: IDL.Vec(IDL.Tuple(IDL.Nat64, Followers)) + }); + const Progress = IDL.Variant({LastNeuronId: NeuronId}); + const Migration = IDL.Record({ + status: IDL.Opt(IDL.Int32), + failure_reason: IDL.Opt(IDL.Text), + progress: IDL.Opt(Progress) + }); + const Migrations = IDL.Record({ + neuron_indexes_migration: IDL.Opt(Migration), + copy_inactive_neurons_to_stable_memory_migration: IDL.Opt(Migration) + }); + const GovernanceError = IDL.Record({ + error_message: IDL.Text, + error_type: IDL.Int32 + }); + const CfNeuron = IDL.Record({ + has_created_neuron_recipes: IDL.Opt(IDL.Bool), + nns_neuron_id: IDL.Nat64, + amount_icp_e8s: IDL.Nat64 + }); + const CfParticipant = IDL.Record({ + hotkey_principal: IDL.Text, + cf_neurons: IDL.Vec(CfNeuron) + }); + const Ballot = IDL.Record({vote: IDL.Int32, voting_power: IDL.Nat64}); + const SwapParticipationLimits = IDL.Record({ + min_participant_icp_e8s: IDL.Opt(IDL.Nat64), + max_participant_icp_e8s: IDL.Opt(IDL.Nat64), + min_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), + max_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const NeuronsFundNeuronPortion = IDL.Record({ + hotkey_principal: IDL.Opt(IDL.Principal), + is_capped: IDL.Opt(IDL.Bool), + maturity_equivalent_icp_e8s: IDL.Opt(IDL.Nat64), + nns_neuron_id: IDL.Opt(NeuronId), + amount_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const NeuronsFundSnapshot = IDL.Record({ + neurons_fund_neuron_portions: IDL.Vec(NeuronsFundNeuronPortion) + }); + const IdealMatchedParticipationFunction = IDL.Record({ + serialized_representation: IDL.Opt(IDL.Text) + }); + const NeuronsFundParticipation = IDL.Record({ + total_maturity_equivalent_icp_e8s: IDL.Opt(IDL.Nat64), + intended_neurons_fund_participation_icp_e8s: IDL.Opt(IDL.Nat64), + direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), + swap_participation_limits: IDL.Opt(SwapParticipationLimits), + max_neurons_fund_swap_participation_icp_e8s: IDL.Opt(IDL.Nat64), + neurons_fund_reserves: IDL.Opt(NeuronsFundSnapshot), + ideal_matched_participation_function: IDL.Opt(IdealMatchedParticipationFunction), + allocated_neurons_fund_participation_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const NeuronsFundData = IDL.Record({ + final_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), + initial_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), + neurons_fund_refunds: IDL.Opt(NeuronsFundSnapshot) + }); + const CanisterStatusResultV2 = IDL.Record({ + status: IDL.Opt(IDL.Int32), + freezing_threshold: IDL.Opt(IDL.Nat64), + controllers: IDL.Vec(IDL.Principal), + memory_size: IDL.Opt(IDL.Nat64), + cycles: IDL.Opt(IDL.Nat64), + idle_cycles_burned_per_day: IDL.Opt(IDL.Nat64), + module_hash: IDL.Vec(IDL.Nat8) + }); + const CanisterSummary = IDL.Record({ + status: IDL.Opt(CanisterStatusResultV2), + canister_id: IDL.Opt(IDL.Principal) + }); + const SwapBackgroundInformation = IDL.Record({ + ledger_index_canister_summary: IDL.Opt(CanisterSummary), + fallback_controller_principal_ids: IDL.Vec(IDL.Principal), + ledger_archive_canister_summaries: IDL.Vec(CanisterSummary), + ledger_canister_summary: IDL.Opt(CanisterSummary), + swap_canister_summary: IDL.Opt(CanisterSummary), + governance_canister_summary: IDL.Opt(CanisterSummary), + root_canister_summary: IDL.Opt(CanisterSummary), + dapp_canister_summaries: IDL.Vec(CanisterSummary) + }); + const DerivedProposalInformation = IDL.Record({ + swap_background_information: IDL.Opt(SwapBackgroundInformation) + }); + const Tally = IDL.Record({ + no: IDL.Nat64, + yes: IDL.Nat64, + total: IDL.Nat64, + timestamp_seconds: IDL.Nat64 + }); + const WaitForQuietState = IDL.Record({ + current_deadline_timestamp_seconds: IDL.Nat64 + }); + const ProposalData = IDL.Record({ + id: IDL.Opt(NeuronId), + failure_reason: IDL.Opt(GovernanceError), + cf_participants: IDL.Vec(CfParticipant), + ballots: IDL.Vec(IDL.Tuple(IDL.Nat64, Ballot)), + proposal_timestamp_seconds: IDL.Nat64, + reward_event_round: IDL.Nat64, + failed_timestamp_seconds: IDL.Nat64, + neurons_fund_data: IDL.Opt(NeuronsFundData), + reject_cost_e8s: IDL.Nat64, + derived_proposal_information: IDL.Opt(DerivedProposalInformation), + latest_tally: IDL.Opt(Tally), + sns_token_swap_lifecycle: IDL.Opt(IDL.Int32), + decided_timestamp_seconds: IDL.Nat64, + proposal: IDL.Opt(Proposal), + proposer: IDL.Opt(NeuronId), + wait_for_quiet_state: IDL.Opt(WaitForQuietState), + executed_timestamp_seconds: IDL.Nat64, + original_total_community_fund_maturity_e8s_equivalent: IDL.Opt(IDL.Nat64) + }); + const XdrConversionRate = IDL.Record({ + xdr_permyriad_per_icp: IDL.Opt(IDL.Nat64), + timestamp_seconds: IDL.Opt(IDL.Nat64) + }); + const Command_2 = IDL.Variant({ + Spawn: NeuronId, + Split: Split, + Configure: Configure, + Merge: Merge, + DisburseToNeuron: DisburseToNeuron, + SyncCommand: IDL.Record({}), + ClaimOrRefreshNeuron: ClaimOrRefresh, + MergeMaturity: MergeMaturity, + Disburse: Disburse + }); + const NeuronInFlightCommand = IDL.Record({ + command: IDL.Opt(Command_2), + timestamp: IDL.Nat64 + }); + const BallotInfo = IDL.Record({ + vote: IDL.Int32, + proposal_id: IDL.Opt(NeuronId) + }); + const DissolveState = IDL.Variant({ + DissolveDelaySeconds: IDL.Nat64, + WhenDissolvedTimestampSeconds: IDL.Nat64 + }); + const Neuron = IDL.Record({ + id: IDL.Opt(NeuronId), + staked_maturity_e8s_equivalent: IDL.Opt(IDL.Nat64), + controller: IDL.Opt(IDL.Principal), + recent_ballots: IDL.Vec(BallotInfo), + kyc_verified: IDL.Bool, + neuron_type: IDL.Opt(IDL.Int32), + not_for_profit: IDL.Bool, + maturity_e8s_equivalent: IDL.Nat64, + cached_neuron_stake_e8s: IDL.Nat64, + created_timestamp_seconds: IDL.Nat64, + auto_stake_maturity: IDL.Opt(IDL.Bool), + aging_since_timestamp_seconds: IDL.Nat64, + hot_keys: IDL.Vec(IDL.Principal), + account: IDL.Vec(IDL.Nat8), + joined_community_fund_timestamp_seconds: IDL.Opt(IDL.Nat64), + dissolve_state: IDL.Opt(DissolveState), + followees: IDL.Vec(IDL.Tuple(IDL.Int32, Followees)), + neuron_fees_e8s: IDL.Nat64, + transfer: IDL.Opt(NeuronStakeTransfer), + known_neuron_data: IDL.Opt(KnownNeuronData), + spawn_at_timestamp_seconds: IDL.Opt(IDL.Nat64) + }); + const Governance = IDL.Record({ + default_followees: IDL.Vec(IDL.Tuple(IDL.Int32, Followees)), + making_sns_proposal: IDL.Opt(MakingSnsProposal), + most_recent_monthly_node_provider_rewards: IDL.Opt(MostRecentMonthlyNodeProviderRewards), + maturity_modulation_last_updated_at_timestamp_seconds: IDL.Opt(IDL.Nat64), + wait_for_quiet_threshold_seconds: IDL.Nat64, + metrics: IDL.Opt(GovernanceCachedMetrics), + neuron_management_voting_period_seconds: IDL.Opt(IDL.Nat64), + node_providers: IDL.Vec(NodeProvider), + cached_daily_maturity_modulation_basis_points: IDL.Opt(IDL.Int32), + economics: IDL.Opt(NetworkEconomics), + restore_aging_summary: IDL.Opt(RestoreAgingSummary), + spawning_neurons: IDL.Opt(IDL.Bool), + latest_reward_event: IDL.Opt(RewardEvent), + to_claim_transfers: IDL.Vec(NeuronStakeTransfer), + short_voting_period_seconds: IDL.Nat64, + topic_followee_index: IDL.Vec(IDL.Tuple(IDL.Int32, FollowersMap)), + migrations: IDL.Opt(Migrations), + proposals: IDL.Vec(IDL.Tuple(IDL.Nat64, ProposalData)), + xdr_conversion_rate: IDL.Opt(XdrConversionRate), + in_flight_commands: IDL.Vec(IDL.Tuple(IDL.Nat64, NeuronInFlightCommand)), + neurons: IDL.Vec(IDL.Tuple(IDL.Nat64, Neuron)), + genesis_timestamp_seconds: IDL.Nat64 + }); + const Result = IDL.Variant({Ok: IDL.Null, Err: GovernanceError}); + const Result_1 = IDL.Variant({ + Error: GovernanceError, + NeuronId: NeuronId + }); + const ClaimOrRefreshNeuronFromAccountResponse = IDL.Record({ + result: IDL.Opt(Result_1) + }); + const Result_2 = IDL.Variant({Ok: Neuron, Err: GovernanceError}); + const Result_3 = IDL.Variant({ + Ok: GovernanceCachedMetrics, + Err: GovernanceError + }); + const Result_4 = IDL.Variant({ + Ok: RewardNodeProviders, + Err: GovernanceError + }); + const NeuronInfo = IDL.Record({ + dissolve_delay_seconds: IDL.Nat64, + recent_ballots: IDL.Vec(BallotInfo), + neuron_type: IDL.Opt(IDL.Int32), + created_timestamp_seconds: IDL.Nat64, + state: IDL.Int32, + stake_e8s: IDL.Nat64, + joined_community_fund_timestamp_seconds: IDL.Opt(IDL.Nat64), + retrieved_at_timestamp_seconds: IDL.Nat64, + known_neuron_data: IDL.Opt(KnownNeuronData), + voting_power: IDL.Nat64, + age_seconds: IDL.Nat64 + }); + const Result_5 = IDL.Variant({Ok: NeuronInfo, Err: GovernanceError}); + const GetNeuronsFundAuditInfoRequest = IDL.Record({ + nns_proposal_id: IDL.Opt(NeuronId) + }); + const NeuronsFundAuditInfo = IDL.Record({ + final_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), + initial_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), + neurons_fund_refunds: IDL.Opt(NeuronsFundSnapshot) + }); + const Ok = IDL.Record({ + neurons_fund_audit_info: IDL.Opt(NeuronsFundAuditInfo) + }); + const Result_6 = IDL.Variant({Ok: Ok, Err: GovernanceError}); + const GetNeuronsFundAuditInfoResponse = IDL.Record({ + result: IDL.Opt(Result_6) + }); + const Result_7 = IDL.Variant({ + Ok: NodeProvider, + Err: GovernanceError + }); + const ProposalInfo = IDL.Record({ + id: IDL.Opt(NeuronId), + status: IDL.Int32, + topic: IDL.Int32, + failure_reason: IDL.Opt(GovernanceError), + ballots: IDL.Vec(IDL.Tuple(IDL.Nat64, Ballot)), + proposal_timestamp_seconds: IDL.Nat64, + reward_event_round: IDL.Nat64, + deadline_timestamp_seconds: IDL.Opt(IDL.Nat64), + failed_timestamp_seconds: IDL.Nat64, + reject_cost_e8s: IDL.Nat64, + derived_proposal_information: IDL.Opt(DerivedProposalInformation), + latest_tally: IDL.Opt(Tally), + reward_status: IDL.Int32, + decided_timestamp_seconds: IDL.Nat64, + proposal: IDL.Opt(Proposal), + proposer: IDL.Opt(NeuronId), + executed_timestamp_seconds: IDL.Nat64 + }); + const ListKnownNeuronsResponse = IDL.Record({ + known_neurons: IDL.Vec(KnownNeuron) + }); + const ListNeurons = IDL.Record({ + neuron_ids: IDL.Vec(IDL.Nat64), + include_neurons_readable_by_caller: IDL.Bool + }); + const ListNeuronsResponse = IDL.Record({ + neuron_infos: IDL.Vec(IDL.Tuple(IDL.Nat64, NeuronInfo)), + full_neurons: IDL.Vec(Neuron) + }); + const ListNodeProvidersResponse = IDL.Record({ + node_providers: IDL.Vec(NodeProvider) + }); + const ListProposalInfo = IDL.Record({ + include_reward_status: IDL.Vec(IDL.Int32), + omit_large_fields: IDL.Opt(IDL.Bool), + before_proposal: IDL.Opt(NeuronId), + limit: IDL.Nat32, + exclude_topic: IDL.Vec(IDL.Int32), + include_all_manage_neuron_proposals: IDL.Opt(IDL.Bool), + include_status: IDL.Vec(IDL.Int32) + }); + const ListProposalInfoResponse = IDL.Record({ + proposal_info: IDL.Vec(ProposalInfo) + }); + const SpawnResponse = IDL.Record({created_neuron_id: IDL.Opt(NeuronId)}); + const ClaimOrRefreshResponse = IDL.Record({ + refreshed_neuron_id: IDL.Opt(NeuronId) + }); + const MergeResponse = IDL.Record({ + target_neuron: IDL.Opt(Neuron), + source_neuron: IDL.Opt(Neuron), + target_neuron_info: IDL.Opt(NeuronInfo), + source_neuron_info: IDL.Opt(NeuronInfo) + }); + const MakeProposalResponse = IDL.Record({ + message: IDL.Opt(IDL.Text), + proposal_id: IDL.Opt(NeuronId) + }); + const StakeMaturityResponse = IDL.Record({ + maturity_e8s: IDL.Nat64, + staked_maturity_e8s: IDL.Nat64 + }); + const MergeMaturityResponse = IDL.Record({ + merged_maturity_e8s: IDL.Nat64, + new_stake_e8s: IDL.Nat64 + }); + const DisburseResponse = IDL.Record({transfer_block_height: IDL.Nat64}); + const Command_1 = IDL.Variant({ + Error: GovernanceError, + Spawn: SpawnResponse, + Split: SpawnResponse, + Follow: IDL.Record({}), + ClaimOrRefresh: ClaimOrRefreshResponse, + Configure: IDL.Record({}), + RegisterVote: IDL.Record({}), + Merge: MergeResponse, + DisburseToNeuron: SpawnResponse, + MakeProposal: MakeProposalResponse, + StakeMaturity: StakeMaturityResponse, + MergeMaturity: MergeMaturityResponse, + Disburse: DisburseResponse + }); + const ManageNeuronResponse = IDL.Record({command: IDL.Opt(Command_1)}); + const Committed = IDL.Record({ + total_direct_contribution_icp_e8s: IDL.Opt(IDL.Nat64), + total_neurons_fund_contribution_icp_e8s: IDL.Opt(IDL.Nat64), + sns_governance_canister_id: IDL.Opt(IDL.Principal) + }); + const Result_8 = IDL.Variant({ + Committed: Committed, + Aborted: IDL.Record({}) + }); + const SettleCommunityFundParticipation = IDL.Record({ + result: IDL.Opt(Result_8), + open_sns_token_swap_proposal_id: IDL.Opt(IDL.Nat64) + }); + const Committed_1 = IDL.Record({ + total_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), + total_neurons_fund_participation_icp_e8s: IDL.Opt(IDL.Nat64), + sns_governance_canister_id: IDL.Opt(IDL.Principal) + }); + const Result_9 = IDL.Variant({ + Committed: Committed_1, + Aborted: IDL.Record({}) + }); + const SettleNeuronsFundParticipationRequest = IDL.Record({ + result: IDL.Opt(Result_9), + nns_proposal_id: IDL.Opt(IDL.Nat64) + }); + const NeuronsFundNeuron = IDL.Record({ + hotkey_principal: IDL.Opt(IDL.Text), + is_capped: IDL.Opt(IDL.Bool), + nns_neuron_id: IDL.Opt(IDL.Nat64), + amount_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const Ok_1 = IDL.Record({ + neurons_fund_neuron_portions: IDL.Vec(NeuronsFundNeuron) + }); + const Result_10 = IDL.Variant({Ok: Ok_1, Err: GovernanceError}); + const SettleNeuronsFundParticipationResponse = IDL.Record({ + result: IDL.Opt(Result_10) + }); + const UpdateNodeProvider = IDL.Record({ + reward_account: IDL.Opt(AccountIdentifier) + }); + return IDL.Service({ + claim_gtc_neurons: IDL.Func([IDL.Principal, IDL.Vec(NeuronId)], [Result], []), + claim_or_refresh_neuron_from_account: IDL.Func( + [ClaimOrRefreshNeuronFromAccount], + [ClaimOrRefreshNeuronFromAccountResponse], + [] + ), + get_build_metadata: IDL.Func([], [IDL.Text], ['query']), + get_full_neuron: IDL.Func([IDL.Nat64], [Result_2], ['query']), + get_full_neuron_by_id_or_subaccount: IDL.Func([NeuronIdOrSubaccount], [Result_2], ['query']), + get_latest_reward_event: IDL.Func([], [RewardEvent], ['query']), + get_metrics: IDL.Func([], [Result_3], ['query']), + get_monthly_node_provider_rewards: IDL.Func([], [Result_4], []), + get_most_recent_monthly_node_provider_rewards: IDL.Func( + [], + [IDL.Opt(MostRecentMonthlyNodeProviderRewards)], + ['query'] + ), + get_network_economics_parameters: IDL.Func([], [NetworkEconomics], ['query']), + get_neuron_ids: IDL.Func([], [IDL.Vec(IDL.Nat64)], ['query']), + get_neuron_info: IDL.Func([IDL.Nat64], [Result_5], ['query']), + get_neuron_info_by_id_or_subaccount: IDL.Func([NeuronIdOrSubaccount], [Result_5], ['query']), + get_neurons_fund_audit_info: IDL.Func( + [GetNeuronsFundAuditInfoRequest], + [GetNeuronsFundAuditInfoResponse], + ['query'] + ), + get_node_provider_by_caller: IDL.Func([IDL.Null], [Result_7], ['query']), + get_pending_proposals: IDL.Func([], [IDL.Vec(ProposalInfo)], ['query']), + get_proposal_info: IDL.Func([IDL.Nat64], [IDL.Opt(ProposalInfo)], ['query']), + get_restore_aging_summary: IDL.Func([], [RestoreAgingSummary], ['query']), + list_known_neurons: IDL.Func([], [ListKnownNeuronsResponse], ['query']), + list_neurons: IDL.Func([ListNeurons], [ListNeuronsResponse], ['query']), + list_node_providers: IDL.Func([], [ListNodeProvidersResponse], ['query']), + list_proposals: IDL.Func([ListProposalInfo], [ListProposalInfoResponse], ['query']), + manage_neuron: IDL.Func([ManageNeuron], [ManageNeuronResponse], []), + settle_community_fund_participation: IDL.Func([SettleCommunityFundParticipation], [Result], []), + settle_neurons_fund_participation: IDL.Func( + [SettleNeuronsFundParticipationRequest], + [SettleNeuronsFundParticipationResponse], + [] + ), + simulate_manage_neuron: IDL.Func([ManageNeuron], [ManageNeuronResponse], []), + transfer_gtc_neuron: IDL.Func([NeuronId, NeuronId], [Result], []), + update_node_provider: IDL.Func([UpdateNodeProvider], [Result], []) + }); +}; +export const init = ({IDL}) => { + const Proposal = IDL.Rec(); + const NeuronId = IDL.Record({id: IDL.Nat64}); + const Followees = IDL.Record({followees: IDL.Vec(NeuronId)}); + const KnownNeuronData = IDL.Record({ + name: IDL.Text, + description: IDL.Opt(IDL.Text) + }); + const KnownNeuron = IDL.Record({ + id: IDL.Opt(NeuronId), + known_neuron_data: IDL.Opt(KnownNeuronData) + }); + const Spawn = IDL.Record({ + percentage_to_spawn: IDL.Opt(IDL.Nat32), + new_controller: IDL.Opt(IDL.Principal), + nonce: IDL.Opt(IDL.Nat64) + }); + const Split = IDL.Record({amount_e8s: IDL.Nat64}); + const Follow = IDL.Record({ + topic: IDL.Int32, + followees: IDL.Vec(NeuronId) + }); + const ClaimOrRefreshNeuronFromAccount = IDL.Record({ + controller: IDL.Opt(IDL.Principal), + memo: IDL.Nat64 + }); + const By = IDL.Variant({ + NeuronIdOrSubaccount: IDL.Record({}), + MemoAndController: ClaimOrRefreshNeuronFromAccount, + Memo: IDL.Nat64 + }); + const ClaimOrRefresh = IDL.Record({by: IDL.Opt(By)}); + const RemoveHotKey = IDL.Record({ + hot_key_to_remove: IDL.Opt(IDL.Principal) + }); + const AddHotKey = IDL.Record({new_hot_key: IDL.Opt(IDL.Principal)}); + const ChangeAutoStakeMaturity = IDL.Record({ + requested_setting_for_auto_stake_maturity: IDL.Bool + }); + const IncreaseDissolveDelay = IDL.Record({ + additional_dissolve_delay_seconds: IDL.Nat32 + }); + const SetDissolveTimestamp = IDL.Record({ + dissolve_timestamp_seconds: IDL.Nat64 + }); + const Operation = IDL.Variant({ + RemoveHotKey: RemoveHotKey, + AddHotKey: AddHotKey, + ChangeAutoStakeMaturity: ChangeAutoStakeMaturity, + StopDissolving: IDL.Record({}), + StartDissolving: IDL.Record({}), + IncreaseDissolveDelay: IncreaseDissolveDelay, + JoinCommunityFund: IDL.Record({}), + LeaveCommunityFund: IDL.Record({}), + SetDissolveTimestamp: SetDissolveTimestamp + }); + const Configure = IDL.Record({operation: IDL.Opt(Operation)}); + const RegisterVote = IDL.Record({ + vote: IDL.Int32, + proposal: IDL.Opt(NeuronId) + }); + const Merge = IDL.Record({source_neuron_id: IDL.Opt(NeuronId)}); + const DisburseToNeuron = IDL.Record({ + dissolve_delay_seconds: IDL.Nat64, + kyc_verified: IDL.Bool, + amount_e8s: IDL.Nat64, + new_controller: IDL.Opt(IDL.Principal), + nonce: IDL.Nat64 + }); + const StakeMaturity = IDL.Record({ + percentage_to_stake: IDL.Opt(IDL.Nat32) + }); + const MergeMaturity = IDL.Record({percentage_to_merge: IDL.Nat32}); + const AccountIdentifier = IDL.Record({hash: IDL.Vec(IDL.Nat8)}); + const Amount = IDL.Record({e8s: IDL.Nat64}); + const Disburse = IDL.Record({ + to_account: IDL.Opt(AccountIdentifier), + amount: IDL.Opt(Amount) + }); + const Command = IDL.Variant({ + Spawn: Spawn, + Split: Split, + Follow: Follow, + ClaimOrRefresh: ClaimOrRefresh, + Configure: Configure, + RegisterVote: RegisterVote, + Merge: Merge, + DisburseToNeuron: DisburseToNeuron, + MakeProposal: Proposal, + StakeMaturity: StakeMaturity, + MergeMaturity: MergeMaturity, + Disburse: Disburse + }); + const NeuronIdOrSubaccount = IDL.Variant({ + Subaccount: IDL.Vec(IDL.Nat8), + NeuronId: NeuronId + }); + const ManageNeuron = IDL.Record({ + id: IDL.Opt(NeuronId), + command: IDL.Opt(Command), + neuron_id_or_subaccount: IDL.Opt(NeuronIdOrSubaccount) + }); + const Percentage = IDL.Record({basis_points: IDL.Opt(IDL.Nat64)}); + const Duration = IDL.Record({seconds: IDL.Opt(IDL.Nat64)}); + const Tokens = IDL.Record({e8s: IDL.Opt(IDL.Nat64)}); + const VotingRewardParameters = IDL.Record({ + reward_rate_transition_duration: IDL.Opt(Duration), + initial_reward_rate: IDL.Opt(Percentage), + final_reward_rate: IDL.Opt(Percentage) + }); + const GovernanceParameters = IDL.Record({ + neuron_maximum_dissolve_delay_bonus: IDL.Opt(Percentage), + neuron_maximum_age_for_age_bonus: IDL.Opt(Duration), + neuron_maximum_dissolve_delay: IDL.Opt(Duration), + neuron_minimum_dissolve_delay_to_vote: IDL.Opt(Duration), + neuron_maximum_age_bonus: IDL.Opt(Percentage), + neuron_minimum_stake: IDL.Opt(Tokens), + proposal_wait_for_quiet_deadline_increase: IDL.Opt(Duration), + proposal_initial_voting_period: IDL.Opt(Duration), + proposal_rejection_fee: IDL.Opt(Tokens), + voting_reward_parameters: IDL.Opt(VotingRewardParameters) + }); + const Image = IDL.Record({base64_encoding: IDL.Opt(IDL.Text)}); + const LedgerParameters = IDL.Record({ + transaction_fee: IDL.Opt(Tokens), + token_symbol: IDL.Opt(IDL.Text), + token_logo: IDL.Opt(Image), + token_name: IDL.Opt(IDL.Text) + }); + const Canister = IDL.Record({id: IDL.Opt(IDL.Principal)}); + const NeuronBasketConstructionParameters = IDL.Record({ + dissolve_delay_interval: IDL.Opt(Duration), + count: IDL.Opt(IDL.Nat64) + }); + const GlobalTimeOfDay = IDL.Record({ + seconds_after_utc_midnight: IDL.Opt(IDL.Nat64) + }); + const Countries = IDL.Record({iso_codes: IDL.Vec(IDL.Text)}); + const SwapParameters = IDL.Record({ + minimum_participants: IDL.Opt(IDL.Nat64), + neurons_fund_participation: IDL.Opt(IDL.Bool), + duration: IDL.Opt(Duration), + neuron_basket_construction_parameters: IDL.Opt(NeuronBasketConstructionParameters), + confirmation_text: IDL.Opt(IDL.Text), + maximum_participant_icp: IDL.Opt(Tokens), + minimum_icp: IDL.Opt(Tokens), + minimum_direct_participation_icp: IDL.Opt(Tokens), + minimum_participant_icp: IDL.Opt(Tokens), + start_time: IDL.Opt(GlobalTimeOfDay), + maximum_direct_participation_icp: IDL.Opt(Tokens), + maximum_icp: IDL.Opt(Tokens), + neurons_fund_investment_icp: IDL.Opt(Tokens), + restricted_countries: IDL.Opt(Countries) + }); + const SwapDistribution = IDL.Record({total: IDL.Opt(Tokens)}); + const NeuronDistribution = IDL.Record({ + controller: IDL.Opt(IDL.Principal), + dissolve_delay: IDL.Opt(Duration), + memo: IDL.Opt(IDL.Nat64), + vesting_period: IDL.Opt(Duration), + stake: IDL.Opt(Tokens) + }); + const DeveloperDistribution = IDL.Record({ + developer_neurons: IDL.Vec(NeuronDistribution) + }); + const InitialTokenDistribution = IDL.Record({ + treasury_distribution: IDL.Opt(SwapDistribution), + developer_distribution: IDL.Opt(DeveloperDistribution), + swap_distribution: IDL.Opt(SwapDistribution) + }); + const CreateServiceNervousSystem = IDL.Record({ + url: IDL.Opt(IDL.Text), + governance_parameters: IDL.Opt(GovernanceParameters), + fallback_controller_principal_ids: IDL.Vec(IDL.Principal), + logo: IDL.Opt(Image), + name: IDL.Opt(IDL.Text), + ledger_parameters: IDL.Opt(LedgerParameters), + description: IDL.Opt(IDL.Text), + dapp_canisters: IDL.Vec(Canister), + swap_parameters: IDL.Opt(SwapParameters), + initial_token_distribution: IDL.Opt(InitialTokenDistribution) + }); + const ExecuteNnsFunction = IDL.Record({ + nns_function: IDL.Int32, + payload: IDL.Vec(IDL.Nat8) + }); + const NodeProvider = IDL.Record({ + id: IDL.Opt(IDL.Principal), + reward_account: IDL.Opt(AccountIdentifier) + }); + const RewardToNeuron = IDL.Record({dissolve_delay_seconds: IDL.Nat64}); + const RewardToAccount = IDL.Record({ + to_account: IDL.Opt(AccountIdentifier) + }); + const RewardMode = IDL.Variant({ + RewardToNeuron: RewardToNeuron, + RewardToAccount: RewardToAccount + }); + const RewardNodeProvider = IDL.Record({ + node_provider: IDL.Opt(NodeProvider), + reward_mode: IDL.Opt(RewardMode), + amount_e8s: IDL.Nat64 + }); + const NeuronBasketConstructionParameters_1 = IDL.Record({ + dissolve_delay_interval_seconds: IDL.Nat64, + count: IDL.Nat64 + }); + const Params = IDL.Record({ + min_participant_icp_e8s: IDL.Nat64, + neuron_basket_construction_parameters: IDL.Opt(NeuronBasketConstructionParameters_1), + max_icp_e8s: IDL.Nat64, + swap_due_timestamp_seconds: IDL.Nat64, + min_participants: IDL.Nat32, + sns_token_e8s: IDL.Nat64, + sale_delay_seconds: IDL.Opt(IDL.Nat64), + max_participant_icp_e8s: IDL.Nat64, + min_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), + min_icp_e8s: IDL.Nat64, + max_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const OpenSnsTokenSwap = IDL.Record({ + community_fund_investment_e8s: IDL.Opt(IDL.Nat64), + target_swap_canister_id: IDL.Opt(IDL.Principal), + params: IDL.Opt(Params) + }); + const TimeWindow = IDL.Record({ + start_timestamp_seconds: IDL.Nat64, + end_timestamp_seconds: IDL.Nat64 + }); + const SetOpenTimeWindowRequest = IDL.Record({ + open_time_window: IDL.Opt(TimeWindow) + }); + const SetSnsTokenSwapOpenTimeWindow = IDL.Record({ + request: IDL.Opt(SetOpenTimeWindowRequest), + swap_canister_id: IDL.Opt(IDL.Principal) + }); + const SetDefaultFollowees = IDL.Record({ + default_followees: IDL.Vec(IDL.Tuple(IDL.Int32, Followees)) + }); + const RewardNodeProviders = IDL.Record({ + use_registry_derived_rewards: IDL.Opt(IDL.Bool), + rewards: IDL.Vec(RewardNodeProvider) + }); + const Decimal = IDL.Record({human_readable: IDL.Opt(IDL.Text)}); + const NeuronsFundMatchedFundingCurveCoefficients = IDL.Record({ + contribution_threshold_xdr: IDL.Opt(Decimal), + one_third_participation_milestone_xdr: IDL.Opt(Decimal), + full_participation_milestone_xdr: IDL.Opt(Decimal) + }); + const NeuronsFundEconomics = IDL.Record({ + maximum_icp_xdr_rate: IDL.Opt(Percentage), + neurons_fund_matched_funding_curve_coefficients: IDL.Opt( + NeuronsFundMatchedFundingCurveCoefficients + ), + max_theoretical_neurons_fund_participation_amount_xdr: IDL.Opt(Decimal), + minimum_icp_xdr_rate: IDL.Opt(Percentage) + }); + const NetworkEconomics = IDL.Record({ + neuron_minimum_stake_e8s: IDL.Nat64, + max_proposals_to_keep_per_topic: IDL.Nat32, + neuron_management_fee_per_proposal_e8s: IDL.Nat64, + reject_cost_e8s: IDL.Nat64, + transaction_fee_e8s: IDL.Nat64, + neuron_spawn_dissolve_delay_seconds: IDL.Nat64, + minimum_icp_xdr_rate: IDL.Nat64, + maximum_node_provider_rewards_e8s: IDL.Nat64, + neurons_fund_economics: IDL.Opt(NeuronsFundEconomics) + }); + const ApproveGenesisKyc = IDL.Record({ + principals: IDL.Vec(IDL.Principal) + }); + const Change = IDL.Variant({ + ToRemove: NodeProvider, + ToAdd: NodeProvider + }); + const AddOrRemoveNodeProvider = IDL.Record({change: IDL.Opt(Change)}); + const Motion = IDL.Record({motion_text: IDL.Text}); + const Action = IDL.Variant({ + RegisterKnownNeuron: KnownNeuron, + ManageNeuron: ManageNeuron, + CreateServiceNervousSystem: CreateServiceNervousSystem, + ExecuteNnsFunction: ExecuteNnsFunction, + RewardNodeProvider: RewardNodeProvider, + OpenSnsTokenSwap: OpenSnsTokenSwap, + SetSnsTokenSwapOpenTimeWindow: SetSnsTokenSwapOpenTimeWindow, + SetDefaultFollowees: SetDefaultFollowees, + RewardNodeProviders: RewardNodeProviders, + ManageNetworkEconomics: NetworkEconomics, + ApproveGenesisKyc: ApproveGenesisKyc, + AddOrRemoveNodeProvider: AddOrRemoveNodeProvider, + Motion: Motion + }); + Proposal.fill( + IDL.Record({ + url: IDL.Text, + title: IDL.Opt(IDL.Text), + action: IDL.Opt(Action), + summary: IDL.Text + }) + ); + const MakingSnsProposal = IDL.Record({ + proposal: IDL.Opt(Proposal), + caller: IDL.Opt(IDL.Principal), + proposer_id: IDL.Opt(NeuronId) + }); + const MostRecentMonthlyNodeProviderRewards = IDL.Record({ + timestamp: IDL.Nat64, + rewards: IDL.Vec(RewardNodeProvider) + }); + const GovernanceCachedMetrics = IDL.Record({ + total_maturity_e8s_equivalent: IDL.Nat64, + not_dissolving_neurons_e8s_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + dissolving_neurons_staked_maturity_e8s_equivalent_sum: IDL.Nat64, + garbage_collectable_neurons_count: IDL.Nat64, + dissolving_neurons_staked_maturity_e8s_equivalent_buckets: IDL.Vec( + IDL.Tuple(IDL.Nat64, IDL.Float64) + ), + neurons_with_invalid_stake_count: IDL.Nat64, + not_dissolving_neurons_count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + ect_neuron_count: IDL.Nat64, + total_supply_icp: IDL.Nat64, + neurons_with_less_than_6_months_dissolve_delay_count: IDL.Nat64, + dissolved_neurons_count: IDL.Nat64, + community_fund_total_maturity_e8s_equivalent: IDL.Nat64, + total_staked_e8s_seed: IDL.Nat64, + total_staked_maturity_e8s_equivalent_ect: IDL.Nat64, + total_staked_e8s: IDL.Nat64, + not_dissolving_neurons_count: IDL.Nat64, + total_locked_e8s: IDL.Nat64, + neurons_fund_total_active_neurons: IDL.Nat64, + total_staked_maturity_e8s_equivalent: IDL.Nat64, + not_dissolving_neurons_e8s_buckets_ect: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + total_staked_e8s_ect: IDL.Nat64, + not_dissolving_neurons_staked_maturity_e8s_equivalent_sum: IDL.Nat64, + dissolved_neurons_e8s: IDL.Nat64, + dissolving_neurons_e8s_buckets_seed: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + neurons_with_less_than_6_months_dissolve_delay_e8s: IDL.Nat64, + not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets: IDL.Vec( + IDL.Tuple(IDL.Nat64, IDL.Float64) + ), + dissolving_neurons_count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + dissolving_neurons_e8s_buckets_ect: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + dissolving_neurons_count: IDL.Nat64, + dissolving_neurons_e8s_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + total_staked_maturity_e8s_equivalent_seed: IDL.Nat64, + community_fund_total_staked_e8s: IDL.Nat64, + not_dissolving_neurons_e8s_buckets_seed: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + timestamp_seconds: IDL.Nat64, + seed_neuron_count: IDL.Nat64 + }); + const RestoreAgingNeuronGroup = IDL.Record({ + count: IDL.Opt(IDL.Nat64), + previous_total_stake_e8s: IDL.Opt(IDL.Nat64), + current_total_stake_e8s: IDL.Opt(IDL.Nat64), + group_type: IDL.Int32 + }); + const RestoreAgingSummary = IDL.Record({ + groups: IDL.Vec(RestoreAgingNeuronGroup), + timestamp_seconds: IDL.Opt(IDL.Nat64) + }); + const RewardEvent = IDL.Record({ + rounds_since_last_distribution: IDL.Opt(IDL.Nat64), + day_after_genesis: IDL.Nat64, + actual_timestamp_seconds: IDL.Nat64, + total_available_e8s_equivalent: IDL.Nat64, + latest_round_available_e8s_equivalent: IDL.Opt(IDL.Nat64), + distributed_e8s_equivalent: IDL.Nat64, + settled_proposals: IDL.Vec(NeuronId) + }); + const NeuronStakeTransfer = IDL.Record({ + to_subaccount: IDL.Vec(IDL.Nat8), + neuron_stake_e8s: IDL.Nat64, + from: IDL.Opt(IDL.Principal), + memo: IDL.Nat64, + from_subaccount: IDL.Vec(IDL.Nat8), + transfer_timestamp: IDL.Nat64, + block_height: IDL.Nat64 + }); + const Followers = IDL.Record({followers: IDL.Vec(NeuronId)}); + const FollowersMap = IDL.Record({ + followers_map: IDL.Vec(IDL.Tuple(IDL.Nat64, Followers)) + }); + const Progress = IDL.Variant({LastNeuronId: NeuronId}); + const Migration = IDL.Record({ + status: IDL.Opt(IDL.Int32), + failure_reason: IDL.Opt(IDL.Text), + progress: IDL.Opt(Progress) + }); + const Migrations = IDL.Record({ + neuron_indexes_migration: IDL.Opt(Migration), + copy_inactive_neurons_to_stable_memory_migration: IDL.Opt(Migration) + }); + const GovernanceError = IDL.Record({ + error_message: IDL.Text, + error_type: IDL.Int32 + }); + const CfNeuron = IDL.Record({ + has_created_neuron_recipes: IDL.Opt(IDL.Bool), + nns_neuron_id: IDL.Nat64, + amount_icp_e8s: IDL.Nat64 + }); + const CfParticipant = IDL.Record({ + hotkey_principal: IDL.Text, + cf_neurons: IDL.Vec(CfNeuron) + }); + const Ballot = IDL.Record({vote: IDL.Int32, voting_power: IDL.Nat64}); + const SwapParticipationLimits = IDL.Record({ + min_participant_icp_e8s: IDL.Opt(IDL.Nat64), + max_participant_icp_e8s: IDL.Opt(IDL.Nat64), + min_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), + max_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const NeuronsFundNeuronPortion = IDL.Record({ + hotkey_principal: IDL.Opt(IDL.Principal), + is_capped: IDL.Opt(IDL.Bool), + maturity_equivalent_icp_e8s: IDL.Opt(IDL.Nat64), + nns_neuron_id: IDL.Opt(NeuronId), + amount_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const NeuronsFundSnapshot = IDL.Record({ + neurons_fund_neuron_portions: IDL.Vec(NeuronsFundNeuronPortion) + }); + const IdealMatchedParticipationFunction = IDL.Record({ + serialized_representation: IDL.Opt(IDL.Text) + }); + const NeuronsFundParticipation = IDL.Record({ + total_maturity_equivalent_icp_e8s: IDL.Opt(IDL.Nat64), + intended_neurons_fund_participation_icp_e8s: IDL.Opt(IDL.Nat64), + direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), + swap_participation_limits: IDL.Opt(SwapParticipationLimits), + max_neurons_fund_swap_participation_icp_e8s: IDL.Opt(IDL.Nat64), + neurons_fund_reserves: IDL.Opt(NeuronsFundSnapshot), + ideal_matched_participation_function: IDL.Opt(IdealMatchedParticipationFunction), + allocated_neurons_fund_participation_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const NeuronsFundData = IDL.Record({ + final_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), + initial_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), + neurons_fund_refunds: IDL.Opt(NeuronsFundSnapshot) + }); + const CanisterStatusResultV2 = IDL.Record({ + status: IDL.Opt(IDL.Int32), + freezing_threshold: IDL.Opt(IDL.Nat64), + controllers: IDL.Vec(IDL.Principal), + memory_size: IDL.Opt(IDL.Nat64), + cycles: IDL.Opt(IDL.Nat64), + idle_cycles_burned_per_day: IDL.Opt(IDL.Nat64), + module_hash: IDL.Vec(IDL.Nat8) + }); + const CanisterSummary = IDL.Record({ + status: IDL.Opt(CanisterStatusResultV2), + canister_id: IDL.Opt(IDL.Principal) + }); + const SwapBackgroundInformation = IDL.Record({ + ledger_index_canister_summary: IDL.Opt(CanisterSummary), + fallback_controller_principal_ids: IDL.Vec(IDL.Principal), + ledger_archive_canister_summaries: IDL.Vec(CanisterSummary), + ledger_canister_summary: IDL.Opt(CanisterSummary), + swap_canister_summary: IDL.Opt(CanisterSummary), + governance_canister_summary: IDL.Opt(CanisterSummary), + root_canister_summary: IDL.Opt(CanisterSummary), + dapp_canister_summaries: IDL.Vec(CanisterSummary) + }); + const DerivedProposalInformation = IDL.Record({ + swap_background_information: IDL.Opt(SwapBackgroundInformation) + }); + const Tally = IDL.Record({ + no: IDL.Nat64, + yes: IDL.Nat64, + total: IDL.Nat64, + timestamp_seconds: IDL.Nat64 + }); + const WaitForQuietState = IDL.Record({ + current_deadline_timestamp_seconds: IDL.Nat64 + }); + const ProposalData = IDL.Record({ + id: IDL.Opt(NeuronId), + failure_reason: IDL.Opt(GovernanceError), + cf_participants: IDL.Vec(CfParticipant), + ballots: IDL.Vec(IDL.Tuple(IDL.Nat64, Ballot)), + proposal_timestamp_seconds: IDL.Nat64, + reward_event_round: IDL.Nat64, + failed_timestamp_seconds: IDL.Nat64, + neurons_fund_data: IDL.Opt(NeuronsFundData), + reject_cost_e8s: IDL.Nat64, + derived_proposal_information: IDL.Opt(DerivedProposalInformation), + latest_tally: IDL.Opt(Tally), + sns_token_swap_lifecycle: IDL.Opt(IDL.Int32), + decided_timestamp_seconds: IDL.Nat64, + proposal: IDL.Opt(Proposal), + proposer: IDL.Opt(NeuronId), + wait_for_quiet_state: IDL.Opt(WaitForQuietState), + executed_timestamp_seconds: IDL.Nat64, + original_total_community_fund_maturity_e8s_equivalent: IDL.Opt(IDL.Nat64) + }); + const XdrConversionRate = IDL.Record({ + xdr_permyriad_per_icp: IDL.Opt(IDL.Nat64), + timestamp_seconds: IDL.Opt(IDL.Nat64) + }); + const Command_2 = IDL.Variant({ + Spawn: NeuronId, + Split: Split, + Configure: Configure, + Merge: Merge, + DisburseToNeuron: DisburseToNeuron, + SyncCommand: IDL.Record({}), + ClaimOrRefreshNeuron: ClaimOrRefresh, + MergeMaturity: MergeMaturity, + Disburse: Disburse + }); + const NeuronInFlightCommand = IDL.Record({ + command: IDL.Opt(Command_2), + timestamp: IDL.Nat64 + }); + const BallotInfo = IDL.Record({ + vote: IDL.Int32, + proposal_id: IDL.Opt(NeuronId) + }); + const DissolveState = IDL.Variant({ + DissolveDelaySeconds: IDL.Nat64, + WhenDissolvedTimestampSeconds: IDL.Nat64 + }); + const Neuron = IDL.Record({ + id: IDL.Opt(NeuronId), + staked_maturity_e8s_equivalent: IDL.Opt(IDL.Nat64), + controller: IDL.Opt(IDL.Principal), + recent_ballots: IDL.Vec(BallotInfo), + kyc_verified: IDL.Bool, + neuron_type: IDL.Opt(IDL.Int32), + not_for_profit: IDL.Bool, + maturity_e8s_equivalent: IDL.Nat64, + cached_neuron_stake_e8s: IDL.Nat64, + created_timestamp_seconds: IDL.Nat64, + auto_stake_maturity: IDL.Opt(IDL.Bool), + aging_since_timestamp_seconds: IDL.Nat64, + hot_keys: IDL.Vec(IDL.Principal), + account: IDL.Vec(IDL.Nat8), + joined_community_fund_timestamp_seconds: IDL.Opt(IDL.Nat64), + dissolve_state: IDL.Opt(DissolveState), + followees: IDL.Vec(IDL.Tuple(IDL.Int32, Followees)), + neuron_fees_e8s: IDL.Nat64, + transfer: IDL.Opt(NeuronStakeTransfer), + known_neuron_data: IDL.Opt(KnownNeuronData), + spawn_at_timestamp_seconds: IDL.Opt(IDL.Nat64) + }); + const Governance = IDL.Record({ + default_followees: IDL.Vec(IDL.Tuple(IDL.Int32, Followees)), + making_sns_proposal: IDL.Opt(MakingSnsProposal), + most_recent_monthly_node_provider_rewards: IDL.Opt(MostRecentMonthlyNodeProviderRewards), + maturity_modulation_last_updated_at_timestamp_seconds: IDL.Opt(IDL.Nat64), + wait_for_quiet_threshold_seconds: IDL.Nat64, + metrics: IDL.Opt(GovernanceCachedMetrics), + neuron_management_voting_period_seconds: IDL.Opt(IDL.Nat64), + node_providers: IDL.Vec(NodeProvider), + cached_daily_maturity_modulation_basis_points: IDL.Opt(IDL.Int32), + economics: IDL.Opt(NetworkEconomics), + restore_aging_summary: IDL.Opt(RestoreAgingSummary), + spawning_neurons: IDL.Opt(IDL.Bool), + latest_reward_event: IDL.Opt(RewardEvent), + to_claim_transfers: IDL.Vec(NeuronStakeTransfer), + short_voting_period_seconds: IDL.Nat64, + topic_followee_index: IDL.Vec(IDL.Tuple(IDL.Int32, FollowersMap)), + migrations: IDL.Opt(Migrations), + proposals: IDL.Vec(IDL.Tuple(IDL.Nat64, ProposalData)), + xdr_conversion_rate: IDL.Opt(XdrConversionRate), + in_flight_commands: IDL.Vec(IDL.Tuple(IDL.Nat64, NeuronInFlightCommand)), + neurons: IDL.Vec(IDL.Tuple(IDL.Nat64, Neuron)), + genesis_timestamp_seconds: IDL.Nat64 + }); + return [Governance]; +}; diff --git a/cli/src/modules/cmc.ts b/cli/src/modules/cmc.ts new file mode 100644 index 0000000..aa8ae2b --- /dev/null +++ b/cli/src/modules/cmc.ts @@ -0,0 +1,61 @@ +import {IDL} from '@dfinity/candid'; +import {Principal} from '@dfinity/principal'; +import {assertNonNullish} from '@dfinity/utils'; +import {AccountIdentifier} from '@junobuild/ledger'; +import {MINTER_IDENTITY_KEY} from '../constants/constants'; +import type {CyclesCanisterInitPayload} from '../declarations/cmc'; +import {init} from '../declarations/cmc.idl'; +import {Module} from '../services/modules.services'; +import type {ModuleDescription, ModuleInstallParams} from '../types/module'; + +const CMC: ModuleDescription = { + key: 'cmc', + name: 'CMC', + canisterId: 'rkp4c-7iaaa-aaaaa-aaaca-cai' +}; + +class CmcModule extends Module { + override async install({state, identities, ...rest}: ModuleInstallParams): Promise { + const icpLedgerCanisterId = state.getModule('icp_ledger')?.canisterId; + + assertNonNullish( + icpLedgerCanisterId, + 'Cannot configure CMC because the ICP ledger id is unknown.' + ); + + const governanceCanisterId = state.getModule('governance')?.canisterId; + + assertNonNullish( + governanceCanisterId, + 'Cannot configure CMC because the NNS Governance id is unknown.' + ); + + const {[MINTER_IDENTITY_KEY]: minterIdentity} = identities; + + const minterAccountIdentifier = AccountIdentifier.fromPrincipal({ + principal: minterIdentity.getPrincipal() + }); + + const sourceArg: CyclesCanisterInitPayload = { + exchange_rate_canister: [], + last_purged_notification: [0n], + governance_canister_id: [Principal.fromText(governanceCanisterId)], + minting_account_id: [minterAccountIdentifier.toHex()], + ledger_canister_id: [Principal.fromText(icpLedgerCanisterId)], + cycles_ledger_canister_id: [] + }; + + // Type definitions generated by Candid are not clean enough. + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + const arg = IDL.encode(init({IDL}), [[sourceArg]]); + + await super.install({ + state, + arg, + identities, + ...rest + }); + } +} + +export const cmc = new CmcModule(CMC); diff --git a/cli/src/modules/governance/governance.constants.ts b/cli/src/modules/governance/governance.constants.ts new file mode 100644 index 0000000..452cf3d --- /dev/null +++ b/cli/src/modules/governance/governance.constants.ts @@ -0,0 +1 @@ +export const NEURON_ID = 666; diff --git a/cli/src/modules/governance/governance.install.ts b/cli/src/modules/governance/governance.install.ts new file mode 100644 index 0000000..974f23d --- /dev/null +++ b/cli/src/modules/governance/governance.install.ts @@ -0,0 +1,108 @@ +import type {Identity} from '@dfinity/agent'; +import { + Decimal, + Governance, + NetworkEconomics, + Neuron, + NeuronId, + NeuronsFundEconomics, + NeuronsFundMatchedFundingCurveCoefficients, + Percentage, + PrincipalId, + XdrConversionRate +} from '@dfinity/nns-proto'; +import {neuronSubaccount} from '@dfinity/sns'; +import {MAIN_IDENTITY_KEY} from '../../constants/constants'; +import type {ModuleInstallParams} from '../../types/module'; +import {NEURON_ID} from './governance.constants'; + +export const prepareGovernanceArgs = ({ + identities +}: Pick): Governance => { + const {[MAIN_IDENTITY_KEY]: identity} = identities; + + // Source: https://github.com/dfinity/ic/blob/e90838a1687f8e0869d85343aac2845d883f74ff/rs/nns/governance/src/governance.rs#L231 + const E8S_PER_ICP = 100_000_000n; + const DEFAULT_TRANSFER_FEE = 10_000n; + + const fund = new NeuronsFundEconomics(); + + const decimal = (value: string): Decimal => { + const dev = new Decimal(); + dev.setHumanReadable(value); + return dev; + }; + + fund.setMaxTheoreticalNeuronsFundParticipationAmountXdr(decimal('750_000.0')); + + const efficients = new NeuronsFundMatchedFundingCurveCoefficients(); + efficients.setContributionThresholdXdr(decimal('75_000.0')); + efficients.setOneThirdParticipationMilestoneXdr(decimal('225_000.0')); + efficients.setFullParticipationMilestoneXdr(decimal('375_000.0')); + + fund.setNeuronsFundMatchedFundingCurveCoefficients(efficients); + + const percentage = (value: number): Percentage => { + const dev = new Percentage(); + dev.setBasisPoints(value); + return dev; + }; + + fund.setMinimumIcpXdrRate(percentage(10_000)); // 1:1 + fund.setMaximumIcpXdrRate(percentage(1_000_000)); // 1:100 + + const eco = new NetworkEconomics(); + eco.setRejectCostE8s(Number(E8S_PER_ICP)); // 1 ICP + eco.setNeuronMinimumStakeE8s(Number(E8S_PER_ICP)); // 1 ICP + eco.setNeuronManagementFeePerProposalE8s(1_000_000); // 0.01 ICP + eco.setMinimumIcpXdrRate(100); // 1 XDR + eco.setNeuronSpawnDissolveDelaySeconds(24 * 60 * 60 * 7); // 7 days + eco.setMaximumNodeProviderRewardsE8s(1_000_000 * 100_000_000); // 1M ICP + eco.setTransactionFeeE8s(Number(DEFAULT_TRANSFER_FEE)); + eco.setMaxProposalsToKeepPerTopic(100); + eco.setNeuronsFundEconomics(fund); + + const xdr = new XdrConversionRate(); + xdr.setTimestampSeconds(1); + xdr.setXdrPermyriadPerIcp(10_000); + + const neuron = prepareNeuron({identity}); + + const gov = new Governance(); + gov.getNeuronsMap().set(neuron.getId()?.getId() ?? NEURON_ID, neuron); + gov.setWaitForQuietThresholdSeconds(60 * 60 * 24 * 4); // 4 days + gov.setEconomics(eco); + gov.setGenesisTimestampSeconds(0); + gov.setShortVotingPeriodSeconds(60 * 60 * 12); // 12 hours + gov.setXdrConversionRate(xdr); + + return gov; +}; + +const prepareNeuron = ({identity}: {identity: Identity}): Neuron => { + const id = new NeuronId(); + id.setId(NEURON_ID); + + const subAccount = neuronSubaccount({ + index: 0, + controller: identity.getPrincipal() + }) as Uint8Array; + + const principalId = new PrincipalId(); + principalId.setSerializedId(identity.getPrincipal().toUint8Array()); + + const neuron = new Neuron(); + neuron.setId(id); + neuron.setAccount(subAccount); + neuron.setController(principalId); + neuron.setHotKeysList([principalId]); + neuron.setCachedNeuronStakeE8s(1_000_000 * 100_000_000); // 1M ICP + neuron.setCreatedTimestampSeconds(0); + neuron.setAgingSinceTimestampSeconds(0); + neuron.setKycVerified(true); + neuron.setMaturityE8sEquivalent(0); + neuron.setNotForProfit(true); + neuron.setDissolveDelaySeconds(24 * 60 * 60 * 365 * 8); // 8 * 365 days + + return neuron; +}; diff --git a/cli/src/modules/governance/governance.post-install.ts b/cli/src/modules/governance/governance.post-install.ts new file mode 100644 index 0000000..0ea3b87 --- /dev/null +++ b/cli/src/modules/governance/governance.post-install.ts @@ -0,0 +1,60 @@ +import {IDL} from '@dfinity/candid'; +import {GovernanceCanister, NnsFunction, type MakeProposalRequest} from '@dfinity/nns'; +import {createAgent} from '@dfinity/utils'; +import {MAIN_IDENTITY_KEY} from '../../constants/constants'; +import type {ModuleInstallParams} from '../../types/module'; +import {NEURON_ID} from './governance.constants'; + +export const makeIcpXdrProposal = async ({identities}: Pick) => { + const {[MAIN_IDENTITY_KEY]: identity} = identities; + + const agent = await createAgent({ + identity, + host: 'http://127.0.0.1:5987', + fetchRootKey: true + }); + + const {makeProposal} = GovernanceCanister.create({ + agent + }); + + const arg = IDL.encode( + [ + IDL.Record({ + data_source: IDL.Text, + timestamp_seconds: IDL.Nat64, + xdr_permyriad_per_icp: IDL.Nat64, + reason: IDL.Opt( + IDL.Variant({ + OldRate: IDL.Null, + DivergedRate: IDL.Null, + EnableAutomaticExchangeRateUpdates: IDL.Null + }) + ) + }) + ], + [ + { + data_source: '{"icp":["Binance"],"sdr":"xe.com"}', // Example of payload data found it some proposal + timestamp_seconds: BigInt(Math.floor(Date.now() / 1000)), // Timestamp should not be < than 30 days from now + xdr_permyriad_per_icp: BigInt(41388), + reason: [{DivergedRate: null}] + } + ] + ); + + const request: MakeProposalRequest = { + neuronId: BigInt(NEURON_ID), + url: 'https://forum.dfinity.org', + title: 'ICP/XDR Conversion Rate', + summary: `Set ICP/XDR conversion rate to ${41_388}`, + action: { + ExecuteNnsFunction: { + nnsFunctionId: NnsFunction.IcpXdrConversionRate, + payloadBytes: arg + } + } + }; + + await makeProposal(request); +}; diff --git a/cli/src/modules/governance/index.ts b/cli/src/modules/governance/index.ts new file mode 100644 index 0000000..f8750df --- /dev/null +++ b/cli/src/modules/governance/index.ts @@ -0,0 +1,46 @@ +import {assertNonNullish} from '@dfinity/utils'; +import kleur from 'kleur'; +import {Module} from '../../services/modules.services'; +import type {ModuleDescription, ModuleInstallParams} from '../../types/module'; +import {prepareGovernanceArgs} from './governance.install'; +import {makeIcpXdrProposal} from './governance.post-install'; + +const {green, cyan} = kleur; + +const GOVERNANCE: ModuleDescription = { + key: 'governance', + name: 'NNS Governance', + canisterId: 'rrkah-fqaaa-aaaaa-aaaaq-cai' +}; + +class GovernanceModule extends Module { + override async install({state, identities, ...rest}: ModuleInstallParams): Promise { + const args = prepareGovernanceArgs({identities}); + + await super.install({ + state, + arg: args.serializeBinary(), + identities, + ...rest + }); + } + + override async postInstall(context: ModuleInstallParams): Promise { + await makeIcpXdrProposal(context); + + const {state} = context; + + const metadata = state.getModule(this.key); + + assertNonNullish( + metadata, + 'Module has not been installed and therefore cannot be post-installed!' + ); + + const {name, canisterId} = metadata; + + console.log(`🫠 ${green(name)} post-install. ID: ${cyan(canisterId.toString())}`); + } +} + +export const governance = new GovernanceModule(GOVERNANCE); diff --git a/cli/src/modules/modules.ts b/cli/src/modules/modules.ts index 0acc45e..3fb9b18 100644 --- a/cli/src/modules/modules.ts +++ b/cli/src/modules/modules.ts @@ -1,6 +1,8 @@ +import {cmc} from './cmc'; +import {governance} from './governance'; import {icpIndex} from './icp-index'; import {icpLedger} from './icp-ledger'; import {internetIdentity} from './internet-identity'; import {satellite} from './satellite'; -export const modules = [internetIdentity, icpLedger, icpIndex, satellite]; +export const modules = [internetIdentity, icpLedger, icpIndex, satellite, cmc, governance]; diff --git a/cli/src/services/modules.services.ts b/cli/src/services/modules.services.ts index 199cdd9..e15e1c0 100644 --- a/cli/src/services/modules.services.ts +++ b/cli/src/services/modules.services.ts @@ -168,6 +168,10 @@ export class Module { ); } + async postInstall(_context: ModuleInstallParams) { + // Default is do nothing after install + } + async start(_context: CliContext) { // Default is do nothing on start } diff --git a/modules.json b/modules.json index 4e26130..97aa802 100644 --- a/modules.json +++ b/modules.json @@ -31,5 +31,21 @@ "candid": [ "https://raw.githubusercontent.com/dfinity/ic/{commit}/rs/rosetta-api/icp_ledger/index/index.did" ] + }, + "cmc": { + "commit": "e790c6636115482db53ca3daa2f1900202ab04cf", + "repo": "https://github.com/dfinity/ic", + "url": "https://download.dfinity.systems/ic/{commit}/canisters/cycles-minting-canister.wasm.gz", + "candid": [ + "https://raw.githubusercontent.com/dfinity/ic/{commit}/rs/nns/cmc/cmc.did" + ] + }, + "governance": { + "commit": "e790c6636115482db53ca3daa2f1900202ab04cf", + "repo": "https://github.com/dfinity/ic", + "url": "https://download.dfinity.systems/ic/{commit}/canisters/governance-canister.wasm.gz", + "candid": [ + "https://raw.githubusercontent.com/dfinity/ic/{commit}/rs/nns/governance/canister/governance.did" + ] } }