Update DEX program ID and expose makeMatchOrdersInstruction
This commit is contained in:
parent
438c5eb469
commit
91cd66b4df
|
@ -11,7 +11,7 @@ import { PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|||
import { TOKEN_PROGRAM_ID } from './token-instructions';
|
||||
|
||||
export const DEX_PROGRAM_ID = new PublicKey(
|
||||
'44LJB33bthJ9CJ9AhD3jvd8WgUyrxrcNUZYDjuqcsd8D',
|
||||
'8FxUAcZc27zBH39TfH1G7qVqDTZn3Bm4ym1qxWnAsdKa',
|
||||
);
|
||||
|
||||
export const INSTRUCTION_LAYOUT = new VersionedLayout(
|
||||
|
|
|
@ -10,6 +10,7 @@ import {
|
|||
PublicKey,
|
||||
SystemProgram,
|
||||
Transaction,
|
||||
TransactionInstruction,
|
||||
TransactionSignature,
|
||||
} from '@solana/web3.js';
|
||||
import { decodeEventQueue, decodeRequestQueue } from './queue';
|
||||
|
@ -458,20 +459,22 @@ export class Market {
|
|||
return this.priceLotsToNumber(new BN(1));
|
||||
}
|
||||
|
||||
makeMatchOrdersInstruction(limit: number): TransactionInstruction {
|
||||
return DexInstructions.matchOrders({
|
||||
market: this.address,
|
||||
requestQueue: this._decoded.requestQueue,
|
||||
eventQueue: this._decoded.eventQueue,
|
||||
bids: this._decoded.bids,
|
||||
asks: this._decoded.asks,
|
||||
baseVault: this._decoded.baseVault,
|
||||
quoteVault: this._decoded.quoteVault,
|
||||
limit,
|
||||
});
|
||||
}
|
||||
|
||||
async matchOrders(connection: Connection, feePayer: Account, limit: number) {
|
||||
const tx = new Transaction();
|
||||
tx.add(
|
||||
DexInstructions.matchOrders({
|
||||
market: this.address,
|
||||
requestQueue: this._decoded.requestQueue,
|
||||
eventQueue: this._decoded.eventQueue,
|
||||
bids: this._decoded.bids,
|
||||
asks: this._decoded.asks,
|
||||
baseVault: this._decoded.baseVault,
|
||||
quoteVault: this._decoded.quoteVault,
|
||||
limit,
|
||||
}),
|
||||
);
|
||||
tx.add(this.makeMatchOrdersInstruction(limit));
|
||||
return await this._sendTransaction(connection, tx, [feePayer]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue