npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lit-protocol/pkp-sui

v7.0.0

Published

The `PKPSuiWallet` class is a specialized wallet for the SUI blockchain using signing scheme based on ECDSA Secp256k1. It's modified version of `SignerWithProvider` class from the `@mysten/sui.js` library. This class wraps the 'PKPBase' class and implemen

Downloads

1,096

Readme

pkp-sui

The PKPSuiWallet class is a specialized wallet for the SUI blockchain using signing scheme based on ECDSA Secp256k1. It's modified version of SignerWithProvider class from the @mysten/sui.js library. This class wraps the 'PKPBase' class and implements the 'Signer' interface. Unlike RawSigner from the @mysten/sui.js, PKPSuiWallet does not store private keys. Despite these differences, it retains all functionality.

Note: Since LitAction uses WebAssembly, additional settings are required to use it in Chrome extension.

Getting Started

yarn add @lit-protocol/pkp-sui @mysten/sui.js

Examples

Create a wallet and get the address

import { PKPSuiWallet } from '@lit-protocol/pkp-sui';
import { JsonRpcProvider, mainnetConnection } from '@mysten/sui.js';

const pkpSuiWallet = new PKPSuiWallet(
  {
    controllerAuthSig: AuthSig,
    pkpPubKey: PKPPubKey,
  },
  new JsonRpcProvider(mainnetConnection)
);
return await pkpSuiWallet.getAddress();

Change wallet rpc/network

import { JsonRpcProvider, testnetConnection, Connection } from '@mysten/sui.js';
// connect to testnet
pkpSuiWallet.connect(new JsonRpcProvider(testnetConnection));
// connect to custom rpcUrl
pkpSuiWallet.connect(new JsonRpcProvider(new Connection({ fullnode: rpcUrl })));

Transfer Sui

import { TransactionBlock } from '@mysten/sui.js';

const tx = new TransactionBlock();
const [coin] = tx.splitCoins(tx.gas, [tx.pure(amount)]);
tx.transferObjects([coin], tx.pure(recipient));

return await pkpSuiWallet.signAndExecuteTransactionBlock({
  transactionBlock: tx,
});

Stake Sui

import { SUI_SYSTEM_STATE_OBJECT_ID, TransactionBlock } from '@mysten/sui.js';

const tx = new TransactionBlock();
const stakeCoin = tx.splitCoins(tx.gas, [tx.pure(amount)]);
tx.moveCall({
  target: '0x3::sui_system::request_add_stake',
  arguments: [
    tx.object(SUI_SYSTEM_STATE_OBJECT_ID),
    stakeCoin,
    tx.pure(validator),
  ],
});
return await pkpSuiWallet.signAndExecuteTransactionBlock({
  transactionBlock: tx,
});

Get balance

const provider = new JsonRpcProvider(mainnetConnection);
const address = await pkpSuiWallet.getAddress();
const balance = await provider.getBalance(address);

Sign message

await pkpSuiWallet.signMessage({ message });

Sign transaction

await pkpSuiWallet.signTransactionBlock({ transactionBlock });

dryRunTransactionBlock for estimating transaction result

await pkpSuiWallet.dryRunTransactionBlock({ transactionBlock });

Running unit tests

Run nx test pkp-sui to execute the unit tests via Jest. If test 3,4 fail, It means sui testnet has been reset. Use sui testnet faucet to get some sui and try again.