@gvnrdao/dh-sdk 0.0.217 → 0.0.219

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/index.js CHANGED
@@ -12685,504 +12685,93 @@ var require_elliptic = __commonJS({
12685
12685
  }
12686
12686
  });
12687
12687
 
12688
- // ../lit-actions/pkg-dist/pkg-src/index.js
12689
- var require_pkg_src = __commonJS({
12690
- "../lit-actions/pkg-dist/pkg-src/index.js"(exports, module2) {
12688
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/chunks/pkp-info.i.js
12689
+ var require_pkp_info_i = __commonJS({
12690
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/chunks/pkp-info.i.js"(exports) {
12691
12691
  "use strict";
12692
- var __defProp2 = Object.defineProperty;
12693
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
12694
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
12695
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
12696
- var __esm2 = (fn, res) => function __init() {
12697
- return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
12698
- };
12699
- var __export2 = (target, all) => {
12700
- for (var name in all)
12701
- __defProp2(target, name, { get: all[name], enumerable: true });
12702
- };
12703
- var __copyProps2 = (to, from, except, desc) => {
12704
- if (from && typeof from === "object" || typeof from === "function") {
12705
- for (let key2 of __getOwnPropNames2(from))
12706
- if (!__hasOwnProp2.call(to, key2) && key2 !== except)
12707
- __defProp2(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc2(from, key2)) || desc.enumerable });
12708
- }
12709
- return to;
12710
- };
12711
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
12712
- function configureDebugLogging(config) {
12713
- debugConfig = { ...debugConfig, ...config };
12714
- }
12715
- function getTimestamp() {
12716
- return (/* @__PURE__ */ new Date()).toISOString();
12717
- }
12718
- function formatMessage(level, component, message, metadata) {
12719
- const timestamp = debugConfig.enableTimestamps ? `[${getTimestamp()}] ` : "";
12720
- const metadataStr = metadata ? ` ${JSON.stringify(metadata)}` : "";
12721
- return `${timestamp}[${level}] [${component}] ${message}${metadataStr}`;
12722
- }
12723
- function debugError(component, message, metadata) {
12724
- if (debugConfig.level >= 0) {
12725
- console.error(formatMessage("ERROR", component, message, metadata));
12726
- }
12727
- }
12728
- function debugWarn(component, message, metadata) {
12729
- if (debugConfig.level >= 1) {
12730
- console.warn(formatMessage("WARN", component, message, metadata));
12731
- }
12732
- }
12733
- function debugInfo(component, message, metadata) {
12734
- if (debugConfig.level >= 2) {
12735
- console.log(formatMessage("INFO", component, message, metadata));
12736
- }
12737
- }
12738
- function debugLog(component, message, metadata) {
12739
- if (debugConfig.level >= 3) {
12740
- console.log(formatMessage("DEBUG", component, message, metadata));
12741
- }
12742
- }
12743
- function debugTrace(component, message, metadata) {
12744
- if (debugConfig.level >= 4) {
12745
- console.log(formatMessage("TRACE", component, message, metadata));
12746
- }
12747
- }
12748
- function logRequest(component, operation, params) {
12749
- if (!debugConfig.enableRequestLogging)
12750
- return;
12751
- debugLog(component, `\u{1F504} Request: ${operation}`, {
12752
- operation,
12753
- params: JSON.stringify(params, null, 2)
12754
- });
12755
- }
12756
- function logResponse(component, operation, response, duration) {
12757
- if (!debugConfig.enableRequestLogging)
12758
- return;
12759
- debugLog(component, `\u2705 Response: ${operation} (${duration}ms)`, {
12760
- operation,
12761
- duration,
12762
- response: typeof response === "object" ? JSON.stringify(response, null, 2) : response
12763
- });
12764
- }
12765
- function logError(component, operation, error, duration) {
12766
- const durationStr = duration ? ` (${duration}ms)` : "";
12767
- debugError(component, `\u274C Error: ${operation}${durationStr}`, {
12768
- operation,
12769
- duration,
12770
- error: error?.message || error?.toString() || "Unknown error",
12771
- stack: error?.stack
12772
- });
12773
- }
12774
- function logConnectionAttempt(network, attempt, maxAttempts) {
12775
- debugInfo("CONNECTION", `\u{1F517} Connecting to ${network} (attempt ${attempt}/${maxAttempts})`);
12776
- }
12777
- function logConnectionSuccess(network, latency) {
12778
- debugInfo("CONNECTION", `\u2705 Connected to ${network} (${latency}ms)`);
12779
- networkMetrics.recordRequest(`connection-${network}`, true, latency);
12780
- }
12781
- function logConnectionFailure(network, error, attempt) {
12782
- debugError("CONNECTION", `\u274C Connection failed to ${network} (attempt ${attempt})`, { error });
12783
- networkMetrics.recordRequest(`connection-${network}`, false, 0, error);
12784
- }
12785
- function logPkpOperation(operation, pkpId, details) {
12786
- const pkpStr = pkpId ? ` (PKP: ${pkpId.slice(0, 8)}...)` : "";
12787
- debugInfo("PKP", `\u{1F511} ${operation}${pkpStr}`, details);
12788
- }
12789
- function logSessionSignatures(count, expiration) {
12790
- debugInfo("SESSION", `\u{1F510} Generated ${count} session signatures (expires: ${expiration})`);
12791
- }
12792
- function logLitActionExecution(cid, params) {
12793
- debugInfo("LIT_ACTION", `\u26A1 Executing LIT Action: ${cid}`, {
12794
- cid,
12795
- params
12796
- });
12797
- }
12798
- function logLitActionResult(cid, success2, duration, result) {
12799
- const status = success2 ? "\u2705" : "\u274C";
12800
- debugInfo("LIT_ACTION", `${status} LIT Action completed: ${cid} (${duration}ms)`, {
12801
- cid,
12802
- success: success2,
12803
- duration,
12804
- result: success2 && result ? JSON.stringify(result, null, 2) : void 0
12805
- });
12806
- }
12807
- function logTestStart(testName) {
12808
- debugInfo("TEST", `\u{1F9EA} Starting test: ${testName}`);
12809
- return new PerformanceTracker(testName);
12810
- }
12811
- function logTestEnd(testName, success2, duration) {
12812
- const status = success2 ? "\u2705" : "\u274C";
12813
- debugInfo("TEST", `${status} Test completed: ${testName} (${duration}ms)`);
12814
- networkMetrics.printSummary();
12815
- }
12816
- var LogLevel2;
12817
- var DEFAULT_DEBUG_CONFIG;
12818
- var debugConfig;
12819
- var PerformanceTracker;
12820
- var NetworkMetricsCollector;
12821
- var networkMetrics;
12822
- var init_debug_logger = __esm2({
12823
- "pkg-src/utils/chunks/debug-logger.ts"() {
12824
- "use strict";
12825
- LogLevel2 = /* @__PURE__ */ ((LogLevel22) => {
12826
- LogLevel22[LogLevel22["ERROR"] = 0] = "ERROR";
12827
- LogLevel22[LogLevel22["WARN"] = 1] = "WARN";
12828
- LogLevel22[LogLevel22["INFO"] = 2] = "INFO";
12829
- LogLevel22[LogLevel22["DEBUG"] = 3] = "DEBUG";
12830
- LogLevel22[LogLevel22["TRACE"] = 4] = "TRACE";
12831
- return LogLevel22;
12832
- })(LogLevel2 || {});
12833
- DEFAULT_DEBUG_CONFIG = {
12834
- level: 2,
12835
- enableTimestamps: true,
12836
- enablePerformanceMetrics: true,
12837
- enableRequestLogging: true,
12838
- enableNetworkMetrics: true
12839
- };
12840
- debugConfig = { ...DEFAULT_DEBUG_CONFIG };
12841
- PerformanceTracker = class {
12842
- constructor(operationName) {
12843
- this.operationName = operationName;
12844
- this.markers = /* @__PURE__ */ new Map();
12845
- this.startTime = Date.now();
12846
- this.log("PERF", `Started: ${operationName}`);
12847
- }
12848
- mark(label) {
12849
- const elapsed = Date.now() - this.startTime;
12850
- this.markers.set(label, elapsed);
12851
- this.log("PERF", `${this.operationName} - ${label}: ${elapsed}ms`);
12852
- }
12853
- end(success2 = true) {
12854
- const totalTime = Date.now() - this.startTime;
12855
- const status = success2 ? "SUCCESS" : "FAILED";
12856
- this.log("PERF", `${this.operationName} - ${status}: ${totalTime}ms`);
12857
- if (debugConfig.enablePerformanceMetrics && this.markers.size > 0) {
12858
- console.log(`\u{1F4CA} Performance Breakdown for ${this.operationName}:`);
12859
- for (const [label, time] of this.markers) {
12860
- console.log(` ${label}: ${time}ms`);
12861
- }
12862
- console.log(` Total: ${totalTime}ms`);
12863
- }
12864
- return totalTime;
12865
- }
12866
- log(level, message) {
12867
- if (debugConfig.enablePerformanceMetrics) {
12868
- console.log(formatMessage(level, "PERFORMANCE", message));
12869
- }
12870
- }
12871
- };
12872
- NetworkMetricsCollector = class {
12873
- constructor() {
12874
- this.metrics = /* @__PURE__ */ new Map();
12875
- }
12876
- getMetrics(operation) {
12877
- if (!this.metrics.has(operation)) {
12878
- this.metrics.set(operation, {
12879
- requestCount: 0,
12880
- successCount: 0,
12881
- failureCount: 0,
12882
- averageLatency: 0,
12883
- startTime: Date.now()
12884
- });
12885
- }
12886
- return this.metrics.get(operation);
12887
- }
12888
- recordRequest(operation, success2, latency, error) {
12889
- const metrics = this.getMetrics(operation);
12890
- metrics.requestCount++;
12891
- if (success2) {
12892
- metrics.successCount++;
12893
- metrics.averageLatency = (metrics.averageLatency * (metrics.successCount - 1) + latency) / metrics.successCount;
12894
- } else {
12895
- metrics.failureCount++;
12896
- if (error)
12897
- metrics.lastError = error;
12898
- }
12899
- if (debugConfig.enableNetworkMetrics) {
12900
- const successRate = (metrics.successCount / metrics.requestCount * 100).toFixed(1);
12901
- debugLog("NETWORK", `${operation} - Success: ${success2}, Latency: ${latency}ms, Success Rate: ${successRate}%`);
12902
- }
12903
- }
12904
- printSummary() {
12905
- if (!debugConfig.enableNetworkMetrics)
12906
- return;
12907
- console.log("\n\u{1F4C8} Network Metrics Summary:");
12908
- for (const [operation, metrics] of this.metrics) {
12909
- const successRate = (metrics.successCount / metrics.requestCount * 100).toFixed(1);
12910
- const runtime = Date.now() - metrics.startTime;
12911
- console.log(` ${operation}:`);
12912
- console.log(` Requests: ${metrics.requestCount}`);
12913
- console.log(` Success Rate: ${successRate}%`);
12914
- console.log(` Avg Latency: ${metrics.averageLatency.toFixed(0)}ms`);
12915
- console.log(` Runtime: ${runtime}ms`);
12916
- if (metrics.lastError) {
12917
- console.log(` Last Error: ${metrics.lastError}`);
12918
- }
12919
- }
12920
- }
12921
- };
12922
- networkMetrics = new NetworkMetricsCollector();
12923
- }
12924
- });
12925
- var session_signature_cache_exports = {};
12926
- __export2(session_signature_cache_exports, {
12927
- DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
12928
- clearSessionSignatureCache: () => clearSessionSignatureCache,
12929
- configureSessionSignatureCache: () => configureSessionSignatureCache,
12930
- generateSessionSignaturesWithCache: () => generateSessionSignaturesWithCache,
12931
- getSessionSignatureCacheStats: () => getSessionSignatureCacheStats,
12932
- sessionSignatureCache: () => sessionSignatureCache
12933
- });
12934
- async function generateSessionSignaturesWithCache(litNodeClient, sessionConfig, pkpTokenId, litActionCid, signerAddress, network = "chipotle") {
12935
- const cached = sessionSignatureCache.get(pkpTokenId, litActionCid, signerAddress, network);
12936
- if (cached) {
12937
- return cached;
12938
- }
12939
- debugInfo("CACHE", "\u{1F510} Generating new session signatures (cache miss)...");
12940
- const sessionSigs = await litNodeClient.getSessionSigs(sessionConfig);
12941
- const expiration = new Date(sessionConfig.expiration);
12942
- sessionSignatureCache.set(pkpTokenId, litActionCid, signerAddress, network, sessionSigs, expiration);
12943
- const sigCount = Object.keys(sessionSigs).length;
12944
- debugInfo("CACHE", `\u2705 Generated and cached ${sigCount} session signatures`);
12945
- return sessionSigs;
12946
- }
12947
- function configureSessionSignatureCache(config) {
12948
- Object.assign(sessionSignatureCache["config"], config);
12949
- }
12950
- function clearSessionSignatureCache() {
12951
- sessionSignatureCache.clear();
12952
- }
12953
- function getSessionSignatureCacheStats() {
12954
- return sessionSignatureCache.getStats();
12955
- }
12956
- var DEFAULT_CACHE_CONFIG;
12957
- var SessionSignatureCache;
12958
- var sessionSignatureCache;
12959
- var init_session_signature_cache = __esm2({
12960
- "pkg-src/utils/chunks/session-signature-cache.ts"() {
12961
- "use strict";
12962
- init_debug_logger();
12963
- DEFAULT_CACHE_CONFIG = {
12964
- maxEntries: 50,
12965
- bufferTimeMs: 6e4,
12966
- // 1 minute buffer before expiration
12967
- enableLogging: true
12968
- };
12969
- SessionSignatureCache = class {
12970
- constructor(config = {}) {
12971
- this.cache = /* @__PURE__ */ new Map();
12972
- this.config = { ...DEFAULT_CACHE_CONFIG, ...config };
12973
- }
12974
- /**
12975
- * Generate cache key from PKP and context
12976
- */
12977
- generateCacheKey(pkpTokenId, litActionCid, signerAddress, network) {
12978
- return `${signerAddress}-${network}-${pkpTokenId}-${litActionCid}`;
12979
- }
12980
- /**
12981
- * Check if cache entry is still valid
12982
- */
12983
- isEntryValid(entry) {
12984
- const now2 = /* @__PURE__ */ new Date();
12985
- const expirationWithBuffer = new Date(
12986
- entry.expiration.getTime() - this.config.bufferTimeMs
12987
- );
12988
- return now2 < expirationWithBuffer;
12989
- }
12990
- /**
12991
- * Clean expired entries from cache
12992
- */
12993
- cleanExpiredEntries() {
12994
- const now2 = /* @__PURE__ */ new Date();
12995
- let cleanedCount = 0;
12996
- for (const [key2, entry] of this.cache.entries()) {
12997
- if (now2 >= entry.expiration) {
12998
- this.cache.delete(key2);
12999
- cleanedCount++;
13000
- }
13001
- }
13002
- if (cleanedCount > 0 && this.config.enableLogging) {
13003
- debugInfo("CACHE", `\u{1F9F9} Cleaned ${cleanedCount} expired session signature entries`);
13004
- }
13005
- }
13006
- /**
13007
- * Enforce cache size limits
13008
- */
13009
- enforceCacheSize() {
13010
- if (this.cache.size <= this.config.maxEntries) {
13011
- return;
13012
- }
13013
- const entries = Array.from(this.cache.entries()).sort(([, a], [, b]) => a.createdAt.getTime() - b.createdAt.getTime());
13014
- const toRemove = entries.slice(0, this.cache.size - this.config.maxEntries);
13015
- for (const [key2] of toRemove) {
13016
- this.cache.delete(key2);
13017
- }
13018
- if (this.config.enableLogging) {
13019
- debugInfo("CACHE", `\u{1F4E6} Removed ${toRemove.length} oldest cache entries to maintain size limit`);
13020
- }
13021
- }
13022
- /**
13023
- * Get cached session signatures if valid
13024
- */
13025
- get(pkpTokenId, litActionCid, signerAddress, network) {
13026
- this.cleanExpiredEntries();
13027
- const cacheKey = this.generateCacheKey(pkpTokenId, litActionCid, signerAddress, network);
13028
- const entry = this.cache.get(cacheKey);
13029
- if (!entry) {
13030
- if (this.config.enableLogging) {
13031
- debugLog("CACHE", `\u274C Session signatures cache miss: ${cacheKey}`);
13032
- }
13033
- return null;
13034
- }
13035
- if (!this.isEntryValid(entry)) {
13036
- this.cache.delete(cacheKey);
13037
- if (this.config.enableLogging) {
13038
- debugWarn("CACHE", `\u23F0 Session signatures expired: ${cacheKey}`);
13039
- }
13040
- return null;
13041
- }
13042
- if (this.config.enableLogging) {
13043
- const timeUntilExpiry = entry.expiration.getTime() - Date.now();
13044
- debugInfo("CACHE", `\u2705 Session signatures cache hit: ${cacheKey} (expires in ${Math.round(timeUntilExpiry / 1e3)}s)`);
13045
- }
13046
- return entry.sessionSigs;
13047
- }
13048
- /**
13049
- * Cache session signatures
13050
- */
13051
- set(pkpTokenId, litActionCid, signerAddress, network, sessionSigs, expiration) {
13052
- const cacheKey = this.generateCacheKey(pkpTokenId, litActionCid, signerAddress, network);
13053
- const entry = {
13054
- sessionSigs,
13055
- expiration,
13056
- pkpTokenId,
13057
- litActionCid,
13058
- signerAddress,
13059
- network,
13060
- createdAt: /* @__PURE__ */ new Date()
13061
- };
13062
- this.cache.set(cacheKey, entry);
13063
- if (this.config.enableLogging) {
13064
- const timeUntilExpiry = expiration.getTime() - Date.now();
13065
- debugInfo("CACHE", `\u{1F4BE} Cached session signatures: ${cacheKey} (expires in ${Math.round(timeUntilExpiry / 1e3)}s)`);
13066
- }
13067
- this.enforceCacheSize();
13068
- }
13069
- /**
13070
- * Clear all cached session signatures
13071
- */
13072
- clear() {
13073
- const size = this.cache.size;
13074
- this.cache.clear();
13075
- if (this.config.enableLogging) {
13076
- debugInfo("CACHE", `\u{1F5D1}\uFE0F Cleared ${size} cached session signature entries`);
13077
- }
13078
- }
13079
- /**
13080
- * Get cache statistics
13081
- */
13082
- getStats() {
13083
- this.cleanExpiredEntries();
13084
- return {
13085
- size: this.cache.size,
13086
- maxEntries: this.config.maxEntries,
13087
- utilizationPercent: Math.round(this.cache.size / this.config.maxEntries * 100)
13088
- };
13089
- }
13090
- /**
13091
- * Remove specific cache entry
13092
- */
13093
- delete(pkpTokenId, litActionCid, signerAddress, network) {
13094
- const cacheKey = this.generateCacheKey(pkpTokenId, litActionCid, signerAddress, network);
13095
- const deleted = this.cache.delete(cacheKey);
13096
- if (deleted && this.config.enableLogging) {
13097
- debugInfo("CACHE", `\u{1F5D1}\uFE0F Removed session signatures from cache: ${cacheKey}`);
13098
- }
13099
- return deleted;
13100
- }
13101
- };
13102
- sessionSignatureCache = new SessionSignatureCache();
13103
- }
13104
- });
13105
- var index_exports = {};
13106
- __export2(index_exports, {
13107
- CHIPOTLE_DEPLOYMENTS: () => CHIPOTLE_DEPLOYMENTS,
13108
- DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
13109
- DEFAULT_DEBUG_CONFIG: () => DEFAULT_DEBUG_CONFIG,
13110
- DEFAULT_RETRY_CONFIG: () => DEFAULT_RETRY_CONFIG,
13111
- DH_LIT_ACTIONS_CHIPOTLE: () => DH_LIT_ACTIONS_CHIPOTLE3,
13112
- ErrorCategory: () => ErrorCategory2,
13113
- LogLevel: () => LogLevel2,
13114
- NETWORK_TIMEOUTS: () => NETWORK_TIMEOUTS,
13115
- PerformanceTracker: () => PerformanceTracker,
13116
- RetryStrategy: () => RetryStrategy,
13117
- analyzeError: () => analyzeError,
13118
- calculateDelay: () => calculateDelay,
13119
- cidToHex: () => cidToHex,
13120
- classifyError: () => classifyError,
13121
- clearSessionSignatureCache: () => clearSessionSignatureCache,
13122
- configureDebugLogging: () => configureDebugLogging,
13123
- configureSessionSignatureCache: () => configureSessionSignatureCache,
13124
- connectLitContracts: () => connectLitContracts,
13125
- connectLitNodeClient: () => connectLitNodeClient,
13126
- createErrorReport: () => createErrorReport,
13127
- debugError: () => debugError,
13128
- debugInfo: () => debugInfo,
13129
- debugLog: () => debugLog,
13130
- debugTrace: () => debugTrace,
13131
- debugWarn: () => debugWarn,
13132
- executeLitAction: () => executeLitAction,
13133
- executePkpOperation: () => executePkpOperation,
13134
- generateSessionSignatures: () => generateSessionSignatures,
13135
- generateSessionSignaturesWithCache: () => generateSessionSignaturesWithCache,
13136
- getDeployedActions: () => getDeployedActions,
13137
- getDeploymentsForNetwork: () => getDeploymentsForNetwork,
13138
- getLitActionCID: () => getLitActionCID,
13139
- getLitActionConfig: () => getLitActionConfig,
13140
- getNetworkTimeouts: () => getNetworkTimeouts,
13141
- getPKPValidatorSetup: () => getPKPValidatorSetup,
13142
- getRetryConfigFromClassification: () => getRetryConfigFromClassification,
13143
- getSessionSignatureCacheStats: () => getSessionSignatureCacheStats,
13144
- isLitActionDeployed: () => isLitActionDeployed,
13145
- isRetryableError: () => isRetryableError,
13146
- litProtocolErrors: () => litProtocolErrors,
13147
- logConnectionAttempt: () => logConnectionAttempt,
13148
- logConnectionFailure: () => logConnectionFailure,
13149
- logConnectionSuccess: () => logConnectionSuccess,
13150
- logError: () => logError,
13151
- logLitActionExecution: () => logLitActionExecution,
13152
- logLitActionResult: () => logLitActionResult,
13153
- logPkpOperation: () => logPkpOperation,
13154
- logRequest: () => logRequest,
13155
- logResponse: () => logResponse,
13156
- logSessionSignatures: () => logSessionSignatures,
13157
- logTestEnd: () => logTestEnd,
13158
- logTestStart: () => logTestStart,
13159
- networkMetrics: () => networkMetrics,
13160
- sessionSignatureCache: () => sessionSignatureCache,
13161
- sleep: () => sleep,
13162
- validateDeployedActions: () => validateDeployedActions,
13163
- validateLitNodeConnection: () => validateLitNodeConnection,
13164
- validateLitNodeReadiness: () => validateLitNodeReadiness,
13165
- withRetry: () => withRetry
12692
+ Object.defineProperty(exports, "__esModule", { value: true });
12693
+ }
12694
+ });
12695
+
12696
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/chunks/lit-action-config.i.js
12697
+ var require_lit_action_config_i = __commonJS({
12698
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/chunks/lit-action-config.i.js"(exports) {
12699
+ "use strict";
12700
+ Object.defineProperty(exports, "__esModule", { value: true });
12701
+ }
12702
+ });
12703
+
12704
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/chunks/diamond-hands-lit-actions.i.js
12705
+ var require_diamond_hands_lit_actions_i = __commonJS({
12706
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/chunks/diamond-hands-lit-actions.i.js"(exports) {
12707
+ "use strict";
12708
+ Object.defineProperty(exports, "__esModule", { value: true });
12709
+ }
12710
+ });
12711
+
12712
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/chunks/lit-action-registry.i.js
12713
+ var require_lit_action_registry_i = __commonJS({
12714
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/chunks/lit-action-registry.i.js"(exports) {
12715
+ "use strict";
12716
+ Object.defineProperty(exports, "__esModule", { value: true });
12717
+ }
12718
+ });
12719
+
12720
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/index.js
12721
+ var require_interfaces = __commonJS({
12722
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/index.js"(exports) {
12723
+ "use strict";
12724
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
12725
+ if (k2 === void 0)
12726
+ k2 = k;
12727
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12728
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12729
+ desc = { enumerable: true, get: function() {
12730
+ return m[k];
12731
+ } };
12732
+ }
12733
+ Object.defineProperty(o, k2, desc);
12734
+ } : function(o, m, k, k2) {
12735
+ if (k2 === void 0)
12736
+ k2 = k;
12737
+ o[k2] = m[k];
13166
12738
  });
