@triadxyz/triad-protocol 2.3.5-beta → 2.3.7-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 CHANGED
@@ -373,6 +373,16 @@ export default class TriadProtocolClient {
373
373
  * @param options - RPC options
374
374
  */
375
375
  marketBidOrder({ marketId, amount, direction, mint, feeBps }: MarketBidOrderArgs, options?: RpcOptions): Promise<string>;
376
+ /**
377
+ * Market Ask Order
378
+ * @param args.marketId - The ID of the Market
379
+ * @param args.shares - The amount of the Order
380
+ * @param args.bidOrderId - The ID of the Bid Order
381
+ * @param args.direction - The direction of the Order
382
+ * @param args.mint - The mint of the Order
383
+ *
384
+ * @param options - RPC options
385
+ */
376
386
  marketAskOrder({ marketId, shares, bidOrderId, direction, mint }: MarketAskOrderArgs, options?: RpcOptions): Promise<string>;
377
387
  /**
378
388
  * Get Orders By Market ID
package/dist/index.js CHANGED
@@ -188,6 +188,7 @@ class TriadProtocolClient {
188
188
  tokenProgram: (0, helpers_1.getTokenProgram)(mint),
189
189
  customer,
190
190
  pool: poolPDA,
191
+ orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, marketId),
191
192
  userTrade
192
193
  })
193
194
  .instruction());
@@ -243,6 +244,7 @@ class TriadProtocolClient {
243
244
  mint,
244
245
  tokenProgram: (0, helpers_1.getTokenProgram)(mint),
245
246
  pool: poolPDA,
247
+ orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, market.marketId),
246
248
  customer,
247
249
  userTrade
248
250
  })
@@ -776,6 +778,16 @@ class TriadProtocolClient {
776
778
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, options);
777
779
  });
778
780
  }
781
+ /**
782
+ * Market Ask Order
783
+ * @param args.marketId - The ID of the Market
784
+ * @param args.shares - The amount of the Order
785
+ * @param args.bidOrderId - The ID of the Bid Order
786
+ * @param args.direction - The direction of the Order
787
+ * @param args.mint - The mint of the Order
788
+ *
789
+ * @param options - RPC options
790
+ */
779
791
  marketAskOrder({ marketId, shares, bidOrderId, direction, mint }, options) {
780
792
  return __awaiter(this, void 0, void 0, function* () {
781
793
  const marketPDA = (0, pda_1.getMarketPDA)(this.program.programId, marketId);
@@ -694,18 +694,7 @@
694
694
  {
695
695
  "name": "order_book",
696
696
  "writable": true,
697
- "pda": {
698
- "seeds": [
699
- {
700
- "kind": "const",
701
- "value": [111, 114, 100, 101, 114, 95, 98, 111, 111, 107]
702
- },
703
- {
704
- "kind": "arg",
705
- "path": "args.market_id"
706
- }
707
- ]
708
- }
697
+ "signer": true
709
698
  },
710
699
  {
711
700
  "name": "mint",
@@ -2010,8 +1999,8 @@
2010
1999
  "discriminator": [212, 67, 145, 23, 58, 104, 52, 83]
2011
2000
  },
2012
2001
  {
2013
- "name": "OrderBookRewardsEvent",
2014
- "discriminator": [63, 134, 65, 51, 227, 192, 87, 114]
2002
+ "name": "OrderBookFilledEvent",
2003
+ "discriminator": [245, 59, 174, 245, 216, 23, 188, 165]
2015
2004
  },
2016
2005
  {
2017
2006
  "name": "OrderEvent",
@@ -2175,11 +2164,6 @@
2175
2164
  "code": 6028,
2176
2165
  "name": "MarketAlreadyPaidOut",
2177
2166
  "msg": "Market already paid out"
2178
- },
2179
- {
2180
- "code": 6029,
2181
- "name": "InvalidAccount",
2182
- "msg": "Invalid account"
2183
2167
  }
2184
2168
  ],
2185
2169
  "types": [
@@ -2317,7 +2301,7 @@
2317
2301
  "kind": "struct",
2318
2302
  "fields": [
2319
2303
  {
2320
- "name": "ts",
2304
+ "name": "timestamp",
2321
2305
  "type": "i64"
2322
2306
  },
2323
2307
  {
@@ -3049,7 +3033,7 @@
3049
3033
  }
3050
3034
  },
3051
3035
  {
3052
- "name": "OrderBookRewardsEvent",
3036
+ "name": "OrderBookFilledEvent",
3053
3037
  "type": {
3054
3038
  "kind": "struct",
3055
3039
  "fields": [
@@ -3062,7 +3046,23 @@
3062
3046
  "type": "pubkey"
3063
3047
  },
3064
3048
  {
3065
- "name": "amount",
3049
+ "name": "shares",
3050
+ "type": "u64"
3051
+ },
3052
+ {
3053
+ "name": "price",
3054
+ "type": "u64"
3055
+ },
3056
+ {
3057
+ "name": "order_direction",
3058
+ "type": {
3059
+ "defined": {
3060
+ "name": "OrderDirection"
3061
+ }
3062
+ }
3063
+ },
3064
+ {
3065
+ "name": "rewards",
3066
3066
  "type": "u64"
3067
3067
  },
3068
3068
  {
@@ -1002,18 +1002,7 @@ export type TriadProtocol = {
1002
1002
  {
1003
1003
  name: 'orderBook';
1004
1004
  writable: true;
1005
- pda: {
1006
- seeds: [
1007
- {
1008
- kind: 'const';
1009
- value: [111, 114, 100, 101, 114, 95, 98, 111, 111, 107];
1010
- },
1011
- {
1012
- kind: 'arg';
1013
- path: 'args.market_id';
1014
- }
1015
- ];
1016
- };
1005
+ signer: true;
1017
1006
  },
1018
1007
  {
1019
1008
  name: 'mint';
@@ -2789,8 +2778,8 @@ export type TriadProtocol = {
2789
2778
  discriminator: [212, 67, 145, 23, 58, 104, 52, 83];
2790
2779
  },
2791
2780
  {
2792
- name: 'orderBookRewardsEvent';
2793
- discriminator: [63, 134, 65, 51, 227, 192, 87, 114];
2781
+ name: 'orderBookFilledEvent';
2782
+ discriminator: [245, 59, 174, 245, 216, 23, 188, 165];
2794
2783
  },
2795
2784
  {
2796
2785
  name: 'orderEvent';
@@ -2954,11 +2943,6 @@ export type TriadProtocol = {
2954
2943
  code: 6028;
2955
2944
  name: 'marketAlreadyPaidOut';
2956
2945
  msg: 'Market already paid out';
2957
- },
2958
- {
2959
- code: 6029;
2960
- name: 'invalidAccount';
2961
- msg: 'Invalid account';
2962
2946
  }
2963
2947
  ];
2964
2948
  types: [
@@ -3096,7 +3080,7 @@ export type TriadProtocol = {
3096
3080
  kind: 'struct';
3097
3081
  fields: [
3098
3082
  {
3099
- name: 'ts';
3083
+ name: 'timestamp';
3100
3084
  type: 'i64';
3101
3085
  },
3102
3086
  {
@@ -3828,7 +3812,7 @@ export type TriadProtocol = {
3828
3812
  };
3829
3813
  },
3830
3814
  {
3831
- name: 'orderBookRewardsEvent';
3815
+ name: 'orderBookFilledEvent';
3832
3816
  type: {
3833
3817
  kind: 'struct';
3834
3818
  fields: [
@@ -3841,7 +3825,23 @@ export type TriadProtocol = {
3841
3825
  type: 'pubkey';
3842
3826
  },
3843
3827
  {
3844
- name: 'amount';
3828
+ name: 'shares';
3829
+ type: 'u64';
3830
+ },
3831
+ {
3832
+ name: 'price';
3833
+ type: 'u64';
3834
+ },
3835
+ {
3836
+ name: 'orderDirection';
3837
+ type: {
3838
+ defined: {
3839
+ name: 'orderDirection';
3840
+ };
3841
+ };
3842
+ },
3843
+ {
3844
+ name: 'rewards';
3845
3845
  type: 'u64';
3846
3846
  },
3847
3847
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "2.3.5-beta",
3
+ "version": "2.3.7-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",