@triadxyz/triad-protocol 0.1.2-alpha.8 → 0.1.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 +2 -0
- package/dist/index.js +4 -3
- package/dist/stake.d.ts +135 -0
- package/dist/stake.js +483 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.js +107 -0
- package/dist/ticker.js +0 -6
- package/dist/types/idl_triad_protocol.json +1902 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +2 -0
- package/dist/types/stake.d.ts +130 -0
- package/dist/types/stake.js +20 -0
- package/dist/types/triad_protocol.d.ts +1527 -405
- package/dist/types/triad_protocol.js +0 -664
- package/dist/utils/constants.d.ts +31 -0
- package/dist/utils/constants.js +14 -1
- package/dist/utils/helpers.d.ts +19 -0
- package/dist/utils/helpers.js +88 -1
- package/dist/utils/stake-season-1/rarity.json +11036 -0
- package/dist/utils/stake-season-1/users-collections-week-1.json +3290 -0
- package/dist/vault.js +22 -6
- package/package.json +9 -8
package/dist/test.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const fs_1 = __importDefault(require("fs"));
|
|
16
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
17
|
+
const index_1 = __importDefault(require("./index"));
|
|
18
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
19
|
+
const constants_1 = require("./utils/constants");
|
|
20
|
+
const file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/id.json');
|
|
21
|
+
const rpc_file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/rpc.txt');
|
|
22
|
+
const keypair = web3_js_1.Keypair.fromSecretKey(new Uint8Array(JSON.parse(file.toString())));
|
|
23
|
+
const connection = new web3_js_1.Connection(rpc_file.toString(), 'confirmed');
|
|
24
|
+
const wallet = new anchor_1.Wallet(keypair);
|
|
25
|
+
const triadProtocol = new index_1.default(connection, wallet);
|
|
26
|
+
const requestWithdraw = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
const response = yield triadProtocol.stake.requestWithdraw({
|
|
28
|
+
wallet: wallet.publicKey,
|
|
29
|
+
nftName: 'Triad 0',
|
|
30
|
+
mint: new web3_js_1.PublicKey('FXRhaGeYue7bMCwcksNw4hJRY7jZ1YMwgmCu1Y8fyUNd'),
|
|
31
|
+
stakeVault: 'Rev 1'
|
|
32
|
+
}, {
|
|
33
|
+
microLamports: 10000,
|
|
34
|
+
skipPreflight: true
|
|
35
|
+
});
|
|
36
|
+
console.log(response);
|
|
37
|
+
});
|
|
38
|
+
const updateStakeVaultStatus = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
const response = yield triadProtocol.stake.updateStakeVaultStatus({
|
|
40
|
+
wallet: wallet.publicKey,
|
|
41
|
+
isLocked: true,
|
|
42
|
+
week: 4,
|
|
43
|
+
stakeVault: constants_1.STAKE_SEASON
|
|
44
|
+
}, {
|
|
45
|
+
skipPreflight: true,
|
|
46
|
+
microLamports: 10000
|
|
47
|
+
});
|
|
48
|
+
console.log(response);
|
|
49
|
+
});
|
|
50
|
+
const withdraw = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
const response = yield triadProtocol.stake.withdrawStake({
|
|
52
|
+
wallet: wallet.publicKey,
|
|
53
|
+
nftName: 'Triad 2807',
|
|
54
|
+
mint: new web3_js_1.PublicKey('A4fu2s6bCbKAveVgACkxpMgtJUHqoRJsTyzRp1Jp8nuE'),
|
|
55
|
+
stakeVault: constants_1.STAKE_SEASON
|
|
56
|
+
}, {
|
|
57
|
+
microLamports: 10000,
|
|
58
|
+
skipPreflight: true
|
|
59
|
+
});
|
|
60
|
+
console.log(response);
|
|
61
|
+
});
|
|
62
|
+
const getStake = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
const response = yield triadProtocol.stake.getStakeByWallet(new web3_js_1.PublicKey('E48CKgbZVpDzerQ7DdommgqNobRHLqHy8RUVi8HXkSHE'), constants_1.STAKE_SEASON);
|
|
64
|
+
const stakeVaults = yield triadProtocol.stake.getStakeVaults();
|
|
65
|
+
console.log(response);
|
|
66
|
+
console.log(stakeVaults);
|
|
67
|
+
});
|
|
68
|
+
const claimStakeRewardsV1 = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
+
const response = yield triadProtocol.stake.claimStakeRewards({
|
|
70
|
+
wallet: wallet.publicKey,
|
|
71
|
+
mint: new web3_js_1.PublicKey('t3DohmswhKk94PPbPYwA6ZKACyY3y5kbcqeQerAJjmV'),
|
|
72
|
+
week: [4],
|
|
73
|
+
stakeVault: constants_1.STAKE_SEASON,
|
|
74
|
+
nftName: 'Triad 2807'
|
|
75
|
+
}, {
|
|
76
|
+
skipPreflight: true,
|
|
77
|
+
microLamports: 10000
|
|
78
|
+
});
|
|
79
|
+
console.log(response);
|
|
80
|
+
});
|
|
81
|
+
const getStakers = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
82
|
+
const response = yield triadProtocol.stake.getStakes(constants_1.STAKE_SEASON);
|
|
83
|
+
console.log(JSON.stringify(response, null, 2));
|
|
84
|
+
const users = response
|
|
85
|
+
.filter((item, index, self) => index === self.findIndex((t) => t.authority === item.authority))
|
|
86
|
+
.map((user) => user.authority);
|
|
87
|
+
fs_1.default.writeFileSync('./src/utils/stake-season-1/users.json', JSON.stringify(users, null, 2));
|
|
88
|
+
});
|
|
89
|
+
const stake = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
+
const response = yield triadProtocol.stake.stakeNft({
|
|
91
|
+
name: 'Triad 0',
|
|
92
|
+
wallet: wallet.publicKey,
|
|
93
|
+
stakeVault: 'Rev 1',
|
|
94
|
+
rarity: { mythic: {} },
|
|
95
|
+
collections: {
|
|
96
|
+
coleta: false,
|
|
97
|
+
undead: false,
|
|
98
|
+
alligators: false,
|
|
99
|
+
pyth: false
|
|
100
|
+
},
|
|
101
|
+
mint: new web3_js_1.PublicKey('FXRhaGeYue7bMCwcksNw4hJRY7jZ1YMwgmCu1Y8fyUNd')
|
|
102
|
+
}, {
|
|
103
|
+
skipPreflight: true,
|
|
104
|
+
microLamports: 20000
|
|
105
|
+
});
|
|
106
|
+
console.log(response);
|
|
107
|
+
});
|
package/dist/ticker.js
CHANGED
|
@@ -34,16 +34,10 @@ class Ticker {
|
|
|
34
34
|
*/
|
|
35
35
|
createTicker({ name, protocolProgramId, tokenMint }) {
|
|
36
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const TickerPDA = (0, helpers_1.getTickerAddressSync)(this.program.programId, name);
|
|
38
|
-
const VaultPDA = (0, helpers_1.getVaultAddressSync)(this.program.programId, TickerPDA);
|
|
39
|
-
const TokenAccountPDA = (0, helpers_1.getTokenVaultAddressSync)(this.program.programId, VaultPDA);
|
|
40
37
|
return this.program.methods
|
|
41
38
|
.createTicker({ name, protocolProgramId })
|
|
42
39
|
.accounts({
|
|
43
40
|
signer: this.provider.wallet.publicKey,
|
|
44
|
-
ticker: TickerPDA,
|
|
45
|
-
vault: VaultPDA,
|
|
46
|
-
tokenAccount: TokenAccountPDA,
|
|
47
41
|
payerTokenMint: tokenMint
|
|
48
42
|
})
|
|
49
43
|
.rpc();
|