Skip to main content

Configuration

wasmkit.config.js

If you take a look at the wasmkit.config.js file, you will find:

Accounts

Here the account details are stored, where each array corresponds to list of accounts associated with a network.

Each account has 3 values:

  1. name: To be referenced in the scripts and tests
  2. address: Public address of the account
  3. mnemonic: Signing part of the account

Note: Never push mainnet mnemonic to a repository


const neutron_testnet_accounts = [
{
name: 'account_0',
address: 'neutron1jtdje5vq42sknl22r4wu9sahryu5wcrdqsccjh',
mnemonic: 'category ... wreck'
},
];
const neutron_localnet_accounts = [
{
name: 'account_0',
address: 'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
mnemonic: 'banner ... mass'
},
{
name: 'account_1',
address: 'neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf',
mnemonic: 'veteran ... only'
}
];
const neutron_mainnet_accounts = [
];
const networks = {
neutron_localnet: {
endpoint: 'http://localhost:26657/',
chainId: 'testing-1',
accounts: neutron_localnet_accounts,
},
neutron_testnet: {
endpoint: 'https://rpc-palvus.pion-1.ntrn.tech/',
chainId: 'pion-1',
accounts: neutron_testnet_accounts,
fees: {
upload: {
amount: [{ amount: "750000", denom: "untrn" }],
gas: "3000000",
},
init: {
amount: [{ amount: "250000", denom: "untrn" }],
gas: "1000000",
},
exec: {
amount: [{ amount: "250000", denom: "untrn" }],
gas: "1000000",
}
},
},
neutron_mainnet: {
endpoint: 'https://rpc-kralum.neutron-1.neutron.org',
chainId: 'neutron-1',
accounts: neutron_mainnet_accounts,
},
};
module.exports = {
networks: {
default: networks.neutron_testnet,
testnet: networks.neutron_testnet,
localnet: networks.neutron_localnet,
mainnet: networks.neutron_mainnet,
},
localnetworks: {
neutron: {
docker_image: "uditgulati0/neutron-node",
rpc_port: 26657,
rest_port: 1317,
flags: ["RUN_BACKGROUND=0"],
},
},
mocha: {
timeout: 60000
},
rust: {
version: "1.68.0",
},
commands: {
compile: "RUSTFLAGS='-C link-arg=-s' cargo build --release --target wasm32-unknown-unknown",
schema: "cargo run --example schema",
},
};

Networks

Here the network details are stored, specifying how to interact with a network.

Each network has 4 values:

  1. endpoint: The RPC endpoint to connect to
  2. chainId: Network's unique chain ID
  3. accounts: List of accounts associated with the network
  4. fees(Optional): Custom fees per action [Deploy, Init, Execute]

const neutron_testnet_accounts = [
{
name: 'account_0',
address: 'neutron1jtdje5vq42sknl22r4wu9sahryu5wcrdqsccjh',
mnemonic: 'category ... wreck'
},
];
const neutron_localnet_accounts = [
{
name: 'account_0',
address: 'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
mnemonic: 'banner ... mass'
},
{
name: 'account_1',
address: 'neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf',
mnemonic: 'veteran ... only'
}
];
const neutron_mainnet_accounts = [
];
const networks = {
neutron_localnet: {
endpoint: 'http://localhost:26657/',
chainId: 'testing-1',
accounts: neutron_localnet_accounts,
},
neutron_testnet: {
endpoint: 'https://rpc-palvus.pion-1.ntrn.tech/',
chainId: 'pion-1',
accounts: neutron_testnet_accounts,
fees: {
upload: {
amount: [{ amount: "750000", denom: "untrn" }],
gas: "3000000",
},
init: {
amount: [{ amount: "250000", denom: "untrn" }],
gas: "1000000",
},
exec: {
amount: [{ amount: "250000", denom: "untrn" }],
gas: "1000000",
}
},
},
neutron_mainnet: {
endpoint: 'https://rpc-kralum.neutron-1.neutron.org',
chainId: 'neutron-1',
accounts: neutron_mainnet_accounts,
},
};
module.exports = {
networks: {
default: networks.neutron_testnet,
testnet: networks.neutron_testnet,
localnet: networks.neutron_localnet,
mainnet: networks.neutron_mainnet,
},
localnetworks: {
neutron: {
docker_image: "uditgulati0/neutron-node",
rpc_port: 26657,
rest_port: 1317,
flags: ["RUN_BACKGROUND=0"],
},
},
mocha: {
timeout: 60000
},
rust: {
version: "1.68.0",
},
commands: {
compile: "RUSTFLAGS='-C link-arg=-s' cargo build --release --target wasm32-unknown-unknown",
schema: "cargo run --example schema",
},
};

Stitching networks, accounts

Here we tell WasmKit the unique name to assign to each network while doing any action such as running a script, a test or simply just doing a node-info query.

The default network will be used whenever a network name is not passed in wasmkit command. To use any other network, --network flag followed by <network-name> can be used.


