fix: remove deprecated bpf-sdk, localnet, and examples
BREAKING CHANGE: Removed binaries solana-localnet and solana-bpf-sdk-install. Please install the Solana CLI tools to download the BPF SDK and to install the solana-test-validator binary intead.
This commit is contained in:
committed by
Justin Starry
parent
f46f346710
commit
e9b08b5e7f
@ -1,10 +0,0 @@
|
||||
## Examples
|
||||
Before trying any of the examples in this directory please populate the `lib/`
|
||||
directory by running `npm install`.
|
||||
|
||||
Additionally most of the examples attempt to connect to a local cluster. Start
|
||||
your local cluster first by running:
|
||||
```bash
|
||||
$ npx solana-localnet update
|
||||
$ npx solana-localnet up
|
||||
```
|
@ -1,24 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Create a new account</title>
|
||||
</head>
|
||||
<body>
|
||||
<b>Account Public Key:</b>
|
||||
<div id="accountPublicKey">?</div>
|
||||
|
||||
<script src="../lib/index.iife.js"></script>
|
||||
<!--
|
||||
<script src="https://github.com/solana-labs/solana-web3.js/releases/download/v0.11.10/solanaWeb3.min.js"></script>
|
||||
-->
|
||||
|
||||
<script>
|
||||
// Create a new account
|
||||
const account = new solanaWeb3.Account();
|
||||
|
||||
// Display the account's public key
|
||||
const accountPublicKey = document.getElementById('accountPublicKey');
|
||||
accountPublicKey.innerHTML = account.publicKey;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
/*
|
||||
Create a new account
|
||||
*/
|
||||
|
||||
//eslint-disable-next-line import/no-commonjs
|
||||
const solanaWeb3 = require('..');
|
||||
//const solanaWeb3 = require('@solana/web3.js');
|
||||
|
||||
const account = new solanaWeb3.Account();
|
||||
console.log(account.publicKey.toString());
|
1
web3.js/examples/bpf-c-noop/.gitignore
vendored
1
web3.js/examples/bpf-c-noop/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/out/
|
@ -1 +0,0 @@
|
||||
include ../../bpf-sdk/c/bpf.mk
|
@ -1,19 +0,0 @@
|
||||
/**
|
||||
* @brief Example C-based BPF program that prints out the parameters
|
||||
* passed to it
|
||||
*/
|
||||
|
||||
#include <solana_sdk.h>
|
||||
|
||||
extern uint64_t entrypoint(const uint8_t *input) {
|
||||
SolAccountInfo ka[1];
|
||||
SolParameters params = (SolParameters) { .ka = ka };
|
||||
|
||||
sol_log("Hello World");
|
||||
|
||||
if (!sol_deserialize(input, ¶ms, SOL_ARRAY_SIZE(ka))) {
|
||||
return ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
sol_log_params(¶ms);
|
||||
return SUCCESS;
|
||||
}
|
3
web3.js/examples/bpf-rust-noop/.gitignore
vendored
3
web3.js/examples/bpf-rust-noop/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
/target/
|
||||
|
||||
Cargo.lock
|
@ -1,23 +0,0 @@
|
||||
[package]
|
||||
name = "solana-bpf-rust-noop"
|
||||
version = "0.1.0"
|
||||
description = "Solana BPF noop program written in Rust"
|
||||
authors = ["Solana Maintainers <maintainers@solana.com>"]
|
||||
repository = "https://github.com/solana-labs/solana"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://solana.com/"
|
||||
documentation = "https://docs.rs/solana-bpf-rust-noop"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
num-derive = "0.2"
|
||||
num-traits = "0.2"
|
||||
solana-program = "1.4.16"
|
||||
thiserror = "1.0"
|
||||
|
||||
[workspace]
|
||||
members = []
|
||||
|
||||
[lib]
|
||||
name = "solana_bpf_rust_noop"
|
||||
crate-type = ["cdylib"]
|
@ -1,2 +0,0 @@
|
||||
[target.bpfel-unknown-unknown.dependencies.std]
|
||||
features = []
|
@ -1,70 +0,0 @@
|
||||
//! @brief Example Rust-based BPF program that prints out the parameters passed to it
|
||||
|
||||
|
||||
use solana_program::{
|
||||
account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg, log::*, pubkey::Pubkey,
|
||||
};
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
struct SStruct {
|
||||
x: u64,
|
||||
y: u64,
|
||||
z: u64,
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
fn return_sstruct() -> SStruct {
|
||||
SStruct { x: 1, y: 2, z: 3 }
|
||||
}
|
||||
|
||||
entrypoint!(process_instruction);
|
||||
fn process_instruction(
|
||||
program_id: &Pubkey,
|
||||
accounts: &[AccountInfo],
|
||||
instruction_data: &[u8],
|
||||
) -> ProgramResult {
|
||||
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.
|
||||
msg!("Account keys and instruction input data:");
|
||||
sol_log_params(accounts, instruction_data);
|
||||
|
||||
{
|
||||
// Test - use std methods, unwrap
|
||||
|
||||
// valid bytes, in a stack-allocated array
|
||||
let sparkle_heart = [240, 159, 146, 150];
|
||||
let result_str = std::str::from_utf8(&sparkle_heart).unwrap();
|
||||
assert_eq!(4, result_str.len());
|
||||
assert_eq!("💖", result_str);
|
||||
msg!(result_str);
|
||||
}
|
||||
|
||||
{
|
||||
// Test - struct return
|
||||
|
||||
let s = return_sstruct();
|
||||
assert_eq!(s.x + s.y + s.z, 6);
|
||||
}
|
||||
|
||||
{
|
||||
// Test - arch config
|
||||
#[cfg(not(target_arch = "bpf"))]
|
||||
panic!();
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_return_sstruct() {
|
||||
assert_eq!(SStruct { x: 1, y: 2, z: 3 }, return_sstruct());
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Get account balance</title>
|
||||
</head>
|
||||
<body>
|
||||
<b>Account</b>
|
||||
<div id="accountPublicKey">?</div>
|
||||
has a balance of
|
||||
<div id="accountBalance">?</div>
|
||||
|
||||
<script src="../lib/index.iife.js"></script>
|
||||
<!--
|
||||
<script src="https://github.com/solana-labs/solana-web3.js/releases/download/v0.11.10/solanaWeb3.min.js"></script>
|
||||
-->
|
||||
|
||||
<script>
|
||||
// Create a new account
|
||||
const account = new solanaWeb3.Account();
|
||||
|
||||
// Display the account's public key
|
||||
const accountPublicKey = document.getElementById('accountPublicKey');
|
||||
accountPublicKey.innerHTML = account.publicKey;
|
||||
|
||||
// Fetch account balance
|
||||
let url = 'http://localhost:8899';
|
||||
const connection = new solanaWeb3.Connection(url);
|
||||
|
||||
connection.getBalance(account.publicKey)
|
||||
.then((balance) => {
|
||||
const accountBalance = document.getElementById('accountBalance');
|
||||
accountBalance.innerHTML = balance;
|
||||
console.log(`${account.publicKey} has a balance of ${balance}`);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
Fetch the balance of an account
|
||||
*/
|
||||
|
||||
//eslint-disable-next-line import/no-commonjs
|
||||
const solanaWeb3 = require('..');
|
||||
//const solanaWeb3 = require('@solana/web3.js');
|
||||
|
||||
const account = new solanaWeb3.Account();
|
||||
|
||||
let url;
|
||||
url = 'http://devnet.solana.com';
|
||||
//url = 'http://localhost:8899';
|
||||
const connection = new solanaWeb3.Connection(url);
|
||||
|
||||
connection.getBalance(account.publicKey).then(balance => {
|
||||
console.log(`${account.publicKey} has a balance of ${balance}`);
|
||||
});
|
Reference in New Issue
Block a user