@twin.org/move-to-json 0.0.3-next.7 → 0.0.3-next.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/cli.js CHANGED
@@ -21,7 +21,7 @@ export class CLI extends CLIBase {
21
21
  return this.execute({
22
22
  title: "TWIN Move to JSON",
23
23
  appName: "move-to-json",
24
- version: "0.0.3-next.7", // x-release-please-version
24
+ version: "0.0.3-next.9", // x-release-please-version
25
25
  icon: "⚙️ ",
26
26
  supportsEnvFiles: true,
27
27
  overrideOutputWidth: options?.overrideOutputWidth
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,GAAI,SAAQ,OAAO;IAC/B;;;;;;;OAOG;IACI,KAAK,CAAC,GAAG,CACf,IAAc,EACd,gBAAyB,EACzB,OAEC;QAED,OAAO,IAAI,CAAC,OAAO,CAClB;YACC,KAAK,EAAE,mBAAmB;YAC1B,OAAO,EAAE,cAAc;YACvB,OAAO,EAAE,cAAc,EAAE,2BAA2B;YACpD,IAAI,EAAE,KAAK;YACX,gBAAgB,EAAE,IAAI;YACtB,mBAAmB,EAAE,OAAO,EAAE,mBAAmB;SACjD,EACD,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,EACzF,IAAI,CACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACO,aAAa,CAAC,OAAgB;QACvC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC3B,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { CLIBase } from \"@twin.org/cli-core\";\nimport type { Command } from \"commander\";\nimport { buildCommandBuild } from \"./commands/build.js\";\nimport { buildCommandDeploy } from \"./commands/deploy.js\";\n\n/**\n * The main entry point for the Move to JSON CLI.\n */\nexport class CLI extends CLIBase {\n\t/**\n\t * Run the app.\n\t * @param argv The process arguments.\n\t * @param localesDirectory The directory for the locales, default to relative to the script.\n\t * @param options Additional options.\n\t * @param options.overrideOutputWidth Override the output width.\n\t * @returns The exit code.\n\t */\n\tpublic async run(\n\t\targv: string[],\n\t\tlocalesDirectory?: string,\n\t\toptions?: {\n\t\t\toverrideOutputWidth?: number;\n\t\t}\n\t): Promise<number> {\n\t\treturn this.execute(\n\t\t\t{\n\t\t\t\ttitle: \"TWIN Move to JSON\",\n\t\t\t\tappName: \"move-to-json\",\n\t\t\t\tversion: \"0.0.3-next.7\", // x-release-please-version\n\t\t\t\ticon: \"⚙️ \",\n\t\t\t\tsupportsEnvFiles: true,\n\t\t\t\toverrideOutputWidth: options?.overrideOutputWidth\n\t\t\t},\n\t\t\tlocalesDirectory ?? path.join(path.dirname(fileURLToPath(import.meta.url)), \"../locales\"),\n\t\t\targv\n\t\t);\n\t}\n\n\t/**\n\t * Configure any options or actions at the root program level.\n\t * @param program The root program command.\n\t */\n\tprotected configureRoot(program: Command): void {\n\t\tbuildCommandBuild(program);\n\t\tbuildCommandDeploy(program);\n\t}\n}\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,GAAI,SAAQ,OAAO;IAC/B;;;;;;;OAOG;IACI,KAAK,CAAC,GAAG,CACf,IAAc,EACd,gBAAyB,EACzB,OAEC;QAED,OAAO,IAAI,CAAC,OAAO,CAClB;YACC,KAAK,EAAE,mBAAmB;YAC1B,OAAO,EAAE,cAAc;YACvB,OAAO,EAAE,cAAc,EAAE,2BAA2B;YACpD,IAAI,EAAE,KAAK;YACX,gBAAgB,EAAE,IAAI;YACtB,mBAAmB,EAAE,OAAO,EAAE,mBAAmB;SACjD,EACD,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,EACzF,IAAI,CACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACO,aAAa,CAAC,OAAgB;QACvC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC3B,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { CLIBase } from \"@twin.org/cli-core\";\nimport type { Command } from \"commander\";\nimport { buildCommandBuild } from \"./commands/build.js\";\nimport { buildCommandDeploy } from \"./commands/deploy.js\";\n\n/**\n * The main entry point for the Move to JSON CLI.\n */\nexport class CLI extends CLIBase {\n\t/**\n\t * Run the app.\n\t * @param argv The process arguments.\n\t * @param localesDirectory The directory for the locales, default to relative to the script.\n\t * @param options Additional options.\n\t * @param options.overrideOutputWidth Override the output width.\n\t * @returns The exit code.\n\t */\n\tpublic async run(\n\t\targv: string[],\n\t\tlocalesDirectory?: string,\n\t\toptions?: {\n\t\t\toverrideOutputWidth?: number;\n\t\t}\n\t): Promise<number> {\n\t\treturn this.execute(\n\t\t\t{\n\t\t\t\ttitle: \"TWIN Move to JSON\",\n\t\t\t\tappName: \"move-to-json\",\n\t\t\t\tversion: \"0.0.3-next.9\", // x-release-please-version\n\t\t\t\ticon: \"⚙️ \",\n\t\t\t\tsupportsEnvFiles: true,\n\t\t\t\toverrideOutputWidth: options?.overrideOutputWidth\n\t\t\t},\n\t\t\tlocalesDirectory ?? path.join(path.dirname(fileURLToPath(import.meta.url)), \"../locales\"),\n\t\t\targv\n\t\t);\n\t}\n\n\t/**\n\t * Configure any options or actions at the root program level.\n\t * @param program The root program command.\n\t */\n\tprotected configureRoot(program: Command): void {\n\t\tbuildCommandBuild(program);\n\t\tbuildCommandDeploy(program);\n\t}\n}\n"]}
@@ -5,7 +5,7 @@ import path from "node:path";
5
5
  import { IotaClient } from "@iota/iota-sdk/client";
6
6
  import { requestIotaFromFaucetV0 } from "@iota/iota-sdk/faucet";
7
7
  import { CLIDisplay, CLIParam, CLIUtils } from "@twin.org/cli-core";
8
- import { Converter, GeneralError, Guards, I18n, Is, RandomHelper } from "@twin.org/core";
8
+ import { Coerce, Converter, GeneralError, Guards, I18n, Is, RandomHelper } from "@twin.org/core";
9
9
  import { Bip39, Bip44 } from "@twin.org/crypto";
10
10
  import { Iota, NetworkTypes } from "@twin.org/dlt-iota";
11
11
  import { cleanBuildArtifactsInPath } from "../utils/buildArtifactUtils.js";
@@ -398,6 +398,39 @@ async function determineDeploymentStrategy(contractData) {
398
398
  }
399
399
  return "initial-deploy";
400
400
  }
401
+ /**
402
+ * Query the on-chain UpgradeCap object to get the actual latest package ID.
403
+ * This is used to validate/correct the `published-at` value before upgrades,
404
+ * preventing failures when the deployment JSON is stale.
405
+ * @param rpcUrl RPC endpoint URL for the network.
406
+ * @param upgradeCapabilityId The UpgradeCap object ID on-chain.
407
+ * @returns The on-chain package ID and version, or undefined if query fails.
408
+ */
409
+ async function queryUpgradeCapPackage(rpcUrl, upgradeCapabilityId) {
410
+ try {
411
+ const client = new IotaClient({ url: rpcUrl });
412
+ const response = await client.getObject({
413
+ id: upgradeCapabilityId,
414
+ options: { showContent: true }
415
+ });
416
+ if (response.data?.content?.dataType === "moveObject") {
417
+ const fields = response.data.content.fields;
418
+ const fieldPackage = Coerce.string(fields.package);
419
+ const fieldVersion = Coerce.number(fields.version);
420
+ if (Is.stringValue(fieldPackage) && Is.number(fieldVersion)) {
421
+ return {
422
+ package: fieldPackage,
423
+ version: fieldVersion
424
+ };
425
+ }
426
+ }
427
+ return undefined;
428
+ }
429
+ catch {
430
+ // If query fails (e.g. network issue), return undefined to fall back to JSON value
431
+ return undefined;
432
+ }
433
+ }
401
434
  /**
402
435
  * Execute contract upgrade using iota client upgrade command.
403
436
  * @param contractData Contract data containing upgrade capability.
@@ -405,10 +438,27 @@ async function determineDeploymentStrategy(contractData) {
405
438
  * @returns Upgrade result with package ID and upgrade capability.
406
439
  */
