This block of code is giving the trouble..
let listener = null;
//@ts-ignore
let [event, slot] = await new Promise((resolve, _reject) => {
listener = program.addEventListener("Deposited", (event, slot) => {
resolve([event, slot]);
});
program.rpc.redeem(
new anchor.BN(redeemAmount),
{
accounts: {
treasury,
posMint,
treasuryVault,
userVault: userTreasuryVault,
userPosVault,
authority: user,
tokenProgram: TOKEN_PROGRAM_ID,
},
signers: [userKeypair]
});
});
the call to the same function without the event listener will execute perfectly fine as I did here:
const tx = await program.rpc.redeem(
new anchor.BN(redeemAmount),
{
accounts: {
treasury,
posMint,
treasuryVault,
userVault: userTreasuryVault,
userPosVault,
authority: user,
tokenProgram: TOKEN_PROGRAM_ID,
},
signers: [userKeypair]
});
I get no errors other than time limit exceeded.. How do I resolve this..?