@triadxyz/triad-protocol 1.6.3-beta → 1.6.5-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/local-test/index.js +75 -1
- package/dist/utils/pda/index.js +1 -1
- package/dist/wheel.d.ts +1 -1
- package/dist/wheel.js +16 -13
- package/package.json +1 -1
package/dist/local-test/index.js
CHANGED
|
@@ -21,6 +21,8 @@ const spl_token_1 = require("@solana/spl-token");
|
|
|
21
21
|
const constants_1 = require("../utils/constants");
|
|
22
22
|
const simulate_market_1 = require("./simulate-market");
|
|
23
23
|
const init_market_1 = require("./init-market");
|
|
24
|
+
const sdk_1 = require("@shadow-drive/sdk");
|
|
25
|
+
const pda_1 = require("../utils/pda");
|
|
24
26
|
const file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/id.json');
|
|
25
27
|
const rpc_file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/rpc.txt');
|
|
26
28
|
const keypair = web3_js_1.Keypair.fromSecretKey(new Uint8Array(JSON.parse(file.toString())));
|
|
@@ -30,7 +32,6 @@ const triadProtocol = new __1.default(connection, wallet);
|
|
|
30
32
|
const marketId = 1001;
|
|
31
33
|
const simulateMarket = new simulate_market_1.SimulateMarket(triadProtocol);
|
|
32
34
|
const initMarket = new init_market_1.InitMarket(triadProtocol);
|
|
33
|
-
simulateMarket.simulate();
|
|
34
35
|
const updateStakeVault = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
36
|
const response = yield triadProtocol.stake.updateStakeVault({
|
|
36
37
|
amount: new anchor_1.BN(1000 * Math.pow(10, 6)),
|
|
@@ -386,6 +387,18 @@ const mintToken = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
386
387
|
console.log(e);
|
|
387
388
|
}
|
|
388
389
|
});
|
|
390
|
+
const updateTokenMetadata = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
391
|
+
const mintTransaction = new web3_js_1.Transaction().add((0, spl_token_1.createUpdateFieldInstruction)({
|
|
392
|
+
programId: spl_token_1.TOKEN_2022_PROGRAM_ID,
|
|
393
|
+
metadata: new web3_js_1.PublicKey('tCMraBSGHeMcQS76hNnBhnfbMzrtnnT3nbt3vAnSCE2'),
|
|
394
|
+
updateAuthority: wallet.publicKey,
|
|
395
|
+
field: 'uri',
|
|
396
|
+
value: 'https://shdw-drive.genesysgo.net/DRRe9dZkP199W6GLrySn2xj2ayfr8gin8iaBt1YVMN9M/tEVENT.json'
|
|
397
|
+
}));
|
|
398
|
+
const transactionSignature = yield (0, web3_js_1.sendAndConfirmTransaction)(connection, mintTransaction, [keypair] // Signers,
|
|
399
|
+
);
|
|
400
|
+
console.log(transactionSignature);
|
|
401
|
+
});
|
|
389
402
|
const withdrawPoseidon = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
390
403
|
const response = yield triadProtocol.withdrawPoseidon({
|
|
391
404
|
poseidonAsset: new web3_js_1.PublicKey('DMoyQ6pAj9bGu3WoMcVeYv4rgrU96Xjzyzudfs4fkJw3'),
|
|
@@ -447,3 +460,64 @@ const updateMarket = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
447
460
|
const response = yield triadProtocol.trade.updateMarket(128, 1751327940);
|
|
448
461
|
console.log(response);
|
|
449
462
|
});
|
|
463
|
+
const getStorage = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
464
|
+
const drive = yield new sdk_1.ShdwDrive(triadProtocol.provider.connection, triadProtocol.provider.wallet).init();
|
|
465
|
+
console.log(yield drive.getStorageAccount(new web3_js_1.PublicKey('DRRe9dZkP199W6GLrySn2xj2ayfr8gin8iaBt1YVMN9M')));
|
|
466
|
+
const jsonFile = {
|
|
467
|
+
name: `tCMAS.json`,
|
|
468
|
+
file: fs_1.default.readFileSync(`./src/tCMAS.json`)
|
|
469
|
+
};
|
|
470
|
+
const file = yield drive.editFile(new web3_js_1.PublicKey('DRRe9dZkP199W6GLrySn2xj2ayfr8gin8iaBt1YVMN9M'), jsonFile);
|
|
471
|
+
console.log(file);
|
|
472
|
+
return file;
|
|
473
|
+
});
|
|
474
|
+
const deployImage = (image) => __awaiter(void 0, void 0, void 0, function* () {
|
|
475
|
+
const TRIAD_STORAGE_ACCOUNT = new web3_js_1.PublicKey('DRRe9dZkP199W6GLrySn2xj2ayfr8gin8iaBt1YVMN9M');
|
|
476
|
+
const drive = yield new sdk_1.ShdwDrive(triadProtocol.provider.connection, triadProtocol.provider.wallet).init();
|
|
477
|
+
const jsonFile = {
|
|
478
|
+
name: `${image}`,
|
|
479
|
+
file: fs_1.default.readFileSync(`./src/${image}`)
|
|
480
|
+
};
|
|
481
|
+
const file = yield drive.uploadFile(TRIAD_STORAGE_ACCOUNT, jsonFile);
|
|
482
|
+
console.log(file);
|
|
483
|
+
return file;
|
|
484
|
+
});
|
|
485
|
+
// 1 - TRD 10k - 10,000
|
|
486
|
+
// 2 - TRD 50 - 10,000
|
|
487
|
+
// 3 - TRD 5 - 50,000
|
|
488
|
+
// 4 - Honeyland NFT - 30 NFT
|
|
489
|
+
// 5 - Poseidon NFT - 20 NFT
|
|
490
|
+
// 6 - SMB 3 - 2 NFT
|
|
491
|
+
// 7 - 500 tridents
|
|
492
|
+
// 8 - 2k tridents
|
|
493
|
+
// 9 - 50 HXD - 10,000
|
|
494
|
+
// 10 - 0.01 ORE - 10 ORE
|
|
495
|
+
// 11 - TRD 100 - 5,000
|
|
496
|
+
// 12 - 10 STREAM - 15K STREAM
|
|
497
|
+
const addWheelPrize = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
498
|
+
const response = yield triadProtocol.wheel.addWheelPrize({
|
|
499
|
+
prize: 3,
|
|
500
|
+
amount: 5,
|
|
501
|
+
rangeMin: 2012,
|
|
502
|
+
rangeMax: 103012,
|
|
503
|
+
availableQuantity: 2000
|
|
504
|
+
});
|
|
505
|
+
console.log(response);
|
|
506
|
+
});
|
|
507
|
+
const getWheel = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
508
|
+
const [response] = yield triadProtocol.program.account.wheel.all();
|
|
509
|
+
const prizes = response.account.prizes
|
|
510
|
+
.filter((prize) => prize.status.claimed)
|
|
511
|
+
.map((prize) => ({
|
|
512
|
+
prize: prize.prize.toString(),
|
|
513
|
+
amount: prize.amount.toString(),
|
|
514
|
+
rangeMin: prize.rangeMin.toString(),
|
|
515
|
+
rangeMax: prize.rangeMax.toString(),
|
|
516
|
+
availableQuantity: prize.availableQuantity.toString()
|
|
517
|
+
}));
|
|
518
|
+
console.table(prizes);
|
|
519
|
+
});
|
|
520
|
+
const spinWheel = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
521
|
+
const spin = (0, pda_1.getWheelPDA)(triadProtocol.program.programId, constants_1.VALENT_SPIN_NAME);
|
|
522
|
+
console.log(spin);
|
|
523
|
+
});
|
package/dist/utils/pda/index.js
CHANGED
|
@@ -16,7 +16,7 @@ const getTokenATA = (address, Mint) => {
|
|
|
16
16
|
};
|
|
17
17
|
exports.getTokenATA = getTokenATA;
|
|
18
18
|
const getWheelPDA = (programId, name) => {
|
|
19
|
-
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('
|
|
19
|
+
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('whell'), Buffer.from(name)], programId)[0];
|
|
20
20
|
};
|
|
21
21
|
exports.getWheelPDA = getWheelPDA;
|
|
22
22
|
const getCollectionPDA = (programId, collectionSymbol) => {
|
package/dist/wheel.d.ts
CHANGED
package/dist/wheel.js
CHANGED
|
@@ -86,19 +86,22 @@ class Wheel {
|
|
|
86
86
|
spinWheel(args, options) {
|
|
87
87
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
88
|
const wheelPDA = (0, pda_1.getWheelPDA)(this.program.programId, constants_1.VALENT_SPIN_NAME);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
89
|
+
let ixs = [];
|
|
90
|
+
for (const prize of args.prize) {
|
|
91
|
+
ixs.push(yield this.program.methods
|
|
92
|
+
.spinWheel({
|
|
93
|
+
isSol: args.isSol,
|
|
94
|
+
prize: new anchor_1.BN(prize)
|
|
95
|
+
})
|
|
96
|
+
.accounts({
|
|
97
|
+
signer: this.provider.wallet.publicKey,
|
|
98
|
+
verifier: constants_1.VERIFIER,
|
|
99
|
+
wheel: wheelPDA,
|
|
100
|
+
mint: constants_1.WHEEL_MINT
|
|
101
|
+
})
|
|
102
|
+
.instruction());
|
|
103
|
+
return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options, undefined, [], args.verifier);
|
|
104
|
+
}
|
|
102
105
|
});
|
|
103
106
|
}
|
|
104
107
|
/**
|