@gvnrdao/dh-sdk 0.0.288 → 0.0.289

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 (76) hide show
  1. package/browser/dist/833.browser.js +1 -1
  2. package/browser/dist/browser.js +1 -1
  3. package/browser/dist/browser.js.LICENSE.txt +5 -10
  4. package/dist/constants/chunks/contract-abis.d.ts +20 -0
  5. package/dist/constants/chunks/deployment-addresses.d.ts +79 -0
  6. package/dist/constants/chunks/encrypted-provider-params.d.ts +21 -0
  7. package/dist/constants/chunks/environment.browser.d.ts +44 -0
  8. package/dist/constants/chunks/environment.d.ts +57 -0
  9. package/dist/constants/chunks/network-configs.d.ts +72 -0
  10. package/dist/constants/chunks/sdk-config.d.ts +33 -0
  11. package/dist/constants/chunks/sdk-limits.d.ts +66 -0
  12. package/dist/constants/index.d.ts +15 -0
  13. package/dist/contracts/typechain-contracts/common.d.ts +50 -0
  14. package/dist/contracts/typechain-contracts/factories/src/psm/SimplePSMV2__factory.d.ts +1996 -0
  15. package/dist/contracts/typechain-contracts/src/psm/SimplePSMV2.d.ts +1198 -0
  16. package/dist/deployments.js +21 -45
  17. package/dist/deployments.mjs +21 -45
  18. package/dist/graphs/client.d.ts +22 -0
  19. package/dist/graphs/diamond-hands.d.ts +259 -0
  20. package/dist/index.d.ts +56 -0
  21. package/dist/index.js +1123 -628
  22. package/dist/index.mjs +1123 -628
  23. package/dist/interfaces/chunks/btc.i.d.ts +36 -0
  24. package/dist/interfaces/chunks/config.i.d.ts +270 -0
  25. package/dist/interfaces/chunks/contract-interactions.i.d.ts +64 -0
  26. package/dist/interfaces/chunks/contract-types.i.d.ts +171 -0
  27. package/dist/interfaces/chunks/lit-actions-results.i.d.ts +165 -0
  28. package/dist/interfaces/chunks/lit-actions.i.d.ts +98 -0
  29. package/dist/interfaces/chunks/loan-operations.i.d.ts +331 -0
  30. package/dist/interfaces/chunks/pkp-integration.i.d.ts +87 -0
  31. package/dist/interfaces/chunks/position-query.i.d.ts +76 -0
  32. package/dist/interfaces/chunks/requests.i.d.ts +55 -0
  33. package/dist/interfaces/chunks/ucd-minting.i.d.ts +34 -0
  34. package/dist/interfaces/chunks/utility.i.d.ts +64 -0
  35. package/dist/interfaces/index.d.ts +17 -0
  36. package/dist/modules/bitcoin/bitcoin-operations.module.d.ts +254 -0
  37. package/dist/modules/cache/cache-manager.module.d.ts +259 -0
  38. package/dist/modules/contract/contract-manager.module.d.ts +152 -0
  39. package/dist/modules/diamond-hands-sdk.d.ts +969 -0
  40. package/dist/modules/loan/loan-creator.module.d.ts +132 -0
  41. package/dist/modules/loan/loan-query.module.d.ts +204 -0
  42. package/dist/modules/mock/mock-token-manager.module.d.ts +83 -0
  43. package/dist/modules/pkp/pkp-manager.module.d.ts +136 -0
  44. package/dist/modules/withdrawal-address/withdrawal-address.module.d.ts +78 -0
  45. package/dist/protocol/protocol-pause.d.ts +19 -0
  46. package/dist/server.d.ts +17 -0
  47. package/dist/types/authorization-params.d.ts +160 -0
  48. package/dist/types/branded/domain-values.d.ts +138 -0
  49. package/dist/types/branded/ids.d.ts +23 -0
  50. package/dist/types/event-types.d.ts +261 -0
  51. package/dist/types/graph-dtos.d.ts +228 -0
  52. package/dist/types/loanStatus.d.ts +10 -0
  53. package/dist/types/protocol-event-types.d.ts +99 -0
  54. package/dist/types/result.d.ts +120 -0
  55. package/dist/utils/address-conversion.utils.d.ts +51 -0
  56. package/dist/utils/bitcoin-address-cache.utils.d.ts +87 -0
  57. package/dist/utils/bitcoin-provider.utils.d.ts +84 -0
  58. package/dist/utils/btc-withdrawal-message.d.ts +60 -0
  59. package/dist/utils/chunks/bitcoin-utils.d.ts +85 -0
  60. package/dist/utils/chunks/eip1559-broadcast.utils.d.ts +33 -0
  61. package/dist/utils/eip712-login.d.ts +34 -0
  62. package/dist/utils/error-handler.d.ts +106 -0
  63. package/dist/utils/ethers-interop.utils.d.ts +146 -0
  64. package/dist/utils/extend-authorization.utils.d.ts +61 -0
  65. package/dist/utils/lit-signature.utils.d.ts +6 -0
  66. package/dist/utils/logger.utils.d.ts +142 -0
  67. package/dist/utils/mint-authorization.utils.d.ts +248 -0
  68. package/dist/utils/position-delegate.utils.d.ts +41 -0
  69. package/dist/utils/quantum-timing.d.ts +75 -0
  70. package/dist/utils/server-session.d.ts +50 -0
  71. package/dist/utils/service-endpoint-policy.d.ts +16 -0
  72. package/dist/utils/signature-tempering.utils.d.ts +34 -0
  73. package/dist/utils/telegram-messaging.utils.d.ts +188 -0
  74. package/package.json +1 -1
  75. package/browser/dist/397.browser.js +0 -2
  76. package/browser/dist/397.browser.js.LICENSE.txt +0 -1
