@triadxyz/triad-protocol 0.2.4-beta → 0.2.5-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
@@ -1,3 +1,4 @@
1
+ /// <reference types="bn.js" />
1
2
  import { AnchorProvider, Program, Wallet } from '@coral-xyz/anchor';
2
3
  import { Connection, PublicKey } from '@solana/web3.js';
3
4
  import { TriadProtocol } from './types/triad_protocol';
@@ -27,6 +28,22 @@ export default class TriadProtocolClient {
27
28
  * @param username - User name
28
29
  */
29
30
  hasUser: (wallet: PublicKey) => Promise<boolean>;
31
+ /**
32
+ * Get Refferal
33
+ * @param name - User name
34
+ */
35
+ getRefferal: (name: string) => Promise<"" | import("@coral-xyz/anchor").ProgramAccount<{
36
+ ts: import("bn.js");
37
+ authority: PublicKey;
38
+ bump: number;
39
+ referral: PublicKey;
40
+ referred: import("bn.js");
41
+ name: string;
42
+ swaps: number;
43
+ swapsMade: number;
44
+ staked: import("bn.js");
45
+ padding: number[];
46
+ }>>;
30
47
  getUserPositions: (userWallet: PublicKey) => Promise<{}[]>;
31
48
  /**
32
49
  * Create User
package/dist/index.js CHANGED
@@ -51,6 +51,19 @@ 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
+ return response.find((item) => item.account.name === name);
62
+ }
63
+ catch (_b) {
64
+ return '';
65
+ }
66
+ });
54
67
  this.getUserPositions = (userWallet) => __awaiter(this, void 0, void 0, function* () {
55
68
  const tickers = yield this.ticker.getTickers();
56
69
  const positions = yield Promise.all(tickers
@@ -64,7 +77,7 @@ class TriadProtocolClient {
64
77
  position
65
78
  };
66
79
  }
67
- catch (_b) {
80
+ catch (_c) {
68
81
  return;
69
82
  }
70
83
  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.5-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",