@triadxyz/triad-protocol 4.4.1 → 4.4.3

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/market.js CHANGED
@@ -137,6 +137,7 @@ class Market {
137
137
  if (market.question.length > 80) {
138
138
  throw new Error('Question must be less than 80 characters');
139
139
  }
140
+ const marketPDA = (0, pda_1.getMarketPDA)(this.program.programId, nextMarketId);
140
141
  ixs.push(yield this.program.methods
141
142
  .createMarket({
142
143
  question: (0, helpers_1.encodeString)(market.question, 80),
@@ -150,14 +151,15 @@ class Market {
150
151
  .accounts({
151
152
  signer: this.program.provider.publicKey,
152
153
  pool: poolPDA,
153
- customer
154
+ customer,
155
+ market: marketPDA
154
156
  })
155
157
  .instruction());
156
158
  ixs.push(yield this.program.methods
157
159
  .createOrderBook()
158
160
  .accounts({
159
161
  signer: this.program.provider.publicKey,
160
- market: (0, pda_1.getMarketPDA)(this.program.programId, nextMarketId)
162
+ market: marketPDA
161
163
  })
162
164
  .instruction());
163
165
  }
@@ -225,7 +227,8 @@ class Market {
225
227
  .accounts({
226
228
  signer: this.program.provider.publicKey,
227
229
  pool: poolPDA,
228
- customer
230
+ customer,
231
+ market: (0, pda_1.getMarketPDA)(this.program.programId, nextMarketId)
229
232
  })
230
233
  .instruction());
231
234
  ixs.push(yield this.program.methods
@@ -417,7 +420,8 @@ class Market {
417
420
  signer: this.program.provider.publicKey,
418
421
  pool: poolPDA,
419
422
  customer: market.customer,
420
- priceUpdate: feedPDA
423
+ priceUpdate: feedPDA,
424
+ market: (0, pda_1.getMarketPDA)(this.program.programId, nextMarketId)
421
425
  })
422
426
  .instruction());
423
427
  ixs.push(yield this.program.methods
@@ -485,7 +489,8 @@ class Market {
485
489
  ? (0, pda_1.getPoolPDA)(this.program.programId, market.poolId)
486
490
  : null,
487
491
  customer: market.customer,
488
- priceUpdate: feedPDA
492
+ priceUpdate: feedPDA,
493
+ market: (0, pda_1.getMarketPDA)(this.program.programId, nextMarketId)
489
494
  })
490
495
  .instruction());
491
496
  ixs.push(yield this.program.methods
@@ -553,7 +558,8 @@ class Market {
553
558
  pool: toResolve.poolId
554
559
  ? (0, pda_1.getPoolPDA)(this.program.programId, toResolve.poolId)
555
560
  : null,
556
- customer
561
+ customer,
562
+ market: (0, pda_1.getMarketPDA)(this.program.programId, nextMarketId)
557
563
  })
558
564
  .instruction());
559
565
  ixs.push(yield this.program.methods
@@ -811,20 +811,7 @@
811
811
  },
812
812
  {
813
813
  "name": "market",
814
- "writable": true,
815
- "pda": {
816
- "seeds": [
817
- {
818
- "kind": "const",
819
- "value": [109, 97, 114, 107, 101, 116]
820
- },
821
- {
822
- "kind": "account",
823
- "path": "central.next_market_id.checked_add(1)",
824
- "account": "Central"
825
- }
826
- ]
827
- }
814
+ "writable": true
828
815
  },
829
816
  {
830
817
  "name": "system_program",
@@ -879,20 +866,7 @@
879
866
  },
880
867
  {
881
868
  "name": "market",
882
- "writable": true,
883
- "pda": {
884
- "seeds": [
885
- {
886
- "kind": "const",
887
- "value": [109, 97, 114, 107, 101, 116]
888
- },
889
- {
890
- "kind": "account",
891
- "path": "central.next_market_id.checked_add(1)",
892
- "account": "Central"
893
- }
894
- ]
895
- }
869
+ "writable": true
896
870
  },
897
871
  {
898
872
  "name": "price_update",
@@ -61,6 +61,7 @@ export type Central = {
61
61
  feeAvailable: number;
62
62
  feeClaimed: number;
63
63
  rewardsPaid: number;
64
+ nextMarketId: number;
64
65
  };
65
66
  export type BookOrder = {
66
67
  id: string;
@@ -1135,19 +1135,6 @@ export type TriadProtocol = {
1135
1135
  {
1136
1136
  name: 'market';
1137
1137
  writable: true;
1138
- pda: {
1139
- seeds: [
1140
- {
1141
- kind: 'const';
1142
- value: [109, 97, 114, 107, 101, 116];
1143
- },
1144
- {
1145
- kind: 'account';
1146
- path: 'central.next_market_id.checked_add(1)';
1147
- account: 'central';
1148
- }
1149
- ];
1150
- };
1151
1138
  },
1152
1139
  {
1153
1140
  name: 'systemProgram';
@@ -1214,19 +1201,6 @@ export type TriadProtocol = {
1214
1201
  {
1215
1202
  name: 'market';
1216
1203
  writable: true;
1217
- pda: {
1218
- seeds: [
1219
- {
1220
- kind: 'const';
1221
- value: [109, 97, 114, 107, 101, 116];
1222
- },
1223
- {
1224
- kind: 'account';
1225
- path: 'central.next_market_id.checked_add(1)';
1226
- account: 'central';
1227
- }
1228
- ];
1229
- };
1230
1204
  },
1231
1205
  {
1232
1206
  name: 'priceUpdate';
@@ -278,7 +278,8 @@ const formatCentral = (account, publicKey) => {
278
278
  isLocked: account.isLocked,
279
279
  feeAvailable: account.feeAvailable.toNumber() / 1e6,
280
280
  feeClaimed: account.feeClaimed.toNumber() / 1e6,
281
- rewardsPaid: account.rewardsPaid.toNumber() / 1e6
281
+ rewardsPaid: account.rewardsPaid.toNumber() / 1e6,
282
+ nextMarketId: account.nextMarketId.toNumber()
282
283
  };
283
284
  };
284
285
  exports.formatCentral = formatCentral;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "4.4.1",
3
+ "version": "4.4.3",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",