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

@okxweb3/coin-stacks

v1.0.2

Published

Stacks SDK is used to interact with the Stacks blockchain, it contains various functions can be used to web3 wallet.

Downloads

74

Readme

@okxweb3/coin-stacks

Stacks SDK is used to interact with the Stacks blockchain, it contains various functions can be used to web3 wallet.

Installation

Npm

To obtain the latest version, simply require the project using npm :

npm install @okxweb3/coin-stacks

Usage

Generate private key

import {StxWallet} from "@okxweb3/coin-stacks";

let wallet = new StxWallet()
// private key
let privateKey = await wallet.getRandomPrivateKey();

// address
let params: NewAddressParams = {
    privateKey: privateKey
};
let address = await wallet.getNewAddress(params);

Private key derivation

import {StxWallet} from "@okxweb3/coin-stacks";

let wallet = new StxWallet()
let param = {
    mnemonic: `gaze supreme human audit aisle entry galaxy shy lock time such auto`,
    hdPath: "m/44'/5757'/0'/0/0"
};
let privateKey = await wallet.getDerivedPrivateKey(param);

Generate address

import {StxWallet} from "@okxweb3/coin-stacks";

let wallet = new StxWallet()
let params: NewAddressParams = {
     privateKey: "33c4ad314d494632a36c27f9ac819e8d2986c0e26ad63052879f631a417c8adf"
};
let address = await wallet.getNewAddress(params);

Verify address

import {StxWallet} from "@okxweb3/coin-stacks";

let wallet = new StxWallet()
let param = {
    address: "SP1BJMEXW9J908SGBCNWQXKCHRGC4H4YYAE0EAVDW"
} 
const ok = await wallet.validAddress(param)

Transfer Stx

import {StxWallet} from "@okxweb3/coin-stacks";

let wallet = new StxWallet()
const secretKey = '//your private key';
const to = 'SP2P58SJY1XH6GX4W3YGEPZ2058DD3JHBPJ8W843Q';
const amount = 3000;
const memo = '20';
const nonce = 56;
const fee = 300;
let params: SignTxParams = {
    privateKey: secretKey,
    data: {
        type: 'transfer',
        data: {
            to: to,
            amount: amount,
            memo: memo,
            nonce: nonce,
            fee: fee,
        }
    },
}
const tx = await wallet.signTransaction(params);

Transfer token

import {StxWallet} from "@okxweb3/coin-stacks";

let wallet = new StxWallet()
const key = "33c4ad314d494632a36c27f9ac819e8d2986c0e26ad63052879f631a417c8adf";
const from = "SP2XYBM8MD5T50WAMQ86E8HKR85BAEKBECNE1HHVY";
const to = "SP3HXJJMJQ06GNAZ8XWDN1QM48JEDC6PP6W3YZPZJ";
const memo = "110317";
const contract = "SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27";
const contract_name = "miamicoin-token";
const function_name = "transfer";
const token_name = "miamicoin";

const amount = 21;
const nonce = 21;
const fee = 200000;
let params: SignTxParams = {
    privateKey: key,
    data: {
        type: 'tokenTransfer',
        data: {
            from: from,
            to: to,
            memo: memo,
            contract: contract,
            contractName: contract_name,
            functionName: function_name,
            tokenName: token_name,
            amount: amount,
            nonce: nonce,
            fee: fee
        }
    }
}
const tx = await wallet.signTransaction(, params);

Sign message

import {StxWallet} from "@okxweb3/coin-stacks";

let wallet = new StxWallet()
const privateKey = "bcf62fdd286f9b30b2c289cce3189dbf3b502dcd955b2dc4f67d18d77f3e73c7"
const param: SignTxParams = {
    privateKey: privateKey,
    data: {
        type: "signMessage",
        message: "Hello World"
    }
}
const sig = await wallet.signMessage(param);

License

Current package is MIT licensed.