@triadxyz/triad-protocol 2.3.0-beta → 2.3.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/trade.d.ts +11 -1
- package/dist/trade.js +27 -2
- package/dist/types/idl_triad_protocol.json +96 -5
- package/dist/types/trade.d.ts +1 -0
- package/dist/types/triad_protocol.d.ts +154 -5
- package/dist/utils/helpers.js +2 -1
- package/package.json +1 -1
package/dist/trade.d.ts
CHANGED
|
@@ -255,7 +255,10 @@ export default class Trade {
|
|
|
255
255
|
* @param options - RPC options
|
|
256
256
|
*
|
|
257
257
|
*/
|
|
258
|
-
allowMarketToPayout(marketId
|
|
258
|
+
allowMarketToPayout({ marketId, poolId }: {
|
|
259
|
+
marketId: number;
|
|
260
|
+
poolId?: number;
|
|
261
|
+
}, options?: RpcOptions): Promise<string>;
|
|
259
262
|
/**
|
|
260
263
|
* Create Sub User Trade
|
|
261
264
|
* @param user - User PublicKey the main user
|
|
@@ -366,4 +369,11 @@ export default class Trade {
|
|
|
366
369
|
ask: Order[];
|
|
367
370
|
};
|
|
368
371
|
}>;
|
|
372
|
+
/**
|
|
373
|
+
* Collect Market Fee
|
|
374
|
+
* @param marketId - The ID of the market
|
|
375
|
+
*
|
|
376
|
+
* @param options - RPC options
|
|
377
|
+
*/
|
|
378
|
+
collectMarketFee(marketId: number, options?: RpcOptions): Promise<string>;
|
|
369
379
|
}
|
package/dist/trade.js
CHANGED
|
@@ -408,9 +408,13 @@ class Trade {
|
|
|
408
408
|
* @param options - RPC options
|
|
409
409
|
*
|
|
410
410
|
*/
|
|
411
|
-
allowMarketToPayout(marketId, options) {
|
|
411
|
+
allowMarketToPayout({ marketId, poolId }, options) {
|
|
412
412
|
return __awaiter(this, void 0, void 0, function* () {
|
|
413
413
|
const ixs = [];
|
|
414
|
+
let poolPDA = null;
|
|
415
|
+
if (poolId) {
|
|
416
|
+
poolPDA = (0, pda_1.getPoolPDA)(this.program.programId, poolId);
|
|
417
|
+
}
|
|
414
418
|
ixs.push(yield this.program.methods
|
|
415
419
|
.updateMarket({
|
|
416
420
|
winningDirection: null,
|
|
@@ -419,7 +423,8 @@ class Trade {
|
|
|
419
423
|
})
|
|
420
424
|
.accounts({
|
|
421
425
|
signer: this.program.provider.publicKey,
|
|
422
|
-
market: (0, pda_1.getMarketPDA)(this.program.programId, marketId)
|
|
426
|
+
market: (0, pda_1.getMarketPDA)(this.program.programId, marketId),
|
|
427
|
+
pool: poolPDA
|
|
423
428
|
})
|
|
424
429
|
.instruction());
|
|
425
430
|
return (0, sendVersionedTransaction_1.default)(this.program, ixs, options);
|
|
@@ -844,5 +849,25 @@ class Trade {
|
|
|
844
849
|
return orderBook;
|
|
845
850
|
});
|
|
846
851
|
}
|
|
852
|
+
/**
|
|
853
|
+
* Collect Market Fee
|
|
854
|
+
* @param marketId - The ID of the market
|
|
855
|
+
*
|
|
856
|
+
* @param options - RPC options
|
|
857
|
+
*/
|
|
858
|
+
collectMarketFee(marketId, options) {
|
|
859
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
860
|
+
const ixs = [];
|
|
861
|
+
ixs.push(yield this.program.methods
|
|
862
|
+
.collectMarketFee()
|
|
863
|
+
.accounts({
|
|
864
|
+
signer: this.program.provider.publicKey,
|
|
865
|
+
market: (0, pda_1.getMarketPDA)(this.program.programId, marketId),
|
|
866
|
+
mint: constants_1.TRD_MINT
|
|
867
|
+
})
|
|
868
|
+
.instruction());
|
|
869
|
+
return (0, sendVersionedTransaction_1.default)(this.program, ixs, options);
|
|
870
|
+
});
|
|
871
|
+
}
|
|
847
872
|
}
|
|
848
873
|
exports.default = Trade;
|
|
@@ -762,6 +762,99 @@
|
|
|
762
762
|
],
|
|
763
763
|
"args": []
|
|
764
764
|
},
|
|
765
|
+
{
|
|
766
|
+
"name": "collect_market_fee",
|
|
767
|
+
"discriminator": [139, 4, 96, 182, 216, 250, 122, 79],
|
|
768
|
+
"accounts": [
|
|
769
|
+
{
|
|
770
|
+
"name": "signer",
|
|
771
|
+
"writable": true,
|
|
772
|
+
"signer": true
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
"name": "squads",
|
|
776
|
+
"writable": true,
|
|
777
|
+
"address": "6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq"
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
"name": "market",
|
|
781
|
+
"writable": true
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
"name": "mint",
|
|
785
|
+
"writable": true
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
"name": "market_ata",
|
|
789
|
+
"writable": true,
|
|
790
|
+
"pda": {
|
|
791
|
+
"seeds": [
|
|
792
|
+
{
|
|
793
|
+
"kind": "account",
|
|
794
|
+
"path": "market"
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
"kind": "account",
|
|
798
|
+
"path": "token_program"
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
"kind": "account",
|
|
802
|
+
"path": "mint"
|
|
803
|
+
}
|
|
804
|
+
],
|
|
805
|
+
"program": {
|
|
806
|
+
"kind": "const",
|
|
807
|
+
"value": [
|
|
808
|
+
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
|
|
809
|
+
13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
|
|
810
|
+
219, 233, 248, 89
|
|
811
|
+
]
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
"name": "receiver_ata",
|
|
817
|
+
"writable": true,
|
|
818
|
+
"pda": {
|
|
819
|
+
"seeds": [
|
|
820
|
+
{
|
|
821
|
+
"kind": "account",
|
|
822
|
+
"path": "squads"
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
"kind": "account",
|
|
826
|
+
"path": "token_program"
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
"kind": "account",
|
|
830
|
+
"path": "mint"
|
|
831
|
+
}
|
|
832
|
+
],
|
|
833
|
+
"program": {
|
|
834
|
+
"kind": "const",
|
|
835
|
+
"value": [
|
|
836
|
+
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
|
|
837
|
+
13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
|
|
838
|
+
219, 233, 248, 89
|
|
839
|
+
]
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
"name": "token_program",
|
|
845
|
+
"address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
"name": "associated_token_program",
|
|
849
|
+
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
"name": "system_program",
|
|
853
|
+
"address": "11111111111111111111111111111111"
|
|
854
|
+
}
|
|
855
|
+
],
|
|
856
|
+
"args": []
|
|
857
|
+
},
|
|
765
858
|
{
|
|
766
859
|
"name": "collect_remaining_liquidity",
|
|
767
860
|
"discriminator": [153, 107, 201, 83, 183, 195, 59, 186],
|
|
@@ -3292,10 +3385,8 @@
|
|
|
3292
3385
|
"type": "u16"
|
|
3293
3386
|
},
|
|
3294
3387
|
{
|
|
3295
|
-
"name": "
|
|
3296
|
-
"type":
|
|
3297
|
-
"array": ["u8", 8]
|
|
3298
|
-
}
|
|
3388
|
+
"name": "fee_recipient",
|
|
3389
|
+
"type": "pubkey"
|
|
3299
3390
|
},
|
|
3300
3391
|
{
|
|
3301
3392
|
"name": "pool_id",
|
|
@@ -3304,7 +3395,7 @@
|
|
|
3304
3395
|
{
|
|
3305
3396
|
"name": "padding",
|
|
3306
3397
|
"type": {
|
|
3307
|
-
"array": ["u8",
|
|
3398
|
+
"array": ["u8", 48]
|
|
3308
3399
|
}
|
|
3309
3400
|
}
|
|
3310
3401
|
]
|
package/dist/types/trade.d.ts
CHANGED
|
@@ -1186,6 +1186,157 @@ export type TriadProtocol = {
|
|
|
1186
1186
|
];
|
|
1187
1187
|
args: [];
|
|
1188
1188
|
},
|
|
1189
|
+
{
|
|
1190
|
+
name: 'collectMarketFee';
|
|
1191
|
+
discriminator: [139, 4, 96, 182, 216, 250, 122, 79];
|
|
1192
|
+
accounts: [
|
|
1193
|
+
{
|
|
1194
|
+
name: 'signer';
|
|
1195
|
+
writable: true;
|
|
1196
|
+
signer: true;
|
|
1197
|
+
},
|
|
1198
|
+
{
|
|
1199
|
+
name: 'squads';
|
|
1200
|
+
writable: true;
|
|
1201
|
+
address: '6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq';
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
name: 'market';
|
|
1205
|
+
writable: true;
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
name: 'mint';
|
|
1209
|
+
writable: true;
|
|
1210
|
+
},
|
|
1211
|
+
{
|
|
1212
|
+
name: 'marketAta';
|
|
1213
|
+
writable: true;
|
|
1214
|
+
pda: {
|
|
1215
|
+
seeds: [
|
|
1216
|
+
{
|
|
1217
|
+
kind: 'account';
|
|
1218
|
+
path: 'market';
|
|
1219
|
+
},
|
|
1220
|
+
{
|
|
1221
|
+
kind: 'account';
|
|
1222
|
+
path: 'tokenProgram';
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
kind: 'account';
|
|
1226
|
+
path: 'mint';
|
|
1227
|
+
}
|
|
1228
|
+
];
|
|
1229
|
+
program: {
|
|
1230
|
+
kind: 'const';
|
|
1231
|
+
value: [
|
|
1232
|
+
140,
|
|
1233
|
+
151,
|
|
1234
|
+
37,
|
|
1235
|
+
143,
|
|
1236
|
+
78,
|
|
1237
|
+
36,
|
|
1238
|
+
137,
|
|
1239
|
+
241,
|
|
1240
|
+
187,
|
|
1241
|
+
61,
|
|
1242
|
+
16,
|
|
1243
|
+
41,
|
|
1244
|
+
20,
|
|
1245
|
+
142,
|
|
1246
|
+
13,
|
|
1247
|
+
131,
|
|
1248
|
+
11,
|
|
1249
|
+
90,
|
|
1250
|
+
19,
|
|
1251
|
+
153,
|
|
1252
|
+
218,
|
|
1253
|
+
255,
|
|
1254
|
+
16,
|
|
1255
|
+
132,
|
|
1256
|
+
4,
|
|
1257
|
+
142,
|
|
1258
|
+
123,
|
|
1259
|
+
216,
|
|
1260
|
+
219,
|
|
1261
|
+
233,
|
|
1262
|
+
248,
|
|
1263
|
+
89
|
|
1264
|
+
];
|
|
1265
|
+
};
|
|
1266
|
+
};
|
|
1267
|
+
},
|
|
1268
|
+
{
|
|
1269
|
+
name: 'receiverAta';
|
|
1270
|
+
writable: true;
|
|
1271
|
+
pda: {
|
|
1272
|
+
seeds: [
|
|
1273
|
+
{
|
|
1274
|
+
kind: 'account';
|
|
1275
|
+
path: 'squads';
|
|
1276
|
+
},
|
|
1277
|
+
{
|
|
1278
|
+
kind: 'account';
|
|
1279
|
+
path: 'tokenProgram';
|
|
1280
|
+
},
|
|
1281
|
+
{
|
|
1282
|
+
kind: 'account';
|
|
1283
|
+
path: 'mint';
|
|
1284
|
+
}
|
|
1285
|
+
];
|
|
1286
|
+
program: {
|
|
1287
|
+
kind: 'const';
|
|
1288
|
+
value: [
|
|
1289
|
+
140,
|
|
1290
|
+
151,
|
|
1291
|
+
37,
|
|
1292
|
+
143,
|
|
1293
|
+
78,
|
|
1294
|
+
36,
|
|
1295
|
+
137,
|
|
1296
|
+
241,
|
|
1297
|
+
187,
|
|
1298
|
+
61,
|
|
1299
|
+
16,
|
|
1300
|
+
41,
|
|
1301
|
+
20,
|
|
1302
|
+
142,
|
|
1303
|
+
13,
|
|
1304
|
+
131,
|
|
1305
|
+
11,
|
|
1306
|
+
90,
|
|
1307
|
+
19,
|
|
1308
|
+
153,
|
|
1309
|
+
218,
|
|
1310
|
+
255,
|
|
1311
|
+
16,
|
|
1312
|
+
132,
|
|
1313
|
+
4,
|
|
1314
|
+
142,
|
|
1315
|
+
123,
|
|
1316
|
+
216,
|
|
1317
|
+
219,
|
|
1318
|
+
233,
|
|
1319
|
+
248,
|
|
1320
|
+
89
|
|
1321
|
+
];
|
|
1322
|
+
};
|
|
1323
|
+
};
|
|
1324
|
+
},
|
|
1325
|
+
{
|
|
1326
|
+
name: 'tokenProgram';
|
|
1327
|
+
address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
name: 'associatedTokenProgram';
|
|
1331
|
+
address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
|
|
1332
|
+
},
|
|
1333
|
+
{
|
|
1334
|
+
name: 'systemProgram';
|
|
1335
|
+
address: '11111111111111111111111111111111';
|
|
1336
|
+
}
|
|
1337
|
+
];
|
|
1338
|
+
args: [];
|
|
1339
|
+
},
|
|
1189
1340
|
{
|
|
1190
1341
|
name: 'collectRemainingLiquidity';
|
|
1191
1342
|
discriminator: [153, 107, 201, 83, 183, 195, 59, 186];
|
|
@@ -4361,10 +4512,8 @@ export type TriadProtocol = {
|
|
|
4361
4512
|
type: 'u16';
|
|
4362
4513
|
},
|
|
4363
4514
|
{
|
|
4364
|
-
name: '
|
|
4365
|
-
type:
|
|
4366
|
-
array: ['u8', 8];
|
|
4367
|
-
};
|
|
4515
|
+
name: 'feeRecipient';
|
|
4516
|
+
type: 'pubkey';
|
|
4368
4517
|
},
|
|
4369
4518
|
{
|
|
4370
4519
|
name: 'poolId';
|
|
@@ -4373,7 +4522,7 @@ export type TriadProtocol = {
|
|
|
4373
4522
|
{
|
|
4374
4523
|
name: 'padding';
|
|
4375
4524
|
type: {
|
|
4376
|
-
array: ['u8',
|
|
4525
|
+
array: ['u8', 48];
|
|
4377
4526
|
};
|
|
4378
4527
|
}
|
|
4379
4528
|
];
|
package/dist/utils/helpers.js
CHANGED
|
@@ -95,7 +95,8 @@ const formatMarket = (account, address) => {
|
|
|
95
95
|
: '0',
|
|
96
96
|
payoutFee: account.payoutFee,
|
|
97
97
|
customer: account.customerId === 0 ? 'Triad' : account.customerId.toString(),
|
|
98
|
-
poolId: account.poolId.toNumber()
|
|
98
|
+
poolId: account.poolId.toNumber(),
|
|
99
|
+
feeRecipient: account.feeRecipient.toString()
|
|
99
100
|
};
|
|
100
101
|
};
|
|
101
102
|
exports.formatMarket = formatMarket;
|