-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into docs/cookbook
- Loading branch information
Showing
15 changed files
with
935 additions
and
393 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ increment | |
liquidity_pool | ||
logging | ||
mint-lock | ||
other_custom_types | ||
simple_account | ||
single_offer | ||
timelock | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
use std::fmt::Debug; | ||
|
||
pub mod env_meta; | ||
pub mod interface; | ||
pub mod meta; | ||
mod shared; | ||
|
||
#[derive(Debug, clap::Subcommand)] | ||
pub enum Cmd { | ||
/// Output the interface of a contract. | ||
/// | ||
/// A contract's interface describes the functions, parameters, and | ||
/// types that the contract makes accessible to be called. | ||
/// | ||
/// The data outputted by this command is a stream of `SCSpecEntry` XDR values. | ||
/// See the type definitions in [stellar-xdr](https://github.com/stellar/stellar-xdr). | ||
/// [See also XDR data format](https://developers.stellar.org/docs/learn/encyclopedia/data-format/xdr). | ||
/// | ||
/// Outputs no data when no data is present in the contract. | ||
Interface(interface::Cmd), | ||
|
||
/// Output the metadata stored in a contract. | ||
/// | ||
/// A contract's meta is a series of key-value pairs that the contract | ||
/// developer can set with any values to provided metadata about the | ||
/// contract. The meta also contains some information like the version | ||
/// of Rust SDK, and Rust compiler version. | ||
/// | ||
/// The data outputted by this command is a stream of `SCMetaEntry` XDR values. | ||
/// See the type definitions in [stellar-xdr](https://github.com/stellar/stellar-xdr). | ||
/// [See also XDR data format](https://developers.stellar.org/docs/learn/encyclopedia/data-format/xdr). | ||
/// | ||
/// Outputs no data when no data is present in the contract. | ||
Meta(meta::Cmd), | ||
|
||
/// Output the env required metadata stored in a contract. | ||
/// | ||
/// Env-meta is information stored in all contracts, in the | ||
/// `contractenvmetav0` WASM custom section, about the environment | ||
/// that the contract was built for. Env-meta allows the Soroban Env | ||
/// to know whether the contract is compatibility with the network in | ||
/// its current configuration. | ||
/// | ||
/// The data outputted by this command is a stream of `SCEnvMetaEntry` XDR values. | ||
/// See the type definitions in [stellar-xdr](https://github.com/stellar/stellar-xdr). | ||
/// [See also XDR data format](https://developers.stellar.org/docs/learn/encyclopedia/data-format/xdr). | ||
/// | ||
/// Outputs no data when no data is present in the contract. | ||
EnvMeta(env_meta::Cmd), | ||
} | ||
|
||
#[derive(thiserror::Error, Debug)] | ||
pub enum Error { | ||
#[error(transparent)] | ||
Interface(#[from] interface::Error), | ||
#[error(transparent)] | ||
Meta(#[from] meta::Error), | ||
#[error(transparent)] | ||
EnvMeta(#[from] env_meta::Error), | ||
} | ||
|
||
impl Cmd { | ||
pub async fn run(&self) -> Result<(), Error> { | ||
let result = match &self { | ||
Cmd::Interface(interface) => interface.run().await?, | ||
Cmd::Meta(meta) => meta.run().await?, | ||
Cmd::EnvMeta(env_meta) => env_meta.run().await?, | ||
}; | ||
println!("{result}"); | ||
Ok(()) | ||
} | ||
} |
Oops, something went wrong.