@project-serum/serum
Advanced tools
Comparing version 0.13.52 to 0.13.53
@@ -11,3 +11,3 @@ export function encodeInstruction(instruction: any): Buffer; | ||
export class DexInstructions { | ||
static initializeMarket({ market, requestQueue, eventQueue, bids, asks, baseVault, quoteVault, baseMint, quoteMint, baseLotSize, quoteLotSize, feeRateBps, vaultSignerNonce, quoteDustThreshold, programId, authority, }: { | ||
static initializeMarket({ market, requestQueue, eventQueue, bids, asks, baseVault, quoteVault, baseMint, quoteMint, baseLotSize, quoteLotSize, feeRateBps, vaultSignerNonce, quoteDustThreshold, programId, authority, pruneAuthority, }: { | ||
market: any; | ||
@@ -28,3 +28,4 @@ requestQueue: any; | ||
programId: any; | ||
authority: any; | ||
authority?: any; | ||
pruneAuthority?: any; | ||
}): TransactionInstruction; | ||
@@ -143,2 +144,12 @@ static newOrder({ market, openOrders, payer, owner, requestQueue, baseVault, quoteVault, side, limitPrice, maxQuantity, orderType, clientId, programId, feeDiscountPubkey, }: { | ||
}): TransactionInstruction; | ||
static prune({ market, bids, asks, eventQueue, pruneAuthority, openOrders, openOrdersOwner, programId, }: { | ||
market: any; | ||
bids: any; | ||
asks: any; | ||
eventQueue: any; | ||
pruneAuthority: any; | ||
openOrders: any; | ||
openOrdersOwner: any; | ||
programId: any; | ||
}): TransactionInstruction; | ||
} | ||
@@ -145,0 +156,0 @@ import { VersionedLayout } from "./layout"; |
@@ -56,2 +56,3 @@ "use strict"; | ||
exports.INSTRUCTION_LAYOUT.inner.addVariant(15, buffer_layout_1.struct([]), 'initOpenOrders'); | ||
exports.INSTRUCTION_LAYOUT.inner.addVariant(16, buffer_layout_1.struct([]), 'prune'); | ||
function encodeInstruction(instruction) { | ||
@@ -67,3 +68,3 @@ const b = Buffer.alloc(100); | ||
class DexInstructions { | ||
static initializeMarket({ market, requestQueue, eventQueue, bids, asks, baseVault, quoteVault, baseMint, quoteMint, baseLotSize, quoteLotSize, feeRateBps, vaultSignerNonce, quoteDustThreshold, programId, authority, }) { | ||
static initializeMarket({ market, requestQueue, eventQueue, bids, asks, baseVault, quoteVault, baseMint, quoteMint, baseLotSize, quoteLotSize, feeRateBps, vaultSignerNonce, quoteDustThreshold, programId, authority = undefined, pruneAuthority = undefined, }) { | ||
let rentSysvar = new web3_js_1.PublicKey('SysvarRent111111111111111111111111111111111'); | ||
@@ -81,5 +82,9 @@ return new web3_js_1.TransactionInstruction({ | ||
{ pubkey: quoteMint, isSigner: false, isWritable: false }, | ||
{ pubkey: rentSysvar, isSigner: false, isWritable: false }, | ||
].concat(authority | ||
{ pubkey: quoteMint, isSigner: false, isWritable: false }, | ||
] | ||
.concat(authority | ||
? { pubkey: authority, isSigner: false, isWritable: false } | ||
: []) | ||
.concat(authority && pruneAuthority | ||
? { pubkey: pruneAuthority, isSigner: false, isWritable: false } | ||
: []), | ||
@@ -318,4 +323,23 @@ programId, | ||
} | ||
static prune({ market, bids, asks, eventQueue, pruneAuthority, openOrders, openOrdersOwner, programId, }) { | ||
const keys = [ | ||
{ pubkey: market, isSigner: false, isWritable: true }, | ||
{ pubkey: bids, isSigner: false, isWritable: true }, | ||
{ pubkey: asks, isSigner: false, isWritable: true }, | ||
// Keep signer false so that one can use a PDA. | ||
{ pubkey: pruneAuthority, isSigner: false, isWritable: false }, | ||
{ pubkey: openOrders, isSigner: false, isWritable: true }, | ||
{ pubkey: openOrdersOwner, isSigner: false, isWritable: false }, | ||
{ pubkey: eventQueue, isSigner: false, isWritable: true }, | ||
]; | ||
return new web3_js_1.TransactionInstruction({ | ||
keys, | ||
programId, | ||
data: encodeInstruction({ | ||
prune: {}, | ||
}), | ||
}); | ||
} | ||
} | ||
exports.DexInstructions = DexInstructions; | ||
//# sourceMappingURL=instructions.js.map |
@@ -26,2 +26,3 @@ import BN from 'bn.js'; | ||
closeOpenOrders(openOrders: PublicKey, owner: PublicKey, solWallet: PublicKey): TransactionInstruction; | ||
prune(openOrders: PublicKey, openOrdersOwner: PublicKey): TransactionInstruction; | ||
private proxy; | ||
@@ -28,0 +29,0 @@ } |
@@ -129,2 +129,16 @@ "use strict"; | ||
} | ||
prune(openOrders, openOrdersOwner) { | ||
const ix = instructions_1.DexInstructions.prune({ | ||
market: this._market.address, | ||
bids: this._market.decoded.bids, | ||
asks: this._market.decoded.asks, | ||
eventQueue: this._market.decoded.eventQueue, | ||
pruneAuthority: this._market.decoded.pruneAuthority, | ||
openOrders, | ||
openOrdersOwner, | ||
programId: this._proxyProgramId, | ||
}); | ||
this._middlewares.forEach((mw) => mw.prune(ix)); | ||
return this.proxy(ix); | ||
} | ||
// Adds the serum dex account to the instruction so that proxies can | ||
@@ -131,0 +145,0 @@ // relay (CPI requires the executable account). |
@@ -9,2 +9,3 @@ import { PublicKey, TransactionInstruction } from '@solana/web3.js'; | ||
closeOpenOrders(ix: TransactionInstruction): void; | ||
prune(ix: TransactionInstruction): void; | ||
} | ||
@@ -26,2 +27,3 @@ export declare class OpenOrdersPda implements Middleware { | ||
closeOpenOrders(ix: TransactionInstruction): void; | ||
prune(ix: TransactionInstruction): void; | ||
} | ||
@@ -35,2 +37,3 @@ export declare class ReferralFees implements Middleware { | ||
closeOpenOrders(_ix: TransactionInstruction): void; | ||
prune(_ix: TransactionInstruction): void; | ||
} | ||
@@ -44,4 +47,5 @@ export declare class Logger implements Middleware { | ||
closeOpenOrders(ix: TransactionInstruction): void; | ||
prune(ix: TransactionInstruction): void; | ||
ixToDisplay(ix: TransactionInstruction): Object; | ||
} | ||
//# sourceMappingURL=middleware.d.ts.map |
@@ -132,2 +132,5 @@ "use strict"; | ||
} | ||
prune(ix) { | ||
ix.data = Buffer.concat([Buffer.from([6]), ix.data]); | ||
} | ||
} | ||
@@ -148,2 +151,4 @@ exports.OpenOrdersPda = OpenOrdersPda; | ||
closeOpenOrders(_ix) { } | ||
// eslint-disable-next-line | ||
prune(_ix) { } | ||
} | ||
@@ -170,2 +175,5 @@ exports.ReferralFees = ReferralFees; | ||
} | ||
prune(ix) { | ||
console.log('Proxying prune', this.ixToDisplay(ix)); | ||
} | ||
ixToDisplay(ix) { | ||
@@ -172,0 +180,0 @@ const keys = ix.keys.map((i) => { |
@@ -88,2 +88,3 @@ "use strict"; | ||
layout_1.publicKeyLayout('authority'), | ||
layout_1.publicKeyLayout('pruneAuthority'), | ||
buffer_layout_1.blob(7), | ||
@@ -135,3 +136,3 @@ ]); | ||
} | ||
const decoded = this.getLayout(programId).decode(data); | ||
const decoded = (layoutOverride !== null && layoutOverride !== void 0 ? layoutOverride : this.getLayout(programId)).decode(data); | ||
if (!decoded.accountFlags.initialized || | ||
@@ -138,0 +139,0 @@ !decoded.accountFlags.market || |
{ | ||
"name": "@project-serum/serum", | ||
"version": "0.13.52", | ||
"version": "0.13.53", | ||
"description": "Library for interacting with the serum dex", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
290471
4663