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

@rsksmart/flyover-sdk

v1.4.6

Published

SDK that simplifies interaction between Flyover's Liquidity Provider Server and client applications

Downloads

182

Readme

Flyover SDK

Flyover SDK simplifies the integration between client applications and the components of the Flyover Protocol by providing an easy to use interface.

Installation

npm install @rsksmart/flyover-sdk

Usage

Create Flyover client instance

    const flyover = new Flyover({ network: 'Regtest'})

If you want, you can provide your own Regtest environment URL, if custom environment URL is not secure, then you must allow insecure connections

    const flyover = new Flyover({
        network: 'Regtest',
        customRegtestUrl: 'http://localhost:8080',
        allowInsecureConnections: true
    })

Then you can start doing operations with the client

    const providers = await flyover.getLiquidityProviders()
    flyover.useLiquidityProvider(providers.at(0))
    const quotes = await flyover.getQuotes({ /* QuoteRequest data... */ })
    const acceptedQuote = await flyover.acceptQuote(quotes.at(0))

You can read more about Flyover Protocol here or in its integration manual.

Connect to RSK

If you need to connect to RSK to execute some operation then you need to create an RSKConnection and provide it to Flyover object

    const rsk = await BlockchainConnection.createUsingStandard(window.ethereum)
    const flyover = new Flyover({ rskConnection: rsk, network: 'Regtest' })

or you can set it after creation

    const rsk = await BlockchainConnection.createUsingStandard(window.ethereum)
    await flyover.connectToRsk(rsk)

Also you can provide your own regtest LBC address if you want to connect to a local node for development purposes

    const rsk = await BlockchainConnection.createUsingStandard(window.ethereum)
    const flyover = new Flyover({ 
        rskConnection: rsk, 
        network: 'Regtest', 
        customLbcAddress: '0x1eD614cd3443EFd9c70F04b6d777aed947A4b0c4' 
    })

There are 3 ways to create an RSK connection, you can check them in RSKConnection class documentation

Supported addresses

Currently, not all the types of Bitcoin addresses are supported in Flyover Protocol. The address support is summarized in the following table: | Address type | Testnet prefix | Mainnet prefix | Supported | Testnet example | Mainnet example | |:------------:|:--------------:|:--------------:|:------------------:|:--------------------------------------------------------------:|:--------------------------------------------------------------:| | P2PKH | m or n | 1 | :white_check_mark: | mvL2bVzGUeC9oqVyQWJ4PxQspFzKgjzAqe | 12higDjoCCNXSA95xZMWUdPvXNmkAduhWv | | P2SH | 2 | 3 | :white_check_mark: | 2MzQwSSnBHWHqSAqtTVQ6v47XtaisrJa1Vc | 342ftSRCvFHfCeFFBuz4xwbeqnDw6BGUey | | P2WPKH | tb1 | bc1 | :x: | tb1qvprq2gqzhj5nqmp8tm598yrs2g32vm0ut2lcge | bc1q34aq5drpuwy3wgl9lhup9892qp6svr8ldzyy7c | | P2WSH | tb1 | bc1 | :x: | tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7 | bc1qeklep85ntjz4605drds6aww9u0qr46qzrv5xswd35uhjuj8ahfcqgf6hak | | P2TR | tb1p | bc1p | :x: | tb1p5cyxnuxmeuwuvkwfem96lqzszd02n6xdcjrs20cac6yqjjwudpxqp3mvzv | bc1p5d7rjq7g6rdk2yhzks9smlaqtedr4dekq08ge8ztwac72sfr9rusxg3297 |

Model Syncrhonization

To synchronize the data structures of the project with the ones of the Liquidity Provider Server you need to run npm run api-sync <branch name>. This will update the src/api/bindings folder updating each structure to match LPS. All fields types will coincide with server structures, but its important to clarify that fields whose name contains the word fee, nonce, amount, cost or value will be build as bigint in TS interface instead of number. To synchronize the ABI of the LBC you need to run npm run api-sync <branch name>.

Application Programming Interface

To see the full API of this package please refer to the the docs folder of this project