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

test-snap-cem

v0.1.0

Published

A Sovereign SDK Metamask Snap

Downloads

2

Readme

Sovereign SDK MetaMask Snap

The Sovereign SDK MetaMask Snap enables transaction signing for users.

This Snap is configured to use the designated coin type 1551, allocated for the SDK-Sovereign SDK. In accordance with Metamask's Snap permissions design, the coin type is hardcoded. If you require a different coin type, you can fork this repository and modify the authorized path in the Snap manifest.

Methods

getAddress

Returns the public key of the wallet as hexadecimal string.

Params
  • path: The BIP-32 derivation path of the wallet (string[]).
  • curve: The curve of the public key (secp256k1 or ed25519).
Example
const response = await request({
  method: 'getPublicKey',
  params: {
    path: ['m', "44'", "1551'"],
    curve: 'ed25519',
  },
});
if (
  !response ===
  '0x00c9aaf347832dc3b1dbb7aab4f41e5e04c64446b819c0761571c27b9f90eacb27'
) {
  throw new Error('Invalid public key');
}

signTransaction

Returns the signature of the message as hexadecimal string.

Will emit a confirmation dialog for the user.

Params
  • path: The BIP-32 derivation path of the wallet (string['m', "44'", "1551'", ...]).
  • curve: The curve of the public key (secp256k1 or ed25519).
  • schema: A borsh schema for the transaction.
  • transaction: A transaction to be serialized using the provided schema. The signature will be performed over the serialized transaction.
Example
import { Schema } from 'borsh';

const callMessageSchema: Schema = {
  enum: [
    {
      struct: {
        Invoke: {
          struct: {
            method: 'string',
            payload: { array: { type: 'u8' } },
          },
        },
      },
    },
    {
      struct: {
        Transfer: {
          struct: {
            from: { array: { type: 'u8', len: 32 } },
            to: { array: { type: 'u8', len: 32 } },
            amount: 'u64',
          },
        },
      },
    },
  ],
};

const response = request({
  method: 'signTransaction',
  params: {
    path: ['m', "44'", "1551'"],
    curve: 'ed25519',
    schema: callMessageSchema,
    transaction: {
      Transfer: {
        from: Array(32).fill(2),
        to: Array(32).fill(3),
        amount: 1582,
      },
    },
  },
});

if (
  !response ===
  '0xfd2e4b23a3e3f498664af355b341e833324276270a13f9647dd1f043248f92fccaa037d4cfc9d23f13a295f7d505ee13afb2b10cea548890678f9002947cbb0a'
) {
  throw new Error('Invalid signature');
}

Testing

To test the snap, run yarn test in this directory. This will use @metamask/snaps-jest to run the tests in src/index.test.ts.

If a change to the snap code was performed, you will need to run yarn build before the tests.