@gvnrdao/dh-sdk 0.0.166 → 0.0.205

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.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -5
  3. package/browser/dist/397.browser.js +1 -1
  4. package/browser/dist/833.browser.js +1 -1
  5. package/browser/dist/browser.js +1 -13
  6. package/browser/dist/browser.js.LICENSE.txt +1 -70
  7. package/browser/dist/index.d.ts +3 -4
  8. package/browser/dist/index.d.ts.map +1 -1
  9. package/browser/dist/index.js +4 -3
  10. package/dist/constants/chunks/contract-abis.d.ts +7 -0
  11. package/dist/constants/chunks/deployment-addresses.d.ts +68 -0
  12. package/dist/constants/chunks/encrypted-provider-params.d.ts +21 -0
  13. package/dist/constants/chunks/environment.browser.d.ts +45 -0
  14. package/dist/constants/chunks/environment.d.ts +57 -0
  15. package/dist/constants/chunks/network-configs.d.ts +65 -0
  16. package/dist/constants/chunks/sdk-config.d.ts +33 -0
  17. package/dist/constants/chunks/sdk-limits.d.ts +66 -0
  18. package/dist/constants/index.d.ts +15 -0
  19. package/dist/graphs/client.d.ts +19 -0
  20. package/dist/graphs/diamond-hands.d.ts +248 -0
  21. package/dist/index.d.ts +47 -7391
  22. package/dist/index.js +4525 -16860
  23. package/dist/index.mjs +4489 -16801
  24. package/dist/interfaces/chunks/btc.i.d.ts +36 -0
  25. package/dist/interfaces/chunks/config.i.d.ts +250 -0
  26. package/dist/interfaces/chunks/contract-interactions.i.d.ts +64 -0
  27. package/dist/interfaces/chunks/contract-types.i.d.ts +165 -0
  28. package/dist/interfaces/chunks/lit-actions-results.i.d.ts +165 -0
  29. package/dist/interfaces/chunks/lit-actions.i.d.ts +98 -0
  30. package/dist/interfaces/chunks/loan-operations.i.d.ts +332 -0
  31. package/dist/interfaces/chunks/pkp-integration.i.d.ts +87 -0
  32. package/dist/interfaces/chunks/position-query.i.d.ts +76 -0
  33. package/dist/interfaces/chunks/requests.i.d.ts +55 -0
  34. package/dist/interfaces/chunks/ucd-minting.i.d.ts +34 -0
  35. package/dist/interfaces/chunks/utility.i.d.ts +64 -0
  36. package/dist/interfaces/index.d.ts +17 -0
  37. package/dist/modules/bitcoin/bitcoin-operations.module.d.ts +223 -0
  38. package/dist/modules/cache/cache-manager.module.d.ts +92 -0
  39. package/dist/modules/contract/contract-manager.module.d.ts +136 -0
  40. package/dist/modules/diamond-hands-sdk.d.ts +669 -0
  41. package/dist/modules/loan/loan-creator.module.d.ts +143 -0
  42. package/dist/modules/loan/loan-query.module.d.ts +206 -0
  43. package/dist/modules/mock/mock-token-manager.module.d.ts +83 -0
  44. package/dist/modules/pkp/pkp-manager.module.d.ts +136 -0
  45. package/dist/protocol/protocol-pause.d.ts +19 -0
  46. package/dist/server.d.ts +17 -0
  47. package/dist/server.js +285 -0
  48. package/dist/server.mjs +242 -0
  49. package/dist/types/authorization-params.d.ts +160 -0
  50. package/dist/types/branded/domain-values.d.ts +138 -0
  51. package/dist/types/branded/ids.d.ts +23 -0
  52. package/dist/types/event-types.d.ts +235 -0
  53. package/dist/types/graph-dtos.d.ts +228 -0
  54. package/dist/types/loanStatus.d.ts +10 -0
  55. package/dist/types/result.d.ts +120 -0
  56. package/dist/utils/bitcoin-address-cache.utils.d.ts +87 -0
  57. package/dist/utils/bitcoin-provider.utils.d.ts +48 -0
  58. package/dist/utils/bitcoin-signature.d.ts +20 -0
  59. package/dist/utils/chunks/bitcoin-utils.d.ts +75 -0
  60. package/dist/utils/chunks/eip1559-broadcast.utils.d.ts +24 -0
  61. package/dist/utils/error-handler.d.ts +106 -0
  62. package/dist/utils/ethers-interop.utils.d.ts +146 -0
  63. package/dist/utils/extend-authorization.utils.d.ts +61 -0
  64. package/dist/utils/lit-signature.utils.d.ts +6 -0
  65. package/dist/utils/logger.utils.d.ts +142 -0
  66. package/dist/utils/mint-authorization.utils.d.ts +224 -0
  67. package/dist/utils/quantum-timing.d.ts +75 -0
  68. package/dist/utils/signature-tempering.utils.d.ts +31 -0
  69. package/dist/utils/telegram-messaging.utils.d.ts +188 -0
  70. package/package.json +43 -22
  71. package/dist/index.d.mts +0 -7392
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Branded types for domain-specific values to prevent mixing incompatible units
3
+ *
4
+ * These types provide compile-time safety to ensure we don't accidentally
5
+ * use Bitcoin satoshis where UCD is expected, or vice versa.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const debt: UCD = UCD(1000000n);
10
+ * const balance: Satoshis = Satoshis(50000000n);
11
+ *
12
+ * // This will cause a TypeScript error:
13
+ * await mintUCD(balance); // Error: Cannot use Satoshis where UCD expected
14
+ * ```
15
+ */
16
+ declare const __brand: unique symbol;
17
+ /**
18
+ * UCD (USD Coin Diamond) - The stablecoin minted against Bitcoin collateral
19
+ * Base unit: 1 UCD = 10^18 wei (matches ERC20 decimals)
20
+ */
21
+ export type UCD = bigint & {
22
+ readonly [__brand]: 'UCD';
23
+ };
24
+ /**
25
+ * Satoshis - Bitcoin base unit
26
+ * Base unit: 1 BTC = 100,000,000 satoshis
27
+ */
28
+ export type Satoshis = bigint & {
29
+ readonly [__brand]: 'Satoshis';
30
+ };
31
+ /**
32
+ * Wei - Ethereum base unit for ETH and ERC20 tokens (18 decimals)
33
+ * Base unit: 1 token = 10^18 wei
34
+ */
35
+ export type Wei = bigint & {
36
+ readonly [__brand]: 'Wei';
37
+ };
38
+ /**
39
+ * BPS - Basis Points for percentage calculations
40
+ * Base unit: 1% = 100 BPS, 100% = 10,000 BPS
41
+ */
42
+ export type BPS = number & {
43
+ readonly [__brand]: 'BPS';
44
+ };
45
+ /**
46
+ * UnixTimestamp - Unix timestamp in seconds
47
+ */
48
+ export type UnixTimestamp = number & {
49
+ readonly [__brand]: 'UnixTimestamp';
50
+ };
51
+ /**
52
+ * BlockNumber - Ethereum block number
53
+ */
54
+ export type BlockNumber = number & {
55
+ readonly [__brand]: 'BlockNumber';
56
+ };
57
+ export declare const UCD: (value: bigint) => UCD;
58
+ export declare const Satoshis: (value: bigint) => Satoshis;
59
+ export declare const Wei: (value: bigint) => Wei;
60
+ export declare const BPS: (value: number) => BPS;
61
+ export declare const UnixTimestamp: (value: number) => UnixTimestamp;
62
+ export declare const BlockNumber: (value: number) => BlockNumber;
63
+ export declare function isUCD(value: unknown): value is UCD;
64
+ export declare function isSatoshis(value: unknown): value is Satoshis;
65
+ export declare function isWei(value: unknown): value is Wei;
66
+ export declare function isBPS(value: unknown): value is BPS;
67
+ export declare function isUnixTimestamp(value: unknown): value is UnixTimestamp;
68
+ export declare function isBlockNumber(value: unknown): value is BlockNumber;
69
+ export declare namespace UCDConversions {
70
+ function fromWhole(whole: number | string): UCD;
71
+ function toWhole(ucd: UCD): number;
72
+ function format(ucd: UCD, decimals?: number): string;
73
+ /**
74
+ * Convert UCD to JSON-serializable string
75
+ */
76
+ function toJSON(ucd: UCD): string;
77
+ /**
78
+ * Parse UCD from JSON string
79
+ */
80
+ function fromJSON(json: string): UCD;
81
+ /**
82
+ * Convert to structured serializable format with metadata
83
+ */
84
+ function toSerializable(ucd: UCD): {
85
+ value: string;
86
+ decimals: number;
87
+ type: 'UCD';
88
+ };
89
+ }
90
+ export declare namespace SatoshisConversions {
91
+ function fromBTC(btc: number | string): Satoshis;
92
+ function toBTC(satoshis: Satoshis): number;
93
+ function format(satoshis: Satoshis, unit?: 'BTC' | 'sats'): string;
94
+ /**
95
+ * Convert Satoshis to JSON-serializable string
96
+ */
97
+ function toJSON(satoshis: Satoshis): string;
98
+ /**
99
+ * Parse Satoshis from JSON string
100
+ */
101
+ function fromJSON(json: string): Satoshis;
102
+ /**
103
+ * Convert to structured serializable format with metadata
104
+ */
105
+ function toSerializable(satoshis: Satoshis): {
106
+ value: string;
107
+ unit: 'satoshis';
108
+ type: 'Satoshis';
109
+ };
110
+ }
111
+ export declare namespace WeiConversions {
112
+ function fromWhole(whole: number | string): Wei;
113
+ function toWhole(wei: Wei): number;
114
+ function format(wei: Wei, decimals?: number): string;
115
+ /**
116
+ * Convert Wei to JSON-serializable string
117
+ */
118
+ function toJSON(wei: Wei): string;
119
+ /**
120
+ * Parse Wei from JSON string
121
+ */
122
+ function fromJSON(json: string): Wei;
123
+ /**
124
+ * Convert to structured serializable format with metadata
125
+ */
126
+ function toSerializable(wei: Wei): {
127
+ value: string;
128
+ decimals: number;
129
+ type: 'Wei';
130
+ };
131
+ }
132
+ export declare namespace BPSConversions {
133
+ function fromPercent(percent: number): BPS;
134
+ function toPercent(bps: BPS): number;
135
+ function toDecimal(bps: BPS): number;
136
+ function format(bps: BPS): string;
137
+ }
138
+ export {};
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Branded identifier types for PKP and Position IDs.
3
+ *
4
+ * These provide lightweight nominal typing so that internal helpers can
5
+ * distinguish between generic strings and protocol identifiers, while
6
+ * still being freely assignable to `string` where needed.
7
+ */
8
+ declare const __idBrand: unique symbol;
9
+ /**
10
+ * PKP token identifier (decimal string or hex string, depending on context).
11
+ */
12
+ export type PkpId = string & {
13
+ readonly [__idBrand]: "PkpId";
14
+ };
15
+ /**
16
+ * Position identifier (on-chain bytes32, represented as hex string in SDK).
17
+ */
18
+ export type PositionId = string & {
19
+ readonly [__idBrand]: "PositionId";
20
+ };
21
+ export declare const PkpId: (value: string) => PkpId;
22
+ export declare const PositionId: (value: string) => PositionId;
23
+ export {};
@@ -0,0 +1,235 @@
1
+ /**
2
+ * Loan Event Types
3
+ *
4
+ * Type definitions for all loan-related events tracked by the Diamond Hands Protocol.
5
+ * These events are indexed by The Graph subgraph and can be queried via the SDK.
6
+ */
7
+ /**
8
+ * Payment event type enum
9
+ */
10
+ export declare enum PaymentType {
11
+ FULL_REPAYMENT = "FULL_REPAYMENT",
12
+ PARTIAL_PAYMENT = "PARTIAL_PAYMENT",
13
+ EXTENSION_FEE = "EXTENSION_FEE"
14
+ }
15
+ /**
16
+ * Position status enum
17
+ */
18
+ export declare enum PositionStatus {
19
+ PENDING_DEPOSIT = "PENDING_DEPOSIT",
20
+ ACTIVE = "ACTIVE",
21
+ EXPIRED = "EXPIRED",
22
+ LIQUIDATED = "LIQUIDATED",
23
+ REPAID = "REPAID",
24
+ CLOSED = "CLOSED"
25
+ }
26
+ /**
27
+ * Payment event - tracks all payment activities for a position
28
+ */
29
+ export interface PaymentEvent {
30
+ /** Unique event ID (transaction hash + log index) */
31
+ id: string;
32
+ /** Position ID this payment belongs to */
33
+ positionId: string;
34
+ /** Address of the payer */
35
+ payer: string;
36
+ /** Payment amount in UCD (wei) */
37
+ amount: string;
38
+ /** Type of payment */
39
+ type: PaymentType;
40
+ /** Transaction hash */
41
+ transactionHash: string;
42
+ /** Block timestamp */
43
+ timestamp: string;
44
+ /** Block number */
45
+ blockNumber: string;
46
+ /** Log index in the transaction */
47
+ logIndex: string;
48
+ /** Position debt after payment */
49
+ newDebt: string;
50
+ /** Position collateral ratio after payment (basis points) */
51
+ newCollateralRatio: string;
52
+ }
53
+ /**
54
+ * Status update event - tracks position status changes
55
+ */
56
+ export interface StatusUpdateEvent {
57
+ /** Unique event ID (transaction hash + log index) */
58
+ id: string;
59
+ /** Position ID */
60
+ positionId: string;
61
+ /** Previous status */
62
+ oldStatus: PositionStatus;
63
+ /** New status */
64
+ newStatus: PositionStatus;
65
+ /** Reason for status change (optional) */
66
+ reason?: string;
67
+ /** Block timestamp */
68
+ timestamp: string;
69
+ /** Block number */
70
+ blockNumber: string;
71
+ /** Transaction hash */
72
+ transactionHash: string;
73
+ }
74
+ /**
75
+ * Liquidation event - tracks position liquidations
76
+ */
77
+ export interface LiquidationEvent {
78
+ /** Unique event ID (transaction hash) */
79
+ id: string;
80
+ /** Position ID that was liquidated */
81
+ positionId: string;
82
+ /** Address of the liquidator */
83
+ liquidator: string;
84
+ /** Amount of debt liquidated (UCD wei) */
85
+ liquidatedAmount: string;
86
+ /** Amount of collateral seized (satoshis) */
87
+ collateralSeized: string;
88
+ /** Transaction hash */
89
+ transactionHash: string;
90
+ /** Block timestamp */
91
+ timestamp: string;
92
+ /** Block number */
93
+ blockNumber: string;
94
+ /** MEV protection: commit hash (if used) */
95
+ commitHash?: string;
96
+ /** MEV protection: commit timestamp (if used) */
97
+ commitTimestamp?: string;
98
+ /** MEV protection: reveal delay in seconds (if used) */
99
+ revealDelay?: string;
100
+ }
101
+ /**
102
+ * UCD mint event - tracks UCD minting for positions
103
+ */
104
+ export interface UCDMintEvent {
105
+ /** Unique event ID (transaction hash + log index) */
106
+ id: string;
107
+ /** Position ID */
108
+ positionId: string;
109
+ /** Amount of UCD minted (wei) */
110
+ amount: string;
111
+ /** Proof bytes (for verification) */
112
+ proof: string;
113
+ /** Address that performed the mint */
114
+ minter: string;
115
+ /** Whether this was a community mint */
116
+ isCommunityMint: boolean;
117
+ /** Block timestamp */
118
+ timestamp: string;
119
+ /** Block number */
120
+ blockNumber: string;
121
+ /** Transaction hash */
122
+ transactionHash: string;
123
+ }
124
+ /**
125
+ * Community fee distribution event
126
+ */
127
+ export interface FeeDistributionEvent {
128
+ /** Unique event ID (transaction hash + log index) */
129
+ id: string;
130
+ /** Position ID */
131
+ positionId: string;
132
+ /** Recipient address */
133
+ recipient: string;
134
+ /** Fee amount (UCD wei) */
135
+ amount: string;
136
+ /** Type of fee (e.g., "community", "extension") */
137
+ feeType: string;
138
+ /** Block timestamp */
139
+ timestamp: string;
140
+ /** Block number */
141
+ blockNumber: string;
142
+ /** Transaction hash */
143
+ transactionHash: string;
144
+ }
145
+ /**
146
+ * Aggregate container for all loan events
147
+ */
148
+ export interface LoanEvents {
149
+ /** Position ID these events belong to */
150
+ positionId: string;
151
+ /** All payment events */
152
+ payments: PaymentEvent[];
153
+ /** All status update events */
154
+ statusUpdates: StatusUpdateEvent[];
155
+ /** Liquidation event (if position was liquidated) */
156
+ liquidation?: LiquidationEvent;
157
+ /** All UCD mint events */
158
+ mints: UCDMintEvent[];
159
+ /** All community fee distribution events */
160
+ feeDistributions: FeeDistributionEvent[];
161
+ /** Total number of events */
162
+ totalEvents: number;
163
+ }
164
+ /**
165
+ * Options for filtering loan events
166
+ */
167
+ export interface LoanEventsFilter {
168
+ /** Filter by event types */
169
+ eventTypes?: Array<'payment' | 'status' | 'liquidation' | 'mint' | 'fee'>;
170
+ /** Filter by minimum timestamp */
171
+ fromTimestamp?: string;
172
+ /** Filter by maximum timestamp */
173
+ toTimestamp?: string;
174
+ /** Filter by minimum block number */
175
+ fromBlock?: string;
176
+ /** Filter by maximum block number */
177
+ toBlock?: string;
178
+ /** Limit number of events per type */
179
+ limit?: number;
180
+ /** Order direction */
181
+ orderDirection?: 'asc' | 'desc';
182
+ }
183
+ /**
184
+ * Type guard to check if status is valid
185
+ */
186
+ export declare function isValidPositionStatus(status: string): status is PositionStatus;
187
+ /**
188
+ * Type guard to check if payment type is valid
189
+ */
190
+ export declare function isValidPaymentType(type: string): type is PaymentType;
191
+ /**
192
+ * Convert numeric status to enum
193
+ */
194
+ export declare function numericToPositionStatus(status: number): PositionStatus;
195
+ /**
196
+ * Event helper functions
197
+ */
198
+ export declare const EventHelpers: {
199
+ /**
200
+ * Sort events by timestamp (descending by default)
201
+ */
202
+ sortByTimestamp<T extends {
203
+ timestamp: string;
204
+ }>(events: T[], direction?: "asc" | "desc"): T[];
205
+ /**
206
+ * Filter events by timestamp range
207
+ */
208
+ filterByTimestamp<T extends {
209
+ timestamp: string;
210
+ }>(events: T[], fromTimestamp?: string, toTimestamp?: string): T[];
211
+ /**
212
+ * Filter events by block range
213
+ */
214
+ filterByBlock<T extends {
215
+ blockNumber: string;
216
+ }>(events: T[], fromBlock?: string, toBlock?: string): T[];
217
+ /**
218
+ * Get total count of all events
219
+ */
220
+ getTotalCount(events: LoanEvents): number;
221
+ /**
222
+ * Merge and sort all events by timestamp
223
+ */
224
+ getAllEventsSorted(events: LoanEvents, direction?: "asc" | "desc"): Array<(PaymentEvent & {
225
+ eventType: "payment";
226
+ }) | (StatusUpdateEvent & {
227
+ eventType: "status";
228
+ }) | (LiquidationEvent & {
229
+ eventType: "liquidation";
230
+ }) | (UCDMintEvent & {
231
+ eventType: "mint";
232
+ }) | (FeeDistributionEvent & {
233
+ eventType: "fee";
234
+ })>;
235
+ };
@@ -0,0 +1,228 @@
1
+ /**
2
+ * Graph Data Transfer Objects (DTOs)
3
+ * Strictly typed interfaces for GraphQL responses to replace any types
4
+ */
5
+ export type BigIntString = string;
6
+ export type TimestampString = string;
7
+ export type AddressString = string;
8
+ export interface GraphPositionDTO {
9
+ id: string;
10
+ pkpId: string;
11
+ borrower: string;
12
+ createdAt: TimestampString;
13
+ lastUpdated: TimestampString;
14
+ vaultAddress: string;
15
+ ucdMinted?: BigIntString;
16
+ ucdPaid?: BigIntString;
17
+ ucdDebt: BigIntString;
18
+ selectedTerm: string;
19
+ status: string;
20
+ expiryAt: TimestampString;
21
+ createdAtBlock?: string;
22
+ lastUpdatedAt?: TimestampString;
23
+ loanTerm?: {
24
+ id: string;
25
+ months: string;
26
+ extensionFeeRate: string;
27
+ extensionFeeUCD: string;
28
+ totalExtensions: string;
29
+ createdAt: string;
30
+ };
31
+ extensionFeesPaid?: string;
32
+ totalExtensions?: string;
33
+ payments?: Array<{
34
+ id: string;
35
+ amount: number;
36
+ blockNumber: number;
37
+ newCollateralRatio: number;
38
+ newDebt: number;
39
+ payer: {
40
+ id: string;
41
+ };
42
+ createdAt: number;
43
+ transactionHash: string;
44
+ type: string;
45
+ }>;
46
+ totalPaid?: string;
47
+ liquidation?: {
48
+ id: string;
49
+ liquidatedAt: string;
50
+ liquidatedBy: string;
51
+ reason: string;
52
+ collateralRecovered: string;
53
+ debtRecovered: string;
54
+ liquidationFee: string;
55
+ blockNumber: number;
56
+ collateralSeized: string;
57
+ commitHash: string;
58
+ commitTimestamp: string;
59
+ liquidatedAmount: string;
60
+ liquidator: string;
61
+ revealDelay: string;
62
+ timestamp: string;
63
+ transactionHash: string;
64
+ };
65
+ }
66
+ export interface GraphBorrowerDTO {
67
+ id: string;
68
+ createdAt: TimestampString;
69
+ }
70
+ export interface GraphPositionWithBorrowerDTO extends Omit<GraphPositionDTO, 'borrower'> {
71
+ borrower: GraphBorrowerDTO;
72
+ }
73
+ export interface GraphUserDataDTO {
74
+ id: string;
75
+ positions: GraphPositionDTO[];
76
+ totalBorrowed: BigIntString;
77
+ totalRepaid: BigIntString;
78
+ activePositions: string;
79
+ firstInteractionTimestamp: TimestampString;
80
+ lastInteractionTimestamp: TimestampString;
81
+ }
82
+ export interface GraphLoanTermDTO {
83
+ id: string;
84
+ months: string;
85
+ mintFeeBps?: string;
86
+ extensionFeeBps?: string;
87
+ isValid?: boolean;
88
+ createdAt?: TimestampString;
89
+ createdAtBlock?: string;
90
+ }
91
+ export interface GraphPSMConfigurationDTO {
92
+ id: string;
93
+ version: string;
94
+ redeemEnabled: boolean;
95
+ totalSwapVolume: BigIntString;
96
+ totalRedeemVolume: BigIntString;
97
+ supportedStablecoinsCount: string;
98
+ lastUpdated: TimestampString;
99
+ }
100
+ export interface GraphSupportedStablecoinDTO {
101
+ id: string;
102
+ address: AddressString;
103
+ isSupported: boolean;
104
+ exchangeRate: BigIntString;
105
+ entryFee: BigIntString;
106
+ exitFee: BigIntString;
107
+ reserves: BigIntString;
108
+ totalSupply: BigIntString;
109
+ lastUpdated: TimestampString;
110
+ }
111
+ export interface GraphPSMDailyMetricsDTO {
112
+ id: string;
113
+ date: string;
114
+ totalSwapVolume: BigIntString;
115
+ totalRedeemVolume: BigIntString;
116
+ averageExchangeRate: BigIntString;
117
+ uniqueUsers: string;
118
+ transactionCount: string;
119
+ }
120
+ export interface GraphTokenDTO {
121
+ id: string;
122
+ address: AddressString;
123
+ name: string;
124
+ symbol: string;
125
+ decimals: string;
126
+ totalSupply: BigIntString;
127
+ createdAtTimestamp: TimestampString;
128
+ createdAtBlock: string;
129
+ }
130
+ export interface GraphAccountDTO {
131
+ id: string;
132
+ address: AddressString;
133
+ balance: BigIntString;
134
+ token: string;
135
+ createdAtTimestamp: TimestampString;
136
+ createdAtBlock: string;
137
+ }
138
+ export interface GraphMetaDTO {
139
+ block: {
140
+ number: string;
141
+ hash: string;
142
+ timestamp: string;
143
+ };
144
+ deployment: {
145
+ network: string;
146
+ chainId: string;
147
+ subgraphName: string;
148
+ version: string;
149
+ };
150
+ }
151
+ export interface GraphPaginationDTO {
152
+ first: number;
153
+ skip: number;
154
+ orderBy?: string;
155
+ orderDirection?: 'asc' | 'desc';
156
+ }
157
+ export interface GraphPaginatedResponseDTO<T> {
158
+ data: T[];
159
+ total: number;
160
+ page: number;
161
+ hasMore: boolean;
162
+ }
163
+ export interface GraphPositionsResponseDTO {
164
+ positions: GraphPositionWithBorrowerDTO[];
165
+ _meta: GraphMetaDTO;
166
+ }
167
+ export interface GraphUserPositionsResponseDTO {
168
+ positions: GraphPositionDTO[];
169
+ total: number;
170
+ }
171
+ export interface GraphPositionsByStatusResponseDTO {
172
+ positions: GraphPositionDTO[];
173
+ total: number;
174
+ }
175
+ export interface GraphPSMDailyMetricsResponseDTO {
176
+ psmDailyMetrics: GraphPSMDailyMetricsDTO[];
177
+ }
178
+ export interface GraphTokensResponseDTO {
179
+ tokens: GraphTokenDTO[];
180
+ }
181
+ export interface GraphTokenResponseDTO {
182
+ token: GraphTokenDTO;
183
+ }
184
+ export interface GraphAccountResponseDTO {
185
+ account: GraphAccountDTO;
186
+ }
187
+ export interface GraphAccountsResponseDTO {
188
+ accounts: GraphAccountDTO[];
189
+ }
190
+ export interface GraphPositionFilterDTO {
191
+ borrower?: string;
192
+ status?: string;
193
+ pkpId?: string;
194
+ createdAt_gte?: TimestampString;
195
+ createdAt_lte?: TimestampString;
196
+ }
197
+ export interface GraphAccountFilterDTO {
198
+ token?: string;
199
+ minBalance?: BigIntString;
200
+ address?: AddressString;
201
+ }
202
+ export interface GraphHealthCheckDTO {
203
+ _meta: GraphMetaDTO;
204
+ positionsCount: number;
205
+ lastIndexedBlock: string;
206
+ isHealthy: boolean;
207
+ }
208
+ export interface GraphErrorDTO {
209
+ message: string;
210
+ locations?: Array<{
211
+ line: number;
212
+ column: number;
213
+ }>;
214
+ path?: string[];
215
+ extensions?: {
216
+ code: string;
217
+ exception?: {
218
+ stacktrace: string[];
219
+ };
220
+ };
221
+ }
222
+ export interface GraphResponseDTO<T> {
223
+ data?: T;
224
+ errors?: GraphErrorDTO[];
225
+ extensions?: {
226
+ [key: string]: any;
227
+ };
228
+ }
@@ -0,0 +1,10 @@
1
+ export declare enum LoanStatus {
2
+ PENDING_DEPOSIT = 0,
3
+ PENDING_MINT = 1,
4
+ ACTIVE = 2,
5
+ EXPIRED = 3,
6
+ LIQUIDATABLE = 4,
7
+ LIQUIDATED = 5,
8
+ REPAID = 6,
9
+ CLOSED = 7
10
+ }