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

parakeet-bridge-sdk

v1.2.4

Published

Parakeet Bridge provides a key missing piece of infrastructure by helping users bridge their NFTs between multiple blockchains. <br /> With Parakeet bridge you can transfer your ERC721/ERC1155 tokens across multiple public blockchain networks in a secure

Downloads

3

Readme

What is Parakeet SDK

Parakeet Bridge provides a key missing piece of infrastructure by helping users bridge their NFTs between multiple blockchains. With Parakeet bridge you can transfer your ERC721/ERC1155 tokens across multiple public blockchain networks in a secure, trustless & decentralized manner. You can read more about Parakeet DAO in Official docs NPM package

Supported chains (Testnet)

| Testnet | Chain ID | | ------------------------ | -------- | | Rinkeby | 4 | | BSC Testnet | 97 | | Arbitrum Rinkeby Testnet | 421611 | | Mumbai (Polygon Testnet) | 80001 | | Fantom Testnet | 4002 | | Fuji (Avalanche Testnet) | 43113 | | Optimism Kovan Testnet | 69 |

Supported chains (Mainnet) >>> Coming Soon

| Mainnet | Chain ID | | ------------------- | -------- | | Ethereum | 1 | | Binance Smart Chain | 56 | | Arbitrum | 42161 | | Polygon | 137 | | Fantom | 250 | | Avalanche | 43114 | | Optimism | 10 |

How to install

npm i parakeet-bridge-sdk

How to approve the bridge

  1. Import approve function

    import { approve } from 'parakeet-bridge-sdk/src/';
  2. Use inside your project. All arguments are required

    await approve({
      srcChainId,
      nftCollectionAddress,
      tokenId,
      provider,
      account,
    });

Arguments for approve

| Argument | Type | Required | Description | | -------------------- | :-----: | -------: | ----------------------------------------------------------------- | | srcChainId | Integer | true | chain Id on the source chain -> chain on which the NFT is present | | nftCollectionAddress | String | true | contract address of collection on the source chain | | tokenId | String | true | specific token Id that you want to bridge | | provider | Object | true | Web3Provider | | account | String | true | account address |

How to bridge the NFT

  1. Import bridge function

    import { bridge } from 'parakeet-bridge-sdk/src/';
  2. Use inside your project. All arguments are required

    await bridge({
      srcChainId,
      dstChainId,
      nftCollectionAddress,
      tokenId,
      provider,
      account,
    });

Arguments for bridge

| Argument | Type | Required | Description | | -------------------- | :-----: | -------: | --------------------------------------------------------------------------- | | srcChainId | Integer | true | chain Id on the source chain -> chain where the NFT is currently present | | dstChainId | Integer | true | chain Id of the destination chain -> chain where you want to bridge the NFT | | nftCollectionAddress | String | true | contract address of collection on the source chain | | tokenId | String | true | specific token Id that you want to bridge | | provider | Object | true | Web3Provider | | account | String | true | account address |

How to estimate bridge fee

  1. Import estimateBridgeFees function

    import { estimateBridgeFees } from 'parakeet-bridge-sdk/src/';
  2. Use inside your project. All arguments are required

    const estimatedFees = await estimateBridgeFees({
           account,
           dstChainId,
           srcChainId,
           provider,
           tokenId,
           nftSrcContractAddress
         });

Arguments for estimateBridgeFees

| Argument | Type | Required | Description | | -------------------- | :-----: | -------: | --------------------------------------------------------------------------- | | srcChainId | Integer | true | chain Id on the source chain -> chain where the NFT is currently present | | dstChainId | Integer | true | chain Id of the destination chain -> chain where you want to bridge the NFT | | nftSrcContractAddress | String | true | contract address of collection on the source chain | | tokenId | String | true | specific token Id that you want to bridge | | provider | Object | true | Web3Provider | | account | String | true | account address |

Example

ReactJs Example using web3-react

import { approve, bridge } from 'parakeet-bridge-sdk/src/';
import { useWeb3React } from '@web3-react/core';

const useBridge = () => {
  const { account, library } = useWeb3React();

  //  rinkeby
  const srcChainId = 4;

  // optimism kovan
  const dstChainId = 69;

  // address of the NFT collection on the source chain -> on Rinekby(in this example)
  const nftCollectionAddress = '...';

  // token Id owned by account
  const tokenId = '...';

  //  provider
  let provider;
  // in case of ethers.js
  provider = library.provider;
  // in case of web3.js
  provider = library.currentProvider;
  
  const estimateFee = async () => {
   
    try {
      const estimatedFees = await estimateBridgeFees({
        account,
        dstChainId,
        srcChainId,
        provider,
        tokenId,
        nftSrcContractAddress
      });
      console.log(estimateFee)
    } catch (err) {
      console.error(err);
    }
};

  const bridgeNFT = async () => {
    try {
      const approveTx = await approve(
        srcChainId,
        nftCollectionAddress,
        tokenId,
        provider,
        account
      );

      const bridgeTx = await bridge(
        srcChainId,
        dstChainId,
        nftCollectionAddress,
        tokenId,
        provider,
        account
      );
    } catch (err) {
      console.log(err);
    }
    return { approveTx, bridgeTx };
  };

  return { bridgeNFT };
};