@gvnrdao/dh-sdk 0.0.211 → 0.0.213

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 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, } 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
@@ -36245,7 +36245,25 @@ var DiamondHandsGraph = class {
36245
36245
  limit = 1e3,
36246
36246
  orderDirection = "desc"
36247
36247
  } = filter || {};
36248
- const buildWhereClause = () => {
36248
+ const shouldQuery = {
36249
+ payment: !eventTypes || eventTypes.includes("payment"),
36250
+ status: !eventTypes || eventTypes.includes("status"),
36251
+ liquidation: !eventTypes || eventTypes.includes("liquidation"),
36252
+ mint: !eventTypes || eventTypes.includes("mint"),
36253
+ withdrawal: !eventTypes || eventTypes.includes("withdrawal"),
36254
+ renewal: !eventTypes || eventTypes.includes("renewal"),
36255
+ operationFailure: !eventTypes || eventTypes.includes("operationFailure"),
36256
+ mintRequest: !eventTypes || eventTypes.includes("mintRequest"),
36257
+ burnRequest: !eventTypes || eventTypes.includes("burnRequest"),
36258
+ collateralEvent: !eventTypes || eventTypes.includes("collateralEvent"),
36259
+ circuitBreaker: !eventTypes || eventTypes.includes("circuitBreaker"),
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")
36265
+ };
36266
+ const buildPositionWhereClause = () => {
36249
36267
  const conditions = [`position: "${positionId.toLowerCase()}"`];
36250
36268
  if (fromTimestamp)
36251
36269
  conditions.push(`timestamp_gte: "${fromTimestamp}"`);
@@ -36255,15 +36273,19 @@ var DiamondHandsGraph = class {
36255
36273
  conditions.push(`blockNumber_gte: "${fromBlock}"`);
36256
36274
  if (toBlock)
36257
36275
  conditions.push(`blockNumber_lte: "${toBlock}"`);
36258
- return conditions.length > 0 ? `where: { ${conditions.join(", ")} }` : "";
36276
+ return `where: { ${conditions.join(", ")} }`;
36259
36277
  };
36260
- const shouldQuery = {
36261
- payment: !eventTypes || eventTypes.includes("payment"),
36262
- status: !eventTypes || eventTypes.includes("status"),
36263
- liquidation: !eventTypes || eventTypes.includes("liquidation"),
36264
- mint: !eventTypes || eventTypes.includes("mint"),
36265
- withdrawal: !eventTypes || eventTypes.includes("withdrawal"),
36266
- renewal: !eventTypes || eventTypes.includes("renewal")
36278
+ const buildProtocolWhereClause = () => {
36279
+ const conditions = [];
36280
+ if (fromTimestamp)
36281
+ conditions.push(`timestamp_gte: "${fromTimestamp}"`);
36282
+ if (toTimestamp)
36283
+ conditions.push(`timestamp_lte: "${toTimestamp}"`);
36284
+ if (fromBlock)
36285
+ conditions.push(`blockNumber_gte: "${fromBlock}"`);
36286
+ if (toBlock)
36287
+ conditions.push(`blockNumber_lte: "${toBlock}"`);
36288
+ return conditions.length > 0 ? `where: { ${conditions.join(", ")} }` : "";
36267
36289
  };
36268
36290
  const query = `
36269
36291
  query GetLoanEvents($positionId: Bytes!, $limit: Int!, $orderDirection: OrderDirection!) {
@@ -36274,7 +36296,7 @@ var DiamondHandsGraph = class {
36274
36296
  first: $limit,
36275
36297
  orderBy: timestamp,
36276
36298
  orderDirection: $orderDirection
36277
- ${buildWhereClause()}
36299
+ ${buildProtocolWhereClause()}
36278
36300
  ) {
36279
36301
  id
36280
36302
  payer { id }
@@ -36294,7 +36316,7 @@ var DiamondHandsGraph = class {
36294
36316
  first: $limit,
36295
36317
  orderBy: timestamp,
36296
36318
  orderDirection: $orderDirection
36297
- ${buildWhereClause()}
36319
+ ${buildProtocolWhereClause()}
36298
36320
  ) {
36299
36321
  id
36300
36322
  oldStatus
@@ -36354,11 +36376,213 @@ var DiamondHandsGraph = class {
36354
36376
  logIndex
36355
36377
  }
36356
36378
  ` : ""}
36379
+
36380
+ ${shouldQuery.operationFailure ? `
36381
+ operationFailures(
36382
+ first: $limit,
36383
+ orderBy: timestamp,
36384
+ orderDirection: $orderDirection
36385
+ ) {
36386
+ id
36387
+ operationType
36388
+ reason
36389
+ errorCode
36390
+ amount
36391
+ timestamp
36392
+ blockNumber
36393
+ transactionHash
36394
+ logIndex
36395
+ }
36396
+ ` : ""}
36397
+
36398
+ ${shouldQuery.mintRequest ? `
36399
+ mintRequests(
36400
+ first: $limit,
36401
+ orderBy: timestamp,
36402
+ orderDirection: $orderDirection
36403
+ ) {
36404
+ id
36405
+ pkpId
36406
+ borrower { id }
36407
+ mintAmount
36408
+ originationFee
36409
+ newDebt
36410
+ newCollateralRatio
36411
+ btcPrice
36412
+ quantumTimestamp
36413
+ opId
36414
+ timestamp
36415
+ blockNumber
36416
+ transactionHash
36417
+ logIndex
36418
+ }
36419
+ ` : ""}
36420
+
36421
+ ${shouldQuery.burnRequest ? `
36422
+ burnRequests(
36423
+ first: $limit,
36424
+ orderBy: timestamp,
36425
+ orderDirection: $orderDirection
36426
+ ) {
36427
+ id
36428
+ pkpId
36429
+ borrower { id }
36430
+ burnAmount
36431
+ remainingDebt
36432
+ newCollateralRatio
36433
+ opId
36434
+ timestamp
36435
+ blockNumber
36436
+ transactionHash
36437
+ logIndex
36438
+ }
36439
+ ` : ""}
36357
36440
  }
36358
36441
 
36442
+ ${shouldQuery.mint ? `
36443
+ ucdMintEvents(
36444
+ ${buildPositionWhereClause()}
36445
+ first: $limit,
36446
+ orderBy: timestamp,
36447
+ orderDirection: $orderDirection
36448
+ ) {
36449
+ id
36450
+ amount
36451
+ proof
36452
+ minter { id }
36453
+ isCommunityMint
36454
+ timestamp
36455
+ blockNumber
36456
+ transactionHash
36457
+ }
36458
+ ` : ""}
36359
36459
 
36360
- # TODO: Re-enable ucdMintEvents query when subgraph schema is updated
36361
- # ${shouldQuery.mint ? `ucdMintEvents(...)` : ""}
36460
+ ${shouldQuery.collateralEvent ? `
36461
+ collateralEvents(
36462
+ ${buildPositionWhereClause()}
36463
+ first: $limit,
36464
+ orderBy: timestamp,
36465
+ orderDirection: $orderDirection
36466
+ ) {
36467
+ id
36468
+ eventType
36469
+ networkFee
36470
+ remainingCollateral
36471
+ collateralRatio
36472
+ timestamp
36473
+ blockNumber
36474
+ transactionHash
36475
+ logIndex
36476
+ }
36477
+ ` : ""}
36478
+
36479
+ ${shouldQuery.circuitBreaker ? `
36480
+ circuitBreakerEvents(
36481
+ ${buildProtocolWhereClause()}
36482
+ first: $limit,
36483
+ orderBy: timestamp,
36484
+ orderDirection: $orderDirection
36485
+ ) {
36486
+ id
36487
+ isActivated
36488
+ admin
36489
+ reason
36490
+ timestamp
36491
+ blockNumber
36492
+ transactionHash
36493
+ }
36494
+ ` : ""}
36495
+
36496
+ ${shouldQuery.termFeeUpdate ? `
36497
+ termFeeUpdates(
36498
+ ${buildProtocolWhereClause()}
36499
+ first: $limit,
36500
+ orderBy: timestamp,
36501
+ orderDirection: $orderDirection
36502
+ ) {
36503
+ id
36504
+ term { id }
36505
+ oldOriginationFee
36506
+ newOriginationFee
36507
+ oldExtensionFee
36508
+ newExtensionFee
36509
+ timestamp
36510
+ blockNumber
36511
+ transactionHash
36512
+ }
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
+ ` : ""}
36362
36586
  }
