@triadxyz/triad-protocol 4.2.0 → 4.2.1

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.
@@ -0,0 +1,163 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import { Program } from '@coral-xyz/anchor';
3
+ import { TriadProtocol } from './types/triad_protocol';
4
+ import { RpcOptions, CreateMarketArgs, CreatePoolArgs, UpdateMarketWinningDirectionArgs, UpdateMarketPayoutArgs, UpdateMarketQuestionArgs, UpdateMarketEndArgs, CreateMarketPythArgs } from './types';
5
+ export default class Market {
6
+ private program;
7
+ private rpcOptions;
8
+ constructor(program: Program<TriadProtocol>, rpcOptions: RpcOptions);
9
+ /**
10
+ * Get Orders By Market ID
11
+ * @param marketId - The ID of the market
12
+ */
13
+ getOrdersByMarketId(marketId: number): Promise<import("./types").Order[]>;
14
+ /**
15
+ * Get All Pools
16
+ */
17
+ getAllPools(): Promise<import("./types").Pool[]>;
18
+ /**
19
+ * Get All Markets
20
+ */
21
+ getAllMarkets(): Promise<import("./types").Market[]>;
22
+ /**
23
+ * Get Pool By ID
24
+ * @param poolId - The ID of the pool
25
+ */
26
+ getPoolById(poolId: number): Promise<import("./types").Pool>;
27
+ /**
28
+ * Get Market By ID
29
+ * @param marketId - The ID of the market
30
+ */
31
+ getMarketById(marketId: number): Promise<import("./types").Market>;
32
+ /**
33
+ * Get Market By Address
34
+ * @param marketAddress - The address of the market
35
+ */
36
+ getMarketByAddress(marketAddress: PublicKey): Promise<import("./types").Market>;
37
+ /**
38
+ * Get Current Market ID
39
+ */
40
+ nextMarketId(): Promise<number>;
41
+ /**
42
+ * Get Next Pool ID
43
+ */
44
+ nextPoolId(): Promise<number>;
45
+ /**
46
+ * Create Market
47
+ * @param args.markets - Array of markets to create
48
+ * @param args.markets.marketId - Market ID
49
+ * @param args.markets.startTime - start time
50
+ * @param args.markets.endTime - end time
51
+ * @param args.markets.question - question (max 80 characters)
52
+ * @param args.markets.liquidityAtStart - liquidity at start
53
+ * @param args.markets.payoutFee - payout fee (to add affiliate system)
54
+ * @param args.customer - The customer of the market
55
+ * @param args.poolId - The ID of the pool
56
+ */
57
+ createMarket({ markets, customer, poolId }: CreateMarketArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
58
+ /**
59
+ * Create Pool
60
+ * @param poolId - The ID of the pool
61
+ * @param question - The question of the pool
62
+ * @param markets - The markets of the pool
63
+ * @param customer - The customer of the pool
64
+ * @param startTime - The start time of the pool
65
+ * @param endTime - The end time of the pool
66
+ * @param feeBps - The fee in basis points of the pool
67
+ * @param payoutFee - The payout fee of the pool
68
+ * @param isFast - Whether the pool is fast
69
+ * @param isPyth - Whether the pool is pyth
70
+ * @param feedId - The feed ID of the pool
71
+ */
72
+ createPool({ poolId, question, markets, customer, startTime, endTime, feeBps, payoutFee, isFast, isPyth, feedId }: CreatePoolArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
73
+ /**
74
+ * Update Market Winning Direction
75
+ * @param args.marketId - The ID of the Market
76
+ * @param args.winningDirection - The Winning Direction of the Market
77
+ * @param args.poolId - The ID of the Pool
78
+ * @param args.withPayout - Whether to allow the market to payout
79
+ */
80
+ updateMarketWinningDirection({ markets }: UpdateMarketWinningDirectionArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
81
+ /**
82
+ * Update Market Payout
83
+ * @param args.marketId - The ID of the market
84
+ * @param args.allowPayout - Whether to allow the market to payout
85
+ */
86
+ updateMarketPayout({ marketId, allowPayout }: UpdateMarketPayoutArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
87
+ /**
88
+ * Update Market End
89
+ * @param args.marketId - The ID of the market
90
+ * @param args.marketEnd - The end time of the market
91
+ */
92
+ updateMarketEnd({ marketId, marketEnd }: UpdateMarketEndArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
93
+ /**
94
+ * Update Market Question
95
+ * @param args.marketId - The ID of the market
96
+ * @param args.question - The question of the market
97
+ */
98
+ updateMarketQuestion({ marketId, question }: UpdateMarketQuestionArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
99
+ /**
100
+ * Close Order Book
101
+ * @param markets.id - Market IDs
102
+ * @param markets.authority - The authority of the market
103
+ */
104
+ closeOrderBook(markets: {
105
+ id: number;
106
+ authority: PublicKey;
107
+ }[]): Promise<string | import("@solana/web3.js").VersionedTransaction>;
108
+ /**
109
+ * Close IDLE Market
110
+ * @param markets.id - Market ID
111
+ * @param markets.authority - Market authority
112
+ * @param markets.mint - Market mint
113
+ */
114
+ closeIdleMarket(markets: {
115
+ id: number;
116
+ authority: PublicKey;
117
+ mint: PublicKey;
118
+ }[]): Promise<string | import("@solana/web3.js").VersionedTransaction>;
119
+ /**
120
+ * Update Pool Question
121
+ * @param poolId - Pool ID
122
+ * @param question - Question
123
+ */
124
+ updatePoolQuestion(poolId: number, question: string): Promise<string | import("@solana/web3.js").VersionedTransaction>;
125
+ /**
126
+ * Create Market Pyth
127
+ * @param args.markets - Array of markets to create
128
+ * @param args.markets.marketId - Market ID
129
+ * @param args.markets.resolveIn - Time to add for resolver the market in seconds
130
+ * @param args.customer - The customer of the market
131
+ * @param args.poolId - The ID of the pool
132
+ */
133
+ createMarketPyth({ markets }: CreateMarketPythArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
134
+ /**
135
+ * Create and Resolve Pyth Market
136
+ * @param toResolve - Market to resolve
137
+ * @param toResolve.marketId - Market ID
138
+ * @param toResolve.winningDirection - Winning direction
139
+ * @param toResolve.poolId - Pool ID
140
+ * @param toResolve.withPayout - Whether to update market payout
141
+ * @param market - Market to create
142
+ * @param market.marketId - Market ID
143
+ * @param market.resolveIn - Time to add for resolver the market in seconds
144
+ * @param market.direction - Direction of the market
145
+ * @param market.customer - The customer of the market
146
+ * @param market.poolId - The ID of the pool
147
+ */
148
+ createAndResolvePythMarket(toResolve: UpdateMarketWinningDirectionArgs['markets'][0], market: CreateMarketPythArgs['markets'][0]): Promise<string | import("@solana/web3.js").VersionedTransaction>;
149
+ /**
150
+ * Create and Resolve Market
151
+ * @param toResolve - Market to resolve
152
+ * @param toResolve.marketId - Market ID
153
+ * @param toResolve.winningDirection - Winning direction
154
+ * @param toResolve.withPayout - Whether to update market payout
155
+ * @param market - Market to create
156
+ * @param market.marketId - Market ID
157
+ * @param market.resolveIn - Time to add for resolver the market in seconds
158
+ * @param market.direction - Direction of the market
159
+ * @param market.customer - The customer of the market
160
+ * @param market.poolId - The ID of the pool
161
+ */
162
+ createAndResolveMarket(toResolve: UpdateMarketWinningDirectionArgs['markets'][0], market: CreateMarketArgs['markets'][0], customer: PublicKey): Promise<string | import("@solana/web3.js").VersionedTransaction>;
163
+ }