@triadxyz/triad-protocol 1.5.4-beta → 1.5.6-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.
@@ -169,8 +169,8 @@ export type TriadProtocol = {
169
169
  ];
170
170
  },
171
171
  {
172
- name: 'allowMarketPayout';
173
- discriminator: [95, 246, 155, 119, 253, 65, 95, 184];
172
+ name: 'allowMarketToPayout';
173
+ discriminator: [193, 227, 109, 171, 110, 177, 47, 251];
174
174
  accounts: [
175
175
  {
176
176
  name: 'signer';
@@ -689,6 +689,59 @@ export type TriadProtocol = {
689
689
  ];
690
690
  args: [];
691
691
  },
692
+ {
693
+ name: 'createSubUserTrade';
694
+ discriminator: [77, 201, 111, 73, 47, 229, 244, 161];
695
+ accounts: [
696
+ {
697
+ name: 'signer';
698
+ writable: true;
699
+ signer: true;
700
+ },
701
+ {
702
+ name: 'userTrade';
703
+ writable: true;
704
+ pda: {
705
+ seeds: [
706
+ {
707
+ kind: 'const';
708
+ value: [117, 115, 101, 114, 95, 116, 114, 97, 100, 101];
709
+ },
710
+ {
711
+ kind: 'account';
712
+ path: 'signer';
713
+ }
714
+ ];
715
+ };
716
+ },
717
+ {
718
+ name: 'subUserTrade';
719
+ writable: true;
720
+ pda: {
721
+ seeds: [
722
+ {
723
+ kind: 'const';
724
+ value: [117, 115, 101, 114, 95, 116, 114, 97, 100, 101];
725
+ },
726
+ {
727
+ kind: 'arg';
728
+ path: 'subUserKey';
729
+ }
730
+ ];
731
+ };
732
+ },
733
+ {
734
+ name: 'systemProgram';
735
+ address: '11111111111111111111111111111111';
736
+ }
737
+ ];
738
+ args: [
739
+ {
740
+ name: 'subUserKey';
741
+ type: 'pubkey';
742
+ }
743
+ ];
744
+ },
692
745
  {
693
746
  name: 'createUserTrade';
694
747
  discriminator: [232, 235, 58, 194, 135, 248, 153, 1];
@@ -1232,227 +1285,6 @@ export type TriadProtocol = {
1232
1285
  }
1233
1286
  ];
1234
1287
  },
1235
- {
1236
- name: 'settleOrder';
1237
- discriminator: [80, 74, 204, 34, 12, 183, 66, 66];
1238
- accounts: [
1239
- {
1240
- name: 'signer';
1241
- writable: true;
1242
- signer: true;
1243
- },
1244
- {
1245
- name: 'squads';
1246
- writable: true;
1247
- address: '6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq';
1248
- },
1249
- {
1250
- name: 'user';
1251
- writable: true;
1252
- },
1253
- {
1254
- name: 'userTrade';
1255
- writable: true;
1256
- },
1257
- {
1258
- name: 'market';
1259
- writable: true;
1260
- },
1261
- {
1262
- name: 'mint';
1263
- writable: true;
1264
- },
1265
- {
1266
- name: 'userAta';
1267
- writable: true;
1268
- pda: {
1269
- seeds: [
1270
- {
1271
- kind: 'account';
1272
- path: 'user';
1273
- },
1274
- {
1275
- kind: 'account';
1276
- path: 'tokenProgram';
1277
- },
1278
- {
1279
- kind: 'account';
1280
- path: 'mint';
1281
- }
1282
- ];
1283
- program: {
1284
- kind: 'const';
1285
- value: [
1286
- 140,
1287
- 151,
1288
- 37,
1289
- 143,
1290
- 78,
1291
- 36,
1292
- 137,
1293
- 241,
1294
- 187,
1295
- 61,
1296
- 16,
1297
- 41,
1298
- 20,
1299
- 142,
1300
- 13,
1301
- 131,
1302
- 11,
1303
- 90,
1304
- 19,
1305
- 153,
1306
- 218,
1307
- 255,
1308
- 16,
1309
- 132,
1310
- 4,
1311
- 142,
1312
- 123,
1313
- 216,
1314
- 219,
1315
- 233,
1316
- 248,
1317
- 89
1318
- ];
1319
- };
1320
- };
1321
- },
1322
- {
1323
- name: 'marketAta';
1324
- writable: true;
1325
- pda: {
1326
- seeds: [
1327
- {
1328
- kind: 'account';
1329
- path: 'market';
1330
- },
1331
- {
1332
- kind: 'account';
1333
- path: 'tokenProgram';
1334
- },
1335
- {
1336
- kind: 'account';
1337
- path: 'mint';
1338
- }
1339
- ];
1340
- program: {
1341
- kind: 'const';
1342
- value: [
1343
- 140,
1344
- 151,
1345
- 37,
1346
- 143,
1347
- 78,
1348
- 36,
1349
- 137,
1350
- 241,
1351
- 187,
1352
- 61,
1353
- 16,
1354
- 41,
1355
- 20,
1356
- 142,
1357
- 13,
1358
- 131,
1359
- 11,
1360
- 90,
1361
- 19,
1362
- 153,
1363
- 218,
1364
- 255,
1365
- 16,
1366
- 132,
1367
- 4,
1368
- 142,
1369
- 123,
1370
- 216,
1371
- 219,
1372
- 233,
1373
- 248,
1374
- 89
1375
- ];
1376
- };
1377
- };
1378
- },
1379
- {
1380
- name: 'squadsAta';
1381
- writable: true;
1382
- pda: {
1383
- seeds: [
1384
- {
1385
- kind: 'account';
1386
- path: 'squads';
1387
- },
1388
- {
1389
- kind: 'account';
1390
- path: 'tokenProgram';
1391
- },
1392
- {
1393
- kind: 'account';
1394
- path: 'mint';
1395
- }
1396
- ];
1397
- program: {
1398
- kind: 'const';
1399
- value: [
1400
- 140,
1401
- 151,
1402
- 37,
1403
- 143,
1404
- 78,
1405
- 36,
1406
- 137,
1407
- 241,
1408
- 187,
1409
- 61,
1410
- 16,
1411
- 41,
1412
- 20,
1413
- 142,
1414
- 13,
1415
- 131,
1416
- 11,
1417
- 90,
1418
- 19,
1419
- 153,
1420
- 218,
1421
- 255,
1422
- 16,
1423
- 132,
1424
- 4,
1425
- 142,
1426
- 123,
1427
- 216,
1428
- 219,
1429
- 233,
1430
- 248,
1431
- 89
1432
- ];
1433
- };
1434
- };
1435
- },
1436
- {
1437
- name: 'tokenProgram';
1438
- address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
1439
- },
1440
- {
1441
- name: 'associatedTokenProgram';
1442
- address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
1443
- },
1444
- {
1445
- name: 'systemProgram';
1446
- address: '11111111111111111111111111111111';
1447
- }
1448
- ];
1449
- args: [
1450
- {
1451
- name: 'orderId';
1452
- type: 'u64';
1453
- }
1454
- ];
1455
- },
1456
1288
  {
1457
1289
  name: 'stakeToken';
1458
1290
  discriminator: [191, 127, 193, 101, 37, 96, 87, 211];
@@ -2069,10 +1901,6 @@ export type TriadProtocol = {
2069
1901
  name: 'collection';
2070
1902
  discriminator: [48, 160, 232, 205, 191, 207, 26, 141];
2071
1903
  },
2072
- {
2073
- name: 'market';
2074
- discriminator: [219, 190, 213, 55, 0, 227, 198, 154];
2075
- },
2076
1904
  {
2077
1905
  name: 'marketV2';
2078
1906
  discriminator: [27, 60, 50, 75, 191, 193, 86, 227];
@@ -2099,10 +1927,6 @@ export type TriadProtocol = {
2099
1927
  }
2100
1928
  ];
2101
1929
  events: [
2102
- {
2103
- name: 'marketAllowedToPayoutEvent';
2104
- discriminator: [72, 148, 96, 232, 248, 132, 92, 26];
2105
- },
2106
1930
  {
2107
1931
  name: 'marketEvent';
2108
1932
  discriminator: [212, 67, 145, 23, 58, 104, 52, 83];
@@ -2200,6 +2024,11 @@ export type TriadProtocol = {
2200
2024
  code: 6015;
2201
2025
  name: 'marketNotAllowedToPayout';
2202
2026
  msg: 'Market Not allowed to payout';
2027
+ },
2028
+ {
2029
+ code: 6016;
2030
+ name: 'userTradeIsSubUser';
2031
+ msg: 'User trade is sub user';
2203
2032
  }
2204
2033
  ];
2205
2034
  types: [
@@ -2403,183 +2232,6 @@ export type TriadProtocol = {
2403
2232
  ];
2404
2233
  };
2405
2234
  },
2406
- {
2407
- name: 'market';
2408
- type: {
2409
- kind: 'struct';
2410
- fields: [
2411
- {
2412
- name: 'bump';
2413
- type: 'u8';
2414
- },
2415
- {
2416
- name: 'authority';
2417
- type: 'pubkey';
2418
- },
2419
- {
2420
- name: 'marketId';
2421
- docs: ['Unique identifier for the market'];
2422
- type: 'u64';
2423
- },
2424
- {
2425
- name: 'name';
2426
- docs: ['The event being predicted (e.g., "tJUP/TRD")'];
2427
- type: 'string';
2428
- },
2429
- {
2430
- name: 'hypePrice';
2431
- docs: [
2432
- 'Current price for Hype outcome (0-1000000, representing 0 to 1 TRD)',
2433
- '1000000 = 1 TRD, 500000 = 0.5 TRD, etc.'
2434
- ];
2435
- type: 'u64';
2436
- },
2437
- {
2438
- name: 'flopPrice';
2439
- docs: [
2440
- 'Current price for Flop outcome (0-1000000, representing 0 to 1 TRD)'
2441
- ];
2442
- type: 'u64';
2443
- },
2444
- {
2445
- name: 'hypeLiquidity';
2446
- docs: ['Total liquidity for Hype (in TRD)'];
2447
- type: 'u64';
2448
- },
2449
- {
2450
- name: 'flopLiquidity';
2451
- docs: ['Total liquidity for Flop (in TRD)'];
2452
- type: 'u64';
2453
- },
2454
- {
2455
- name: 'totalHypeShares';
2456
- docs: ['Total number of Hype shares issued'];
2457
- type: 'u64';
2458
- },
2459
- {
2460
- name: 'totalFlopShares';
2461
- docs: ['Total number of Flop shares issued'];
2462
- type: 'u64';
2463
- },
2464
- {
2465
- name: 'totalVolume';
2466
- docs: ['Total trading volume (in TRD) for all resolutions'];
2467
- type: 'u64';
2468
- },
2469
- {
2470
- name: 'mint';
2471
- docs: ['Mint $TRD token'];
2472
- type: 'pubkey';
2473
- },
2474
- {
2475
- name: 'ts';
2476
- docs: ['Timestamp of the init'];
2477
- type: 'i64';
2478
- },
2479
- {
2480
- name: 'updateTs';
2481
- type: 'i64';
2482
- },
2483
- {
2484
- name: 'openOrdersCount';
2485
- docs: ['Total number of open orders in this market'];
2486
- type: 'u64';
2487
- },
2488
- {
2489
- name: 'nextOrderId';
2490
- docs: ['Next available order ID'];
2491
- type: 'u64';
2492
- },
2493
- {
2494
- name: 'feeBps';
2495
- docs: ['Fees applied to trades (in basis points, e.g., 2.131% fee)'];
2496
- type: 'u16';
2497
- },
2498
- {
2499
- name: 'feeVault';
2500
- docs: ['Vault to Receive fees'];
2501
- type: 'pubkey';
2502
- },
2503
- {
2504
- name: 'isActive';
2505
- docs: ['Whether the market is currently active for trading'];
2506
- type: 'bool';
2507
- },
2508
- {
2509
- name: 'marketPrice';
2510
- type: 'u64';
2511
- },
2512
- {
2513
- name: 'previousResolvedQuestion';
2514
- type: {
2515
- defined: {
2516
- name: 'resolvedQuestion';
2517
- };
2518
- };
2519
- },
2520
- {
2521
- name: 'currentQuestionId';
2522
- docs: [
2523
- 'Index of the current week in the weekly_results array initialized with default values'
2524
- ];
2525
- type: 'u64';
2526
- },
2527
- {
2528
- name: 'currentQuestionStart';
2529
- type: 'i64';
2530
- },
2531
- {
2532
- name: 'currentQuestionEnd';
2533
- type: 'i64';
2534
- },
2535
- {
2536
- name: 'currentQuestion';
2537
- docs: ['The question or prediction topic for the current week'];
2538
- type: {
2539
- array: ['u8', 80];
2540
- };
2541
- },
2542
- {
2543
- name: 'liquidity';
2544
- type: 'u64';
2545
- },
2546
- {
2547
- name: 'padding';
2548
- type: {
2549
- array: ['u8', 200];
2550
- };
2551
- }
2552
- ];
2553
- };
2554
- },
2555
- {
2556
- name: 'marketAllowedToPayoutEvent';
2557
- type: {
2558
- kind: 'struct';
2559
- fields: [
2560
- {
2561
- name: 'marketId';
2562
- type: 'u64';
2563
- },
2564
- {
2565
- name: 'winningDirection';
2566
- type: {
2567
- defined: {
2568
- name: 'winningDirection';
2569
- };
2570
- };
2571
- },
2572
- {
2573
- name: 'timestamp';
2574
- type: 'i64';
2575
- },
2576
- {
2577
- name: 'isAllowedToPayout';
2578
- type: 'bool';
2579
- }
2580
- ];
2581
- };
2582
- },
2583
2235
  {
2584
2236
  name: 'marketEvent';
2585
2237
  type: {
@@ -2644,6 +2296,14 @@ export type TriadProtocol = {
2644
2296
  {
2645
2297
  name: 'marketEnd';
2646
2298
  type: 'i64';
2299
+ },
2300
+ {
2301
+ name: 'isAllowedToPayout';
2302
+ type: 'bool';
2303
+ },
2304
+ {
2305
+ name: 'marketLiquidityAtStart';
2306
+ type: 'u64';
2647
2307
  }
2648
2308
  ];
2649
2309
  };
@@ -2855,10 +2515,14 @@ export type TriadProtocol = {
2855
2515
  };
2856
2516
  };
2857
2517
  },
2518
+ {
2519
+ name: 'userNonce';
2520
+ type: 'u32';
2521
+ },
2858
2522
  {
2859
2523
  name: 'padding';
2860
2524
  type: {
2861
- array: ['u8', 32];
2525
+ array: ['u8', 28];
2862
2526
  };
2863
2527
  }
2864
2528
  ];
