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-kaspa

v1.0.11

Published

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

Downloads

296

Readme

@okxweb3/coin-kaspa

Kaspa SDK is used to interact with the Kaspa 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-kaspa

Usage

Derive privateKey

import { KaspaWallet } from "@okxweb3/coin-kaspa";

let wallet = new KaspaWallet();
let p: DerivePriKeyParams = {
    mnemonic: "reopen vivid parent want raw main filter rotate earth true fossil dream",
    hdPath: "m/44'/111111'/0'/0/0",
};
let privateKey = await wallet.getDerivedPrivateKey(p);

New address

import { KaspaWallet } from "@okxweb3/coin-kaspa";

let wallet = new KaspaWallet();
let p: NewAddressParams = {
    privateKey: "d636a23d4f49fe4e0d59fcf7a6c2ab3846ff2d3a54007b3817a11dff770d06ff"
};
let address = await wallet.getNewAddress(p);

Verify address

import { KaspaWallet } from "@okxweb3/coin-kaspa";

let wallet = new KaspaWallet();
let p: ValidAddressParams = {
    address: "kaspa:qrcnkrtrjptghtrntvyqkqafj06f9tamn0pnqvelmt2vmz68yp4gqj5lnal2h"
};
let valid = await wallet.validAddress(p);

Transfer

import { KaspaWallet } from "@okxweb3/coin-kaspa";

let wallet = new KaspaWallet();
let p: SignTxParams = {
    data: {
        inputs: [
            {
                txId: "ec62c785badb0ee693435841d35bd05da9c8a40aa2d568dddb0dd47410e7e78a",
                vOut: 1,
                address: "kaspa:qqpet37fwqlql7q4jczr7zj7qp5ylps2r2c0ynz6jjf368sdjnztufeghvc9x",
                amount: 597700,
            },
        ],
        outputs: [
            {
                address: "kaspa:qqpet37fwqlql7q4jczr7zj7qp5ylps2r2c0ynz6jjf368sdjnztufeghvc9x",
                amount: 587700,
            },
        ],
        address: "kaspa:qqpet37fwqlql7q4jczr7zj7qp5ylps2r2c0ynz6jjf368sdjnztufeghvc9x",
        fee: 10000,
    },
    privateKey: "d636a23d4f49fe4e0d59fcf7a6c2ab3846ff2d3a54007b3817a11dff770d06ff",
};
let tx = await wallet.signTransaction(p);

Calculate txId

import { KaspaWallet } from "@okxweb3/coin-kaspa";

let wallet = new KaspaWallet();
let p: CalcTxHashParams = {
    data: {"transaction":{"version":0,"inputs":[{"previousOutpoint":{"transactionId":"ec62c785badb0ee693435841d35bd05da9c8a40aa2d568dddb0dd47410e7e78a","index":1},"signatureScript":"411687d956de8e3cc53b9dbf20ede3922b422595abbad31ecf38ff90c0cf8ef7c3b5ae71628e041a3a0f1b9ad6e14bb6d49dd7c35f06c46316b67c10d477c29ac001","sequence":0,"sigOpCount":1}],"outputs":[{"scriptPublicKey":{"version":0,"scriptPublicKey":"200395c7c9703e0ff81596043f0a5e00684f860a1ab0f24c5a94931d1e0d94c4beac"},"amount":587700}],"lockTime":0,"subnetworkId":"0000000000000000000000000000000000000000"},"allowOrphan":false},
};
let txId = await wallet.calcTxHash(p);

Sign message

import { KaspaWallet } from "@okxweb3/coin-kaspa";

let wallet = new KaspaWallet();
let p: SignTxParams = {
    data: {
        message: "Hello Kaspa!",
    },
    privateKey: "d636a23d4f49fe4e0d59fcf7a6c2ab3846ff2d3a54007b3817a11dff770d06ff",
};
let sig = await wallet.signMessage(p);

License

Most packages or folder are MIT licensed, see package or folder for the respective license.