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

flashx-sdk

v1.0.4

Published

An SDK for developers to build applications on top of FlashX platform.

Downloads

8

Readme

Creating a professional README.md is essential for any open-source project or SDK, as it serves as the first impression for users. Below is a detailed and professional template for your flashx-sdk. You can adjust the content as needed.


FlashX SDK

npm npm npm

FlashX SDK is a JavaScript/TypeScript SDK that allows developers to seamlessly integrate blockchain and crypto features into their applications using the FlashX platform. This SDK provides tools for token detection, swapping, trading, minting NFTs, and more, all while ensuring a secure and smooth experience for users.

Table of Contents


Features

  • Token Detection: Easily detect tokens on the blockchain by their address.
  • Swapping Tokens: Enable users to swap tokens via a simple API call.
  • Long/Short Trading: Open and close long/short positions on tokens.
  • Minting NFTs: Utilize the user’s wallet to mint NFTs on various blockchains.
  • Wallet Interactions: Seamlessly interact with user wallets for staking, transfers, and more.
  • Custom UI Integration: Inject custom CSS and JS to enhance the user interface and experience.
  • Secure: User data is securely handled, with a focus on privacy and data protection.

Installation

To install the SDK, simply run the following command:

npm install flashx-sdk

Quick Start

Here is a quick example to get you started with FlashX SDK:

import { FlashXSDK } from 'flashx-sdk';

const sdk = new FlashXSDK({ apiKey: 'YOUR_API_KEY' });

// Example: Detect a token
sdk
  .detectToken('0x1234567890abcdef1234567890abcdef12345678')
  .then((tokenInfo) => console.log('Token Info:', tokenInfo))
  .catch((err) => console.error('Error detecting token:', err));

Usage

Token Detection

You can easily detect tokens by their contract address. The SDK provides a method to query token metadata.

sdk
  .detectToken('0xTokenAddressHere')
  .then((tokenInfo) => {
    console.log('Detected Token:', tokenInfo);
  })
  .catch((error) => {
    console.error('Error detecting token:', error);
  });

Swapping Tokens

Enable users to swap tokens directly within your application:

sdk
  .swap('ETH', 'DAI', 1)
  .then((result) => {
    console.log('Swap successful:', result);
  })
  .catch((error) => {
    console.error('Swap failed:', error);
  });

Trading

Easily open long or short positions on tokens:

sdk
  .longShort('long', 'ETH', 2)
  .then((result) => {
    console.log('Opened long position:', result);
  })
  .catch((error) => {
    console.error('Failed to open position:', error);
  });

Minting NFTs

Mint NFTs using the user’s wallet:

sdk
  .mintNFT('0xNFTContractAddressHere')
  .then((result) => {
    console.log('Mint successful:', result);
  })
  .catch((error) => {
    console.error('Mint failed:', error);
  });

Wallet Interactions

Interact with the user’s wallet to transfer tokens or perform staking:

sdk
  .transferToken('ETH', '0xRecipientAddress', 1)
  .then((result) => {
    console.log('Transfer successful:', result);
  })
  .catch((error) => {
    console.error('Transfer failed:', error);
  });

Inserting Custom CSS and JS

Customize the UI by injecting your own CSS and JavaScript:

// Insert CSS
sdk.insertCSS(`
  body {
    background-color: #f0f0f0;
  }
`);

// Insert JS
sdk.insertJS(`
  console.log('Custom JavaScript code executed!');
`);

API Reference

FlashXSDK(options: SDKOptions)

The main class for interacting with the FlashX SDK.

  • options: An object that must include your API key.

detectToken(tokenAddress: string): Promise<TokenInfo>

Detects token information based on the token address.

swap(fromToken: string, toToken: string, amount: number): Promise<SwapResult>

Swaps one token for another using the specified amount.

longShort(position: 'long' | 'short', token: string, amount: number): Promise<TradeResult>

Opens a long or short position on a token.

transferToken(token: string, toAddress: string, amount: number): Promise<TransferResult>

Transfers the specified amount of a token to another address.

mintNFT(contractAddress: string): Promise<MintResult>

Mints an NFT using the user’s wallet.

insertCSS(css: string): void

Inserts custom CSS into the current user’s interface.

insertJS(js: string): void

Inserts custom JavaScript into the current user’s interface.


Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/YourFeature).
  3. Make your changes.
  4. Push to the branch (git push origin feature/YourFeature).
  5. Open a pull request.

Please ensure your changes adhere to the coding standards and include appropriate tests.


License

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


Contact

For any issues or inquiries, feel free to open an issue or contact us at [email protected].


This README.md template provides a professional, clear structure for documenting your flashx-sdk. Be sure to update any specific details that might differ in your project, such as your actual email or contribution guidelines.