@triadxyz/triad-protocol 0.3.7-beta → 0.3.9-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.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="@coral-xyz/anchor/node_modules/@solana/web3.js" />
1
2
  import { AnchorProvider, Program } from '@coral-xyz/anchor';
2
3
  import { PublicKey } from '@solana/web3.js';
3
4
  import { TriadProtocol } from './types/triad_protocol';
@@ -123,5 +124,5 @@ export default class Stake {
123
124
  * @param nftName - Name of the nft
124
125
  *
125
126
  */
126
- claimStakeRewards({ wallet, stakeVault, nftName, collections, rank }: ClaimStakeRewardsArgs, options?: RpcOptions): Promise<string>;
127
+ claimStakeRewards({ wallet, stakeVault, nftName, collections, rank }: ClaimStakeRewardsArgs, options?: RpcOptions): Promise<import("@solana/web3.js").Transaction>;
127
128
  }
package/dist/stake.js CHANGED
@@ -406,7 +406,7 @@ class Stake {
406
406
  })
407
407
  ]);
408
408
  }
409
- return method.rpc({ skipPreflight: options === null || options === void 0 ? void 0 : options.skipPreflight });
409
+ return method.transaction();
410
410
  });
411
411
  }
412
412
  }
package/dist/test.js CHANGED
@@ -18,6 +18,7 @@ const index_1 = __importDefault(require("./index"));
18
18
  const anchor_1 = require("@coral-xyz/anchor");
19
19
  const constants_1 = require("./utils/constants");
20
20
  const rarity_json_1 = __importDefault(require("./utils/stake-season-1/rarity.json"));
21
+ const getRarity_1 = require("./utils/getRarity");
21
22
  const file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/id.json');
22
23
  const rpc_file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/rpc.txt');
23
24
  const keypair = web3_js_1.Keypair.fromSecretKey(new Uint8Array(JSON.parse(file.toString())));
@@ -25,7 +26,27 @@ const connection = new web3_js_1.Connection(rpc_file.toString(), 'confirmed');
25
26
  const wallet = new anchor_1.Wallet(keypair);
26
27
  const triadProtocol = new index_1.default(connection, wallet);
27
28
  const getStake = () => __awaiter(void 0, void 0, void 0, function* () {
28
- const response = yield triadProtocol.stake.getStakeByWallet(new web3_js_1.PublicKey('HjJQdfTHgC3EBX3471w4st8BXbBmtbaMyCAXNgcUb7dq'), constants_1.STAKE_SEASON, 0, rarity_json_1.default);
29
- console.log(response);
29
+ const response = yield triadProtocol.stake.getStakes(constants_1.STAKE_SEASON);
30
+ let available = 0;
31
+ let items = 0;
32
+ for (const stake of response) {
33
+ const getRank = (0, getRarity_1.getRarityRank)(rarity_json_1.default, stake.mint, stake.name);
34
+ try {
35
+ available += yield triadProtocol.stake.getStakeRewards({
36
+ wallet: new web3_js_1.PublicKey(stake.authority),
37
+ nftName: stake.name,
38
+ stakeVault: constants_1.STAKE_SEASON,
39
+ rank: getRank,
40
+ collections: 1
41
+ });
42
+ items += 1;
43
+ console.log(items);
44
+ console.log(available);
45
+ }
46
+ catch (e) { }
47
+ }
48
+ console.log(available);
49
+ console.log(items);
50
+ console.log(response.length);
30
51
  });
31
52
  getStake();
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRarityRank = void 0;
4
4
  const getRarityRank = (ranks, onchainId, name) => {
5
5
  const item = ranks.find((entry) => entry.onchainId === onchainId || entry.name === name);
6
- return item ? item.rarityRankHrtt : 0;
6
+ return item ? item.rarityRankHrtt : 963;
7
7
  };
8
8
  exports.getRarityRank = getRarityRank;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "0.3.7-beta",
3
+ "version": "0.3.9-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",