36363
36587
  `;
36364
36588
  const variables = {
@@ -36438,7 +36662,122 @@ var DiamondHandsGraph = class {
36438
36662
  transactionHash: r2.transactionHash,
36439
36663
  logIndex: r2.logIndex
36440
36664
  }));
36441
- const totalEvents = payments.length + statusUpdates.length + (liquidation ? 1 : 0) + mints.length + withdrawals.length + renewals.length;
36665
+ const operationFailures = (result.position?.operationFailures || []).map((o) => ({
36666
+ id: o.id,
36667
+ positionId,
36668
+ operationType: o.operationType,
36669
+ reason: o.reason,
36670
+ errorCode: o.errorCode,
36671
+ amount: o.amount,
36672
+ timestamp: o.timestamp,
36673
+ blockNumber: o.blockNumber,
36674
+ transactionHash: o.transactionHash,
36675
+ logIndex: o.logIndex
36676
+ }));
36677
+ const mintRequests = (result.position?.mintRequests || []).map((m) => ({
36678
+ id: m.id,
36679
+ positionId,
36680
+ pkpId: m.pkpId,
36681
+ borrower: m.borrower.id,
36682
+ mintAmount: m.mintAmount,
36683
+ originationFee: m.originationFee,
36684
+ newDebt: m.newDebt,
36685
+ newCollateralRatio: m.newCollateralRatio,
36686
+ btcPrice: m.btcPrice,
36687
+ quantumTimestamp: m.quantumTimestamp,
36688
+ opId: m.opId,
36689
+ timestamp: m.timestamp,
36690
+ blockNumber: m.blockNumber,
36691
+ transactionHash: m.transactionHash,
36692
+ logIndex: m.logIndex
36693
+ }));
36694
+ const burnRequests = (result.position?.burnRequests || []).map((b) => ({
36695
+ id: b.id,
36696
+ positionId,
36697
+ pkpId: b.pkpId,
36698
+ borrower: b.borrower.id,
36699
+ burnAmount: b.burnAmount,
36700
+ remainingDebt: b.remainingDebt,
36701
+ newCollateralRatio: b.newCollateralRatio,
36702
+ opId: b.opId,
36703
+ timestamp: b.timestamp,
36704
+ blockNumber: b.blockNumber,
36705
+ transactionHash: b.transactionHash,
36706
+ logIndex: b.logIndex
36707
+ }));
36708
+ const collateralEvents = (result.collateralEvents || []).map((c) => ({
36709
+ id: c.id,
36710
+ positionId,
36711
+ eventType: c.eventType,
36712
+ networkFee: c.networkFee,
36713
+ remainingCollateral: c.remainingCollateral,
36714
+ collateralRatio: c.collateralRatio,
36715
+ timestamp: c.timestamp,
36716
+ blockNumber: c.blockNumber,
36717
+ transactionHash: c.transactionHash,
36718
+ logIndex: c.logIndex
36719
+ }));
36720
+ const circuitBreakerEvents = (result.circuitBreakerEvents || []).map((cb) => ({
36721
+ id: cb.id,
36722
+ isActivated: cb.isActivated,
36723
+ admin: cb.admin,
36724
+ reason: cb.reason,
36725
+ timestamp: cb.timestamp,
36726
+ blockNumber: cb.blockNumber,
36727
+ transactionHash: cb.transactionHash
36728
+ }));
36729
+ const termFeeUpdates = (result.termFeeUpdates || []).map((t) => ({
36730
+ id: t.id,
36731
+ termMonths: t.term.id,
36732
+ oldOriginationFee: t.oldOriginationFee,
36733
+ newOriginationFee: t.newOriginationFee,
36734
+ oldExtensionFee: t.oldExtensionFee,
36735
+ newExtensionFee: t.newExtensionFee,
36736
+ timestamp: t.timestamp,
36737
+ blockNumber: t.blockNumber,
36738
+ transactionHash: t.transactionHash
36739
+ }));
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;
36442
36781
  return {
36443
36782
  positionId,
36444
36783
  payments,
@@ -36447,6 +36786,16 @@ var DiamondHandsGraph = class {
36447
36786
  mints,
36448
36787
  withdrawals,
36449
36788
  renewals,
36789
+ operationFailures,
36790
+ mintRequests,
36791
+ burnRequests,
36792
+ collateralEvents,
36793
+ circuitBreakerEvents,
36794
+ termFeeUpdates,
36795
+ loanProtocolParamUpdates,
36796
+ maxLoanValueUpdates,
36797
+ btcPriceBoundsUpdates,
36798
+ perUserMintLimitUpdates,
36450
36799
  feeDistributions: [],
36451
36800
  totalEvents
36452
36801
  };
@@ -43207,7 +43556,7 @@ var EventHelpers = {
43207
43556
  * Get total count of all events
43208
43557
  */
43209
43558
  getTotalCount(events) {
43210
- return events.payments.length + events.statusUpdates.length + (events.liquidation ? 1 : 0) + events.mints.length + events.withdrawals.length + events.renewals.length;
43559
+ 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;
43211
43560
  },
43212
43561
  /**
43213
43562
  * Merge and sort all events by timestamp
@@ -43219,7 +43568,17 @@ var EventHelpers = {
43219
43568
  ...events.liquidation ? [{ ...events.liquidation, eventType: "liquidation" }] : [],
43220
43569
  ...events.mints.map((e) => ({ ...e, eventType: "mint" })),
43221
43570
  ...events.withdrawals.map((e) => ({ ...e, eventType: "withdrawal" })),
43222
- ...events.renewals.map((e) => ({ ...e, eventType: "renewal" }))
43571
+ ...events.renewals.map((e) => ({ ...e, eventType: "renewal" })),
43572
+ ...events.operationFailures.map((e) => ({ ...e, eventType: "operationFailure" })),
43573
+ ...events.mintRequests.map((e) => ({ ...e, eventType: "mintRequest" })),
43574
+ ...events.burnRequests.map((e) => ({ ...e, eventType: "burnRequest" })),
43575
+ ...events.collateralEvents.map((e) => ({ ...e, eventType: "collateralEvent" })),
43576
+ ...events.circuitBreakerEvents.map((e) => ({ ...e, eventType: "circuitBreaker" })),
43577
+ ...events.termFeeUpdates.map((e) => ({ ...e, eventType: "termFeeUpdate" })),
43578
+ ...events.loanProtocolParamUpdates.map((e) => ({ ...e, eventType: "loanProtocolParamUpdate" })),
43579
+ ...events.maxLoanValueUpdates.map((e) => ({ ...e, eventType: "maxLoanValueUpdate" })),
43580
+ ...events.btcPriceBoundsUpdates.map((e) => ({ ...e, eventType: "btcPriceBoundsUpdate" })),
43581
+ ...events.perUserMintLimitUpdates.map((e) => ({ ...e, eventType: "perUserMintLimitUpdate" }))
43223
43582
  ];
43224
43583
  return allEvents.sort((a, b) => {
43225
43584
  const diff = BigInt(a.timestamp) - BigInt(b.timestamp);
package/dist/index.mjs CHANGED
@@ -36173,7 +36173,25 @@ var DiamondHandsGraph = class {
36173
36173
  limit = 1e3,
36174
36174
  orderDirection = "desc"
36175
36175
  } = filter || {};
36176
- const buildWhereClause = () => {
36176
+ const shouldQuery = {
36177
+ payment: !eventTypes || eventTypes.includes("payment"),
36178
+ status: !eventTypes || eventTypes.includes("status"),
36179
+ liquidation: !eventTypes || eventTypes.includes("liquidation"),
36180
+ mint: !eventTypes || eventTypes.includes("mint"),
36181
+ withdrawal: !eventTypes || eventTypes.includes("withdrawal"),
36182
+ renewal: !eventTypes || eventTypes.includes("renewal"),
36183
+ operationFailure: !eventTypes || eventTypes.includes("operationFailure"),
36184
+ mintRequest: !eventTypes || eventTypes.includes("mintRequest"),
36185
+ burnRequest: !eventTypes || eventTypes.includes("burnRequest"),
36186
+ collateralEvent: !eventTypes || eventTypes.includes("collateralEvent"),
36187
+ circuitBreaker: !eventTypes || eventTypes.includes("circuitBreaker"),
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")
36193
+ };
36194
+ const buildPositionWhereClause = () => {
36177
36195
  const conditions = [`position: "${positionId.toLowerCase()}"`];
36178
36196
  if (fromTimestamp)
36179
36197
  conditions.push(`timestamp_gte: "${fromTimestamp}"`);
@@ -36183,15 +36201,19 @@ var DiamondHandsGraph = class {
36183
36201
  conditions.push(`blockNumber_gte: "${fromBlock}"`);
36184
36202
  if (toBlock)
36185
36203
  conditions.push(`blockNumber_lte: "${toBlock}"`);
36186
- return conditions.length > 0 ? `where: { ${conditions.join(", ")} }` : "";
36204
+ return `where: { ${conditions.join(", ")} }`;
36187
36205
  };
36188
- const shouldQuery = {
36189
- payment: !eventTypes || eventTypes.includes("payment"),
36190
- status: !eventTypes || eventTypes.includes("status"),
36191
- liquidation: !eventTypes || eventTypes.includes("liquidation"),
36192
- mint: !eventTypes || eventTypes.includes("mint"),
36193
- withdrawal: !eventTypes || eventTypes.includes("withdrawal"),
36194
- renewal: !eventTypes || eventTypes.includes("renewal")
36206
+ const buildProtocolWhereClause = () => {
36207
+ const conditions = [];
36208
+ if (fromTimestamp)
36209
+ conditions.push(`timestamp_gte: "${fromTimestamp}"`);
36210
+ if (toTimestamp)
36211
+ conditions.push(`timestamp_lte: "${toTimestamp}"`);
36212
+ if (fromBlock)
36213
+ conditions.push(`blockNumber_gte: "${fromBlock}"`);
36214
+ if (toBlock)
36215
+ conditions.push(`blockNumber_lte: "${toBlock}"`);
36216
+ return conditions.length > 0 ? `where: { ${conditions.join(", ")} }` : "";
36195
36217
  };
36196
36218
  const query = `
