@triadxyz/triad-protocol 0.2.9-beta → 0.3.1-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/stake.js +8 -1
- package/dist/test.js +5 -1
- package/dist/types/idl_triad_protocol.json +53 -3
- package/dist/types/triad_protocol.d.ts +52 -260
- package/package.json +1 -1
package/dist/stake.js
CHANGED
|
@@ -263,9 +263,11 @@ class Stake {
|
|
|
263
263
|
return __awaiter(this, void 0, void 0, function* () {
|
|
264
264
|
const stakeVaultPDA = (0, helpers_1.getStakeVaultAddressSync)(this.program.programId, stakeVault);
|
|
265
265
|
const stakePDA = (0, helpers_1.getStakeAddressSync)(this.program.programId, wallet, name);
|
|
266
|
+
const userPAD = (0, helpers_1.getUserAddressSync)(this.program.programId, wallet);
|
|
266
267
|
const method = this.program.methods.requestWithdrawStake().accounts({
|
|
267
268
|
signer: wallet,
|
|
268
269
|
mint: mint,
|
|
270
|
+
user: userPAD,
|
|
269
271
|
stake: stakePDA,
|
|
270
272
|
stakeVault: stakeVaultPDA
|
|
271
273
|
});
|
|
@@ -293,6 +295,7 @@ class Stake {
|
|
|
293
295
|
const userPDA = (0, helpers_1.getUserAddressSync)(this.program.programId, wallet);
|
|
294
296
|
const FromAta = (0, helpers_1.getATASync)(stakeVaultPDA, mint);
|
|
295
297
|
const stakePDA = (0, helpers_1.getStakeAddressSync)(this.program.programId, wallet, name);
|
|
298
|
+
const ToAta = (0, helpers_1.getATASync)(wallet, mint);
|
|
296
299
|
const method = this.program.methods.withdrawStake().accounts({
|
|
297
300
|
signer: wallet,
|
|
298
301
|
fromAta: FromAta,
|
|
@@ -300,6 +303,7 @@ class Stake {
|
|
|
300
303
|
stakeVault: stakeVaultPDA,
|
|
301
304
|
admin: new web3_js_1.PublicKey('82ppCojm3yrEKgdpH8B5AmBJTU1r1uAWXFWhxvPs9UCR'),
|
|
302
305
|
mint: mint,
|
|
306
|
+
toAta: ToAta,
|
|
303
307
|
user: userPDA
|
|
304
308
|
});
|
|
305
309
|
if (options === null || options === void 0 ? void 0 : options.microLamports) {
|
|
@@ -326,7 +330,8 @@ class Stake {
|
|
|
326
330
|
const method = this.program.methods
|
|
327
331
|
.updateStakeVaultStatus({
|
|
328
332
|
isLocked,
|
|
329
|
-
initTs: new anchor_1.BN(initTs)
|
|
333
|
+
initTs: new anchor_1.BN(initTs),
|
|
334
|
+
slots: new anchor_1.BN(1839)
|
|
330
335
|
})
|
|
331
336
|
.accounts({
|
|
332
337
|
signer: wallet,
|
|
@@ -355,10 +360,12 @@ class Stake {
|
|
|
355
360
|
const StakeVault = (0, helpers_1.getStakeVaultAddressSync)(this.program.programId, stakeVault);
|
|
356
361
|
const Stake = (0, helpers_1.getStakeAddressSync)(this.program.programId, wallet, nftName);
|
|
357
362
|
const FromAta = (0, helpers_1.getATASync)(StakeVault, mint);
|
|
363
|
+
const ToAta = (0, helpers_1.getATASync)(wallet, mint);
|
|
358
364
|
const method = this.program.methods.claimStake().accounts({
|
|
359
365
|
signer: wallet,
|
|
360
366
|
fromAta: FromAta,
|
|
361
367
|
mint: mint,
|
|
368
|
+
toAta: ToAta,
|
|
362
369
|
stake: Stake,
|
|
363
370
|
stakeVault: StakeVault
|
|
364
371
|
});
|
package/dist/test.js
CHANGED
|
@@ -48,6 +48,10 @@ const getUsers = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
48
48
|
const response = yield triadProtocol.getUsers();
|
|
49
49
|
console.log(response);
|
|
50
50
|
});
|
|
51
|
+
const getUser = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
const response = yield triadProtocol.getUser(new web3_js_1.PublicKey('6mGxYSJzJxTHwY43aafsSnSPM3QqXKbNUsnCRj4fMo5q'));
|
|
53
|
+
console.log(response);
|
|
54
|
+
});
|
|
51
55
|
const getReferral = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
56
|
const response = yield triadProtocol.hasUser(new web3_js_1.PublicKey('6MuTdUhc4LDHDW3fiTemyns4NgR99oAWvHM2SwCSTcau'));
|
|
53
57
|
console.log(response);
|
|
@@ -61,4 +65,4 @@ const createUser = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
61
65
|
microLamports: 10000
|
|
62
66
|
});
|
|
63
67
|
});
|
|
64
|
-
|
|
68
|
+
getUser();
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
"address": "TRDwq3BN4mP3m9KsuNUWSN6QDff93VKGSwE95Jbr9Ss",
|
|
3
3
|
"metadata": {
|
|
4
4
|
"name": "triad_protocol",
|
|
5
|
-
"version": "0.1.
|
|
6
|
-
"spec": "0.1.0"
|
|
5
|
+
"version": "0.1.4",
|
|
6
|
+
"spec": "0.1.0",
|
|
7
|
+
"description": "Triad protocol, trade solana projects"
|
|
7
8
|
},
|
|
8
9
|
"instructions": [
|
|
9
10
|
{
|
|
@@ -508,6 +509,10 @@
|
|
|
508
509
|
"name": "stake_vault",
|
|
509
510
|
"writable": true
|
|
510
511
|
},
|
|
512
|
+
{
|
|
513
|
+
"name": "user",
|
|
514
|
+
"writable": true
|
|
515
|
+
},
|
|
511
516
|
{
|
|
512
517
|
"name": "stake",
|
|
513
518
|
"writable": true
|
|
@@ -749,6 +754,38 @@
|
|
|
749
754
|
}
|
|
750
755
|
]
|
|
751
756
|
},
|
|
757
|
+
{
|
|
758
|
+
"name": "swap_404",
|
|
759
|
+
"discriminator": [227, 249, 224, 136, 128, 95, 255, 239],
|
|
760
|
+
"accounts": [
|
|
761
|
+
{
|
|
762
|
+
"name": "signer",
|
|
763
|
+
"writable": true,
|
|
764
|
+
"signer": true
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
"name": "user",
|
|
768
|
+
"writable": true,
|
|
769
|
+
"pda": {
|
|
770
|
+
"seeds": [
|
|
771
|
+
{
|
|
772
|
+
"kind": "const",
|
|
773
|
+
"value": [117, 115, 101, 114]
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
"kind": "account",
|
|
777
|
+
"path": "signer"
|
|
778
|
+
}
|
|
779
|
+
]
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
"name": "system_program",
|
|
784
|
+
"address": "11111111111111111111111111111111"
|
|
785
|
+
}
|
|
786
|
+
],
|
|
787
|
+
"args": []
|
|
788
|
+
},
|
|
752
789
|
{
|
|
753
790
|
"name": "update_stake_vault_status",
|
|
754
791
|
"discriminator": [71, 64, 188, 150, 86, 254, 221, 65],
|
|
@@ -1033,6 +1070,11 @@
|
|
|
1033
1070
|
"code": 6020,
|
|
1034
1071
|
"name": "StakeOverflow",
|
|
1035
1072
|
"msg": "Stake overflow"
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
"code": 6021,
|
|
1076
|
+
"name": "SwapsReachedLimit",
|
|
1077
|
+
"msg": "Swaps reached limit"
|
|
1036
1078
|
}
|
|
1037
1079
|
],
|
|
1038
1080
|
"types": [
|
|
@@ -1474,6 +1516,10 @@
|
|
|
1474
1516
|
{
|
|
1475
1517
|
"name": "init_ts",
|
|
1476
1518
|
"type": "i64"
|
|
1519
|
+
},
|
|
1520
|
+
{
|
|
1521
|
+
"name": "slots",
|
|
1522
|
+
"type": "u64"
|
|
1477
1523
|
}
|
|
1478
1524
|
]
|
|
1479
1525
|
}
|
|
@@ -1531,10 +1577,14 @@
|
|
|
1531
1577
|
"name": "staked",
|
|
1532
1578
|
"type": "u64"
|
|
1533
1579
|
},
|
|
1580
|
+
{
|
|
1581
|
+
"name": "first_swap",
|
|
1582
|
+
"type": "i64"
|
|
1583
|
+
},
|
|
1534
1584
|
{
|
|
1535
1585
|
"name": "padding",
|
|
1536
1586
|
"type": {
|
|
1537
|
-
"array": ["u8",
|
|
1587
|
+
"array": ["u8", 32]
|
|
1538
1588
|
}
|
|
1539
1589
|
}
|
|
1540
1590
|
]
|
|
@@ -8,8 +8,9 @@ export type TriadProtocol = {
|
|
|
8
8
|
address: 'TRDwq3BN4mP3m9KsuNUWSN6QDff93VKGSwE95Jbr9Ss';
|
|
9
9
|
metadata: {
|
|
10
10
|
name: 'triadProtocol';
|
|
11
|
-
version: '0.1.
|
|
11
|
+
version: '0.1.4';
|
|
12
12
|
spec: '0.1.0';
|
|
13
|
+
description: 'Triad protocol, trade solana projects';
|
|
13
14
|
};
|
|
14
15
|
instructions: [
|
|
15
16
|
{
|
|
@@ -40,92 +41,6 @@ export type TriadProtocol = {
|
|
|
40
41
|
{
|
|
41
42
|
name: 'toAta';
|
|
42
43
|
writable: true;
|
|
43
|
-
pda: {
|
|
44
|
-
seeds: [
|
|
45
|
-
{
|
|
46
|
-
kind: 'account';
|
|
47
|
-
path: 'signer';
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
kind: 'const';
|
|
51
|
-
value: [
|
|
52
|
-
6,
|
|
53
|
-
221,
|
|
54
|
-
246,
|
|
55
|
-
225,
|
|
56
|
-
215,
|
|
57
|
-
101,
|
|
58
|
-
161,
|
|
59
|
-
147,
|
|
60
|
-
217,
|
|
61
|
-
203,
|
|
62
|
-
225,
|
|
63
|
-
70,
|
|
64
|
-
206,
|
|
65
|
-
235,
|
|
66
|
-
121,
|
|
67
|
-
172,
|
|
68
|
-
28,
|
|
69
|
-
180,
|
|
70
|
-
133,
|
|
71
|
-
237,
|
|
72
|
-
95,
|
|
73
|
-
91,
|
|
74
|
-
55,
|
|
75
|
-
145,
|
|
76
|
-
58,
|
|
77
|
-
140,
|
|
78
|
-
245,
|
|
79
|
-
133,
|
|
80
|
-
126,
|
|
81
|
-
255,
|
|
82
|
-
0,
|
|
83
|
-
169
|
|
84
|
-
];
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
kind: 'account';
|
|
88
|
-
path: 'mint';
|
|
89
|
-
}
|
|
90
|
-
];
|
|
91
|
-
program: {
|
|
92
|
-
kind: 'const';
|
|
93
|
-
value: [
|
|
94
|
-
140,
|
|
95
|
-
151,
|
|
96
|
-
37,
|
|
97
|
-
143,
|
|
98
|
-
78,
|
|
99
|
-
36,
|
|
100
|
-
137,
|
|
101
|
-
241,
|
|
102
|
-
187,
|
|
103
|
-
61,
|
|
104
|
-
16,
|
|
105
|
-
41,
|
|
106
|
-
20,
|
|
107
|
-
142,
|
|
108
|
-
13,
|
|
109
|
-
131,
|
|
110
|
-
11,
|
|
111
|
-
90,
|
|
112
|
-
19,
|
|
113
|
-
153,
|
|
114
|
-
218,
|
|
115
|
-
255,
|
|
116
|
-
16,
|
|
117
|
-
132,
|
|
118
|
-
4,
|
|
119
|
-
142,
|
|
120
|
-
123,
|
|
121
|
-
216,
|
|
122
|
-
219,
|
|
123
|
-
233,
|
|
124
|
-
248,
|
|
125
|
-
89
|
|
126
|
-
];
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
44
|
},
|
|
130
45
|
{
|
|
131
46
|
name: 'tokenProgram';
|
|
@@ -426,92 +341,6 @@ export type TriadProtocol = {
|
|
|
426
341
|
{
|
|
427
342
|
name: 'toAta';
|
|
428
343
|
writable: true;
|
|
429
|
-
pda: {
|
|
430
|
-
seeds: [
|
|
431
|
-
{
|
|
432
|
-
kind: 'account';
|
|
433
|
-
path: 'stakeVault';
|
|
434
|
-
},
|
|
435
|
-
{
|
|
436
|
-
kind: 'const';
|
|
437
|
-
value: [
|
|
438
|
-
6,
|
|
439
|
-
221,
|
|
440
|
-
246,
|
|
441
|
-
225,
|
|
442
|
-
215,
|
|
443
|
-
101,
|
|
444
|
-
161,
|
|
445
|
-
147,
|
|
446
|
-
217,
|
|
447
|
-
203,
|
|
448
|
-
225,
|
|
449
|
-
70,
|
|
450
|
-
206,
|
|
451
|
-
235,
|
|
452
|
-
121,
|
|
453
|
-
172,
|
|
454
|
-
28,
|
|
455
|
-
180,
|
|
456
|
-
133,
|
|
457
|
-
237,
|
|
458
|
-
95,
|
|
459
|
-
91,
|
|
460
|
-
55,
|
|
461
|
-
145,
|
|
462
|
-
58,
|
|
463
|
-
140,
|
|
464
|
-
245,
|
|
465
|
-
133,
|
|
466
|
-
126,
|
|
467
|
-
255,
|
|
468
|
-
0,
|
|
469
|
-
169
|
|
470
|
-
];
|
|
471
|
-
},
|
|
472
|
-
{
|
|
473
|
-
kind: 'account';
|
|
474
|
-
path: 'mint';
|
|
475
|
-
}
|
|
476
|
-
];
|
|
477
|
-
program: {
|
|
478
|
-
kind: 'const';
|
|
479
|
-
value: [
|
|
480
|
-
140,
|
|
481
|
-
151,
|
|
482
|
-
37,
|
|
483
|
-
143,
|
|
484
|
-
78,
|
|
485
|
-
36,
|
|
486
|
-
137,
|
|
487
|
-
241,
|
|
488
|
-
187,
|
|
489
|
-
61,
|
|
490
|
-
16,
|
|
491
|
-
41,
|
|
492
|
-
20,
|
|
493
|
-
142,
|
|
494
|
-
13,
|
|
495
|
-
131,
|
|
496
|
-
11,
|
|
497
|
-
90,
|
|
498
|
-
19,
|
|
499
|
-
153,
|
|
500
|
-
218,
|
|
501
|
-
255,
|
|
502
|
-
16,
|
|
503
|
-
132,
|
|
504
|
-
4,
|
|
505
|
-
142,
|
|
506
|
-
123,
|
|
507
|
-
216,
|
|
508
|
-
219,
|
|
509
|
-
233,
|
|
510
|
-
248,
|
|
511
|
-
89
|
|
512
|
-
];
|
|
513
|
-
};
|
|
514
|
-
};
|
|
515
344
|
},
|
|
516
345
|
{
|
|
517
346
|
name: 'tokenProgram';
|
|
@@ -676,6 +505,10 @@ export type TriadProtocol = {
|
|
|
676
505
|
name: 'stakeVault';
|
|
677
506
|
writable: true;
|
|
678
507
|
},
|
|
508
|
+
{
|
|
509
|
+
name: 'user';
|
|
510
|
+
writable: true;
|
|
511
|
+
},
|
|
679
512
|
{
|
|
680
513
|
name: 'stake';
|
|
681
514
|
writable: true;
|
|
@@ -861,6 +694,38 @@ export type TriadProtocol = {
|
|
|
861
694
|
}
|
|
862
695
|
];
|
|
863
696
|
},
|
|
697
|
+
{
|
|
698
|
+
name: 'swap404';
|
|
699
|
+
discriminator: [227, 249, 224, 136, 128, 95, 255, 239];
|
|
700
|
+
accounts: [
|
|
701
|
+
{
|
|
702
|
+
name: 'signer';
|
|
703
|
+
writable: true;
|
|
704
|
+
signer: true;
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
name: 'user';
|
|
708
|
+
writable: true;
|
|
709
|
+
pda: {
|
|
710
|
+
seeds: [
|
|
711
|
+
{
|
|
712
|
+
kind: 'const';
|
|
713
|
+
value: [117, 115, 101, 114];
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
kind: 'account';
|
|
717
|
+
path: 'signer';
|
|
718
|
+
}
|
|
719
|
+
];
|
|
720
|
+
};
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
name: 'systemProgram';
|
|
724
|
+
address: '11111111111111111111111111111111';
|
|
725
|
+
}
|
|
726
|
+
];
|
|
727
|
+
args: [];
|
|
728
|
+
},
|
|
864
729
|
{
|
|
865
730
|
name: 'updateStakeVaultStatus';
|
|
866
731
|
discriminator: [71, 64, 188, 150, 86, 254, 221, 65];
|
|
@@ -955,92 +820,6 @@ export type TriadProtocol = {
|
|
|
955
820
|
{
|
|
956
821
|
name: 'toAta';
|
|
957
822
|
writable: true;
|
|
958
|
-
pda: {
|
|
959
|
-
seeds: [
|
|
960
|
-
{
|
|
961
|
-
kind: 'account';
|
|
962
|
-
path: 'signer';
|
|
963
|
-
},
|
|
964
|
-
{
|
|
965
|
-
kind: 'const';
|
|
966
|
-
value: [
|
|
967
|
-
6,
|
|
968
|
-
221,
|
|
969
|
-
246,
|
|
970
|
-
225,
|
|
971
|
-
215,
|
|
972
|
-
101,
|
|
973
|
-
161,
|
|
974
|
-
147,
|
|
975
|
-
217,
|
|
976
|
-
203,
|
|
977
|
-
225,
|
|
978
|
-
70,
|
|
979
|
-
206,
|
|
980
|
-
235,
|
|
981
|
-
121,
|
|
982
|
-
172,
|
|
983
|
-
28,
|
|
984
|
-
180,
|
|
985
|
-
133,
|
|
986
|
-
237,
|
|
987
|
-
95,
|
|
988
|
-
91,
|
|
989
|
-
55,
|
|
990
|
-
145,
|
|
991
|
-
58,
|
|
992
|
-
140,
|
|
993
|
-
245,
|
|
994
|
-
133,
|
|
995
|
-
126,
|
|
996
|
-
255,
|
|
997
|
-
0,
|
|
998
|
-
169
|
|
999
|
-
];
|
|
1000
|
-
},
|
|
1001
|
-
{
|
|
1002
|
-
kind: 'account';
|
|
1003
|
-
path: 'mint';
|
|
1004
|
-
}
|
|
1005
|
-
];
|
|
1006
|
-
program: {
|
|
1007
|
-
kind: 'const';
|
|
1008
|
-
value: [
|
|
1009
|
-
140,
|
|
1010
|
-
151,
|
|
1011
|
-
37,
|
|
1012
|
-
143,
|
|
1013
|
-
78,
|
|
1014
|
-
36,
|
|
1015
|
-
137,
|
|
1016
|
-
241,
|
|
1017
|
-
187,
|
|
1018
|
-
61,
|
|
1019
|
-
16,
|
|
1020
|
-
41,
|
|
1021
|
-
20,
|
|
1022
|
-
142,
|
|
1023
|
-
13,
|
|
1024
|
-
131,
|
|
1025
|
-
11,
|
|
1026
|
-
90,
|
|
1027
|
-
19,
|
|
1028
|
-
153,
|
|
1029
|
-
218,
|
|
1030
|
-
255,
|
|
1031
|
-
16,
|
|
1032
|
-
132,
|
|
1033
|
-
4,
|
|
1034
|
-
142,
|
|
1035
|
-
123,
|
|
1036
|
-
216,
|
|
1037
|
-
219,
|
|
1038
|
-
233,
|
|
1039
|
-
248,
|
|
1040
|
-
89
|
|
1041
|
-
];
|
|
1042
|
-
};
|
|
1043
|
-
};
|
|
1044
823
|
},
|
|
1045
824
|
{
|
|
1046
825
|
name: 'tokenProgram';
|
|
@@ -1203,6 +982,11 @@ export type TriadProtocol = {
|
|
|
1203
982
|
code: 6020;
|
|
1204
983
|
name: 'stakeOverflow';
|
|
1205
984
|
msg: 'Stake overflow';
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
code: 6021;
|
|
988
|
+
name: 'swapsReachedLimit';
|
|
989
|
+
msg: 'Swaps reached limit';
|
|
1206
990
|
}
|
|
1207
991
|
];
|
|
1208
992
|
types: [
|
|
@@ -1644,6 +1428,10 @@ export type TriadProtocol = {
|
|
|
1644
1428
|
{
|
|
1645
1429
|
name: 'initTs';
|
|
1646
1430
|
type: 'i64';
|
|
1431
|
+
},
|
|
1432
|
+
{
|
|
1433
|
+
name: 'slots';
|
|
1434
|
+
type: 'u64';
|
|
1647
1435
|
}
|
|
1648
1436
|
];
|
|
1649
1437
|
};
|
|
@@ -1701,10 +1489,14 @@ export type TriadProtocol = {
|
|
|
1701
1489
|
name: 'staked';
|
|
1702
1490
|
type: 'u64';
|
|
1703
1491
|
},
|
|
1492
|
+
{
|
|
1493
|
+
name: 'firstSwap';
|
|
1494
|
+
type: 'i64';
|
|
1495
|
+
},
|
|
1704
1496
|
{
|
|
1705
1497
|
name: 'padding';
|
|
1706
1498
|
type: {
|
|
1707
|
-
array: ['u8',
|
|
1499
|
+
array: ['u8', 32];
|
|
1708
1500
|
};
|
|
1709
1501
|
}
|
|
1710
1502
|
];
|