@triadxyz/triad-protocol 0.7.4-beta.devnet → 0.7.5-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.
@@ -17,7 +17,7 @@ const index_1 = __importDefault(require("./index"));
17
17
  const anchor_1 = require("@coral-xyz/anchor");
18
18
  const axios_1 = __importDefault(require("axios"));
19
19
  const web3_js_1 = require("@solana/web3.js");
20
- const file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/id.json');
20
+ const file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/triad.json');
21
21
  const rpc_file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/rpc-devnet.txt');
22
22
  const keypair = web3_js_1.Keypair.fromSecretKey(new Uint8Array(JSON.parse(file.toString())));
23
23
  const connection = new web3_js_1.Connection(rpc_file.toString(), 'confirmed');
@@ -42,8 +42,7 @@ const ordersHypeAndFloopBot = [
42
42
  },
43
43
  orderType: {
44
44
  market: {}
45
- },
46
- limitPrice: 0
45
+ }
47
46
  },
48
47
  {
49
48
  marketId: 0,
@@ -53,8 +52,7 @@ const ordersHypeAndFloopBot = [
53
52
  },
54
53
  orderType: {
55
54
  market: {}
56
- },
57
- limitPrice: 0
55
+ }
58
56
  },
59
57
  {
60
58
  marketId: 0,
@@ -64,8 +62,7 @@ const ordersHypeAndFloopBot = [
64
62
  },
65
63
  orderType: {
66
64
  limit: {}
67
- },
68
- limitPrice: 0.8
65
+ }
69
66
  },
70
67
  {
71
68
  marketId: 0,
@@ -75,8 +72,7 @@ const ordersHypeAndFloopBot = [
75
72
  },
76
73
  orderType: {
77
74
  limit: {}
78
- },
79
- limitPrice: 0.2
75
+ }
80
76
  },
81
77
  {
82
78
  marketId: 0,
@@ -168,7 +164,6 @@ const getMarkets = () => __awaiter(void 0, void 0, void 0, function* () {
168
164
  const markets = yield triadProtocol.trade.getMarkets();
169
165
  console.log(markets);
170
166
  });
171
- getMarkets();
172
167
  const initializeAllMarkets = () => __awaiter(void 0, void 0, void 0, function* () {
173
168
  for (const market of markets) {
174
169
  try {
@@ -192,8 +187,7 @@ const openOrder = () => __awaiter(void 0, void 0, void 0, function* () {
192
187
  amount: order.amount,
193
188
  direction: order.direction,
194
189
  orderType: order.orderType,
195
- comment: `hype/flop bot ${order.amount} - ${order.direction}`,
196
- limitPrice: order.limitPrice
190
+ comment: `hype/flop bot ${order.amount} - ${order.direction}`
197
191
  }, {
198
192
  skipPreflight: true
199
193
  });
@@ -222,6 +216,6 @@ const runBot = () => __awaiter(void 0, void 0, void 0, function* () {
222
216
  }
223
217
  yield openOrder();
224
218
  yield new Promise((resolve) => setTimeout(resolve, 40000));
225
- yield closeOrder();
226
219
  }
227
220
  });
221
+ runBot();
package/dist/trade.d.ts CHANGED
@@ -81,7 +81,6 @@ export default class Trade {
81
81
  amount: number;
82
82
  direction: OrderDirection;
83
83
  orderType: OrderType;
84
- limitPrice?: number;
85
84
  comment?: string;
86
85
  }, options?: RpcOptions): Promise<string>;
87
86
  closeOrder({ marketId, orderId }: {
@@ -405,6 +405,75 @@
405
405
  }
406
406
  ]
407
407
  },
408
+ {
409
+ "name": "initialize_question",
410
+ "discriminator": [245, 151, 106, 188, 88, 44, 65, 212],
411
+ "accounts": [
412
+ {
413
+ "name": "signer",
414
+ "writable": true,
415
+ "signer": true
416
+ },
417
+ {
418
+ "name": "market",
419
+ "writable": true
420
+ },
421
+ {
422
+ "name": "mint",
423
+ "writable": true
424
+ },
425
+ {
426
+ "name": "market_vault",
427
+ "writable": true,
428
+ "pda": {
429
+ "seeds": [
430
+ {
431
+ "kind": "account",
432
+ "path": "market"
433
+ },
434
+ {
435
+ "kind": "account",
436
+ "path": "token_program"
437
+ },
438
+ {
439
+ "kind": "account",
440
+ "path": "mint"
441
+ }
442
+ ],
443
+ "program": {
444
+ "kind": "const",
445
+ "value": [
446
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
447
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
448
+ 219, 233, 248, 89
449
+ ]
450
+ }
451
+ }
452
+ },
453
+ {
454
+ "name": "token_program",
455
+ "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
456
+ },
457
+ {
458
+ "name": "associated_token_program",
459
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
460
+ },
461
+ {
462
+ "name": "system_program",
463
+ "address": "11111111111111111111111111111111"
464
+ }
465
+ ],
466
+ "args": [
467
+ {
468
+ "name": "args",
469
+ "type": {
470
+ "defined": {
471
+ "name": "InitializeQuestionArgs"
472
+ }
473
+ }
474
+ }
475
+ ]
476
+ },
408
477
  {
409
478
  "name": "open_order",
410
479
  "discriminator": [206, 88, 88, 143, 38, 136, 50, 224],
@@ -550,6 +619,26 @@
550
619
  ],
551
620
  "args": []
552
621
  },
