@triadxyz/triad-protocol 1.0.0-beta → 1.0.1-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.js +19 -10
- package/dist/stake.js +0 -1
- package/package.json +1 -1
package/dist/local-test.js
CHANGED
|
@@ -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
|
|
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/
|
|
21
|
-
const rpc_file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/rpc
|
|
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
|
|
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:
|
|
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;
|
|
@@ -65,11 +73,11 @@ const getAllMarkets = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
65
73
|
const markets = yield triadProtocol.trade.getAllMarkets();
|
|
66
74
|
console.log(markets);
|
|
67
75
|
});
|
|
76
|
+
getAllMarkets();
|
|
68
77
|
const getMarket = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
78
|
const market = yield triadProtocol.trade.getMarketById(1);
|
|
70
79
|
console.log(market);
|
|
71
80
|
});
|
|
72
|
-
getMarket();
|
|
73
81
|
const initializeAllMarkets = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
82
|
for (const market of markets) {
|
|
75
83
|
try {
|
|
@@ -125,15 +133,16 @@ const runBot = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
125
133
|
}
|
|
126
134
|
});
|
|
127
135
|
const initializeQuestion = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
128
|
-
const currentTime = Math.floor(Date.now() / 1000)
|
|
136
|
+
const currentTime = Math.floor(Date.now() / 1000); // Current time in seconds
|
|
129
137
|
const response = yield triadProtocol.trade.initializeQuestion({
|
|
130
|
-
marketId:
|
|
131
|
-
question: '
|
|
138
|
+
marketId: 0,
|
|
139
|
+
question: 'Will Triad send the project to the Radar Hackathon?',
|
|
132
140
|
startTime: currentTime,
|
|
133
|
-
endTime:
|
|
141
|
+
endTime: 1728320400
|
|
134
142
|
});
|
|
135
143
|
console.log(response);
|
|
136
144
|
});
|
|
145
|
+
initializeQuestion();
|
|
137
146
|
const resolveQuestion = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
138
147
|
const response = yield triadProtocol.trade.resolveQuestion(0);
|
|
139
148
|
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,
|