const neutron_testnet_accounts = [
{
name: 'account_0',
address: 'neutron1jtdje5vq42sknl22r4wu9sahryu5wcrdqsccjh',
mnemonic: 'category ... wreck'
},
];
const neutron_localnet_accounts = [
{
name: 'account_0',
address: 'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
mnemonic: 'banner ... mass'
},
{
name: 'account_1',
address: 'neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf',
mnemonic: 'veteran ... only'
}
];
const neutron_mainnet_accounts = [
];
const networks = {
neutron_localnet: {
endpoint: 'http://localhost:26657/',
chainId: 'testing-1',
accounts: neutron_localnet_accounts,
},
neutron_testnet: {
endpoint: 'https://rpc-palvus.pion-1.ntrn.tech/',
chainId: 'pion-1',
accounts: neutron_testnet_accounts,
fees: {
upload: {
amount: [{ amount: "750000", denom: "untrn" }],
gas: "3000000",
},
init: {
amount: [{ amount: "250000", denom: "untrn" }],
gas: "1000000",
},
exec: {
amount: [{ amount: "250000", denom: "untrn" }],
gas: "1000000",
}
},
},
neutron_mainnet: {
endpoint: 'https://rpc-kralum.neutron-1.neutron.org',
chainId: 'neutron-1',
accounts: neutron_mainnet_accounts,
},
};
module.exports = {
networks: {
default: networks.neutron_testnet,
testnet: networks.neutron_testnet,
localnet: networks.neutron_localnet,
mainnet: networks.neutron_mainnet,
},
localnetworks: {
neutron: {
docker_image: "uditgulati0/neutron-node",
rpc_port: 26657,
rest_port: 1317,
flags: ["RUN_BACKGROUND=0"],
},
},
mocha: {
timeout: 60000
},
rust: {
version: "1.68.0",
},
commands: {
compile: "RUSTFLAGS='-C link-arg=-s' cargo build --release --target wasm32-unknown-unknown",
schema: "cargo run --example schema",
},
};

Adding a localnetwork

This part of the config specifies how to run a docker container of network locally. Please refer to the WasmKit repository for config for other kinds of local networks.

In this example, we've configured a neutron node with RPC endpoint on localhost:26657 and REST endpoint on localhost:1317.


const neutron_testnet_accounts = [
{
name: 'account_0',
address: 'neutron1jtdje5vq42sknl22r4wu9sahryu5wcrdqsccjh',
mnemonic: 'category ... wreck'
},
];
const neutron_localnet_accounts = [
{
name: 'account_0',
address: 'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
mnemonic: 'banner ... mass'
},
{
name: 'account_1',
address: 'neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf',
mnemonic: 'veteran ... only'
}
];
const neutron_mainnet_accounts = [
];
const networks = {
neutron_localnet: {
endpoint: 'http://localhost:26657/',
chainId: 'testing-1',
accounts: neutron_localnet_accounts,
},
neutron_testnet: {
endpoint: 'https://rpc-palvus.pion-1.ntrn.tech/',
chainId: 'pion-1',
accounts: neutron_testnet_accounts,
fees: {
upload: {
amount: [{ amount: "750000", denom: "untrn" }],
gas: "3000000",
},
init: {
amount: [{ amount: "250000", denom: "untrn" }],
gas: "1000000",
},
exec: {
amount: [{ amount: "250000", denom: "untrn" }],
gas: "1000000",
}
},
},
neutron_mainnet: {
endpoint: 'https://rpc-kralum.neutron-1.neutron.org',
chainId: 'neutron-1',
accounts: neutron_mainnet_accounts,
},
};
module.exports = {
networks: {
default: networks.neutron_testnet,
testnet: networks.neutron_testnet,
localnet: networks.neutron_localnet,
mainnet: networks.neutron_mainnet,
},
localnetworks: {
neutron: {
docker_image: "uditgulati0/neutron-node",
rpc_port: 26657,
rest_port: 1317,
flags: ["RUN_BACKGROUND=0"],
},
},
mocha: {
timeout: 60000
},
rust: {
version: "1.68.0",
},
commands: {
compile: "RUSTFLAGS='-C link-arg=-s' cargo build --release --target wasm32-unknown-unknown",
schema: "cargo run --example schema",
},
};

Miscellaneous

Here we specify the following:

  1. Mocha: Configuration related to tests
  • timeout: Timout for each test file
  1. Rust: Rust compiler values
  • version: Compiler version to use
  1. Commands: To overwrite contract compilation steps
  • compile: Command to use to generate .wasm binary files
  • schema: Command to use to generate .json schema files

