-
-
Save dtmrc/ba9b7d86839d6aa016cb70657adc3621 to your computer and use it in GitHub Desktop.
solana-program-library-memo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Web3 = ({ | |
Account, | |
Transaction, | |
TransactionInstruction, | |
PublicKey, | |
Connection, | |
} = require("@solana/web3.js")); | |
const testMemo = (conn, account) => { | |
const instruction = new TransactionInstruction({ | |
keys: [], | |
programId: new PublicKey("6vDzicgVeXdeFneCRF7rT1Rqur8qAAEk2d6kURhMBeoA"), | |
data: Buffer.from("cztest"), | |
}); | |
console.log("account: ", account.publicKey.toBase58()); | |
Web3.sendAndConfirmTransaction( | |
conn, | |
new Transaction().add(instruction), | |
[account], | |
{ | |
skipPreflight: true, | |
commitment: "singleGossip", | |
} | |
) | |
.then(() => { | |
console.log("done"); | |
}) | |
.catch((e) => { | |
console.log("error", e); | |
}); | |
}; | |
const main = () => { | |
const conn = new Connection("https://devnet.solana.com", "singleGossip"); | |
const account = new Account(); | |
const lamports = 10 * 1000000000; | |
conn.requestAirdrop(account.publicKey, lamports).then(() => { | |
console.log("airdrop done"); | |
testMemo(conn, account); | |
}); | |
}; | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment