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

flint-gasless-sdk

v1.1.0

Published

![Logo](https://dnj9s9rkg1f49.cloudfront.net/flint-logo-golden-black.svg)

Downloads

3

Readme

Logo

Flint Gasless SDK

Flint gasless SDK (Gaspay) does the magic of enabling gasless feature in any dApp with just a few lines of code. Users can pay in ERC20 tokens to send transactions to the blockchain that needs native tokens otherwise.

Installation

Recommended Node version 16 or higher

  npm install flint-gasless-sdk

Documentation

import { GaspayManager } from "flint-gasless-sdk";

const gaspayManager = new GaspayManager("<FLINT_GASPAY_API_KEY>");

const { dataToSign, functionSignature } =
      await gaspayManager.generateApprovalSignature(
        <WALLET_ADDRESS>,
        <ERC20_TOKEN_ADDRESS>,
        <CHAIN_ID>
);

Get the signature from the user

You can use default ethereum injected by the wallet provider or wagmi to initiate a signature from the user in your dApp.

Note: This will open metamask or any other ethereum wallet

const signature = await ethereum.request({
            method: 'eth_signTypedData_v4',
            params: [walletAddress, JSON.stringify(dataToSign)],
    });

Or

You can read about signing typed data here: wagmi


import { useSignTypedData } from 'wagmi'

const signTypedData = useSignTypedData({
    domain,
    types,
    value,
    onSuccess(data) {
      console.log('Success', data)
      // Call gasless sdk on this data signature returned
    },
  })

Finally send this transaction through the SDK

const txDetails = await gaspayManager.sendApprovalTransaction(
        data,
        functionSig,
        <ERC20_TOKEN_ADDRESS>,
        <WALLET_ADDRESS>,
        <CHAIN_ID>
    );

Get signature for SWAP

const swapSig = await gaspayManager.generateSwapSignature(
    merchantApiKey,
    params,
    chainId,
    walletAddress
)

Send the SWAP signature

const result = await gaspayManager.sendSwapTransaction(
    merchantApiKey,
    signature,
    params,
    chainId,
    walletAddress
)

And voilà!! You have gasless feature enabled in your dApp with just a few lines of code 🥳

API Reference

Generate approval signature

generateApprovalSignature(walletAddress: string, fromToken: string, chainId: string): Promise<ApprovalSignature>;

| Parameter | Type | Description | | :-------- | :------- | :------------------------- | | walletAddress | string | Required. User wallet address connected to the dApp | | fromToken | string | Required. ERC20 token in for approval | | chainId | string | Required. Current chain id of the connected account |

Send approval transaction

  sendApprovalTransaction(signature: string, functionSignature: string, fromToken: string, walletAddress: string, chainId: string): Promise<any>;

| Parameter | Type | Description | | :-------- | :------- | :-------------------------------- | | signature | string | Required. Signature returned by the users ethereum wallet | functionSignature | string | Required. function signature returned by flint gaspay manager | fromToken | string | Required. ERC20 token address for approval | walletAddress | string | Required. Wallet address of the connected user | chainId | string | Required. Current chain id of the connected account

Get swap signature

  generateSwapSignature (merchantApiKey: string, params: any, chainId: string, walletAddress: string): Promise<string>

| Parameter | Type | Description | | :-------- | :------- | :-------------------------------- | | merchantApiKey | string | Required. Merchant api key provided by flint | params | any | Required. Parameters required for swap in case of the specific merchant | chainId | string | Required. connected chainId of user's wallet | walletAddress | string | Required. Wallet address of the connected user

Send swap transaction

  sendSwapTransaction (merchantApiKey: string, signature: string, params: any, chainId: string, walletAddress: string): Promise<any>

| Parameter | Type | Description | | :-------- | :------- | :-------------------------------- | | merchantApiKey | string | Required. Merchant api key provided by flint | signature | string | Required. user signed signature for swap | params | any | Required. Parameters required for swap in case of the specific merchant | chainId | string | Required. connected chainId of user's wallet | walletAddress | string | Required. Wallet address of the connected user

Authors

License

MIT