@triadxyz/triad-protocol 0.2.4-beta → 0.2.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
@@ -27,6 +27,11 @@ export default class TriadProtocolClient {
27
27
  * @param username - User name
28
28
  */
29
29
  hasUser: (wallet: PublicKey) => Promise<boolean>;
30
+ /**
31
+ * Get Refferal
32
+ * @param name - User name
33
+ */
34
+ getRefferal: (name: string) => Promise<PublicKey | "">;
30
35
  getUserPositions: (userWallet: PublicKey) => Promise<{}[]>;
31
36
  /**
32
37
  * Create User
package/dist/index.js CHANGED
@@ -51,6 +51,20 @@ class TriadProtocolClient {
51
51
  return false;
52
52
  }
53
53
  });
54
+ /**
55
+ * Get Refferal
56
+ * @param name - User name
57
+ */
58
+ this.getRefferal = (name) => __awaiter(this, void 0, void 0, function* () {
59
+ try {
60
+ const response = yield this.program.account.user.all();
61
+ const data = response.find((item) => item.account.name === name);
62
+ return data.publicKey;
63
+ }
64
+ catch (_b) {
65
+ return '';
66
+ }
67
+ });
54
68
  this.getUserPositions = (userWallet) => __awaiter(this, void 0, void 0, function* () {
55
69
  const tickers = yield this.ticker.getTickers();
56
70
  const positions = yield Promise.all(tickers
@@ -64,7 +78,7 @@ class TriadProtocolClient {
64
78
  position
65
79
  };
66
80
  }
67
- catch (_b) {
81
+ catch (_c) {
68
82
  return;
69
83
  }
70
84
  return data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "0.2.4-beta",
3
+ "version": "0.2.6-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",