@triadxyz/triad-protocol 2.9.3-beta → 2.9.4-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
@@ -69,6 +69,12 @@ export default class TriadProtocolClient {
69
69
  *
70
70
  */
71
71
  getCustomerByWallet(wallet: PublicKey): Promise<import("./types").Customer>;
72
+ /**
73
+ * Get Customer By ID
74
+ * @param customerId - The ID of the customer
75
+ *
76
+ */
77
+ getCustomerById(customerId: number): Promise<import("./types").Customer>;
72
78
  /**
73
79
  * Get Refer By Wallet Address
74
80
  * @param wallet - The wallet address of the refer
package/dist/index.js CHANGED
@@ -166,6 +166,18 @@ class TriadProtocolClient {
166
166
  return (0, helpers_1.formatCustomer)(customer.account, customer.publicKey);
167
167
  });
168
168
  }
169
+ /**
170
+ * Get Customer By ID
171
+ * @param customerId - The ID of the customer
172
+ *
173
+ */
174
+ getCustomerById(customerId) {
175
+ return __awaiter(this, void 0, void 0, function* () {
176
+ const customerPDA = (0, pda_1.getCustomerPDA)(this.program.programId, customerId);
177
+ const customer = yield this.program.account.customer.fetch(customerPDA);
178
+ return (0, helpers_1.formatCustomer)(customer, customerPDA);
179
+ });
180
+ }
169
181
  /**
170
182
  * Get Refer By Wallet Address
171
183
  * @param wallet - The wallet address of the refer
@@ -20,7 +20,7 @@ const getOrderBookPDA = (programId, marketId) => {
20
20
  };
21
21
  exports.getOrderBookPDA = getOrderBookPDA;
22
22
  const getCustomerPDA = (programId, customerId) => {
23
- return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('customer'), new bn_js_1.default(customerId).toArrayLike(Buffer, 'le', 8)], programId)[0];
23
+ return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('customer'), new bn_js_1.default(customerId).toArrayLike(Buffer, 'le', 2)], programId)[0];
24
24
  };
25
25
  exports.getCustomerPDA = getCustomerPDA;
26
26
  const getUserTradePDA = (programId, wallet) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "2.9.3-beta",
3
+ "version": "2.9.4-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",