407
440
  async function executeContractUpgrade(contractData, config) {
408
- // Store the previous deployedPackageId for "published-at" field in Move.toml
409
- // Use lastDeployedPackageId which tracks the previous deployment for upgrade chain
410
- const previousDeployedPackageId = contractData.lastDeployedPackageId;
411
- if (!previousDeployedPackageId) {
441
+ // Start with lastDeployedPackageId from JSON as the candidate for "published-at"
442
+ let publishedAtPackageId = contractData.lastDeployedPackageId;
443
+ // Query the on-chain UpgradeCap to get the actual latest package ID.
444
+ // This prevents failures when the JSON is stale
445
+ if (Is.stringValue(contractData.upgradeCapabilityId)) {
446
+ CLIDisplay.task(I18n.formatMessage("commands.deploy.progress.queryingUpgradeCap"));
447
+ const onChainCap = await queryUpgradeCapPackage(config.rpc.url, contractData.upgradeCapabilityId);
448
+ if (onChainCap) {
449
+ CLIDisplay.value(I18n.formatMessage("commands.deploy.labels.onChainPackageId"), onChainCap.package, 1);
450
+ CLIDisplay.value(I18n.formatMessage("commands.deploy.labels.onChainVersion"), String(onChainCap.version), 1);
451
+ if (publishedAtPackageId !== onChainCap.package) {
452
+ CLIDisplay.value(I18n.formatMessage("commands.deploy.labels.warning"), I18n.formatMessage("commands.deploy.messages.staleJsonDetected", {
453
+ jsonPackageId: publishedAtPackageId ?? "none",
454
+ onChainPackageId: onChainCap.package
455
+ }), 2);
456
+ publishedAtPackageId = onChainCap.package;
457
+ contractData.lastDeployedPackageId = onChainCap.package;
458
+ }
459
+ }
460
+ }
461
+ if (!publishedAtPackageId) {
412
462
  throw new GeneralError("commands", "commands.deploy.noPreviousDeploymentForUpgrade");
413
463
  }
414
464
  const moveTomlPaths = [];
@@ -424,8 +474,8 @@ async function executeContractUpgrade(contractData, config) {
424
474
  const projectRoot = path.dirname(moveTomlPath);
425
475
  const backupPath = await backupMoveToml(moveTomlPath);
426
476
  try {
427
- // Update Move.toml with "published-at" = previous deployedPackageId
428
- await updateMoveTomlPublishedAt(moveTomlPath, previousDeployedPackageId);
477
+ // Update Move.toml with "published-at" = validated package ID (from chain or JSON)
478
+ await updateMoveTomlPublishedAt(moveTomlPath, publishedAtPackageId);
429
479
  await validateContractIsBuilt(contractData, projectRoot);
430
480
  // Execute upgrade command
431
481
  const upgradeCapabilityId = contractData.upgradeCapabilityId;
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ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AmB,EAAE,EAAE,CAAC,IAAI,KAAK,eAAe,CACzD,CAAC;QAEF,IAAI,CAAC,aAAa,EAAE,CAAC;YACpB,MAAM,IAAI,YAAY,CAAC,UAAU,EAAE,oCAAoC,EAAE;gBACxE,eAAe;gBACf,SAAS;aACT,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,YAAY,CACrB,UAAU,EACV,wCAAwC,EACxC,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,EACvC,KAAK,CACL,CAAC;IACH,CAAC;AACF,CAAC;AAED;;;;;;;GAOG;AACH,KAAK,UAAU,wBAAwB,CACtC,OAAqB,EACrB,SAAiB,EACjB,YAAoB,EACpB,aAAqB,EACrB,gBAAwB;IAExB,UAAU,CAAC,IAAI,CACd,IAAI,CAAC,aAAa,CAAC,+CAA+C,EAAE,EAAE,SAAS,EAAE,CAAC,CAClF,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IACxE,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;IAE7F,MAAM,kBAAkB,CACvB,wBAAwB,QAAQ,cAAc,cAAc,cAAc,SAAS,GAAG,CACtF,CAAC;IAEF,UAAU,CAAC,KAAK,CACf,IAAI,CAAC,aAAa,CAAC,4CAA4C,CAAC,EAChE,GAAG,SAAS,KAAK,aAAa,GAAG,EACjC,CAAC,CACD,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { promises as fsPromises } from \"node:fs\";\nimport path from \"node:path\";\nimport { IotaClient } from \"@iota/iota-sdk/client\";\nimport { requestIotaFromFaucetV0 } from \"@iota/iota-sdk/faucet\";\nimport { CLIDisplay, CLIParam, CLIUtils } from \"@twin.org/cli-core\";\nimport { Converter, GeneralError, Guards, I18n, Is, RandomHelper } from \"@twin.org/core\";\nimport { Bip39, Bip44 } from \"@twin.org/crypto\";\nimport {\n\tIota,\n\tNetworkTypes,\n\ttype IContractData,\n\ttype ISmartContractDeployments\n} from \"@twin.org/dlt-iota\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type { Command } from \"commander\";\nimport type { INetworkConfig } from \"../models/INetworkConfig.js\";\nimport { cleanBuildArtifactsInPath } from \"../utils/buildArtifactUtils.js\";\nimport { ensureEnvironment, execAsyncWithError } from \"../utils/environmentUtils.js\";\nimport {\n\tgetDeploymentMnemonic,\n\tgetDeploymentSeed,\n\tvalidateDeploymentEnvironment\n} from \"../utils/envSetup.js\";\nimport { verifyIotaSDK } from \"../utils/iotaUtils.js\";\nimport { searchDirectoryForMoveToml } from \"../utils/moveToJsonUtils.js\";\n\n/**\n * Build the deploy command.\n * @param program The command program.\n */\nexport function buildCommandDeploy(program: Command): void {\n\tprogram\n\t\t.command(\"deploy\")\n\t\t.description(I18n.formatMessage(\"commands.deploy.description\"))\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.contracts.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.contracts.description\"),\n\t\t\t\"smart-contract-deployments.json\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.network.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.network.description\"),\n\t\t\t\"!NETWORK\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.dryRun.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.dryRun.description\")\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.force.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.force.description\")\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.rpcUrl.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.rpcUrl.description\"),\n\t\t\t\"!RPC_URL\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.addressIndex.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.addressIndex.description\"),\n\t\t\t\"!ADDRESS_INDEX\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.rpcTimeout.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.rpcTimeout.description\"),\n\t\t\t\"!RPC_TIMEOUT\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.gasBudget.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.gasBudget.description\"),\n\t\t\t\"!GAS_BUDGET\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.confirmationTimeout.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.confirmationTimeout.description\"),\n\t\t\t\"!CONFIRMATION_TIMEOUT\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.faucetUrl.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.faucetUrl.description\"),\n\t\t\t\"!FAUCET_URL\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.deployerMnemonic.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.deployerMnemonic.description\"),\n\t\t\t\"!DEPLOYER_MNEMONIC\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.deployerSeed.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.deployerSeed.description\"),\n\t\t\t\"!DEPLOYER_SEED\"\n\t\t)\n\t\t.action(actionCommandDeploy);\n}\n\n/**\n * Action for the deploy command.\n * @param opts Command options.\n * @param opts.contracts Path to compiled modules JSON.\n * @param opts.network Network identifier - optional if NETWORK env var is set.\n * @param opts.dryRun Simulate deployment without executing.\n * @param opts.force Force redeployment of existing packages.\n * @param opts.rpcUrl RPC endpoint URL for the network.\n * @param opts.addressIndex Address index for key derivation.\n * @param opts.rpcTimeout RPC request timeout in milliseconds.\n * @param opts.gasBudget Gas budget for transactions.\n * @param opts.confirmationTimeout Transaction confirmation timeout in milliseconds.\n * @param opts.faucetUrl Faucet URL for requesting test tokens.\n * @param opts.deployerMnemonic Deployer wallet mnemonic phrase.\n * @param opts.deployerSeed Deployer wallet seed (alternative to mnemonic).\n */\nexport async function actionCommandDeploy(opts: {\n\tcontracts?: string;\n\tnetwork?: NetworkTypes;\n\tdryRun?: boolean;\n\tforce?: boolean;\n\trpcUrl?: string;\n\taddressIndex?: string;\n\trpcTimeout?: string;\n\tgasBudget?: string;\n\tconfirmationTimeout?: string;\n\tfaucetUrl?: string;\n\tdeployerMnemonic?: string;\n\tdeployerSeed?: string;\n}): Promise<void> {\n\tconst network = CLIParam.arrayOneOf<NetworkTypes>(\n\t\t\"network\",\n\t\topts.network,\n\t\tObject.values(NetworkTypes),\n\t\ttrue\n\t);\n\n\tconst contractsPath = opts.contracts ?? \"smart-contract-deployments.json\";\n\tconst dryRun = opts.dryRun ?? false;\n\tconst force = opts.force ?? false;\n\n\tCLIDisplay.section(I18n.formatMessage(\"commands.deploy.section.deployContracts\"));\n\tCLIDisplay.section(contractsPath);\n\n\t// Verify the IOTA SDK before we do anything else\n\tawait verifyIotaSDK();\n\n\t// Get configuration values needed for environment setup\n\tconst rpcUrl: string = CLIParam.stringValue(\"rpcUrl\", opts.rpcUrl);\n\tconst addressIndex = CLIParam.number(\"addressIndex\", opts.addressIndex) ?? 0;\n\tconst rpcTimeout = CLIParam.number(\"rpcTimeout\", opts.rpcTimeout);\n\tconst gasBudget = CLIParam.number(\"gasBudget\", opts.gasBudget);\n\tconst confirmationTimeout = CLIParam.number(\"confirmationTimeout\", opts.confirmationTimeout);\n\tconst faucetUrl: string | undefined =\n\t\tnetwork === NetworkTypes.Mainnet\n\t\t\t? undefined\n\t\t\t: CLIParam.stringValue(\"faucetUrl\", opts.faucetUrl);\n\n\tlet deployerMnemonic: string | undefined;\n\ttry {\n\t\tdeployerMnemonic = CLIParam.stringValue(\"deployerMnemonic\", opts.deployerMnemonic);\n\t} catch {\n\t\t// Optional parameter, can be undefined\n\t\tdeployerMnemonic = undefined;\n\t}\n\n\tlet deployerSeed: string | undefined;\n\ttry {\n\t\tdeployerSeed = CLIParam.stringValue(\"deployerSeed\", opts.deployerSeed);\n\t} catch {\n\t\t// Optional parameter, can be undefined\n\t\tdeployerSeed = undefined;\n\t}\n\n\t// Validate that at least one deployer credential is provided\n\tconst hasValidMnemonic = Is.stringValue(deployerMnemonic);\n\tconst hasValidSeed = Is.stringValue(deployerSeed);\n\n\tif (!hasValidMnemonic && !hasValidSeed) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.deployerCredentialRequired\", {\n\t\t\tnetwork\n\t\t});\n\t}\n\n\t// Check/switch to target network environment BEFORE loading config\n\tawait setIotaEnvironment(network, rpcUrl, addressIndex, dryRun, deployerMnemonic, deployerSeed);\n\n\tconst config = await createNetworkConfig(\n\t\tnetwork,\n\t\trpcUrl,\n\t\taddressIndex,\n\t\trpcTimeout,\n\t\tgasBudget,\n\t\tconfirmationTimeout\n\t);\n\tvalidateNetworkConfig(config, network);\n\n\tconst contractsData = await loadCompiledContracts(contractsPath);\n\n\tif (network === NetworkTypes.Mainnet) {\n\t\tconst validatedMnemonic = await getDeploymentMnemonic(\n\t\t\tnetwork,\n\t\t\thasValidMnemonic ? deployerMnemonic : undefined\n\t\t);\n\t\tawait validateDeploymentEnvironment(network, validatedMnemonic);\n\t}\n\n\tconst networkContracts = contractsData[network];\n\tif (!Is.object<IContractData>(networkContracts)) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.noContractsFound\", {\n\t\t\tnetwork,\n\t\t\tcontractsPath\n\t\t});\n\t}\n\n\tawait deployContract(\n\t\t\"contract\",\n\t\tnetworkContracts,\n\t\tconfig,\n\t\tnetwork,\n\t\tdryRun,\n\t\tforce,\n\t\tfaucetUrl,\n\t\tdeployerMnemonic,\n\t\tdeployerSeed\n\t);\n\n\tif (!dryRun) {\n\t\tawait updateContractsFile(contractsPath, contractsData);\n\t}\n\n\tCLIDisplay.done();\n}\n\n/**\n * Switch IOTA CLI to the target network environment and set the active address.\n * @param network Target network to switch to\n * @param rpcUrl The RPC URL for the network\n * @param addressIndex The address index to derive the target address\n * @param dryRun Whether this is a dry run (checks environment but doesn't switch)\n * @param deployerMnemonic The deployer mnemonic from environment variables.\n * @param deployerSeed The deployer seed from environment variables (optional).\n */\nasync function setIotaEnvironment(\n\tnetwork: NetworkTypes,\n\trpcUrl: string,\n\taddressIndex: number,\n\tdryRun: boolean = false,\n\tdeployerMnemonic?: string,\n\tdeployerSeed?: string\n): Promise<void> {\n\ttry {\n\t\tCLIDisplay.task(\n\t\t\tdryRun\n\t\t\t\t? I18n.formatMessage(\"commands.deploy.progress.checkingEnvironment\")\n\t\t\t\t: I18n.formatMessage(\"commands.deploy.progress.settingEnvironment\")\n\t\t);\n\n\t\t// Ensure environment exists, create if necessary\n\t\tGuards.stringValue(\"setIotaEnvironment\", nameof(rpcUrl), rpcUrl);\n\n\t\tawait ensureEnvironment(network, rpcUrl);\n\n\t\tif (dryRun) {\n\t\t\tCLIDisplay.value(\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.iotaEnvironmentCheck\"),\n\t\t\t\t`✅ ${network} environment exists`,\n\t\t\t\t1\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// Derive the target address from existing mnemonic/seed\n\t\tconst targetAddress = await getDeploymentWalletAddress(\n\t\t\tnetwork,\n\t\t\taddressIndex,\n\t\t\tdeployerMnemonic,\n\t\t\tdeployerSeed\n\t\t);\n\n\t\t// Ensure the correct deployer key exists in the keystore\n\t\tconst aliasName = `deployer-${network}`;\n\t\tconst validatedMnemonic = await getDeploymentMnemonic(network, deployerMnemonic);\n\t\tawait ensureCorrectDeployerKey(\n\t\t\tnetwork,\n\t\t\taliasName,\n\t\t\ttargetAddress,\n\t\t\taddressIndex,\n\t\t\tvalidatedMnemonic\n\t\t);\n\n\t\t// Switch both environment and address in one command\n\t\tawait execAsyncWithError(`iota client switch --env ${network} --address ${targetAddress}`);\n\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.switchedIotaEnvironment\"),\n\t\t\tnetwork,\n\t\t\t1\n\t\t);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.switchedActiveAddress\"),\n\t\t\ttargetAddress,\n\t\t\t1\n\t\t);\n\n\t\t// Verify the switch was successful\n\t\tconst { stdout: activeEnv } = await execAsyncWithError(\"iota client active-env\");\n\t\tif (!activeEnv.includes(network)) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.environmentSwitchFailed\", {\n\t\t\t\tnetwork,\n\t\t\t\tactiveEnv\n\t\t\t});\n\t\t}\n\n\t\t// Verify address switch was successful\n\t\tconst { stdout: activeAddressOutput } = await execAsyncWithError(\"iota client active-address\");\n\t\tconst activeAddress = activeAddressOutput.trim();\n\t\tif (activeAddress !== targetAddress) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.addressSwitchFailed\", {\n\t\t\t\tnetwork,\n\t\t\t\ttargetAddress,\n\t\t\t\tactiveAddress\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\tthrow new GeneralError(\n\t\t\t\"commands\",\n\t\t\t\"commands.deploy.environmentOperationFailed\",\n\t\t\t{ network, operation: dryRun ? \"check\" : \"switch to\" },\n\t\t\terror\n\t\t);\n\t}\n}\n\n/**\n * Creates the network configuration.\n * @param network Target network to determine which env file to load.\n * @param rpcUrl The RPC URL for the network.\n * @param addressIndex The address index for the wallet.\n * @param rpcTimeout The RPC timeout in milliseconds.\n * @param gasBudget The gas budget for deployment.\n * @param confirmationTimeout The confirmation timeout in seconds.\n * @returns Network configuration.\n */\nasync function createNetworkConfig(\n\tnetwork: NetworkTypes,\n\trpcUrl: string,\n\taddressIndex: number,\n\trpcTimeout?: number,\n\tgasBudget?: number,\n\tconfirmationTimeout?: number\n): Promise<INetworkConfig> {\n\ttry {\n\t\tGuards.stringValue(\"createNetworkConfig\", nameof(rpcUrl), rpcUrl);\n\n\t\tconst config: INetworkConfig = {\n\t\t\tnetwork,\n\t\t\tplatform: \"iota\",\n\t\t\trpc: {\n\t\t\t\turl: rpcUrl,\n\t\t\t\ttimeout: rpcTimeout ?? 60000\n\t\t\t},\n\t\t\tdeployment: {\n\t\t\t\tgasBudget: gasBudget ?? 50000000,\n\t\t\t\tconfirmationTimeout: confirmationTimeout ?? 60,\n\t\t\t\twallet: {\n\t\t\t\t\taddressIndex\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\treturn config;\n\t} catch (err) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.networkConfigInvalid\", { network }, err);\n\t}\n}\n\n/**\n * Validate network configuration matches expected network.\n * @param config Network configuration.\n * @param expectedNetwork Expected network type.\n * @throws GeneralError if the network configuration is invalid.\n */\nfunction validateNetworkConfig(config: INetworkConfig, expectedNetwork: NetworkTypes): void {\n\tif (config.network !== expectedNetwork) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.networkMismatch\", {\n\t\t\texpected: expectedNetwork,\n\t\t\tactual: config.network,\n\t\t\thelp: `Configuration file specifies '${config.network}' but command targets '${expectedNetwork}'`\n\t\t});\n\t}\n\n\tif (!Is.stringValue(config.rpc?.url)) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.rpcUrlRequired\", {\n\t\t\tnetwork: expectedNetwork\n\t\t});\n\t}\n\n\tif (!Is.number(config.deployment?.gasBudget)) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.gasBudgetRequired\", {\n\t\t\tnetwork: expectedNetwork\n\t\t});\n\t}\n}\n\n/**\n * Load compiled contracts from file.\n * @param contractsPath Path to contracts file.\n * @returns Compiled contracts data.\n */\nasync function loadCompiledContracts(contractsPath: string): Promise<ISmartContractDeployments> {\n\ttry {\n\t\tif (!(await CLIUtils.fileExists(contractsPath))) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.contractsFileNotFound\", {\n\t\t\t\tcontractsPath\n\t\t\t});\n\t\t}\n\n\t\tconst contracts = await CLIUtils.readJsonFile<ISmartContractDeployments>(contractsPath);\n\n\t\tif (!Is.object(contracts)) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.invalidContractsFile\");\n\t\t}\n\n\t\treturn contracts;\n\t} catch (err) {\n\t\tthrow new GeneralError(\n\t\t\t\"commands\",\n\t\t\t\"commands.deploy.contractsLoadFailed\",\n\t\t\t{ contractsPath },\n\t\t\terr\n\t\t);\n\t}\n}\n\n/**\n * Validate environment and setup for deployment based on network type.\n * @param network Target network.\n * @param config Network configuration.\n * @param isDryRun Whether this is a dry run.\n * @param faucetUrl The faucet URL (optional, defaults to network-specific URL).\n * @param deployerMnemonic The deployer mnemonic for validation.\n * @param deployerSeed The deployer seed (optional).\n * @returns Wallet address for the deployment.\n */\nasync function validateEnvironmentForNetwork(\n\tnetwork: NetworkTypes,\n\tconfig: INetworkConfig,\n\tisDryRun: boolean = false,\n\tfaucetUrl?: string,\n\tdeployerMnemonic?: string,\n\tdeployerSeed?: string\n): Promise<string> {\n\tconst walletAddress = await getDeploymentWalletAddress(\n\t\tnetwork,\n\t\tconfig.deployment.wallet.addressIndex,\n\t\tdeployerMnemonic,\n\t\tdeployerSeed\n\t);\n\n\tif (isDryRun) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.dryRunWalletAddress\"),\n\t\t\twalletAddress,\n\t\t\t1\n\t\t);\n\t} else {\n\t\tCLIDisplay.value(I18n.formatMessage(\"commands.deploy.labels.walletAddress\"), walletAddress, 1);\n\t}\n\n\tif (network === NetworkTypes.Mainnet) {\n\t\tconst validatedMnemonic = await getDeploymentMnemonic(network, deployerMnemonic);\n\t\tawait validateDeploymentEnvironment(network, validatedMnemonic);\n\t} else if ((network === NetworkTypes.Testnet || network === NetworkTypes.Devnet) && !isDryRun) {\n\t\t// For testnet/devnet, check balance first and only request funds if needed\n\t\tawait checkBalanceAndRequestFaucetIfNeeded(network, config, walletAddress, faucetUrl);\n\t}\n\n\treturn walletAddress;\n}\n\n/**\n * Check wallet balance and display relevant information.\n * @param network Target network.\n * @param config Network configuration.\n * @param walletAddress Wallet address.\n * @param isDryRun Whether this is a dry run.\n * @returns Balance in nanos.\n */\nasync function checkWalletBalance(\n\tnetwork: NetworkTypes,\n\tconfig: INetworkConfig,\n\twalletAddress: string,\n\tisDryRun: boolean = false\n): Promise<number> {\n\tconst client = new IotaClient({ url: config.rpc.url });\n\tconst balanceResponse = await client.getBalance({ owner: walletAddress });\n\tconst balanceInNanos = Number(balanceResponse.totalBalance);\n\tconst requiredInNanos = config.deployment.gasBudget;\n\n\tconst balanceInIota = nanosToIota(balanceInNanos);\n\tconst requiredInIota = nanosToIota(requiredInNanos);\n\n\tconst balanceLabel = isDryRun\n\t\t? \"commands.deploy.labels.dryRunWalletBalance\"\n\t\t: \"commands.deploy.labels.walletBalance\";\n\tconst gasBudgetLabel = isDryRun\n\t\t? \"commands.deploy.labels.dryRunGasBudget\"\n\t\t: \"commands.deploy.labels.gasBudget\";\n\n\tCLIDisplay.value(I18n.formatMessage(balanceLabel), `${balanceInIota.toFixed(2)} IOTA`, 1);\n\tCLIDisplay.value(I18n.formatMessage(gasBudgetLabel), `${requiredInIota.toFixed(2)} IOTA`, 1);\n\n\t// Handle insufficient balance based on network and run type (compare in same units - nanos)\n\tif (balanceInNanos < requiredInNanos) {\n\t\tif (isDryRun) {\n\t\t\tCLIDisplay.value(\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.warning\"),\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.insufficientBalanceWarning\", {\n\t\t\t\t\tcurrentBalance: balanceInIota.toFixed(2),\n\t\t\t\t\trequiredBalance: requiredInIota.toFixed(2)\n\t\t\t\t}),\n\t\t\t\t2\n\t\t\t);\n\t\t} else if (network === NetworkTypes.Mainnet) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.insufficientBalance\", {\n\t\t\t\tbalance: balanceInIota,\n\t\t\t\trequired: requiredInIota,\n\t\t\t\twalletAddress\n\t\t\t});\n\t\t} else {\n\t\t\t// For testnet/devnet, show warning but continue\n\t\t\tCLIDisplay.value(\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.warning\"),\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.insufficientBalanceAfterFaucet\", {\n\t\t\t\t\tnetwork,\n\t\t\t\t\tbalance: balanceInIota.toFixed(2),\n\t\t\t\t\trequired: requiredInIota.toFixed(2),\n\t\t\t\t\twalletAddress\n\t\t\t\t}),\n\t\t\t\t2\n\t\t\t);\n\t\t}\n\t}\n\n\treturn balanceInNanos;\n}\n\n/**\n * Handle dry run validation and display.\n * @param contractName Name of the contract.\n * @param contractData Contract data.\n * @param config Network configuration.\n * @param network Target network.\n * @param faucetUrl The faucet URL (optional, defaults to network-specific URL).\n * @param deployerMnemonic The deployer mnemonic from environment variables.\n * @param deployerSeed The deployer seed from environment variables (optional).\n */\nasync function handleDryRunValidation(\n\tcontractName: string,\n\tcontractData: IContractData,\n\tconfig: INetworkConfig,\n\tnetwork: NetworkTypes,\n\tfaucetUrl?: string,\n\tdeployerMnemonic?: string,\n\tdeployerSeed?: string\n): Promise<void> {\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.dryRunWouldDeploy\"),\n\t\t`${contractName} (${network})`,\n\t\t1\n\t);\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.dryRunPackageId\"),\n\t\tcontractData.packageId,\n\t\t1\n\t);\n\tCLIDisplay.value(I18n.formatMessage(\"commands.deploy.labels.dryRunRpcUrl\"), config.rpc.url, 1);\n\n\ttry {\n\t\tconst walletAddress = await validateEnvironmentForNetwork(\n\t\t\tnetwork,\n\t\t\tconfig,\n\t\t\ttrue,\n\t\t\tfaucetUrl,\n\t\t\tdeployerMnemonic,\n\t\t\tdeployerSeed\n\t\t);\n\t\tawait checkWalletBalance(network, config, walletAddress, true);\n\t} catch (err) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.warning\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.environmentValidationWarning\", {\n\t\t\t\tmessage: (err as Error).message\n\t\t\t}),\n\t\t\t2\n\t\t);\n\t}\n}\n\n/**\n * Handle actual deployment execution.\n * @param contractName Name of the contract.\n * @param contractData Contract data.\n * @param config Network configuration.\n * @param network Target network.\n * @param faucetUrl The faucet URL (optional, defaults to network-specific URL).\n * @param deployerMnemonic The deployer mnemonic from environment variables.\n * @param deployerSeed The deployer seed from environment variables (optional).\n */\nasync function handleActualDeployment(\n\tcontractName: string,\n\tcontractData: IContractData,\n\tconfig: INetworkConfig,\n\tnetwork: NetworkTypes,\n\tfaucetUrl?: string,\n\tdeployerMnemonic?: string,\n\tdeployerSeed?: string\n): Promise<void> {\n\ttry {\n\t\tconst walletAddress = await validateEnvironmentForNetwork(\n\t\t\tnetwork,\n\t\t\tconfig,\n\t\t\tfalse,\n\t\t\tfaucetUrl,\n\t\t\tdeployerMnemonic,\n\t\t\tdeployerSeed\n\t\t);\n\t\tawait checkWalletBalance(network, config, walletAddress, false);\n\n\t\tconst deploymentResult = await deployWithIotaCli(config.deployment.gasBudget);\n\n\t\tcontractData.deployedPackageId = deploymentResult.packageId;\n\t\tcontractData.upgradeCapabilityId = deploymentResult.upgradeCap;\n\n\t\tif (deploymentResult.migrationStateId) {\n\t\t\tcontractData.migrationStateId = deploymentResult.migrationStateId;\n\t\t}\n\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.deployedPackageIdResult\"),\n\t\t\tdeploymentResult.packageId,\n\t\t\t1\n\t\t);\n\t\tif (deploymentResult.upgradeCap) {\n\t\t\tCLIDisplay.value(\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.upgradeCapabilityIdResult\"),\n\t\t\t\tdeploymentResult.upgradeCap,\n\t\t\t\t1\n\t\t\t);\n\t\t}\n\t\tif (contractData.migrationStateId) {\n\t\t\tCLIDisplay.value(\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.migrationStateIdResult\"),\n\t\t\t\tcontractData.migrationStateId,\n\t\t\t\t1\n\t\t\t);\n\t\t}\n\t} catch (err) {\n\t\tthrow new GeneralError(\n\t\t\t\"commands\",\n\t\t\t\"commands.deploy.deploymentFailed\",\n\t\t\t{ contract: contractName },\n\t\t\terr\n\t\t);\n\t}\n}\n\n/**\n * Determine the deployment strategy based on contract state.\n * @param contractData Contract data to analyze.\n * @returns Deployment strategy: initial-deploy, upgrade or already-deployed.\n */\nasync function determineDeploymentStrategy(\n\tcontractData: IContractData\n): Promise<\"initial-deploy\" | \"upgrade\" | \"already-deployed\"> {\n\tif (Is.stringValue(contractData.deployedPackageId)) {\n\t\treturn \"already-deployed\";\n\t}\n\n\tif (Is.stringValue(contractData.lastDeployedPackageId)) {\n\t\treturn \"upgrade\";\n\t}\n\n\treturn \"initial-deploy\";\n}\n\n/**\n * Execute contract upgrade using iota client upgrade command.\n * @param contractData Contract data containing upgrade capability.\n * @param config Network configuration.\n * @returns Upgrade result with package ID and upgrade capability.\n */\nasync function executeContractUpgrade(\n\tcontractData: IContractData,\n\tconfig: INetworkConfig\n): Promise<{ packageId: string; upgradeCap: string; migrationStateId?: string }> {\n\t// Store the previous deployedPackageId for \"published-at\" field in Move.toml\n\t// Use lastDeployedPackageId which tracks the previous deployment for upgrade chain\n\tconst previousDeployedPackageId = contractData.lastDeployedPackageId;\n\tif (!previousDeployedPackageId) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.noPreviousDeploymentForUpgrade\");\n\t}\n\n\tconst moveTomlPaths: string[] = [];\n\tawait searchDirectoryForMoveToml(process.cwd(), moveTomlPaths);\n\n\tif (moveTomlPaths.length === 0) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.noMoveTomlFilesFound\", {\n\t\t\tcurrentDir: process.cwd()\n\t\t});\n\t}\n\n\tconst currentDirMoveToml = path.join(process.cwd(), \"Move.toml\");\n\tconst selectedMoveToml = moveTomlPaths.find(p => p === currentDirMoveToml) ?? moveTomlPaths[0];\n\tconst moveTomlPath = selectedMoveToml;\n\tconst projectRoot = path.dirname(moveTomlPath);\n\n\tconst backupPath = await backupMoveToml(moveTomlPath);\n\n\ttry {\n\t\t// Update Move.toml with \"published-at\" = previous deployedPackageId\n\t\tawait updateMoveTomlPublishedAt(moveTomlPath, previousDeployedPackageId);\n\n\t\tawait validateContractIsBuilt(contractData, projectRoot);\n\n\t\t// Execute upgrade command\n\t\tconst upgradeCapabilityId = contractData.upgradeCapabilityId;\n\t\tif (!upgradeCapabilityId) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.upgradeCapabilityNotFound\");\n\t\t}\n\t\tconst upgradeResult = await executeUpgradeWithIotaCli(\n\t\t\tupgradeCapabilityId,\n\t\t\tconfig.deployment.gasBudget,\n\t\t\tprojectRoot\n\t\t);\n\n\t\t// Update contract data with new package ID\n\t\tcontractData.deployedPackageId = upgradeResult.packageId;\n\n\t\treturn upgradeResult;\n\t} finally {\n\t\t// Always restore original Move.toml\n\t\tawait restoreMoveToml(moveTomlPath, backupPath);\n\t}\n}\n\n/**\n * Execute upgrade using iota client upgrade command.\n * @param upgradeCapabilityId Upgrade capability ID.\n * @param gasBudget Gas budget for upgrade.\n * @param moveProjectRoot Move project root directory.\n * @returns Upgrade result.\n */\nasync function executeUpgradeWithIotaCli(\n\tupgradeCapabilityId: string,\n\tgasBudget: number,\n\tmoveProjectRoot: string\n): Promise<{ packageId: string; upgradeCap: string; migrationStateId?: string }> {\n\t// Clean build artifacts and lock files before upgrade to prevent permission issues\n\tawait cleanBuildArtifactsInPath(moveProjectRoot);\n\n\tconst upgradeCmd = `iota client upgrade --upgrade-capability ${upgradeCapabilityId} . --gas-budget ${gasBudget} --json`;\n\n\tCLIDisplay.value(I18n.formatMessage(\"commands.deploy.labels.publishCommand\"), upgradeCmd, 1);\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.workingDirectory\"),\n\t\tmoveProjectRoot,\n\t\t1\n\t);\n\n\ttry {\n\t\tconst { stdout: output } = await execAsyncWithError(upgradeCmd, {\n\t\t\tcwd: moveProjectRoot\n\t\t});\n\t\tconst result = JSON.parse(output);\n\n\t\t// Parse upgrade response (different from publish response)\n\t\tconst packageId = result.objectChanges?.find(\n\t\t\t(change: { type: string; packageId?: string }) => change.type === \"published\"\n\t\t)?.packageId;\n\n\t\tif (!packageId) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.upgradePackageIdNotFound\", { result });\n\t\t}\n\n\t\t// UpgradeCap persists with same ID\n\t\tconst upgradeCap = upgradeCapabilityId;\n\n\t\treturn { packageId, upgradeCap };\n\t} catch (err) {\n\t\t// Clean up on error too\n\t\tawait cleanBuildArtifactsInPath(moveProjectRoot);\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.upgradeFailed\", undefined, err);\n\t}\n}\n\n/**\n * Backup Move.toml file.\n * @param moveTomlPath Path to Move.toml file.\n * @returns Path to backup file.\n */\nasync function backupMoveToml(moveTomlPath: string): Promise<string> {\n\tconst backupPath = `${moveTomlPath}.backup.${Date.now()}`;\n\tawait fsPromises.copyFile(moveTomlPath, backupPath);\n\treturn backupPath;\n}\n\n/**\n * Restore Move.toml file from backup.\n * @param moveTomlPath Path to Move.toml file.\n * @param backupPath Path to backup file.\n */\nasync function restoreMoveToml(moveTomlPath: string, backupPath: string): Promise<void> {\n\tawait fsPromises.copyFile(backupPath, moveTomlPath);\n\tawait fsPromises.unlink(backupPath);\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.moveTomlRestored\"),\n\t\tI18n.formatMessage(\"commands.deploy.messages.originalConfigurationRestored\"),\n\t\t1\n\t);\n}\n\n/**\n * Update Move.toml published-at field.\n * @param moveTomlPath Path to Move.toml file.\n * @param publishedAt Published-at value to set.\n */\nasync function updateMoveTomlPublishedAt(moveTomlPath: string, publishedAt: string): Promise<void> {\n\tconst content = await fsPromises.readFile(moveTomlPath, \"utf-8\");\n\n\t// Parse TOML and update \"published-at\" field\n\tconst lines = content.split(\"\\n\");\n\tlet updated = false;\n\n\tfor (let i = 0; i < lines.length; i++) {\n\t\tif (lines[i].trim().startsWith(\"published-at\")) {\n\t\t\tlines[i] = `published-at = \"${publishedAt}\"`;\n\t\t\tupdated = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (!updated) {\n\t\t// Add \"published-at\" to \"[package]\" section\n\t\tconst packageSectionIndex = lines.findIndex(line => line.trim() === \"[package]\");\n\t\tif (packageSectionIndex >= 0) {\n\t\t\tlines.splice(packageSectionIndex + 1, 0, `published-at = \"${publishedAt}\"`);\n\t\t}\n\t}\n\n\tawait fsPromises.writeFile(moveTomlPath, lines.join(\"\\n\"));\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.moveTomlUpdated\"),\n\t\t`published-at = \"${publishedAt}\"`,\n\t\t1\n\t);\n}\n\n/**\n * Validate that contract has been built.\n * @param contractData Contract data to validate.\n * @param projectRoot Project root directory.\n */\nasync function validateContractIsBuilt(\n\tcontractData: IContractData,\n\tprojectRoot: string\n): Promise<void> {\n\t// Check if build directory exists and has been built\n\tconst buildDir = path.join(projectRoot, \"build\");\n\ttry {\n\t\tconst stats = await fsPromises.stat(buildDir);\n\t\tif (!stats.isDirectory()) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.buildPathNotDirectory\", {\n\t\t\t\tbuildDir\n\t\t\t});\n\t\t}\n\t} catch {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.contractNotBuilt\", {\n\t\t\tprojectRoot\n\t\t});\n\t}\n\n\t// Verify that the contract data has current packageId (build should have been run)\n\tif (!contractData.packageId || !contractData.packageBytecode) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.contractDataOutdated\");\n\t}\n\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.buildValidation\"),\n\t\tI18n.formatMessage(\"commands.deploy.messages.contractBuiltAndReadyForUpgrade\"),\n\t\t1\n\t);\n}\n\n/**\n * Handle contract upgrade execution.\n * @param contractName Name of the contract.\n * @param contractData Contract data.\n * @param config Network configuration.\n * @param network Target network.\n * @param faucetUrl The faucet URL (optional, defaults to network-specific URL).\n * @param deployerMnemonic The deployer mnemonic from environment variables.\n * @param deployerSeed The deployer seed from environment variables (optional).\n */\nasync function handleContractUpgrade(\n\tcontractName: string,\n\tcontractData: IContractData,\n\tconfig: INetworkConfig,\n\tnetwork: NetworkTypes,\n\tfaucetUrl?: string,\n\tdeployerMnemonic?: string,\n\tdeployerSeed?: string\n): Promise<void> {\n\tCLIDisplay.task(`Upgrading contract: ${contractName}`);\n\n\tconst walletAddress = await validateEnvironmentForNetwork(\n\t\tnetwork,\n\t\tconfig,\n\t\tfalse,\n\t\tfaucetUrl,\n\t\tdeployerMnemonic,\n\t\tdeployerSeed\n\t);\n\tawait checkWalletBalance(network, config, walletAddress, false);\n\n\tconst upgradeResult = await executeContractUpgrade(contractData, config);\n\n\t// Update contract data with upgrade chain tracking\n\tcontractData.deployedPackageId = upgradeResult.packageId;\n\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.upgradeSuccessful\"),\n\t\tupgradeResult.packageId,\n\t\t1\n\t);\n\tif (contractData.lastDeployedPackageId) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.previousDeployment\"),\n\t\t\tcontractData.lastDeployedPackageId,\n\t\t\t1\n\t\t);\n\t}\n\tif (contractData.upgradeCapabilityId) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.upgradeCapabilityPreserved\"),\n\t\t\tcontractData.upgradeCapabilityId,\n\t\t\t1\n\t\t);\n\t}\n}\n\n/**\n * Deploy a single contract.\n * @param contractName Name of the contract\n * @param contractData Contract compilation data\n * @param contractData.packageId Package ID\n * @param contractData.packageBytecode Package bytecode\n * @param contractData.deployedPackageId Deployed package ID\n * @param config Network configuration\n * @param network Target network\n * @param dryRun Whether this is a dry run\n * @param force Whether to force redeployment\n * @param faucetUrl The faucet URL (optional, defaults to network-specific URL).\n * @param deployerMnemonic The deployer mnemonic from environment variables.\n * @param deployerSeed The deployer seed from environment variables (optional).\n */\nasync function deployContract(\n\tcontractName: string,\n\tcontractData: IContractData,\n\tconfig: INetworkConfig,\n\tnetwork: NetworkTypes,\n\tdryRun: boolean,\n\tforce: boolean,\n\tfaucetUrl?: string,\n\tdeployerMnemonic?: string,\n\tdeployerSeed?: string\n): Promise<void> {\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\"commands.deploy.progress.deployingContract\", { contractName, network })\n\t);\n\n\tconst strategy = await determineDeploymentStrategy(contractData);\n\n\tif (strategy === \"already-deployed\" && !force) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.contractStatus\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.messages.contractAlreadyDeployed\"),\n\t\t\t1\n\t\t);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.upgradeGuidance\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.messages.upgradeGuidanceMessage\"),\n\t\t\t1\n\t\t);\n\t\treturn;\n\t}\n\n\t// Show deployment strategy\n\tCLIDisplay.section(I18n.formatMessage(\"commands.deploy.labels.smartDeployAnalysis\"));\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.upgradeCapability\"),\n\t\tcontractData.upgradeCapabilityId ??\n\t\t\tI18n.formatMessage(\"commands.deploy.messages.noneInitialDeployment\")\n\t);\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.currentDeployment\"),\n\t\tcontractData.deployedPackageId ??\n\t\t\tI18n.formatMessage(\"commands.deploy.messages.noneNeedsDeploymentUpgrade\")\n\t);\n\tCLIDisplay.value(I18n.formatMessage(\"commands.deploy.labels.detectedStrategy\"), strategy);\n\n\tif (dryRun) {\n\t\tawait handleDryRunValidation(\n\t\t\tcontractName,\n\t\t\tcontractData,\n\t\t\tconfig,\n\t\t\tnetwork,\n\t\t\tfaucetUrl,\n\t\t\tdeployerMnemonic,\n\t\t\tdeployerSeed\n\t\t);\n\t\treturn;\n\t}\n\n\tif (strategy === \"upgrade\") {\n\t\tawait handleContractUpgrade(\n\t\t\tcontractName,\n\t\t\tcontractData,\n\t\t\tconfig,\n\t\t\tnetwork,\n\t\t\tfaucetUrl,\n\t\t\tdeployerMnemonic,\n\t\t\tdeployerSeed\n\t\t);\n\t} else {\n\t\tawait handleActualDeployment(\n\t\t\tcontractName,\n\t\t\tcontractData,\n\t\t\tconfig,\n\t\t\tnetwork,\n\t\t\tfaucetUrl,\n\t\t\tdeployerMnemonic,\n\t\t\tdeployerSeed\n\t\t);\n\t}\n}\n\n/**\n * Get wallet address for deployment, preferring seed over mnemonic if available.\n * @param network The target network.\n * @param addressIndex The address index to derive.\n * @param deployerMnemonic The deployer mnemonic from environment variables.\n * @param deployerSeed The deployer seed from environment variables (optional).\n * @returns The wallet address.\n */\nasync function getDeploymentWalletAddress(\n\tnetwork: NetworkTypes,\n\taddressIndex: number,\n\tdeployerMnemonic?: string,\n\tdeployerSeed?: string\n): Promise<string> {\n\t// Try to use seed first if available\n\tconst hexSeed = await getDeploymentSeed(network, deployerSeed);\n\tlet seed: Uint8Array | undefined;\n\tif (Is.stringValue(hexSeed)) {\n\t\tseed = Converter.hexToBytes(hexSeed);\n\t} else {\n\t\tconst mnemonic = await getDeploymentMnemonic(network, deployerMnemonic);\n\t\tseed = Bip39.mnemonicToSeed(mnemonic);\n\t}\n\n\tconst addresses = Iota.getAddresses(seed, Iota.DEFAULT_COIN_TYPE, 0, addressIndex, 1, false);\n\n\treturn addresses[0];\n}\n\n/**\n * Convert nanos to IOTA (1 IOTA = 1,000,000,000 nanos).\n * @param nanos Balance in nanos.\n * @returns Balance in IOTA.\n */\nfunction nanosToIota(nanos: number): number {\n\treturn nanos / 1_000_000_000;\n}\n\n/**\n * Request funds from the faucet for testnet or devnet deployment.\n * @param network The target network (testnet or devnet).\n * @param walletAddress The wallet address to fund.\n * @param rpcUrl The RPC URL for the network.\n * @param faucetUrl The faucet URL (optional, defaults to network-specific URL).\n * @returns Promise that resolves when funding is complete.\n */\nasync function requestFaucetFunds(\n\tnetwork: NetworkTypes,\n\twalletAddress: string,\n\trpcUrl: string,\n\tfaucetUrl: string\n): Promise<void> {\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\"commands.deploy.progress.requestingFaucetFunds\", { network })\n\t);\n\n\tconst response = await requestIotaFromFaucetV0({\n\t\thost: faucetUrl,\n\t\trecipient: walletAddress\n\t});\n\n\tif (response?.error) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.fundingFailed\", undefined, response.error);\n\t}\n\n\tconst client = new IotaClient({ url: rpcUrl });\n\tconst balanceResponse = await client.getBalance({ owner: walletAddress });\n\tconst balanceInNanos = Number(balanceResponse.totalBalance);\n\n\tif (balanceInNanos > 0) {\n\t\tconst amountInIota = nanosToIota(balanceInNanos);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.faucetFundsRequested\"),\n\t\t\t`${amountInIota.toFixed(2)} IOTA`,\n\t\t\t1\n\t\t);\n\t} else {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.warning\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.faucetNoFundsAdded\", { network }),\n\t\t\t2\n\t\t);\n\t}\n}\n\n/**\n * Check wallet balance and request faucet funds only if needed.\n * @param network The target network (testnet or devnet).\n * @param config Network configuration.\n * @param walletAddress The wallet address to check and potentially fund.\n * @param faucetUrl The faucet URL (optional, defaults to network-specific URL).\n * @returns Promise that resolves when balance check and optional funding is complete.\n */\nasync function checkBalanceAndRequestFaucetIfNeeded(\n\tnetwork: NetworkTypes,\n\tconfig: INetworkConfig,\n\twalletAddress: string,\n\tfaucetUrl?: string\n): Promise<void> {\n\t// Check current balance\n\tconst client = new IotaClient({ url: config.rpc.url });\n\tconst balanceResponse = await client.getBalance({ owner: walletAddress });\n\tconst balanceInNanos = Number(balanceResponse.totalBalance);\n\tconst requiredInNanos = config.deployment.gasBudget;\n\t// Convert to IOTA for display purposes\n\tconst balanceInIota = nanosToIota(balanceInNanos);\n\tconst requiredInIota = nanosToIota(requiredInNanos);\n\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.walletBalance\"),\n\t\t`${balanceInIota.toFixed(2)} IOTA`,\n\t\t1\n\t);\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.gasBudget\"),\n\t\t`${requiredInIota.toFixed(2)} IOTA`,\n\t\t1\n\t);\n\n\t// Only request faucet funds if balance is insufficient (compare in same units - nanos)\n\tif (balanceInNanos < requiredInNanos) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.warning\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.insufficientBalance\", {\n\t\t\t\tcurrentBalance: balanceInIota.toFixed(2),\n\t\t\t\trequiredBalance: requiredInIota.toFixed(2)\n\t\t\t}),\n\t\t\t1\n\t\t);\n\n\t\tif (!Is.stringValue(faucetUrl)) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.noFaucetConfigured\");\n\t\t}\n\n\t\tCLIDisplay.task(I18n.formatMessage(\"commands.deploy.progress.requestingAdditionalFaucetFunds\"));\n\t\tawait requestFaucetFunds(network, walletAddress, config.rpc.url, faucetUrl);\n\n\t\t// Check balance again after faucet request\n\t\tconst updatedBalanceResponse = await client.getBalance({ owner: walletAddress });\n\t\tconst updatedBalanceInNanos = Number(updatedBalanceResponse.totalBalance);\n\t\tconst updatedBalanceInIota = nanosToIota(updatedBalanceInNanos);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.updatedWalletBalance\"),\n\t\t\t`${updatedBalanceInIota.toFixed(2)} IOTA`,\n\t\t\t1\n\t\t);\n\t} else {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.balanceCheck\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.sufficientFundsAvailable\"),\n\t\t\t1\n\t\t);\n\t}\n}\n\n/**\n * Deploy contract using IOTA CLI.\n * @param gasBudget Gas budget for deployment.\n * @returns Deployment result with package ID, upgrade cap, and migration state ID.\n */\nasync function deployWithIotaCli(\n\tgasBudget: number\n): Promise<{ packageId: string; upgradeCap?: string; migrationStateId?: string }> {\n\t// Find the Move project directory\n\tconst moveTomlPaths: string[] = [];\n\tconst cwd = process.cwd();\n\tawait searchDirectoryForMoveToml(cwd, moveTomlPaths);\n\n\tif (moveTomlPaths.length === 0) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.noMoveTomlFilesFound\", {\n\t\t\tcurrentDir: cwd\n\t\t});\n\t}\n\n\t// Prioritize Move.toml in current directory, then use first found\n\tconst currentDirMoveToml = path.join(cwd, \"Move.toml\");\n\tconst selectedMoveToml = moveTomlPaths.find(p => p === currentDirMoveToml) ?? moveTomlPaths[0];\n\n\t// Use the actual Move project directory\n\tconst moveProjectRoot = path.dirname(selectedMoveToml);\n\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.moveProjectRoot\"),\n\t\tmoveProjectRoot,\n\t\t1\n\t);\n\n\tconst publishCmd = `iota client publish --gas-budget ${gasBudget} --json`;\n\n\tCLIDisplay.value(I18n.formatMessage(\"commands.deploy.labels.publishCommand\"), publishCmd, 1);\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.workingDirectory\"),\n\t\tmoveProjectRoot,\n\t\t1\n\t);\n\n\ttry {\n\t\tconst { stdout: output } = await execAsyncWithError(publishCmd, { cwd: moveProjectRoot });\n\t\tconst result = JSON.parse(output);\n\n\t\t// Extract package ID from published object\n\t\tconst packageId = result.objectChanges?.find(\n\t\t\t(change: { type: string; packageId?: string }) => change.type === \"published\"\n\t\t)?.packageId;\n\n\t\tif (!packageId) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.packageIdNotFound\", {\n\t\t\t\tresult\n\t\t\t});\n\t\t}\n\n\t\t// Extract UpgradeCap ID from created objects\n\t\tconst upgradeCap = result.objectChanges?.find(\n\t\t\t(change: { objectType?: string; objectId?: string }) =>\n\t\t\t\tchange.objectType === \"0x2::package::UpgradeCap\"\n\t\t)?.objectId;\n\n\t\t// Extract MigrationState ID from created objects\n\t\tconst migrationStateId = result.objectChanges?.find(\n\t\t\t(change: { objectType?: string; objectId?: string }) =>\n\t\t\t\tchange.objectType?.endsWith(\"::MigrationState\")\n\t\t)?.objectId;\n\n\t\treturn {\n\t\t\tpackageId,\n\t\t\tupgradeCap,\n\t\t\tmigrationStateId\n\t\t};\n\t} catch (err) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.deploymentFailed\", undefined, err);\n\t}\n}\n\n/**\n * Update contracts file with deployed package IDs.\n * @param contractsPath Path to contracts file.\n * @param contractsData Updated contracts data.\n */\nasync function updateContractsFile(\n\tcontractsPath: string,\n\tcontractsData: ISmartContractDeployments\n): Promise<void> {\n\ttry {\n\t\tawait CLIUtils.writeJsonFile(contractsPath, contractsData, false);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.updatedContractsFile\"),\n\t\t\tcontractsPath,\n\t\t\t1\n\t\t);\n\t} catch (err) {\n\t\tthrow new GeneralError(\n\t\t\t\"commands\",\n\t\t\t\"commands.deploy.contractsFileUpdateFailed\",\n\t\t\t{ contractsPath },\n\t\t\terr\n\t\t);\n\t}\n}\n\n/**\n * Generate a unique backup alias that doesn't conflict with existing keys.\n * Uses cryptographically secure random bytes to avoid conflicts.\n * @param baseAlias The original alias name.\n * @param existingKeys Array of existing keys from keystore.\n * @returns A unique backup alias name.\n */\nexport function generateUniqueBackupAlias(\n\tbaseAlias: string,\n\texistingKeys: { alias: string; iotaAddress: string }[]\n): string {\n\tconst existingAliases = new Set(existingKeys.map(key => key.alias));\n\n\t// Generate cryptographically secure random identifier\n\tconst randomSuffix = Converter.bytesToHex(RandomHelper.generate(4));\n\tconst backupAlias = `${baseAlias}-backup-${randomSuffix}`;\n\n\t// In the extremely unlikely event of collision, add timestamp\n\tif (existingAliases.has(backupAlias)) {\n\t\treturn `${baseAlias}-backup-${Date.now()}-${randomSuffix}`;\n\t}\n\n\treturn backupAlias;\n}\n\n/**\n * Ensure the correct deployer key exists in the keystore with the expected address.\n * If a conflicting alias exists, rename it and import the correct key.\n * @param network The target network.\n * @param aliasName The desired alias name (e.g., \"deployer-testnet\").\n * @param expectedAddress The expected address from the current mnemonic.\n * @param addressIndex The address index to use.\n * @param deployerMnemonic The deployer mnemonic.\n */\nexport async function ensureCorrectDeployerKey(\n\tnetwork: NetworkTypes,\n\taliasName: string,\n\texpectedAddress: string,\n\taddressIndex: number,\n\tdeployerMnemonic: string\n): Promise<void> {\n\ttry {\n\t\t// Check if the alias already exists in keystore\n\t\tconst { stdout: keysListOutput } = await execAsyncWithError(\"iota keytool list --json\");\n\t\tconst keysList = JSON.parse(keysListOutput);\n\n\t\t// Find existing key with the target alias\n\t\tconst existingKey = keysList.find(\n\t\t\t(key: { alias: string; iotaAddress: string }) => key.alias === aliasName\n\t\t);\n\n\t\tif (existingKey) {\n\t\t\t// Check if existing key has the correct address\n\t\t\tconst existingAddress = existingKey.iotaAddress;\n\n\t\t\tif (existingAddress !== expectedAddress) {\n\t\t\t\t// Conflicting alias exists with wrong mnemonic - rename it\n\t\t\t\tCLIDisplay.task(\n\t\t\t\t\tI18n.formatMessage(\"commands.deploy.progress.renamingConflictingKey\", { aliasName })\n\t\t\t\t);\n\n\t\t\t\tconst backupAlias = generateUniqueBackupAlias(aliasName, keysList);\n\t\t\t\tawait execAsyncWithError(`iota keytool update-alias \"${aliasName}\" \"${backupAlias}\"`);\n\n\t\t\t\tCLIDisplay.value(\n\t\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.renamedExistingKey\"),\n\t\t\t\t\t`${aliasName} → ${backupAlias} (${existingAddress})`,\n\t\t\t\t\t1\n\t\t\t\t);\n\n\t\t\t\t// Now import the correct key with the desired alias\n\t\t\t\tawait importCorrectDeployerKey(\n\t\t\t\t\tnetwork,\n\t\t\t\t\taliasName,\n\t\t\t\t\taddressIndex,\n\t\t\t\t\texpectedAddress,\n\t\t\t\t\tdeployerMnemonic\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Existing key is correct - no action needed\n\t\t\t\tCLIDisplay.value(\n\t\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.usingExistingCorrectKey\"),\n\t\t\t\t\t`${aliasName} (${expectedAddress})`,\n\t\t\t\t\t1\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\t// No existing alias - import the key\n\t\t\tawait importCorrectDeployerKey(\n\t\t\t\tnetwork,\n\t\t\t\taliasName,\n\t\t\t\taddressIndex,\n\t\t\t\texpectedAddress,\n\t\t\t\tdeployerMnemonic\n\t\t\t);\n\t\t}\n\n\t\t// Verify the address exists in client addresses\n\t\tconst { stdout: addressListOutput } = await execAsyncWithError(\"iota client addresses --json\");\n\t\tconst addressInfo = JSON.parse(addressListOutput);\n\t\tconst addressExists: boolean = addressInfo.addresses.some(\n\t\t\t([_, addr]: [string, string]) => addr === expectedAddress\n\t\t);\n\n\t\tif (!addressExists) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.addressNotInClient\", {\n\t\t\t\texpectedAddress,\n\t\t\t\taliasName\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\tthrow new GeneralError(\n\t\t\t\"commands\",\n\t\t\t\"commands.deploy.deployerKeySetupFailed\",\n\t\t\t{ network, aliasName, expectedAddress },\n\t\t\terror\n\t\t);\n\t}\n}\n\n/**\n * Import the deployer key with the correct mnemonic.\n * @param network The target network.\n * @param aliasName The alias name to use.\n * @param addressIndex The address index.\n * @param targetAddress The expected target address (avoids redundant calculation).\n * @param deployerMnemonic The deployer mnemonic.\n */\nasync function importCorrectDeployerKey(\n\tnetwork: NetworkTypes,\n\taliasName: string,\n\taddressIndex: number,\n\ttargetAddress: string,\n\tdeployerMnemonic: string\n): Promise<void> {\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\"commands.deploy.progress.importingDeployerKey\", { aliasName })\n\t);\n\n\tconst mnemonic = await getDeploymentMnemonic(network, deployerMnemonic);\n\tconst derivationPath = Bip44.path(Iota.DEFAULT_COIN_TYPE, 0, false, addressIndex).toString();\n\n\tawait execAsyncWithError(\n\t\t`iota keytool import \"${mnemonic}\" ed25519 \"${derivationPath}\" --alias \"${aliasName}\"`\n\t);\n\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.importedDeployerKey\"),\n\t\t`${aliasName} (${targetAddress})`,\n\t\t1\n\t);\n}\n"]}
1
+ {"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACjG,OAAO,EAAE,KAAK,EAAE,K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AK,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;IAE7F,MAAM,kBAAkB,CACvB,wBAAwB,QAAQ,cAAc,cAAc,cAAc,SAAS,GAAG,CACtF,CAAC;IAEF,UAAU,CAAC,KAAK,CACf,IAAI,CAAC,aAAa,CAAC,4CAA4C,CAAC,EAChE,GAAG,SAAS,KAAK,aAAa,GAAG,EACjC,CAAC,CACD,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { promises as fsPromises } from \"node:fs\";\nimport path from \"node:path\";\nimport { IotaClient } from \"@iota/iota-sdk/client\";\nimport { requestIotaFromFaucetV0 } from \"@iota/iota-sdk/faucet\";\nimport { CLIDisplay, CLIParam, CLIUtils } from \"@twin.org/cli-core\";\nimport { Coerce, Converter, GeneralError, Guards, I18n, Is, RandomHelper } from \"@twin.org/core\";\nimport { Bip39, Bip44 } from \"@twin.org/crypto\";\nimport {\n\tIota,\n\tNetworkTypes,\n\ttype IContractData,\n\ttype ISmartContractDeployments\n} from \"@twin.org/dlt-iota\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type { Command } from \"commander\";\nimport type { INetworkConfig } from \"../models/INetworkConfig.js\";\nimport { cleanBuildArtifactsInPath } from \"../utils/buildArtifactUtils.js\";\nimport { ensureEnvironment, execAsyncWithError } from \"../utils/environmentUtils.js\";\nimport {\n\tgetDeploymentMnemonic,\n\tgetDeploymentSeed,\n\tvalidateDeploymentEnvironment\n} from \"../utils/envSetup.js\";\nimport { verifyIotaSDK } from \"../utils/iotaUtils.js\";\nimport { searchDirectoryForMoveToml } from \"../utils/moveToJsonUtils.js\";\n\n/**\n * Build the deploy command.\n * @param program The command program.\n */\nexport function buildCommandDeploy(program: Command): void {\n\tprogram\n\t\t.command(\"deploy\")\n\t\t.description(I18n.formatMessage(\"commands.deploy.description\"))\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.contracts.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.contracts.description\"),\n\t\t\t\"smart-contract-deployments.json\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.network.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.network.description\"),\n\t\t\t\"!NETWORK\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.dryRun.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.dryRun.description\")\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.force.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.force.description\")\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.rpcUrl.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.rpcUrl.description\"),\n\t\t\t\"!RPC_URL\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.addressIndex.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.addressIndex.description\"),\n\t\t\t\"!ADDRESS_INDEX\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.rpcTimeout.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.rpcTimeout.description\"),\n\t\t\t\"!RPC_TIMEOUT\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.gasBudget.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.gasBudget.description\"),\n\t\t\t\"!GAS_BUDGET\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.confirmationTimeout.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.confirmationTimeout.description\"),\n\t\t\t\"!CONFIRMATION_TIMEOUT\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.faucetUrl.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.faucetUrl.description\"),\n\t\t\t\"!FAUCET_URL\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.deployerMnemonic.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.deployerMnemonic.description\"),\n\t\t\t\"!DEPLOYER_MNEMONIC\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.deploy.options.deployerSeed.param\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.options.deployerSeed.description\"),\n\t\t\t\"!DEPLOYER_SEED\"\n\t\t)\n\t\t.action(actionCommandDeploy);\n}\n\n/**\n * Action for the deploy command.\n * @param opts Command options.\n * @param opts.contracts Path to compiled modules JSON.\n * @param opts.network Network identifier - optional if NETWORK env var is set.\n * @param opts.dryRun Simulate deployment without executing.\n * @param opts.force Force redeployment of existing packages.\n * @param opts.rpcUrl RPC endpoint URL for the network.\n * @param opts.addressIndex Address index for key derivation.\n * @param opts.rpcTimeout RPC request timeout in milliseconds.\n * @param opts.gasBudget Gas budget for transactions.\n * @param opts.confirmationTimeout Transaction confirmation timeout in milliseconds.\n * @param opts.faucetUrl Faucet URL for requesting test tokens.\n * @param opts.deployerMnemonic Deployer wallet mnemonic phrase.\n * @param opts.deployerSeed Deployer wallet seed (alternative to mnemonic).\n */\nexport async function actionCommandDeploy(opts: {\n\tcontracts?: string;\n\tnetwork?: NetworkTypes;\n\tdryRun?: boolean;\n\tforce?: boolean;\n\trpcUrl?: string;\n\taddressIndex?: string;\n\trpcTimeout?: string;\n\tgasBudget?: string;\n\tconfirmationTimeout?: string;\n\tfaucetUrl?: string;\n\tdeployerMnemonic?: string;\n\tdeployerSeed?: string;\n}): Promise<void> {\n\tconst network = CLIParam.arrayOneOf<NetworkTypes>(\n\t\t\"network\",\n\t\topts.network,\n\t\tObject.values(NetworkTypes),\n\t\ttrue\n\t);\n\n\tconst contractsPath = opts.contracts ?? \"smart-contract-deployments.json\";\n\tconst dryRun = opts.dryRun ?? false;\n\tconst force = opts.force ?? false;\n\n\tCLIDisplay.section(I18n.formatMessage(\"commands.deploy.section.deployContracts\"));\n\tCLIDisplay.section(contractsPath);\n\n\t// Verify the IOTA SDK before we do anything else\n\tawait verifyIotaSDK();\n\n\t// Get configuration values needed for environment setup\n\tconst rpcUrl: string = CLIParam.stringValue(\"rpcUrl\", opts.rpcUrl);\n\tconst addressIndex = CLIParam.number(\"addressIndex\", opts.addressIndex) ?? 0;\n\tconst rpcTimeout = CLIParam.number(\"rpcTimeout\", opts.rpcTimeout);\n\tconst gasBudget = CLIParam.number(\"gasBudget\", opts.gasBudget);\n\tconst confirmationTimeout = CLIParam.number(\"confirmationTimeout\", opts.confirmationTimeout);\n\tconst faucetUrl: string | undefined =\n\t\tnetwork === NetworkTypes.Mainnet\n\t\t\t? undefined\n\t\t\t: CLIParam.stringValue(\"faucetUrl\", opts.faucetUrl);\n\n\tlet deployerMnemonic: string | undefined;\n\ttry {\n\t\tdeployerMnemonic = CLIParam.stringValue(\"deployerMnemonic\", opts.deployerMnemonic);\n\t} catch {\n\t\t// Optional parameter, can be undefined\n\t\tdeployerMnemonic = undefined;\n\t}\n\n\tlet deployerSeed: string | undefined;\n\ttry {\n\t\tdeployerSeed = CLIParam.stringValue(\"deployerSeed\", opts.deployerSeed);\n\t} catch {\n\t\t// Optional parameter, can be undefined\n\t\tdeployerSeed = undefined;\n\t}\n\n\t// Validate that at least one deployer credential is provided\n\tconst hasValidMnemonic = Is.stringValue(deployerMnemonic);\n\tconst hasValidSeed = Is.stringValue(deployerSeed);\n\n\tif (!hasValidMnemonic && !hasValidSeed) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.deployerCredentialRequired\", {\n\t\t\tnetwork\n\t\t});\n\t}\n\n\t// Check/switch to target network environment BEFORE loading config\n\tawait setIotaEnvironment(network, rpcUrl, addressIndex, dryRun, deployerMnemonic, deployerSeed);\n\n\tconst config = await createNetworkConfig(\n\t\tnetwork,\n\t\trpcUrl,\n\t\taddressIndex,\n\t\trpcTimeout,\n\t\tgasBudget,\n\t\tconfirmationTimeout\n\t);\n\tvalidateNetworkConfig(config, network);\n\n\tconst contractsData = await loadCompiledContracts(contractsPath);\n\n\tif (network === NetworkTypes.Mainnet) {\n\t\tconst validatedMnemonic = await getDeploymentMnemonic(\n\t\t\tnetwork,\n\t\t\thasValidMnemonic ? deployerMnemonic : undefined\n\t\t);\n\t\tawait validateDeploymentEnvironment(network, validatedMnemonic);\n\t}\n\n\tconst networkContracts = contractsData[network];\n\tif (!Is.object<IContractData>(networkContracts)) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.noContractsFound\", {\n\t\t\tnetwork,\n\t\t\tcontractsPath\n\t\t});\n\t}\n\n\tawait deployContract(\n\t\t\"contract\",\n\t\tnetworkContracts,\n\t\tconfig,\n\t\tnetwork,\n\t\tdryRun,\n\t\tforce,\n\t\tfaucetUrl,\n\t\tdeployerMnemonic,\n\t\tdeployerSeed\n\t);\n\n\tif (!dryRun) {\n\t\tawait updateContractsFile(contractsPath, contractsData);\n\t}\n\n\tCLIDisplay.done();\n}\n\n/**\n * Switch IOTA CLI to the target network environment and set the active address.\n * @param network Target network to switch to\n * @param rpcUrl The RPC URL for the network\n * @param addressIndex The address index to derive the target address\n * @param dryRun Whether this is a dry run (checks environment but doesn't switch)\n * @param deployerMnemonic The deployer mnemonic from environment variables.\n * @param deployerSeed The deployer seed from environment variables (optional).\n */\nasync function setIotaEnvironment(\n\tnetwork: NetworkTypes,\n\trpcUrl: string,\n\taddressIndex: number,\n\tdryRun: boolean = false,\n\tdeployerMnemonic?: string,\n\tdeployerSeed?: string\n): Promise<void> {\n\ttry {\n\t\tCLIDisplay.task(\n\t\t\tdryRun\n\t\t\t\t? I18n.formatMessage(\"commands.deploy.progress.checkingEnvironment\")\n\t\t\t\t: I18n.formatMessage(\"commands.deploy.progress.settingEnvironment\")\n\t\t);\n\n\t\t// Ensure environment exists, create if necessary\n\t\tGuards.stringValue(\"setIotaEnvironment\", nameof(rpcUrl), rpcUrl);\n\n\t\tawait ensureEnvironment(network, rpcUrl);\n\n\t\tif (dryRun) {\n\t\t\tCLIDisplay.value(\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.iotaEnvironmentCheck\"),\n\t\t\t\t`✅ ${network} environment exists`,\n\t\t\t\t1\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// Derive the target address from existing mnemonic/seed\n\t\tconst targetAddress = await getDeploymentWalletAddress(\n\t\t\tnetwork,\n\t\t\taddressIndex,\n\t\t\tdeployerMnemonic,\n\t\t\tdeployerSeed\n\t\t);\n\n\t\t// Ensure the correct deployer key exists in the keystore\n\t\tconst aliasName = `deployer-${network}`;\n\t\tconst validatedMnemonic = await getDeploymentMnemonic(network, deployerMnemonic);\n\t\tawait ensureCorrectDeployerKey(\n\t\t\tnetwork,\n\t\t\taliasName,\n\t\t\ttargetAddress,\n\t\t\taddressIndex,\n\t\t\tvalidatedMnemonic\n\t\t);\n\n\t\t// Switch both environment and address in one command\n\t\tawait execAsyncWithError(`iota client switch --env ${network} --address ${targetAddress}`);\n\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.switchedIotaEnvironment\"),\n\t\t\tnetwork,\n\t\t\t1\n\t\t);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.switchedActiveAddress\"),\n\t\t\ttargetAddress,\n\t\t\t1\n\t\t);\n\n\t\t// Verify the switch was successful\n\t\tconst { stdout: activeEnv } = await execAsyncWithError(\"iota client active-env\");\n\t\tif (!activeEnv.includes(network)) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.environmentSwitchFailed\", {\n\t\t\t\tnetwork,\n\t\t\t\tactiveEnv\n\t\t\t});\n\t\t}\n\n\t\t// Verify address switch was successful\n\t\tconst { stdout: activeAddressOutput } = await execAsyncWithError(\"iota client active-address\");\n\t\tconst activeAddress = activeAddressOutput.trim();\n\t\tif (activeAddress !== targetAddress) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.addressSwitchFailed\", {\n\t\t\t\tnetwork,\n\t\t\t\ttargetAddress,\n\t\t\t\tactiveAddress\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\tthrow new GeneralError(\n\t\t\t\"commands\",\n\t\t\t\"commands.deploy.environmentOperationFailed\",\n\t\t\t{ network, operation: dryRun ? \"check\" : \"switch to\" },\n\t\t\terror\n\t\t);\n\t}\n}\n\n/**\n * Creates the network configuration.\n * @param network Target network to determine which env file to load.\n * @param rpcUrl The RPC URL for the network.\n * @param addressIndex The address index for the wallet.\n * @param rpcTimeout The RPC timeout in milliseconds.\n * @param gasBudget The gas budget for deployment.\n * @param confirmationTimeout The confirmation timeout in seconds.\n * @returns Network configuration.\n */\nasync function createNetworkConfig(\n\tnetwork: NetworkTypes,\n\trpcUrl: string,\n\taddressIndex: number,\n\trpcTimeout?: number,\n\tgasBudget?: number,\n\tconfirmationTimeout?: number\n): Promise<INetworkConfig> {\n\ttry {\n\t\tGuards.stringValue(\"createNetworkConfig\", nameof(rpcUrl), rpcUrl);\n\n\t\tconst config: INetworkConfig = {\n\t\t\tnetwork,\n\t\t\tplatform: \"iota\",\n\t\t\trpc: {\n\t\t\t\turl: rpcUrl,\n\t\t\t\ttimeout: rpcTimeout ?? 60000\n\t\t\t},\n\t\t\tdeployment: {\n\t\t\t\tgasBudget: gasBudget ?? 50000000,\n\t\t\t\tconfirmationTimeout: confirmationTimeout ?? 60,\n\t\t\t\twallet: {\n\t\t\t\t\taddressIndex\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\treturn config;\n\t} catch (err) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.networkConfigInvalid\", { network }, err);\n\t}\n}\n\n/**\n * Validate network configuration matches expected network.\n * @param config Network configuration.\n * @param expectedNetwork Expected network type.\n * @throws GeneralError if the network configuration is invalid.\n */\nfunction validateNetworkConfig(config: INetworkConfig, expectedNetwork: NetworkTypes): void {\n\tif (config.network !== expectedNetwork) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.networkMismatch\", {\n\t\t\texpected: expectedNetwork,\n\t\t\tactual: config.network,\n\t\t\thelp: `Configuration file specifies '${config.network}' but command targets '${expectedNetwork}'`\n\t\t});\n\t}\n\n\tif (!Is.stringValue(config.rpc?.url)) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.rpcUrlRequired\", {\n\t\t\tnetwork: expectedNetwork\n\t\t});\n\t}\n\n\tif (!Is.number(config.deployment?.gasBudget)) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.gasBudgetRequired\", {\n\t\t\tnetwork: expectedNetwork\n\t\t});\n\t}\n}\n\n/**\n * Load compiled contracts from file.\n * @param contractsPath Path to contracts file.\n * @returns Compiled contracts data.\n */\nasync function loadCompiledContracts(contractsPath: string): Promise<ISmartContractDeployments> {\n\ttry {\n\t\tif (!(await CLIUtils.fileExists(contractsPath))) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.contractsFileNotFound\", {\n\t\t\t\tcontractsPath\n\t\t\t});\n\t\t}\n\n\t\tconst contracts = await CLIUtils.readJsonFile<ISmartContractDeployments>(contractsPath);\n\n\t\tif (!Is.object(contracts)) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.invalidContractsFile\");\n\t\t}\n\n\t\treturn contracts;\n\t} catch (err) {\n\t\tthrow new GeneralError(\n\t\t\t\"commands\",\n\t\t\t\"commands.deploy.contractsLoadFailed\",\n\t\t\t{ contractsPath },\n\t\t\terr\n\t\t);\n\t}\n}\n\n/**\n * Validate environment and setup for deployment based on network type.\n * @param network Target network.\n * @param config Network configuration.\n * @param isDryRun Whether this is a dry run.\n * @param faucetUrl The faucet URL (optional, defaults to network-specific URL).\n * @param deployerMnemonic The deployer mnemonic for validation.\n * @param deployerSeed The deployer seed (optional).\n * @returns Wallet address for the deployment.\n */\nasync function validateEnvironmentForNetwork(\n\tnetwork: NetworkTypes,\n\tconfig: INetworkConfig,\n\tisDryRun: boolean = false,\n\tfaucetUrl?: string,\n\tdeployerMnemonic?: string,\n\tdeployerSeed?: string\n): Promise<string> {\n\tconst walletAddress = await getDeploymentWalletAddress(\n\t\tnetwork,\n\t\tconfig.deployment.wallet.addressIndex,\n\t\tdeployerMnemonic,\n\t\tdeployerSeed\n\t);\n\n\tif (isDryRun) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.dryRunWalletAddress\"),\n\t\t\twalletAddress,\n\t\t\t1\n\t\t);\n\t} else {\n\t\tCLIDisplay.value(I18n.formatMessage(\"commands.deploy.labels.walletAddress\"), walletAddress, 1);\n\t}\n\n\tif (network === NetworkTypes.Mainnet) {\n\t\tconst validatedMnemonic = await getDeploymentMnemonic(network, deployerMnemonic);\n\t\tawait validateDeploymentEnvironment(network, validatedMnemonic);\n\t} else if ((network === NetworkTypes.Testnet || network === NetworkTypes.Devnet) && !isDryRun) {\n\t\t// For testnet/devnet, check balance first and only request funds if needed\n\t\tawait checkBalanceAndRequestFaucetIfNeeded(network, config, walletAddress, faucetUrl);\n\t}\n\n\treturn walletAddress;\n}\n\n/**\n * Check wallet balance and display relevant information.\n * @param network Target network.\n * @param config Network configuration.\n * @param walletAddress Wallet address.\n * @param isDryRun Whether this is a dry run.\n * @returns Balance in nanos.\n */\nasync function checkWalletBalance(\n\tnetwork: NetworkTypes,\n\tconfig: INetworkConfig,\n\twalletAddress: string,\n\tisDryRun: boolean = false\n): Promise<number> {\n\tconst client = new IotaClient({ url: config.rpc.url });\n\tconst balanceResponse = await client.getBalance({ owner: walletAddress });\n\tconst balanceInNanos = Number(balanceResponse.totalBalance);\n\tconst requiredInNanos = config.deployment.gasBudget;\n\n\tconst balanceInIota = nanosToIota(balanceInNanos);\n\tconst requiredInIota = nanosToIota(requiredInNanos);\n\n\tconst balanceLabel = isDryRun\n\t\t? \"commands.deploy.labels.dryRunWalletBalance\"\n\t\t: \"commands.deploy.labels.walletBalance\";\n\tconst gasBudgetLabel = isDryRun\n\t\t? \"commands.deploy.labels.dryRunGasBudget\"\n\t\t: \"commands.deploy.labels.gasBudget\";\n\n\tCLIDisplay.value(I18n.formatMessage(balanceLabel), `${balanceInIota.toFixed(2)} IOTA`, 1);\n\tCLIDisplay.value(I18n.formatMessage(gasBudgetLabel), `${requiredInIota.toFixed(2)} IOTA`, 1);\n\n\t// Handle insufficient balance based on network and run type (compare in same units - nanos)\n\tif (balanceInNanos < requiredInNanos) {\n\t\tif (isDryRun) {\n\t\t\tCLIDisplay.value(\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.warning\"),\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.insufficientBalanceWarning\", {\n\t\t\t\t\tcurrentBalance: balanceInIota.toFixed(2),\n\t\t\t\t\trequiredBalance: requiredInIota.toFixed(2)\n\t\t\t\t}),\n\t\t\t\t2\n\t\t\t);\n\t\t} else if (network === NetworkTypes.Mainnet) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.insufficientBalance\", {\n\t\t\t\tbalance: balanceInIota,\n\t\t\t\trequired: requiredInIota,\n\t\t\t\twalletAddress\n\t\t\t});\n\t\t} else {\n\t\t\t// For testnet/devnet, show warning but continue\n\t\t\tCLIDisplay.value(\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.warning\"),\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.insufficientBalanceAfterFaucet\", {\n\t\t\t\t\tnetwork,\n\t\t\t\t\tbalance: balanceInIota.toFixed(2),\n\t\t\t\t\trequired: requiredInIota.toFixed(2),\n\t\t\t\t\twalletAddress\n\t\t\t\t}),\n\t\t\t\t2\n\t\t\t);\n\t\t}\n\t}\n\n\treturn balanceInNanos;\n}\n\n/**\n * Handle dry run validation and display.\n * @param contractName Name of the contract.\n * @param contractData Contract data.\n * @param config Network configuration.\n * @param network Target network.\n * @param faucetUrl The faucet URL (optional, defaults to network-specific URL).\n * @param deployerMnemonic The deployer mnemonic from environment variables.\n * @param deployerSeed The deployer seed from environment variables (optional).\n */\nasync function handleDryRunValidation(\n\tcontractName: string,\n\tcontractData: IContractData,\n\tconfig: INetworkConfig,\n\tnetwork: NetworkTypes,\n\tfaucetUrl?: string,\n\tdeployerMnemonic?: string,\n\tdeployerSeed?: string\n): Promise<void> {\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.dryRunWouldDeploy\"),\n\t\t`${contractName} (${network})`,\n\t\t1\n\t);\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.dryRunPackageId\"),\n\t\tcontractData.packageId,\n\t\t1\n\t);\n\tCLIDisplay.value(I18n.formatMessage(\"commands.deploy.labels.dryRunRpcUrl\"), config.rpc.url, 1);\n\n\ttry {\n\t\tconst walletAddress = await validateEnvironmentForNetwork(\n\t\t\tnetwork,\n\t\t\tconfig,\n\t\t\ttrue,\n\t\t\tfaucetUrl,\n\t\t\tdeployerMnemonic,\n\t\t\tdeployerSeed\n\t\t);\n\t\tawait checkWalletBalance(network, config, walletAddress, true);\n\t} catch (err) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.warning\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.environmentValidationWarning\", {\n\t\t\t\tmessage: (err as Error).message\n\t\t\t}),\n\t\t\t2\n\t\t);\n\t}\n}\n\n/**\n * Handle actual deployment execution.\n * @param contractName Name of the contract.\n * @param contractData Contract data.\n * @param config Network configuration.\n * @param network Target network.\n * @param faucetUrl The faucet URL (optional, defaults to network-specific URL).\n * @param deployerMnemonic The deployer mnemonic from environment variables.\n * @param deployerSeed The deployer seed from environment variables (optional).\n */\nasync function handleActualDeployment(\n\tcontractName: string,\n\tcontractData: IContractData,\n\tconfig: INetworkConfig,\n\tnetwork: NetworkTypes,\n\tfaucetUrl?: string,\n\tdeployerMnemonic?: string,\n\tdeployerSeed?: string\n): Promise<void> {\n\ttry {\n\t\tconst walletAddress = await validateEnvironmentForNetwork(\n\t\t\tnetwork,\n\t\t\tconfig,\n\t\t\tfalse,\n\t\t\tfaucetUrl,\n\t\t\tdeployerMnemonic,\n\t\t\tdeployerSeed\n\t\t);\n\t\tawait checkWalletBalance(network, config, walletAddress, false);\n\n\t\tconst deploymentResult = await deployWithIotaCli(config.deployment.gasBudget);\n\n\t\tcontractData.deployedPackageId = deploymentResult.packageId;\n\t\tcontractData.upgradeCapabilityId = deploymentResult.upgradeCap;\n\n\t\tif (deploymentResult.migrationStateId) {\n\t\t\tcontractData.migrationStateId = deploymentResult.migrationStateId;\n\t\t}\n\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.deployedPackageIdResult\"),\n\t\t\tdeploymentResult.packageId,\n\t\t\t1\n\t\t);\n\t\tif (deploymentResult.upgradeCap) {\n\t\t\tCLIDisplay.value(\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.upgradeCapabilityIdResult\"),\n\t\t\t\tdeploymentResult.upgradeCap,\n\t\t\t\t1\n\t\t\t);\n\t\t}\n\t\tif (contractData.migrationStateId) {\n\t\t\tCLIDisplay.value(\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.migrationStateIdResult\"),\n\t\t\t\tcontractData.migrationStateId,\n\t\t\t\t1\n\t\t\t);\n\t\t}\n\t} catch (err) {\n\t\tthrow new GeneralError(\n\t\t\t\"commands\",\n\t\t\t\"commands.deploy.deploymentFailed\",\n\t\t\t{ contract: contractName },\n\t\t\terr\n\t\t);\n\t}\n}\n\n/**\n * Determine the deployment strategy based on contract state.\n * @param contractData Contract data to analyze.\n * @returns Deployment strategy: initial-deploy, upgrade or already-deployed.\n */\nasync function determineDeploymentStrategy(\n\tcontractData: IContractData\n): Promise<\"initial-deploy\" | \"upgrade\" | \"already-deployed\"> {\n\tif (Is.stringValue(contractData.deployedPackageId)) {\n\t\treturn \"already-deployed\";\n\t}\n\n\tif (Is.stringValue(contractData.lastDeployedPackageId)) {\n\t\treturn \"upgrade\";\n\t}\n\n\treturn \"initial-deploy\";\n}\n\n/**\n * Query the on-chain UpgradeCap object to get the actual latest package ID.\n * This is used to validate/correct the `published-at` value before upgrades,\n * preventing failures when the deployment JSON is stale.\n * @param rpcUrl RPC endpoint URL for the network.\n * @param upgradeCapabilityId The UpgradeCap object ID on-chain.\n * @returns The on-chain package ID and version, or undefined if query fails.\n */\nasync function queryUpgradeCapPackage(\n\trpcUrl: string,\n\tupgradeCapabilityId: string\n): Promise<{ package: string; version: number } | undefined> {\n\ttry {\n\t\tconst client = new IotaClient({ url: rpcUrl });\n\t\tconst response = await client.getObject({\n\t\t\tid: upgradeCapabilityId,\n\t\t\toptions: { showContent: true }\n\t\t});\n\n\t\tif (response.data?.content?.dataType === \"moveObject\") {\n\t\t\tconst fields = response.data.content.fields as { [key: string]: unknown };\n\t\t\tconst fieldPackage = Coerce.string(fields.package);\n\t\t\tconst fieldVersion = Coerce.number(fields.version);\n\t\t\tif (Is.stringValue(fieldPackage) && Is.number(fieldVersion)) {\n\t\t\t\treturn {\n\t\t\t\t\tpackage: fieldPackage,\n\t\t\t\t\tversion: fieldVersion\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t} catch {\n\t\t// If query fails (e.g. network issue), return undefined to fall back to JSON value\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Execute contract upgrade using iota client upgrade command.\n * @param contractData Contract data containing upgrade capability.\n * @param config Network configuration.\n * @returns Upgrade result with package ID and upgrade capability.\n */\nasync function executeContractUpgrade(\n\tcontractData: IContractData,\n\tconfig: INetworkConfig\n): Promise<{ packageId: string; upgradeCap: string; migrationStateId?: string }> {\n\t// Start with lastDeployedPackageId from JSON as the candidate for \"published-at\"\n\tlet publishedAtPackageId = contractData.lastDeployedPackageId;\n\n\t// Query the on-chain UpgradeCap to get the actual latest package ID.\n\t// This prevents failures when the JSON is stale\n\tif (Is.stringValue(contractData.upgradeCapabilityId)) {\n\t\tCLIDisplay.task(I18n.formatMessage(\"commands.deploy.progress.queryingUpgradeCap\"));\n\t\tconst onChainCap = await queryUpgradeCapPackage(\n\t\t\tconfig.rpc.url,\n\t\t\tcontractData.upgradeCapabilityId\n\t\t);\n\t\tif (onChainCap) {\n\t\t\tCLIDisplay.value(\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.onChainPackageId\"),\n\t\t\t\tonChainCap.package,\n\t\t\t\t1\n\t\t\t);\n\t\t\tCLIDisplay.value(\n\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.onChainVersion\"),\n\t\t\t\tString(onChainCap.version),\n\t\t\t\t1\n\t\t\t);\n\n\t\t\tif (publishedAtPackageId !== onChainCap.package) {\n\t\t\t\tCLIDisplay.value(\n\t\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.warning\"),\n\t\t\t\t\tI18n.formatMessage(\"commands.deploy.messages.staleJsonDetected\", {\n\t\t\t\t\t\tjsonPackageId: publishedAtPackageId ?? \"none\",\n\t\t\t\t\t\tonChainPackageId: onChainCap.package\n\t\t\t\t\t}),\n\t\t\t\t\t2\n\t\t\t\t);\n\t\t\t\tpublishedAtPackageId = onChainCap.package;\n\t\t\t\tcontractData.lastDeployedPackageId = onChainCap.package;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!publishedAtPackageId) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.noPreviousDeploymentForUpgrade\");\n\t}\n\n\tconst moveTomlPaths: string[] = [];\n\tawait searchDirectoryForMoveToml(process.cwd(), moveTomlPaths);\n\n\tif (moveTomlPaths.length === 0) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.noMoveTomlFilesFound\", {\n\t\t\tcurrentDir: process.cwd()\n\t\t});\n\t}\n\n\tconst currentDirMoveToml = path.join(process.cwd(), \"Move.toml\");\n\tconst selectedMoveToml = moveTomlPaths.find(p => p === currentDirMoveToml) ?? moveTomlPaths[0];\n\tconst moveTomlPath = selectedMoveToml;\n\tconst projectRoot = path.dirname(moveTomlPath);\n\n\tconst backupPath = await backupMoveToml(moveTomlPath);\n\n\ttry {\n\t\t// Update Move.toml with \"published-at\" = validated package ID (from chain or JSON)\n\t\tawait updateMoveTomlPublishedAt(moveTomlPath, publishedAtPackageId);\n\n\t\tawait validateContractIsBuilt(contractData, projectRoot);\n\n\t\t// Execute upgrade command\n\t\tconst upgradeCapabilityId = contractData.upgradeCapabilityId;\n\t\tif (!upgradeCapabilityId) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.upgradeCapabilityNotFound\");\n\t\t}\n\t\tconst upgradeResult = await executeUpgradeWithIotaCli(\n\t\t\tupgradeCapabilityId,\n\t\t\tconfig.deployment.gasBudget,\n\t\t\tprojectRoot\n\t\t);\n\n\t\t// Update contract data with new package ID\n\t\tcontractData.deployedPackageId = upgradeResult.packageId;\n\n\t\treturn upgradeResult;\n\t} finally {\n\t\t// Always restore original Move.toml\n\t\tawait restoreMoveToml(moveTomlPath, backupPath);\n\t}\n}\n\n/**\n * Execute upgrade using iota client upgrade command.\n * @param upgradeCapabilityId Upgrade capability ID.\n * @param gasBudget Gas budget for upgrade.\n * @param moveProjectRoot Move project root directory.\n * @returns Upgrade result.\n */\nasync function executeUpgradeWithIotaCli(\n\tupgradeCapabilityId: string,\n\tgasBudget: number,\n\tmoveProjectRoot: string\n): Promise<{ packageId: string; upgradeCap: string; migrationStateId?: string }> {\n\t// Clean build artifacts and lock files before upgrade to prevent permission issues\n\tawait cleanBuildArtifactsInPath(moveProjectRoot);\n\n\tconst upgradeCmd = `iota client upgrade --upgrade-capability ${upgradeCapabilityId} . --gas-budget ${gasBudget} --json`;\n\n\tCLIDisplay.value(I18n.formatMessage(\"commands.deploy.labels.publishCommand\"), upgradeCmd, 1);\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.workingDirectory\"),\n\t\tmoveProjectRoot,\n\t\t1\n\t);\n\n\ttry {\n\t\tconst { stdout: output } = await execAsyncWithError(upgradeCmd, {\n\t\t\tcwd: moveProjectRoot\n\t\t});\n\t\tconst result = JSON.parse(output);\n\n\t\t// Parse upgrade response (different from publish response)\n\t\tconst packageId = result.objectChanges?.find(\n\t\t\t(change: { type: string; packageId?: string }) => change.type === \"published\"\n\t\t)?.packageId;\n\n\t\tif (!packageId) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.upgradePackageIdNotFound\", { result });\n\t\t}\n\n\t\t// UpgradeCap persists with same ID\n\t\tconst upgradeCap = upgradeCapabilityId;\n\n\t\treturn { packageId, upgradeCap };\n\t} catch (err) {\n\t\t// Clean up on error too\n\t\tawait cleanBuildArtifactsInPath(moveProjectRoot);\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.upgradeFailed\", undefined, err);\n\t}\n}\n\n/**\n * Backup Move.toml file.\n * @param moveTomlPath Path to Move.toml file.\n * @returns Path to backup file.\n */\nasync function backupMoveToml(moveTomlPath: string): Promise<string> {\n\tconst backupPath = `${moveTomlPath}.backup.${Date.now()}`;\n\tawait fsPromises.copyFile(moveTomlPath, backupPath);\n\treturn backupPath;\n}\n\n/**\n * Restore Move.toml file from backup.\n * @param moveTomlPath Path to Move.toml file.\n * @param backupPath Path to backup file.\n */\nasync function restoreMoveToml(moveTomlPath: string, backupPath: string): Promise<void> {\n\tawait fsPromises.copyFile(backupPath, moveTomlPath);\n\tawait fsPromises.unlink(backupPath);\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.moveTomlRestored\"),\n\t\tI18n.formatMessage(\"commands.deploy.messages.originalConfigurationRestored\"),\n\t\t1\n\t);\n}\n\n/**\n * Update Move.toml published-at field.\n * @param moveTomlPath Path to Move.toml file.\n * @param publishedAt Published-at value to set.\n */\nasync function updateMoveTomlPublishedAt(moveTomlPath: string, publishedAt: string): Promise<void> {\n\tconst content = await fsPromises.readFile(moveTomlPath, \"utf-8\");\n\n\t// Parse TOML and update \"published-at\" field\n\tconst lines = content.split(\"\\n\");\n\tlet updated = false;\n\n\tfor (let i = 0; i < lines.length; i++) {\n\t\tif (lines[i].trim().startsWith(\"published-at\")) {\n\t\t\tlines[i] = `published-at = \"${publishedAt}\"`;\n\t\t\tupdated = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (!updated) {\n\t\t// Add \"published-at\" to \"[package]\" section\n\t\tconst packageSectionIndex = lines.findIndex(line => line.trim() === \"[package]\");\n\t\tif (packageSectionIndex >= 0) {\n\t\t\tlines.splice(packageSectionIndex + 1, 0, `published-at = \"${publishedAt}\"`);\n\t\t}\n\t}\n\n\tawait fsPromises.writeFile(moveTomlPath, lines.join(\"\\n\"));\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.moveTomlUpdated\"),\n\t\t`published-at = \"${publishedAt}\"`,\n\t\t1\n\t);\n}\n\n/**\n * Validate that contract has been built.\n * @param contractData Contract data to validate.\n * @param projectRoot Project root directory.\n */\nasync function validateContractIsBuilt(\n\tcontractData: IContractData,\n\tprojectRoot: string\n): Promise<void> {\n\t// Check if build directory exists and has been built\n\tconst buildDir = path.join(projectRoot, \"build\");\n\ttry {\n\t\tconst stats = await fsPromises.stat(buildDir);\n\t\tif (!stats.isDirectory()) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.buildPathNotDirectory\", {\n\t\t\t\tbuildDir\n\t\t\t});\n\t\t}\n\t} catch {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.contractNotBuilt\", {\n\t\t\tprojectRoot\n\t\t});\n\t}\n\n\t// Verify that the contract data has current packageId (build should have been run)\n\tif (!contractData.packageId || !contractData.packageBytecode) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.contractDataOutdated\");\n\t}\n\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.buildValidation\"),\n\t\tI18n.formatMessage(\"commands.deploy.messages.contractBuiltAndReadyForUpgrade\"),\n\t\t1\n\t);\n}\n\n/**\n * Handle contract upgrade execution.\n * @param contractName Name of the contract.\n * @param contractData Contract data.\n * @param config Network configuration.\n * @param network Target network.\n * @param faucetUrl The faucet URL (optional, defaults to network-specific URL).\n * @param deployerMnemonic The deployer mnemonic from environment variables.\n * @param deployerSeed The deployer seed from environment variables (optional).\n */\nasync function handleContractUpgrade(\n\tcontractName: string,\n\tcontractData: IContractData,\n\tconfig: INetworkConfig,\n\tnetwork: NetworkTypes,\n\tfaucetUrl?: string,\n\tdeployerMnemonic?: string,\n\tdeployerSeed?: string\n): Promise<void> {\n\tCLIDisplay.task(`Upgrading contract: ${contractName}`);\n\n\tconst walletAddress = await validateEnvironmentForNetwork(\n\t\tnetwork,\n\t\tconfig,\n\t\tfalse,\n\t\tfaucetUrl,\n\t\tdeployerMnemonic,\n\t\tdeployerSeed\n\t);\n\tawait checkWalletBalance(network, config, walletAddress, false);\n\n\tconst upgradeResult = await executeContractUpgrade(contractData, config);\n\n\t// Update contract data with upgrade chain tracking\n\tcontractData.deployedPackageId = upgradeResult.packageId;\n\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.upgradeSuccessful\"),\n\t\tupgradeResult.packageId,\n\t\t1\n\t);\n\tif (contractData.lastDeployedPackageId) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.previousDeployment\"),\n\t\t\tcontractData.lastDeployedPackageId,\n\t\t\t1\n\t\t);\n\t}\n\tif (contractData.upgradeCapabilityId) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.upgradeCapabilityPreserved\"),\n\t\t\tcontractData.upgradeCapabilityId,\n\t\t\t1\n\t\t);\n\t}\n}\n\n/**\n * Deploy a single contract.\n * @param contractName Name of the contract\n * @param contractData Contract compilation data\n * @param contractData.packageId Package ID\n * @param contractData.packageBytecode Package bytecode\n * @param contractData.deployedPackageId Deployed package ID\n * @param config Network configuration\n * @param network Target network\n * @param dryRun Whether this is a dry run\n * @param force Whether to force redeployment\n * @param faucetUrl The faucet URL (optional, defaults to network-specific URL).\n * @param deployerMnemonic The deployer mnemonic from environment variables.\n * @param deployerSeed The deployer seed from environment variables (optional).\n */\nasync function deployContract(\n\tcontractName: string,\n\tcontractData: IContractData,\n\tconfig: INetworkConfig,\n\tnetwork: NetworkTypes,\n\tdryRun: boolean,\n\tforce: boolean,\n\tfaucetUrl?: string,\n\tdeployerMnemonic?: string,\n\tdeployerSeed?: string\n): Promise<void> {\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\"commands.deploy.progress.deployingContract\", { contractName, network })\n\t);\n\n\tconst strategy = await determineDeploymentStrategy(contractData);\n\n\tif (strategy === \"already-deployed\" && !force) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.contractStatus\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.messages.contractAlreadyDeployed\"),\n\t\t\t1\n\t\t);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.upgradeGuidance\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.messages.upgradeGuidanceMessage\"),\n\t\t\t1\n\t\t);\n\t\treturn;\n\t}\n\n\t// Show deployment strategy\n\tCLIDisplay.section(I18n.formatMessage(\"commands.deploy.labels.smartDeployAnalysis\"));\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.upgradeCapability\"),\n\t\tcontractData.upgradeCapabilityId ??\n\t\t\tI18n.formatMessage(\"commands.deploy.messages.noneInitialDeployment\")\n\t);\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.currentDeployment\"),\n\t\tcontractData.deployedPackageId ??\n\t\t\tI18n.formatMessage(\"commands.deploy.messages.noneNeedsDeploymentUpgrade\")\n\t);\n\tCLIDisplay.value(I18n.formatMessage(\"commands.deploy.labels.detectedStrategy\"), strategy);\n\n\tif (dryRun) {\n\t\tawait handleDryRunValidation(\n\t\t\tcontractName,\n\t\t\tcontractData,\n\t\t\tconfig,\n\t\t\tnetwork,\n\t\t\tfaucetUrl,\n\t\t\tdeployerMnemonic,\n\t\t\tdeployerSeed\n\t\t);\n\t\treturn;\n\t}\n\n\tif (strategy === \"upgrade\") {\n\t\tawait handleContractUpgrade(\n\t\t\tcontractName,\n\t\t\tcontractData,\n\t\t\tconfig,\n\t\t\tnetwork,\n\t\t\tfaucetUrl,\n\t\t\tdeployerMnemonic,\n\t\t\tdeployerSeed\n\t\t);\n\t} else {\n\t\tawait handleActualDeployment(\n\t\t\tcontractName,\n\t\t\tcontractData,\n\t\t\tconfig,\n\t\t\tnetwork,\n\t\t\tfaucetUrl,\n\t\t\tdeployerMnemonic,\n\t\t\tdeployerSeed\n\t\t);\n\t}\n}\n\n/**\n * Get wallet address for deployment, preferring seed over mnemonic if available.\n * @param network The target network.\n * @param addressIndex The address index to derive.\n * @param deployerMnemonic The deployer mnemonic from environment variables.\n * @param deployerSeed The deployer seed from environment variables (optional).\n * @returns The wallet address.\n */\nasync function getDeploymentWalletAddress(\n\tnetwork: NetworkTypes,\n\taddressIndex: number,\n\tdeployerMnemonic?: string,\n\tdeployerSeed?: string\n): Promise<string> {\n\t// Try to use seed first if available\n\tconst hexSeed = await getDeploymentSeed(network, deployerSeed);\n\tlet seed: Uint8Array | undefined;\n\tif (Is.stringValue(hexSeed)) {\n\t\tseed = Converter.hexToBytes(hexSeed);\n\t} else {\n\t\tconst mnemonic = await getDeploymentMnemonic(network, deployerMnemonic);\n\t\tseed = Bip39.mnemonicToSeed(mnemonic);\n\t}\n\n\tconst addresses = Iota.getAddresses(seed, Iota.DEFAULT_COIN_TYPE, 0, addressIndex, 1, false);\n\n\treturn addresses[0];\n}\n\n/**\n * Convert nanos to IOTA (1 IOTA = 1,000,000,000 nanos).\n * @param nanos Balance in nanos.\n * @returns Balance in IOTA.\n */\nfunction nanosToIota(nanos: number): number {\n\treturn nanos / 1_000_000_000;\n}\n\n/**\n * Request funds from the faucet for testnet or devnet deployment.\n * @param network The target network (testnet or devnet).\n * @param walletAddress The wallet address to fund.\n * @param rpcUrl The RPC URL for the network.\n * @param faucetUrl The faucet URL (optional, defaults to network-specific URL).\n * @returns Promise that resolves when funding is complete.\n */\nasync function requestFaucetFunds(\n\tnetwork: NetworkTypes,\n\twalletAddress: string,\n\trpcUrl: string,\n\tfaucetUrl: string\n): Promise<void> {\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\"commands.deploy.progress.requestingFaucetFunds\", { network })\n\t);\n\n\tconst response = await requestIotaFromFaucetV0({\n\t\thost: faucetUrl,\n\t\trecipient: walletAddress\n\t});\n\n\tif (response?.error) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.fundingFailed\", undefined, response.error);\n\t}\n\n\tconst client = new IotaClient({ url: rpcUrl });\n\tconst balanceResponse = await client.getBalance({ owner: walletAddress });\n\tconst balanceInNanos = Number(balanceResponse.totalBalance);\n\n\tif (balanceInNanos > 0) {\n\t\tconst amountInIota = nanosToIota(balanceInNanos);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.faucetFundsRequested\"),\n\t\t\t`${amountInIota.toFixed(2)} IOTA`,\n\t\t\t1\n\t\t);\n\t} else {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.warning\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.faucetNoFundsAdded\", { network }),\n\t\t\t2\n\t\t);\n\t}\n}\n\n/**\n * Check wallet balance and request faucet funds only if needed.\n * @param network The target network (testnet or devnet).\n * @param config Network configuration.\n * @param walletAddress The wallet address to check and potentially fund.\n * @param faucetUrl The faucet URL (optional, defaults to network-specific URL).\n * @returns Promise that resolves when balance check and optional funding is complete.\n */\nasync function checkBalanceAndRequestFaucetIfNeeded(\n\tnetwork: NetworkTypes,\n\tconfig: INetworkConfig,\n\twalletAddress: string,\n\tfaucetUrl?: string\n): Promise<void> {\n\t// Check current balance\n\tconst client = new IotaClient({ url: config.rpc.url });\n\tconst balanceResponse = await client.getBalance({ owner: walletAddress });\n\tconst balanceInNanos = Number(balanceResponse.totalBalance);\n\tconst requiredInNanos = config.deployment.gasBudget;\n\t// Convert to IOTA for display purposes\n\tconst balanceInIota = nanosToIota(balanceInNanos);\n\tconst requiredInIota = nanosToIota(requiredInNanos);\n\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.walletBalance\"),\n\t\t`${balanceInIota.toFixed(2)} IOTA`,\n\t\t1\n\t);\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.gasBudget\"),\n\t\t`${requiredInIota.toFixed(2)} IOTA`,\n\t\t1\n\t);\n\n\t// Only request faucet funds if balance is insufficient (compare in same units - nanos)\n\tif (balanceInNanos < requiredInNanos) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.warning\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.insufficientBalance\", {\n\t\t\t\tcurrentBalance: balanceInIota.toFixed(2),\n\t\t\t\trequiredBalance: requiredInIota.toFixed(2)\n\t\t\t}),\n\t\t\t1\n\t\t);\n\n\t\tif (!Is.stringValue(faucetUrl)) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.noFaucetConfigured\");\n\t\t}\n\n\t\tCLIDisplay.task(I18n.formatMessage(\"commands.deploy.progress.requestingAdditionalFaucetFunds\"));\n\t\tawait requestFaucetFunds(network, walletAddress, config.rpc.url, faucetUrl);\n\n\t\t// Check balance again after faucet request\n\t\tconst updatedBalanceResponse = await client.getBalance({ owner: walletAddress });\n\t\tconst updatedBalanceInNanos = Number(updatedBalanceResponse.totalBalance);\n\t\tconst updatedBalanceInIota = nanosToIota(updatedBalanceInNanos);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.updatedWalletBalance\"),\n\t\t\t`${updatedBalanceInIota.toFixed(2)} IOTA`,\n\t\t\t1\n\t\t);\n\t} else {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.balanceCheck\"),\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.sufficientFundsAvailable\"),\n\t\t\t1\n\t\t);\n\t}\n}\n\n/**\n * Deploy contract using IOTA CLI.\n * @param gasBudget Gas budget for deployment.\n * @returns Deployment result with package ID, upgrade cap, and migration state ID.\n */\nasync function deployWithIotaCli(\n\tgasBudget: number\n): Promise<{ packageId: string; upgradeCap?: string; migrationStateId?: string }> {\n\t// Find the Move project directory\n\tconst moveTomlPaths: string[] = [];\n\tconst cwd = process.cwd();\n\tawait searchDirectoryForMoveToml(cwd, moveTomlPaths);\n\n\tif (moveTomlPaths.length === 0) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.noMoveTomlFilesFound\", {\n\t\t\tcurrentDir: cwd\n\t\t});\n\t}\n\n\t// Prioritize Move.toml in current directory, then use first found\n\tconst currentDirMoveToml = path.join(cwd, \"Move.toml\");\n\tconst selectedMoveToml = moveTomlPaths.find(p => p === currentDirMoveToml) ?? moveTomlPaths[0];\n\n\t// Use the actual Move project directory\n\tconst moveProjectRoot = path.dirname(selectedMoveToml);\n\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.moveProjectRoot\"),\n\t\tmoveProjectRoot,\n\t\t1\n\t);\n\n\tconst publishCmd = `iota client publish --gas-budget ${gasBudget} --json`;\n\n\tCLIDisplay.value(I18n.formatMessage(\"commands.deploy.labels.publishCommand\"), publishCmd, 1);\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.workingDirectory\"),\n\t\tmoveProjectRoot,\n\t\t1\n\t);\n\n\ttry {\n\t\tconst { stdout: output } = await execAsyncWithError(publishCmd, { cwd: moveProjectRoot });\n\t\tconst result = JSON.parse(output);\n\n\t\t// Extract package ID from published object\n\t\tconst packageId = result.objectChanges?.find(\n\t\t\t(change: { type: string; packageId?: string }) => change.type === \"published\"\n\t\t)?.packageId;\n\n\t\tif (!packageId) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.packageIdNotFound\", {\n\t\t\t\tresult\n\t\t\t});\n\t\t}\n\n\t\t// Extract UpgradeCap ID from created objects\n\t\tconst upgradeCap = result.objectChanges?.find(\n\t\t\t(change: { objectType?: string; objectId?: string }) =>\n\t\t\t\tchange.objectType === \"0x2::package::UpgradeCap\"\n\t\t)?.objectId;\n\n\t\t// Extract MigrationState ID from created objects\n\t\tconst migrationStateId = result.objectChanges?.find(\n\t\t\t(change: { objectType?: string; objectId?: string }) =>\n\t\t\t\tchange.objectType?.endsWith(\"::MigrationState\")\n\t\t)?.objectId;\n\n\t\treturn {\n\t\t\tpackageId,\n\t\t\tupgradeCap,\n\t\t\tmigrationStateId\n\t\t};\n\t} catch (err) {\n\t\tthrow new GeneralError(\"commands\", \"commands.deploy.deploymentFailed\", undefined, err);\n\t}\n}\n\n/**\n * Update contracts file with deployed package IDs.\n * @param contractsPath Path to contracts file.\n * @param contractsData Updated contracts data.\n */\nasync function updateContractsFile(\n\tcontractsPath: string,\n\tcontractsData: ISmartContractDeployments\n): Promise<void> {\n\ttry {\n\t\tawait CLIUtils.writeJsonFile(contractsPath, contractsData, false);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.deploy.labels.updatedContractsFile\"),\n\t\t\tcontractsPath,\n\t\t\t1\n\t\t);\n\t} catch (err) {\n\t\tthrow new GeneralError(\n\t\t\t\"commands\",\n\t\t\t\"commands.deploy.contractsFileUpdateFailed\",\n\t\t\t{ contractsPath },\n\t\t\terr\n\t\t);\n\t}\n}\n\n/**\n * Generate a unique backup alias that doesn't conflict with existing keys.\n * Uses cryptographically secure random bytes to avoid conflicts.\n * @param baseAlias The original alias name.\n * @param existingKeys Array of existing keys from keystore.\n * @returns A unique backup alias name.\n */\nexport function generateUniqueBackupAlias(\n\tbaseAlias: string,\n\texistingKeys: { alias: string; iotaAddress: string }[]\n): string {\n\tconst existingAliases = new Set(existingKeys.map(key => key.alias));\n\n\t// Generate cryptographically secure random identifier\n\tconst randomSuffix = Converter.bytesToHex(RandomHelper.generate(4));\n\tconst backupAlias = `${baseAlias}-backup-${randomSuffix}`;\n\n\t// In the extremely unlikely event of collision, add timestamp\n\tif (existingAliases.has(backupAlias)) {\n\t\treturn `${baseAlias}-backup-${Date.now()}-${randomSuffix}`;\n\t}\n\n\treturn backupAlias;\n}\n\n/**\n * Ensure the correct deployer key exists in the keystore with the expected address.\n * If a conflicting alias exists, rename it and import the correct key.\n * @param network The target network.\n * @param aliasName The desired alias name (e.g., \"deployer-testnet\").\n * @param expectedAddress The expected address from the current mnemonic.\n * @param addressIndex The address index to use.\n * @param deployerMnemonic The deployer mnemonic.\n */\nexport async function ensureCorrectDeployerKey(\n\tnetwork: NetworkTypes,\n\taliasName: string,\n\texpectedAddress: string,\n\taddressIndex: number,\n\tdeployerMnemonic: string\n): Promise<void> {\n\ttry {\n\t\t// Check if the alias already exists in keystore\n\t\tconst { stdout: keysListOutput } = await execAsyncWithError(\"iota keytool list --json\");\n\t\tconst keysList = JSON.parse(keysListOutput);\n\n\t\t// Find existing key with the target alias\n\t\tconst existingKey = keysList.find(\n\t\t\t(key: { alias: string; iotaAddress: string }) => key.alias === aliasName\n\t\t);\n\n\t\tif (existingKey) {\n\t\t\t// Check if existing key has the correct address\n\t\t\tconst existingAddress = existingKey.iotaAddress;\n\n\t\t\tif (existingAddress !== expectedAddress) {\n\t\t\t\t// Conflicting alias exists with wrong mnemonic - rename it\n\t\t\t\tCLIDisplay.task(\n\t\t\t\t\tI18n.formatMessage(\"commands.deploy.progress.renamingConflictingKey\", { aliasName })\n\t\t\t\t);\n\n\t\t\t\tconst backupAlias = generateUniqueBackupAlias(aliasName, keysList);\n\t\t\t\tawait execAsyncWithError(`iota keytool update-alias \"${aliasName}\" \"${backupAlias}\"`);\n\n\t\t\t\tCLIDisplay.value(\n\t\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.renamedExistingKey\"),\n\t\t\t\t\t`${aliasName} → ${backupAlias} (${existingAddress})`,\n\t\t\t\t\t1\n\t\t\t\t);\n\n\t\t\t\t// Now import the correct key with the desired alias\n\t\t\t\tawait importCorrectDeployerKey(\n\t\t\t\t\tnetwork,\n\t\t\t\t\taliasName,\n\t\t\t\t\taddressIndex,\n\t\t\t\t\texpectedAddress,\n\t\t\t\t\tdeployerMnemonic\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Existing key is correct - no action needed\n\t\t\t\tCLIDisplay.value(\n\t\t\t\t\tI18n.formatMessage(\"commands.deploy.labels.usingExistingCorrectKey\"),\n\t\t\t\t\t`${aliasName} (${expectedAddress})`,\n\t\t\t\t\t1\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\t// No existing alias - import the key\n\t\t\tawait importCorrectDeployerKey(\n\t\t\t\tnetwork,\n\t\t\t\taliasName,\n\t\t\t\taddressIndex,\n\t\t\t\texpectedAddress,\n\t\t\t\tdeployerMnemonic\n\t\t\t);\n\t\t}\n\n\t\t// Verify the address exists in client addresses\n\t\tconst { stdout: addressListOutput } = await execAsyncWithError(\"iota client addresses --json\");\n\t\tconst addressInfo = JSON.parse(addressListOutput);\n\t\tconst addressExists: boolean = addressInfo.addresses.some(\n\t\t\t([_, addr]: [string, string]) => addr === expectedAddress\n\t\t);\n\n\t\tif (!addressExists) {\n\t\t\tthrow new GeneralError(\"commands\", \"commands.deploy.addressNotInClient\", {\n\t\t\t\texpectedAddress,\n\t\t\t\taliasName\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\tthrow new GeneralError(\n\t\t\t\"commands\",\n\t\t\t\"commands.deploy.deployerKeySetupFailed\",\n\t\t\t{ network, aliasName, expectedAddress },\n\t\t\terror\n\t\t);\n\t}\n}\n\n/**\n * Import the deployer key with the correct mnemonic.\n * @param network The target network.\n * @param aliasName The alias name to use.\n * @param addressIndex The address index.\n * @param targetAddress The expected target address (avoids redundant calculation).\n * @param deployerMnemonic The deployer mnemonic.\n */\nasync function importCorrectDeployerKey(\n\tnetwork: NetworkTypes,\n\taliasName: string,\n\taddressIndex: number,\n\ttargetAddress: string,\n\tdeployerMnemonic: string\n): Promise<void> {\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\"commands.deploy.progress.importingDeployerKey\", { aliasName })\n\t);\n\n\tconst mnemonic = await getDeploymentMnemonic(network, deployerMnemonic);\n\tconst derivationPath = Bip44.path(Iota.DEFAULT_COIN_TYPE, 0, false, addressIndex).toString();\n\n\tawait execAsyncWithError(\n\t\t`iota keytool import \"${mnemonic}\" ed25519 \"${derivationPath}\" --alias \"${aliasName}\"`\n\t);\n\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.deploy.labels.importedDeployerKey\"),\n\t\t`${aliasName} (${targetAddress})`,\n\t\t1\n\t);\n}\n"]}
@@ -353,9 +353,6 @@
353
353
  "transactionCosts": "Transaction costs for operation \"{operation}\", \"{cost}\""
354
354
  }
