@triadxyz/triad-protocol 1.9.7-beta → 1.9.9-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.
@@ -44,26 +44,6 @@
44
44
  ],
45
45
  "args": []
46
46
  },
47
- {
48
- "name": "allow_market_to_payout",
49
- "discriminator": [193, 227, 109, 171, 110, 177, 47, 251],
50
- "accounts": [
51
- {
52
- "name": "signer",
53
- "writable": true,
54
- "signer": true
55
- },
56
- {
57
- "name": "market",
58
- "writable": true
59
- },
60
- {
61
- "name": "system_program",
62
- "address": "11111111111111111111111111111111"
63
- }
64
- ],
65
- "args": []
66
- },
67
47
  {
68
48
  "name": "cancel_ask_order",
69
49
  "discriminator": [211, 157, 113, 122, 34, 180, 162, 178],
@@ -204,7 +184,21 @@
204
184
  },
205
185
  {
206
186
  "name": "stake_vault",
207
- "writable": true
187
+ "writable": true,
188
+ "pda": {
189
+ "seeds": [
190
+ {
191
+ "kind": "const",
192
+ "value": [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116]
193
+ },
194
+ {
195
+ "kind": "const",
196
+ "value": [
197
+ 84, 114, 105, 97, 100, 32, 83, 104, 97, 114, 101, 32, 49
198
+ ]
199
+ }
200
+ ]
201
+ }
208
202
  },
209
203
  {
210
204
  "name": "stake",
@@ -1335,35 +1329,6 @@
1335
1329
  ],
1336
1330
  "args": []
1337
1331
  },
1338
- {
1339
- "name": "resolve_market",
1340
- "discriminator": [155, 23, 80, 173, 46, 74, 23, 239],
1341
- "accounts": [
1342
- {
1343
- "name": "signer",
1344
- "writable": true,
1345
- "signer": true
1346
- },
1347
- {
1348
- "name": "market",
1349
- "writable": true
1350
- },
1351
- {
1352
- "name": "system_program",
1353
- "address": "11111111111111111111111111111111"
1354
- }
1355
- ],
1356
- "args": [
1357
- {
1358
- "name": "winning_direction",
1359
- "type": {
1360
- "defined": {
1361
- "name": "WinningDirection"
1362
- }
1363
- }
1364
- }
1365
- ]
1366
- },
1367
1332
  {
1368
1333
  "name": "stake_token",
1369
1334
  "discriminator": [191, 127, 193, 101, 37, 96, 87, 211],
@@ -1383,8 +1348,10 @@
1383
1348
  "value": [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116]
1384
1349
  },
1385
1350
  {
1386
- "kind": "arg",
1387
- "path": "args.stake_vault"
1351
+ "kind": "const",
1352
+ "value": [
1353
+ 84, 114, 105, 97, 100, 32, 83, 104, 97, 114, 101, 32, 49
1354
+ ]
1388
1355
  }
1389
1356
  ]
1390
1357
  }
@@ -1566,8 +1533,12 @@
1566
1533
  ],
1567
1534
  "args": [
1568
1535
  {
1569
- "name": "market_end",
1570
- "type": "i64"
1536
+ "name": "args",
1537
+ "type": {
1538
+ "defined": {
1539
+ "name": "UpdateMarketArgs"
1540
+ }
1541
+ }
1571
1542
  }
1572
1543
  ]
1573
1544
  },
@@ -1590,8 +1561,10 @@
1590
1561
  "value": [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116]
1591
1562
  },
1592
1563
  {
1593
- "kind": "arg",
1594
- "path": "args.stake_vault"
1564
+ "kind": "const",
1565
+ "value": [
1566
+ 84, 114, 105, 97, 100, 32, 83, 104, 97, 114, 101, 32, 49
1567
+ ]
1595
1568
  }
1596
1569
  ]
1597
1570
  }
@@ -1727,7 +1700,21 @@
1727
1700
  },
