phantom / docs

31 stars 17 forks source link

`signAndSendTransaction` Transaction recentBlockhash required error #25

Closed ghost closed 1 year ago

ghost commented 2 years ago

import {
    Connection,
    LAMPORTS_PER_SOL,
    PublicKey,
    SystemProgram,
    Transaction,
    TransactionInstruction
} from "@solana/web3.js"

(async () => {

const tx = new Transaction();

const connection = await new Connection(
    network("http://localhost:8899"),'confirmed'
)

const {signature} = await window.solana.signAndSendTransaction(tx);
const b = await connection.confirmTransaction(signature);
console.log(b,123)

})()

Does not work and docs and very wrong https://docs.phantom.app/integrating/sending-a-transaction