Lit Protocol PKP/Cosmos
A small, complimentary package for CosmJS that allows PKPs to sign and send transactions on the Cosmos Network.
Install:
npm install lit-pkp-cosmos
yarn add lit-pkp-cosmos
Usage:
Instantiate a signer with the PKP public key, a valid auth sig of the owning wallet, and an RPC for the Cosmos Network.
import { SigningStargateClientWithLit } from "lit-pkp-cosmos";
const pkpCosmosSigner = await SigningStargateClientWithLit.createClient(
pkpPubKey, // uncompressed public key
pkpOwnerAuthSig, // authSig of the owning party
rpc
);
An introduction to Lit Actions and PKPs
Mint PKPs here
To use, pass a valid Cosmos address, an amount, and fee. The fee must be hardcoded since the transactions cannot be
simulated with PKPs.
const txRes = await pkpCosmosSigner.sendTokens(
recipientAddress
[{denom: "uatom", amount: "100000"}],
{
amount: [{denom: "uatom", amount: "1000"}],
gas: "100000",
}
);
console.log('txRes', txRes)
CosmJS tutorial
CosmJS on Github