@@ -2954,6 +2618,10 @@ export type TriadProtocol = {
2954
2618
  type: {
2955
2619
  option: 'bool';
2956
2620
  };
2621
+ },
2622
+ {
2623
+ name: 'userNonce';
2624
+ type: 'u32';
2957
2625
  }
2958
2626
  ];
2959
2627
  };
@@ -2971,12 +2639,6 @@ export type TriadProtocol = {
2971
2639
  },
2972
2640
  {
2973
2641
  name: 'closed';
2974
- },
2975
- {
2976
- name: 'claimed';
2977
- },
2978
- {
2979
- name: 'liquidated';
2980
2642
  }
2981
2643
  ];
2982
2644
  };
@@ -3027,84 +2689,6 @@ export type TriadProtocol = {
3027
2689
  ];
3028
2690
  };
3029
2691
  },
3030
- {
3031
- name: 'resolvedQuestion';
3032
- type: {
3033
- kind: 'struct';
3034
- fields: [
3035
- {
3036
- name: 'questionId';
3037
- type: 'u64';
3038
- },
3039
- {
3040
- name: 'question';
3041
- docs: ['The question or prediction topic for this week'];
3042
- type: {
3043
- array: ['u8', 80];
3044
- };
3045
- },
3046
- {
3047
- name: 'startTime';
3048
- docs: ['Start timestamp of the week'];
3049
- type: 'i64';
3050
- },
3051
- {
3052
- name: 'endTime';
3053
- docs: ['End timestamp of the week'];
3054
- type: 'i64';
3055
- },
3056
- {
3057
- name: 'hypeLiquidity';
3058
- docs: ['Total liquidity for Hype (in TRD)'];
3059
- type: 'u64';
3060
- },
3061
- {
3062
- name: 'flopLiquidity';
3063
- docs: ['Total liquidity for Flop (in TRD)'];
3064
- type: 'u64';
3065
- },
3066
- {
3067
- name: 'winningDirection';
3068
- docs: ['The winning direction (Hype, Flop or None)'];
3069
- type: {
3070
- defined: {
3071
- name: 'winningDirection';
3072
- };
3073
- };
3074
- },
3075
- {
3076
- name: 'marketPrice';
3077
- type: 'u64';
3078
- },
3079
- {
3080
- name: 'finalHypePrice';
3081
- docs: ['Final price for Hype outcome at the end of the week'];
3082
- type: 'u64';
3083
- },
3084
- {
3085
- name: 'finalFlopPrice';
3086
- docs: ['Final price for Flop outcome at the end of the week'];
3087
- type: 'u64';
3088
- },
3089
- {
3090
- name: 'totalHypeShares';
3091
- docs: ['Total number of Hype shares issued'];
3092
- type: 'u64';
3093
- },
3094
- {
3095
- name: 'totalFlopShares';
3096
- docs: ['Total number of Flop shares issued'];
3097
- type: 'u64';
3098
- },
3099
- {
3100
- name: 'padding';
3101
- type: {
3102
- array: ['u8', 40];
3103
- };
3104
- }
3105
- ];
3106
- };
3107
- },
3108
2692
  {
3109
2693
  name: 'stakeRewardsEvent';
3110
2694
  type: {
@@ -3415,10 +2999,18 @@ export type TriadProtocol = {
3415
2999
  ];
3416
3000
  };
3417
3001
  },
