pub trait ChainBootstrapMethodsExt {
// Required methods
fn read_file(&self, file_path: &str) -> Result<String, Error>;
fn write_file(&self, file_path: &str, content: &str) -> Result<(), Error>;
fn update_chain_config(
&self,
file: &str,
cont: impl FnOnce(&mut Value) -> Result<(), Error>
) -> Result<(), Error>;
fn initialize(&self) -> Result<(), Error>;
fn update_genesis_file(
&self,
file: &str,
cont: impl FnOnce(&mut Value) -> Result<(), Error>
) -> Result<(), Error>;
fn add_wallet(&self, wallet_id: &str) -> Result<Wallet, Error>;
fn add_genesis_account(
&self,
wallet: &WalletAddress,
amounts: &[&Token]
) -> Result<(), Error>;
fn add_genesis_validator(
&self,
wallet_id: &WalletId,
token: &Token
) -> Result<(), Error>;
fn collect_gen_txs(&self) -> Result<(), Error>;
fn start(&self) -> Result<ChildProcess, Error>;
}Required Methods§
sourcefn read_file(&self, file_path: &str) -> Result<String, Error>
fn read_file(&self, file_path: &str) -> Result<String, Error>
Read the content at a file path relative to the chain home directory, and return the result as a string.
This is not efficient but is sufficient for testing purposes.
sourcefn write_file(&self, file_path: &str, content: &str) -> Result<(), Error>
fn write_file(&self, file_path: &str, content: &str) -> Result<(), Error>
Write the string content to a file path relative to the chain home directory.
This is not efficient but is sufficient for testing purposes.
sourcefn update_chain_config(
&self,
file: &str,
cont: impl FnOnce(&mut Value) -> Result<(), Error>
) -> Result<(), Error>
fn update_chain_config( &self, file: &str, cont: impl FnOnce(&mut Value) -> Result<(), Error> ) -> Result<(), Error>
Modify the Gaia chain config which is saved in toml format.
sourcefn initialize(&self) -> Result<(), Error>
fn initialize(&self) -> Result<(), Error>
Initialized the chain data stores.
This is used by
bootstrap_single_node.
sourcefn update_genesis_file(
&self,
file: &str,
cont: impl FnOnce(&mut Value) -> Result<(), Error>
) -> Result<(), Error>
fn update_genesis_file( &self, file: &str, cont: impl FnOnce(&mut Value) -> Result<(), Error> ) -> Result<(), Error>
Modify the Gaia genesis file.
sourcefn add_wallet(&self, wallet_id: &str) -> Result<Wallet, Error>
fn add_wallet(&self, wallet_id: &str) -> Result<Wallet, Error>
Add a wallet with the given ID to the full node’s keyring.
sourcefn add_genesis_account(
&self,
wallet: &WalletAddress,
amounts: &[&Token]
) -> Result<(), Error>
fn add_genesis_account( &self, wallet: &WalletAddress, amounts: &[&Token] ) -> Result<(), Error>
Add a wallet address to the genesis account list for an uninitialized full node.
sourcefn add_genesis_validator(
&self,
wallet_id: &WalletId,
token: &Token
) -> Result<(), Error>
fn add_genesis_validator( &self, wallet_id: &WalletId, token: &Token ) -> Result<(), Error>
Add a wallet ID with the given stake amount to be the genesis validator for an uninitialized chain.
sourcefn collect_gen_txs(&self) -> Result<(), Error>
fn collect_gen_txs(&self) -> Result<(), Error>
Call gaiad collect-gentxs to generate the genesis transactions.
sourcefn start(&self) -> Result<ChildProcess, Error>
fn start(&self) -> Result<ChildProcess, Error>
Start a full node by running in the background gaiad start.
Returns a ChildProcess that stops the full node process when the
value is dropped.