@triadxyz/triad-protocol 3.4.4-beta → 3.4.6-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.js CHANGED
@@ -71,7 +71,7 @@ class TriadProtocol {
71
71
  const orders = yield this.program.account.orderV2.all([
72
72
  {
73
73
  memcmp: {
74
- offset: 8 + 1,
74
+ offset: 8,
75
75
  bytes: wallet.toBase58()
76
76
  }
77
77
  }
@@ -512,6 +512,7 @@ class TriadProtocol {
512
512
  ixs.push(yield this.program.methods
513
513
  .openOrder({
514
514
  amount: new bn_js_1.default(amountInTRD),
515
+ marketId: new bn_js_1.default(marketId),
515
516
  orderDirection
516
517
  })
517
518
  .accounts({
@@ -640,12 +641,15 @@ class TriadProtocol {
640
641
  .placeBidOrder({
641
642
  amount: new bn_js_1.default(order.amount * Math.pow(10, constants_1.BASE_DECIMALS)),
642
643
  price: new bn_js_1.default(order.price * Math.pow(10, constants_1.BASE_DECIMALS)),
644
+ marketId: new bn_js_1.default(order.marketId),
643
645
  orderDirection: order.orderDirection
644
646
  })
645
647
  .accounts({
646
648
  signer: this.program.provider.publicKey,
649
+ payer: this.rpcOptions.payer,
647
650
  market: (0, pda_1.getMarketPDA)(this.program.programId, order.marketId),
648
- orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, order.marketId)
651
+ orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, order.marketId),
652
+ order: (0, pda_1.getOrderPDA)(this.program.programId, this.program.provider.publicKey, order.marketId, (0, helpers_1.getOrderDirection)(order.orderDirection))
649
653
  })
650
654
  .instruction());
651
655
  }
@@ -677,6 +681,7 @@ class TriadProtocol {
677
681
  .accounts({
678
682
  signer: this.program.provider.publicKey,
679
683
  market: (0, pda_1.getMarketPDA)(this.program.programId, order.marketId),
684
+ order: (0, pda_1.getOrderPDA)(this.program.programId, this.program.provider.publicKey, order.marketId, (0, helpers_1.getOrderDirection)(order.orderDirection)),
680
685
  orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, order.marketId)
681
686
  })
682
687
  .instruction());
@@ -734,7 +739,8 @@ class TriadProtocol {
734
739
  .accounts({
735
740
  signer: this.program.provider.publicKey,
736
741
  market: (0, pda_1.getMarketPDA)(this.program.programId, order.marketId),
737
- orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, order.marketId)
742
+ orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, order.marketId),
743
+ order: (0, pda_1.getOrderPDA)(this.program.programId, this.program.provider.publicKey, order.marketId, (0, helpers_1.getOrderDirection)(order.orderDirection))
738
744
  })
739
745
  .instruction());
740
746
  }
@@ -833,12 +839,14 @@ class TriadProtocol {
833
839
  ixs.push(yield this.program.methods
834
840
  .marketBidOrder({
835
841
  amount: new bn_js_1.default(usdcAmount),
842
+ marketId: new bn_js_1.default(marketId),
836
843
  orderDirection,
837
844
  bookOrderAskId: new bn_js_1.default(order.id),
838
845
  oppositeOrderDirection: (0, helpers_1.getOppositeOrderDirectionEncoded)(orderDirection)
839
846
  })
840
847
  .accounts({
841
848
  signer: this.program.provider.publicKey,
849
+ payer: this.rpcOptions.payer,
842
850
  market: marketPDA,
843
851
  orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, marketId),
844
852
  bookOrderAskAuthority: new web3_js_1.PublicKey(order.authority),
@@ -900,7 +908,9 @@ class TriadProtocol {
900
908
  market: marketPDA,
901
909
  buyerAuthority: new web3_js_1.PublicKey(order.authority),
902
910
  orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, marketId),
903
- marketAta: (0, pda_1.getTokenATA)(marketPDA, constants_1.USDC_MINT, spl_token_1.TOKEN_PROGRAM_ID)
911
+ marketAta: (0, pda_1.getTokenATA)(marketPDA, constants_1.USDC_MINT, spl_token_1.TOKEN_PROGRAM_ID),
912
+ bidOrder: (0, pda_1.getOrderPDA)(this.program.programId, new web3_js_1.PublicKey(order.authority), marketId, (0, helpers_1.getOrderDirection)(orderDirection)),
913
+ askOrder: (0, pda_1.getOrderPDA)(this.program.programId, this.program.provider.publicKey, marketId, (0, helpers_1.getOrderDirection)(orderDirection))
904
914
  })
905
915
  .instruction());
906
916
  }
@@ -165,28 +165,7 @@
165
165
  },
166
166
  {
167
167
  "name": "order",
168
- "writable": true,
169
- "pda": {
170
- "seeds": [
171
- {
172
- "kind": "const",
173
- "value": [111, 114, 100, 101, 114]
174
- },
175
- {
176
- "kind": "account",
177
- "path": "signer"
178
- },
179
- {
180
- "kind": "account",
181
- "path": "market.market_id",
182
- "account": "MarketV2"
183
- },
184
- {
185
- "kind": "arg",
186
- "path": "args.order_direction"
187
- }
188
- ]
189
- }
168
+ "writable": true
190
169
  },
191
170
  {
192
171
  "name": "system_program",
@@ -576,28 +555,7 @@
576
555
  },
577
556
  {
578
557
  "name": "order",
579
- "writable": true,
580
- "pda": {
581
- "seeds": [
582
- {
583
- "kind": "const",
584
- "value": [111, 114, 100, 101, 114]
585
- },
586
- {
587
- "kind": "account",
588
- "path": "signer"
589
- },
590
- {
591
- "kind": "account",
592
- "path": "market.market_id",
593
- "account": "MarketV2"
594
- },
595
- {
596
- "kind": "arg",
597
- "path": "order_direction"
598
- }
599
- ]
600
- }
558
+ "writable": true
601
559
  },
602
560
  {
603
561
  "name": "mint",
@@ -1392,53 +1350,11 @@
1392
1350
  },
1393
1351
  {
1394
1352
  "name": "ask_order",
1395
- "writable": true,
1396
- "pda": {
1397
- "seeds": [
1398
- {
1399
- "kind": "const",
1400
- "value": [111, 114, 100, 101, 114]
1401
- },
1402
- {
1403
- "kind": "account",
1404
- "path": "signer"
1405
- },
1406
- {
1407
- "kind": "account",
1408
- "path": "market.market_id",
1409
- "account": "MarketV2"
1410
- },
1411
- {
1412
- "kind": "arg",
1413
- "path": "args.order_direction"
1414
- }
1415
- ]
1416
- }
1353
+ "writable": true
1417
1354
  },
1418
1355
  {
1419
1356
  "name": "bid_order",
1420
- "writable": true,
1421
- "pda": {
1422
- "seeds": [
1423
- {
1424
- "kind": "const",
1425
- "value": [111, 114, 100, 101, 114]
1426
- },
1427
- {
1428
- "kind": "account",
1429
- "path": "buyer_authority"
1430
- },
1431
- {
1432
- "kind": "account",
1433
- "path": "market.market_id",
1434
- "account": "MarketV2"
1435
- },
1436
- {
1437
- "kind": "arg",
1438
- "path": "args.order_direction"
1439
- }
1440
- ]
1441
- }
1357
+ "writable": true
1442
1358
  },
1443
1359
  {
1444
1360
  "name": "buyer_authority",
@@ -1529,28 +1445,7 @@
1529
1445
  },
1530
1446
  {
1531
1447
  "name": "order",
1532
- "writable": true,
1533
- "pda": {
1534
- "seeds": [
1535
- {
1536
- "kind": "const",
1537
- "value": [111, 114, 100, 101, 114]
1538
- },
1539
- {
1540
- "kind": "account",
1541
- "path": "signer"
1542
- },
1543
- {
1544
- "kind": "account",
1545
- "path": "market.market_id",
1546
- "account": "MarketV2"
1547
- },
1548
- {
1549
- "kind": "arg",
1550
- "path": "args.order_direction"
1551
- }
1552
- ]
1553
- }
1448
+ "writable": true
1554
1449
  },
1555
1450
  {
1556
1451
  "name": "opposite_order",
@@ -1688,27 +1583,7 @@
1688
1583
  },
1689
1584
  {
1690
1585
  "name": "order",
1691
- "writable": true,
1692
- "pda": {
1693
- "seeds": [
1694
- {
1695
- "kind": "const",
1696
- "value": [111, 114, 100, 101, 114]
1697
- },
1698
- {
1699
- "kind": "account",
1700
- "path": "signer"
1701
- },
1702
- {
1703
- "kind": "arg",
1704
- "path": "args.market_id"
1705
- },
1706
- {
1707
- "kind": "arg",
1708
- "path": "args.order_direction"
1709
- }
1710
- ]
1711
- }
1586
+ "writable": true
1712
1587
  },
1713
1588
  {
1714
1589
  "name": "system_program",
@@ -1751,28 +1626,7 @@
1751
1626
  },
1752
1627
  {
1753
1628
  "name": "order",
1754
- "writable": true,
1755
- "pda": {
1756
- "seeds": [
1757
- {
1758
- "kind": "const",
1759
- "value": [111, 114, 100, 101, 114]
1760
- },
1761
- {
1762
- "kind": "account",
1763
- "path": "signer"
1764
- },
1765
- {
1766
- "kind": "account",
1767
- "path": "market.market_id",
1768
- "account": "MarketV2"
1769
- },
1770
- {
1771
- "kind": "arg",
1772
- "path": "args.order_direction"
1773
- }
1774
- ]
1775
- }
1629
+ "writable": true
1776
1630
  },
1777
1631
  {
1778
1632
  "name": "mint",
@@ -1871,34 +1725,18 @@
1871
1725
  "writable": true,
1872
1726
  "signer": true
1873
1727
  },
1728
+ {
1729
+ "name": "squads",
1730
+ "writable": true,
1731
+ "address": "Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4"
1732
+ },
1874
1733
  {
1875
1734
  "name": "market",
1876
1735
  "writable": true
1877
1736
  },
1878
1737
  {
1879
1738
  "name": "order",
1880
- "writable": true,
1881
- "pda": {
1882
- "seeds": [
1883
- {
1884
- "kind": "const",
1885
- "value": [111, 114, 100, 101, 114]
1886
- },
1887
- {
1888
- "kind": "account",
1889
- "path": "signer"
1890
- },
1891
- {
1892
- "kind": "account",
1893
- "path": "market.market_id",
1894
- "account": "MarketV2"
1895
- },
1896
- {
1897
- "kind": "arg",
1898
- "path": "order_direction"
1899
- }
1900
- ]
1901
- }
1739
+ "writable": true
1902
1740
  },
1903
1741
  {
1904
1742
  "name": "mint",
@@ -2002,28 +1840,7 @@
2002
1840
  },
2003
1841
  {
2004
1842
  "name": "order",
2005
- "writable": true,
2006
- "pda": {
2007
- "seeds": [
2008
- {
2009
- "kind": "const",
2010
- "value": [111, 114, 100, 101, 114]
2011
- },
2012
- {
2013
- "kind": "account",
2014
- "path": "signer"
2015
- },
2016
- {
2017
- "kind": "account",
2018
- "path": "market.market_id",
2019
- "account": "MarketV2"
2020
- },
2021
- {
2022
- "kind": "arg",
2023
- "path": "args.order_direction"
2024
- }
2025
- ]
2026
- }
1843
+ "writable": true
2027
1844
  },
2028
1845
  {
2029
1846
  "name": "system_program",
@@ -2065,28 +1882,7 @@
2065
1882
  },
2066
1883
  {
2067
1884
  "name": "order",
2068
- "writable": true,
2069
- "pda": {
2070
- "seeds": [
2071
- {
2072
- "kind": "const",
2073
- "value": [111, 114, 100, 101, 114]
2074
- },
2075
- {
2076
- "kind": "account",
2077
- "path": "signer"
2078
- },
2079
- {
2080
- "kind": "account",
2081
- "path": "market.market_id",
2082
- "account": "MarketV2"
2083
- },
2084
- {
2085
- "kind": "arg",
2086
- "path": "args.order_direction"
2087
- }
2088
- ]
2089
- }
1885
+ "writable": true
2090
1886
  },
2091
1887
  {
2092
1888
  "name": "mint",
@@ -3968,6 +3764,10 @@
3968
3764
  }
3969
3765
  }
3970
3766
  },