1728
1701
  {
1729
1702
  "name": "stake_vault",
1730
- "writable": true
1703
+ "writable": true,
1704
+ "pda": {
1705
+ "seeds": [
1706
+ {
1707
+ "kind": "const",
1708
+ "value": [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116]
1709
+ },
1710
+ {
1711
+ "kind": "const",
1712
+ "value": [
1713
+ 84, 114, 105, 97, 100, 32, 83, 104, 97, 114, 101, 32, 49
1714
+ ]
1715
+ }
1716
+ ]
1717
+ }
1731
1718
  },
1732
1719
  {
1733
1720
  "name": "stake",
@@ -1873,7 +1860,7 @@
1873
1860
  {
1874
1861
  "code": 6000,
1875
1862
  "name": "Unauthorized",
1876
- "msg": "Unauthorized access"
1863
+ "msg": "Unauthorized Instruction"
1877
1864
  },
1878
1865
  {
1879
1866
  "code": 6001,
@@ -1999,6 +1986,11 @@
1999
1986
  "code": 6025,
2000
1987
  "name": "OrderIsFullFilled",
2001
1988
  "msg": "Order is full filled"
1989
+ },
1990
+ {
1991
+ "code": 6026,
1992
+ "name": "Overflow",
1993
+ "msg": "Overflow"
2002
1994
  }
2003
1995
  ],
2004
1996
  "types": [
@@ -2337,6 +2329,14 @@
2337
2329
  "name": "fee_bps",
2338
2330
  "type": "u16"
2339
2331
  },
2332
+ {
2333
+ "name": "payout_fee_available",
2334
+ "type": "u64"
2335
+ },
2336
+ {
2337
+ "name": "payout_fee_claimed",
2338
+ "type": "u64"
2339
+ },
2340
2340
  {
2341
2341
  "name": "market_fee_available",
2342
2342
  "type": "u64"
@@ -2452,11 +2452,11 @@
2452
2452
  "type": "u16"
2453
2453
  },
2454
2454
  {
2455
- "name": "creator_fee_available",
2455
+ "name": "payout_fee_available",
2456
2456
  "type": "u64"
2457
2457
  },
2458
2458
  {
2459
- "name": "creator_fee_claimed",
2459
+ "name": "payout_fee_claimed",
2460
2460
  "type": "u64"
2461
2461
  },
2462
2462
  {
@@ -2868,14 +2868,6 @@
2868
2868
  "name": "flop_price",
2869
2869
  "type": "u64"
2870
2870
  },
2871
- {
2872
- "name": "direction",
2873
- "type": {
2874
- "defined": {
2875
- "name": "OrderDirection"
2876
- }
2877
- }
2878
- },
2879
2871
  {
2880
2872
  "name": "timestamp",
2881
2873
  "type": "i64"
@@ -2916,10 +2908,6 @@
2916
2908
  "type": {
2917
2909
  "kind": "struct",
2918
2910
  "fields": [
2919
- {
2920
- "name": "stake_vault",
2921
- "type": "string"
2922
- },
2923
2911
  {
2924
2912
  "name": "name",
2925
2913
  "type": "string"
@@ -3084,6 +3072,36 @@
3084
3072
  ]
3085
3073
  }
3086
3074
  },
3075
+ {
3076
+ "name": "UpdateMarketArgs",
3077
+ "type": {
3078
+ "kind": "struct",
3079
+ "fields": [
3080
+ {
3081
+ "name": "market_end",
3082
+ "type": {
3083
+ "option": "i64"
3084
+ }
3085
+ },
3086
+ {
3087
+ "name": "winning_direction",
3088
+ "type": {
3089
+ "option": {
3090
+ "defined": {
3091
+ "name": "WinningDirection"
3092
+ }
3093
+ }
3094
+ }
3095
+ },
3096
+ {
3097
+ "name": "allow_payout",
3098
+ "type": {
3099
+ "option": "bool"
3100
+ }
3101
+ }
3102
+ ]
3103
+ }
3104
+ },
3087
3105
  {
3088
3106
  "name": "UpdateStakeVaultArgs",
3089
3107
  "type": {
@@ -3100,10 +3118,6 @@
3100
3118
  "type": {
3101
3119
  "option": "bool"
3102
3120
  }
3103
- },
3104
- {
3105
- "name": "stake_vault",
3106
- "type": "string"
3107
3121
  }
3108
3122
  ]
3109
3123
  }
