Skip to content

Commit

Permalink
Fix wallet-connect to handle transactions of type Unit8Array and Buff…
Browse files Browse the repository at this point in the history
…er after NAJ update to v4.
  • Loading branch information
kujtimprenku committed Sep 15, 2024
1 parent 52b704c commit 3687d3e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/wallet-connect/src/lib/wallet-connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,10 @@ const WalletConnect: WalletBehaviourFactory<
},
});

return nearAPI.transactions.SignedTransaction.decode(Buffer.from(result));
// @ts-ignore
const isBuffer = result?.type === "Buffer";
const txResult = isBuffer ? result : Object.values(result);
return nearAPI.transactions.SignedTransaction.decode(Buffer.from(txResult));
};

const requestSignTransactions = async (transactions: Array<Transaction>) => {
Expand Down Expand Up @@ -408,7 +411,12 @@ const WalletConnect: WalletBehaviourFactory<
});

return results.map((result) => {
return nearAPI.transactions.SignedTransaction.decode(Buffer.from(result));
// @ts-ignore
const isBuffer = result?.type === "Buffer";
const txResult = isBuffer ? result : Object.values(result);
return nearAPI.transactions.SignedTransaction.decode(
Buffer.from(txResult)
);
});
};

Expand Down

0 comments on commit 3687d3e

Please sign in to comment.