@gvnrdao/dh-sdk 0.0.114 → 0.0.115
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 +162 -7
- package/dist/index.mjs +162 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -42567,6 +42567,12 @@ var PKPAuthorization = class {
|
|
|
42567
42567
|
* @returns Mint authorization response
|
|
42568
42568
|
*/
|
|
42569
42569
|
async authorizeMintUCD(params, pkpPublicKey, auth, pkpTokenId, pkpEthAddress) {
|
|
42570
|
+
console.log("[PKP-AUTH] authorizeMintUCD called", {
|
|
42571
|
+
positionId: params.positionId,
|
|
42572
|
+
hasConfig: !!this.config,
|
|
42573
|
+
hasContractAddresses: !!this.config?.contractAddresses,
|
|
42574
|
+
debug: this.config?.debug
|
|
42575
|
+
});
|
|
42570
42576
|
if (this.config.debug) {
|
|
42571
42577
|
log.info("\u{1F510} Authorizing mint UCD", {
|
|
42572
42578
|
positionId: params.positionId,
|
|
@@ -42680,6 +42686,14 @@ var PKPAuthorization = class {
|
|
|
42680
42686
|
"final chainStr": chainStr
|
|
42681
42687
|
});
|
|
42682
42688
|
}
|
|
42689
|
+
console.log("[PKP-AUTH] Contract addresses check (BEFORE mapping):", {
|
|
42690
|
+
hasConfigContractAddresses: !!this.config.contractAddresses,
|
|
42691
|
+
configContractAddressKeys: this.config.contractAddresses ? Object.keys(this.config.contractAddresses) : [],
|
|
42692
|
+
positionManager: this.config.contractAddresses?.positionManager || "MISSING",
|
|
42693
|
+
loanOperationsManager: this.config.contractAddresses?.loanOperationsManager || "MISSING",
|
|
42694
|
+
termManager: this.config.contractAddresses?.termManager || "MISSING",
|
|
42695
|
+
ucdController: this.config.contractAddresses?.ucdController || "MISSING"
|
|
42696
|
+
});
|
|
42683
42697
|
if (this.config.debug) {
|
|
42684
42698
|
log.info("\u{1F50D} PKPAuthorization contract addresses check:", {
|
|
42685
42699
|
hasConfigContractAddresses: !!this.config.contractAddresses,
|
|
@@ -42691,6 +42705,14 @@ var PKPAuthorization = class {
|
|
|
42691
42705
|
});
|
|
42692
42706
|
}
|
|
42693
42707
|
const contractAddresses = this.mapContractAddressesToLitActionFormat(this.config.contractAddresses);
|
|
42708
|
+
console.log("[PKP-AUTH] Contract addresses check (AFTER mapping):", {
|
|
42709
|
+
hasMappedAddresses: !!contractAddresses,
|
|
42710
|
+
mappedKeys: contractAddresses ? Object.keys(contractAddresses) : [],
|
|
42711
|
+
PositionManager: contractAddresses?.PositionManager || "MISSING",
|
|
42712
|
+
LoanOperationsManagerModule: contractAddresses?.LoanOperationsManagerModule || "MISSING",
|
|
42713
|
+
TermManagerModule: contractAddresses?.TermManagerModule || "MISSING",
|
|
42714
|
+
UCDController: contractAddresses?.UCDController || "MISSING"
|
|
42715
|
+
});
|
|
42694
42716
|
const requiredContracts = ["PositionManager", "LoanOperationsManagerModule", "TermManagerModule", "UCDController"];
|
|
42695
42717
|
if (contractAddresses) {
|
|
42696
42718
|
const missingContracts = requiredContracts.filter((contract) => !contractAddresses[contract]);
|
|
@@ -42750,6 +42772,14 @@ var PKPAuthorization = class {
|
|
|
42750
42772
|
if (hasRequiredContracts) {
|
|
42751
42773
|
jsParams["contracts"] = contractAddresses;
|
|
42752
42774
|
jsParams["contractAddresses"] = contractAddresses;
|
|
42775
|
+
console.log("[PKP-AUTH] \u2705 Contract addresses INCLUDED in jsParams:", {
|
|
42776
|
+
contracts: Object.keys(contractAddresses),
|
|
42777
|
+
contractCount: Object.keys(contractAddresses).length,
|
|
42778
|
+
PositionManager: contractAddresses.PositionManager || "MISSING",
|
|
42779
|
+
LoanOperationsManagerModule: contractAddresses.LoanOperationsManagerModule || "MISSING",
|
|
42780
|
+
TermManagerModule: contractAddresses.TermManagerModule || "MISSING",
|
|
42781
|
+
UCDController: contractAddresses.UCDController || "MISSING"
|
|
42782
|
+
});
|
|
42753
42783
|
if (this.config.debug) {
|
|
42754
42784
|
log.info("\u{1F4CB} Contract addresses included in jsParams:", {
|
|
42755
42785
|
contracts: Object.keys(contractAddresses),
|
|
@@ -42766,6 +42796,13 @@ var PKPAuthorization = class {
|
|
|
42766
42796
|
}
|
|
42767
42797
|
} else {
|
|
42768
42798
|
const missingRequired = contractAddresses ? requiredContractsForLIT.filter((contract) => !contractAddresses[contract] || contractAddresses[contract].trim() === "") : requiredContractsForLIT;
|
|
42799
|
+
console.error("[PKP-AUTH] \u274C CRITICAL: Required contract addresses MISSING!", {
|
|
42800
|
+
hasConfigContractAddresses: !!this.config.contractAddresses,
|
|
42801
|
+
configContractAddressKeys: this.config.contractAddresses ? Object.keys(this.config.contractAddresses) : [],
|
|
42802
|
+
mappedResult: contractAddresses,
|
|
42803
|
+
missingRequiredContracts: missingRequired,
|
|
42804
|
+
availableContracts: contractAddresses ? Object.keys(contractAddresses) : []
|
|
42805
|
+
});
|
|
42769
42806
|
log.error("\u274C CRITICAL: Required contract addresses missing - LIT Action will fail!", {
|
|
42770
42807
|
hasConfigContractAddresses: !!this.config.contractAddresses,
|
|
42771
42808
|
configContractAddressKeys: this.config.contractAddresses ? Object.keys(this.config.contractAddresses) : [],
|
|
@@ -42776,11 +42813,61 @@ var PKPAuthorization = class {
|
|
|
42776
42813
|
if (contractAddresses && Object.keys(contractAddresses).length > 0) {
|
|
42777
42814
|
jsParams["contracts"] = contractAddresses;
|
|
42778
42815
|
jsParams["contractAddresses"] = contractAddresses;
|
|
42816
|
+
console.warn("[PKP-AUTH] \u26A0\uFE0F Passing incomplete contract addresses - LIT Action may fail");
|
|
42779
42817
|
log.warn("\u26A0\uFE0F Passing incomplete contract addresses - LIT Action may fail");
|
|
42780
42818
|
} else {
|
|
42819
|
+
console.error("[PKP-AUTH] \u274C No contract addresses to pass - LIT Action will definitely fail with toLowerCase error");
|
|
42781
42820
|
log.error("\u274C No contract addresses to pass - LIT Action will definitely fail with toLowerCase error");
|
|
42782
42821
|
}
|
|
42783
42822
|
}
|
|
42823
|
+
if (this.config.debug) {
|
|
42824
|
+
log.info("\u{1F4E4} Complete jsParams being sent to LIT Action:", {
|
|
42825
|
+
jsParamsKeys: Object.keys(jsParams),
|
|
42826
|
+
jsParamsCount: Object.keys(jsParams).length,
|
|
42827
|
+
// Log all params with sanitized sensitive data
|
|
42828
|
+
chain: jsParams["chain"],
|
|
42829
|
+
bitcoinProviderUrl: jsParams["bitcoinProviderUrl"] ? "PROVIDED" : "NOT PROVIDED",
|
|
42830
|
+
amount: jsParams["amount"],
|
|
42831
|
+
publicKey: jsParams["publicKey"] ? `${jsParams["publicKey"].substring(0, 20)}...` : "NOT PROVIDED",
|
|
42832
|
+
ipfsId: jsParams["ipfsId"],
|
|
42833
|
+
pkpTokenId: jsParams["pkpTokenId"] || "NOT PROVIDED",
|
|
42834
|
+
rpcUrl: jsParams["rpcUrl"] ? "PROVIDED" : "NOT PROVIDED",
|
|
42835
|
+
contracts: jsParams["contracts"] ? {
|
|
42836
|
+
keys: Object.keys(jsParams["contracts"]),
|
|
42837
|
+
count: Object.keys(jsParams["contracts"]).length,
|
|
42838
|
+
PositionManager: jsParams["contracts"]?.PositionManager || "MISSING",
|
|
42839
|
+
LoanOperationsManagerModule: jsParams["contracts"]?.LoanOperationsManagerModule || "MISSING",
|
|
42840
|
+
TermManagerModule: jsParams["contracts"]?.TermManagerModule || "MISSING",
|
|
42841
|
+
UCDController: jsParams["contracts"]?.UCDController || "MISSING"
|
|
42842
|
+
} : "NOT PROVIDED",
|
|
42843
|
+
contractAddresses: jsParams["contractAddresses"] ? {
|
|
42844
|
+
keys: Object.keys(jsParams["contractAddresses"]),
|
|
42845
|
+
count: Object.keys(jsParams["contractAddresses"]).length
|
|
42846
|
+
} : "NOT PROVIDED",
|
|
42847
|
+
// Log full auth object structure (without signature value)
|
|
42848
|
+
auth: jsParams["auth"] ? {
|
|
42849
|
+
positionId: jsParams["auth"]?.positionId,
|
|
42850
|
+
timestamp: jsParams["auth"]?.timestamp,
|
|
42851
|
+
chainId: jsParams["auth"]?.chainId,
|
|
42852
|
+
amount: jsParams["auth"]?.amount,
|
|
42853
|
+
action: jsParams["auth"]?.action,
|
|
42854
|
+
mode: jsParams["auth"]?.mode,
|
|
42855
|
+
hasSignature: !!jsParams["auth"]?.signature
|
|
42856
|
+
} : "NOT PROVIDED"
|
|
42857
|
+
});
|
|
42858
|
+
const sanitizedParams = { ...jsParams };
|
|
42859
|
+
if (sanitizedParams["auth"] && typeof sanitizedParams["auth"] === "object") {
|
|
42860
|
+
const auth2 = sanitizedParams["auth"];
|
|
42861
|
+
sanitizedParams["auth"] = {
|
|
42862
|
+
...auth2,
|
|
42863
|
+
signature: auth2.signature ? `${auth2.signature.substring(0, 20)}...` : void 0
|
|
42864
|
+
};
|
|
42865
|
+
}
|
|
42866
|
+
if (typeof sanitizedParams["publicKey"] === "string") {
|
|
42867
|
+
sanitizedParams["publicKey"] = `${sanitizedParams["publicKey"].substring(0, 20)}...`;
|
|
42868
|
+
}
|
|
42869
|
+
log.info("\u{1F4E4} Complete jsParams (sanitized JSON):", JSON.stringify(sanitizedParams, null, 2));
|
|
42870
|
+
}
|
|
42784
42871
|
const litResult = await this.executeLitAction(pkpPublicKey, jsParams, pkpTokenId, pkpEthAddress);
|
|
42785
42872
|
if (!litResult.success) {
|
|
42786
42873
|
return litResult;
|
|
@@ -43479,14 +43566,59 @@ var PKPAuthorization = class {
|
|
|
43479
43566
|
...formattedPkpTokenId ? { pkpTokenId: formattedPkpTokenId } : {}
|
|
43480
43567
|
};
|
|
43481
43568
|
if (this.config.debug) {
|
|
43482
|
-
log.info("\u{1F4E4} Service request body:", {
|
|
43569
|
+
log.info("\u{1F4E4} Service request body (summary):", {
|
|
43483
43570
|
ipfsId: requestBody.ipfsId,
|
|
43484
43571
|
pkpPublicKey: formattedPkpPublicKey.substring(0, 20) + "...",
|
|
43485
43572
|
pkpTokenId: formattedPkpTokenId || "NOT PROVIDED",
|
|
43486
43573
|
pkpTokenIdOriginal: pkpTokenId || "NOT PROVIDED",
|
|
43487
43574
|
pkpTokenIdFormatted: formattedPkpTokenId ? `${formattedPkpTokenId.length} chars (hex)` : "NOT PROVIDED",
|
|
43488
|
-
paramsKeys: Object.keys(jsParams)
|
|
43575
|
+
paramsKeys: Object.keys(jsParams),
|
|
43576
|
+
paramsCount: Object.keys(jsParams).length
|
|
43577
|
+
});
|
|
43578
|
+
log.info("\u{1F4E4} Complete jsParams being sent to service (for LIT Action):", {
|
|
43579
|
+
jsParamsKeys: Object.keys(jsParams),
|
|
43580
|
+
jsParamsCount: Object.keys(jsParams).length,
|
|
43581
|
+
chain: jsParams["chain"],
|
|
43582
|
+
bitcoinProviderUrl: jsParams["bitcoinProviderUrl"] ? "PROVIDED" : "NOT PROVIDED",
|
|
43583
|
+
amount: jsParams["amount"],
|
|
43584
|
+
publicKey: jsParams["publicKey"] ? `${jsParams["publicKey"].substring(0, 20)}...` : "NOT PROVIDED",
|
|
43585
|
+
ipfsId: jsParams["ipfsId"],
|
|
43586
|
+
pkpTokenId: jsParams["pkpTokenId"] || "NOT PROVIDED",
|
|
43587
|
+
rpcUrl: jsParams["rpcUrl"] ? "PROVIDED" : "NOT PROVIDED",
|
|
43588
|
+
contracts: jsParams["contracts"] ? {
|
|
43589
|
+
keys: Object.keys(jsParams["contracts"]),
|
|
43590
|
+
count: Object.keys(jsParams["contracts"]).length,
|
|
43591
|
+
PositionManager: jsParams["contracts"]?.PositionManager || "MISSING",
|
|
43592
|
+
LoanOperationsManagerModule: jsParams["contracts"]?.LoanOperationsManagerModule || "MISSING",
|
|
43593
|
+
TermManagerModule: jsParams["contracts"]?.TermManagerModule || "MISSING",
|
|
43594
|
+
UCDController: jsParams["contracts"]?.UCDController || "MISSING"
|
|
43595
|
+
} : "NOT PROVIDED",
|
|
43596
|
+
contractAddresses: jsParams["contractAddresses"] ? {
|
|
43597
|
+
keys: Object.keys(jsParams["contractAddresses"]),
|
|
43598
|
+
count: Object.keys(jsParams["contractAddresses"]).length
|
|
43599
|
+
} : "NOT PROVIDED",
|
|
43600
|
+
auth: jsParams["auth"] ? {
|
|
43601
|
+
positionId: jsParams["auth"]?.positionId,
|
|
43602
|
+
timestamp: jsParams["auth"]?.timestamp,
|
|
43603
|
+
chainId: jsParams["auth"]?.chainId,
|
|
43604
|
+
amount: jsParams["auth"]?.amount,
|
|
43605
|
+
action: jsParams["auth"]?.action,
|
|
43606
|
+
mode: jsParams["auth"]?.mode,
|
|
43607
|
+
hasSignature: !!jsParams["auth"]?.signature
|
|
43608
|
+
} : "NOT PROVIDED"
|
|
43489
43609
|
});
|
|
43610
|
+
const sanitizedParams = { ...jsParams };
|
|
43611
|
+
if (sanitizedParams["auth"] && typeof sanitizedParams["auth"] === "object") {
|
|
43612
|
+
const auth = sanitizedParams["auth"];
|
|
43613
|
+
sanitizedParams["auth"] = {
|
|
43614
|
+
...auth,
|
|
43615
|
+
signature: auth.signature ? `${auth.signature.substring(0, 20)}...` : void 0
|
|
43616
|
+
};
|
|
43617
|
+
}
|
|
43618
|
+
if (typeof sanitizedParams["publicKey"] === "string") {
|
|
43619
|
+
sanitizedParams["publicKey"] = `${sanitizedParams["publicKey"].substring(0, 20)}...`;
|
|
43620
|
+
}
|
|
43621
|
+
log.info("\u{1F4E4} Complete jsParams (sanitized JSON):", JSON.stringify(sanitizedParams, null, 2));
|
|
43490
43622
|
}
|
|
43491
43623
|
const response = await fetch(url, {
|
|
43492
43624
|
method: "POST",
|
|
@@ -43703,16 +43835,39 @@ var PKPAuthorization = class {
|
|
|
43703
43835
|
);
|
|
43704
43836
|
}
|
|
43705
43837
|
const formattedPkpPublicKey = pkpPublicKey?.startsWith("0x") ? pkpPublicKey.slice(2) : pkpPublicKey;
|
|
43838
|
+
const finalJsParams = {
|
|
43839
|
+
...jsParams,
|
|
43840
|
+
publicKey: formattedPkpPublicKey,
|
|
43841
|
+
ipfsId: cid
|
|
43842
|
+
};
|
|
43843
|
+
if (this.config.debug) {
|
|
43844
|
+
log.info("\u{1F680} Final jsParams being sent to LIT Protocol (IPFS execution):", {
|
|
43845
|
+
ipfsId: cid,
|
|
43846
|
+
jsParamsKeys: Object.keys(finalJsParams),
|
|
43847
|
+
jsParamsCount: Object.keys(finalJsParams).length,
|
|
43848
|
+
contracts: finalJsParams["contracts"] ? {
|
|
43849
|
+
keys: Object.keys(finalJsParams["contracts"]),
|
|
43850
|
+
PositionManager: finalJsParams["contracts"]?.PositionManager || "MISSING",
|
|
43851
|
+
LoanOperationsManagerModule: finalJsParams["contracts"]?.LoanOperationsManagerModule || "MISSING",
|
|
43852
|
+
TermManagerModule: finalJsParams["contracts"]?.TermManagerModule || "MISSING",
|
|
43853
|
+
UCDController: finalJsParams["contracts"]?.UCDController || "MISSING"
|
|
43854
|
+
} : "NOT PROVIDED",
|
|
43855
|
+
contractAddresses: finalJsParams["contractAddresses"] ? {
|
|
43856
|
+
keys: Object.keys(finalJsParams["contractAddresses"])
|
|
43857
|
+
} : "NOT PROVIDED",
|
|
43858
|
+
hasPublicKey: !!finalJsParams["publicKey"],
|
|
43859
|
+
publicKeyPreview: finalJsParams["publicKey"] ? `${finalJsParams["publicKey"].substring(0, 20)}...` : "MISSING",
|
|
43860
|
+
hasAuth: !!finalJsParams["auth"],
|
|
43861
|
+
chain: finalJsParams["chain"],
|
|
43862
|
+
amount: finalJsParams["amount"]
|
|
43863
|
+
});
|
|
43864
|
+
}
|
|
43706
43865
|
const result = await executeLitAction(
|
|
43707
43866
|
litClient,
|
|
43708
43867
|
{
|
|
43709
43868
|
ipfsId: cid,
|
|
43710
43869
|
sessionSigs: sessionSigsResult.sessionSigs,
|
|
43711
|
-
jsParams:
|
|
43712
|
-
...jsParams,
|
|
43713
|
-
publicKey: formattedPkpPublicKey,
|
|
43714
|
-
ipfsId: cid
|
|
43715
|
-
}
|
|
43870
|
+
jsParams: finalJsParams
|
|
43716
43871
|
},
|
|
43717
43872
|
{
|
|
43718
43873
|
maxAttempts: 1,
|
package/dist/index.mjs
CHANGED
|
@@ -42472,6 +42472,12 @@ var PKPAuthorization = class {
|
|
|
42472
42472
|
* @returns Mint authorization response
|
|
42473
42473
|
*/
|
|
42474
42474
|
async authorizeMintUCD(params, pkpPublicKey, auth, pkpTokenId, pkpEthAddress) {
|
|
42475
|
+
console.log("[PKP-AUTH] authorizeMintUCD called", {
|
|
42476
|
+
positionId: params.positionId,
|
|
42477
|
+
hasConfig: !!this.config,
|
|
42478
|
+
hasContractAddresses: !!this.config?.contractAddresses,
|
|
42479
|
+
debug: this.config?.debug
|
|
42480
|
+
});
|
|
42475
42481
|
if (this.config.debug) {
|
|
42476
42482
|
log.info("\u{1F510} Authorizing mint UCD", {
|
|
42477
42483
|
positionId: params.positionId,
|
|
@@ -42585,6 +42591,14 @@ var PKPAuthorization = class {
|
|
|
42585
42591
|
"final chainStr": chainStr
|
|
42586
42592
|
});
|
|
42587
42593
|
}
|
|
42594
|
+
console.log("[PKP-AUTH] Contract addresses check (BEFORE mapping):", {
|
|
42595
|
+
hasConfigContractAddresses: !!this.config.contractAddresses,
|
|
42596
|
+
configContractAddressKeys: this.config.contractAddresses ? Object.keys(this.config.contractAddresses) : [],
|
|
42597
|
+
positionManager: this.config.contractAddresses?.positionManager || "MISSING",
|
|
42598
|
+
loanOperationsManager: this.config.contractAddresses?.loanOperationsManager || "MISSING",
|
|
42599
|
+
termManager: this.config.contractAddresses?.termManager || "MISSING",
|
|
42600
|
+
ucdController: this.config.contractAddresses?.ucdController || "MISSING"
|
|
42601
|
+
});
|
|
42588
42602
|
if (this.config.debug) {
|
|
42589
42603
|
log.info("\u{1F50D} PKPAuthorization contract addresses check:", {
|
|
42590
42604
|
hasConfigContractAddresses: !!this.config.contractAddresses,
|
|
@@ -42596,6 +42610,14 @@ var PKPAuthorization = class {
|
|
|
42596
42610
|
});
|
|
42597
42611
|
}
|
|
42598
42612
|
const contractAddresses = this.mapContractAddressesToLitActionFormat(this.config.contractAddresses);
|
|
42613
|
+
console.log("[PKP-AUTH] Contract addresses check (AFTER mapping):", {
|
|
42614
|
+
hasMappedAddresses: !!contractAddresses,
|
|
42615
|
+
mappedKeys: contractAddresses ? Object.keys(contractAddresses) : [],
|
|
42616
|
+
PositionManager: contractAddresses?.PositionManager || "MISSING",
|
|
42617
|
+
LoanOperationsManagerModule: contractAddresses?.LoanOperationsManagerModule || "MISSING",
|
|
42618
|
+
TermManagerModule: contractAddresses?.TermManagerModule || "MISSING",
|
|
42619
|
+
UCDController: contractAddresses?.UCDController || "MISSING"
|
|
42620
|
+
});
|
|
42599
42621
|
const requiredContracts = ["PositionManager", "LoanOperationsManagerModule", "TermManagerModule", "UCDController"];
|
|
42600
42622
|
if (contractAddresses) {
|
|
42601
42623
|
const missingContracts = requiredContracts.filter((contract) => !contractAddresses[contract]);
|
|
@@ -42655,6 +42677,14 @@ var PKPAuthorization = class {
|
|
|
42655
42677
|
if (hasRequiredContracts) {
|
|
42656
42678
|
jsParams["contracts"] = contractAddresses;
|
|
42657
42679
|
jsParams["contractAddresses"] = contractAddresses;
|
|
42680
|
+
console.log("[PKP-AUTH] \u2705 Contract addresses INCLUDED in jsParams:", {
|
|
42681
|
+
contracts: Object.keys(contractAddresses),
|
|
42682
|
+
contractCount: Object.keys(contractAddresses).length,
|
|
42683
|
+
PositionManager: contractAddresses.PositionManager || "MISSING",
|
|
42684
|
+
LoanOperationsManagerModule: contractAddresses.LoanOperationsManagerModule || "MISSING",
|
|
42685
|
+
TermManagerModule: contractAddresses.TermManagerModule || "MISSING",
|
|
42686
|
+
UCDController: contractAddresses.UCDController || "MISSING"
|
|
42687
|
+
});
|
|
42658
42688
|
if (this.config.debug) {
|
|
42659
42689
|
log.info("\u{1F4CB} Contract addresses included in jsParams:", {
|
|
42660
42690
|
contracts: Object.keys(contractAddresses),
|
|
@@ -42671,6 +42701,13 @@ var PKPAuthorization = class {
|
|
|
42671
42701
|
}
|
|
42672
42702
|
} else {
|
|
42673
42703
|
const missingRequired = contractAddresses ? requiredContractsForLIT.filter((contract) => !contractAddresses[contract] || contractAddresses[contract].trim() === "") : requiredContractsForLIT;
|
|
42704
|
+
console.error("[PKP-AUTH] \u274C CRITICAL: Required contract addresses MISSING!", {
|
|
42705
|
+
hasConfigContractAddresses: !!this.config.contractAddresses,
|
|
42706
|
+
configContractAddressKeys: this.config.contractAddresses ? Object.keys(this.config.contractAddresses) : [],
|
|
42707
|
+
mappedResult: contractAddresses,
|
|
42708
|
+
missingRequiredContracts: missingRequired,
|
|
42709
|
+
availableContracts: contractAddresses ? Object.keys(contractAddresses) : []
|
|
42710
|
+
});
|
|
42674
42711
|
log.error("\u274C CRITICAL: Required contract addresses missing - LIT Action will fail!", {
|
|
42675
42712
|
hasConfigContractAddresses: !!this.config.contractAddresses,
|
|
42676
42713
|
configContractAddressKeys: this.config.contractAddresses ? Object.keys(this.config.contractAddresses) : [],
|
|
@@ -42681,11 +42718,61 @@ var PKPAuthorization = class {
|
|
|
42681
42718
|
if (contractAddresses && Object.keys(contractAddresses).length > 0) {
|
|
42682
42719
|
jsParams["contracts"] = contractAddresses;
|
|
42683
42720
|
jsParams["contractAddresses"] = contractAddresses;
|
|
42721
|
+
console.warn("[PKP-AUTH] \u26A0\uFE0F Passing incomplete contract addresses - LIT Action may fail");
|
|
42684
42722
|
log.warn("\u26A0\uFE0F Passing incomplete contract addresses - LIT Action may fail");
|
|
42685
42723
|
} else {
|
|
42724
|
+
console.error("[PKP-AUTH] \u274C No contract addresses to pass - LIT Action will definitely fail with toLowerCase error");
|
|
42686
42725
|
log.error("\u274C No contract addresses to pass - LIT Action will definitely fail with toLowerCase error");
|
|
42687
42726
|
}
|
|
42688
42727
|
}
|
|
42728
|
+
if (this.config.debug) {
|
|
42729
|
+
log.info("\u{1F4E4} Complete jsParams being sent to LIT Action:", {
|
|
42730
|
+
jsParamsKeys: Object.keys(jsParams),
|
|
42731
|
+
jsParamsCount: Object.keys(jsParams).length,
|
|
42732
|
+
// Log all params with sanitized sensitive data
|
|
42733
|
+
chain: jsParams["chain"],
|
|
42734
|
+
bitcoinProviderUrl: jsParams["bitcoinProviderUrl"] ? "PROVIDED" : "NOT PROVIDED",
|
|
42735
|
+
amount: jsParams["amount"],
|
|
42736
|
+
publicKey: jsParams["publicKey"] ? `${jsParams["publicKey"].substring(0, 20)}...` : "NOT PROVIDED",
|
|
42737
|
+
ipfsId: jsParams["ipfsId"],
|
|
42738
|
+
pkpTokenId: jsParams["pkpTokenId"] || "NOT PROVIDED",
|
|
42739
|
+
rpcUrl: jsParams["rpcUrl"] ? "PROVIDED" : "NOT PROVIDED",
|
|
42740
|
+
contracts: jsParams["contracts"] ? {
|
|
42741
|
+
keys: Object.keys(jsParams["contracts"]),
|
|
42742
|
+
count: Object.keys(jsParams["contracts"]).length,
|
|
42743
|
+
PositionManager: jsParams["contracts"]?.PositionManager || "MISSING",
|
|
42744
|
+
LoanOperationsManagerModule: jsParams["contracts"]?.LoanOperationsManagerModule || "MISSING",
|
|
42745
|
+
TermManagerModule: jsParams["contracts"]?.TermManagerModule || "MISSING",
|
|
42746
|
+
UCDController: jsParams["contracts"]?.UCDController || "MISSING"
|
|
42747
|
+
} : "NOT PROVIDED",
|
|
42748
|
+
contractAddresses: jsParams["contractAddresses"] ? {
|
|
42749
|
+
keys: Object.keys(jsParams["contractAddresses"]),
|
|
42750
|
+
count: Object.keys(jsParams["contractAddresses"]).length
|
|
42751
|
+
} : "NOT PROVIDED",
|
|
42752
|
+
// Log full auth object structure (without signature value)
|
|
42753
|
+
auth: jsParams["auth"] ? {
|
|
42754
|
+
positionId: jsParams["auth"]?.positionId,
|
|
42755
|
+
timestamp: jsParams["auth"]?.timestamp,
|
|
42756
|
+
chainId: jsParams["auth"]?.chainId,
|
|
42757
|
+
amount: jsParams["auth"]?.amount,
|
|
42758
|
+
action: jsParams["auth"]?.action,
|
|
42759
|
+
mode: jsParams["auth"]?.mode,
|
|
42760
|
+
hasSignature: !!jsParams["auth"]?.signature
|
|
42761
|
+
} : "NOT PROVIDED"
|
|
42762
|
+
});
|
|
42763
|
+
const sanitizedParams = { ...jsParams };
|
|
42764
|
+
if (sanitizedParams["auth"] && typeof sanitizedParams["auth"] === "object") {
|
|
42765
|
+
const auth2 = sanitizedParams["auth"];
|
|
42766
|
+
sanitizedParams["auth"] = {
|
|
42767
|
+
...auth2,
|
|
42768
|
+
signature: auth2.signature ? `${auth2.signature.substring(0, 20)}...` : void 0
|
|
42769
|
+
};
|
|
42770
|
+
}
|
|
42771
|
+
if (typeof sanitizedParams["publicKey"] === "string") {
|
|
42772
|
+
sanitizedParams["publicKey"] = `${sanitizedParams["publicKey"].substring(0, 20)}...`;
|
|
42773
|
+
}
|
|
42774
|
+
log.info("\u{1F4E4} Complete jsParams (sanitized JSON):", JSON.stringify(sanitizedParams, null, 2));
|
|
42775
|
+
}
|
|
42689
42776
|
const litResult = await this.executeLitAction(pkpPublicKey, jsParams, pkpTokenId, pkpEthAddress);
|
|
42690
42777
|
if (!litResult.success) {
|
|
42691
42778
|
return litResult;
|
|
@@ -43384,14 +43471,59 @@ var PKPAuthorization = class {
|
|
|
43384
43471
|
...formattedPkpTokenId ? { pkpTokenId: formattedPkpTokenId } : {}
|
|
43385
43472
|
};
|
|
43386
43473
|
if (this.config.debug) {
|
|
43387
|
-
log.info("\u{1F4E4} Service request body:", {
|
|
43474
|
+
log.info("\u{1F4E4} Service request body (summary):", {
|
|
43388
43475
|
ipfsId: requestBody.ipfsId,
|
|
43389
43476
|
pkpPublicKey: formattedPkpPublicKey.substring(0, 20) + "...",
|
|
43390
43477
|
pkpTokenId: formattedPkpTokenId || "NOT PROVIDED",
|
|
43391
43478
|
pkpTokenIdOriginal: pkpTokenId || "NOT PROVIDED",
|
|
43392
43479
|
pkpTokenIdFormatted: formattedPkpTokenId ? `${formattedPkpTokenId.length} chars (hex)` : "NOT PROVIDED",
|
|
43393
|
-
paramsKeys: Object.keys(jsParams)
|
|
43480
|
+
paramsKeys: Object.keys(jsParams),
|
|
43481
|
+
paramsCount: Object.keys(jsParams).length
|
|
43482
|
+
});
|
|
43483
|
+
log.info("\u{1F4E4} Complete jsParams being sent to service (for LIT Action):", {
|
|
43484
|
+
jsParamsKeys: Object.keys(jsParams),
|
|
43485
|
+
jsParamsCount: Object.keys(jsParams).length,
|
|
43486
|
+
chain: jsParams["chain"],
|
|
43487
|
+
bitcoinProviderUrl: jsParams["bitcoinProviderUrl"] ? "PROVIDED" : "NOT PROVIDED",
|
|
43488
|
+
amount: jsParams["amount"],
|
|
43489
|
+
publicKey: jsParams["publicKey"] ? `${jsParams["publicKey"].substring(0, 20)}...` : "NOT PROVIDED",
|
|
43490
|
+
ipfsId: jsParams["ipfsId"],
|
|
43491
|
+
pkpTokenId: jsParams["pkpTokenId"] || "NOT PROVIDED",
|
|
43492
|
+
rpcUrl: jsParams["rpcUrl"] ? "PROVIDED" : "NOT PROVIDED",
|
|
43493
|
+
contracts: jsParams["contracts"] ? {
|
|
43494
|
+
keys: Object.keys(jsParams["contracts"]),
|
|
43495
|
+
count: Object.keys(jsParams["contracts"]).length,
|
|
43496
|
+
PositionManager: jsParams["contracts"]?.PositionManager || "MISSING",
|
|
43497
|
+
LoanOperationsManagerModule: jsParams["contracts"]?.LoanOperationsManagerModule || "MISSING",
|
|
43498
|
+
TermManagerModule: jsParams["contracts"]?.TermManagerModule || "MISSING",
|
|
43499
|
+
UCDController: jsParams["contracts"]?.UCDController || "MISSING"
|
|
43500
|
+
} : "NOT PROVIDED",
|
|
43501
|
+
contractAddresses: jsParams["contractAddresses"] ? {
|
|
43502
|
+
keys: Object.keys(jsParams["contractAddresses"]),
|
|
43503
|
+
count: Object.keys(jsParams["contractAddresses"]).length
|
|
43504
|
+
} : "NOT PROVIDED",
|
|
43505
|
+
auth: jsParams["auth"] ? {
|
|
43506
|
+
positionId: jsParams["auth"]?.positionId,
|
|
43507
|
+
timestamp: jsParams["auth"]?.timestamp,
|
|
43508
|
+
chainId: jsParams["auth"]?.chainId,
|
|
43509
|
+
amount: jsParams["auth"]?.amount,
|
|
43510
|
+
action: jsParams["auth"]?.action,
|
|
43511
|
+
mode: jsParams["auth"]?.mode,
|
|
43512
|
+
hasSignature: !!jsParams["auth"]?.signature
|
|
43513
|
+
} : "NOT PROVIDED"
|
|
43394
43514
|
});
|
|
43515
|
+
const sanitizedParams = { ...jsParams };
|
|
43516
|
+
if (sanitizedParams["auth"] && typeof sanitizedParams["auth"] === "object") {
|
|
43517
|
+
const auth = sanitizedParams["auth"];
|
|
43518
|
+
sanitizedParams["auth"] = {
|
|
43519
|
+
...auth,
|
|
43520
|
+
signature: auth.signature ? `${auth.signature.substring(0, 20)}...` : void 0
|
|
43521
|
+
};
|
|
43522
|
+
}
|
|
43523
|
+
if (typeof sanitizedParams["publicKey"] === "string") {
|
|
43524
|
+
sanitizedParams["publicKey"] = `${sanitizedParams["publicKey"].substring(0, 20)}...`;
|
|
43525
|
+
}
|
|
43526
|
+
log.info("\u{1F4E4} Complete jsParams (sanitized JSON):", JSON.stringify(sanitizedParams, null, 2));
|
|
43395
43527
|
}
|
|
43396
43528
|
const response = await fetch(url, {
|
|
43397
43529
|
method: "POST",
|
|
@@ -43608,16 +43740,39 @@ var PKPAuthorization = class {
|
|
|
43608
43740
|
);
|
|
43609
43741
|
}
|
|
43610
43742
|
const formattedPkpPublicKey = pkpPublicKey?.startsWith("0x") ? pkpPublicKey.slice(2) : pkpPublicKey;
|
|
43743
|
+
const finalJsParams = {
|
|
43744
|
+
...jsParams,
|
|
43745
|
+
publicKey: formattedPkpPublicKey,
|
|
43746
|
+
ipfsId: cid
|
|
43747
|
+
};
|
|
43748
|
+
if (this.config.debug) {
|
|
43749
|
+
log.info("\u{1F680} Final jsParams being sent to LIT Protocol (IPFS execution):", {
|
|
43750
|
+
ipfsId: cid,
|
|
43751
|
+
jsParamsKeys: Object.keys(finalJsParams),
|
|
43752
|
+
jsParamsCount: Object.keys(finalJsParams).length,
|
|
43753
|
+
contracts: finalJsParams["contracts"] ? {
|
|
43754
|
+
keys: Object.keys(finalJsParams["contracts"]),
|
|
43755
|
+
PositionManager: finalJsParams["contracts"]?.PositionManager || "MISSING",
|
|
43756
|
+
LoanOperationsManagerModule: finalJsParams["contracts"]?.LoanOperationsManagerModule || "MISSING",
|
|
43757
|
+
TermManagerModule: finalJsParams["contracts"]?.TermManagerModule || "MISSING",
|
|
43758
|
+
UCDController: finalJsParams["contracts"]?.UCDController || "MISSING"
|
|
43759
|
+
} : "NOT PROVIDED",
|
|
43760
|
+
contractAddresses: finalJsParams["contractAddresses"] ? {
|
|
43761
|
+
keys: Object.keys(finalJsParams["contractAddresses"])
|
|
43762
|
+
} : "NOT PROVIDED",
|
|
43763
|
+
hasPublicKey: !!finalJsParams["publicKey"],
|
|
43764
|
+
publicKeyPreview: finalJsParams["publicKey"] ? `${finalJsParams["publicKey"].substring(0, 20)}...` : "MISSING",
|
|
43765
|
+
hasAuth: !!finalJsParams["auth"],
|
|
43766
|
+
chain: finalJsParams["chain"],
|
|
43767
|
+
amount: finalJsParams["amount"]
|
|
43768
|
+
});
|
|
43769
|
+
}
|
|
43611
43770
|
const result = await executeLitAction(
|
|
43612
43771
|
litClient,
|
|
43613
43772
|
{
|
|
43614
43773
|
ipfsId: cid,
|
|
43615
43774
|
sessionSigs: sessionSigsResult.sessionSigs,
|
|
43616
|
-
jsParams:
|
|
43617
|
-
...jsParams,
|
|
43618
|
-
publicKey: formattedPkpPublicKey,
|
|
43619
|
-
ipfsId: cid
|
|
43620
|
-
}
|
|
43775
|
+
jsParams: finalJsParams
|
|
43621
43776
|
},
|
|
43622
43777
|
{
|
|
43623
43778
|
maxAttempts: 1,
|
package/package.json
CHANGED