@triadxyz/triad-protocol 0.7.7-beta.devnet → 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 +20 -20
- package/dist/stake.js +0 -1
- package/dist/trade.d.ts +0 -1
- package/dist/trade.js +1 -1
- package/dist/types/idl_triad_protocol.json +250 -14
- package/dist/types/triad_protocol.d.ts +250 -14
- package/dist/utils/constants.d.ts +0 -1
- package/dist/utils/constants.js +1 -2
- package/package.json +1 -1
package/dist/local-test.js
CHANGED
|
@@ -13,30 +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
|
|
26
|
-
const markets = [
|
|
27
|
-
{ name: 'Jupiter', marketId: 0 },
|
|
28
|
-
{ name: 'Drift', marketId: 1 },
|
|
29
|
-
{ name: 'Pyth', marketId: 2 },
|
|
30
|
-
{ name: 'Undead', marketId: 3 },
|
|
31
|
-
{ name: 'MadLads', marketId: 4 },
|
|
32
|
-
{ name: 'DeGods', marketId: 5 },
|
|
33
|
-
{ name: 'IslandDAO', marketId: 6 },
|
|
34
|
-
{ name: 'Colosseum', marketId: 7 }
|
|
35
|
-
];
|
|
25
|
+
const triadProtocol = new _1.default(connection, wallet);
|
|
26
|
+
const markets = [{ name: 'Triad', marketId: 0 }];
|
|
36
27
|
const ordersHypeAndFloopBot = [
|
|
37
28
|
{
|
|
38
29
|
marketId: 0,
|
|
39
|
-
amount:
|
|
30
|
+
amount: 0,
|
|
40
31
|
direction: {
|
|
41
32
|
flop: {}
|
|
42
33
|
},
|
|
@@ -51,6 +42,14 @@ const updateStakeVault = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
51
42
|
});
|
|
52
43
|
console.log(response);
|
|
53
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
|
+
});
|
|
54
53
|
const updateBoost = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
54
|
const response = (yield axios_1.default.get('https://api.triadfi.co/boost'))
|
|
56
55
|
.data;
|
|
@@ -74,11 +73,11 @@ const getAllMarkets = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
74
73
|
const markets = yield triadProtocol.trade.getAllMarkets();
|
|
75
74
|
console.log(markets);
|
|
76
75
|
});
|
|
76
|
+
getAllMarkets();
|
|
77
77
|
const getMarket = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
78
|
const market = yield triadProtocol.trade.getMarketById(1);
|
|
79
79
|
console.log(market);
|
|
80
80
|
});
|
|
81
|
-
getMarket();
|
|
82
81
|
const initializeAllMarkets = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
83
82
|
for (const market of markets) {
|
|
84
83
|
try {
|
|
@@ -134,15 +133,16 @@ const runBot = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
134
133
|
}
|
|
135
134
|
});
|
|
136
135
|
const initializeQuestion = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
137
|
-
const currentTime = Math.floor(Date.now() / 1000)
|
|
136
|
+
const currentTime = Math.floor(Date.now() / 1000); // Current time in seconds
|
|
138
137
|
const response = yield triadProtocol.trade.initializeQuestion({
|
|
139
|
-
marketId:
|
|
140
|
-
question: '
|
|
138
|
+
marketId: 0,
|
|
139
|
+
question: 'Will Triad send the project to the Radar Hackathon?',
|
|
141
140
|
startTime: currentTime,
|
|
142
|
-
endTime:
|
|
141
|
+
endTime: 1728320400
|
|
143
142
|
});
|
|
144
143
|
console.log(response);
|
|
145
144
|
});
|
|
145
|
+
initializeQuestion();
|
|
146
146
|
const resolveQuestion = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
147
147
|
const response = yield triadProtocol.trade.resolveQuestion(0);
|
|
148
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,
|
package/dist/trade.d.ts
CHANGED
package/dist/trade.js
CHANGED
|
@@ -21,7 +21,7 @@ const sendVersionedTransaction_1 = __importDefault(require("./utils/sendVersione
|
|
|
21
21
|
const sendTransactionWithOptions_1 = __importDefault(require("./utils/sendTransactionWithOptions"));
|
|
22
22
|
class Trade {
|
|
23
23
|
constructor(program, provider) {
|
|
24
|
-
this.mint = constants_1.
|
|
24
|
+
this.mint = constants_1.TRD_MINT;
|
|
25
25
|
this.provider = provider;
|
|
26
26
|
this.program = program;
|
|
27
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"address": "
|
|
2
|
+
"address": "TRDwq3BN4mP3m9KsuNUWSN6QDff93VKGSwE95Jbr9Ss",
|
|
3
3
|
"metadata": {
|
|
4
4
|
"name": "triad_protocol",
|
|
5
5
|
"version": "0.1.4",
|
|
@@ -1089,6 +1089,51 @@
|
|
|
1089
1089
|
}
|
|
1090
1090
|
],
|
|
1091
1091
|
"args": []
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
"name": "withdraw_v1",
|
|
1095
|
+
"discriminator": [212, 118, 210, 5, 187, 1, 117, 222],
|
|
1096
|
+
"accounts": [
|
|
1097
|
+
{
|
|
1098
|
+
"name": "signer",
|
|
1099
|
+
"writable": true,
|
|
1100
|
+
"signer": true
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
"name": "ticker",
|
|
1104
|
+
"writable": true
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
"name": "vault",
|
|
1108
|
+
"writable": true
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
"name": "user_position",
|
|
1112
|
+
"writable": true
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
"name": "vault_token_account",
|
|
1116
|
+
"writable": true
|
|
1117
|
+
},
|
|
1118
|
+
{
|
|
1119
|
+
"name": "user_token_account",
|
|
1120
|
+
"writable": true
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
"name": "system_program",
|
|
1124
|
+
"address": "11111111111111111111111111111111"
|
|
1125
|
+
},
|
|
1126
|
+
{
|
|
1127
|
+
"name": "token_program",
|
|
1128
|
+
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
1129
|
+
}
|
|
1130
|
+
],
|
|
1131
|
+
"args": [
|
|
1132
|
+
{
|
|
1133
|
+
"name": "position_index",
|
|
1134
|
+
"type": "u8"
|
|
1135
|
+
}
|
|
1136
|
+
]
|
|
1092
1137
|
}
|
|
1093
1138
|
],
|
|
1094
1139
|
"accounts": [
|
|
@@ -1108,13 +1153,25 @@
|
|
|
1108
1153
|
"name": "StakeVault",
|
|
1109
1154
|
"discriminator": [192, 112, 65, 125, 129, 151, 173, 226]
|
|
1110
1155
|
},
|
|
1156
|
+
{
|
|
1157
|
+
"name": "Ticker",
|
|
1158
|
+
"discriminator": [214, 74, 184, 188, 214, 64, 251, 53]
|
|
1159
|
+
},
|
|
1111
1160
|
{
|
|
1112
1161
|
"name": "User",
|
|
1113
1162
|
"discriminator": [159, 117, 95, 227, 239, 151, 58, 236]
|
|
1114
1163
|
},
|
|
1164
|
+
{
|
|
1165
|
+
"name": "UserPosition",
|
|
1166
|
+
"discriminator": [251, 248, 209, 245, 83, 234, 17, 27]
|
|
1167
|
+
},
|
|
1115
1168
|
{
|
|
1116
1169
|
"name": "UserTrade",
|
|
1117
1170
|
"discriminator": [149, 190, 47, 218, 136, 9, 222, 222]
|
|
1171
|
+
},
|
|
1172
|
+
{
|
|
1173
|
+
"name": "Vault",
|
|
1174
|
+
"discriminator": [211, 8, 232, 43, 2, 152, 117, 119]
|
|
1118
1175
|
}
|
|
1119
1176
|
],
|
|
1120
1177
|
"events": [
|
|
@@ -1422,7 +1479,7 @@
|
|
|
1422
1479
|
{
|
|
1423
1480
|
"name": "padding",
|
|
1424
1481
|
"type": {
|
|
1425
|
-
"array": ["u8",
|
|
1482
|
+
"array": ["u8", 60]
|
|
1426
1483
|
}
|
|
1427
1484
|
}
|
|
1428
1485
|
]
|
|
@@ -1607,7 +1664,7 @@
|
|
|
1607
1664
|
{
|
|
1608
1665
|
"name": "padding",
|
|
1609
1666
|
"type": {
|
|
1610
|
-
"array": ["u8",
|
|
1667
|
+
"array": ["u8", 200]
|
|
1611
1668
|
}
|
|
1612
1669
|
}
|
|
1613
1670
|
]
|
|
@@ -1672,10 +1729,7 @@
|
|
|
1672
1729
|
},
|
|
1673
1730
|
{
|
|
1674
1731
|
"name": "price",
|
|
1675
|
-
"docs": [
|
|
1676
|
-
"The price of the order (in TRD)",
|
|
1677
|
-
"precision: PRICE_PRECISION (e.g., 1_000_000 = 1 TRD)"
|
|
1678
|
-
],
|
|
1732
|
+
"docs": ["The price of the order (in TRD)"],
|
|
1679
1733
|
"type": "u64"
|
|
1680
1734
|
},
|
|
1681
1735
|
{
|
|
@@ -1704,13 +1758,6 @@
|
|
|
1704
1758
|
}
|
|
1705
1759
|
}
|
|
1706
1760
|
},
|
|
1707
|
-
{
|
|
1708
|
-
"name": "pnl",
|
|
1709
|
-
"docs": [
|
|
1710
|
-
"The amount of pnl settled in this market since opening the position (in TRD)"
|
|
1711
|
-
],
|
|
1712
|
-
"type": "i64"
|
|
1713
|
-
},
|
|
1714
1761
|
{
|
|
1715
1762
|
"name": "padding",
|
|
1716
1763
|
"type": {
|
|
@@ -1853,6 +1900,38 @@
|
|
|
1853
1900
|
]
|
|
1854
1901
|
}
|
|
1855
1902
|
},
|
|
1903
|
+
{
|
|
1904
|
+
"name": "Position",
|
|
1905
|
+
"type": {
|
|
1906
|
+
"kind": "struct",
|
|
1907
|
+
"fields": [
|
|
1908
|
+
{
|
|
1909
|
+
"name": "amount",
|
|
1910
|
+
"type": "u64"
|
|
1911
|
+
},
|
|
1912
|
+
{
|
|
1913
|
+
"name": "entry_price",
|
|
1914
|
+
"type": "u64"
|
|
1915
|
+
},
|
|
1916
|
+
{
|
|
1917
|
+
"name": "ts",
|
|
1918
|
+
"type": "i64"
|
|
1919
|
+
},
|
|
1920
|
+
{
|
|
1921
|
+
"name": "is_long",
|
|
1922
|
+
"type": "bool"
|
|
1923
|
+
},
|
|
1924
|
+
{
|
|
1925
|
+
"name": "is_open",
|
|
1926
|
+
"type": "bool"
|
|
1927
|
+
},
|
|
1928
|
+
{
|
|
1929
|
+
"name": "pnl",
|
|
1930
|
+
"type": "i64"
|
|
1931
|
+
}
|
|
1932
|
+
]
|
|
1933
|
+
}
|
|
1934
|
+
},
|
|
1856
1935
|
{
|
|
1857
1936
|
"name": "PriceUpdate",
|
|
1858
1937
|
"type": {
|
|
@@ -2263,6 +2342,46 @@
|
|
|
2263
2342
|
]
|
|
2264
2343
|
}
|
|
2265
2344
|
},
|
|
2345
|
+
{
|
|
2346
|
+
"name": "Ticker",
|
|
2347
|
+
"type": {
|
|
2348
|
+
"kind": "struct",
|
|
2349
|
+
"fields": [
|
|
2350
|
+
{
|
|
2351
|
+
"name": "init_ts",
|
|
2352
|
+
"type": "i64"
|
|
2353
|
+
},
|
|
2354
|
+
{
|
|
2355
|
+
"name": "updated_ts",
|
|
2356
|
+
"type": "i64"
|
|
2357
|
+
},
|
|
2358
|
+
{
|
|
2359
|
+
"name": "bump",
|
|
2360
|
+
"type": "u8"
|
|
2361
|
+
},
|
|
2362
|
+
{
|
|
2363
|
+
"name": "authority",
|
|
2364
|
+
"type": "pubkey"
|
|
2365
|
+
},
|
|
2366
|
+
{
|
|
2367
|
+
"name": "name",
|
|
2368
|
+
"type": "string"
|
|
2369
|
+
},
|
|
2370
|
+
{
|
|
2371
|
+
"name": "protocol_program_id",
|
|
2372
|
+
"type": "pubkey"
|
|
2373
|
+
},
|
|
2374
|
+
{
|
|
2375
|
+
"name": "price",
|
|
2376
|
+
"type": "u64"
|
|
2377
|
+
},
|
|
2378
|
+
{
|
|
2379
|
+
"name": "vault",
|
|
2380
|
+
"type": "pubkey"
|
|
2381
|
+
}
|
|
2382
|
+
]
|
|
2383
|
+
}
|
|
2384
|
+
},
|
|
2266
2385
|
{
|
|
2267
2386
|
"name": "UpdateStakeVaultArgs",
|
|
2268
2387
|
"type": {
|
|
@@ -2339,6 +2458,59 @@
|
|
|
2339
2458
|
]
|
|
2340
2459
|
}
|
|
2341
2460
|
},
|
|
2461
|
+
{
|
|
2462
|
+
"name": "UserPosition",
|
|
2463
|
+
"type": {
|
|
2464
|
+
"kind": "struct",
|
|
2465
|
+
"fields": [
|
|
2466
|
+
{
|
|
2467
|
+
"name": "ts",
|
|
2468
|
+
"type": "i64"
|
|
2469
|
+
},
|
|
2470
|
+
{
|
|
2471
|
+
"name": "bump",
|
|
2472
|
+
"type": "u8"
|
|
2473
|
+
},
|
|
2474
|
+
{
|
|
2475
|
+
"name": "total_deposited",
|
|
2476
|
+
"type": "u64"
|
|
2477
|
+
},
|
|
2478
|
+
{
|
|
2479
|
+
"name": "total_withdrawn",
|
|
2480
|
+
"type": "u64"
|
|
2481
|
+
},
|
|
2482
|
+
{
|
|
2483
|
+
"name": "lp_share",
|
|
2484
|
+
"type": "u64"
|
|
2485
|
+
},
|
|
2486
|
+
{
|
|
2487
|
+
"name": "total_positions",
|
|
2488
|
+
"type": "u16"
|
|
2489
|
+
},
|
|
2490
|
+
{
|
|
2491
|
+
"name": "ticker",
|
|
2492
|
+
"type": "pubkey"
|
|
2493
|
+
},
|
|
2494
|
+
{
|
|
2495
|
+
"name": "authority",
|
|
2496
|
+
"type": "pubkey"
|
|
2497
|
+
},
|
|
2498
|
+
{
|
|
2499
|
+
"name": "positions",
|
|
2500
|
+
"type": {
|
|
2501
|
+
"array": [
|
|
2502
|
+
{
|
|
2503
|
+
"defined": {
|
|
2504
|
+
"name": "Position"
|
|
2505
|
+
}
|
|
2506
|
+
},
|
|
2507
|
+
3
|
|
2508
|
+
]
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
]
|
|
2512
|
+
}
|
|
2513
|
+
},
|
|
2342
2514
|
{
|
|
2343
2515
|
"name": "UserTrade",
|
|
2344
2516
|
"type": {
|
|
@@ -2395,6 +2567,70 @@
|
|
|
2395
2567
|
]
|
|
2396
2568
|
}
|
|
2397
2569
|
},
|
|
2570
|
+
{
|
|
2571
|
+
"name": "Vault",
|
|
2572
|
+
"type": {
|
|
2573
|
+
"kind": "struct",
|
|
2574
|
+
"fields": [
|
|
2575
|
+
{
|
|
2576
|
+
"name": "bump",
|
|
2577
|
+
"type": "u8"
|
|
2578
|
+
},
|
|
2579
|
+
{
|
|
2580
|
+
"name": "authority",
|
|
2581
|
+
"type": "pubkey"
|
|
2582
|
+
},
|
|
2583
|
+
{
|
|
2584
|
+
"name": "name",
|
|
2585
|
+
"type": "string"
|
|
2586
|
+
},
|
|
2587
|
+
{
|
|
2588
|
+
"name": "token_account",
|
|
2589
|
+
"type": "pubkey"
|
|
2590
|
+
},
|
|
2591
|
+
{
|
|
2592
|
+
"name": "ticker_address",
|
|
2593
|
+
"type": "pubkey"
|
|
2594
|
+
},
|
|
2595
|
+
{
|
|
2596
|
+
"name": "total_deposited",
|
|
2597
|
+
"type": "u64"
|
|
2598
|
+
},
|
|
2599
|
+
{
|
|
2600
|
+
"name": "total_withdrawn",
|
|
2601
|
+
"type": "u64"
|
|
2602
|
+
},
|
|
2603
|
+
{
|
|
2604
|
+
"name": "init_ts",
|
|
2605
|
+
"type": "i64"
|
|
2606
|
+
},
|
|
2607
|
+
{
|
|
2608
|
+
"name": "net_deposits",
|
|
2609
|
+
"type": "u128"
|
|
2610
|
+
},
|
|
2611
|
+
{
|
|
2612
|
+
"name": "net_withdraws",
|
|
2613
|
+
"type": "u128"
|
|
2614
|
+
},
|
|
2615
|
+
{
|
|
2616
|
+
"name": "long_balance",
|
|
2617
|
+
"type": "u64"
|
|
2618
|
+
},
|
|
2619
|
+
{
|
|
2620
|
+
"name": "short_balance",
|
|
2621
|
+
"type": "u64"
|
|
2622
|
+
},
|
|
2623
|
+
{
|
|
2624
|
+
"name": "long_positions_opened",
|
|
2625
|
+
"type": "u64"
|
|
2626
|
+
},
|
|
2627
|
+
{
|
|
2628
|
+
"name": "short_positions_opened",
|
|
2629
|
+
"type": "u64"
|
|
2630
|
+
}
|
|
2631
|
+
]
|
|
2632
|
+
}
|
|
2633
|
+
},
|
|
2398
2634
|
{
|
|
2399
2635
|
"name": "WinningDirection",
|
|
2400
2636
|
"type": {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* IDL can be found at `target/idl/triad_protocol.json`.
|
|
6
6
|
*/
|
|
7
7
|
export type TriadProtocol = {
|
|
8
|
-
address: '
|
|
8
|
+
address: 'TRDwq3BN4mP3m9KsuNUWSN6QDff93VKGSwE95Jbr9Ss';
|
|
9
9
|
metadata: {
|
|
10
10
|
name: 'triadProtocol';
|
|
11
11
|
version: '0.1.4';
|
|
@@ -1530,6 +1530,51 @@ export type TriadProtocol = {
|
|
|
1530
1530
|
}
|
|
1531
1531
|
];
|
|
1532
1532
|
args: [];
|
|
1533
|
+
},
|
|
1534
|
+
{
|
|
1535
|
+
name: 'withdrawV1';
|
|
1536
|
+
discriminator: [212, 118, 210, 5, 187, 1, 117, 222];
|
|
1537
|
+
accounts: [
|
|
1538
|
+
{
|
|
1539
|
+
name: 'signer';
|
|
1540
|
+
writable: true;
|
|
1541
|
+
signer: true;
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
name: 'ticker';
|
|
1545
|
+
writable: true;
|
|
1546
|
+
},
|
|
1547
|
+
{
|
|
1548
|
+
name: 'vault';
|
|
1549
|
+
writable: true;
|
|
1550
|
+
},
|
|
1551
|
+
{
|
|
1552
|
+
name: 'userPosition';
|
|
1553
|
+
writable: true;
|
|
1554
|
+
},
|
|
1555
|
+
{
|
|
1556
|
+
name: 'vaultTokenAccount';
|
|
1557
|
+
writable: true;
|
|
1558
|
+
},
|
|
1559
|
+
{
|
|
1560
|
+
name: 'userTokenAccount';
|
|
1561
|
+
writable: true;
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
name: 'systemProgram';
|
|
1565
|
+
address: '11111111111111111111111111111111';
|
|
1566
|
+
},
|
|
1567
|
+
{
|
|
1568
|
+
name: 'tokenProgram';
|
|
1569
|
+
address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
1570
|
+
}
|
|
1571
|
+
];
|
|
1572
|
+
args: [
|
|
1573
|
+
{
|
|
1574
|
+
name: 'positionIndex';
|
|
1575
|
+
type: 'u8';
|
|
1576
|
+
}
|
|
1577
|
+
];
|
|
1533
1578
|
}
|
|
1534
1579
|
];
|
|
1535
1580
|
accounts: [
|
|
@@ -1549,13 +1594,25 @@ export type TriadProtocol = {
|
|
|
1549
1594
|
name: 'stakeVault';
|
|
1550
1595
|
discriminator: [192, 112, 65, 125, 129, 151, 173, 226];
|
|
1551
1596
|
},
|
|
1597
|
+
{
|
|
1598
|
+
name: 'ticker';
|
|
1599
|
+
discriminator: [214, 74, 184, 188, 214, 64, 251, 53];
|
|
1600
|
+
},
|
|
1552
1601
|
{
|
|
1553
1602
|
name: 'user';
|
|
1554
1603
|
discriminator: [159, 117, 95, 227, 239, 151, 58, 236];
|
|
1555
1604
|
},
|
|
1605
|
+
{
|
|
1606
|
+
name: 'userPosition';
|
|
1607
|
+
discriminator: [251, 248, 209, 245, 83, 234, 17, 27];
|
|
1608
|
+
},
|
|
1556
1609
|
{
|
|
1557
1610
|
name: 'userTrade';
|
|
1558
1611
|
discriminator: [149, 190, 47, 218, 136, 9, 222, 222];
|
|
1612
|
+
},
|
|
1613
|
+
{
|
|
1614
|
+
name: 'vault';
|
|
1615
|
+
discriminator: [211, 8, 232, 43, 2, 152, 117, 119];
|
|
1559
1616
|
}
|
|
1560
1617
|
];
|
|
1561
1618
|
events: [
|
|
@@ -1863,7 +1920,7 @@ export type TriadProtocol = {
|
|
|
1863
1920
|
{
|
|
1864
1921
|
name: 'padding';
|
|
1865
1922
|
type: {
|
|
1866
|
-
array: ['u8',
|
|
1923
|
+
array: ['u8', 60];
|
|
1867
1924
|
};
|
|
1868
1925
|
}
|
|
1869
1926
|
];
|
|
@@ -2046,7 +2103,7 @@ export type TriadProtocol = {
|
|
|
2046
2103
|
{
|
|
2047
2104
|
name: 'padding';
|
|
2048
2105
|
type: {
|
|
2049
|
-
array: ['u8',
|
|
2106
|
+
array: ['u8', 200];
|
|
2050
2107
|
};
|
|
2051
2108
|
}
|
|
2052
2109
|
];
|
|
@@ -2111,10 +2168,7 @@ export type TriadProtocol = {
|
|
|
2111
2168
|
},
|
|
2112
2169
|
{
|
|
2113
2170
|
name: 'price';
|
|
2114
|
-
docs: [
|
|
2115
|
-
'The price of the order (in TRD)',
|
|
2116
|
-
'precision: PRICE_PRECISION (e.g., 1_000_000 = 1 TRD)'
|
|
2117
|
-
];
|
|
2171
|
+
docs: ['The price of the order (in TRD)'];
|
|
2118
2172
|
type: 'u64';
|
|
2119
2173
|
},
|
|
2120
2174
|
{
|
|
@@ -2143,13 +2197,6 @@ export type TriadProtocol = {
|
|
|
2143
2197
|
};
|
|
2144
2198
|
};
|
|
2145
2199
|
},
|
|
2146
|
-
{
|
|
2147
|
-
name: 'pnl';
|
|
2148
|
-
docs: [
|
|
2149
|
-
'The amount of pnl settled in this market since opening the position (in TRD)'
|
|
2150
|
-
];
|
|
2151
|
-
type: 'i64';
|
|
2152
|
-
},
|
|
2153
2200
|
{
|
|
2154
2201
|
name: 'padding';
|
|
2155
2202
|
type: {
|
|
@@ -2292,6 +2339,38 @@ export type TriadProtocol = {
|
|
|
2292
2339
|
];
|
|
2293
2340
|
};
|
|
2294
2341
|
},
|
|
2342
|
+
{
|
|
2343
|
+
name: 'position';
|
|
2344
|
+
type: {
|
|
2345
|
+
kind: 'struct';
|
|
2346
|
+
fields: [
|
|
2347
|
+
{
|
|
2348
|
+
name: 'amount';
|
|
2349
|
+
type: 'u64';
|
|
2350
|
+
},
|
|
2351
|
+
{
|
|
2352
|
+
name: 'entryPrice';
|
|
2353
|
+
type: 'u64';
|
|
2354
|
+
},
|
|
2355
|
+
{
|
|
2356
|
+
name: 'ts';
|
|
2357
|
+
type: 'i64';
|
|
2358
|
+
},
|
|
2359
|
+
{
|
|
2360
|
+
name: 'isLong';
|
|
2361
|
+
type: 'bool';
|
|
2362
|
+
},
|
|
2363
|
+
{
|
|
2364
|
+
name: 'isOpen';
|
|
2365
|
+
type: 'bool';
|
|
2366
|
+
},
|
|
2367
|
+
{
|
|
2368
|
+
name: 'pnl';
|
|
2369
|
+
type: 'i64';
|
|
2370
|
+
}
|
|
2371
|
+
];
|
|
2372
|
+
};
|
|
2373
|
+
},
|
|
2295
2374
|
{
|
|
2296
2375
|
name: 'priceUpdate';
|
|
2297
2376
|
type: {
|
|
@@ -2702,6 +2781,46 @@ export type TriadProtocol = {
|
|
|
2702
2781
|
];
|
|
2703
2782
|
};
|
|
2704
2783
|
},
|
|
2784
|
+
{
|
|
2785
|
+
name: 'ticker';
|
|
2786
|
+
type: {
|
|
2787
|
+
kind: 'struct';
|
|
2788
|
+
fields: [
|
|
2789
|
+
{
|
|
2790
|
+
name: 'initTs';
|
|
2791
|
+
type: 'i64';
|
|
2792
|
+
},
|
|
2793
|
+
{
|
|
2794
|
+
name: 'updatedTs';
|
|
2795
|
+
type: 'i64';
|
|
2796
|
+
},
|
|
2797
|
+
{
|
|
2798
|
+
name: 'bump';
|
|
2799
|
+
type: 'u8';
|
|
2800
|
+
},
|
|
2801
|
+
{
|
|
2802
|
+
name: 'authority';
|
|
2803
|
+
type: 'pubkey';
|
|
2804
|
+
},
|
|
2805
|
+
{
|
|
2806
|
+
name: 'name';
|
|
2807
|
+
type: 'string';
|
|
2808
|
+
},
|
|
2809
|
+
{
|
|
2810
|
+
name: 'protocolProgramId';
|
|
2811
|
+
type: 'pubkey';
|
|
2812
|
+
},
|
|
2813
|
+
{
|
|
2814
|
+
name: 'price';
|
|
2815
|
+
type: 'u64';
|
|
2816
|
+
},
|
|
2817
|
+
{
|
|
2818
|
+
name: 'vault';
|
|
2819
|
+
type: 'pubkey';
|
|
2820
|
+
}
|
|
2821
|
+
];
|
|
2822
|
+
};
|
|
2823
|
+
},
|
|
2705
2824
|
{
|
|
2706
2825
|
name: 'updateStakeVaultArgs';
|
|
2707
2826
|
type: {
|
|
@@ -2778,6 +2897,59 @@ export type TriadProtocol = {
|
|
|
2778
2897
|
];
|
|
2779
2898
|
};
|
|
2780
2899
|
},
|
|
2900
|
+
{
|
|
2901
|
+
name: 'userPosition';
|
|
2902
|
+
type: {
|
|
2903
|
+
kind: 'struct';
|
|
2904
|
+
fields: [
|
|
2905
|
+
{
|
|
2906
|
+
name: 'ts';
|
|
2907
|
+
type: 'i64';
|
|
2908
|
+
},
|
|
2909
|
+
{
|
|
2910
|
+
name: 'bump';
|
|
2911
|
+
type: 'u8';
|
|
2912
|
+
},
|
|
2913
|
+
{
|
|
2914
|
+
name: 'totalDeposited';
|
|
2915
|
+
type: 'u64';
|
|
2916
|
+
},
|
|
2917
|
+
{
|
|
2918
|
+
name: 'totalWithdrawn';
|
|
2919
|
+
type: 'u64';
|
|
2920
|
+
},
|
|
2921
|
+
{
|
|
2922
|
+
name: 'lpShare';
|
|
2923
|
+
type: 'u64';
|
|
2924
|
+
},
|
|
2925
|
+
{
|
|
2926
|
+
name: 'totalPositions';
|
|
2927
|
+
type: 'u16';
|
|
2928
|
+
},
|
|
2929
|
+
{
|
|
2930
|
+
name: 'ticker';
|
|
2931
|
+
type: 'pubkey';
|
|
2932
|
+
},
|
|
2933
|
+
{
|
|
2934
|
+
name: 'authority';
|
|
2935
|
+
type: 'pubkey';
|
|
2936
|
+
},
|
|
2937
|
+
{
|
|
2938
|
+
name: 'positions';
|
|
2939
|
+
type: {
|
|
2940
|
+
array: [
|
|
2941
|
+
{
|
|
2942
|
+
defined: {
|
|
2943
|
+
name: 'position';
|
|
2944
|
+
};
|
|
2945
|
+
},
|
|
2946
|
+
3
|
|
2947
|
+
];
|
|
2948
|
+
};
|
|
2949
|
+
}
|
|
2950
|
+
];
|
|
2951
|
+
};
|
|
2952
|
+
},
|
|
2781
2953
|
{
|
|
2782
2954
|
name: 'userTrade';
|
|
2783
2955
|
type: {
|
|
@@ -2834,6 +3006,70 @@ export type TriadProtocol = {
|
|
|
2834
3006
|
];
|
|
2835
3007
|
};
|
|
2836
3008
|
},
|
|
3009
|
+
{
|
|
3010
|
+
name: 'vault';
|
|
3011
|
+
type: {
|
|
3012
|
+
kind: 'struct';
|
|
3013
|
+
fields: [
|
|
3014
|
+
{
|
|
3015
|
+
name: 'bump';
|
|
3016
|
+
type: 'u8';
|
|
3017
|
+
},
|
|
3018
|
+
{
|
|
3019
|
+
name: 'authority';
|
|
3020
|
+
type: 'pubkey';
|
|
3021
|
+
},
|
|
3022
|
+
{
|
|
3023
|
+
name: 'name';
|
|
3024
|
+
type: 'string';
|
|
3025
|
+
},
|
|
3026
|
+
{
|
|
3027
|
+
name: 'tokenAccount';
|
|
3028
|
+
type: 'pubkey';
|
|
3029
|
+
},
|
|
3030
|
+
{
|
|
3031
|
+
name: 'tickerAddress';
|
|
3032
|
+
type: 'pubkey';
|
|
3033
|
+
},
|
|
3034
|
+
{
|
|
3035
|
+
name: 'totalDeposited';
|
|
3036
|
+
type: 'u64';
|
|
3037
|
+
},
|
|
3038
|
+
{
|
|
3039
|
+
name: 'totalWithdrawn';
|
|
3040
|
+
type: 'u64';
|
|
3041
|
+
},
|
|
3042
|
+
{
|
|
3043
|
+
name: 'initTs';
|
|
3044
|
+
type: 'i64';
|
|
3045
|
+
},
|
|
3046
|
+
{
|
|
3047
|
+
name: 'netDeposits';
|
|
3048
|
+
type: 'u128';
|
|
3049
|
+
},
|
|
3050
|
+
{
|
|
3051
|
+
name: 'netWithdraws';
|
|
3052
|
+
type: 'u128';
|
|
3053
|
+
},
|
|
3054
|
+
{
|
|
3055
|
+
name: 'longBalance';
|
|
3056
|
+
type: 'u64';
|
|
3057
|
+
},
|
|
3058
|
+
{
|
|
3059
|
+
name: 'shortBalance';
|
|
3060
|
+
type: 'u64';
|
|
3061
|
+
},
|
|
3062
|
+
{
|
|
3063
|
+
name: 'longPositionsOpened';
|
|
3064
|
+
type: 'u64';
|
|
3065
|
+
},
|
|
3066
|
+
{
|
|
3067
|
+
name: 'shortPositionsOpened';
|
|
3068
|
+
type: 'u64';
|
|
3069
|
+
}
|
|
3070
|
+
];
|
|
3071
|
+
};
|
|
3072
|
+
},
|
|
2837
3073
|
{
|
|
2838
3074
|
name: 'winningDirection';
|
|
2839
3075
|
type: {
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.TRIAD_ADMIN = exports.TRD_MINT = exports.VERIFIER = exports.TRD_DECIMALS = exports.STAKE_VAULT_NAME = void 0;
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
5
|
exports.STAKE_VAULT_NAME = 'Triad Share 1';
|
|
6
6
|
exports.TRD_DECIMALS = 6;
|
|
7
7
|
exports.VERIFIER = new web3_js_1.PublicKey('42n6BHufivUKrb5Bi6tXbMZvM8NHovrDLX1Rt5w2a919');
|
|
8
8
|
exports.TRD_MINT = new web3_js_1.PublicKey('t3DohmswhKk94PPbPYwA6ZKACyY3y5kbcqeQerAJjmV');
|
|
9
9
|
exports.TRIAD_ADMIN = new web3_js_1.PublicKey('82ppCojm3yrEKgdpH8B5AmBJTU1r1uAWXFWhxvPs9UCR');
|
|
10
|
-
exports.TRD_MINT_DEVNET = new web3_js_1.PublicKey('9ti9L1a4ynpTj4gbGQLkYmZh7495nvLEgWtw5mtUkGQj');
|