use grpc for drift client for dlob publishers

This commit is contained in:
Nour Alharithi
2024-12-04 19:37:11 -08:00
parent 302ef36eec
commit 9271bd8fd6
2 changed files with 19 additions and 2 deletions

View File

@@ -324,7 +324,24 @@ const main = async () => {
let accountSubscription: DriftClientSubscriptionConfig; let accountSubscription: DriftClientSubscriptionConfig;
let slotSource: SlotSource; let slotSource: SlotSource;
if (!useWebsocket) { // USE_GRPC=true will override websocket
if (useGrpc) {
accountSubscription = {
type: 'grpc',
resubTimeoutMs: 30_000,
grpcConfigs: {
endpoint,
token,
},
};
slotSubscriber = new SlotSubscriber(connection);
await slotSubscriber.subscribe();
slotSource = {
getSlot: () => slotSubscriber!.getSlot(),
};
} else if (!useWebsocket) {
bulkAccountLoader = new BulkAccountLoader( bulkAccountLoader = new BulkAccountLoader(
connection, connection,
stateCommitment, stateCommitment,