@@ -5,19 +5,14 @@
5
5
  * @license MIT
6
6
  */
7
7
 
8
- /*! Axios v1.15.2 Copyright (c) 2026 Matt Zabriskie and contributors */
8
+ /*! Axios v1.18.1 Copyright (c) 2026 Matt Zabriskie and contributors */
9
+
10
+ /*! MIT License. Copyright 2015-2022 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
9
11
 
10
12
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
11
13
 
14
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
15
+
12
16
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
13
17
 
14
18
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
15
-
16
- /**
17
- * [js-sha3]{@link https://github.com/emn178/js-sha3}
18
- *
19
- * @version 0.8.0
20
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
21
- * @copyright Chen, Yi-Cyuan 2015-2018
22
- * @license MIT
23
- */
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Smart Contract ABIs (public SDK surface)
3
+ *
4
+ * Only ABIs that remain HAND-WRITTEN live here. Anything that drifts with
5
+ * frequent contract changes (PositionManager, SimplePSMV2, LiquidationManager,
6
+ * etc.) MUST be consumed via the typechain factories instead:
7
+ *
8
+ * import { PositionManager__factory } from "@gvnrdao/dh-sdk";
9
+ *
10
+ * H-A / H-B (2026-05-17 post-audit review):
11
+ * Removed `POSITION_MANAGER_ABI` and `PSM_ABI`. Both had drifted from the
12
+ * deployed contracts (`extendPosition` 6-vs-7 params; `setRenewalRestriction`
13
+ * 2-vs-1 args; stale `liquidatePosition`; etc.) and external consumers using
14
+ * these hand-written exports produced reverting calldata. Force typechain-only
15
+ * for these public surfaces. A CI drift check in `.github/workflows/
16
+ * contracts-pr-checks.yml` keeps `sdk/src/contracts/typechain-contracts/` in
17
+ * lockstep with `contracts/typechain-types/`.
18
+ */
19
+ export declare const UCD_TOKEN_ABI: readonly ["function balanceOf(address account) external view returns (uint256)", "function transfer(address to, uint256 amount) external returns (bool)", "function approve(address spender, uint256 amount) external returns (bool)", "function allowance(address owner, address spender) external view returns (uint256)", "function mint(address to, uint256 amount) external", "function burn(uint256 amount) external", "function burnFrom(address account, uint256 amount) external", "event Transfer(address indexed from, address indexed to, uint256 value)", "event Approval(address indexed owner, address indexed spender, uint256 value)"];
20
+ export declare const PRICE_FEED_CONSUMER_ABI: readonly ["function getCurrentPrice() external view returns (uint256)", "function isPriceStale() external view returns (bool)", "function updatePrice() external", "event PriceUpdated(uint256 indexed price, uint256 timestamp)"];
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Auto-generated deployment addresses
3
+ * Generated by scripts/sync-deployments.js
4
+ * Do not edit manually - this file is overwritten during build
5
+ */
6
+ export interface DeploymentLatestEnv {
7
+ [key: string]: string | number | undefined;
8
+ }
9
+ export interface DeploymentContracts {
10
+ PositionManagerProxy?: string;
11
+ PositionManager?: string;
12
+ PositionManagerCoreModule?: string;
13
+ PositionManagerViews?: string;
14
+ SimplePSMV2?: string;
15
+ LoanOperationsManagerModule?: string;
16
+ BTCSpendAuthorizer?: string;
17
+ TermManagerModule?: string;
18
+ CircuitBreakerModule?: string;
19
+ LiquidationManagerModule?: string;
20
+ CollateralManagerModule?: string;
21
+ AdminModule?: string;
22
+ UCDToken?: string;
23
+ UCDController?: string;
24
+ UCDMintingRewards?: string;
25
+ UpgradeValidator?: string;
26
+ BTCProofValidator?: string;
27
+ LITActionValidator?: string;
28
+ BitcoinProviderRegistry?: string;
29
+ ContractVersionRegistry?: string;
30
+ /** FeeRecipientRegistry — M-8 fix: allowlist of addresses authorised to receive protocol fee transfers from LoanOperationsManager.transferFee and SimplePSMV2.transferFee. */
31
+ FeeRecipientRegistry?: string;
32
+ /** PositionDelegateRegistry — stores per-position off-chain auth delegates (Safe-as-borrower flows). */
33
+ PositionDelegateRegistry?: string;
34
+ /** BitcoinWithdrawalAddressRegistry — per-wallet allowlist of approved BTC withdrawal destinations (24h time-lock). */
35
+ BitcoinWithdrawalAddressRegistry?: string;
36
+ PriceFeedConsumer?: string;
37
+ OperationAuthorizationRegistry?: string;
38
+ PKPValidation?: string;
39
+ EmergencyStorageUpdate?: string;
40
+ mockUsdcToken?: string;
41
+ mockUsdcOwner?: string;
42
+ mockUsdtToken?: string;
43
+ mockUsdtOwner?: string;
44
+ [key: string]: string | undefined;
45
+ }
46
+ export interface DeploymentData {
47
+ network: string;
48
+ chainId?: number;
49
+ timestamp: string;
50
+ deployer: string;
51
+ contracts: DeploymentContracts;
52
+ /** Flat assignments from contracts/deployments/full-{network}-latest.env (proxies, impls, validators, etc.) */
53
+ latestEnv?: DeploymentLatestEnv;
54
+ [key: string]: any;
55
+ }
56
+ export declare const SEPOLIA_DEPLOYMENT: DeploymentData;
57
+ export declare const SEPOLIA_CONTRACTS: DeploymentContracts;
58
+ export declare const MAINNET_DEPLOYMENT: DeploymentData;
59
+ export declare const MAINNET_CONTRACTS: DeploymentContracts;
60
+ export declare const LOCALHOST_DEPLOYMENT: DeploymentData;
61
+ export declare const LOCALHOST_CONTRACTS: DeploymentContracts;
62
+ export declare const ALL_DEPLOYMENTS: {
63
+ readonly sepolia: DeploymentData;
64
+ readonly mainnet: DeploymentData;
65
+ readonly localhost: DeploymentData;
66
+ };
67
+ export declare const ALL_CONTRACTS: {
68
+ readonly sepolia: DeploymentContracts;
69
+ readonly mainnet: DeploymentContracts;
70
+ readonly localhost: DeploymentContracts;
71
+ };
72
+ /**
73
+ * Get deployment data by network name
74
+ */
75
+ export declare function getDeploymentByNetwork(network: string): DeploymentData | null;
76
+ /**
77
+ * Get contract addresses by network name
78
+ */
79
+ export declare function getContractsByNetwork(network: string): DeploymentContracts | null;
@@ -0,0 +1,21 @@
1
+ export type EncryptedPriceProvider = {
2
+ name: string;
3
+ pkpId: string;
4
+ apiKey: string;
5
+ apiSecret?: string;
6
+ };
7
+ type RegistryProvider = {
8
+ name: string;
9
+ pkpId: string;
10
+ apiKeyEncrypted: string;
11
+ apiSecretEncrypted?: string;
12
+ version: number;
13
+ updatedAt: string;
14
+ };
15
+ type EncryptedParamsRegistry = {
16
+ network: string;
17
+ providers: RegistryProvider[];
18
+ };
19
+ export declare function loadEncryptedProviderRegistry(registryPath?: string): EncryptedParamsRegistry;
20
+ export declare function getEncryptedPriceProviders(providerNames?: string[], registryPath?: string): EncryptedPriceProvider[];
21
+ export {};
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Environment Configuration for Diamond Hands SDK - Browser Version
3
+ * Browser-compatible environment handling without Node.js dependencies
4
+ */
5
+ import { LitNetwork } from "@gvnrdao/dh-lit-ops";
6
+ /** SDK environment label — mirrors `LIT_NETWORK` for supported networks. */
7
+ export type EnvironmentName = "chipotle";
8
+ export interface SDKConfig {
9
+ environment: EnvironmentName;
10
+ litNetwork: LitNetwork;
11
+ realLitTesting: boolean;
12
+ debugMode: boolean;
13
+ runRealIntegrationTests: boolean;
14
+ litRelayUrl?: string;
15
+ ethRpcUrl: string;
16
+ polygonRpcUrl: string;
17
+ }
18
+ /**
19
+ * Resolved Lit network from `LIT_NETWORK` / `VITE_LIT_NETWORK` (default: production **chipotle**).
20
+ */
21
+ export declare function resolveLitNetworkFromEnv(): LitNetwork;
22
+ /**
23
+ * SDK environment label derived from `LIT_NETWORK` (default **chipotle**).
24
+ */
25
+ export declare function getCurrentEnvironment(): EnvironmentName;
26
+ /**
27
+ * Load and validate SDK configuration from environment
28
+ */
29
+ export declare function loadSDKConfig(): SDKConfig;
30
+ /**
31
+ * Get LIT Network configuration
32
+ */
33
+ export declare function getLitNetworkConfig(networkName: LitNetwork): LitNetwork;
34
+ /**
35
+ * Environment-aware console logging
36
+ */
37
+ export declare function envLog(message: string, ...args: any[]): void;
38
+ /**
39
+ * Validate SDK environment requirements
40
+ */
41
+ export declare function validateSDKEnvironment(requirements: {
42
+ requiresRealLitTesting?: boolean;
43
+ requiresPrivateKey?: boolean;
44
+ }): SDKConfig;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Environment Configuration for Diamond Hands SDK (Node only)
3
+ *
4
+ * Loads and validates environment variables with multi-path `.env` discovery.
5
+ * Used for server-side flows that may read `PKP_MINT_PRIVATE_KEY`.
6
+ *
7
+ * **Do not import this file from browser-oriented modules.** Import via
8
+ * `@gvnrdao/dh-sdk/server` only. Shared / client code should use `environment.browser`.
9
+ *
10
+ * **Observability:** With `DEBUG_SDK=true`, logs once which `.env` paths were attempted
11
+ * and which existing files were merged (later overrides earlier).
12
+ *
13
+ * **Strict merge checks:** Detecting conflicting definitions of the same variable across
14
+ * multiple `.env` files is not implemented; reserved for a future CI-gated workflow once
15
+ * the repo has automated SDK checks in CI.
16
+ */
17
+ import { LitNetwork } from "@gvnrdao/dh-lit-ops";
18
+ /** SDK environment label — mirrors `LIT_NETWORK` for supported networks. */
19
+ export type EnvironmentName = "chipotle";
20
+ export interface SDKConfig {
21
+ environment: EnvironmentName;
22
+ litNetwork: LitNetwork;
23
+ realLitTesting: boolean;
24
+ debugMode: boolean;
25
+ runRealIntegrationTests: boolean;
26
+ litRelayUrl?: string;
27
+ ethRpcUrl: string;
28
+ polygonRpcUrl: string;
29
+ pkpMintPrivateKey?: string;
30
+ }
31
+ /**
32
+ * Resolved Lit network from `LIT_NETWORK` (default: production **chipotle**).
33
+ */
34
+ export declare function resolveLitNetworkFromEnv(): LitNetwork;
35
+ /**
36
+ * SDK environment label derived from `LIT_NETWORK` (default **chipotle**).
37
+ */
38
+ export declare function getCurrentEnvironment(): EnvironmentName;
39
+ /**
40
+ * Load and validate SDK configuration from environment
41
+ */
42
+ export declare function loadSDKConfig(): SDKConfig;
43
+ /**
44
+ * Get LIT Network configuration
45
+ */
46
+ export declare function getLitNetworkConfig(networkName: LitNetwork): LitNetwork;
47
+ /**
48
+ * Environment-aware console logging
49
+ */
50
+ export declare function envLog(message: string, ...args: any[]): void;
51
+ /**
52
+ * Validate SDK environment requirements
53
+ */
54
+ export declare function validateSDKEnvironment(requirements: {
55
+ requiresRealLitTesting?: boolean;
56
+ requiresPrivateKey?: boolean;
57
+ }): SDKConfig;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Network Configuration Constants
3
+ * Automatically loads contract addresses from deployment files
4
+ * Browser-friendly implementation with silent fallbacks
5
+ */
6
+ /**
7
+ * Network Configuration Interface
8
+ */
9
+ export interface NetworkConfig {
10
+ mode: "service" | "standalone";
11
+ serviceEndpoint: string;
12
+ chainId: number;
13
+ name: string;
14
+ rpcUrls: string[];
15
+ contractAddresses: {
16
+ positionManager: string;
17
+ positionManagerCore?: string;
18
+ positionManagerViews?: string;
19
+ simplePsmV2?: string;
20
+ loanOperationsManager?: string;
21
+ termManager?: string;
22
+ circuitBreaker?: string;
23
+ liquidationManager?: string;
24
+ ucdToken: string;
25
+ ucdController?: string;
26
+ priceFeedConsumer: string;
27
+ operationAuthorizationRegistry?: string;
28
+ btcSpendAuthorizer?: string;
29
+ bitcoinProviderRegistry?: string;
30
+ contractVersionRegistry?: string;
31
+ /** FeeRecipientRegistry proxy; M-8 fix — allowlist consulted by LoanOperationsManager.transferFee and SimplePSMV2.transferFee. */
32
+ feeRecipientRegistry?: string;
33
+ /** PositionDelegateRegistry proxy; consumed by LIT Action authorization verifier as the third recovery arm for Safe-as-borrower flows. */
34
+ positionDelegateRegistry?: string;
35
+ /** BitcoinWithdrawalAddressRegistry proxy; per-wallet allowlist gating borrower-initiated BTC withdrawal destinations (24h time-lock). */
36
+ bitcoinWithdrawalAddressRegistry?: string;
37
+ mockUsdcToken?: string;
38
+ mockUsdtToken?: string;
39
+ mockUsdcOwner?: string;
40
+ };
41
+ subgraphs: {
42
+ diamondHandsUrl?: string;
43
+ tokenGvnrUrl?: string;
44
+ };
45
+ litNetwork: string;
46
+ validatorVersion?: number;
47
+ debug: boolean;
48
+ }
49
+ /**
50
+ * Network Configuration Registry
51
+ */
52
+ export declare const NETWORK_CONFIGS: Record<number, NetworkConfig>;
53
+ /**
54
+ * Get network configuration by chain ID
55
+ */
56
+ export declare function getNetworkConfig(chainId: number): NetworkConfig | null;
57
+ /**
58
+ * Get network configuration by human-readable name (e.g., "sepolia")
59
+ */
60
+ export declare function getNetworkConfigByName(name: string): NetworkConfig | null;
61
+ /**
62
+ * Get all supported network configurations
63
+ */
64
+ export declare function getAllNetworkConfigs(): NetworkConfig[];
65
+ /**
66
+ * Check if a network is supported
67
+ */
68
+ export declare function isNetworkSupported(chainId: number): boolean;
69
+ /**
70
+ * Default network fallbacks
71
+ */
72
+ export declare const DEFAULT_NETWORK_CONFIG: Partial<NetworkConfig>;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * SDK Configuration Constants
3
+ */
4
+ import type { LitNetwork } from "@gvnrdao/dh-lit-ops";
5
+ export declare const DEFAULT_NETWORKS: {
6
+ readonly ETHEREUM_MAINNET: "https://eth-mainnet.g.alchemy.com/v2/";
7
+ readonly ETHEREUM_SEPOLIA: "https://eth-sepolia.g.alchemy.com/v2/";
8
+ readonly POLYGON_MAINNET: "https://polygon-mainnet.g.alchemy.com/v2/";
9
+ readonly LOCAL_HARDHAT: "http://localhost:8545";
10
+ };
11
+ export declare const DEFAULT_LIT_NETWORKS: {
12
+ readonly CHIPOTLE: "chipotle";
13
+ };
14
+ /**
15
+ * Default Lit network when `LIT_NETWORK` is unset or config omits `litNetwork`.
16
+ */
17
+ export declare const DEFAULT_LIT_NETWORK: "chipotle";
18
+ /** Supported Lit Protocol networks for this SDK (Chipotle). */
19
+ export declare const VALID_LIT_NETWORKS: readonly LitNetwork[];
20
+ export declare const SDK_DEFAULTS: {
21
+ readonly SESSION_EXPIRATION_MINUTES: 60;
22
+ readonly TRANSACTION_TIMEOUT_MS: 30000;
23
+ readonly RETRY_ATTEMPTS: 3;
24
+ readonly DEBUG: false;
25
+ };
26
+ export declare const SDK_ERROR_MESSAGES: {
27
+ readonly NOT_INITIALIZED: "SDK not initialized. Call initialize() first.";
28
+ readonly INVALID_CONFIG: "Invalid SDK configuration provided.";
29
+ readonly NETWORK_ERROR: "Network connection error occurred.";
30
+ readonly TRANSACTION_FAILED: "Transaction failed to execute.";
31
+ readonly PKP_CREATION_FAILED: "PKP creation failed.";
32
+ readonly SIGNATURE_INVALID: "Invalid signature provided.";
33
+ };
@@ -0,0 +1,66 @@
1
+ /**
2
+ * SDK Limits and Configuration Constants
3
+ * Centralized constants for magic numbers used throughout the SDK
4
+ */
5
+ /**
6
+ * Maximum batch size for The Graph queries
7
+ * The Graph has a hard limit of 1000 items per query
8
+ */
9
+ export declare const THE_GRAPH_MAX_BATCH_SIZE = 1000;
10
+ /**
11
+ * Maximum rows per page for pagination
12
+ * Prevents excessive memory usage and query timeouts
13
+ */
14
+ export declare const MAX_PAGINATION_ROWS = 1000;
15
+ /**
16
+ * Default rows per page for pagination
17
+ */
18
+ export declare const DEFAULT_PAGINATION_ROWS = 10;
19
+ /**
20
+ * Default maximum number of retries for failed operations
21
+ */
22
+ export declare const DEFAULT_MAX_RETRIES = 3;
23
+ /**
24
+ * Default operation timeout in milliseconds
25
+ */
26
+ export declare const DEFAULT_OPERATION_TIMEOUT_MS = 30000;
27
+ /**
28
+ * Default PKP address cache size
29
+ */
30
+ export declare const DEFAULT_PKP_CACHE_SIZE = 500;
31
+ /**
32
+ * Default PKP address cache TTL in milliseconds
33
+ */
34
+ export declare const DEFAULT_PKP_CACHE_TTL_MS = 300000;
35
+ /**
36
+ * Default balance cache size
37
+ */
38
+ export declare const DEFAULT_BALANCE_CACHE_SIZE = 1000;
39
+ /**
40
+ * Default balance cache TTL in milliseconds
41
+ */
42
+ export declare const DEFAULT_BALANCE_CACHE_TTL_MS = 60000;
43
+ /**
44
+ * Default cache cleanup interval in milliseconds
45
+ */
46
+ export declare const DEFAULT_CACHE_CLEANUP_INTERVAL_MS = 300000;
47
+ /**
48
+ * Default number of blocks for PSM rate limit reset period
49
+ */
50
+ export declare const PSM_RATE_LIMIT_RESET_BLOCKS = 100;
51
+ /**
52
+ * Maximum operations per PSM rate limit window
53
+ */
54
+ export declare const PSM_MAX_OPERATIONS_PER_WINDOW = 10;
55
+ /**
56
+ * Default maximum concurrent operations
57
+ */
58
+ export declare const DEFAULT_CONCURRENCY_LIMIT = 10;
59
+ /**
60
+ * Default Bitcoin provider consensus mode
61
+ */
62
+ export declare const DEFAULT_BITCOIN_CONSENSUS_MODE: "majority";
63
+ /**
64
+ * Minimum number of Bitcoin providers for consensus
65
+ */
66
+ export declare const MIN_BITCOIN_PROVIDERS_FOR_CONSENSUS = 2;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Diamond Hands SDK Constants
3
+ * All constants used in the SDK package
4
+ *
5
+ * Following the golden source pattern with organized chunks
6
+ *
7
+ * **Environment:** This barrel exports **browser-safe** `environment.browser` only.
8
+ * For Node-only config including `PKP_MINT_PRIVATE_KEY` / dotenv paths, use
9
+ * `@gvnrdao/dh-sdk/server` (see `src/server.ts`).
10
+ */
11
+ export * from "./chunks/sdk-config";
12
+ export * from "./chunks/network-configs";
13
+ export * from "./chunks/environment.browser";
14
+ export * from "./chunks/contract-abis";
15
+ export * from "./chunks/sdk-limits";
@@ -0,0 +1,50 @@
1
+ import type { FunctionFragment, Typed, EventFragment, ContractTransaction, ContractTransactionResponse, DeferredTopicFilter, EventLog, TransactionRequest, LogDescription } from "ethers";
2
+ export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> extends DeferredTopicFilter {
3
+ }
4
+ export interface TypedContractEvent<InputTuple extends Array<any> = any, OutputTuple extends Array<any> = any, OutputObject = any> {
5
+ (...args: Partial<InputTuple>): TypedDeferredTopicFilter<TypedContractEvent<InputTuple, OutputTuple, OutputObject>>;
6
+ name: string;
7
+ fragment: EventFragment;
8
+ getFragment(...args: Partial<InputTuple>): EventFragment;
9
+ }
10
+ type __TypechainAOutputTuple<T> = T extends TypedContractEvent<infer _U, infer W> ? W : never;
11
+ type __TypechainOutputObject<T> = T extends TypedContractEvent<infer _U, infer _W, infer V> ? V : never;
12
+ export interface TypedEventLog<TCEvent extends TypedContractEvent> extends Omit<EventLog, "args"> {
13
+ args: __TypechainAOutputTuple<TCEvent> & __TypechainOutputObject<TCEvent>;
14
+ }
15
+ export interface TypedLogDescription<TCEvent extends TypedContractEvent> extends Omit<LogDescription, "args"> {
16
+ args: __TypechainAOutputTuple<TCEvent> & __TypechainOutputObject<TCEvent>;
17
+ }
18
+ export type TypedListener<TCEvent extends TypedContractEvent> = (...listenerArg: [
19
+ ...__TypechainAOutputTuple<TCEvent>,
20
+ TypedEventLog<TCEvent>,
21
+ ...undefined[]
22
+ ]) => void;
23
+ export type MinEthersFactory<C, ARGS> = {
24
+ deploy(...a: ARGS[]): Promise<C>;
25
+ };
26
+ export type GetContractTypeFromFactory<F> = F extends MinEthersFactory<infer C, any> ? C : never;
27
+ export type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any> ? Parameters<F["deploy"]> : never;
28
+ export type StateMutability = "nonpayable" | "payable" | "view";
29
+ export type BaseOverrides = Omit<TransactionRequest, "to" | "data">;
30
+ export type NonPayableOverrides = Omit<BaseOverrides, "value" | "blockTag" | "enableCcipRead">;
31
+ export type PayableOverrides = Omit<BaseOverrides, "blockTag" | "enableCcipRead">;
32
+ export type ViewOverrides = Omit<TransactionRequest, "to" | "data">;
33
+ export type Overrides<S extends StateMutability> = S extends "nonpayable" ? NonPayableOverrides : S extends "payable" ? PayableOverrides : ViewOverrides;
34
+ export type PostfixOverrides<A extends Array<any>, S extends StateMutability> = A | [...A, Overrides<S>];
35
+ export type ContractMethodArgs<A extends Array<any>, S extends StateMutability> = PostfixOverrides<{
36
+ [I in keyof A]-?: A[I] | Typed;
37
+ }, S>;
38
+ export type DefaultReturnType<R> = R extends Array<any> ? R[0] : R;
39
+ export interface TypedContractMethod<A extends Array<any> = Array<any>, R = any, S extends StateMutability = "payable"> {
40
+ (...args: ContractMethodArgs<A, S>): S extends "view" ? Promise<DefaultReturnType<R>> : Promise<ContractTransactionResponse>;
41
+ name: string;
42
+ fragment: FunctionFragment;
43
+ getFragment(...args: ContractMethodArgs<A, S>): FunctionFragment;
44
+ populateTransaction(...args: ContractMethodArgs<A, S>): Promise<ContractTransaction>;
45
+ staticCall(...args: ContractMethodArgs<A, "view">): Promise<DefaultReturnType<R>>;
46
+ send(...args: ContractMethodArgs<A, S>): Promise<ContractTransactionResponse>;
47
+ estimateGas(...args: ContractMethodArgs<A, S>): Promise<bigint>;
48
+ staticCallResult(...args: ContractMethodArgs<A, "view">): Promise<R>;
49
+ }
50
+ export {};