@gvnrdao/dh-sdk 0.0.286 → 0.0.288
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/browser/dist/397.browser.js +2 -0
- package/browser/dist/397.browser.js.LICENSE.txt +1 -0
- package/browser/dist/833.browser.js +1 -1
- package/browser/dist/browser.js +1 -1
- package/browser/dist/browser.js.LICENSE.txt +10 -5
- package/dist/deployments.js +45 -21
- package/dist/deployments.mjs +45 -21
- package/dist/index.js +620 -1103
- package/dist/index.mjs +620 -1103
- package/package.json +1 -1
- package/dist/constants/chunks/contract-abis.d.ts +0 -20
- package/dist/constants/chunks/deployment-addresses.d.ts +0 -79
- package/dist/constants/chunks/encrypted-provider-params.d.ts +0 -21
- package/dist/constants/chunks/environment.browser.d.ts +0 -44
- package/dist/constants/chunks/environment.d.ts +0 -57
- package/dist/constants/chunks/network-configs.d.ts +0 -72
- package/dist/constants/chunks/sdk-config.d.ts +0 -33
- package/dist/constants/chunks/sdk-limits.d.ts +0 -66
- package/dist/constants/index.d.ts +0 -15
- package/dist/contracts/typechain-contracts/common.d.ts +0 -50
- package/dist/contracts/typechain-contracts/factories/src/psm/SimplePSMV2__factory.d.ts +0 -1996
- package/dist/contracts/typechain-contracts/src/psm/SimplePSMV2.d.ts +0 -1198
- package/dist/graphs/client.d.ts +0 -22
- package/dist/graphs/diamond-hands.d.ts +0 -259
- package/dist/index.d.ts +0 -56
- package/dist/interfaces/chunks/btc.i.d.ts +0 -36
- package/dist/interfaces/chunks/config.i.d.ts +0 -270
- package/dist/interfaces/chunks/contract-interactions.i.d.ts +0 -64
- package/dist/interfaces/chunks/contract-types.i.d.ts +0 -171
- package/dist/interfaces/chunks/lit-actions-results.i.d.ts +0 -165
- package/dist/interfaces/chunks/lit-actions.i.d.ts +0 -98
- package/dist/interfaces/chunks/loan-operations.i.d.ts +0 -331
- package/dist/interfaces/chunks/pkp-integration.i.d.ts +0 -87
- package/dist/interfaces/chunks/position-query.i.d.ts +0 -76
- package/dist/interfaces/chunks/requests.i.d.ts +0 -55
- package/dist/interfaces/chunks/ucd-minting.i.d.ts +0 -34
- package/dist/interfaces/chunks/utility.i.d.ts +0 -64
- package/dist/interfaces/index.d.ts +0 -17
- package/dist/modules/bitcoin/bitcoin-operations.module.d.ts +0 -254
- package/dist/modules/cache/cache-manager.module.d.ts +0 -259
- package/dist/modules/contract/contract-manager.module.d.ts +0 -152
- package/dist/modules/diamond-hands-sdk.d.ts +0 -969
- package/dist/modules/loan/loan-creator.module.d.ts +0 -132
- package/dist/modules/loan/loan-query.module.d.ts +0 -204
- package/dist/modules/mock/mock-token-manager.module.d.ts +0 -83
- package/dist/modules/pkp/pkp-manager.module.d.ts +0 -136
- package/dist/modules/withdrawal-address/withdrawal-address.module.d.ts +0 -78
- package/dist/protocol/protocol-pause.d.ts +0 -19
- package/dist/server.d.ts +0 -17
- package/dist/types/authorization-params.d.ts +0 -160
- package/dist/types/branded/domain-values.d.ts +0 -138
- package/dist/types/branded/ids.d.ts +0 -23
- package/dist/types/event-types.d.ts +0 -261
- package/dist/types/graph-dtos.d.ts +0 -228
- package/dist/types/loanStatus.d.ts +0 -10
- package/dist/types/protocol-event-types.d.ts +0 -99
- package/dist/types/result.d.ts +0 -120
- package/dist/utils/address-conversion.utils.d.ts +0 -51
- package/dist/utils/bitcoin-address-cache.utils.d.ts +0 -87
- package/dist/utils/bitcoin-provider.utils.d.ts +0 -84
- package/dist/utils/btc-withdrawal-message.d.ts +0 -60
- package/dist/utils/chunks/bitcoin-utils.d.ts +0 -85
- package/dist/utils/chunks/eip1559-broadcast.utils.d.ts +0 -33
- package/dist/utils/eip712-login.d.ts +0 -34
- package/dist/utils/error-handler.d.ts +0 -106
- package/dist/utils/ethers-interop.utils.d.ts +0 -146
- package/dist/utils/extend-authorization.utils.d.ts +0 -61
- package/dist/utils/lit-signature.utils.d.ts +0 -6
- package/dist/utils/logger.utils.d.ts +0 -142
- package/dist/utils/mint-authorization.utils.d.ts +0 -248
- package/dist/utils/position-delegate.utils.d.ts +0 -41
- package/dist/utils/quantum-timing.d.ts +0 -75
- package/dist/utils/server-session.d.ts +0 -50
- package/dist/utils/service-endpoint-policy.d.ts +0 -16
- package/dist/utils/signature-tempering.utils.d.ts +0 -34
- package/dist/utils/telegram-messaging.utils.d.ts +0 -188
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Loan Operations Interfaces
|
|
3
|
-
*/
|
|
4
|
-
import { LoanStatus } from "../../types/loanStatus";
|
|
5
|
-
export type BitcoinAddresses = {
|
|
6
|
-
mainnet: string;
|
|
7
|
-
testnet: string;
|
|
8
|
-
regtest: string;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Create Loan Request Interface
|
|
12
|
-
*/
|
|
13
|
-
export interface CreateLoanRequest {
|
|
14
|
-
selectedTerm: number;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* PKP Validation Data Interface
|
|
18
|
-
*/
|
|
19
|
-
export interface PKPValidationData {
|
|
20
|
-
tokenId: string;
|
|
21
|
-
publicKey: string;
|
|
22
|
-
ethAddress: string;
|
|
23
|
-
validationSignature: string;
|
|
24
|
-
btcAddresses: {
|
|
25
|
-
mainnet: string;
|
|
26
|
-
testnet: string;
|
|
27
|
-
regtest: string;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Create Loan Result Interface
|
|
32
|
-
*/
|
|
33
|
-
export interface CreateLoanResult {
|
|
34
|
-
success: boolean;
|
|
35
|
-
error?: string;
|
|
36
|
-
transactionHash?: string;
|
|
37
|
-
positionId?: string;
|
|
38
|
-
pkpData?: PKPValidationData;
|
|
39
|
-
vaultAddress?: string;
|
|
40
|
-
auditTrail?: {
|
|
41
|
-
pkpCreation: any;
|
|
42
|
-
validation: any;
|
|
43
|
-
contractCall: any;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Loan Data Interface (Graph/SDK simplified shape)
|
|
48
|
-
*/
|
|
49
|
-
export interface LoanData {
|
|
50
|
-
id: string;
|
|
51
|
-
pkpId: string;
|
|
52
|
-
borrower: {
|
|
53
|
-
createdAt: number;
|
|
54
|
-
id: string;
|
|
55
|
-
};
|
|
56
|
-
createdAt: number;
|
|
57
|
-
lastUpdatedAt: number;
|
|
58
|
-
loan: {
|
|
59
|
-
ucdMinted: number;
|
|
60
|
-
ucdPaid: number;
|
|
61
|
-
ucdDebt: number;
|
|
62
|
-
selectedTerm: number;
|
|
63
|
-
status: LoanStatus;
|
|
64
|
-
expiryAt: number;
|
|
65
|
-
};
|
|
66
|
-
collateral: {
|
|
67
|
-
vaultAddress: string | BitcoinAddresses;
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Paginated Loans Response Interface
|
|
72
|
-
* Used by loan query methods that support pagination
|
|
73
|
-
*/
|
|
74
|
-
export interface PaginatedLoansResponse {
|
|
75
|
-
loans: LoanData[];
|
|
76
|
-
page: number;
|
|
77
|
-
maxRows: number;
|
|
78
|
-
totalLoans: number;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Detailed Loan Data Interface (used by getLoanById / PKP)
|
|
82
|
-
*/
|
|
83
|
-
export interface LoanDataDetail {
|
|
84
|
-
id: string;
|
|
85
|
-
pkpId: string;
|
|
86
|
-
borrower: {
|
|
87
|
-
id: string;
|
|
88
|
-
createdAt: number;
|
|
89
|
-
};
|
|
90
|
-
createdAt: number;
|
|
91
|
-
createdAtBlock: number;
|
|
92
|
-
lastUpdatedAt: number;
|
|
93
|
-
lastUpdatedAtBlock: number;
|
|
94
|
-
expiryAt: number;
|
|
95
|
-
loan: {
|
|
96
|
-
ucdMinted: number;
|
|
97
|
-
ucdPaid: number;
|
|
98
|
-
ucdDebt: number;
|
|
99
|
-
status: LoanStatus;
|
|
100
|
-
expiryAt: number;
|
|
101
|
-
currentTerm: {
|
|
102
|
-
id: string;
|
|
103
|
-
createdAt: number;
|
|
104
|
-
selectedTerm: number;
|
|
105
|
-
extensionFeeRate: number;
|
|
106
|
-
extensionFeeUCD: number;
|
|
107
|
-
};
|
|
108
|
-
extensions: {
|
|
109
|
-
extendedAt: number;
|
|
110
|
-
expiredAt: number;
|
|
111
|
-
term: number;
|
|
112
|
-
extensionFeeRate: number;
|
|
113
|
-
extensionFeeUCD: number;
|
|
114
|
-
};
|
|
115
|
-
totalExtensions: number;
|
|
116
|
-
payments: Array<{
|
|
117
|
-
amount: number;
|
|
118
|
-
blockNumber: number;
|
|
119
|
-
id: string;
|
|
120
|
-
newCollateralRatio: number;
|
|
121
|
-
newDebt: number;
|
|
122
|
-
payer: {
|
|
123
|
-
id: string;
|
|
124
|
-
};
|
|
125
|
-
createdAt: number;
|
|
126
|
-
transactionHash: string;
|
|
127
|
-
type: string;
|
|
128
|
-
}>;
|
|
129
|
-
totalPayments: number;
|
|
130
|
-
totalPaid: number;
|
|
131
|
-
};
|
|
132
|
-
collateral: {
|
|
133
|
-
vaultAddress: string | BitcoinAddresses;
|
|
134
|
-
};
|
|
135
|
-
liquidation: {
|
|
136
|
-
blockNumber: number;
|
|
137
|
-
collateralSeized: number;
|
|
138
|
-
commitHash: string;
|
|
139
|
-
commitTimestamp: string;
|
|
140
|
-
id: string;
|
|
141
|
-
liquidatedAmount: number;
|
|
142
|
-
liquidator: string;
|
|
143
|
-
revealDelay: string;
|
|
144
|
-
timestamp: number;
|
|
145
|
-
transactionHash: string;
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Loans Query Interface
|
|
150
|
-
*/
|
|
151
|
-
export interface LoansQuery {
|
|
152
|
-
ownerWalletAddress?: string;
|
|
153
|
-
status?: LoanStatus;
|
|
154
|
-
expiryRange?: {
|
|
155
|
-
from: number;
|
|
156
|
-
to: number;
|
|
157
|
-
};
|
|
158
|
-
creationRange?: {
|
|
159
|
-
from: number;
|
|
160
|
-
to: number;
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* UCD Mint Request Interface
|
|
165
|
-
*/
|
|
166
|
-
export interface UCDMintRequest {
|
|
167
|
-
positionId: string;
|
|
168
|
-
amount: number;
|
|
169
|
-
selectedTerm?: number;
|
|
170
|
-
skipValidation?: boolean;
|
|
171
|
-
rpcUrl?: string;
|
|
172
|
-
testBtcPrice?: number;
|
|
173
|
-
debugOverrides?: {
|
|
174
|
-
useStubbedBtcData?: boolean;
|
|
175
|
-
stubbedBtcPriceUsd?: string;
|
|
176
|
-
stubbedAvailableBtcSats?: string;
|
|
177
|
-
stubbedAuthorizedSpendsHash?: string;
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* UCD Mint Result Interface
|
|
182
|
-
*/
|
|
183
|
-
export interface UCDMintResult {
|
|
184
|
-
success: boolean;
|
|
185
|
-
transactionHash?: string;
|
|
186
|
-
blockNumber?: number;
|
|
187
|
-
blockHash?: string;
|
|
188
|
-
gasUsed?: string;
|
|
189
|
-
effectiveGasPrice?: string;
|
|
190
|
-
positionId?: string;
|
|
191
|
-
amountMinted?: string;
|
|
192
|
-
amountMintedUCD?: number;
|
|
193
|
-
error?: string;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Renew Position Result Interface
|
|
197
|
-
*/
|
|
198
|
-
export interface RenewPositionResult {
|
|
199
|
-
success: boolean;
|
|
200
|
-
transactionHash?: string;
|
|
201
|
-
blockNumber?: number;
|
|
202
|
-
blockHash?: string;
|
|
203
|
-
gasUsed?: string;
|
|
204
|
-
effectiveGasPrice?: string;
|
|
205
|
-
positionId?: string;
|
|
206
|
-
extensionTerm?: number;
|
|
207
|
-
newExpiryAt?: number;
|
|
208
|
-
error?: string;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Renew Position Request Interface
|
|
212
|
-
*/
|
|
213
|
-
export interface RenewPositionRequest {
|
|
214
|
-
positionId: string;
|
|
215
|
-
selectedTerm: number;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* BTC Withdrawal Result Interface
|
|
219
|
-
*/
|
|
220
|
-
export interface BTCWithdrawalResult {
|
|
221
|
-
success: boolean;
|
|
222
|
-
evmTransactionHash?: string;
|
|
223
|
-
blockNumber?: number;
|
|
224
|
-
blockHash?: string;
|
|
225
|
-
gasUsed?: string;
|
|
226
|
-
effectiveGasPrice?: string;
|
|
227
|
-
positionId?: string;
|
|
228
|
-
withdrawalAddress?: string;
|
|
229
|
-
networkFee?: number;
|
|
230
|
-
amountWithdrawn?: string;
|
|
231
|
-
bitcoinTransactionHash?: string;
|
|
232
|
-
utxoTxid?: string;
|
|
233
|
-
utxoVout?: number;
|
|
234
|
-
/** Full satoshi value of the authorized UTXO; needed by Phase 2 broadcast. */
|
|
235
|
-
utxoSatoshis?: string;
|
|
236
|
-
error?: string;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Liquidation Request Interface
|
|
240
|
-
*/
|
|
241
|
-
export interface LiquidationRequest {
|
|
242
|
-
positionId: string;
|
|
243
|
-
forceContractCall?: boolean;
|
|
244
|
-
/**
|
|
245
|
-
* When true, the SDK will not send a UCD `approve(UCDController, …)` transaction.
|
|
246
|
-
* Use when the liquidator wallet has already approved UCDController (e.g. multisig flow).
|
|
247
|
-
* If allowance is insufficient, liquidation returns an error instead of approving.
|
|
248
|
-
*/
|
|
249
|
-
skipUcdApproval?: boolean;
|
|
250
|
-
rpcUrl?: string;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Liquidation Result Interface
|
|
254
|
-
*/
|
|
255
|
-
export interface LiquidationResult {
|
|
256
|
-
success: boolean;
|
|
257
|
-
error?: string;
|
|
258
|
-
transactionHash?: string;
|
|
259
|
-
blockNumber?: number;
|
|
260
|
-
positionId?: string;
|
|
261
|
-
debtAmount?: string;
|
|
262
|
-
collateralAmount?: string;
|
|
263
|
-
wasLiquidated?: boolean;
|
|
264
|
-
notLiquidatedReason?: string;
|
|
265
|
-
btcPrice?: string;
|
|
266
|
-
btcVaultBalance?: string;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Partial Payment Request Interface
|
|
270
|
-
*/
|
|
271
|
-
export interface PartialPaymentRequest {
|
|
272
|
-
positionId: string;
|
|
273
|
-
paymentAmount: number;
|
|
274
|
-
rpcUrl?: string;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Confirm Balance Result Interface
|
|
278
|
-
*/
|
|
279
|
-
export interface ConfirmBalanceResult {
|
|
280
|
-
success: boolean;
|
|
281
|
-
transactionHash?: string;
|
|
282
|
-
blockNumber?: number;
|
|
283
|
-
blockHash?: string;
|
|
284
|
-
gasUsed?: string;
|
|
285
|
-
effectiveGasPrice?: string;
|
|
286
|
-
positionId?: string;
|
|
287
|
-
confirmedBalance?: string;
|
|
288
|
-
btcPrice?: string;
|
|
289
|
-
newStatus?: LoanStatus;
|
|
290
|
-
error?: string;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Confirm Balance Request Interface
|
|
294
|
-
*/
|
|
295
|
-
export interface ConfirmBalanceRequest {
|
|
296
|
-
positionId: string;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Partial Payment Result Interface
|
|
300
|
-
*/
|
|
301
|
-
export interface PartialPaymentResult {
|
|
302
|
-
success: boolean;
|
|
303
|
-
transactionHash?: string;
|
|
304
|
-
blockNumber?: number;
|
|
305
|
-
blockHash?: string;
|
|
306
|
-
gasUsed?: string;
|
|
307
|
-
effectiveGasPrice?: string;
|
|
308
|
-
positionId?: string;
|
|
309
|
-
paymentAmountUCD?: number;
|
|
310
|
-
error?: string;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Term with Fees Interface
|
|
314
|
-
*/
|
|
315
|
-
export interface TermWithFees {
|
|
316
|
-
termMonths: number;
|
|
317
|
-
originationFeeBps: number;
|
|
318
|
-
extensionFeeBps: number;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Terms with Fees Result Interface
|
|
322
|
-
*/
|
|
323
|
-
export interface TermsWithFeesResult {
|
|
324
|
-
terms: TermWithFees[];
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Configuration for Loan Operations Manager
|
|
328
|
-
*/
|
|
329
|
-
export interface LoanManagerConfig {
|
|
330
|
-
debug?: boolean;
|
|
331
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PKP Integration Interfaces
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* PKP Manager Interface
|
|
6
|
-
*/
|
|
7
|
-
export interface IPKPManager {
|
|
8
|
-
issuePKP(request: PKPIssuanceRequest): Promise<PKPData>;
|
|
9
|
-
validatePKP(pkpId: string): Promise<PKPValidationResult>;
|
|
10
|
-
getPKPData(pkpId: string): Promise<PKPData | null>;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* PKP Data Interface
|
|
14
|
-
*/
|
|
15
|
-
export interface PKPData {
|
|
16
|
-
tokenId: string;
|
|
17
|
-
publicKey: string;
|
|
18
|
-
ethAddress: string;
|
|
19
|
-
litActionCid?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* PKP Issuance Request Interface
|
|
23
|
-
*/
|
|
24
|
-
export interface PKPIssuanceRequest {
|
|
25
|
-
userId: string;
|
|
26
|
-
metadata?: {
|
|
27
|
-
name?: string;
|
|
28
|
-
description?: string;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* PKP Creation Request Interface
|
|
33
|
-
*/
|
|
34
|
-
export interface PKPCreationRequest {
|
|
35
|
-
userId: string;
|
|
36
|
-
litActionCid: string;
|
|
37
|
-
metadata?: {
|
|
38
|
-
name?: string;
|
|
39
|
-
description?: string;
|
|
40
|
-
attributes?: Record<string, any>;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* PKP Creation Result Interface
|
|
45
|
-
*/
|
|
46
|
-
export interface PKPCreationResult {
|
|
47
|
-
success: boolean;
|
|
48
|
-
error?: string;
|
|
49
|
-
tokenId?: string;
|
|
50
|
-
publicKey?: string;
|
|
51
|
-
ethAddress?: string;
|
|
52
|
-
transactionHash?: string;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* PKP Validation Request Interface
|
|
56
|
-
*/
|
|
57
|
-
export interface PKPValidationRequest {
|
|
58
|
-
pkpId: string;
|
|
59
|
-
message: string;
|
|
60
|
-
signature: string;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* PKP Validation Result Interface
|
|
64
|
-
*/
|
|
65
|
-
export interface PKPValidationResult {
|
|
66
|
-
valid: boolean;
|
|
67
|
-
error?: string;
|
|
68
|
-
validatorAddress?: string;
|
|
69
|
-
signature?: string;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* PKP Signing Request Interface
|
|
73
|
-
*/
|
|
74
|
-
export interface PKPSigningRequest {
|
|
75
|
-
pkpId: string;
|
|
76
|
-
messageHash: string;
|
|
77
|
-
params?: Record<string, any>;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* PKP Signing Result Interface
|
|
81
|
-
*/
|
|
82
|
-
export interface PKPSigningResult {
|
|
83
|
-
success: boolean;
|
|
84
|
-
error?: string;
|
|
85
|
-
signature?: string;
|
|
86
|
-
publicKey?: string;
|
|
87
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Position Query Interfaces
|
|
3
|
-
*/
|
|
4
|
-
import { LoanStatus } from "../../types/loanStatus";
|
|
5
|
-
/**
|
|
6
|
-
* Position data structure (from contract)
|
|
7
|
-
*/
|
|
8
|
-
export interface Position {
|
|
9
|
-
positionId: string;
|
|
10
|
-
pkpId: string;
|
|
11
|
-
borrower: string;
|
|
12
|
-
vaultAddress: string;
|
|
13
|
-
vaultAddressRegtest?: string;
|
|
14
|
-
ucdDebt: bigint;
|
|
15
|
-
createdAt: number;
|
|
16
|
-
lastUpdated: number;
|
|
17
|
-
expiryAt: number;
|
|
18
|
-
status: LoanStatus;
|
|
19
|
-
collateralRatio?: number;
|
|
20
|
-
requestedCollateralRatio?: number;
|
|
21
|
-
selectedTerm: number;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Bitcoin UTXO (Unspent Transaction Output)
|
|
25
|
-
*/
|
|
26
|
-
export interface BitcoinUTXO {
|
|
27
|
-
txId: string;
|
|
28
|
-
vout: number;
|
|
29
|
-
value: number;
|
|
30
|
-
confirmations: number;
|
|
31
|
-
scriptPubKey?: string;
|
|
32
|
-
address?: string;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Position with Bitcoin status
|
|
36
|
-
*/
|
|
37
|
-
export interface PositionWithBTCStatus extends Position {
|
|
38
|
-
btcStatus: {
|
|
39
|
-
actualAmount: bigint;
|
|
40
|
-
confirmations: number;
|
|
41
|
-
utxos: BitcoinUTXO[];
|
|
42
|
-
lastCheckedAt: number;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Position query options
|
|
47
|
-
*/
|
|
48
|
-
export interface PositionQueryOptions {
|
|
49
|
-
borrower?: string;
|
|
50
|
-
status?: LoanStatus | LoanStatus[];
|
|
51
|
-
verifyBTC?: boolean;
|
|
52
|
-
offset?: number;
|
|
53
|
-
limit?: number;
|
|
54
|
-
sortBy?: 'createdAt' | 'lastUpdated' | 'ucdDebt';
|
|
55
|
-
sortDirection?: 'asc' | 'desc';
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Position query result
|
|
59
|
-
*/
|
|
60
|
-
export interface PositionQueryResult {
|
|
61
|
-
positions: Position[] | PositionWithBTCStatus[];
|
|
62
|
-
total: number;
|
|
63
|
-
hasMore: boolean;
|
|
64
|
-
executionTimeMs: number;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Bitcoin balance check result
|
|
68
|
-
*/
|
|
69
|
-
export interface BitcoinBalanceResult {
|
|
70
|
-
address: string;
|
|
71
|
-
balance: bigint;
|
|
72
|
-
utxos: BitcoinUTXO[];
|
|
73
|
-
confirmations: number;
|
|
74
|
-
provider: string;
|
|
75
|
-
timestamp: number;
|
|
76
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* General Request/Response Types and Interfaces
|
|
3
|
-
*/
|
|
4
|
-
import { AuthorizationParams } from '../../types/authorization-params';
|
|
5
|
-
/**
|
|
6
|
-
* Authorization request with type-safe parameters
|
|
7
|
-
*/
|
|
8
|
-
export interface AuthorizationRequest {
|
|
9
|
-
/** PKP token ID */
|
|
10
|
-
pkpId: string;
|
|
11
|
-
/** Action being authorized (derived from params.type) */
|
|
12
|
-
action: string;
|
|
13
|
-
/** Type-safe authorization parameters (discriminated union) */
|
|
14
|
-
params: AuthorizationParams;
|
|
15
|
-
/** Authorization signature */
|
|
16
|
-
signature: string;
|
|
17
|
-
/** Request timestamp */
|
|
18
|
-
timestamp: number;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Result of an authorization check
|
|
22
|
-
*/
|
|
23
|
-
export interface AuthorizationResult {
|
|
24
|
-
/** Whether the authorization was successful */
|
|
25
|
-
authorized: boolean;
|
|
26
|
-
/** PKP token ID that was checked */
|
|
27
|
-
pkpId: string;
|
|
28
|
-
/** Error message if authorization failed */
|
|
29
|
-
error?: string;
|
|
30
|
-
/** Additional details about the authorization (type-safe per action) */
|
|
31
|
-
details?: unknown;
|
|
32
|
-
}
|
|
33
|
-
export interface ValidationRequest {
|
|
34
|
-
data: any;
|
|
35
|
-
rules: string[];
|
|
36
|
-
context?: Record<string, any>;
|
|
37
|
-
}
|
|
38
|
-
export interface ConfirmationResult {
|
|
39
|
-
confirmed: boolean;
|
|
40
|
-
confirmations: number;
|
|
41
|
-
blockHeight?: number;
|
|
42
|
-
txHash?: string;
|
|
43
|
-
error?: string;
|
|
44
|
-
}
|
|
45
|
-
export interface BTCDepositRequest {
|
|
46
|
-
positionId: string;
|
|
47
|
-
}
|
|
48
|
-
export interface BTCDepositResult {
|
|
49
|
-
success: boolean;
|
|
50
|
-
positionId?: string;
|
|
51
|
-
vaultBalance?: string;
|
|
52
|
-
hasBalance?: boolean;
|
|
53
|
-
validationResponse?: any;
|
|
54
|
-
error?: string;
|
|
55
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UCD Minting Types and Interfaces
|
|
3
|
-
*/
|
|
4
|
-
export interface IUCDMinting {
|
|
5
|
-
mint(params: MintingParams): Promise<MintingResult>;
|
|
6
|
-
calculateRewards(amount: string): Promise<RewardDistribution>;
|
|
7
|
-
validateMinting(params: MintingParams): Promise<boolean>;
|
|
8
|
-
}
|
|
9
|
-
export interface MintingParams {
|
|
10
|
-
amount: string;
|
|
11
|
-
recipient: string;
|
|
12
|
-
collateralType: string;
|
|
13
|
-
collateralAmount: string;
|
|
14
|
-
oracleData?: any;
|
|
15
|
-
}
|
|
16
|
-
export interface MintingResult {
|
|
17
|
-
success: boolean;
|
|
18
|
-
txHash?: string;
|
|
19
|
-
mintedAmount?: string;
|
|
20
|
-
fees?: string;
|
|
21
|
-
rewards?: RewardDistribution;
|
|
22
|
-
error?: string;
|
|
23
|
-
}
|
|
24
|
-
export interface RewardDistribution {
|
|
25
|
-
totalRewards: string;
|
|
26
|
-
operatorReward: string;
|
|
27
|
-
protocolReward: string;
|
|
28
|
-
liquidityProviderReward: string;
|
|
29
|
-
distribution: {
|
|
30
|
-
operator: string;
|
|
31
|
-
protocol: string;
|
|
32
|
-
liquidityProvider: string;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility Type Interfaces
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Generic Result Interface
|
|
6
|
-
*/
|
|
7
|
-
export interface Result<T = any> {
|
|
8
|
-
success: boolean;
|
|
9
|
-
error?: string;
|
|
10
|
-
data?: T;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Pagination Interface
|
|
14
|
-
*/
|
|
15
|
-
export interface Pagination {
|
|
16
|
-
page: number;
|
|
17
|
-
limit: number;
|
|
18
|
-
total?: number;
|
|
19
|
-
hasNext?: boolean;
|
|
20
|
-
hasPrev?: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Paginated Result Interface
|
|
24
|
-
*/
|
|
25
|
-
export interface PaginatedResult<T = any> extends Result<T[]> {
|
|
26
|
-
pagination?: Pagination;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Audit Trail Interface
|
|
30
|
-
*/
|
|
31
|
-
export interface AuditTrail {
|
|
32
|
-
operation: string;
|
|
33
|
-
timestamp: number;
|
|
34
|
-
duration?: number;
|
|
35
|
-
success: boolean;
|
|
36
|
-
error?: string;
|
|
37
|
-
metadata?: Record<string, any>;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Debug Information Interface
|
|
41
|
-
*/
|
|
42
|
-
export interface DebugInfo {
|
|
43
|
-
logs: string[];
|
|
44
|
-
metrics?: {
|
|
45
|
-
startTime: number;
|
|
46
|
-
endTime: number;
|
|
47
|
-
duration: number;
|
|
48
|
-
};
|
|
49
|
-
networkCalls?: {
|
|
50
|
-
url: string;
|
|
51
|
-
method: string;
|
|
52
|
-
duration: number;
|
|
53
|
-
success: boolean;
|
|
54
|
-
}[];
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Retry Configuration Interface
|
|
58
|
-
*/
|
|
59
|
-
export interface RetryConfig {
|
|
60
|
-
maxAttempts: number;
|
|
61
|
-
delay: number;
|
|
62
|
-
backoffMultiplier?: number;
|
|
63
|
-
maxDelay?: number;
|
|
64
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Diamond Hands SDK Interfaces
|
|
3
|
-
* All TypeScript interfaces and types used in the SDK package
|
|
4
|
-
*
|
|
5
|
-
* Following the golden source pattern with organized chunks
|
|
6
|
-
*/
|
|
7
|
-
export * from "./chunks/config.i";
|
|
8
|
-
export * from "./chunks/contract-types.i";
|
|
9
|
-
export * from "./chunks/loan-operations.i";
|
|
10
|
-
export * from "./chunks/pkp-integration.i";
|
|
11
|
-
export * from "./chunks/contract-interactions.i";
|
|
12
|
-
export * from "./chunks/utility.i";
|
|
13
|
-
export * from "./chunks/btc.i";
|
|
14
|
-
export * from "./chunks/lit-actions.i";
|
|
15
|
-
export * from "./chunks/ucd-minting.i";
|
|
16
|
-
export * from "./chunks/requests.i";
|
|
17
|
-
export * from "./chunks/position-query.i";
|