@triadxyz/triad-protocol 4.2.5 → 4.2.7

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.d.ts CHANGED
@@ -160,4 +160,11 @@ export default class Market {
160
160
  * @param market.poolId - The ID of the pool
161
161
  */
162
162
  createAndResolveMarket(toResolve: UpdateMarketWinningDirectionArgs['markets'][0], market: CreateMarketArgs['markets'][0], customer: PublicKey): Promise<string | import("@solana/web3.js").VersionedTransaction>;
163
+ /**
164
+ *
165
+ * @param marketId
166
+ * @param usdcMint
167
+ * @returns
168
+ */
169
+ migrateUSDC(marketIds: number[]): Promise<string | import("@solana/web3.js").VersionedTransaction>;
163
170
  }
package/dist/market.js CHANGED
@@ -567,5 +567,27 @@ class Market {
567
567
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
568
568
  });
569
569
  }
570
+ /**
571
+ *
572
+ * @param marketId
573
+ * @param usdcMint
574
+ * @returns
575
+ */
576
+ migrateUSDC(marketIds) {
577
+ return __awaiter(this, void 0, void 0, function* () {
578
+ const ixs = [];
579
+ for (const marketId of marketIds) {
580
+ const marketPDA = (0, pda_1.getMarketPDA)(this.program.programId, marketId);
581
+ ixs.push(yield this.program.methods
582
+ .migrateUsdc()
583
+ .accounts({
584
+ signer: this.program.provider.publicKey,
585
+ market: marketPDA
586
+ })
587
+ .instruction());
588
+ }
589
+ return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
590
+ });
591
+ }
570
592
  }
571
593
  exports.default = Market;
@@ -13,6 +13,11 @@ export default class Predictor {
13
13
  * @param customerId - Customer ID
14
14
  */
15
15
  getPredictor(authority: PublicKey, customerId: number): Promise<PredictorType>;
16
+ createPredictor(users: {
17
+ authority: PublicKey;
18
+ refer: string;
19
+ customerId: number;
20
+ }[]): Promise<void>;
16
21
  /**
17
22
  * Get User Orders
18
23
  * @param wallet - User wallet PublicKey
package/dist/predictor.js CHANGED
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ const web3_js_1 = require("@solana/web3.js");
15
16
  const bn_js_1 = __importDefault(require("bn.js"));
16
17
  const constants_1 = require("./utils/constants");
17
18
  const sendVersionedTransaction_1 = __importDefault(require("./utils/sendVersionedTransaction"));
@@ -47,6 +48,24 @@ class Predictor {
47
48
  }
48
49
  });
49
50
  }
51
+ createPredictor(users) {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ let ixs = [];
54
+ for (const user of users) {
55
+ ixs.push(yield this.program.methods
56
+ .createPredictor({
57
+ customerId: user.customerId,
58
+ refer: new web3_js_1.PublicKey(user.refer)
59
+ })
60
+ .accounts({
61
+ signer: user.authority,
62
+ payer: this.rpcOptions.payer
63
+ })
64
+ .instruction());
65
+ }
66
+ yield (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
67
+ });
68
+ }
50
69
  /**
51
70
  * Get User Orders
52
71
  * @param wallet - User wallet PublicKey
package/dist/trade.js CHANGED
@@ -232,7 +232,7 @@ class Trade {
232
232
  signer: this.program.provider.publicKey,
233
233
  payer: this.rpcOptions.payer,
234
234
  predictor: predictorPDA,
235
- oppositePredictor: (0, pda_1.getPredictorPDA)(this.program.programId, new web3_js_1.PublicKey(order.authority), customer.id),
235
+ oppositePredictor: new web3_js_1.PublicKey(order.authority),
236
236
  central: (0, pda_1.getCentralPDA)(this.program.programId),
237
237
  market: marketPDA,
238
238
  orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, marketId),
@@ -294,6 +294,7 @@ class Trade {
294
294
  .accounts({
295
295
  signer: this.program.provider.publicKey,
296
296
  predictor: predictorPDA,
297
+ oppositePredictor: new web3_js_1.PublicKey(order.authority),
297
298
  market: marketPDA,
298
299
  orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, marketId),
299
300
  customer: customer.address,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "4.2.5",
3
+ "version": "4.2.7",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",