@triadxyz/triad-protocol 1.0.0-beta → 1.0.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.js CHANGED
@@ -21,7 +21,9 @@ const stake_1 = __importDefault(require("./stake"));
21
21
  const sendTransactionWithOptions_1 = __importDefault(require("./utils/sendTransactionWithOptions"));
22
22
  class TriadProtocolClient {
23
23
  constructor(connection, wallet) {
24
- this.provider = new anchor_1.AnchorProvider(connection, wallet, anchor_1.AnchorProvider.defaultOptions());
24
+ this.provider = new anchor_1.AnchorProvider(connection, wallet, {
25
+ commitment: 'confirmed'
26
+ });
25
27
  this.program = new anchor_1.Program(idl_triad_protocol_json_1.default, this.provider);
26
28
  this.trade = new trade_1.default(this.program, this.provider);
27
29
  this.stake = new stake_1.default(this.program, this.provider);
@@ -13,21 +13,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const fs_1 = __importDefault(require("fs"));
16
- const src_1 = __importDefault(require("../src"));
16
+ const _1 = __importDefault(require("./"));
17
17
  const anchor_1 = require("@coral-xyz/anchor");
18
18
  const axios_1 = __importDefault(require("axios"));
19
19
  const web3_js_1 = require("@solana/web3.js");
20
- const file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/triad.json');
21
- const rpc_file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/rpc-devnet.txt');
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
22
  const keypair = web3_js_1.Keypair.fromSecretKey(new Uint8Array(JSON.parse(file.toString())));
23
23
  const connection = new web3_js_1.Connection(rpc_file.toString(), 'confirmed');
24
24
  const wallet = new anchor_1.Wallet(keypair);
25
- const triadProtocol = new src_1.default(connection, wallet);
25
+ const triadProtocol = new _1.default(connection, wallet);
26
26
  const markets = [{ name: 'Triad', marketId: 0 }];
27
27
  const ordersHypeAndFloopBot = [
28
28
  {
29
29
  marketId: 0,
30
- amount: 100000,
30
+ amount: 0,
31
31
  direction: {
32
32
  flop: {}
33
33
  },
@@ -42,6 +42,14 @@ const updateStakeVault = () => __awaiter(void 0, void 0, void 0, function* () {
42
42
  });
43
43
  console.log(response);
44
44
  });
45
+ const updateStakeVaultStatus = () => __awaiter(void 0, void 0, void 0, function* () {
46
+ const response = yield triadProtocol.stake.updateStakeVault({
47
+ wallet: wallet.publicKey,
48
+ amount: new anchor_1.BN(0),
49
+ status: false
50
+ });
51
+ console.log(response);
52
+ });
45
53
  const updateBoost = () => __awaiter(void 0, void 0, void 0, function* () {
46
54
  const response = (yield axios_1.default.get('https://api.triadfi.co/boost'))
47
55
  .data;
@@ -69,7 +77,6 @@ const getMarket = () => __awaiter(void 0, void 0, void 0, function* () {
69
77
  const market = yield triadProtocol.trade.getMarketById(1);
70
78
  console.log(market);
71
79
  });
72
- getMarket();
73
80
  const initializeAllMarkets = () => __awaiter(void 0, void 0, void 0, function* () {
74
81
  for (const market of markets) {
75
82
  try {
@@ -126,14 +133,20 @@ const runBot = () => __awaiter(void 0, void 0, void 0, function* () {
126
133
  });
127
134
  const initializeQuestion = () => __awaiter(void 0, void 0, void 0, function* () {
128
135
  const currentTime = Math.floor(Date.now() / 1000) + 10; // Current time in seconds
129
- const response = yield triadProtocol.trade.initializeQuestion({
130
- marketId: 1,
131
- question: 'FUCK OFF?',
132
- startTime: currentTime,
133
- endTime: currentTime + 24 * 60 * 60
134
- });
135
- console.log(response);
136
+ try {
137
+ const response = yield triadProtocol.trade.initializeQuestion({
138
+ marketId: 0,
139
+ question: 'Will Triad send the project to the Radar Hackathon?',
140
+ startTime: currentTime,
141
+ endTime: 1728320400
142
+ });
143
+ console.log(response);
144
+ }
145
+ catch (e) {
146
+ console.log(e);
147
+ }
136
148
  });
149
+ initializeQuestion();
137
150
  const resolveQuestion = () => __awaiter(void 0, void 0, void 0, function* () {
138
151
  const response = yield triadProtocol.trade.resolveQuestion(0);
139
152
  console.log(response);
package/dist/stake.js CHANGED
@@ -99,7 +99,6 @@ class Stake {
99
99
  for (const stake of response) {
100
100
  const rank = (0, getRarityRank_1.default)(ranks, stake.mint, stake.name);
101
101
  let available = 0;
102
- yield new Promise((resolve) => setTimeout(resolve, 1000));
103
102
  try {
104
103
  available = yield this.getStakeRewards({
105
104
  wallet,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.0.0-beta",
3
+ "version": "1.0.2-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",