drama-pm-client 0.2.9 → 0.4.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.
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,16 @@ export interface ClaimRewardsParams {
35
36
  bettingToken: PublicKey;
36
37
  winningOutcome: Outcome;
37
38
  sharesToClaim: number | BN;
39
+ feeRecipient?: PublicKey;
40
+ }
41
+ export interface BatchClaimParams {
42
+ user: PublicKey;
43
+ claims: Array<{
44
+ market: PublicKey;
45
+ bettingToken: PublicKey;
46
+ winningOutcome: Outcome;
47
+ sharesToClaim?: number | BN;
48
+ }>;
38
49
  }
39
50
  export interface RefundParams {
40
51
  user: PublicKey;
@@ -63,8 +74,9 @@ export declare class DramaPmClient {
63
74
  ataExists(ata: PublicKey): Promise<boolean>;
64
75
  /**
65
76
  * Create an instruction to initialize an associated token account
77
+ * @param tokenProgram - Token program ID (TOKEN_PROGRAM_ID for betting token, TOKEN_2022_PROGRAM_ID for outcome tokens)
66
78
  */
67
- createAtaInstruction(payer: PublicKey, owner: PublicKey, mint: PublicKey): TransactionInstruction;
79
+ createAtaInstruction(payer: PublicKey, owner: PublicKey, mint: PublicKey, tokenProgram?: PublicKey): TransactionInstruction;
68
80
  /**
69
81
  * Initialize global configuration (Authority only)
70
82
  */
@@ -73,6 +85,15 @@ export declare class DramaPmClient {
73
85
  * Build a complete transaction to initialize config
74
86
  */
75
87
  buildInitializeConfigTx(authority: PublicKey): Promise<Transaction>;
88
+ /**
89
+ * Migrate GlobalConfig to new version with fee_claim_bps field (Authority only)
90
+ * Should be called once after program upgrade
91
+ */
92
+ migrateConfig(authority: PublicKey): Promise<TransactionInstruction>;
93
+ /**
94
+ * Build a complete transaction to migrate config
95
+ */
96
+ buildMigrateConfigTx(authority: PublicKey): Promise<Transaction>;
76
97
  /**
77
98
  * Update authorized admin (Authority only)
78
99
  */
@@ -81,6 +102,14 @@ export declare class DramaPmClient {
81
102
  * Build a complete transaction to update admin
82
103
  */
83
104
  buildAddAdminTx(newAdmin: PublicKey): Promise<Transaction>;
105
+ /**
106
+ * Remove authorized admin (Authority only)
107
+ */
108
+ removeAdmin(adminToRemove: PublicKey): Promise<TransactionInstruction>;
109
+ /**
110
+ * Build a complete transaction to remove admin
111
+ */
112
+ buildRemoveAdminTx(adminToRemove: PublicKey): Promise<Transaction>;
84
113
  /**
85
114
  * Update fee configuration (Authority or authorized admin)
86
115
  */
@@ -113,6 +142,19 @@ export declare class DramaPmClient {
113
142
  * Build a complete transaction to claim rewards
114
143
  */
115
144
  buildClaimRewardsTx(params: ClaimRewardsParams): Promise<Transaction>;
145
+ /**
146
+ * Build instructions to claim rewards from multiple markets
147
+ * Returns an array of instructions that can be batched into transactions
148
+ */
149
+ batchClaimRewards(params: BatchClaimParams): Promise<TransactionInstruction[]>;
150
+ /**
151
+ * Build transactions to claim rewards from multiple markets
152
+ * Automatically splits into multiple transactions if needed (max 5 claims per tx to avoid size limits)
153
+ * @param params - Batch claim parameters
154
+ * @param maxClaimsPerTx - Maximum claims per transaction (default: 5)
155
+ * @returns Array of transactions
156
+ */
157
+ buildBatchClaimRewardsTx(params: BatchClaimParams, maxClaimsPerTx?: number): Promise<Transaction[]>;
116
158
  /**
117
159
  * Refund bets if market is refunded
118
160
  * @param params.tokenAmount - Amount of shares to refund. 0 or undefined means refund all shares.
@@ -126,19 +168,19 @@ export declare class DramaPmClient {
126
168
  /**
127
169
  * Resolve a market (Admin only)
128
170
  */
129
- resolveMarketByID(admin: PublicKey, marketId: number | BN, winningOutcome: "Yes" | "No" | null): Promise<TransactionInstruction>;
171
+ resolveMarketByID(admin: PublicKey, marketId: number | BN, winningOutcome: "Yes" | "No" | null, feeRecipient?: PublicKey): Promise<TransactionInstruction>;
130
172
  /**
131
173
  * Build a complete transaction to resolve a market
132
174
  */
133
- buildResolveMarketTxByID(admin: PublicKey, marketId: number | BN, winningOutcome: "Yes" | "No" | null): Promise<Transaction>;
175
+ buildResolveMarketTxByID(admin: PublicKey, marketId: number | BN, winningOutcome: "Yes" | "No" | null, feeRecipient?: PublicKey): Promise<Transaction>;
134
176
  /**
135
177
  * Resolve a market (Admin only)
136
178
  */
137
- resolveMarket(admin: PublicKey, market: PublicKey, winningOutcome: "Yes" | "No" | null): Promise<TransactionInstruction>;
179
+ resolveMarket(admin: PublicKey, market: PublicKey, winningOutcome: "Yes" | "No" | null, feeRecipient?: PublicKey): Promise<TransactionInstruction>;
138
180
  /**
139
181
  * Build a complete transaction to resolve a market
140
182
  */
141
- buildResolveMarketTx(admin: PublicKey, market: PublicKey, winningOutcome: "Yes" | "No" | null): Promise<Transaction>;
183
+ buildResolveMarketTx(admin: PublicKey, market: PublicKey, winningOutcome: "Yes" | "No" | null, feeRecipient?: PublicKey): Promise<Transaction>;
142
184
  /**
143
185
  * Close a market (Admin only)
144
186
  */
@@ -155,6 +197,28 @@ export declare class DramaPmClient {
155
197
  * Build a complete transaction to close a market
156
198
  */
157
199
  buildCloseMarketTxByID(admin: PublicKey, marketId: number | BN): Promise<Transaction>;
200
+ /**
201
+ * Close market account and reclaim rent (Admin only)
202
+ * Can only be called after market is resolved and all rewards claimed
203
+ */
204
+ closeMarketAccount(admin: PublicKey, market: PublicKey): Promise<TransactionInstruction>;
205
+ /**
206
+ * Build a complete transaction to close market account
207
+ */
208
+ buildCloseMarketAccountTx(admin: PublicKey, market: PublicKey): Promise<Transaction>;
209
+ /**
210
+ * Burn worthless tokens from the losing side of a resolved market.
211
+ * This allows users to clean up their losing tokens so the market account can be closed.
212
+ * @param user - The user who holds losing tokens
213
+ * @param market - The market PDA
214
+ * @param winningOutcome - The outcome that won (so we burn the opposite side)
215
+ * @param tokenAmount - Amount to burn (0 = burn all)
216
+ */
217
+ burnMarketTokens(user: PublicKey, market: PublicKey, losingOutcome: Outcome, tokenAmount?: number | BN): Promise<TransactionInstruction>;
218
+ /**
219
+ * Build a complete transaction to burn market tokens
220
+ */
221
+ buildBurnMarketTokensTx(user: PublicKey, market: PublicKey, losingOutcome: Outcome, tokenAmount?: number | BN): Promise<Transaction>;
158
222
  /**
159
223
  * Fetch global config account data
160
224
  */
@@ -163,6 +227,7 @@ export declare class DramaPmClient {
163
227
  authorizedAdmins: PublicKey[];
164
228
  feeBps: number;
165
229
  feeRecipient: PublicKey;
230
+ feeClaimBps: number;
166
231
  }>;
167
232
  /**
168
233
  * Fetch market account data