Skip to main content

Function

signTransactionWithEncryptedKey(params)
Signs an EVM or Solana transaction with a stored wrapped key. Optionally broadcasts when the Lit Action supports it.

Parameters

params.pkpSessionSigs
SessionSigsMap
required
params.litClient
LitClient
required
params.network
'evm' | 'solana'
required
params.id
string
required
params.unsignedTransaction
object
required
Serialized transaction payload. For Solana include chain/serializedTransaction; for EVM include chain, chainId, and toAddress/value.
params.broadcast
boolean
When true, the Lit Action attempts to submit the signed transaction to the configured RPC endpoint and returns the transaction hash.
params.versionedTransaction
boolean
Set to true when providing a Solana versioned transaction payload.
params.userMaxPrice
bigint
Optional price ceiling for the Lit Action.

Returns

result
string
Signed transaction (or hash when broadcasting is enabled).

Example

const signedTx = await wrappedKeysApi.signTransactionWithEncryptedKey({
  pkpSessionSigs,
  litClient,
  network: 'evm',
  id,
  unsignedTransaction: {
    chain: 'yellowstone',
    chainId: 1337,
    toAddress: ZERO_ADDRESS,
    value: '0',
  },
  broadcast: false,
});