ITS NODE BABY
This commit is contained in:
1 parent
321e82a71c
commit
38c5579fbb
25 files changed
+3877
-683
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import base58 from "bs58";
|
||||
import "dotenv/config"
|
||||
import * as helpers from "@solana-developers/helpers";
|
||||
import * as web3 from "@solana/web3.js";
|
||||
|
||||
const emoKey = helpers.getKeypairFromEnvironment("EMO");
|
||||
const emoAddr = new web3.PublicKey(emoKey.publicKey);
|
||||
|
||||
const ntrKey = helpers.getKeypairFromEnvironment("NTR");
|
||||
const ntrAddr = new web3.PublicKey(ntrKey.publicKey);
|
||||
|
||||
const payer = emoKey
|
||||
const connection = new web3.Connection(web3.clusterApiUrl("devnet"));
|
||||
|
||||
const balance = await connection.getBalance(emoAddr);
|
||||
|
||||
const tx = new web3.Transaction();
|
||||
const TX_COST = 5000;
|
||||
|
||||
const instr = web3.SystemProgram.transfer({
|
||||
fromPubkey: emoAddr,
|
||||
toPubkey: ntrAddr,
|
||||
lamports: balance - TX_COST,
|
||||
});
|
||||
|
||||
tx.add(instr);
|
||||
|
||||
const sig = await web3.sendAndConfirmTransaction(connection, tx, [emoKey]);
|
||||
|
||||
console.log(sig);
|
||||
|
||||
Reference in new issue
Block a user