Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs #149

Merged
merged 2 commits into from
Oct 24, 2024
Merged

Docs #149

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/space-operator-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change log

## 0.4.1

- Update README.md

## 0.4.0

- Use `serde_as` for node inputs, outputs.
Expand Down
2 changes: 1 addition & 1 deletion lib/space-operator-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "space-operator-cli"
version = "0.4.0"
version = "0.4.1"
edition = "2021"
description = "CLI for Space Operator"
license = "AGPL-3.0-only"
Expand Down
39 changes: 21 additions & 18 deletions lib/space-operator-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,21 +200,23 @@ fn build() -> BuildResult {
});
Ok(CACHE.clone()?.build(run))
}
#[serde_as]
#[derive(Deserialize, Serialize, Debug)]
struct Input {
#[serde(with = "value::keypair")]
fee_payer: Keypair,
#[serde(with = "value::decimal")]
amount: Decimal,
pub struct Input {
#[serde_as(as = "AsKeypair")]
pub fee_payer: Keypair,
#[serde_as(as = "AsDecimal")]
pub amount: Decimal,
#[serde(default = "value::default::bool_true")]
submit: bool,
pub submit: bool,
}
#[serde_as]
#[derive(Deserialize, Serialize, Debug)]
struct Output {
#[serde(default, with = "value::decimal::opt")]
balance: Option<Decimal>,
#[serde(default, with = "value::signature::opt")]
signature: Option<Signature>,
pub struct Output {
#[serde_as(as = "AsDecimal")]
pub balance: Option<Decimal>,
#[serde_as(as = "Option<Signature>")]
pub signature: Option<Signature>,
}
async fn run(mut ctx: Context, input: Input) -> Result<Output, CommandError> {
tracing::info!("input: {:?}", input);
Expand Down Expand Up @@ -253,22 +255,23 @@ spo generate input crates/cmds-solana/node-definitions/nft/v1/mint_v1.json
```

```rust
#[serde_as]
#[derive(Deserialize, Serialize, Debug)]
struct Input {
#[serde(with = "value::keypair")]
#[serde_as(as = "AsKeypair")]
fee_payer: Keypair,
#[serde(default, with = "value::keypair::opt")]
#[serde_as(as = "Option<AsKeypair>")]
authority: Option<Keypair>,
#[serde(with = "value::pubkey")]
#[serde_as(as = "AsPubkey")]
mint_account: Pubkey,
#[serde(with = "value::pubkey")]
#[serde_as(as = "AsPubkey")]
token_owner: Pubkey,
amount: Option<u64>,
#[serde(default, with = "value::pubkey::opt")]
#[serde_as(as = "Option<AsPubkey>")]
delegate_record: Option<Pubkey>,
#[serde(default, with = "value::pubkey::opt")]
#[serde_as(as = "Option<AsPubkey>")]
authorization_rules_program: Option<Pubkey>,
#[serde(default, with = "value::pubkey::opt")]
#[serde_as(as = "Option<AsPubkey>")]
authorization_rules: Option<Pubkey>,
authorization_data: Option<JsonValue>,
#[serde(default = "value::default::bool_true")]
Expand Down