@triadxyz/triad-protocol 1.6.8-beta → 1.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/trade.d.ts +9 -14
- package/dist/trade.js +20 -27
- package/dist/types/idl_triad_protocol.json +154 -133
- package/dist/types/index.d.ts +0 -12
- package/dist/types/trade.d.ts +9 -1
- package/dist/types/triad_protocol.d.ts +149 -186
- package/dist/utils/helpers.d.ts +1 -0
- package/dist/utils/helpers.js +10 -1
- package/package.json +1 -1
package/dist/trade.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { AnchorProvider, Program } from '@coral-xyz/anchor';
|
|
2
2
|
import { TriadProtocol } from './types/triad_protocol';
|
|
3
3
|
import { PublicKey } from '@solana/web3.js';
|
|
4
|
-
import {
|
|
4
|
+
import { CreateMarketArgs, OpenOrderArgs, UserTrade, CreateCustomerArgs } from './types/trade';
|
|
5
5
|
import { RpcOptions } from './types';
|
|
6
6
|
import BN from 'bn.js';
|
|
7
7
|
export default class Trade {
|
|
8
8
|
private program;
|
|
9
9
|
private provider;
|
|
10
|
+
mint: PublicKey;
|
|
10
11
|
constructor(program: Program<TriadProtocol>, provider: AnchorProvider);
|
|
11
12
|
/**
|
|
12
13
|
* Get All Markets
|
|
@@ -129,7 +130,7 @@ export default class Trade {
|
|
|
129
130
|
* @param options - RPC options
|
|
130
131
|
*
|
|
131
132
|
*/
|
|
132
|
-
|
|
133
|
+
createMarket({ marketId, startTime, endTime, question, feeBps, customer }: CreateMarketArgs, options?: RpcOptions): Promise<string>;
|
|
133
134
|
/**
|
|
134
135
|
* Get User Trade Nonce With Slots
|
|
135
136
|
* @param userTrades - User Trades
|
|
@@ -141,7 +142,7 @@ export default class Trade {
|
|
|
141
142
|
* @param args.marketId - The ID of the Market
|
|
142
143
|
* @param args.amount - The amount of the Order
|
|
143
144
|
* @param args.direction - The direction of the Order
|
|
144
|
-
* @param args.token - The token
|
|
145
|
+
* @param args.token - The token of the Order
|
|
145
146
|
*
|
|
146
147
|
* @param options - RPC options
|
|
147
148
|
*
|
|
@@ -229,19 +230,13 @@ export default class Trade {
|
|
|
229
230
|
*/
|
|
230
231
|
updateMarket(marketId: number, marketEnd: number, options?: RpcOptions): Promise<string>;
|
|
231
232
|
/**
|
|
232
|
-
*
|
|
233
|
-
* @param args.
|
|
234
|
-
* @param args.
|
|
235
|
-
* @param args.
|
|
236
|
-
* @param args.userNonce - The nonce of the user
|
|
233
|
+
* Create Customer
|
|
234
|
+
* @param args.id - The ID of the customer
|
|
235
|
+
* @param args.name - The name of the customer
|
|
236
|
+
* @param args.authority - The authority of the customer
|
|
237
237
|
*
|
|
238
238
|
* @param options - RPC options
|
|
239
239
|
*
|
|
240
240
|
*/
|
|
241
|
-
|
|
242
|
-
marketId: number;
|
|
243
|
-
user: PublicKey;
|
|
244
|
-
orderId: number;
|
|
245
|
-
userNonce: number;
|
|
246
|
-
}, options?: RpcOptions): Promise<string>;
|
|
241
|
+
createCustomer({ id, name, authority }: CreateCustomerArgs, options?: RpcOptions): Promise<string>;
|
|
247
242
|
}
|
package/dist/trade.js
CHANGED
|
@@ -23,6 +23,7 @@ class Trade {
|
|
|
23
23
|
constructor(program, provider) {
|
|
24
24
|
this.program = program;
|
|
25
25
|
this.provider = provider;
|
|
26
|
+
this.mint = constants_1.TRD_MINT;
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
29
|
* Get All Markets
|
|
@@ -113,21 +114,24 @@ class Trade {
|
|
|
113
114
|
* @param options - RPC options
|
|
114
115
|
*
|
|
115
116
|
*/
|
|
116
|
-
|
|
117
|
+
createMarket({ marketId, startTime, endTime, question, feeBps, customer }, options) {
|
|
117
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
118
119
|
if (question.length > 80) {
|
|
119
120
|
throw new Error('Question must be less than 80 characters');
|
|
120
121
|
}
|
|
121
122
|
return (0, sendTransactionWithOptions_1.default)(this.program.methods
|
|
122
|
-
.
|
|
123
|
+
.createMarket({
|
|
123
124
|
marketId: new bn_js_1.default(marketId),
|
|
124
125
|
question: (0, helpers_1.encodeString)(question, 80),
|
|
125
126
|
marketStart: new bn_js_1.default(startTime),
|
|
126
|
-
marketEnd: new bn_js_1.default(endTime)
|
|
127
|
+
marketEnd: new bn_js_1.default(endTime),
|
|
128
|
+
feeBps
|
|
127
129
|
})
|
|
128
130
|
.accounts({
|
|
129
131
|
signer: this.provider.publicKey,
|
|
130
|
-
mint:
|
|
132
|
+
mint: this.mint,
|
|
133
|
+
tokenProgram: (0, helpers_1.getTokenProgram)(this.mint),
|
|
134
|
+
customer
|
|
131
135
|
}), options);
|
|
132
136
|
});
|
|
133
137
|
}
|
|
@@ -169,7 +173,7 @@ class Trade {
|
|
|
169
173
|
* @param args.marketId - The ID of the Market
|
|
170
174
|
* @param args.amount - The amount of the Order
|
|
171
175
|
* @param args.direction - The direction of the Order
|
|
172
|
-
* @param args.token - The token
|
|
176
|
+
* @param args.token - The token of the Order
|
|
173
177
|
*
|
|
174
178
|
* @param options - RPC options
|
|
175
179
|
*
|
|
@@ -231,7 +235,7 @@ class Trade {
|
|
|
231
235
|
signer: this.provider.publicKey,
|
|
232
236
|
market: marketPDA,
|
|
233
237
|
userTrade: userTradePDA,
|
|
234
|
-
mint:
|
|
238
|
+
mint: this.mint
|
|
235
239
|
})
|
|
236
240
|
.instruction());
|
|
237
241
|
return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options, undefined, addressLookupTableAccounts);
|
|
@@ -257,7 +261,7 @@ class Trade {
|
|
|
257
261
|
return (0, sendTransactionWithOptions_1.default)(this.program.methods.closeOrder(new bn_js_1.default(orderId)).accounts({
|
|
258
262
|
signer: this.provider.publicKey,
|
|
259
263
|
market: marketPDA,
|
|
260
|
-
mint:
|
|
264
|
+
mint: this.mint,
|
|
261
265
|
userTrade: userTradePDA
|
|
262
266
|
}), options);
|
|
263
267
|
});
|
|
@@ -295,7 +299,7 @@ class Trade {
|
|
|
295
299
|
return (0, sendTransactionWithOptions_1.default)(this.program.methods.collectRemainingLiquidity().accounts({
|
|
296
300
|
signer: this.provider.publicKey,
|
|
297
301
|
market: marketPDA,
|
|
298
|
-
mint:
|
|
302
|
+
mint: this.mint
|
|
299
303
|
}), options);
|
|
300
304
|
});
|
|
301
305
|
}
|
|
@@ -320,7 +324,7 @@ class Trade {
|
|
|
320
324
|
signer: this.provider.publicKey,
|
|
321
325
|
userTrade: userTradePDA,
|
|
322
326
|
market: marketPDA,
|
|
323
|
-
mint:
|
|
327
|
+
mint: this.mint
|
|
324
328
|
}), options);
|
|
325
329
|
});
|
|
326
330
|
}
|
|
@@ -374,29 +378,18 @@ class Trade {
|
|
|
374
378
|
});
|
|
375
379
|
}
|
|
376
380
|
/**
|
|
377
|
-
*
|
|
378
|
-
* @param args.
|
|
379
|
-
* @param args.
|
|
380
|
-
* @param args.
|
|
381
|
-
* @param args.userNonce - The nonce of the user
|
|
381
|
+
* Create Customer
|
|
382
|
+
* @param args.id - The ID of the customer
|
|
383
|
+
* @param args.name - The name of the customer
|
|
384
|
+
* @param args.authority - The authority of the customer
|
|
382
385
|
*
|
|
383
386
|
* @param options - RPC options
|
|
384
387
|
*
|
|
385
388
|
*/
|
|
386
|
-
|
|
389
|
+
createCustomer({ id, name, authority }, options) {
|
|
387
390
|
return __awaiter(this, void 0, void 0, function* () {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
if (userNonce !== 0) {
|
|
391
|
-
const subUserTradePDA = (0, trade_1.getSubUserTradePDA)(this.program.programId, user, userNonce);
|
|
392
|
-
userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, subUserTradePDA);
|
|
393
|
-
}
|
|
394
|
-
return (0, sendTransactionWithOptions_1.default)(this.program.methods.forceCancelOrder(new bn_js_1.default(orderId)).accounts({
|
|
395
|
-
signer: this.provider.publicKey,
|
|
396
|
-
user,
|
|
397
|
-
market: marketPDA,
|
|
398
|
-
mint: constants_1.TRD_MINT,
|
|
399
|
-
userTrade: userTradePDA
|
|
391
|
+
return (0, sendTransactionWithOptions_1.default)(this.program.methods.createCustomer({ id, name, authority }).accounts({
|
|
392
|
+
signer: this.provider.publicKey
|
|
400
393
|
}), options);
|
|
401
394
|
});
|
|
402
395
|
}
|
|
@@ -412,8 +412,8 @@
|
|
|
412
412
|
"args": []
|
|
413
413
|
},
|
|
414
414
|
{
|
|
415
|
-
"name": "
|
|
416
|
-
"discriminator": [
|
|
415
|
+
"name": "create_customer",
|
|
416
|
+
"discriminator": [120, 122, 113, 216, 95, 207, 252, 147],
|
|
417
417
|
"accounts": [
|
|
418
418
|
{
|
|
419
419
|
"name": "signer",
|
|
@@ -421,33 +421,17 @@
|
|
|
421
421
|
"signer": true
|
|
422
422
|
},
|
|
423
423
|
{
|
|
424
|
-
"name": "
|
|
425
|
-
"writable": true,
|
|
426
|
-
"pda": {
|
|
427
|
-
"seeds": [
|
|
428
|
-
{
|
|
429
|
-
"kind": "const",
|
|
430
|
-
"value": [117, 115, 101, 114, 95, 116, 114, 97, 100, 101]
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
"kind": "account",
|
|
434
|
-
"path": "signer"
|
|
435
|
-
}
|
|
436
|
-
]
|
|
437
|
-
}
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
"name": "sub_user_trade",
|
|
424
|
+
"name": "customer",
|
|
441
425
|
"writable": true,
|
|
442
426
|
"pda": {
|
|
443
427
|
"seeds": [
|
|
444
428
|
{
|
|
445
429
|
"kind": "const",
|
|
446
|
-
"value": [117, 115,
|
|
430
|
+
"value": [99, 117, 115, 116, 111, 109, 101, 114]
|
|
447
431
|
},
|
|
448
432
|
{
|
|
449
433
|
"kind": "arg",
|
|
450
|
-
"path": "
|
|
434
|
+
"path": "args.id"
|
|
451
435
|
}
|
|
452
436
|
]
|
|
453
437
|
}
|
|
@@ -459,14 +443,18 @@
|
|
|
459
443
|
],
|
|
460
444
|
"args": [
|
|
461
445
|
{
|
|
462
|
-
"name": "
|
|
463
|
-
"type":
|
|
446
|
+
"name": "args",
|
|
447
|
+
"type": {
|
|
448
|
+
"defined": {
|
|
449
|
+
"name": "CreateCustomerArgs"
|
|
450
|
+
}
|
|
451
|
+
}
|
|
464
452
|
}
|
|
465
453
|
]
|
|
466
454
|
},
|
|
467
455
|
{
|
|
468
|
-
"name": "
|
|
469
|
-
"discriminator": [
|
|
456
|
+
"name": "create_market",
|
|
457
|
+
"discriminator": [103, 226, 97, 235, 200, 188, 251, 254],
|
|
470
458
|
"accounts": [
|
|
471
459
|
{
|
|
472
460
|
"name": "signer",
|
|
@@ -474,83 +462,37 @@
|
|
|
474
462
|
"signer": true
|
|
475
463
|
},
|
|
476
464
|
{
|
|
477
|
-
"name": "
|
|
465
|
+
"name": "squads",
|
|
478
466
|
"writable": true,
|
|
479
|
-
"
|
|
480
|
-
"seeds": [
|
|
481
|
-
{
|
|
482
|
-
"kind": "const",
|
|
483
|
-
"value": [117, 115, 101, 114, 95, 116, 114, 97, 100, 101]
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
"kind": "account",
|
|
487
|
-
"path": "signer"
|
|
488
|
-
}
|
|
489
|
-
]
|
|
490
|
-
}
|
|
467
|
+
"address": "6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq"
|
|
491
468
|
},
|
|
492
469
|
{
|
|
493
|
-
"name": "
|
|
494
|
-
"address": "11111111111111111111111111111111"
|
|
495
|
-
}
|
|
496
|
-
],
|
|
497
|
-
"args": []
|
|
498
|
-
},
|
|
499
|
-
{
|
|
500
|
-
"name": "force_cancel_order",
|
|
501
|
-
"discriminator": [10, 45, 231, 51, 229, 251, 182, 45],
|
|
502
|
-
"accounts": [
|
|
503
|
-
{
|
|
504
|
-
"name": "signer",
|
|
470
|
+
"name": "customer",
|
|
505
471
|
"writable": true,
|
|
506
|
-
"
|
|
507
|
-
},
|
|
508
|
-
{
|
|
509
|
-
"name": "user",
|
|
510
|
-
"writable": true
|
|
511
|
-
},
|
|
512
|
-
{
|
|
513
|
-
"name": "user_trade",
|
|
514
|
-
"writable": true
|
|
472
|
+
"optional": true
|
|
515
473
|
},
|
|
516
474
|
{
|
|
517
475
|
"name": "market",
|
|
518
|
-
"writable": true
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
"name": "mint",
|
|
522
|
-
"writable": true
|
|
523
|
-
},
|
|
524
|
-
{
|
|
525
|
-
"name": "user_ata",
|
|
526
476
|
"writable": true,
|
|
527
477
|
"pda": {
|
|
528
478
|
"seeds": [
|
|
529
479
|
{
|
|
530
|
-
"kind": "
|
|
531
|
-
"
|
|
532
|
-
},
|
|
533
|
-
{
|
|
534
|
-
"kind": "account",
|
|
535
|
-
"path": "token_program"
|
|
480
|
+
"kind": "const",
|
|
481
|
+
"value": [109, 97, 114, 107, 101, 116]
|
|
536
482
|
},
|
|
537
483
|
{
|
|
538
|
-
"kind": "
|
|
539
|
-
"path": "
|
|
484
|
+
"kind": "arg",
|
|
485
|
+
"path": "args.market_id"
|
|
540
486
|
}
|
|
541
|
-
]
|
|
542
|
-
"program": {
|
|
543
|
-
"kind": "const",
|
|
544
|
-
"value": [
|
|
545
|
-
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
|
|
546
|
-
13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
|
|
547
|
-
219, 233, 248, 89
|
|
548
|
-
]
|
|
549
|
-
}
|
|
487
|
+
]
|
|
550
488
|
}
|
|
551
489
|
},
|
|
552
490
|
{
|
|
553
|
-
"name": "
|
|
491
|
+
"name": "mint",
|
|
492
|
+
"writable": true
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
"name": "market_to_ata",
|
|
554
496
|
"writable": true,
|
|
555
497
|
"pda": {
|
|
556
498
|
"seeds": [
|
|
@@ -578,8 +520,7 @@
|
|
|
578
520
|
}
|
|
579
521
|
},
|
|
580
522
|
{
|
|
581
|
-
"name": "token_program"
|
|
582
|
-
"address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
523
|
+
"name": "token_program"
|
|
583
524
|
},
|
|
584
525
|
{
|
|
585
526
|
"name": "associated_token_program",
|
|
@@ -592,14 +533,18 @@
|
|
|
592
533
|
],
|
|
593
534
|
"args": [
|
|
594
535
|
{
|
|
595
|
-
"name": "
|
|
596
|
-
"type":
|
|
536
|
+
"name": "args",
|
|
537
|
+
"type": {
|
|
538
|
+
"defined": {
|
|
539
|
+
"name": "CreateMarketArgs"
|
|
540
|
+
}
|
|
541
|
+
}
|
|
597
542
|
}
|
|
598
543
|
]
|
|
599
544
|
},
|
|
600
545
|
{
|
|
601
|
-
"name": "
|
|
602
|
-
"discriminator": [
|
|
546
|
+
"name": "create_sub_user_trade",
|
|
547
|
+
"discriminator": [77, 201, 111, 73, 47, 229, 244, 161],
|
|
603
548
|
"accounts": [
|
|
604
549
|
{
|
|
605
550
|
"name": "signer",
|
|
@@ -607,61 +552,37 @@
|
|
|
607
552
|
"signer": true
|
|
608
553
|
},
|
|
609
554
|
{
|
|
610
|
-
"name": "
|
|
555
|
+
"name": "user_trade",
|
|
611
556
|
"writable": true,
|
|
612
557
|
"pda": {
|
|
613
558
|
"seeds": [
|
|
614
559
|
{
|
|
615
560
|
"kind": "const",
|
|
616
|
-
"value": [
|
|
561
|
+
"value": [117, 115, 101, 114, 95, 116, 114, 97, 100, 101]
|
|
617
562
|
},
|
|
618
563
|
{
|
|
619
|
-
"kind": "
|
|
620
|
-
"path": "
|
|
564
|
+
"kind": "account",
|
|
565
|
+
"path": "signer"
|
|
621
566
|
}
|
|
622
567
|
]
|
|
623
568
|
}
|
|
624
569
|
},
|
|
625
570
|
{
|
|
626
|
-
"name": "
|
|
627
|
-
"writable": true
|
|
628
|
-
},
|
|
629
|
-
{
|
|
630
|
-
"name": "market_ata",
|
|
571
|
+
"name": "sub_user_trade",
|
|
631
572
|
"writable": true,
|
|
632
573
|
"pda": {
|
|
633
574
|
"seeds": [
|
|
634
575
|
{
|
|
635
|
-
"kind": "
|
|
636
|
-
"
|
|
637
|
-
},
|
|
638
|
-
{
|
|
639
|
-
"kind": "account",
|
|
640
|
-
"path": "token_program"
|
|
576
|
+
"kind": "const",
|
|
577
|
+
"value": [117, 115, 101, 114, 95, 116, 114, 97, 100, 101]
|
|
641
578
|
},
|
|
642
579
|
{
|
|
643
|
-
"kind": "
|
|
644
|
-
"path": "
|
|
580
|
+
"kind": "arg",
|
|
581
|
+
"path": "sub_user_key"
|
|
645
582
|
}
|
|
646
|
-
]
|
|
647
|
-
"program": {
|
|
648
|
-
"kind": "const",
|
|
649
|
-
"value": [
|
|
650
|
-
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
|
|
651
|
-
13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
|
|
652
|
-
219, 233, 248, 89
|
|
653
|
-
]
|
|
654
|
-
}
|
|
583
|
+
]
|
|
655
584
|
}
|
|
656
585
|
},
|
|
657
|
-
{
|
|
658
|
-
"name": "token_program",
|
|
659
|
-
"address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
660
|
-
},
|
|
661
|
-
{
|
|
662
|
-
"name": "associated_token_program",
|
|
663
|
-
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
664
|
-
},
|
|
665
586
|
{
|
|
666
587
|
"name": "system_program",
|
|
667
588
|
"address": "11111111111111111111111111111111"
|
|
@@ -669,15 +590,43 @@
|
|
|
669
590
|
],
|
|
670
591
|
"args": [
|
|
671
592
|
{
|
|
672
|
-
"name": "
|
|
673
|
-
"type":
|
|
674
|
-
"defined": {
|
|
675
|
-
"name": "InitializeMarketArgs"
|
|
676
|
-
}
|
|
677
|
-
}
|
|
593
|
+
"name": "sub_user_key",
|
|
594
|
+
"type": "pubkey"
|
|
678
595
|
}
|
|
679
596
|
]
|
|
680
597
|
},
|
|
598
|
+
{
|
|
599
|
+
"name": "create_user_trade",
|
|
600
|
+
"discriminator": [232, 235, 58, 194, 135, 248, 153, 1],
|
|
601
|
+
"accounts": [
|
|
602
|
+
{
|
|
603
|
+
"name": "signer",
|
|
604
|
+
"writable": true,
|
|
605
|
+
"signer": true
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
"name": "user_trade",
|
|
609
|
+
"writable": true,
|
|
610
|
+
"pda": {
|
|
611
|
+
"seeds": [
|
|
612
|
+
{
|
|
613
|
+
"kind": "const",
|
|
614
|
+
"value": [117, 115, 101, 114, 95, 116, 114, 97, 100, 101]
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"kind": "account",
|
|
618
|
+
"path": "signer"
|
|
619
|
+
}
|
|
620
|
+
]
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
"name": "system_program",
|
|
625
|
+
"address": "11111111111111111111111111111111"
|
|
626
|
+
}
|
|
627
|
+
],
|
|
628
|
+
"args": []
|
|
629
|
+
},
|
|
681
630
|
{
|
|
682
631
|
"name": "open_order",
|
|
683
632
|
"discriminator": [206, 88, 88, 143, 38, 136, 50, 224],
|
|
@@ -1442,6 +1391,10 @@
|
|
|
1442
1391
|
"name": "Collection",
|
|
1443
1392
|
"discriminator": [48, 160, 232, 205, 191, 207, 26, 141]
|
|
1444
1393
|
},
|
|
1394
|
+
{
|
|
1395
|
+
"name": "Customer",
|
|
1396
|
+
"discriminator": [112, 147, 140, 31, 93, 186, 103, 18]
|
|
1397
|
+
},
|
|
1445
1398
|
{
|
|
1446
1399
|
"name": "MarketV2",
|
|
1447
1400
|
"discriminator": [27, 60, 50, 75, 191, 193, 86, 227]
|
|
@@ -1586,6 +1539,16 @@
|
|
|
1586
1539
|
"code": 6020,
|
|
1587
1540
|
"name": "NotLinked",
|
|
1588
1541
|
"msg": "Not linked"
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
"code": 6021,
|
|
1545
|
+
"name": "InvalidCustomer",
|
|
1546
|
+
"msg": "Invalid customer"
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
"code": 6022,
|
|
1550
|
+
"name": "InvalidMint",
|
|
1551
|
+
"msg": "Invalid mint"
|
|
1589
1552
|
}
|
|
1590
1553
|
],
|
|
1591
1554
|
"types": [
|
|
@@ -1718,7 +1681,27 @@
|
|
|
1718
1681
|
}
|
|
1719
1682
|
},
|
|
1720
1683
|
{
|
|
1721
|
-
"name": "
|
|
1684
|
+
"name": "CreateCustomerArgs",
|
|
1685
|
+
"type": {
|
|
1686
|
+
"kind": "struct",
|
|
1687
|
+
"fields": [
|
|
1688
|
+
{
|
|
1689
|
+
"name": "name",
|
|
1690
|
+
"type": "string"
|
|
1691
|
+
},
|
|
1692
|
+
{
|
|
1693
|
+
"name": "authority",
|
|
1694
|
+
"type": "pubkey"
|
|
1695
|
+
},
|
|
1696
|
+
{
|
|
1697
|
+
"name": "id",
|
|
1698
|
+
"type": "u16"
|
|
1699
|
+
}
|
|
1700
|
+
]
|
|
1701
|
+
}
|
|
1702
|
+
},
|
|
1703
|
+
{
|
|
1704
|
+
"name": "CreateMarketArgs",
|
|
1722
1705
|
"type": {
|
|
1723
1706
|
"kind": "struct",
|
|
1724
1707
|
"fields": [
|
|
@@ -1739,6 +1722,40 @@
|
|
|
1739
1722
|
{
|
|
1740
1723
|
"name": "market_end",
|
|
1741
1724
|
"type": "i64"
|
|
1725
|
+
},
|
|
1726
|
+
{
|
|
1727
|
+
"name": "fee_bps",
|
|
1728
|
+
"type": "u8"
|
|
1729
|
+
}
|
|
1730
|
+
]
|
|
1731
|
+
}
|
|
1732
|
+
},
|
|
1733
|
+
{
|
|
1734
|
+
"name": "Customer",
|
|
1735
|
+
"type": {
|
|
1736
|
+
"kind": "struct",
|
|
1737
|
+
"fields": [
|
|
1738
|
+
{
|
|
1739
|
+
"name": "bump",
|
|
1740
|
+
"type": "u8"
|
|
1741
|
+
},
|
|
1742
|
+
{
|
|
1743
|
+
"name": "id",
|
|
1744
|
+
"type": "u16"
|
|
1745
|
+
},
|
|
1746
|
+
{
|
|
1747
|
+
"name": "authority",
|
|
1748
|
+
"type": "pubkey"
|
|
1749
|
+
},
|
|
1750
|
+
{
|
|
1751
|
+
"name": "name",
|
|
1752
|
+
"type": "string"
|
|
1753
|
+
},
|
|
1754
|
+
{
|
|
1755
|
+
"name": "padding",
|
|
1756
|
+
"type": {
|
|
1757
|
+
"array": ["u8", 64]
|
|
1758
|
+
}
|
|
1742
1759
|
}
|
|
1743
1760
|
]
|
|
1744
1761
|
}
|
|
@@ -1956,10 +1973,14 @@
|
|
|
1956
1973
|
"name": "market_liquidity_at_start",
|
|
1957
1974
|
"type": "u64"
|
|
1958
1975
|
},
|
|
1976
|
+
{
|
|
1977
|
+
"name": "customer_id",
|
|
1978
|
+
"type": "u16"
|
|
1979
|
+
},
|
|
1959
1980
|
{
|
|
1960
1981
|
"name": "padding",
|
|
1961
1982
|
"type": {
|
|
1962
|
-
"array": ["u8",
|
|
1983
|
+
"array": ["u8", 90]
|
|
1963
1984
|
}
|
|
1964
1985
|
}
|
|
1965
1986
|
]
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,11 +3,6 @@ export type RpcOptions = {
|
|
|
3
3
|
skipPreflight?: boolean;
|
|
4
4
|
microLamports?: number;
|
|
5
5
|
};
|
|
6
|
-
export type CreateUserArgs = {
|
|
7
|
-
wallet: PublicKey;
|
|
8
|
-
name: string;
|
|
9
|
-
referral?: PublicKey;
|
|
10
|
-
};
|
|
11
6
|
export type MintTicketArgs = {
|
|
12
7
|
discount: number;
|
|
13
8
|
isBoosted: boolean;
|
|
@@ -27,13 +22,6 @@ export type MintTicketArgs = {
|
|
|
27
22
|
verifier: string;
|
|
28
23
|
nftMint: PublicKey;
|
|
29
24
|
};
|
|
30
|
-
export type User = {
|
|
31
|
-
ts: number;
|
|
32
|
-
authority: string;
|
|
33
|
-
referral: string;
|
|
34
|
-
referred: number;
|
|
35
|
-
name: string;
|
|
36
|
-
};
|
|
37
25
|
export type OrderStatus = {
|
|
38
26
|
init: {};
|
|
39
27
|
} | {
|
package/dist/types/trade.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
|
1
2
|
export type Market = {
|
|
2
3
|
address: string;
|
|
3
4
|
bump: number;
|
|
@@ -77,9 +78,16 @@ export type OpenOrderArgs = {
|
|
|
77
78
|
direction: OrderDirection;
|
|
78
79
|
token: string;
|
|
79
80
|
};
|
|
80
|
-
export type
|
|
81
|
+
export type CreateMarketArgs = {
|
|
81
82
|
marketId: number;
|
|
82
83
|
startTime: number;
|
|
83
84
|
endTime: number;
|
|
84
85
|
question: string;
|
|
86
|
+
feeBps: number;
|
|
87
|
+
customer: PublicKey;
|
|
88
|
+
};
|
|
89
|
+
export type CreateCustomerArgs = {
|
|
90
|
+
id: number;
|
|
91
|
+
name: string;
|
|
92
|
+
authority: PublicKey;
|
|
85
93
|
};
|
|
@@ -592,8 +592,8 @@ export type TriadProtocol = {
|
|
|
592
592
|
args: [];
|
|
593
593
|
},
|
|
594
594
|
{
|
|
595
|
-
name: '
|
|
596
|
-
discriminator: [
|
|
595
|
+
name: 'createCustomer';
|
|
596
|
+
discriminator: [120, 122, 113, 216, 95, 207, 252, 147];
|
|
597
597
|
accounts: [
|
|
598
598
|
{
|
|
599
599
|
name: 'signer';
|
|
@@ -601,33 +601,17 @@ export type TriadProtocol = {
|
|
|
601
601
|
signer: true;
|
|
602
602
|
},
|
|
603
603
|
{
|
|
604
|
-
name: '
|
|
605
|
-
writable: true;
|
|
606
|
-
pda: {
|
|
607
|
-
seeds: [
|
|
608
|
-
{
|
|
609
|
-
kind: 'const';
|
|
610
|
-
value: [117, 115, 101, 114, 95, 116, 114, 97, 100, 101];
|
|
611
|
-
},
|
|
612
|
-
{
|
|
613
|
-
kind: 'account';
|
|
614
|
-
path: 'signer';
|
|
615
|
-
}
|
|
616
|
-
];
|
|
617
|
-
};
|
|
618
|
-
},
|
|
619
|
-
{
|
|
620
|
-
name: 'subUserTrade';
|
|
604
|
+
name: 'customer';
|
|
621
605
|
writable: true;
|
|
622
606
|
pda: {
|
|
623
607
|
seeds: [
|
|
624
608
|
{
|
|
625
609
|
kind: 'const';
|
|
626
|
-
value: [117, 115,
|
|
610
|
+
value: [99, 117, 115, 116, 111, 109, 101, 114];
|
|
627
611
|
},
|
|
628
612
|
{
|
|
629
613
|
kind: 'arg';
|
|
630
|
-
path: '
|
|
614
|
+
path: 'args.id';
|
|
631
615
|
}
|
|
632
616
|
];
|
|
633
617
|
};
|
|
@@ -639,46 +623,18 @@ export type TriadProtocol = {
|
|
|
639
623
|
];
|
|
640
624
|
args: [
|
|
641
625
|
{
|
|
642
|
-
name: '
|
|
643
|
-
type:
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
{
|
|
648
|
-
name: 'createUserTrade';
|
|
649
|
-
discriminator: [232, 235, 58, 194, 135, 248, 153, 1];
|
|
650
|
-
accounts: [
|
|
651
|
-
{
|
|
652
|
-
name: 'signer';
|
|
653
|
-
writable: true;
|
|
654
|
-
signer: true;
|
|
655
|
-
},
|
|
656
|
-
{
|
|
657
|
-
name: 'userTrade';
|
|
658
|
-
writable: true;
|
|
659
|
-
pda: {
|
|
660
|
-
seeds: [
|
|
661
|
-
{
|
|
662
|
-
kind: 'const';
|
|
663
|
-
value: [117, 115, 101, 114, 95, 116, 114, 97, 100, 101];
|
|
664
|
-
},
|
|
665
|
-
{
|
|
666
|
-
kind: 'account';
|
|
667
|
-
path: 'signer';
|
|
668
|
-
}
|
|
669
|
-
];
|
|
626
|
+
name: 'args';
|
|
627
|
+
type: {
|
|
628
|
+
defined: {
|
|
629
|
+
name: 'createCustomerArgs';
|
|
630
|
+
};
|
|
670
631
|
};
|
|
671
|
-
},
|
|
672
|
-
{
|
|
673
|
-
name: 'systemProgram';
|
|
674
|
-
address: '11111111111111111111111111111111';
|
|
675
632
|
}
|
|
676
633
|
];
|
|
677
|
-
args: [];
|
|
678
634
|
},
|
|
679
635
|
{
|
|
680
|
-
name: '
|
|
681
|
-
discriminator: [
|
|
636
|
+
name: 'createMarket';
|
|
637
|
+
discriminator: [103, 226, 97, 235, 200, 188, 251, 254];
|
|
682
638
|
accounts: [
|
|
683
639
|
{
|
|
684
640
|
name: 'signer';
|
|
@@ -686,80 +642,37 @@ export type TriadProtocol = {
|
|
|
686
642
|
signer: true;
|
|
687
643
|
},
|
|
688
644
|
{
|
|
689
|
-
name: '
|
|
645
|
+
name: 'squads';
|
|
690
646
|
writable: true;
|
|
647
|
+
address: '6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq';
|
|
691
648
|
},
|
|
692
649
|
{
|
|
693
|
-
name: '
|
|
650
|
+
name: 'customer';
|
|
694
651
|
writable: true;
|
|
652
|
+
optional: true;
|
|
695
653
|
},
|
|
696
654
|
{
|
|
697
655
|
name: 'market';
|
|
698
656
|
writable: true;
|
|
699
|
-
},
|
|
700
|
-
{
|
|
701
|
-
name: 'mint';
|
|
702
|
-
writable: true;
|
|
703
|
-
},
|
|
704
|
-
{
|
|
705
|
-
name: 'userAta';
|
|
706
|
-
writable: true;
|
|
707
657
|
pda: {
|
|
708
658
|
seeds: [
|
|
709
659
|
{
|
|
710
|
-
kind: '
|
|
711
|
-
|
|
712
|
-
},
|
|
713
|
-
{
|
|
714
|
-
kind: 'account';
|
|
715
|
-
path: 'tokenProgram';
|
|
660
|
+
kind: 'const';
|
|
661
|
+
value: [109, 97, 114, 107, 101, 116];
|
|
716
662
|
},
|
|
717
663
|
{
|
|
718
|
-
kind: '
|
|
719
|
-
path: '
|
|
664
|
+
kind: 'arg';
|
|
665
|
+
path: 'args.market_id';
|
|
720
666
|
}
|
|
721
667
|
];
|
|
722
|
-
program: {
|
|
723
|
-
kind: 'const';
|
|
724
|
-
value: [
|
|
725
|
-
140,
|
|
726
|
-
151,
|
|
727
|
-
37,
|
|
728
|
-
143,
|
|
729
|
-
78,
|
|
730
|
-
36,
|
|
731
|
-
137,
|
|
732
|
-
241,
|
|
733
|
-
187,
|
|
734
|
-
61,
|
|
735
|
-
16,
|
|
736
|
-
41,
|
|
737
|
-
20,
|
|
738
|
-
142,
|
|
739
|
-
13,
|
|
740
|
-
131,
|
|
741
|
-
11,
|
|
742
|
-
90,
|
|
743
|
-
19,
|
|
744
|
-
153,
|
|
745
|
-
218,
|
|
746
|
-
255,
|
|
747
|
-
16,
|
|
748
|
-
132,
|
|
749
|
-
4,
|
|
750
|
-
142,
|
|
751
|
-
123,
|
|
752
|
-
216,
|
|
753
|
-
219,
|
|
754
|
-
233,
|
|
755
|
-
248,
|
|
756
|
-
89
|
|
757
|
-
];
|
|
758
|
-
};
|
|
759
668
|
};
|
|
760
669
|
},
|
|
761
670
|
{
|
|
762
|
-
name: '
|
|
671
|
+
name: 'mint';
|
|
672
|
+
writable: true;
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
name: 'marketToAta';
|
|
763
676
|
writable: true;
|
|
764
677
|
pda: {
|
|
765
678
|
seeds: [
|
|
@@ -817,7 +730,6 @@ export type TriadProtocol = {
|
|
|
817
730
|
},
|
|
818
731
|
{
|
|
819
732
|
name: 'tokenProgram';
|
|
820
|
-
address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
|
|
821
733
|
},
|
|
822
734
|
{
|
|
823
735
|
name: 'associatedTokenProgram';
|
|
@@ -830,14 +742,18 @@ export type TriadProtocol = {
|
|
|
830
742
|
];
|
|
831
743
|
args: [
|
|
832
744
|
{
|
|
833
|
-
name: '
|
|
834
|
-
type:
|
|
745
|
+
name: 'args';
|
|
746
|
+
type: {
|
|
747
|
+
defined: {
|
|
748
|
+
name: 'createMarketArgs';
|
|
749
|
+
};
|
|
750
|
+
};
|
|
835
751
|
}
|
|
836
752
|
];
|
|
837
753
|
},
|
|
838
754
|
{
|
|
839
|
-
name: '
|
|
840
|
-
discriminator: [
|
|
755
|
+
name: 'createSubUserTrade';
|
|
756
|
+
discriminator: [77, 201, 111, 73, 47, 229, 244, 161];
|
|
841
757
|
accounts: [
|
|
842
758
|
{
|
|
843
759
|
name: 'signer';
|
|
@@ -845,90 +761,37 @@ export type TriadProtocol = {
|
|
|
845
761
|
signer: true;
|
|
846
762
|
},
|
|
847
763
|
{
|
|
848
|
-
name: '
|
|
764
|
+
name: 'userTrade';
|
|
849
765
|
writable: true;
|
|
850
766
|
pda: {
|
|
851
767
|
seeds: [
|
|
852
768
|
{
|
|
853
769
|
kind: 'const';
|
|
854
|
-
value: [
|
|
770
|
+
value: [117, 115, 101, 114, 95, 116, 114, 97, 100, 101];
|
|
855
771
|
},
|
|
856
772
|
{
|
|
857
|
-
kind: '
|
|
858
|
-
path: '
|
|
773
|
+
kind: 'account';
|
|
774
|
+
path: 'signer';
|
|
859
775
|
}
|
|
860
776
|
];
|
|
861
777
|
};
|
|
862
778
|
},
|
|
863
779
|
{
|
|
864
|
-
name: '
|
|
865
|
-
writable: true;
|
|
866
|
-
},
|
|
867
|
-
{
|
|
868
|
-
name: 'marketAta';
|
|
780
|
+
name: 'subUserTrade';
|
|
869
781
|
writable: true;
|
|
870
782
|
pda: {
|
|
871
783
|
seeds: [
|
|
872
784
|
{
|
|
873
|
-
kind: '
|
|
874
|
-
|
|
875
|
-
},
|
|
876
|
-
{
|
|
877
|
-
kind: 'account';
|
|
878
|
-
path: 'tokenProgram';
|
|
785
|
+
kind: 'const';
|
|
786
|
+
value: [117, 115, 101, 114, 95, 116, 114, 97, 100, 101];
|
|
879
787
|
},
|
|
880
788
|
{
|
|
881
|
-
kind: '
|
|
882
|
-
path: '
|
|
789
|
+
kind: 'arg';
|
|
790
|
+
path: 'subUserKey';
|
|
883
791
|
}
|
|
884
792
|
];
|
|
885
|
-
program: {
|
|
886
|
-
kind: 'const';
|
|
887
|
-
value: [
|
|
888
|
-
140,
|
|
889
|
-
151,
|
|
890
|
-
37,
|
|
891
|
-
143,
|
|
892
|
-
78,
|
|
893
|
-
36,
|
|
894
|
-
137,
|
|
895
|
-
241,
|
|
896
|
-
187,
|
|
897
|
-
61,
|
|
898
|
-
16,
|
|
899
|
-
41,
|
|
900
|
-
20,
|
|
901
|
-
142,
|
|
902
|
-
13,
|
|
903
|
-
131,
|
|
904
|
-
11,
|
|
905
|
-
90,
|
|
906
|
-
19,
|
|
907
|
-
153,
|
|
908
|
-
218,
|
|
909
|
-
255,
|
|
910
|
-
16,
|
|
911
|
-
132,
|
|
912
|
-
4,
|
|
913
|
-
142,
|
|
914
|
-
123,
|
|
915
|
-
216,
|
|
916
|
-
219,
|
|
917
|
-
233,
|
|
918
|
-
248,
|
|
919
|
-
89
|
|
920
|
-
];
|
|
921
|
-
};
|
|
922
793
|
};
|
|
923
794
|
},
|
|
924
|
-
{
|
|
925
|
-
name: 'tokenProgram';
|
|
926
|
-
address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
|
|
927
|
-
},
|
|
928
|
-
{
|
|
929
|
-
name: 'associatedTokenProgram';
|
|
930
|
-
address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
|
|
931
|
-
},
|
|
932
795
|
{
|
|
933
796
|
name: 'systemProgram';
|
|
934
797
|
address: '11111111111111111111111111111111';
|
|
@@ -936,14 +799,42 @@ export type TriadProtocol = {
|
|
|
936
799
|
];
|
|
937
800
|
args: [
|
|
938
801
|
{
|
|
939
|
-
name: '
|
|
940
|
-
type:
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
802
|
+
name: 'subUserKey';
|
|
803
|
+
type: 'pubkey';
|
|
804
|
+
}
|
|
805
|
+
];
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
name: 'createUserTrade';
|
|
809
|
+
discriminator: [232, 235, 58, 194, 135, 248, 153, 1];
|
|
810
|
+
accounts: [
|
|
811
|
+
{
|
|
812
|
+
name: 'signer';
|
|
813
|
+
writable: true;
|
|
814
|
+
signer: true;
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
name: 'userTrade';
|
|
818
|
+
writable: true;
|
|
819
|
+
pda: {
|
|
820
|
+
seeds: [
|
|
821
|
+
{
|
|
822
|
+
kind: 'const';
|
|
823
|
+
value: [117, 115, 101, 114, 95, 116, 114, 97, 100, 101];
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
kind: 'account';
|
|
827
|
+
path: 'signer';
|
|
828
|
+
}
|
|
829
|
+
];
|
|
944
830
|
};
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
name: 'systemProgram';
|
|
834
|
+
address: '11111111111111111111111111111111';
|
|
945
835
|
}
|
|
946
836
|
];
|
|
837
|
+
args: [];
|
|
947
838
|
},
|
|
948
839
|
{
|
|
949
840
|
name: 'openOrder';
|
|
@@ -1999,6 +1890,10 @@ export type TriadProtocol = {
|
|
|
1999
1890
|
name: 'collection';
|
|
2000
1891
|
discriminator: [48, 160, 232, 205, 191, 207, 26, 141];
|
|
2001
1892
|
},
|
|
1893
|
+
{
|
|
1894
|
+
name: 'customer';
|
|
1895
|
+
discriminator: [112, 147, 140, 31, 93, 186, 103, 18];
|
|
1896
|
+
},
|
|
2002
1897
|
{
|
|
2003
1898
|
name: 'marketV2';
|
|
2004
1899
|
discriminator: [27, 60, 50, 75, 191, 193, 86, 227];
|
|
@@ -2143,6 +2038,16 @@ export type TriadProtocol = {
|
|
|
2143
2038
|
code: 6020;
|
|
2144
2039
|
name: 'notLinked';
|
|
2145
2040
|
msg: 'Not linked';
|
|
2041
|
+
},
|
|
2042
|
+
{
|
|
2043
|
+
code: 6021;
|
|
2044
|
+
name: 'invalidCustomer';
|
|
2045
|
+
msg: 'Invalid customer';
|
|
2046
|
+
},
|
|
2047
|
+
{
|
|
2048
|
+
code: 6022;
|
|
2049
|
+
name: 'invalidMint';
|
|
2050
|
+
msg: 'Invalid mint';
|
|
2146
2051
|
}
|
|
2147
2052
|
];
|
|
2148
2053
|
types: [
|
|
@@ -2275,7 +2180,27 @@ export type TriadProtocol = {
|
|
|
2275
2180
|
};
|
|
2276
2181
|
},
|
|
2277
2182
|
{
|
|
2278
|
-
name: '
|
|
2183
|
+
name: 'createCustomerArgs';
|
|
2184
|
+
type: {
|
|
2185
|
+
kind: 'struct';
|
|
2186
|
+
fields: [
|
|
2187
|
+
{
|
|
2188
|
+
name: 'name';
|
|
2189
|
+
type: 'string';
|
|
2190
|
+
},
|
|
2191
|
+
{
|
|
2192
|
+
name: 'authority';
|
|
2193
|
+
type: 'pubkey';
|
|
2194
|
+
},
|
|
2195
|
+
{
|
|
2196
|
+
name: 'id';
|
|
2197
|
+
type: 'u16';
|
|
2198
|
+
}
|
|
2199
|
+
];
|
|
2200
|
+
};
|
|
2201
|
+
},
|
|
2202
|
+
{
|
|
2203
|
+
name: 'createMarketArgs';
|
|
2279
2204
|
type: {
|
|
2280
2205
|
kind: 'struct';
|
|
2281
2206
|
fields: [
|
|
@@ -2296,6 +2221,40 @@ export type TriadProtocol = {
|
|
|
2296
2221
|
{
|
|
2297
2222
|
name: 'marketEnd';
|
|
2298
2223
|
type: 'i64';
|
|
2224
|
+
},
|
|
2225
|
+
{
|
|
2226
|
+
name: 'feeBps';
|
|
2227
|
+
type: 'u8';
|
|
2228
|
+
}
|
|
2229
|
+
];
|
|
2230
|
+
};
|
|
2231
|
+
},
|
|
2232
|
+
{
|
|
2233
|
+
name: 'customer';
|
|
2234
|
+
type: {
|
|
2235
|
+
kind: 'struct';
|
|
2236
|
+
fields: [
|
|
2237
|
+
{
|
|
2238
|
+
name: 'bump';
|
|
2239
|
+
type: 'u8';
|
|
2240
|
+
},
|
|
2241
|
+
{
|
|
2242
|
+
name: 'id';
|
|
2243
|
+
type: 'u16';
|
|
2244
|
+
},
|
|
2245
|
+
{
|
|
2246
|
+
name: 'authority';
|
|
2247
|
+
type: 'pubkey';
|
|
2248
|
+
},
|
|
2249
|
+
{
|
|
2250
|
+
name: 'name';
|
|
2251
|
+
type: 'string';
|
|
2252
|
+
},
|
|
2253
|
+
{
|
|
2254
|
+
name: 'padding';
|
|
2255
|
+
type: {
|
|
2256
|
+
array: ['u8', 64];
|
|
2257
|
+
};
|
|
2299
2258
|
}
|
|
2300
2259
|
];
|
|
2301
2260
|
};
|
|
@@ -2513,10 +2472,14 @@ export type TriadProtocol = {
|
|
|
2513
2472
|
name: 'marketLiquidityAtStart';
|
|
2514
2473
|
type: 'u64';
|
|
2515
2474
|
},
|
|
2475
|
+
{
|
|
2476
|
+
name: 'customerId';
|
|
2477
|
+
type: 'u16';
|
|
2478
|
+
},
|
|
2516
2479
|
{
|
|
2517
2480
|
name: 'padding';
|
|
2518
2481
|
type: {
|
|
2519
|
-
array: ['u8',
|
|
2482
|
+
array: ['u8', 90];
|
|
2520
2483
|
};
|
|
2521
2484
|
}
|
|
2522
2485
|
];
|
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -9,3 +9,4 @@ export declare const formatMarket: (account: any, address: PublicKey) => Market;
|
|
|
9
9
|
export declare const formatOrder: (order: any) => Order;
|
|
10
10
|
export declare const formatUserTrade: (account: any, publicKey: PublicKey) => UserTrade;
|
|
11
11
|
export declare const calculateStakeRewards: (stake: Stake, multiplier: number) => number;
|
|
12
|
+
export declare const getTokenProgram: (mint: PublicKey) => PublicKey;
|
package/dist/utils/helpers.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculateStakeRewards = exports.formatUserTrade = exports.formatOrder = exports.formatMarket = exports.formatStake = exports.formatStakeVault = exports.decodeString = exports.encodeString = void 0;
|
|
3
|
+
exports.getTokenProgram = exports.calculateStakeRewards = exports.formatUserTrade = exports.formatOrder = exports.formatMarket = exports.formatStake = exports.formatStakeVault = exports.decodeString = exports.encodeString = void 0;
|
|
4
4
|
const trade_1 = require("../types/trade");
|
|
5
5
|
const constants_1 = require("./constants");
|
|
6
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
7
|
+
const spl_token_2 = require("@solana/spl-token");
|
|
6
8
|
const encodeString = (value, alloc = 32) => {
|
|
7
9
|
const buffer = Buffer.alloc(alloc, 32);
|
|
8
10
|
buffer.write(value);
|
|
@@ -133,3 +135,10 @@ const calculateStakeRewards = (stake, multiplier) => {
|
|
|
133
135
|
return (rewards + stake.available) / Math.pow(10, constants_1.TRD_DECIMALS);
|
|
134
136
|
};
|
|
135
137
|
exports.calculateStakeRewards = calculateStakeRewards;
|
|
138
|
+
const getTokenProgram = (mint) => {
|
|
139
|
+
if (mint.toBase58() === constants_1.TRD_MINT.toBase58()) {
|
|
140
|
+
return spl_token_1.TOKEN_2022_PROGRAM_ID;
|
|
141
|
+
}
|
|
142
|
+
return spl_token_2.TOKEN_PROGRAM_ID;
|
|
143
|
+
};
|
|
144
|
+
exports.getTokenProgram = getTokenProgram;
|