@triadxyz/triad-protocol 4.2.0 → 4.2.2
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 +5 -188
- package/dist/index.js +9 -630
- package/dist/market.d.ts +163 -0
- package/dist/market.js +571 -0
- package/dist/poseidon.d.ts +2 -4
- package/dist/poseidon.js +10 -16
- package/dist/predictor.d.ts +32 -1
- package/dist/predictor.js +99 -15
- package/dist/stake.d.ts +0 -15
- package/dist/stake.js +0 -60
- package/dist/trade.d.ts +7 -6
- package/dist/trade.js +44 -54
- package/dist/types/idl_triad_protocol.json +511 -900
- package/dist/types/index.d.ts +3 -8
- package/dist/types/predictor.d.ts +6 -0
- package/dist/types/trade.d.ts +7 -2
- package/dist/types/triad_protocol.d.ts +619 -1388
- package/dist/utils/helpers.d.ts +4 -4
- package/dist/utils/helpers.js +10 -13
- package/dist/utils/sendVersionedTransaction.js +3 -11
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { Connection
|
|
1
|
+
import { Connection } from '@solana/web3.js';
|
|
2
2
|
import { AnchorProvider, Program, Wallet } from '@coral-xyz/anchor';
|
|
3
3
|
import { TriadProtocol as TriadProtocolIDL } from './types/triad_protocol';
|
|
4
|
-
import { RpcOptions
|
|
4
|
+
import { RpcOptions } from './types';
|
|
5
5
|
import Stake from './stake';
|
|
6
6
|
import Poseidon from './poseidon';
|
|
7
7
|
import Predictor from './predictor';
|
|
8
8
|
import Trade from './trade';
|
|
9
9
|
import Customer from './customer';
|
|
10
|
+
import Market from './market';
|
|
10
11
|
export * from './types';
|
|
11
12
|
export * from './types/predictor';
|
|
12
13
|
export * from './types/stake';
|
|
@@ -27,196 +28,12 @@ export default class TriadProtocol {
|
|
|
27
28
|
predictor: Predictor;
|
|
28
29
|
trade: Trade;
|
|
29
30
|
customer: Customer;
|
|
31
|
+
market: Market;
|
|
30
32
|
constructor(connection: Connection, wallet: Wallet, rpcOptions: RpcOptions);
|
|
31
|
-
|
|
32
|
-
* Get User Orders
|
|
33
|
-
* @param wallet - User wallet PublicKey
|
|
34
|
-
*/
|
|
35
|
-
getUserOrders(wallet: PublicKey): Promise<import("./types").Order[]>;
|
|
36
|
-
/**
|
|
37
|
-
* Get Orders By Market ID
|
|
38
|
-
* @param marketId - The ID of the market
|
|
39
|
-
*/
|
|
40
|
-
getOrdersByMarketId(marketId: number): Promise<import("./types").Order[]>;
|
|
41
|
-
/**
|
|
42
|
-
* Get User Orders By Market ID
|
|
43
|
-
* @param wallet - User wallet PublicKey
|
|
44
|
-
* @param marketId - The ID of the market
|
|
45
|
-
*/
|
|
46
|
-
getUserOrdersByMarketId(wallet: PublicKey, marketId: number): Promise<import("./types").Order[]>;
|
|
47
|
-
/**
|
|
48
|
-
* Get all User Book Orders
|
|
49
|
-
* @param wallet - User wallet PublicKey
|
|
50
|
-
*/
|
|
51
|
-
getUserBookOrders(wallet: PublicKey): Promise<import("./types").BookOrder[]>;
|
|
52
|
-
/**
|
|
53
|
-
* Get User Book Orders By Market ID
|
|
54
|
-
*/
|
|
55
|
-
getUserBookOrdersByMarketId(wallet: PublicKey, marketId: number): Promise<import("./types").BookOrder[]>;
|
|
56
|
-
/**
|
|
57
|
-
* Get All Pools
|
|
58
|
-
*/
|
|
59
|
-
getAllPools(): Promise<import("./types").Pool[]>;
|
|
60
|
-
/**
|
|
61
|
-
* Get All Markets
|
|
62
|
-
*/
|
|
63
|
-
getAllMarkets(): Promise<import("./types").Market[]>;
|
|
64
|
-
/**
|
|
65
|
-
* Get Pool By ID
|
|
66
|
-
* @param poolId - The ID of the pool
|
|
67
|
-
*/
|
|
68
|
-
getPoolById(poolId: number): Promise<import("./types").Pool>;
|
|
69
|
-
/**
|
|
70
|
-
* Get Market By ID
|
|
71
|
-
* @param marketId - The ID of the market
|
|
72
|
-
*/
|
|
73
|
-
getMarketById(marketId: number): Promise<import("./types").Market>;
|
|
74
|
-
/**
|
|
75
|
-
* Get Market By Address
|
|
76
|
-
* @param marketAddress - The address of the market
|
|
77
|
-
*/
|
|
78
|
-
getMarketByAddress(marketAddress: PublicKey): Promise<import("./types").Market>;
|
|
79
|
-
/**
|
|
80
|
-
* Get Current Market ID
|
|
81
|
-
*/
|
|
82
|
-
nextMarketId(): Promise<number>;
|
|
83
|
-
/**
|
|
84
|
-
* Get Next Pool ID
|
|
85
|
-
*/
|
|
86
|
-
nextPoolId(): Promise<number>;
|
|
87
|
-
/**
|
|
88
|
-
* Create Market
|
|
89
|
-
* @param args.markets - Array of markets to create
|
|
90
|
-
* @param args.markets.marketId - Market ID
|
|
91
|
-
* @param args.markets.startTime - start time
|
|
92
|
-
* @param args.markets.endTime - end time
|
|
93
|
-
* @param args.markets.question - question (max 80 characters)
|
|
94
|
-
* @param args.markets.liquidityAtStart - liquidity at start
|
|
95
|
-
* @param args.markets.payoutFee - payout fee (to add affiliate system)
|
|
96
|
-
* @param args.customer - The customer of the market
|
|
97
|
-
* @param args.poolId - The ID of the pool
|
|
98
|
-
*/
|
|
99
|
-
createMarket({ markets, customer, poolId }: CreateMarketArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
100
|
-
/**
|
|
101
|
-
* Create Pool
|
|
102
|
-
* @param poolId - The ID of the pool
|
|
103
|
-
* @param question - The question of the pool
|
|
104
|
-
* @param markets - The markets of the pool
|
|
105
|
-
* @param customer - The customer of the pool
|
|
106
|
-
* @param startTime - The start time of the pool
|
|
107
|
-
* @param endTime - The end time of the pool
|
|
108
|
-
* @param feeBps - The fee in basis points of the pool
|
|
109
|
-
* @param payoutFee - The payout fee of the pool
|
|
110
|
-
* @param isFast - Whether the pool is fast
|
|
111
|
-
* @param isPyth - Whether the pool is pyth
|
|
112
|
-
* @param feedId - The feed ID of the pool
|
|
113
|
-
*/
|
|
114
|
-
createPool({ poolId, question, markets, customer, startTime, endTime, feeBps, payoutFee, isFast, isPyth, feedId }: CreatePoolArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
115
|
-
/**
|
|
116
|
-
* Update Market Winning Direction
|
|
117
|
-
* @param args.marketId - The ID of the Market
|
|
118
|
-
* @param args.winningDirection - The Winning Direction of the Market
|
|
119
|
-
* @param args.poolId - The ID of the Pool
|
|
120
|
-
* @param args.withPayout - Whether to allow the market to payout
|
|
121
|
-
*/
|
|
122
|
-
updateMarketWinningDirection({ markets }: UpdateMarketWinningDirectionArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
123
|
-
/**
|
|
124
|
-
* Update Market Payout
|
|
125
|
-
* @param args.marketId - The ID of the market
|
|
126
|
-
* @param args.allowPayout - Whether to allow the market to payout
|
|
127
|
-
*/
|
|
128
|
-
updateMarketPayout({ marketId, allowPayout }: UpdateMarketPayoutArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
129
|
-
/**
|
|
130
|
-
* Update Market End
|
|
131
|
-
* @param args.marketId - The ID of the market
|
|
132
|
-
* @param args.marketEnd - The end time of the market
|
|
133
|
-
*/
|
|
134
|
-
updateMarketEnd({ marketId, marketEnd }: UpdateMarketEndArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
135
|
-
/**
|
|
136
|
-
* Update Market Question
|
|
137
|
-
* @param args.marketId - The ID of the market
|
|
138
|
-
* @param args.question - The question of the market
|
|
139
|
-
*/
|
|
140
|
-
updateMarketQuestion({ marketId, question }: UpdateMarketQuestionArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
141
|
-
/**
|
|
142
|
-
* Collect Market Fee
|
|
143
|
-
* @param args.markets - The markets to collect the fee from
|
|
144
|
-
* @param args.markets.marketAddress - The address of the market
|
|
145
|
-
* @param args.markets.customerId - The ID of the customer
|
|
146
|
-
* @param args.markets.customerFeeRecipient - The address of the customer fee recipient
|
|
147
|
-
*/
|
|
148
|
-
collectMarketFee(markets: {
|
|
149
|
-
marketAddress: PublicKey;
|
|
150
|
-
customerId: number;
|
|
151
|
-
customerFeeRecipient: PublicKey;
|
|
152
|
-
}[]): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
153
|
-
/**
|
|
154
|
-
* Close Order Book
|
|
155
|
-
* @param markets.id - Market IDs
|
|
156
|
-
* @param markets.authority - The authority of the market
|
|
157
|
-
*/
|
|
158
|
-
closeOrderBook(markets: {
|
|
159
|
-
id: number;
|
|
160
|
-
authority: PublicKey;
|
|
161
|
-
}[]): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
162
|
-
/**
|
|
163
|
-
* Close IDLE Market
|
|
164
|
-
* @param markets.id - Market ID
|
|
165
|
-
* @param markets.authority - Market authority
|
|
166
|
-
* @param markets.mint - Market mint
|
|
167
|
-
*/
|
|
168
|
-
closeIdleMarket(markets: {
|
|
169
|
-
id: number;
|
|
170
|
-
authority: PublicKey;
|
|
171
|
-
mint: PublicKey;
|
|
172
|
-
}[]): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
173
|
-
/**
|
|
174
|
-
* Update Pool Question
|
|
175
|
-
* @param poolId - Pool ID
|
|
176
|
-
* @param question - Question
|
|
177
|
-
*/
|
|
178
|
-
updatePoolQuestion(poolId: number, question: string): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
179
|
-
/**
|
|
180
|
-
* Create Market Pyth
|
|
181
|
-
* @param args.markets - Array of markets to create
|
|
182
|
-
* @param args.markets.marketId - Market ID
|
|
183
|
-
* @param args.markets.resolveIn - Time to add for resolver the market in seconds
|
|
184
|
-
* @param args.customer - The customer of the market
|
|
185
|
-
* @param args.poolId - The ID of the pool
|
|
186
|
-
*/
|
|
187
|
-
createMarketPyth({ markets }: CreateMarketPythArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
33
|
+
getPriorityFee(): Promise<void>;
|
|
188
34
|
/**
|
|
189
35
|
* Burn Triad
|
|
190
36
|
* @param amount - Amount to burn
|
|
191
37
|
*/
|
|
192
38
|
burnTriad(amount: number): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
193
|
-
/**
|
|
194
|
-
* Create and Resolve Pyth Market
|
|
195
|
-
* @param toResolve - Market to resolve
|
|
196
|
-
* @param toResolve.marketId - Market ID
|
|
197
|
-
* @param toResolve.winningDirection - Winning direction
|
|
198
|
-
* @param toResolve.poolId - Pool ID
|
|
199
|
-
* @param toResolve.withPayout - Whether to update market payout
|
|
200
|
-
* @param market - Market to create
|
|
201
|
-
* @param market.marketId - Market ID
|
|
202
|
-
* @param market.resolveIn - Time to add for resolver the market in seconds
|
|
203
|
-
* @param market.direction - Direction of the market
|
|
204
|
-
* @param market.customer - The customer of the market
|
|
205
|
-
* @param market.poolId - The ID of the pool
|
|
206
|
-
*/
|
|
207
|
-
createAndResolvePythMarket(toResolve: UpdateMarketWinningDirectionArgs['markets'][0], market: CreateMarketPythArgs['markets'][0]): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
208
|
-
/**
|
|
209
|
-
* Create and Resolve Market
|
|
210
|
-
* @param toResolve - Market to resolve
|
|
211
|
-
* @param toResolve.marketId - Market ID
|
|
212
|
-
* @param toResolve.winningDirection - Winning direction
|
|
213
|
-
* @param toResolve.withPayout - Whether to update market payout
|
|
214
|
-
* @param market - Market to create
|
|
215
|
-
* @param market.marketId - Market ID
|
|
216
|
-
* @param market.resolveIn - Time to add for resolver the market in seconds
|
|
217
|
-
* @param market.direction - Direction of the market
|
|
218
|
-
* @param market.customer - The customer of the market
|
|
219
|
-
* @param market.poolId - The ID of the pool
|
|
220
|
-
*/
|
|
221
|
-
createAndResolveMarket(toResolve: UpdateMarketWinningDirectionArgs['markets'][0], market: CreateMarketArgs['markets'][0], customer: PublicKey): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
222
39
|
}
|