Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion sdk/src/accounts/grpcMultiUserAccountSubscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ export class grpcMultiUserAccountSubscriber {
this.listeners.set(key, new Set());
this.keyToPk.set(key, userAccountPublicKey);
this.pendingAddKeys.add(key);
this.scheduleFlush();
if (this.isMultiSubscribed) {
// only schedule flush if already subscribed to the multi-subscriber
this.scheduleFlush();
}
}
};

Expand Down Expand Up @@ -161,6 +164,10 @@ export class grpcMultiUserAccountSubscriber {
},

updateData(userAccount: UserAccount, slot: number): void {
const existingData = parent.userData.get(key);
if (existingData && existingData.slot > slot) {
return;
}
parent.userData.set(key, { data: userAccount, slot });
perUserEmitter.emit('userAccountUpdate', userAccount);
perUserEmitter.emit('update');
Expand Down
5 changes: 5 additions & 0 deletions sdk/src/constants/numericConstants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LAMPORTS_PER_SOL } from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import { BigNum } from '../factory/bigNum';

export const ZERO = new BN(0);
export const ONE = new BN(1);
Expand Down Expand Up @@ -116,3 +117,7 @@ export const FUEL_START_TS = new BN(1723147200); // unix timestamp
export const MAX_PREDICTION_PRICE = PRICE_PRECISION;

export const GET_MULTIPLE_ACCOUNTS_CHUNK_SIZE = 99;

// integer constants
export const MAX_I64 = BigNum.fromPrint('9223372036854775807').val;
export const MIN_I64 = BigNum.fromPrint('-9223372036854775808').val;
Loading