fix: drift user account info fetching

This commit is contained in:
michaelessiet
2025-01-15 14:52:13 +01:00
parent a65463a77b
commit 484a64de85
2 changed files with 139 additions and 137 deletions

View File

@@ -254,7 +254,7 @@ export async function withdrawFromDriftUserAccount(
const tx = new Transaction().add(...withdrawInstruction).add(
ComputeBudgetProgram.setComputeUnitPrice({
microLamports: 0.000001 * 1000000 * 1000000,
microLamports: 0.000003 * 1000000 * 1000000,
}),
);
tx.recentBlockhash = latestBlockhash.blockhash;
@@ -388,9 +388,11 @@ export async function doesUserHaveDriftAccount(agent: SolanaAgentKit) {
agent.wallet.publicKey,
),
});
await user.subscribe();
user.getActivePerpPositions();
const userAccountExists = await user.exists();
await cleanUp();
await user.unsubscribe();
return {
hasAccount: userAccountExists,
account: user.userAccountPublicKey,