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

v0.1.1

Published

The 'Hello, world!' of MetaMask Snaps, now written in TypeScript.

Downloads

11

Readme

aptos-connect

NPM Version

aptos-connect is a MetaMask Snap that allows users to interact with the Aptos blockchain directly from MetaMask. This Snap provides several key functionalities related to Aptos, including account management, signing messages, and sending transactions.

Features

  • Account Management: Generate new Aptos accounts, view public and private keys, and get account addresses.
  • Transaction Signing: Sign and send transactions on the Aptos blockchain, including transferring funds.
  • Message Signing: Sign arbitrary messages with your Aptos private key directly from MetaMask.
  • Data Persistence: Save and retrieve encrypted data within MetaMask sessions.
  • RPC Interaction: Perform various Aptos blockchain operations using RPC methods such as checking account balances, transaction history, and more.

Installation

To integrate Aptos Connect into your project, install the npm package:

npm install aptos-connect

Usage

To interact with the Snap, use wallet_invokeSnap from MetaMask:

Example: Retrieve Account Address

const accountAddress = await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId: 'npm:aptos-connect',
    request: { method: 'getAccountAddress' },
  },
});
console.log('Account Address:', accountAddress);

Example: Sign and Send a Transaction

const txnHash = await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId: 'npm:aptos-connect',
    request: {
      method: 'sign&sendTxn',
      params: {
        derivationPath: "m/44'/637'/0'/0'/0'",
        txnDetails: { receiver: '0x1...', amount: 1000 },
      },
    },
  },
});
console.log('Transaction Hash:', txnHash);

Available RPC Methods

  • getAccountAddress: Retrieve the Aptos account address for a given derivation path.
  • getPublicKey: Get the public key for the specified derivation path.
  • getPrivateKey: Obtain the private key (for advanced use cases).
  • createNewAccount: Generate a new Aptos account.
  • signMessage: Sign a message using the account's private key.
  • sign&sendTxn: Sign and send a transaction on the Aptos blockchain.
  • setData: Save data in MetaMask's encrypted storage.
  • getData: Retrieve data stored within the session.
  • clearData: Clear all stored data from the session.

Check the full list of RPC methods in the source code.

Local Development

Clone the repository and install dependencies to start developing locally:

git clone https://github.com/vedant-asati/aptos-snap.git
cd packages/snap
yarn install
yarn start

To use the locally started Snap, point MetaMask to local:http://localhost:8080 as the Snap ID.

License

This project is licensed under both the Apache 2.0 License and MIT License.