622
+ {
623
+ "name": "resolve_question",
624
+ "discriminator": [52, 32, 224, 179, 180, 8, 0, 246],
625
+ "accounts": [
626
+ {
627
+ "name": "signer",
628
+ "writable": true,
629
+ "signer": true
630
+ },
631
+ {
632
+ "name": "market",
633
+ "writable": true
634
+ },
635
+ {
636
+ "name": "system_program",
637
+ "address": "11111111111111111111111111111111"
638
+ }
639
+ ],
640
+ "args": []
641
+ },
553
642
  {
554
643
  "name": "stake_nft",
555
644
  "discriminator": [38, 27, 66, 46, 69, 65, 151, 219],
@@ -1257,6 +1346,31 @@
1257
1346
  "code": 6034,
1258
1347
  "name": "OrderSizeTooLarge",
1259
1348
  "msg": "Order size too large"
1349
+ },
1350
+ {
1351
+ "code": 6035,
1352
+ "name": "QuestionPeriodNotEnded",
1353
+ "msg": "Question period not ended"
1354
+ },
1355
+ {
1356
+ "code": 6036,
1357
+ "name": "InvalidStartTime",
1358
+ "msg": "Invalid start time"
1359
+ },
1360
+ {
1361
+ "code": 6037,
1362
+ "name": "InvalidEndTime",
1363
+ "msg": "Invalid end time"
1364
+ },
1365
+ {
1366
+ "code": 6038,
1367
+ "name": "QuestionPeriodNotStarted",
1368
+ "msg": "Question period not started"
1369
+ },
1370
+ {
1371
+ "code": 6039,
1372
+ "name": "QuestionPeriodEnded",
1373
+ "msg": "Question period ended"
1260
1374
  }
1261
1375
  ],
1262
1376
  "types": [
@@ -1366,6 +1480,28 @@
1366
1480
  ]
1367
1481
  }
1368
1482
  },
1483
+ {
1484
+ "name": "InitializeQuestionArgs",
1485
+ "type": {
1486
+ "kind": "struct",
1487
+ "fields": [
1488
+ {
1489
+ "name": "question",
1490
+ "type": {
1491
+ "array": ["u8", 80]
1492
+ }
1493
+ },
1494
+ {
1495
+ "name": "start_time",
1496
+ "type": "i64"
1497
+ },
1498
+ {
1499
+ "name": "end_time",
1500
+ "type": "i64"
1501
+ }
1502
+ ]
1503
+ }
1504
+ },
1369
1505
  {
1370
1506
  "name": "Market",
1371
1507
  "type": {
@@ -1800,6 +1936,20 @@
1800
1936
  ]
1801
1937
  }
1802
1938
  },
1939
+ {
1940
+ "name": "QuestionStatus",
1941
+ "type": {
1942
+ "kind": "enum",
1943
+ "variants": [
1944
+ {
1945
+ "name": "Resolved"
1946
+ },
1947
+ {
1948
+ "name": "Unresolved"
1949
+ }
1950
+ ]
1951
+ }
1952
+ },
1803
1953
  {
1804
1954
  "name": "QuestionUpdate",
1805
1955
  "type": {
@@ -1854,16 +2004,24 @@
1854
2004
  "type": "u64"
1855
2005
  },
1856
2006
  {
1857
- "name": "direction",
2007
+ "name": "timestamp",
2008
+ "type": "i64"
2009
+ },
2010
+ {
2011
+ "name": "total_hype_shares",
2012
+ "type": "u64"
2013
+ },
2014
+ {
2015
+ "name": "total_flop_shares",
2016
+ "type": "u64"
2017
+ },
2018
+ {
2019
+ "name": "status",
1858
2020
  "type": {
1859
2021
  "defined": {
1860
- "name": "OrderDirection"
2022
+ "name": "QuestionStatus"
1861
2023
  }
1862
2024
  }
1863
- },
1864
- {
1865
- "name": "timestamp",
1866
- "type": "i64"
1867
2025
  }
1868
2026
  ]
1869
2027
  }
