@triadxyz/triad-protocol 2.4.0-beta → 2.4.2-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -0
- package/dist/index.js +20 -0
- package/dist/types/idl_triad_protocol.json +24 -0
- package/dist/types/triad_protocol.d.ts +24 -0
- package/dist/utils/helpers.js +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -410,4 +410,11 @@ export default class TriadProtocolClient {
|
|
|
410
410
|
* @param options - RPC options
|
|
411
411
|
*/
|
|
412
412
|
collectMarketFee({ marketId, feeRecipient }: CollectMarketFeeArgs, options?: RpcOptions): Promise<string>;
|
|
413
|
+
/**
|
|
414
|
+
* Close Order Book
|
|
415
|
+
* @param marketId - The ID of the market
|
|
416
|
+
*
|
|
417
|
+
* @param options - RPC options
|
|
418
|
+
*/
|
|
419
|
+
closeOrderBook(marketId: number, options?: RpcOptions): Promise<string>;
|
|
413
420
|
}
|
package/dist/index.js
CHANGED
|
@@ -907,5 +907,25 @@ class TriadProtocolClient {
|
|
|
907
907
|
return (0, sendVersionedTransaction_1.default)(this.program, ixs, options);
|
|
908
908
|
});
|
|
909
909
|
}
|
|
910
|
+
/**
|
|
911
|
+
* Close Order Book
|
|
912
|
+
* @param marketId - The ID of the market
|
|
913
|
+
*
|
|
914
|
+
* @param options - RPC options
|
|
915
|
+
*/
|
|
916
|
+
closeOrderBook(marketId, options) {
|
|
917
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
918
|
+
const ixs = [];
|
|
919
|
+
ixs.push(yield this.program.methods
|
|
920
|
+
.closeOrderBook()
|
|
921
|
+
.accounts({
|
|
922
|
+
signer: this.program.provider.publicKey,
|
|
923
|
+
market: (0, pda_1.getMarketPDA)(this.program.programId, marketId),
|
|
924
|
+
orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, marketId)
|
|
925
|
+
})
|
|
926
|
+
.instruction());
|
|
927
|
+
return (0, sendVersionedTransaction_1.default)(this.program, ixs, options);
|
|
928
|
+
});
|
|
929
|
+
}
|
|
910
930
|
}
|
|
911
931
|
exports.default = TriadProtocolClient;
|
|
@@ -394,6 +394,30 @@
|
|
|
394
394
|
}
|
|
395
395
|
]
|
|
396
396
|
},
|
|
397
|
+
{
|
|
398
|
+
"name": "close_order_book",
|
|
399
|
+
"discriminator": [219, 134, 73, 219, 180, 7, 94, 206],
|
|
400
|
+
"accounts": [
|
|
401
|
+
{
|
|
402
|
+
"name": "signer",
|
|
403
|
+
"writable": true,
|
|
404
|
+
"signer": true
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"name": "market",
|
|
408
|
+
"writable": true
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
"name": "order_book",
|
|
412
|
+
"writable": true
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"name": "system_program",
|
|
416
|
+
"address": "11111111111111111111111111111111"
|
|
417
|
+
}
|
|
418
|
+
],
|
|
419
|
+
"args": []
|
|
420
|
+
},
|
|
397
421
|
{
|
|
398
422
|
"name": "collect_market_fee",
|
|
399
423
|
"discriminator": [139, 4, 96, 182, 216, 250, 122, 79],
|
|
@@ -586,6 +586,30 @@ export type TriadProtocol = {
|
|
|
586
586
|
}
|
|
587
587
|
];
|
|
588
588
|
},
|
|
589
|
+
{
|
|
590
|
+
name: 'closeOrderBook';
|
|
591
|
+
discriminator: [219, 134, 73, 219, 180, 7, 94, 206];
|
|
592
|
+
accounts: [
|
|
593
|
+
{
|
|
594
|
+
name: 'signer';
|
|
595
|
+
writable: true;
|
|
596
|
+
signer: true;
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
name: 'market';
|
|
600
|
+
writable: true;
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
name: 'orderBook';
|
|
604
|
+
writable: true;
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
name: 'systemProgram';
|
|
608
|
+
address: '11111111111111111111111111111111';
|
|
609
|
+
}
|
|
610
|
+
];
|
|
611
|
+
args: [];
|
|
612
|
+
},
|
|
589
613
|
{
|
|
590
614
|
name: 'collectMarketFee';
|
|
591
615
|
discriminator: [139, 4, 96, 182, 216, 250, 122, 79];
|
package/dist/utils/helpers.js
CHANGED
|
@@ -178,10 +178,10 @@ const getOrderDirection = (direction) => {
|
|
|
178
178
|
};
|
|
179
179
|
exports.getOrderDirection = getOrderDirection;
|
|
180
180
|
const getOrderDirectionFromNumber = (direction) => {
|
|
181
|
-
if (direction ===
|
|
181
|
+
if (direction === 0) {
|
|
182
182
|
return types_1.OrderDirection.HYPE;
|
|
183
183
|
}
|
|
184
|
-
if (direction ===
|
|
184
|
+
if (direction === 1) {
|
|
185
185
|
return types_1.OrderDirection.FLOP;
|
|
186
186
|
}
|
|
187
187
|
};
|