@triadxyz/triad-protocol 1.8.4-beta → 1.8.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/trade.d.ts CHANGED
@@ -146,7 +146,7 @@ export default class Trade {
146
146
  padding: number[];
147
147
  }>;
148
148
  /**
149
- * Initialize Market
149
+ * Create Market
150
150
  * @param args.marketId - new markert id - length + 1
151
151
  * @param args.startTime - start time
152
152
  * @param args.endTime - end time
@@ -157,7 +157,7 @@ export default class Trade {
157
157
  * @param options - RPC options
158
158
  *
159
159
  */
160
- createMarket({ marketId, startTime, endTime, question, feeBps, customer, payoutFee, mint }: CreateMarketArgs, options?: RpcOptions): Promise<string>;
160
+ createMarket({ marketId, startTime, endTime, question, feeBps, customerId, payoutFee, mint }: CreateMarketArgs, options?: RpcOptions): Promise<string>;
161
161
  /**
162
162
  * Open Order
163
163
  * @param args.marketId - The ID of the Market
package/dist/trade.js CHANGED
@@ -108,7 +108,7 @@ class Trade {
108
108
  });
109
109
  }
110
110
  /**
111
- * Initialize Market
111
+ * Create Market
112
112
  * @param args.marketId - new markert id - length + 1
113
113
  * @param args.startTime - start time
114
114
  * @param args.endTime - end time
@@ -119,11 +119,15 @@ class Trade {
119
119
  * @param options - RPC options
120
120
  *
121
121
  */
122
- createMarket({ marketId, startTime, endTime, question, feeBps, customer, payoutFee, mint }, options) {
122
+ createMarket({ marketId, startTime, endTime, question, feeBps, customerId, payoutFee, mint }, options) {
123
123
  return __awaiter(this, void 0, void 0, function* () {
124
124
  if (question.length > 80) {
125
125
  throw new Error('Question must be less than 80 characters');
126
126
  }
127
+ let customerPDA = null;
128
+ if (customerId) {
129
+ customerPDA = (0, trade_2.getCustomerPDA)(this.program.programId, customerId);
130
+ }
127
131
  return (0, sendTransactionWithOptions_1.default)(this.program.methods
128
132
  .createMarket({
129
133
  marketId: new bn_js_1.default(marketId),
@@ -137,7 +141,7 @@ class Trade {
137
141
  signer: this.provider.publicKey,
138
142
  mint,
139
143
  tokenProgram: (0, helpers_1.getTokenProgram)(mint),
140
- customer
144
+ customer: customerPDA
141
145
  }), options);
142
146
  });
143
147
  }
@@ -142,7 +142,7 @@ export type CreateMarketArgs = {
142
142
  endTime: number;
143
143
  question: string;
144
144
  feeBps: number;
145
- customer: PublicKey;
145
+ customerId: number | null;
146
146
  payoutFee: number;
147
147
  mint: PublicKey;
148
148
  };
@@ -1,4 +1,5 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
2
  export declare const getMarketPDA: (programId: PublicKey, marketId: number) => PublicKey;
3
+ export declare const getCustomerPDA: (programId: PublicKey, marketId: number) => PublicKey;
3
4
  export declare const getUserTradePDA: (programId: PublicKey, wallet: PublicKey) => PublicKey;
4
5
  export declare const getSubUserTradePDA: (programId: PublicKey, wallet: PublicKey, nonce: number) => PublicKey;
@@ -3,13 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getSubUserTradePDA = exports.getUserTradePDA = exports.getMarketPDA = void 0;
6
+ exports.getSubUserTradePDA = exports.getUserTradePDA = exports.getCustomerPDA = exports.getMarketPDA = void 0;
7
7
  const web3_js_1 = require("@solana/web3.js");
8
8
  const bn_js_1 = __importDefault(require("bn.js"));
9
9
  const getMarketPDA = (programId, marketId) => {
10
10
  return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('market'), new bn_js_1.default(marketId).toArrayLike(Buffer, 'le', 8)], programId)[0];
11
11
  };
12
12
  exports.getMarketPDA = getMarketPDA;
13
+ const getCustomerPDA = (programId, marketId) => {
14
+ return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('customer'), new bn_js_1.default(marketId).toArrayLike(Buffer, 'le', 8)], programId)[0];
15
+ };
16
+ exports.getCustomerPDA = getCustomerPDA;
13
17
  const getUserTradePDA = (programId, wallet) => {
14
18
  return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('user_trade'), wallet.toBuffer()], programId)[0];
15
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.8.4-beta",
3
+ "version": "1.8.6-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",