@triadxyz/triad-protocol 0.2.5-beta → 0.2.7-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,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { AnchorProvider, Program, Wallet } from '@coral-xyz/anchor';
3
2
  import { Connection, PublicKey } from '@solana/web3.js';
4
3
  import { TriadProtocol } from './types/triad_protocol';
@@ -32,18 +31,7 @@ export default class TriadProtocolClient {
32
31
  * Get Refferal
33
32
  * @param name - User name
34
33
  */
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
- }>>;
34
+ getRefferal: (name: string) => Promise<PublicKey | "">;
47
35
  getUserPositions: (userWallet: PublicKey) => Promise<{}[]>;
48
36
  /**
49
37
  * Create User
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ class TriadProtocolClient {
36
36
  */
37
37
  this.getUsers = () => __awaiter(this, void 0, void 0, function* () {
38
38
  const response = yield this.program.account.user.all();
39
- return response.map((item) => (0, helpers_1.formatUser)(item));
39
+ return response.map((item) => (0, helpers_1.formatUser)(item.account));
40
40
  });
41
41
  /**
42
42
  * Check if user exists
@@ -58,7 +58,8 @@ class TriadProtocolClient {
58
58
  this.getRefferal = (name) => __awaiter(this, void 0, void 0, function* () {
59
59
  try {
60
60
  const response = yield this.program.account.user.all();
61
- return response.find((item) => item.account.name === name);
61
+ const data = response.find((item) => item.account.name === name);
62
+ return data.publicKey;
62
63
  }
63
64
  catch (_b) {
64
65
  return '';
package/dist/test.js CHANGED
@@ -47,6 +47,6 @@ const getUsers = () => __awaiter(void 0, void 0, void 0, function* () {
47
47
  });
48
48
  getUsers();
49
49
  const getReferral = () => __awaiter(void 0, void 0, void 0, function* () {
50
- const response = yield triadProtocol.hasUser(new web3_js_1.PublicKey(''));
50
+ const response = yield triadProtocol.hasUser(new web3_js_1.PublicKey('BCTdjdcjMiECGFbF5Ps15yjLRPzy5YZGJNa4VdGRbhjB'));
51
51
  console.log(response);
52
52
  });
@@ -137,6 +137,7 @@ const formatStake = (stake) => {
137
137
  };
138
138
  exports.formatStake = formatStake;
139
139
  const formatUser = (user) => {
140
+ console.log(user);
140
141
  return {
141
142
  ts: user.ts.toNumber(),
142
143
  authority: user.authority.toBase58(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "0.2.5-beta",
3
+ "version": "0.2.7-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",