UNPKG

@drift-labs/sdk

Version:
16 lines (15 loc) 566 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getMarketAddress = void 0; const pda_1 = require("./pda"); const CACHE = new Map(); async function getMarketAddress(programId, marketIndex) { const cacheKey = `${programId.toString()}-${marketIndex.toString()}`; if (CACHE.has(cacheKey)) { return CACHE.get(cacheKey); } const publicKey = await (0, pda_1.getPerpMarketPublicKey)(programId, marketIndex); CACHE.set(cacheKey, publicKey); return publicKey; } exports.getMarketAddress = getMarketAddress;