bump sdk, new user stats map loading
This commit is contained in:
@@ -55,8 +55,8 @@ const driftClientPublicKey = new PublicKey(sdkConfig.DRIFT_PROGRAM_ID);
|
||||
let lastSeenSlot = 0;
|
||||
|
||||
/********** initializing driftClient as usual **********/
|
||||
var accountSubscription: DriftClientSubscriptionConfig;
|
||||
var logProviderConfig: LogProviderConfig;
|
||||
let accountSubscription: DriftClientSubscriptionConfig;
|
||||
let logProviderConfig: LogProviderConfig;
|
||||
if (useWebsocket) {
|
||||
accountSubscription = {
|
||||
type: 'websocket',
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"main": "lib/index.js",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@drift-labs/sdk": "2.48.0-beta.2",
|
||||
"@drift-labs/sdk": "2.48.0-beta.4",
|
||||
"@opentelemetry/api": "^1.1.0",
|
||||
"@opentelemetry/auto-instrumentations-node": "^0.31.1",
|
||||
"@opentelemetry/exporter-prometheus": "^0.31.0",
|
||||
|
||||
40
src/index.ts
40
src/index.ts
@@ -16,7 +16,10 @@ import {
|
||||
DLOBOrdersCoder,
|
||||
DLOBSubscriber,
|
||||
DriftClient,
|
||||
DriftClientSubscriptionConfig,
|
||||
DriftEnv,
|
||||
SlotSource,
|
||||
SlotSubscriber,
|
||||
UserMap,
|
||||
UserStatsMap,
|
||||
Wallet,
|
||||
@@ -214,7 +217,6 @@ const main = async () => {
|
||||
programID: clearingHousePublicKey,
|
||||
accountSubscription,
|
||||
env: driftEnv,
|
||||
userStats: true,
|
||||
});
|
||||
|
||||
const dlobCoder = DLOBOrdersCoder.create();
|
||||
@@ -229,24 +231,22 @@ const main = async () => {
|
||||
lastSlotReceived = slotSource.getSlot();
|
||||
}, ORDERBOOK_UPDATE_INTERVAL);
|
||||
|
||||
const userStatsMap = new UserStatsMap(driftClient);
|
||||
|
||||
logger.info(`Initializing userMap...`);
|
||||
const initUserMapStart = Date.now();
|
||||
const userMap = new UserMap(
|
||||
driftClient,
|
||||
driftClient.userAccountSubscriptionConfig,
|
||||
false
|
||||
false,
|
||||
async (authorities) => {
|
||||
await userStatsMap.sync(authorities);
|
||||
},
|
||||
{ hasOpenOrders: true }
|
||||
);
|
||||
await userMap.subscribe();
|
||||
logger.info(`userMap initialized in ${Date.now() - initUserMapStart} ms`);
|
||||
|
||||
logger.info(`Initializing userStatsMap...`);
|
||||
const initUserStatsMapStart = Date.now();
|
||||
const userStatsMap = new UserStatsMap(driftClient, accountSubscription);
|
||||
await userStatsMap.subscribe();
|
||||
logger.info(
|
||||
`userStatsMap initialized in ${Date.now() - initUserStatsMapStart} ms`
|
||||
);
|
||||
|
||||
logger.info(`Initializing DLOBSubscriber...`);
|
||||
const initDlobSubscriberStart = Date.now();
|
||||
const dlobSubscriber = new DLOBSubscriber({
|
||||
@@ -650,11 +650,11 @@ const main = async () => {
|
||||
numVammOrders: parseInt((numVammOrders ?? '100') as string),
|
||||
fallbackL2Generators: isSpot
|
||||
? [
|
||||
`${includePhoenix}`.toLowerCase() === 'true' &&
|
||||
MARKET_SUBSCRIBERS[normedMarketIndex].phoenix,
|
||||
`${includeSerum}`.toLowerCase() === 'true' &&
|
||||
MARKET_SUBSCRIBERS[normedMarketIndex].serum,
|
||||
].filter((a) => !!a)
|
||||
`${includePhoenix}`.toLowerCase() === 'true' &&
|
||||
MARKET_SUBSCRIBERS[normedMarketIndex].phoenix,
|
||||
`${includeSerum}`.toLowerCase() === 'true' &&
|
||||
MARKET_SUBSCRIBERS[normedMarketIndex].serum,
|
||||
].filter((a) => !!a)
|
||||
: [],
|
||||
});
|
||||
|
||||
@@ -768,11 +768,11 @@ const main = async () => {
|
||||
: `${normedParam['includeVamm']}`.toLowerCase() === 'true',
|
||||
fallbackL2Generators: isSpot
|
||||
? [
|
||||
`${normedParam['includePhoenix']}`.toLowerCase() === 'true' &&
|
||||
MARKET_SUBSCRIBERS[normedMarketIndex].phoenix,
|
||||
`${normedParam['includeSerum']}`.toLowerCase() === 'true' &&
|
||||
MARKET_SUBSCRIBERS[normedMarketIndex].serum,
|
||||
].filter((a) => !!a)
|
||||
`${normedParam['includePhoenix']}`.toLowerCase() === 'true' &&
|
||||
MARKET_SUBSCRIBERS[normedMarketIndex].phoenix,
|
||||
`${normedParam['includeSerum']}`.toLowerCase() === 'true' &&
|
||||
MARKET_SUBSCRIBERS[normedMarketIndex].serum,
|
||||
].filter((a) => !!a)
|
||||
: [],
|
||||
});
|
||||
|
||||
|
||||
@@ -80,10 +80,10 @@
|
||||
enabled "2.0.x"
|
||||
kuler "^2.0.0"
|
||||
|
||||
"@drift-labs/sdk@2.48.0-beta.2":
|
||||
version "2.48.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@drift-labs/sdk/-/sdk-2.48.0-beta.2.tgz#447cdd132e99e7283eecb96adbce6709724f4e3f"
|
||||
integrity sha512-zp0OxvuwDDLoqN1GfknPuEDCwPVzLRvRVpnrJFzeTNgBS1ish0ZmqtM5URFMHuXJ9ZaEt3gezqhhlqRID917rQ==
|
||||
"@drift-labs/sdk@2.48.0-beta.4":
|
||||
version "2.48.0-beta.4"
|
||||
resolved "https://registry.yarnpkg.com/@drift-labs/sdk/-/sdk-2.48.0-beta.4.tgz#80395976b04d59fa5340e5c9a7839c72b3ee3c2e"
|
||||
integrity sha512-gsxKL1xOAtOlybDaI+kAvA070WfqnkaGCPyAs87gILYDAVrCyoGX37EE6e3v098X3qsR0VIAjaVlCqz4nZfPwg==
|
||||
dependencies:
|
||||
"@coral-xyz/anchor" "0.28.1-beta.2"
|
||||
"@ellipsis-labs/phoenix-sdk" "^1.4.2"
|
||||
|
||||
Reference in New Issue
Block a user