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

aptos-wallet-api

v0.3.3

Published

A light weight wallet client built for aptos blockchain

Downloads

78

Readme

Aptos Wallet Client Api

A light weight wallet client built for aptos blockchain

Installation

npm i aptos-wallet-api

Usage

const WalletClient = require("aptos-wallet-api/src/wallet-client");

Initialize WalletClient

const NODE_URL = "https://fullnode.testnet.aptoslabs.com/v1";
const FAUCET_URL = "https://faucet.net.aptoslabs.com";

const walletClient = new WalletClient(NODE_URL, FAUCET_URL);

Cteate New Account

  const { mnemonic, account } = await walletClient.createNewAccount();

Check Balance

  let balance = await walletClient.balance(account.address());

Airdrop

 await walletClient.airdrop(account.address());

Import Account from Mnemonic

  const account = await walletClient.getAccountFromMnemonic(mnemonic);

Send Token

 let transfer = await walletClient.transfer(
    account,
    "0x43417434fd869edee76cca2a4d2301e528a1551b1d719b75c350c3c97d15b8b9::coins::BTC",
    "0x225f4210302db0bba77c212287ea73ef16586d3f48c7384030b4215861bd2283",
    300000
  );

Estimate gas usage

 let gasUsage = await walletClient.estimateGasUsage(
    account,
    "0x43417434fd869edee76cca2a4d2301e528a1551b1d719b75c350c3c97d15b8b9::coins::BTC",
    "0xdbbccfe83ae786cf1d3d99053a5d44f6fb4f8d25a6abf63045f454231fcb01b3",
    1000
  );

Register new coin

let register = await walletClient.registerCoin(
    account,
    "0x43417434fd869edee76cca2a4d2301e528a1551b1d719b75c350c3c97d15b8b9::coins::BTC"
  );

Create a new NFT Collection

let nftCollection = await walletClient.createCollection(
    account,
    "Anto",
    "Anto's NFT",
    "<Your Nft Uri>"
  );

Mint a NFT

let mintNFT = await walletClient.createToken(
    account,
    "Anto",
    "Anto's 001",
    "Anto on Aptos",
    10,
    "https://www.kanalabs.io/static/media/kana-labs-logo.184851f66aef0526f82c829b55e37b34.svg",
    10,
    account.address(),
    0,
    0,
    [],
    [],
    []
  );

Offer NFT

  let offerNFT = await walletClient.offerToken(
    account,
    "0xef1f3c9e962a06f84b5d6e169dc8ecd490f0a54bab62d95fc7113da8e003fc0b",
    "0x82b94c0423cf25f6a58589f992390ec917eec0945198d9031c10cd79cedb6699",
    "Anto",
    "Anto's 001",
    1
  );

Claim NFT

  let claimNFT = await walletClient.claimToken(
    account, // Receiver account
    "0x82b94c0423cf25f6a58589f992390ec917eec0945198d9031c10cd79cedb6699", // Who offered the NFT
    "0x82b94c0423cf25f6a58589f992390ec917eec0945198d9031c10cd79cedb6699", // Creator of the NFT
    "Anto", // Collection Name
    "Anto's 001" // NFT name
  );

Get NFT IDs

  let tokenIds = await walletClient.getTokenIds(account.address());

Get NFT Data

  let token = await walletClient.getToken(tokenId.data);

Get Transaction Details by Hash

 let detail = await walletClient.getTransactionDetailsByHash(
    "0xa76f4e50b43609b9da3089b1cc7df78bc6d85dfd45051777aa40e8495f2d3ffa"
  );

Get Transaction Details by Version

  let detail = await walletClient.getTransactionDetailsByVersion(61483556);

Account Transactions

 let txns = await walletClient.getAllTransactions(address);