13167
- module2.exports = __toCommonJS2(index_exports);
13168
- function base2(ALPHABET2) {
13169
- if (ALPHABET2.length >= 255) {
12739
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
12740
+ for (var p in m)
12741
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
12742
+ __createBinding(exports2, m, p);
12743
+ };
12744
+ Object.defineProperty(exports, "__esModule", { value: true });
12745
+ __exportStar(require_pkp_info_i(), exports);
12746
+ __exportStar(require_lit_action_config_i(), exports);
12747
+ __exportStar(require_diamond_hands_lit_actions_i(), exports);
12748
+ __exportStar(require_lit_action_registry_i(), exports);
12749
+ }
12750
+ });
12751
+
12752
+ // node_modules/base-x/src/cjs/index.cjs
12753
+ var require_cjs = __commonJS({
12754
+ "node_modules/base-x/src/cjs/index.cjs"(exports) {
12755
+ "use strict";
12756
+ Object.defineProperty(exports, "__esModule", { value: true });
12757
+ function base2(ALPHABET) {
12758
+ if (ALPHABET.length >= 255) {
13170
12759
  throw new TypeError("Alphabet too long");
13171
12760
  }
13172
12761
  const BASE_MAP = new Uint8Array(256);
13173
12762
  for (let j = 0; j < BASE_MAP.length; j++) {
13174
12763
  BASE_MAP[j] = 255;
13175
12764
  }
13176
- for (let i = 0; i < ALPHABET2.length; i++) {
13177
- const x = ALPHABET2.charAt(i);
12765
+ for (let i = 0; i < ALPHABET.length; i++) {
12766
+ const x = ALPHABET.charAt(i);
13178
12767
  const xc = x.charCodeAt(0);
13179
12768
  if (BASE_MAP[xc] !== 255) {
13180
12769
  throw new TypeError(x + " is ambiguous");
13181
12770
  }
13182
12771
  BASE_MAP[xc] = i;
13183
12772
  }
13184
- const BASE = ALPHABET2.length;
13185
- const LEADER = ALPHABET2.charAt(0);
12773
+ const BASE = ALPHABET.length;
12774
+ const LEADER = ALPHABET.charAt(0);
13186
12775
  const FACTOR = Math.log(BASE) / Math.log(256);
13187
12776
  const iFACTOR = Math.log(256) / Math.log(BASE);
13188
12777
  function encode4(source) {
@@ -13228,7 +12817,7 @@ var require_pkg_src = __commonJS({
13228
12817
  }
13229
12818
  let str = LEADER.repeat(zeroes);
13230
12819
  for (; it2 < size; ++it2) {
13231
- str += ALPHABET2.charAt(b58[it2]);
12820
+ str += ALPHABET.charAt(b58[it2]);
13232
12821
  }
13233
12822
  return str;
13234
12823
  }
@@ -13293,13 +12882,38 @@ var require_pkg_src = __commonJS({
13293
12882
  decode: decode3
13294
12883
  };
13295
12884
  }
13296
- var esm_default = base2;
12885
+ exports.default = base2;
12886
+ }
12887
+ });
12888
+
12889
+ // node_modules/bs58/src/cjs/index.cjs
12890
+ var require_cjs2 = __commonJS({
12891
+ "node_modules/bs58/src/cjs/index.cjs"(exports) {
12892
+ "use strict";
12893
+ var __importDefault = exports && exports.__importDefault || function(mod) {
12894
+ return mod && mod.__esModule ? mod : { "default": mod };
12895
+ };
12896
+ Object.defineProperty(exports, "__esModule", { value: true });
12897
+ var base_x_1 = __importDefault(require_cjs());
13297
12898
  var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
13298
- var esm_default2 = esm_default(ALPHABET);
12899
+ exports.default = (0, base_x_1.default)(ALPHABET);
12900
+ }
12901
+ });
12902
+
12903
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/cid-utils.js
12904
+ var require_cid_utils = __commonJS({
12905
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/cid-utils.js"(exports) {
12906
+ "use strict";
12907
+ var __importDefault = exports && exports.__importDefault || function(mod) {
12908
+ return mod && mod.__esModule ? mod : { "default": mod };
12909
+ };
12910
+ Object.defineProperty(exports, "__esModule", { value: true });
12911
+ exports.cidToHex = cidToHex;
12912
+ var bs58_1 = __importDefault(require_cjs2());
13299
12913
  function cidToHex(cid) {
13300
12914
  try {
13301
12915
  if (cid.startsWith("Qm")) {
13302
- const bytes = esm_default2.decode(cid);
12916
+ const bytes = bs58_1.default.decode(cid);
13303
12917
  return "0x" + Buffer.from(bytes).toString("hex");
13304
12918
  } else if (cid.startsWith("0x")) {
13305
12919
  return cid;
@@ -13313,12 +12927,21 @@ var require_pkg_src = __commonJS({
13313
12927
  throw new Error(`Failed to convert CID ${cid} to hex: ${error instanceof Error ? error.message : String(error)}`);
13314
12928
  }
13315
12929
  }
13316
- var DH_LIT_ACTIONS_CHIPOTLE3 = {
12930
+ }
12931
+ });
12932
+
12933
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/constants/chunks/lit-actions-registry.js
12934
+ var require_lit_actions_registry = __commonJS({
12935
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/constants/chunks/lit-actions-registry.js"(exports) {
12936
+ "use strict";
12937
+ Object.defineProperty(exports, "__esModule", { value: true });
12938
+ exports.CHIPOTLE_DEPLOYMENTS = exports.DH_LIT_ACTIONS_CHIPOTLE = void 0;
12939
+ exports.getDeploymentsForNetwork = getDeploymentsForNetwork;
12940
+ var cid_utils_1 = require_cid_utils();
12941
+ exports.DH_LIT_ACTIONS_CHIPOTLE = {
13317
12942
  authorizationDummy: {
13318
12943
  cid: "QmXPh5RTReLqjqZDRNhgVKi1TWMJK2vS9QSRPkWPhLBQJN",
13319
- authorizedCidHex: cidToHex(
13320
- "QmXPh5RTReLqjqZDRNhgVKi1TWMJK2vS9QSRPkWPhLBQJN"
13321
- ),
12944
+ authorizedCidHex: (0, cid_utils_1.cidToHex)("QmXPh5RTReLqjqZDRNhgVKi1TWMJK2vS9QSRPkWPhLBQJN"),
13322
12945
  name: "Authorization Dummy",
13323
12946
  description: "Production Authorization Dummy",
13324
12947
  version: "1.0.0",
@@ -13329,9 +12952,7 @@ var require_pkg_src = __commonJS({
13329
12952
  },
13330
12953
  authorizationDummyB: {
13331
12954
  cid: "QmQXTcAU9tr4YAVrzHujEJw9moJgM1o5gnJU2ojcvhigua",
13332
- authorizedCidHex: cidToHex(
13333
- "QmQXTcAU9tr4YAVrzHujEJw9moJgM1o5gnJU2ojcvhigua"
13334
- ),
12955
+ authorizedCidHex: (0, cid_utils_1.cidToHex)("QmQXTcAU9tr4YAVrzHujEJw9moJgM1o5gnJU2ojcvhigua"),
13335
12956
  name: "Authorization Dummy B",
13336
12957
  description: "Production Authorization Dummy B",
13337
12958
  version: "1.0.0",
@@ -13341,17 +12962,15 @@ var require_pkg_src = __commonJS({
13341
12962
  hash: "def4576ba6c382d145f996c4f950b5e39e58792415ee7fdd749e0d2bc61e8f0b"
13342
12963
  },
13343
12964
  pkpValidator: {
13344
- cid: "QmSo9fkRJA5rS2AnkpKyFgE7ADdGRC2mXvcXVUPaSBRxv1",
13345
- authorizedCidHex: cidToHex(
13346
- "QmSo9fkRJA5rS2AnkpKyFgE7ADdGRC2mXvcXVUPaSBRxv1"
13347
- ),
12965
+ cid: "QmTqsmXkjib7CRGFcEhmCs61Z3EZTaRPznaZDDLk5Wq9NX",
12966
+ authorizedCidHex: (0, cid_utils_1.cidToHex)("QmTqsmXkjib7CRGFcEhmCs61Z3EZTaRPznaZDDLk5Wq9NX"),
13348
12967
  name: "Pkp Validator",
13349
12968
  description: "Production Pkp Validator",
13350
12969
  version: "1.0.0",
13351
12970
  deployed: true,
13352
- deployedAt: 1776315028869,
13353
- size: 4030,
13354
- hash: "f57523311d2f1f1f1fae5a1bbdcd877582e64268c1cb90396c0d1dc26ab9a1fb",
12971
+ deployedAt: 1777311468630,
12972
+ size: 3999,
12973
+ hash: "baba8c31b73dbfe6425d8f9fd69c61f41a573e189a185962382b815a15fddb24",
13355
12974
  validatorWalletAddress: "0x9ee56687f7a984d5df7ab79330271a619ef56ddd",
13356
12975
  pkp: {
13357
12976
  publicKey: "0x04ec0e3acc40884e3f366ca469d08899eb640ad5259fa196b0238075086208a9f8732a3175704f35f0bcc28e07406cfb24c254efd1e7355640577330f0d2dd755f",
@@ -13360,9 +12979,7 @@ var require_pkg_src = __commonJS({
13360
12979
  },
13361
12980
  btcTransactionSigner: {
13362
12981
  cid: "QmYSvuDcn2EPjRoDsPBLK2e3PGYEUHtWAPxwB51s4unkaG",
13363
- authorizedCidHex: cidToHex(
13364
- "QmYSvuDcn2EPjRoDsPBLK2e3PGYEUHtWAPxwB51s4unkaG"
13365
- ),
12982
+ authorizedCidHex: (0, cid_utils_1.cidToHex)("QmYSvuDcn2EPjRoDsPBLK2e3PGYEUHtWAPxwB51s4unkaG"),
13366
12983
  name: "Btc Transaction Signer",
13367
12984
  description: "Production Btc Transaction Signer",
13368
12985
  version: "1.0.0",
@@ -13372,17 +12989,15 @@ var require_pkg_src = __commonJS({
13372
12989
  hash: "422311d10447a806bf435a1df440ff00d4eee986c019ccdb4af15bdbfd8019cf"
13373
12990
  },
13374
12991
  ucdMintValidator: {
13375
- cid: "QmRrL2oTyEyAsTNQQDbq7LpMtU6EJJCbmnLGKGJM4ULr1h",
13376
- authorizedCidHex: cidToHex(
13377
- "QmRrL2oTyEyAsTNQQDbq7LpMtU6EJJCbmnLGKGJM4ULr1h"
13378
- ),
12992
+ cid: "QmbYWJkLBdxTCNUkYTVmBzcp4CFhAn7ZcCyMZjhhbjAUMB",
12993
+ authorizedCidHex: (0, cid_utils_1.cidToHex)("QmbYWJkLBdxTCNUkYTVmBzcp4CFhAn7ZcCyMZjhhbjAUMB"),
13379
12994
  name: "Ucd Mint Validator",
13380
12995
  description: "Production Ucd Mint Validator",
13381
12996
  version: "1.0.0",
13382
12997
  deployed: true,
13383
- deployedAt: 1776782297891,
13384
- size: 64983,
13385
- hash: "001bbe2c2ba746daf2a29653c053fbe3ac84312df45dada048e18947fa3cc05b",
12998
+ deployedAt: 1777311478949,
12999
+ size: 65507,
13000
+ hash: "f079aa1fc53fe04b08508379feba5d55d2d334ab9ee21bee043c05cf592eced3",
13386
13001
  validatorWalletAddress: "0x36f3dd61c4c08a56d29ed2fd6d5f111b67b6a7a1",
13387
13002
  pkp: {
13388
13003
  publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
@@ -13390,17 +13005,15 @@ var require_pkg_src = __commonJS({
13390
13005
  }
13391
13006
  },
13392
13007
  processPaymentValidator: {
13393
- cid: "QmR7rT7iG74YeSVoavTSTgBtZqcmCKG3Tf3hmzQ3zTFUb3",
13394
- authorizedCidHex: cidToHex(
13395
- "QmR7rT7iG74YeSVoavTSTgBtZqcmCKG3Tf3hmzQ3zTFUb3"
13396
- ),
13008
+ cid: "Qmc9gkDVY1SK9vvyQ9cXa3PSSuv8q6Ki9o9rsG87qpXCYi",
13009
+ authorizedCidHex: (0, cid_utils_1.cidToHex)("Qmc9gkDVY1SK9vvyQ9cXa3PSSuv8q6Ki9o9rsG87qpXCYi"),
13397
13010
  name: "Process Payment Validator",
13398
13011
  description: "Production Process Payment Validator",
13399
13012
  version: "1.0.0",
13400
13013
  deployed: true,
13401
- deployedAt: 1776782306970,
13402
- size: 60889,
13403
- hash: "2153e187d2bbd713d41a87d1dac2199ab879590761becf55c708e5fb970bf941",
13014
+ deployedAt: 1777311488810,
13015
+ size: 61413,
13016
+ hash: "2ffbd15b1429edb7ddc7587ea8d30d45d4182a2bd3fc22e5986f9b4850440a9b",
13404
13017
  validatorWalletAddress: "0xc2ed5a59bd81eb4d1a19a0147b86ab69aa4c28ba",
13405
13018
  pkp: {
13406
13019
  publicKey: "0x04cfccb9b6c7addc79469c0e9fafebef4c70801302c62cdb26b610723a9b8527d23f98a40158c7340d83fd0e62d02b5ec74c12f7a86d98e8c6973b4811110f19ad",
@@ -13408,17 +13021,15 @@ var require_pkg_src = __commonJS({
13408
13021
  }
13409
13022
  },
13410
13023
  extendPositionValidator: {
13411
- cid: "QmZGWWnjVcfHzSBQzgXfMmxQJUYXKt9jsCXrCPZXzuPxPv",
13412
- authorizedCidHex: cidToHex(
13413
- "QmZGWWnjVcfHzSBQzgXfMmxQJUYXKt9jsCXrCPZXzuPxPv"
13414
- ),
13024
+ cid: "Qmc5MDW6ZxTRe3nXJEKa5KKUCVXFznV9vDqFL4n7ayRZ4p",
13025
+ authorizedCidHex: (0, cid_utils_1.cidToHex)("Qmc5MDW6ZxTRe3nXJEKa5KKUCVXFznV9vDqFL4n7ayRZ4p"),
13415
13026
  name: "Extend Position Validator",
13416
13027
  description: "Production Extend Position Validator",
13417
13028
  version: "1.0.0",
13418
13029
  deployed: true,
13419
- deployedAt: 1776782316021,
13420
- size: 60346,
13421
- hash: "630dacf25495e39a4011c5e28a74a5d9f09e9b89eb0d701868e8881e28609269",
13030
+ deployedAt: 1777311498958,
13031
+ size: 60870,
13032
+ hash: "624cbc2514b8be7b2e8cc3a509dce282db9213e43a7675f058ecebe4eb9faa40",
13422
13033
  validatorWalletAddress: "0xb3f4271c475887a86a2f21446f0968c30cc74c97",
13423
13034
  pkp: {
13424
13035
  publicKey: "0x04e52338f6a0c3362800f1a94c4c8f08be5030dde0fa217388c53d1c1a4790f4443c9f2886b2d2d8f4b75a9a156e9b028011b1a1cf7648da0e556aa980ec692836",
@@ -13426,17 +13037,15 @@ var require_pkg_src = __commonJS({
13426
13037
  }
13427
13038
  },
13428
13039
  btcWithdrawal: {
13429
- cid: "QmX9HxZsogBTBSurQPnopMtGDQRXtd3HynHxkqgq23u3rm",
13430
- authorizedCidHex: cidToHex(
13431
- "QmX9HxZsogBTBSurQPnopMtGDQRXtd3HynHxkqgq23u3rm"
13432
- ),
13040
+ cid: "QmQC7QKobtNJKArGK7rgGj8ZCcEWt1pBKXPyd5SZ2fi4tt",
13041
+ authorizedCidHex: (0, cid_utils_1.cidToHex)("QmQC7QKobtNJKArGK7rgGj8ZCcEWt1pBKXPyd5SZ2fi4tt"),
13433
13042
  name: "Btc Withdrawal",
13434
13043
  description: "Production Btc Withdrawal",
13435
- version: "1.0.0",
13044
+ version: "1.0.1",
13436
13045
  deployed: true,
13437
- deployedAt: 1776782325228,
13438
- size: 69488,
13439
- hash: "361055707df1851003f867635bb8c29eaaef6ced2e57c9d0250b8739d01e6b13",
13046
+ deployedAt: 1777474196351,
13047
+ size: 72236,
13048
+ hash: "5d2d3672dfa4027fd17d6bf4740995561ccc4dbe1ed388be19c241ecf5f4018f",
13440
13049
  validatorWalletAddress: "0xbb137fbda353199e9419b698c57a742124d4987d",
13441
13050
  pkp: {
13442
13051
  publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
@@ -13444,17 +13053,15 @@ var require_pkg_src = __commonJS({
13444
13053
  }
13445
13054
  },
13446
13055
  liquidationValidator: {
13447
- cid: "QmbufZa57vL7k3eeeFs9vy6LPry5XMYjJrYw7wCHzc3TWH",
13448
- authorizedCidHex: cidToHex(
13449
- "QmbufZa57vL7k3eeeFs9vy6LPry5XMYjJrYw7wCHzc3TWH"
13450
- ),
13056
+ cid: "QmZscQTKzwqWDZwYfaE57vdG4vYoNeQMkC2DwgJsnRNgQf",
13057
+ authorizedCidHex: (0, cid_utils_1.cidToHex)("QmZscQTKzwqWDZwYfaE57vdG4vYoNeQMkC2DwgJsnRNgQf"),
13451
13058
  name: "Liquidation Validator",
13452
13059
  description: "Production Liquidation Validator",
13453
13060
  version: "1.0.0",
13454
13061
  deployed: true,
13455
- deployedAt: 1776782332379,
13456
- size: 54383,
13457
- hash: "a2acf645716ed249b62ecc2069609eb53b17fe60c41d3027f0c3e98c3bffb4ca",
13062
+ deployedAt: 1777311523132,
13063
+ size: 54907,
13064
+ hash: "7a5a63dc80fad2258a0361f767f3efae3a62ec391c34b0927ca770411bf4de3e",
13458
13065
  validatorWalletAddress: "0x1542f863ee0340f6a067573e80ae66dd9b3838fa",
13459
13066
  pkp: {
13460
13067
  publicKey: "0x041a241de58976c13e3d7ca5a18e494f7330151e3818706135d50176e78ffb673e58b11f0b67a87c73fade6c6b27d6e7a7377ea9f4c10bf31880f1d725f18cc6f8",
@@ -13462,17 +13069,15 @@ var require_pkg_src = __commonJS({
13462
13069
  }
13463
13070
  },
13464
13071
  priceOracle: {
13465
- cid: "QmXKfK7JJFixFPvm48uwgVVW7s3eoE3sEyFEbZZ3dfNK1e",
13466
- authorizedCidHex: cidToHex(
13467
- "QmXKfK7JJFixFPvm48uwgVVW7s3eoE3sEyFEbZZ3dfNK1e"
13468
- ),
13072
+ cid: "Qma6vTTnn3AFy3A4u3A7T5tT6eEp26vXt7rPHSWpmBpdsp",
13073
+ authorizedCidHex: (0, cid_utils_1.cidToHex)("Qma6vTTnn3AFy3A4u3A7T5tT6eEp26vXt7rPHSWpmBpdsp"),
13469
13074
  name: "Price Oracle",
13470
13075
  description: "Production Price Oracle (Chipotle main+getPrivateKey)",
13471
13076
  version: "1.1.0",
13472
13077
  deployed: true,
13473
- deployedAt: 1776708126597,
13474
- size: 11644,
13475
- hash: "d175d8571aa4337d465115f9939a2d72965255c7c7a64c33e546ffff141e7a09",
13078
+ deployedAt: 1777311530589,
13079
+ size: 11531,
13080
+ hash: "a49e9a4875e68a1b8f1c37bcc8284a28e0995652a7df8bad4f1853408d1c81c8",
13476
13081
  validatorWalletAddress: "0x831ddf3048547b983efe3ccbbb35a45a53191651",
13477
13082
  pkp: {
13478
13083
  publicKey: "0x043beaa1da47875601a8d6f430b1438ee2d4732eefd06e5c63a474bbdaf9e7df1797b1b951e041b627c2bf839788164825324c9cbd1e2d6f740fdd4bff69b1900b",
@@ -13480,17 +13085,15 @@ var require_pkg_src = __commonJS({
13480
13085
  }
13481
13086
  },
13482
13087
  loanVaultBtcBalance: {
13483
- cid: "QmUdw25GDYMY6gm7nChBxpHtkwtoSEMjf66QWJ1dCikWkt",
13484
- authorizedCidHex: cidToHex(
13485
- "QmUdw25GDYMY6gm7nChBxpHtkwtoSEMjf66QWJ1dCikWkt"
13486
- ),
13088
+ cid: "QmWGEg79snhDQ5Fkm9pLhNmLKUJY5uXfp3t3276Jybritq",
13089
+ authorizedCidHex: (0, cid_utils_1.cidToHex)("QmWGEg79snhDQ5Fkm9pLhNmLKUJY5uXfp3t3276Jybritq"),
13487
13090
  name: "Loan Vault Btc Balance",
13488
13091
  description: "Production Loan Vault Btc Balance",
13489
13092
  version: "1.0.0",
13490
13093
  deployed: true,
13491
- deployedAt: 1776782341246,
13492
- size: 43769,
13493
- hash: "780ea6731fa48e0b15e1666ab1c6aa91471dbf748d36fa1e93f74614047bacb7",
13094
+ deployedAt: 1777311539409,
13095
+ size: 44293,
13096
+ hash: "70b009f01b9051dee2db1e4030dd17d08dc53728d30b5e24cffd11d07acfcaf0",
13494
13097
  validatorWalletAddress: "0x47feea74c8739d24b44faa67217f2f99970e15e7",
13495
13098
  pkp: {
13496
13099
  publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
@@ -13498,17 +13101,15 @@ var require_pkg_src = __commonJS({
13498
13101
  }
13499
13102
  },
13500
13103
  adminLiquidationValidator: {
13501
- cid: "QmYBpkLWKZbEBgdZnfFMabszmPYQJsfdVsqwVyJqdrMnP4",
13502
- authorizedCidHex: cidToHex(
13503
- "QmYBpkLWKZbEBgdZnfFMabszmPYQJsfdVsqwVyJqdrMnP4"
13504
- ),
13104
+ cid: "QmYJJFgFPF4BR4ts9GrAkwfEoQbVSXEwnrciZ5Jj9WTDgd",
13105
+ authorizedCidHex: (0, cid_utils_1.cidToHex)("QmYJJFgFPF4BR4ts9GrAkwfEoQbVSXEwnrciZ5Jj9WTDgd"),
13505
13106
  name: "Admin Liquidation Validator",
13506
13107
  description: "Production Admin Liquidation Validator",
13507
13108
  version: "1.0.0",
13508
13109
  deployed: true,
13509
- deployedAt: 1776782348498,
13510
- size: 51032,
13511
- hash: "b3af59aab3d71841e2b06e11da7c1664e451e636ead6ee746604be82ff472a13",
13110
+ deployedAt: 1777311549068,
13111
+ size: 51556,
13112
+ hash: "8eb26b08623d6be2ded733579d61c389fe312eef8d12ae1e62166c9359bbd037",
13512
13113
  validatorWalletAddress: "0x2a83b78842d75358877deb8854ccc5bbbaa5012e",
13513
13114
  pkp: {
13514
13115
  publicKey: "0x04ee4316afb8538280ede6c56def9cbe791f18f96ccba97768b28e2966d9c46a9493a6b81f4571495c3ce56c2d0b33fe8cf63726cd12d395832ea54162b5c67801",
@@ -13517,9 +13118,7 @@ var require_pkg_src = __commonJS({
13517
13118
  },
13518
13119
  alwaysSigner: {
13519
13120
  cid: "QmXQjybSsdE19Da66to9Hh7X2dLFwpZPhjoqojxbpk7Nvs",
13520
- authorizedCidHex: cidToHex(
13521
- "QmXQjybSsdE19Da66to9Hh7X2dLFwpZPhjoqojxbpk7Nvs"
13522
- ),
13121
+ authorizedCidHex: (0, cid_utils_1.cidToHex)("QmXQjybSsdE19Da66to9Hh7X2dLFwpZPhjoqojxbpk7Nvs"),
13523
13122
  name: "Always Signer",
13524
13123
  description: "Production Always Signer",
13525
13124
  version: "1.0.0",
@@ -13531,80 +13130,336 @@ var require_pkg_src = __commonJS({
13531
13130
  };
13532
13131
  function getDeploymentsForNetwork(network) {
13533
13132
  if (network === "chipotle")
13534
- return DH_LIT_ACTIONS_CHIPOTLE3;
13133
+ return exports.DH_LIT_ACTIONS_CHIPOTLE;
13535
13134
  throw new Error(`Unsupported LIT network: ${network}`);
13536
13135
  }
13537
- var CHIPOTLE_DEPLOYMENTS = DH_LIT_ACTIONS_CHIPOTLE3;
13136
+ exports.CHIPOTLE_DEPLOYMENTS = exports.DH_LIT_ACTIONS_CHIPOTLE;
13137
+ }
13138
+ });
13139
+
13140
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/lit-action-helpers.js
13141
+ var require_lit_action_helpers = __commonJS({
13142
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/lit-action-helpers.js"(exports) {
13143
+ "use strict";
13144
+ Object.defineProperty(exports, "__esModule", { value: true });
13145
+ exports.getLitActionCID = getLitActionCID;
13146
+ exports.getLitActionConfig = getLitActionConfig;
13147
+ exports.isLitActionDeployed = isLitActionDeployed;
13148
+ exports.validateDeployedActions = validateDeployedActions;
13149
+ exports.getDeployedActions = getDeployedActions;
13150
+ var lit_actions_registry_1 = require_lit_actions_registry();
13538
13151
  function getLitActionCID(litNetwork = "chipotle", actionName) {
13539
- const deployments = getDeploymentsForNetwork(litNetwork);
13152
+ const deployments = (0, lit_actions_registry_1.getDeploymentsForNetwork)(litNetwork);
13540
13153
  const action = deployments[actionName];
13541
13154
  if (!action || !action.deployed || !action.cid) {
13542
- throw new Error(
13543
- `LIT Action '${actionName}' not deployed on network '${litNetwork}'. Check deployment status.`
13544
- );
13155
+ throw new Error(`LIT Action '${actionName}' not deployed on network '${litNetwork}'. Check deployment status.`);
13545
13156
  }
13546
13157
  return action.cid;
13547
13158
  }
13548
13159
  function getLitActionConfig(actionName, litNetwork = "chipotle") {
13549
- const deployments = getDeploymentsForNetwork(litNetwork);
13160
+ const deployments = (0, lit_actions_registry_1.getDeploymentsForNetwork)(litNetwork);
13550
13161
  const action = deployments[actionName];
13551
13162
  if (!action) {
13552
- throw new Error(
13553
- `LIT Action '${actionName}' not found in registry for network '${litNetwork}'.`
13554
- );
13163
+ throw new Error(`LIT Action '${actionName}' not found in registry for network '${litNetwork}'.`);
13555
13164
  }
13556
13165
  return action;
13557
13166
  }
13558
13167
  function isLitActionDeployed(actionName, litNetwork = "chipotle") {
13559
- const deployments = getDeploymentsForNetwork(litNetwork);
13168
+ const deployments = (0, lit_actions_registry_1.getDeploymentsForNetwork)(litNetwork);
13560
13169
  const action = deployments[actionName];
13561
13170
  return !!(action && action.deployed && action.cid);
13562
13171
  }
13563
13172
  function validateDeployedActions(requiredActions, litNetwork = "chipotle") {
13564
- return requiredActions.every(
13565
- (actionName) => isLitActionDeployed(actionName, litNetwork)
13566
- );
13173
+ return requiredActions.every((actionName) => isLitActionDeployed(actionName, litNetwork));
13567
13174
  }
13568
13175
  function getDeployedActions(litNetwork = "chipotle") {
13569
- const deployments = getDeploymentsForNetwork(litNetwork);
13570
- return Object.values(deployments).filter(
13571
- (action) => action && action.deployed
13572
- );
13176
+ const deployments = (0, lit_actions_registry_1.getDeploymentsForNetwork)(litNetwork);
13177
+ return Object.values(deployments).filter((action) => action && action.deployed);
13573
13178
  }
13179
+ }
13180
+ });
13181
+
13182
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/pkp-setup.js
13183
+ var require_pkp_setup = __commonJS({
13184
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/pkp-setup.js"(exports) {
13185
+ "use strict";
13186
+ Object.defineProperty(exports, "__esModule", { value: true });
13187
+ exports.getPKPValidatorSetup = getPKPValidatorSetup;
13188
+ var lit_actions_registry_1 = require_lit_actions_registry();
13574
13189
  function getPKPValidatorSetup(litNetwork = "chipotle") {
13575
- const deployments = getDeploymentsForNetwork(litNetwork);
13190
+ const deployments = (0, lit_actions_registry_1.getDeploymentsForNetwork)(litNetwork);
13576
13191
  const litAction = deployments.pkpValidator;
13577
13192
  if (!litAction || !litAction.pkp) {
13578
- throw new Error(
13579
- `PKP validator setup is not available for litNetwork='${litNetwork}'. Ensure the pkpValidator action (with pkp attached) is defined in the registry.`
13580
- );
13193
+ throw new Error(`PKP validator setup is not available for litNetwork='${litNetwork}'. Ensure the pkpValidator action (with pkp attached) is defined in the registry.`);
13581
13194
  }
13582
13195
  return {
13583
13196
  litAction,
13584
13197
  pkp: litAction.pkp
13585
13198
  };
13586
13199
  }
13587
- init_debug_logger();
13588
- var ErrorCategory2 = /* @__PURE__ */ ((ErrorCategory22) => {
13589
- ErrorCategory22["NETWORK"] = "network";
13590
- ErrorCategory22["PROTOCOL"] = "protocol";
13591
- ErrorCategory22["AUTHENTICATION"] = "authentication";
13592
- ErrorCategory22["RESOURCE"] = "resource";
13593
- ErrorCategory22["VALIDATION"] = "validation";
13594
- ErrorCategory22["TIMEOUT"] = "timeout";
13595
- ErrorCategory22["RATE_LIMIT"] = "rate_limit";
13596
- ErrorCategory22["CONFIGURATION"] = "configuration";
13597
- ErrorCategory22["UNKNOWN"] = "unknown";
13598
- return ErrorCategory22;
13599
- })(ErrorCategory2 || {});
13600
- var RetryStrategy = /* @__PURE__ */ ((RetryStrategy2) => {
13200
+ }
13201
+ });
13202
+
13203
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/debug-logger.js
13204
+ var require_debug_logger = __commonJS({
13205
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/debug-logger.js"(exports) {
13206
+ "use strict";
13207
+ Object.defineProperty(exports, "__esModule", { value: true });
13208
+ exports.networkMetrics = exports.PerformanceTracker = exports.DEFAULT_DEBUG_CONFIG = exports.LogLevel = void 0;
13209
+ exports.configureDebugLogging = configureDebugLogging;
13210
+ exports.debugError = debugError;
13211
+ exports.debugWarn = debugWarn;
13212
+ exports.debugInfo = debugInfo;
13213
+ exports.debugLog = debugLog;
13214
+ exports.debugTrace = debugTrace;
13215
+ exports.logRequest = logRequest;
13216
+ exports.logResponse = logResponse;
13217
+ exports.logError = logError;
13218
+ exports.logConnectionAttempt = logConnectionAttempt;
13219
+ exports.logConnectionSuccess = logConnectionSuccess;
13220
+ exports.logConnectionFailure = logConnectionFailure;
13221
+ exports.logPkpOperation = logPkpOperation;
13222
+ exports.logSessionSignatures = logSessionSignatures;
13223
+ exports.logLitActionExecution = logLitActionExecution;
13224
+ exports.logLitActionResult = logLitActionResult;
13225
+ exports.logTestStart = logTestStart;
13226
+ exports.logTestEnd = logTestEnd;
13227
+ var LogLevel2;
13228
+ (function(LogLevel3) {
13229
+ LogLevel3[LogLevel3["ERROR"] = 0] = "ERROR";
13230
+ LogLevel3[LogLevel3["WARN"] = 1] = "WARN";
13231
+ LogLevel3[LogLevel3["INFO"] = 2] = "INFO";
13232
+ LogLevel3[LogLevel3["DEBUG"] = 3] = "DEBUG";
13233
+ LogLevel3[LogLevel3["TRACE"] = 4] = "TRACE";
13234
+ })(LogLevel2 || (exports.LogLevel = LogLevel2 = {}));
13235
+ exports.DEFAULT_DEBUG_CONFIG = {
13236
+ level: LogLevel2.INFO,
13237
+ enableTimestamps: true,
13238
+ enablePerformanceMetrics: true,
13239
+ enableRequestLogging: true,
13240
+ enableNetworkMetrics: true
13241
+ };
13242
+ var debugConfig = { ...exports.DEFAULT_DEBUG_CONFIG };
13243
+ function configureDebugLogging(config) {
13244
+ debugConfig = { ...debugConfig, ...config };
13245
+ }
13246
+ function getTimestamp() {
13247
+ return (/* @__PURE__ */ new Date()).toISOString();
13248
+ }
13249
+ function formatMessage(level, component, message, metadata) {
13250
+ const timestamp = debugConfig.enableTimestamps ? `[${getTimestamp()}] ` : "";
13251
+ const metadataStr = metadata ? ` ${JSON.stringify(metadata)}` : "";
13252
+ return `${timestamp}[${level}] [${component}] ${message}${metadataStr}`;
13253
+ }
13254
+ var PerformanceTracker = class {
13255
+ constructor(operationName) {
13256
+ this.operationName = operationName;
13257
+ this.markers = /* @__PURE__ */ new Map();
13258
+ this.startTime = Date.now();
13259
+ this.log("PERF", `Started: ${operationName}`);
13260
+ }
13261
+ mark(label) {
13262
+ const elapsed = Date.now() - this.startTime;
13263
+ this.markers.set(label, elapsed);
13264
+ this.log("PERF", `${this.operationName} - ${label}: ${elapsed}ms`);
13265
+ }
13266
+ end(success2 = true) {
13267
+ const totalTime = Date.now() - this.startTime;
13268
+ const status = success2 ? "SUCCESS" : "FAILED";
13269
+ this.log("PERF", `${this.operationName} - ${status}: ${totalTime}ms`);
13270
+ if (debugConfig.enablePerformanceMetrics && this.markers.size > 0) {
13271
+ console.log(`\u{1F4CA} Performance Breakdown for ${this.operationName}:`);
13272
+ for (const [label, time] of this.markers) {
13273
+ console.log(` ${label}: ${time}ms`);
13274
+ }
13275
+ console.log(` Total: ${totalTime}ms`);
13276
+ }
13277
+ return totalTime;
13278
+ }
13279
+ log(level, message) {
13280
+ if (debugConfig.enablePerformanceMetrics) {
13281
+ console.log(formatMessage(level, "PERFORMANCE", message));
13282
+ }
13283
+ }
13284
+ };
13285
+ exports.PerformanceTracker = PerformanceTracker;
13286
+ var NetworkMetricsCollector = class {
13287
+ constructor() {
13288
+ this.metrics = /* @__PURE__ */ new Map();
13289
+ }
13290
+ getMetrics(operation) {
13291
+ if (!this.metrics.has(operation)) {
13292
+ this.metrics.set(operation, {
13293
+ requestCount: 0,
13294
+ successCount: 0,
13295
+ failureCount: 0,
13296
+ averageLatency: 0,
13297
+ startTime: Date.now()
13298
+ });
13299
+ }
13300
+ return this.metrics.get(operation);
13301
+ }
13302
+ recordRequest(operation, success2, latency, error) {
13303
+ const metrics = this.getMetrics(operation);
13304
+ metrics.requestCount++;
13305
+ if (success2) {
13306
+ metrics.successCount++;
13307
+ metrics.averageLatency = (metrics.averageLatency * (metrics.successCount - 1) + latency) / metrics.successCount;
13308
+ } else {
13309
+ metrics.failureCount++;
13310
+ if (error)
13311
+ metrics.lastError = error;
13312
+ }
13313
+ if (debugConfig.enableNetworkMetrics) {
13314
+ const successRate = (metrics.successCount / metrics.requestCount * 100).toFixed(1);
13315
+ debugLog("NETWORK", `${operation} - Success: ${success2}, Latency: ${latency}ms, Success Rate: ${successRate}%`);
13316
+ }
13317
+ }
13318
+ printSummary() {
13319
+ if (!debugConfig.enableNetworkMetrics)
13320
+ return;
13321
+ console.log("\n\u{1F4C8} Network Metrics Summary:");
13322
+ for (const [operation, metrics] of this.metrics) {
13323
+ const successRate = (metrics.successCount / metrics.requestCount * 100).toFixed(1);
13324
+ const runtime = Date.now() - metrics.startTime;
13325
+ console.log(` ${operation}:`);
13326
+ console.log(` Requests: ${metrics.requestCount}`);
13327
+ console.log(` Success Rate: ${successRate}%`);
13328
+ console.log(` Avg Latency: ${metrics.averageLatency.toFixed(0)}ms`);
13329
+ console.log(` Runtime: ${runtime}ms`);
13330
+ if (metrics.lastError) {
13331
+ console.log(` Last Error: ${metrics.lastError}`);
13332
+ }
13333
+ }
13334
+ }
13335
+ };
13336
+ exports.networkMetrics = new NetworkMetricsCollector();
13337
+ function debugError(component, message, metadata) {
13338
+ if (debugConfig.level >= LogLevel2.ERROR) {
13339
+ console.error(formatMessage("ERROR", component, message, metadata));
13340
+ }
13341
+ }
13342
+ function debugWarn(component, message, metadata) {
13343
+ if (debugConfig.level >= LogLevel2.WARN) {
13344
+ console.warn(formatMessage("WARN", component, message, metadata));
13345
+ }
13346
+ }
13347
+ function debugInfo(component, message, metadata) {
13348
+ if (debugConfig.level >= LogLevel2.INFO) {
13349
+ console.log(formatMessage("INFO", component, message, metadata));
13350
+ }
13351
+ }
13352
+ function debugLog(component, message, metadata) {
13353
+ if (debugConfig.level >= LogLevel2.DEBUG) {
13354
+ console.log(formatMessage("DEBUG", component, message, metadata));
13355
+ }
13356
+ }
13357
+ function debugTrace(component, message, metadata) {
13358
+ if (debugConfig.level >= LogLevel2.TRACE) {
13359
+ console.log(formatMessage("TRACE", component, message, metadata));
13360
+ }
13361
+ }
13362
+ function logRequest(component, operation, params) {
13363
+ if (!debugConfig.enableRequestLogging)
13364
+ return;
13365
+ debugLog(component, `\u{1F504} Request: ${operation}`, {
13366
+ operation,
13367
+ params: JSON.stringify(params, null, 2)
13368
+ });
13369
+ }
13370
+ function logResponse(component, operation, response, duration) {
13371
+ if (!debugConfig.enableRequestLogging)
13372
+ return;
13373
+ debugLog(component, `\u2705 Response: ${operation} (${duration}ms)`, {
13374
+ operation,
13375
+ duration,
13376
+ response: typeof response === "object" ? JSON.stringify(response, null, 2) : response
13377
+ });
13378
+ }
13379
+ function logError(component, operation, error, duration) {
13380
+ const durationStr = duration ? ` (${duration}ms)` : "";
13381
+ debugError(component, `\u274C Error: ${operation}${durationStr}`, {
13382
+ operation,
13383
+ duration,
13384
+ error: error?.message || error?.toString() || "Unknown error",
13385
+ stack: error?.stack
13386
+ });
13387
+ }
13388
+ function logConnectionAttempt(network, attempt, maxAttempts) {
13389
+ debugInfo("CONNECTION", `\u{1F517} Connecting to ${network} (attempt ${attempt}/${maxAttempts})`);
13390
+ }
13391
+ function logConnectionSuccess(network, latency) {
13392
+ debugInfo("CONNECTION", `\u2705 Connected to ${network} (${latency}ms)`);
13393
+ exports.networkMetrics.recordRequest(`connection-${network}`, true, latency);
13394
+ }
13395
+ function logConnectionFailure(network, error, attempt) {
13396
+ debugError("CONNECTION", `\u274C Connection failed to ${network} (attempt ${attempt})`, { error });
13397
+ exports.networkMetrics.recordRequest(`connection-${network}`, false, 0, error);
13398
+ }
13399
+ function logPkpOperation(operation, pkpId, details) {
13400
+ const pkpStr = pkpId ? ` (PKP: ${pkpId.slice(0, 8)}...)` : "";
13401
+ debugInfo("PKP", `\u{1F511} ${operation}${pkpStr}`, details);
13402
+ }
13403
+ function logSessionSignatures(count, expiration) {
13404
+ debugInfo("SESSION", `\u{1F510} Generated ${count} session signatures (expires: ${expiration})`);
13405
+ }
13406
+ function logLitActionExecution(cid, params) {
13407
+ debugInfo("LIT_ACTION", `\u26A1 Executing LIT Action: ${cid}`, {
13408
+ cid,
13409
+ params
13410
+ });
13411
+ }
13412
+ function logLitActionResult(cid, success2, duration, result) {
13413
+ const status = success2 ? "\u2705" : "\u274C";
13414
+ debugInfo("LIT_ACTION", `${status} LIT Action completed: ${cid} (${duration}ms)`, {
13415
+ cid,
13416
+ success: success2,
13417
+ duration,
13418
+ result: success2 && result ? JSON.stringify(result, null, 2) : void 0
13419
+ });
13420
+ }
13421
+ function logTestStart(testName) {
13422
+ debugInfo("TEST", `\u{1F9EA} Starting test: ${testName}`);
13423
+ return new PerformanceTracker(testName);
13424
+ }
13425
+ function logTestEnd(testName, success2, duration) {
13426
+ const status = success2 ? "\u2705" : "\u274C";
13427
+ debugInfo("TEST", `${status} Test completed: ${testName} (${duration}ms)`);
13428
+ exports.networkMetrics.printSummary();
13429
+ }
13430
+ }
13431
+ });
13432
+
13433
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/error-classification.js
13434
+ var require_error_classification = __commonJS({
13435
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/error-classification.js"(exports) {
13436
+ "use strict";
13437
+ Object.defineProperty(exports, "__esModule", { value: true });
13438
+ exports.litProtocolErrors = exports.RetryStrategy = exports.ErrorCategory = void 0;
13439
+ exports.classifyError = classifyError;
13440
+ exports.getRetryConfigFromClassification = getRetryConfigFromClassification;
13441
+ exports.analyzeError = analyzeError;
13442
+ exports.createErrorReport = createErrorReport;
13443
+ var ErrorCategory2;
13444
+ (function(ErrorCategory3) {
13445
+ ErrorCategory3["NETWORK"] = "network";
13446
+ ErrorCategory3["PROTOCOL"] = "protocol";
13447
+ ErrorCategory3["AUTHENTICATION"] = "authentication";
13448
+ ErrorCategory3["RESOURCE"] = "resource";
13449
+ ErrorCategory3["VALIDATION"] = "validation";
13450
+ ErrorCategory3["TIMEOUT"] = "timeout";
13451
+ ErrorCategory3["RATE_LIMIT"] = "rate_limit";
13452
+ ErrorCategory3["CONFIGURATION"] = "configuration";
13453
+ ErrorCategory3["UNKNOWN"] = "unknown";
13454
+ })(ErrorCategory2 || (exports.ErrorCategory = ErrorCategory2 = {}));
13455
+ var RetryStrategy;
13456
+ (function(RetryStrategy2) {
13601
13457
  RetryStrategy2["AGGRESSIVE"] = "aggressive";
13602
13458
  RetryStrategy2["CONSERVATIVE"] = "conservative";
13603
13459
  RetryStrategy2["EXPONENTIAL"] = "exponential";
13604
13460
  RetryStrategy2["LINEAR"] = "linear";
13605
13461
  RetryStrategy2["NONE"] = "none";
13606
- return RetryStrategy2;
13607
- })(RetryStrategy || {});
13462
+ })(RetryStrategy || (exports.RetryStrategy = RetryStrategy = {}));
13608
13463
  var LIT_ERROR_PATTERNS = {
13609
13464
  // Network and connection errors
13610
13465
  network: [
@@ -13697,46 +13552,31 @@ var require_pkg_src = __commonJS({
13697
13552
  ]
13698
13553
  };
13699
13554
  var RETRY_STRATEGIES = {
13700
- [
13701
- "aggressive"
13702
- /* AGGRESSIVE */
13703
- ]: {
13555
+ [RetryStrategy.AGGRESSIVE]: {
13704
13556
  maxAttempts: 5,
13705
13557
  baseDelayMs: 500,
13706
13558
  maxDelayMs: 5e3,
13707
13559
  multiplier: 1.5
13708
13560
  },
13709
- [
13710
- "conservative"
13711
- /* CONSERVATIVE */
13712
- ]: {
13561
+ [RetryStrategy.CONSERVATIVE]: {
13713
13562
  maxAttempts: 3,
13714
13563
  baseDelayMs: 3e3,
13715
13564
  maxDelayMs: 3e4,
13716
13565
  multiplier: 2.5
13717
13566
  },
13718
- [
13719
- "exponential"
13720
- /* EXPONENTIAL */
13721
- ]: {
13567
+ [RetryStrategy.EXPONENTIAL]: {
13722
13568
  maxAttempts: 4,
13723
13569
  baseDelayMs: 1e3,
13724
13570
  maxDelayMs: 15e3,
13725
13571
  multiplier: 2
13726
13572
  },
13727
- [
13728
- "linear"
13729
- /* LINEAR */
13730
- ]: {
13573
+ [RetryStrategy.LINEAR]: {
13731
13574
  maxAttempts: 3,
13732
13575
  baseDelayMs: 2e3,
13733
13576
  maxDelayMs: 1e4,
13734
13577
  multiplier: 1
13735
13578
  },
13736
- [
13737
- "none"
13738
- /* NONE */
13739
- ]: {
13579
+ [RetryStrategy.NONE]: {
13740
13580
  maxAttempts: 1,
13741
13581
  baseDelayMs: 0,
13742
13582
  maxDelayMs: 0,
@@ -13744,17 +13584,11 @@ var require_pkg_src = __commonJS({
13744
13584
  }
13745
13585
  };
13746
13586
  var CLASSIFICATION_RULES = {
13747
- [
13748
- "network"
13749
- /* NETWORK */
13750
- ]: {
13751
- category: "network",
13752
- retryStrategy: "aggressive",
13587
+ [ErrorCategory2.NETWORK]: {
13588
+ category: ErrorCategory2.NETWORK,
13589
+ retryStrategy: RetryStrategy.AGGRESSIVE,
13753
13590
  isRetryable: true,
13754
- ...RETRY_STRATEGIES[
13755
- "aggressive"
13756
- /* AGGRESSIVE */
13757
- ],
13591
+ ...RETRY_STRATEGIES[RetryStrategy.AGGRESSIVE],
13758
13592
  description: "Network connectivity or communication error",
13759
13593
  troubleshooting: [
13760
13594
  "Check internet connection",
@@ -13763,17 +13597,11 @@ var require_pkg_src = __commonJS({
13763
13597
  "Try connecting to different node endpoints"
13764
13598
  ]
13765
13599
  },
13766
- [
13767
- "protocol"
13768
- /* PROTOCOL */
13769
- ]: {
13770
- category: "protocol",
13771
- retryStrategy: "conservative",
13600
+ [ErrorCategory2.PROTOCOL]: {
13601
+ category: ErrorCategory2.PROTOCOL,
13602
+ retryStrategy: RetryStrategy.CONSERVATIVE,
13772
13603
  isRetryable: true,
13773
- ...RETRY_STRATEGIES[
13774
- "conservative"
13775
- /* CONSERVATIVE */
13776
- ],
13604
+ ...RETRY_STRATEGIES[RetryStrategy.CONSERVATIVE],
13777
13605
  description: "LIT Protocol specific operational error",
13778
13606
  troubleshooting: [
13779
13607
  "Check LIT Protocol network status",
@@ -13782,17 +13610,11 @@ var require_pkg_src = __commonJS({
13782
13610
  "Wait for network consensus"
13783
13611
  ]
13784
13612
  },
13785
- [
13786
- "authentication"
13787
- /* AUTHENTICATION */
13788
- ]: {
13789
- category: "authentication",
13790
- retryStrategy: "exponential",
13613
+ [ErrorCategory2.AUTHENTICATION]: {
13614
+ category: ErrorCategory2.AUTHENTICATION,
13615
+ retryStrategy: RetryStrategy.EXPONENTIAL,
13791
13616
  isRetryable: true,
13792
- ...RETRY_STRATEGIES[
13793
- "exponential"
13794
- /* EXPONENTIAL */
13795
- ],
13617
+ ...RETRY_STRATEGIES[RetryStrategy.EXPONENTIAL],
13796
13618
  maxAttempts: 2,
13797
13619
  // Override: limited retries for auth issues
13798
13620
  description: "Authentication or authorization error",
@@ -13803,17 +13625,11 @@ var require_pkg_src = __commonJS({
13803
13625
  "Check PKP authorization status"
13804
13626
  ]
13805
13627
  },
13806
- [
13807
- "resource"
13808
- /* RESOURCE */
13809
- ]: {
13810
- category: "resource",
13811
- retryStrategy: "linear",
13628
+ [ErrorCategory2.RESOURCE]: {
13629
+ category: ErrorCategory2.RESOURCE,
13630
+ retryStrategy: RetryStrategy.LINEAR,
13812
13631
  isRetryable: true,
13813
- ...RETRY_STRATEGIES[
13814
- "linear"
13815
- /* LINEAR */
13816
- ],
13632
+ ...RETRY_STRATEGIES[RetryStrategy.LINEAR],
13817
13633
  maxAttempts: 2,
13818
13634
  // Override: limited retries for resource issues
13819
13635
  description: "Resource not found or validation error",
@@ -13824,17 +13640,11 @@ var require_pkg_src = __commonJS({
13824
13640
  "Wait for resource propagation"
13825
13641
  ]
13826
13642
  },
13827
- [
13828
- "validation"
13829
- /* VALIDATION */
13830
- ]: {
13831
- category: "validation",
13832
- retryStrategy: "none",
13643
+ [ErrorCategory2.VALIDATION]: {
13644
+ category: ErrorCategory2.VALIDATION,
13645
+ retryStrategy: RetryStrategy.NONE,
13833
13646
  isRetryable: false,
13834
- ...RETRY_STRATEGIES[
13835
- "none"
13836
- /* NONE */
13837
- ],
13647
+ ...RETRY_STRATEGIES[RetryStrategy.NONE],
13838
13648
  description: "Input validation or schema error",
13839
13649
  troubleshooting: [
13840
13650
  "Check input parameters format",
@@ -13843,17 +13653,11 @@ var require_pkg_src = __commonJS({
13843
13653
  "Review API documentation"
13844
13654
  ]
13845
13655
  },
13846
- [
13847
- "timeout"
13848
- /* TIMEOUT */
13849
- ]: {
13850
- category: "timeout",
13851
- retryStrategy: "conservative",
13656
+ [ErrorCategory2.TIMEOUT]: {
13657
+ category: ErrorCategory2.TIMEOUT,
13658
+ retryStrategy: RetryStrategy.CONSERVATIVE,
13852
13659
  isRetryable: true,
13853
- ...RETRY_STRATEGIES[
13854
- "conservative"
13855
- /* CONSERVATIVE */
13856
- ],
13660
+ ...RETRY_STRATEGIES[RetryStrategy.CONSERVATIVE],
13857
13661
  description: "Operation timeout error",
13858
13662
  troubleshooting: [
13859
13663
  "Increase timeout values",
@@ -13862,17 +13666,11 @@ var require_pkg_src = __commonJS({
13862
13666
  "Split operations into smaller chunks"
13863
13667
  ]
13864
13668
  },
13865
- [
13866
- "rate_limit"
13867
- /* RATE_LIMIT */
13868
- ]: {
13869
- category: "rate_limit",
13870
- retryStrategy: "conservative",
13669
+ [ErrorCategory2.RATE_LIMIT]: {
13670
+ category: ErrorCategory2.RATE_LIMIT,
13671
+ retryStrategy: RetryStrategy.CONSERVATIVE,
13871
13672
  isRetryable: true,
13872
- ...RETRY_STRATEGIES[
13873
- "conservative"
13874
- /* CONSERVATIVE */
13875
- ],
13673
+ ...RETRY_STRATEGIES[RetryStrategy.CONSERVATIVE],
13876
13674
  maxAttempts: 2,
13877
13675
  // Override: limited retries to avoid further rate limiting
13878
13676
  baseDelayMs: 5e3,
@@ -13885,17 +13683,11 @@ var require_pkg_src = __commonJS({
13885
13683
  "Wait for quota reset"
13886
13684
  ]
13887
13685
  },
13888
- [
13889
- "configuration"
13890
- /* CONFIGURATION */
13891
- ]: {
13892
- category: "configuration",
13893
- retryStrategy: "none",
13686
+ [ErrorCategory2.CONFIGURATION]: {
13687
+ category: ErrorCategory2.CONFIGURATION,
13688
+ retryStrategy: RetryStrategy.NONE,
13894
13689
  isRetryable: false,
13895
- ...RETRY_STRATEGIES[
13896
- "none"
13897
- /* NONE */
13898
- ],
13690
+ ...RETRY_STRATEGIES[RetryStrategy.NONE],
13899
13691
  description: "Configuration or setup error",
13900
13692
  troubleshooting: [
13901
13693
  "Check environment variables",
@@ -13904,17 +13696,11 @@ var require_pkg_src = __commonJS({
13904
13696
  "Check required dependencies"
13905
13697
  ]
13906
13698
  },
13907
- [
13908
- "unknown"
13909
- /* UNKNOWN */
13910
- ]: {
13911
- category: "unknown",
13912
- retryStrategy: "exponential",
13699
+ [ErrorCategory2.UNKNOWN]: {
13700
+ category: ErrorCategory2.UNKNOWN,
13701
+ retryStrategy: RetryStrategy.EXPONENTIAL,
13913
13702
  isRetryable: true,
13914
- ...RETRY_STRATEGIES[
13915
- "exponential"
13916
- /* EXPONENTIAL */
13917
- ],
13703
+ ...RETRY_STRATEGIES[RetryStrategy.EXPONENTIAL],
13918
13704
  maxAttempts: 2,
13919
13705
  // Override: conservative retries for unknown errors
13920
13706
  description: "Unknown or unclassified error",
@@ -13940,10 +13726,7 @@ var require_pkg_src = __commonJS({
13940
13726
  }
13941
13727
  }
13942
13728
  }
13943
- const unknownClassification = CLASSIFICATION_RULES[
13944
- "unknown"
13945
- /* UNKNOWN */
13946
- ];
13729
+ const unknownClassification = CLASSIFICATION_RULES[ErrorCategory2.UNKNOWN];
13947
13730
  return {
13948
13731
  ...unknownClassification,
13949
13732
  description: `${unknownClassification.description}: ${errorMessage.slice(0, 100)}`
@@ -13992,19 +13775,260 @@ var require_pkg_src = __commonJS({
13992
13775
  });
13993
13776
  report.push("");
13994
13777
  }
13995
- return report.join("\n");
13996
- }
13997
- var litProtocolErrors = {
13998
- isNetworkError: (error) => classifyError(error).category === "network",
13999
- isProtocolError: (error) => classifyError(error).category === "protocol",
14000
- isAuthenticationError: (error) => classifyError(error).category === "authentication",
14001
- isResourceError: (error) => classifyError(error).category === "resource",
14002
- isTimeoutError: (error) => classifyError(error).category === "timeout",
14003
- isRateLimitError: (error) => classifyError(error).category === "rate_limit",
14004
- isConfigurationError: (error) => classifyError(error).category === "configuration",
14005
- isRetryable: (error) => classifyError(error).isRetryable
13778
+ return report.join("\n");
13779
+ }
13780
+ exports.litProtocolErrors = {
13781
+ isNetworkError: (error) => classifyError(error).category === ErrorCategory2.NETWORK,
13782
+ isProtocolError: (error) => classifyError(error).category === ErrorCategory2.PROTOCOL,
13783
+ isAuthenticationError: (error) => classifyError(error).category === ErrorCategory2.AUTHENTICATION,
13784
+ isResourceError: (error) => classifyError(error).category === ErrorCategory2.RESOURCE,
13785
+ isTimeoutError: (error) => classifyError(error).category === ErrorCategory2.TIMEOUT,
13786
+ isRateLimitError: (error) => classifyError(error).category === ErrorCategory2.RATE_LIMIT,
13787
+ isConfigurationError: (error) => classifyError(error).category === ErrorCategory2.CONFIGURATION,
13788
+ isRetryable: (error) => classifyError(error).isRetryable
13789
+ };
13790
+ }
13791
+ });
13792
+
13793
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/session-signature-cache.js
13794
+ var require_session_signature_cache = __commonJS({
13795
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/session-signature-cache.js"(exports) {
13796
+ "use strict";
13797
+ Object.defineProperty(exports, "__esModule", { value: true });
13798
+ exports.sessionSignatureCache = exports.DEFAULT_CACHE_CONFIG = void 0;
13799
+ exports.generateSessionSignaturesWithCache = generateSessionSignaturesWithCache;
13800
+ exports.configureSessionSignatureCache = configureSessionSignatureCache;
13801
+ exports.clearSessionSignatureCache = clearSessionSignatureCache;
13802
+ exports.getSessionSignatureCacheStats = getSessionSignatureCacheStats;
13803
+ var debug_logger_1 = require_debug_logger();
13804
+ exports.DEFAULT_CACHE_CONFIG = {
13805
+ maxEntries: 50,
13806
+ bufferTimeMs: 6e4,
13807
+ // 1 minute buffer before expiration
13808
+ enableLogging: true
13809
+ };
13810
+ var SessionSignatureCache = class {
13811
+ constructor(config = {}) {
13812
+ this.cache = /* @__PURE__ */ new Map();
13813
+ this.config = { ...exports.DEFAULT_CACHE_CONFIG, ...config };
13814
+ }
13815
+ /**
13816
+ * Generate cache key from PKP and context
13817
+ */
13818
+ generateCacheKey(pkpTokenId, litActionCid, signerAddress, network) {
13819
+ return `${signerAddress}-${network}-${pkpTokenId}-${litActionCid}`;
13820
+ }
13821
+ /**
13822
+ * Check if cache entry is still valid
13823
+ */
13824
+ isEntryValid(entry) {
13825
+ const now2 = /* @__PURE__ */ new Date();
13826
+ const expirationWithBuffer = new Date(entry.expiration.getTime() - this.config.bufferTimeMs);
13827
+ return now2 < expirationWithBuffer;
13828
+ }
13829
+ /**
13830
+ * Clean expired entries from cache
13831
+ */
13832
+ cleanExpiredEntries() {
13833
+ const now2 = /* @__PURE__ */ new Date();
13834
+ let cleanedCount = 0;
13835
+ for (const [key2, entry] of this.cache.entries()) {
13836
+ if (now2 >= entry.expiration) {
13837
+ this.cache.delete(key2);
13838
+ cleanedCount++;
13839
+ }
13840
+ }
13841
+ if (cleanedCount > 0 && this.config.enableLogging) {
13842
+ (0, debug_logger_1.debugInfo)("CACHE", `\u{1F9F9} Cleaned ${cleanedCount} expired session signature entries`);
13843
+ }
13844
+ }
13845
+ /**
13846
+ * Enforce cache size limits
13847
+ */
13848
+ enforceCacheSize() {
13849
+ if (this.cache.size <= this.config.maxEntries) {
13850
+ return;
13851
+ }
13852
+ const entries = Array.from(this.cache.entries()).sort(([, a], [, b]) => a.createdAt.getTime() - b.createdAt.getTime());
13853
+ const toRemove = entries.slice(0, this.cache.size - this.config.maxEntries);
13854
+ for (const [key2] of toRemove) {
13855
+ this.cache.delete(key2);
13856
+ }
13857
+ if (this.config.enableLogging) {
13858
+ (0, debug_logger_1.debugInfo)("CACHE", `\u{1F4E6} Removed ${toRemove.length} oldest cache entries to maintain size limit`);
13859
+ }
13860
+ }
13861
+ /**
13862
+ * Get cached session signatures if valid
13863
+ */
13864
+ get(pkpTokenId, litActionCid, signerAddress, network) {
13865
+ this.cleanExpiredEntries();
13866
+ const cacheKey = this.generateCacheKey(pkpTokenId, litActionCid, signerAddress, network);
13867
+ const entry = this.cache.get(cacheKey);
13868
+ if (!entry) {
13869
+ if (this.config.enableLogging) {
13870
+ (0, debug_logger_1.debugLog)("CACHE", `\u274C Session signatures cache miss: ${cacheKey}`);
13871
+ }
13872
+ return null;
13873
+ }
13874
+ if (!this.isEntryValid(entry)) {
13875
+ this.cache.delete(cacheKey);
13876
+ if (this.config.enableLogging) {
13877
+ (0, debug_logger_1.debugWarn)("CACHE", `\u23F0 Session signatures expired: ${cacheKey}`);
13878
+ }
13879
+ return null;
13880
+ }
13881
+ if (this.config.enableLogging) {
13882
+ const timeUntilExpiry = entry.expiration.getTime() - Date.now();
13883
+ (0, debug_logger_1.debugInfo)("CACHE", `\u2705 Session signatures cache hit: ${cacheKey} (expires in ${Math.round(timeUntilExpiry / 1e3)}s)`);
13884
+ }
13885
+ return entry.sessionSigs;
13886
+ }
13887
+ /**
13888
+ * Cache session signatures
13889
+ */
13890
+ set(pkpTokenId, litActionCid, signerAddress, network, sessionSigs, expiration) {
13891
+ const cacheKey = this.generateCacheKey(pkpTokenId, litActionCid, signerAddress, network);
13892
+ const entry = {
13893
+ sessionSigs,
13894
+ expiration,
13895
+ pkpTokenId,
13896
+ litActionCid,
13897
+ signerAddress,
13898
+ network,
13899
+ createdAt: /* @__PURE__ */ new Date()
13900
+ };
13901
+ this.cache.set(cacheKey, entry);
13902
+ if (this.config.enableLogging) {
13903
+ const timeUntilExpiry = expiration.getTime() - Date.now();
13904
+ (0, debug_logger_1.debugInfo)("CACHE", `\u{1F4BE} Cached session signatures: ${cacheKey} (expires in ${Math.round(timeUntilExpiry / 1e3)}s)`);
13905
+ }
13906
+ this.enforceCacheSize();
13907
+ }
13908
+ /**
13909
+ * Clear all cached session signatures
13910
+ */
13911
+ clear() {
13912
+ const size = this.cache.size;
13913
+ this.cache.clear();
13914
+ if (this.config.enableLogging) {
13915
+ (0, debug_logger_1.debugInfo)("CACHE", `\u{1F5D1}\uFE0F Cleared ${size} cached session signature entries`);
13916
+ }
13917
+ }
13918
+ /**
13919
+ * Get cache statistics
13920
+ */
13921
+ getStats() {
13922
+ this.cleanExpiredEntries();
13923
+ return {
13924
+ size: this.cache.size,
13925
+ maxEntries: this.config.maxEntries,
13926
+ utilizationPercent: Math.round(this.cache.size / this.config.maxEntries * 100)
13927
+ };
13928
+ }
13929
+ /**
13930
+ * Remove specific cache entry
13931
+ */
13932
+ delete(pkpTokenId, litActionCid, signerAddress, network) {
13933
+ const cacheKey = this.generateCacheKey(pkpTokenId, litActionCid, signerAddress, network);
13934
+ const deleted = this.cache.delete(cacheKey);
13935
+ if (deleted && this.config.enableLogging) {
13936
+ (0, debug_logger_1.debugInfo)("CACHE", `\u{1F5D1}\uFE0F Removed session signatures from cache: ${cacheKey}`);
13937
+ }
13938
+ return deleted;
13939
+ }
14006
13940
  };
14007
- var DEFAULT_RETRY_CONFIG = {
13941
+ exports.sessionSignatureCache = new SessionSignatureCache();
13942
+ async function generateSessionSignaturesWithCache(litNodeClient, sessionConfig, pkpTokenId, litActionCid, signerAddress, network = "chipotle") {
13943
+ const cached = exports.sessionSignatureCache.get(pkpTokenId, litActionCid, signerAddress, network);
13944
+ if (cached) {
13945
+ return cached;
13946
+ }
13947
+ (0, debug_logger_1.debugInfo)("CACHE", "\u{1F510} Generating new session signatures (cache miss)...");
13948
+ const sessionSigs = await litNodeClient.getSessionSigs(sessionConfig);
13949
+ const expiration = new Date(sessionConfig.expiration);
13950
+ exports.sessionSignatureCache.set(pkpTokenId, litActionCid, signerAddress, network, sessionSigs, expiration);
13951
+ const sigCount = Object.keys(sessionSigs).length;
13952
+ (0, debug_logger_1.debugInfo)("CACHE", `\u2705 Generated and cached ${sigCount} session signatures`);
13953
+ return sessionSigs;
13954
+ }
13955
+ function configureSessionSignatureCache(config) {
13956
+ Object.assign(exports.sessionSignatureCache["config"], config);
13957
+ }
13958
+ function clearSessionSignatureCache() {
13959
+ exports.sessionSignatureCache.clear();
13960
+ }
13961
+ function getSessionSignatureCacheStats() {
13962
+ return exports.sessionSignatureCache.getStats();
13963
+ }
13964
+ }
13965
+ });
13966
+
13967
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/connection-helpers.js
13968
+ var require_connection_helpers = __commonJS({
13969
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/connection-helpers.js"(exports) {
13970
+ "use strict";
13971
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
13972
+ if (k2 === void 0)
13973
+ k2 = k;
13974
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13975
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13976
+ desc = { enumerable: true, get: function() {
13977
+ return m[k];
13978
+ } };
13979
+ }
13980
+ Object.defineProperty(o, k2, desc);
13981
+ } : function(o, m, k, k2) {
13982
+ if (k2 === void 0)
13983
+ k2 = k;
13984
+ o[k2] = m[k];
13985
+ });
13986
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
13987
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
13988
+ } : function(o, v) {
13989
+ o["default"] = v;
13990
+ });
13991
+ var __importStar = exports && exports.__importStar || function() {
13992
+ var ownKeys = function(o) {
13993
+ ownKeys = Object.getOwnPropertyNames || function(o2) {
13994
+ var ar = [];
13995
+ for (var k in o2)
13996
+ if (Object.prototype.hasOwnProperty.call(o2, k))
13997
+ ar[ar.length] = k;
13998
+ return ar;
13999
+ };
14000
+ return ownKeys(o);
14001
+ };
14002
+ return function(mod) {
14003
+ if (mod && mod.__esModule)
14004
+ return mod;
14005
+ var result = {};
14006
+ if (mod != null) {
14007
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
14008
+ if (k[i] !== "default")
14009
+ __createBinding(result, mod, k[i]);
14010
+ }
14011
+ __setModuleDefault(result, mod);
14012
+ return result;
14013
+ };
14014
+ }();
14015
+ Object.defineProperty(exports, "__esModule", { value: true });
14016
+ exports.NETWORK_TIMEOUTS = exports.DEFAULT_RETRY_CONFIG = void 0;
14017
+ exports.sleep = sleep;
14018
+ exports.isRetryableError = isRetryableError;
14019
+ exports.calculateDelay = calculateDelay;
14020
+ exports.withRetry = withRetry;
14021
+ exports.connectLitNodeClient = connectLitNodeClient;
14022
+ exports.connectLitContracts = connectLitContracts;
14023
+ exports.validateLitNodeConnection = validateLitNodeConnection;
14024
+ exports.generateSessionSignatures = generateSessionSignatures;
14025
+ exports.validateLitNodeReadiness = validateLitNodeReadiness;
14026
+ exports.executeLitAction = executeLitAction;
14027
+ exports.executePkpOperation = executePkpOperation;
14028
+ exports.getNetworkTimeouts = getNetworkTimeouts;
14029
+ var debug_logger_1 = require_debug_logger();
14030
+ var error_classification_1 = require_error_classification();
14031
+ exports.DEFAULT_RETRY_CONFIG = {
14008
14032
  maxAttempts: 5,
14009
14033
  // Increased from 3 for PKP operations
14010
14034
  initialDelayMs: 2e3,
@@ -14038,85 +14062,80 @@ var require_pkg_src = __commonJS({
14038
14062
  function sleep(ms) {
14039
14063
  return new Promise((resolve) => setTimeout(resolve, ms));
14040
14064
  }
14041
- function isRetryableError(error, retryableErrors = DEFAULT_RETRY_CONFIG.retryableErrors) {
14065
+ function isRetryableError(error, retryableErrors = exports.DEFAULT_RETRY_CONFIG.retryableErrors) {
14042
14066
  if (!error)
14043
14067
  return false;
14044
- const classification = classifyError(error);
14068
+ const classification = (0, error_classification_1.classifyError)(error);
14045
14069
  if (classification.isRetryable !== void 0) {
14046
- debugInfo("ERROR_CLASSIFICATION", `Error classified as: ${classification.category} (retryable: ${classification.isRetryable})`);
14070
+ (0, debug_logger_1.debugInfo)("ERROR_CLASSIFICATION", `Error classified as: ${classification.category} (retryable: ${classification.isRetryable})`);
14047
14071
  return classification.isRetryable;
14048
14072
  }
14049
14073
  const errorMessage = error.message || error.toString() || "";
14050
14074
  const errorLower = errorMessage.toLowerCase();
14051
- return retryableErrors.some(
14052
- (pattern) => errorLower.includes(pattern.toLowerCase())
14053
- );
14075
+ return retryableErrors.some((pattern) => errorLower.includes(pattern.toLowerCase()));
14054
14076
  }
14055
14077
  function calculateDelay(attempt, config) {
14056
- const exponentialDelay = Math.min(
14057
- config.initialDelayMs * Math.pow(config.backoffMultiplier, attempt - 1),
14058
- config.maxDelayMs
14059
- );
14078
+ const exponentialDelay = Math.min(config.initialDelayMs * Math.pow(config.backoffMultiplier, attempt - 1), config.maxDelayMs);
14060
14079
  const jitter = exponentialDelay * 0.25 * (Math.random() - 0.5);
14061
14080
  return Math.max(100, exponentialDelay + jitter);
14062
14081
  }
14063
14082
  async function withRetry(operation, config = {}, operationName = "operation") {
14064
- let finalConfig = { ...DEFAULT_RETRY_CONFIG, ...config };
14065
- const tracker = new PerformanceTracker(`Retry ${operationName}`);
14083
+ let finalConfig = { ...exports.DEFAULT_RETRY_CONFIG, ...config };
14084
+ const tracker = new debug_logger_1.PerformanceTracker(`Retry ${operationName}`);
14066
14085
  let lastError;
14067
14086
  let errorClassification = null;
14068
14087
  for (let attempt = 1; attempt <= finalConfig.maxAttempts; attempt++) {
14069
14088
  try {
14070
- debugInfo("RETRY", `\u{1F504} [${operationName}] Attempt ${attempt}/${finalConfig.maxAttempts}`);
14089
+ (0, debug_logger_1.debugInfo)("RETRY", `\u{1F504} [${operationName}] Attempt ${attempt}/${finalConfig.maxAttempts}`);
14071
14090
  const startTime = Date.now();
14072
14091
  const result = await operation();
14073
14092
  const duration = Date.now() - startTime;
14074
- debugInfo("RETRY", `\u2705 [${operationName}] Success after ${duration}ms (attempt ${attempt})`);
14075
- networkMetrics.recordRequest(operationName, true, duration);
14093
+ (0, debug_logger_1.debugInfo)("RETRY", `\u2705 [${operationName}] Success after ${duration}ms (attempt ${attempt})`);
14094
+ debug_logger_1.networkMetrics.recordRequest(operationName, true, duration);
14076
14095
  tracker.end(true);
14077
14096
  return result;
14078
14097
  } catch (error) {
14079
14098
  lastError = error;
14080
14099
  const errorMessage = error?.message || error?.toString() || "Unknown error";
14081
- errorClassification = classifyError(error);
14100
+ errorClassification = (0, error_classification_1.classifyError)(error);
14082
14101
  if (attempt === 1 && errorClassification) {
14083
- const intelligentConfig = getRetryConfigFromClassification(errorClassification);
14102
+ const intelligentConfig = (0, error_classification_1.getRetryConfigFromClassification)(errorClassification);
14084
14103
  finalConfig = {
14085
14104
  ...finalConfig,
14086
14105
  ...intelligentConfig,
14087
14106
  maxAttempts: Math.min(finalConfig.maxAttempts, intelligentConfig.maxAttempts)
14088
14107
  };
14089
- debugInfo("RETRY", `\u{1F9E0} Intelligent retry strategy applied: ${errorClassification.category} (${errorClassification.retryStrategy})`);
14090
- debugInfo("RETRY", `\u{1F4CA} Adjusted config: max=${finalConfig.maxAttempts}, delay=${finalConfig.initialDelayMs}ms`);
14108
+ (0, debug_logger_1.debugInfo)("RETRY", `\u{1F9E0} Intelligent retry strategy applied: ${errorClassification.category} (${errorClassification.retryStrategy})`);
14109
+ (0, debug_logger_1.debugInfo)("RETRY", `\u{1F4CA} Adjusted config: max=${finalConfig.maxAttempts}, delay=${finalConfig.initialDelayMs}ms`);
14091
14110
  }
14092
- debugWarn("RETRY", `\u26A0\uFE0F [${operationName}] Attempt ${attempt} failed:`, {
14111
+ (0, debug_logger_1.debugWarn)("RETRY", `\u26A0\uFE0F [${operationName}] Attempt ${attempt} failed:`, {
14093
14112
  error: errorMessage,
14094
14113
  attempt,
14095
14114
  category: errorClassification.category,
14096
14115
  retryable: errorClassification.isRetryable
14097
14116
  });
14098
- networkMetrics.recordRequest(operationName, false, 0, errorMessage);
14117
+ debug_logger_1.networkMetrics.recordRequest(operationName, false, 0, errorMessage);
14099
14118
  if (attempt >= finalConfig.maxAttempts) {
14100
- debugError("RETRY", `\u274C [${operationName}] All attempts failed. Last error:`, { error: errorMessage });
14119
+ (0, debug_logger_1.debugError)("RETRY", `\u274C [${operationName}] All attempts failed. Last error:`, { error: errorMessage });
14101
14120
  if (errorClassification) {
14102
- const errorReport = createErrorReport(error);
14103
- debugError("RETRY", `\u{1F4CB} Error Analysis Report:
14121
+ const errorReport = (0, error_classification_1.createErrorReport)(error);
14122
+ (0, debug_logger_1.debugError)("RETRY", `\u{1F4CB} Error Analysis Report:
14104
14123
  ${errorReport}`);
14105
14124
  }
14106
14125
  tracker.end(false);
14107
14126
  break;
14108
14127
  }
14109
14128
  if (!errorClassification.isRetryable) {
14110
- debugError("RETRY", `\u{1F6AB} [${operationName}] Non-retryable error (${errorClassification.category}):`, { error: errorMessage });
14129
+ (0, debug_logger_1.debugError)("RETRY", `\u{1F6AB} [${operationName}] Non-retryable error (${errorClassification.category}):`, { error: errorMessage });
14111
14130
  if (errorClassification.troubleshooting) {
14112
- debugInfo("RETRY", `\u{1F4A1} Troubleshooting suggestions:
14131
+ (0, debug_logger_1.debugInfo)("RETRY", `\u{1F4A1} Troubleshooting suggestions:
14113
14132
  ${errorClassification.troubleshooting.join("\n ")}`);
14114
14133
  }
14115
14134
  tracker.end(false);
14116
14135
  break;
14117
14136
  }
14118
14137
  const delayMs = calculateDelay(attempt, finalConfig);
14119
- debugInfo("RETRY", `\u23F3 [${operationName}] Waiting ${delayMs}ms before retry... (${errorClassification.retryStrategy} strategy)`);
14138
+ (0, debug_logger_1.debugInfo)("RETRY", `\u23F3 [${operationName}] Waiting ${delayMs}ms before retry... (${errorClassification.retryStrategy} strategy)`);
14120
14139
  await sleep(delayMs);
14121
14140
  }
14122
14141
  }
@@ -14124,44 +14143,36 @@ ${errorReport}`);
14124
14143
  }
14125
14144
  async function connectLitNodeClient(litNodeClient, config = {}) {
14126
14145
  const network = litNodeClient?.config?.litNetwork || "unknown";
14127
- return withRetry(
14128
- async () => {
14129
- if (!litNodeClient) {
14130
- throw new Error("LIT Node Client is null or undefined");
14131
- }
14132
- const startTime = Date.now();
14133
- logConnectionAttempt(network, 1, config.maxAttempts || DEFAULT_RETRY_CONFIG.maxAttempts);
14134
- await litNodeClient.connect();
14135
- debugInfo("CONNECTION", `\u23F3 Waiting for LIT Node Client to be ready...`);
14136
- const readyTimeout = 3e4;
14137
- const readyStartTime = Date.now();
14138
- while (!litNodeClient.ready && Date.now() - readyStartTime < readyTimeout) {
14139
- await sleep(500);
14140
- }
14141
- if (!litNodeClient.ready) {
14142
- throw new Error(`LIT Node Client failed to become ready within ${readyTimeout}ms`);
14143
- }
14144
- const latency = Date.now() - startTime;
14145
- debugInfo("CONNECTION", `\u2705 LIT Node Client is ready (${litNodeClient.ready})`);
14146
- logConnectionSuccess(network, latency);
14147
- },
14148
- config,
14149
- "LIT Node Client Connection"
14150
- );
14146
+ return withRetry(async () => {
14147
+ if (!litNodeClient) {
14148
+ throw new Error("LIT Node Client is null or undefined");
14149
+ }
14150
+ const startTime = Date.now();
14151
+ (0, debug_logger_1.logConnectionAttempt)(network, 1, config.maxAttempts || exports.DEFAULT_RETRY_CONFIG.maxAttempts);
14152
+ await litNodeClient.connect();
14153
+ (0, debug_logger_1.debugInfo)("CONNECTION", `\u23F3 Waiting for LIT Node Client to be ready...`);
14154
+ const readyTimeout = 3e4;
14155
+ const readyStartTime = Date.now();
14156
+ while (!litNodeClient.ready && Date.now() - readyStartTime < readyTimeout) {
14157
+ await sleep(500);
14158
+ }
14159
+ if (!litNodeClient.ready) {
14160
+ throw new Error(`LIT Node Client failed to become ready within ${readyTimeout}ms`);
14161
+ }
14162
+ const latency = Date.now() - startTime;
14163
+ (0, debug_logger_1.debugInfo)("CONNECTION", `\u2705 LIT Node Client is ready (${litNodeClient.ready})`);
14164
+ (0, debug_logger_1.logConnectionSuccess)(network, latency);
14165
+ }, config, "LIT Node Client Connection");
14151
14166
  }
14152
14167
  async function connectLitContracts(litContracts, config = {}) {
14153
- return withRetry(
14154
- async () => {
14155
- if (!litContracts) {
14156
- throw new Error("LIT Contracts is null or undefined");
14157
- }
14158
- console.log(`\u{1F517} Connecting to LIT Contracts: ${litContracts.network || "unknown"}`);
14159
- await litContracts.connect();
14160
- console.log("\u2705 LIT Contracts connected successfully");
14161
- },
14162
- config,
14163
- "LIT Contracts Connection"
14164
- );
14168
+ return withRetry(async () => {
14169
+ if (!litContracts) {
14170
+ throw new Error("LIT Contracts is null or undefined");
14171
+ }
14172
+ console.log(`\u{1F517} Connecting to LIT Contracts: ${litContracts.network || "unknown"}`);
14173
+ await litContracts.connect();
14174
+ console.log("\u2705 LIT Contracts connected successfully");
14175
+ }, config, "LIT Contracts Connection");
14165
14176
  }
14166
14177
  async function validateLitNodeConnection(litNodeClient) {
14167
14178
  try {
@@ -14181,37 +14192,33 @@ ${errorReport}`);
14181
14192
  }
14182
14193
  async function generateSessionSignatures(litNodeClient, sessionConfig, config = {}, pkpTokenId, litActionCid, signerAddress, network = "chipotle") {
14183
14194
  if (pkpTokenId && litActionCid && signerAddress) {
14184
- const { sessionSignatureCache: sessionSignatureCache2 } = await Promise.resolve().then(() => (init_session_signature_cache(), session_signature_cache_exports));
14185
- const cached = sessionSignatureCache2.get(pkpTokenId, litActionCid, signerAddress, network);
14195
+ const { sessionSignatureCache } = await Promise.resolve().then(() => __importStar(require_session_signature_cache()));
14196
+ const cached = sessionSignatureCache.get(pkpTokenId, litActionCid, signerAddress, network);
14186
14197
  if (cached) {
14187
14198
  const sigCount = Object.keys(cached).length;
14188
- debugInfo("SESSION", `\u{1F504} Using cached session signatures (${sigCount} sigs)`);
14199
+ (0, debug_logger_1.debugInfo)("SESSION", `\u{1F504} Using cached session signatures (${sigCount} sigs)`);
14189
14200
  return cached;
14190
14201
  }
14191
14202
  }
14192
- return withRetry(
14193
- async () => {
14194
- debugInfo("SESSION", "\u{1F510} Generating new session signatures...");
14195
- const sessionSigs = await litNodeClient.getSessionSigs(sessionConfig);
14196
- const sigCount = Object.keys(sessionSigs).length;
14197
- if (pkpTokenId && litActionCid && signerAddress) {
14198
- const { sessionSignatureCache: sessionSignatureCache2 } = await Promise.resolve().then(() => (init_session_signature_cache(), session_signature_cache_exports));
14199
- const expiration = new Date(sessionConfig.expiration);
14200
- sessionSignatureCache2.set(pkpTokenId, litActionCid, signerAddress, network, sessionSigs, expiration);
14201
- }
14202
- debugInfo("SESSION", `\u2705 Generated ${sigCount} session signatures`);
14203
- return sessionSigs;
14204
- },
14205
- config,
14206
- "Session Signature Generation"
14207
- );
14203
+ return withRetry(async () => {
14204
+ (0, debug_logger_1.debugInfo)("SESSION", "\u{1F510} Generating new session signatures...");
14205
+ const sessionSigs = await litNodeClient.getSessionSigs(sessionConfig);
14206
+ const sigCount = Object.keys(sessionSigs).length;
14207
+ if (pkpTokenId && litActionCid && signerAddress) {
14208
+ const { sessionSignatureCache } = await Promise.resolve().then(() => __importStar(require_session_signature_cache()));
14209
+ const expiration = new Date(sessionConfig.expiration);
14210
+ sessionSignatureCache.set(pkpTokenId, litActionCid, signerAddress, network, sessionSigs, expiration);
14211
+ }
14212
+ (0, debug_logger_1.debugInfo)("SESSION", `\u2705 Generated ${sigCount} session signatures`);
14213
+ return sessionSigs;
14214
+ }, config, "Session Signature Generation");
14208
14215
  }
14209
14216
  async function validateLitNodeReadiness(litNodeClient) {
14210
14217
  if (!litNodeClient) {
14211
14218
  throw new Error("LIT Node Client is null or undefined");
14212
14219
  }
14213
14220
  if (!litNodeClient.ready) {
14214
- debugWarn("CONNECTION", "\u26A0\uFE0F LIT Node Client not ready, attempting to reconnect...");
14221
+ (0, debug_logger_1.debugWarn)("CONNECTION", "\u26A0\uFE0F LIT Node Client not ready, attempting to reconnect...");
14215
14222
  await litNodeClient.connect();
14216
14223
  const readyTimeout = 15e3;
14217
14224
  const startTime = Date.now();
@@ -14222,36 +14229,32 @@ ${errorReport}`);
14222
14229
  throw new Error("LIT Node Client is not ready for operations");
14223
14230
  }
14224
14231
  }
14225
- debugInfo("CONNECTION", "\u2705 LIT Node Client readiness validated");
14232
+ (0, debug_logger_1.debugInfo)("CONNECTION", "\u2705 LIT Node Client readiness validated");
14226
14233
  }
14227
14234
  async function executeLitAction(litNodeClient, executionConfig, config = {}) {
14228
14235
  const cid = executionConfig.ipfsId;
14229
- return withRetry(
14230
- async () => {
14231
- const startTime = Date.now();
14232
- await validateLitNodeReadiness(litNodeClient);
14233
- logLitActionExecution(cid, executionConfig.jsParams);
14234
- logRequest("LIT_ACTION", "executeJs", executionConfig);
14235
- const result = await litNodeClient.executeJs(executionConfig);
14236
- const duration = Date.now() - startTime;
14237
- if (!result.response) {
14238
- logError("LIT_ACTION", "executeJs", new Error("No response from LIT Action"), duration);
14239
- throw new Error("No response from LIT Action");
14240
- }
14241
- logResponse("LIT_ACTION", "executeJs", result, duration);
14242
- logLitActionResult(cid, true, duration, result);
14243
- return result;
14244
- },
14245
- config,
14246
- "LIT Action Execution"
14247
- );
14236
+ return withRetry(async () => {
14237
+ const startTime = Date.now();
14238
+ await validateLitNodeReadiness(litNodeClient);
14239
+ (0, debug_logger_1.logLitActionExecution)(cid, executionConfig.jsParams);
14240
+ (0, debug_logger_1.logRequest)("LIT_ACTION", "executeJs", executionConfig);
14241
+ const result = await litNodeClient.executeJs(executionConfig);
14242
+ const duration = Date.now() - startTime;
14243
+ if (!result.response) {
14244
+ (0, debug_logger_1.logError)("LIT_ACTION", "executeJs", new Error("No response from LIT Action"), duration);
14245
+ throw new Error("No response from LIT Action");
14246
+ }
14247
+ (0, debug_logger_1.logResponse)("LIT_ACTION", "executeJs", result, duration);
14248
+ (0, debug_logger_1.logLitActionResult)(cid, true, duration, result);
14249
+ return result;
14250
+ }, config, "LIT Action Execution");
14248
14251
  }
14249
14252
  async function executePkpOperation(operation, operationName, config = {}) {
14250
14253
  const pkpConfig = {
14251
- ...DEFAULT_RETRY_CONFIG,
14254
+ ...exports.DEFAULT_RETRY_CONFIG,
14252
14255
  ...config,
14253
14256
  retryableErrors: [
14254
- ...DEFAULT_RETRY_CONFIG.retryableErrors,
14257
+ ...exports.DEFAULT_RETRY_CONFIG.retryableErrors,
14255
14258
  "pkp validation",
14256
14259
  "signing shares",
14257
14260
  "resource validation",
@@ -14260,7 +14263,7 @@ ${errorReport}`);
14260
14263
  };
14261
14264
  return withRetry(operation, pkpConfig, `PKP ${operationName}`);
14262
14265
  }
14263
- var NETWORK_TIMEOUTS = {
14266
+ exports.NETWORK_TIMEOUTS = {
14264
14267
  chipotle: {
14265
14268
  connection: 6e4,
14266
14269
  operation: 12e4,
@@ -14268,10 +14271,82 @@ ${errorReport}`);
14268
14271
  }
14269
14272
  };
14270
14273
  function getNetworkTimeouts(network) {
14271
- return NETWORK_TIMEOUTS[network] || NETWORK_TIMEOUTS["chipotle"];
14274
+ return exports.NETWORK_TIMEOUTS[network] || exports.NETWORK_TIMEOUTS["chipotle"];
14272
14275
  }
14273
- init_debug_logger();
14274
- init_session_signature_cache();
14276
+ }
14277
+ });
14278
+
14279
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/index.js
14280
+ var require_utils4 = __commonJS({
14281
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/index.js"(exports) {
14282
+ "use strict";
14283
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
14284
+ if (k2 === void 0)
14285
+ k2 = k;
14286
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14287
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14288
+ desc = { enumerable: true, get: function() {
14289
+ return m[k];
14290
+ } };
14291
+ }
14292
+ Object.defineProperty(o, k2, desc);
14293
+ } : function(o, m, k, k2) {
14294
+ if (k2 === void 0)
14295
+ k2 = k;
14296
+ o[k2] = m[k];
14297
+ });
14298
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
14299
+ for (var p in m)
14300
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
14301
+ __createBinding(exports2, m, p);
14302
+ };
14303
+ Object.defineProperty(exports, "__esModule", { value: true });
14304
+ __exportStar(require_lit_action_helpers(), exports);
14305
+ __exportStar(require_pkp_setup(), exports);
14306
+ __exportStar(require_cid_utils(), exports);
14307
+ __exportStar(require_connection_helpers(), exports);
14308
+ __exportStar(require_debug_logger(), exports);
14309
+ __exportStar(require_error_classification(), exports);
14310
+ __exportStar(require_session_signature_cache(), exports);
14311
+ }
14312
+ });
14313
+
14314
+ // node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/index.js
14315
+ var require_pkg_src = __commonJS({
14316
+ "node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/index.js"(exports) {
14317
+ "use strict";
14318
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
14319
+ if (k2 === void 0)
14320
+ k2 = k;
14321
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14322
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14323
+ desc = { enumerable: true, get: function() {
14324
+ return m[k];
14325
+ } };
14326
+ }
14327
+ Object.defineProperty(o, k2, desc);
14328
+ } : function(o, m, k, k2) {
14329
+ if (k2 === void 0)
14330
+ k2 = k;
14331
+ o[k2] = m[k];
14332
+ });
14333
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
14334
+ for (var p in m)
14335
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
14336
+ __createBinding(exports2, m, p);
14337
+ };
14338
+ Object.defineProperty(exports, "__esModule", { value: true });
14339
+ exports.CHIPOTLE_DEPLOYMENTS = exports.DH_LIT_ACTIONS_CHIPOTLE = void 0;
14340
+ __exportStar(require_interfaces(), exports);
14341
+ __exportStar(require_lit_actions_registry(), exports);
14342
+ __exportStar(require_utils4(), exports);
14343
+ var lit_actions_registry_1 = require_lit_actions_registry();
14344
+ Object.defineProperty(exports, "DH_LIT_ACTIONS_CHIPOTLE", { enumerable: true, get: function() {
14345
+ return lit_actions_registry_1.DH_LIT_ACTIONS_CHIPOTLE;
14346
+ } });
14347
+ Object.defineProperty(exports, "CHIPOTLE_DEPLOYMENTS", { enumerable: true, get: function() {
14348
+ return lit_actions_registry_1.CHIPOTLE_DEPLOYMENTS;
14349
+ } });
14275
14350
  }
14276
14351
  });
14277
14352
 
@@ -14552,66 +14627,68 @@ var init_deployment_addresses = __esm({
14552
14627
  LOCALHOST_DEPLOYMENT = {
14553
14628
  network: "localhost",
14554
14629
  chainId: 31337,
14555
- timestamp: "2026-03-23T15:33:34.068Z",
14630
+ timestamp: "2026-04-29T14:55:27.529Z",
14556
14631
  deployer: "",
14557
14632
  contracts: {
14558
- MessageHashBuilder: "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
14559
- UpgradeValidator: "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318",
14633
+ MessageHashBuilder: "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
14634
+ UpgradeValidator: "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
14560
14635
  UCDToken: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
14561
14636
  UCDController: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
14562
- PositionManagerCoreModule: "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
14563
- TermManagerModule: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
14564
- LoanOperationsManagerModule: "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
14637
+ PositionManagerCoreModule: "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0",
14638
+ TermManagerModule: "0x9A676e781A523b5d0C0e43731313A708CB607508",
14639
+ LoanOperationsManagerModule: "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
14565
14640
  BTCSpendAuthorizer: "0x59b670e9fA9D0A427751Af201D676719a970857b",
14566
14641
  CollateralManagerModule: "0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f",
14567
14642
  LiquidationManagerModule: "0x7a2088a1bFc9d81c55368AE168C2C02570cB814F",
14568
- CircuitBreakerModule: "0x0B306BF915C4d645ff596e518fAf3F9669b97016",
14643
+ CircuitBreakerModule: "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
14569
14644
  AdminModule: "0xc5a5C42992dECbae36851359345FE25997F5C42d",
14570
- PositionManagerViews: "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
14571
- PositionManager: "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
14572
- OperationAuthorizationRegistry: "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0",
14573
- PKPValidation: "0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc"
14645
+ PositionManagerViews: "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
14646
+ PositionManager: "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
14647
+ OperationAuthorizationRegistry: "0x5081a39b8A5f0E35a8D959395a630b68B74Dd30f",
14648
+ PKPValidation: "0x04C89607413713Ec9775E14b954286519d836FEf"
14574
14649
  },
14575
14650
  latestEnv: {
14576
14651
  UCD_TOKEN: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
14577
14652
  UCD_CONTROLLER: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
14578
- POSITION_MANAGER: "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
14579
- PKP_VALIDATION_REGISTRY: "0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc",
14580
- PKP_VALIDATION_CID_V1: "QmfHJKA4RnW7RepsdLmrDwKjVTzPXB2K3qMTco3JNPDexm",
14581
- PKP_ETH_ADDRESS: "0x9624C46073E1d1F5AB975c67Fc899536d599bb57",
14582
- OPERATION_AUTHORIZATION_REGISTRY: "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0",
14583
- UCD_MINT_VALIDATOR_ADDRESS: "0x80f81afb9e6dF27afCD752ad46cD286e705e42be",
14653
+ POSITION_MANAGER: "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
14654
+ PKP_VALIDATION_REGISTRY: "0x04C89607413713Ec9775E14b954286519d836FEf",
14655
+ PKP_VALIDATION_CID_V1: "0x12209630a978a5711aafd1a6a676ad85dcde8817a181a8c25a8067c23dad89f6ae3d",
14656
+ PKP_VALIDATION_CID_V3: "0x12209630a978a5711aafd1a6a676ad85dcde8817a181a8c25a8067c23dad89f6ae3d",
14657
+ PKP_ETH_ADDRESS: "0x9eE56687F7a984D5DF7aB79330271a619ef56DdD",
14658
+ OPERATION_AUTHORIZATION_REGISTRY: "0x5081a39b8A5f0E35a8D959395a630b68B74Dd30f",
14659
+ UCD_MINT_VALIDATOR_ADDRESS: "0x4D9299055093938d0CD2F26C42A87260CB50adD8",
14584
14660
  UCD_MINT_VALIDATOR_VERSION: 1,
14585
- BTC_WITHDRAWAL_VALIDATOR_ADDRESS: "0xa751ad81E1CAe61d6cF5Cf64839Fe8D28A1372Df",
14661
+ BTC_WITHDRAWAL_VALIDATOR_ADDRESS: "0x7b9316cAA00B257F7CE30F7F6979bd6867BA9eE2",
14586
14662
  BTC_WITHDRAWAL_VALIDATOR_VERSION: 1,
14587
- UPDATE_BALANCE_VALIDATOR_ADDRESS: "0x8A40C22B03348bc10df9ae0dc54346b4AE8e909c",
14663
+ UPDATE_BALANCE_VALIDATOR_ADDRESS: "0x7b9316cAA00B257F7CE30F7F6979bd6867BA9eE2",
14588
14664
  UPDATE_BALANCE_VALIDATOR_VERSION: 1,
14589
- PROCESS_PAYMENT_VALIDATOR_ADDRESS: "0x28f50E07532d3aF677b8E0bcF220422d159b0dd6",
14665
+ PROCESS_PAYMENT_VALIDATOR_ADDRESS: "0x440Fd7B157766b95eb551825C06DF4f92E41D55b",
14590
14666
  PROCESS_PAYMENT_VALIDATOR_VERSION: 1,
14591
- EXTEND_POSITION_VALIDATOR_ADDRESS: "0xc7aC43F2F907123465449575e853f5D0229898e1",
14667
+ EXTEND_POSITION_VALIDATOR_ADDRESS: "0x4cb7651Ba27610991A5775486B5F4487F3Dd7cDA",
14592
14668
  EXTEND_POSITION_VALIDATOR_VERSION: 1,
14593
- POSITION_MANAGER_CORE_MODULE: "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
14594
- LOAN_OPERATIONS_MANAGER_MODULE: "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
14595
- TERM_MANAGER_MODULE: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82"
14669
+ POSITION_MANAGER_CORE_MODULE: "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0",
14670
+ LOAN_OPERATIONS_MANAGER_MODULE: "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
14671
+ TERM_MANAGER_MODULE: "0x9A676e781A523b5d0C0e43731313A708CB607508",
14672
+ COMMUNITY_MANAGER_MODULE: ""
14596
14673
  }
14597
14674
  };
14598
14675
  LOCALHOST_CONTRACTS = {
14599
- MessageHashBuilder: "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
14600
- UpgradeValidator: "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318",
14676
+ MessageHashBuilder: "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
14677
+ UpgradeValidator: "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
14601
14678
  UCDToken: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
14602
14679
  UCDController: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
14603
- PositionManagerCoreModule: "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
14604
- TermManagerModule: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
14605
- LoanOperationsManagerModule: "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
14680
+ PositionManagerCoreModule: "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0",
14681
+ TermManagerModule: "0x9A676e781A523b5d0C0e43731313A708CB607508",
14682
+ LoanOperationsManagerModule: "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
14606
14683
  BTCSpendAuthorizer: "0x59b670e9fA9D0A427751Af201D676719a970857b",
14607
14684
  CollateralManagerModule: "0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f",
14608
14685
  LiquidationManagerModule: "0x7a2088a1bFc9d81c55368AE168C2C02570cB814F",
14609
- CircuitBreakerModule: "0x0B306BF915C4d645ff596e518fAf3F9669b97016",
14686
+ CircuitBreakerModule: "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
14610
14687
  AdminModule: "0xc5a5C42992dECbae36851359345FE25997F5C42d",
14611
- PositionManagerViews: "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
14612
- PositionManager: "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
14613
- OperationAuthorizationRegistry: "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0",
14614
- PKPValidation: "0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc"
14688
+ PositionManagerViews: "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
14689
+ PositionManager: "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
14690
+ OperationAuthorizationRegistry: "0x5081a39b8A5f0E35a8D959395a630b68B74Dd30f",
14691
+ PKPValidation: "0x04C89607413713Ec9775E14b954286519d836FEf"
14615
14692
  };
14616
14693
  ALL_DEPLOYMENTS = {
14617
14694
  sepolia: SEPOLIA_DEPLOYMENT,
@@ -14937,7 +15014,7 @@ __export(src_exports, {
14937
15014
  ErrorSeverity: () => ErrorSeverity,
14938
15015
  EventHelpers: () => EventHelpers,
14939
15016
  LOCALHOST_CONTRACTS: () => LOCALHOST_CONTRACTS,
14940
- LRUCache: () => LRUCache,
15017
+ LRUCache: () => Cache,
14941
15018
  LoanCreator: () => LoanCreator,
14942
15019
  LoanQuery: () => LoanQuery,
14943
15020
  LoanStatus: () => LoanStatus,
@@ -31807,333 +31884,106 @@ function createContractManager(config) {
31807
31884
  }
31808
31885
 
31809
31886
  // src/modules/cache/cache-manager.module.ts
31810
- var LRUCache = class {
31811
- cache;
31887
+ var Cache = class {
31888
+ cache = /* @__PURE__ */ new Map();
31812
31889
  maxSize;
31813
31890
  ttlMs;
31814
- debug;
31815
- name;
31816
- // Statistics
31817
- stats = {
31818
- hits: 0,
31819
- misses: 0,
31820
- evictions: 0
31821
- };
31822
- constructor(config = {}) {
31823
- this.cache = /* @__PURE__ */ new Map();
31824
- this.maxSize = config.maxSize || 1e3;
31825
- this.ttlMs = config.ttlMs || 6e4;
31826
- this.debug = config.debug || false;
31827
- this.name = config.name || "Cache";
31828
- if (this.debug) {
31829
- console.log(
31830
- `\u{1F4BE} [${this.name}] Initialized: maxSize=${this.maxSize}, ttl=${this.ttlMs}ms`
31831
- );
31832
- }
31891
+ constructor(config) {
31892
+ this.maxSize = config.maxSize;
31893
+ this.ttlMs = config.ttlMs;
31833
31894
  }
31834
31895
  /**
31835
31896
  * Get value from cache
31836
- *
31837
- * Returns null if:
31838
- * - Key not found
31839
- * - Entry has expired
31840
- *
31841
- * @param key - Cache key
31842
- * @returns Cached value or null
31843
31897
  */
31844
31898
  get(key2) {
31845
31899
  const entry = this.cache.get(key2);
31846
31900
  if (!entry) {
31847
- this.stats.misses++;
31848
- if (this.debug) {
31849
- console.log(`\u274C [${this.name}] Cache MISS: ${String(key2)}`);
31850
- }
31851
- return null;
31901
+ return void 0;
31852
31902
  }
31853
- if (this.isExpired(entry)) {
31903
+ const now2 = Date.now();
31904
+ if (now2 - entry.timestamp > entry.ttl) {
31854
31905
  this.cache.delete(key2);
31855
- this.stats.misses++;
31856
- if (this.debug) {
31857
- const age = Date.now() - entry.timestamp;
31858
- console.log(`\u23F0 [${this.name}] Cache EXPIRED: ${String(key2)} (age: ${age}ms)`);
31859
- }
31860
- return null;
31861
- }
31862
- entry.hits++;
31863
- entry.lastAccessed = Date.now();
31864
- this.cache.set(key2, entry);
31865
- this.stats.hits++;
31866
- if (this.debug) {
31867
- const age = Date.now() - entry.timestamp;
31868
- console.log(
31869
- `\u2705 [${this.name}] Cache HIT: ${String(key2)} (age: ${age}ms, hits: ${entry.hits})`
31870
- );
31906
+ return void 0;
31871
31907
  }
31872
31908
  return entry.value;
31873
31909
  }
31874
- /**
31875
- * Get value from cache with Result wrapper
31876
- *
31877
- * Useful when you want to distinguish between "not found" and "expired"
31878
- */
31879
- getResult(key2) {
31880
- const value = this.get(key2);
31881
- if (value === null) {
31882
- return failure(
31883
- new SDKError({
31884
- message: `Cache miss for key: ${String(key2)}`,
31885
- category: "CACHE" /* CACHE */,
31886
- severity: "LOW" /* LOW */,
31887
- originalError: new Error("Cache miss")
31888
- })
31889
- );
31890
- }
31891
- return success(value);
31892
- }
31893
31910
  /**
31894
31911
  * Set value in cache
31895
- *
31896
- * If cache is full, evicts the least recently used entry
31897
- *
31898
- * @param key - Cache key
31899
- * @param value - Value to cache
31900
- * @param ttl - Optional custom TTL for this entry (ms)
31901
31912
  */
31902
31913
  set(key2, value, ttl) {
31903
31914
  if (this.cache.size >= this.maxSize && !this.cache.has(key2)) {
31904
- this.evictLRU();
31915
+ const firstKey = this.cache.keys().next().value;
31916
+ if (firstKey) {
31917
+ this.cache.delete(firstKey);
31918
+ }
31905
31919
  }
31906
- const entry = {
31920
+ this.cache.set(key2, {
31907
31921
  value,
31908
31922
  timestamp: Date.now(),
31909
- hits: 0,
31910
- lastAccessed: Date.now()
31911
- };
31912
- this.cache.set(key2, entry);
31913
- if (this.debug) {
31914
- const effectiveTtl = ttl || this.ttlMs;
31915
- console.log(
31916
- `\u{1F4BE} [${this.name}] Cache SET: ${String(key2)} (ttl: ${effectiveTtl}ms, size: ${this.cache.size}/${this.maxSize})`
31917
- );
31918
- }
31919
- }
31920
- /**
31921
- * Set value in cache with Result wrapper
31922
- */
31923
- setResult(key2, value, ttl) {
31924
- try {
31925
- this.set(key2, value, ttl);
31926
- return success(void 0);
31927
- } catch (error) {
31928
- return failure(
31929
- new SDKError({
31930
- message: `Failed to set cache value for key: ${String(key2)}`,
31931
- category: "CACHE" /* CACHE */,
31932
- severity: "MEDIUM" /* MEDIUM */,
31933
- originalError: error instanceof Error ? error : new Error(String(error))
31934
- })
31935
- );
31936
- }
31923
+ ttl: ttl || this.ttlMs
31924
+ });
31937
31925
  }
31938
31926
  /**
31939
- * Check if key exists in cache (without affecting stats)
31927
+ * Check if key exists in cache
31940
31928
  */
31941
31929
  has(key2) {
31942
- const entry = this.cache.get(key2);
31943
- return entry !== void 0 && !this.isExpired(entry);
31930
+ return this.get(key2) !== void 0;
31944
31931
  }
31945
31932
  /**
31946
- * Delete specific key from cache
31933
+ * Delete key from cache
31947
31934
  */
31948
31935
  delete(key2) {
31949
- const deleted = this.cache.delete(key2);
31950
- if (deleted && this.debug) {
31951
- console.log(`\u{1F5D1}\uFE0F [${this.name}] Cache DELETE: ${String(key2)}`);
31952
- }
31953
- return deleted;
31936
+ return this.cache.delete(key2);
31954
31937
  }
31955
31938
  /**
31956
- * Clear entire cache
31939
+ * Clear all cache entries
31957
31940
  */
31958
31941
  clear() {
31959
- const previousSize = this.cache.size;
31960
31942
  this.cache.clear();
31961
- this.stats = {
31962
- hits: 0,
31963
- misses: 0,
31964
- evictions: 0
31965
- };
31966
- if (this.debug) {
31967
- console.log(`\u{1F9F9} [${this.name}] Cache CLEARED: removed ${previousSize} entries`);
31968
- }
31969
- }
31970
- /**
31971
- * Get current cache size
31972
- */
31973
- size() {
31974
- return this.cache.size;
31975
- }
31976
- /**
31977
- * Get cache statistics
31978
- */
31979
- getStats() {
31980
- const entries = Array.from(this.cache.values());
31981
- const timestamps = entries.map((e) => e.timestamp);
31982
- const total = this.stats.hits + this.stats.misses;
31983
- const hitRate = total === 0 ? 0 : this.stats.hits / total * 100;
31984
- return {
31985
- size: this.cache.size,
31986
- hits: this.stats.hits,
31987
- misses: this.stats.misses,
31988
- evictions: this.stats.evictions,
31989
- oldestEntry: timestamps.length > 0 ? Math.min(...timestamps) : 0,
31990
- newestEntry: timestamps.length > 0 ? Math.max(...timestamps) : 0,
31991
- hitRate
31992
- };
31993
- }
31994
- /**
31995
- * Get hit rate percentage
31996
- */
31997
- getHitRate() {
31998
- const total = this.stats.hits + this.stats.misses;
31999
- return total === 0 ? 0 : this.stats.hits / total * 100;
32000
- }
32001
- /**
32002
- * Get all cached keys (for debugging)
32003
- */
32004
- getKeys() {
32005
- return Array.from(this.cache.keys());
32006
- }
32007
- /**
32008
- * Get all cached values (for debugging)
32009
- */
32010
- getValues() {
32011
- return Array.from(this.cache.values()).map((entry) => entry.value);
32012
- }
32013
- /**
32014
- * Get all cache entries with metadata (for debugging)
32015
- */
32016
- getEntries() {
32017
- return Array.from(this.cache.entries()).map(([key2, entry]) => ({
32018
- key: key2,
32019
- value: entry.value,
32020
- metadata: {
32021
- timestamp: entry.timestamp,
32022
- hits: entry.hits,
32023
- lastAccessed: entry.lastAccessed
32024
- }
32025
- }));
32026
31943
  }
32027
31944
  /**
32028
- * Clean up expired entries
32029
- *
32030
- * Useful for periodic maintenance
32031
- *
32032
- * @returns Number of entries cleaned
31945
+ * Clean expired entries
32033
31946
  */
32034
31947
  cleanExpired() {
32035
31948
  const now2 = Date.now();
32036
- let cleanedCount = 0;
31949
+ let cleaned = 0;
32037
31950
  for (const [key2, entry] of this.cache.entries()) {
32038
- if (now2 - entry.timestamp > this.ttlMs) {
31951
+ if (now2 - entry.timestamp > entry.ttl) {
32039
31952
  this.cache.delete(key2);
32040
- cleanedCount++;
32041
- }
32042
- }
32043
- if (cleanedCount > 0 && this.debug) {
32044
- console.log(`\u{1F9F9} [${this.name}] Cleaned ${cleanedCount} expired entries`);
32045
- }
32046
- return cleanedCount;
32047
- }
32048
- /**
32049
- * Check if cache entry is expired
32050
- */
32051
- isExpired(entry) {
32052
- return Date.now() - entry.timestamp > this.ttlMs;
32053
- }
32054
- /**
32055
- * Evict least recently used entry
32056
- */
32057
- evictLRU() {
32058
- let oldestKey = null;
32059
- let oldestAccess = Infinity;
32060
- for (const [key2, entry] of this.cache.entries()) {
32061
- if (entry.lastAccessed < oldestAccess) {
32062
- oldestAccess = entry.lastAccessed;
32063
- oldestKey = key2;
32064
- }
32065
- }
32066
- if (oldestKey !== null) {
32067
- this.cache.delete(oldestKey);
32068
- this.stats.evictions++;
32069
- if (this.debug) {
32070
- const timeSinceAccess = Date.now() - oldestAccess;
32071
- console.log(
32072
- `\u267B\uFE0F [${this.name}] Cache EVICT (LRU): ${String(oldestKey)} (last accessed: ${timeSinceAccess}ms ago)`
32073
- );
31953
+ cleaned++;
32074
31954
  }
32075
31955
  }
31956
+ return cleaned;
32076
31957
  }
32077
31958
  /**
32078
- * Get or compute value
32079
- *
32080
- * If key exists in cache, returns cached value.
32081
- * Otherwise, computes value using provided function and caches it.
32082
- *
32083
- * @param key - Cache key
32084
- * @param compute - Function to compute value if not in cache
32085
- * @param ttl - Optional custom TTL for this entry
32086
- * @returns Cached or computed value
32087
- */
32088
- async getOrCompute(key2, compute, ttl) {
32089
- const cached = this.get(key2);
32090
- if (cached !== null) {
32091
- return cached;
32092
- }
32093
- const value = await compute();
32094
- this.set(key2, value, ttl);
32095
- return value;
32096
- }
32097
- /**
32098
- * Get or compute value with Result wrapper
31959
+ * Get cache statistics
32099
31960
  */
32100
- async getOrComputeResult(key2, compute, ttl) {
32101
- const cached = this.get(key2);
32102
- if (cached !== null) {
32103
- return success(cached);
32104
- }
32105
- const result = await compute();
32106
- if (result.success) {
32107
- this.set(key2, result.value, ttl);
32108
- }
32109
- return result;
31961
+ getStats() {
31962
+ return {
31963
+ size: this.cache.size,
31964
+ maxSize: this.maxSize,
31965
+ ttlMs: this.ttlMs
31966
+ };
32110
31967
  }
32111
31968
  };
32112
31969
  var CacheManager = class {
32113
31970
  caches = /* @__PURE__ */ new Map();
32114
- globalConfig;
32115
- constructor(globalConfig = {}) {
32116
- this.globalConfig = globalConfig;
31971
+ debug;
31972
+ constructor(config = {}) {
31973
+ this.debug = config.debug || false;
32117
31974
  }
32118
31975
  /**
32119
- * Create or get a named cache
32120
- *
32121
- * @param name - Unique cache name
32122
- * @param config - Optional cache-specific configuration
32123
- * @returns LRU cache instance
31976
+ * Get or create a cache instance
32124
31977
  */
32125
31978
  getCache(name, config) {
32126
- const existingCache = this.caches.get(name);
32127
- if (existingCache) {
32128
- return existingCache;
31979
+ if (this.caches.has(name)) {
31980
+ return this.caches.get(name);
32129
31981
  }
32130
- const mergedConfig = {
32131
- ...this.globalConfig,
32132
- ...config,
32133
- name
32134
- };
32135
- const cache = new LRUCache(mergedConfig);
31982
+ const cache = new Cache(config);
32136
31983
  this.caches.set(name, cache);
31984
+ if (this.debug) {
31985
+ console.log(`[CacheManager] Created cache: ${name}`, config);
31986
+ }
32137
31987
  return cache;
32138
31988
  }
32139
31989
  /**
@@ -32148,11 +31998,11 @@ var CacheManager = class {
32148
31998
  * Clean expired entries from all caches
32149
31999
  */
32150
32000
  cleanAllExpired() {
32151
- let totalCleaned = 0;
32001
+ let total = 0;
32152
32002
  for (const cache of this.caches.values()) {
32153
- totalCleaned += cache.cleanExpired();
32003
+ total += cache.cleanExpired();
32154
32004
  }
32155
- return totalCleaned;
32005
+ return total;
32156
32006
  }
32157
32007
  /**
32158
32008
  * Get statistics for all caches
@@ -32165,16 +32015,11 @@ var CacheManager = class {
32165
32015
  return stats;
32166
32016
  }
32167
32017
  /**
32168
- * Get list of all cache names
32169
- */
32170
- getCacheNames() {
32171
- return Array.from(this.caches.keys());
32172
- }
32173
- /**
32174
- * Delete a named cache
32018
+ * Destroy cache manager
32175
32019
  */
32176
- deleteCache(name) {
32177
- return this.caches.delete(name);
32020
+ destroy() {
32021
+ this.clearAll();
32022
+ this.caches.clear();
32178
32023
  }
32179
32024
  };
32180
32025
  function createCacheManager(config) {
@@ -36365,7 +36210,7 @@ var DiamondHandsGraph = class {
36365
36210
  }
36366
36211
 
36367
36212
  ${shouldQuery.mint ? `
36368
- ucdmintEvents(
36213
+ ucdMintEvents(
36369
36214
  ${buildPositionWhereClause()}
36370
36215
  first: $limit,
36371
36216
  orderBy: timestamp,
@@ -36554,7 +36399,7 @@ var DiamondHandsGraph = class {
36554
36399
  commitTimestamp: result.position.liquidation.commitTimestamp,
36555
36400
  revealDelay: result.position.liquidation.revealDelay
36556
36401
  } : void 0;
36557
- const mints = (result.ucdmintEvents || []).map((m) => ({
36402
+ const mints = (result.ucdMintEvents || []).map((m) => ({
36558
36403
  id: m.id,
36559
36404
  positionId,
36560
36405
  amount: m.amount,
@@ -41553,32 +41398,59 @@ Error data: ${errorData || "none"}`
41553
41398
  } catch (txError) {
41554
41399
  const txErrorMsg = txError instanceof Error ? txError.message : String(txError);
41555
41400
  if (this.config.debug) {
41556
- log.error("\u274C withdrawBTC transaction failed", {
41557
- error: txErrorMsg,
41558
- withdrawalParams,
41559
- signatureBytesLength: signatureBytes.length
41560
- });
41401
+ log.warn(
41402
+ "\u26A0\uFE0F withdrawBTC contract interface failed, falling back to raw transaction",
41403
+ { error: txErrorMsg }
41404
+ );
41561
41405
  }
41562
41406
  try {
41563
- const position = await this.getPosition(positionId);
41564
- const btcAmount = (Number(withdrawalAmount) / 1e8).toFixed(8);
41565
- const message = formatBTCWithdrawalFailureMessage(
41566
- btcAmount,
41567
- position?.vaultAddress || "unknown",
41568
- withdrawalAddress,
41569
- positionId
41570
- );
41571
- await this._relayNotification(message);
41572
- } catch (telegramError) {
41573
- console.error(
41574
- "Telegram notification failed:",
41575
- telegramError instanceof Error ? telegramError.message : String(telegramError)
41576
- );
41407
+ const contractAddress = this.getContractAddressesOrThrow().positionManager;
41408
+ const iface = new ethers_exports.utils.Interface([
41409
+ "function withdrawBTC((bytes32 positionId, bytes32 actionHash, bytes32 authorizedSpendsHash, bytes32 ucdDebtHash, bytes32 contractBundleHash, string withdrawalAddress, uint256 totalDeduction, uint256 newCollateral, uint256 quantumTimestamp, uint256 btcPrice, string utxoTxid, uint32 utxoVout) params, bytes withdrawalValidatorSignature, bytes btcSpendAuthSignature) external returns (bool)"
41410
+ ]);
41411
+ const calldata = iface.encodeFunctionData("withdrawBTC", [
41412
+ withdrawalParams,
41413
+ signatureBytes,
41414
+ btcSpendAuthBytes
41415
+ ]);
41416
+ const signer = this.getSignerOrThrow();
41417
+ tx = await signer.sendTransaction({
41418
+ to: contractAddress,
41419
+ data: calldata,
41420
+ value: "0x0",
41421
+ gasLimit: 1e6
41422
+ });
41423
+ if (this.config.debug) {
41424
+ log.info("\u2705 withdrawBTC raw transaction fallback succeeded", {
41425
+ txHash: tx.hash
41426
+ });
41427
+ }
41428
+ } catch (rawError) {
41429
+ const rawErrorMsg = rawError instanceof Error ? rawError.message : String(rawError);
41430
+ if (this.config.debug) {
41431
+ log.error("\u274C withdrawBTC transaction failed (raw fallback also failed)", {
41432
+ error: rawErrorMsg,
41433
+ withdrawalParams,
41434
+ signatureBytesLength: signatureBytes.length
41435
+ });
41436
+ }
41437
+ try {
41438
+ const position = await this.getPosition(positionId);
41439
+ const btcAmount = (Number(withdrawalAmount) / 1e8).toFixed(8);
41440
+ const message = formatBTCWithdrawalFailureMessage(
41441
+ btcAmount,
41442
+ position?.vaultAddress || "unknown",
41443
+ withdrawalAddress,
41444
+ positionId
41445
+ );
41446
+ await this._relayNotification(message);
41447
+ } catch {
41448
+ }
41449
+ return {
41450
+ success: false,
41451
+ error: `Transaction submission failed: ${rawErrorMsg}`
41452
+ };
41577
41453
  }
41578
- return {
41579
- success: false,
41580
- error: `Transaction submission failed: ${txErrorMsg}`
41581
- };
41582
41454
  }
41583
41455
  if (this.config.debug) {
41584
41456
  log.info("\u2705 Transaction submitted, waiting for confirmation:", {