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

@cryptoscan/swap-sdk

v1.6.3

Published

The fastest way to swap any tokens on any networks & dexes

Downloads

134

Readme

@cryptoscan/swap-sdk

The fastest way to swap any tokens on any networks & dexes

[GitHub] [Our website] [Docs] [Discord]

Supported networks

  • [x] Solana

Networks are planned to support: https://api.cryptoscan.pro/v1/networks

Get started

To install package:

npm install @cryptoscan/swap-sdk

Easy-To-Use Example

import { getWallet } from '@cryptoscan/solana-wallet-sdk';
import { swap } from '@cryptoscan/swap-sdk';

const secretKeyStr = 'YOUR_SECRET_KEY';
const wallet = getWallet(secretKeyStr);
const from = 'sol';
const to = 'HJAoYbnsf16Z8ftk3SsuShKLQQgzmxAPu41RTpjjpump';
const amount = 0.05;

swap({
  wallet,
  from,
  to,
  amount,
})
.then((tx) => console.log(tx))

Primary Usage

import { Keypair, Connection } from "@solana/web3.js";
import sendTransaction from '@cryptoscan/solana-send-transaction';
import { createTransaction } from '@cryptoscan/swap-sdk';

const rpcUrl = 'https://api.mainnet-beta.solana.com';
const wsRpcUrl = 'wss://api.mainnet-beta.solana.com';
const secretKeyStr = 'YOUR_SECRET_KEY';
const wallet = Keypair.fromSecretKey(bs58.decode(secretKeyStr));
const from = 'sol';
const to = 'HJAoYbnsf16Z8ftk3SsuShKLQQgzmxAPu41RTpjjpump';
const amount = 0.05;

async function swap() {
  const connection = new Connection(rpcUrl, {
    wsEndpoint: wsRpcUrl,
  })
  const transaction = await createTransaction({
    walletAddress: wallet.publicKey.toString(),
    from,
    to,
    amount,
  });

  if (transaction instanceof Error) {
    return transaction;
  }

  transaction.sign([wallet]);

  return sendTransaction(transaction, { connection }) // The fast Cryptoscan method
  // return connection.sendTransaction(transaction); // Solana SDK Method
}

swap().then((tx) => console.log(tx));

Swap Docs

  • wallet - Keypair of the wallet
  • from - Coin address to pay (Defaults: sol)
  • service - Platform to buy (Optional: auto-detecting)
  • to - Coin address to buy
  • amount - Amount of Coin from to buy
  • fee - Transaction fee (Optional)
  • priorityFee - Priority fee (Default: 0.0001)
  • slippage - Slippage (Default: 1)

FAQ

Yes. You don't share private key through api request. You sign transaction with private key locally only.

We charge a 0.39% fee on each successful transaction instruction. If you want to decrease fee - please contact us in discord or telegram We can increase fee down to 0.1% if you will contribute us.

You can create pull requests or make a project based on our packages. You have chance to get some supply for a work and get fee reduced for the api.

Contribute

To install dependencies:

npm install

To build:

npm build