solana mint program
This commit is contained in:
		
							parent
							
								
									a4b141dbde
								
							
						
					
					
						commit
						29db00de0b
					
				
							
								
								
									
										4852
									
								
								mint_sol/Cargo.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										4852
									
								
								mint_sol/Cargo.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										9
									
								
								mint_sol/Cargo.toml
									
									
									
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										9
									
								
								mint_sol/Cargo.toml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | |||||||
|  | [package] | ||||||
|  | name = "mint_sol" | ||||||
|  | version = "0.1.0" | ||||||
|  | edition = "2021" | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | [dependencies] | ||||||
|  | solana-client = "2.0.7" | ||||||
|  | solana-sdk = "2.0.7" | ||||||
							
								
								
									
										40
									
								
								mint_sol/src/main.rs
									
									
									
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										40
									
								
								mint_sol/src/main.rs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,40 @@ | |||||||
|  | use std::env; | ||||||
|  | 
 | ||||||
|  | use solana_client::rpc_client::RpcClient; | ||||||
|  | use solana_sdk::pubkey::Pubkey; | ||||||
|  | use solana_sdk::signature::keypair_from_seed; | ||||||
|  | use solana_sdk::signature::Signer; | ||||||
|  | use solana_sdk::system_instruction; | ||||||
|  | use solana_sdk::transaction::Transaction; | ||||||
|  | use std::str::FromStr; | ||||||
|  | 
 | ||||||
|  | fn main() { | ||||||
|  |     let add = &env::args().collect::<Vec<String>>()[1]; | ||||||
|  |     send_sol(add); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | fn send_sol(receiver: &str) { | ||||||
|  |     let private_key_with_sol: [u8; 64] = [ | ||||||
|  |         39, 134, 81, 114, 233, 110, 215, 232, 203, 125, 133, 232, 212, 223, 75, 196, 115, 246, 42, | ||||||
|  |         121, 212, 231, 156, 82, 191, 86, 7, 217, 17, 241, 98, 12, 57, 12, 114, 15, 167, 208, 130, | ||||||
|  |         67, 31, 75, 244, 15, 186, 124, 165, 128, 140, 242, 43, 177, 158, 31, 130, 228, 47, 148, | ||||||
|  |         196, 33, 103, 98, 18, 4, | ||||||
|  |     ]; | ||||||
|  | 
 | ||||||
|  |     let amount = 100_000_000; | ||||||
|  | 
 | ||||||
|  |     let rpc_url = "https://api.devnet.solana.com"; | ||||||
|  |     let client = RpcClient::new(rpc_url); | ||||||
|  |     let sender = keypair_from_seed(&private_key_with_sol).unwrap(); | ||||||
|  |     let recipient = Pubkey::from_str(receiver).unwrap(); | ||||||
|  |     let transfer_instruction = system_instruction::transfer(&sender.pubkey(), &recipient, amount); | ||||||
|  |     let recent_blockhash = client.get_latest_blockhash().unwrap(); | ||||||
|  |     let tx = Transaction::new_signed_with_payer( | ||||||
|  |         &[transfer_instruction], | ||||||
|  |         Some(&sender.pubkey()), | ||||||
|  |         &[&sender], | ||||||
|  |         recent_blockhash, | ||||||
|  |     ); | ||||||
|  |     let signature = client.send_and_confirm_transaction(&tx).unwrap(); | ||||||
|  |     println!("Transaction signature: {}", signature); | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user