LIT-Protocol / js-sdk

The Lit Protocol SDK provides developers with a framework for implementing Lit functionality into their own applications.
https://developer.litprotocol.com
MIT License
92 stars 55 forks source link

Add `signMessage` and `signTransaction` Lit Action exports for Wrapped Keys #504

Closed spacesailor24 closed 2 weeks ago

spacesailor24 commented 3 weeks ago

NOTE Before this PR is merged, we need to pin the bundled Lit Action code via Lit's official Pinata account (or similar), as they are currently pinned via my personal Pinata account


Adds two exported consts from wrapped-keys package:

  1. signTransactionWithSolanaEncryptedKeyLitActionIpfsCid
    • This CID refers to the bundled Lit Action code to sign and submit a Solana transaction using a decrypted private key within the Lit Action
    • This Lit Actions accepts the parameters:
      accessControlConditions,
      ciphertext,
      dataToEncryptHash,
      serializedTransaction,
      broadcast,
      solanaNetwork,
      • serializedTransaction by required a serialized transaction, we can support any Solana transaction signing (i.e. transfers or contract executions)
      • broadcast determines whether or not the signed transaction is submitted to the solanaNetwork
      • solanaNetwork is the Solana network to connect to
        • Options are: mainnet-beta, testnet, and devnet
  2. signMessageWithSolanaEncryptedKeyLitActionIpfsCid
    • This CID refers to the bundled Lit Action code to sign a message using a decrypted private key within the Lit Action
    • This Lit Actions accepts the parameters:
      accessControlConditions,
      ciphertext,
      dataToEncryptHash,
      messageToSign
      • messageToSign can be any string and is not expected to be encoded any specific way (it will be converted to a Buffer before signing within the Lit Action)

I tested that the sign tx and submit Lit Action works manually by providing it a testnet private key to the testSignTransactionWithSolanaEncryptedKey test and enabled broadcast (tx receipt)


For organizational purposes, I renamed the Eth Lit Actions file to ethereum.ts and moved it under a new litActions directory. The Solana Lit Actions are located under litActions/Solana

CLAassistant commented 3 weeks ago

CLA assistant check
All committers have signed the CLA.

DashKash54 commented 2 weeks ago

solanaNetwork is the Solana network to connect to

Let's add it to the SolanaLitTransaction interface? Then it can be part of the unsigned transaction params?

DashKash54 commented 2 weeks ago

Also the Linter is failing, please run yarn prettier