This package defines the core interface for the tooling stack, and only includes neutral interfaces unrelated to the LayerZero protocol.
-
Transaction
Interface: Used to express transactions in different stages. -
Provider
Interface: Define the connectors to a chain node. -
Signer
Interface: Sign message and transaction. -
Deployment
interface: Represent the structure for deployment information
To install the LayerZero Config Types package, you can use npm or yarn:
npm install @layerzerolabs/lz-config-types
or
yarn add @layerzerolabs/lz-config-types
Provides methods to retrieve providers based on the specified chain and environment.
- chain: The chain for which to retrieve the provider.
- env: The environment for which to retrieve the provider.
- Returns: A promise that resolves to the provider.
import { ProviderManager } from "@layerzerolabs/lz-config-types";
import { Chain, Environment } from "@layerzerolabs/lz-definitions";
const providerManager: ProviderManager = {
async getProvider(chain: Chain, env: Environment): Promise<Provider> {
// Implementation to retrieve the provider
},
};
const chain: Chain = "ethereum";
const env: Environment = "mainnet";
providerManager.getProvider(chain, env).then((provider) => {
console.log(`Provider: ${provider}`);
});
Provides methods to retrieve signers based on the specified chain, stage, environment, and key name.
- chain: The chain for which to retrieve the signer.
- stage: The stage for which to retrieve the signer.
- env: The environment for which to retrieve the signer.
- keyName: The key name for which to retrieve the signer.
- Returns: A promise that resolves to the signer.
import { SignerManager } from "@layerzerolabs/lz-config-types";
import { Chain, Stage, Environment } from "@layerzerolabs/lz-definitions";
const signerManager: SignerManager = {
async getSigner(chain: Chain, stage: Stage, env: Environment, keyName: string): Promise<Signer> {
// Implementation to retrieve the signer
},
};
const chain: Chain = "ethereum";
const stage: Stage = "development";
const env: Environment = "sandbox";
const keyName = "key1";
signerManager.getSigner(chain, stage, env, keyName).then((signer) => {
console.log(`Signer: ${signer}`);
});
Provides methods to retrieve configuration values based on a specified path.
- path: The path to the configuration value.
- Returns: A promise that resolves to the configuration value.
import { ConfigManager } from "@layerzerolabs/lz-config-types";
const configManager: ConfigManager = {
async get(...path: (string | number | (string | number)[])[]): Promise<unknown> {
// Implementation to retrieve the configuration value
},
};
configManager.get("database", "host").then((value) => {
console.log(`Configuration Value: ${value}`);
});