phantom / docs

31 stars 17 forks source link

can`t signTransaction: too long waited to approve. #38

Closed X-justice closed 1 year ago

X-justice commented 2 years ago

In the firefox browser, the transaction is rejected due to a long wait. When this is in the console, the reason is as follows: The user rejected the transaction. This problem is only in Firefox.

below code works for other wallets in google chrome

let transaction = new Transaction().add(
    new TransactionInstruction({
        data: createBidInstruction(chosenSideIndex, betValue),
        keys: [
            { pubkey: publicKey, isSigner: true, isWritable: true }, //from
            { pubkey: new PublicKey(bet.wallet), isSigner: false, isWritable: true }, //to
            { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }
        ],
        programId: new PublicKey('PROGRAMKEY')
    })
)
transaction.feePayer = transaction.feePayer || publicKey || undefined;
transaction.recentBlockhash = transaction.recentBlockhash || (await connection.getLatestBlockhash('finalized')).blockhash;

await sendTransaction(transaction, connection)