@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 +1 -13
- package/dist/index.js +3 -2
- package/dist/test.js +1 -1
- package/dist/utils/helpers.js +1 -0
- package/package.json +1 -1
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<
|
|
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
|
-
|
|
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
|
});
|
package/dist/utils/helpers.js
CHANGED