@gvnrdao/dh-sdk 0.0.93 → 0.0.94
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.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +24 -6
- package/dist/index.mjs +24 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5185,7 +5185,7 @@ declare class DiamondHandsSDK {
|
|
|
5185
5185
|
/**
|
|
5186
5186
|
* Get all loans with pagination
|
|
5187
5187
|
*
|
|
5188
|
-
* @param pagination - Pagination parameters (page, maxRows)
|
|
5188
|
+
* @param pagination - Pagination parameters (page, maxRows, orderBy, orderDirection)
|
|
5189
5189
|
* @param enrichBalance - Whether to enrich loans with Bitcoin balance (not used currently)
|
|
5190
5190
|
* @param source - Data source: "subgraph" (default) or "contract"
|
|
5191
5191
|
* @returns Array of loans for the specified page
|
|
@@ -5193,6 +5193,8 @@ declare class DiamondHandsSDK {
|
|
|
5193
5193
|
getLoansAll(pagination?: {
|
|
5194
5194
|
page?: number;
|
|
5195
5195
|
maxRows?: number;
|
|
5196
|
+
orderBy?: "createdAt" | "lastUpdatedAt" | "ucdDebt";
|
|
5197
|
+
orderDirection?: "asc" | "desc";
|
|
5196
5198
|
}, enrichBalance?: boolean, source?: "subgraph" | "contract"): Promise<LoanData[]>;
|
|
5197
5199
|
/**
|
|
5198
5200
|
* Get all events for a loan position from the subgraph
|
package/dist/index.d.ts
CHANGED
|
@@ -5185,7 +5185,7 @@ declare class DiamondHandsSDK {
|
|
|
5185
5185
|
/**
|
|
5186
5186
|
* Get all loans with pagination
|
|
5187
5187
|
*
|
|
5188
|
-
* @param pagination - Pagination parameters (page, maxRows)
|
|
5188
|
+
* @param pagination - Pagination parameters (page, maxRows, orderBy, orderDirection)
|
|
5189
5189
|
* @param enrichBalance - Whether to enrich loans with Bitcoin balance (not used currently)
|
|
5190
5190
|
* @param source - Data source: "subgraph" (default) or "contract"
|
|
5191
5191
|
* @returns Array of loans for the specified page
|
|
@@ -5193,6 +5193,8 @@ declare class DiamondHandsSDK {
|
|
|
5193
5193
|
getLoansAll(pagination?: {
|
|
5194
5194
|
page?: number;
|
|
5195
5195
|
maxRows?: number;
|
|
5196
|
+
orderBy?: "createdAt" | "lastUpdatedAt" | "ucdDebt";
|
|
5197
|
+
orderDirection?: "asc" | "desc";
|
|
5196
5198
|
}, enrichBalance?: boolean, source?: "subgraph" | "contract"): Promise<LoanData[]>;
|
|
5197
5199
|
/**
|
|
5198
5200
|
* Get all events for a loan position from the subgraph
|
package/dist/index.js
CHANGED
|
@@ -46509,8 +46509,20 @@ var DiamondHandsGraph = class {
|
|
|
46509
46509
|
const batchSize = THE_GRAPH_MAX_BATCH_SIZE;
|
|
46510
46510
|
while (hasMore) {
|
|
46511
46511
|
const whereStr = whereClause ? `, where: ${whereClause}` : "";
|
|
46512
|
+
const variableDeclarations = ["$skip: Int!"];
|
|
46513
|
+
if (variables) {
|
|
46514
|
+
if (variables["borrower"] !== void 0) {
|
|
46515
|
+
variableDeclarations.push("$borrower: Bytes!");
|
|
46516
|
+
}
|
|
46517
|
+
if (variables["status"] !== void 0) {
|
|
46518
|
+
variableDeclarations.push("$status: [Position_status!]");
|
|
46519
|
+
}
|
|
46520
|
+
if (variables["statuses"] !== void 0) {
|
|
46521
|
+
variableDeclarations.push("$statuses: [Position_status!]");
|
|
46522
|
+
}
|
|
46523
|
+
}
|
|
46512
46524
|
const query = `
|
|
46513
|
-
query GetCount($
|
|
46525
|
+
query GetCount(${variableDeclarations.join(", ")}) {
|
|
46514
46526
|
positions(first: ${batchSize}, skip: $skip${whereStr}, orderBy: id) {
|
|
46515
46527
|
id
|
|
46516
46528
|
}
|
|
@@ -50220,7 +50232,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
50220
50232
|
/**
|
|
50221
50233
|
* Get all loans with pagination
|
|
50222
50234
|
*
|
|
50223
|
-
* @param pagination - Pagination parameters (page, maxRows)
|
|
50235
|
+
* @param pagination - Pagination parameters (page, maxRows, orderBy, orderDirection)
|
|
50224
50236
|
* @param enrichBalance - Whether to enrich loans with Bitcoin balance (not used currently)
|
|
50225
50237
|
* @param source - Data source: "subgraph" (default) or "contract"
|
|
50226
50238
|
* @returns Array of loans for the specified page
|
|
@@ -50230,10 +50242,16 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
50230
50242
|
if (source === "contract") {
|
|
50231
50243
|
throw new Error("Contract source not yet implemented - use subgraph");
|
|
50232
50244
|
}
|
|
50233
|
-
const result = await this.loanQuery.getLoans(
|
|
50234
|
-
|
|
50235
|
-
|
|
50236
|
-
|
|
50245
|
+
const result = await this.loanQuery.getLoans(
|
|
50246
|
+
{
|
|
50247
|
+
orderBy: pagination?.orderBy || "createdAt",
|
|
50248
|
+
orderDirection: pagination?.orderDirection || "desc"
|
|
50249
|
+
},
|
|
50250
|
+
{
|
|
50251
|
+
page: pagination?.page || 0,
|
|
50252
|
+
pageSize: pagination?.maxRows || 10
|
|
50253
|
+
}
|
|
50254
|
+
);
|
|
50237
50255
|
if (!result.success) {
|
|
50238
50256
|
if (this.config.debug) {
|
|
50239
50257
|
console.error("[getLoansAll] Full error:", result.error);
|
package/dist/index.mjs
CHANGED
|
@@ -46415,8 +46415,20 @@ var DiamondHandsGraph = class {
|
|
|
46415
46415
|
const batchSize = THE_GRAPH_MAX_BATCH_SIZE;
|
|
46416
46416
|
while (hasMore) {
|
|
46417
46417
|
const whereStr = whereClause ? `, where: ${whereClause}` : "";
|
|
46418
|
+
const variableDeclarations = ["$skip: Int!"];
|
|
46419
|
+
if (variables) {
|
|
46420
|
+
if (variables["borrower"] !== void 0) {
|
|
46421
|
+
variableDeclarations.push("$borrower: Bytes!");
|
|
46422
|
+
}
|
|
46423
|
+
if (variables["status"] !== void 0) {
|
|
46424
|
+
variableDeclarations.push("$status: [Position_status!]");
|
|
46425
|
+
}
|
|
46426
|
+
if (variables["statuses"] !== void 0) {
|
|
46427
|
+
variableDeclarations.push("$statuses: [Position_status!]");
|
|
46428
|
+
}
|
|
46429
|
+
}
|
|
46418
46430
|
const query = `
|
|
46419
|
-
query GetCount($
|
|
46431
|
+
query GetCount(${variableDeclarations.join(", ")}) {
|
|
46420
46432
|
positions(first: ${batchSize}, skip: $skip${whereStr}, orderBy: id) {
|
|
46421
46433
|
id
|
|
46422
46434
|
}
|
|
@@ -50126,7 +50138,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
50126
50138
|
/**
|
|
50127
50139
|
* Get all loans with pagination
|
|
50128
50140
|
*
|
|
50129
|
-
* @param pagination - Pagination parameters (page, maxRows)
|
|
50141
|
+
* @param pagination - Pagination parameters (page, maxRows, orderBy, orderDirection)
|
|
50130
50142
|
* @param enrichBalance - Whether to enrich loans with Bitcoin balance (not used currently)
|
|
50131
50143
|
* @param source - Data source: "subgraph" (default) or "contract"
|
|
50132
50144
|
* @returns Array of loans for the specified page
|
|
@@ -50136,10 +50148,16 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
50136
50148
|
if (source === "contract") {
|
|
50137
50149
|
throw new Error("Contract source not yet implemented - use subgraph");
|
|
50138
50150
|
}
|
|
50139
|
-
const result = await this.loanQuery.getLoans(
|
|
50140
|
-
|
|
50141
|
-
|
|
50142
|
-
|
|
50151
|
+
const result = await this.loanQuery.getLoans(
|
|
50152
|
+
{
|
|
50153
|
+
orderBy: pagination?.orderBy || "createdAt",
|
|
50154
|
+
orderDirection: pagination?.orderDirection || "desc"
|
|
50155
|
+
},
|
|
50156
|
+
{
|
|
50157
|
+
page: pagination?.page || 0,
|
|
50158
|
+
pageSize: pagination?.maxRows || 10
|
|
50159
|
+
}
|
|
50160
|
+
);
|
|
50143
50161
|
if (!result.success) {
|
|
50144
50162
|
if (this.config.debug) {
|
|
50145
50163
|
console.error("[getLoansAll] Full error:", result.error);
|
package/package.json
CHANGED