@@ -17,8 +17,8 @@ export type Market = {
17
17
  nextOrderId: string;
18
18
  feeBps: number;
19
19
  isAllowedToPayout: boolean;
20
- creatorFeeAvailable: string;
21
- creatorFeeClaimed: string;
20
+ payoutFeeAvailable: string;
21
+ payoutFeeClaimed: string;
22
22
  marketFeeAvailable: string;
23
23
  marketFeeClaimed: string;
24
24
  marketStart: string;
@@ -50,26 +50,6 @@ export type TriadProtocol = {
50
50
  ];
51
51
  args: [];
52
52
  },
53
- {
54
- name: 'allowMarketToPayout';
55
- discriminator: [193, 227, 109, 171, 110, 177, 47, 251];
56
- accounts: [
57
- {
58
- name: 'signer';
59
- writable: true;
60
- signer: true;
61
- },
62
- {
63
- name: 'market';
64
- writable: true;
65
- },
66
- {
67
- name: 'systemProgram';
68
- address: '11111111111111111111111111111111';
69
- }
70
- ];
71
- args: [];
72
- },
73
53
  {
74
54
  name: 'cancelAskOrder';
75
55
  discriminator: [211, 157, 113, 122, 34, 180, 162, 178];
@@ -269,6 +249,32 @@ export type TriadProtocol = {
269
249
  {
270
250
  name: 'stakeVault';
271
251
  writable: true;
252
+ pda: {
253
+ seeds: [
254
+ {
255
+ kind: 'const';
256
+ value: [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116];
257
+ },
258
+ {
259
+ kind: 'const';
260
+ value: [
261
+ 84,
262
+ 114,
263
+ 105,
264
+ 97,
265
+ 100,
266
+ 32,
267
+ 83,
268
+ 104,
269
+ 97,
270
+ 114,
271
+ 101,
272
+ 32,
273
+ 49
274
+ ];
275
+ }
276
+ ];
277
+ };
272
278
  },
273
279
  {
274
280
  name: 'stake';
@@ -1863,35 +1869,6 @@ export type TriadProtocol = {
1863
1869
  ];
1864
1870
  args: [];
1865
1871
  },
1866
- {
1867
- name: 'resolveMarket';
1868
- discriminator: [155, 23, 80, 173, 46, 74, 23, 239];
1869
- accounts: [
1870
- {
1871
- name: 'signer';
1872
- writable: true;
1873
- signer: true;
1874
- },
1875
- {
1876
- name: 'market';
1877
- writable: true;
1878
- },
1879
- {
1880
- name: 'systemProgram';
1881
- address: '11111111111111111111111111111111';
1882
- }
1883
- ];
1884
- args: [
1885
- {
1886
- name: 'winningDirection';
1887
- type: {
1888
- defined: {
1889
- name: 'winningDirection';
1890
- };
1891
- };
1892
- }
1893
- ];
1894
- },
1895
1872
  {
1896
1873
  name: 'stakeToken';
1897
1874
  discriminator: [191, 127, 193, 101, 37, 96, 87, 211];
@@ -1911,8 +1888,22 @@ export type TriadProtocol = {
1911
1888
  value: [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116];
1912
1889
  },
1913
1890
  {
1914
- kind: 'arg';
1915
- path: 'args.stake_vault';
1891
+ kind: 'const';
1892
+ value: [
1893
+ 84,
1894
+ 114,
1895
+ 105,
1896
+ 97,
1897
+ 100,
1898
+ 32,
1899
+ 83,
1900
+ 104,
1901
+ 97,
1902
+ 114,
1903
+ 101,
1904
+ 32,
1905
+ 49
1906
+ ];
1916
1907
  }
1917
1908
  ];
1918
1909
  };
@@ -2152,8 +2143,12 @@ export type TriadProtocol = {
2152
2143
  ];
2153
2144
  args: [
2154
2145
  {
2155
- name: 'marketEnd';
2156
- type: 'i64';
2146
+ name: 'args';
2147
+ type: {
2148
+ defined: {
2149
+ name: 'updateMarketArgs';
2150
+ };
2151
+ };
2157
2152
  }
2158
2153
  ];
2159
2154
  },