3002
+ {
3003
+ name: 'nonce';
3004
+ type: 'u32';
3005
+ },
3006
+ {
3007
+ name: 'isSubUser';
3008
+ type: 'bool';
3009
+ },
3418
3010
  {
3419
3011
  name: 'padding';
3420
3012
  type: {
3421
- array: ['u8', 32];
3013
+ array: ['u8', 27];
3422
3014
  };
3423
3015
  }
3424
3016
  ];
@@ -1,6 +1,6 @@
1
1
  import { Stake, StakeVault } from './../types/stake';
2
2
  import { User } from './../types';
3
- import { Market } from '../types/trade';
3
+ import { Market, Order, UserTrade } from '../types/trade';
4
4
  import { PublicKey } from '@solana/web3.js';
5
5
  export declare const encodeString: (value: string, alloc?: number) => number[];
6
6
  export declare const decodeString: (bytes: number[]) => string;
@@ -8,5 +8,6 @@ export declare const formatStakeVault: (stakeVault: any) => StakeVault;
8
8
  export declare const formatStake: (stake: any) => Stake;
9
9
  export declare const formatUser: (user: any) => User;
10
10
  export declare const formatMarket: (account: any, address: PublicKey) => Market;
11
- export declare const accountToMarketV1: (account: any, address: PublicKey) => Market;
11
+ export declare const formatOrder: (order: any) => Order;
12
+ export declare const formatUserTrade: (account: any, publicKey: PublicKey) => UserTrade;
12
13
  export declare const calculateStakeRewards: (stake: Stake, multiplier: number) => number;