@triadxyz/triad-protocol 2.6.6-beta → 2.6.8-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
CHANGED
|
@@ -2,7 +2,7 @@ import { Connection, PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
|
2
2
|
import { AnchorProvider, Program, Wallet } from '@coral-xyz/anchor';
|
|
3
3
|
import BN from 'bn.js';
|
|
4
4
|
import { TriadProtocol } from './types/triad_protocol';
|
|
5
|
-
import { CreateMarketArgs, OpenOrderArgs, UserTrade, CreateCustomerArgs, MarketBidOrderArgs, CancelBidOrderArgs, CancelAskOrderArgs, PlaceBidOrderArgs, PlaceAskOrderArgs, CreatePoolArgs, BookOrder, MarketAskOrderArgs, RpcOptions,
|
|
5
|
+
import { CreateMarketArgs, OpenOrderArgs, UserTrade, CreateCustomerArgs, MarketBidOrderArgs, CancelBidOrderArgs, CancelAskOrderArgs, PlaceBidOrderArgs, PlaceAskOrderArgs, CreatePoolArgs, BookOrder, MarketAskOrderArgs, RpcOptions, UpdateCustomerFeeArgs } from './types';
|
|
6
6
|
import Stake from './stake';
|
|
7
7
|
import Poseidon from './poseidon';
|
|
8
8
|
export * from './types';
|
|
@@ -436,18 +436,21 @@ export default class TriadProtocolClient {
|
|
|
436
436
|
}>;
|
|
437
437
|
/**
|
|
438
438
|
* Collect Market Fee
|
|
439
|
-
* @param
|
|
439
|
+
* @param args.markets - The markets to collect the fee from
|
|
440
440
|
*
|
|
441
441
|
* @param options - RPC options
|
|
442
442
|
*/
|
|
443
|
-
collectMarketFee(
|
|
443
|
+
collectMarketFee(markets: {
|
|
444
|
+
mint: PublicKey;
|
|
445
|
+
marketAddress: PublicKey;
|
|
446
|
+
}[], options?: RpcOptions): Promise<string>;
|
|
444
447
|
/**
|
|
445
448
|
* Close Order Book
|
|
446
449
|
* @param marketId - The ID of the market
|
|
447
450
|
*
|
|
448
451
|
* @param options - RPC options
|
|
449
452
|
*/
|
|
450
|
-
closeOrderBook(
|
|
453
|
+
closeOrderBook(marketIds: number[], options?: RpcOptions): Promise<string>;
|
|
451
454
|
/**
|
|
452
455
|
* Create Refer
|
|
453
456
|
* @param id - The ID of the refer
|
package/dist/index.js
CHANGED
|
@@ -296,7 +296,8 @@ class TriadProtocolClient {
|
|
|
296
296
|
isFast
|
|
297
297
|
})
|
|
298
298
|
.accounts({
|
|
299
|
-
signer: this.program.provider.publicKey
|
|
299
|
+
signer: this.program.provider.publicKey,
|
|
300
|
+
customer
|
|
300
301
|
})
|
|
301
302
|
.instruction());
|
|
302
303
|
for (const market of markets) {
|
|
@@ -898,6 +899,7 @@ class TriadProtocolClient {
|
|
|
898
899
|
const sharesToSell = bn_js_1.default.min(remainingShares, availableShares);
|
|
899
900
|
if (sharesToSell.lt(new bn_js_1.default(0)))
|
|
900
901
|
continue;
|
|
902
|
+
remainingShares = remainingShares.sub(sharesToSell);
|
|
901
903
|
ixs.push(yield this.program.methods
|
|
902
904
|
.marketAskOrder({
|
|
903
905
|
shares: new bn_js_1.default(sharesToSell),
|
|
@@ -966,21 +968,24 @@ class TriadProtocolClient {
|
|
|
966
968
|
}
|
|
967
969
|
/**
|
|
968
970
|
* Collect Market Fee
|
|
969
|
-
* @param
|
|
971
|
+
* @param args.markets - The markets to collect the fee from
|
|
970
972
|
*
|
|
971
973
|
* @param options - RPC options
|
|
972
974
|
*/
|
|
973
|
-
collectMarketFee(
|
|
975
|
+
collectMarketFee(markets, options) {
|
|
974
976
|
return __awaiter(this, void 0, void 0, function* () {
|
|
975
977
|
const ixs = [];
|
|
976
|
-
|
|
977
|
-
.
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
978
|
+
for (const market of markets) {
|
|
979
|
+
ixs.push(yield this.program.methods
|
|
980
|
+
.collectMarketFee()
|
|
981
|
+
.accounts({
|
|
982
|
+
signer: this.program.provider.publicKey,
|
|
983
|
+
market: market.marketAddress,
|
|
984
|
+
mint: market.mint,
|
|
985
|
+
tokenProgram: (0, helpers_1.getTokenProgram)(market.mint)
|
|
986
|
+
})
|
|
987
|
+
.instruction());
|
|
988
|
+
}
|
|
984
989
|
return (0, sendVersionedTransaction_1.default)(this.program, ixs, options);
|
|
985
990
|
});
|
|
986
991
|
}
|
|
@@ -990,17 +995,19 @@ class TriadProtocolClient {
|
|
|
990
995
|
*
|
|
991
996
|
* @param options - RPC options
|
|
992
997
|
*/
|
|
993
|
-
closeOrderBook(
|
|
998
|
+
closeOrderBook(marketIds, options) {
|
|
994
999
|
return __awaiter(this, void 0, void 0, function* () {
|
|
995
1000
|
const ixs = [];
|
|
996
|
-
|
|
997
|
-
.
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1001
|
+
for (const marketId of marketIds) {
|
|
1002
|
+
ixs.push(yield this.program.methods
|
|
1003
|
+
.closeOrderBook()
|
|
1004
|
+
.accounts({
|
|
1005
|
+
signer: this.program.provider.publicKey,
|
|
1006
|
+
market: (0, pda_1.getMarketPDA)(this.program.programId, marketId),
|
|
1007
|
+
orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, marketId)
|
|
1008
|
+
})
|
|
1009
|
+
.instruction());
|
|
1010
|
+
}
|
|
1004
1011
|
return (0, sendVersionedTransaction_1.default)(this.program, ixs, options);
|
|
1005
1012
|
});
|
|
1006
1013
|
}
|
|
@@ -678,34 +678,6 @@
|
|
|
678
678
|
}
|
|
679
679
|
]
|
|
680
680
|
},
|
|
681
|
-
{
|
|
682
|
-
"name": "create_global",
|
|
683
|
-
"discriminator": [84, 131, 250, 135, 241, 203, 79, 0],
|
|
684
|
-
"accounts": [
|
|
685
|
-
{
|
|
686
|
-
"name": "signer",
|
|
687
|
-
"writable": true,
|
|
688
|
-
"signer": true
|
|
689
|
-
},
|
|
690
|
-
{
|
|
691
|
-
"name": "global",
|
|
692
|
-
"writable": true,
|
|
693
|
-
"pda": {
|
|
694
|
-
"seeds": [
|
|
695
|
-
{
|
|
696
|
-
"kind": "const",
|
|
697
|
-
"value": [103, 108, 111, 98, 97, 108]
|
|
698
|
-
}
|
|
699
|
-
]
|
|
700
|
-
}
|
|
701
|
-
},
|
|
702
|
-
{
|
|
703
|
-
"name": "system_program",
|
|
704
|
-
"address": "11111111111111111111111111111111"
|
|
705
|
-
}
|
|
706
|
-
],
|
|
707
|
-
"args": []
|
|
708
|
-
},
|
|
709
681
|
{
|
|
710
682
|
"name": "create_market",
|
|
711
683
|
"discriminator": [103, 226, 97, 235, 200, 188, 251, 254],
|
package/dist/types/index.d.ts
CHANGED
|
@@ -986,34 +986,6 @@ export type TriadProtocol = {
|
|
|
986
986
|
}
|
|
987
987
|
];
|
|
988
988
|
},
|
|
989
|
-
{
|
|
990
|
-
name: 'createGlobal';
|
|
991
|
-
discriminator: [84, 131, 250, 135, 241, 203, 79, 0];
|
|
992
|
-
accounts: [
|
|
993
|
-
{
|
|
994
|
-
name: 'signer';
|
|
995
|
-
writable: true;
|
|
996
|
-
signer: true;
|
|
997
|
-
},
|
|
998
|
-
{
|
|
999
|
-
name: 'global';
|
|
1000
|
-
writable: true;
|
|
1001
|
-
pda: {
|
|
1002
|
-
seeds: [
|
|
1003
|
-
{
|
|
1004
|
-
kind: 'const';
|
|
1005
|
-
value: [103, 108, 111, 98, 97, 108];
|
|
1006
|
-
}
|
|
1007
|
-
];
|
|
1008
|
-
};
|
|
1009
|
-
},
|
|
1010
|
-
{
|
|
1011
|
-
name: 'systemProgram';
|
|
1012
|
-
address: '11111111111111111111111111111111';
|
|
1013
|
-
}
|
|
1014
|
-
];
|
|
1015
|
-
args: [];
|
|
1016
|
-
},
|
|
1017
989
|
{
|
|
1018
990
|
name: 'createMarket';
|
|
1019
991
|
discriminator: [103, 226, 97, 235, 200, 188, 251, 254];
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TICKET_COLLECTION_SYMBOL = exports.POSEIDON_CORE_COLLECTION = exports.POSEIDON_COLLECTION_SYMBOL = exports.TICKET_CORE_COLLECTION = exports.SOL_MINT = exports.TRIAD_ADMIN = exports.TRD_MINT = exports.TRD_DECIMALS = void 0;
|
|
3
|
+
exports.TICKET_COLLECTION_SYMBOL = exports.POSEIDON_CORE_COLLECTION = exports.POSEIDON_COLLECTION_SYMBOL = exports.TICKET_CORE_COLLECTION = exports.SOL_MINT = exports.TRIAD_ADMIN = exports.TRD_MINT = exports.USDC_MINT = exports.TRD_DECIMALS = void 0;
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
5
|
exports.TRD_DECIMALS = 6;
|
|
6
|
+
exports.USDC_MINT = new web3_js_1.PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v');
|
|
6
7
|
exports.TRD_MINT = new web3_js_1.PublicKey('t3DohmswhKk94PPbPYwA6ZKACyY3y5kbcqeQerAJjmV');
|
|
7
8
|
exports.TRIAD_ADMIN = new web3_js_1.PublicKey('82ppCojm3yrEKgdpH8B5AmBJTU1r1uAWXFWhxvPs9UCR');
|
|
8
9
|
exports.SOL_MINT = new web3_js_1.PublicKey('So11111111111111111111111111111111111111112');
|