chore: remove web3 examples (#26515)

This commit is contained in:
Justin Starry 2022-07-08 23:14:38 +01:00 committed by GitHub
parent 6d7a569087
commit 0de0d4625e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 0 additions and 64 deletions

View File

@ -32,7 +32,6 @@ ignores=(
.cache
.cargo
target
web3.js/examples
web3.js/test
node_modules
)

View File

@ -22,7 +22,6 @@ ignores=(
.cache
.cargo
target
web3.js/examples
web3.js/test
node_modules
)

View File

@ -1,25 +0,0 @@
import * as web3 from '@solana/web3.js';
(async () => {
// Connect to cluster
var connection = new web3.Connection(
web3.clusterApiUrl('devnet'),
'confirmed',
);
// Generate a new wallet keypair and airdrop SOL
var wallet = web3.Keypair.generate();
var airdropSignature = await connection.requestAirdrop(
wallet.publicKey,
web3.LAMPORTS_PER_SOL,
);
//wait for airdrop confirmation
await connection.confirmTransaction(airdropSignature);
// get account info
// account data is bytecode that needs to be deserialized
// serialization and deserialization is program specific
let account = await connection.getAccountInfo(wallet.publicKey);
console.log(account);
})();

View File

@ -1,37 +0,0 @@
import * as web3 from '@solana/web3.js';
(async () => {
// Connect to cluster
var connection = new web3.Connection(
web3.clusterApiUrl('devnet'),
'confirmed',
);
// Generate a new random public key
var from = web3.Keypair.generate();
var airdropSignature = await connection.requestAirdrop(
from.publicKey,
web3.LAMPORTS_PER_SOL,
);
await connection.confirmTransaction(airdropSignature);
// Generate a new random public key
var to = web3.Keypair.generate();
// Add transfer instruction to transaction
var transaction = new web3.Transaction().add(
web3.SystemProgram.transfer({
fromPubkey: from.publicKey,
toPubkey: to.publicKey,
lamports: web3.LAMPORTS_PER_SOL / 100,
}),
);
// Sign transaction, broadcast, and confirm
var signature = await web3.sendAndConfirmTransaction(
connection,
transaction,
[from],
);
console.log('SIGNATURE', signature);
})();