pnp-sdk 0.2.9 → 0.2.11
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/chunk-ITEBWEGS.js +12545 -0
- package/dist/chunk-ITEBWEGS.js.map +1 -0
- package/dist/cli.cjs +12743 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +310 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +12567 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1319 -0
- package/dist/index.d.ts +1319 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1319 @@
|
|
|
1
|
+
import * as _solana_web3_js from '@solana/web3.js';
|
|
2
|
+
import { Connection, PublicKey, Commitment as Commitment$1, Transaction, VersionedTransaction, Keypair } from '@solana/web3.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import * as anchor from '@coral-xyz/anchor';
|
|
5
|
+
import { Idl } from '@coral-xyz/anchor';
|
|
6
|
+
import { BN } from 'bn.js';
|
|
7
|
+
|
|
8
|
+
type Commitment = "processed" | "confirmed" | "finalized";
|
|
9
|
+
interface Logger {
|
|
10
|
+
debug?: (...args: any[]) => void;
|
|
11
|
+
info?: (...args: any[]) => void;
|
|
12
|
+
warn?: (...args: any[]) => void;
|
|
13
|
+
error?: (...args: any[]) => void;
|
|
14
|
+
}
|
|
15
|
+
interface SdkConfig {
|
|
16
|
+
rpcUrl: string;
|
|
17
|
+
commitment?: Commitment;
|
|
18
|
+
httpHeaders?: Record<string, string>;
|
|
19
|
+
priorityFeeMicroLamports?: number;
|
|
20
|
+
computeUnitLimit?: number;
|
|
21
|
+
computeUnitPriceMicroLamports?: number;
|
|
22
|
+
addressLookupTables?: unknown[];
|
|
23
|
+
logger?: Logger;
|
|
24
|
+
}
|
|
25
|
+
declare class SdkError extends Error {
|
|
26
|
+
code: string;
|
|
27
|
+
details?: unknown;
|
|
28
|
+
constructor(code: string, message: string, details?: unknown);
|
|
29
|
+
}
|
|
30
|
+
declare class ValidationError extends SdkError {
|
|
31
|
+
constructor(message: string, details?: unknown);
|
|
32
|
+
}
|
|
33
|
+
declare class TransportError extends SdkError {
|
|
34
|
+
constructor(message: string, details?: unknown);
|
|
35
|
+
}
|
|
36
|
+
declare class ProgramError extends SdkError {
|
|
37
|
+
programErrorCode?: number;
|
|
38
|
+
logs?: string[];
|
|
39
|
+
constructor(message: string, details?: unknown, programErrorCode?: number, logs?: string[]);
|
|
40
|
+
}
|
|
41
|
+
type PubkeyLike = string;
|
|
42
|
+
type U64Like = bigint | number | string;
|
|
43
|
+
type WinningTokenLike = "none" | "yes" | "no" | number | Record<string, unknown> | null;
|
|
44
|
+
interface MarketType {
|
|
45
|
+
id: U64Like;
|
|
46
|
+
resolved: boolean;
|
|
47
|
+
market_reserves: U64Like;
|
|
48
|
+
collateral_token: PubkeyLike;
|
|
49
|
+
winning_token_id: WinningTokenLike;
|
|
50
|
+
yes_token_mint: PubkeyLike;
|
|
51
|
+
no_token_mint: PubkeyLike;
|
|
52
|
+
yes_token_supply_minted: U64Like;
|
|
53
|
+
no_token_supply_minted: U64Like;
|
|
54
|
+
creator: PubkeyLike;
|
|
55
|
+
creator_fee_treasury: PubkeyLike;
|
|
56
|
+
question: string;
|
|
57
|
+
initial_liquidity: U64Like;
|
|
58
|
+
end_time: U64Like;
|
|
59
|
+
bump: number;
|
|
60
|
+
creation_time: U64Like;
|
|
61
|
+
resolvable: boolean;
|
|
62
|
+
force_resolve: boolean;
|
|
63
|
+
version: number;
|
|
64
|
+
/** Amount of YES tokens locked in vault for creator (set during setMarketResolvableV2) */
|
|
65
|
+
creator_yes_locked: U64Like;
|
|
66
|
+
/** Amount of NO tokens locked in vault for creator (set during setMarketResolvableV2) */
|
|
67
|
+
creator_no_locked: U64Like;
|
|
68
|
+
/** Whether the creator has already claimed locked liquidity */
|
|
69
|
+
creator_liquidity_claimed: boolean;
|
|
70
|
+
}
|
|
71
|
+
interface MarketsResponse {
|
|
72
|
+
count: number;
|
|
73
|
+
data: Array<{
|
|
74
|
+
publicKey: string;
|
|
75
|
+
account: MarketType;
|
|
76
|
+
}>;
|
|
77
|
+
}
|
|
78
|
+
interface GlobalConfigType {
|
|
79
|
+
admin: PubkeyLike;
|
|
80
|
+
oracle_program: PubkeyLike;
|
|
81
|
+
fee: U64Like;
|
|
82
|
+
creator_fee: U64Like;
|
|
83
|
+
bump: number;
|
|
84
|
+
yes_global_metadata: string;
|
|
85
|
+
no_global_metadata: string;
|
|
86
|
+
collateral_token_mint: PubkeyLike;
|
|
87
|
+
global_id: U64Like;
|
|
88
|
+
min_liquidity: U64Like;
|
|
89
|
+
buffer_period: U64Like;
|
|
90
|
+
burn_fee: U64Like;
|
|
91
|
+
trading_paused: boolean;
|
|
92
|
+
}
|
|
93
|
+
type TokenSideLike = "yes" | "no" | number | Record<string, unknown>;
|
|
94
|
+
interface MarketV3Type {
|
|
95
|
+
id: U64Like;
|
|
96
|
+
resolved: boolean;
|
|
97
|
+
/** Total collateral in YES pot */
|
|
98
|
+
yes_pot_reserve: U64Like;
|
|
99
|
+
/** Total collateral in NO pot */
|
|
100
|
+
no_pot_reserve: U64Like;
|
|
101
|
+
/** Market creator */
|
|
102
|
+
creator: PubkeyLike;
|
|
103
|
+
/** Which side creator is backing */
|
|
104
|
+
creator_side: TokenSideLike;
|
|
105
|
+
/** Initial amount creator deposited */
|
|
106
|
+
creator_initial_amount: U64Like;
|
|
107
|
+
/** Maximum liquidity allowed on creator's side */
|
|
108
|
+
creator_side_cap: U64Like;
|
|
109
|
+
/** Total YES tokens issued */
|
|
110
|
+
yes_tokens_issued: U64Like;
|
|
111
|
+
/** Total NO tokens issued */
|
|
112
|
+
no_tokens_issued: U64Like;
|
|
113
|
+
/** Collateral token mint */
|
|
114
|
+
collateral_token: PubkeyLike;
|
|
115
|
+
/** YES token mint */
|
|
116
|
+
yes_token_mint: PubkeyLike;
|
|
117
|
+
/** NO token mint */
|
|
118
|
+
no_token_mint: PubkeyLike;
|
|
119
|
+
/** Winning side after resolution */
|
|
120
|
+
winning_token_id: WinningTokenLike;
|
|
121
|
+
/** Creator's fee treasury */
|
|
122
|
+
creator_fee_treasury: PubkeyLike;
|
|
123
|
+
/** Market question */
|
|
124
|
+
question: string;
|
|
125
|
+
/** Market end timestamp */
|
|
126
|
+
end_time: U64Like;
|
|
127
|
+
/** Market creation timestamp */
|
|
128
|
+
creation_time: U64Like;
|
|
129
|
+
/** Whether market is resolvable (set by oracle) */
|
|
130
|
+
resolvable: boolean;
|
|
131
|
+
/** PDA bump */
|
|
132
|
+
bump: number;
|
|
133
|
+
/** Maximum pot ratio allowed (basis points, e.g. 10000 = 1:1, 100000 = 10:1) */
|
|
134
|
+
max_pot_ratio: number;
|
|
135
|
+
}
|
|
136
|
+
interface MarketExtensionType {
|
|
137
|
+
/** Market ID this extension belongs to */
|
|
138
|
+
market_id: U64Like;
|
|
139
|
+
/** Initial YES odds in basis points (e.g. 7000 = 70% YES) */
|
|
140
|
+
initial_yes_odds_bps: number;
|
|
141
|
+
/** Custom oracle for this market */
|
|
142
|
+
oracle: PubkeyLike;
|
|
143
|
+
/** PDA bump */
|
|
144
|
+
bump: number;
|
|
145
|
+
}
|
|
146
|
+
interface MarketV3ExtensionType {
|
|
147
|
+
/** Market ID this extension belongs to */
|
|
148
|
+
market_id: U64Like;
|
|
149
|
+
/** Odds in basis points for creator's side (e.g. 7000 = 70%) */
|
|
150
|
+
odds_bps: number;
|
|
151
|
+
/** Custom oracle for this market */
|
|
152
|
+
oracle: PubkeyLike;
|
|
153
|
+
/** PDA bump */
|
|
154
|
+
bump: number;
|
|
155
|
+
}
|
|
156
|
+
interface SettlementCriteria {
|
|
157
|
+
category: string;
|
|
158
|
+
reasoning: string;
|
|
159
|
+
resolvable: boolean;
|
|
160
|
+
resolution_sources: string[];
|
|
161
|
+
settlement_criteria: string;
|
|
162
|
+
suggested_improvements: string;
|
|
163
|
+
}
|
|
164
|
+
interface SettlementData {
|
|
165
|
+
answer: string;
|
|
166
|
+
reasoning: string;
|
|
167
|
+
resolved?: boolean;
|
|
168
|
+
winning_token_id?: string;
|
|
169
|
+
resolution_time?: string;
|
|
170
|
+
settlement_description?: string;
|
|
171
|
+
resolution_source?: string;
|
|
172
|
+
}
|
|
173
|
+
interface MarketMeta {
|
|
174
|
+
market: string;
|
|
175
|
+
market_volume: number;
|
|
176
|
+
image: string | null;
|
|
177
|
+
initial_liquidity: number;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Web3-agnostic shape for the result of a P2P market operation.
|
|
181
|
+
* Note: The Anchor-based module returns actual PublicKey instances at runtime.
|
|
182
|
+
* When exposing results at the SDK boundary, prefer serializing these to base58 strings to match P2PMarketResponse.
|
|
183
|
+
*/
|
|
184
|
+
interface P2PMarketResponse {
|
|
185
|
+
signature: string;
|
|
186
|
+
market: PubkeyLike;
|
|
187
|
+
yesTokenMint: PubkeyLike;
|
|
188
|
+
noTokenMint: PubkeyLike;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
declare class Client {
|
|
192
|
+
readonly connection: Connection;
|
|
193
|
+
readonly programId: PublicKey;
|
|
194
|
+
readonly commitment: Commitment$1;
|
|
195
|
+
readonly logger: Logger;
|
|
196
|
+
readonly isDevnet: boolean;
|
|
197
|
+
constructor(cfg: SdkConfig);
|
|
198
|
+
fail(code: string, message: string, details?: unknown): TransportError;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
type AccountsMap = Record<string, PublicKey>;
|
|
202
|
+
|
|
203
|
+
type CreateMarketArgs = {
|
|
204
|
+
question: string;
|
|
205
|
+
initial_liquidity: bigint;
|
|
206
|
+
end_time: bigint;
|
|
207
|
+
creator?: PublicKey;
|
|
208
|
+
yes_odds_bps?: number;
|
|
209
|
+
oracle?: PublicKey;
|
|
210
|
+
};
|
|
211
|
+
type MintDecisionTokensArgs = {
|
|
212
|
+
amount: bigint;
|
|
213
|
+
buy_yes_token: boolean;
|
|
214
|
+
minimum_out: bigint;
|
|
215
|
+
};
|
|
216
|
+
type BurnDecisionTokensArgs = {
|
|
217
|
+
amount: bigint;
|
|
218
|
+
burn_yes_token: boolean;
|
|
219
|
+
};
|
|
220
|
+
type SetMarketResolvableV2Args = {
|
|
221
|
+
market_id: bigint;
|
|
222
|
+
resolvable: boolean;
|
|
223
|
+
force_resolve?: boolean;
|
|
224
|
+
};
|
|
225
|
+
type SetMarketResolvableV3Args = {
|
|
226
|
+
resolvable: boolean;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
interface SignerLike {
|
|
230
|
+
publicKey: PublicKey;
|
|
231
|
+
signTransaction(tx: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
232
|
+
signAllTransactions?(txs: (Transaction | VersionedTransaction)[]): Promise<(Transaction | VersionedTransaction)[]>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
declare const CreateMarketSchema: z.ZodObject<{
|
|
236
|
+
baseMint: z.ZodOptional<z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>>;
|
|
237
|
+
quoteMint: z.ZodOptional<z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>>;
|
|
238
|
+
question: z.ZodOptional<z.ZodString>;
|
|
239
|
+
initialLiquidity: z.ZodOptional<z.ZodBigInt>;
|
|
240
|
+
endTime: z.ZodOptional<z.ZodBigInt>;
|
|
241
|
+
tickSize: z.ZodOptional<z.ZodBigInt>;
|
|
242
|
+
lotSize: z.ZodOptional<z.ZodBigInt>;
|
|
243
|
+
}, "strip", z.ZodTypeAny, {
|
|
244
|
+
question?: string | undefined;
|
|
245
|
+
initialLiquidity?: bigint | undefined;
|
|
246
|
+
endTime?: bigint | undefined;
|
|
247
|
+
baseMint?: PublicKey | undefined;
|
|
248
|
+
quoteMint?: PublicKey | undefined;
|
|
249
|
+
tickSize?: bigint | undefined;
|
|
250
|
+
lotSize?: bigint | undefined;
|
|
251
|
+
}, {
|
|
252
|
+
question?: string | undefined;
|
|
253
|
+
initialLiquidity?: bigint | undefined;
|
|
254
|
+
endTime?: bigint | undefined;
|
|
255
|
+
baseMint?: PublicKey | undefined;
|
|
256
|
+
quoteMint?: PublicKey | undefined;
|
|
257
|
+
tickSize?: bigint | undefined;
|
|
258
|
+
lotSize?: bigint | undefined;
|
|
259
|
+
}>;
|
|
260
|
+
declare class MarketModule {
|
|
261
|
+
private readonly client;
|
|
262
|
+
private readonly signer;
|
|
263
|
+
constructor(client: Client, signer: SignerLike);
|
|
264
|
+
createMarket(params: z.infer<typeof CreateMarketSchema>): Promise<{
|
|
265
|
+
signature: string | undefined;
|
|
266
|
+
market: PublicKey;
|
|
267
|
+
}>;
|
|
268
|
+
createMarketIdl(accounts: AccountsMap, args: CreateMarketArgs): Promise<{
|
|
269
|
+
signature: string | undefined;
|
|
270
|
+
}>;
|
|
271
|
+
createMarketDerived(params: {
|
|
272
|
+
question: string;
|
|
273
|
+
initialLiquidity: bigint;
|
|
274
|
+
endTime: bigint;
|
|
275
|
+
collateralMint?: PublicKey;
|
|
276
|
+
}): Promise<{
|
|
277
|
+
signature: string | undefined;
|
|
278
|
+
market: PublicKey;
|
|
279
|
+
}>;
|
|
280
|
+
fetchGlobalConfig(): Promise<{
|
|
281
|
+
publicKey: PublicKey;
|
|
282
|
+
account: any;
|
|
283
|
+
}>;
|
|
284
|
+
fetchMarket(market: PublicKey): Promise<{
|
|
285
|
+
publicKey: PublicKey;
|
|
286
|
+
account: any;
|
|
287
|
+
}>;
|
|
288
|
+
/**
|
|
289
|
+
* ⚠️ DEVNET/TESTING ONLY - This function is for devnet and testing purposes only.
|
|
290
|
+
* It will NOT work on mainnet. Use this only for development and testing.
|
|
291
|
+
*/
|
|
292
|
+
setMarketResolvableIdl(accounts: AccountsMap, args: SetMarketResolvableV2Args): Promise<{
|
|
293
|
+
signature: string;
|
|
294
|
+
}>;
|
|
295
|
+
/**
|
|
296
|
+
* Set market resolvable status for V2 markets.
|
|
297
|
+
*
|
|
298
|
+
* ⚠️ DEVNET/TESTING ONLY - This function is for devnet and testing purposes only.
|
|
299
|
+
* It will NOT work on mainnet. Use this only for development and testing.
|
|
300
|
+
*
|
|
301
|
+
* @param params - Parameters for setting market resolvable status
|
|
302
|
+
* @param params.market - Market public key
|
|
303
|
+
* @param params.resolvable - New resolvable status (true/false)
|
|
304
|
+
* @param params.forceResolve - Optional: force resolve (allow immediate refunds)
|
|
305
|
+
* @returns Transaction signature
|
|
306
|
+
*/
|
|
307
|
+
setMarketResolvable(params: {
|
|
308
|
+
market: PublicKey;
|
|
309
|
+
resolvable: boolean;
|
|
310
|
+
forceResolve?: boolean;
|
|
311
|
+
}): Promise<{
|
|
312
|
+
signature: string;
|
|
313
|
+
}>;
|
|
314
|
+
/**
|
|
315
|
+
* ⚠️ DEVNET/TESTING ONLY - This function is for devnet and testing purposes only.
|
|
316
|
+
* It will NOT work on mainnet. Use this only for development and testing.
|
|
317
|
+
*/
|
|
318
|
+
setMarketResolvableP2pIdl(accounts: AccountsMap, args: SetMarketResolvableV3Args): Promise<{
|
|
319
|
+
signature: string;
|
|
320
|
+
}>;
|
|
321
|
+
/**
|
|
322
|
+
* Set market resolvable status for V3/P2P markets.
|
|
323
|
+
*
|
|
324
|
+
* ⚠️ DEVNET/TESTING ONLY - This function is for devnet and testing purposes only.
|
|
325
|
+
* It will NOT work on mainnet. Use this only for development and testing.
|
|
326
|
+
*
|
|
327
|
+
* @param params - Parameters for setting market resolvable status
|
|
328
|
+
* @param params.market - Market public key
|
|
329
|
+
* @param params.resolvable - New resolvable status (true/false)
|
|
330
|
+
* @returns Transaction signature
|
|
331
|
+
*/
|
|
332
|
+
setMarketResolvableP2p(params: {
|
|
333
|
+
market: PublicKey;
|
|
334
|
+
resolvable: boolean;
|
|
335
|
+
}): Promise<{
|
|
336
|
+
signature: string;
|
|
337
|
+
}>;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
declare const TradeSchema: z.ZodObject<{
|
|
341
|
+
market: z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>;
|
|
342
|
+
side: z.ZodUnion<[z.ZodLiteral<"buy">, z.ZodLiteral<"sell">]>;
|
|
343
|
+
price: z.ZodBigInt;
|
|
344
|
+
size: z.ZodBigInt;
|
|
345
|
+
}, "strip", z.ZodTypeAny, {
|
|
346
|
+
market: PublicKey;
|
|
347
|
+
side: "buy" | "sell";
|
|
348
|
+
price: bigint;
|
|
349
|
+
size: bigint;
|
|
350
|
+
}, {
|
|
351
|
+
market: PublicKey;
|
|
352
|
+
side: "buy" | "sell";
|
|
353
|
+
price: bigint;
|
|
354
|
+
size: bigint;
|
|
355
|
+
}>;
|
|
356
|
+
declare class TradingModule {
|
|
357
|
+
private readonly client;
|
|
358
|
+
private readonly signer;
|
|
359
|
+
constructor(client: Client, signer: SignerLike);
|
|
360
|
+
private static readonly MARKET_CREATED_V3_DISCRIMINATOR;
|
|
361
|
+
private decodeMarketAny;
|
|
362
|
+
trade(params: z.infer<typeof TradeSchema>): Promise<{
|
|
363
|
+
signature: string | undefined;
|
|
364
|
+
}>;
|
|
365
|
+
mintDecisionTokens(accounts: AccountsMap, args: MintDecisionTokensArgs): Promise<{
|
|
366
|
+
signature: string | undefined;
|
|
367
|
+
}>;
|
|
368
|
+
burnDecisionTokens(accounts: AccountsMap, args: BurnDecisionTokensArgs): Promise<{
|
|
369
|
+
signature: string | undefined;
|
|
370
|
+
}>;
|
|
371
|
+
mintDecisionTokensDerived(params: {
|
|
372
|
+
market: PublicKey;
|
|
373
|
+
amount: bigint;
|
|
374
|
+
buyYesToken: boolean;
|
|
375
|
+
minimumOut: bigint;
|
|
376
|
+
}): Promise<{
|
|
377
|
+
signature: string | undefined;
|
|
378
|
+
}>;
|
|
379
|
+
burnDecisionTokensDerived(params: {
|
|
380
|
+
market: PublicKey;
|
|
381
|
+
amount: bigint;
|
|
382
|
+
burnYesToken: boolean;
|
|
383
|
+
}): Promise<{
|
|
384
|
+
signature: string | undefined;
|
|
385
|
+
}>;
|
|
386
|
+
getMarketInfo(market: PublicKey): Promise<{
|
|
387
|
+
address: PublicKey;
|
|
388
|
+
question: any;
|
|
389
|
+
id: any;
|
|
390
|
+
creator: PublicKey;
|
|
391
|
+
initialLiquidity: any;
|
|
392
|
+
marketReserves: any;
|
|
393
|
+
endTime: any;
|
|
394
|
+
resolvable: any;
|
|
395
|
+
resolved: any;
|
|
396
|
+
winningTokenId: any;
|
|
397
|
+
yesTokenMint: PublicKey;
|
|
398
|
+
noTokenMint: PublicKey;
|
|
399
|
+
collateralToken: PublicKey;
|
|
400
|
+
yesTokenSupplyMinted: any;
|
|
401
|
+
noTokenSupplyMinted: any;
|
|
402
|
+
}>;
|
|
403
|
+
getBalances(market: PublicKey): Promise<{
|
|
404
|
+
collateral: {
|
|
405
|
+
account: PublicKey;
|
|
406
|
+
amount: any;
|
|
407
|
+
uiAmount: any;
|
|
408
|
+
uiAmountString: any;
|
|
409
|
+
};
|
|
410
|
+
yes: {
|
|
411
|
+
account: PublicKey;
|
|
412
|
+
amount: any;
|
|
413
|
+
uiAmount: any;
|
|
414
|
+
uiAmountString: any;
|
|
415
|
+
};
|
|
416
|
+
no: {
|
|
417
|
+
account: PublicKey;
|
|
418
|
+
amount: any;
|
|
419
|
+
uiAmount: any;
|
|
420
|
+
uiAmountString: any;
|
|
421
|
+
};
|
|
422
|
+
}>;
|
|
423
|
+
getPrices(market: PublicKey): Promise<{
|
|
424
|
+
yesMinted: number;
|
|
425
|
+
noMinted: number;
|
|
426
|
+
totalMinted: number;
|
|
427
|
+
yesShare: number;
|
|
428
|
+
noShare: number;
|
|
429
|
+
}>;
|
|
430
|
+
buyTokensUsdc(params: {
|
|
431
|
+
market: PublicKey;
|
|
432
|
+
buyYesToken: boolean;
|
|
433
|
+
amountUsdc: number;
|
|
434
|
+
minimumOut?: bigint;
|
|
435
|
+
}): Promise<{
|
|
436
|
+
signature: string;
|
|
437
|
+
usdcSpent: number;
|
|
438
|
+
tokensReceived: number;
|
|
439
|
+
before: {
|
|
440
|
+
collateral: {
|
|
441
|
+
account: PublicKey;
|
|
442
|
+
amount: any;
|
|
443
|
+
uiAmount: any;
|
|
444
|
+
uiAmountString: any;
|
|
445
|
+
};
|
|
446
|
+
yes: {
|
|
447
|
+
account: PublicKey;
|
|
448
|
+
amount: any;
|
|
449
|
+
uiAmount: any;
|
|
450
|
+
uiAmountString: any;
|
|
451
|
+
};
|
|
452
|
+
no: {
|
|
453
|
+
account: PublicKey;
|
|
454
|
+
amount: any;
|
|
455
|
+
uiAmount: any;
|
|
456
|
+
uiAmountString: any;
|
|
457
|
+
};
|
|
458
|
+
};
|
|
459
|
+
after: {
|
|
460
|
+
collateral: {
|
|
461
|
+
account: PublicKey;
|
|
462
|
+
amount: any;
|
|
463
|
+
uiAmount: any;
|
|
464
|
+
uiAmountString: any;
|
|
465
|
+
};
|
|
466
|
+
yes: {
|
|
467
|
+
account: PublicKey;
|
|
468
|
+
amount: any;
|
|
469
|
+
uiAmount: any;
|
|
470
|
+
uiAmountString: any;
|
|
471
|
+
};
|
|
472
|
+
no: {
|
|
473
|
+
account: PublicKey;
|
|
474
|
+
amount: any;
|
|
475
|
+
uiAmount: any;
|
|
476
|
+
uiAmountString: any;
|
|
477
|
+
};
|
|
478
|
+
};
|
|
479
|
+
}>;
|
|
480
|
+
sellTokensBase(params: {
|
|
481
|
+
market: PublicKey;
|
|
482
|
+
burnYesToken: boolean;
|
|
483
|
+
amountBaseUnits: bigint;
|
|
484
|
+
}): Promise<{
|
|
485
|
+
signature: string;
|
|
486
|
+
tokensSold: number;
|
|
487
|
+
usdcReceived: number;
|
|
488
|
+
before: {
|
|
489
|
+
collateral: {
|
|
490
|
+
account: PublicKey;
|
|
491
|
+
amount: any;
|
|
492
|
+
uiAmount: any;
|
|
493
|
+
uiAmountString: any;
|
|
494
|
+
};
|
|
495
|
+
yes: {
|
|
496
|
+
account: PublicKey;
|
|
497
|
+
amount: any;
|
|
498
|
+
uiAmount: any;
|
|
499
|
+
uiAmountString: any;
|
|
500
|
+
};
|
|
501
|
+
no: {
|
|
502
|
+
account: PublicKey;
|
|
503
|
+
amount: any;
|
|
504
|
+
uiAmount: any;
|
|
505
|
+
uiAmountString: any;
|
|
506
|
+
};
|
|
507
|
+
};
|
|
508
|
+
after: {
|
|
509
|
+
collateral: {
|
|
510
|
+
account: PublicKey;
|
|
511
|
+
amount: any;
|
|
512
|
+
uiAmount: any;
|
|
513
|
+
uiAmountString: any;
|
|
514
|
+
};
|
|
515
|
+
yes: {
|
|
516
|
+
account: PublicKey;
|
|
517
|
+
amount: any;
|
|
518
|
+
uiAmount: any;
|
|
519
|
+
uiAmountString: any;
|
|
520
|
+
};
|
|
521
|
+
no: {
|
|
522
|
+
account: PublicKey;
|
|
523
|
+
amount: any;
|
|
524
|
+
uiAmount: any;
|
|
525
|
+
uiAmountString: any;
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
}>;
|
|
529
|
+
redeemPosition(market: PublicKey): Promise<void>;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
declare const RedeemSchema: z.ZodObject<{
|
|
533
|
+
market: z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>;
|
|
534
|
+
position: z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>;
|
|
535
|
+
amount: z.ZodBigInt;
|
|
536
|
+
to: z.ZodOptional<z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>>;
|
|
537
|
+
}, "strip", z.ZodTypeAny, {
|
|
538
|
+
market: PublicKey;
|
|
539
|
+
amount: bigint;
|
|
540
|
+
position: PublicKey;
|
|
541
|
+
to?: PublicKey | undefined;
|
|
542
|
+
}, {
|
|
543
|
+
market: PublicKey;
|
|
544
|
+
amount: bigint;
|
|
545
|
+
position: PublicKey;
|
|
546
|
+
to?: PublicKey | undefined;
|
|
547
|
+
}>;
|
|
548
|
+
declare class RedemptionModule {
|
|
549
|
+
private readonly client;
|
|
550
|
+
private readonly signer;
|
|
551
|
+
constructor(client: Client, signer: SignerLike);
|
|
552
|
+
redeemPosition(params: z.infer<typeof RedeemSchema>): Promise<{
|
|
553
|
+
signature: string | undefined;
|
|
554
|
+
}>;
|
|
555
|
+
claimCreatorFee(accounts: AccountsMap): Promise<{
|
|
556
|
+
signature: string | undefined;
|
|
557
|
+
}>;
|
|
558
|
+
creatorRefund(accounts: AccountsMap): Promise<{
|
|
559
|
+
signature: string | undefined;
|
|
560
|
+
}>;
|
|
561
|
+
creatorRefundV2(accounts: AccountsMap): Promise<{
|
|
562
|
+
signature: string | undefined;
|
|
563
|
+
}>;
|
|
564
|
+
creatorRefundV3(accounts: AccountsMap): Promise<{
|
|
565
|
+
signature: string | undefined;
|
|
566
|
+
}>;
|
|
567
|
+
/**
|
|
568
|
+
* Redeem a winning position from a resolved market
|
|
569
|
+
* @param accounts - Account mapping for the redemption instruction
|
|
570
|
+
* @returns Transaction signature
|
|
571
|
+
*/
|
|
572
|
+
redeemPositionV2(accounts: AccountsMap): Promise<{
|
|
573
|
+
signature: string | undefined;
|
|
574
|
+
}>;
|
|
575
|
+
/**
|
|
576
|
+
* Redeem a winning position from a resolved V3 market
|
|
577
|
+
* @param accounts - Account mapping for the V3 redemption instruction
|
|
578
|
+
* @returns Transaction signature
|
|
579
|
+
*/
|
|
580
|
+
redeemV3Position(accounts: AccountsMap): Promise<{
|
|
581
|
+
signature: string | undefined;
|
|
582
|
+
}>;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Provides a wrapper for Anchor program interactions
|
|
587
|
+
* Following the same pattern as the JavaScript example
|
|
588
|
+
*/
|
|
589
|
+
declare class AnchorClient {
|
|
590
|
+
readonly connection: Connection;
|
|
591
|
+
readonly signer: Keypair;
|
|
592
|
+
readonly idlOverride?: Idl | undefined;
|
|
593
|
+
readonly programIdOverride?: PublicKey | undefined;
|
|
594
|
+
readonly provider: anchor.AnchorProvider;
|
|
595
|
+
readonly wallet: anchor.Wallet;
|
|
596
|
+
readonly program: anchor.Program;
|
|
597
|
+
constructor(connection: Connection, signer: Keypair, idlOverride?: Idl | undefined, programIdOverride?: PublicKey | undefined);
|
|
598
|
+
/**
|
|
599
|
+
* Convert a JavaScript BigInt or number to Anchor BN
|
|
600
|
+
*/
|
|
601
|
+
static toBN(value: bigint | number): typeof BN.prototype;
|
|
602
|
+
/**
|
|
603
|
+
* Returns the IDL for the PNP program
|
|
604
|
+
*/
|
|
605
|
+
static getIdl(): Promise<Idl>;
|
|
606
|
+
static fromIdl(connection: Connection, signer: Keypair, idl: Idl): AnchorClient;
|
|
607
|
+
/**
|
|
608
|
+
* Get the wallet's public key
|
|
609
|
+
*/
|
|
610
|
+
get walletPublicKey(): PublicKey;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Market module that uses direct Anchor program calls
|
|
615
|
+
*/
|
|
616
|
+
declare class AnchorMarketModule {
|
|
617
|
+
private anchorClient;
|
|
618
|
+
constructor(anchorClient: AnchorClient);
|
|
619
|
+
/**
|
|
620
|
+
* Create a new prediction market using direct Anchor program calls
|
|
621
|
+
* Following the same structure as the working JavaScript example
|
|
622
|
+
*/
|
|
623
|
+
createMarket(params: {
|
|
624
|
+
question: string;
|
|
625
|
+
initialLiquidity: bigint;
|
|
626
|
+
endTime: bigint;
|
|
627
|
+
collateralTokenMint: PublicKey;
|
|
628
|
+
creator?: PublicKey;
|
|
629
|
+
yesOddsBps?: number;
|
|
630
|
+
oracle?: PublicKey;
|
|
631
|
+
}): Promise<{
|
|
632
|
+
signature: any;
|
|
633
|
+
market: PublicKey;
|
|
634
|
+
marketDetails: any;
|
|
635
|
+
} | {
|
|
636
|
+
signature: any;
|
|
637
|
+
market: PublicKey;
|
|
638
|
+
marketDetails?: undefined;
|
|
639
|
+
}>;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
type TokenSide = "yes" | "no";
|
|
643
|
+
/**
|
|
644
|
+
* Market module that uses direct Anchor program calls for V3 markets
|
|
645
|
+
*/
|
|
646
|
+
declare class AnchorMarketV3Module {
|
|
647
|
+
private anchorClient;
|
|
648
|
+
constructor(anchorClient: AnchorClient);
|
|
649
|
+
/**
|
|
650
|
+
* Create a new V3 prediction market using direct Anchor program calls
|
|
651
|
+
*/
|
|
652
|
+
createMarketV3(params: {
|
|
653
|
+
question: string;
|
|
654
|
+
initialAmount: bigint;
|
|
655
|
+
side: TokenSide;
|
|
656
|
+
creatorSideCap: bigint;
|
|
657
|
+
endTime: bigint;
|
|
658
|
+
maxPotRatio?: number;
|
|
659
|
+
collateralTokenMint: PublicKey;
|
|
660
|
+
creator?: PublicKey;
|
|
661
|
+
oddsBps?: number;
|
|
662
|
+
oracle?: PublicKey;
|
|
663
|
+
}): Promise<{
|
|
664
|
+
signature: any;
|
|
665
|
+
market: PublicKey;
|
|
666
|
+
yesTokenMint: PublicKey;
|
|
667
|
+
noTokenMint: PublicKey;
|
|
668
|
+
}>;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
declare class PNPClient {
|
|
672
|
+
readonly client: Client;
|
|
673
|
+
readonly signer?: SignerLike;
|
|
674
|
+
readonly market?: MarketModule;
|
|
675
|
+
readonly trading?: TradingModule;
|
|
676
|
+
readonly redemption?: RedemptionModule;
|
|
677
|
+
readonly anchorMarket?: AnchorMarketModule;
|
|
678
|
+
readonly anchorMarketV3?: AnchorMarketV3Module;
|
|
679
|
+
readonly anchorClient?: AnchorClient;
|
|
680
|
+
private static readonly MARKET_V3_DISCRIMINATOR;
|
|
681
|
+
get connection(): _solana_web3_js.Connection;
|
|
682
|
+
/**
|
|
683
|
+
* Decode market account data from buffer
|
|
684
|
+
* @param data Buffer containing account data
|
|
685
|
+
* @returns Decoded market account data
|
|
686
|
+
*/
|
|
687
|
+
private decodeMarketAny;
|
|
688
|
+
constructor(rpcUrl: string, privateKey?: Uint8Array | string | {
|
|
689
|
+
secretKey: Uint8Array;
|
|
690
|
+
});
|
|
691
|
+
/**
|
|
692
|
+
* Create a P2P market (high-level wrapper) and return a web3-agnostic result.
|
|
693
|
+
* Serializes PublicKeys to base58 strings to match P2PMarketResponse.
|
|
694
|
+
*/
|
|
695
|
+
createP2PMarketGeneral(params: {
|
|
696
|
+
question: string;
|
|
697
|
+
initialAmount: bigint;
|
|
698
|
+
side: "yes" | "no";
|
|
699
|
+
creatorSideCap: bigint;
|
|
700
|
+
endTime: bigint;
|
|
701
|
+
maxPotRatio?: number;
|
|
702
|
+
collateralTokenMint: PublicKey;
|
|
703
|
+
creator?: PublicKey;
|
|
704
|
+
}): Promise<P2PMarketResponse>;
|
|
705
|
+
/**
|
|
706
|
+
* Create a P2P market using simple, UI-friendly parameters.
|
|
707
|
+
* - Accepts amount in USDC (number) and converts to raw units internally (assumes 6 decimals).
|
|
708
|
+
* - Defaults to mainnet USDC as collateral mint if not provided.
|
|
709
|
+
* - Defaults creatorSideCap to 5x the initial amount if not provided.
|
|
710
|
+
* - Defaults end time to `daysUntilEnd` days from now (30 days by default).
|
|
711
|
+
*/
|
|
712
|
+
createP2PMarketSimple(params: {
|
|
713
|
+
question: string;
|
|
714
|
+
side: "yes" | "no";
|
|
715
|
+
amountUsdc: number;
|
|
716
|
+
daysUntilEnd?: number;
|
|
717
|
+
creatorSideCapMultiplier?: number;
|
|
718
|
+
collateralTokenMint?: PublicKey;
|
|
719
|
+
maxPotRatio?: number;
|
|
720
|
+
creator?: PublicKey;
|
|
721
|
+
}): Promise<P2PMarketResponse>;
|
|
722
|
+
/**
|
|
723
|
+
* Create a P2P market with YouTube URL detection (high-level wrapper).
|
|
724
|
+
* Automatically detects and extracts YouTube URLs from the question.
|
|
725
|
+
* Serializes PublicKeys to base58 strings to match P2PMarketResponse.
|
|
726
|
+
*/
|
|
727
|
+
createP2PMarketYoutube(params: {
|
|
728
|
+
question: string;
|
|
729
|
+
youtubeUrl: string;
|
|
730
|
+
initialAmount: bigint;
|
|
731
|
+
side: "yes" | "no";
|
|
732
|
+
creatorSideCap: bigint;
|
|
733
|
+
endTime: bigint;
|
|
734
|
+
maxPotRatio?: number;
|
|
735
|
+
collateralTokenMint: PublicKey;
|
|
736
|
+
creator?: PublicKey;
|
|
737
|
+
}): Promise<P2PMarketResponse & {
|
|
738
|
+
detectedYoutubeUrl?: string;
|
|
739
|
+
}>;
|
|
740
|
+
/**
|
|
741
|
+
* Create a P2P market with DeFiLlama protocol/metric detection (high-level wrapper).
|
|
742
|
+
* Automatically formats the question with DeFiLlama reference.
|
|
743
|
+
* Serializes PublicKeys to base58 strings to match P2PMarketResponse.
|
|
744
|
+
*/
|
|
745
|
+
createP2PMarketDefiLlama(params: {
|
|
746
|
+
question: string;
|
|
747
|
+
protocolName: string;
|
|
748
|
+
metric: string;
|
|
749
|
+
initialAmount: bigint;
|
|
750
|
+
side: "yes" | "no";
|
|
751
|
+
creatorSideCap: bigint;
|
|
752
|
+
endTime: bigint;
|
|
753
|
+
maxPotRatio?: number;
|
|
754
|
+
collateralTokenMint: PublicKey;
|
|
755
|
+
creator?: PublicKey;
|
|
756
|
+
}): Promise<P2PMarketResponse & {
|
|
757
|
+
detectedProtocol?: string;
|
|
758
|
+
detectedMetric?: string;
|
|
759
|
+
}>;
|
|
760
|
+
/**
|
|
761
|
+
* Simple helper to create a P2P market with a YouTube URL using UI-friendly parameters.
|
|
762
|
+
* - Accepts amount in USDC (number) and converts to raw units internally (assumes 6 decimals).
|
|
763
|
+
* - Defaults to mainnet USDC as collateral mint if not provided.
|
|
764
|
+
* - Defaults creatorSideCap to 5x the initial amount if not provided.
|
|
765
|
+
* - Defaults end time to `daysUntilEnd` days from now (30 days by default).
|
|
766
|
+
*/
|
|
767
|
+
createP2PMarketYoutubeSimple(params: {
|
|
768
|
+
question: string;
|
|
769
|
+
youtubeUrl: string;
|
|
770
|
+
side: "yes" | "no";
|
|
771
|
+
amountUsdc: number;
|
|
772
|
+
daysUntilEnd?: number;
|
|
773
|
+
creatorSideCapMultiplier?: number;
|
|
774
|
+
collateralTokenMint?: PublicKey;
|
|
775
|
+
maxPotRatio?: number;
|
|
776
|
+
creator?: PublicKey;
|
|
777
|
+
}): Promise<P2PMarketResponse & {
|
|
778
|
+
detectedYoutubeUrl?: string;
|
|
779
|
+
}>;
|
|
780
|
+
/**
|
|
781
|
+
* Create a V2 (AMM) market with Twitter URL detection (high-level wrapper).
|
|
782
|
+
* Automatically detects and extracts Twitter URLs from the question.
|
|
783
|
+
* Serializes PublicKeys to base58 strings.
|
|
784
|
+
*/
|
|
785
|
+
createMarketTwitter(params: {
|
|
786
|
+
question: string;
|
|
787
|
+
tweetUrl: string;
|
|
788
|
+
initialLiquidity: bigint;
|
|
789
|
+
endTime: bigint;
|
|
790
|
+
collateralTokenMint: PublicKey;
|
|
791
|
+
}): Promise<{
|
|
792
|
+
signature: string;
|
|
793
|
+
market: string;
|
|
794
|
+
detectedTwitterUrl?: string;
|
|
795
|
+
isTweetIdFormat?: boolean;
|
|
796
|
+
}>;
|
|
797
|
+
/**
|
|
798
|
+
* Create a V2 (AMM) market with YouTube URL detection (high-level wrapper).
|
|
799
|
+
* Automatically detects and extracts YouTube URLs from the question.
|
|
800
|
+
* Serializes PublicKeys to base58 strings.
|
|
801
|
+
*/
|
|
802
|
+
createMarketYoutube(params: {
|
|
803
|
+
question: string;
|
|
804
|
+
youtubeUrl: string;
|
|
805
|
+
initialLiquidity: bigint;
|
|
806
|
+
endTime: bigint;
|
|
807
|
+
collateralTokenMint: PublicKey;
|
|
808
|
+
}): Promise<{
|
|
809
|
+
signature: string;
|
|
810
|
+
market: string;
|
|
811
|
+
detectedYoutubeUrl?: string;
|
|
812
|
+
}>;
|
|
813
|
+
/**
|
|
814
|
+
* Create a V2 (AMM) market with DeFiLlama protocol/metric detection (high-level wrapper).
|
|
815
|
+
* Automatically formats the question with DeFiLlama reference.
|
|
816
|
+
* Serializes PublicKeys to base58 strings.
|
|
817
|
+
*/
|
|
818
|
+
createMarketDefiLlama(params: {
|
|
819
|
+
question: string;
|
|
820
|
+
protocolName: string;
|
|
821
|
+
metric: string;
|
|
822
|
+
initialLiquidity: bigint;
|
|
823
|
+
endTime: bigint;
|
|
824
|
+
collateralTokenMint: PublicKey;
|
|
825
|
+
}): Promise<{
|
|
826
|
+
signature: string;
|
|
827
|
+
market: string;
|
|
828
|
+
detectedProtocol?: string;
|
|
829
|
+
detectedMetric?: string;
|
|
830
|
+
}>;
|
|
831
|
+
/**
|
|
832
|
+
* Create a P2P market with Twitter URL detection (high-level wrapper).
|
|
833
|
+
* Automatically detects and extracts Twitter URLs from the question.
|
|
834
|
+
* Serializes PublicKeys to base58 strings to match P2PMarketResponse.
|
|
835
|
+
*/
|
|
836
|
+
createP2PMarketTwitter(params: {
|
|
837
|
+
question: string;
|
|
838
|
+
tweetUrl: string;
|
|
839
|
+
initialAmount: bigint;
|
|
840
|
+
side: "yes" | "no";
|
|
841
|
+
creatorSideCap: bigint;
|
|
842
|
+
endTime: bigint;
|
|
843
|
+
maxPotRatio?: number;
|
|
844
|
+
collateralTokenMint: PublicKey;
|
|
845
|
+
creator?: PublicKey;
|
|
846
|
+
}): Promise<P2PMarketResponse & {
|
|
847
|
+
detectedTwitterUrl?: string;
|
|
848
|
+
isTweetIdFormat?: boolean;
|
|
849
|
+
}>;
|
|
850
|
+
/**
|
|
851
|
+
* Simple helper to create a P2P market with a Twitter / X URL using UI-friendly parameters.
|
|
852
|
+
* - Accepts amount in USDC (number) and converts to raw units internally (assumes 6 decimals).
|
|
853
|
+
* - Defaults to mainnet USDC as collateral mint if not provided.
|
|
854
|
+
* - Defaults creatorSideCap to 5x the initial amount if not provided.
|
|
855
|
+
* - Defaults end time to `daysUntilEnd` days from now (30 days by default).
|
|
856
|
+
*/
|
|
857
|
+
createP2PMarketTwitterSimple(params: {
|
|
858
|
+
question: string;
|
|
859
|
+
tweetUrl: string;
|
|
860
|
+
side: "yes" | "no";
|
|
861
|
+
amountUsdc: number;
|
|
862
|
+
daysUntilEnd?: number;
|
|
863
|
+
creatorSideCapMultiplier?: number;
|
|
864
|
+
collateralTokenMint?: PublicKey;
|
|
865
|
+
maxPotRatio?: number;
|
|
866
|
+
creator?: PublicKey;
|
|
867
|
+
}): Promise<P2PMarketResponse & {
|
|
868
|
+
detectedTwitterUrl?: string;
|
|
869
|
+
isTweetIdFormat?: boolean;
|
|
870
|
+
}>;
|
|
871
|
+
/**
|
|
872
|
+
* Simple helper to create a P2P market with DeFiLlama protocol/metric using UI-friendly parameters.
|
|
873
|
+
* - Accepts amount in USDC (number) and converts to raw units internally (assumes 6 decimals).
|
|
874
|
+
* - Defaults to mainnet USDC as collateral mint if not provided.
|
|
875
|
+
* - Defaults creatorSideCap to 5x the initial amount if not provided.
|
|
876
|
+
* - Defaults end time to `daysUntilEnd` days from now (30 days by default).
|
|
877
|
+
*/
|
|
878
|
+
createP2PMarketDefiLlamaSimple(params: {
|
|
879
|
+
question: string;
|
|
880
|
+
protocolName: string;
|
|
881
|
+
metric: string;
|
|
882
|
+
side: "yes" | "no";
|
|
883
|
+
amountUsdc: number;
|
|
884
|
+
daysUntilEnd?: number;
|
|
885
|
+
creatorSideCapMultiplier?: number;
|
|
886
|
+
collateralTokenMint?: PublicKey;
|
|
887
|
+
maxPotRatio?: number;
|
|
888
|
+
creator?: PublicKey;
|
|
889
|
+
}): Promise<P2PMarketResponse & {
|
|
890
|
+
detectedProtocol?: string;
|
|
891
|
+
detectedMetric?: string;
|
|
892
|
+
}>;
|
|
893
|
+
/**
|
|
894
|
+
* Create a V2 (AMM) market with custom initial odds and/or a custom oracle.
|
|
895
|
+
*
|
|
896
|
+
* @param params - Market creation parameters
|
|
897
|
+
* @param params.yesOddsBps - Initial YES odds in basis points (100-9900).
|
|
898
|
+
* Example: 7000 = 70% YES / 30% NO
|
|
899
|
+
* @param params.oracle - Optional custom oracle for settlement (default: global oracle)
|
|
900
|
+
* @returns Object with transaction signature and market PDA
|
|
901
|
+
*/
|
|
902
|
+
createMarketV2WithCustomOdds(params: {
|
|
903
|
+
question: string;
|
|
904
|
+
initialLiquidity: bigint;
|
|
905
|
+
endTime: bigint;
|
|
906
|
+
collateralTokenMint: PublicKey;
|
|
907
|
+
yesOddsBps: number;
|
|
908
|
+
oracle?: PublicKey;
|
|
909
|
+
creator?: PublicKey;
|
|
910
|
+
}): Promise<{
|
|
911
|
+
signature: any;
|
|
912
|
+
market: string;
|
|
913
|
+
}>;
|
|
914
|
+
/**
|
|
915
|
+
* Create a P2P (V3) market with custom initial odds (high-level wrapper).
|
|
916
|
+
* Custom odds allow splitting the initial liquidity between YES and NO sides
|
|
917
|
+
* instead of the default 100% to creator side.
|
|
918
|
+
*
|
|
919
|
+
* @param params - Market creation parameters
|
|
920
|
+
* @param params.oddsBps - Initial odds in basis points (100-9900).
|
|
921
|
+
* Example: 7000 = 70% YES / 30% NO for a YES-side creator
|
|
922
|
+
* @param params.oracle - Optional custom oracle for settlement (default: global oracle)
|
|
923
|
+
* @returns P2PMarketResponse with market address and token mints
|
|
924
|
+
*/
|
|
925
|
+
createMarketP2PWithCustomOdds(params: {
|
|
926
|
+
question: string;
|
|
927
|
+
initialAmount: bigint;
|
|
928
|
+
side: "yes" | "no";
|
|
929
|
+
creatorSideCap: bigint;
|
|
930
|
+
endTime: bigint;
|
|
931
|
+
oddsBps: number;
|
|
932
|
+
oracle?: PublicKey;
|
|
933
|
+
maxPotRatio?: number;
|
|
934
|
+
collateralTokenMint: PublicKey;
|
|
935
|
+
creator?: PublicKey;
|
|
936
|
+
}): Promise<P2PMarketResponse>;
|
|
937
|
+
/**
|
|
938
|
+
* Detects if a question contains a Twitter URL or tweet ID format after the question mark
|
|
939
|
+
* @param questionText The question text to analyze
|
|
940
|
+
* @returns Object containing the cleaned question, Twitter URL if present, and isTweetIdFormat flag indicating if X {tweet_id} format was used
|
|
941
|
+
* @example
|
|
942
|
+
* // With URL format
|
|
943
|
+
* detectTwitterUrl("Will X happen? https://twitter.com/user/status/1234567890");
|
|
944
|
+
* // With X {tweet id} format - with space
|
|
945
|
+
* detectTwitterUrl("Will X happen? X 1234567890");
|
|
946
|
+
* // With X {tweet id} format - with curly braces
|
|
947
|
+
* detectTwitterUrl("Will X happen? X {1234567890}");
|
|
948
|
+
*/
|
|
949
|
+
static detectTwitterUrl(questionText: string): {
|
|
950
|
+
question: string;
|
|
951
|
+
twitterUrl?: string;
|
|
952
|
+
isTweetIdFormat?: boolean;
|
|
953
|
+
};
|
|
954
|
+
/**
|
|
955
|
+
* Detects if a question contains a YouTube URL after the question mark
|
|
956
|
+
* @param questionText The question text to analyze
|
|
957
|
+
* @returns Object containing the cleaned question and YouTube URL if present
|
|
958
|
+
*/
|
|
959
|
+
static detectYoutubeUrl(questionText: string): {
|
|
960
|
+
question: string;
|
|
961
|
+
youtubeUrl?: string;
|
|
962
|
+
};
|
|
963
|
+
/**
|
|
964
|
+
* Detects if a question contains a DeFiLlama format after the question mark
|
|
965
|
+
* @param questionText The question text to analyze
|
|
966
|
+
* @returns Object containing the cleaned question and DeFiLlama protocol/metric info if present
|
|
967
|
+
* @example
|
|
968
|
+
* detectDefiLlamaUrl("Will Uniswap TVL exceed $5B? df uniswap-v3 tvl");
|
|
969
|
+
*/
|
|
970
|
+
static detectDefiLlamaUrl(questionText: string): {
|
|
971
|
+
question: string;
|
|
972
|
+
protocol?: string;
|
|
973
|
+
metric?: string;
|
|
974
|
+
};
|
|
975
|
+
/**
|
|
976
|
+
* Parse a private key from a string that could be a JSON array or base58 encoded
|
|
977
|
+
* @param keyString Private key as JSON array or base58 string
|
|
978
|
+
* @returns Uint8Array containing the private key bytes
|
|
979
|
+
*/
|
|
980
|
+
static parseSecretKey(keyString: string): Uint8Array;
|
|
981
|
+
/**
|
|
982
|
+
* Convert UI amount to raw amount based on decimals (defaults to 6 for USDC)
|
|
983
|
+
* @param amount UI amount with decimal places
|
|
984
|
+
* @param decimals Token decimals (default: 6 for USDC)
|
|
985
|
+
* @returns Raw token amount as bigint
|
|
986
|
+
*/
|
|
987
|
+
uiToRaw(amount: number, decimals?: number): bigint;
|
|
988
|
+
/**
|
|
989
|
+
* Buy tokens on a V3 market using USDC
|
|
990
|
+
* @param params Buy parameters including market, side, and amount
|
|
991
|
+
* @returns Transaction signature
|
|
992
|
+
*/
|
|
993
|
+
buyV3TokensUsdc(params: {
|
|
994
|
+
market: PublicKey;
|
|
995
|
+
buyYesToken: boolean;
|
|
996
|
+
amountUsdc: number;
|
|
997
|
+
}): Promise<{
|
|
998
|
+
signature: string;
|
|
999
|
+
}>;
|
|
1000
|
+
/**
|
|
1001
|
+
* Redeems a winning position in a resolved market
|
|
1002
|
+
* @param market - The public key of the market where the position was created
|
|
1003
|
+
* @param options - Optional parameters for customizing the redemption
|
|
1004
|
+
* @returns Transaction signature
|
|
1005
|
+
*/
|
|
1006
|
+
redeemPosition(market: PublicKey, options?: {
|
|
1007
|
+
admin?: PublicKey;
|
|
1008
|
+
marketCreator?: PublicKey;
|
|
1009
|
+
creatorFeeTreasury?: PublicKey;
|
|
1010
|
+
}): Promise<{
|
|
1011
|
+
signature: string | undefined;
|
|
1012
|
+
}>;
|
|
1013
|
+
/**
|
|
1014
|
+
* Redeems a winning position in a resolved V3 market
|
|
1015
|
+
* @param market - The public key of the V3 market where the position was created
|
|
1016
|
+
* @returns Transaction signature
|
|
1017
|
+
*/
|
|
1018
|
+
redeemV3Position(market: PublicKey): Promise<{
|
|
1019
|
+
signature: any;
|
|
1020
|
+
}>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Redeem a winning position from a resolved P2P (V3) market.
|
|
1023
|
+
* Thin wrapper around redeemV3Position that accepts either a string or PublicKey.
|
|
1024
|
+
*/
|
|
1025
|
+
redeemP2PPosition(market: PublicKey | string): Promise<{
|
|
1026
|
+
signature: string;
|
|
1027
|
+
}>;
|
|
1028
|
+
fetchGlobalConfig(): Promise<{
|
|
1029
|
+
publicKey: PublicKey;
|
|
1030
|
+
account: GlobalConfigType;
|
|
1031
|
+
}>;
|
|
1032
|
+
/**
|
|
1033
|
+
* Get V2 AMM market price data including prices and multipliers
|
|
1034
|
+
*
|
|
1035
|
+
* ✅ READ-ONLY - No signer required! Works with just an RPC connection.
|
|
1036
|
+
*
|
|
1037
|
+
* This function fetches on-chain market data and calculates:
|
|
1038
|
+
* - YES/NO token prices using the V2 AMM formula
|
|
1039
|
+
* - Multipliers (potential payout ratios)
|
|
1040
|
+
*
|
|
1041
|
+
* Formulas:
|
|
1042
|
+
* - YES Price: (marketReserves × yesTokenSupply) / (yesTokenSupply² + noTokenSupply²)
|
|
1043
|
+
* - NO Price: (marketReserves × noTokenSupply) / (yesTokenSupply² + noTokenSupply²)
|
|
1044
|
+
* - YES Multiplier: 1 + (noTokenSupply / yesTokenSupply)²
|
|
1045
|
+
* - NO Multiplier: 1 + (yesTokenSupply / noTokenSupply)²
|
|
1046
|
+
*
|
|
1047
|
+
* @param market - Market public key or address string
|
|
1048
|
+
* @returns V2 market price data with prices, multipliers, and supplies
|
|
1049
|
+
*
|
|
1050
|
+
* @example
|
|
1051
|
+
* ```typescript
|
|
1052
|
+
* // Works without a signer!
|
|
1053
|
+
* const client = new PNPClient("https://api.devnet.solana.com");
|
|
1054
|
+
* const priceData = await client.getMarketPriceV2("3LsfeB3RhQKJc2eHdEcb9XQzkF6eP9BFa6HTD6vvug9j");
|
|
1055
|
+
* console.log(`YES Price: ${priceData.yesPrice}`);
|
|
1056
|
+
* console.log(`NO Price: ${priceData.noPrice}`);
|
|
1057
|
+
* console.log(`YES Multiplier: ${priceData.yesMultiplier}x`);
|
|
1058
|
+
* ```
|
|
1059
|
+
*/
|
|
1060
|
+
getMarketPriceV2(market: PublicKey | string): Promise<{
|
|
1061
|
+
/** Market reserves (collateral) in UI units */
|
|
1062
|
+
marketReserves: number;
|
|
1063
|
+
/** YES tokens minted in UI units */
|
|
1064
|
+
yesTokenSupply: number;
|
|
1065
|
+
/** NO tokens minted in UI units */
|
|
1066
|
+
noTokenSupply: number;
|
|
1067
|
+
/** YES token price (0-1) */
|
|
1068
|
+
yesPrice: number;
|
|
1069
|
+
/** NO token price (0-1) */
|
|
1070
|
+
noPrice: number;
|
|
1071
|
+
/** YES multiplier (potential payout ratio) */
|
|
1072
|
+
yesMultiplier: number;
|
|
1073
|
+
/** NO multiplier (potential payout ratio) */
|
|
1074
|
+
noMultiplier: number;
|
|
1075
|
+
/** Raw market reserves in base units */
|
|
1076
|
+
marketReservesRaw: bigint;
|
|
1077
|
+
/** Raw YES tokens in base units */
|
|
1078
|
+
yesTokenSupplyRaw: bigint;
|
|
1079
|
+
/** Raw NO tokens in base units */
|
|
1080
|
+
noTokenSupplyRaw: bigint;
|
|
1081
|
+
}>;
|
|
1082
|
+
/**
|
|
1083
|
+
* Set market resolvable status (V2 markets)
|
|
1084
|
+
*
|
|
1085
|
+
* ⚠️ DEVNET/TESTING ONLY - This function is for devnet and testing purposes only.
|
|
1086
|
+
* It will NOT work on mainnet. Use this only for development and testing.
|
|
1087
|
+
*
|
|
1088
|
+
* @param market - Market public key or address string
|
|
1089
|
+
* @param resolvable - New resolvable status
|
|
1090
|
+
* @param forceResolve - Optional: force resolve (allow immediate refunds)
|
|
1091
|
+
* @returns Transaction signature
|
|
1092
|
+
*/
|
|
1093
|
+
/**
|
|
1094
|
+
* Set market resolvable status for V2 markets.
|
|
1095
|
+
* Automatically handles market extension accounts for custom oracles.
|
|
1096
|
+
*
|
|
1097
|
+
* @param market - Market public key or address string
|
|
1098
|
+
* @param resolvable - New resolvable status (true/false)
|
|
1099
|
+
* @param forceResolve - Optional: force resolve (allow immediate refunds)
|
|
1100
|
+
* @returns Transaction signature
|
|
1101
|
+
*/
|
|
1102
|
+
setMarketResolvable(market: PublicKey | string, resolvable: boolean, forceResolve?: boolean): Promise<{
|
|
1103
|
+
signature: string;
|
|
1104
|
+
}>;
|
|
1105
|
+
/**
|
|
1106
|
+
* High-level method to create a V2 market with a custom oracle (settler).
|
|
1107
|
+
*
|
|
1108
|
+
* @param params Market parameters including settler address and optional odds
|
|
1109
|
+
* @returns Created market details
|
|
1110
|
+
*/
|
|
1111
|
+
createMarketWithCustomOracle(params: {
|
|
1112
|
+
question: string;
|
|
1113
|
+
initialLiquidity: bigint;
|
|
1114
|
+
endTime: bigint;
|
|
1115
|
+
collateralMint: PublicKey;
|
|
1116
|
+
settlerAddress: PublicKey;
|
|
1117
|
+
yesOddsBps?: number;
|
|
1118
|
+
}): Promise<{
|
|
1119
|
+
market: PublicKey;
|
|
1120
|
+
signature: string;
|
|
1121
|
+
}>;
|
|
1122
|
+
/**
|
|
1123
|
+
* Set market resolvable status (V3/P2P markets)
|
|
1124
|
+
*
|
|
1125
|
+
* ⚠️ DEVNET/TESTING ONLY - This function is for devnet and testing purposes only.
|
|
1126
|
+
* It will NOT work on mainnet. Use this only for development and testing.
|
|
1127
|
+
*
|
|
1128
|
+
* @param market - Market public key or address string
|
|
1129
|
+
* @param resolvable - New resolvable status
|
|
1130
|
+
* @returns Transaction signature
|
|
1131
|
+
*/
|
|
1132
|
+
setMarketResolvableP2p(market: PublicKey | string, resolvable: boolean): Promise<{
|
|
1133
|
+
signature: string;
|
|
1134
|
+
}>;
|
|
1135
|
+
fetchMarket(market: PublicKey): Promise<{
|
|
1136
|
+
publicKey: PublicKey;
|
|
1137
|
+
account: MarketType;
|
|
1138
|
+
}>;
|
|
1139
|
+
fetchMarkets(): Promise<MarketsResponse>;
|
|
1140
|
+
/**
|
|
1141
|
+
* Fetch settlement criteria for a market from the proxy server
|
|
1142
|
+
* @param market - Market public key (as string or PublicKey)
|
|
1143
|
+
* @param baseUrl - Optional base URL for the proxy server
|
|
1144
|
+
* @returns Settlement criteria data
|
|
1145
|
+
*/
|
|
1146
|
+
fetchSettlementCriteria(market: string | PublicKey, baseUrl?: string): Promise<SettlementCriteria>;
|
|
1147
|
+
/**
|
|
1148
|
+
* Get settlement criteria for a market from the proxy server (alias for fetchSettlementCriteria)
|
|
1149
|
+
* @param market - Market public key (as string or PublicKey)
|
|
1150
|
+
* @param baseUrl - Optional base URL for the proxy server
|
|
1151
|
+
* @returns Settlement criteria data
|
|
1152
|
+
*/
|
|
1153
|
+
getSettlementCriteria(market: string | PublicKey, baseUrl?: string, options?: {
|
|
1154
|
+
retryDelayMs?: number;
|
|
1155
|
+
maxRetryTimeMs?: number;
|
|
1156
|
+
}): Promise<SettlementCriteria>;
|
|
1157
|
+
/**
|
|
1158
|
+
* Convenience helper: wait for settlement criteria and provide a small summary.
|
|
1159
|
+
* - Uses getSettlementCriteria() (with retry) under the hood
|
|
1160
|
+
* - Derives a friendly YES/NO answer when possible
|
|
1161
|
+
* - Surfaces resolvable if provided by the proxy
|
|
1162
|
+
*/
|
|
1163
|
+
waitForSettlementCriteria(market: string | PublicKey, baseUrl?: string, options?: {
|
|
1164
|
+
retryDelayMs?: number;
|
|
1165
|
+
maxRetryTimeMs?: number;
|
|
1166
|
+
}): Promise<{
|
|
1167
|
+
resolvable?: boolean;
|
|
1168
|
+
answer?: string;
|
|
1169
|
+
criteria: SettlementCriteria;
|
|
1170
|
+
}>;
|
|
1171
|
+
/**
|
|
1172
|
+
* Fetch settlement data for a market from the proxy server
|
|
1173
|
+
* @param market - Market public key (as string or PublicKey)
|
|
1174
|
+
* @param baseUrl - Optional base URL for the proxy server
|
|
1175
|
+
* @returns Settlement data
|
|
1176
|
+
*/
|
|
1177
|
+
fetchSettlementData(market: string | PublicKey, baseUrl?: string): Promise<SettlementData>;
|
|
1178
|
+
/**
|
|
1179
|
+
* Get settlement data for a market from the proxy server (alias for fetchSettlementData)
|
|
1180
|
+
* @param market - Market public key (as string or PublicKey)
|
|
1181
|
+
* @param baseUrl - Optional base URL for the proxy server
|
|
1182
|
+
* @returns Settlement data
|
|
1183
|
+
*/
|
|
1184
|
+
getSettlementData(market: string | PublicKey, baseUrl?: string): Promise<SettlementData>;
|
|
1185
|
+
/**
|
|
1186
|
+
* Fetch market addresses from the proxy server
|
|
1187
|
+
* @param baseUrl - Optional base URL for the proxy server
|
|
1188
|
+
* @returns Array of market addresses
|
|
1189
|
+
*/
|
|
1190
|
+
fetchMarketAddresses(baseUrl?: string): Promise<string[]>;
|
|
1191
|
+
/**
|
|
1192
|
+
* Get comprehensive information for a P2P market (V3), including reserves, token mints, and settlement criteria
|
|
1193
|
+
* @param marketAddress Market address as PublicKey or string
|
|
1194
|
+
* @param options Optional parameters like base URL
|
|
1195
|
+
* @returns Combined market info with both on-chain data and settlement criteria
|
|
1196
|
+
*/
|
|
1197
|
+
getP2PMarketInfo(marketAddress: PublicKey | string, options?: {
|
|
1198
|
+
baseUrl?: string;
|
|
1199
|
+
}): Promise<{
|
|
1200
|
+
question: string;
|
|
1201
|
+
yesMint: string;
|
|
1202
|
+
noMint: string;
|
|
1203
|
+
yesReserve: string;
|
|
1204
|
+
noReserve: string;
|
|
1205
|
+
collateralMint: string;
|
|
1206
|
+
settlementCriteria: SettlementCriteria | null;
|
|
1207
|
+
endTime: Date;
|
|
1208
|
+
}>;
|
|
1209
|
+
/**
|
|
1210
|
+
* Get comprehensive market information for a V2 market, combining on-chain data and settlement criteria
|
|
1211
|
+
* @param marketAddress Market address as PublicKey or string
|
|
1212
|
+
* @param options Optional parameters like base URL
|
|
1213
|
+
* @returns Combined market info with both on-chain data and settlement criteria
|
|
1214
|
+
*/
|
|
1215
|
+
getV2MarketInfo(marketAddress: PublicKey | string, options?: {
|
|
1216
|
+
baseUrl?: string;
|
|
1217
|
+
}): Promise<{
|
|
1218
|
+
yesMint: string;
|
|
1219
|
+
noMint: string;
|
|
1220
|
+
question: string;
|
|
1221
|
+
creator: string;
|
|
1222
|
+
settlementCriteria: SettlementCriteria | null;
|
|
1223
|
+
yesMultiplier: number;
|
|
1224
|
+
noMultiplier: number;
|
|
1225
|
+
endTime: Date;
|
|
1226
|
+
}>;
|
|
1227
|
+
/**
|
|
1228
|
+
* Fetch V3 market addresses from the proxy server
|
|
1229
|
+
* @param baseUrl - Optional base URL for the proxy server
|
|
1230
|
+
* @returns Array of market addresses
|
|
1231
|
+
*/
|
|
1232
|
+
fetchV3MarketAddresses(baseUrl?: string): Promise<string[]>;
|
|
1233
|
+
/**
|
|
1234
|
+
* Get market metadata (volume, image, initial liquidity) for multiple markets in a single API call
|
|
1235
|
+
* @param markets - Array of market public keys (as strings or PublicKeys)
|
|
1236
|
+
* @param baseUrl - Optional base URL for the proxy server
|
|
1237
|
+
* @returns Array of market metadata including volume, image, and initial liquidity
|
|
1238
|
+
*/
|
|
1239
|
+
getMarketMetaBatch(markets: (string | PublicKey)[], baseUrl?: string): Promise<MarketMeta[]>;
|
|
1240
|
+
/**
|
|
1241
|
+
* Get market metadata (volume, image, initial liquidity) for a single market
|
|
1242
|
+
* @param market - Market public key (as string or PublicKey)
|
|
1243
|
+
* @param baseUrl - Optional base URL for the proxy server
|
|
1244
|
+
* @returns Market metadata including volume, image, and initial liquidity
|
|
1245
|
+
*/
|
|
1246
|
+
getMarketMeta(market: string | PublicKey, baseUrl?: string): Promise<MarketMeta>;
|
|
1247
|
+
/**
|
|
1248
|
+
* Claim creator refund for a market.
|
|
1249
|
+
* Behavior parity with scripts/claimCreatorRefund.ts:
|
|
1250
|
+
* - Eligible if market is not resolvable (proxy or on-chain flag) AND signer is the creator
|
|
1251
|
+
* - Mixed token programs => use creator_refund_v2 with accountsPartial (yes/no token mints null)
|
|
1252
|
+
* - Uniform token programs => try creator_refund_v2 then fallback to v1
|
|
1253
|
+
*/
|
|
1254
|
+
claimMarketRefund(market: PublicKey): Promise<{
|
|
1255
|
+
signature: string;
|
|
1256
|
+
}>;
|
|
1257
|
+
/**
|
|
1258
|
+
* Claim creator refund for a P2P (V3) market by market address.
|
|
1259
|
+
* - Uses getP2PMarketInfo to discover collateral mint
|
|
1260
|
+
* - Decodes MarketV3 to discover creator
|
|
1261
|
+
* - Enforces that the signer is the creator
|
|
1262
|
+
* - Automatically wires all required PDAs and token accounts
|
|
1263
|
+
*/
|
|
1264
|
+
claimP2PMarketRefund(marketAddress: PublicKey | string): Promise<{
|
|
1265
|
+
signature: string;
|
|
1266
|
+
}>;
|
|
1267
|
+
/**
|
|
1268
|
+
* Settle a V2 market by determining the winning outcome.
|
|
1269
|
+
* Only callable by the oracle/admin after market is resolvable.
|
|
1270
|
+
*
|
|
1271
|
+
* @param params Market address and outcome (true for YES winner, false for NO winner)
|
|
1272
|
+
* @returns Transaction signature
|
|
1273
|
+
*/
|
|
1274
|
+
settleMarket(params: {
|
|
1275
|
+
market: PublicKey;
|
|
1276
|
+
yesWinner: boolean;
|
|
1277
|
+
}): Promise<{
|
|
1278
|
+
signature: string;
|
|
1279
|
+
}>;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
declare function deriveMarketPda(baseMint: PublicKey, quoteMint: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
1283
|
+
declare function derivePositionPda(market: PublicKey, owner: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
1284
|
+
declare function deriveGlobalConfigPda(programId: PublicKey): [PublicKey, number];
|
|
1285
|
+
declare function deriveCreatorFeeTreasuryPda(creator: PublicKey, programId: PublicKey, collateralMint: PublicKey): [PublicKey, number];
|
|
1286
|
+
declare function deriveCreatorFeeTreasuryPdaLegacy(creator: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
1287
|
+
declare function deriveAta(owner: PublicKey, mint: PublicKey, allowOwnerOffCurve?: boolean, tokenProgramId?: PublicKey, ataProgramId?: PublicKey): PublicKey;
|
|
1288
|
+
declare function deriveMarketPdaFromMints(yesMint: PublicKey, noMint: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
1289
|
+
declare function deriveYesTokenMint(globalId: bigint, programId: PublicKey): [PublicKey, number];
|
|
1290
|
+
declare function deriveNoTokenMint(globalId: bigint, programId: PublicKey): [PublicKey, number];
|
|
1291
|
+
declare function deriveMarketV2Pda(globalId: bigint, programId: PublicKey): [PublicKey, number];
|
|
1292
|
+
declare function deriveMarketV3Pda(globalId: bigint, programId: PublicKey): [PublicKey, number];
|
|
1293
|
+
declare function deriveV3YesTokenMint(globalId: bigint, programId: PublicKey): [PublicKey, number];
|
|
1294
|
+
declare function deriveV3NoTokenMint(globalId: bigint, programId: PublicKey): [PublicKey, number];
|
|
1295
|
+
declare function deriveMarketExtensionPda(marketId: bigint, programId: PublicKey): [PublicKey, number];
|
|
1296
|
+
declare function deriveMarketV3ExtensionPda(marketId: bigint, programId: PublicKey): [PublicKey, number];
|
|
1297
|
+
declare function deriveTokenMetadataPda(mint: PublicKey, metadataProgramId: PublicKey): [PublicKey, number];
|
|
1298
|
+
|
|
1299
|
+
declare const pdas_deriveAta: typeof deriveAta;
|
|
1300
|
+
declare const pdas_deriveCreatorFeeTreasuryPda: typeof deriveCreatorFeeTreasuryPda;
|
|
1301
|
+
declare const pdas_deriveCreatorFeeTreasuryPdaLegacy: typeof deriveCreatorFeeTreasuryPdaLegacy;
|
|
1302
|
+
declare const pdas_deriveGlobalConfigPda: typeof deriveGlobalConfigPda;
|
|
1303
|
+
declare const pdas_deriveMarketExtensionPda: typeof deriveMarketExtensionPda;
|
|
1304
|
+
declare const pdas_deriveMarketPda: typeof deriveMarketPda;
|
|
1305
|
+
declare const pdas_deriveMarketPdaFromMints: typeof deriveMarketPdaFromMints;
|
|
1306
|
+
declare const pdas_deriveMarketV2Pda: typeof deriveMarketV2Pda;
|
|
1307
|
+
declare const pdas_deriveMarketV3ExtensionPda: typeof deriveMarketV3ExtensionPda;
|
|
1308
|
+
declare const pdas_deriveMarketV3Pda: typeof deriveMarketV3Pda;
|
|
1309
|
+
declare const pdas_deriveNoTokenMint: typeof deriveNoTokenMint;
|
|
1310
|
+
declare const pdas_derivePositionPda: typeof derivePositionPda;
|
|
1311
|
+
declare const pdas_deriveTokenMetadataPda: typeof deriveTokenMetadataPda;
|
|
1312
|
+
declare const pdas_deriveV3NoTokenMint: typeof deriveV3NoTokenMint;
|
|
1313
|
+
declare const pdas_deriveV3YesTokenMint: typeof deriveV3YesTokenMint;
|
|
1314
|
+
declare const pdas_deriveYesTokenMint: typeof deriveYesTokenMint;
|
|
1315
|
+
declare namespace pdas {
|
|
1316
|
+
export { pdas_deriveAta as deriveAta, pdas_deriveCreatorFeeTreasuryPda as deriveCreatorFeeTreasuryPda, pdas_deriveCreatorFeeTreasuryPdaLegacy as deriveCreatorFeeTreasuryPdaLegacy, pdas_deriveGlobalConfigPda as deriveGlobalConfigPda, pdas_deriveMarketExtensionPda as deriveMarketExtensionPda, pdas_deriveMarketPda as deriveMarketPda, pdas_deriveMarketPdaFromMints as deriveMarketPdaFromMints, pdas_deriveMarketV2Pda as deriveMarketV2Pda, pdas_deriveMarketV3ExtensionPda as deriveMarketV3ExtensionPda, pdas_deriveMarketV3Pda as deriveMarketV3Pda, pdas_deriveNoTokenMint as deriveNoTokenMint, pdas_derivePositionPda as derivePositionPda, pdas_deriveTokenMetadataPda as deriveTokenMetadataPda, pdas_deriveV3NoTokenMint as deriveV3NoTokenMint, pdas_deriveV3YesTokenMint as deriveV3YesTokenMint, pdas_deriveYesTokenMint as deriveYesTokenMint };
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
export { Client, type Commitment, type GlobalConfigType, type Logger, type MarketExtensionType, type MarketMeta, MarketModule, type MarketType, type MarketV3ExtensionType, type MarketV3Type, type MarketsResponse, type P2PMarketResponse, PNPClient, ProgramError, type PubkeyLike, RedemptionModule, type SdkConfig, SdkError, type SettlementCriteria, type SettlementData, type TokenSideLike, TradingModule, TransportError, type U64Like, ValidationError, type WinningTokenLike, pdas };
|