355
355
  },
356
- "errorMessages": {
357
- "fetch": "Fetch"
358
- },
359
356
  "commands": {
360
357
  "build": {
361
358
  "description": "Compiles Move smart contracts using the IOTA CLI and generates a network-aware JSON structure containing compiled bytecode modules.",
@@ -505,7 +502,9 @@
505
502
  "upgradeGuidance": "Upgrade Guidance",
506
503
  "previousDeployment": "Previous Deployment",
507
504
  "currentDeployment": "Current Deployment",
508
- "buildValidation": "Build Validation"
505
+ "buildValidation": "Build Validation",
506
+ "onChainPackageId": "On-chain UpgradeCap Package",
507
+ "onChainVersion": "On-chain UpgradeCap Version"
509
508
  },
510
509
  "progress": {
511
510
  "checkingEnvironment": "Checking IOTA CLI environment...",
@@ -514,7 +513,8 @@
514
513
  "requestingFaucetFunds": "Requesting funds from {network} faucet...",
515
514
  "requestingAdditionalFaucetFunds": "Requesting additional funds from faucet...",
516
515
  "renamingConflictingKey": "Renaming conflicting key alias \"{aliasName}\" to preserve existing key",
517
- "importingDeployerKey": "Importing deployer key as \"{aliasName}\""
516
+ "importingDeployerKey": "Importing deployer key as \"{aliasName}\"",
517
+ "queryingUpgradeCap": "Querying on-chain UpgradeCap to validate published-at..."
518
518
  },
519
519
  "messages": {
520
520
  "contractAlreadyDeployed": "Contract already deployed, no changes detected",
@@ -522,7 +522,8 @@
522
522
  "noneInitialDeployment": "None - Initial deployment",
523
523
  "noneNeedsDeploymentUpgrade": "None - Needs deployment/upgrade",
524
524
  "originalConfigurationRestored": "Original configuration restored",
525
- "contractBuiltAndReadyForUpgrade": "Contract has been built and is ready for upgrade"
525
+ "contractBuiltAndReadyForUpgrade": "Contract has been built and is ready for upgrade",
526
+ "staleJsonDetected": "Stale deployment JSON detected. JSON has \"{jsonPackageId}\" but on-chain UpgradeCap has \"{onChainPackageId}\". Using on-chain value."
526
527
  },
527
528
  "section": {
528
529
  "deployContracts": "Deploy Contracts"
package/docs/changelog.md CHANGED
@@ -1,11 +1,39 @@
1
1
  # Changelog
2
2
 
3
- ## [0.0.3-next.7](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.3-next.6...move-to-json-v0.0.3-next.7) (2026-03-13)
3
+ ## [0.0.3-next.9](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.3-next.8...move-to-json-v0.0.3-next.9) (2026-05-11)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **move-to-json:** Synchronize repo versions
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/dlt-iota bumped from 0.0.3-next.8 to 0.0.3-next.9
16
+
17
+ ## [0.0.3-next.8](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.3-next.7...move-to-json-v0.0.3-next.8) (2026-03-16)
18
+
19
+
20
+ ### Features
21
+
22
+ * validate published-at against on-chain UpgradeCap before upgrade ([#62](https://github.com/iotaledger/twin-dlt/issues/62)) ([23b49e2](https://github.com/iotaledger/twin-dlt/commit/23b49e247b89d2e363f9420b01fa35941f73be12))
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/dlt-iota bumped from 0.0.3-next.7 to 0.0.3-next.8
30
+
31
+ ## [0.0.3-next.7](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.3-next.6...move-to-json-v0.0.3-next.7) (2026-03-13)
4
32
 
5
33
 
6
34
  ### Bug Fixes
7
35
 
8
- * buffer usage required for identity ([#60](https://github.com/twinfoundation/dlt/issues/60)) ([0ba7d16](https://github.com/twinfoundation/dlt/commit/0ba7d165662b0083aa2b4c1325dd8c2e65defa2e))
36
+ * buffer usage required for identity ([#60](https://github.com/iotaledger/twin-dlt/issues/60)) ([0ba7d16](https://github.com/iotaledger/twin-dlt/commit/0ba7d165662b0083aa2b4c1325dd8c2e65defa2e))
9
37
 
10
38
 
11
39
  ### Dependencies
@@ -14,12 +42,12 @@
14
42
  * dependencies
15
43
  * @twin.org/dlt-iota bumped from 0.0.3-next.6 to 0.0.3-next.7
16
44
 
17
- ## [0.0.3-next.6](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.3-next.5...move-to-json-v0.0.3-next.6) (2026-03-12)
45
+ ## [0.0.3-next.6](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.3-next.5...move-to-json-v0.0.3-next.6) (2026-03-12)
18
46
 
19
47
 
20
48
  ### Features
21
49
 
22
- * add IotaIdentityUtils to resolve IOTA identity controller cap info ([#57](https://github.com/twinfoundation/dlt/issues/57)) ([f15281a](https://github.com/twinfoundation/dlt/commit/f15281af3b2812bde5130a1813f9c0143f1462bf))
50
+ * add IotaIdentityUtils to resolve IOTA identity controller cap info ([#57](https://github.com/iotaledger/twin-dlt/issues/57)) ([f15281a](https://github.com/iotaledger/twin-dlt/commit/f15281af3b2812bde5130a1813f9c0143f1462bf))
23
51
 
24
52
 
25
53
  ### Dependencies
@@ -28,12 +56,12 @@
28
56
  * dependencies
29
57
  * @twin.org/dlt-iota bumped from 0.0.3-next.5 to 0.0.3-next.6
30
58
 
31
- ## [0.0.3-next.5](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.3-next.4...move-to-json-v0.0.3-next.5) (2026-03-03)
59
+ ## [0.0.3-next.5](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.3-next.4...move-to-json-v0.0.3-next.5) (2026-03-03)
32
60
 
33
61
 
34
62
  ### Bug Fixes
35
63
 
36
- * additional debugging ([0d335a5](https://github.com/twinfoundation/dlt/commit/0d335a594a34dea047fa0ee4143b2d519183b704))
64
+ * additional debugging ([0d335a5](https://github.com/iotaledger/twin-dlt/commit/0d335a594a34dea047fa0ee4143b2d519183b704))
37
65
 
38
66
 
39
67
  ### Dependencies
@@ -42,7 +70,7 @@
42
70
  * dependencies
43
71
  * @twin.org/dlt-iota bumped from 0.0.3-next.4 to 0.0.3-next.5
44
72
 
45
- ## [0.0.3-next.4](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.3-next.3...move-to-json-v0.0.3-next.4) (2026-02-25)
73
+ ## [0.0.3-next.4](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.3-next.3...move-to-json-v0.0.3-next.4) (2026-02-25)
46
74
 
47
75
 
48
76
  ### Miscellaneous Chores
@@ -56,37 +84,37 @@
56
84
  * dependencies
57
85
  * @twin.org/dlt-iota bumped from 0.0.3-next.3 to 0.0.3-next.4
58
86
 
59
- ## [0.0.3-next.3](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.3-next.2...move-to-json-v0.0.3-next.3) (2026-02-25)
87
+ ## [0.0.3-next.3](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.3-next.2...move-to-json-v0.0.3-next.3) (2026-02-25)
60
88
 
61
89
 
62
90
  ### Features
63
91
 
64
- * add context id features ([#51](https://github.com/twinfoundation/dlt/issues/51)) ([fb68498](https://github.com/twinfoundation/dlt/commit/fb6849897957904ec90cf6368153aeff3bef261a))
65
- * add header for CLI check ([#8](https://github.com/twinfoundation/dlt/issues/8)) ([0b9f271](https://github.com/twinfoundation/dlt/commit/0b9f2711fb3a9eb859e481725bfa1e2139e14053))
66
- * add validate-locales ([8465099](https://github.com/twinfoundation/dlt/commit/8465099626ab1891d419a35870fae447efc3008d))
67
- * bytecode change detection ([#43](https://github.com/twinfoundation/dlt/issues/43)) ([528469c](https://github.com/twinfoundation/dlt/commit/528469c1e4f032c6a936a9724a692abe403d92f6))
68
- * consolidate environment management ([#41](https://github.com/twinfoundation/dlt/issues/41)) ([add1618](https://github.com/twinfoundation/dlt/commit/add161828e5dc42880fb0a5f9d3e61e611cf92bb))
69
- * eslint migration to flat config ([83b56f0](https://github.com/twinfoundation/dlt/commit/83b56f02b1483f77c5f4cb9d7a1c345c56631333))
70
- * eslint migration to flat config ([da1d12d](https://github.com/twinfoundation/dlt/commit/da1d12dcf5b24e7ba6204f540c27de191bca098e))
71
- * methods for alias handling and tests ([#38](https://github.com/twinfoundation/dlt/issues/38)) ([43e0062](https://github.com/twinfoundation/dlt/commit/43e006220b4cf3df1aceb52b62178be0395ede00))
72
- * move to json build deploy commands ([#30](https://github.com/twinfoundation/dlt/issues/30)) ([91aa00a](https://github.com/twinfoundation/dlt/commit/91aa00a29a8d7e3a99a46cea89e879a12dffc188))
73
- * remove local error handling as CLI base already handles this ([fc5a083](https://github.com/twinfoundation/dlt/commit/fc5a083303f8c92cc264f782a2d292436da18031))
74
- * update dependencies ([bfbe8fc](https://github.com/twinfoundation/dlt/commit/bfbe8fcfda80aa59d04f4ade3e4012e5291c8877))
75
- * update dependencies ([f7b71c2](https://github.com/twinfoundation/dlt/commit/f7b71c24274b71e2d37c26c4a7e5e6d9df1dc9b7))
76
- * update framework core ([79fc4b9](https://github.com/twinfoundation/dlt/commit/79fc4b961bd755437cad98d733ca9e25476bc03f))
77
- * upgrade capabilities ([#32](https://github.com/twinfoundation/dlt/issues/32)) ([437219f](https://github.com/twinfoundation/dlt/commit/437219f0f784ec38353c01e1c8ce6bfba3b1b530))
78
- * use new CLIParam.arrayOnOf ([1f6458a](https://github.com/twinfoundation/dlt/commit/1f6458a44486dfa5ddbf61bd63b85a98ec561728))
79
- * use shared store mechanism ([#10](https://github.com/twinfoundation/dlt/issues/10)) ([ce36214](https://github.com/twinfoundation/dlt/commit/ce36214577f02cbb9642f831cb2c21335c31cc9a))
92
+ * add context id features ([#51](https://github.com/iotaledger/twin-dlt/issues/51)) ([fb68498](https://github.com/iotaledger/twin-dlt/commit/fb6849897957904ec90cf6368153aeff3bef261a))
93
+ * add header for CLI check ([#8](https://github.com/iotaledger/twin-dlt/issues/8)) ([0b9f271](https://github.com/iotaledger/twin-dlt/commit/0b9f2711fb3a9eb859e481725bfa1e2139e14053))
94
+ * add validate-locales ([8465099](https://github.com/iotaledger/twin-dlt/commit/8465099626ab1891d419a35870fae447efc3008d))
95
+ * bytecode change detection ([#43](https://github.com/iotaledger/twin-dlt/issues/43)) ([528469c](https://github.com/iotaledger/twin-dlt/commit/528469c1e4f032c6a936a9724a692abe403d92f6))
96
+ * consolidate environment management ([#41](https://github.com/iotaledger/twin-dlt/issues/41)) ([add1618](https://github.com/iotaledger/twin-dlt/commit/add161828e5dc42880fb0a5f9d3e61e611cf92bb))
97
+ * eslint migration to flat config ([83b56f0](https://github.com/iotaledger/twin-dlt/commit/83b56f02b1483f77c5f4cb9d7a1c345c56631333))
98
+ * eslint migration to flat config ([da1d12d](https://github.com/iotaledger/twin-dlt/commit/da1d12dcf5b24e7ba6204f540c27de191bca098e))
99
+ * methods for alias handling and tests ([#38](https://github.com/iotaledger/twin-dlt/issues/38)) ([43e0062](https://github.com/iotaledger/twin-dlt/commit/43e006220b4cf3df1aceb52b62178be0395ede00))
100
+ * move to json build deploy commands ([#30](https://github.com/iotaledger/twin-dlt/issues/30)) ([91aa00a](https://github.com/iotaledger/twin-dlt/commit/91aa00a29a8d7e3a99a46cea89e879a12dffc188))
101
+ * remove local error handling as CLI base already handles this ([fc5a083](https://github.com/iotaledger/twin-dlt/commit/fc5a083303f8c92cc264f782a2d292436da18031))
102
+ * update dependencies ([bfbe8fc](https://github.com/iotaledger/twin-dlt/commit/bfbe8fcfda80aa59d04f4ade3e4012e5291c8877))
103
+ * update dependencies ([f7b71c2](https://github.com/iotaledger/twin-dlt/commit/f7b71c24274b71e2d37c26c4a7e5e6d9df1dc9b7))
104
+ * update framework core ([79fc4b9](https://github.com/iotaledger/twin-dlt/commit/79fc4b961bd755437cad98d733ca9e25476bc03f))
105
+ * upgrade capabilities ([#32](https://github.com/iotaledger/twin-dlt/issues/32)) ([437219f](https://github.com/iotaledger/twin-dlt/commit/437219f0f784ec38353c01e1c8ce6bfba3b1b530))
106
+ * use new CLIParam.arrayOnOf ([1f6458a](https://github.com/iotaledger/twin-dlt/commit/1f6458a44486dfa5ddbf61bd63b85a98ec561728))
107
+ * use shared store mechanism ([#10](https://github.com/iotaledger/twin-dlt/issues/10)) ([ce36214](https://github.com/iotaledger/twin-dlt/commit/ce36214577f02cbb9642f831cb2c21335c31cc9a))
80
108
 
81
109
 
82
110
  ### Bug Fixes
83
111
 
84
- * adding dependencies ([#45](https://github.com/twinfoundation/dlt/issues/45)) ([969f598](https://github.com/twinfoundation/dlt/commit/969f59807a0a0585dfe7d078b2cb38f197afb5d6))
85
- * docs ([cade544](https://github.com/twinfoundation/dlt/commit/cade5443a4b955d592c1622f07499ad8a3d554b6))
86
- * i18n messages ([4b61495](https://github.com/twinfoundation/dlt/commit/4b614957ea84d8af43345892cae3256dfa457483))
87
- * missing dependency ([16f363c](https://github.com/twinfoundation/dlt/commit/16f363cde935d3b30cf86e01cb12f0390bfc8648))
88
- * modifying logging type param ([#36](https://github.com/twinfoundation/dlt/issues/36)) ([b884fcc](https://github.com/twinfoundation/dlt/commit/b884fccef5bea5c6818cf8bfa8af197d3622cac6))
89
- * update console output ([8cb193e](https://github.com/twinfoundation/dlt/commit/8cb193e2704e1e391d4c3c5899b765ca12471ef3))
112
+ * adding dependencies ([#45](https://github.com/iotaledger/twin-dlt/issues/45)) ([969f598](https://github.com/iotaledger/twin-dlt/commit/969f59807a0a0585dfe7d078b2cb38f197afb5d6))
113
+ * docs ([cade544](https://github.com/iotaledger/twin-dlt/commit/cade5443a4b955d592c1622f07499ad8a3d554b6))
114
+ * i18n messages ([4b61495](https://github.com/iotaledger/twin-dlt/commit/4b614957ea84d8af43345892cae3256dfa457483))
115
+ * missing dependency ([16f363c](https://github.com/iotaledger/twin-dlt/commit/16f363cde935d3b30cf86e01cb12f0390bfc8648))
116
+ * modifying logging type param ([#36](https://github.com/iotaledger/twin-dlt/issues/36)) ([b884fcc](https://github.com/iotaledger/twin-dlt/commit/b884fccef5bea5c6818cf8bfa8af197d3622cac6))
117
+ * update console output ([8cb193e](https://github.com/iotaledger/twin-dlt/commit/8cb193e2704e1e391d4c3c5899b765ca12471ef3))
90
118
 
91
119
 
92
120
  ### Dependencies
@@ -95,12 +123,12 @@
95
123
  * dependencies
96
124
  * @twin.org/dlt-iota bumped from 0.0.3-next.2 to 0.0.3-next.3
97
125
 
98
- ## [0.0.3-next.2](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.3-next.1...move-to-json-v0.0.3-next.2) (2026-02-25)
126
+ ## [0.0.3-next.2](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.3-next.1...move-to-json-v0.0.3-next.2) (2026-02-25)
99
127
 
100
128
 
101
129
  ### Bug Fixes
102
130
 
103
- * missing dependency ([16f363c](https://github.com/twinfoundation/dlt/commit/16f363cde935d3b30cf86e01cb12f0390bfc8648))
131
+ * missing dependency ([16f363c](https://github.com/iotaledger/twin-dlt/commit/16f363cde935d3b30cf86e01cb12f0390bfc8648))
104
132
 
105
133
 
106
134
  ### Dependencies
@@ -109,35 +137,35 @@
109
137
  * dependencies
110
138
  * @twin.org/dlt-iota bumped from 0.0.3-next.1 to 0.0.3-next.2
111
139
 
112
- ## [0.0.3-next.1](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.3-next.0...move-to-json-v0.0.3-next.1) (2025-11-11)
140
+ ## [0.0.3-next.1](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.3-next.0...move-to-json-v0.0.3-next.1) (2025-11-11)
113
141
 
114
142
 
115
143
  ### Features
116
144
 
117
- * add context id features ([#51](https://github.com/twinfoundation/dlt/issues/51)) ([fb68498](https://github.com/twinfoundation/dlt/commit/fb6849897957904ec90cf6368153aeff3bef261a))
118
- * add header for CLI check ([#8](https://github.com/twinfoundation/dlt/issues/8)) ([0b9f271](https://github.com/twinfoundation/dlt/commit/0b9f2711fb3a9eb859e481725bfa1e2139e14053))
119
- * add validate-locales ([8465099](https://github.com/twinfoundation/dlt/commit/8465099626ab1891d419a35870fae447efc3008d))
120
- * bytecode change detection ([#43](https://github.com/twinfoundation/dlt/issues/43)) ([528469c](https://github.com/twinfoundation/dlt/commit/528469c1e4f032c6a936a9724a692abe403d92f6))
121
- * consolidate environment management ([#41](https://github.com/twinfoundation/dlt/issues/41)) ([add1618](https://github.com/twinfoundation/dlt/commit/add161828e5dc42880fb0a5f9d3e61e611cf92bb))
122
- * eslint migration to flat config ([83b56f0](https://github.com/twinfoundation/dlt/commit/83b56f02b1483f77c5f4cb9d7a1c345c56631333))
123
- * eslint migration to flat config ([da1d12d](https://github.com/twinfoundation/dlt/commit/da1d12dcf5b24e7ba6204f540c27de191bca098e))
124
- * methods for alias handling and tests ([#38](https://github.com/twinfoundation/dlt/issues/38)) ([43e0062](https://github.com/twinfoundation/dlt/commit/43e006220b4cf3df1aceb52b62178be0395ede00))
125
- * move to json build deploy commands ([#30](https://github.com/twinfoundation/dlt/issues/30)) ([91aa00a](https://github.com/twinfoundation/dlt/commit/91aa00a29a8d7e3a99a46cea89e879a12dffc188))
126
- * remove local error handling as CLI base already handles this ([fc5a083](https://github.com/twinfoundation/dlt/commit/fc5a083303f8c92cc264f782a2d292436da18031))
127
- * update dependencies ([f7b71c2](https://github.com/twinfoundation/dlt/commit/f7b71c24274b71e2d37c26c4a7e5e6d9df1dc9b7))
128
- * update framework core ([79fc4b9](https://github.com/twinfoundation/dlt/commit/79fc4b961bd755437cad98d733ca9e25476bc03f))
129
- * upgrade capabilities ([#32](https://github.com/twinfoundation/dlt/issues/32)) ([437219f](https://github.com/twinfoundation/dlt/commit/437219f0f784ec38353c01e1c8ce6bfba3b1b530))
130
- * use new CLIParam.arrayOnOf ([1f6458a](https://github.com/twinfoundation/dlt/commit/1f6458a44486dfa5ddbf61bd63b85a98ec561728))
131
- * use shared store mechanism ([#10](https://github.com/twinfoundation/dlt/issues/10)) ([ce36214](https://github.com/twinfoundation/dlt/commit/ce36214577f02cbb9642f831cb2c21335c31cc9a))
145
+ * add context id features ([#51](https://github.com/iotaledger/twin-dlt/issues/51)) ([fb68498](https://github.com/iotaledger/twin-dlt/commit/fb6849897957904ec90cf6368153aeff3bef261a))
146
+ * add header for CLI check ([#8](https://github.com/iotaledger/twin-dlt/issues/8)) ([0b9f271](https://github.com/iotaledger/twin-dlt/commit/0b9f2711fb3a9eb859e481725bfa1e2139e14053))
147
+ * add validate-locales ([8465099](https://github.com/iotaledger/twin-dlt/commit/8465099626ab1891d419a35870fae447efc3008d))
148
+ * bytecode change detection ([#43](https://github.com/iotaledger/twin-dlt/issues/43)) ([528469c](https://github.com/iotaledger/twin-dlt/commit/528469c1e4f032c6a936a9724a692abe403d92f6))
149
+ * consolidate environment management ([#41](https://github.com/iotaledger/twin-dlt/issues/41)) ([add1618](https://github.com/iotaledger/twin-dlt/commit/add161828e5dc42880fb0a5f9d3e61e611cf92bb))
150
+ * eslint migration to flat config ([83b56f0](https://github.com/iotaledger/twin-dlt/commit/83b56f02b1483f77c5f4cb9d7a1c345c56631333))
151
+ * eslint migration to flat config ([da1d12d](https://github.com/iotaledger/twin-dlt/commit/da1d12dcf5b24e7ba6204f540c27de191bca098e))
152
+ * methods for alias handling and tests ([#38](https://github.com/iotaledger/twin-dlt/issues/38)) ([43e0062](https://github.com/iotaledger/twin-dlt/commit/43e006220b4cf3df1aceb52b62178be0395ede00))
153
+ * move to json build deploy commands ([#30](https://github.com/iotaledger/twin-dlt/issues/30)) ([91aa00a](https://github.com/iotaledger/twin-dlt/commit/91aa00a29a8d7e3a99a46cea89e879a12dffc188))
154
+ * remove local error handling as CLI base already handles this ([fc5a083](https://github.com/iotaledger/twin-dlt/commit/fc5a083303f8c92cc264f782a2d292436da18031))
155
+ * update dependencies ([f7b71c2](https://github.com/iotaledger/twin-dlt/commit/f7b71c24274b71e2d37c26c4a7e5e6d9df1dc9b7))
156
+ * update framework core ([79fc4b9](https://github.com/iotaledger/twin-dlt/commit/79fc4b961bd755437cad98d733ca9e25476bc03f))
157
+ * upgrade capabilities ([#32](https://github.com/iotaledger/twin-dlt/issues/32)) ([437219f](https://github.com/iotaledger/twin-dlt/commit/437219f0f784ec38353c01e1c8ce6bfba3b1b530))
158
+ * use new CLIParam.arrayOnOf ([1f6458a](https://github.com/iotaledger/twin-dlt/commit/1f6458a44486dfa5ddbf61bd63b85a98ec561728))
159
+ * use shared store mechanism ([#10](https://github.com/iotaledger/twin-dlt/issues/10)) ([ce36214](https://github.com/iotaledger/twin-dlt/commit/ce36214577f02cbb9642f831cb2c21335c31cc9a))
132
160
 
133
161
 
134
162
  ### Bug Fixes
135
163
 
136
- * adding dependencies ([#45](https://github.com/twinfoundation/dlt/issues/45)) ([969f598](https://github.com/twinfoundation/dlt/commit/969f59807a0a0585dfe7d078b2cb38f197afb5d6))
137
- * docs ([cade544](https://github.com/twinfoundation/dlt/commit/cade5443a4b955d592c1622f07499ad8a3d554b6))
138
- * i18n messages ([4b61495](https://github.com/twinfoundation/dlt/commit/4b614957ea84d8af43345892cae3256dfa457483))
139
- * modifying logging type param ([#36](https://github.com/twinfoundation/dlt/issues/36)) ([b884fcc](https://github.com/twinfoundation/dlt/commit/b884fccef5bea5c6818cf8bfa8af197d3622cac6))
140
- * update console output ([8cb193e](https://github.com/twinfoundation/dlt/commit/8cb193e2704e1e391d4c3c5899b765ca12471ef3))
164
+ * adding dependencies ([#45](https://github.com/iotaledger/twin-dlt/issues/45)) ([969f598](https://github.com/iotaledger/twin-dlt/commit/969f59807a0a0585dfe7d078b2cb38f197afb5d6))
165
+ * docs ([cade544](https://github.com/iotaledger/twin-dlt/commit/cade5443a4b955d592c1622f07499ad8a3d554b6))
166
+ * i18n messages ([4b61495](https://github.com/iotaledger/twin-dlt/commit/4b614957ea84d8af43345892cae3256dfa457483))
167
+ * modifying logging type param ([#36](https://github.com/iotaledger/twin-dlt/issues/36)) ([b884fcc](https://github.com/iotaledger/twin-dlt/commit/b884fccef5bea5c6818cf8bfa8af197d3622cac6))
168
+ * update console output ([8cb193e](https://github.com/iotaledger/twin-dlt/commit/8cb193e2704e1e391d4c3c5899b765ca12471ef3))
141
169
 
142
170
 
143
171
  ### Dependencies
@@ -146,12 +174,12 @@
146
174
  * dependencies
147
175
  * @twin.org/dlt-iota bumped from 0.0.3-next.0 to 0.0.3-next.1
148
176
 
149
- ## [0.0.2-next.11](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.2-next.10...move-to-json-v0.0.2-next.11) (2025-10-09)
177
+ ## [0.0.2-next.11](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.2-next.10...move-to-json-v0.0.2-next.11) (2025-10-09)
150
178
 
151
179
 
152
180
  ### Features
153
181
 
154
- * add validate-locales ([8465099](https://github.com/twinfoundation/dlt/commit/8465099626ab1891d419a35870fae447efc3008d))
182
+ * add validate-locales ([8465099](https://github.com/iotaledger/twin-dlt/commit/8465099626ab1891d419a35870fae447efc3008d))
155
183
 
156
184
 
157
185
  ### Dependencies
@@ -160,12 +188,12 @@
160
188
  * dependencies
161
189
  * @twin.org/dlt-iota bumped from 0.0.2-next.10 to 0.0.2-next.11
162
190
 
163
- ## [0.0.2-next.10](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.2-next.9...move-to-json-v0.0.2-next.10) (2025-09-29)
191
+ ## [0.0.2-next.10](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.2-next.9...move-to-json-v0.0.2-next.10) (2025-09-29)
164
192
 
165
193
 
166
194
  ### Bug Fixes
167
195
 
168
- * adding dependencies ([#45](https://github.com/twinfoundation/dlt/issues/45)) ([969f598](https://github.com/twinfoundation/dlt/commit/969f59807a0a0585dfe7d078b2cb38f197afb5d6))
196
+ * adding dependencies ([#45](https://github.com/iotaledger/twin-dlt/issues/45)) ([969f598](https://github.com/iotaledger/twin-dlt/commit/969f59807a0a0585dfe7d078b2cb38f197afb5d6))
169
197
 
170
198
 
171
199
  ### Dependencies
@@ -174,19 +202,19 @@
174
202
  * dependencies
175
203
  * @twin.org/dlt-iota bumped from 0.0.2-next.9 to 0.0.2-next.10
176
204
 
177
- ## [0.0.2-next.9](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.2-next.8...move-to-json-v0.0.2-next.9) (2025-09-22)
205
+ ## [0.0.2-next.9](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.2-next.8...move-to-json-v0.0.2-next.9) (2025-09-22)
178
206
 
179
207
 
180
208
  ### Features
181
209
 
182
- * bytecode change detection ([#43](https://github.com/twinfoundation/dlt/issues/43)) ([528469c](https://github.com/twinfoundation/dlt/commit/528469c1e4f032c6a936a9724a692abe403d92f6))
183
- * remove local error handling as CLI base already handles this ([fc5a083](https://github.com/twinfoundation/dlt/commit/fc5a083303f8c92cc264f782a2d292436da18031))
184
- * use new CLIParam.arrayOnOf ([1f6458a](https://github.com/twinfoundation/dlt/commit/1f6458a44486dfa5ddbf61bd63b85a98ec561728))
210
+ * bytecode change detection ([#43](https://github.com/iotaledger/twin-dlt/issues/43)) ([528469c](https://github.com/iotaledger/twin-dlt/commit/528469c1e4f032c6a936a9724a692abe403d92f6))
211
+ * remove local error handling as CLI base already handles this ([fc5a083](https://github.com/iotaledger/twin-dlt/commit/fc5a083303f8c92cc264f782a2d292436da18031))
212
+ * use new CLIParam.arrayOnOf ([1f6458a](https://github.com/iotaledger/twin-dlt/commit/1f6458a44486dfa5ddbf61bd63b85a98ec561728))
185
213
 
186
214
 
187
215
  ### Bug Fixes
188
216
 
189
- * i18n messages ([4b61495](https://github.com/twinfoundation/dlt/commit/4b614957ea84d8af43345892cae3256dfa457483))
217
+ * i18n messages ([4b61495](https://github.com/iotaledger/twin-dlt/commit/4b614957ea84d8af43345892cae3256dfa457483))
190
218
 
191
219
 
192
220
  ### Dependencies
@@ -195,13 +223,13 @@
195
223
  * dependencies
196
224
  * @twin.org/dlt-iota bumped from 0.0.2-next.8 to 0.0.2-next.9
197
225
 
198
- ## [0.0.2-next.8](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.2-next.7...move-to-json-v0.0.2-next.8) (2025-09-10)
226
+ ## [0.0.2-next.8](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.2-next.7...move-to-json-v0.0.2-next.8) (2025-09-10)
199
227
 
200
228
 
201
229
  ### Features
202
230
 
203
- * consolidate environment management ([#41](https://github.com/twinfoundation/dlt/issues/41)) ([add1618](https://github.com/twinfoundation/dlt/commit/add161828e5dc42880fb0a5f9d3e61e611cf92bb))
204
- * eslint migration to flat config ([83b56f0](https://github.com/twinfoundation/dlt/commit/83b56f02b1483f77c5f4cb9d7a1c345c56631333))
231
+ * consolidate environment management ([#41](https://github.com/iotaledger/twin-dlt/issues/41)) ([add1618](https://github.com/iotaledger/twin-dlt/commit/add161828e5dc42880fb0a5f9d3e61e611cf92bb))
232
+ * eslint migration to flat config ([83b56f0](https://github.com/iotaledger/twin-dlt/commit/83b56f02b1483f77c5f4cb9d7a1c345c56631333))
205
233
 
206
234
 
207
235
  ### Dependencies
@@ -210,12 +238,12 @@
210
238
  * dependencies
211
239
  * @twin.org/dlt-iota bumped from 0.0.2-next.7 to 0.0.2-next.8
212
240
 
213
- ## [0.0.2-next.7](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.2-next.6...move-to-json-v0.0.2-next.7) (2025-08-29)
241
+ ## [0.0.2-next.7](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.2-next.6...move-to-json-v0.0.2-next.7) (2025-08-29)
214
242
 
215
243
 
216
244
  ### Features
217
245
 
218
- * eslint migration to flat config ([da1d12d](https://github.com/twinfoundation/dlt/commit/da1d12dcf5b24e7ba6204f540c27de191bca098e))
246
+ * eslint migration to flat config ([da1d12d](https://github.com/iotaledger/twin-dlt/commit/da1d12dcf5b24e7ba6204f540c27de191bca098e))
219
247
 
220
248
 
221
249
  ### Dependencies
@@ -224,12 +252,12 @@
224
252
  * dependencies
225
253
  * @twin.org/dlt-iota bumped from 0.0.2-next.6 to 0.0.2-next.7
226
254
 
227
- ## [0.0.2-next.6](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.2-next.5...move-to-json-v0.0.2-next.6) (2025-08-27)
255
+ ## [0.0.2-next.6](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.2-next.5...move-to-json-v0.0.2-next.6) (2025-08-27)
228
256
 
229
257
 
230
258
  ### Features
231
259
 
232
- * methods for alias handling and tests ([#38](https://github.com/twinfoundation/dlt/issues/38)) ([43e0062](https://github.com/twinfoundation/dlt/commit/43e006220b4cf3df1aceb52b62178be0395ede00))
260
+ * methods for alias handling and tests ([#38](https://github.com/iotaledger/twin-dlt/issues/38)) ([43e0062](https://github.com/iotaledger/twin-dlt/commit/43e006220b4cf3df1aceb52b62178be0395ede00))
233
261
 
234
262
 
235
263
  ### Dependencies
@@ -238,12 +266,12 @@
238
266
  * dependencies
239
267
  * @twin.org/dlt-iota bumped from 0.0.2-next.5 to 0.0.2-next.6
240
268
 
241
- ## [0.0.2-next.5](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.2-next.4...move-to-json-v0.0.2-next.5) (2025-08-25)
269
+ ## [0.0.2-next.5](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.2-next.4...move-to-json-v0.0.2-next.5) (2025-08-25)
242
270
 
243
271
 
244
272
  ### Bug Fixes
245
273
 
246
- * modifying logging type param ([#36](https://github.com/twinfoundation/dlt/issues/36)) ([b884fcc](https://github.com/twinfoundation/dlt/commit/b884fccef5bea5c6818cf8bfa8af197d3622cac6))
274
+ * modifying logging type param ([#36](https://github.com/iotaledger/twin-dlt/issues/36)) ([b884fcc](https://github.com/iotaledger/twin-dlt/commit/b884fccef5bea5c6818cf8bfa8af197d3622cac6))
247
275
 
248
276
 
249
277
  ### Dependencies
@@ -252,12 +280,12 @@
252
280
  * dependencies
253
281
  * @twin.org/dlt-iota bumped from 0.0.2-next.4 to 0.0.2-next.5
254
282
 
255
- ## [0.0.2-next.4](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.2-next.3...move-to-json-v0.0.2-next.4) (2025-08-22)
283
+ ## [0.0.2-next.4](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.2-next.3...move-to-json-v0.0.2-next.4) (2025-08-22)
256
284
 
257
285
 
258
286
  ### Features
259
287
 
260
- * upgrade capabilities ([#32](https://github.com/twinfoundation/dlt/issues/32)) ([437219f](https://github.com/twinfoundation/dlt/commit/437219f0f784ec38353c01e1c8ce6bfba3b1b530))
288
+ * upgrade capabilities ([#32](https://github.com/iotaledger/twin-dlt/issues/32)) ([437219f](https://github.com/iotaledger/twin-dlt/commit/437219f0f784ec38353c01e1c8ce6bfba3b1b530))
261
289
 
262
290
 
263
291
  ### Dependencies
@@ -266,17 +294,17 @@
266
294
  * dependencies
267
295
  * @twin.org/dlt-iota bumped from 0.0.2-next.3 to 0.0.2-next.4
268
296
 
269
- ## [0.0.2-next.3](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.2-next.2...move-to-json-v0.0.2-next.3) (2025-08-20)
297
+ ## [0.0.2-next.3](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.2-next.2...move-to-json-v0.0.2-next.3) (2025-08-20)
270
298
 
271
299
 
272
300
  ### Features
273
301
 
274
- * update framework core ([79fc4b9](https://github.com/twinfoundation/dlt/commit/79fc4b961bd755437cad98d733ca9e25476bc03f))
302
+ * update framework core ([79fc4b9](https://github.com/iotaledger/twin-dlt/commit/79fc4b961bd755437cad98d733ca9e25476bc03f))
275
303
 
276
304
 
277
305
  ### Bug Fixes
278
306
 
279
- * docs ([cade544](https://github.com/twinfoundation/dlt/commit/cade5443a4b955d592c1622f07499ad8a3d554b6))
307
+ * docs ([cade544](https://github.com/iotaledger/twin-dlt/commit/cade5443a4b955d592c1622f07499ad8a3d554b6))
280
308
 
281
309
 
282
310
  ### Dependencies
@@ -285,12 +313,12 @@
285
313
  * dependencies
286
314
  * @twin.org/dlt-iota bumped from 0.0.2-next.2 to 0.0.2-next.3
287
315
 
288
- ## [0.0.2-next.2](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.2-next.1...move-to-json-v0.0.2-next.2) (2025-07-25)
316
+ ## [0.0.2-next.2](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.2-next.1...move-to-json-v0.0.2-next.2) (2025-07-25)
289
317
 
290
318
 
291
319
  ### Features
292
320
 
293
- * move to json build deploy commands ([#30](https://github.com/twinfoundation/dlt/issues/30)) ([91aa00a](https://github.com/twinfoundation/dlt/commit/91aa00a29a8d7e3a99a46cea89e879a12dffc188))
321
+ * move to json build deploy commands ([#30](https://github.com/iotaledger/twin-dlt/issues/30)) ([91aa00a](https://github.com/iotaledger/twin-dlt/commit/91aa00a29a8d7e3a99a46cea89e879a12dffc188))
294
322
 
295
323
 
296
324
  ### Dependencies
@@ -299,89 +327,89 @@
299
327
  * dependencies
300
328
  * @twin.org/dlt-iota bumped from next to 0.0.2-next.2
301
329
 
302
- ## [0.0.2-next.1](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.2-next.0...move-to-json-v0.0.2-next.1) (2025-07-16)
330
+ ## [0.0.2-next.1](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.2-next.0...move-to-json-v0.0.2-next.1) (2025-07-16)
303
331
 
304
332
 
305
333
  ### Features
306
334
 
307
- * add header for CLI check ([#8](https://github.com/twinfoundation/dlt/issues/8)) ([0b9f271](https://github.com/twinfoundation/dlt/commit/0b9f2711fb3a9eb859e481725bfa1e2139e14053))
308
- * update dependencies ([f7b71c2](https://github.com/twinfoundation/dlt/commit/f7b71c24274b71e2d37c26c4a7e5e6d9df1dc9b7))
309
- * use shared store mechanism ([#10](https://github.com/twinfoundation/dlt/issues/10)) ([ce36214](https://github.com/twinfoundation/dlt/commit/ce36214577f02cbb9642f831cb2c21335c31cc9a))
335
+ * add header for CLI check ([#8](https://github.com/iotaledger/twin-dlt/issues/8)) ([0b9f271](https://github.com/iotaledger/twin-dlt/commit/0b9f2711fb3a9eb859e481725bfa1e2139e14053))
336
+ * update dependencies ([f7b71c2](https://github.com/iotaledger/twin-dlt/commit/f7b71c24274b71e2d37c26c4a7e5e6d9df1dc9b7))
337
+ * use shared store mechanism ([#10](https://github.com/iotaledger/twin-dlt/issues/10)) ([ce36214](https://github.com/iotaledger/twin-dlt/commit/ce36214577f02cbb9642f831cb2c21335c31cc9a))
310
338
 
311
339
  ## 0.0.1 (2025-07-08)
312
340
 
313
341
 
314
342
  ### Features
315
343
 
316
- * add header for CLI check ([#8](https://github.com/twinfoundation/dlt/issues/8)) ([0b9f271](https://github.com/twinfoundation/dlt/commit/0b9f2711fb3a9eb859e481725bfa1e2139e14053))
317
- * release to production ([fe6a7f7](https://github.com/twinfoundation/dlt/commit/fe6a7f751138ea92ac22c70438261b0cea6fb238))
318
- * update dependencies ([f7b71c2](https://github.com/twinfoundation/dlt/commit/f7b71c24274b71e2d37c26c4a7e5e6d9df1dc9b7))
319
- * use shared store mechanism ([#10](https://github.com/twinfoundation/dlt/issues/10)) ([ce36214](https://github.com/twinfoundation/dlt/commit/ce36214577f02cbb9642f831cb2c21335c31cc9a))
344
+ * add header for CLI check ([#8](https://github.com/iotaledger/twin-dlt/issues/8)) ([0b9f271](https://github.com/iotaledger/twin-dlt/commit/0b9f2711fb3a9eb859e481725bfa1e2139e14053))
345
+ * release to production ([fe6a7f7](https://github.com/iotaledger/twin-dlt/commit/fe6a7f751138ea92ac22c70438261b0cea6fb238))
346
+ * update dependencies ([f7b71c2](https://github.com/iotaledger/twin-dlt/commit/f7b71c24274b71e2d37c26c4a7e5e6d9df1dc9b7))
347
+ * use shared store mechanism ([#10](https://github.com/iotaledger/twin-dlt/issues/10)) ([ce36214](https://github.com/iotaledger/twin-dlt/commit/ce36214577f02cbb9642f831cb2c21335c31cc9a))
320
348
 
321
- ## [0.0.1-next.29](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.1-next.28...move-to-json-v0.0.1-next.29) (2025-06-26)
349
+ ## [0.0.1-next.29](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.1-next.28...move-to-json-v0.0.1-next.29) (2025-06-26)
322
350
 
323
351
 
324
352
  ### Miscellaneous Chores
325
353
 
326
354
  * **move-to-json:** Synchronize repo versions
327
355
 
328
- ## [0.0.1-next.28](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.1-next.27...move-to-json-v0.0.1-next.28) (2025-06-23)
356
+ ## [0.0.1-next.28](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.1-next.27...move-to-json-v0.0.1-next.28) (2025-06-23)
329
357
 
330
358
 
331
359
  ### Miscellaneous Chores
332
360
 
333
361
  * **move-to-json:** Synchronize repo versions
334
362
 
335
- ## [0.0.1-next.27](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.1-next.26...move-to-json-v0.0.1-next.27) (2025-06-18)
363
+ ## [0.0.1-next.27](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.1-next.26...move-to-json-v0.0.1-next.27) (2025-06-18)
336
364
 
337
365
 
338
366
  ### Miscellaneous Chores
339
367
 
340
368
  * **move-to-json:** Synchronize repo versions
341
369
 
342
- ## [0.0.1-next.26](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.1-next.25...move-to-json-v0.0.1-next.26) (2025-06-12)
370
+ ## [0.0.1-next.26](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.1-next.25...move-to-json-v0.0.1-next.26) (2025-06-12)
343
371
 
344
372
 
345
373
  ### Features
346
374
 
347
- * update dependencies ([f7b71c2](https://github.com/twinfoundation/dlt/commit/f7b71c24274b71e2d37c26c4a7e5e6d9df1dc9b7))
375
+ * update dependencies ([f7b71c2](https://github.com/iotaledger/twin-dlt/commit/f7b71c24274b71e2d37c26c4a7e5e6d9df1dc9b7))
348
376
 
349
- ## [0.0.1-next.25](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.1-next.24...move-to-json-v0.0.1-next.25) (2025-05-21)
377
+ ## [0.0.1-next.25](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.1-next.24...move-to-json-v0.0.1-next.25) (2025-05-21)
350
378
 
351
379
 
352
380
  ### Miscellaneous Chores
353
381
 
354
382
  * **move-to-json:** Synchronize repo versions
355
383
 
356
- ## [0.0.1-next.24](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.1-next.23...move-to-json-v0.0.1-next.24) (2025-05-21)
384
+ ## [0.0.1-next.24](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.1-next.23...move-to-json-v0.0.1-next.24) (2025-05-21)
357
385
 
358
386
 
359
387
  ### Miscellaneous Chores
360
388
 
361
389
  * **move-to-json:** Synchronize repo versions
362
390
 
363
- ## [0.0.1-next.23](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.1-next.22...move-to-json-v0.0.1-next.23) (2025-05-06)
391
+ ## [0.0.1-next.23](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.1-next.22...move-to-json-v0.0.1-next.23) (2025-05-06)
364
392
 
365
393
 
366
394
  ### Miscellaneous Chores
367
395
 
368
396
  * **move-to-json:** Synchronize repo versions
369
397
 
370
- ## [0.0.1-next.22](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.1-next.21...move-to-json-v0.0.1-next.22) (2025-04-17)
398
+ ## [0.0.1-next.22](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.1-next.21...move-to-json-v0.0.1-next.22) (2025-04-17)
371
399
 
372
400
 
373
401
  ### Features
374
402
 
375
- * use shared store mechanism ([#10](https://github.com/twinfoundation/dlt/issues/10)) ([ce36214](https://github.com/twinfoundation/dlt/commit/ce36214577f02cbb9642f831cb2c21335c31cc9a))
403
+ * use shared store mechanism ([#10](https://github.com/iotaledger/twin-dlt/issues/10)) ([ce36214](https://github.com/iotaledger/twin-dlt/commit/ce36214577f02cbb9642f831cb2c21335c31cc9a))
376
404
 
377
- ## [0.0.1-next.21](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.1-next.20...move-to-json-v0.0.1-next.21) (2025-04-17)
405
+ ## [0.0.1-next.21](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.1-next.20...move-to-json-v0.0.1-next.21) (2025-04-17)
378
406
 
379
407
 
380
408
  ### Features
381
409
 
382
- * add header for CLI check ([#8](https://github.com/twinfoundation/dlt/issues/8)) ([0b9f271](https://github.com/twinfoundation/dlt/commit/0b9f2711fb3a9eb859e481725bfa1e2139e14053))
410
+ * add header for CLI check ([#8](https://github.com/iotaledger/twin-dlt/issues/8)) ([0b9f271](https://github.com/iotaledger/twin-dlt/commit/0b9f2711fb3a9eb859e481725bfa1e2139e14053))
383
411
 
384
- ## [0.0.1-next.20](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.1-next.19...move-to-json-v0.0.1-next.20) (2025-03-28)
412
+ ## [0.0.1-next.20](https://github.com/iotaledger/twin-dlt/compare/move-to-json-v0.0.1-next.19...move-to-json-v0.0.1-next.20) (2025-03-28)
385
413
 
386
414
 
387
415
  ### Miscellaneous Chores
@@ -32,7 +32,7 @@ The RPC configuration
32
32
 
33
33
  #### timeout?
34
34
 
35
- > `optional` **timeout**: `number`
35
+ > `optional` **timeout?**: `number`
36
36
 
37
37
  ***
38
38
 
@@ -48,7 +48,7 @@ The deployment configuration
48
48
 
49
49
  #### confirmationTimeout?
50
50
 
51
- > `optional` **confirmationTimeout**: `number`
51
+ > `optional` **confirmationTimeout?**: `number`
52
52
 
53
53
  #### wallet
54
54
 
@@ -60,7 +60,7 @@ The deployment configuration
60
60
 
61
61
  #### gasStation?
62
62
 
63
- > `optional` **gasStation**: `object`
63
+ > `optional` **gasStation?**: `object`
64
64
 
65
65
  ##### gasStation.url
66
66
 
@@ -74,7 +74,7 @@ The deployment configuration
74
74
 
75
75
  ### contracts? {#contracts}
76
76
 
77
- > `optional` **contracts**: `object`
77
+ > `optional` **contracts?**: `object`
78
78
 
79
79
  The contracts configuration
80
80
 
package/docs/usage.md CHANGED
@@ -165,6 +165,6 @@ move-to-json deploy --network mainnet --contracts <PATH-TO-CONTRACTS> --load-env
165
165
  ## Example
166
166
 
167
167
  ```shell
168
- npx "@twin.org/move-to-json" build "tests/fixtures/sources/**/*.move" --load-env configs/testnet.env --output tests/fixtures/smart-contract-deployments/smart-contract-deployments.json
169
- npx "@twin.org/move-to-json" deploy --load-env configs/testnet.env --contracts tests/fixtures/smart-contract-deployments/smart-contract-deployments.json --dry-run
168
+ npx "@twin.org/move-to-json" build "tests/fixtures/sources/**/*.move" --load-env configs/testnet.env --output tests/fixtures/smartContractDeployments/smart-contract-deployments.json
169
+ npx "@twin.org/move-to-json" deploy --load-env configs/testnet.env --contracts tests/fixtures/smartContractDeployments/smart-contract-deployments.json --dry-run
170
170
  ```
package/locales/en.json CHANGED
@@ -202,7 +202,9 @@
202
202
  "upgradeGuidance": "Upgrade Guidance",
203
203
  "previousDeployment": "Previous Deployment",
204
204
  "currentDeployment": "Current Deployment",
205
- "buildValidation": "Build Validation"
205
+ "buildValidation": "Build Validation",
206
+ "onChainPackageId": "On-chain UpgradeCap Package",
207
+ "onChainVersion": "On-chain UpgradeCap Version"
206
208
  },
207
209
  "progress": {
208
210
  "checkingEnvironment": "Checking IOTA CLI environment...",
@@ -211,7 +213,8 @@
211
213
  "requestingFaucetFunds": "Requesting funds from {network} faucet...",
212
214
  "requestingAdditionalFaucetFunds": "Requesting additional funds from faucet...",
213
215
  "renamingConflictingKey": "Renaming conflicting key alias \"{aliasName}\" to preserve existing key",
214
- "importingDeployerKey": "Importing deployer key as \"{aliasName}\""
216
+ "importingDeployerKey": "Importing deployer key as \"{aliasName}\"",
217
+ "queryingUpgradeCap": "Querying on-chain UpgradeCap to validate published-at..."
215
218
  },
216
219
  "messages": {
217
220
  "contractAlreadyDeployed": "Contract already deployed, no changes detected",
@@ -219,7 +222,8 @@
219
222
  "noneInitialDeployment": "None - Initial deployment",
220
223
  "noneNeedsDeploymentUpgrade": "None - Needs deployment/upgrade",
221
224
  "originalConfigurationRestored": "Original configuration restored",
222
- "contractBuiltAndReadyForUpgrade": "Contract has been built and is ready for upgrade"
225
+ "contractBuiltAndReadyForUpgrade": "Contract has been built and is ready for upgrade",
226
+ "staleJsonDetected": "Stale deployment JSON detected. JSON has \"{jsonPackageId}\" but on-chain UpgradeCap has \"{onChainPackageId}\". Using on-chain value."
223
227
  },
224
228
  "section": {
225
229
  "deployContracts": "Deploy Contracts"
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@twin.org/move-to-json",
3
- "version": "0.0.3-next.7",
3
+ "version": "0.0.3-next.9",
4
4
  "description": "CLI for compiling Move contracts and preparing deployment JSON for IOTA networks.",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/twinfoundation/dlt.git",
7
+ "url": "git+https://github.com/iotaledger/dlt.git",
8
8
  "directory": "packages/move-to-json"
9
9
  },
10
10
  "author": "cornel.filip@iota.org",
@@ -14,11 +14,11 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@iota/iota-sdk": "1.11.0",
17
+ "@iota/iota-sdk": "1.13.0",
18
18
  "@twin.org/cli-core": "next",
19
19
  "@twin.org/core": "next",
20
20
  "@twin.org/crypto": "next",
21
- "@twin.org/dlt-iota": "0.0.3-next.7",
21
+ "@twin.org/dlt-iota": "0.0.3-next.9",
22
22
  "@twin.org/nameof": "next",
23
23
  "@twin.org/wallet-connector-iota": "next",
24
24
  "commander": "14.0.3",
@@ -53,7 +53,7 @@
53
53
  "dlt"
54
54
  ],
55
55
  "bugs": {
56
- "url": "git+https://github.com/twinfoundation/dlt/issues"
56
+ "url": "git+https://github.com/iotaledger/dlt/issues"
57
57
  },
58
58
  "homepage": "https://twindev.org"
59
59
  }