36197
36219
  query GetLoanEvents($positionId: Bytes!, $limit: Int!, $orderDirection: OrderDirection!) {
@@ -36202,7 +36224,7 @@ var DiamondHandsGraph = class {
36202
36224
  first: $limit,
36203
36225
  orderBy: timestamp,
36204
36226
  orderDirection: $orderDirection
36205
- ${buildWhereClause()}
36227
+ ${buildProtocolWhereClause()}
36206
36228
  ) {
36207
36229
  id
36208
36230
  payer { id }
@@ -36222,7 +36244,7 @@ var DiamondHandsGraph = class {
36222
36244
  first: $limit,
36223
36245
  orderBy: timestamp,
36224
36246
  orderDirection: $orderDirection
36225
- ${buildWhereClause()}
36247
+ ${buildProtocolWhereClause()}
36226
36248
  ) {
36227
36249
  id
36228
36250
  oldStatus
@@ -36282,11 +36304,213 @@ var DiamondHandsGraph = class {
36282
36304
  logIndex
36283
36305
  }
36284
36306
  ` : ""}
36307
+
36308
+ ${shouldQuery.operationFailure ? `
36309
+ operationFailures(
36310
+ first: $limit,
36311
+ orderBy: timestamp,
36312
+ orderDirection: $orderDirection
36313
+ ) {
36314
+ id
36315
+ operationType
36316
+ reason
36317
+ errorCode
36318
+ amount
36319
+ timestamp
36320
+ blockNumber
36321
+ transactionHash
36322
+ logIndex
36323
+ }
36324
+ ` : ""}
36325
+
36326
+ ${shouldQuery.mintRequest ? `
36327
+ mintRequests(
36328
+ first: $limit,
36329
+ orderBy: timestamp,
36330
+ orderDirection: $orderDirection
36331
+ ) {
36332
+ id
36333
+ pkpId
36334
+ borrower { id }
36335
+ mintAmount
36336
+ originationFee
36337
+ newDebt
36338
+ newCollateralRatio
36339
+ btcPrice
36340
+ quantumTimestamp
36341
+ opId
36342
+ timestamp
36343
+ blockNumber
36344
+ transactionHash
36345
+ logIndex
36346
+ }
36347
+ ` : ""}
36348
+
36349
+ ${shouldQuery.burnRequest ? `
36350
+ burnRequests(
36351
+ first: $limit,
36352
+ orderBy: timestamp,
36353
+ orderDirection: $orderDirection
36354
+ ) {
36355
+ id
36356
+ pkpId
36357
+ borrower { id }
36358
+ burnAmount
36359
+ remainingDebt
36360
+ newCollateralRatio
36361
+ opId
36362
+ timestamp
36363
+ blockNumber
36364
+ transactionHash
36365
+ logIndex
36366
+ }
36367
+ ` : ""}
36285
36368
  }
36286
36369
 
36370
+ ${shouldQuery.mint ? `
36371
+ ucdMintEvents(
36372
+ ${buildPositionWhereClause()}
36373
+ first: $limit,
36374
+ orderBy: timestamp,
36375
+ orderDirection: $orderDirection
36376
+ ) {
36377
+ id
36378
+ amount
36379
+ proof
36380
+ minter { id }
36381
+ isCommunityMint
36382
+ timestamp
36383
+ blockNumber
36384
+ transactionHash
36385
+ }
36386
+ ` : ""}
36287
36387
 
36288
- # TODO: Re-enable ucdMintEvents query when subgraph schema is updated
36289
- # ${shouldQuery.mint ? `ucdMintEvents(...)` : ""}
36388
+ ${shouldQuery.collateralEvent ? `
36389
+ collateralEvents(
36390
+ ${buildPositionWhereClause()}
36391
+ first: $limit,
36392
+ orderBy: timestamp,
36393
+ orderDirection: $orderDirection
36394
+ ) {
36395
+ id
36396
+ eventType
36397
+ networkFee
36398
+ remainingCollateral
36399
+ collateralRatio
36400
+ timestamp
36401
+ blockNumber
36402
+ transactionHash
36403
+ logIndex
36404
+ }
36405
+ ` : ""}
36406
+
36407
+ ${shouldQuery.circuitBreaker ? `
36408
+ circuitBreakerEvents(
36409
+ ${buildProtocolWhereClause()}
36410
+ first: $limit,
36411
+ orderBy: timestamp,
36412
+ orderDirection: $orderDirection
36413
+ ) {
36414
+ id
36415
+ isActivated
36416
+ admin
36417
+ reason
36418
+ timestamp
36419
+ blockNumber
36420
+ transactionHash
36421
+ }
36422
+ ` : ""}
36423
+
36424
+ ${shouldQuery.termFeeUpdate ? `
36425
+ termFeeUpdates(
36426
+ ${buildProtocolWhereClause()}
36427
+ first: $limit,
36428
+ orderBy: timestamp,
36429
+ orderDirection: $orderDirection
36430
+ ) {
36431
+ id
36432
+ term { id }
36433
+ oldOriginationFee
36434
+ newOriginationFee
36435
+ oldExtensionFee
36436
+ newExtensionFee
36437
+ timestamp
36438
+ blockNumber
36439
+ transactionHash
36440
+ }
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
+ ` : ""}
36290
36514
  }
36291
36515
  `;
36292
36516
  const variables = {
@@ -36366,7 +36590,122 @@ var DiamondHandsGraph = class {
36366
36590
  transactionHash: r2.transactionHash,
36367
36591
  logIndex: r2.logIndex
36368
36592
  }));
36369
- const totalEvents = payments.length + statusUpdates.length + (liquidation ? 1 : 0) + mints.length + withdrawals.length + renewals.length;
36593
+ const operationFailures = (result.position?.operationFailures || []).map((o) => ({
36594
+ id: o.id,
36595
+ positionId,
36596
+ operationType: o.operationType,
36597
+ reason: o.reason,
36598
+ errorCode: o.errorCode,
36599
+ amount: o.amount,
36600
+ timestamp: o.timestamp,
36601
+ blockNumber: o.blockNumber,
36602
+ transactionHash: o.transactionHash,
36603
+ logIndex: o.logIndex
36604
+ }));
36605
+ const mintRequests = (result.position?.mintRequests || []).map((m) => ({
36606
+ id: m.id,
36607
+ positionId,
36608
+ pkpId: m.pkpId,
36609
+ borrower: m.borrower.id,
36610
+ mintAmount: m.mintAmount,
36611
+ originationFee: m.originationFee,
36612
+ newDebt: m.newDebt,
36613
+ newCollateralRatio: m.newCollateralRatio,
36614
+ btcPrice: m.btcPrice,
36615
+ quantumTimestamp: m.quantumTimestamp,
36616
+ opId: m.opId,
36617
+ timestamp: m.timestamp,
36618
+ blockNumber: m.blockNumber,
36619
+ transactionHash: m.transactionHash,
36620
+ logIndex: m.logIndex
36621
+ }));
36622
+ const burnRequests = (result.position?.burnRequests || []).map((b) => ({
36623
+ id: b.id,
36624
+ positionId,
36625
+ pkpId: b.pkpId,
36626
+ borrower: b.borrower.id,
36627
+ burnAmount: b.burnAmount,
36628
+ remainingDebt: b.remainingDebt,
36629
+ newCollateralRatio: b.newCollateralRatio,
36630
+ opId: b.opId,
36631
+ timestamp: b.timestamp,
36632
+ blockNumber: b.blockNumber,
36633
+ transactionHash: b.transactionHash,
36634
+ logIndex: b.logIndex
36635
+ }));
36636
+ const collateralEvents = (result.collateralEvents || []).map((c) => ({
36637
+ id: c.id,
36638
+ positionId,
36639
+ eventType: c.eventType,
36640
+ networkFee: c.networkFee,
36641
+ remainingCollateral: c.remainingCollateral,
36642
+ collateralRatio: c.collateralRatio,
36643
+ timestamp: c.timestamp,
36644
+ blockNumber: c.blockNumber,
36645
+ transactionHash: c.transactionHash,
36646
+ logIndex: c.logIndex
36647
+ }));
36648
+ const circuitBreakerEvents = (result.circuitBreakerEvents || []).map((cb) => ({
36649
+ id: cb.id,
36650
+ isActivated: cb.isActivated,
36651
+ admin: cb.admin,
36652
+ reason: cb.reason,
36653
+ timestamp: cb.timestamp,
36654
+ blockNumber: cb.blockNumber,
36655
+ transactionHash: cb.transactionHash
36656
+ }));
36657
+ const termFeeUpdates = (result.termFeeUpdates || []).map((t) => ({
36658
+ id: t.id,
36659
+ termMonths: t.term.id,
36660
+ oldOriginationFee: t.oldOriginationFee,
36661
+ newOriginationFee: t.newOriginationFee,
36662
+ oldExtensionFee: t.oldExtensionFee,
36663
+ newExtensionFee: t.newExtensionFee,
36664
+ timestamp: t.timestamp,
36665
+ blockNumber: t.blockNumber,
36666
+ transactionHash: t.transactionHash
36667
+ }));
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;
36370
36709
  return {
36371
36710
  positionId,
36372
36711
  payments,
@@ -36375,6 +36714,16 @@ var DiamondHandsGraph = class {
36375
36714
  mints,
36376
36715
  withdrawals,
36377
36716
  renewals,
36717
+ operationFailures,
36718
+ mintRequests,
36719
+ burnRequests,
36720
+ collateralEvents,
36721
+ circuitBreakerEvents,
36722
+ termFeeUpdates,
36723
+ loanProtocolParamUpdates,
36724
+ maxLoanValueUpdates,
36725
+ btcPriceBoundsUpdates,
36726
+ perUserMintLimitUpdates,
36378
36727
  feeDistributions: [],
36379
36728
  totalEvents
36380
36729
  };
@@ -43135,7 +43484,7 @@ var EventHelpers = {
43135
43484
  * Get total count of all events
43136
43485
  */
43137
43486
  getTotalCount(events) {
43138
- return events.payments.length + events.statusUpdates.length + (events.liquidation ? 1 : 0) + events.mints.length + events.withdrawals.length + events.renewals.length;
43487
+ 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;
43139
43488
  },
43140
43489
  /**
43141
43490
  * Merge and sort all events by timestamp
@@ -43147,7 +43496,17 @@ var EventHelpers = {
43147
43496
  ...events.liquidation ? [{ ...events.liquidation, eventType: "liquidation" }] : [],
43148
43497
  ...events.mints.map((e) => ({ ...e, eventType: "mint" })),
43149
43498
  ...events.withdrawals.map((e) => ({ ...e, eventType: "withdrawal" })),
43150
- ...events.renewals.map((e) => ({ ...e, eventType: "renewal" }))
43499
+ ...events.renewals.map((e) => ({ ...e, eventType: "renewal" })),
43500
+ ...events.operationFailures.map((e) => ({ ...e, eventType: "operationFailure" })),
43501
+ ...events.mintRequests.map((e) => ({ ...e, eventType: "mintRequest" })),
43502
+ ...events.burnRequests.map((e) => ({ ...e, eventType: "burnRequest" })),
43503
+ ...events.collateralEvents.map((e) => ({ ...e, eventType: "collateralEvent" })),
43504
+ ...events.circuitBreakerEvents.map((e) => ({ ...e, eventType: "circuitBreaker" })),
43505
+ ...events.termFeeUpdates.map((e) => ({ ...e, eventType: "termFeeUpdate" })),
43506
+ ...events.loanProtocolParamUpdates.map((e) => ({ ...e, eventType: "loanProtocolParamUpdate" })),
43507
+ ...events.maxLoanValueUpdates.map((e) => ({ ...e, eventType: "maxLoanValueUpdate" })),
43508
+ ...events.btcPriceBoundsUpdates.map((e) => ({ ...e, eventType: "btcPriceBoundsUpdate" })),
43509
+ ...events.perUserMintLimitUpdates.map((e) => ({ ...e, eventType: "perUserMintLimitUpdate" }))
43151
43510
  ];
43152
43511
  return allEvents.sort((a, b) => {
43153
43512
  const diff = BigInt(a.timestamp) - BigInt(b.timestamp);
@@ -167,6 +167,152 @@ export interface RenewalEvent {
167
167
  /** Log index in the transaction */
168
168
  logIndex: string;
169
169
  }
170
+ /**
171
+ * Failed operation event - tracks mint/burn/repay/renew/withdraw failures
172
+ */
173
+ export interface OperationFailureEvent {
174
+ id: string;
175
+ positionId: string;
176
+ operationType: string;
177
+ reason: string;
178
+ errorCode?: string;
179
+ amount?: string;
180
+ timestamp: string;
181
+ blockNumber: string;
182
+ transactionHash: string;
183
+ logIndex: string;
184
+ }
185
+ /**
186
+ * UCD mint request - records a successful mintUCD call with all parameters
187
+ */
188
+ export interface MintRequestEvent {
189
+ id: string;
190
+ positionId: string;
191
+ pkpId: string;
192
+ borrower: string;
193
+ mintAmount: string;
194
+ originationFee: string;
195
+ newDebt: string;
196
+ newCollateralRatio: string;
197
+ btcPrice: string;
198
+ quantumTimestamp: string;
199
+ opId: string;
200
+ timestamp: string;
201
+ blockNumber: string;
202
+ transactionHash: string;
203
+ logIndex: string;
204
+ }
205
+ /**
206
+ * Burn request - records a successful makePayment/repay call
207
+ */
208
+ export interface BurnRequestEvent {
209
+ id: string;
210
+ positionId: string;
211
+ pkpId: string;
212
+ borrower: string;
213
+ burnAmount: string;
214
+ remainingDebt: string;
215
+ newCollateralRatio: string;
216
+ opId: string;
217
+ timestamp: string;
218
+ blockNumber: string;
219
+ transactionHash: string;
220
+ logIndex: string;
221
+ }
222
+ /**
223
+ * Collateral contract event - position-level collateral manager outcomes
224
+ * (POSITION_CLOSED, NETWORK_FEE_DEDUCTED, VALIDATION_FAILED, EXCESSIVE_FEE_REJECTED)
225
+ */
226
+ export interface CollateralContractEvent {
227
+ id: string;
228
+ positionId: string;
229
+ eventType: string;
230
+ networkFee?: string;
231
+ remainingCollateral?: string;
232
+ collateralRatio?: string;
233
+ timestamp: string;
234
+ blockNumber: string;
235
+ transactionHash: string;
236
+ logIndex: string;
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
+ }
290
+ /**
291
+ * Protocol-level circuit breaker event (activation, deactivation, limit updates)
292
+ */
293
+ export interface CircuitBreakerProtocolEvent {
294
+ id: string;
295
+ isActivated: boolean;
296
+ admin: string;
297
+ reason?: string;
298
+ timestamp: string;
299
+ blockNumber: string;
300
+ transactionHash: string;
301
+ }
302
+ /**
303
+ * Protocol-level term fee update event
304
+ */
305
+ export interface TermFeeUpdateEvent {
306
+ id: string;
307
+ termMonths: string;
308
+ oldOriginationFee: string;
309
+ newOriginationFee: string;
310
+ oldExtensionFee: string;
311
+ newExtensionFee: string;
312
+ timestamp: string;
313
+ blockNumber: string;
314
+ transactionHash: string;
315
+ }
170
316
  /**
171
317
  * Community fee distribution event
172
318
  */
@@ -206,6 +352,26 @@ export interface LoanEvents {
206
352
  withdrawals: WithdrawalEvent[];
207
353
  /** All position renewal/extension events */
208
354
  renewals: RenewalEvent[];
355
+ /** All failed operation events */
356
+ operationFailures: OperationFailureEvent[];
357
+ /** All mint request events (successful mintUCD calls) */
358
+ mintRequests: MintRequestEvent[];
359
+ /** All burn request events (successful repay/payment calls) */
360
+ burnRequests: BurnRequestEvent[];
361
+ /** All collateral contract events (close, fee deduction, validation failures) */
362
+ collateralEvents: CollateralContractEvent[];
363
+ /** Protocol-level circuit breaker events */
364
+ circuitBreakerEvents: CircuitBreakerProtocolEvent[];
365
+ /** Protocol-level term fee update events */
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[];
209
375
  /** All community fee distribution events */
210
376
  feeDistributions: FeeDistributionEvent[];
211
377
  /** Total number of events */
@@ -216,7 +382,7 @@ export interface LoanEvents {
216
382
  */
217
383
  export interface LoanEventsFilter {
218
384
  /** Filter by event types */
219
- eventTypes?: Array<'payment' | 'status' | 'liquidation' | 'mint' | 'withdrawal' | 'renewal'>;
385
+ eventTypes?: Array<'payment' | 'status' | 'liquidation' | 'mint' | 'withdrawal' | 'renewal' | 'operationFailure' | 'mintRequest' | 'burnRequest' | 'collateralEvent' | 'circuitBreaker' | 'termFeeUpdate' | 'loanProtocolParamUpdate' | 'maxLoanValueUpdate' | 'btcPriceBoundsUpdate' | 'perUserMintLimitUpdate'>;
220
386
  /** Filter by minimum timestamp */
221
387
  fromTimestamp?: string;
222
388
  /** Filter by maximum timestamp */
@@ -283,5 +449,25 @@ export declare const EventHelpers: {
283
449
  eventType: "withdrawal";
284
450
  }) | (RenewalEvent & {
285
451
  eventType: "renewal";
452
+ }) | (OperationFailureEvent & {
453
+ eventType: "operationFailure";
454
+ }) | (MintRequestEvent & {
455
+ eventType: "mintRequest";
456
+ }) | (BurnRequestEvent & {
457
+ eventType: "burnRequest";
458
+ }) | (CollateralContractEvent & {
459
+ eventType: "collateralEvent";
460
+ }) | (CircuitBreakerProtocolEvent & {
461
+ eventType: "circuitBreaker";
462
+ }) | (TermFeeUpdateEvent & {
463
+ eventType: "termFeeUpdate";
464
+ }) | (LoanProtocolParamUpdateEvent & {
465
+ eventType: "loanProtocolParamUpdate";
466
+ }) | (MaxLoanValueUpdateEvent & {
467
+ eventType: "maxLoanValueUpdate";
468
+ }) | (BtcPriceBoundsUpdateEvent & {
469
+ eventType: "btcPriceBoundsUpdate";
470
+ }) | (PerUserDailyMintLimitUpdateEvent & {
471
+ eventType: "perUserMintLimitUpdate";
286
472
  })>;
287
473
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gvnrdao/dh-sdk",
3
- "version": "0.0.211",
3
+ "version": "0.0.213",
4
4
  "description": "TypeScript SDK for Diamond Hands Protocol - Bitcoin-backed lending with LIT Protocol PKPs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/sdk/src/index.d.ts",