Hello,
When trying to use Drift SDK to place a perp order, there is a randomly a loopy random error :
accountUnsubscribe error: Tried to call a JSON-RPC method `accountUnsubscribe` but the socket was not `CONNECTING` or `OPEN` (`readyState` was 2)
accountUnsubscribe error: Tried to call a JSON-RPC method `accountUnsubscribe` but the socket was not `CONNECTING` or `OPEN` (`readyState` was 2)
### hundreds of times until crash
This is how I instantiate a DriftClient and how I place a perp order :
// DriftClient init:
const provider = new AnchorProvider(
connection,
wallet,
{
commitment: 'confirmed',
preflightCommitment: 'confirmed',
skipPreflight: false,
}
);
const driftPublicKey = new PublicKey(sdkConfig.DRIFT_PROGRAM_ID);
const driftClient = new DriftClient({
connection: provider.connection,
wallet: provider.wallet,
programID: driftPublicKey,
accountSubscription: {
type: "websocket",
}
});
await driftClient.subscribe();
// Perp placing order
try {
await driftClient.placePerpOrder(
getMarketOrderParams({
marketIndex: marketIndex,
baseAssetAmount: assetAmount,
direction: direction,
}),
undefined,
subAccountId
);
} catch (e) {
if (e instanceof SendTransactionError) {
console.error(e.logs);
}
throw e;
}
Using latest "@drift-labs/sdk": "^2.157.0-beta.7" version.
Please advice
Hello,
When trying to use Drift SDK to place a perp order, there is a randomly a loopy random error :
This is how I instantiate a DriftClient and how I place a perp order :
Using latest "@drift-labs/sdk": "^2.157.0-beta.7" version.
Please advice