Skip to content

把脚本中间的函数修改了下,可以避免上链过程出现意外后,脚本直接退出 #2

@Kahnchan

Description

@Kahnchan

async function logMemo(message) {
try {
let tx = new Transaction();
await tx.add(
new TransactionInstruction({
keys: [{ pubkey: keypair.publicKey, isSigner: true, isWritable: true }],
data: Buffer.from(message, "utf-8"),
programId: new PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),
})
)
let result = await sendAndConfirmTransaction(SOLANA_CONNECTION, tx, [keypair]);
console.log("complete: ", https://solscan.io/tx/${result});
return result;
} catch (error) {
console.error("Error in logMemo:", error.message);
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions