@triadxyz/triad-protocol 2.5.5-beta → 2.5.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/index.d.ts CHANGED
@@ -56,6 +56,42 @@ export default class TriadProtocolClient {
56
56
  *
57
57
  */
58
58
  getMarketByAddress(marketAddress: PublicKey): Promise<import("./types").Market>;
59
+ /**
60
+ * Get Costumer By Wallet Address
61
+ * @param wallet - The wallet address of the customer
62
+ *
63
+ */
64
+ getCustomerByWallet(wallet: PublicKey): Promise<import("@coral-xyz/anchor").ProgramAccount<{
65
+ bump: number;
66
+ id: number;
67
+ authority: PublicKey;
68
+ name: string;
69
+ feeRecipient: PublicKey;
70
+ feeBps: number;
71
+ isVerified: boolean;
72
+ padding: number[];
73
+ }>>;
74
+ /**
75
+ * Get Refer By Wallet Address
76
+ * @param wallet - The wallet address of the refer
77
+ *
78
+ */
79
+ getReferByWallet(wallet: PublicKey): Promise<import("./types").Refer>;
80
+ /**
81
+ * Get Current Market ID
82
+ *
83
+ */
84
+ nextMarketId(): Promise<number>;
85
+ /**
86
+ * Get Next Customer ID
87
+ *
88
+ */
89
+ nextCustomerId(): Promise<number>;
90
+ /**
91
+ * Get Next Pool ID
92
+ *
93
+ */
94
+ nextPoolId(): Promise<number>;
59
95
  /**
60
96
  * Get User Trade PDA
61
97
  * @param wallet - User wallet PublicKey
package/dist/index.js CHANGED
@@ -137,6 +137,67 @@ class TriadProtocolClient {
137
137
  return (0, helpers_1.formatMarket)(account, marketAddress);
138
138
  });
139
139
  }
140
+ /**
141
+ * Get Costumer By Wallet Address
142
+ * @param wallet - The wallet address of the customer
143
+ *
144
+ */
145
+ getCustomerByWallet(wallet) {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ const [customer] = yield this.program.account.customer.all([
148
+ {
149
+ memcmp: {
150
+ offset: 10 + 1,
151
+ bytes: wallet.toBase58()
152
+ }
153
+ }
154
+ ]);
155
+ return customer;
156
+ });
157
+ }
158
+ /**
159
+ * Get Refer By Wallet Address
160
+ * @param wallet - The wallet address of the refer
161
+ *
162
+ */
163
+ getReferByWallet(wallet) {
164
+ return __awaiter(this, void 0, void 0, function* () {
165
+ const referPDA = (0, pda_1.getReferPDA)(this.program.programId, wallet);
166
+ const refer = yield this.program.account.refer.fetch(referPDA);
167
+ return (0, helpers_1.formatRefer)(refer);
168
+ });
169
+ }
170
+ /**
171
+ * Get Current Market ID
172
+ *
173
+ */
174
+ nextMarketId() {
175
+ return __awaiter(this, void 0, void 0, function* () {
176
+ const markets = yield this.program.account.marketV2.all();
177
+ // 10 is the initial market id
178
+ return markets.length + 10;
179
+ });
180
+ }
181
+ /**
182
+ * Get Next Customer ID
183
+ *
184
+ */
185
+ nextCustomerId() {
186
+ return __awaiter(this, void 0, void 0, function* () {
187
+ const customers = yield this.program.account.customer.all();
188
+ return customers.length + 1;
189
+ });
190
+ }
191
+ /**
192
+ * Get Next Pool ID
193
+ *
194
+ */
195
+ nextPoolId() {
196
+ return __awaiter(this, void 0, void 0, function* () {
197
+ const pools = yield this.program.account.pool.all();
198
+ return pools.length + 1;
199
+ });
200
+ }
140
201
  /**
141
202
  * Get User Trade PDA
142
203
  * @param wallet - User wallet PublicKey
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "2.5.5-beta",
3
+ "version": "2.5.6-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",