3767
+ {
3768
+ "name": "market_id",
3769
+ "type": "u64"
3770
+ },
3971
3771
  {
3972
3772
  "name": "opposite_order_direction",
3973
3773
  "type": {
@@ -4313,6 +4113,10 @@
4313
4113
  "name": "amount",
4314
4114
  "type": "u64"
4315
4115
  },
4116
+ {
4117
+ "name": "market_id",
4118
+ "type": "u64"
4119
+ },
4316
4120
  {
4317
4121
  "name": "order_direction",
4318
4122
  "type": {
@@ -4705,6 +4509,10 @@
4705
4509
  "name": "price",
4706
4510
  "type": "u64"
4707
4511
  },
4512
+ {
4513
+ "name": "market_id",
4514
+ "type": "u64"
4515
+ },
4708
4516
  {
4709
4517
  "name": "order_direction",
4710
4518
  "type": {
@@ -242,27 +242,6 @@ export type TriadProtocol = {
242
242
  {
243
243
  name: 'order';
244
244
  writable: true;
245
- pda: {
246
- seeds: [
247
- {
248
- kind: 'const';
249
- value: [111, 114, 100, 101, 114];
250
- },
251
- {
252
- kind: 'account';
253
- path: 'signer';
254
- },
255
- {
256
- kind: 'account';
257
- path: 'market.market_id';
258
- account: 'marketV2';
259
- },
260
- {
261
- kind: 'arg';
262
- path: 'args.order_direction';
263
- }
264
- ];
265
- };
266
245
  },
267
246
  {
268
247
  name: 'systemProgram';
@@ -837,27 +816,6 @@ export type TriadProtocol = {
837
816
  {
838
817
  name: 'order';
839
818
  writable: true;
840
- pda: {
841
- seeds: [
842
- {
843
- kind: 'const';
844
- value: [111, 114, 100, 101, 114];
845
- },
846
- {
847
- kind: 'account';
848
- path: 'signer';
849
- },
850
- {
851
- kind: 'account';
852
- path: 'market.market_id';
853
- account: 'marketV2';
854
- },
855
- {
856
- kind: 'arg';
857
- path: 'orderDirection';
858
- }
859
- ];
860
- };
861
819
  },
862
820
  {
863
821
  name: 'mint';
@@ -1984,52 +1942,10 @@ export type TriadProtocol = {
1984
1942
  {
1985
1943
  name: 'askOrder';
1986
1944
  writable: true;
1987
- pda: {
1988
- seeds: [
1989
- {
1990
- kind: 'const';
1991
- value: [111, 114, 100, 101, 114];
1992
- },
1993
- {
1994
- kind: 'account';
1995
- path: 'signer';
1996
- },
1997
- {
1998
- kind: 'account';
1999
- path: 'market.market_id';
2000
- account: 'marketV2';
2001
- },
2002
- {
2003
- kind: 'arg';
2004
- path: 'args.order_direction';
2005
- }
2006
- ];
2007
- };
2008
1945
  },
2009
1946
  {
2010
1947
  name: 'bidOrder';
2011
1948
  writable: true;
2012
- pda: {
2013
- seeds: [
2014
- {
2015
- kind: 'const';
2016
- value: [111, 114, 100, 101, 114];
2017
- },
2018
- {
2019
- kind: 'account';
2020
- path: 'buyerAuthority';
2021
- },
2022
- {
2023
- kind: 'account';
2024
- path: 'market.market_id';
2025
- account: 'marketV2';
2026
- },
2027
- {
2028
- kind: 'arg';
2029
- path: 'args.order_direction';
2030
- }
2031
- ];
2032
- };
2033
1949
  },
2034
1950
  {
2035
1951
  name: 'buyerAuthority';
@@ -2150,27 +2066,6 @@ export type TriadProtocol = {
2150
2066
  {
2151
2067
  name: 'order';
2152
2068
  writable: true;
2153
- pda: {
2154
- seeds: [
2155
- {
2156
- kind: 'const';
2157
- value: [111, 114, 100, 101, 114];
2158
- },
2159
- {
2160
- kind: 'account';
2161
- path: 'signer';
2162
- },
2163
- {
2164
- kind: 'account';
2165
- path: 'market.market_id';
2166
- account: 'marketV2';
2167
- },
2168
- {
2169
- kind: 'arg';
2170
- path: 'args.order_direction';
2171
- }
2172
- ];
2173
- };
2174
2069
  },
2175
2070
  {
2176
2071
  name: 'oppositeOrder';
@@ -2396,26 +2291,6 @@ export type TriadProtocol = {
2396
2291
  {
2397
2292
  name: 'order';
2398
2293
  writable: true;
2399
- pda: {
2400
- seeds: [
2401
- {
2402
- kind: 'const';
2403
- value: [111, 114, 100, 101, 114];
2404
- },
2405
- {
2406
- kind: 'account';
2407
- path: 'signer';
2408
- },
2409
- {
2410
- kind: 'arg';
2411
- path: 'args.market_id';
2412
- },
2413
- {
2414
- kind: 'arg';
2415
- path: 'args.order_direction';
2416
- }
2417
- ];
2418
- };
2419
2294
  },
2420
2295
  {
2421
2296
  name: 'systemProgram';
@@ -2459,27 +2334,6 @@ export type TriadProtocol = {
2459
2334
  {
2460
2335
  name: 'order';
2461
2336
  writable: true;
2462
- pda: {
2463
- seeds: [
2464
- {
2465
- kind: 'const';
2466
- value: [111, 114, 100, 101, 114];
2467
- },
2468
- {
2469
- kind: 'account';
2470
- path: 'signer';
2471
- },
2472
- {
2473
- kind: 'account';
2474
- path: 'market.market_id';
2475
- account: 'marketV2';
2476
- },
2477
- {
2478
- kind: 'arg';
2479
- path: 'args.order_direction';
2480
- }
2481
- ];
2482
- };
2483
2337
  },
2484
2338
  {
2485
2339
  name: 'mint';
@@ -2636,6 +2490,11 @@ export type TriadProtocol = {
2636
2490
  writable: true;
2637
2491
  signer: true;
2638
2492
  },
2493
+ {
2494
+ name: 'squads';
2495
+ writable: true;
2496
+ address: 'Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4';
2497
+ },
2639
2498
  {
2640
2499
  name: 'market';
2641
2500
  writable: true;
@@ -2643,27 +2502,6 @@ export type TriadProtocol = {
2643
2502
  {
2644
2503
  name: 'order';
2645
2504
  writable: true;
2646
- pda: {
2647
- seeds: [
2648
- {
2649
- kind: 'const';
2650
- value: [111, 114, 100, 101, 114];
2651
- },
2652
- {
2653
- kind: 'account';
2654
- path: 'signer';
2655
- },
2656
- {
2657
- kind: 'account';
2658
- path: 'market.market_id';
2659
- account: 'marketV2';
2660
- },
2661
- {
2662
- kind: 'arg';
2663
- path: 'orderDirection';
2664
- }
2665
- ];
2666
- };
2667
2505
  },
2668
2506
  {
2669
2507
  name: 'mint';
@@ -2826,27 +2664,6 @@ export type TriadProtocol = {
2826
2664
  {
2827
2665
  name: 'order';
2828
2666
  writable: true;
2829
- pda: {
2830
- seeds: [
2831
- {
2832
- kind: 'const';
2833
- value: [111, 114, 100, 101, 114];
2834
- },
2835
- {
2836
- kind: 'account';
2837
- path: 'signer';
2838
- },
2839
- {
2840
- kind: 'account';
2841
- path: 'market.market_id';
2842
- account: 'marketV2';
2843
- },
2844
- {
2845
- kind: 'arg';
2846
- path: 'args.order_direction';
2847
- }
2848
- ];
2849
- };
2850
2667
  },
2851
2668
  {
2852
2669
  name: 'systemProgram';
@@ -2889,27 +2706,6 @@ export type TriadProtocol = {
2889
2706
  {
2890
2707
  name: 'order';
2891
2708
  writable: true;
2892
- pda: {
2893
- seeds: [
2894
- {
2895
- kind: 'const';
2896
- value: [111, 114, 100, 101, 114];
2897
- },
2898
- {
2899
- kind: 'account';
2900
- path: 'signer';
2901
- },
2902
- {
2903
- kind: 'account';
2904
- path: 'market.market_id';
2905
- account: 'marketV2';
2906
- },
2907
- {
2908
- kind: 'arg';
2909
- path: 'args.order_direction';
2910
- }
2911
- ];
2912
- };
2913
2709
  },
2914
2710
  {
2915
2711
  name: 'mint';
@@ -5059,6 +4855,10 @@ export type TriadProtocol = {
5059
4855
  };
5060
4856
  };
5061
4857
  },
4858
+ {
4859
+ name: 'marketId';
4860
+ type: 'u64';
4861
+ },
5062
4862
  {
5063
4863
  name: 'oppositeOrderDirection';
5064
4864
  type: {
@@ -5404,6 +5204,10 @@ export type TriadProtocol = {
5404
5204
  name: 'amount';
5405
5205
  type: 'u64';
5406
5206
  },
5207
+ {
5208
+ name: 'marketId';
5209
+ type: 'u64';
5210
+ },
5407
5211
  {
5408
5212
  name: 'orderDirection';
5409
5213
  type: {
@@ -5796,6 +5600,10 @@ export type TriadProtocol = {
5796
5600
  name: 'price';
5797
5601
  type: 'u64';
5798
5602
  },
5603
+ {
5604
+ name: 'marketId';
5605
+ type: 'u64';
5606
+ },
5799
5607
  {
5800
5608
  name: 'orderDirection';
5801
5609
  type: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "3.4.4-beta",
3
+ "version": "3.4.6-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",