const neutron_testnet_accounts = [
{
name: 'account_0',
address: 'neutron1jtdje5vq42sknl22r4wu9sahryu5wcrdqsccjh',
mnemonic: 'category ... wreck'
},
];
const neutron_localnet_accounts = [
{
name: 'account_0',
address: 'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
mnemonic: 'banner ... mass'
},
{
name: 'account_1',
address: 'neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf',
mnemonic: 'veteran ... only'
}
];
const neutron_mainnet_accounts = [
];
const networks = {
neutron_localnet: {
endpoint: 'http://localhost:26657/',
chainId: 'testing-1',
accounts: neutron_localnet_accounts,
},
neutron_testnet: {
endpoint: 'https://rpc-palvus.pion-1.ntrn.tech/',
chainId: 'pion-1',
accounts: neutron_testnet_accounts,
fees: {
upload: {
amount: [{ amount: "750000", denom: "untrn" }],
gas: "3000000",
},
init: {
amount: [{ amount: "250000", denom: "untrn" }],
gas: "1000000",
},
exec: {
amount: [{ amount: "250000", denom: "untrn" }],
gas: "1000000",
}
},
},
neutron_mainnet: {
endpoint: 'https://rpc-kralum.neutron-1.neutron.org',
chainId: 'neutron-1',
accounts: neutron_mainnet_accounts,
},
};
module.exports = {
networks: {
default: networks.neutron_testnet,
testnet: networks.neutron_testnet,
localnet: networks.neutron_localnet,
mainnet: networks.neutron_mainnet,
},
localnetworks: {
neutron: {
docker_image: "uditgulati0/neutron-node",
rpc_port: 26657,
rest_port: 1317,
flags: ["RUN_BACKGROUND=0"],
},
},
mocha: {
timeout: 60000
},
rust: {
version: "1.68.0",
},
commands: {
compile: "RUSTFLAGS='-C link-arg=-s' cargo build --release --target wasm32-unknown-unknown",
schema: "cargo run --example schema",
},
};

Accounts

Here the account details are stored, where each array corresponds to list of accounts associated with a network.

Each account has 3 values:

  1. name: To be referenced in the scripts and tests
  2. address: Public address of the account
  3. mnemonic: Signing part of the account

Note: Never push mainnet mnemonic to a repository

Networks

Here the network details are stored, specifying how to interact with a network.

Each network has 4 values:

  1. endpoint: The RPC endpoint to connect to
  2. chainId: Network's unique chain ID
  3. accounts: List of accounts associated with the network
  4. fees(Optional): Custom fees per action [Deploy, Init, Execute]

Stitching networks, accounts

Here we tell WasmKit the unique name to assign to each network while doing any action such as running a script, a test or simply just doing a node-info query.

The default network will be used whenever a network name is not passed in wasmkit command. To use any other network, --network flag followed by <network-name> can be used.

Adding a localnetwork

This part of the config specifies how to run a docker container of network locally. Please refer to the WasmKit repository for config for other kinds of local networks.

In this example, we've configured a neutron node with RPC endpoint on localhost:26657 and REST endpoint on localhost:1317.

Miscellaneous

Here we specify the following:

  1. Mocha: Configuration related to tests
  • timeout: Timout for each test file
  1. Rust: Rust compiler values
  • version: Compiler version to use
  1. Commands: To overwrite contract compilation steps
  • compile: Command to use to generate .wasm binary files
  • schema: Command to use to generate .json schema files

const neutron_testnet_accounts = [
{
name: 'account_0',
address: 'neutron1jtdje5vq42sknl22r4wu9sahryu5wcrdqsccjh',
mnemonic: 'category ... wreck'
},
];
const neutron_localnet_accounts = [
{
name: 'account_0',
address: 'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
mnemonic: 'banner ... mass'
},
{
name: 'account_1',
address: 'neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf',
mnemonic: 'veteran ... only'
}
];
const neutron_mainnet_accounts = [
];
const networks = {
neutron_localnet: {
endpoint: 'http://localhost:26657/',
chainId: 'testing-1',
accounts: neutron_localnet_accounts,
},
neutron_testnet: {
endpoint: 'https://rpc-palvus.pion-1.ntrn.tech/',
chainId: 'pion-1',
accounts: neutron_testnet_accounts,
fees: {
upload: {
amount: [{ amount: "750000", denom: "untrn" }],
gas: "3000000",
},
init: {
amount: [{ amount: "250000", denom: "untrn" }],
gas: "1000000",
},
exec: {
amount: [{ amount: "250000", denom: "untrn" }],
gas: "1000000",
}
},
},
neutron_mainnet: {
endpoint: 'https://rpc-kralum.neutron-1.neutron.org',
chainId: 'neutron-1',
accounts: neutron_mainnet_accounts,
},
};
module.exports = {
networks: {
default: networks.neutron_testnet,
testnet: networks.neutron_testnet,
localnet: networks.neutron_localnet,
mainnet: networks.neutron_mainnet,
},
localnetworks: {
neutron: {
docker_image: "uditgulati0/neutron-node",
rpc_port: 26657,
rest_port: 1317,
flags: ["RUN_BACKGROUND=0"],
},
},
mocha: {
timeout: 60000
},
rust: {
version: "1.68.0",
},
commands: {
compile: "RUSTFLAGS='-C link-arg=-s' cargo build --release --target wasm32-unknown-unknown",
schema: "cargo run --example schema",
},
};