@gvnrdao/dh-sdk 0.0.213 → 0.0.215
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 +810 -882
- package/dist/index.mjs +810 -882
- package/dist/modules/diamond-hands-sdk.d.ts +3 -2
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -12691,93 +12691,504 @@ var require_elliptic = __commonJS({
|
|
|
12691
12691
|
}
|
|
12692
12692
|
});
|
|
12693
12693
|
|
|
12694
|
-
//
|
|
12695
|
-
var
|
|
12696
|
-
"
|
|
12697
|
-
"use strict";
|
|
12698
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12699
|
-
}
|
|
12700
|
-
});
|
|
12701
|
-
|
|
12702
|
-
// node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/chunks/lit-action-config.i.js
|
|
12703
|
-
var require_lit_action_config_i = __commonJS({
|
|
12704
|
-
"node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/chunks/lit-action-config.i.js"(exports) {
|
|
12705
|
-
"use strict";
|
|
12706
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12707
|
-
}
|
|
12708
|
-
});
|
|
12709
|
-
|
|
12710
|
-
// node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/chunks/diamond-hands-lit-actions.i.js
|
|
12711
|
-
var require_diamond_hands_lit_actions_i = __commonJS({
|
|
12712
|
-
"node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/chunks/diamond-hands-lit-actions.i.js"(exports) {
|
|
12713
|
-
"use strict";
|
|
12714
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12715
|
-
}
|
|
12716
|
-
});
|
|
12717
|
-
|
|
12718
|
-
// node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/chunks/lit-action-registry.i.js
|
|
12719
|
-
var require_lit_action_registry_i = __commonJS({
|
|
12720
|
-
"node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/chunks/lit-action-registry.i.js"(exports) {
|
|
12721
|
-
"use strict";
|
|
12722
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12723
|
-
}
|
|
12724
|
-
});
|
|
12725
|
-
|
|
12726
|
-
// node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/index.js
|
|
12727
|
-
var require_interfaces = __commonJS({
|
|
12728
|
-
"node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/interfaces/index.js"(exports) {
|
|
12694
|
+
// ../lit-actions/pkg-dist/pkg-src/index.js
|
|
12695
|
+
var require_pkg_src = __commonJS({
|
|
12696
|
+
"../lit-actions/pkg-dist/pkg-src/index.js"(exports, module) {
|
|
12729
12697
|
"use strict";
|
|
12730
|
-
var
|
|
12731
|
-
|
|
12732
|
-
|
|
12733
|
-
|
|
12734
|
-
|
|
12735
|
-
|
|
12736
|
-
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
|
|
12740
|
-
}
|
|
12741
|
-
|
|
12742
|
-
|
|
12743
|
-
|
|
12698
|
+
var __defProp2 = Object.defineProperty;
|
|
12699
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
12700
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
12701
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
12702
|
+
var __esm2 = (fn, res) => function __init() {
|
|
12703
|
+
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
|
|
12704
|
+
};
|
|
12705
|
+
var __export2 = (target, all) => {
|
|
12706
|
+
for (var name in all)
|
|
12707
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
12708
|
+
};
|
|
12709
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
12710
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12711
|
+
for (let key2 of __getOwnPropNames2(from))
|
|
12712
|
+
if (!__hasOwnProp2.call(to, key2) && key2 !== except)
|
|
12713
|
+
__defProp2(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc2(from, key2)) || desc.enumerable });
|
|
12714
|
+
}
|
|
12715
|
+
return to;
|
|
12716
|
+
};
|
|
12717
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
12718
|
+
function configureDebugLogging(config) {
|
|
12719
|
+
debugConfig = { ...debugConfig, ...config };
|
|
12720
|
+
}
|
|
12721
|
+
function getTimestamp() {
|
|
12722
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
12723
|
+
}
|
|
12724
|
+
function formatMessage(level, component, message, metadata) {
|
|
12725
|
+
const timestamp = debugConfig.enableTimestamps ? `[${getTimestamp()}] ` : "";
|
|
12726
|
+
const metadataStr = metadata ? ` ${JSON.stringify(metadata)}` : "";
|
|
12727
|
+
return `${timestamp}[${level}] [${component}] ${message}${metadataStr}`;
|
|
12728
|
+
}
|
|
12729
|
+
function debugError(component, message, metadata) {
|
|
12730
|
+
if (debugConfig.level >= 0) {
|
|
12731
|
+
console.error(formatMessage("ERROR", component, message, metadata));
|
|
12732
|
+
}
|
|
12733
|
+
}
|
|
12734
|
+
function debugWarn(component, message, metadata) {
|
|
12735
|
+
if (debugConfig.level >= 1) {
|
|
12736
|
+
console.warn(formatMessage("WARN", component, message, metadata));
|
|
12737
|
+
}
|
|
12738
|
+
}
|
|
12739
|
+
function debugInfo(component, message, metadata) {
|
|
12740
|
+
if (debugConfig.level >= 2) {
|
|
12741
|
+
console.log(formatMessage("INFO", component, message, metadata));
|
|
12742
|
+
}
|
|
12743
|
+
}
|
|
12744
|
+
function debugLog(component, message, metadata) {
|
|
12745
|
+
if (debugConfig.level >= 3) {
|
|
12746
|
+
console.log(formatMessage("DEBUG", component, message, metadata));
|
|
12747
|
+
}
|
|
12748
|
+
}
|
|
12749
|
+
function debugTrace(component, message, metadata) {
|
|
12750
|
+
if (debugConfig.level >= 4) {
|
|
12751
|
+
console.log(formatMessage("TRACE", component, message, metadata));
|
|
12752
|
+
}
|
|
12753
|
+
}
|
|
12754
|
+
function logRequest(component, operation, params) {
|
|
12755
|
+
if (!debugConfig.enableRequestLogging)
|
|
12756
|
+
return;
|
|
12757
|
+
debugLog(component, `\u{1F504} Request: ${operation}`, {
|
|
12758
|
+
operation,
|
|
12759
|
+
params: JSON.stringify(params, null, 2)
|
|
12760
|
+
});
|
|
12761
|
+
}
|
|
12762
|
+
function logResponse(component, operation, response, duration) {
|
|
12763
|
+
if (!debugConfig.enableRequestLogging)
|
|
12764
|
+
return;
|
|
12765
|
+
debugLog(component, `\u2705 Response: ${operation} (${duration}ms)`, {
|
|
12766
|
+
operation,
|
|
12767
|
+
duration,
|
|
12768
|
+
response: typeof response === "object" ? JSON.stringify(response, null, 2) : response
|
|
12769
|
+
});
|
|
12770
|
+
}
|
|
12771
|
+
function logError(component, operation, error, duration) {
|
|
12772
|
+
const durationStr = duration ? ` (${duration}ms)` : "";
|
|
12773
|
+
debugError(component, `\u274C Error: ${operation}${durationStr}`, {
|
|
12774
|
+
operation,
|
|
12775
|
+
duration,
|
|
12776
|
+
error: error?.message || error?.toString() || "Unknown error",
|
|
12777
|
+
stack: error?.stack
|
|
12778
|
+
});
|
|
12779
|
+
}
|
|
12780
|
+
function logConnectionAttempt(network, attempt, maxAttempts) {
|
|
12781
|
+
debugInfo("CONNECTION", `\u{1F517} Connecting to ${network} (attempt ${attempt}/${maxAttempts})`);
|
|
12782
|
+
}
|
|
12783
|
+
function logConnectionSuccess(network, latency) {
|
|
12784
|
+
debugInfo("CONNECTION", `\u2705 Connected to ${network} (${latency}ms)`);
|
|
12785
|
+
networkMetrics.recordRequest(`connection-${network}`, true, latency);
|
|
12786
|
+
}
|
|
12787
|
+
function logConnectionFailure(network, error, attempt) {
|
|
12788
|
+
debugError("CONNECTION", `\u274C Connection failed to ${network} (attempt ${attempt})`, { error });
|
|
12789
|
+
networkMetrics.recordRequest(`connection-${network}`, false, 0, error);
|
|
12790
|
+
}
|
|
12791
|
+
function logPkpOperation(operation, pkpId, details) {
|
|
12792
|
+
const pkpStr = pkpId ? ` (PKP: ${pkpId.slice(0, 8)}...)` : "";
|
|
12793
|
+
debugInfo("PKP", `\u{1F511} ${operation}${pkpStr}`, details);
|
|
12794
|
+
}
|
|
12795
|
+
function logSessionSignatures(count, expiration) {
|
|
12796
|
+
debugInfo("SESSION", `\u{1F510} Generated ${count} session signatures (expires: ${expiration})`);
|
|
12797
|
+
}
|
|
12798
|
+
function logLitActionExecution(cid, params) {
|
|
12799
|
+
debugInfo("LIT_ACTION", `\u26A1 Executing LIT Action: ${cid}`, {
|
|
12800
|
+
cid,
|
|
12801
|
+
params
|
|
12802
|
+
});
|
|
12803
|
+
}
|
|
12804
|
+
function logLitActionResult(cid, success2, duration, result) {
|
|
12805
|
+
const status = success2 ? "\u2705" : "\u274C";
|
|
12806
|
+
debugInfo("LIT_ACTION", `${status} LIT Action completed: ${cid} (${duration}ms)`, {
|
|
12807
|
+
cid,
|
|
12808
|
+
success: success2,
|
|
12809
|
+
duration,
|
|
12810
|
+
result: success2 && result ? JSON.stringify(result, null, 2) : void 0
|
|
12811
|
+
});
|
|
12812
|
+
}
|
|
12813
|
+
function logTestStart(testName) {
|
|
12814
|
+
debugInfo("TEST", `\u{1F9EA} Starting test: ${testName}`);
|
|
12815
|
+
return new PerformanceTracker(testName);
|
|
12816
|
+
}
|
|
12817
|
+
function logTestEnd(testName, success2, duration) {
|
|
12818
|
+
const status = success2 ? "\u2705" : "\u274C";
|
|
12819
|
+
debugInfo("TEST", `${status} Test completed: ${testName} (${duration}ms)`);
|
|
12820
|
+
networkMetrics.printSummary();
|
|
12821
|
+
}
|
|
12822
|
+
var LogLevel2;
|
|
12823
|
+
var DEFAULT_DEBUG_CONFIG;
|
|
12824
|
+
var debugConfig;
|
|
12825
|
+
var PerformanceTracker;
|
|
12826
|
+
var NetworkMetricsCollector;
|
|
12827
|
+
var networkMetrics;
|
|
12828
|
+
var init_debug_logger = __esm2({
|
|
12829
|
+
"pkg-src/utils/chunks/debug-logger.ts"() {
|
|
12830
|
+
"use strict";
|
|
12831
|
+
LogLevel2 = /* @__PURE__ */ ((LogLevel22) => {
|
|
12832
|
+
LogLevel22[LogLevel22["ERROR"] = 0] = "ERROR";
|
|
12833
|
+
LogLevel22[LogLevel22["WARN"] = 1] = "WARN";
|
|
12834
|
+
LogLevel22[LogLevel22["INFO"] = 2] = "INFO";
|
|
12835
|
+
LogLevel22[LogLevel22["DEBUG"] = 3] = "DEBUG";
|
|
12836
|
+
LogLevel22[LogLevel22["TRACE"] = 4] = "TRACE";
|
|
12837
|
+
return LogLevel22;
|
|
12838
|
+
})(LogLevel2 || {});
|
|
12839
|
+
DEFAULT_DEBUG_CONFIG = {
|
|
12840
|
+
level: 2,
|
|
12841
|
+
enableTimestamps: true,
|
|
12842
|
+
enablePerformanceMetrics: true,
|
|
12843
|
+
enableRequestLogging: true,
|
|
12844
|
+
enableNetworkMetrics: true
|
|
12845
|
+
};
|
|
12846
|
+
debugConfig = { ...DEFAULT_DEBUG_CONFIG };
|
|
12847
|
+
PerformanceTracker = class {
|
|
12848
|
+
constructor(operationName) {
|
|
12849
|
+
this.operationName = operationName;
|
|
12850
|
+
this.markers = /* @__PURE__ */ new Map();
|
|
12851
|
+
this.startTime = Date.now();
|
|
12852
|
+
this.log("PERF", `Started: ${operationName}`);
|
|
12853
|
+
}
|
|
12854
|
+
mark(label) {
|
|
12855
|
+
const elapsed = Date.now() - this.startTime;
|
|
12856
|
+
this.markers.set(label, elapsed);
|
|
12857
|
+
this.log("PERF", `${this.operationName} - ${label}: ${elapsed}ms`);
|
|
12858
|
+
}
|
|
12859
|
+
end(success2 = true) {
|
|
12860
|
+
const totalTime = Date.now() - this.startTime;
|
|
12861
|
+
const status = success2 ? "SUCCESS" : "FAILED";
|
|
12862
|
+
this.log("PERF", `${this.operationName} - ${status}: ${totalTime}ms`);
|
|
12863
|
+
if (debugConfig.enablePerformanceMetrics && this.markers.size > 0) {
|
|
12864
|
+
console.log(`\u{1F4CA} Performance Breakdown for ${this.operationName}:`);
|
|
12865
|
+
for (const [label, time] of this.markers) {
|
|
12866
|
+
console.log(` ${label}: ${time}ms`);
|
|
12867
|
+
}
|
|
12868
|
+
console.log(` Total: ${totalTime}ms`);
|
|
12869
|
+
}
|
|
12870
|
+
return totalTime;
|
|
12871
|
+
}
|
|
12872
|
+
log(level, message) {
|
|
12873
|
+
if (debugConfig.enablePerformanceMetrics) {
|
|
12874
|
+
console.log(formatMessage(level, "PERFORMANCE", message));
|
|
12875
|
+
}
|
|
12876
|
+
}
|
|
12877
|
+
};
|
|
12878
|
+
NetworkMetricsCollector = class {
|
|
12879
|
+
constructor() {
|
|
12880
|
+
this.metrics = /* @__PURE__ */ new Map();
|
|
12881
|
+
}
|
|
12882
|
+
getMetrics(operation) {
|
|
12883
|
+
if (!this.metrics.has(operation)) {
|
|
12884
|
+
this.metrics.set(operation, {
|
|
12885
|
+
requestCount: 0,
|
|
12886
|
+
successCount: 0,
|
|
12887
|
+
failureCount: 0,
|
|
12888
|
+
averageLatency: 0,
|
|
12889
|
+
startTime: Date.now()
|
|
12890
|
+
});
|
|
12891
|
+
}
|
|
12892
|
+
return this.metrics.get(operation);
|
|
12893
|
+
}
|
|
12894
|
+
recordRequest(operation, success2, latency, error) {
|
|
12895
|
+
const metrics = this.getMetrics(operation);
|
|
12896
|
+
metrics.requestCount++;
|
|
12897
|
+
if (success2) {
|
|
12898
|
+
metrics.successCount++;
|
|
12899
|
+
metrics.averageLatency = (metrics.averageLatency * (metrics.successCount - 1) + latency) / metrics.successCount;
|
|
12900
|
+
} else {
|
|
12901
|
+
metrics.failureCount++;
|
|
12902
|
+
if (error)
|
|
12903
|
+
metrics.lastError = error;
|
|
12904
|
+
}
|
|
12905
|
+
if (debugConfig.enableNetworkMetrics) {
|
|
12906
|
+
const successRate = (metrics.successCount / metrics.requestCount * 100).toFixed(1);
|
|
12907
|
+
debugLog("NETWORK", `${operation} - Success: ${success2}, Latency: ${latency}ms, Success Rate: ${successRate}%`);
|
|
12908
|
+
}
|
|
12909
|
+
}
|
|
12910
|
+
printSummary() {
|
|
12911
|
+
if (!debugConfig.enableNetworkMetrics)
|
|
12912
|
+
return;
|
|
12913
|
+
console.log("\n\u{1F4C8} Network Metrics Summary:");
|
|
12914
|
+
for (const [operation, metrics] of this.metrics) {
|
|
12915
|
+
const successRate = (metrics.successCount / metrics.requestCount * 100).toFixed(1);
|
|
12916
|
+
const runtime = Date.now() - metrics.startTime;
|
|
12917
|
+
console.log(` ${operation}:`);
|
|
12918
|
+
console.log(` Requests: ${metrics.requestCount}`);
|
|
12919
|
+
console.log(` Success Rate: ${successRate}%`);
|
|
12920
|
+
console.log(` Avg Latency: ${metrics.averageLatency.toFixed(0)}ms`);
|
|
12921
|
+
console.log(` Runtime: ${runtime}ms`);
|
|
12922
|
+
if (metrics.lastError) {
|
|
12923
|
+
console.log(` Last Error: ${metrics.lastError}`);
|
|
12924
|
+
}
|
|
12925
|
+
}
|
|
12926
|
+
}
|
|
12927
|
+
};
|
|
12928
|
+
networkMetrics = new NetworkMetricsCollector();
|
|
12929
|
+
}
|
|
12744
12930
|
});
|
|
12745
|
-
var
|
|
12746
|
-
|
|
12747
|
-
|
|
12748
|
-
|
|
12749
|
-
|
|
12750
|
-
|
|
12751
|
-
|
|
12752
|
-
|
|
12753
|
-
|
|
12754
|
-
|
|
12755
|
-
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
|
|
12760
|
-
|
|
12761
|
-
|
|
12762
|
-
|
|
12763
|
-
|
|
12764
|
-
|
|
12931
|
+
var session_signature_cache_exports = {};
|
|
12932
|
+
__export2(session_signature_cache_exports, {
|
|
12933
|
+
DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
|
|
12934
|
+
clearSessionSignatureCache: () => clearSessionSignatureCache,
|
|
12935
|
+
configureSessionSignatureCache: () => configureSessionSignatureCache,
|
|
12936
|
+
generateSessionSignaturesWithCache: () => generateSessionSignaturesWithCache,
|
|
12937
|
+
getSessionSignatureCacheStats: () => getSessionSignatureCacheStats,
|
|
12938
|
+
sessionSignatureCache: () => sessionSignatureCache
|
|
12939
|
+
});
|
|
12940
|
+
async function generateSessionSignaturesWithCache(litNodeClient, sessionConfig, pkpTokenId, litActionCid, signerAddress, network = "chipotle") {
|
|
12941
|
+
const cached = sessionSignatureCache.get(pkpTokenId, litActionCid, signerAddress, network);
|
|
12942
|
+
if (cached) {
|
|
12943
|
+
return cached;
|
|
12944
|
+
}
|
|
12945
|
+
debugInfo("CACHE", "\u{1F510} Generating new session signatures (cache miss)...");
|
|
12946
|
+
const sessionSigs = await litNodeClient.getSessionSigs(sessionConfig);
|
|
12947
|
+
const expiration = new Date(sessionConfig.expiration);
|
|
12948
|
+
sessionSignatureCache.set(pkpTokenId, litActionCid, signerAddress, network, sessionSigs, expiration);
|
|
12949
|
+
const sigCount = Object.keys(sessionSigs).length;
|
|
12950
|
+
debugInfo("CACHE", `\u2705 Generated and cached ${sigCount} session signatures`);
|
|
12951
|
+
return sessionSigs;
|
|
12952
|
+
}
|
|
12953
|
+
function configureSessionSignatureCache(config) {
|
|
12954
|
+
Object.assign(sessionSignatureCache["config"], config);
|
|
12955
|
+
}
|
|
12956
|
+
function clearSessionSignatureCache() {
|
|
12957
|
+
sessionSignatureCache.clear();
|
|
12958
|
+
}
|
|
12959
|
+
function getSessionSignatureCacheStats() {
|
|
12960
|
+
return sessionSignatureCache.getStats();
|
|
12961
|
+
}
|
|
12962
|
+
var DEFAULT_CACHE_CONFIG;
|
|
12963
|
+
var SessionSignatureCache;
|
|
12964
|
+
var sessionSignatureCache;
|
|
12965
|
+
var init_session_signature_cache = __esm2({
|
|
12966
|
+
"pkg-src/utils/chunks/session-signature-cache.ts"() {
|
|
12967
|
+
"use strict";
|
|
12968
|
+
init_debug_logger();
|
|
12969
|
+
DEFAULT_CACHE_CONFIG = {
|
|
12970
|
+
maxEntries: 50,
|
|
12971
|
+
bufferTimeMs: 6e4,
|
|
12972
|
+
// 1 minute buffer before expiration
|
|
12973
|
+
enableLogging: true
|
|
12974
|
+
};
|
|
12975
|
+
SessionSignatureCache = class {
|
|
12976
|
+
constructor(config = {}) {
|
|
12977
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
12978
|
+
this.config = { ...DEFAULT_CACHE_CONFIG, ...config };
|
|
12979
|
+
}
|
|
12980
|
+
/**
|
|
12981
|
+
* Generate cache key from PKP and context
|
|
12982
|
+
*/
|
|
12983
|
+
generateCacheKey(pkpTokenId, litActionCid, signerAddress, network) {
|
|
12984
|
+
return `${signerAddress}-${network}-${pkpTokenId}-${litActionCid}`;
|
|
12985
|
+
}
|
|
12986
|
+
/**
|
|
12987
|
+
* Check if cache entry is still valid
|
|
12988
|
+
*/
|
|
12989
|
+
isEntryValid(entry) {
|
|
12990
|
+
const now2 = /* @__PURE__ */ new Date();
|
|
12991
|
+
const expirationWithBuffer = new Date(
|
|
12992
|
+
entry.expiration.getTime() - this.config.bufferTimeMs
|
|
12993
|
+
);
|
|
12994
|
+
return now2 < expirationWithBuffer;
|
|
12995
|
+
}
|
|
12996
|
+
/**
|
|
12997
|
+
* Clean expired entries from cache
|
|
12998
|
+
*/
|
|
12999
|
+
cleanExpiredEntries() {
|
|
13000
|
+
const now2 = /* @__PURE__ */ new Date();
|
|
13001
|
+
let cleanedCount = 0;
|
|
13002
|
+
for (const [key2, entry] of this.cache.entries()) {
|
|
13003
|
+
if (now2 >= entry.expiration) {
|
|
13004
|
+
this.cache.delete(key2);
|
|
13005
|
+
cleanedCount++;
|
|
13006
|
+
}
|
|
13007
|
+
}
|
|
13008
|
+
if (cleanedCount > 0 && this.config.enableLogging) {
|
|
13009
|
+
debugInfo("CACHE", `\u{1F9F9} Cleaned ${cleanedCount} expired session signature entries`);
|
|
13010
|
+
}
|
|
13011
|
+
}
|
|
13012
|
+
/**
|
|
13013
|
+
* Enforce cache size limits
|
|
13014
|
+
*/
|
|
13015
|
+
enforceCacheSize() {
|
|
13016
|
+
if (this.cache.size <= this.config.maxEntries) {
|
|
13017
|
+
return;
|
|
13018
|
+
}
|
|
13019
|
+
const entries = Array.from(this.cache.entries()).sort(([, a], [, b]) => a.createdAt.getTime() - b.createdAt.getTime());
|
|
13020
|
+
const toRemove = entries.slice(0, this.cache.size - this.config.maxEntries);
|
|
13021
|
+
for (const [key2] of toRemove) {
|
|
13022
|
+
this.cache.delete(key2);
|
|
13023
|
+
}
|
|
13024
|
+
if (this.config.enableLogging) {
|
|
13025
|
+
debugInfo("CACHE", `\u{1F4E6} Removed ${toRemove.length} oldest cache entries to maintain size limit`);
|
|
13026
|
+
}
|
|
13027
|
+
}
|
|
13028
|
+
/**
|
|
13029
|
+
* Get cached session signatures if valid
|
|
13030
|
+
*/
|
|
13031
|
+
get(pkpTokenId, litActionCid, signerAddress, network) {
|
|
13032
|
+
this.cleanExpiredEntries();
|
|
13033
|
+
const cacheKey = this.generateCacheKey(pkpTokenId, litActionCid, signerAddress, network);
|
|
13034
|
+
const entry = this.cache.get(cacheKey);
|
|
13035
|
+
if (!entry) {
|
|
13036
|
+
if (this.config.enableLogging) {
|
|
13037
|
+
debugLog("CACHE", `\u274C Session signatures cache miss: ${cacheKey}`);
|
|
13038
|
+
}
|
|
13039
|
+
return null;
|
|
13040
|
+
}
|
|
13041
|
+
if (!this.isEntryValid(entry)) {
|
|
13042
|
+
this.cache.delete(cacheKey);
|
|
13043
|
+
if (this.config.enableLogging) {
|
|
13044
|
+
debugWarn("CACHE", `\u23F0 Session signatures expired: ${cacheKey}`);
|
|
13045
|
+
}
|
|
13046
|
+
return null;
|
|
13047
|
+
}
|
|
13048
|
+
if (this.config.enableLogging) {
|
|
13049
|
+
const timeUntilExpiry = entry.expiration.getTime() - Date.now();
|
|
13050
|
+
debugInfo("CACHE", `\u2705 Session signatures cache hit: ${cacheKey} (expires in ${Math.round(timeUntilExpiry / 1e3)}s)`);
|
|
13051
|
+
}
|
|
13052
|
+
return entry.sessionSigs;
|
|
13053
|
+
}
|
|
13054
|
+
/**
|
|
13055
|
+
* Cache session signatures
|
|
13056
|
+
*/
|
|
13057
|
+
set(pkpTokenId, litActionCid, signerAddress, network, sessionSigs, expiration) {
|
|
13058
|
+
const cacheKey = this.generateCacheKey(pkpTokenId, litActionCid, signerAddress, network);
|
|
13059
|
+
const entry = {
|
|
13060
|
+
sessionSigs,
|
|
13061
|
+
expiration,
|
|
13062
|
+
pkpTokenId,
|
|
13063
|
+
litActionCid,
|
|
13064
|
+
signerAddress,
|
|
13065
|
+
network,
|
|
13066
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
13067
|
+
};
|
|
13068
|
+
this.cache.set(cacheKey, entry);
|
|
13069
|
+
if (this.config.enableLogging) {
|
|
13070
|
+
const timeUntilExpiry = expiration.getTime() - Date.now();
|
|
13071
|
+
debugInfo("CACHE", `\u{1F4BE} Cached session signatures: ${cacheKey} (expires in ${Math.round(timeUntilExpiry / 1e3)}s)`);
|
|
13072
|
+
}
|
|
13073
|
+
this.enforceCacheSize();
|
|
13074
|
+
}
|
|
13075
|
+
/**
|
|
13076
|
+
* Clear all cached session signatures
|
|
13077
|
+
*/
|
|
13078
|
+
clear() {
|
|
13079
|
+
const size = this.cache.size;
|
|
13080
|
+
this.cache.clear();
|
|
13081
|
+
if (this.config.enableLogging) {
|
|
13082
|
+
debugInfo("CACHE", `\u{1F5D1}\uFE0F Cleared ${size} cached session signature entries`);
|
|
13083
|
+
}
|
|
13084
|
+
}
|
|
13085
|
+
/**
|
|
13086
|
+
* Get cache statistics
|
|
13087
|
+
*/
|
|
13088
|
+
getStats() {
|
|
13089
|
+
this.cleanExpiredEntries();
|
|
13090
|
+
return {
|
|
13091
|
+
size: this.cache.size,
|
|
13092
|
+
maxEntries: this.config.maxEntries,
|
|
13093
|
+
utilizationPercent: Math.round(this.cache.size / this.config.maxEntries * 100)
|
|
13094
|
+
};
|
|
13095
|
+
}
|
|
13096
|
+
/**
|
|
13097
|
+
* Remove specific cache entry
|
|
13098
|
+
*/
|
|
13099
|
+
delete(pkpTokenId, litActionCid, signerAddress, network) {
|
|
13100
|
+
const cacheKey = this.generateCacheKey(pkpTokenId, litActionCid, signerAddress, network);
|
|
13101
|
+
const deleted = this.cache.delete(cacheKey);
|
|
13102
|
+
if (deleted && this.config.enableLogging) {
|
|
13103
|
+
debugInfo("CACHE", `\u{1F5D1}\uFE0F Removed session signatures from cache: ${cacheKey}`);
|
|
13104
|
+
}
|
|
13105
|
+
return deleted;
|
|
13106
|
+
}
|
|
13107
|
+
};
|
|
13108
|
+
sessionSignatureCache = new SessionSignatureCache();
|
|
13109
|
+
}
|
|
13110
|
+
});
|
|
13111
|
+
var index_exports = {};
|
|
13112
|
+
__export2(index_exports, {
|
|
13113
|
+
CHIPOTLE_DEPLOYMENTS: () => CHIPOTLE_DEPLOYMENTS,
|
|
13114
|
+
DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
|
|
13115
|
+
DEFAULT_DEBUG_CONFIG: () => DEFAULT_DEBUG_CONFIG,
|
|
13116
|
+
DEFAULT_RETRY_CONFIG: () => DEFAULT_RETRY_CONFIG,
|
|
13117
|
+
DH_LIT_ACTIONS_CHIPOTLE: () => DH_LIT_ACTIONS_CHIPOTLE3,
|
|
13118
|
+
ErrorCategory: () => ErrorCategory2,
|
|
13119
|
+
LogLevel: () => LogLevel2,
|
|
13120
|
+
NETWORK_TIMEOUTS: () => NETWORK_TIMEOUTS,
|
|
13121
|
+
PerformanceTracker: () => PerformanceTracker,
|
|
13122
|
+
RetryStrategy: () => RetryStrategy,
|
|
13123
|
+
analyzeError: () => analyzeError,
|
|
13124
|
+
calculateDelay: () => calculateDelay,
|
|
13125
|
+
cidToHex: () => cidToHex,
|
|
13126
|
+
classifyError: () => classifyError,
|
|
13127
|
+
clearSessionSignatureCache: () => clearSessionSignatureCache,
|
|
13128
|
+
configureDebugLogging: () => configureDebugLogging,
|
|
13129
|
+
configureSessionSignatureCache: () => configureSessionSignatureCache,
|
|
13130
|
+
connectLitContracts: () => connectLitContracts,
|
|
13131
|
+
connectLitNodeClient: () => connectLitNodeClient,
|
|
13132
|
+
createErrorReport: () => createErrorReport,
|
|
13133
|
+
debugError: () => debugError,
|
|
13134
|
+
debugInfo: () => debugInfo,
|
|
13135
|
+
debugLog: () => debugLog,
|
|
13136
|
+
debugTrace: () => debugTrace,
|
|
13137
|
+
debugWarn: () => debugWarn,
|
|
13138
|
+
executeLitAction: () => executeLitAction,
|
|
13139
|
+
executePkpOperation: () => executePkpOperation,
|
|
13140
|
+
generateSessionSignatures: () => generateSessionSignatures,
|
|
13141
|
+
generateSessionSignaturesWithCache: () => generateSessionSignaturesWithCache,
|
|
13142
|
+
getDeployedActions: () => getDeployedActions,
|
|
13143
|
+
getDeploymentsForNetwork: () => getDeploymentsForNetwork,
|
|
13144
|
+
getLitActionCID: () => getLitActionCID,
|
|
13145
|
+
getLitActionConfig: () => getLitActionConfig,
|
|
13146
|
+
getNetworkTimeouts: () => getNetworkTimeouts,
|
|
13147
|
+
getPKPValidatorSetup: () => getPKPValidatorSetup,
|
|
13148
|
+
getRetryConfigFromClassification: () => getRetryConfigFromClassification,
|
|
13149
|
+
getSessionSignatureCacheStats: () => getSessionSignatureCacheStats,
|
|
13150
|
+
isLitActionDeployed: () => isLitActionDeployed,
|
|
13151
|
+
isRetryableError: () => isRetryableError,
|
|
13152
|
+
litProtocolErrors: () => litProtocolErrors,
|
|
13153
|
+
logConnectionAttempt: () => logConnectionAttempt,
|
|
13154
|
+
logConnectionFailure: () => logConnectionFailure,
|
|
13155
|
+
logConnectionSuccess: () => logConnectionSuccess,
|
|
13156
|
+
logError: () => logError,
|
|
13157
|
+
logLitActionExecution: () => logLitActionExecution,
|
|
13158
|
+
logLitActionResult: () => logLitActionResult,
|
|
13159
|
+
logPkpOperation: () => logPkpOperation,
|
|
13160
|
+
logRequest: () => logRequest,
|
|
13161
|
+
logResponse: () => logResponse,
|
|
13162
|
+
logSessionSignatures: () => logSessionSignatures,
|
|
13163
|
+
logTestEnd: () => logTestEnd,
|
|
13164
|
+
logTestStart: () => logTestStart,
|
|
13165
|
+
networkMetrics: () => networkMetrics,
|
|
13166
|
+
sessionSignatureCache: () => sessionSignatureCache,
|
|
13167
|
+
sleep: () => sleep,
|
|
13168
|
+
validateDeployedActions: () => validateDeployedActions,
|
|
13169
|
+
validateLitNodeConnection: () => validateLitNodeConnection,
|
|
13170
|
+
validateLitNodeReadiness: () => validateLitNodeReadiness,
|
|
13171
|
+
withRetry: () => withRetry
|
|
13172
|
+
});
|
|
13173
|
+
module.exports = __toCommonJS2(index_exports);
|
|
13174
|
+
function base2(ALPHABET2) {
|
|
13175
|
+
if (ALPHABET2.length >= 255) {
|
|
12765
13176
|
throw new TypeError("Alphabet too long");
|
|
12766
13177
|
}
|
|
12767
13178
|
const BASE_MAP = new Uint8Array(256);
|
|
12768
13179
|
for (let j = 0; j < BASE_MAP.length; j++) {
|
|
12769
13180
|
BASE_MAP[j] = 255;
|
|
12770
13181
|
}
|
|
12771
|
-
for (let i = 0; i <
|
|
12772
|
-
const x =
|
|
13182
|
+
for (let i = 0; i < ALPHABET2.length; i++) {
|
|
13183
|
+
const x = ALPHABET2.charAt(i);
|
|
12773
13184
|
const xc = x.charCodeAt(0);
|
|
12774
13185
|
if (BASE_MAP[xc] !== 255) {
|
|
12775
13186
|
throw new TypeError(x + " is ambiguous");
|
|
12776
13187
|
}
|
|
12777
13188
|
BASE_MAP[xc] = i;
|
|
12778
13189
|
}
|
|
12779
|
-
const BASE =
|
|
12780
|
-
const LEADER =
|
|
13190
|
+
const BASE = ALPHABET2.length;
|
|
13191
|
+
const LEADER = ALPHABET2.charAt(0);
|
|
12781
13192
|
const FACTOR = Math.log(BASE) / Math.log(256);
|
|
12782
13193
|
const iFACTOR = Math.log(256) / Math.log(BASE);
|
|
12783
13194
|
function encode4(source) {
|
|
@@ -12823,7 +13234,7 @@ var require_cjs = __commonJS({
|
|
|
12823
13234
|
}
|
|
12824
13235
|
let str = LEADER.repeat(zeroes);
|
|
12825
13236
|
for (; it2 < size; ++it2) {
|
|
12826
|
-
str +=
|
|
13237
|
+
str += ALPHABET2.charAt(b58[it2]);
|
|
12827
13238
|
}
|
|
12828
13239
|
return str;
|
|
12829
13240
|
}
|
|
@@ -12888,38 +13299,13 @@ var require_cjs = __commonJS({
|
|
|
12888
13299
|
decode: decode3
|
|
12889
13300
|
};
|
|
12890
13301
|
}
|
|
12891
|
-
|
|
12892
|
-
}
|
|
12893
|
-
});
|
|
12894
|
-
|
|
12895
|
-
// node_modules/bs58/src/cjs/index.cjs
|
|
12896
|
-
var require_cjs2 = __commonJS({
|
|
12897
|
-
"node_modules/bs58/src/cjs/index.cjs"(exports) {
|
|
12898
|
-
"use strict";
|
|
12899
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
12900
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
12901
|
-
};
|
|
12902
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12903
|
-
var base_x_1 = __importDefault(require_cjs());
|
|
13302
|
+
var esm_default = base2;
|
|
12904
13303
|
var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
12905
|
-
|
|
12906
|
-
}
|
|
12907
|
-
});
|
|
12908
|
-
|
|
12909
|
-
// node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/cid-utils.js
|
|
12910
|
-
var require_cid_utils = __commonJS({
|
|
12911
|
-
"node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/cid-utils.js"(exports) {
|
|
12912
|
-
"use strict";
|
|
12913
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
12914
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
12915
|
-
};
|
|
12916
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12917
|
-
exports.cidToHex = cidToHex;
|
|
12918
|
-
var bs58_1 = __importDefault(require_cjs2());
|
|
13304
|
+
var esm_default2 = esm_default(ALPHABET);
|
|
12919
13305
|
function cidToHex(cid) {
|
|
12920
13306
|
try {
|
|
12921
13307
|
if (cid.startsWith("Qm")) {
|
|
12922
|
-
const bytes =
|
|
13308
|
+
const bytes = esm_default2.decode(cid);
|
|
12923
13309
|
return "0x" + Buffer.from(bytes).toString("hex");
|
|
12924
13310
|
} else if (cid.startsWith("0x")) {
|
|
12925
13311
|
return cid;
|
|
@@ -12933,21 +13319,12 @@ var require_cid_utils = __commonJS({
|
|
|
12933
13319
|
throw new Error(`Failed to convert CID ${cid} to hex: ${error instanceof Error ? error.message : String(error)}`);
|
|
12934
13320
|
}
|
|
12935
13321
|
}
|
|
12936
|
-
|
|
12937
|
-
});
|
|
12938
|
-
|
|
12939
|
-
// node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/constants/chunks/lit-actions-registry.js
|
|
12940
|
-
var require_lit_actions_registry = __commonJS({
|
|
12941
|
-
"node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/constants/chunks/lit-actions-registry.js"(exports) {
|
|
12942
|
-
"use strict";
|
|
12943
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12944
|
-
exports.CHIPOTLE_DEPLOYMENTS = exports.DH_LIT_ACTIONS_CHIPOTLE = void 0;
|
|
12945
|
-
exports.getDeploymentsForNetwork = getDeploymentsForNetwork;
|
|
12946
|
-
var cid_utils_1 = require_cid_utils();
|
|
12947
|
-
exports.DH_LIT_ACTIONS_CHIPOTLE = {
|
|
13322
|
+
var DH_LIT_ACTIONS_CHIPOTLE3 = {
|
|
12948
13323
|
authorizationDummy: {
|
|
12949
13324
|
cid: "QmXPh5RTReLqjqZDRNhgVKi1TWMJK2vS9QSRPkWPhLBQJN",
|
|
12950
|
-
authorizedCidHex:
|
|
13325
|
+
authorizedCidHex: cidToHex(
|
|
13326
|
+
"QmXPh5RTReLqjqZDRNhgVKi1TWMJK2vS9QSRPkWPhLBQJN"
|
|
13327
|
+
),
|
|
12951
13328
|
name: "Authorization Dummy",
|
|
12952
13329
|
description: "Production Authorization Dummy",
|
|
12953
13330
|
version: "1.0.0",
|
|
@@ -12958,7 +13335,9 @@ var require_lit_actions_registry = __commonJS({
|
|
|
12958
13335
|
},
|
|
12959
13336
|
authorizationDummyB: {
|
|
12960
13337
|
cid: "QmQXTcAU9tr4YAVrzHujEJw9moJgM1o5gnJU2ojcvhigua",
|
|
12961
|
-
authorizedCidHex:
|
|
13338
|
+
authorizedCidHex: cidToHex(
|
|
13339
|
+
"QmQXTcAU9tr4YAVrzHujEJw9moJgM1o5gnJU2ojcvhigua"
|
|
13340
|
+
),
|
|
12962
13341
|
name: "Authorization Dummy B",
|
|
12963
13342
|
description: "Production Authorization Dummy B",
|
|
12964
13343
|
version: "1.0.0",
|
|
@@ -12969,7 +13348,9 @@ var require_lit_actions_registry = __commonJS({
|
|
|
12969
13348
|
},
|
|
12970
13349
|
pkpValidator: {
|
|
12971
13350
|
cid: "QmSo9fkRJA5rS2AnkpKyFgE7ADdGRC2mXvcXVUPaSBRxv1",
|
|
12972
|
-
authorizedCidHex:
|
|
13351
|
+
authorizedCidHex: cidToHex(
|
|
13352
|
+
"QmSo9fkRJA5rS2AnkpKyFgE7ADdGRC2mXvcXVUPaSBRxv1"
|
|
13353
|
+
),
|
|
12973
13354
|
name: "Pkp Validator",
|
|
12974
13355
|
description: "Production Pkp Validator",
|
|
12975
13356
|
version: "1.0.0",
|
|
@@ -12985,7 +13366,9 @@ var require_lit_actions_registry = __commonJS({
|
|
|
12985
13366
|
},
|
|
12986
13367
|
btcTransactionSigner: {
|
|
12987
13368
|
cid: "QmYSvuDcn2EPjRoDsPBLK2e3PGYEUHtWAPxwB51s4unkaG",
|
|
12988
|
-
authorizedCidHex:
|
|
13369
|
+
authorizedCidHex: cidToHex(
|
|
13370
|
+
"QmYSvuDcn2EPjRoDsPBLK2e3PGYEUHtWAPxwB51s4unkaG"
|
|
13371
|
+
),
|
|
12989
13372
|
name: "Btc Transaction Signer",
|
|
12990
13373
|
description: "Production Btc Transaction Signer",
|
|
12991
13374
|
version: "1.0.0",
|
|
@@ -12996,7 +13379,9 @@ var require_lit_actions_registry = __commonJS({
|
|
|
12996
13379
|
},
|
|
12997
13380
|
ucdMintValidator: {
|
|
12998
13381
|
cid: "QmRrL2oTyEyAsTNQQDbq7LpMtU6EJJCbmnLGKGJM4ULr1h",
|
|
12999
|
-
authorizedCidHex:
|
|
13382
|
+
authorizedCidHex: cidToHex(
|
|
13383
|
+
"QmRrL2oTyEyAsTNQQDbq7LpMtU6EJJCbmnLGKGJM4ULr1h"
|
|
13384
|
+
),
|
|
13000
13385
|
name: "Ucd Mint Validator",
|
|
13001
13386
|
description: "Production Ucd Mint Validator",
|
|
13002
13387
|
version: "1.0.0",
|
|
@@ -13012,7 +13397,9 @@ var require_lit_actions_registry = __commonJS({
|
|
|
13012
13397
|
},
|
|
13013
13398
|
processPaymentValidator: {
|
|
13014
13399
|
cid: "QmR7rT7iG74YeSVoavTSTgBtZqcmCKG3Tf3hmzQ3zTFUb3",
|
|
13015
|
-
authorizedCidHex:
|
|
13400
|
+
authorizedCidHex: cidToHex(
|
|
13401
|
+
"QmR7rT7iG74YeSVoavTSTgBtZqcmCKG3Tf3hmzQ3zTFUb3"
|
|
13402
|
+
),
|
|
13016
13403
|
name: "Process Payment Validator",
|
|
13017
13404
|
description: "Production Process Payment Validator",
|
|
13018
13405
|
version: "1.0.0",
|
|
@@ -13028,7 +13415,9 @@ var require_lit_actions_registry = __commonJS({
|
|
|
13028
13415
|
},
|
|
13029
13416
|
extendPositionValidator: {
|
|
13030
13417
|
cid: "QmZGWWnjVcfHzSBQzgXfMmxQJUYXKt9jsCXrCPZXzuPxPv",
|
|
13031
|
-
authorizedCidHex:
|
|
13418
|
+
authorizedCidHex: cidToHex(
|
|
13419
|
+
"QmZGWWnjVcfHzSBQzgXfMmxQJUYXKt9jsCXrCPZXzuPxPv"
|
|
13420
|
+
),
|
|
13032
13421
|
name: "Extend Position Validator",
|
|
13033
13422
|
description: "Production Extend Position Validator",
|
|
13034
13423
|
version: "1.0.0",
|
|
@@ -13044,7 +13433,9 @@ var require_lit_actions_registry = __commonJS({
|
|
|
13044
13433
|
},
|
|
13045
13434
|
btcWithdrawal: {
|
|
13046
13435
|
cid: "QmX9HxZsogBTBSurQPnopMtGDQRXtd3HynHxkqgq23u3rm",
|
|
13047
|
-
authorizedCidHex:
|
|
13436
|
+
authorizedCidHex: cidToHex(
|
|
13437
|
+
"QmX9HxZsogBTBSurQPnopMtGDQRXtd3HynHxkqgq23u3rm"
|
|
13438
|
+
),
|
|
13048
13439
|
name: "Btc Withdrawal",
|
|
13049
13440
|
description: "Production Btc Withdrawal",
|
|
13050
13441
|
version: "1.0.0",
|
|
@@ -13060,7 +13451,9 @@ var require_lit_actions_registry = __commonJS({
|
|
|
13060
13451
|
},
|
|
13061
13452
|
liquidationValidator: {
|
|
13062
13453
|
cid: "QmbufZa57vL7k3eeeFs9vy6LPry5XMYjJrYw7wCHzc3TWH",
|
|
13063
|
-
authorizedCidHex:
|
|
13454
|
+
authorizedCidHex: cidToHex(
|
|
13455
|
+
"QmbufZa57vL7k3eeeFs9vy6LPry5XMYjJrYw7wCHzc3TWH"
|
|
13456
|
+
),
|
|
13064
13457
|
name: "Liquidation Validator",
|
|
13065
13458
|
description: "Production Liquidation Validator",
|
|
13066
13459
|
version: "1.0.0",
|
|
@@ -13076,7 +13469,9 @@ var require_lit_actions_registry = __commonJS({
|
|
|
13076
13469
|
},
|
|
13077
13470
|
priceOracle: {
|
|
13078
13471
|
cid: "QmXKfK7JJFixFPvm48uwgVVW7s3eoE3sEyFEbZZ3dfNK1e",
|
|
13079
|
-
authorizedCidHex:
|
|
13472
|
+
authorizedCidHex: cidToHex(
|
|
13473
|
+
"QmXKfK7JJFixFPvm48uwgVVW7s3eoE3sEyFEbZZ3dfNK1e"
|
|
13474
|
+
),
|
|
13080
13475
|
name: "Price Oracle",
|
|
13081
13476
|
description: "Production Price Oracle (Chipotle main+getPrivateKey)",
|
|
13082
13477
|
version: "1.1.0",
|
|
@@ -13092,7 +13487,9 @@ var require_lit_actions_registry = __commonJS({
|
|
|
13092
13487
|
},
|
|
13093
13488
|
loanVaultBtcBalance: {
|
|
13094
13489
|
cid: "QmUdw25GDYMY6gm7nChBxpHtkwtoSEMjf66QWJ1dCikWkt",
|
|
13095
|
-
authorizedCidHex:
|
|
13490
|
+
authorizedCidHex: cidToHex(
|
|
13491
|
+
"QmUdw25GDYMY6gm7nChBxpHtkwtoSEMjf66QWJ1dCikWkt"
|
|
13492
|
+
),
|
|
13096
13493
|
name: "Loan Vault Btc Balance",
|
|
13097
13494
|
description: "Production Loan Vault Btc Balance",
|
|
13098
13495
|
version: "1.0.0",
|
|
@@ -13108,7 +13505,9 @@ var require_lit_actions_registry = __commonJS({
|
|
|
13108
13505
|
},
|
|
13109
13506
|
adminLiquidationValidator: {
|
|
13110
13507
|
cid: "QmYBpkLWKZbEBgdZnfFMabszmPYQJsfdVsqwVyJqdrMnP4",
|
|
13111
|
-
authorizedCidHex:
|
|
13508
|
+
authorizedCidHex: cidToHex(
|
|
13509
|
+
"QmYBpkLWKZbEBgdZnfFMabszmPYQJsfdVsqwVyJqdrMnP4"
|
|
13510
|
+
),
|
|
13112
13511
|
name: "Admin Liquidation Validator",
|
|
13113
13512
|
description: "Production Admin Liquidation Validator",
|
|
13114
13513
|
version: "1.0.0",
|
|
@@ -13124,7 +13523,9 @@ var require_lit_actions_registry = __commonJS({
|
|
|
13124
13523
|
},
|
|
13125
13524
|
alwaysSigner: {
|
|
13126
13525
|
cid: "QmXQjybSsdE19Da66to9Hh7X2dLFwpZPhjoqojxbpk7Nvs",
|
|
13127
|
-
authorizedCidHex:
|
|
13526
|
+
authorizedCidHex: cidToHex(
|
|
13527
|
+
"QmXQjybSsdE19Da66to9Hh7X2dLFwpZPhjoqojxbpk7Nvs"
|
|
13528
|
+
),
|
|
13128
13529
|
name: "Always Signer",
|
|
13129
13530
|
description: "Production Always Signer",
|
|
13130
13531
|
version: "1.0.0",
|
|
@@ -13136,336 +13537,80 @@ var require_lit_actions_registry = __commonJS({
|
|
|
13136
13537
|
};
|
|
13137
13538
|
function getDeploymentsForNetwork(network) {
|
|
13138
13539
|
if (network === "chipotle")
|
|
13139
|
-
return
|
|
13540
|
+
return DH_LIT_ACTIONS_CHIPOTLE3;
|
|
13140
13541
|
throw new Error(`Unsupported LIT network: ${network}`);
|
|
13141
13542
|
}
|
|
13142
|
-
|
|
13143
|
-
}
|
|
13144
|
-
});
|
|
13145
|
-
|
|
13146
|
-
// node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/lit-action-helpers.js
|
|
13147
|
-
var require_lit_action_helpers = __commonJS({
|
|
13148
|
-
"node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/lit-action-helpers.js"(exports) {
|
|
13149
|
-
"use strict";
|
|
13150
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13151
|
-
exports.getLitActionCID = getLitActionCID;
|
|
13152
|
-
exports.getLitActionConfig = getLitActionConfig;
|
|
13153
|
-
exports.isLitActionDeployed = isLitActionDeployed;
|
|
13154
|
-
exports.validateDeployedActions = validateDeployedActions;
|
|
13155
|
-
exports.getDeployedActions = getDeployedActions;
|
|
13156
|
-
var lit_actions_registry_1 = require_lit_actions_registry();
|
|
13543
|
+
var CHIPOTLE_DEPLOYMENTS = DH_LIT_ACTIONS_CHIPOTLE3;
|
|
13157
13544
|
function getLitActionCID(litNetwork = "chipotle", actionName) {
|
|
13158
|
-
const deployments =
|
|
13545
|
+
const deployments = getDeploymentsForNetwork(litNetwork);
|
|
13159
13546
|
const action = deployments[actionName];
|
|
13160
13547
|
if (!action || !action.deployed || !action.cid) {
|
|
13161
|
-
throw new Error(
|
|
13548
|
+
throw new Error(
|
|
13549
|
+
`LIT Action '${actionName}' not deployed on network '${litNetwork}'. Check deployment status.`
|
|
13550
|
+
);
|
|
13162
13551
|
}
|
|
13163
13552
|
return action.cid;
|
|
13164
13553
|
}
|
|
13165
13554
|
function getLitActionConfig(actionName, litNetwork = "chipotle") {
|
|
13166
|
-
const deployments =
|
|
13555
|
+
const deployments = getDeploymentsForNetwork(litNetwork);
|
|
13167
13556
|
const action = deployments[actionName];
|
|
13168
13557
|
if (!action) {
|
|
13169
|
-
throw new Error(
|
|
13558
|
+
throw new Error(
|
|
13559
|
+
`LIT Action '${actionName}' not found in registry for network '${litNetwork}'.`
|
|
13560
|
+
);
|
|
13170
13561
|
}
|
|
13171
13562
|
return action;
|
|
13172
13563
|
}
|
|
13173
13564
|
function isLitActionDeployed(actionName, litNetwork = "chipotle") {
|
|
13174
|
-
const deployments =
|
|
13565
|
+
const deployments = getDeploymentsForNetwork(litNetwork);
|
|
13175
13566
|
const action = deployments[actionName];
|
|
13176
13567
|
return !!(action && action.deployed && action.cid);
|
|
13177
13568
|
}
|
|
13178
13569
|
function validateDeployedActions(requiredActions, litNetwork = "chipotle") {
|
|
13179
|
-
return requiredActions.every(
|
|
13570
|
+
return requiredActions.every(
|
|
13571
|
+
(actionName) => isLitActionDeployed(actionName, litNetwork)
|
|
13572
|
+
);
|
|
13180
13573
|
}
|
|
13181
13574
|
function getDeployedActions(litNetwork = "chipotle") {
|
|
13182
|
-
const deployments =
|
|
13183
|
-
return Object.values(deployments).filter(
|
|
13575
|
+
const deployments = getDeploymentsForNetwork(litNetwork);
|
|
13576
|
+
return Object.values(deployments).filter(
|
|
13577
|
+
(action) => action && action.deployed
|
|
13578
|
+
);
|
|
13184
13579
|
}
|
|
13185
|
-
}
|
|
13186
|
-
});
|
|
13187
|
-
|
|
13188
|
-
// node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/pkp-setup.js
|
|
13189
|
-
var require_pkp_setup = __commonJS({
|
|
13190
|
-
"node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/pkp-setup.js"(exports) {
|
|
13191
|
-
"use strict";
|
|
13192
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13193
|
-
exports.getPKPValidatorSetup = getPKPValidatorSetup;
|
|
13194
|
-
var lit_actions_registry_1 = require_lit_actions_registry();
|
|
13195
13580
|
function getPKPValidatorSetup(litNetwork = "chipotle") {
|
|
13196
|
-
const deployments =
|
|
13581
|
+
const deployments = getDeploymentsForNetwork(litNetwork);
|
|
13197
13582
|
const litAction = deployments.pkpValidator;
|
|
13198
13583
|
if (!litAction || !litAction.pkp) {
|
|
13199
|
-
throw new Error(
|
|
13584
|
+
throw new Error(
|
|
13585
|
+
`PKP validator setup is not available for litNetwork='${litNetwork}'. Ensure the pkpValidator action (with pkp attached) is defined in the registry.`
|
|
13586
|
+
);
|
|
13200
13587
|
}
|
|
13201
13588
|
return {
|
|
13202
13589
|
litAction,
|
|
13203
13590
|
pkp: litAction.pkp
|
|
13204
13591
|
};
|
|
13205
13592
|
}
|
|
13206
|
-
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
13211
|
-
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
exports.debugTrace = debugTrace;
|
|
13221
|
-
exports.logRequest = logRequest;
|
|
13222
|
-
exports.logResponse = logResponse;
|
|
13223
|
-
exports.logError = logError;
|
|
13224
|
-
exports.logConnectionAttempt = logConnectionAttempt;
|
|
13225
|
-
exports.logConnectionSuccess = logConnectionSuccess;
|
|
13226
|
-
exports.logConnectionFailure = logConnectionFailure;
|
|
13227
|
-
exports.logPkpOperation = logPkpOperation;
|
|
13228
|
-
exports.logSessionSignatures = logSessionSignatures;
|
|
13229
|
-
exports.logLitActionExecution = logLitActionExecution;
|
|
13230
|
-
exports.logLitActionResult = logLitActionResult;
|
|
13231
|
-
exports.logTestStart = logTestStart;
|
|
13232
|
-
exports.logTestEnd = logTestEnd;
|
|
13233
|
-
var LogLevel2;
|
|
13234
|
-
(function(LogLevel3) {
|
|
13235
|
-
LogLevel3[LogLevel3["ERROR"] = 0] = "ERROR";
|
|
13236
|
-
LogLevel3[LogLevel3["WARN"] = 1] = "WARN";
|
|
13237
|
-
LogLevel3[LogLevel3["INFO"] = 2] = "INFO";
|
|
13238
|
-
LogLevel3[LogLevel3["DEBUG"] = 3] = "DEBUG";
|
|
13239
|
-
LogLevel3[LogLevel3["TRACE"] = 4] = "TRACE";
|
|
13240
|
-
})(LogLevel2 || (exports.LogLevel = LogLevel2 = {}));
|
|
13241
|
-
exports.DEFAULT_DEBUG_CONFIG = {
|
|
13242
|
-
level: LogLevel2.INFO,
|
|
13243
|
-
enableTimestamps: true,
|
|
13244
|
-
enablePerformanceMetrics: true,
|
|
13245
|
-
enableRequestLogging: true,
|
|
13246
|
-
enableNetworkMetrics: true
|
|
13247
|
-
};
|
|
13248
|
-
var debugConfig = { ...exports.DEFAULT_DEBUG_CONFIG };
|
|
13249
|
-
function configureDebugLogging(config) {
|
|
13250
|
-
debugConfig = { ...debugConfig, ...config };
|
|
13251
|
-
}
|
|
13252
|
-
function getTimestamp() {
|
|
13253
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
13254
|
-
}
|
|
13255
|
-
function formatMessage(level, component, message, metadata) {
|
|
13256
|
-
const timestamp = debugConfig.enableTimestamps ? `[${getTimestamp()}] ` : "";
|
|
13257
|
-
const metadataStr = metadata ? ` ${JSON.stringify(metadata)}` : "";
|
|
13258
|
-
return `${timestamp}[${level}] [${component}] ${message}${metadataStr}`;
|
|
13259
|
-
}
|
|
13260
|
-
var PerformanceTracker = class {
|
|
13261
|
-
constructor(operationName) {
|
|
13262
|
-
this.operationName = operationName;
|
|
13263
|
-
this.markers = /* @__PURE__ */ new Map();
|
|
13264
|
-
this.startTime = Date.now();
|
|
13265
|
-
this.log("PERF", `Started: ${operationName}`);
|
|
13266
|
-
}
|
|
13267
|
-
mark(label) {
|
|
13268
|
-
const elapsed = Date.now() - this.startTime;
|
|
13269
|
-
this.markers.set(label, elapsed);
|
|
13270
|
-
this.log("PERF", `${this.operationName} - ${label}: ${elapsed}ms`);
|
|
13271
|
-
}
|
|
13272
|
-
end(success2 = true) {
|
|
13273
|
-
const totalTime = Date.now() - this.startTime;
|
|
13274
|
-
const status = success2 ? "SUCCESS" : "FAILED";
|
|
13275
|
-
this.log("PERF", `${this.operationName} - ${status}: ${totalTime}ms`);
|
|
13276
|
-
if (debugConfig.enablePerformanceMetrics && this.markers.size > 0) {
|
|
13277
|
-
console.log(`\u{1F4CA} Performance Breakdown for ${this.operationName}:`);
|
|
13278
|
-
for (const [label, time] of this.markers) {
|
|
13279
|
-
console.log(` ${label}: ${time}ms`);
|
|
13280
|
-
}
|
|
13281
|
-
console.log(` Total: ${totalTime}ms`);
|
|
13282
|
-
}
|
|
13283
|
-
return totalTime;
|
|
13284
|
-
}
|
|
13285
|
-
log(level, message) {
|
|
13286
|
-
if (debugConfig.enablePerformanceMetrics) {
|
|
13287
|
-
console.log(formatMessage(level, "PERFORMANCE", message));
|
|
13288
|
-
}
|
|
13289
|
-
}
|
|
13290
|
-
};
|
|
13291
|
-
exports.PerformanceTracker = PerformanceTracker;
|
|
13292
|
-
var NetworkMetricsCollector = class {
|
|
13293
|
-
constructor() {
|
|
13294
|
-
this.metrics = /* @__PURE__ */ new Map();
|
|
13295
|
-
}
|
|
13296
|
-
getMetrics(operation) {
|
|
13297
|
-
if (!this.metrics.has(operation)) {
|
|
13298
|
-
this.metrics.set(operation, {
|
|
13299
|
-
requestCount: 0,
|
|
13300
|
-
successCount: 0,
|
|
13301
|
-
failureCount: 0,
|
|
13302
|
-
averageLatency: 0,
|
|
13303
|
-
startTime: Date.now()
|
|
13304
|
-
});
|
|
13305
|
-
}
|
|
13306
|
-
return this.metrics.get(operation);
|
|
13307
|
-
}
|
|
13308
|
-
recordRequest(operation, success2, latency, error) {
|
|
13309
|
-
const metrics = this.getMetrics(operation);
|
|
13310
|
-
metrics.requestCount++;
|
|
13311
|
-
if (success2) {
|
|
13312
|
-
metrics.successCount++;
|
|
13313
|
-
metrics.averageLatency = (metrics.averageLatency * (metrics.successCount - 1) + latency) / metrics.successCount;
|
|
13314
|
-
} else {
|
|
13315
|
-
metrics.failureCount++;
|
|
13316
|
-
if (error)
|
|
13317
|
-
metrics.lastError = error;
|
|
13318
|
-
}
|
|
13319
|
-
if (debugConfig.enableNetworkMetrics) {
|
|
13320
|
-
const successRate = (metrics.successCount / metrics.requestCount * 100).toFixed(1);
|
|
13321
|
-
debugLog("NETWORK", `${operation} - Success: ${success2}, Latency: ${latency}ms, Success Rate: ${successRate}%`);
|
|
13322
|
-
}
|
|
13323
|
-
}
|
|
13324
|
-
printSummary() {
|
|
13325
|
-
if (!debugConfig.enableNetworkMetrics)
|
|
13326
|
-
return;
|
|
13327
|
-
console.log("\n\u{1F4C8} Network Metrics Summary:");
|
|
13328
|
-
for (const [operation, metrics] of this.metrics) {
|
|
13329
|
-
const successRate = (metrics.successCount / metrics.requestCount * 100).toFixed(1);
|
|
13330
|
-
const runtime = Date.now() - metrics.startTime;
|
|
13331
|
-
console.log(` ${operation}:`);
|
|
13332
|
-
console.log(` Requests: ${metrics.requestCount}`);
|
|
13333
|
-
console.log(` Success Rate: ${successRate}%`);
|
|
13334
|
-
console.log(` Avg Latency: ${metrics.averageLatency.toFixed(0)}ms`);
|
|
13335
|
-
console.log(` Runtime: ${runtime}ms`);
|
|
13336
|
-
if (metrics.lastError) {
|
|
13337
|
-
console.log(` Last Error: ${metrics.lastError}`);
|
|
13338
|
-
}
|
|
13339
|
-
}
|
|
13340
|
-
}
|
|
13341
|
-
};
|
|
13342
|
-
exports.networkMetrics = new NetworkMetricsCollector();
|
|
13343
|
-
function debugError(component, message, metadata) {
|
|
13344
|
-
if (debugConfig.level >= LogLevel2.ERROR) {
|
|
13345
|
-
console.error(formatMessage("ERROR", component, message, metadata));
|
|
13346
|
-
}
|
|
13347
|
-
}
|
|
13348
|
-
function debugWarn(component, message, metadata) {
|
|
13349
|
-
if (debugConfig.level >= LogLevel2.WARN) {
|
|
13350
|
-
console.warn(formatMessage("WARN", component, message, metadata));
|
|
13351
|
-
}
|
|
13352
|
-
}
|
|
13353
|
-
function debugInfo(component, message, metadata) {
|
|
13354
|
-
if (debugConfig.level >= LogLevel2.INFO) {
|
|
13355
|
-
console.log(formatMessage("INFO", component, message, metadata));
|
|
13356
|
-
}
|
|
13357
|
-
}
|
|
13358
|
-
function debugLog(component, message, metadata) {
|
|
13359
|
-
if (debugConfig.level >= LogLevel2.DEBUG) {
|
|
13360
|
-
console.log(formatMessage("DEBUG", component, message, metadata));
|
|
13361
|
-
}
|
|
13362
|
-
}
|
|
13363
|
-
function debugTrace(component, message, metadata) {
|
|
13364
|
-
if (debugConfig.level >= LogLevel2.TRACE) {
|
|
13365
|
-
console.log(formatMessage("TRACE", component, message, metadata));
|
|
13366
|
-
}
|
|
13367
|
-
}
|
|
13368
|
-
function logRequest(component, operation, params) {
|
|
13369
|
-
if (!debugConfig.enableRequestLogging)
|
|
13370
|
-
return;
|
|
13371
|
-
debugLog(component, `\u{1F504} Request: ${operation}`, {
|
|
13372
|
-
operation,
|
|
13373
|
-
params: JSON.stringify(params, null, 2)
|
|
13374
|
-
});
|
|
13375
|
-
}
|
|
13376
|
-
function logResponse(component, operation, response, duration) {
|
|
13377
|
-
if (!debugConfig.enableRequestLogging)
|
|
13378
|
-
return;
|
|
13379
|
-
debugLog(component, `\u2705 Response: ${operation} (${duration}ms)`, {
|
|
13380
|
-
operation,
|
|
13381
|
-
duration,
|
|
13382
|
-
response: typeof response === "object" ? JSON.stringify(response, null, 2) : response
|
|
13383
|
-
});
|
|
13384
|
-
}
|
|
13385
|
-
function logError(component, operation, error, duration) {
|
|
13386
|
-
const durationStr = duration ? ` (${duration}ms)` : "";
|
|
13387
|
-
debugError(component, `\u274C Error: ${operation}${durationStr}`, {
|
|
13388
|
-
operation,
|
|
13389
|
-
duration,
|
|
13390
|
-
error: error?.message || error?.toString() || "Unknown error",
|
|
13391
|
-
stack: error?.stack
|
|
13392
|
-
});
|
|
13393
|
-
}
|
|
13394
|
-
function logConnectionAttempt(network, attempt, maxAttempts) {
|
|
13395
|
-
debugInfo("CONNECTION", `\u{1F517} Connecting to ${network} (attempt ${attempt}/${maxAttempts})`);
|
|
13396
|
-
}
|
|
13397
|
-
function logConnectionSuccess(network, latency) {
|
|
13398
|
-
debugInfo("CONNECTION", `\u2705 Connected to ${network} (${latency}ms)`);
|
|
13399
|
-
exports.networkMetrics.recordRequest(`connection-${network}`, true, latency);
|
|
13400
|
-
}
|
|
13401
|
-
function logConnectionFailure(network, error, attempt) {
|
|
13402
|
-
debugError("CONNECTION", `\u274C Connection failed to ${network} (attempt ${attempt})`, { error });
|
|
13403
|
-
exports.networkMetrics.recordRequest(`connection-${network}`, false, 0, error);
|
|
13404
|
-
}
|
|
13405
|
-
function logPkpOperation(operation, pkpId, details) {
|
|
13406
|
-
const pkpStr = pkpId ? ` (PKP: ${pkpId.slice(0, 8)}...)` : "";
|
|
13407
|
-
debugInfo("PKP", `\u{1F511} ${operation}${pkpStr}`, details);
|
|
13408
|
-
}
|
|
13409
|
-
function logSessionSignatures(count, expiration) {
|
|
13410
|
-
debugInfo("SESSION", `\u{1F510} Generated ${count} session signatures (expires: ${expiration})`);
|
|
13411
|
-
}
|
|
13412
|
-
function logLitActionExecution(cid, params) {
|
|
13413
|
-
debugInfo("LIT_ACTION", `\u26A1 Executing LIT Action: ${cid}`, {
|
|
13414
|
-
cid,
|
|
13415
|
-
params
|
|
13416
|
-
});
|
|
13417
|
-
}
|
|
13418
|
-
function logLitActionResult(cid, success2, duration, result) {
|
|
13419
|
-
const status = success2 ? "\u2705" : "\u274C";
|
|
13420
|
-
debugInfo("LIT_ACTION", `${status} LIT Action completed: ${cid} (${duration}ms)`, {
|
|
13421
|
-
cid,
|
|
13422
|
-
success: success2,
|
|
13423
|
-
duration,
|
|
13424
|
-
result: success2 && result ? JSON.stringify(result, null, 2) : void 0
|
|
13425
|
-
});
|
|
13426
|
-
}
|
|
13427
|
-
function logTestStart(testName) {
|
|
13428
|
-
debugInfo("TEST", `\u{1F9EA} Starting test: ${testName}`);
|
|
13429
|
-
return new PerformanceTracker(testName);
|
|
13430
|
-
}
|
|
13431
|
-
function logTestEnd(testName, success2, duration) {
|
|
13432
|
-
const status = success2 ? "\u2705" : "\u274C";
|
|
13433
|
-
debugInfo("TEST", `${status} Test completed: ${testName} (${duration}ms)`);
|
|
13434
|
-
exports.networkMetrics.printSummary();
|
|
13435
|
-
}
|
|
13436
|
-
}
|
|
13437
|
-
});
|
|
13438
|
-
|
|
13439
|
-
// node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/error-classification.js
|
|
13440
|
-
var require_error_classification = __commonJS({
|
|
13441
|
-
"node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/error-classification.js"(exports) {
|
|
13442
|
-
"use strict";
|
|
13443
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13444
|
-
exports.litProtocolErrors = exports.RetryStrategy = exports.ErrorCategory = void 0;
|
|
13445
|
-
exports.classifyError = classifyError;
|
|
13446
|
-
exports.getRetryConfigFromClassification = getRetryConfigFromClassification;
|
|
13447
|
-
exports.analyzeError = analyzeError;
|
|
13448
|
-
exports.createErrorReport = createErrorReport;
|
|
13449
|
-
var ErrorCategory2;
|
|
13450
|
-
(function(ErrorCategory3) {
|
|
13451
|
-
ErrorCategory3["NETWORK"] = "network";
|
|
13452
|
-
ErrorCategory3["PROTOCOL"] = "protocol";
|
|
13453
|
-
ErrorCategory3["AUTHENTICATION"] = "authentication";
|
|
13454
|
-
ErrorCategory3["RESOURCE"] = "resource";
|
|
13455
|
-
ErrorCategory3["VALIDATION"] = "validation";
|
|
13456
|
-
ErrorCategory3["TIMEOUT"] = "timeout";
|
|
13457
|
-
ErrorCategory3["RATE_LIMIT"] = "rate_limit";
|
|
13458
|
-
ErrorCategory3["CONFIGURATION"] = "configuration";
|
|
13459
|
-
ErrorCategory3["UNKNOWN"] = "unknown";
|
|
13460
|
-
})(ErrorCategory2 || (exports.ErrorCategory = ErrorCategory2 = {}));
|
|
13461
|
-
var RetryStrategy;
|
|
13462
|
-
(function(RetryStrategy2) {
|
|
13593
|
+
init_debug_logger();
|
|
13594
|
+
var ErrorCategory2 = /* @__PURE__ */ ((ErrorCategory22) => {
|
|
13595
|
+
ErrorCategory22["NETWORK"] = "network";
|
|
13596
|
+
ErrorCategory22["PROTOCOL"] = "protocol";
|
|
13597
|
+
ErrorCategory22["AUTHENTICATION"] = "authentication";
|
|
13598
|
+
ErrorCategory22["RESOURCE"] = "resource";
|
|
13599
|
+
ErrorCategory22["VALIDATION"] = "validation";
|
|
13600
|
+
ErrorCategory22["TIMEOUT"] = "timeout";
|
|
13601
|
+
ErrorCategory22["RATE_LIMIT"] = "rate_limit";
|
|
13602
|
+
ErrorCategory22["CONFIGURATION"] = "configuration";
|
|
13603
|
+
ErrorCategory22["UNKNOWN"] = "unknown";
|
|
13604
|
+
return ErrorCategory22;
|
|
13605
|
+
})(ErrorCategory2 || {});
|
|
13606
|
+
var RetryStrategy = /* @__PURE__ */ ((RetryStrategy2) => {
|
|
13463
13607
|
RetryStrategy2["AGGRESSIVE"] = "aggressive";
|
|
13464
13608
|
RetryStrategy2["CONSERVATIVE"] = "conservative";
|
|
13465
13609
|
RetryStrategy2["EXPONENTIAL"] = "exponential";
|
|
13466
13610
|
RetryStrategy2["LINEAR"] = "linear";
|
|
13467
13611
|
RetryStrategy2["NONE"] = "none";
|
|
13468
|
-
|
|
13612
|
+
return RetryStrategy2;
|
|
13613
|
+
})(RetryStrategy || {});
|
|
13469
13614
|
var LIT_ERROR_PATTERNS = {
|
|
13470
13615
|
// Network and connection errors
|
|
13471
13616
|
network: [
|
|
@@ -13558,31 +13703,46 @@ var require_error_classification = __commonJS({
|
|
|
13558
13703
|
]
|
|
13559
13704
|
};
|
|
13560
13705
|
var RETRY_STRATEGIES = {
|
|
13561
|
-
[
|
|
13706
|
+
[
|
|
13707
|
+
"aggressive"
|
|
13708
|
+
/* AGGRESSIVE */
|
|
13709
|
+
]: {
|
|
13562
13710
|
maxAttempts: 5,
|
|
13563
13711
|
baseDelayMs: 500,
|
|
13564
13712
|
maxDelayMs: 5e3,
|
|
13565
13713
|
multiplier: 1.5
|
|
13566
13714
|
},
|
|
13567
|
-
[
|
|
13715
|
+
[
|
|
13716
|
+
"conservative"
|
|
13717
|
+
/* CONSERVATIVE */
|
|
13718
|
+
]: {
|
|
13568
13719
|
maxAttempts: 3,
|
|
13569
13720
|
baseDelayMs: 3e3,
|
|
13570
13721
|
maxDelayMs: 3e4,
|
|
13571
13722
|
multiplier: 2.5
|
|
13572
13723
|
},
|
|
13573
|
-
[
|
|
13724
|
+
[
|
|
13725
|
+
"exponential"
|
|
13726
|
+
/* EXPONENTIAL */
|
|
13727
|
+
]: {
|
|
13574
13728
|
maxAttempts: 4,
|
|
13575
13729
|
baseDelayMs: 1e3,
|
|
13576
13730
|
maxDelayMs: 15e3,
|
|
13577
13731
|
multiplier: 2
|
|
13578
13732
|
},
|
|
13579
|
-
[
|
|
13733
|
+
[
|
|
13734
|
+
"linear"
|
|
13735
|
+
/* LINEAR */
|
|
13736
|
+
]: {
|
|
13580
13737
|
maxAttempts: 3,
|
|
13581
13738
|
baseDelayMs: 2e3,
|
|
13582
13739
|
maxDelayMs: 1e4,
|
|
13583
13740
|
multiplier: 1
|
|
13584
13741
|
},
|
|
13585
|
-
[
|
|
13742
|
+
[
|
|
13743
|
+
"none"
|
|
13744
|
+
/* NONE */
|
|
13745
|
+
]: {
|
|
13586
13746
|
maxAttempts: 1,
|
|
13587
13747
|
baseDelayMs: 0,
|
|
13588
13748
|
maxDelayMs: 0,
|
|
@@ -13590,11 +13750,17 @@ var require_error_classification = __commonJS({
|
|
|
13590
13750
|
}
|
|
13591
13751
|
};
|
|
13592
13752
|
var CLASSIFICATION_RULES = {
|
|
13593
|
-
[
|
|
13594
|
-
|
|
13595
|
-
|
|
13753
|
+
[
|
|
13754
|
+
"network"
|
|
13755
|
+
/* NETWORK */
|
|
13756
|
+
]: {
|
|
13757
|
+
category: "network",
|
|
13758
|
+
retryStrategy: "aggressive",
|
|
13596
13759
|
isRetryable: true,
|
|
13597
|
-
...RETRY_STRATEGIES[
|
|
13760
|
+
...RETRY_STRATEGIES[
|
|
13761
|
+
"aggressive"
|
|
13762
|
+
/* AGGRESSIVE */
|
|
13763
|
+
],
|
|
13598
13764
|
description: "Network connectivity or communication error",
|
|
13599
13765
|
troubleshooting: [
|
|
13600
13766
|
"Check internet connection",
|
|
@@ -13603,11 +13769,17 @@ var require_error_classification = __commonJS({
|
|
|
13603
13769
|
"Try connecting to different node endpoints"
|
|
13604
13770
|
]
|
|
13605
13771
|
},
|
|
13606
|
-
[
|
|
13607
|
-
|
|
13608
|
-
|
|
13772
|
+
[
|
|
13773
|
+
"protocol"
|
|
13774
|
+
/* PROTOCOL */
|
|
13775
|
+
]: {
|
|
13776
|
+
category: "protocol",
|
|
13777
|
+
retryStrategy: "conservative",
|
|
13609
13778
|
isRetryable: true,
|
|
13610
|
-
...RETRY_STRATEGIES[
|
|
13779
|
+
...RETRY_STRATEGIES[
|
|
13780
|
+
"conservative"
|
|
13781
|
+
/* CONSERVATIVE */
|
|
13782
|
+
],
|
|
13611
13783
|
description: "LIT Protocol specific operational error",
|
|
13612
13784
|
troubleshooting: [
|
|
13613
13785
|
"Check LIT Protocol network status",
|
|
@@ -13616,11 +13788,17 @@ var require_error_classification = __commonJS({
|
|
|
13616
13788
|
"Wait for network consensus"
|
|
13617
13789
|
]
|
|
13618
13790
|
},
|
|
13619
|
-
[
|
|
13620
|
-
|
|
13621
|
-
|
|
13791
|
+
[
|
|
13792
|
+
"authentication"
|
|
13793
|
+
/* AUTHENTICATION */
|
|
13794
|
+
]: {
|
|
13795
|
+
category: "authentication",
|
|
13796
|
+
retryStrategy: "exponential",
|
|
13622
13797
|
isRetryable: true,
|
|
13623
|
-
...RETRY_STRATEGIES[
|
|
13798
|
+
...RETRY_STRATEGIES[
|
|
13799
|
+
"exponential"
|
|
13800
|
+
/* EXPONENTIAL */
|
|
13801
|
+
],
|
|
13624
13802
|
maxAttempts: 2,
|
|
13625
13803
|
// Override: limited retries for auth issues
|
|
13626
13804
|
description: "Authentication or authorization error",
|
|
@@ -13631,11 +13809,17 @@ var require_error_classification = __commonJS({
|
|
|
13631
13809
|
"Check PKP authorization status"
|
|
13632
13810
|
]
|
|
13633
13811
|
},
|
|
13634
|
-
[
|
|
13635
|
-
|
|
13636
|
-
|
|
13812
|
+
[
|
|
13813
|
+
"resource"
|
|
13814
|
+
/* RESOURCE */
|
|
13815
|
+
]: {
|
|
13816
|
+
category: "resource",
|
|
13817
|
+
retryStrategy: "linear",
|
|
13637
13818
|
isRetryable: true,
|
|
13638
|
-
...RETRY_STRATEGIES[
|
|
13819
|
+
...RETRY_STRATEGIES[
|
|
13820
|
+
"linear"
|
|
13821
|
+
/* LINEAR */
|
|
13822
|
+
],
|
|
13639
13823
|
maxAttempts: 2,
|
|
13640
13824
|
// Override: limited retries for resource issues
|
|
13641
13825
|
description: "Resource not found or validation error",
|
|
@@ -13646,11 +13830,17 @@ var require_error_classification = __commonJS({
|
|
|
13646
13830
|
"Wait for resource propagation"
|
|
13647
13831
|
]
|
|
13648
13832
|
},
|
|
13649
|
-
[
|
|
13650
|
-
|
|
13651
|
-
|
|
13833
|
+
[
|
|
13834
|
+
"validation"
|
|
13835
|
+
/* VALIDATION */
|
|
13836
|
+
]: {
|
|
13837
|
+
category: "validation",
|
|
13838
|
+
retryStrategy: "none",
|
|
13652
13839
|
isRetryable: false,
|
|
13653
|
-
...RETRY_STRATEGIES[
|
|
13840
|
+
...RETRY_STRATEGIES[
|
|
13841
|
+
"none"
|
|
13842
|
+
/* NONE */
|
|
13843
|
+
],
|
|
13654
13844
|
description: "Input validation or schema error",
|
|
13655
13845
|
troubleshooting: [
|
|
13656
13846
|
"Check input parameters format",
|
|
@@ -13659,11 +13849,17 @@ var require_error_classification = __commonJS({
|
|
|
13659
13849
|
"Review API documentation"
|
|
13660
13850
|
]
|
|
13661
13851
|
},
|
|
13662
|
-
[
|
|
13663
|
-
|
|
13664
|
-
|
|
13852
|
+
[
|
|
13853
|
+
"timeout"
|
|
13854
|
+
/* TIMEOUT */
|
|
13855
|
+
]: {
|
|
13856
|
+
category: "timeout",
|
|
13857
|
+
retryStrategy: "conservative",
|
|
13665
13858
|
isRetryable: true,
|
|
13666
|
-
...RETRY_STRATEGIES[
|
|
13859
|
+
...RETRY_STRATEGIES[
|
|
13860
|
+
"conservative"
|
|
13861
|
+
/* CONSERVATIVE */
|
|
13862
|
+
],
|
|
13667
13863
|
description: "Operation timeout error",
|
|
13668
13864
|
troubleshooting: [
|
|
13669
13865
|
"Increase timeout values",
|
|
@@ -13672,11 +13868,17 @@ var require_error_classification = __commonJS({
|
|
|
13672
13868
|
"Split operations into smaller chunks"
|
|
13673
13869
|
]
|
|
13674
13870
|
},
|
|
13675
|
-
[
|
|
13676
|
-
|
|
13677
|
-
|
|
13871
|
+
[
|
|
13872
|
+
"rate_limit"
|
|
13873
|
+
/* RATE_LIMIT */
|
|
13874
|
+
]: {
|
|
13875
|
+
category: "rate_limit",
|
|
13876
|
+
retryStrategy: "conservative",
|
|
13678
13877
|
isRetryable: true,
|
|
13679
|
-
...RETRY_STRATEGIES[
|
|
13878
|
+
...RETRY_STRATEGIES[
|
|
13879
|
+
"conservative"
|
|
13880
|
+
/* CONSERVATIVE */
|
|
13881
|
+
],
|
|
13680
13882
|
maxAttempts: 2,
|
|
13681
13883
|
// Override: limited retries to avoid further rate limiting
|
|
13682
13884
|
baseDelayMs: 5e3,
|
|
@@ -13689,11 +13891,17 @@ var require_error_classification = __commonJS({
|
|
|
13689
13891
|
"Wait for quota reset"
|
|
13690
13892
|
]
|
|
13691
13893
|
},
|
|
13692
|
-
[
|
|
13693
|
-
|
|
13694
|
-
|
|
13894
|
+
[
|
|
13895
|
+
"configuration"
|
|
13896
|
+
/* CONFIGURATION */
|
|
13897
|
+
]: {
|
|
13898
|
+
category: "configuration",
|
|
13899
|
+
retryStrategy: "none",
|
|
13695
13900
|
isRetryable: false,
|
|
13696
|
-
...RETRY_STRATEGIES[
|
|
13901
|
+
...RETRY_STRATEGIES[
|
|
13902
|
+
"none"
|
|
13903
|
+
/* NONE */
|
|
13904
|
+
],
|
|
13697
13905
|
description: "Configuration or setup error",
|
|
13698
13906
|
troubleshooting: [
|
|
13699
13907
|
"Check environment variables",
|
|
@@ -13702,11 +13910,17 @@ var require_error_classification = __commonJS({
|
|
|
13702
13910
|
"Check required dependencies"
|
|
13703
13911
|
]
|
|
13704
13912
|
},
|
|
13705
|
-
[
|
|
13706
|
-
|
|
13707
|
-
|
|
13913
|
+
[
|
|
13914
|
+
"unknown"
|
|
13915
|
+
/* UNKNOWN */
|
|
13916
|
+
]: {
|
|
13917
|
+
category: "unknown",
|
|
13918
|
+
retryStrategy: "exponential",
|
|
13708
13919
|
isRetryable: true,
|
|
13709
|
-
...RETRY_STRATEGIES[
|
|
13920
|
+
...RETRY_STRATEGIES[
|
|
13921
|
+
"exponential"
|
|
13922
|
+
/* EXPONENTIAL */
|
|
13923
|
+
],
|
|
13710
13924
|
maxAttempts: 2,
|
|
13711
13925
|
// Override: conservative retries for unknown errors
|
|
13712
13926
|
description: "Unknown or unclassified error",
|
|
@@ -13732,7 +13946,10 @@ var require_error_classification = __commonJS({
|
|
|
13732
13946
|
}
|
|
13733
13947
|
}
|
|
13734
13948
|
}
|
|
13735
|
-
const unknownClassification = CLASSIFICATION_RULES[
|
|
13949
|
+
const unknownClassification = CLASSIFICATION_RULES[
|
|
13950
|
+
"unknown"
|
|
13951
|
+
/* UNKNOWN */
|
|
13952
|
+
];
|
|
13736
13953
|
return {
|
|
13737
13954
|
...unknownClassification,
|
|
13738
13955
|
description: `${unknownClassification.description}: ${errorMessage.slice(0, 100)}`
|
|
@@ -13783,258 +14000,17 @@ var require_error_classification = __commonJS({
|
|
|
13783
14000
|
}
|
|
13784
14001
|
return report.join("\n");
|
|
13785
14002
|
}
|
|
13786
|
-
|
|
13787
|
-
isNetworkError: (error) => classifyError(error).category ===
|
|
13788
|
-
isProtocolError: (error) => classifyError(error).category ===
|
|
13789
|
-
isAuthenticationError: (error) => classifyError(error).category ===
|
|
13790
|
-
isResourceError: (error) => classifyError(error).category ===
|
|
13791
|
-
isTimeoutError: (error) => classifyError(error).category ===
|
|
13792
|
-
isRateLimitError: (error) => classifyError(error).category ===
|
|
13793
|
-
isConfigurationError: (error) => classifyError(error).category ===
|
|
14003
|
+
var litProtocolErrors = {
|
|
14004
|
+
isNetworkError: (error) => classifyError(error).category === "network",
|
|
14005
|
+
isProtocolError: (error) => classifyError(error).category === "protocol",
|
|
14006
|
+
isAuthenticationError: (error) => classifyError(error).category === "authentication",
|
|
14007
|
+
isResourceError: (error) => classifyError(error).category === "resource",
|
|
14008
|
+
isTimeoutError: (error) => classifyError(error).category === "timeout",
|
|
14009
|
+
isRateLimitError: (error) => classifyError(error).category === "rate_limit",
|
|
14010
|
+
isConfigurationError: (error) => classifyError(error).category === "configuration",
|
|
13794
14011
|
isRetryable: (error) => classifyError(error).isRetryable
|
|
13795
14012
|
};
|
|
13796
|
-
|
|
13797
|
-
});
|
|
13798
|
-
|
|
13799
|
-
// node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/session-signature-cache.js
|
|
13800
|
-
var require_session_signature_cache = __commonJS({
|
|
13801
|
-
"node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/session-signature-cache.js"(exports) {
|
|
13802
|
-
"use strict";
|
|
13803
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13804
|
-
exports.sessionSignatureCache = exports.DEFAULT_CACHE_CONFIG = void 0;
|
|
13805
|
-
exports.generateSessionSignaturesWithCache = generateSessionSignaturesWithCache;
|
|
13806
|
-
exports.configureSessionSignatureCache = configureSessionSignatureCache;
|
|
13807
|
-
exports.clearSessionSignatureCache = clearSessionSignatureCache;
|
|
13808
|
-
exports.getSessionSignatureCacheStats = getSessionSignatureCacheStats;
|
|
13809
|
-
var debug_logger_1 = require_debug_logger();
|
|
13810
|
-
exports.DEFAULT_CACHE_CONFIG = {
|
|
13811
|
-
maxEntries: 50,
|
|
13812
|
-
bufferTimeMs: 6e4,
|
|
13813
|
-
// 1 minute buffer before expiration
|
|
13814
|
-
enableLogging: true
|
|
13815
|
-
};
|
|
13816
|
-
var SessionSignatureCache = class {
|
|
13817
|
-
constructor(config = {}) {
|
|
13818
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
13819
|
-
this.config = { ...exports.DEFAULT_CACHE_CONFIG, ...config };
|
|
13820
|
-
}
|
|
13821
|
-
/**
|
|
13822
|
-
* Generate cache key from PKP and context
|
|
13823
|
-
*/
|
|
13824
|
-
generateCacheKey(pkpTokenId, litActionCid, signerAddress, network) {
|
|
13825
|
-
return `${signerAddress}-${network}-${pkpTokenId}-${litActionCid}`;
|
|
13826
|
-
}
|
|
13827
|
-
/**
|
|
13828
|
-
* Check if cache entry is still valid
|
|
13829
|
-
*/
|
|
13830
|
-
isEntryValid(entry) {
|
|
13831
|
-
const now2 = /* @__PURE__ */ new Date();
|
|
13832
|
-
const expirationWithBuffer = new Date(entry.expiration.getTime() - this.config.bufferTimeMs);
|
|
13833
|
-
return now2 < expirationWithBuffer;
|
|
13834
|
-
}
|
|
13835
|
-
/**
|
|
13836
|
-
* Clean expired entries from cache
|
|
13837
|
-
*/
|
|
13838
|
-
cleanExpiredEntries() {
|
|
13839
|
-
const now2 = /* @__PURE__ */ new Date();
|
|
13840
|
-
let cleanedCount = 0;
|
|
13841
|
-
for (const [key2, entry] of this.cache.entries()) {
|
|
13842
|
-
if (now2 >= entry.expiration) {
|
|
13843
|
-
this.cache.delete(key2);
|
|
13844
|
-
cleanedCount++;
|
|
13845
|
-
}
|
|
13846
|
-
}
|
|
13847
|
-
if (cleanedCount > 0 && this.config.enableLogging) {
|
|
13848
|
-
(0, debug_logger_1.debugInfo)("CACHE", `\u{1F9F9} Cleaned ${cleanedCount} expired session signature entries`);
|
|
13849
|
-
}
|
|
13850
|
-
}
|
|
13851
|
-
/**
|
|
13852
|
-
* Enforce cache size limits
|
|
13853
|
-
*/
|
|
13854
|
-
enforceCacheSize() {
|
|
13855
|
-
if (this.cache.size <= this.config.maxEntries) {
|
|
13856
|
-
return;
|
|
13857
|
-
}
|
|
13858
|
-
const entries = Array.from(this.cache.entries()).sort(([, a], [, b]) => a.createdAt.getTime() - b.createdAt.getTime());
|
|
13859
|
-
const toRemove = entries.slice(0, this.cache.size - this.config.maxEntries);
|
|
13860
|
-
for (const [key2] of toRemove) {
|
|
13861
|
-
this.cache.delete(key2);
|
|
13862
|
-
}
|
|
13863
|
-
if (this.config.enableLogging) {
|
|
13864
|
-
(0, debug_logger_1.debugInfo)("CACHE", `\u{1F4E6} Removed ${toRemove.length} oldest cache entries to maintain size limit`);
|
|
13865
|
-
}
|
|
13866
|
-
}
|
|
13867
|
-
/**
|
|
13868
|
-
* Get cached session signatures if valid
|
|
13869
|
-
*/
|
|
13870
|
-
get(pkpTokenId, litActionCid, signerAddress, network) {
|
|
13871
|
-
this.cleanExpiredEntries();
|
|
13872
|
-
const cacheKey = this.generateCacheKey(pkpTokenId, litActionCid, signerAddress, network);
|
|
13873
|
-
const entry = this.cache.get(cacheKey);
|
|
13874
|
-
if (!entry) {
|
|
13875
|
-
if (this.config.enableLogging) {
|
|
13876
|
-
(0, debug_logger_1.debugLog)("CACHE", `\u274C Session signatures cache miss: ${cacheKey}`);
|
|
13877
|
-
}
|
|
13878
|
-
return null;
|
|
13879
|
-
}
|
|
13880
|
-
if (!this.isEntryValid(entry)) {
|
|
13881
|
-
this.cache.delete(cacheKey);
|
|
13882
|
-
if (this.config.enableLogging) {
|
|
13883
|
-
(0, debug_logger_1.debugWarn)("CACHE", `\u23F0 Session signatures expired: ${cacheKey}`);
|
|
13884
|
-
}
|
|
13885
|
-
return null;
|
|
13886
|
-
}
|
|
13887
|
-
if (this.config.enableLogging) {
|
|
13888
|
-
const timeUntilExpiry = entry.expiration.getTime() - Date.now();
|
|
13889
|
-
(0, debug_logger_1.debugInfo)("CACHE", `\u2705 Session signatures cache hit: ${cacheKey} (expires in ${Math.round(timeUntilExpiry / 1e3)}s)`);
|
|
13890
|
-
}
|
|
13891
|
-
return entry.sessionSigs;
|
|
13892
|
-
}
|
|
13893
|
-
/**
|
|
13894
|
-
* Cache session signatures
|
|
13895
|
-
*/
|
|
13896
|
-
set(pkpTokenId, litActionCid, signerAddress, network, sessionSigs, expiration) {
|
|
13897
|
-
const cacheKey = this.generateCacheKey(pkpTokenId, litActionCid, signerAddress, network);
|
|
13898
|
-
const entry = {
|
|
13899
|
-
sessionSigs,
|
|
13900
|
-
expiration,
|
|
13901
|
-
pkpTokenId,
|
|
13902
|
-
litActionCid,
|
|
13903
|
-
signerAddress,
|
|
13904
|
-
network,
|
|
13905
|
-
createdAt: /* @__PURE__ */ new Date()
|
|
13906
|
-
};
|
|
13907
|
-
this.cache.set(cacheKey, entry);
|
|
13908
|
-
if (this.config.enableLogging) {
|
|
13909
|
-
const timeUntilExpiry = expiration.getTime() - Date.now();
|
|
13910
|
-
(0, debug_logger_1.debugInfo)("CACHE", `\u{1F4BE} Cached session signatures: ${cacheKey} (expires in ${Math.round(timeUntilExpiry / 1e3)}s)`);
|
|
13911
|
-
}
|
|
13912
|
-
this.enforceCacheSize();
|
|
13913
|
-
}
|
|
13914
|
-
/**
|
|
13915
|
-
* Clear all cached session signatures
|
|
13916
|
-
*/
|
|
13917
|
-
clear() {
|
|
13918
|
-
const size = this.cache.size;
|
|
13919
|
-
this.cache.clear();
|
|
13920
|
-
if (this.config.enableLogging) {
|
|
13921
|
-
(0, debug_logger_1.debugInfo)("CACHE", `\u{1F5D1}\uFE0F Cleared ${size} cached session signature entries`);
|
|
13922
|
-
}
|
|
13923
|
-
}
|
|
13924
|
-
/**
|
|
13925
|
-
* Get cache statistics
|
|
13926
|
-
*/
|
|
13927
|
-
getStats() {
|
|
13928
|
-
this.cleanExpiredEntries();
|
|
13929
|
-
return {
|
|
13930
|
-
size: this.cache.size,
|
|
13931
|
-
maxEntries: this.config.maxEntries,
|
|
13932
|
-
utilizationPercent: Math.round(this.cache.size / this.config.maxEntries * 100)
|
|
13933
|
-
};
|
|
13934
|
-
}
|
|
13935
|
-
/**
|
|
13936
|
-
* Remove specific cache entry
|
|
13937
|
-
*/
|
|
13938
|
-
delete(pkpTokenId, litActionCid, signerAddress, network) {
|
|
13939
|
-
const cacheKey = this.generateCacheKey(pkpTokenId, litActionCid, signerAddress, network);
|
|
13940
|
-
const deleted = this.cache.delete(cacheKey);
|
|
13941
|
-
if (deleted && this.config.enableLogging) {
|
|
13942
|
-
(0, debug_logger_1.debugInfo)("CACHE", `\u{1F5D1}\uFE0F Removed session signatures from cache: ${cacheKey}`);
|
|
13943
|
-
}
|
|
13944
|
-
return deleted;
|
|
13945
|
-
}
|
|
13946
|
-
};
|
|
13947
|
-
exports.sessionSignatureCache = new SessionSignatureCache();
|
|
13948
|
-
async function generateSessionSignaturesWithCache(litNodeClient, sessionConfig, pkpTokenId, litActionCid, signerAddress, network = "chipotle") {
|
|
13949
|
-
const cached = exports.sessionSignatureCache.get(pkpTokenId, litActionCid, signerAddress, network);
|
|
13950
|
-
if (cached) {
|
|
13951
|
-
return cached;
|
|
13952
|
-
}
|
|
13953
|
-
(0, debug_logger_1.debugInfo)("CACHE", "\u{1F510} Generating new session signatures (cache miss)...");
|
|
13954
|
-
const sessionSigs = await litNodeClient.getSessionSigs(sessionConfig);
|
|
13955
|
-
const expiration = new Date(sessionConfig.expiration);
|
|
13956
|
-
exports.sessionSignatureCache.set(pkpTokenId, litActionCid, signerAddress, network, sessionSigs, expiration);
|
|
13957
|
-
const sigCount = Object.keys(sessionSigs).length;
|
|
13958
|
-
(0, debug_logger_1.debugInfo)("CACHE", `\u2705 Generated and cached ${sigCount} session signatures`);
|
|
13959
|
-
return sessionSigs;
|
|
13960
|
-
}
|
|
13961
|
-
function configureSessionSignatureCache(config) {
|
|
13962
|
-
Object.assign(exports.sessionSignatureCache["config"], config);
|
|
13963
|
-
}
|
|
13964
|
-
function clearSessionSignatureCache() {
|
|
13965
|
-
exports.sessionSignatureCache.clear();
|
|
13966
|
-
}
|
|
13967
|
-
function getSessionSignatureCacheStats() {
|
|
13968
|
-
return exports.sessionSignatureCache.getStats();
|
|
13969
|
-
}
|
|
13970
|
-
}
|
|
13971
|
-
});
|
|
13972
|
-
|
|
13973
|
-
// node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/connection-helpers.js
|
|
13974
|
-
var require_connection_helpers = __commonJS({
|
|
13975
|
-
"node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/chunks/connection-helpers.js"(exports) {
|
|
13976
|
-
"use strict";
|
|
13977
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
13978
|
-
if (k2 === void 0)
|
|
13979
|
-
k2 = k;
|
|
13980
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13981
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13982
|
-
desc = { enumerable: true, get: function() {
|
|
13983
|
-
return m[k];
|
|
13984
|
-
} };
|
|
13985
|
-
}
|
|
13986
|
-
Object.defineProperty(o, k2, desc);
|
|
13987
|
-
} : function(o, m, k, k2) {
|
|
13988
|
-
if (k2 === void 0)
|
|
13989
|
-
k2 = k;
|
|
13990
|
-
o[k2] = m[k];
|
|
13991
|
-
});
|
|
13992
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
13993
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
13994
|
-
} : function(o, v) {
|
|
13995
|
-
o["default"] = v;
|
|
13996
|
-
});
|
|
13997
|
-
var __importStar = exports && exports.__importStar || function() {
|
|
13998
|
-
var ownKeys = function(o) {
|
|
13999
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
14000
|
-
var ar = [];
|
|
14001
|
-
for (var k in o2)
|
|
14002
|
-
if (Object.prototype.hasOwnProperty.call(o2, k))
|
|
14003
|
-
ar[ar.length] = k;
|
|
14004
|
-
return ar;
|
|
14005
|
-
};
|
|
14006
|
-
return ownKeys(o);
|
|
14007
|
-
};
|
|
14008
|
-
return function(mod) {
|
|
14009
|
-
if (mod && mod.__esModule)
|
|
14010
|
-
return mod;
|
|
14011
|
-
var result = {};
|
|
14012
|
-
if (mod != null) {
|
|
14013
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++)
|
|
14014
|
-
if (k[i] !== "default")
|
|
14015
|
-
__createBinding(result, mod, k[i]);
|
|
14016
|
-
}
|
|
14017
|
-
__setModuleDefault(result, mod);
|
|
14018
|
-
return result;
|
|
14019
|
-
};
|
|
14020
|
-
}();
|
|
14021
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14022
|
-
exports.NETWORK_TIMEOUTS = exports.DEFAULT_RETRY_CONFIG = void 0;
|
|
14023
|
-
exports.sleep = sleep;
|
|
14024
|
-
exports.isRetryableError = isRetryableError;
|
|
14025
|
-
exports.calculateDelay = calculateDelay;
|
|
14026
|
-
exports.withRetry = withRetry;
|
|
14027
|
-
exports.connectLitNodeClient = connectLitNodeClient;
|
|
14028
|
-
exports.connectLitContracts = connectLitContracts;
|
|
14029
|
-
exports.validateLitNodeConnection = validateLitNodeConnection;
|
|
14030
|
-
exports.generateSessionSignatures = generateSessionSignatures;
|
|
14031
|
-
exports.validateLitNodeReadiness = validateLitNodeReadiness;
|
|
14032
|
-
exports.executeLitAction = executeLitAction;
|
|
14033
|
-
exports.executePkpOperation = executePkpOperation;
|
|
14034
|
-
exports.getNetworkTimeouts = getNetworkTimeouts;
|
|
14035
|
-
var debug_logger_1 = require_debug_logger();
|
|
14036
|
-
var error_classification_1 = require_error_classification();
|
|
14037
|
-
exports.DEFAULT_RETRY_CONFIG = {
|
|
14013
|
+
var DEFAULT_RETRY_CONFIG = {
|
|
14038
14014
|
maxAttempts: 5,
|
|
14039
14015
|
// Increased from 3 for PKP operations
|
|
14040
14016
|
initialDelayMs: 2e3,
|
|
@@ -14068,80 +14044,85 @@ var require_connection_helpers = __commonJS({
|
|
|
14068
14044
|
function sleep(ms) {
|
|
14069
14045
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
14070
14046
|
}
|
|
14071
|
-
function isRetryableError(error, retryableErrors =
|
|
14047
|
+
function isRetryableError(error, retryableErrors = DEFAULT_RETRY_CONFIG.retryableErrors) {
|
|
14072
14048
|
if (!error)
|
|
14073
14049
|
return false;
|
|
14074
|
-
const classification =
|
|
14050
|
+
const classification = classifyError(error);
|
|
14075
14051
|
if (classification.isRetryable !== void 0) {
|
|
14076
|
-
|
|
14052
|
+
debugInfo("ERROR_CLASSIFICATION", `Error classified as: ${classification.category} (retryable: ${classification.isRetryable})`);
|
|
14077
14053
|
return classification.isRetryable;
|
|
14078
14054
|
}
|
|
14079
14055
|
const errorMessage = error.message || error.toString() || "";
|
|
14080
14056
|
const errorLower = errorMessage.toLowerCase();
|
|
14081
|
-
return retryableErrors.some(
|
|
14057
|
+
return retryableErrors.some(
|
|
14058
|
+
(pattern) => errorLower.includes(pattern.toLowerCase())
|
|
14059
|
+
);
|
|
14082
14060
|
}
|
|
14083
14061
|
function calculateDelay(attempt, config) {
|
|
14084
|
-
const exponentialDelay = Math.min(
|
|
14062
|
+
const exponentialDelay = Math.min(
|
|
14063
|
+
config.initialDelayMs * Math.pow(config.backoffMultiplier, attempt - 1),
|
|
14064
|
+
config.maxDelayMs
|
|
14065
|
+
);
|
|
14085
14066
|
const jitter = exponentialDelay * 0.25 * (Math.random() - 0.5);
|
|
14086
14067
|
return Math.max(100, exponentialDelay + jitter);
|
|
14087
14068
|
}
|
|
14088
14069
|
async function withRetry(operation, config = {}, operationName = "operation") {
|
|
14089
|
-
let finalConfig = { ...
|
|
14090
|
-
const tracker = new
|
|
14070
|
+
let finalConfig = { ...DEFAULT_RETRY_CONFIG, ...config };
|
|
14071
|
+
const tracker = new PerformanceTracker(`Retry ${operationName}`);
|
|
14091
14072
|
let lastError;
|
|
14092
14073
|
let errorClassification = null;
|
|
14093
14074
|
for (let attempt = 1; attempt <= finalConfig.maxAttempts; attempt++) {
|
|
14094
14075
|
try {
|
|
14095
|
-
|
|
14076
|
+
debugInfo("RETRY", `\u{1F504} [${operationName}] Attempt ${attempt}/${finalConfig.maxAttempts}`);
|
|
14096
14077
|
const startTime = Date.now();
|
|
14097
14078
|
const result = await operation();
|
|
14098
14079
|
const duration = Date.now() - startTime;
|
|
14099
|
-
|
|
14100
|
-
|
|
14080
|
+
debugInfo("RETRY", `\u2705 [${operationName}] Success after ${duration}ms (attempt ${attempt})`);
|
|
14081
|
+
networkMetrics.recordRequest(operationName, true, duration);
|
|
14101
14082
|
tracker.end(true);
|
|
14102
14083
|
return result;
|
|
14103
14084
|
} catch (error) {
|
|
14104
14085
|
lastError = error;
|
|
14105
14086
|
const errorMessage = error?.message || error?.toString() || "Unknown error";
|
|
14106
|
-
errorClassification =
|
|
14087
|
+
errorClassification = classifyError(error);
|
|
14107
14088
|
if (attempt === 1 && errorClassification) {
|
|
14108
|
-
const intelligentConfig =
|
|
14089
|
+
const intelligentConfig = getRetryConfigFromClassification(errorClassification);
|
|
14109
14090
|
finalConfig = {
|
|
14110
14091
|
...finalConfig,
|
|
14111
14092
|
...intelligentConfig,
|
|
14112
14093
|
maxAttempts: Math.min(finalConfig.maxAttempts, intelligentConfig.maxAttempts)
|
|
14113
14094
|
};
|
|
14114
|
-
|
|
14115
|
-
|
|
14095
|
+
debugInfo("RETRY", `\u{1F9E0} Intelligent retry strategy applied: ${errorClassification.category} (${errorClassification.retryStrategy})`);
|
|
14096
|
+
debugInfo("RETRY", `\u{1F4CA} Adjusted config: max=${finalConfig.maxAttempts}, delay=${finalConfig.initialDelayMs}ms`);
|
|
14116
14097
|
}
|
|
14117
|
-
|
|
14098
|
+
debugWarn("RETRY", `\u26A0\uFE0F [${operationName}] Attempt ${attempt} failed:`, {
|
|
14118
14099
|
error: errorMessage,
|
|
14119
14100
|
attempt,
|
|
14120
14101
|
category: errorClassification.category,
|
|
14121
14102
|
retryable: errorClassification.isRetryable
|
|
14122
14103
|
});
|
|
14123
|
-
|
|
14104
|
+
networkMetrics.recordRequest(operationName, false, 0, errorMessage);
|
|
14124
14105
|
if (attempt >= finalConfig.maxAttempts) {
|
|
14125
|
-
|
|
14106
|
+
debugError("RETRY", `\u274C [${operationName}] All attempts failed. Last error:`, { error: errorMessage });
|
|
14126
14107
|
if (errorClassification) {
|
|
14127
|
-
const errorReport =
|
|
14128
|
-
|
|
14108
|
+
const errorReport = createErrorReport(error);
|
|
14109
|
+
debugError("RETRY", `\u{1F4CB} Error Analysis Report:
|
|
14129
14110
|
${errorReport}`);
|
|
14130
14111
|
}
|
|
14131
14112
|
tracker.end(false);
|
|
14132
14113
|
break;
|
|
14133
14114
|
}
|
|
14134
14115
|
if (!errorClassification.isRetryable) {
|
|
14135
|
-
|
|
14116
|
+
debugError("RETRY", `\u{1F6AB} [${operationName}] Non-retryable error (${errorClassification.category}):`, { error: errorMessage });
|
|
14136
14117
|
if (errorClassification.troubleshooting) {
|
|
14137
|
-
|
|
14118
|
+
debugInfo("RETRY", `\u{1F4A1} Troubleshooting suggestions:
|
|
14138
14119
|
${errorClassification.troubleshooting.join("\n ")}`);
|
|
14139
14120
|
}
|
|
14140
14121
|
tracker.end(false);
|
|
14141
14122
|
break;
|
|
14142
14123
|
}
|
|
14143
14124
|
const delayMs = calculateDelay(attempt, finalConfig);
|
|
14144
|
-
|
|
14125
|
+
debugInfo("RETRY", `\u23F3 [${operationName}] Waiting ${delayMs}ms before retry... (${errorClassification.retryStrategy} strategy)`);
|
|
14145
14126
|
await sleep(delayMs);
|
|
14146
14127
|
}
|
|
14147
14128
|
}
|
|
@@ -14149,36 +14130,44 @@ ${errorReport}`);
|
|
|
14149
14130
|
}
|
|
14150
14131
|
async function connectLitNodeClient(litNodeClient, config = {}) {
|
|
14151
14132
|
const network = litNodeClient?.config?.litNetwork || "unknown";
|
|
14152
|
-
return withRetry(
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14157
|
-
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14165
|
-
|
|
14166
|
-
|
|
14167
|
-
|
|
14168
|
-
|
|
14169
|
-
|
|
14170
|
-
|
|
14171
|
-
|
|
14133
|
+
return withRetry(
|
|
14134
|
+
async () => {
|
|
14135
|
+
if (!litNodeClient) {
|
|
14136
|
+
throw new Error("LIT Node Client is null or undefined");
|
|
14137
|
+
}
|
|
14138
|
+
const startTime = Date.now();
|
|
14139
|
+
logConnectionAttempt(network, 1, config.maxAttempts || DEFAULT_RETRY_CONFIG.maxAttempts);
|
|
14140
|
+
await litNodeClient.connect();
|
|
14141
|
+
debugInfo("CONNECTION", `\u23F3 Waiting for LIT Node Client to be ready...`);
|
|
14142
|
+
const readyTimeout = 3e4;
|
|
14143
|
+
const readyStartTime = Date.now();
|
|
14144
|
+
while (!litNodeClient.ready && Date.now() - readyStartTime < readyTimeout) {
|
|
14145
|
+
await sleep(500);
|
|
14146
|
+
}
|
|
14147
|
+
if (!litNodeClient.ready) {
|
|
14148
|
+
throw new Error(`LIT Node Client failed to become ready within ${readyTimeout}ms`);
|
|
14149
|
+
}
|
|
14150
|
+
const latency = Date.now() - startTime;
|
|
14151
|
+
debugInfo("CONNECTION", `\u2705 LIT Node Client is ready (${litNodeClient.ready})`);
|
|
14152
|
+
logConnectionSuccess(network, latency);
|
|
14153
|
+
},
|
|
14154
|
+
config,
|
|
14155
|
+
"LIT Node Client Connection"
|
|
14156
|
+
);
|
|
14172
14157
|
}
|
|
14173
14158
|
async function connectLitContracts(litContracts, config = {}) {
|
|
14174
|
-
return withRetry(
|
|
14175
|
-
|
|
14176
|
-
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
|
|
14180
|
-
|
|
14181
|
-
|
|
14159
|
+
return withRetry(
|
|
14160
|
+
async () => {
|
|
14161
|
+
if (!litContracts) {
|
|
14162
|
+
throw new Error("LIT Contracts is null or undefined");
|
|
14163
|
+
}
|
|
14164
|
+
console.log(`\u{1F517} Connecting to LIT Contracts: ${litContracts.network || "unknown"}`);
|
|
14165
|
+
await litContracts.connect();
|
|
14166
|
+
console.log("\u2705 LIT Contracts connected successfully");
|
|
14167
|
+
},
|
|
14168
|
+
config,
|
|
14169
|
+
"LIT Contracts Connection"
|
|
14170
|
+
);
|
|
14182
14171
|
}
|
|
14183
14172
|
async function validateLitNodeConnection(litNodeClient) {
|
|
14184
14173
|
try {
|
|
@@ -14198,33 +14187,37 @@ ${errorReport}`);
|
|
|
14198
14187
|
}
|
|
14199
14188
|
async function generateSessionSignatures(litNodeClient, sessionConfig, config = {}, pkpTokenId, litActionCid, signerAddress, network = "chipotle") {
|
|
14200
14189
|
if (pkpTokenId && litActionCid && signerAddress) {
|
|
14201
|
-
const { sessionSignatureCache } = await Promise.resolve().then(() =>
|
|
14202
|
-
const cached =
|
|
14190
|
+
const { sessionSignatureCache: sessionSignatureCache2 } = await Promise.resolve().then(() => (init_session_signature_cache(), session_signature_cache_exports));
|
|
14191
|
+
const cached = sessionSignatureCache2.get(pkpTokenId, litActionCid, signerAddress, network);
|
|
14203
14192
|
if (cached) {
|
|
14204
14193
|
const sigCount = Object.keys(cached).length;
|
|
14205
|
-
|
|
14194
|
+
debugInfo("SESSION", `\u{1F504} Using cached session signatures (${sigCount} sigs)`);
|
|
14206
14195
|
return cached;
|
|
14207
14196
|
}
|
|
14208
14197
|
}
|
|
14209
|
-
return withRetry(
|
|
14210
|
-
(
|
|
14211
|
-
|
|
14212
|
-
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
|
|
14217
|
-
|
|
14218
|
-
|
|
14219
|
-
|
|
14220
|
-
|
|
14198
|
+
return withRetry(
|
|
14199
|
+
async () => {
|
|
14200
|
+
debugInfo("SESSION", "\u{1F510} Generating new session signatures...");
|
|
14201
|
+
const sessionSigs = await litNodeClient.getSessionSigs(sessionConfig);
|
|
14202
|
+
const sigCount = Object.keys(sessionSigs).length;
|
|
14203
|
+
if (pkpTokenId && litActionCid && signerAddress) {
|
|
14204
|
+
const { sessionSignatureCache: sessionSignatureCache2 } = await Promise.resolve().then(() => (init_session_signature_cache(), session_signature_cache_exports));
|
|
14205
|
+
const expiration = new Date(sessionConfig.expiration);
|
|
14206
|
+
sessionSignatureCache2.set(pkpTokenId, litActionCid, signerAddress, network, sessionSigs, expiration);
|
|
14207
|
+
}
|
|
14208
|
+
debugInfo("SESSION", `\u2705 Generated ${sigCount} session signatures`);
|
|
14209
|
+
return sessionSigs;
|
|
14210
|
+
},
|
|
14211
|
+
config,
|
|
14212
|
+
"Session Signature Generation"
|
|
14213
|
+
);
|
|
14221
14214
|
}
|
|
14222
14215
|
async function validateLitNodeReadiness(litNodeClient) {
|
|
14223
14216
|
if (!litNodeClient) {
|
|
14224
14217
|
throw new Error("LIT Node Client is null or undefined");
|
|
14225
14218
|
}
|
|
14226
14219
|
if (!litNodeClient.ready) {
|
|
14227
|
-
|
|
14220
|
+
debugWarn("CONNECTION", "\u26A0\uFE0F LIT Node Client not ready, attempting to reconnect...");
|
|
14228
14221
|
await litNodeClient.connect();
|
|
14229
14222
|
const readyTimeout = 15e3;
|
|
14230
14223
|
const startTime = Date.now();
|
|
@@ -14235,32 +14228,36 @@ ${errorReport}`);
|
|
|
14235
14228
|
throw new Error("LIT Node Client is not ready for operations");
|
|
14236
14229
|
}
|
|
14237
14230
|
}
|
|
14238
|
-
|
|
14231
|
+
debugInfo("CONNECTION", "\u2705 LIT Node Client readiness validated");
|
|
14239
14232
|
}
|
|
14240
14233
|
async function executeLitAction(litNodeClient, executionConfig, config = {}) {
|
|
14241
14234
|
const cid = executionConfig.ipfsId;
|
|
14242
|
-
return withRetry(
|
|
14243
|
-
|
|
14244
|
-
|
|
14245
|
-
|
|
14246
|
-
|
|
14247
|
-
|
|
14248
|
-
|
|
14249
|
-
|
|
14250
|
-
(
|
|
14251
|
-
|
|
14252
|
-
|
|
14253
|
-
|
|
14254
|
-
|
|
14255
|
-
|
|
14256
|
-
|
|
14235
|
+
return withRetry(
|
|
14236
|
+
async () => {
|
|
14237
|
+
const startTime = Date.now();
|
|
14238
|
+
await validateLitNodeReadiness(litNodeClient);
|
|
14239
|
+
logLitActionExecution(cid, executionConfig.jsParams);
|
|
14240
|
+
logRequest("LIT_ACTION", "executeJs", executionConfig);
|
|
14241
|
+
const result = await litNodeClient.executeJs(executionConfig);
|
|
14242
|
+
const duration = Date.now() - startTime;
|
|
14243
|
+
if (!result.response) {
|
|
14244
|
+
logError("LIT_ACTION", "executeJs", new Error("No response from LIT Action"), duration);
|
|
14245
|
+
throw new Error("No response from LIT Action");
|
|
14246
|
+
}
|
|
14247
|
+
logResponse("LIT_ACTION", "executeJs", result, duration);
|
|
14248
|
+
logLitActionResult(cid, true, duration, result);
|
|
14249
|
+
return result;
|
|
14250
|
+
},
|
|
14251
|
+
config,
|
|
14252
|
+
"LIT Action Execution"
|
|
14253
|
+
);
|
|
14257
14254
|
}
|
|
14258
14255
|
async function executePkpOperation(operation, operationName, config = {}) {
|
|
14259
14256
|
const pkpConfig = {
|
|
14260
|
-
...
|
|
14257
|
+
...DEFAULT_RETRY_CONFIG,
|
|
14261
14258
|
...config,
|
|
14262
14259
|
retryableErrors: [
|
|
14263
|
-
...
|
|
14260
|
+
...DEFAULT_RETRY_CONFIG.retryableErrors,
|
|
14264
14261
|
"pkp validation",
|
|
14265
14262
|
"signing shares",
|
|
14266
14263
|
"resource validation",
|
|
@@ -14269,7 +14266,7 @@ ${errorReport}`);
|
|
|
14269
14266
|
};
|
|
14270
14267
|
return withRetry(operation, pkpConfig, `PKP ${operationName}`);
|
|
14271
14268
|
}
|
|
14272
|
-
|
|
14269
|
+
var NETWORK_TIMEOUTS = {
|
|
14273
14270
|
chipotle: {
|
|
14274
14271
|
connection: 6e4,
|
|
14275
14272
|
operation: 12e4,
|
|
@@ -14277,82 +14274,10 @@ ${errorReport}`);
|
|
|
14277
14274
|
}
|
|
14278
14275
|
};
|
|
14279
14276
|
function getNetworkTimeouts(network) {
|
|
14280
|
-
return
|
|
14277
|
+
return NETWORK_TIMEOUTS[network] || NETWORK_TIMEOUTS["chipotle"];
|
|
14281
14278
|
}
|
|
14282
|
-
|
|
14283
|
-
|
|
14284
|
-
|
|
14285
|
-
// node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/index.js
|
|
14286
|
-
var require_utils4 = __commonJS({
|
|
14287
|
-
"node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/utils/index.js"(exports) {
|
|
14288
|
-
"use strict";
|
|
14289
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
14290
|
-
if (k2 === void 0)
|
|
14291
|
-
k2 = k;
|
|
14292
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14293
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14294
|
-
desc = { enumerable: true, get: function() {
|
|
14295
|
-
return m[k];
|
|
14296
|
-
} };
|
|
14297
|
-
}
|
|
14298
|
-
Object.defineProperty(o, k2, desc);
|
|
14299
|
-
} : function(o, m, k, k2) {
|
|
14300
|
-
if (k2 === void 0)
|
|
14301
|
-
k2 = k;
|
|
14302
|
-
o[k2] = m[k];
|
|
14303
|
-
});
|
|
14304
|
-
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
14305
|
-
for (var p in m)
|
|
14306
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
14307
|
-
__createBinding(exports2, m, p);
|
|
14308
|
-
};
|
|
14309
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14310
|
-
__exportStar(require_lit_action_helpers(), exports);
|
|
14311
|
-
__exportStar(require_pkp_setup(), exports);
|
|
14312
|
-
__exportStar(require_cid_utils(), exports);
|
|
14313
|
-
__exportStar(require_connection_helpers(), exports);
|
|
14314
|
-
__exportStar(require_debug_logger(), exports);
|
|
14315
|
-
__exportStar(require_error_classification(), exports);
|
|
14316
|
-
__exportStar(require_session_signature_cache(), exports);
|
|
14317
|
-
}
|
|
14318
|
-
});
|
|
14319
|
-
|
|
14320
|
-
// node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/index.js
|
|
14321
|
-
var require_pkg_src = __commonJS({
|
|
14322
|
-
"node_modules/@gvnrdao/dh-lit-actions/pkg-dist/pkg-src/index.js"(exports) {
|
|
14323
|
-
"use strict";
|
|
14324
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
14325
|
-
if (k2 === void 0)
|
|
14326
|
-
k2 = k;
|
|
14327
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14328
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14329
|
-
desc = { enumerable: true, get: function() {
|
|
14330
|
-
return m[k];
|
|
14331
|
-
} };
|
|
14332
|
-
}
|
|
14333
|
-
Object.defineProperty(o, k2, desc);
|
|
14334
|
-
} : function(o, m, k, k2) {
|
|
14335
|
-
if (k2 === void 0)
|
|
14336
|
-
k2 = k;
|
|
14337
|
-
o[k2] = m[k];
|
|
14338
|
-
});
|
|
14339
|
-
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
14340
|
-
for (var p in m)
|
|
14341
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
14342
|
-
__createBinding(exports2, m, p);
|
|
14343
|
-
};
|
|
14344
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14345
|
-
exports.CHIPOTLE_DEPLOYMENTS = exports.DH_LIT_ACTIONS_CHIPOTLE = void 0;
|
|
14346
|
-
__exportStar(require_interfaces(), exports);
|
|
14347
|
-
__exportStar(require_lit_actions_registry(), exports);
|
|
14348
|
-
__exportStar(require_utils4(), exports);
|
|
14349
|
-
var lit_actions_registry_1 = require_lit_actions_registry();
|
|
14350
|
-
Object.defineProperty(exports, "DH_LIT_ACTIONS_CHIPOTLE", { enumerable: true, get: function() {
|
|
14351
|
-
return lit_actions_registry_1.DH_LIT_ACTIONS_CHIPOTLE;
|
|
14352
|
-
} });
|
|
14353
|
-
Object.defineProperty(exports, "CHIPOTLE_DEPLOYMENTS", { enumerable: true, get: function() {
|
|
14354
|
-
return lit_actions_registry_1.CHIPOTLE_DEPLOYMENTS;
|
|
14355
|
-
} });
|
|
14279
|
+
init_debug_logger();
|
|
14280
|
+
init_session_signature_cache();
|
|
14356
14281
|
}
|
|
14357
14282
|
});
|
|
14358
14283
|
|
|
@@ -14390,7 +14315,7 @@ var init_deployment_addresses = __esm({
|
|
|
14390
14315
|
PriceFeedConsumer: "0xb3Dc64501935a6f0334779126Ee37bE463cee318",
|
|
14391
14316
|
PositionManagerCoreModule: "0xfFAA39a08887FeFB697eBC8691A8630CbCC33391",
|
|
14392
14317
|
TermManagerModule: "0x94Adc6F9558368B1482197584f1fc7133Ecf835b",
|
|
14393
|
-
LoanOperationsManagerModule: "
|
|
14318
|
+
LoanOperationsManagerModule: "0x3e05e760a87715207b7F4e8fD35EF7559BcA72C0",
|
|
14394
14319
|
CollateralManagerModule: "0x967E92c976Fc0fa8268D37D4d6B7245d912aA7dB",
|
|
14395
14320
|
LiquidationManagerModule: "0xC4AB00f39e7ceD812F5C67058C9fa44e15d40e76",
|
|
14396
14321
|
CircuitBreakerModule: "0x3D0B2cAE481821E57BA9CC3807bCC0d0D7F18bd8",
|
|
@@ -14476,9 +14401,9 @@ var init_deployment_addresses = __esm({
|
|
|
14476
14401
|
reason: "Shared upgrade script: PositionManagerCoreModule implementation update"
|
|
14477
14402
|
},
|
|
14478
14403
|
CollateralManagerModule: {
|
|
14479
|
-
previousImplementation: "
|
|
14480
|
-
newImplementation: "
|
|
14481
|
-
upgradedAt: "2026-04-
|
|
14404
|
+
previousImplementation: "0xb26039e5FF9771b2899D54b6dE879D493616502c",
|
|
14405
|
+
newImplementation: "0x84C5B89f60415F8df3Fee46Ef1a10a6484aa8e0A",
|
|
14406
|
+
upgradedAt: "2026-04-29T12:13:12.465Z",
|
|
14482
14407
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14483
14408
|
reason: "Shared upgrade script: CollateralManagerModule implementation update"
|
|
14484
14409
|
},
|
|
@@ -14616,7 +14541,7 @@ var init_deployment_addresses = __esm({
|
|
|
14616
14541
|
PriceFeedConsumer: "0xb3Dc64501935a6f0334779126Ee37bE463cee318",
|
|
14617
14542
|
PositionManagerCoreModule: "0xfFAA39a08887FeFB697eBC8691A8630CbCC33391",
|
|
14618
14543
|
TermManagerModule: "0x94Adc6F9558368B1482197584f1fc7133Ecf835b",
|
|
14619
|
-
LoanOperationsManagerModule: "
|
|
14544
|
+
LoanOperationsManagerModule: "0x3e05e760a87715207b7F4e8fD35EF7559BcA72C0",
|
|
14620
14545
|
CollateralManagerModule: "0x967E92c976Fc0fa8268D37D4d6B7245d912aA7dB",
|
|
14621
14546
|
LiquidationManagerModule: "0xC4AB00f39e7ceD812F5C67058C9fa44e15d40e76",
|
|
14622
14547
|
CircuitBreakerModule: "0x3D0B2cAE481821E57BA9CC3807bCC0d0D7F18bd8",
|
|
@@ -36368,7 +36293,7 @@ var DiamondHandsGraph = class {
|
|
|
36368
36293
|
}
|
|
36369
36294
|
|
|
36370
36295
|
${shouldQuery.mint ? `
|
|
36371
|
-
|
|
36296
|
+
ucdmintEvents(
|
|
36372
36297
|
${buildPositionWhereClause()}
|
|
36373
36298
|
first: $limit,
|
|
36374
36299
|
orderBy: timestamp,
|
|
@@ -36557,7 +36482,7 @@ var DiamondHandsGraph = class {
|
|
|
36557
36482
|
commitTimestamp: result.position.liquidation.commitTimestamp,
|
|
36558
36483
|
revealDelay: result.position.liquidation.revealDelay
|
|
36559
36484
|
} : void 0;
|
|
36560
|
-
const mints = (result.
|
|
36485
|
+
const mints = (result.ucdmintEvents || []).map((m) => ({
|
|
36561
36486
|
id: m.id,
|
|
36562
36487
|
positionId,
|
|
36563
36488
|
amount: m.amount,
|
|
@@ -37200,6 +37125,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
37200
37125
|
network: config.litNetwork || DEFAULT_LIT_NETWORK,
|
|
37201
37126
|
signer: config.mode === "standalone" ? config.litOpsSigner : void 0,
|
|
37202
37127
|
serviceEndpoint: isServiceModeConfig(config) ? config.serviceEndpoint : void 0,
|
|
37128
|
+
serviceAuthToken: isServiceModeConfig(config) ? config.serviceAuthToken : void 0,
|
|
37203
37129
|
debug: config.debug,
|
|
37204
37130
|
litNodeConnectTimeoutMs: config.litNodeConnectTimeoutMs
|
|
37205
37131
|
// TODO Round 2: Add litActionExecution config when added to config.i.ts interface
|
|
@@ -43183,11 +43109,13 @@ Error data: ${errorData || "none"}`
|
|
|
43183
43109
|
return {
|
|
43184
43110
|
async getProtocolConfig() {
|
|
43185
43111
|
const result = await contract["getProtocolConfig"]();
|
|
43112
|
+
const maxUcdWhole = ethers_exports.BigNumber.from(result[3]);
|
|
43186
43113
|
return {
|
|
43187
43114
|
liquidationThreshold: result[0].toString(),
|
|
43188
|
-
minimumLoanValueUcd: result[
|
|
43115
|
+
minimumLoanValueUcd: ethers_exports.utils.formatUnits(result[2], 18),
|
|
43189
43116
|
minimumLoanValueWei: result[2].toString(),
|
|
43190
|
-
maxSingleLoanValueUcd:
|
|
43117
|
+
maxSingleLoanValueUcd: maxUcdWhole.toString(),
|
|
43118
|
+
maxSingleLoanValueWei: maxUcdWhole.mul(ethers_exports.BigNumber.from(10).pow(18)).toString()
|
|
43191
43119
|
};
|
|
43192
43120
|
}
|
|
43193
43121
|
};
|