@gvnrdao/dh-sdk 0.0.287 → 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 +615 -1100
- package/dist/index.mjs +615 -1100
- 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,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Smart Contract Interaction Interfaces
|
|
3
|
-
*/
|
|
4
|
-
import type { TransactionReceipt } from "ethers";
|
|
5
|
-
/**
|
|
6
|
-
* Contract Call Options Interface
|
|
7
|
-
*/
|
|
8
|
-
export interface ContractCallOptions {
|
|
9
|
-
gasLimit?: number;
|
|
10
|
-
gasPrice?: string;
|
|
11
|
-
value?: string;
|
|
12
|
-
timeout?: number;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Contract Transaction Result Interface
|
|
16
|
-
*/
|
|
17
|
-
export interface ContractTransactionResult {
|
|
18
|
-
success: boolean;
|
|
19
|
-
error?: string;
|
|
20
|
-
transactionHash?: string;
|
|
21
|
-
receipt?: TransactionReceipt;
|
|
22
|
-
gasUsed?: string;
|
|
23
|
-
events?: any[];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Position Details Interface
|
|
27
|
-
*/
|
|
28
|
-
export interface PositionDetails {
|
|
29
|
-
positionId: string;
|
|
30
|
-
pkpId: string;
|
|
31
|
-
borrower: string;
|
|
32
|
-
ucdDebt: string;
|
|
33
|
-
createdAt: number;
|
|
34
|
-
lastUpdated: number;
|
|
35
|
-
collateralRatio: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Contract Query Options Interface
|
|
39
|
-
*/
|
|
40
|
-
export interface ContractQueryOptions {
|
|
41
|
-
blockTag?: number | "latest" | "pending";
|
|
42
|
-
contractAddress?: string;
|
|
43
|
-
abi?: string[];
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Event Filter Interface
|
|
47
|
-
*/
|
|
48
|
-
export interface EventFilter {
|
|
49
|
-
address?: string;
|
|
50
|
-
topics?: (string | string[])[];
|
|
51
|
-
fromBlock?: number | "latest";
|
|
52
|
-
toBlock?: number | "latest";
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Event Log Interface
|
|
56
|
-
*/
|
|
57
|
-
export interface EventLog {
|
|
58
|
-
address: string;
|
|
59
|
-
topics: string[];
|
|
60
|
-
data: string;
|
|
61
|
-
blockNumber: number;
|
|
62
|
-
transactionHash: string;
|
|
63
|
-
logIndex: number;
|
|
64
|
-
}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Smart Contract Type Interfaces
|
|
3
|
-
*
|
|
4
|
-
* These interfaces define the TypeScript types for smart contracts used in the SDK.
|
|
5
|
-
* They are independent definitions - NOT imported from the contracts package.
|
|
6
|
-
* Based on Solidity interfaces from contracts/src/interfaces/
|
|
7
|
-
*/
|
|
8
|
-
import type { BaseContract, ContractTransactionResponse } from "ethers";
|
|
9
|
-
/**
|
|
10
|
-
* Position Manager Contract Interface
|
|
11
|
-
* Based on contracts/src/interfaces/IPositionManager.sol
|
|
12
|
-
*/
|
|
13
|
-
export interface PositionManager extends BaseContract {
|
|
14
|
-
createPosition(pkpId: string, validatorSignature: string, mainnetVaultAddress: string, regtestVaultAddress: string, selectedTermMonths: number | bigint, validatorVersion: number | bigint, pkpPublicKey: string): Promise<ContractTransactionResponse>;
|
|
15
|
-
mintUCD(positionId: string, mintAmount: bigint, mintFee: bigint, newDebt: bigint, newCollateral: bigint, btcPrice: bigint, authorizedSpendsHash: string, ucdDebtHash: string, contractHash: string, quantumTimestamp: bigint, mintValidatorSignature: string): Promise<ContractTransactionResponse>;
|
|
16
|
-
liquidatePosition(positionId: string, btcPrice: bigint, quantumTimestamp: bigint, liquidationValidatorSignature: string): Promise<ContractTransactionResponse>;
|
|
17
|
-
getPosition(positionId: string): Promise<{
|
|
18
|
-
positionId: string;
|
|
19
|
-
pkpId: string;
|
|
20
|
-
ucdDebt: bigint;
|
|
21
|
-
borrower: string;
|
|
22
|
-
createdAt: number;
|
|
23
|
-
lastUpdated: number;
|
|
24
|
-
selectedTerm: number;
|
|
25
|
-
expiryAt: number;
|
|
26
|
-
status: number;
|
|
27
|
-
}>;
|
|
28
|
-
extendPosition(positionId: string, selectedTerm: bigint, quantumTimestamp: bigint, btcPrice: bigint, availableBTCBalance: bigint, proRataRenewalFee: bigint, extensionValidatorSignature: string): Promise<ContractTransactionResponse>;
|
|
29
|
-
commitLiquidation(positionId: string, quantumTimestamp: bigint, btcPrice: bigint, btcVaultBalance: bigint, liquidationValidatorSignature: string, overrides?: object): Promise<ContractTransactionResponse>;
|
|
30
|
-
revealAndLiquidate(positionId: string, quantumTimestamp: bigint, btcPrice: bigint, btcVaultBalance: bigint, liquidationValidatorSignature: string, deadline: bigint, overrides?: object): Promise<ContractTransactionResponse>;
|
|
31
|
-
makePayment(positionId: string, paymentAmount: bigint | string, quantumTimestamp: bigint | string, btcPrice: bigint | string, paymentValidatorSignature: string): Promise<ContractTransactionResponse>;
|
|
32
|
-
pkpValidationRegistry(): Promise<string>;
|
|
33
|
-
updateBalance(positionId: string, newBtcBalance: string | number | bigint, btcPrice: string | number | bigint, quantumTimestamp: string | number | bigint, signature: string): Promise<ContractTransactionResponse>;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Loan Operations Manager Contract Interface
|
|
37
|
-
* Based on contracts/src/interfaces/ILoanOperationsManager.sol
|
|
38
|
-
*/
|
|
39
|
-
export interface ILoanOperationsManager extends BaseContract {
|
|
40
|
-
mintUCD(positionId: string, mintAmount: bigint, mintFee: bigint, newDebt: bigint, newCollateral: bigint, btcPrice: bigint, authorizedSpendsHash: string, ucdDebtHash: string, quantumTimestamp: bigint): Promise<ContractTransactionResponse>;
|
|
41
|
-
processPayment(positionId: string, paymentAmount: bigint, quantumTimestamp: bigint, btcPrice: bigint): Promise<ContractTransactionResponse>;
|
|
42
|
-
updatePosition(positionId: string, newDebt: bigint, quantumTimestamp: bigint, btcPrice: bigint, updateValidatorSignature: string): Promise<ContractTransactionResponse>;
|
|
43
|
-
transferFee(recipient: string, amount: bigint): Promise<ContractTransactionResponse>;
|
|
44
|
-
mintExtensionFee(amount: bigint): Promise<ContractTransactionResponse>;
|
|
45
|
-
feeBalance(): Promise<bigint>;
|
|
46
|
-
setFeeRecipientRegistry(registry: string): Promise<ContractTransactionResponse>;
|
|
47
|
-
feeRecipientRegistry(): Promise<string>;
|
|
48
|
-
authorizeBTCSpend(positionId: string, txid: string, vout: number, satoshis: bigint, targetAddress: string, targetAmount: bigint, litSignature: string): Promise<ContractTransactionResponse>;
|
|
49
|
-
liquidationThreshold(): Promise<bigint>;
|
|
50
|
-
minimumLoanValueWei(): Promise<bigint>;
|
|
51
|
-
ucdToken(): Promise<string>;
|
|
52
|
-
getUcdController(): Promise<string>;
|
|
53
|
-
getPKPActualCollateral(pkpId: string): Promise<bigint>;
|
|
54
|
-
isPriceFeedStale(): Promise<boolean>;
|
|
55
|
-
calculateCollateralRatio(positionId: string, btcPrice: bigint): Promise<bigint>;
|
|
56
|
-
getTotalAuthorizedSats(positionId: string): Promise<bigint>;
|
|
57
|
-
extendPosition(positionId: string, newTermMonths: bigint, extensionFee: bigint, quantumTimestamp: bigint, btcPrice: bigint, extendValidatorSignature: string): Promise<ContractTransactionResponse>;
|
|
58
|
-
withdrawBTC(positionId: string, btcTxid: string, btcVout: number, satoshis: bigint, destinationAddress: string, quantumTimestamp: bigint, btcPrice: bigint, btcWithdrawalSignature: string): Promise<ContractTransactionResponse>;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* UCD Controller Contract Interface
|
|
62
|
-
* Based on contracts/src/interfaces/IUCDController.sol
|
|
63
|
-
*/
|
|
64
|
-
export interface IUCDController extends BaseContract {
|
|
65
|
-
mintFromLoanOps(to: string, amount: bigint, positionId: string, debtAfterMint: bigint): Promise<ContractTransactionResponse>;
|
|
66
|
-
mintFromPsm(to: string, amount: bigint, stablecoin: string, amountIn: bigint): Promise<ContractTransactionResponse>;
|
|
67
|
-
burnTokens(from: string, amount: bigint): Promise<ContractTransactionResponse>;
|
|
68
|
-
setAdminModule(_adminModule: string): Promise<ContractTransactionResponse>;
|
|
69
|
-
setAuthorizedMinter(minter: string, authorized: boolean): Promise<ContractTransactionResponse>;
|
|
70
|
-
setAuthorizedBurner(burner: string, authorized: boolean): Promise<ContractTransactionResponse>;
|
|
71
|
-
setMaxSupply(newMaxSupply: bigint): Promise<ContractTransactionResponse>;
|
|
72
|
-
setDailyMintLimit(newLimit: bigint): Promise<ContractTransactionResponse>;
|
|
73
|
-
setDailyBurnLimit(newLimit: bigint): Promise<ContractTransactionResponse>;
|
|
74
|
-
setUCDToken(newToken: string): Promise<ContractTransactionResponse>;
|
|
75
|
-
getCurrentSupply(): Promise<bigint>;
|
|
76
|
-
getRemainingMintCapacity(): Promise<bigint>;
|
|
77
|
-
getRemainingBurnCapacity(): Promise<bigint>;
|
|
78
|
-
getRemainingPsmMintCapacity(): Promise<bigint>;
|
|
79
|
-
isAuthorizedMinter(account: string): Promise<boolean>;
|
|
80
|
-
isAuthorizedBurner(account: string): Promise<boolean>;
|
|
81
|
-
authorizedMinters(account: string): Promise<boolean>;
|
|
82
|
-
authorizedBurners(account: string): Promise<boolean>;
|
|
83
|
-
burnedPerAddress(account: string): Promise<bigint>;
|
|
84
|
-
totalMinted(): Promise<bigint>;
|
|
85
|
-
totalBurned(): Promise<bigint>;
|
|
86
|
-
maxSupply(): Promise<bigint>;
|
|
87
|
-
dailyMintLimit(): Promise<bigint>;
|
|
88
|
-
dailyBurnLimit(): Promise<bigint>;
|
|
89
|
-
lastMintReset(): Promise<bigint>;
|
|
90
|
-
lastBurnReset(): Promise<bigint>;
|
|
91
|
-
dailyMinted(): Promise<bigint>;
|
|
92
|
-
dailyBurned(): Promise<bigint>;
|
|
93
|
-
dailyPsmMinted(): Promise<bigint>;
|
|
94
|
-
psmDailyMintLimit(): Promise<bigint>;
|
|
95
|
-
circuitBreaker(): Promise<string>;
|
|
96
|
-
ucdToken(): Promise<string>;
|
|
97
|
-
adminModule(): Promise<string>;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Price Feed Consumer Contract Interface
|
|
101
|
-
*/
|
|
102
|
-
export interface IPriceFeedConsumer extends BaseContract {
|
|
103
|
-
updatePrice(): Promise<ContractTransactionResponse>;
|
|
104
|
-
getCurrentPrice(): Promise<bigint>;
|
|
105
|
-
getPriceAge(): Promise<bigint>;
|
|
106
|
-
isPriceStale(): Promise<boolean>;
|
|
107
|
-
validatePriceFeed(): Promise<boolean>;
|
|
108
|
-
getLatestBTCPrice(): Promise<bigint>;
|
|
109
|
-
decimals(): Promise<number>;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Term Manager Contract Interface
|
|
113
|
-
* Based on contracts/src/interfaces/ITermManager.sol
|
|
114
|
-
*/
|
|
115
|
-
export interface ITermManager extends BaseContract {
|
|
116
|
-
addTerm(termMonths: bigint, originationFee: bigint, extensionFee: bigint): Promise<ContractTransactionResponse>;
|
|
117
|
-
removeTerm(termMonths: bigint): Promise<ContractTransactionResponse>;
|
|
118
|
-
updateTermFees(termMonths: bigint, originationFee: bigint, extensionFee: bigint): Promise<ContractTransactionResponse>;
|
|
119
|
-
getTermFees(termMonths: bigint): Promise<{
|
|
120
|
-
originationFee: bigint;
|
|
121
|
-
extensionFee: bigint;
|
|
122
|
-
}>;
|
|
123
|
-
isValidTerm(termMonths: bigint): Promise<boolean>;
|
|
124
|
-
getValidTermsWithFees(): Promise<{
|
|
125
|
-
terms: bigint[];
|
|
126
|
-
originationFees: bigint[];
|
|
127
|
-
extensionFees: bigint[];
|
|
128
|
-
}>;
|
|
129
|
-
getTermDataById(termId: bigint): Promise<{
|
|
130
|
-
termMonths: bigint;
|
|
131
|
-
originationFee: bigint;
|
|
132
|
-
extensionFee: bigint;
|
|
133
|
-
isActive: boolean;
|
|
134
|
-
}>;
|
|
135
|
-
getAllTerms(): Promise<bigint[]>;
|
|
136
|
-
updateDependencies(newCore: string, newUcdController: string): Promise<ContractTransactionResponse>;
|
|
137
|
-
supportsInterface(interfaceId: string): Promise<boolean>;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Circuit Breaker Module Contract Interface
|
|
141
|
-
* Based on contracts/src/interfaces/ICircuitBreakerModule.sol
|
|
142
|
-
*/
|
|
143
|
-
export interface CircuitBreakerModule extends BaseContract {
|
|
144
|
-
circuitBreakerCheck(ucdAmount: bigint, btcAmount: bigint): Promise<ContractTransactionResponse>;
|
|
145
|
-
proposeLimitUpdate(newMaxLoanValue: bigint, newMaxBtcPerPosition: bigint, newDailyLimit: bigint): Promise<ContractTransactionResponse>;
|
|
146
|
-
signLimitUpdate(proposalHash: string): Promise<ContractTransactionResponse>;
|
|
147
|
-
executeLimitUpdate(proposalHash: string, newMaxLoanValue: bigint, newMaxBtcPerPosition: bigint, newDailyLimit: bigint): Promise<ContractTransactionResponse>;
|
|
148
|
-
activateCircuitBreaker(): Promise<ContractTransactionResponse>;
|
|
149
|
-
deactivateCircuitBreaker(): Promise<ContractTransactionResponse>;
|
|
150
|
-
signCircuitBreakerDeactivation(): Promise<ContractTransactionResponse>;
|
|
151
|
-
maxSingleLoanValue(): Promise<bigint>;
|
|
152
|
-
maxBtcPerPosition(): Promise<bigint>;
|
|
153
|
-
dailyVolumeLimit(): Promise<bigint>;
|
|
154
|
-
circuitBreakerActive(): Promise<boolean>;
|
|
155
|
-
circuitBreakerActivatedAt(): Promise<bigint>;
|
|
156
|
-
dailyUcdVolume(day: bigint): Promise<bigint>;
|
|
157
|
-
dailyBtcVolume(day: bigint): Promise<bigint>;
|
|
158
|
-
supportsInterface(interfaceId: string): Promise<boolean>;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Liquidation Manager Contract Interface
|
|
162
|
-
* Based on contracts/src/interfaces/ILiquidationManager.sol
|
|
163
|
-
*/
|
|
164
|
-
export interface ILiquidationManager extends BaseContract {
|
|
165
|
-
liquidatePosition(positionId: string, btcPrice: bigint, quantumTimestamp: bigint): Promise<ContractTransactionResponse>;
|
|
166
|
-
commitLiquidation(positionId: string, quantumTimestamp: bigint, btcPrice: bigint): Promise<ContractTransactionResponse>;
|
|
167
|
-
revealAndLiquidate(positionId: string, quantumTimestamp: bigint, btcPrice: bigint, liquidationValidatorSignature: string, deadline: bigint): Promise<ContractTransactionResponse>;
|
|
168
|
-
isLiquidatable(positionId: string, btcPrice: bigint, quantumTimestamp: bigint, liquidationValidatorSignature: string): Promise<boolean>;
|
|
169
|
-
vrfSeeds(positionId: string): Promise<bigint>;
|
|
170
|
-
supportsInterface(interfaceId: string): Promise<boolean>;
|
|
171
|
-
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed responses for critical Diamond Hands LIT Actions.
|
|
3
|
-
*
|
|
4
|
-
* These mirror the JSON payloads passed to `Lit.Actions.setResponse(...)`
|
|
5
|
-
* in the lit-actions package and are intended to be used as the `TData`
|
|
6
|
-
* parameter on `LitActionResult<TData>`.
|
|
7
|
-
*/
|
|
8
|
-
import type { PositionId } from "../../types/branded/ids";
|
|
9
|
-
/**
|
|
10
|
-
* Base shape for approval-style validator responses.
|
|
11
|
-
*/
|
|
12
|
-
export interface BaseValidatorResponse {
|
|
13
|
-
approved: boolean;
|
|
14
|
-
positionId?: PositionId | string;
|
|
15
|
-
reason?: string;
|
|
16
|
-
failedStep?: string;
|
|
17
|
-
timestamp: number | string;
|
|
18
|
-
/**
|
|
19
|
-
* Optional low-level execution error from lit-ops / LIT runtime.
|
|
20
|
-
*/
|
|
21
|
-
error?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Some flows attach the raw signature JSON here (service wrappers).
|
|
24
|
-
*/
|
|
25
|
-
signature?: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* UCD Mint Validator response (ucdMintValidator).
|
|
29
|
-
* Source: lit-actions/src/ucd-mint-validator.ts
|
|
30
|
-
*/
|
|
31
|
-
export interface UcdMintValidatorResponse extends BaseValidatorResponse {
|
|
32
|
-
approved: true;
|
|
33
|
-
mintAmount: string;
|
|
34
|
-
mintFee: string;
|
|
35
|
-
newDebt: string;
|
|
36
|
-
newCollateral: string;
|
|
37
|
-
newCollateralRatioBps: number;
|
|
38
|
-
btcPrice: string;
|
|
39
|
-
authorizedSpendsHash: string;
|
|
40
|
-
ucdDebtHash: string;
|
|
41
|
-
contractBundleHash: string;
|
|
42
|
-
signature: string;
|
|
43
|
-
validatorPkp: string;
|
|
44
|
-
/**
|
|
45
|
-
* Optional: Exact parameter values used for signing.
|
|
46
|
-
* If present, SDK should use these values instead of response values
|
|
47
|
-
* to ensure contract receives identical parameters that were signed.
|
|
48
|
-
*/
|
|
49
|
-
signingParams?: {
|
|
50
|
-
positionId: string;
|
|
51
|
-
actionHash: string;
|
|
52
|
-
authorizedSpendsHash: string;
|
|
53
|
-
ucdDebtHash: string;
|
|
54
|
-
contractBundleHash: string;
|
|
55
|
-
btcPrice: string;
|
|
56
|
-
mintAmount: string;
|
|
57
|
-
mintFee: string;
|
|
58
|
-
newCollateral: string;
|
|
59
|
-
newDebt: string;
|
|
60
|
-
timestamp: string;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
export interface UcdMintValidatorErrorResponse extends BaseValidatorResponse {
|
|
64
|
-
approved: false;
|
|
65
|
-
}
|
|
66
|
-
export type UcdMintValidatorResult = UcdMintValidatorResponse | UcdMintValidatorErrorResponse;
|
|
67
|
-
/**
|
|
68
|
-
* BTC Withdrawal Validator response (btcWithdrawal).
|
|
69
|
-
* Source: lit-actions/src/btc-withdrawal.ts
|
|
70
|
-
*/
|
|
71
|
-
export interface BtcWithdrawalValidatorResponse extends BaseValidatorResponse {
|
|
72
|
-
approved: true;
|
|
73
|
-
actionHash: string;
|
|
74
|
-
authorizedSpendsHash: string;
|
|
75
|
-
ucdDebtHash: string;
|
|
76
|
-
totalDeduction: string;
|
|
77
|
-
remainingCollateral: string;
|
|
78
|
-
newCollateralRatioBps?: number;
|
|
79
|
-
destinationAddress: string;
|
|
80
|
-
signature: string;
|
|
81
|
-
btcPrice: string;
|
|
82
|
-
/**
|
|
83
|
-
* Optional UTXO fields used by enhanced BTC withdrawal flow.
|
|
84
|
-
* These are populated by the LIT Action when BIP-143 validation is enabled.
|
|
85
|
-
*/
|
|
86
|
-
utxoTxid?: string;
|
|
87
|
-
utxoVout?: number;
|
|
88
|
-
}
|
|
89
|
-
export interface BtcWithdrawalValidatorErrorResponse extends BaseValidatorResponse {
|
|
90
|
-
approved: false;
|
|
91
|
-
}
|
|
92
|
-
export type BtcWithdrawalValidatorResult = BtcWithdrawalValidatorResponse | BtcWithdrawalValidatorErrorResponse;
|
|
93
|
-
/**
|
|
94
|
-
* Liquidation Validator response (liquidationValidator).
|
|
95
|
-
* Source: lit-actions/src/liquidation-validator.ts
|
|
96
|
-
*/
|
|
97
|
-
export interface LiquidationValidatorResponse extends BaseValidatorResponse {
|
|
98
|
-
approved: true;
|
|
99
|
-
btcPrice: string;
|
|
100
|
-
btcAmountSats: string;
|
|
101
|
-
signature: string;
|
|
102
|
-
signatureBonus: string;
|
|
103
|
-
validatorPkp: string;
|
|
104
|
-
}
|
|
105
|
-
export interface LiquidationValidatorErrorResponse extends BaseValidatorResponse {
|
|
106
|
-
approved: false;
|
|
107
|
-
}
|
|
108
|
-
export type LiquidationValidatorResult = LiquidationValidatorResponse | LiquidationValidatorErrorResponse;
|
|
109
|
-
/**
|
|
110
|
-
* Extend Position Validator response (extendPositionValidator).
|
|
111
|
-
* Source: lit-actions/src/extend-position-validator.ts
|
|
112
|
-
*/
|
|
113
|
-
export interface ExtendPositionValidatorResponse extends BaseValidatorResponse {
|
|
114
|
-
approved: true;
|
|
115
|
-
selectedTerm: number;
|
|
116
|
-
btcPrice: string;
|
|
117
|
-
availableBTCBalance: string;
|
|
118
|
-
extensionFee: string;
|
|
119
|
-
newTotalDebt: string;
|
|
120
|
-
newCollateralRatioBps: string;
|
|
121
|
-
signature: string;
|
|
122
|
-
timestamp: number;
|
|
123
|
-
quantumTimestamp: number;
|
|
124
|
-
validatorPkp: string;
|
|
125
|
-
}
|
|
126
|
-
export interface ExtendPositionValidatorErrorResponse extends BaseValidatorResponse {
|
|
127
|
-
approved: false;
|
|
128
|
-
}
|
|
129
|
-
export type ExtendPositionValidatorResult = ExtendPositionValidatorResponse | ExtendPositionValidatorErrorResponse;
|
|
130
|
-
/**
|
|
131
|
-
* Process Payment Validator response (processPaymentValidator).
|
|
132
|
-
* Source: lit-actions/src/process-payment-validator.ts
|
|
133
|
-
*/
|
|
134
|
-
export interface ProcessPaymentValidatorResponse extends BaseValidatorResponse {
|
|
135
|
-
approved: true;
|
|
136
|
-
paymentAmount: string;
|
|
137
|
-
btcPrice: string;
|
|
138
|
-
btcAmountSats: string;
|
|
139
|
-
signature: string;
|
|
140
|
-
timestamp: number;
|
|
141
|
-
validatorPkp: string;
|
|
142
|
-
}
|
|
143
|
-
export interface ProcessPaymentValidatorErrorResponse extends BaseValidatorResponse {
|
|
144
|
-
approved: false;
|
|
145
|
-
}
|
|
146
|
-
export type ProcessPaymentValidatorResult = ProcessPaymentValidatorResponse | ProcessPaymentValidatorErrorResponse;
|
|
147
|
-
/**
|
|
148
|
-
* Loan vault BTC balance / deposit validator response (loanVaultBtcBalance).
|
|
149
|
-
* Source: lit-actions/src/loan-vault-btc-balance.ts
|
|
150
|
-
*/
|
|
151
|
-
export interface LoanVaultBtcBalanceValidatorResponse {
|
|
152
|
-
vaultAddress: string;
|
|
153
|
-
vaultBalance: string;
|
|
154
|
-
positionId: PositionId | string;
|
|
155
|
-
btcPrice: string;
|
|
156
|
-
signature: string;
|
|
157
|
-
timestamp: number;
|
|
158
|
-
validatorPkp: string;
|
|
159
|
-
}
|
|
160
|
-
export interface LoanVaultBtcBalanceValidatorErrorResponse {
|
|
161
|
-
error: string;
|
|
162
|
-
positionId: PositionId | string | null;
|
|
163
|
-
timestamp: number;
|
|
164
|
-
}
|
|
165
|
-
export type LoanVaultBtcBalanceValidatorResult = LoanVaultBtcBalanceValidatorResponse | LoanVaultBtcBalanceValidatorErrorResponse;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LIT Action Types and Interfaces (SDK boundary)
|
|
3
|
-
*
|
|
4
|
-
* This file provides the strongly-typed SDK view of LIT Actions and
|
|
5
|
-
* re-exports the action registry interfaces from the @gvnrdao/dh-lit-actions
|
|
6
|
-
* package so that action names and configs stay in sync across packages.
|
|
7
|
-
*/
|
|
8
|
-
import type { DiamondHandsLitActions, LitActionName } from "@gvnrdao/dh-lit-actions";
|
|
9
|
-
import type { UcdMintValidatorResult, BtcWithdrawalValidatorResult, LiquidationValidatorResult, ExtendPositionValidatorResult, ProcessPaymentValidatorResult, LoanVaultBtcBalanceValidatorResult } from "./lit-actions-results.i";
|
|
10
|
-
/**
|
|
11
|
-
* Re-export registry types so SDK consumers can use the same action name space.
|
|
12
|
-
*/
|
|
13
|
-
export type { DiamondHandsLitActions, LitActionName };
|
|
14
|
-
/**
|
|
15
|
-
* Core LIT Action execution description.
|
|
16
|
-
*
|
|
17
|
-
* TParams describes the jsParams structure, TAuth describes the authSig shape.
|
|
18
|
-
* Both default to safe, unknown-based records instead of `any`.
|
|
19
|
-
*/
|
|
20
|
-
export interface ILitAction<TParams extends Record<string, unknown> = Record<string, unknown>, TAuth = LitActionAuth> {
|
|
21
|
-
code: string;
|
|
22
|
-
ipfsId?: string;
|
|
23
|
-
jsParams: TParams;
|
|
24
|
-
authSig: TAuth;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Parameters passed to lit-node-client.executeJs.
|
|
28
|
-
*
|
|
29
|
-
* This mirrors ILitAction but is named for historic reasons.
|
|
30
|
-
*/
|
|
31
|
-
export interface LitActionParams<TParams extends Record<string, unknown> = Record<string, unknown>, TAuth = LitActionAuth> {
|
|
32
|
-
code: string;
|
|
33
|
-
jsParams: TParams;
|
|
34
|
-
authSig: TAuth;
|
|
35
|
-
debug?: boolean;
|
|
36
|
-
pkpId?: string;
|
|
37
|
-
userAddress?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Collateral amount used by some actions (e.g. mint flows).
|
|
40
|
-
* Replaces legacy btcAmount naming.
|
|
41
|
-
*/
|
|
42
|
-
collateralAmount?: string;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Raw result returned from LIT Action execution.
|
|
46
|
-
*
|
|
47
|
-
* Callers are encouraged to wrap this in action-specific result
|
|
48
|
-
* types instead of accessing the generic `data` bag directly.
|
|
49
|
-
*/
|
|
50
|
-
export interface LitActionResult<TData = unknown> {
|
|
51
|
-
success: boolean;
|
|
52
|
-
signedData?: unknown;
|
|
53
|
-
decryptedData?: unknown;
|
|
54
|
-
claimedKeyId?: string;
|
|
55
|
-
signatures?: unknown;
|
|
56
|
-
/**
|
|
57
|
-
* Alias for signatures used by some helpers.
|
|
58
|
-
*/
|
|
59
|
-
signature?: string;
|
|
60
|
-
decryptions?: unknown;
|
|
61
|
-
claims?: unknown;
|
|
62
|
-
response?: string;
|
|
63
|
-
logs?: string;
|
|
64
|
-
/**
|
|
65
|
-
* Action-specific payload. Prefer narrowing this via generics.
|
|
66
|
-
*/
|
|
67
|
-
data?: TData;
|
|
68
|
-
/**
|
|
69
|
-
* Human-readable error (if any).
|
|
70
|
-
*/
|
|
71
|
-
error?: string;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Discriminated union of typed results for the core Diamond Hands actions.
|
|
75
|
-
*
|
|
76
|
-
* This can be used by higher-level SDK helpers to express that a given
|
|
77
|
-
* execution is expected to return a particular validator payload.
|
|
78
|
-
*/
|
|
79
|
-
export type DiamondHandsLitActionResult = LitActionResult<UcdMintValidatorResult> | LitActionResult<BtcWithdrawalValidatorResult> | LitActionResult<LiquidationValidatorResult> | LitActionResult<ExtendPositionValidatorResult> | LitActionResult<ProcessPaymentValidatorResult> | LitActionResult<LoanVaultBtcBalanceValidatorResult>;
|
|
80
|
-
/**
|
|
81
|
-
* Standard EIP-191 style authorization signature used by LIT.
|
|
82
|
-
*/
|
|
83
|
-
export interface LitActionAuth {
|
|
84
|
-
sig: string;
|
|
85
|
-
derivedVia: string;
|
|
86
|
-
signedMessage: string;
|
|
87
|
-
address: string;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Generic validation result used by some helper actions.
|
|
91
|
-
*
|
|
92
|
-
* Callers should prefer action-specific result types where available.
|
|
93
|
-
*/
|
|
94
|
-
export interface LitActionValidationResult<TDetails = unknown> {
|
|
95
|
-
valid: boolean;
|
|
96
|
-
error?: string;
|
|
97
|
-
details?: TDetails;
|
|
98
|
-
}
|