@@ -2176,8 +2171,22 @@ export type TriadProtocol = {
2176
2171
  value: [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116];
2177
2172
  },
2178
2173
  {
2179
- kind: 'arg';
2180
- path: 'args.stake_vault';
2174
+ kind: 'const';
2175
+ value: [
2176
+ 84,
2177
+ 114,
2178
+ 105,
2179
+ 97,
2180
+ 100,
2181
+ 32,
2182
+ 83,
2183
+ 104,
2184
+ 97,
2185
+ 114,
2186
+ 101,
2187
+ 32,
2188
+ 49
2189
+ ];
2181
2190
  }
2182
2191
  ];
2183
2192
  };
@@ -2372,6 +2381,32 @@ export type TriadProtocol = {
2372
2381
  {
2373
2382
  name: 'stakeVault';
2374
2383
  writable: true;
2384
+ pda: {
2385
+ seeds: [
2386
+ {
2387
+ kind: 'const';
2388
+ value: [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116];
2389
+ },
2390
+ {
2391
+ kind: 'const';
2392
+ value: [
2393
+ 84,
2394
+ 114,
2395
+ 105,
2396
+ 97,
2397
+ 100,
2398
+ 32,
2399
+ 83,
2400
+ 104,
2401
+ 97,
2402
+ 114,
2403
+ 101,
2404
+ 32,
2405
+ 49
2406
+ ];
2407
+ }
2408
+ ];
2409
+ };
2375
2410
  },
2376
2411
  {
2377
2412
  name: 'stake';
@@ -2575,7 +2610,7 @@ export type TriadProtocol = {
2575
2610
  {
2576
2611
  code: 6000;
2577
2612
  name: 'unauthorized';
2578
- msg: 'Unauthorized access';
2613
+ msg: 'Unauthorized Instruction';
2579
2614
  },
2580
2615
  {
2581
2616
  code: 6001;
@@ -2701,6 +2736,11 @@ export type TriadProtocol = {
2701
2736
  code: 6025;
2702
2737
  name: 'orderIsFullFilled';
2703
2738
  msg: 'Order is full filled';
2739
+ },
2740
+ {
2741
+ code: 6026;
2742
+ name: 'overflow';
2743
+ msg: 'overflow';
2704
2744
  }
2705
2745
  ];
2706
2746
  types: [
@@ -3039,6 +3079,14 @@ export type TriadProtocol = {
3039
3079
  name: 'feeBps';
3040
3080
  type: 'u16';
3041
3081
  },
3082
+ {
3083
+ name: 'payoutFeeAvailable';
3084
+ type: 'u64';
3085
+ },
3086
+ {
3087
+ name: 'payoutFeeClaimed';
3088
+ type: 'u64';
3089
+ },
3042
3090
  {
3043
3091
  name: 'marketFeeAvailable';
3044
3092
  type: 'u64';
@@ -3154,11 +3202,11 @@ export type TriadProtocol = {
3154
3202
  type: 'u16';
3155
3203
  },
3156
3204
  {
3157
- name: 'creatorFeeAvailable';
3205
+ name: 'payoutFeeAvailable';
3158
3206
  type: 'u64';
3159
3207
  },
3160
3208
  {
3161
- name: 'creatorFeeClaimed';
3209
+ name: 'payoutFeeClaimed';
3162
3210
  type: 'u64';
3163
3211
  },
3164
3212
  {
@@ -3570,14 +3618,6 @@ export type TriadProtocol = {
3570
3618
  name: 'flopPrice';
3571
3619
  type: 'u64';
3572
3620
  },
3573
- {
3574
- name: 'direction';
3575
- type: {
3576
- defined: {
3577
- name: 'orderDirection';
3578
- };
3579
- };
3580
- },
3581
3621
  {
3582
3622
  name: 'timestamp';
3583
3623
  type: 'i64';
@@ -3618,10 +3658,6 @@ export type TriadProtocol = {
3618
3658
  type: {
3619
3659
  kind: 'struct';
3620
3660
  fields: [
3621
- {
3622
- name: 'stakeVault';
3623
- type: 'string';
3624
- },
3625
3661
  {
3626
3662
  name: 'name';
3627
3663
  type: 'string';
@@ -3786,6 +3822,36 @@ export type TriadProtocol = {
3786
3822
  ];
3787
3823
  };
3788
3824
  },
3825
+ {
3826
+ name: 'updateMarketArgs';
3827
+ type: {
3828
+ kind: 'struct';
3829
+ fields: [
3830
+ {
3831
+ name: 'marketEnd';
3832
+ type: {
3833
+ option: 'i64';
3834
+ };
3835
+ },
3836
+ {
3837
+ name: 'winningDirection';
3838
+ type: {
3839
+ option: {
3840
+ defined: {
3841
+ name: 'winningDirection';
3842
+ };
3843
+ };
3844
+ };
3845
+ },
3846
+ {
3847
+ name: 'allowPayout';
3848
+ type: {
3849
+ option: 'bool';
3850
+ };
3851
+ }
3852
+ ];
3853
+ };
3854
+ },
3789
3855
  {
3790
3856
  name: 'updateStakeVaultArgs';
3791
3857
  type: {
@@ -3802,10 +3868,6 @@ export type TriadProtocol = {
3802
3868
  type: {
3803
3869
  option: 'bool';
3804
3870
  };
3805
- },
3806
- {
3807
- name: 'stakeVault';
3808
- type: 'string';
3809
3871
  }
3810
3872
  ];
3811
3873
  };
@@ -1,13 +1,10 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
- export declare const STAKE_VAULT_NAME = "Triad Share 1";
3
2
  export declare const TRD_DECIMALS = 6;
4
3
  export declare const VERIFIER: PublicKey;
5
4
  export declare const TRD_MINT: PublicKey;
6
5
  export declare const TRIAD_ADMIN: PublicKey;
7
6
  export declare const SOL_MINT: PublicKey;
8
7
  export declare const TICKET_CORE_COLLECTION: PublicKey;
9
- export declare const VALENT_SPIN_NAME = "valent";
10
- export declare const WHEEL_MINT: PublicKey;
11
8
  export declare const POSEIDON_COLLECTION_SYMBOL = "$PSN";
12
9
  export declare const POSEIDON_CORE_COLLECTION: PublicKey;
13
10
  export declare const TICKET_COLLECTION_SYMBOL = "PTCKT";
@@ -1,16 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TICKET_COLLECTION_SYMBOL = exports.POSEIDON_CORE_COLLECTION = exports.POSEIDON_COLLECTION_SYMBOL = exports.WHEEL_MINT = exports.VALENT_SPIN_NAME = exports.TICKET_CORE_COLLECTION = exports.SOL_MINT = exports.TRIAD_ADMIN = exports.TRD_MINT = exports.VERIFIER = exports.TRD_DECIMALS = exports.STAKE_VAULT_NAME = void 0;
3
+ exports.TICKET_COLLECTION_SYMBOL = exports.POSEIDON_CORE_COLLECTION = exports.POSEIDON_COLLECTION_SYMBOL = exports.TICKET_CORE_COLLECTION = exports.SOL_MINT = exports.TRIAD_ADMIN = exports.TRD_MINT = exports.VERIFIER = exports.TRD_DECIMALS = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
- exports.STAKE_VAULT_NAME = 'Triad Share 1';
6
5
  exports.TRD_DECIMALS = 6;
7
6
  exports.VERIFIER = new web3_js_1.PublicKey('42n6BHufivUKrb5Bi6tXbMZvM8NHovrDLX1Rt5w2a919');
8
7
  exports.TRD_MINT = new web3_js_1.PublicKey('t3DohmswhKk94PPbPYwA6ZKACyY3y5kbcqeQerAJjmV');
9
8
  exports.TRIAD_ADMIN = new web3_js_1.PublicKey('82ppCojm3yrEKgdpH8B5AmBJTU1r1uAWXFWhxvPs9UCR');
10
9
  exports.SOL_MINT = new web3_js_1.PublicKey('So11111111111111111111111111111111111111112');
11
10
  exports.TICKET_CORE_COLLECTION = new web3_js_1.PublicKey('BaqopH1VXYUCT6VsojbTibVcd3k5jpGGT6296HFb6fVa');
12
- exports.VALENT_SPIN_NAME = 'valent';
13
- exports.WHEEL_MINT = new web3_js_1.PublicKey('tCMraBSGHeMcQS76hNnBhnfbMzrtnnT3nbt3vAnSCE2');
14
11
  exports.POSEIDON_COLLECTION_SYMBOL = '$PSN';
15
12
  exports.POSEIDON_CORE_COLLECTION = new web3_js_1.PublicKey('69CLccefLRmvDSAJP7Er632dvn878qkpdcnvq5ZUspSm');
16
13
  exports.TICKET_COLLECTION_SYMBOL = 'PTCKT';
@@ -1,13 +1,15 @@
1
1
  import { Stake, StakeVault } from './../types/stake';
2
2
  import { Market, Order, OrderDirection, OrderSide, OrderStatus, OrderType, UserTrade } from '../types/trade';
3
3
  import { PublicKey } from '@solana/web3.js';
4
+ import { IdlAccounts } from '@coral-xyz/anchor';
5
+ import { TriadProtocol } from '../types/triad_protocol';
4
6
  export declare const encodeString: (value: string, alloc?: number) => number[];
5
7
  export declare const decodeString: (bytes: number[]) => string;
6
- export declare const formatStakeVault: (stakeVault: any) => StakeVault;
7
- export declare const formatStake: (stake: any) => Stake;
8
- export declare const formatMarket: (account: any, address: PublicKey) => Market;
9
- export declare const formatOrder: (order: any, authority?: string) => Order;
10
- export declare const formatUserTrade: (account: any, publicKey: PublicKey) => UserTrade;
8
+ export declare const formatStakeVault: (stakeVault: IdlAccounts<TriadProtocol>['stakeVault']) => StakeVault;
9
+ export declare const formatStake: (stake: IdlAccounts<TriadProtocol>['stakeV2']) => Stake;
10
+ export declare const formatMarket: (account: IdlAccounts<TriadProtocol>['marketV2'], address: PublicKey) => Market;
11
+ export declare const formatUserTrade: (account: IdlAccounts<TriadProtocol>['userTrade'], publicKey: PublicKey) => UserTrade;
12
+ export declare const formatOrder: (order: IdlAccounts<TriadProtocol>['userTrade']['orders'][number], authority?: string) => Order;
11
13
  export declare const calculateStakeRewards: (stake: Stake) => number;
12
14
  export declare const getTokenProgram: (mint: PublicKey) => PublicKey;
13
15
  export declare const getOrderDirection: (direction: {