@gvnrdao/dh-sdk 0.0.130 → 0.0.131
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/browser/dist/browser.js +3 -3
- package/dist/index.d.mts +39 -4
- package/dist/index.d.ts +39 -4
- package/dist/index.js +415 -131
- package/dist/index.mjs +414 -130
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3779,6 +3779,8 @@ interface ContractManagerConfig {
|
|
|
3779
3779
|
signer?: Signer;
|
|
3780
3780
|
/** Contract addresses for the target network */
|
|
3781
3781
|
contractAddresses: ContractAddresses;
|
|
3782
|
+
/** SDK mode: 'service' or 'standalone' */
|
|
3783
|
+
mode?: 'service' | 'standalone';
|
|
3782
3784
|
/** Enable debug logging */
|
|
3783
3785
|
debug?: boolean;
|
|
3784
3786
|
}
|
|
@@ -5705,6 +5707,8 @@ interface LoanCreatorConfig {
|
|
|
5705
5707
|
litOpsSigner?: Wallet;
|
|
5706
5708
|
/** SDK mode: 'service' or 'standalone' */
|
|
5707
5709
|
mode?: "service" | "standalone";
|
|
5710
|
+
/** Service endpoint for backend operations (service mode only) */
|
|
5711
|
+
serviceEndpoint?: string;
|
|
5708
5712
|
/** LIT Action CID for loan creation */
|
|
5709
5713
|
litActionCid: string;
|
|
5710
5714
|
/** User ID (typically wallet address) */
|
|
@@ -6239,7 +6243,8 @@ interface UserRateLimitData {
|
|
|
6239
6243
|
declare class DiamondHandsGraph {
|
|
6240
6244
|
private client;
|
|
6241
6245
|
private defaultPageSize;
|
|
6242
|
-
|
|
6246
|
+
private bitcoinOps?;
|
|
6247
|
+
constructor(config: DiamondHandsGraphConfig, bitcoinOps?: BitcoinOperations);
|
|
6243
6248
|
/**
|
|
6244
6249
|
* Transform graph position data to LoanData interface
|
|
6245
6250
|
* Converts flat graph structure to nested LoanData structure
|
|
@@ -6268,6 +6273,25 @@ declare class DiamondHandsGraph {
|
|
|
6268
6273
|
positions: LoanData[];
|
|
6269
6274
|
total: number;
|
|
6270
6275
|
}>;
|
|
6276
|
+
/**
|
|
6277
|
+
* Get user positions with enriched Bitcoin balance data
|
|
6278
|
+
*
|
|
6279
|
+
* Same as getUserPositions but queries actual BTC balance from Bitcoin network
|
|
6280
|
+
* for each vault address in parallel.
|
|
6281
|
+
*
|
|
6282
|
+
* @param userAddress - User's Ethereum address
|
|
6283
|
+
* @param first - Optional: max number of positions to return (default: 10)
|
|
6284
|
+
* @param skip - Optional: number of positions to skip (default: 0)
|
|
6285
|
+
* @param orderBy - Optional: field to order by (default: "createdAt")
|
|
6286
|
+
* @param orderDirection - Optional: asc or desc (default: "desc" - most recent first)
|
|
6287
|
+
* @returns Positions with actual BTC balances from Bitcoin network
|
|
6288
|
+
*/
|
|
6289
|
+
getUserPositionsWithBtc(userAddress: string, first?: number, skip?: number, orderBy?: string, orderDirection?: "asc" | "desc"): Promise<{
|
|
6290
|
+
positions: (LoanData & {
|
|
6291
|
+
btcBalance?: EnrichedBitcoinBalance;
|
|
6292
|
+
})[];
|
|
6293
|
+
total: number;
|
|
6294
|
+
}>;
|
|
6271
6295
|
/**
|
|
6272
6296
|
* Get position by PKP ID from subgraph
|
|
6273
6297
|
*/
|
|
@@ -6290,14 +6314,14 @@ declare class DiamondHandsGraph {
|
|
|
6290
6314
|
/**
|
|
6291
6315
|
* Get all positions directly (simple query with pagination support)
|
|
6292
6316
|
*/
|
|
6293
|
-
getPositions(first?: number, orderBy?: string, orderDirection?:
|
|
6317
|
+
getPositions(first?: number, orderBy?: string, orderDirection?: "asc" | "desc", skip?: number): Promise<{
|
|
6294
6318
|
positions: LoanData[];
|
|
6295
6319
|
total: number;
|
|
6296
6320
|
}>;
|
|
6297
6321
|
/**
|
|
6298
6322
|
* Get positions filtered by an array of statuses
|
|
6299
6323
|
*/
|
|
6300
|
-
getPositionsByStatus(statuses: string[], first?: number, orderBy?: string, orderDirection?:
|
|
6324
|
+
getPositionsByStatus(statuses: string[], first?: number, orderBy?: string, orderDirection?: "asc" | "desc", skip?: number): Promise<{
|
|
6301
6325
|
positions: LoanData[];
|
|
6302
6326
|
total: number;
|
|
6303
6327
|
}>;
|
|
@@ -6362,7 +6386,7 @@ declare class DiamondHandsGraph {
|
|
|
6362
6386
|
getPSMTransactions(filters?: {
|
|
6363
6387
|
user?: string;
|
|
6364
6388
|
stablecoin?: string;
|
|
6365
|
-
type?:
|
|
6389
|
+
type?: "SWAP" | "REDEEM";
|
|
6366
6390
|
first?: number;
|
|
6367
6391
|
skip?: number;
|
|
6368
6392
|
}): Promise<PSMTransactionData[]>;
|
|
@@ -6476,6 +6500,17 @@ declare class LoanQuery {
|
|
|
6476
6500
|
* @returns Paginated loans response
|
|
6477
6501
|
*/
|
|
6478
6502
|
getLoans(filters?: LoanQueryFilters, pagination?: PaginationParams): Promise<Result$1<PaginatedLoansResponse, SDKError>>;
|
|
6503
|
+
/**
|
|
6504
|
+
* Get loans with BTC balance data from Bitcoin network
|
|
6505
|
+
*
|
|
6506
|
+
* Same as getLoans but includes actual Bitcoin balance for each position's vault.
|
|
6507
|
+
* Queries BTC balances in parallel for performance.
|
|
6508
|
+
*
|
|
6509
|
+
* @param filters - Query filters
|
|
6510
|
+
* @param pagination - Pagination parameters
|
|
6511
|
+
* @returns Paginated loans response with BTC balance data
|
|
6512
|
+
*/
|
|
6513
|
+
getLoansWithBtc(filters?: LoanQueryFilters, pagination?: PaginationParams): Promise<Result$1<PaginatedLoansResponse, SDKError>>;
|
|
6479
6514
|
/**
|
|
6480
6515
|
* Enrich loans with vault addresses derived from PKP public keys
|
|
6481
6516
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -3779,6 +3779,8 @@ interface ContractManagerConfig {
|
|
|
3779
3779
|
signer?: Signer;
|
|
3780
3780
|
/** Contract addresses for the target network */
|
|
3781
3781
|
contractAddresses: ContractAddresses;
|
|
3782
|
+
/** SDK mode: 'service' or 'standalone' */
|
|
3783
|
+
mode?: 'service' | 'standalone';
|
|
3782
3784
|
/** Enable debug logging */
|
|
3783
3785
|
debug?: boolean;
|
|
3784
3786
|
}
|
|
@@ -5705,6 +5707,8 @@ interface LoanCreatorConfig {
|
|
|
5705
5707
|
litOpsSigner?: Wallet;
|
|
5706
5708
|
/** SDK mode: 'service' or 'standalone' */
|
|
5707
5709
|
mode?: "service" | "standalone";
|
|
5710
|
+
/** Service endpoint for backend operations (service mode only) */
|
|
5711
|
+
serviceEndpoint?: string;
|
|
5708
5712
|
/** LIT Action CID for loan creation */
|
|
5709
5713
|
litActionCid: string;
|
|
5710
5714
|
/** User ID (typically wallet address) */
|
|
@@ -6239,7 +6243,8 @@ interface UserRateLimitData {
|
|
|
6239
6243
|
declare class DiamondHandsGraph {
|
|
6240
6244
|
private client;
|
|
6241
6245
|
private defaultPageSize;
|
|
6242
|
-
|
|
6246
|
+
private bitcoinOps?;
|
|
6247
|
+
constructor(config: DiamondHandsGraphConfig, bitcoinOps?: BitcoinOperations);
|
|
6243
6248
|
/**
|
|
6244
6249
|
* Transform graph position data to LoanData interface
|
|
6245
6250
|
* Converts flat graph structure to nested LoanData structure
|
|
@@ -6268,6 +6273,25 @@ declare class DiamondHandsGraph {
|
|
|
6268
6273
|
positions: LoanData[];
|
|
6269
6274
|
total: number;
|
|
6270
6275
|
}>;
|
|
6276
|
+
/**
|
|
6277
|
+
* Get user positions with enriched Bitcoin balance data
|
|
6278
|
+
*
|
|
6279
|
+
* Same as getUserPositions but queries actual BTC balance from Bitcoin network
|
|
6280
|
+
* for each vault address in parallel.
|
|
6281
|
+
*
|
|
6282
|
+
* @param userAddress - User's Ethereum address
|
|
6283
|
+
* @param first - Optional: max number of positions to return (default: 10)
|
|
6284
|
+
* @param skip - Optional: number of positions to skip (default: 0)
|
|
6285
|
+
* @param orderBy - Optional: field to order by (default: "createdAt")
|
|
6286
|
+
* @param orderDirection - Optional: asc or desc (default: "desc" - most recent first)
|
|
6287
|
+
* @returns Positions with actual BTC balances from Bitcoin network
|
|
6288
|
+
*/
|
|
6289
|
+
getUserPositionsWithBtc(userAddress: string, first?: number, skip?: number, orderBy?: string, orderDirection?: "asc" | "desc"): Promise<{
|
|
6290
|
+
positions: (LoanData & {
|
|
6291
|
+
btcBalance?: EnrichedBitcoinBalance;
|
|
6292
|
+
})[];
|
|
6293
|
+
total: number;
|
|
6294
|
+
}>;
|
|
6271
6295
|
/**
|
|
6272
6296
|
* Get position by PKP ID from subgraph
|
|
6273
6297
|
*/
|
|
@@ -6290,14 +6314,14 @@ declare class DiamondHandsGraph {
|
|
|
6290
6314
|
/**
|
|
6291
6315
|
* Get all positions directly (simple query with pagination support)
|
|
6292
6316
|
*/
|
|
6293
|
-
getPositions(first?: number, orderBy?: string, orderDirection?:
|
|
6317
|
+
getPositions(first?: number, orderBy?: string, orderDirection?: "asc" | "desc", skip?: number): Promise<{
|
|
6294
6318
|
positions: LoanData[];
|
|
6295
6319
|
total: number;
|
|
6296
6320
|
}>;
|
|
6297
6321
|
/**
|
|
6298
6322
|
* Get positions filtered by an array of statuses
|
|
6299
6323
|
*/
|
|
6300
|
-
getPositionsByStatus(statuses: string[], first?: number, orderBy?: string, orderDirection?:
|
|
6324
|
+
getPositionsByStatus(statuses: string[], first?: number, orderBy?: string, orderDirection?: "asc" | "desc", skip?: number): Promise<{
|
|
6301
6325
|
positions: LoanData[];
|
|
6302
6326
|
total: number;
|
|
6303
6327
|
}>;
|
|
@@ -6362,7 +6386,7 @@ declare class DiamondHandsGraph {
|
|
|
6362
6386
|
getPSMTransactions(filters?: {
|
|
6363
6387
|
user?: string;
|
|
6364
6388
|
stablecoin?: string;
|
|
6365
|
-
type?:
|
|
6389
|
+
type?: "SWAP" | "REDEEM";
|
|
6366
6390
|
first?: number;
|
|
6367
6391
|
skip?: number;
|
|
6368
6392
|
}): Promise<PSMTransactionData[]>;
|
|
@@ -6476,6 +6500,17 @@ declare class LoanQuery {
|
|
|
6476
6500
|
* @returns Paginated loans response
|
|
6477
6501
|
*/
|
|
6478
6502
|
getLoans(filters?: LoanQueryFilters, pagination?: PaginationParams): Promise<Result$1<PaginatedLoansResponse, SDKError>>;
|
|
6503
|
+
/**
|
|
6504
|
+
* Get loans with BTC balance data from Bitcoin network
|
|
6505
|
+
*
|
|
6506
|
+
* Same as getLoans but includes actual Bitcoin balance for each position's vault.
|
|
6507
|
+
* Queries BTC balances in parallel for performance.
|
|
6508
|
+
*
|
|
6509
|
+
* @param filters - Query filters
|
|
6510
|
+
* @param pagination - Pagination parameters
|
|
6511
|
+
* @returns Paginated loans response with BTC balance data
|
|
6512
|
+
*/
|
|
6513
|
+
getLoansWithBtc(filters?: LoanQueryFilters, pagination?: PaginationParams): Promise<Result$1<PaginatedLoansResponse, SDKError>>;
|
|
6479
6514
|
/**
|
|
6480
6515
|
* Enrich loans with vault addresses derived from PKP public keys
|
|
6481
6516
|
*
|