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

@keyban/sdk-base

v0.3.3

Published

Keyban Javascript SDK provides core functionalities for the MPC wallet solution, supporting web and Node.js apps with TypeScript, custom storage, and Ethereum blockchain integration.

Downloads

330

Readme

Keyban JavaScript SDK

Overview

The Keyban JavaScript SDK provides the core functionality for Keyban's MPC wallet solution, simplifying the development of web and Node.js applications. It offers essential configurations, utilities, and functions that serve as the foundation for creating decentralized wallet experiences.

Key Features

  • TypeScript Support: Fully typed to enhance code quality and development experience.
  • Flexible Storage: Support for custom storage solutions, with built-in options coming soon.
  • Blockchain Support: Supports Ethereum testnets and the Polygon Amoy testnet.
  • ERC-20, ERC-721, and ERC-1155 Support: Transfer and interact with ERC-20 tokens and NFTs (ERC-721 and ERC-1155).
  • Bundling: Efficiently bundled using tsup for optimized builds in development and production.

Installation

npm install @keyban/sdk-base

Basic Example

Initialize the SDK

import { KeybanClient, KeybanChain, KeybanAccount } from '@keyban/sdk-base';

const client = new KeybanClient({
  appId: "your-keyban-app-id",                 // Your Keyban application ID
  accessTokenProvider: async () => "access-token", // Function to provide the access token
  chain: KeybanChain.KeybanTestnet,            // Select the desired blockchain network
});

Retrieve Account Information

const account: KeybanAccount = await client.initialize();

Estimate Transaction Fees

const transferEstimate = await account.estimateTransfer("0xRecipientAddress", BigInt('1000000000000000000')); // 1 ETH in wei

Perform Token Transfer

await account.transfer("0xRecipientAddress", BigInt('1000000000000000000'));
console.log(`Transferred 1 ETH to 0xRecipientAddress`);

Retrieve ERC-20 Token Balances

const tokenBalances = await client.getTokenBalances(account.address);
console.log('ERC-20 Token Balances:', tokenBalances);

Perform ERC-20 Token Transfer

const erc20Estimate = await account.estimateERC20Transfer({
  contractAddress: "0xTokenContractAddress",   // ERC-20 contract address
  to: "0xRecipientAddress",                    // Recipient address
  value: BigInt('500000000000000000'),         // Amount to transfer (0.5 tokens in wei)
});
await account.transferERC20({
  contractAddress: "0xTokenContractAddress",
  to: "0xRecipientAddress",
  value: BigInt('500000000000000000'),
});
console.log(`Transferred 0.5 tokens to 0xRecipientAddress`);

Retrieve NFTs Owned by the Account

const nfts = await client.getNfts(account.address);
console.log('Owned NFTs:', nfts);

Perform NFT Transfer

const nftEstimate = await account.estimateNftTransfer({
  contractAddress: "0xNftContractAddress",
  to: "0xRecipientAddress",
  tokenId: BigInt(1),                          // Token ID
  standard: 'ERC721',                          // 'ERC721' or 'ERC1155'
});
await account.transferNft({
  contractAddress: "0xNftContractAddress",
  to: "0xRecipientAddress",
  tokenId: BigInt(1),
  standard: 'ERC721',
});
console.log(`Transferred NFT with Token ID 1 to 0xRecipientAddress`);

Supported Blockchains

The Keyban SDK supports the following blockchains:

  • Keyban Testnet: KeybanChain.KeybanTestnet
  • Polygon Amoy Testnet: KeybanChain.PolygonAmoy

Support for additional blockchains and mainnets will be introduced in future releases.

Custom Storage and Signing

Developers can define their own storage and signing strategies. The SDK offers flexibility with custom storage mechanisms, and future releases will bring more built-in storage options.

Documentation

For more detailed API references and advanced features, visit the official Keyban API Reference Portal.