chore: port web3.js to solana-test-validator

This commit is contained in:
Michael Vines
2020-12-15 13:24:28 -08:00
committed by mergify[bot]
parent efc091e28a
commit fd7d2f82ae
12 changed files with 373 additions and 131 deletions

View File

@@ -1,10 +1,8 @@
//! @brief Example Rust-based BPF program that prints out the parameters passed to it
#![allow(unreachable_code)]
extern crate solana_sdk;
use solana_sdk::{
account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, info, log::*, pubkey::Pubkey,
use solana_program::{
account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg, log::*, pubkey::Pubkey,
};
#[derive(Debug, PartialEq)]
@@ -25,13 +23,13 @@ fn process_instruction(
accounts: &[AccountInfo],
instruction_data: &[u8],
) -> ProgramResult {
info!("Program identifier:");
msg!("Program identifier:");
program_id.log();
// Log the provided account keys and instruction input data. In the case of
// the no-op program, no account keys or input data are expected but real
// programs will have specific requirements so they can do their work.
info!("Account keys and instruction input data:");
msg!("Account keys and instruction input data:");
sol_log_params(accounts, instruction_data);
{
@@ -42,7 +40,7 @@ fn process_instruction(
let result_str = std::str::from_utf8(&sparkle_heart).unwrap();
assert_eq!(4, result_str.len());
assert_eq!("💖", result_str);
info!(result_str);
msg!(result_str);
}
{