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

@joshyzou/sendcrypto

v1.0.3

Published

A lightweight, easy to use library for sending all types of crypto

Downloads

6

Readme

A minimal JavaScript library for sending crypto assets.

Supported assets

  • BTC

  • LTC

  • ETH

  • XRP

Usage


npm install --save @joshyzou/sendcrypto

Replace "btc" with any supported asset:


const  Accounts  =  require("@joshyzou/sendcrypto");

  

/* Load account from private key, select crypto API provider, coin. ApiKey is optional*/

const  account  =  new  Accounts(address, privateKey, "btc", apiProvider, apiKey);

  
  

/* Print balance */

console.log(await account.getBalance());

// > 0.01

  

/* Send 0.01 BTC */

const  txHash  =  await account.send("Reciever address", 0.01, "Eth Gas (Only applies to ethereum)")

// > 1

// > 2 ...

Docs

When creating a new account, there are 4 required parameters and 1 optional parameter.


new  Accounts(crypto_address, crypto_secret, coin, api_provider, api_key-optional);

crypto_address

This is your crypto address. For example, a bitcoin address looks like 1KHwtS5mn7NMUm7Ls7Y1XwxLqMriLdaGbX

crypto_secret

This is your crypto secret. You need this to prove to the network that you are the owner of the coin, which then enables you to send crypto to other wallets.

coin

Supported assets - use the lowercase ticker in the "coin" parameter

| Coin | Ticker | |--|--| | BITCOIN | btc | |ETHEREUM|eth| |LITECOIN|ltc| |RIPPLE|xrp|

api_provider

This is the api provider you would like to use to interact with the rest of the blockchain.

Supported BTC apis

|API|Key required? | send_crypto parameter name| |--|--|--| | Sochain | No |sochain| |Blockcypher|Yes|blockcypher|

Supported ETH apis

|API|Key required? | send_crypto parameter name| |--|--|--| | Etherscan | Yes |etherscan| |Blockcypher|Yes|blockcypher| |Web3|Yes*|web3|

*note: If you would like to use your own web3 server, (like infura) the "key" parameter is your connection string/url

Supported LTC apis

|API|Key required? | send_crypto parameter name| |--|--|--| | Sochain | No |sochain|

Supported XRP apis

|API|Key required? | send_crypto parameter name| |--|--|--| | Ripple.API | Yes* |ripple.api|

*note: If you would like to use your own ripple API serverthe "key" parameter is your connection string/url - The public no-key-required api service is wss://s1.ripple.com

Sending transactions

When sending transactions, there are normally 2 parameters, with an optional third for ETH


account.send(reciever, amountToSend, *gas*)

reciever

The reciever address you would like to send the crypto to.

amountToSend

This is the amount of crypto you would like to send

If you would like to send all of the crypto in your wallet (Sweeping) pass "all" as a string instead of a number in this parameter

gas

The max gas you would like to be consumed in ETH transactions. The default is 2100 gwei, but you can increase/decrease this number as you please.

Examples

BTC, LTC


const  Accounts  =  require("@joshyzou/sendcrypto");

  

// Send BTC

  

const  account  =  new  Accounts("BTC Address", "BTC Secret", "btc", "sochain");

await account.send("reciever address", 0.01);

  

const  Accounts  =  require("@joshyzou/sendcrypto");

  

// Send LTC

  

const  account  =  new  Accounts("LTC Address", "LTC Secret", "ltc", "sochain");

await account.send("reciever address", 0.01);

You can replace "BTC" with "ZEC" or "BCH" in the following examples:


const  Accounts  =  require("@joshyzou/sendcrypto");

  

// Send LTC

  

const  account  =  new  Accounts("BTC Address", "BTC Secret", "btc", "sochain");

await account.send("reciever address", "all");

ETH


const  Accounts  =  require("@joshyzou/sendcrypto");

  

// Send ETH

  

const  account  =  new  Accounts("ETH Address", "ETH Secret", "eth", "web3", "web3 connection string");

await account.send("reciever address", 0.01, 2100);