@triadxyz/triad-protocol 0.6.5-beta.devnet → 0.6.7-beta.devnet
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/local-test.js +1 -5
- package/dist/trade.js +3 -3
- package/dist/types/idl_triad_protocol.json +24 -57
- package/dist/types/trade.d.ts +0 -1
- package/dist/types/triad_protocol.d.ts +24 -86
- package/package.json +1 -1
package/dist/local-test.js
CHANGED
|
@@ -145,14 +145,9 @@ const updateBoost = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
145
145
|
console.log(updateBoostResponse);
|
|
146
146
|
});
|
|
147
147
|
const getMarkets = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
148
|
-
// const acc = await connection.getAccountInfo(
|
|
149
|
-
// new PublicKey('2J7uYG9ND5pf4px8ABZBh2QtB5wrhkgRcSZvVDA3NZxk')
|
|
150
|
-
// )
|
|
151
|
-
// console.log(JSON.stringify(acc.data, null, 2))
|
|
152
148
|
const markets = yield triadProtocol.trade.getMarkets();
|
|
153
149
|
console.log(markets);
|
|
154
150
|
});
|
|
155
|
-
getMarkets();
|
|
156
151
|
const initializeAllMarkets = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
157
152
|
for (const market of markets) {
|
|
158
153
|
try {
|
|
@@ -183,6 +178,7 @@ const openOrder = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
183
178
|
console.log(response);
|
|
184
179
|
}
|
|
185
180
|
});
|
|
181
|
+
openOrder();
|
|
186
182
|
const closeOrder = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
187
183
|
for (const order of yield getOrders()) {
|
|
188
184
|
try {
|
package/dist/trade.js
CHANGED
|
@@ -40,7 +40,6 @@ class Trade {
|
|
|
40
40
|
totalHypeShares: account.totalHypeShares.toNumber(),
|
|
41
41
|
totalFlopShares: account.totalFlopShares.toNumber(),
|
|
42
42
|
totalVolume: account.totalVolume.toNumber(),
|
|
43
|
-
vaultTokenAccount: account.vaultTokenAccount.toString(),
|
|
44
43
|
mint: account.mint.toString(),
|
|
45
44
|
ts: account.ts.toNumber(),
|
|
46
45
|
updateTs: account.updateTs.toNumber(),
|
|
@@ -69,7 +68,6 @@ class Trade {
|
|
|
69
68
|
totalHypeShares: account.totalHypeShares.toNumber(),
|
|
70
69
|
totalFlopShares: account.totalFlopShares.toNumber(),
|
|
71
70
|
totalVolume: account.totalVolume.toNumber(),
|
|
72
|
-
vaultTokenAccount: account.vaultTokenAccount.toString(),
|
|
73
71
|
mint: account.mint.toString(),
|
|
74
72
|
ts: account.ts.toNumber(),
|
|
75
73
|
updateTs: account.updateTs.toNumber(),
|
|
@@ -97,7 +95,7 @@ class Trade {
|
|
|
97
95
|
})
|
|
98
96
|
.accounts({
|
|
99
97
|
signer: this.provider.publicKey,
|
|
100
|
-
mint:
|
|
98
|
+
mint: this.mint
|
|
101
99
|
});
|
|
102
100
|
if (options === null || options === void 0 ? void 0 : options.microLamports) {
|
|
103
101
|
method.postInstructions([
|
|
@@ -118,6 +116,8 @@ class Trade {
|
|
|
118
116
|
openOrder(marketId, args, options) {
|
|
119
117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
120
118
|
const marketPDA = (0, helpers_1.getMarketAddressSync)(this.program.programId, marketId);
|
|
119
|
+
const feeVualtPDA = (0, helpers_1.getFeeVaultAddressSync)(this.program.programId, marketPDA);
|
|
120
|
+
const userTradePDA = (0, helpers_1.getUserTradeAddressSync)(this.program.programId, this.provider.publicKey);
|
|
121
121
|
const ixs = [];
|
|
122
122
|
try {
|
|
123
123
|
const userTradePDA = (0, helpers_1.getUserTradeAddressSync)(this.program.programId, this.provider.publicKey);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"address": "
|
|
2
|
+
"address": "7nGGR51pBSUrpMPYVf9LWnNwaApz7N9VaJfDAJrihXts",
|
|
3
3
|
"metadata": {
|
|
4
4
|
"name": "triad_protocol",
|
|
5
5
|
"version": "0.1.4",
|
|
@@ -347,13 +347,13 @@
|
|
|
347
347
|
}
|
|
348
348
|
},
|
|
349
349
|
{
|
|
350
|
-
"name": "
|
|
350
|
+
"name": "fee_vault_ata",
|
|
351
351
|
"writable": true,
|
|
352
352
|
"pda": {
|
|
353
353
|
"seeds": [
|
|
354
354
|
{
|
|
355
355
|
"kind": "account",
|
|
356
|
-
"path": "
|
|
356
|
+
"path": "fee_vault"
|
|
357
357
|
},
|
|
358
358
|
{
|
|
359
359
|
"kind": "account",
|
|
@@ -378,34 +378,6 @@
|
|
|
378
378
|
"name": "mint",
|
|
379
379
|
"writable": true
|
|
380
380
|
},
|
|
381
|
-
{
|
|
382
|
-
"name": "vault_token_account",
|
|
383
|
-
"writable": true,
|
|
384
|
-
"pda": {
|
|
385
|
-
"seeds": [
|
|
386
|
-
{
|
|
387
|
-
"kind": "account",
|
|
388
|
-
"path": "market"
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
"kind": "account",
|
|
392
|
-
"path": "token_program"
|
|
393
|
-
},
|
|
394
|
-
{
|
|
395
|
-
"kind": "account",
|
|
396
|
-
"path": "mint"
|
|
397
|
-
}
|
|
398
|
-
],
|
|
399
|
-
"program": {
|
|
400
|
-
"kind": "const",
|
|
401
|
-
"value": [
|
|
402
|
-
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
|
|
403
|
-
13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
|
|
404
|
-
219, 233, 248, 89
|
|
405
|
-
]
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
},
|
|
409
381
|
{
|
|
410
382
|
"name": "token_program",
|
|
411
383
|
"address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
@@ -459,6 +431,22 @@
|
|
|
459
431
|
"name": "market",
|
|
460
432
|
"writable": true
|
|
461
433
|
},
|
|
434
|
+
{
|
|
435
|
+
"name": "fee_vault",
|
|
436
|
+
"writable": true,
|
|
437
|
+
"pda": {
|
|
438
|
+
"seeds": [
|
|
439
|
+
{
|
|
440
|
+
"kind": "const",
|
|
441
|
+
"value": [102, 101, 101, 95, 118, 97, 117, 108, 116]
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"kind": "account",
|
|
445
|
+
"path": "market"
|
|
446
|
+
}
|
|
447
|
+
]
|
|
448
|
+
}
|
|
449
|
+
},
|
|
462
450
|
{
|
|
463
451
|
"name": "mint",
|
|
464
452
|
"writable": true
|
|
@@ -519,22 +507,6 @@
|
|
|
519
507
|
}
|
|
520
508
|
}
|
|
521
509
|
},
|
|
522
|
-
{
|
|
523
|
-
"name": "fee_vault",
|
|
524
|
-
"writable": true,
|
|
525
|
-
"pda": {
|
|
526
|
-
"seeds": [
|
|
527
|
-
{
|
|
528
|
-
"kind": "const",
|
|
529
|
-
"value": [102, 101, 101, 95, 118, 97, 117, 108, 116]
|
|
530
|
-
},
|
|
531
|
-
{
|
|
532
|
-
"kind": "account",
|
|
533
|
-
"path": "market"
|
|
534
|
-
}
|
|
535
|
-
]
|
|
536
|
-
}
|
|
537
|
-
},
|
|
538
510
|
{
|
|
539
511
|
"name": "fee_ata",
|
|
540
512
|
"writable": true,
|
|
@@ -1498,11 +1470,6 @@
|
|
|
1498
1470
|
"docs": ["Total trading volume (in TRD)"],
|
|
1499
1471
|
"type": "u64"
|
|
1500
1472
|
},
|
|
1501
|
-
{
|
|
1502
|
-
"name": "vault_token_account",
|
|
1503
|
-
"docs": ["Vault token account of $TRD"],
|
|
1504
|
-
"type": "pubkey"
|
|
1505
|
-
},
|
|
1506
1473
|
{
|
|
1507
1474
|
"name": "mint",
|
|
1508
1475
|
"docs": ["Mint $TRD token"],
|
|
@@ -1513,6 +1480,10 @@
|
|
|
1513
1480
|
"docs": ["Timestamp of the init"],
|
|
1514
1481
|
"type": "i64"
|
|
1515
1482
|
},
|
|
1483
|
+
{
|
|
1484
|
+
"name": "update_ts",
|
|
1485
|
+
"type": "i64"
|
|
1486
|
+
},
|
|
1516
1487
|
{
|
|
1517
1488
|
"name": "open_orders_count",
|
|
1518
1489
|
"docs": ["Total number of open orders in this market"],
|
|
@@ -1544,14 +1515,10 @@
|
|
|
1544
1515
|
"name": "is_official",
|
|
1545
1516
|
"type": "bool"
|
|
1546
1517
|
},
|
|
1547
|
-
{
|
|
1548
|
-
"name": "update_ts",
|
|
1549
|
-
"type": "i64"
|
|
1550
|
-
},
|
|
1551
1518
|
{
|
|
1552
1519
|
"name": "padding",
|
|
1553
1520
|
"type": {
|
|
1554
|
-
"array": ["u8",
|
|
1521
|
+
"array": ["u8", 232]
|
|
1555
1522
|
}
|
|
1556
1523
|
}
|
|
1557
1524
|
]
|
package/dist/types/trade.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* IDL can be found at `target/idl/triad_protocol.json`.
|
|
6
6
|
*/
|
|
7
7
|
export type TriadProtocol = {
|
|
8
|
-
address: '
|
|
8
|
+
address: '7nGGR51pBSUrpMPYVf9LWnNwaApz7N9VaJfDAJrihXts';
|
|
9
9
|
metadata: {
|
|
10
10
|
name: 'triadProtocol';
|
|
11
11
|
version: '0.1.4';
|
|
@@ -469,13 +469,13 @@ export type TriadProtocol = {
|
|
|
469
469
|
};
|
|
470
470
|
},
|
|
471
471
|
{
|
|
472
|
-
name: '
|
|
472
|
+
name: 'feeVaultAta';
|
|
473
473
|
writable: true;
|
|
474
474
|
pda: {
|
|
475
475
|
seeds: [
|
|
476
476
|
{
|
|
477
477
|
kind: 'account';
|
|
478
|
-
path: '
|
|
478
|
+
path: 'feeVault';
|
|
479
479
|
},
|
|
480
480
|
{
|
|
481
481
|
kind: 'account';
|
|
@@ -529,63 +529,6 @@ export type TriadProtocol = {
|
|
|
529
529
|
name: 'mint';
|
|
530
530
|
writable: true;
|
|
531
531
|
},
|
|
532
|
-
{
|
|
533
|
-
name: 'vaultTokenAccount';
|
|
534
|
-
writable: true;
|
|
535
|
-
pda: {
|
|
536
|
-
seeds: [
|
|
537
|
-
{
|
|
538
|
-
kind: 'account';
|
|
539
|
-
path: 'market';
|
|
540
|
-
},
|
|
541
|
-
{
|
|
542
|
-
kind: 'account';
|
|
543
|
-
path: 'tokenProgram';
|
|
544
|
-
},
|
|
545
|
-
{
|
|
546
|
-
kind: 'account';
|
|
547
|
-
path: 'mint';
|
|
548
|
-
}
|
|
549
|
-
];
|
|
550
|
-
program: {
|
|
551
|
-
kind: 'const';
|
|
552
|
-
value: [
|
|
553
|
-
140,
|
|
554
|
-
151,
|
|
555
|
-
37,
|
|
556
|
-
143,
|
|
557
|
-
78,
|
|
558
|
-
36,
|
|
559
|
-
137,
|
|
560
|
-
241,
|
|
561
|
-
187,
|
|
562
|
-
61,
|
|
563
|
-
16,
|
|
564
|
-
41,
|
|
565
|
-
20,
|
|
566
|
-
142,
|
|
567
|
-
13,
|
|
568
|
-
131,
|
|
569
|
-
11,
|
|
570
|
-
90,
|
|
571
|
-
19,
|
|
572
|
-
153,
|
|
573
|
-
218,
|
|
574
|
-
255,
|
|
575
|
-
16,
|
|
576
|
-
132,
|
|
577
|
-
4,
|
|
578
|
-
142,
|
|
579
|
-
123,
|
|
580
|
-
216,
|
|
581
|
-
219,
|
|
582
|
-
233,
|
|
583
|
-
248,
|
|
584
|
-
89
|
|
585
|
-
];
|
|
586
|
-
};
|
|
587
|
-
};
|
|
588
|
-
},
|
|
589
532
|
{
|
|
590
533
|
name: 'tokenProgram';
|
|
591
534
|
address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
|
|
@@ -639,6 +582,22 @@ export type TriadProtocol = {
|
|
|
639
582
|
name: 'market';
|
|
640
583
|
writable: true;
|
|
641
584
|
},
|
|
585
|
+
{
|
|
586
|
+
name: 'feeVault';
|
|
587
|
+
writable: true;
|
|
588
|
+
pda: {
|
|
589
|
+
seeds: [
|
|
590
|
+
{
|
|
591
|
+
kind: 'const';
|
|
592
|
+
value: [102, 101, 101, 95, 118, 97, 117, 108, 116];
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
kind: 'account';
|
|
596
|
+
path: 'market';
|
|
597
|
+
}
|
|
598
|
+
];
|
|
599
|
+
};
|
|
600
|
+
},
|
|
642
601
|
{
|
|
643
602
|
name: 'mint';
|
|
644
603
|
writable: true;
|
|
@@ -757,22 +716,6 @@ export type TriadProtocol = {
|
|
|
757
716
|
};
|
|
758
717
|
};
|
|
759
718
|
},
|
|
760
|
-
{
|
|
761
|
-
name: 'feeVault';
|
|
762
|
-
writable: true;
|
|
763
|
-
pda: {
|
|
764
|
-
seeds: [
|
|
765
|
-
{
|
|
766
|
-
kind: 'const';
|
|
767
|
-
value: [102, 101, 101, 95, 118, 97, 117, 108, 116];
|
|
768
|
-
},
|
|
769
|
-
{
|
|
770
|
-
kind: 'account';
|
|
771
|
-
path: 'market';
|
|
772
|
-
}
|
|
773
|
-
];
|
|
774
|
-
};
|
|
775
|
-
},
|
|
776
719
|
{
|
|
777
720
|
name: 'feeAta';
|
|
778
721
|
writable: true;
|
|
@@ -1997,11 +1940,6 @@ export type TriadProtocol = {
|
|
|
1997
1940
|
docs: ['Total trading volume (in TRD)'];
|
|
1998
1941
|
type: 'u64';
|
|
1999
1942
|
},
|
|
2000
|
-
{
|
|
2001
|
-
name: 'vaultTokenAccount';
|
|
2002
|
-
docs: ['Vault token account of $TRD'];
|
|
2003
|
-
type: 'pubkey';
|
|
2004
|
-
},
|
|
2005
1943
|
{
|
|
2006
1944
|
name: 'mint';
|
|
2007
1945
|
docs: ['Mint $TRD token'];
|
|
@@ -2012,6 +1950,10 @@ export type TriadProtocol = {
|
|
|
2012
1950
|
docs: ['Timestamp of the init'];
|
|
2013
1951
|
type: 'i64';
|
|
2014
1952
|
},
|
|
1953
|
+
{
|
|
1954
|
+
name: 'updateTs';
|
|
1955
|
+
type: 'i64';
|
|
1956
|
+
},
|
|
2015
1957
|
{
|
|
2016
1958
|
name: 'openOrdersCount';
|
|
2017
1959
|
docs: ['Total number of open orders in this market'];
|
|
@@ -2043,14 +1985,10 @@ export type TriadProtocol = {
|
|
|
2043
1985
|
name: 'isOfficial';
|
|
2044
1986
|
type: 'bool';
|
|
2045
1987
|
},
|
|
2046
|
-
{
|
|
2047
|
-
name: 'updateTs';
|
|
2048
|
-
type: 'i64';
|
|
2049
|
-
},
|
|
2050
1988
|
{
|
|
2051
1989
|
name: 'padding';
|
|
2052
1990
|
type: {
|
|
2053
|
-
array: ['u8',
|
|
1991
|
+
array: ['u8', 232];
|
|
2054
1992
|
};
|
|
2055
1993
|
}
|
|
2056
1994
|
];
|