@gvnrdao/dh-sdk 0.0.212 → 0.0.214
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 +1 -1
- package/dist/index.js +132 -6
- package/dist/index.mjs +132 -6
- package/dist/modules/diamond-hands-sdk.d.ts +3 -2
- package/dist/types/event-types.d.ts +69 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export type { DiamondHandsSDKConfig, SDKMode, ContractAddresses, BitcoinProvider
|
|
|
41
41
|
export type { PKPData, PKPCreationRequest, PKPCreationResult, PKPValidationResult, } from './interfaces/chunks/pkp-integration.i';
|
|
42
42
|
export type { AuthorizationRequest, AuthorizationResult, BTCDepositRequest, BTCDepositResult, } from './interfaces/chunks/requests.i';
|
|
43
43
|
export { LoanStatus } from './types/loanStatus';
|
|
44
|
-
export type { LoanEvents, LoanEventsFilter, PaymentEvent, StatusUpdateEvent, LiquidationEvent, UCDMintEvent, FeeDistributionEvent, WithdrawalEvent, RenewalEvent, OperationFailureEvent, MintRequestEvent, BurnRequestEvent, CollateralContractEvent, CircuitBreakerProtocolEvent, TermFeeUpdateEvent, } from './types/event-types';
|
|
44
|
+
export type { LoanEvents, LoanEventsFilter, PaymentEvent, StatusUpdateEvent, LiquidationEvent, UCDMintEvent, FeeDistributionEvent, WithdrawalEvent, RenewalEvent, OperationFailureEvent, MintRequestEvent, BurnRequestEvent, CollateralContractEvent, CircuitBreakerProtocolEvent, TermFeeUpdateEvent, LoanProtocolParamUpdateEvent, MaxLoanValueUpdateEvent, BtcPriceBoundsUpdateEvent, PerUserDailyMintLimitUpdateEvent, } from './types/event-types';
|
|
45
45
|
export { PaymentType, PositionStatus, isValidPositionStatus, isValidPaymentType, numericToPositionStatus, EventHelpers, } from './types/event-types';
|
|
46
46
|
export { fetchProtocolPauseStatus, assertProtocolNotPaused, } from './protocol/protocol-pause';
|
|
47
47
|
export type { ProtocolPauseStatus, ProtocolPauseKey, } from './protocol/protocol-pause';
|
package/dist/index.js
CHANGED
|
@@ -36257,7 +36257,11 @@ var DiamondHandsGraph = class {
|
|
|
36257
36257
|
burnRequest: !eventTypes || eventTypes.includes("burnRequest"),
|
|
36258
36258
|
collateralEvent: !eventTypes || eventTypes.includes("collateralEvent"),
|
|
36259
36259
|
circuitBreaker: !eventTypes || eventTypes.includes("circuitBreaker"),
|
|
36260
|
-
termFeeUpdate: !eventTypes || eventTypes.includes("termFeeUpdate")
|
|
36260
|
+
termFeeUpdate: !eventTypes || eventTypes.includes("termFeeUpdate"),
|
|
36261
|
+
loanProtocolParamUpdate: !eventTypes || eventTypes.includes("loanProtocolParamUpdate"),
|
|
36262
|
+
maxLoanValueUpdate: !eventTypes || eventTypes.includes("maxLoanValueUpdate"),
|
|
36263
|
+
btcPriceBoundsUpdate: !eventTypes || eventTypes.includes("btcPriceBoundsUpdate"),
|
|
36264
|
+
perUserMintLimitUpdate: !eventTypes || eventTypes.includes("perUserMintLimitUpdate")
|
|
36261
36265
|
};
|
|
36262
36266
|
const buildPositionWhereClause = () => {
|
|
36263
36267
|
const conditions = [`position: "${positionId.toLowerCase()}"`];
|
|
@@ -36507,6 +36511,78 @@ var DiamondHandsGraph = class {
|
|
|
36507
36511
|
transactionHash
|
|
36508
36512
|
}
|
|
36509
36513
|
` : ""}
|
|
36514
|
+
|
|
36515
|
+
${shouldQuery.loanProtocolParamUpdate ? `
|
|
36516
|
+
loanProtocolParamUpdates(
|
|
36517
|
+
${buildProtocolWhereClause()}
|
|
36518
|
+
first: $limit,
|
|
36519
|
+
orderBy: timestamp,
|
|
36520
|
+
orderDirection: $orderDirection
|
|
36521
|
+
) {
|
|
36522
|
+
id
|
|
36523
|
+
oldLiquidationThreshold
|
|
36524
|
+
newLiquidationThreshold
|
|
36525
|
+
oldMinimumLoanValueUcd
|
|
36526
|
+
newMinimumLoanValueUcd
|
|
36527
|
+
caller
|
|
36528
|
+
timestamp
|
|
36529
|
+
blockNumber
|
|
36530
|
+
transactionHash
|
|
36531
|
+
}
|
|
36532
|
+
` : ""}
|
|
36533
|
+
|
|
36534
|
+
${shouldQuery.maxLoanValueUpdate ? `
|
|
36535
|
+
maxLoanValueUpdates(
|
|
36536
|
+
${buildProtocolWhereClause()}
|
|
36537
|
+
first: $limit,
|
|
36538
|
+
orderBy: timestamp,
|
|
36539
|
+
orderDirection: $orderDirection
|
|
36540
|
+
) {
|
|
36541
|
+
id
|
|
36542
|
+
oldValueUcd
|
|
36543
|
+
newValueUcd
|
|
36544
|
+
caller
|
|
36545
|
+
timestamp
|
|
36546
|
+
blockNumber
|
|
36547
|
+
transactionHash
|
|
36548
|
+
}
|
|
36549
|
+
` : ""}
|
|
36550
|
+
|
|
36551
|
+
${shouldQuery.btcPriceBoundsUpdate ? `
|
|
36552
|
+
btcPriceBoundsUpdates(
|
|
36553
|
+
${buildProtocolWhereClause()}
|
|
36554
|
+
first: $limit,
|
|
36555
|
+
orderBy: timestamp,
|
|
36556
|
+
orderDirection: $orderDirection
|
|
36557
|
+
) {
|
|
36558
|
+
id
|
|
36559
|
+
oldMinBound
|
|
36560
|
+
newMinBound
|
|
36561
|
+
oldMaxBound
|
|
36562
|
+
newMaxBound
|
|
36563
|
+
caller
|
|
36564
|
+
timestamp
|
|
36565
|
+
blockNumber
|
|
36566
|
+
transactionHash
|
|
36567
|
+
}
|
|
36568
|
+
` : ""}
|
|
36569
|
+
|
|
36570
|
+
${shouldQuery.perUserMintLimitUpdate ? `
|
|
36571
|
+
perUserDailyMintLimitUpdates(
|
|
36572
|
+
${buildProtocolWhereClause()}
|
|
36573
|
+
first: $limit,
|
|
36574
|
+
orderBy: timestamp,
|
|
36575
|
+
orderDirection: $orderDirection
|
|
36576
|
+
) {
|
|
36577
|
+
id
|
|
36578
|
+
oldLimit
|
|
36579
|
+
newLimit
|
|
36580
|
+
updatedBy
|
|
36581
|
+
timestamp
|
|
36582
|
+
blockNumber
|
|
36583
|
+
transactionHash
|
|
36584
|
+
}
|
|
36585
|
+
` : ""}
|
|
36510
36586
|
}
|
|
36511
36587
|
`;
|
|
36512
36588
|
const variables = {
|
|
@@ -36661,7 +36737,47 @@ var DiamondHandsGraph = class {
|
|
|
36661
36737
|
blockNumber: t.blockNumber,
|
|
36662
36738
|
transactionHash: t.transactionHash
|
|
36663
36739
|
}));
|
|
36664
|
-
const
|
|
36740
|
+
const loanProtocolParamUpdates = (result.loanProtocolParamUpdates || []).map((p) => ({
|
|
36741
|
+
id: p.id,
|
|
36742
|
+
oldLiquidationThreshold: p.oldLiquidationThreshold,
|
|
36743
|
+
newLiquidationThreshold: p.newLiquidationThreshold,
|
|
36744
|
+
oldMinimumLoanValueUcd: p.oldMinimumLoanValueUcd,
|
|
36745
|
+
newMinimumLoanValueUcd: p.newMinimumLoanValueUcd,
|
|
36746
|
+
caller: p.caller,
|
|
36747
|
+
timestamp: p.timestamp,
|
|
36748
|
+
blockNumber: p.blockNumber,
|
|
36749
|
+
transactionHash: p.transactionHash
|
|
36750
|
+
}));
|
|
36751
|
+
const maxLoanValueUpdates = (result.maxLoanValueUpdates || []).map((m) => ({
|
|
36752
|
+
id: m.id,
|
|
36753
|
+
oldValueUcd: m.oldValueUcd,
|
|
36754
|
+
newValueUcd: m.newValueUcd,
|
|
36755
|
+
caller: m.caller,
|
|
36756
|
+
timestamp: m.timestamp,
|
|
36757
|
+
blockNumber: m.blockNumber,
|
|
36758
|
+
transactionHash: m.transactionHash
|
|
36759
|
+
}));
|
|
36760
|
+
const btcPriceBoundsUpdates = (result.btcPriceBoundsUpdates || []).map((b) => ({
|
|
36761
|
+
id: b.id,
|
|
36762
|
+
oldMinBound: b.oldMinBound,
|
|
36763
|
+
newMinBound: b.newMinBound,
|
|
36764
|
+
oldMaxBound: b.oldMaxBound,
|
|
36765
|
+
newMaxBound: b.newMaxBound,
|
|
36766
|
+
caller: b.caller,
|
|
36767
|
+
timestamp: b.timestamp,
|
|
36768
|
+
blockNumber: b.blockNumber,
|
|
36769
|
+
transactionHash: b.transactionHash
|
|
36770
|
+
}));
|
|
36771
|
+
const perUserMintLimitUpdates = (result.perUserDailyMintLimitUpdates || []).map((p) => ({
|
|
36772
|
+
id: p.id,
|
|
36773
|
+
oldLimit: p.oldLimit,
|
|
36774
|
+
newLimit: p.newLimit,
|
|
36775
|
+
updatedBy: p.updatedBy,
|
|
36776
|
+
timestamp: p.timestamp,
|
|
36777
|
+
blockNumber: p.blockNumber,
|
|
36778
|
+
transactionHash: p.transactionHash
|
|
36779
|
+
}));
|
|
36780
|
+
const totalEvents = payments.length + statusUpdates.length + (liquidation ? 1 : 0) + mints.length + withdrawals.length + renewals.length + operationFailures.length + mintRequests.length + burnRequests.length + collateralEvents.length + circuitBreakerEvents.length + termFeeUpdates.length + loanProtocolParamUpdates.length + maxLoanValueUpdates.length + btcPriceBoundsUpdates.length + perUserMintLimitUpdates.length;
|
|
36665
36781
|
return {
|
|
36666
36782
|
positionId,
|
|
36667
36783
|
payments,
|
|
@@ -36676,6 +36792,10 @@ var DiamondHandsGraph = class {
|
|
|
36676
36792
|
collateralEvents,
|
|
36677
36793
|
circuitBreakerEvents,
|
|
36678
36794
|
termFeeUpdates,
|
|
36795
|
+
loanProtocolParamUpdates,
|
|
36796
|
+
maxLoanValueUpdates,
|
|
36797
|
+
btcPriceBoundsUpdates,
|
|
36798
|
+
perUserMintLimitUpdates,
|
|
36679
36799
|
feeDistributions: [],
|
|
36680
36800
|
totalEvents
|
|
36681
36801
|
};
|
|
@@ -43135,11 +43255,13 @@ Error data: ${errorData || "none"}`
|
|
|
43135
43255
|
return {
|
|
43136
43256
|
async getProtocolConfig() {
|
|
43137
43257
|
const result = await contract["getProtocolConfig"]();
|
|
43258
|
+
const maxUcdWhole = ethers_exports.BigNumber.from(result[3]);
|
|
43138
43259
|
return {
|
|
43139
43260
|
liquidationThreshold: result[0].toString(),
|
|
43140
|
-
minimumLoanValueUcd: result[
|
|
43261
|
+
minimumLoanValueUcd: ethers_exports.utils.formatUnits(result[2], 18),
|
|
43141
43262
|
minimumLoanValueWei: result[2].toString(),
|
|
43142
|
-
maxSingleLoanValueUcd:
|
|
43263
|
+
maxSingleLoanValueUcd: maxUcdWhole.toString(),
|
|
43264
|
+
maxSingleLoanValueWei: maxUcdWhole.mul(ethers_exports.BigNumber.from(10).pow(18)).toString()
|
|
43143
43265
|
};
|
|
43144
43266
|
}
|
|
43145
43267
|
};
|
|
@@ -43436,7 +43558,7 @@ var EventHelpers = {
|
|
|
43436
43558
|
* Get total count of all events
|
|
43437
43559
|
*/
|
|
43438
43560
|
getTotalCount(events) {
|
|
43439
|
-
return events.payments.length + events.statusUpdates.length + (events.liquidation ? 1 : 0) + events.mints.length + events.withdrawals.length + events.renewals.length + events.operationFailures.length + events.mintRequests.length + events.burnRequests.length + events.collateralEvents.length + events.circuitBreakerEvents.length + events.termFeeUpdates.length;
|
|
43561
|
+
return events.payments.length + events.statusUpdates.length + (events.liquidation ? 1 : 0) + events.mints.length + events.withdrawals.length + events.renewals.length + events.operationFailures.length + events.mintRequests.length + events.burnRequests.length + events.collateralEvents.length + events.circuitBreakerEvents.length + events.termFeeUpdates.length + events.loanProtocolParamUpdates.length + events.maxLoanValueUpdates.length + events.btcPriceBoundsUpdates.length + events.perUserMintLimitUpdates.length;
|
|
43440
43562
|
},
|
|
43441
43563
|
/**
|
|
43442
43564
|
* Merge and sort all events by timestamp
|
|
@@ -43454,7 +43576,11 @@ var EventHelpers = {
|
|
|
43454
43576
|
...events.burnRequests.map((e) => ({ ...e, eventType: "burnRequest" })),
|
|
43455
43577
|
...events.collateralEvents.map((e) => ({ ...e, eventType: "collateralEvent" })),
|
|
43456
43578
|
...events.circuitBreakerEvents.map((e) => ({ ...e, eventType: "circuitBreaker" })),
|
|
43457
|
-
...events.termFeeUpdates.map((e) => ({ ...e, eventType: "termFeeUpdate" }))
|
|
43579
|
+
...events.termFeeUpdates.map((e) => ({ ...e, eventType: "termFeeUpdate" })),
|
|
43580
|
+
...events.loanProtocolParamUpdates.map((e) => ({ ...e, eventType: "loanProtocolParamUpdate" })),
|
|
43581
|
+
...events.maxLoanValueUpdates.map((e) => ({ ...e, eventType: "maxLoanValueUpdate" })),
|
|
43582
|
+
...events.btcPriceBoundsUpdates.map((e) => ({ ...e, eventType: "btcPriceBoundsUpdate" })),
|
|
43583
|
+
...events.perUserMintLimitUpdates.map((e) => ({ ...e, eventType: "perUserMintLimitUpdate" }))
|
|
43458
43584
|
];
|
|
43459
43585
|
return allEvents.sort((a, b) => {
|
|
43460
43586
|
const diff = BigInt(a.timestamp) - BigInt(b.timestamp);
|
package/dist/index.mjs
CHANGED
|
@@ -36185,7 +36185,11 @@ var DiamondHandsGraph = class {
|
|
|
36185
36185
|
burnRequest: !eventTypes || eventTypes.includes("burnRequest"),
|
|
36186
36186
|
collateralEvent: !eventTypes || eventTypes.includes("collateralEvent"),
|
|
36187
36187
|
circuitBreaker: !eventTypes || eventTypes.includes("circuitBreaker"),
|
|
36188
|
-
termFeeUpdate: !eventTypes || eventTypes.includes("termFeeUpdate")
|
|
36188
|
+
termFeeUpdate: !eventTypes || eventTypes.includes("termFeeUpdate"),
|
|
36189
|
+
loanProtocolParamUpdate: !eventTypes || eventTypes.includes("loanProtocolParamUpdate"),
|
|
36190
|
+
maxLoanValueUpdate: !eventTypes || eventTypes.includes("maxLoanValueUpdate"),
|
|
36191
|
+
btcPriceBoundsUpdate: !eventTypes || eventTypes.includes("btcPriceBoundsUpdate"),
|
|
36192
|
+
perUserMintLimitUpdate: !eventTypes || eventTypes.includes("perUserMintLimitUpdate")
|
|
36189
36193
|
};
|
|
36190
36194
|
const buildPositionWhereClause = () => {
|
|
36191
36195
|
const conditions = [`position: "${positionId.toLowerCase()}"`];
|
|
@@ -36435,6 +36439,78 @@ var DiamondHandsGraph = class {
|
|
|
36435
36439
|
transactionHash
|
|
36436
36440
|
}
|
|
36437
36441
|
` : ""}
|
|
36442
|
+
|
|
36443
|
+
${shouldQuery.loanProtocolParamUpdate ? `
|
|
36444
|
+
loanProtocolParamUpdates(
|
|
36445
|
+
${buildProtocolWhereClause()}
|
|
36446
|
+
first: $limit,
|
|
36447
|
+
orderBy: timestamp,
|
|
36448
|
+
orderDirection: $orderDirection
|
|
36449
|
+
) {
|
|
36450
|
+
id
|
|
36451
|
+
oldLiquidationThreshold
|
|
36452
|
+
newLiquidationThreshold
|
|
36453
|
+
oldMinimumLoanValueUcd
|
|
36454
|
+
newMinimumLoanValueUcd
|
|
36455
|
+
caller
|
|
36456
|
+
timestamp
|
|
36457
|
+
blockNumber
|
|
36458
|
+
transactionHash
|
|
36459
|
+
}
|
|
36460
|
+
` : ""}
|
|
36461
|
+
|
|
36462
|
+
${shouldQuery.maxLoanValueUpdate ? `
|
|
36463
|
+
maxLoanValueUpdates(
|
|
36464
|
+
${buildProtocolWhereClause()}
|
|
36465
|
+
first: $limit,
|
|
36466
|
+
orderBy: timestamp,
|
|
36467
|
+
orderDirection: $orderDirection
|
|
36468
|
+
) {
|
|
36469
|
+
id
|
|
36470
|
+
oldValueUcd
|
|
36471
|
+
newValueUcd
|
|
36472
|
+
caller
|
|
36473
|
+
timestamp
|
|
36474
|
+
blockNumber
|
|
36475
|
+
transactionHash
|
|
36476
|
+
}
|
|
36477
|
+
` : ""}
|
|
36478
|
+
|
|
36479
|
+
${shouldQuery.btcPriceBoundsUpdate ? `
|
|
36480
|
+
btcPriceBoundsUpdates(
|
|
36481
|
+
${buildProtocolWhereClause()}
|
|
36482
|
+
first: $limit,
|
|
36483
|
+
orderBy: timestamp,
|
|
36484
|
+
orderDirection: $orderDirection
|
|
36485
|
+
) {
|
|
36486
|
+
id
|
|
36487
|
+
oldMinBound
|
|
36488
|
+
newMinBound
|
|
36489
|
+
oldMaxBound
|
|
36490
|
+
newMaxBound
|
|
36491
|
+
caller
|
|
36492
|
+
timestamp
|
|
36493
|
+
blockNumber
|
|
36494
|
+
transactionHash
|
|
36495
|
+
}
|
|
36496
|
+
` : ""}
|
|
36497
|
+
|
|
36498
|
+
${shouldQuery.perUserMintLimitUpdate ? `
|
|
36499
|
+
perUserDailyMintLimitUpdates(
|
|
36500
|
+
${buildProtocolWhereClause()}
|
|
36501
|
+
first: $limit,
|
|
36502
|
+
orderBy: timestamp,
|
|
36503
|
+
orderDirection: $orderDirection
|
|
36504
|
+
) {
|
|
36505
|
+
id
|
|
36506
|
+
oldLimit
|
|
36507
|
+
newLimit
|
|
36508
|
+
updatedBy
|
|
36509
|
+
timestamp
|
|
36510
|
+
blockNumber
|
|
36511
|
+
transactionHash
|
|
36512
|
+
}
|
|
36513
|
+
` : ""}
|
|
36438
36514
|
}
|
|
36439
36515
|
`;
|
|
36440
36516
|
const variables = {
|
|
@@ -36589,7 +36665,47 @@ var DiamondHandsGraph = class {
|
|
|
36589
36665
|
blockNumber: t.blockNumber,
|
|
36590
36666
|
transactionHash: t.transactionHash
|
|
36591
36667
|
}));
|
|
36592
|
-
const
|
|
36668
|
+
const loanProtocolParamUpdates = (result.loanProtocolParamUpdates || []).map((p) => ({
|
|
36669
|
+
id: p.id,
|
|
36670
|
+
oldLiquidationThreshold: p.oldLiquidationThreshold,
|
|
36671
|
+
newLiquidationThreshold: p.newLiquidationThreshold,
|
|
36672
|
+
oldMinimumLoanValueUcd: p.oldMinimumLoanValueUcd,
|
|
36673
|
+
newMinimumLoanValueUcd: p.newMinimumLoanValueUcd,
|
|
36674
|
+
caller: p.caller,
|
|
36675
|
+
timestamp: p.timestamp,
|
|
36676
|
+
blockNumber: p.blockNumber,
|
|
36677
|
+
transactionHash: p.transactionHash
|
|
36678
|
+
}));
|
|
36679
|
+
const maxLoanValueUpdates = (result.maxLoanValueUpdates || []).map((m) => ({
|
|
36680
|
+
id: m.id,
|
|
36681
|
+
oldValueUcd: m.oldValueUcd,
|
|
36682
|
+
newValueUcd: m.newValueUcd,
|
|
36683
|
+
caller: m.caller,
|
|
36684
|
+
timestamp: m.timestamp,
|
|
36685
|
+
blockNumber: m.blockNumber,
|
|
36686
|
+
transactionHash: m.transactionHash
|
|
36687
|
+
}));
|
|
36688
|
+
const btcPriceBoundsUpdates = (result.btcPriceBoundsUpdates || []).map((b) => ({
|
|
36689
|
+
id: b.id,
|
|
36690
|
+
oldMinBound: b.oldMinBound,
|
|
36691
|
+
newMinBound: b.newMinBound,
|
|
36692
|
+
oldMaxBound: b.oldMaxBound,
|
|
36693
|
+
newMaxBound: b.newMaxBound,
|
|
36694
|
+
caller: b.caller,
|
|
36695
|
+
timestamp: b.timestamp,
|
|
36696
|
+
blockNumber: b.blockNumber,
|
|
36697
|
+
transactionHash: b.transactionHash
|
|
36698
|
+
}));
|
|
36699
|
+
const perUserMintLimitUpdates = (result.perUserDailyMintLimitUpdates || []).map((p) => ({
|
|
36700
|
+
id: p.id,
|
|
36701
|
+
oldLimit: p.oldLimit,
|
|
36702
|
+
newLimit: p.newLimit,
|
|
36703
|
+
updatedBy: p.updatedBy,
|
|
36704
|
+
timestamp: p.timestamp,
|
|
36705
|
+
blockNumber: p.blockNumber,
|
|
36706
|
+
transactionHash: p.transactionHash
|
|
36707
|
+
}));
|
|
36708
|
+
const totalEvents = payments.length + statusUpdates.length + (liquidation ? 1 : 0) + mints.length + withdrawals.length + renewals.length + operationFailures.length + mintRequests.length + burnRequests.length + collateralEvents.length + circuitBreakerEvents.length + termFeeUpdates.length + loanProtocolParamUpdates.length + maxLoanValueUpdates.length + btcPriceBoundsUpdates.length + perUserMintLimitUpdates.length;
|
|
36593
36709
|
return {
|
|
36594
36710
|
positionId,
|
|
36595
36711
|
payments,
|
|
@@ -36604,6 +36720,10 @@ var DiamondHandsGraph = class {
|
|
|
36604
36720
|
collateralEvents,
|
|
36605
36721
|
circuitBreakerEvents,
|
|
36606
36722
|
termFeeUpdates,
|
|
36723
|
+
loanProtocolParamUpdates,
|
|
36724
|
+
maxLoanValueUpdates,
|
|
36725
|
+
btcPriceBoundsUpdates,
|
|
36726
|
+
perUserMintLimitUpdates,
|
|
36607
36727
|
feeDistributions: [],
|
|
36608
36728
|
totalEvents
|
|
36609
36729
|
};
|
|
@@ -43063,11 +43183,13 @@ Error data: ${errorData || "none"}`
|
|
|
43063
43183
|
return {
|
|
43064
43184
|
async getProtocolConfig() {
|
|
43065
43185
|
const result = await contract["getProtocolConfig"]();
|
|
43186
|
+
const maxUcdWhole = ethers_exports.BigNumber.from(result[3]);
|
|
43066
43187
|
return {
|
|
43067
43188
|
liquidationThreshold: result[0].toString(),
|
|
43068
|
-
minimumLoanValueUcd: result[
|
|
43189
|
+
minimumLoanValueUcd: ethers_exports.utils.formatUnits(result[2], 18),
|
|
43069
43190
|
minimumLoanValueWei: result[2].toString(),
|
|
43070
|
-
maxSingleLoanValueUcd:
|
|
43191
|
+
maxSingleLoanValueUcd: maxUcdWhole.toString(),
|
|
43192
|
+
maxSingleLoanValueWei: maxUcdWhole.mul(ethers_exports.BigNumber.from(10).pow(18)).toString()
|
|
43071
43193
|
};
|
|
43072
43194
|
}
|
|
43073
43195
|
};
|
|
@@ -43364,7 +43486,7 @@ var EventHelpers = {
|
|
|
43364
43486
|
* Get total count of all events
|
|
43365
43487
|
*/
|
|
43366
43488
|
getTotalCount(events) {
|
|
43367
|
-
return events.payments.length + events.statusUpdates.length + (events.liquidation ? 1 : 0) + events.mints.length + events.withdrawals.length + events.renewals.length + events.operationFailures.length + events.mintRequests.length + events.burnRequests.length + events.collateralEvents.length + events.circuitBreakerEvents.length + events.termFeeUpdates.length;
|
|
43489
|
+
return events.payments.length + events.statusUpdates.length + (events.liquidation ? 1 : 0) + events.mints.length + events.withdrawals.length + events.renewals.length + events.operationFailures.length + events.mintRequests.length + events.burnRequests.length + events.collateralEvents.length + events.circuitBreakerEvents.length + events.termFeeUpdates.length + events.loanProtocolParamUpdates.length + events.maxLoanValueUpdates.length + events.btcPriceBoundsUpdates.length + events.perUserMintLimitUpdates.length;
|
|
43368
43490
|
},
|
|
43369
43491
|
/**
|
|
43370
43492
|
* Merge and sort all events by timestamp
|
|
@@ -43382,7 +43504,11 @@ var EventHelpers = {
|
|
|
43382
43504
|
...events.burnRequests.map((e) => ({ ...e, eventType: "burnRequest" })),
|
|
43383
43505
|
...events.collateralEvents.map((e) => ({ ...e, eventType: "collateralEvent" })),
|
|
43384
43506
|
...events.circuitBreakerEvents.map((e) => ({ ...e, eventType: "circuitBreaker" })),
|
|
43385
|
-
...events.termFeeUpdates.map((e) => ({ ...e, eventType: "termFeeUpdate" }))
|
|
43507
|
+
...events.termFeeUpdates.map((e) => ({ ...e, eventType: "termFeeUpdate" })),
|
|
43508
|
+
...events.loanProtocolParamUpdates.map((e) => ({ ...e, eventType: "loanProtocolParamUpdate" })),
|
|
43509
|
+
...events.maxLoanValueUpdates.map((e) => ({ ...e, eventType: "maxLoanValueUpdate" })),
|
|
43510
|
+
...events.btcPriceBoundsUpdates.map((e) => ({ ...e, eventType: "btcPriceBoundsUpdate" })),
|
|
43511
|
+
...events.perUserMintLimitUpdates.map((e) => ({ ...e, eventType: "perUserMintLimitUpdate" }))
|
|
43386
43512
|
];
|
|
43387
43513
|
return allEvents.sort((a, b) => {
|
|
43388
43514
|
const diff = BigInt(a.timestamp) - BigInt(b.timestamp);
|
|
@@ -639,9 +639,10 @@ export declare class DiamondHandsSDK {
|
|
|
639
639
|
loanOps(): {
|
|
640
640
|
getProtocolConfig(): Promise<{
|
|
641
641
|
liquidationThreshold: any;
|
|
642
|
-
minimumLoanValueUcd:
|
|
642
|
+
minimumLoanValueUcd: string;
|
|
643
643
|
minimumLoanValueWei: any;
|
|
644
|
-
maxSingleLoanValueUcd:
|
|
644
|
+
maxSingleLoanValueUcd: string;
|
|
645
|
+
maxSingleLoanValueWei: string;
|
|
645
646
|
}>;
|
|
646
647
|
};
|
|
647
648
|
/**
|
|
@@ -235,6 +235,58 @@ export interface CollateralContractEvent {
|
|
|
235
235
|
transactionHash: string;
|
|
236
236
|
logIndex: string;
|
|
237
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Protocol param update — emitted by updateProtocolParameters() on LoanOperationsManager
|
|
240
|
+
*/
|
|
241
|
+
export interface LoanProtocolParamUpdateEvent {
|
|
242
|
+
id: string;
|
|
243
|
+
oldLiquidationThreshold: string;
|
|
244
|
+
newLiquidationThreshold: string;
|
|
245
|
+
oldMinimumLoanValueUcd: string;
|
|
246
|
+
newMinimumLoanValueUcd: string;
|
|
247
|
+
caller: string;
|
|
248
|
+
timestamp: string;
|
|
249
|
+
blockNumber: string;
|
|
250
|
+
transactionHash: string;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Maximum loan value update — emitted alongside updateProtocolParameters() when max changes
|
|
254
|
+
*/
|
|
255
|
+
export interface MaxLoanValueUpdateEvent {
|
|
256
|
+
id: string;
|
|
257
|
+
oldValueUcd: string;
|
|
258
|
+
newValueUcd: string;
|
|
259
|
+
caller: string;
|
|
260
|
+
timestamp: string;
|
|
261
|
+
blockNumber: string;
|
|
262
|
+
transactionHash: string;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* BTC price bounds update — emitted by updateBtcPriceBounds()
|
|
266
|
+
*/
|
|
267
|
+
export interface BtcPriceBoundsUpdateEvent {
|
|
268
|
+
id: string;
|
|
269
|
+
oldMinBound: string;
|
|
270
|
+
newMinBound: string;
|
|
271
|
+
oldMaxBound: string;
|
|
272
|
+
newMaxBound: string;
|
|
273
|
+
caller: string;
|
|
274
|
+
timestamp: string;
|
|
275
|
+
blockNumber: string;
|
|
276
|
+
transactionHash: string;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Per-user daily mint limit update — emitted by setPerUserDailyMintLimit()
|
|
280
|
+
*/
|
|
281
|
+
export interface PerUserDailyMintLimitUpdateEvent {
|
|
282
|
+
id: string;
|
|
283
|
+
oldLimit: string;
|
|
284
|
+
newLimit: string;
|
|
285
|
+
updatedBy: string;
|
|
286
|
+
timestamp: string;
|
|
287
|
+
blockNumber: string;
|
|
288
|
+
transactionHash: string;
|
|
289
|
+
}
|
|
238
290
|
/**
|
|
239
291
|
* Protocol-level circuit breaker event (activation, deactivation, limit updates)
|
|
240
292
|
*/
|
|
@@ -312,6 +364,14 @@ export interface LoanEvents {
|
|
|
312
364
|
circuitBreakerEvents: CircuitBreakerProtocolEvent[];
|
|
313
365
|
/** Protocol-level term fee update events */
|
|
314
366
|
termFeeUpdates: TermFeeUpdateEvent[];
|
|
367
|
+
/** LoanOps protocol param updates (liquidationThreshold + minimumLoanValueUcd) */
|
|
368
|
+
loanProtocolParamUpdates: LoanProtocolParamUpdateEvent[];
|
|
369
|
+
/** LoanOps maximum loan value updates */
|
|
370
|
+
maxLoanValueUpdates: MaxLoanValueUpdateEvent[];
|
|
371
|
+
/** BTC price bounds updates */
|
|
372
|
+
btcPriceBoundsUpdates: BtcPriceBoundsUpdateEvent[];
|
|
373
|
+
/** Per-user daily mint limit updates */
|
|
374
|
+
perUserMintLimitUpdates: PerUserDailyMintLimitUpdateEvent[];
|
|
315
375
|
/** All community fee distribution events */
|
|
316
376
|
feeDistributions: FeeDistributionEvent[];
|
|
317
377
|
/** Total number of events */
|
|
@@ -322,7 +382,7 @@ export interface LoanEvents {
|
|
|
322
382
|
*/
|
|
323
383
|
export interface LoanEventsFilter {
|
|
324
384
|
/** Filter by event types */
|
|
325
|
-
eventTypes?: Array<'payment' | 'status' | 'liquidation' | 'mint' | 'withdrawal' | 'renewal' | 'operationFailure' | 'mintRequest' | 'burnRequest' | 'collateralEvent' | 'circuitBreaker' | 'termFeeUpdate'>;
|
|
385
|
+
eventTypes?: Array<'payment' | 'status' | 'liquidation' | 'mint' | 'withdrawal' | 'renewal' | 'operationFailure' | 'mintRequest' | 'burnRequest' | 'collateralEvent' | 'circuitBreaker' | 'termFeeUpdate' | 'loanProtocolParamUpdate' | 'maxLoanValueUpdate' | 'btcPriceBoundsUpdate' | 'perUserMintLimitUpdate'>;
|
|
326
386
|
/** Filter by minimum timestamp */
|
|
327
387
|
fromTimestamp?: string;
|
|
328
388
|
/** Filter by maximum timestamp */
|
|
@@ -401,5 +461,13 @@ export declare const EventHelpers: {
|
|
|
401
461
|
eventType: "circuitBreaker";
|
|
402
462
|
}) | (TermFeeUpdateEvent & {
|
|
403
463
|
eventType: "termFeeUpdate";
|
|
464
|
+
}) | (LoanProtocolParamUpdateEvent & {
|
|
465
|
+
eventType: "loanProtocolParamUpdate";
|
|
466
|
+
}) | (MaxLoanValueUpdateEvent & {
|
|
467
|
+
eventType: "maxLoanValueUpdate";
|
|
468
|
+
}) | (BtcPriceBoundsUpdateEvent & {
|
|
469
|
+
eventType: "btcPriceBoundsUpdate";
|
|
470
|
+
}) | (PerUserDailyMintLimitUpdateEvent & {
|
|
471
|
+
eventType: "perUserMintLimitUpdate";
|
|
404
472
|
})>;
|
|
405
473
|
};
|
package/package.json
CHANGED