Skip to content

Commit

Permalink
fix: tx process function not detection tx type correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
k0beLeenders authored and chambaz committed Oct 16, 2024
1 parent 2e91c1e commit 86773dc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/marginfi-client-v2/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ class MarginfiClient {
lastValidBlockHeight = getLatestBlockhashAndContext.value.lastValidBlockHeight;

for (const transaction of transactions) {
if (transaction instanceof VersionedTransaction) {
if (transaction && "message" in transaction) {
versionedTransactions.push(transaction);
} else {
const versionedMessage = new TransactionMessage({
Expand Down Expand Up @@ -939,16 +939,16 @@ class MarginfiClient {
blockhash = getLatestBlockhashAndContext.value.blockhash;
lastValidBlockHeight = getLatestBlockhashAndContext.value.lastValidBlockHeight;

if (transaction instanceof Transaction) {
if (transaction && "message" in transaction) {
versionedTransaction = transaction;
} else {
const versionedMessage = new TransactionMessage({
instructions: transaction.instructions,
payerKey: this.provider.publicKey,
recentBlockhash: blockhash,
});

versionedTransaction = new VersionedTransaction(versionedMessage.compileToV0Message(this.addressLookupTables));
} else {
versionedTransaction = transaction;
}

if (signers) versionedTransaction.sign(signers);
Expand Down

0 comments on commit 86773dc

Please sign in to comment.