@triadxyz/triad-protocol 1.6.3-beta → 1.6.4-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.
@@ -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,65 @@ 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 / 1 to 20
486
+ // 2 - TRD 50 - 10,000 / 21 to 2021
487
+ // 3 - TRD 5 - 50,000 / 2022 to 102022
488
+ // 4 - Honeyland NFT - 30 NFT / 102023 to 132023
489
+ // 5 - Poseidon NFT - 20 NFT / 132024 to 152024
490
+ // 6 - SMB 3 - 2 NFT / 152025 to 157025
491
+ // 7 - 500 tridents / 157026 to 657026
492
+ // 8 - 2k tridents / 657027 to 857027
493
+ // 9 - 50 HXD - 10,000 / 857028 to 864008
494
+ // 10 - 0.01 ORE - 10 ORE / 864009 to 924009
495
+ // 11 - TRD 100 - 5,000 / 924010 to 925010
496
+ // 12 - 10 STREAM - 15K STREAM / 925011 to 1000000
497
+ const addWheelPrize = () => __awaiter(void 0, void 0, void 0, function* () {
498
+ const response = yield triadProtocol.wheel.addWheelPrize({
499
+ prize: 11,
500
+ amount: 20,
501
+ rangeMin: 924010,
502
+ rangeMax: 925010,
503
+ availableQuantity: 50
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.log(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
+ });
524
+ spinWheel();
@@ -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('wheel'), Buffer.from(name)], programId)[0];
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.6.3-beta",
3
+ "version": "1.6.4-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",