Skip to content

Commit 8bbd2be

Browse files
committed
feat: Add additional param for custom Wrapped Keys fields
1 parent 9544af0 commit 8bbd2be

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

packages/wrapped-keys/src/lib/interfaces.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export interface CustomSignMessageWithEncryptedKeyParams {
5050
litActionIpfsCid?: string;
5151
litActionCode?: string;
5252
messageToSign: string | Uint8Array;
53+
params?: Record<string, any>;
5354
litNodeClient: ILitNodeClient;
5455
}
5556

@@ -72,8 +73,9 @@ export interface CustomSignTransactionWithEncryptedKeyParams {
7273
pkpSessionSigs: SessionSigsMap;
7374
litActionIpfsCid?: string;
7475
litActionCode?: string;
75-
unsignedTransaction: SolanaLitTransaction;
76+
serializedTransaction: string;
7677
broadcast: boolean;
78+
params?: Record<string, any>;
7779
litNodeClient: ILitNodeClient;
7880
}
7981

packages/wrapped-keys/src/lib/wrapped-keys.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,9 @@ export async function signTransactionWithEncryptedKey<T = LitTransaction>({
320320
* @param pkpSessionSigs - The PKP sessionSigs used to associated the PKP with the generated private key
321321
* @param litActionIpfsCid - The IPFS CID of the Lit Action to be executed for generating the Wrapped Key. Can't provide this if already provided litActionCode
322322
* @param litActionCode - The Lit Action code to be executed for generating the Wrapped Key. Can't provide this if already provided litActionIpfsCid
323-
* @param unsignedTransaction - The unsigned transaction which will be signed inside the Lit Action. It should be a serialized unsigned transaction
323+
* @param serializedTransaction - The unsigned transaction which will be signed inside the Lit Action. It should be a serialized unsigned transaction
324324
* @param broadcast - Flag used to determine whether the Lit Action should broadcast the signed transaction or only return the signed transaction
325+
* @param params - Any other params passes to the Lit Action
325326
* @param litNodeClient - The Lit Node Client used for executing the Lit Action
326327
*
327328
* @returns { Promise<string> } - The signed signed transaction or the transaction hash of the broadcasted transaction by the Wrapped Key
@@ -330,8 +331,9 @@ export async function customSignTransactionWithEncryptedKey({
330331
pkpSessionSigs,
331332
litActionIpfsCid,
332333
litActionCode,
333-
unsignedTransaction,
334+
serializedTransaction,
334335
broadcast,
336+
params,
335337
litNodeClient,
336338
}: CustomSignTransactionWithEncryptedKeyParams): Promise<string> {
337339
if (!litActionIpfsCid && !litActionCode) {
@@ -355,9 +357,10 @@ export async function customSignTransactionWithEncryptedKey({
355357
pkpAddress,
356358
ciphertext,
357359
dataToEncryptHash,
358-
unsignedTransaction,
360+
serializedTransaction,
359361
broadcast,
360362
accessControlConditions: getPkpAccessControlCondition(pkpAddress),
363+
...params,
361364
},
362365
});
363366
} catch (err: any) {
@@ -427,6 +430,7 @@ export async function signMessageWithEncryptedKey({
427430
* @param litActionIpfsCid - The IPFS CID of the Lit Action to be executed for generating the Wrapped Key. Can't provide this if already provided litActionCode
428431
* @param litActionCode - The Lit Action code to be executed for generating the Wrapped Key. Can't provide this if already provided litActionIpfsCid
429432
* @param messageToSign - The unsigned message which will be signed inside the Lit Action
433+
* @param params - Any other params passes to the Lit Action
430434
* @param litNodeClient - The Lit Node Client used for executing the Lit Action
431435
*
432436
* @returns { Promise<string> } - The signed message by the Wrapped Key
@@ -436,6 +440,7 @@ export async function customSignMessageWithEncryptedKey({
436440
litActionIpfsCid,
437441
litActionCode,
438442
messageToSign,
443+
params,
439444
litNodeClient,
440445
}: CustomSignMessageWithEncryptedKeyParams): Promise<string> {
441446
if (!litActionIpfsCid && !litActionCode) {
@@ -461,6 +466,7 @@ export async function customSignMessageWithEncryptedKey({
461466
dataToEncryptHash,
462467
messageToSign,
463468
accessControlConditions: getPkpAccessControlCondition(pkpAddress),
469+
...params,
464470
},
465471
});
466472
} catch (err: any) {

0 commit comments

Comments
 (0)