@gvnrdao/dh-sdk 0.0.103 → 0.0.105
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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +42 -6
- package/dist/index.mjs +42 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -6096,6 +6096,8 @@ interface GraphPositionDTO {
|
|
|
6096
6096
|
createdAt: TimestampString;
|
|
6097
6097
|
lastUpdated: TimestampString;
|
|
6098
6098
|
vaultAddress: string;
|
|
6099
|
+
ucdMinted?: BigIntString;
|
|
6100
|
+
ucdPaid?: BigIntString;
|
|
6099
6101
|
ucdDebt: BigIntString;
|
|
6100
6102
|
selectedTerm: string;
|
|
6101
6103
|
status: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -6096,6 +6096,8 @@ interface GraphPositionDTO {
|
|
|
6096
6096
|
createdAt: TimestampString;
|
|
6097
6097
|
lastUpdated: TimestampString;
|
|
6098
6098
|
vaultAddress: string;
|
|
6099
|
+
ucdMinted?: BigIntString;
|
|
6100
|
+
ucdPaid?: BigIntString;
|
|
6099
6101
|
ucdDebt: BigIntString;
|
|
6100
6102
|
selectedTerm: string;
|
|
6101
6103
|
status: string;
|
package/dist/index.js
CHANGED
|
@@ -44274,16 +44274,42 @@ var LoanQuery = class {
|
|
|
44274
44274
|
}
|
|
44275
44275
|
return tryCatchAsync(
|
|
44276
44276
|
async () => {
|
|
44277
|
-
const
|
|
44277
|
+
const rawLoan = await this.config.graphClient.getDetailedPositionById(
|
|
44278
44278
|
positionId
|
|
44279
44279
|
);
|
|
44280
|
-
if (!
|
|
44280
|
+
if (!rawLoan) {
|
|
44281
44281
|
return null;
|
|
44282
44282
|
}
|
|
44283
|
+
const borrowerId = typeof rawLoan.borrower === "string" ? rawLoan.borrower : rawLoan.borrower?.id || "";
|
|
44284
|
+
const borrowerCreatedAt = typeof rawLoan.borrower === "object" && rawLoan.borrower?.createdAt ? Number(rawLoan.borrower.createdAt) : 0;
|
|
44285
|
+
const loanData = {
|
|
44286
|
+
id: rawLoan.id,
|
|
44287
|
+
pkpId: rawLoan.pkpId,
|
|
44288
|
+
borrower: {
|
|
44289
|
+
createdAt: borrowerCreatedAt,
|
|
44290
|
+
id: borrowerId
|
|
44291
|
+
},
|
|
44292
|
+
createdAt: rawLoan.createdAt ? Number(rawLoan.createdAt) : 0,
|
|
44293
|
+
lastUpdatedAt: rawLoan.lastUpdated ? Number(rawLoan.lastUpdated) : 0,
|
|
44294
|
+
loan: {
|
|
44295
|
+
ucdMinted: rawLoan.ucdMinted ? Number(rawLoan.ucdMinted) : 0,
|
|
44296
|
+
ucdPaid: rawLoan.ucdPaid ? Number(rawLoan.ucdPaid) : 0,
|
|
44297
|
+
ucdDebt: rawLoan.ucdDebt ? Number(rawLoan.ucdDebt) : 0,
|
|
44298
|
+
selectedTerm: rawLoan.selectedTerm ? Number(rawLoan.selectedTerm) : 0,
|
|
44299
|
+
status: rawLoan.status,
|
|
44300
|
+
expiryAt: rawLoan.expiryAt ? Number(rawLoan.expiryAt) : 0
|
|
44301
|
+
},
|
|
44302
|
+
collateral: {
|
|
44303
|
+
vaultAddress: ""
|
|
44304
|
+
// Will be enriched below
|
|
44305
|
+
}
|
|
44306
|
+
};
|
|
44307
|
+
const enrichedLoans = await this.enrichLoansWithVaultAddresses([loanData]);
|
|
44308
|
+
const enrichedLoan = enrichedLoans[0] || loanData;
|
|
44283
44309
|
if (enrichBalance) {
|
|
44284
|
-
await this.enrichLoanWithBalance(
|
|
44310
|
+
await this.enrichLoanWithBalance(enrichedLoan);
|
|
44285
44311
|
}
|
|
44286
|
-
return
|
|
44312
|
+
return enrichedLoan;
|
|
44287
44313
|
},
|
|
44288
44314
|
(error) => new SDKError({
|
|
44289
44315
|
message: "Failed to query loan by ID",
|
|
@@ -46680,6 +46706,9 @@ var DiamondHandsGraph = class {
|
|
|
46680
46706
|
query,
|
|
46681
46707
|
variables
|
|
46682
46708
|
);
|
|
46709
|
+
if (!result || !result.positions) {
|
|
46710
|
+
return null;
|
|
46711
|
+
}
|
|
46683
46712
|
return result.positions[0] || null;
|
|
46684
46713
|
}
|
|
46685
46714
|
/**
|
|
@@ -46698,6 +46727,8 @@ var DiamondHandsGraph = class {
|
|
|
46698
46727
|
lastUpdated
|
|
46699
46728
|
pkpId
|
|
46700
46729
|
status
|
|
46730
|
+
ucdMinted
|
|
46731
|
+
ucdPaid
|
|
46701
46732
|
ucdDebt
|
|
46702
46733
|
totalPaid
|
|
46703
46734
|
totalExtensions
|
|
@@ -46755,6 +46786,9 @@ var DiamondHandsGraph = class {
|
|
|
46755
46786
|
query,
|
|
46756
46787
|
variables
|
|
46757
46788
|
);
|
|
46789
|
+
if (!result || !result.positions) {
|
|
46790
|
+
return null;
|
|
46791
|
+
}
|
|
46758
46792
|
return result.positions[0] || null;
|
|
46759
46793
|
}
|
|
46760
46794
|
/**
|
|
@@ -46829,7 +46863,8 @@ var DiamondHandsGraph = class {
|
|
|
46829
46863
|
{ first, skip, orderBy, orderDirection }
|
|
46830
46864
|
);
|
|
46831
46865
|
const total = await this.getTotalCountPaginated();
|
|
46832
|
-
const
|
|
46866
|
+
const positions = result && result.positions || [];
|
|
46867
|
+
const transformedPositions = positions.map(
|
|
46833
46868
|
(p) => this.transformGraphPositionToLoanData(p)
|
|
46834
46869
|
);
|
|
46835
46870
|
return {
|
|
@@ -46876,7 +46911,8 @@ var DiamondHandsGraph = class {
|
|
|
46876
46911
|
"{ status_in: $statuses }",
|
|
46877
46912
|
{ statuses }
|
|
46878
46913
|
);
|
|
46879
|
-
const
|
|
46914
|
+
const positions = result && result.positions || [];
|
|
46915
|
+
const transformedPositions = positions.map(
|
|
46880
46916
|
(p) => this.transformGraphPositionToLoanData(p)
|
|
46881
46917
|
);
|
|
46882
46918
|
return {
|
package/dist/index.mjs
CHANGED
|
@@ -44180,16 +44180,42 @@ var LoanQuery = class {
|
|
|
44180
44180
|
}
|
|
44181
44181
|
return tryCatchAsync(
|
|
44182
44182
|
async () => {
|
|
44183
|
-
const
|
|
44183
|
+
const rawLoan = await this.config.graphClient.getDetailedPositionById(
|
|
44184
44184
|
positionId
|
|
44185
44185
|
);
|
|
44186
|
-
if (!
|
|
44186
|
+
if (!rawLoan) {
|
|
44187
44187
|
return null;
|
|
44188
44188
|
}
|
|
44189
|
+
const borrowerId = typeof rawLoan.borrower === "string" ? rawLoan.borrower : rawLoan.borrower?.id || "";
|
|
44190
|
+
const borrowerCreatedAt = typeof rawLoan.borrower === "object" && rawLoan.borrower?.createdAt ? Number(rawLoan.borrower.createdAt) : 0;
|
|
44191
|
+
const loanData = {
|
|
44192
|
+
id: rawLoan.id,
|
|
44193
|
+
pkpId: rawLoan.pkpId,
|
|
44194
|
+
borrower: {
|
|
44195
|
+
createdAt: borrowerCreatedAt,
|
|
44196
|
+
id: borrowerId
|
|
44197
|
+
},
|
|
44198
|
+
createdAt: rawLoan.createdAt ? Number(rawLoan.createdAt) : 0,
|
|
44199
|
+
lastUpdatedAt: rawLoan.lastUpdated ? Number(rawLoan.lastUpdated) : 0,
|
|
44200
|
+
loan: {
|
|
44201
|
+
ucdMinted: rawLoan.ucdMinted ? Number(rawLoan.ucdMinted) : 0,
|
|
44202
|
+
ucdPaid: rawLoan.ucdPaid ? Number(rawLoan.ucdPaid) : 0,
|
|
44203
|
+
ucdDebt: rawLoan.ucdDebt ? Number(rawLoan.ucdDebt) : 0,
|
|
44204
|
+
selectedTerm: rawLoan.selectedTerm ? Number(rawLoan.selectedTerm) : 0,
|
|
44205
|
+
status: rawLoan.status,
|
|
44206
|
+
expiryAt: rawLoan.expiryAt ? Number(rawLoan.expiryAt) : 0
|
|
44207
|
+
},
|
|
44208
|
+
collateral: {
|
|
44209
|
+
vaultAddress: ""
|
|
44210
|
+
// Will be enriched below
|
|
44211
|
+
}
|
|
44212
|
+
};
|
|
44213
|
+
const enrichedLoans = await this.enrichLoansWithVaultAddresses([loanData]);
|
|
44214
|
+
const enrichedLoan = enrichedLoans[0] || loanData;
|
|
44189
44215
|
if (enrichBalance) {
|
|
44190
|
-
await this.enrichLoanWithBalance(
|
|
44216
|
+
await this.enrichLoanWithBalance(enrichedLoan);
|
|
44191
44217
|
}
|
|
44192
|
-
return
|
|
44218
|
+
return enrichedLoan;
|
|
44193
44219
|
},
|
|
44194
44220
|
(error) => new SDKError({
|
|
44195
44221
|
message: "Failed to query loan by ID",
|
|
@@ -46586,6 +46612,9 @@ var DiamondHandsGraph = class {
|
|
|
46586
46612
|
query,
|
|
46587
46613
|
variables
|
|
46588
46614
|
);
|
|
46615
|
+
if (!result || !result.positions) {
|
|
46616
|
+
return null;
|
|
46617
|
+
}
|
|
46589
46618
|
return result.positions[0] || null;
|
|
46590
46619
|
}
|
|
46591
46620
|
/**
|
|
@@ -46604,6 +46633,8 @@ var DiamondHandsGraph = class {
|
|
|
46604
46633
|
lastUpdated
|
|
46605
46634
|
pkpId
|
|
46606
46635
|
status
|
|
46636
|
+
ucdMinted
|
|
46637
|
+
ucdPaid
|
|
46607
46638
|
ucdDebt
|
|
46608
46639
|
totalPaid
|
|
46609
46640
|
totalExtensions
|
|
@@ -46661,6 +46692,9 @@ var DiamondHandsGraph = class {
|
|
|
46661
46692
|
query,
|
|
46662
46693
|
variables
|
|
46663
46694
|
);
|
|
46695
|
+
if (!result || !result.positions) {
|
|
46696
|
+
return null;
|
|
46697
|
+
}
|
|
46664
46698
|
return result.positions[0] || null;
|
|
46665
46699
|
}
|
|
46666
46700
|
/**
|
|
@@ -46735,7 +46769,8 @@ var DiamondHandsGraph = class {
|
|
|
46735
46769
|
{ first, skip, orderBy, orderDirection }
|
|
46736
46770
|
);
|
|
46737
46771
|
const total = await this.getTotalCountPaginated();
|
|
46738
|
-
const
|
|
46772
|
+
const positions = result && result.positions || [];
|
|
46773
|
+
const transformedPositions = positions.map(
|
|
46739
46774
|
(p) => this.transformGraphPositionToLoanData(p)
|
|
46740
46775
|
);
|
|
46741
46776
|
return {
|
|
@@ -46782,7 +46817,8 @@ var DiamondHandsGraph = class {
|
|
|
46782
46817
|
"{ status_in: $statuses }",
|
|
46783
46818
|
{ statuses }
|
|
46784
46819
|
);
|
|
46785
|
-
const
|
|
46820
|
+
const positions = result && result.positions || [];
|
|
46821
|
+
const transformedPositions = positions.map(
|
|
46786
46822
|
(p) => this.transformGraphPositionToLoanData(p)
|
|
46787
46823
|
);
|
|
46788
46824
|
return {
|
package/package.json
CHANGED