@triadxyz/triad-protocol 2.6.7-beta → 2.6.9-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 -4
- package/dist/index.js +26 -20
- package/dist/types/idl_triad_protocol.json +10 -38
- package/dist/types/index.d.ts +0 -4
- package/dist/types/triad_protocol.d.ts +10 -38
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.js +2 -1
- package/package.json +1 -1
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) {
|
|
@@ -967,21 +968,24 @@ class TriadProtocolClient {
|
|
|
967
968
|
}
|
|
968
969
|
/**
|
|
969
970
|
* Collect Market Fee
|
|
970
|
-
* @param
|
|
971
|
+
* @param args.markets - The markets to collect the fee from
|
|
971
972
|
*
|
|
972
973
|
* @param options - RPC options
|
|
973
974
|
*/
|
|
974
|
-
collectMarketFee(
|
|
975
|
+
collectMarketFee(markets, options) {
|
|
975
976
|
return __awaiter(this, void 0, void 0, function* () {
|
|
976
977
|
const ixs = [];
|
|
977
|
-
|
|
978
|
-
.
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
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
|
+
}
|
|
985
989
|
return (0, sendVersionedTransaction_1.default)(this.program, ixs, options);
|
|
986
990
|
});
|
|
987
991
|
}
|
|
@@ -991,17 +995,19 @@ class TriadProtocolClient {
|
|
|
991
995
|
*
|
|
992
996
|
* @param options - RPC options
|
|
993
997
|
*/
|
|
994
|
-
closeOrderBook(
|
|
998
|
+
closeOrderBook(marketIds, options) {
|
|
995
999
|
return __awaiter(this, void 0, void 0, function* () {
|
|
996
1000
|
const ixs = [];
|
|
997
|
-
|
|
998
|
-
.
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
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
|
+
}
|
|
1005
1011
|
return (0, sendVersionedTransaction_1.default)(this.program, ixs, options);
|
|
1006
1012
|
});
|
|
1007
1013
|
}
|
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
{
|
|
304
304
|
"name": "squads",
|
|
305
305
|
"writable": true,
|
|
306
|
-
"address": "
|
|
306
|
+
"address": "Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4"
|
|
307
307
|
},
|
|
308
308
|
{
|
|
309
309
|
"name": "user_trade",
|
|
@@ -405,7 +405,7 @@
|
|
|
405
405
|
{
|
|
406
406
|
"name": "squads",
|
|
407
407
|
"writable": true,
|
|
408
|
-
"address": "
|
|
408
|
+
"address": "Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4"
|
|
409
409
|
},
|
|
410
410
|
{
|
|
411
411
|
"name": "market",
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
{
|
|
435
435
|
"name": "squads",
|
|
436
436
|
"writable": true,
|
|
437
|
-
"address": "
|
|
437
|
+
"address": "Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4"
|
|
438
438
|
},
|
|
439
439
|
{
|
|
440
440
|
"name": "market",
|
|
@@ -526,7 +526,7 @@
|
|
|
526
526
|
{
|
|
527
527
|
"name": "squads",
|
|
528
528
|
"writable": true,
|
|
529
|
-
"address": "
|
|
529
|
+
"address": "Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4"
|
|
530
530
|
},
|
|
531
531
|
{
|
|
532
532
|
"name": "market",
|
|
@@ -617,7 +617,7 @@
|
|
|
617
617
|
"signer": true
|
|
618
618
|
},
|
|
619
619
|
{
|
|
620
|
-
"name": "
|
|
620
|
+
"name": "poseidon_fee_wallet",
|
|
621
621
|
"writable": true,
|
|
622
622
|
"address": "6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq"
|
|
623
623
|
},
|
|
@@ -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],
|
|
@@ -718,7 +690,7 @@
|
|
|
718
690
|
{
|
|
719
691
|
"name": "squads",
|
|
720
692
|
"writable": true,
|
|
721
|
-
"address": "
|
|
693
|
+
"address": "Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4"
|
|
722
694
|
},
|
|
723
695
|
{
|
|
724
696
|
"name": "customer",
|
|
@@ -1041,7 +1013,7 @@
|
|
|
1041
1013
|
{
|
|
1042
1014
|
"name": "squads",
|
|
1043
1015
|
"writable": true,
|
|
1044
|
-
"address": "
|
|
1016
|
+
"address": "Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4"
|
|
1045
1017
|
},
|
|
1046
1018
|
{
|
|
1047
1019
|
"name": "buyer_authority",
|
|
@@ -1134,7 +1106,7 @@
|
|
|
1134
1106
|
{
|
|
1135
1107
|
"name": "squads",
|
|
1136
1108
|
"writable": true,
|
|
1137
|
-
"address": "
|
|
1109
|
+
"address": "Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4"
|
|
1138
1110
|
},
|
|
1139
1111
|
{
|
|
1140
1112
|
"name": "seller_authority",
|
|
@@ -1223,7 +1195,7 @@
|
|
|
1223
1195
|
{
|
|
1224
1196
|
"name": "squads",
|
|
1225
1197
|
"writable": true,
|
|
1226
|
-
"address": "
|
|
1198
|
+
"address": "Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4"
|
|
1227
1199
|
},
|
|
1228
1200
|
{
|
|
1229
1201
|
"name": "user_trade",
|
|
@@ -1329,7 +1301,7 @@
|
|
|
1329
1301
|
{
|
|
1330
1302
|
"name": "squads",
|
|
1331
1303
|
"writable": true,
|
|
1332
|
-
"address": "
|
|
1304
|
+
"address": "Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4"
|
|
1333
1305
|
},
|
|
1334
1306
|
{
|
|
1335
1307
|
"name": "user_trade",
|
package/dist/types/index.d.ts
CHANGED
|
@@ -437,7 +437,7 @@ export type TriadProtocol = {
|
|
|
437
437
|
{
|
|
438
438
|
name: 'squads';
|
|
439
439
|
writable: true;
|
|
440
|
-
address: '
|
|
440
|
+
address: 'Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4';
|
|
441
441
|
},
|
|
442
442
|
{
|
|
443
443
|
name: 'userTrade';
|
|
@@ -597,7 +597,7 @@ export type TriadProtocol = {
|
|
|
597
597
|
{
|
|
598
598
|
name: 'squads';
|
|
599
599
|
writable: true;
|
|
600
|
-
address: '
|
|
600
|
+
address: 'Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4';
|
|
601
601
|
},
|
|
602
602
|
{
|
|
603
603
|
name: 'market';
|
|
@@ -626,7 +626,7 @@ export type TriadProtocol = {
|
|
|
626
626
|
{
|
|
627
627
|
name: 'squads';
|
|
628
628
|
writable: true;
|
|
629
|
-
address: '
|
|
629
|
+
address: 'Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4';
|
|
630
630
|
},
|
|
631
631
|
{
|
|
632
632
|
name: 'market';
|
|
@@ -776,7 +776,7 @@ export type TriadProtocol = {
|
|
|
776
776
|
{
|
|
777
777
|
name: 'squads';
|
|
778
778
|
writable: true;
|
|
779
|
-
address: '
|
|
779
|
+
address: 'Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4';
|
|
780
780
|
},
|
|
781
781
|
{
|
|
782
782
|
name: 'market';
|
|
@@ -925,7 +925,7 @@ export type TriadProtocol = {
|
|
|
925
925
|
signer: true;
|
|
926
926
|
},
|
|
927
927
|
{
|
|
928
|
-
name: '
|
|
928
|
+
name: 'poseidonFeeWallet';
|
|
929
929
|
writable: true;
|
|
930
930
|
address: '6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq';
|
|
931
931
|
},
|
|
@@ -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];
|
|
@@ -1026,7 +998,7 @@ export type TriadProtocol = {
|
|
|
1026
998
|
{
|
|
1027
999
|
name: 'squads';
|
|
1028
1000
|
writable: true;
|
|
1029
|
-
address: '
|
|
1001
|
+
address: 'Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4';
|
|
1030
1002
|
},
|
|
1031
1003
|
{
|
|
1032
1004
|
name: 'customer';
|
|
@@ -1378,7 +1350,7 @@ export type TriadProtocol = {
|
|
|
1378
1350
|
{
|
|
1379
1351
|
name: 'squads';
|
|
1380
1352
|
writable: true;
|
|
1381
|
-
address: '
|
|
1353
|
+
address: 'Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4';
|
|
1382
1354
|
},
|
|
1383
1355
|
{
|
|
1384
1356
|
name: 'buyerAuthority';
|
|
@@ -1500,7 +1472,7 @@ export type TriadProtocol = {
|
|
|
1500
1472
|
{
|
|
1501
1473
|
name: 'squads';
|
|
1502
1474
|
writable: true;
|
|
1503
|
-
address: '
|
|
1475
|
+
address: 'Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4';
|
|
1504
1476
|
},
|
|
1505
1477
|
{
|
|
1506
1478
|
name: 'sellerAuthority';
|
|
@@ -1618,7 +1590,7 @@ export type TriadProtocol = {
|
|
|
1618
1590
|
{
|
|
1619
1591
|
name: 'squads';
|
|
1620
1592
|
writable: true;
|
|
1621
|
-
address: '
|
|
1593
|
+
address: 'Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4';
|
|
1622
1594
|
},
|
|
1623
1595
|
{
|
|
1624
1596
|
name: 'userTrade';
|
|
@@ -1782,7 +1754,7 @@ export type TriadProtocol = {
|
|
|
1782
1754
|
{
|
|
1783
1755
|
name: 'squads';
|
|
1784
1756
|
writable: true;
|
|
1785
|
-
address: '
|
|
1757
|
+
address: 'Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4';
|
|
1786
1758
|
},
|
|
1787
1759
|
{
|
|
1788
1760
|
name: 'userTrade';
|
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');
|