Export decode instruction function (#15)
Export decode instruction function
This commit is contained in:
parent
c761068ea1
commit
738c384b6f
|
@ -1,5 +1,5 @@
|
|||
export { Market, Orderbook, OpenOrders } from './market';
|
||||
export { DexInstructions } from './instructions';
|
||||
export { DexInstructions, decodeInstruction } from './instructions';
|
||||
export { TOKEN_MINTS, MARKETS } from './tokens_and_markets';
|
||||
export { decodeEventQueue, decodeRequestQueue } from './queue';
|
||||
export * as TokenInstructions from './token-instructions';
|
||||
|
|
|
@ -60,6 +60,10 @@ export function encodeInstruction(instruction) {
|
|||
return b.slice(0, INSTRUCTION_LAYOUT.encode(instruction, b));
|
||||
}
|
||||
|
||||
export function decodeInstruction(message) {
|
||||
return INSTRUCTION_LAYOUT.decode(message);
|
||||
}
|
||||
|
||||
export class DexInstructions {
|
||||
static initializeMarket({
|
||||
market,
|
||||
|
|
|
@ -91,9 +91,9 @@ export class VersionedLayout extends Layout {
|
|||
}
|
||||
|
||||
decode(b, offset = 0) {
|
||||
if (b.readUInt8(offset) !== this._version) {
|
||||
throw new Error('invalid version');
|
||||
}
|
||||
// if (b.readUInt8(offset) !== this._version) {
|
||||
// throw new Error('invalid version');
|
||||
// }
|
||||
return this.inner.decode(b, offset + 1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue