1.0.9 • Published 1 year ago

lit-pkp-cosmos v1.0.9

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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