@triadxyz/triad-protocol 0.7.4-beta.devnet → 0.7.6-beta.devnet
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.d.ts +7 -1
- package/dist/index.js +9 -11
- package/dist/local-test.js +28 -106
- package/dist/stake.d.ts +4 -4
- package/dist/stake.js +12 -68
- package/dist/trade.d.ts +66 -17
- package/dist/trade.js +101 -47
- package/dist/types/idl_triad_protocol.json +195 -35
- package/dist/types/trade.d.ts +12 -0
- package/dist/types/triad_protocol.d.ts +195 -35
- package/dist/utils/sendTransactionWithOptions.d.ts +3 -0
- package/dist/utils/sendTransactionWithOptions.js +14 -0
- package/dist/utils/sendVersionedTransaction.d.ts +5 -0
- package/dist/utils/sendVersionedTransaction.js +29 -0
- package/package.json +1 -1
package/dist/trade.js
CHANGED
|
@@ -12,12 +12,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
16
15
|
const bn_js_1 = __importDefault(require("bn.js"));
|
|
17
16
|
const constants_1 = require("./utils/constants");
|
|
18
17
|
const helpers_1 = require("./utils/helpers");
|
|
19
18
|
const trade_1 = require("./utils/pda/trade");
|
|
20
19
|
const pda_1 = require("./utils/pda");
|
|
20
|
+
const sendVersionedTransaction_1 = __importDefault(require("./utils/sendVersionedTransaction"));
|
|
21
|
+
const sendTransactionWithOptions_1 = __importDefault(require("./utils/sendTransactionWithOptions"));
|
|
21
22
|
class Trade {
|
|
22
23
|
constructor(program, provider) {
|
|
23
24
|
this.mint = constants_1.TRD_MINT_DEVNET;
|
|
@@ -27,30 +28,58 @@ class Trade {
|
|
|
27
28
|
/**
|
|
28
29
|
* Get all Markets
|
|
29
30
|
*/
|
|
30
|
-
|
|
31
|
+
getAllMarkets() {
|
|
31
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
33
|
return this.program.account.market
|
|
33
34
|
.all()
|
|
34
35
|
.then((markets) => markets.map(({ account, publicKey }) => (0, helpers_1.accountToMarket)(account, publicKey)));
|
|
35
36
|
});
|
|
36
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Get Market by ID
|
|
40
|
+
* @param marketId - The ID of the market
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
getMarketById(marketId) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const marketPDA = (0, trade_1.getMarketPDA)(this.program.programId, marketId);
|
|
46
|
+
const response = yield this.program.account.market.fetch(marketPDA);
|
|
47
|
+
return (0, helpers_1.accountToMarket)(response, marketPDA);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get Market by Address
|
|
52
|
+
* @param address - The address of the market
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
37
55
|
getMarketByAddress(address) {
|
|
38
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
57
|
const account = yield this.program.account.market.fetch(address);
|
|
40
58
|
return (0, helpers_1.accountToMarket)(account, address);
|
|
41
59
|
});
|
|
42
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Get User Trade
|
|
63
|
+
* @param user - The user's public key
|
|
64
|
+
*
|
|
65
|
+
*/
|
|
66
|
+
getUserTrade(user) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, user);
|
|
69
|
+
return this.program.account.userTrade.fetch(userTradePDA);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
43
72
|
/**
|
|
44
73
|
* Initialize Market
|
|
45
74
|
* @param market id - new markert id - length + 1
|
|
46
75
|
* @param name - PYTH/TRD JUP/TRD DRIFT/TRD
|
|
47
76
|
*
|
|
77
|
+
* @param options - RPC options
|
|
78
|
+
*
|
|
48
79
|
*/
|
|
49
80
|
initializeMarket({ marketId, name }, options) {
|
|
50
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
|
|
52
|
-
const feeVaultPDA = (0, trade_1.getFeeVaultPDA)(this.program.programId, marketId);
|
|
53
|
-
const method = this.program.methods
|
|
82
|
+
return (0, sendTransactionWithOptions_1.default)(this.program.methods
|
|
54
83
|
.initializeMarket({
|
|
55
84
|
marketId: new bn_js_1.default(marketId),
|
|
56
85
|
name: name
|
|
@@ -58,24 +87,20 @@ class Trade {
|
|
|
58
87
|
.accounts({
|
|
59
88
|
signer: this.provider.publicKey,
|
|
60
89
|
mint: this.mint
|
|
61
|
-
});
|
|
62
|
-
if (options === null || options === void 0 ? void 0 : options.microLamports) {
|
|
63
|
-
method.postInstructions([
|
|
64
|
-
web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
|
|
65
|
-
microLamports: options.microLamports
|
|
66
|
-
})
|
|
67
|
-
]);
|
|
68
|
-
}
|
|
69
|
-
return method.rpc({ skipPreflight: options === null || options === void 0 ? void 0 : options.skipPreflight });
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
getUserTrade() {
|
|
73
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
const userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, this.provider.publicKey);
|
|
75
|
-
return this.program.account.userTrade.fetch(userTradePDA);
|
|
90
|
+
}), options);
|
|
76
91
|
});
|
|
77
92
|
}
|
|
78
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Open Order
|
|
95
|
+
* @param marketId - The ID of the market
|
|
96
|
+
* @param amount - The amount of the order
|
|
97
|
+
* @param direction - The direction of the order
|
|
98
|
+
* @param comment - The comment of the order
|
|
99
|
+
*
|
|
100
|
+
* @param options - RPC options
|
|
101
|
+
*
|
|
102
|
+
*/
|
|
103
|
+
openOrder({ marketId, amount, direction, comment }, options) {
|
|
79
104
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
105
|
const marketPDA = (0, trade_1.getMarketPDA)(this.program.programId, marketId);
|
|
81
106
|
const feeVualtPDA = (0, trade_1.getFeeVaultPDA)(this.program.programId, marketId);
|
|
@@ -97,9 +122,9 @@ class Trade {
|
|
|
97
122
|
}
|
|
98
123
|
ixs.push(yield this.program.methods
|
|
99
124
|
.openOrder({
|
|
100
|
-
amount: new bn_js_1.default(
|
|
101
|
-
direction:
|
|
102
|
-
comment: (0, helpers_1.encodeString)(
|
|
125
|
+
amount: new bn_js_1.default(amount * Math.pow(10, constants_1.TRD_DECIMALS)),
|
|
126
|
+
direction: direction,
|
|
127
|
+
comment: (0, helpers_1.encodeString)(comment, 64)
|
|
103
128
|
})
|
|
104
129
|
.accounts({
|
|
105
130
|
signer: this.provider.publicKey,
|
|
@@ -110,40 +135,69 @@ class Trade {
|
|
|
110
135
|
userFromAta: userFromATA
|
|
111
136
|
})
|
|
112
137
|
.instruction());
|
|
113
|
-
|
|
114
|
-
ixs.push(web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
|
|
115
|
-
microLamports: options.microLamports
|
|
116
|
-
}));
|
|
117
|
-
}
|
|
118
|
-
const { blockhash } = yield this.provider.connection.getLatestBlockhash();
|
|
119
|
-
return this.provider.sendAndConfirm(new web3_js_1.VersionedTransaction(new web3_js_1.TransactionMessage({
|
|
120
|
-
instructions: ixs,
|
|
121
|
-
recentBlockhash: blockhash,
|
|
122
|
-
payerKey: this.provider.publicKey
|
|
123
|
-
}).compileToV0Message()), [], {
|
|
124
|
-
skipPreflight: options === null || options === void 0 ? void 0 : options.skipPreflight,
|
|
125
|
-
commitment: 'confirmed'
|
|
126
|
-
});
|
|
138
|
+
return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options);
|
|
127
139
|
});
|
|
128
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Close Order
|
|
143
|
+
* @param marketId - The ID of the market
|
|
144
|
+
* @param orderId - The ID of the order
|
|
145
|
+
*
|
|
146
|
+
* @param options - RPC options
|
|
147
|
+
*
|
|
148
|
+
*/
|
|
129
149
|
closeOrder({ marketId, orderId }, options) {
|
|
130
150
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
151
|
const marketPDA = (0, trade_1.getMarketPDA)(this.program.programId, marketId);
|
|
132
152
|
const userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, this.provider.publicKey);
|
|
133
|
-
|
|
153
|
+
return (0, sendTransactionWithOptions_1.default)(this.program.methods.closeOrder(new bn_js_1.default(orderId)).accounts({
|
|
134
154
|
signer: this.provider.publicKey,
|
|
135
155
|
market: marketPDA,
|
|
136
156
|
mint: this.mint,
|
|
137
157
|
userTrade: userTradePDA
|
|
158
|
+
}), options);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Initialize a new question for a market
|
|
163
|
+
* @param marketId - The ID of the market
|
|
164
|
+
* @param question - The question to initialize
|
|
165
|
+
* @param startTime - The start time of the question
|
|
166
|
+
* @param endTime - The end time of the question
|
|
167
|
+
*
|
|
168
|
+
* @param options - RPC options
|
|
169
|
+
*
|
|
170
|
+
*/
|
|
171
|
+
initializeQuestion({ marketId, question, startTime, endTime }, options) {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
const marketPDA = (0, trade_1.getMarketPDA)(this.program.programId, marketId);
|
|
174
|
+
return (0, sendTransactionWithOptions_1.default)(this.program.methods
|
|
175
|
+
.initializeQuestion({
|
|
176
|
+
question: (0, helpers_1.encodeString)(question, 80),
|
|
177
|
+
startTime: new bn_js_1.default(startTime),
|
|
178
|
+
endTime: new bn_js_1.default(endTime)
|
|
179
|
+
})
|
|
180
|
+
.accounts({
|
|
181
|
+
signer: this.provider.publicKey,
|
|
182
|
+
market: marketPDA
|
|
183
|
+
}), options);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Resolve the current question for a market
|
|
188
|
+
* @param marketId - The ID of the market
|
|
189
|
+
*
|
|
190
|
+
* @param options - RPC options
|
|
191
|
+
*
|
|
192
|
+
*/
|
|
193
|
+
resolveQuestion(marketId, options) {
|
|
194
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
const marketPDA = (0, trade_1.getMarketPDA)(this.program.programId, marketId);
|
|
196
|
+
const method = this.program.methods.resolveQuestion().accounts({
|
|
197
|
+
signer: this.provider.publicKey,
|
|
198
|
+
market: marketPDA
|
|
138
199
|
});
|
|
139
|
-
|
|
140
|
-
method.postInstructions([
|
|
141
|
-
web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
|
|
142
|
-
microLamports: options.microLamports
|
|
143
|
-
})
|
|
144
|
-
]);
|
|
145
|
-
}
|
|
146
|
-
return method.rpc({ skipPreflight: options === null || options === void 0 ? void 0 : options.skipPreflight });
|
|
200
|
+
return (0, sendTransactionWithOptions_1.default)(method, options);
|
|
147
201
|
});
|
|
148
202
|
}
|
|
149
203
|
}
|
|
@@ -405,6 +405,35 @@
|
|
|
405
405
|
}
|
|
406
406
|
]
|
|
407
407
|
},
|
|
408
|
+
{
|
|
409
|
+
"name": "initialize_question",
|
|
410
|
+
"discriminator": [245, 151, 106, 188, 88, 44, 65, 212],
|
|
411
|
+
"accounts": [
|
|
412
|
+
{
|
|
413
|
+
"name": "signer",
|
|
414
|
+
"writable": true,
|
|
415
|
+
"signer": true
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
"name": "market",
|
|
419
|
+
"writable": true
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"name": "system_program",
|
|
423
|
+
"address": "11111111111111111111111111111111"
|
|
424
|
+
}
|
|
425
|
+
],
|
|
426
|
+
"args": [
|
|
427
|
+
{
|
|
428
|
+
"name": "args",
|
|
429
|
+
"type": {
|
|
430
|
+
"defined": {
|
|
431
|
+
"name": "InitializeQuestionArgs"
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
]
|
|
436
|
+
},
|
|
408
437
|
{
|
|
409
438
|
"name": "open_order",
|
|
410
439
|
"discriminator": [206, 88, 88, 143, 38, 136, 50, 224],
|
|
@@ -550,6 +579,26 @@
|
|
|
550
579
|
],
|
|
551
580
|
"args": []
|
|
552
581
|
},
|
|
582
|
+
{
|
|
583
|
+
"name": "resolve_question",
|
|
584
|
+
"discriminator": [52, 32, 224, 179, 180, 8, 0, 246],
|
|
585
|
+
"accounts": [
|
|
586
|
+
{
|
|
587
|
+
"name": "signer",
|
|
588
|
+
"writable": true,
|
|
589
|
+
"signer": true
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
"name": "market",
|
|
593
|
+
"writable": true
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
"name": "system_program",
|
|
597
|
+
"address": "11111111111111111111111111111111"
|
|
598
|
+
}
|
|
599
|
+
],
|
|
600
|
+
"args": []
|
|
601
|
+
},
|
|
553
602
|
{
|
|
554
603
|
"name": "stake_nft",
|
|
555
604
|
"discriminator": [38, 27, 66, 46, 69, 65, 151, 219],
|
|
@@ -1080,6 +1129,10 @@
|
|
|
1080
1129
|
{
|
|
1081
1130
|
"name": "QuestionUpdate",
|
|
1082
1131
|
"discriminator": [110, 108, 240, 86, 176, 226, 54, 113]
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
"name": "StakeRewards",
|
|
1135
|
+
"discriminator": [236, 217, 227, 239, 6, 129, 188, 218]
|
|
1083
1136
|
}
|
|
1084
1137
|
],
|
|
1085
1138
|
"errors": [
|
|
@@ -1155,108 +1208,133 @@
|
|
|
1155
1208
|
},
|
|
1156
1209
|
{
|
|
1157
1210
|
"code": 6014,
|
|
1158
|
-
"name": "StakeVaultLocked",
|
|
1159
|
-
"msg": "Stake vault locked"
|
|
1160
|
-
},
|
|
1161
|
-
{
|
|
1162
|
-
"code": 6015,
|
|
1163
1211
|
"name": "StakeLocked",
|
|
1164
1212
|
"msg": "Stake is locked"
|
|
1165
1213
|
},
|
|
1166
1214
|
{
|
|
1167
|
-
"code":
|
|
1215
|
+
"code": 6015,
|
|
1168
1216
|
"name": "StakeVaultFull",
|
|
1169
1217
|
"msg": "Stake vault full"
|
|
1170
1218
|
},
|
|
1171
1219
|
{
|
|
1172
|
-
"code":
|
|
1220
|
+
"code": 6016,
|
|
1173
1221
|
"name": "InvalidMint",
|
|
1174
1222
|
"msg": "Invalid mint"
|
|
1175
1223
|
},
|
|
1176
1224
|
{
|
|
1177
|
-
"code":
|
|
1225
|
+
"code": 6017,
|
|
1178
1226
|
"name": "InvalidStakeVaultWeek",
|
|
1179
1227
|
"msg": "Invalid stake vault week"
|
|
1180
1228
|
},
|
|
1181
1229
|
{
|
|
1182
|
-
"code":
|
|
1230
|
+
"code": 6018,
|
|
1183
1231
|
"name": "RewardsAlreadyClaimed",
|
|
1184
1232
|
"msg": "Rewards already claimed"
|
|
1185
1233
|
},
|
|
1186
1234
|
{
|
|
1187
|
-
"code":
|
|
1235
|
+
"code": 6019,
|
|
1188
1236
|
"name": "StakeOverflow",
|
|
1189
1237
|
"msg": "Stake overflow"
|
|
1190
1238
|
},
|
|
1191
1239
|
{
|
|
1192
|
-
"code":
|
|
1240
|
+
"code": 6020,
|
|
1193
1241
|
"name": "SwapsReachedLimit",
|
|
1194
1242
|
"msg": "Swaps reached limit"
|
|
1195
1243
|
},
|
|
1196
1244
|
{
|
|
1197
|
-
"code":
|
|
1245
|
+
"code": 6021,
|
|
1198
1246
|
"name": "InsufficientFunds",
|
|
1199
1247
|
"msg": "Insufficient funds"
|
|
1200
1248
|
},
|
|
1201
1249
|
{
|
|
1202
|
-
"code":
|
|
1250
|
+
"code": 6022,
|
|
1203
1251
|
"name": "NoRewardsAvailable",
|
|
1204
1252
|
"msg": "No rewards available"
|
|
1205
1253
|
},
|
|
1206
1254
|
{
|
|
1207
|
-
"code":
|
|
1255
|
+
"code": 6023,
|
|
1208
1256
|
"name": "InvalidPrice",
|
|
1209
1257
|
"msg": "Invalid price"
|
|
1210
1258
|
},
|
|
1211
1259
|
{
|
|
1212
|
-
"code":
|
|
1260
|
+
"code": 6024,
|
|
1213
1261
|
"name": "InvalidOrderSize",
|
|
1214
1262
|
"msg": "Invalid order size"
|
|
1215
1263
|
},
|
|
1216
1264
|
{
|
|
1217
|
-
"code":
|
|
1265
|
+
"code": 6025,
|
|
1218
1266
|
"name": "MaxOpenOrdersReached",
|
|
1219
1267
|
"msg": "Maximum number of open orders reached"
|
|
1220
1268
|
},
|
|
1221
1269
|
{
|
|
1222
|
-
"code":
|
|
1270
|
+
"code": 6026,
|
|
1223
1271
|
"name": "NoAvailableOrderSlot",
|
|
1224
1272
|
"msg": "No available order slot"
|
|
1225
1273
|
},
|
|
1226
1274
|
{
|
|
1227
|
-
"code":
|
|
1275
|
+
"code": 6027,
|
|
1228
1276
|
"name": "MarketInactive",
|
|
1229
1277
|
"msg": "Market is inactive"
|
|
1230
1278
|
},
|
|
1231
1279
|
{
|
|
1232
|
-
"code":
|
|
1280
|
+
"code": 6028,
|
|
1233
1281
|
"name": "InvalidOrderType",
|
|
1234
1282
|
"msg": "Invalid order type"
|
|
1235
1283
|
},
|
|
1236
1284
|
{
|
|
1237
|
-
"code":
|
|
1285
|
+
"code": 6029,
|
|
1238
1286
|
"name": "InvalidOrderDirection",
|
|
1239
1287
|
"msg": "Invalid order direction"
|
|
1240
1288
|
},
|
|
1241
1289
|
{
|
|
1242
|
-
"code":
|
|
1290
|
+
"code": 6030,
|
|
1243
1291
|
"name": "OrderNotFound",
|
|
1244
1292
|
"msg": "Order not found"
|
|
1245
1293
|
},
|
|
1246
1294
|
{
|
|
1247
|
-
"code":
|
|
1295
|
+
"code": 6031,
|
|
1248
1296
|
"name": "InvalidOrderStatus",
|
|
1249
1297
|
"msg": "Invalid order status"
|
|
1250
1298
|
},
|
|
1251
1299
|
{
|
|
1252
|
-
"code":
|
|
1300
|
+
"code": 6032,
|
|
1253
1301
|
"name": "ArithmeticOverflow",
|
|
1254
1302
|
"msg": "Arithmetic overflow"
|
|
1255
1303
|
},
|
|
1256
1304
|
{
|
|
1257
|
-
"code":
|
|
1305
|
+
"code": 6033,
|
|
1258
1306
|
"name": "OrderSizeTooLarge",
|
|
1259
1307
|
"msg": "Order size too large"
|
|
1308
|
+
},
|
|
1309
|
+
{
|
|
1310
|
+
"code": 6034,
|
|
1311
|
+
"name": "QuestionPeriodNotEnded",
|
|
1312
|
+
"msg": "Question period not ended"
|
|
1313
|
+
},
|
|
1314
|
+
{
|
|
1315
|
+
"code": 6035,
|
|
1316
|
+
"name": "InvalidStartTime",
|
|
1317
|
+
"msg": "Invalid start time"
|
|
1318
|
+
},
|
|
1319
|
+
{
|
|
1320
|
+
"code": 6036,
|
|
1321
|
+
"name": "InvalidEndTime",
|
|
1322
|
+
"msg": "Invalid end time"
|
|
1323
|
+
},
|
|
1324
|
+
{
|
|
1325
|
+
"code": 6037,
|
|
1326
|
+
"name": "QuestionPeriodNotStarted",
|
|
1327
|
+
"msg": "Question period not started"
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
"code": 6038,
|
|
1331
|
+
"name": "QuestionPeriodEnded",
|
|
1332
|
+
"msg": "Question period ended"
|
|
1333
|
+
},
|
|
1334
|
+
{
|
|
1335
|
+
"code": 6039,
|
|
1336
|
+
"name": "StakeVaultLocked",
|
|
1337
|
+
"msg": "Stake vault is locked"
|
|
1260
1338
|
}
|
|
1261
1339
|
],
|
|
1262
1340
|
"types": [
|
|
@@ -1366,6 +1444,28 @@
|
|
|
1366
1444
|
]
|
|
1367
1445
|
}
|
|
1368
1446
|
},
|
|
1447
|
+
{
|
|
1448
|
+
"name": "InitializeQuestionArgs",
|
|
1449
|
+
"type": {
|
|
1450
|
+
"kind": "struct",
|
|
1451
|
+
"fields": [
|
|
1452
|
+
{
|
|
1453
|
+
"name": "question",
|
|
1454
|
+
"type": {
|
|
1455
|
+
"array": ["u8", 80]
|
|
1456
|
+
}
|
|
1457
|
+
},
|
|
1458
|
+
{
|
|
1459
|
+
"name": "start_time",
|
|
1460
|
+
"type": "i64"
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
"name": "end_time",
|
|
1464
|
+
"type": "i64"
|
|
1465
|
+
}
|
|
1466
|
+
]
|
|
1467
|
+
}
|
|
1468
|
+
},
|
|
1369
1469
|
{
|
|
1370
1470
|
"name": "Market",
|
|
1371
1471
|
"type": {
|
|
@@ -1491,9 +1591,6 @@
|
|
|
1491
1591
|
},
|
|
1492
1592
|
{
|
|
1493
1593
|
"name": "current_question_start",
|
|
1494
|
-
"docs": [
|
|
1495
|
-
"Start timestamp of the current week if 7 days have passed since the start of the week"
|
|
1496
|
-
],
|
|
1497
1594
|
"type": "i64"
|
|
1498
1595
|
},
|
|
1499
1596
|
{
|
|
@@ -1800,6 +1897,20 @@
|
|
|
1800
1897
|
]
|
|
1801
1898
|
}
|
|
1802
1899
|
},
|
|
1900
|
+
{
|
|
1901
|
+
"name": "QuestionStatus",
|
|
1902
|
+
"type": {
|
|
1903
|
+
"kind": "enum",
|
|
1904
|
+
"variants": [
|
|
1905
|
+
{
|
|
1906
|
+
"name": "Resolved"
|
|
1907
|
+
},
|
|
1908
|
+
{
|
|
1909
|
+
"name": "Unresolved"
|
|
1910
|
+
}
|
|
1911
|
+
]
|
|
1912
|
+
}
|
|
1913
|
+
},
|
|
1803
1914
|
{
|
|
1804
1915
|
"name": "QuestionUpdate",
|
|
1805
1916
|
"type": {
|
|
@@ -1854,16 +1965,24 @@
|
|
|
1854
1965
|
"type": "u64"
|
|
1855
1966
|
},
|
|
1856
1967
|
{
|
|
1857
|
-
"name": "
|
|
1968
|
+
"name": "timestamp",
|
|
1969
|
+
"type": "i64"
|
|
1970
|
+
},
|
|
1971
|
+
{
|
|
1972
|
+
"name": "total_hype_shares",
|
|
1973
|
+
"type": "u64"
|
|
1974
|
+
},
|
|
1975
|
+
{
|
|
1976
|
+
"name": "total_flop_shares",
|
|
1977
|
+
"type": "u64"
|
|
1978
|
+
},
|
|
1979
|
+
{
|
|
1980
|
+
"name": "status",
|
|
1858
1981
|
"type": {
|
|
1859
1982
|
"defined": {
|
|
1860
|
-
"name": "
|
|
1983
|
+
"name": "QuestionStatus"
|
|
1861
1984
|
}
|
|
1862
1985
|
}
|
|
1863
|
-
},
|
|
1864
|
-
{
|
|
1865
|
-
"name": "timestamp",
|
|
1866
|
-
"type": "i64"
|
|
1867
1986
|
}
|
|
1868
1987
|
]
|
|
1869
1988
|
}
|
|
@@ -1927,10 +2046,20 @@
|
|
|
1927
2046
|
"docs": ["Final price for Flop outcome at the end of the week"],
|
|
1928
2047
|
"type": "u64"
|
|
1929
2048
|
},
|
|
2049
|
+
{
|
|
2050
|
+
"name": "total_hype_shares",
|
|
2051
|
+
"docs": ["Total number of Hype shares issued"],
|
|
2052
|
+
"type": "u64"
|
|
2053
|
+
},
|
|
2054
|
+
{
|
|
2055
|
+
"name": "total_flop_shares",
|
|
2056
|
+
"docs": ["Total number of Flop shares issued"],
|
|
2057
|
+
"type": "u64"
|
|
2058
|
+
},
|
|
1930
2059
|
{
|
|
1931
2060
|
"name": "padding",
|
|
1932
2061
|
"type": {
|
|
1933
|
-
"array": ["u8",
|
|
2062
|
+
"array": ["u8", 40]
|
|
1934
2063
|
}
|
|
1935
2064
|
}
|
|
1936
2065
|
]
|
|
@@ -1952,6 +2081,34 @@
|
|
|
1952
2081
|
]
|
|
1953
2082
|
}
|
|
1954
2083
|
},
|
|
2084
|
+
{
|
|
2085
|
+
"name": "StakeRewards",
|
|
2086
|
+
"type": {
|
|
2087
|
+
"kind": "struct",
|
|
2088
|
+
"fields": [
|
|
2089
|
+
{
|
|
2090
|
+
"name": "user",
|
|
2091
|
+
"type": "pubkey"
|
|
2092
|
+
},
|
|
2093
|
+
{
|
|
2094
|
+
"name": "mint",
|
|
2095
|
+
"type": "pubkey"
|
|
2096
|
+
},
|
|
2097
|
+
{
|
|
2098
|
+
"name": "amount",
|
|
2099
|
+
"type": "u64"
|
|
2100
|
+
},
|
|
2101
|
+
{
|
|
2102
|
+
"name": "timestamp",
|
|
2103
|
+
"type": "i64"
|
|
2104
|
+
},
|
|
2105
|
+
{
|
|
2106
|
+
"name": "rank",
|
|
2107
|
+
"type": "u16"
|
|
2108
|
+
}
|
|
2109
|
+
]
|
|
2110
|
+
}
|
|
2111
|
+
},
|
|
1955
2112
|
{
|
|
1956
2113
|
"name": "StakeTokenArgs",
|
|
1957
2114
|
"type": {
|
|
@@ -2243,6 +2400,9 @@
|
|
|
2243
2400
|
"type": {
|
|
2244
2401
|
"kind": "enum",
|
|
2245
2402
|
"variants": [
|
|
2403
|
+
{
|
|
2404
|
+
"name": "None"
|
|
2405
|
+
},
|
|
2246
2406
|
{
|
|
2247
2407
|
"name": "Hype"
|
|
2248
2408
|
},
|
|
@@ -2250,7 +2410,7 @@
|
|
|
2250
2410
|
"name": "Flop"
|
|
2251
2411
|
},
|
|
2252
2412
|
{
|
|
2253
|
-
"name": "
|
|
2413
|
+
"name": "Draw"
|
|
2254
2414
|
}
|
|
2255
2415
|
]
|
|
2256
2416
|
}
|
package/dist/types/trade.d.ts
CHANGED
|
@@ -64,3 +64,15 @@ export type OrderType = {
|
|
|
64
64
|
} | {
|
|
65
65
|
market: {};
|
|
66
66
|
};
|
|
67
|
+
export type InitializeQuestionArgs = {
|
|
68
|
+
marketId: number;
|
|
69
|
+
question: string;
|
|
70
|
+
startTime: number;
|
|
71
|
+
endTime: number;
|
|
72
|
+
};
|
|
73
|
+
export type OpenOrderArgs = {
|
|
74
|
+
marketId: number;
|
|
75
|
+
amount: number;
|
|
76
|
+
direction: OrderDirection;
|
|
77
|
+
comment?: string;
|
|
78
|
+
};
|