-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
cli: init rust test #2805
cli: init rust test #2805
Conversation
@aoikurokawa is attempting to deploy a commit to the coral-xyz Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for starting on this!
I am submitting this pull request for review. As I am not entirely confident about my implementation, I would greatly appreciate any advice or suggestions. I am open to feedback and happy to make any necessary adjustments.
Can we add this as a template instead of a separate flag? It would also be much easier to add it that way since you can just specify all the necessary files in one place similar to
anchor/cli/src/rust_template.rs
Line 69 in 94fde24
fn create_program_template_multiple(name: &str, program_path: &Path) -> Files { |
Thank you for the review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work, thanks! A few more things and it should be good to merge.
@acheroncrypto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
For anyone wishing to try this, use
Look inside You'll see a file with the contents: use std::str::FromStr;
use anchor_client::{
solana_sdk::{
commitment_config::CommitmentConfig, pubkey::Pubkey, signature::read_keypair_file,
},
Client, Cluster,
};
#[test]
fn test_initialize() {
let program_id = "ALBsctEzCR2MuZ65KczywWQYEyhjdbq7B5LnkuYg1sie";
let anchor_wallet = std::env::var("ANCHOR_WALLET").unwrap();
let payer = read_keypair_file(&anchor_wallet).unwrap();
let client = Client::new_with_options(Cluster::Localnet, &payer, CommitmentConfig::confirmed());
let program_id = Pubkey::from_str(program_id).unwrap();
let program = client.program(program_id).unwrap();
let tx = program
.request()
.accounts(aaa::accounts::Initialize {})
.args(aaa::instruction::Initialize {})
.send()
.expect("");
println!("Your transaction signature {}", tx);
} Then run |
Problem
close #2680
Summary of Changes
rust-template
inanchor init -t
command.I am submitting this pull request for review. As I am not entirely confident about my implementation, I would greatly appreciate any advice or suggestions. I am open to feedback and happy to make any necessary adjustments.