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

kinto-web-sdk

v1.0.2

Published

Kinto Wallet SDK for app development

Downloads

94

Readme

Kinto Wallet SDK

Kinto SDK is a JavaScript library that allows applications to connect to the Kinto Wallet. Kinto is an Ethereum Layer 2 (L2) solution designed to provide fast and cost-efficient transactions. This SDK provides methods to connect a Kinto Wallet, send transactions, and create new wallets.

Table of Contents

Design Principles

The Kinto SDK has been designed with the following principles in mind:

  • No Dependencies: The SDK is built without external dependencies to minimize its size and maximize security. This ensures that it doesn't rely on any third-party libraries.

  • No UI: The SDK does not provide any user interface components. This allows app developers the flexibility to design their own UI and remain unopinionated about the user experience.

  • No Web3 Packages: The SDK is agnostic to specific Ethereum libraries. You can use any library you prefer, such as viem, ethers, or web3js. The SDK itself doesn't require any of these packages.

Installation

You can install the Kinto SDK via npm:

npm install kinto-web-sdk

Usage

Prerequisites

Before using the Kinto SDK, ensure you have completed the following steps:

  1. Kinto Wallet: You need to have a Kinto wallet. Create an account by visiting Kinto Onboarding.

  2. Developer Account: Create a developer account, deploy a contract, and create the application. Use your main contract address as the app address. Visit Kinto Developers to get started.

Initialization

To use the Kinto SDK, you need to initialize it with your application's address.

import { createKintoSDK } from 'kinto-web-sdk';

const appAddress = 'your-app-address';
const kintoSDK = createKintoSDK(appAddress);

Connecting to Kinto Wallet

To connect to the Kinto Wallet, use the connect method. This method opens a modal for the user to connect their wallet.

kintoSDK.connect()
  .then((accountInfo) => {
    console.log('Connected account info:', accountInfo);
  })
  .catch((error) => {
    console.error('Failed to connect:', error);
  });

Sending Transactions

To send transactions, use the sendTransaction method. This method accepts an array of transaction objects.

const transactions = [
  {
    to: '0xRecipientAddress',
    value: '1000000000000000000', // 1 ETH in wei`
    data: '0x'
  }
];

kintoSDK.sendTransaction(transactions)
  .then((hash) => {
    console.log('Transaction successful, hash:', hash);
  })
  .catch((error) => {
    console.error('Transaction failed:', error);
  });

Creating a New Wallet

To create a new wallet, use the createNewWallet method. This method opens a popup for the user to create a new wallet in Kinto website. Alternatively, you can instruct users to visit Kinto to create an account.

kintoSDK.createNewWallet()
  .then(() => {
    console.log('New wallet created successfully');
  })
  .catch((error) => {
    console.error('Failed to create new wallet:', error);
  });

API

KintoSDK

connect()

Starts a connection with a logged-in Kinto Wallet and returns the account information.

Returns: Promise<KintoAccountInfo>

sendTransaction(txs: TxCall[]): Promise

Sends transactions through the Kinto Wallet.

  • txs: An array of transaction objects.

Returns: Promise<void>

createNewWallet(): Promise

Opens a popup for the user to create a new wallet.

Returns: Promise<void>

Types

AppMetadata

export interface AppMetadata {
  parent: `0x${string}`;
  paymasterBalance: number;
  tokenId: number;
  dsaEnabled: boolean;
  rateLimitPeriod: number;
  rateLimitNumber: number;
  gasLimitPeriod: number;
  gasLimitCost: number;
  name: string;
  devEOAs: string[];
  appContracts: string[];
}

KintoAccountInfo

export interface KintoAccountInfo {
  exists: boolean;
  approval?: boolean;
  walletAddress?: `0x${string}`;
  app: AppMetadata;
  appKey?: `0x${string}`;
}

TxCall

export interface TxCall {
  to: `0x${string}`;
  data: `0x${string}`;
  value: bigint;
}

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License. See the LICENSE file for details.


For more information about Kinto, visit docs.kinto.xyz.