Merge pull request #344 from drift-labs/wphan/pmm_fix
properly apply pmm mode
This commit is contained in:
@@ -3,7 +3,7 @@ import { PublicKey } from '@solana/web3.js';
|
|||||||
|
|
||||||
export type DLOBProvider = {
|
export type DLOBProvider = {
|
||||||
subscribe(): Promise<void>;
|
subscribe(): Promise<void>;
|
||||||
getDLOB(slot: number): Promise<DLOB>;
|
getDLOB(slot: number, protectedMakerView: boolean): Promise<DLOB>;
|
||||||
getUniqueAuthorities(): PublicKey[];
|
getUniqueAuthorities(): PublicKey[];
|
||||||
getUserAccounts(): Generator<{
|
getUserAccounts(): Generator<{
|
||||||
userAccount: UserAccount;
|
userAccount: UserAccount;
|
||||||
@@ -20,8 +20,8 @@ export function getDLOBProviderFromUserMap(userMap: UserMap): DLOBProvider {
|
|||||||
subscribe: async () => {
|
subscribe: async () => {
|
||||||
await userMap.subscribe();
|
await userMap.subscribe();
|
||||||
},
|
},
|
||||||
getDLOB: async (slot: number) => {
|
getDLOB: async (slot: number, protectedMakerView: boolean) => {
|
||||||
return await userMap.getDLOB(slot);
|
return await userMap.getDLOB(slot, protectedMakerView);
|
||||||
},
|
},
|
||||||
getUniqueAuthorities: () => {
|
getUniqueAuthorities: () => {
|
||||||
return userMap.getUniqueAuthorities();
|
return userMap.getUniqueAuthorities();
|
||||||
@@ -56,8 +56,8 @@ export function getDLOBProviderFromOrderSubscriber(
|
|||||||
subscribe: async () => {
|
subscribe: async () => {
|
||||||
await orderSubscriber.subscribe();
|
await orderSubscriber.subscribe();
|
||||||
},
|
},
|
||||||
getDLOB: async (slot: number) => {
|
getDLOB: async (slot: number, protectedMakerView: boolean) => {
|
||||||
return await orderSubscriber.getDLOB(slot);
|
return await orderSubscriber.getDLOB(slot, protectedMakerView);
|
||||||
},
|
},
|
||||||
getUniqueAuthorities: () => {
|
getUniqueAuthorities: () => {
|
||||||
const authorities = new Set<string>();
|
const authorities = new Set<string>();
|
||||||
|
|||||||
@@ -590,6 +590,7 @@ const main = async () => {
|
|||||||
|
|
||||||
const handleDebug = async (req: Request, res: Response) => {
|
const handleDebug = async (req: Request, res: Response) => {
|
||||||
const marketIndex = +req.query.marketIndex;
|
const marketIndex = +req.query.marketIndex;
|
||||||
|
const protectedMakerView = req.query.includePmm === 'true';
|
||||||
let marketType: MarketType = MarketType.PERP;
|
let marketType: MarketType = MarketType.PERP;
|
||||||
let oraclePriceData: OraclePriceData;
|
let oraclePriceData: OraclePriceData;
|
||||||
if (req.query.marketType === 'spot') {
|
if (req.query.marketType === 'spot') {
|
||||||
@@ -600,7 +601,7 @@ const main = async () => {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const slot = slotSource.getSlot();
|
const slot = slotSource.getSlot();
|
||||||
const dlob = await dlobProvider.getDLOB(slot);
|
const dlob = await dlobProvider.getDLOB(slot, protectedMakerView);
|
||||||
const l2 = dlob.getL2({
|
const l2 = dlob.getL2({
|
||||||
marketIndex,
|
marketIndex,
|
||||||
marketType,
|
marketType,
|
||||||
@@ -623,6 +624,7 @@ const main = async () => {
|
|||||||
},
|
},
|
||||||
l2: l2WithBNToStrings(l2),
|
l2: l2WithBNToStrings(l2),
|
||||||
l3,
|
l3,
|
||||||
|
includePmm: protectedMakerView,
|
||||||
};
|
};
|
||||||
|
|
||||||
res.json(state);
|
res.json(state);
|
||||||
|
|||||||
Reference in New Issue
Block a user