@@ -1927,10 +2085,20 @@
1927
2085
  "docs": ["Final price for Flop outcome at the end of the week"],
1928
2086
  "type": "u64"
1929
2087
  },
2088
+ {
2089
+ "name": "total_hype_shares",
2090
+ "docs": ["Total number of Hype shares issued"],
2091
+ "type": "u64"
2092
+ },
2093
+ {
2094
+ "name": "total_flop_shares",
2095
+ "docs": ["Total number of Flop shares issued"],
2096
+ "type": "u64"
2097
+ },
1930
2098
  {
1931
2099
  "name": "padding",
1932
2100
  "type": {
1933
- "array": ["u8", 56]
2101
+ "array": ["u8", 40]
1934
2102
  }
1935
2103
  }
1936
2104
  ]
@@ -2243,6 +2411,9 @@
2243
2411
  "type": {
2244
2412
  "kind": "enum",
2245
2413
  "variants": [
2414
+ {
2415
+ "name": "None"
2416
+ },
2246
2417
  {
2247
2418
  "name": "Hype"
2248
2419
  },
@@ -2250,7 +2421,7 @@
2250
2421
  "name": "Flop"
2251
2422
  },
2252
2423
  {
2253
- "name": "None"
2424
+ "name": "Draw"
2254
2425
  }
2255
2426
  ]
2256
2427
  }
@@ -556,6 +556,104 @@ export type TriadProtocol = {
556
556
  }
557
557
  ];
558
558
  },
559
+ {
560
+ name: 'initializeQuestion';
561
+ discriminator: [245, 151, 106, 188, 88, 44, 65, 212];
562
+ accounts: [
563
+ {
564
+ name: 'signer';
565
+ writable: true;
566
+ signer: true;
567
+ },
568
+ {
569
+ name: 'market';
570
+ writable: true;
571
+ },
572
+ {
573
+ name: 'mint';
574
+ writable: true;
575
+ },
576
+ {
577
+ name: 'marketVault';
578
+ writable: true;
579
+ pda: {
580
+ seeds: [
581
+ {
582
+ kind: 'account';
583
+ path: 'market';
584
+ },
585
+ {
586
+ kind: 'account';
587
+ path: 'tokenProgram';
588
+ },
589
+ {
590
+ kind: 'account';
591
+ path: 'mint';
592
+ }
593
+ ];
594
+ program: {
595
+ kind: 'const';
596
+ value: [
597
+ 140,
598
+ 151,
599
+ 37,
600
+ 143,
601
+ 78,
602
+ 36,
603
+ 137,
604
+ 241,
605
+ 187,
606
+ 61,
607
+ 16,
608
+ 41,
609
+ 20,
610
+ 142,
611
+ 13,
612
+ 131,
613
+ 11,
614
+ 90,
615
+ 19,
616
+ 153,
617
+ 218,
618
+ 255,
619
+ 16,
620
+ 132,
621
+ 4,
622
+ 142,
623
+ 123,
624
+ 216,
625
+ 219,
626
+ 233,
627
+ 248,
628
+ 89
629
+ ];
630
+ };
631
+ };
632
+ },
633
+ {
634
+ name: 'tokenProgram';
635
+ address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
636
+ },
637
+ {
638
+ name: 'associatedTokenProgram';
639
+ address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
640
+ },
641
+ {
642
+ name: 'systemProgram';
643
+ address: '11111111111111111111111111111111';
644
+ }
645
+ ];
646
+ args: [
647
+ {
648
+ name: 'args';
649
+ type: {
650
+ defined: {
651
+ name: 'initializeQuestionArgs';
652
+ };
653
+ };
654
+ }
655
+ ];
656
+ },
559
657
  {
560
658
  name: 'openOrder';
561
659
  discriminator: [206, 88, 88, 143, 38, 136, 50, 224];
@@ -759,6 +857,26 @@ export type TriadProtocol = {
759
857
  ];
760
858
  args: [];
761
859
  },
