drama-pm-client 0.3.1 → 0.4.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/idl.d.ts +202 -1
- package/dist/idl.js +365 -2
- package/dist/index.d.ts +52 -5
- package/dist/index.js +225 -21
- package/dist/types.d.ts +363 -0
- package/dist/types.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export interface UpdateFeeConfigParams {
|
|
|
28
28
|
authority: PublicKey;
|
|
29
29
|
newFeeBps: number;
|
|
30
30
|
newFeeRecipient: PublicKey;
|
|
31
|
+
newFeeClaimBps: number;
|
|
31
32
|
}
|
|
32
33
|
export interface ClaimRewardsParams {
|
|
33
34
|
user: PublicKey;
|
|
@@ -35,6 +36,8 @@ export interface ClaimRewardsParams {
|
|
|
35
36
|
bettingToken: PublicKey;
|
|
36
37
|
winningOutcome: Outcome;
|
|
37
38
|
sharesToClaim: number | BN;
|
|
39
|
+
closeAccount?: boolean;
|
|
40
|
+
feeRecipient?: PublicKey;
|
|
38
41
|
}
|
|
39
42
|
export interface BatchClaimParams {
|
|
40
43
|
user: PublicKey;
|
|
@@ -43,6 +46,7 @@ export interface BatchClaimParams {
|
|
|
43
46
|
bettingToken: PublicKey;
|
|
44
47
|
winningOutcome: Outcome;
|
|
45
48
|
sharesToClaim?: number | BN;
|
|
49
|
+
closeAccount?: boolean;
|
|
46
50
|
}>;
|
|
47
51
|
}
|
|
48
52
|
export interface RefundParams {
|
|
@@ -72,8 +76,9 @@ export declare class DramaPmClient {
|
|
|
72
76
|
ataExists(ata: PublicKey): Promise<boolean>;
|
|
73
77
|
/**
|
|
74
78
|
* Create an instruction to initialize an associated token account
|
|
79
|
+
* @param tokenProgram - Token program ID (TOKEN_PROGRAM_ID for betting token, TOKEN_2022_PROGRAM_ID for outcome tokens)
|
|
75
80
|
*/
|
|
76
|
-
createAtaInstruction(payer: PublicKey, owner: PublicKey, mint: PublicKey): TransactionInstruction;
|
|
81
|
+
createAtaInstruction(payer: PublicKey, owner: PublicKey, mint: PublicKey, tokenProgram?: PublicKey): TransactionInstruction;
|
|
77
82
|
/**
|
|
78
83
|
* Initialize global configuration (Authority only)
|
|
79
84
|
*/
|
|
@@ -82,6 +87,15 @@ export declare class DramaPmClient {
|
|
|
82
87
|
* Build a complete transaction to initialize config
|
|
83
88
|
*/
|
|
84
89
|
buildInitializeConfigTx(authority: PublicKey): Promise<Transaction>;
|
|
90
|
+
/**
|
|
91
|
+
* Migrate GlobalConfig to new version with fee_claim_bps field (Authority only)
|
|
92
|
+
* Should be called once after program upgrade
|
|
93
|
+
*/
|
|
94
|
+
migrateConfig(authority: PublicKey): Promise<TransactionInstruction>;
|
|
95
|
+
/**
|
|
96
|
+
* Build a complete transaction to migrate config
|
|
97
|
+
*/
|
|
98
|
+
buildMigrateConfigTx(authority: PublicKey): Promise<Transaction>;
|
|
85
99
|
/**
|
|
86
100
|
* Update authorized admin (Authority only)
|
|
87
101
|
*/
|
|
@@ -90,6 +104,14 @@ export declare class DramaPmClient {
|
|
|
90
104
|
* Build a complete transaction to update admin
|
|
91
105
|
*/
|
|
92
106
|
buildAddAdminTx(newAdmin: PublicKey): Promise<Transaction>;
|
|
107
|
+
/**
|
|
108
|
+
* Remove authorized admin (Authority only)
|
|
109
|
+
*/
|
|
110
|
+
removeAdmin(adminToRemove: PublicKey): Promise<TransactionInstruction>;
|
|
111
|
+
/**
|
|
112
|
+
* Build a complete transaction to remove admin
|
|
113
|
+
*/
|
|
114
|
+
buildRemoveAdminTx(adminToRemove: PublicKey): Promise<Transaction>;
|
|
93
115
|
/**
|
|
94
116
|
* Update fee configuration (Authority or authorized admin)
|
|
95
117
|
*/
|
|
@@ -148,19 +170,19 @@ export declare class DramaPmClient {
|
|
|
148
170
|
/**
|
|
149
171
|
* Resolve a market (Admin only)
|
|
150
172
|
*/
|
|
151
|
-
resolveMarketByID(admin: PublicKey, marketId: number | BN, winningOutcome: "Yes" | "No" | null): Promise<TransactionInstruction>;
|
|
173
|
+
resolveMarketByID(admin: PublicKey, marketId: number | BN, winningOutcome: "Yes" | "No" | null, feeRecipient?: PublicKey): Promise<TransactionInstruction>;
|
|
152
174
|
/**
|
|
153
175
|
* Build a complete transaction to resolve a market
|
|
154
176
|
*/
|
|
155
|
-
buildResolveMarketTxByID(admin: PublicKey, marketId: number | BN, winningOutcome: "Yes" | "No" | null): Promise<Transaction>;
|
|
177
|
+
buildResolveMarketTxByID(admin: PublicKey, marketId: number | BN, winningOutcome: "Yes" | "No" | null, feeRecipient?: PublicKey): Promise<Transaction>;
|
|
156
178
|
/**
|
|
157
179
|
* Resolve a market (Admin only)
|
|
158
180
|
*/
|
|
159
|
-
resolveMarket(admin: PublicKey, market: PublicKey, winningOutcome: "Yes" | "No" | null): Promise<TransactionInstruction>;
|
|
181
|
+
resolveMarket(admin: PublicKey, market: PublicKey, winningOutcome: "Yes" | "No" | null, feeRecipient?: PublicKey): Promise<TransactionInstruction>;
|
|
160
182
|
/**
|
|
161
183
|
* Build a complete transaction to resolve a market
|
|
162
184
|
*/
|
|
163
|
-
buildResolveMarketTx(admin: PublicKey, market: PublicKey, winningOutcome: "Yes" | "No" | null): Promise<Transaction>;
|
|
185
|
+
buildResolveMarketTx(admin: PublicKey, market: PublicKey, winningOutcome: "Yes" | "No" | null, feeRecipient?: PublicKey): Promise<Transaction>;
|
|
164
186
|
/**
|
|
165
187
|
* Close a market (Admin only)
|
|
166
188
|
*/
|
|
@@ -177,6 +199,30 @@ export declare class DramaPmClient {
|
|
|
177
199
|
* Build a complete transaction to close a market
|
|
178
200
|
*/
|
|
179
201
|
buildCloseMarketTxByID(admin: PublicKey, marketId: number | BN): Promise<Transaction>;
|
|
202
|
+
/**
|
|
203
|
+
* Close market account and reclaim rent (Admin only)
|
|
204
|
+
* Can only be called after market is resolved and all rewards claimed
|
|
205
|
+
*/
|
|
206
|
+
closeMarketAccount(admin: PublicKey, market: PublicKey): Promise<TransactionInstruction>;
|
|
207
|
+
/**
|
|
208
|
+
* Build a complete transaction to close market account
|
|
209
|
+
*/
|
|
210
|
+
buildCloseMarketAccountTx(admin: PublicKey, market: PublicKey): Promise<Transaction>;
|
|
211
|
+
/**
|
|
212
|
+
* Burn worthless tokens from the losing side of a resolved market.
|
|
213
|
+
* This allows users to clean up their losing tokens so the market account can be closed.
|
|
214
|
+
* @param user - The user who holds losing tokens
|
|
215
|
+
* @param market - The market PDA
|
|
216
|
+
* @param losingOutcome - The outcome that lost (the side to burn)
|
|
217
|
+
* @param tokenAmount - Amount to burn (0 = burn all)
|
|
218
|
+
* @param closeAccount - Whether to close the losing token account after burning all tokens (default: false)
|
|
219
|
+
*/
|
|
220
|
+
burnMarketTokens(user: PublicKey, market: PublicKey, losingOutcome: Outcome, tokenAmount?: number | BN, closeAccount?: boolean): Promise<TransactionInstruction>;
|
|
221
|
+
/**
|
|
222
|
+
* Build a complete transaction to burn market tokens
|
|
223
|
+
* @param closeAccount - Whether to close the losing token account after burning all tokens (default: false)
|
|
224
|
+
*/
|
|
225
|
+
buildBurnMarketTokensTx(user: PublicKey, market: PublicKey, losingOutcome: Outcome, tokenAmount?: number | BN, closeAccount?: boolean): Promise<Transaction>;
|
|
180
226
|
/**
|
|
181
227
|
* Fetch global config account data
|
|
182
228
|
*/
|
|
@@ -185,6 +231,7 @@ export declare class DramaPmClient {
|
|
|
185
231
|
authorizedAdmins: PublicKey[];
|
|
186
232
|
feeBps: number;
|
|
187
233
|
feeRecipient: PublicKey;
|
|
234
|
+
feeClaimBps: number;
|
|
188
235
|
}>;
|
|
189
236
|
/**
|
|
190
237
|
* Fetch market account data
|