Module: config
This module exposes the Config class that exposes an interface for accessing project configurations.
Exports
Internal
- Compiler
- ProjType
- Config
- ContractsConfig
- AvalancheConfig
- CommonConfig
- EthereumConfig
- NetworkProfile
- PolygonConfig
- ProxyConfig
- SubnetInfo
- TargetConfig
- EndpointConfig
- NetworkProfileName
- PathBuf
Core
Internal
• Compiler: Object
The compiler used for compiling contract code. For now only solc
.
Defined in
submodules/cubist-node-sdk/src/config.ts:94
• ProjType: Object
Project type.
Defined in
submodules/cubist-node-sdk/src/config.ts:80
• Config: Object
Class that exposes Cubist project configurations (and resolves and validates path names, network configurations, etc.).
All cubist applications have a JSON config file (DEFAULT_FILENAME), which specifies the kind of project (ProjType]) the application code is written in, where build output should be written to, and where deployment scripts and information should be generated.
Example configuration file:
{
"type": "TypeScript",
"build_dir": "build",
"deploy_dir": "deploy",
"contracts": {
"root_dir": "contracts",
"targets": {
"ethereum" : {
"files": ["./contracts/StorageReceiver.sol"]
},
"polygon": {
"files": ["./contracts/StorageSender.sol"]
}
},
"import_dirs": [
"node_modules"
]
},
"allow_import_from_external": true,
"network_profiles": {
"default": {
"ethereum": { "url": "http://127.0.0.1:8545/" },
"polygon": { "url": "http://127.0.0.1:9545" }
}
}
}
You can load config files with nearest, which finds the JSON file in the current directory or any parent directory:
const cfg = Config.nearest();
Alternatively, you can load the default config in the directory with from_dir:
const cfg = Config.from_dir("/path/to/my-app");
Alternatively, you can just use from_file if you have the filename of the config file:
const cfg = Config.from_file("/path/to/cubist-config.json");
This class exposes a subset of the functionality available in our Rust SDK. In particular, this class is only intended to be used to read configurations from the file system. This means that every Config object should be treated as effectively read-only.
Most users don't need to use this class; the class you likely want to use is Cubist, which transparently loads configurations.
Defined in
submodules/cubist-node-sdk/src/config.ts:246
• ContractsConfig: Object
Contract configuration.
Defined in
submodules/cubist-node-sdk/src/config.ts:136
• AvalancheConfig: Object
A config for avalanche endpoints.
Defined in
submodules/cubist-node-sdk/src/config/network.ts:113
• CommonConfig: Object
Contains the config options that are common to all providers.
Defined in
submodules/cubist-node-sdk/src/config/network.ts:31
• EthereumConfig: Object
A config for ethereum endpoints.
Defined in
submodules/cubist-node-sdk/src/config/network.ts:144
• NetworkProfile: Object
The configuration for a suite of endpoints. Used to specify a single or multi-chain environment.
Defined in
submodules/cubist-node-sdk/src/config/network.ts:9
• PolygonConfig: Object
A config for polygon endpoints
Defined in
submodules/cubist-node-sdk/src/config/network.ts:138
• ProxyConfig: Object
Proxy configuration.
Defined in
submodules/cubist-node-sdk/src/config/network.ts:46
• SubnetInfo: Object
Subnet info.
Defined in
submodules/cubist-node-sdk/src/config/network.ts:122
• TargetConfig: Object
Target configuration.
Defined in
submodules/cubist-node-sdk/src/config.ts:124
EndpointConfig
Ƭ EndpointConfig: EthereumConfig
| AvalancheConfig
| PolygonConfig
Configuration for an unspecified network.
Defined in
submodules/cubist-node-sdk/src/config/network.ts:25
NetworkProfileName
Ƭ NetworkProfileName: string
Type alias for "network profile name" to be used in hash maps.
Defined in
submodules/cubist-node-sdk/src/config.ts:74
PathBuf
Ƭ PathBuf: string
Paths are just strings in node.
Defined in
submodules/cubist-node-sdk/src/config/pre_compile_manifest.ts:9
Core
• Target: Object
Target chains (e.g., Avalanche, Polygon, Ethereum) for which we can deploy contracts.
Defined in
submodules/cubist-node-sdk/src/config.ts:109
ContractName
Ƭ ContractName: string
Contract names (strings).
Defined in
submodules/cubist-node-sdk/src/config/pre_compile_manifest.ts:16