860
+ {
861
+ name: 'resolveQuestion';
862
+ discriminator: [52, 32, 224, 179, 180, 8, 0, 246];
863
+ accounts: [
864
+ {
865
+ name: 'signer';
866
+ writable: true;
867
+ signer: true;
868
+ },
869
+ {
870
+ name: 'market';
871
+ writable: true;
872
+ },
873
+ {
874
+ name: 'systemProgram';
875
+ address: '11111111111111111111111111111111';
876
+ }
877
+ ];
878
+ args: [];
879
+ },
762
880
  {
763
881
  name: 'stakeNft';
764
882
  discriminator: [38, 27, 66, 46, 69, 65, 151, 219];
@@ -1698,6 +1816,31 @@ export type TriadProtocol = {
1698
1816
  code: 6034;
1699
1817
  name: 'orderSizeTooLarge';
1700
1818
  msg: 'Order size too large';
1819
+ },
1820
+ {
1821
+ code: 6035;
1822
+ name: 'questionPeriodNotEnded';
1823
+ msg: 'Question period not ended';
1824
+ },
1825
+ {
1826
+ code: 6036;
1827
+ name: 'invalidStartTime';
1828
+ msg: 'Invalid start time';
1829
+ },
1830
+ {
1831
+ code: 6037;
1832
+ name: 'invalidEndTime';
1833
+ msg: 'Invalid end time';
1834
+ },
1835
+ {
1836
+ code: 6038;
1837
+ name: 'questionPeriodNotStarted';
1838
+ msg: 'Question period not started';
1839
+ },
1840
+ {
1841
+ code: 6039;
1842
+ name: 'questionPeriodEnded';
1843
+ msg: 'Question period ended';
1701
1844
  }
1702
1845
  ];
1703
1846
  types: [
@@ -1807,6 +1950,28 @@ export type TriadProtocol = {
1807
1950
  ];
1808
1951
  };
1809
1952
  },
1953
+ {
1954
+ name: 'initializeQuestionArgs';
1955
+ type: {
1956
+ kind: 'struct';
1957
+ fields: [
1958
+ {
1959
+ name: 'question';
1960
+ type: {
1961
+ array: ['u8', 80];
1962
+ };
1963
+ },
1964
+ {
1965
+ name: 'startTime';
1966
+ type: 'i64';
1967
+ },
1968
+ {
1969
+ name: 'endTime';
1970
+ type: 'i64';
1971
+ }
1972
+ ];
1973
+ };
1974
+ },
1810
1975
  {
1811
1976
  name: 'market';
1812
1977
  type: {
@@ -2239,6 +2404,20 @@ export type TriadProtocol = {
2239
2404
  ];
2240
2405
  };
2241
2406
  },
2407
+ {
2408
+ name: 'questionStatus';
2409
+ type: {
2410
+ kind: 'enum';
2411
+ variants: [
2412
+ {
2413
+ name: 'resolved';
2414
+ },
2415
+ {
2416
+ name: 'unresolved';
2417
+ }
2418
+ ];
2419
+ };
2420
+ },
2242
2421
  {
2243
2422
  name: 'questionUpdate';
2244
2423
  type: {
@@ -2293,16 +2472,24 @@ export type TriadProtocol = {
2293
2472
  type: 'u64';
2294
2473
  },
2295
2474
  {
2296
- name: 'direction';
2475
+ name: 'timestamp';
2476
+ type: 'i64';
2477
+ },
2478
+ {
2479
+ name: 'totalHypeShares';
2480
+ type: 'u64';
2481
+ },
2482
+ {
2483
+ name: 'totalFlopShares';
2484
+ type: 'u64';
2485
+ },
2486
+ {
2487
+ name: 'status';
2297
2488
  type: {
2298
2489
  defined: {
2299
- name: 'orderDirection';
2490
+ name: 'questionStatus';
2300
2491
  };
2301
2492
  };
2302
- },
2303
- {
2304
- name: 'timestamp';
2305
- type: 'i64';
2306
2493
  }
2307
2494
  ];
2308
2495
  };
@@ -2366,10 +2553,20 @@ export type TriadProtocol = {
2366
2553
  docs: ['Final price for Flop outcome at the end of the week'];
2367
2554
  type: 'u64';
2368
2555
  },
2556
+ {
2557
+ name: 'totalHypeShares';
2558
+ docs: ['Total number of Hype shares issued'];
2559
+ type: 'u64';
2560
+ },
2561
+ {
2562
+ name: 'totalFlopShares';
2563
+ docs: ['Total number of Flop shares issued'];
2564
+ type: 'u64';
2565
+ },
2369
2566
  {
2370
2567
  name: 'padding';
2371
2568
  type: {
2372
- array: ['u8', 56];
2569
+ array: ['u8', 40];
2373
2570
  };
2374
2571
  }
2375
2572
  ];
@@ -2682,6 +2879,9 @@ export type TriadProtocol = {
2682
2879
  type: {
2683
2880
  kind: 'enum';
2684
2881
  variants: [
2882
+ {
2883
+ name: 'none';
2884
+ },
2685
2885
  {
2686
2886
  name: 'hype';
2687
2887
  },
@@ -2689,7 +2889,7 @@ export type TriadProtocol = {
2689
2889
  name: 'flop';
2690
2890
  },
2691
2891
  {
2692
- name: 'none';
2892
+ name: 'draw';
2693
2893
  }
2694
2894
  ];
2695
2895
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "0.7.4-beta.devnet",
3
+ "version": "0.7.5-beta.devnet",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",