Skip to content

Commit

Permalink
Marinade common CLI artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
ochaloup committed Jun 26, 2023
1 parent 27f73a5 commit 16f301d
Show file tree
Hide file tree
Showing 11 changed files with 1,810 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
/Cargo.lock
/.idea
14 changes: 12 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ name = "marinade-common-rs-cli"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
solana-sdk = "1.14.18"
once_cell = "1.8.0"
thiserror = "1.0.30"
anyhow = "1.0.71"
bincode = "1.3.3"
spl-token = { version = "3.5.0", features = ["no-entrypoint"] }
spl-associated-token-account = { version = "1.1.3", features = ["no-entrypoint"] }
log = "0.4.18"
solana-client = "1.14.18"
marinade-finance = { git = "https://github.com/marinade-finance/liquid-staking-program.git", branch = "anchor-0.27" }
anchor-lang = "0.27.0"
anchor-client = "0.27.0"
31 changes: 31 additions & 0 deletions src/dyn_signer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signer::Signer;
use std::sync::Arc;

/// Auxiliary data structure to align the types of the solana-clap-utils with anchor-client.
pub struct DynSigner(pub Arc<dyn Signer>);

impl Signer for DynSigner {
fn pubkey(&self) -> Pubkey {
self.0.pubkey()
}

fn try_pubkey(&self) -> Result<Pubkey, solana_sdk::signer::SignerError> {
self.0.try_pubkey()
}

fn sign_message(&self, message: &[u8]) -> solana_sdk::signature::Signature {
self.0.sign_message(message)
}

fn try_sign_message(
&self,
message: &[u8],
) -> Result<solana_sdk::signature::Signature, solana_sdk::signer::SignerError> {
self.0.try_sign_message(message)
}

fn is_interactive(&self) -> bool {
self.0.is_interactive()
}
}
18 changes: 6 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#![cfg_attr(not(debug_assertions), deny(warnings))]

#[cfg(test)]
mod tests {
use super::*;
pub mod dyn_signer;
pub mod marinade;
pub mod rpc_client_helpers;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
pub use solana_sdk;
pub use spl_associated_token_account;
Loading

0 comments on commit 16f301d

Please sign in to comment.