-
Notifications
You must be signed in to change notification settings - Fork 133
Open
Description
Summary
I am facing a TypeScript error when passing the signedTransaction to sendAndConfirmTransaction at solana/web3.js-2.0/basics/transferSol.ts#L91
Error description :
Argument of type 'FullySignedTransaction & TransactionWithinSizeLimit & Readonly<{ messageBytes: TransactionMessageBytes; signatures: SignaturesMap; }> & TransactionWithLifetime' is not assignable to parameter of type 'FullySignedTransaction & TransactionWithinSizeLimit & Readonly<{ messageBytes: TransactionMessageBytes; signatures: SignaturesMap; }> & Omit<...> & { ...; }'.
Type 'FullySignedTransaction & TransactionWithinSizeLimit & Readonly<{ messageBytes: TransactionMessageBytes; signatures: SignaturesMap; }> & TransactionWithLifetime' is not assignable to type '{ lifetimeConstraint: Omit<TransactionBlockhashLifetime, "blockhash">; }'.
Types of property 'lifetimeConstraint' are incompatible.
Type 'TransactionBlockhashLifetime | TransactionDurableNonceLifetime' is not assignable to type 'Omit<TransactionBlockhashLifetime, "blockhash">'.
Property 'lastValidBlockHeight' is missing in type 'TransactionDurableNonceLifetime' but required in type 'Omit<TransactionBlockhashLifetime, "blockhash">'.ts(2345)
lifetime.d.ts(25, 5): 'lastValidBlockHeight' is declared here.Looks likesendAndConfirmTransaction expects a transaction that is using a recent blockhash, but the transaction we’re passing in could be either a recent blockhash transaction or a durable nonce transaction.
Note
- Recent blockhash transactions have lastValidBlockHeight
- But durable nonce transactions do not
Proposed Solution
We require an assertion before calling sendAndConfirmTransaction, to make sure that the signed transaction has the lastValidBlockHeight
assertIsTransactionWithBlockhashLifetime(signedTransaction);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels