pub struct ChainDriver {
Show 13 fields pub chain_type: ChainType, pub command_path: String, pub chain_id: ChainId, pub home_path: String, pub account_prefix: String, pub rpc_port: u16, pub grpc_port: u16, pub grpc_web_port: u16, pub p2p_port: u16, pub pprof_port: u16, pub tx_config: TxConfig, pub runtime: Arc<Runtime>, pub compat_mode: Option<CompatMode>,
}
Expand description

A driver for interacting with a chain full nodes through command line.

The name ChainDriver is inspired by WebDriver, which is the term used to describe programs that control spawning of the web browsers. In our case, the ChainDriver is used to spawn and manage chain full nodes.

Currently the ChainDriver is hardcoded to support only a single version of Gaia chain. In the future, we will want to turn this into one or more ChainDriver traits so that they can be used to spawn multiple chain implementations other than a single version of Gaia.

Fields§

§chain_type: ChainType§command_path: String

The filesystem path to the Gaia CLI. Defaults to gaiad.

§chain_id: ChainId

The ID of the chain.

§home_path: String

The home directory for the full node to store data files.

§account_prefix: String§rpc_port: u16

The port used for RPC.

§grpc_port: u16

The port used for GRPC.

§grpc_web_port: u16§p2p_port: u16

The port used for P2P. (Currently unused other than for setup)

§pprof_port: u16

The port used for pprof. (Currently unused other than for setup)

§tx_config: TxConfig§runtime: Arc<Runtime>§compat_mode: Option<CompatMode>

Implementations§

source§

impl ChainDriver

source

pub fn create( chain_type: ChainType, command_path: String, chain_id: ChainId, home_path: String, account_prefix: String, rpc_port: u16, grpc_port: u16, grpc_web_port: u16, p2p_port: u16, pprof_port: u16, runtime: Arc<Runtime>, native_token: String, compat_mode: Option<CompatMode> ) -> Result<Self, Error>

Create a new ChainDriver

source

pub fn rpc_address(&self) -> String

Returns the full URL for the RPC address.

source

pub fn websocket_address(&self) -> String

Returns the full URL for the WebSocket address.

source

pub fn grpc_address(&self) -> String

Returns the full URL for the GRPC address.

source

pub fn rpc_listen_address(&self) -> String

Returns the full URL for the RPC address to listen to when starting the full node.

This is somehow different from rpc_address as it requires the "tcp://" scheme.

source

pub fn grpc_listen_address(&self) -> String

Returns the full URL for the GRPC address to listen to when starting the full node.

This is somehow different from grpc_address as it requires no scheme to be specified.

source

pub fn query_balance( &self, wallet_id: &WalletAddress, denom: &Denom ) -> Result<Amount, Error>

Query for the balances for a given wallet address and denomination

source

pub fn assert_eventual_wallet_amount( &self, wallet: &WalletAddress, token: &Token ) -> Result<(), Error>

Assert that a wallet should eventually have the expected amount in the given denomination.

Trait Implementations§

source§

impl ChainBootstrapMethodsExt for ChainDriver

source§

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. Read more
source§

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. Read more
source§

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.
source§

fn initialize(&self) -> Result<(), Error>

Initialized the chain data stores. Read more
source§

fn update_genesis_file( &self, file: &str, cont: impl FnOnce(&mut Value) -> Result<(), Error> ) -> Result<(), Error>

Modify the Gaia genesis file.
source§

fn add_wallet(&self, wallet_id: &str) -> Result<Wallet, Error>

Add a wallet with the given ID to the full node’s keyring.
source§

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.
source§

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.
source§

fn collect_gen_txs(&self) -> Result<(), Error>

Call gaiad collect-gentxs to generate the genesis transactions.
source§

fn start(&self) -> Result<ChildProcess, Error>

Start a full node by running in the background gaiad start. Read more
source§

fn submit_consumer_chain_proposal( &self, consumer_chain_id: &str, _spawn_time: &str ) -> Result<(), Error>

Submit a consumer chain proposal.
source§

fn assert_consumer_chain_proposal_submitted( &self, chain_id: &str, command_path: &str, home_path: &str, rpc_listen_address: &str ) -> Result<(), Error>

Assert that the consumer chain proposal is eventually submitted.
source§

fn assert_consumer_chain_proposal_passed( &self, chain_id: &str, command_path: &str, home_path: &str, rpc_listen_address: &str ) -> Result<(), Error>

Assert that the consumer chain proposal eventually passes.
source§

fn query_consumer_genesis( &self, consumer_chain_driver: &ChainDriver, consumer_chain_id: &str ) -> Result<(), Error>

Query a consumer chain’s genesis.
source§

fn replace_genesis_state(&self) -> Result<(), Error>

Replace genesis state.
source§

fn copy_validator_key_pair( &self, provider_chain_driver: &ChainDriver ) -> Result<(), Error>

Copy validator key pair.
source§

impl Clone for ChainDriver

source§

fn clone(&self) -> ChainDriver

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ChainDriver

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl ExportEnv for ChainDriver

source§

fn export_env(&self, writer: &mut impl EnvWriter)

Export the environment variables using the given EnvWriter.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsAny for Twhere T: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

Borrow this concrete type as a &dyn Any
§

fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)

Borrow this concrete type as a &mut dyn Any
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for Twhere T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<D> OwoColorize for D

§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where C: Color,

Set the foreground color generically Read more
§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where C: Color,

Set the background color generically. Read more
§

fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>

Change the foreground color to black
§

fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>

Change the background color to black
§

fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>

Change the foreground color to red
§

fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>

Change the background color to red
§

fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>

Change the foreground color to green
§

fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>

Change the background color to green
§

fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>

Change the foreground color to yellow
§

fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>

Change the background color to yellow
§

fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>

Change the foreground color to blue
§

fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>

Change the background color to blue
§

fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>

Change the foreground color to magenta
§

fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>

Change the background color to magenta
§

fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>

Change the foreground color to purple
§

fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>

Change the background color to purple
§

fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>

Change the foreground color to cyan
§

fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>

Change the background color to cyan
§

fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>

Change the foreground color to white
§

fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>

Change the background color to white
§

fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>

Change the foreground color to the terminal default
§

fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>

Change the background color to the terminal default
§

fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>

Change the foreground color to bright black
§

fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>

Change the background color to bright black
§

fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>

Change the foreground color to bright red
§

fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>

Change the background color to bright red
§

fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>

Change the foreground color to bright green
§

fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>

Change the background color to bright green
§

fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>

Change the foreground color to bright yellow
§

fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>

Change the background color to bright yellow
§

fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>

Change the foreground color to bright blue
§

fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>

Change the background color to bright blue
§

fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>

Change the foreground color to bright magenta
§

fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>

Change the background color to bright magenta
§

fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>

Change the foreground color to bright purple
§

fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>

Change the background color to bright purple
§

fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>

Change the foreground color to bright cyan
§

fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>

Change the background color to bright cyan
§

fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>

Change the foreground color to bright white
§

fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>

Change the background color to bright white
§

fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>

Make the text bold
§

fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>

Make the text dim
§

fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>

Make the text italicized
§

fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>

Make the text italicized
Make the text blink
Make the text blink (but fast!)
§

fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>

Swap the foreground and background colors
§

fn hidden<'a>(&'a self) -> HiddenDisplay<'a, Self>

Hide the text
§

fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>

Cross out the text
§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more