@triadxyz/triad-protocol 1.6.1-beta → 1.6.2-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 +0 -25
- package/dist/index.js +0 -71
- package/dist/types/idl_triad_protocol.json +0 -62
- package/dist/types/index.d.ts +0 -29
- package/dist/types/triad_protocol.d.ts +0 -62
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,23 +10,6 @@ export default class TriadProtocolClient {
|
|
|
10
10
|
trade: Trade;
|
|
11
11
|
stake: Stake;
|
|
12
12
|
constructor(connection: Connection, wallet: Wallet);
|
|
13
|
-
/**
|
|
14
|
-
* Get User by wallet address
|
|
15
|
-
* @param wallet - User wallet
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
|
-
getUser(wallet: PublicKey): Promise<import("./types").User>;
|
|
19
|
-
/**
|
|
20
|
-
* Get Users
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
getUsers(): Promise<import("./types").User[]>;
|
|
24
|
-
/**
|
|
25
|
-
* Get Refferal By Name
|
|
26
|
-
* @param name - Username
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
getReferral(name: string): Promise<string>;
|
|
30
13
|
/**
|
|
31
14
|
* Transfer Poseidon
|
|
32
15
|
* @param args.poseidonAsset - Poseidon Asset
|
|
@@ -38,14 +21,6 @@ export default class TriadProtocolClient {
|
|
|
38
21
|
*
|
|
39
22
|
*/
|
|
40
23
|
transferPoseidon(args: TransferPoseidonArgs[], verifier: Keypair, options?: RpcOptions): Promise<string>;
|
|
41
|
-
/**
|
|
42
|
-
* Migrate Users
|
|
43
|
-
* @param users - Users public keys
|
|
44
|
-
*
|
|
45
|
-
* @param options - RPC options
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
migrateUsers(users: PublicKey[], options?: RpcOptions): Promise<string>;
|
|
49
24
|
/**
|
|
50
25
|
* Withdraw Poseidon
|
|
51
26
|
* @param args.poseidonAsset - Poseidon Asset - CORE PublicKey
|
package/dist/index.js
CHANGED
|
@@ -15,10 +15,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
16
16
|
const idl_triad_protocol_json_1 = __importDefault(require("./types/idl_triad_protocol.json"));
|
|
17
17
|
const trade_1 = __importDefault(require("./trade"));
|
|
18
|
-
const helpers_1 = require("./utils/helpers");
|
|
19
18
|
const pda_1 = require("./utils/pda");
|
|
20
19
|
const stake_1 = __importDefault(require("./stake"));
|
|
21
|
-
const bytes_1 = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
|
|
22
20
|
const sendVersionedTransaction_1 = __importDefault(require("./utils/sendVersionedTransaction"));
|
|
23
21
|
const constants_1 = require("./utils/constants");
|
|
24
22
|
const sendTransactionWithOptions_1 = __importDefault(require("./utils/sendTransactionWithOptions"));
|
|
@@ -31,55 +29,6 @@ class TriadProtocolClient {
|
|
|
31
29
|
this.trade = new trade_1.default(this.program, this.provider);
|
|
32
30
|
this.stake = new stake_1.default(this.program, this.provider);
|
|
33
31
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Get User by wallet address
|
|
36
|
-
* @param wallet - User wallet
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
getUser(wallet) {
|
|
40
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const userPDA = (0, pda_1.getUserPDA)(this.program.programId, wallet);
|
|
42
|
-
return (0, helpers_1.formatUser)(yield this.program.account.user.fetch(userPDA));
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Get Users
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
49
|
-
getUsers() {
|
|
50
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const response = yield this.program.account.user.all();
|
|
52
|
-
return response
|
|
53
|
-
.map((item) => (0, helpers_1.formatUser)(item.account))
|
|
54
|
-
.sort((a, b) => b.referred - a.referred);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Get Refferal By Name
|
|
59
|
-
* @param name - Username
|
|
60
|
-
*
|
|
61
|
-
*/
|
|
62
|
-
getReferral(name) {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
try {
|
|
65
|
-
const users = yield this.program.account.user.all([
|
|
66
|
-
{
|
|
67
|
-
memcmp: {
|
|
68
|
-
offset: 89 + 4,
|
|
69
|
-
bytes: bytes_1.bs58.encode(Buffer.from(name))
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
]);
|
|
73
|
-
if (users.length > 0) {
|
|
74
|
-
return users[0].publicKey.toString();
|
|
75
|
-
}
|
|
76
|
-
return '';
|
|
77
|
-
}
|
|
78
|
-
catch (_a) {
|
|
79
|
-
return '';
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
32
|
/**
|
|
84
33
|
* Transfer Poseidon
|
|
85
34
|
* @param args.poseidonAsset - Poseidon Asset
|
|
@@ -115,26 +64,6 @@ class TriadProtocolClient {
|
|
|
115
64
|
return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options, undefined, [], verifier);
|
|
116
65
|
});
|
|
117
66
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Migrate Users
|
|
120
|
-
* @param users - Users public keys
|
|
121
|
-
*
|
|
122
|
-
* @param options - RPC options
|
|
123
|
-
*
|
|
124
|
-
*/
|
|
125
|
-
migrateUsers(users, options) {
|
|
126
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
-
const ixs = [];
|
|
128
|
-
for (const user of users) {
|
|
129
|
-
const userPDA = (0, pda_1.getUserPDA)(this.program.programId, user);
|
|
130
|
-
ixs.push(yield this.program.methods
|
|
131
|
-
.migrateUser()
|
|
132
|
-
.accounts({ user: userPDA })
|
|
133
|
-
.instruction());
|
|
134
|
-
}
|
|
135
|
-
return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options, undefined, []);
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
67
|
/**
|
|
139
68
|
* Withdraw Poseidon
|
|
140
69
|
* @param args.poseidonAsset - Poseidon Asset - CORE PublicKey
|
|
@@ -617,26 +617,6 @@
|
|
|
617
617
|
}
|
|
618
618
|
]
|
|
619
619
|
},
|
|
620
|
-
{
|
|
621
|
-
"name": "migrate_user",
|
|
622
|
-
"discriminator": [159, 64, 64, 6, 80, 228, 54, 66],
|
|
623
|
-
"accounts": [
|
|
624
|
-
{
|
|
625
|
-
"name": "signer",
|
|
626
|
-
"writable": true,
|
|
627
|
-
"signer": true
|
|
628
|
-
},
|
|
629
|
-
{
|
|
630
|
-
"name": "user",
|
|
631
|
-
"writable": true
|
|
632
|
-
},
|
|
633
|
-
{
|
|
634
|
-
"name": "system_program",
|
|
635
|
-
"address": "11111111111111111111111111111111"
|
|
636
|
-
}
|
|
637
|
-
],
|
|
638
|
-
"args": []
|
|
639
|
-
},
|
|
640
620
|
{
|
|
641
621
|
"name": "open_order",
|
|
642
622
|
"discriminator": [206, 88, 88, 143, 38, 136, 50, 224],
|
|
@@ -1360,10 +1340,6 @@
|
|
|
1360
1340
|
"name": "StakeVault",
|
|
1361
1341
|
"discriminator": [192, 112, 65, 125, 129, 151, 173, 226]
|
|
1362
1342
|
},
|
|
1363
|
-
{
|
|
1364
|
-
"name": "User",
|
|
1365
|
-
"discriminator": [159, 117, 95, 227, 239, 151, 58, 236]
|
|
1366
|
-
},
|
|
1367
1343
|
{
|
|
1368
1344
|
"name": "UserTrade",
|
|
1369
1345
|
"discriminator": [149, 190, 47, 218, 136, 9, 222, 222]
|
|
@@ -2363,44 +2339,6 @@
|
|
|
2363
2339
|
]
|
|
2364
2340
|
}
|
|
2365
2341
|
},
|
|
2366
|
-
{
|
|
2367
|
-
"name": "User",
|
|
2368
|
-
"type": {
|
|
2369
|
-
"kind": "struct",
|
|
2370
|
-
"fields": [
|
|
2371
|
-
{
|
|
2372
|
-
"name": "ts",
|
|
2373
|
-
"type": "i64"
|
|
2374
|
-
},
|
|
2375
|
-
{
|
|
2376
|
-
"name": "authority",
|
|
2377
|
-
"type": "pubkey"
|
|
2378
|
-
},
|
|
2379
|
-
{
|
|
2380
|
-
"name": "bump",
|
|
2381
|
-
"type": "u8"
|
|
2382
|
-
},
|
|
2383
|
-
{
|
|
2384
|
-
"name": "referral",
|
|
2385
|
-
"type": "pubkey"
|
|
2386
|
-
},
|
|
2387
|
-
{
|
|
2388
|
-
"name": "referred",
|
|
2389
|
-
"type": "i64"
|
|
2390
|
-
},
|
|
2391
|
-
{
|
|
2392
|
-
"name": "name",
|
|
2393
|
-
"type": "string"
|
|
2394
|
-
},
|
|
2395
|
-
{
|
|
2396
|
-
"name": "padding",
|
|
2397
|
-
"type": {
|
|
2398
|
-
"array": ["u8", 50]
|
|
2399
|
-
}
|
|
2400
|
-
}
|
|
2401
|
-
]
|
|
2402
|
-
}
|
|
2403
|
-
},
|
|
2404
2342
|
{
|
|
2405
2343
|
"name": "UserTrade",
|
|
2406
2344
|
"type": {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -45,35 +45,6 @@ export type OrderStatus = {
|
|
|
45
45
|
} | {
|
|
46
46
|
liquidated: {};
|
|
47
47
|
};
|
|
48
|
-
export type PrizeType = {
|
|
49
|
-
none: {};
|
|
50
|
-
} | {
|
|
51
|
-
undead: {};
|
|
52
|
-
} | {
|
|
53
|
-
ticket: {};
|
|
54
|
-
} | {
|
|
55
|
-
honeyland: {};
|
|
56
|
-
} | {
|
|
57
|
-
trd100: {};
|
|
58
|
-
} | {
|
|
59
|
-
trd50: {};
|
|
60
|
-
} | {
|
|
61
|
-
flip: {};
|
|
62
|
-
} | {
|
|
63
|
-
pengu: {};
|
|
64
|
-
} | {
|
|
65
|
-
ore: {};
|
|
66
|
-
} | {
|
|
67
|
-
lucksea: {};
|
|
68
|
-
} | {
|
|
69
|
-
trd5: {};
|
|
70
|
-
} | {
|
|
71
|
-
trident2000: {};
|
|
72
|
-
} | {
|
|
73
|
-
trident500: {};
|
|
74
|
-
} | {
|
|
75
|
-
trd10000: {};
|
|
76
|
-
};
|
|
77
48
|
export type TransferPoseidonArgs = {
|
|
78
49
|
poseidonAsset: PublicKey;
|
|
79
50
|
ticketAsset: PublicKey;
|
|
@@ -884,26 +884,6 @@ export type TriadProtocol = {
|
|
|
884
884
|
}
|
|
885
885
|
];
|
|
886
886
|
},
|
|
887
|
-
{
|
|
888
|
-
name: 'migrateUser';
|
|
889
|
-
discriminator: [159, 64, 64, 6, 80, 228, 54, 66];
|
|
890
|
-
accounts: [
|
|
891
|
-
{
|
|
892
|
-
name: 'signer';
|
|
893
|
-
writable: true;
|
|
894
|
-
signer: true;
|
|
895
|
-
},
|
|
896
|
-
{
|
|
897
|
-
name: 'user';
|
|
898
|
-
writable: true;
|
|
899
|
-
},
|
|
900
|
-
{
|
|
901
|
-
name: 'systemProgram';
|
|
902
|
-
address: '11111111111111111111111111111111';
|
|
903
|
-
}
|
|
904
|
-
];
|
|
905
|
-
args: [];
|
|
906
|
-
},
|
|
907
887
|
{
|
|
908
888
|
name: 'openOrder';
|
|
909
889
|
discriminator: [206, 88, 88, 143, 38, 136, 50, 224];
|
|
@@ -1917,10 +1897,6 @@ export type TriadProtocol = {
|
|
|
1917
1897
|
name: 'stakeVault';
|
|
1918
1898
|
discriminator: [192, 112, 65, 125, 129, 151, 173, 226];
|
|
1919
1899
|
},
|
|
1920
|
-
{
|
|
1921
|
-
name: 'user';
|
|
1922
|
-
discriminator: [159, 117, 95, 227, 239, 151, 58, 236];
|
|
1923
|
-
},
|
|
1924
1900
|
{
|
|
1925
1901
|
name: 'userTrade';
|
|
1926
1902
|
discriminator: [149, 190, 47, 218, 136, 9, 222, 222];
|
|
@@ -2920,44 +2896,6 @@ export type TriadProtocol = {
|
|
|
2920
2896
|
];
|
|
2921
2897
|
};
|
|
2922
2898
|
},
|
|
2923
|
-
{
|
|
2924
|
-
name: 'user';
|
|
2925
|
-
type: {
|
|
2926
|
-
kind: 'struct';
|
|
2927
|
-
fields: [
|
|
2928
|
-
{
|
|
2929
|
-
name: 'ts';
|
|
2930
|
-
type: 'i64';
|
|
2931
|
-
},
|
|
2932
|
-
{
|
|
2933
|
-
name: 'authority';
|
|
2934
|
-
type: 'pubkey';
|
|
2935
|
-
},
|
|
2936
|
-
{
|
|
2937
|
-
name: 'bump';
|
|
2938
|
-
type: 'u8';
|
|
2939
|
-
},
|
|
2940
|
-
{
|
|
2941
|
-
name: 'referral';
|
|
2942
|
-
type: 'pubkey';
|
|
2943
|
-
},
|
|
2944
|
-
{
|
|
2945
|
-
name: 'referred';
|
|
2946
|
-
type: 'i64';
|
|
2947
|
-
},
|
|
2948
|
-
{
|
|
2949
|
-
name: 'name';
|
|
2950
|
-
type: 'string';
|
|
2951
|
-
},
|
|
2952
|
-
{
|
|
2953
|
-
name: 'padding';
|
|
2954
|
-
type: {
|
|
2955
|
-
array: ['u8', 50];
|
|
2956
|
-
};
|
|
2957
|
-
}
|
|
2958
|
-
];
|
|
2959
|
-
};
|
|
2960
|
-
},
|
|
2961
2899
|
{
|
|
2962
2900
|
name: 'userTrade';
|
|
2963
2901
|
type: {
|