From d67f051dc88cd11452c1bc3348798990f693ef28 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Wed, 1 Apr 2026 14:03:35 +0200 Subject: [PATCH] feat: remove custom install IC canisters --- cli/src/commands/deploy.ts | 21 +-- cli/src/constants/modules.constants.ts | 2 + cli/src/modules/cmc/cmc.install.ts | 46 ------ cli/src/modules/cmc/cmc.post-install.ts | 60 -------- cli/src/modules/cmc/index.ts | 47 ------ .../modules/governance/governance.install.ts | 142 ------------------ .../governance/governance.post-install.ts | 63 -------- cli/src/modules/governance/index.ts | 47 ------ cli/src/modules/icp-index.ts | 35 ----- cli/src/modules/icp-ledger.ts | 71 --------- cli/src/modules/internet-identity.ts | 50 ------ cli/src/modules/modules.ts | 19 +-- cli/src/services/server/ledger.services.ts | 2 +- 13 files changed, 5 insertions(+), 600 deletions(-) delete mode 100644 cli/src/modules/cmc/cmc.install.ts delete mode 100644 cli/src/modules/cmc/cmc.post-install.ts delete mode 100644 cli/src/modules/cmc/index.ts delete mode 100644 cli/src/modules/governance/governance.install.ts delete mode 100644 cli/src/modules/governance/governance.post-install.ts delete mode 100644 cli/src/modules/governance/index.ts delete mode 100644 cli/src/modules/icp-index.ts delete mode 100644 cli/src/modules/icp-ledger.ts delete mode 100644 cli/src/modules/internet-identity.ts diff --git a/cli/src/commands/deploy.ts b/cli/src/commands/deploy.ts index a431771f..b176c20d 100644 --- a/cli/src/commands/deploy.ts +++ b/cli/src/commands/deploy.ts @@ -1,6 +1,6 @@ import {isNullish} from '@dfinity/utils'; import kleur from 'kleur'; -import {modules, troublemakers} from '../modules/modules'; +import {modules} from '../modules/modules'; import {buildContext} from '../services/context.services'; import type {Module} from '../services/modules/module.services'; import type {CliContext} from '../types/context'; @@ -16,12 +16,6 @@ export const deploy = async (args?: string[]) => { installFn: installModulesParallel, postInstallFn: postInstallModulesParallel }); - await deployModules({ - context, - mods: troublemakers, - installFn: installModulesSerial, - postInstallFn: postInstallModulesSerial - }); }; interface DeployModulesParams { @@ -101,16 +95,3 @@ const postInstallModulesParallel = async ({ }) ); }; - -// Installing one after the other is slower 😢 -const installModulesSerial = async ({context, mods}: {context: CliContext; mods: Module[]}) => { - for (const mod of mods) { - await mod.install(context); - } -}; - -const postInstallModulesSerial = async ({context, mods}: {context: CliContext; mods: Module[]}) => { - for (const mod of mods) { - await mod.postInstall(context); - } -}; diff --git a/cli/src/constants/modules.constants.ts b/cli/src/constants/modules.constants.ts index a118358c..0faaf2e5 100644 --- a/cli/src/constants/modules.constants.ts +++ b/cli/src/constants/modules.constants.ts @@ -1 +1,3 @@ export const NEURON_ID = 666n; + +export const ICP_LEDGER_CANISTER_ID = 'ryjl3-tyaaa-aaaaa-aaaba-cai'; diff --git a/cli/src/modules/cmc/cmc.install.ts b/cli/src/modules/cmc/cmc.install.ts deleted file mode 100644 index d41d7b1c..00000000 --- a/cli/src/modules/cmc/cmc.install.ts +++ /dev/null @@ -1,46 +0,0 @@ -import {assertNonNullish} from '@dfinity/utils'; -import {AccountIdentifier} from '@icp-sdk/canisters/ledger/icp'; -import {IDL} from '@icp-sdk/core/candid'; -import {Principal} from '@icp-sdk/core/principal'; -import {MINTER_IDENTITY_KEY} from '../../constants/constants'; -import type {CyclesCanisterInitPayload} from '../../declarations/cmc'; -import {init} from '../../declarations/cmc.idl'; -import type {ModuleInstallParams} from '../../types/module'; - -export const prepareCmcArgs = ({ - state, - identities -}: Pick): Uint8Array => { - 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 - return IDL.encode(init({IDL}), [[sourceArg]]); -}; diff --git a/cli/src/modules/cmc/cmc.post-install.ts b/cli/src/modules/cmc/cmc.post-install.ts deleted file mode 100644 index f45573d3..00000000 --- a/cli/src/modules/cmc/cmc.post-install.ts +++ /dev/null @@ -1,60 +0,0 @@ -import {hexStringToUint8Array} from '@dfinity/utils'; -import {NnsFunction, NnsGovernanceCanister, type MakeProposalRequest} from '@icp-sdk/canisters/nns'; -import {IC_ROOT_KEY} from '@icp-sdk/core/agent'; -import {IDL} from '@icp-sdk/core/candid'; -import {Principal} from '@icp-sdk/core/principal'; -import {createAgent} from '../../api/agent.api'; -import {MAIN_IDENTITY_KEY} from '../../constants/constants'; -import {NEURON_ID} from '../../constants/modules.constants'; -import type {ModuleInstallParams} from '../../types/module'; - -export const makeAuthorizedSubnetworksProposal = async ({ - identities, - port -}: Pick) => { - const {[MAIN_IDENTITY_KEY]: identity} = identities; - - const agent = await createAgent({ - identity, - port - }); - - const {makeProposal} = NnsGovernanceCanister.create({ - agent - }); - - const icRootKey = hexStringToUint8Array(IC_ROOT_KEY); - - const subnetId = Principal.selfAuthenticating(icRootKey); - - const arg = IDL.encode( - [ - IDL.Record({ - who: IDL.Opt(IDL.Principal), - subnets: IDL.Vec(IDL.Principal) - }) - ], - [ - { - who: [], - subnets: [subnetId] - } - ] - ); - - const request: MakeProposalRequest = { - neuronId: NEURON_ID, - url: 'https://forum.dfinity.org', - title: 'Authorize CMC to create canisters in subnets', - summary: 'The lack of documentation makes developing anything with the CMC canister a pain.', - action: { - ExecuteNnsFunction: { - nnsFunctionId: NnsFunction.SetAuthorizedSubnetworks, - // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion - payloadBytes: arg.buffer as ArrayBuffer - } - } - }; - - await makeProposal(request); -}; diff --git a/cli/src/modules/cmc/index.ts b/cli/src/modules/cmc/index.ts deleted file mode 100644 index 2ddb9f7d..00000000 --- a/cli/src/modules/cmc/index.ts +++ /dev/null @@ -1,47 +0,0 @@ -import {assertNonNullish} from '@dfinity/utils'; -import kleur from 'kleur'; -import {Module} from '../../services/modules/module.services'; -import type {ModuleDescription, ModuleInstallParams} from '../../types/module'; -import {prepareCmcArgs} from './cmc.install'; -import {makeAuthorizedSubnetworksProposal} from './cmc.post-install'; - -const {green, cyan} = kleur; - -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 arg = prepareCmcArgs({identities, state}); - - await super.install({ - state, - arg, - identities, - ...rest - }); - } - - override async postInstall(context: ModuleInstallParams): Promise { - await makeAuthorizedSubnetworksProposal(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; - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion - console.log(`🫠 ${green(name)} post-install. ID: ${cyan(canisterId.toString())}`); - } -} - -export const cmc = new CmcModule(CMC); diff --git a/cli/src/modules/governance/governance.install.ts b/cli/src/modules/governance/governance.install.ts deleted file mode 100644 index 65e5cfbc..00000000 --- a/cli/src/modules/governance/governance.install.ts +++ /dev/null @@ -1,142 +0,0 @@ -import {fromNullable} from '@dfinity/utils'; -import {neuronSubaccount} from '@icp-sdk/canisters/sns'; -import type {Identity} from '@icp-sdk/core/agent'; -import {IDL} from '@icp-sdk/core/candid'; -import {MAIN_IDENTITY_KEY} from '../../constants/constants'; -import {NEURON_ID} from '../../constants/modules.constants'; -import type { - Decimal, - Governance, - NetworkEconomics, - Neuron, - NeuronsFundEconomics, - NeuronsFundMatchedFundingCurveCoefficients, - Percentage, - VotingPowerEconomics, - XdrConversionRate -} from '../../declarations/governance'; -import {init} from '../../declarations/governance.idl'; -import type {ModuleInstallParams} from '../../types/module'; - -export const prepareGovernanceArgs = ({ - identities -}: Pick): Uint8Array => { - 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 decimal = (value: string): Decimal => ({human_readable: [value]}); - - const efficients: NeuronsFundMatchedFundingCurveCoefficients = { - contribution_threshold_xdr: [decimal('75_000.0')], - one_third_participation_milestone_xdr: [decimal('225_000.0')], - full_participation_milestone_xdr: [decimal('375_000.0')] - }; - - const percentage = (value: bigint): Percentage => ({basis_points: [value]}); - - const fund: NeuronsFundEconomics = { - maximum_icp_xdr_rate: [percentage(1_000_000n)], // 1:100 - neurons_fund_matched_funding_curve_coefficients: [efficients], - max_theoretical_neurons_fund_participation_amount_xdr: [decimal('750_000.0')], - minimum_icp_xdr_rate: [percentage(10_000n)] // 1:1 - }; - - const ONE_DAY_SECONDS = 24n * 60n * 60n; - const ONE_YEAR_SECONDS = ((4n * 365n + 1n) * ONE_DAY_SECONDS) / 4n; - const ONE_MONTH_SECONDS = ONE_YEAR_SECONDS / 12n; - - const votingPowerEconomics: VotingPowerEconomics = { - start_reducing_voting_power_after_seconds: [6n * ONE_MONTH_SECONDS], - clear_following_after_seconds: [ONE_MONTH_SECONDS], - neuron_minimum_dissolve_delay_to_vote_seconds: [6n * ONE_MONTH_SECONDS] - }; - - const eco: NetworkEconomics = { - neuron_minimum_stake_e8s: E8S_PER_ICP, // 1 ICP - max_proposals_to_keep_per_topic: 100, - neuron_management_fee_per_proposal_e8s: 1_000_000n, // 0.01 ICP - reject_cost_e8s: E8S_PER_ICP, // 1 ICP - transaction_fee_e8s: DEFAULT_TRANSFER_FEE, - neuron_spawn_dissolve_delay_seconds: BigInt(24 * 60 * 60 * 7), // 7 days - minimum_icp_xdr_rate: 100n, // 1 XDR - maximum_node_provider_rewards_e8s: BigInt(1_000_000 * 100_000_000), // 1M ICP - neurons_fund_economics: [fund], - voting_power_economics: [votingPowerEconomics] - }; - - const xdr: XdrConversionRate = { - xdr_permyriad_per_icp: [10_000n], - timestamp_seconds: [1n] - }; - - const neuron = prepareNeuron({identity}); - - const gov: Governance = { - default_followees: [], - most_recent_monthly_node_provider_rewards: [], - maturity_modulation_last_updated_at_timestamp_seconds: [], - wait_for_quiet_threshold_seconds: BigInt(60 * 60 * 24 * 4), // 4 days - metrics: [], - neuron_management_voting_period_seconds: [], - node_providers: [], - cached_daily_maturity_modulation_basis_points: [], - economics: [eco], - restore_aging_summary: [], - spawning_neurons: [], - latest_reward_event: [], - to_claim_transfers: [], - short_voting_period_seconds: BigInt(60 * 60 * 12), // 12 hours - proposals: [], - xdr_conversion_rate: [xdr], - in_flight_commands: [], - neurons: [[fromNullable(neuron.id)?.id ?? NEURON_ID, neuron]], - genesis_timestamp_seconds: 0n - }; - - // Type definitions generated by Candid are not clean enough. - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - return IDL.encode(init({IDL}), [gov]); -}; - -const prepareNeuron = ({identity}: {identity: Identity}): Neuron => { - const subAccount = neuronSubaccount({ - index: 0, - controller: identity.getPrincipal() - }); - - const principalId = identity.getPrincipal(); - - const neuron: Neuron = { - id: [{id: NEURON_ID}], - staked_maturity_e8s_equivalent: [], - controller: [principalId], - recent_ballots: [], - kyc_verified: true, - neuron_type: [], - not_for_profit: true, - maturity_e8s_equivalent: 0n, - cached_neuron_stake_e8s: BigInt(1_000_000 * 100_000_000), // 1M ICP - created_timestamp_seconds: 0n, - auto_stake_maturity: [], - aging_since_timestamp_seconds: 0n, - hot_keys: [principalId], - account: subAccount, - joined_community_fund_timestamp_seconds: [], - dissolve_state: [{DissolveDelaySeconds: BigInt(24 * 60 * 60 * 365 * 8)}], // 8 * 365 days - followees: [], - neuron_fees_e8s: 0n, - visibility: [], - transfer: [], - known_neuron_data: [], - spawn_at_timestamp_seconds: [], - voting_power_refreshed_timestamp_seconds: [], - potential_voting_power: [], - deciding_voting_power: [], - maturity_disbursements_in_progress: [] - }; - - return neuron; -}; diff --git a/cli/src/modules/governance/governance.post-install.ts b/cli/src/modules/governance/governance.post-install.ts deleted file mode 100644 index 30876d5c..00000000 --- a/cli/src/modules/governance/governance.post-install.ts +++ /dev/null @@ -1,63 +0,0 @@ -import {NnsFunction, NnsGovernanceCanister, type MakeProposalRequest} from '@icp-sdk/canisters/nns'; -import {IDL} from '@icp-sdk/core/candid'; -import {createAgent} from '../../api/agent.api'; -import {MAIN_IDENTITY_KEY} from '../../constants/constants'; -import {NEURON_ID} from '../../constants/modules.constants'; -import type {ModuleInstallParams} from '../../types/module'; - -export const makeIcpXdrProposal = async ({ - identities, - port -}: Pick) => { - const {[MAIN_IDENTITY_KEY]: identity} = identities; - - const agent = await createAgent({ - identity, - port - }); - - const {makeProposal} = NnsGovernanceCanister.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: NEURON_ID, - url: 'https://forum.dfinity.org', - title: 'ICP/XDR Conversion Rate', - summary: `Set ICP/XDR conversion rate to 41388`, - action: { - ExecuteNnsFunction: { - nnsFunctionId: NnsFunction.IcpXdrConversionRate, - // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion - payloadBytes: arg.buffer as ArrayBuffer - } - } - }; - - await makeProposal(request); -}; diff --git a/cli/src/modules/governance/index.ts b/cli/src/modules/governance/index.ts deleted file mode 100644 index 7117d2b4..00000000 --- a/cli/src/modules/governance/index.ts +++ /dev/null @@ -1,47 +0,0 @@ -import {assertNonNullish} from '@dfinity/utils'; -import kleur from 'kleur'; -import {Module} from '../../services/modules/module.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 arg = prepareGovernanceArgs({identities}); - - await super.install({ - state, - arg, - 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; - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion - console.log(`🫠 ${green(name)} post-install. ID: ${cyan(canisterId.toString())}`); - } -} - -export const governance = new GovernanceModule(GOVERNANCE); diff --git a/cli/src/modules/icp-index.ts b/cli/src/modules/icp-index.ts deleted file mode 100644 index 6da33ea6..00000000 --- a/cli/src/modules/icp-index.ts +++ /dev/null @@ -1,35 +0,0 @@ -import {assertNonNullish} from '@dfinity/utils'; -import {IDL} from '@icp-sdk/core/candid'; -import {Principal} from '@icp-sdk/core/principal'; -import {init} from '../declarations/icp_index.idl'; -import {Module} from '../services/modules/module.services'; -import type {ModuleDescription, ModuleInstallParams} from '../types/module'; - -const ICP_INDEX: ModuleDescription = { - key: 'icp_index', - name: 'ICP Index', - canisterId: 'qhbym-qaaaa-aaaaa-aaafq-cai' -}; - -class IcpIndexModule extends Module { - override async install({state, ...rest}: ModuleInstallParams): Promise { - const canisterId = state.getModule('icp_ledger')?.canisterId; - - assertNonNullish( - canisterId, - 'Cannot configure ICP index because the ICP ledger id is unknown.' - ); - - // Type definitions generated by Candid are not clean enough. - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - const arg = IDL.encode(init({IDL}), [{ledger_id: Principal.fromText(canisterId)}]); - - await super.install({ - state, - arg, - ...rest - }); - } -} - -export const icpIndex = new IcpIndexModule(ICP_INDEX); diff --git a/cli/src/modules/icp-ledger.ts b/cli/src/modules/icp-ledger.ts deleted file mode 100644 index 85bdc8dc..00000000 --- a/cli/src/modules/icp-ledger.ts +++ /dev/null @@ -1,71 +0,0 @@ -import {AccountIdentifier} from '@icp-sdk/canisters/ledger/icp'; -import {IDL} from '@icp-sdk/core/candid'; -import {MAIN_IDENTITY_KEY, MINTER_IDENTITY_KEY} from '../constants/constants'; -import {init} from '../declarations/icp_ledger.idl'; -import {Module} from '../services/modules/module.services'; -import type {ModuleDescription, ModuleInstallParams} from '../types/module'; - -export const ICP_LEDGER_CANISTER_ID = 'ryjl3-tyaaa-aaaaa-aaaba-cai'; - -const ICP_LEDGER: ModuleDescription = { - key: 'icp_ledger', - name: 'ICP Ledger', - canisterId: ICP_LEDGER_CANISTER_ID -}; - -class IcpLedgerModule extends Module { - override async install(context: ModuleInstallParams): Promise { - const { - identities: { - [MINTER_IDENTITY_KEY]: minterIdentity, - [MAIN_IDENTITY_KEY]: mainIdentity, - ...otherIdentities - }, - ...rest - } = context; - - const minterAccountIdentifier = AccountIdentifier.fromPrincipal({ - principal: minterIdentity.getPrincipal() - }).toHex(); - - const ledgerAccountIdentifier = AccountIdentifier.fromPrincipal({ - principal: mainIdentity.getPrincipal() - }).toHex(); - - const initArgs = { - send_whitelist: [], - token_symbol: ['ICP'], - transfer_fee: [{e8s: 10_000n}], - minting_account: minterAccountIdentifier, - maximum_number_of_accounts: [], - accounts_overflow_trim_quantity: [], - transaction_window: [], - max_message_size_bytes: [], - icrc1_minting_account: [], - archive_options: [], - initial_values: [[ledgerAccountIdentifier, {e8s: 100_000_000_000n}]], - token_name: ['Internet Computer'], - feature_flags: [] - }; - - const upgradeArgs = []; - - // Type definitions generated by Candid are not clean enough. - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - const arg = IDL.encode(init({IDL}), [ - this.status(context) === 'deployed' ? {Upgrade: upgradeArgs} : {Init: initArgs} - ]); - - await super.install({ - identities: { - [MINTER_IDENTITY_KEY]: minterIdentity, - [MAIN_IDENTITY_KEY]: mainIdentity, - ...otherIdentities - }, - ...rest, - arg - }); - } -} - -export const icpLedger = new IcpLedgerModule(ICP_LEDGER); diff --git a/cli/src/modules/internet-identity.ts b/cli/src/modules/internet-identity.ts deleted file mode 100644 index f6cfae19..00000000 --- a/cli/src/modules/internet-identity.ts +++ /dev/null @@ -1,50 +0,0 @@ -import {toNullable} from '@dfinity/utils'; -import {IDL} from '@icp-sdk/core/candid'; -import type {InternetIdentityInit} from '../declarations/internet_identity'; -import {init} from '../declarations/internet_identity.idl'; -import {Module} from '../services/modules/module.services'; -import type {ModuleDescription, ModuleInstallParams} from '../types/module'; - -const INTERNET_IDENTITY: ModuleDescription = { - key: 'internet_identity', - name: 'Internet Identity', - canisterId: 'rdmx6-jaaaa-aaaaa-aaadq-cai' -}; - -class InternetIdentityModule extends Module { - override async install(params: ModuleInstallParams): Promise { - const initArgs: InternetIdentityInit = { - archive_config: toNullable(), - canister_creation_cycles_cost: toNullable(), - assigned_user_number_range: toNullable(), - register_rate_limit: toNullable(), - captcha_config: toNullable({ - max_unsolved_captchas: 50n, - captcha_trigger: { - Static: { - CaptchaDisabled: null - } - } - }), - fetch_root_key: [true], - is_production: [false], - enable_dapps_explorer: [false], - analytics_config: [], - related_origins: [], - new_flow_origins: [], - openid_configs: [], - dummy_auth: [] - }; - - // Type definitions generated by Candid are not clean enough. - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - const arg = IDL.encode(init({IDL}), [[initArgs]]); - - await super.install({ - arg, - ...params - }); - } -} - -export const internetIdentity = new InternetIdentityModule(INTERNET_IDENTITY); diff --git a/cli/src/modules/modules.ts b/cli/src/modules/modules.ts index f88b0726..da27fd84 100644 --- a/cli/src/modules/modules.ts +++ b/cli/src/modules/modules.ts @@ -1,26 +1,10 @@ import {nonNullish, notEmptyString} from '@dfinity/utils'; import type {Module} from '../services/modules/module.services'; -import {cmc} from './cmc'; import {consoleModule} from './console'; -import {governance} from './governance'; -import {icpIndex} from './icp-index'; -import {icpLedger} from './icp-ledger'; -import {internetIdentity} from './internet-identity'; import {observatory} from './observatory'; import {satellite} from './satellite'; -const MODULES = [internetIdentity, icpLedger, icpIndex, satellite, consoleModule, observatory]; - -// Canisters that require other modules (like the ledger) to be installed first -// before they can be initialized. Still a mystery how they were deployed at genesis... -// -// Also, the order matters. For example: -// - The CMC must be available when the Governance canister is installed. -// - The Governance must be available when the CMC post-install runs. -// - The CMC post-install must runs before the Governance one. -// -// Yolo -const TROUBLEMAKERS = [cmc, governance]; +const MODULES = [satellite, consoleModule, observatory]; const filterModules = (modules: Module[]): Module[] => (process.env.MODULES ?? '') @@ -30,4 +14,3 @@ const filterModules = (modules: Module[]): Module[] => .filter((mod) => nonNullish(mod)); export const modules = filterModules(MODULES); -export const troublemakers = filterModules(TROUBLEMAKERS); diff --git a/cli/src/services/server/ledger.services.ts b/cli/src/services/server/ledger.services.ts index b6e5126f..24cbc3b2 100644 --- a/cli/src/services/server/ledger.services.ts +++ b/cli/src/services/server/ledger.services.ts @@ -3,7 +3,7 @@ import {decodeIcrcAccount, IcrcLedgerCanister} from '@icp-sdk/canisters/ledger/i import {AnonymousIdentity} from '@icp-sdk/core/agent'; import {Principal} from '@icp-sdk/core/principal'; import {createAgent} from '../../api/agent.api'; -import {ICP_LEDGER_CANISTER_ID} from '../../modules/icp-ledger'; +import {ICP_LEDGER_CANISTER_ID} from '../../constants/modules.constants'; import type {CliContext} from '../../types/context'; export const transfer = async ({