@gvnrdao/dh-sdk 0.0.251 → 0.0.254
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/deployments.js +424 -0
- package/dist/deployments.mjs +390 -0
- package/dist/index.js +499 -397
- package/dist/index.mjs +499 -397
- package/dist/interfaces/chunks/config.i.d.ts +1 -0
- package/dist/modules/contract/contract-manager.module.d.ts +10 -0
- package/dist/modules/diamond-hands-sdk.d.ts +19 -0
- package/dist/modules/loan/loan-creator.module.d.ts +0 -11
- package/dist/modules/pkp/pkp-manager.module.d.ts +1 -1
- package/dist/utils/mint-authorization.utils.d.ts +3 -3
- package/package.json +7 -2
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { type Provider, type Signer } from "ethers";
|
|
14
14
|
import type { ContractAddresses } from "../../interfaces/chunks/config.i";
|
|
15
|
+
import { type DeploymentContracts } from "../../constants/chunks/deployment-addresses";
|
|
15
16
|
import { Result } from "../../types/result";
|
|
16
17
|
import { SDKError } from "../../utils/error-handler";
|
|
17
18
|
import type { PositionManager, ILoanOperationsManager, IUCDController, IPriceFeedConsumer, ITermManager, CircuitBreakerModule, ILiquidationManager } from "../../interfaces/chunks/contract-types.i";
|
|
@@ -41,6 +42,8 @@ export interface ContractManagerConfig {
|
|
|
41
42
|
mode?: "service" | "standalone";
|
|
42
43
|
/** Enable debug logging */
|
|
43
44
|
debug?: boolean;
|
|
45
|
+
/** Network name (e.g. "sepolia", "localhost") for deployment address lookup */
|
|
46
|
+
networkName?: string;
|
|
44
47
|
}
|
|
45
48
|
/**
|
|
46
49
|
* Managed contract instances with proper typing
|
|
@@ -121,6 +124,13 @@ export declare class ContractManager {
|
|
|
121
124
|
* Get contract addresses
|
|
122
125
|
*/
|
|
123
126
|
getContractAddresses(): ContractAddresses;
|
|
127
|
+
/**
|
|
128
|
+
* Get the full deployment map for the configured network.
|
|
129
|
+
* Returns all deployed contracts (including admin-surface ones not needed at runtime),
|
|
130
|
+
* keyed by PascalCase contract name matching the deployment JSON.
|
|
131
|
+
* Returns null if the network name is unknown.
|
|
132
|
+
*/
|
|
133
|
+
getDeploymentAddresses(): DeploymentContracts | null;
|
|
124
134
|
/**
|
|
125
135
|
* Get the network chain ID from the provider
|
|
126
136
|
*/
|
|
@@ -478,6 +478,25 @@ export declare class DiamondHandsSDK {
|
|
|
478
478
|
transactionHash?: string;
|
|
479
479
|
error?: string;
|
|
480
480
|
}>;
|
|
481
|
+
/**
|
|
482
|
+
* Mark an authorized spend as consumed after a verified Bitcoin broadcast.
|
|
483
|
+
*
|
|
484
|
+
* Calls LoanOperationsManager.markSpentByOwner which delegates to
|
|
485
|
+
* BTCSpendAuthorizer.markSpent. The on-chain position balance was already
|
|
486
|
+
* debited during Phase 1 (withdrawBTC) — this is bookkeeping so the entry
|
|
487
|
+
* stops appearing in getPendingWithdrawals().
|
|
488
|
+
*
|
|
489
|
+
* @param positionId - Position identifier
|
|
490
|
+
* @param txid - Source UTXO transaction ID (the one that was authorized in Phase 1)
|
|
491
|
+
* @param vout - Source UTXO output index
|
|
492
|
+
* @param broadcastTxid - Bitcoin txid of the broadcast that consumed this UTXO
|
|
493
|
+
* @returns Transaction hash of the mark-spent EVM transaction
|
|
494
|
+
*/
|
|
495
|
+
markSpentByOwner(positionId: string, txid: string, vout: number, broadcastTxid: string): Promise<{
|
|
496
|
+
success: boolean;
|
|
497
|
+
transactionHash?: string;
|
|
498
|
+
error?: string;
|
|
499
|
+
}>;
|
|
481
500
|
/**
|
|
482
501
|
* Withdraw BTC and execute transfer (Complete Flow)
|
|
483
502
|
*
|
|
@@ -52,17 +52,6 @@ export interface LoanCreatorConfig {
|
|
|
52
52
|
ethRpcUrl?: string;
|
|
53
53
|
/** Security testing: Temper signatures to test contract validation */
|
|
54
54
|
temperSignaturesTest?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Optional: Custom PKP creator.
|
|
57
|
-
* When provided, bypasses the default LitOps PKP flow and creates the PKP using
|
|
58
|
-
* this function.
|
|
59
|
-
*/
|
|
60
|
-
nagaLoanPkpCreator?: () => Promise<{
|
|
61
|
-
tokenId: string;
|
|
62
|
-
publicKey: string;
|
|
63
|
-
ethAddress: string;
|
|
64
|
-
validatorSignature: string;
|
|
65
|
-
}>;
|
|
66
55
|
}
|
|
67
56
|
/**
|
|
68
57
|
* Loan creation audit trail
|
|
@@ -23,7 +23,7 @@ import type { SDKMode } from "../../interfaces/chunks/config.i";
|
|
|
23
23
|
export interface PKPManagerConfig {
|
|
24
24
|
/** Operation mode: service (via lit-ops-server) or direct (LIT Protocol) */
|
|
25
25
|
mode: SDKMode;
|
|
26
|
-
/** LIT network (
|
|
26
|
+
/** LIT network (e.g. chipotle) */
|
|
27
27
|
litNetwork: string;
|
|
28
28
|
/** Service mode: endpoint for lit-ops-server */
|
|
29
29
|
serviceEndpoint?: string;
|
|
@@ -152,7 +152,7 @@ export interface ChipotleServiceFallback {
|
|
|
152
152
|
/**
|
|
153
153
|
* Get PKP public key from PKP token ID.
|
|
154
154
|
*
|
|
155
|
-
* For
|
|
155
|
+
* For legacy PKPs minted as NFTs on Chronicle Yellowstone: looks up
|
|
156
156
|
* via `getPubkey(tokenId)` on the supplied PKP NFT contract.
|
|
157
157
|
*
|
|
158
158
|
* For Chipotle PKPs (ABI-encoded ETH address): there is no on-chain lookup, so
|
|
@@ -161,8 +161,8 @@ export interface ChipotleServiceFallback {
|
|
|
161
161
|
* throws with a clear diagnostic.
|
|
162
162
|
*
|
|
163
163
|
* @param pkpTokenId - PKP token ID (bytes32 hex string)
|
|
164
|
-
* @param provider - Ethereum provider connected to the PKP NFT chain (
|
|
165
|
-
* @param pkpNftContractAddress - PKP NFT contract address on that chain (
|
|
164
|
+
* @param provider - Ethereum provider connected to the PKP NFT chain (legacy PKPs only)
|
|
165
|
+
* @param pkpNftContractAddress - PKP NFT contract address on that chain (legacy PKPs only)
|
|
166
166
|
* @param chipotleFallback - Service-mode fallback used when pkpTokenId is a Chipotle id
|
|
167
167
|
* @returns PKP public key as hex string with '0x' prefix
|
|
168
168
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gvnrdao/dh-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.254",
|
|
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/index.d.ts",
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
"types": "./dist/server.d.ts",
|
|
17
17
|
"import": "./dist/server.mjs",
|
|
18
18
|
"require": "./dist/server.js"
|
|
19
|
+
},
|
|
20
|
+
"./deployments": {
|
|
21
|
+
"types": "./dist/deployments.d.ts",
|
|
22
|
+
"import": "./dist/deployments.mjs",
|
|
23
|
+
"require": "./dist/deployments.js"
|
|
19
24
|
}
|
|
20
25
|
},
|
|
21
26
|
"files": [
|
|
@@ -71,7 +76,7 @@
|
|
|
71
76
|
"sideEffects": false,
|
|
72
77
|
"dependencies": {
|
|
73
78
|
"@gvnrdao/dh-lit-actions": "^0.0.295",
|
|
74
|
-
"@gvnrdao/dh-lit-ops": "^0.0.
|
|
79
|
+
"@gvnrdao/dh-lit-ops": "^0.0.280",
|
|
75
80
|
"@noble/hashes": "^1.5.0",
|
|
76
81
|
"axios": "^1.15.2",
|
|
77
82
|
"bech32": "^2.0.0",
|