@dimcool/sdk 0.1.19 → 0.1.21
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/README.md +16 -0
- package/dist/index.cjs +5 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -609,6 +609,22 @@ console.log(`User unbanned: ${!user.banned}`);
|
|
|
609
609
|
- Banned users receive a 403 Forbidden error with code `ACCOUNT_BANNED` when trying to log in or access any authenticated endpoint
|
|
610
610
|
- Banned users are directed to contact support@dim.gg to appeal their ban
|
|
611
611
|
|
|
612
|
+
### `getUserBalance(userId: string): Promise<{ sol: number; usdc: number; publicKey: string }>`
|
|
613
|
+
|
|
614
|
+
Get a user's wallet balance (admin only). Returns SOL balance, USDC balance (minor units), and wallet public key. Throws (e.g. 404) if the user has no wallet.
|
|
615
|
+
|
|
616
|
+
```typescript
|
|
617
|
+
const balance = await sdk.admin.getUserBalance('user-id');
|
|
618
|
+
console.log(`${balance.sol} SOL, ${balance.usdc / 1e6} USDC`);
|
|
619
|
+
console.log('Wallet:', balance.publicKey);
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
**Parameters:**
|
|
623
|
+
|
|
624
|
+
- `userId: string` - The ID of the user
|
|
625
|
+
|
|
626
|
+
**Returns:** `{ sol: number; usdc: number; publicKey: string }`. USDC is in minor units (1e6 = 1 USDC).
|
|
627
|
+
|
|
612
628
|
---
|
|
613
629
|
|
|
614
630
|
## Reports (`sdk.reports`)
|
package/dist/index.cjs
CHANGED
|
@@ -22185,6 +22185,11 @@ var Admin = class {
|
|
|
22185
22185
|
async getUserById(id) {
|
|
22186
22186
|
return this.http.get(`/admin/users/${id}`);
|
|
22187
22187
|
}
|
|
22188
|
+
async getUserBalance(userId) {
|
|
22189
|
+
return this.http.get(
|
|
22190
|
+
`/admin/users/${userId}/balance`
|
|
22191
|
+
);
|
|
22192
|
+
}
|
|
22188
22193
|
async getStats() {
|
|
22189
22194
|
return this.http.get("/admin/stats");
|
|
22190
22195
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -185,6 +185,7 @@ interface User {
|
|
|
185
185
|
bio?: string;
|
|
186
186
|
chessElo: number;
|
|
187
187
|
points: number;
|
|
188
|
+
type?: 'human' | 'bot';
|
|
188
189
|
createdAt: string;
|
|
189
190
|
updatedAt: string;
|
|
190
191
|
banned?: boolean;
|
|
@@ -954,6 +955,11 @@ declare class Admin {
|
|
|
954
955
|
private logger?;
|
|
955
956
|
constructor(http: IHttpClient, logger?: ILogger | undefined);
|
|
956
957
|
getUserById(id: string): Promise<User>;
|
|
958
|
+
getUserBalance(userId: string): Promise<{
|
|
959
|
+
sol: number;
|
|
960
|
+
usdc: number;
|
|
961
|
+
publicKey: string;
|
|
962
|
+
}>;
|
|
957
963
|
getStats(): Promise<AdminStats>;
|
|
958
964
|
getAdminStats(): Promise<AdminStats>;
|
|
959
965
|
getDailyStats(days?: number): Promise<AdminDailyStats>;
|
package/dist/index.d.ts
CHANGED
|
@@ -185,6 +185,7 @@ interface User {
|
|
|
185
185
|
bio?: string;
|
|
186
186
|
chessElo: number;
|
|
187
187
|
points: number;
|
|
188
|
+
type?: 'human' | 'bot';
|
|
188
189
|
createdAt: string;
|
|
189
190
|
updatedAt: string;
|
|
190
191
|
banned?: boolean;
|
|
@@ -954,6 +955,11 @@ declare class Admin {
|
|
|
954
955
|
private logger?;
|
|
955
956
|
constructor(http: IHttpClient, logger?: ILogger | undefined);
|
|
956
957
|
getUserById(id: string): Promise<User>;
|
|
958
|
+
getUserBalance(userId: string): Promise<{
|
|
959
|
+
sol: number;
|
|
960
|
+
usdc: number;
|
|
961
|
+
publicKey: string;
|
|
962
|
+
}>;
|
|
957
963
|
getStats(): Promise<AdminStats>;
|
|
958
964
|
getAdminStats(): Promise<AdminStats>;
|
|
959
965
|
getDailyStats(days?: number): Promise<AdminDailyStats>;
|
package/dist/index.js
CHANGED
|
@@ -22144,6 +22144,11 @@ var Admin = class {
|
|
|
22144
22144
|
async getUserById(id) {
|
|
22145
22145
|
return this.http.get(`/admin/users/${id}`);
|
|
22146
22146
|
}
|
|
22147
|
+
async getUserBalance(userId) {
|
|
22148
|
+
return this.http.get(
|
|
22149
|
+
`/admin/users/${userId}/balance`
|
|
22150
|
+
);
|
|
22151
|
+
}
|
|
22147
22152
|
async getStats() {
|
|
22148
22153
|
return this.http.get("/admin/stats");
|
|
22149
22154
|
}
|