Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@layerzerolabs/lz-initia-cli

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@layerzerolabs/lz-initia-cli

  • 3.0.19-movment.1
  • npm
  • Socket score

Version published
Weekly downloads
493
decreased by-37.04%
Maintainers
1
Weekly downloads
 
Created
Source

Wrap Initia cli to support custom configuration just like Hardhat

Install
yarn add @layerzerolabs/lz-initia-cli
Config

Create a initia.config.ts file in the root of your project. A full example is below:

import { LzInitiaConfig } from "@layerzerolabs/lz-initia-cli";
import {
  Chain,
  chainAndStageToNetwork,
  Environment,
  Stage,
} from "@layerzerolabs/lz-definitions";
import path from "path";
import { Account } from "@initia-labs/ts-sdk";

const INITIA_SANDBOX_LOCAL = chainAndStageToNetwork(
  Chain.INITIA,
  Stage.SANDBOX,
  Environment.LOCAL,
);
const INITIA_TESTNET = chainAndStageToNetwork(
  Chain.INITIA,
  Stage.TESTNET,
  Environment.TESTNET,
);
const INITIA_MAINNET = chainAndStageToNetwork(
  Chain.INITIA,
  Stage.MAINNET,
  Environment.MAINNET,
);
const contractWorkspace = "./contracts";

const config: LzInitiaConfig = {
  artifactsPath: "./artifacts",
  deploymentPath: "./deployments",
  compatibleVersions: ["v1"],
  network: {
    [Environment.LOCAL]: "http://127.0.0.1:8080",
  },
  defaultDeployer: {
    [INITIA_SANDBOX_LOCAL]: Account.fromPrivateKey({
      privateKey: process.env.LOCAL_DEPLOYER,
    }),
    [INITIA_TESTNET]: Account.fromPrivateKey({
      privateKey: process.env.TESTNET_DEPLOYER,
    }),
    [INITIA_MAINNET]: Account.fromPrivateKey({
      privateKey: process.env.MAINNET_DEPLOYER,
    }),
  },
  // alternative way to set defaultDeployer
  // defaultDeployer: Account.fromPrivateKey({ privateKey: process.env.DEFAULT_DEPLOYER })
  gasPrice: {
    [INITIA_SANDBOX_LOCAL]: 1000,
    [INITIA_TESTNET]: 1000,
    [INITIA_MAINNET]: 1000,
  },
  baseModules: ["PATH_TO_ANOTHER_LZ_INITIA_CONFIG_FILE"],
  modules: {
    layerzero_common: {
      modulePath: path.join(contractWorkspace, "layerzero-common"),
      deployer: {
        "initia-sandbox-local": Account.fromPrivateKey({
          privateKey: process.env.LAYERZERO_DEPLOYER,
        }),
      },
    },
    executor_v2: {
      alias: "ExecutorV2",
      modulePath: path.join(contractWorkspace, "executor/executor-v2"),
      deployer: Account.fromPrivateKey({
        privateKey: process.env.EXECUTOR_DEPLOYER,
      }),
    },
    executor_auth: {
      modulePath: path.join(contractWorkspace, "executor/executor-auth"),
      variant: process.env.SUFFIX_EXECUTOR,
    },
  },
};

export default config;

Details of the configuration:

  • artifactsPath: Path to store the artifacts(*.mv and package-metadata.bcs) generated by the compiler.
  • deploymentPath: Path to store the deployment files(*.json) recording the deployment information.
  • compatibleVersions: The compatible endpoint version. If not set, the default value is ['v1', 'v2']
  • network: The RPC for each environment.
  • compileOptions: The OPTIONS for the initiad move build. If not set, the default value is --skip-fetch-latest-git-deps=true.
  • defaultDeployer: The default deployer. Deployer account address is also the address of the contract.
  • gasPrice: The gas price for each environment. If not set, the default value is 2 times the current gas price.
  • baseModules: The path to another lz-initia config file. The command tool will search the base modules recursively if module name not found in modules. If not set, the default value is [].
  • modules: The module configuration. The key is the module name used in lz-initia-cli command. The key should be the same with package name in Move.toml.
    • alias: Artifact/Deployment name for the module. If not set, the module name will be used.
    • modulePath: The path to the module's contract directory which contains Move.toml.
    • deployer: The deployer for the module. If not set, the default deployer will be used.
    • variant: The variant for the module. If not set, it means the module has no variant. It will be overridden by the variant in the command line.
Usage
cd path/to/your/project
# compile the contracts
yarn lz-initia-cli build -m layerzero_common -n initia-sandbox-local
# compile the contracts with a variant
# for use cases like deploying same contract to different addresses
yarn lz-initia-cli build -m dvn -n initia-sandbox-local --variant nethermind
# replace the module path
yarn lz-initia-cli build -m layerzero_common -n initia-sandbox-local -p path/to/layerzero-common
# deploy the contracts
yarn lz-initia-cli deploy -m layerzero_common -n initia-sandbox-local
# deploy the contracts with a variant
yarn lz-initia-cli deploy -m layerzero_common -n initia-sandbox-local --variant nethermind

FAQs

Package last updated on 27 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc