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

@safecoin/amman

v0.12.0

Published

A modern mandatory toolbelt to help test solana SDK libraries and apps on a locally running validator.

Downloads

4

Readme

Amman

A m odern man datory toolbelt to help test solana SDK libraries and apps on a locally running validator.

Table of Contents generated with DocToc

API

Aside from providing a CLI for various tasks, amman also provides commonly used actions, transactions, asserts and more via an API. Please find the API docs here.

CLI

amman [command]

Commands:
  amman start    Launches a solana-test-validator and the amman relay and/or
                 mock storage if so configured
  amman stop     Stops the relay and storage and kills the running solana
                 test validator
  amman logs     Launches 'solana logs' and pipes them through a prettifier
  amman airdrop  Airdrops provided Sol to the payer
  amman label    Adds labels for accounts or transactions to amman
  amman account  Retrieves account information for a PublicKey or a label or
                 shows all labeled accounts
  amman run      Executes the provided command after expanding all address
                 labels

Options:
  --help     Show help                                                 [boolean]
  --version  Show version number                                       [boolean]

Commands: start

amman start <config.js>

If no config.js is provided amman looks for an .ammanrc.js file in the current directory. If that isn't found either it uses a default config.

The config should be a JavaScript module exporting 'validator' with any of the below properties:

  • killRunningValidators: if true will kill any solana-test-validators currently running on the system.
  • programs: bpf programs which should be loaded into the test validator
  • accountsCluster: default cluster to clone remote accounts from
  • accounts: array of remote accounts to load into the test validator
  • jsonRpcUrl: the URL at which the test validator should listen for JSON RPC requests
  • websocketUrl: for the RPC websocket
  • ledgerDir: where the solana test validator writes the ledger
  • resetLedger: if true the ledger is reset to genesis at startup
  • verifyFees: if true the validator is not considered fully started up until it charges transaction fees

Example Configs

Validator/Relay/Storage Config with Defaults

Below is an example config with all values set to the defaults except for an added program and a relay and storage config.

A amman-explorer relay is launched automatically with the validator unless it is running in a CI environment and if a relay is already running on the known relay port, it is killed first.

A mock storage is launched only if a storage config is provided. In case a storage server is already running on the known storage port, it is killed first.

import { LOCALHOST, tmpLedgerDir } from '@safecoin/amman'

module.exports = {
  validator: {
    killRunningValidators: true,
    programs: [
      { 
        label: 'Token Metadata Program',
        programId: programIds.metadata,
        deployPath: localDeployPath('mpl_token_metadata')
      },
    ],
    jsonRpcUrl: LOCALHOST,
    websocketUrl: '',
    commitment: 'confirmed',
    ledgerDir: tmpLedgerDir(),
    resetLedger: true,
    verifyFees: false,
    detached: process.env.CI != null,
  },
  relay: {
    enabled: process.env.CI == null,
    killlRunningRelay: true,
  },
  storage: {
    enabled: process.env.CI == null,
    storageId: 'mock-storage',
    clearOnStart: true,
  },
}

Config with Remote Accounts

Below is an example of a config where the accounts are being pulled from a specific RPC endpoint.

module.exports = {
  validator: {
    // By default Amman will pull the account data from the accountsCluster (can be overridden on a per account basis)
    accountsCluster: 'https://api.metaplex.solana.com',
    accounts: [
        {
          label: 'Token Metadata Program',
          accountId:'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s',
          // marking executable as true will cause Amman to pull the executable data account as well automatically
          executable: true,
        },
        {
          label: 'Random other account',
          programId:'4VLgNs1jXgdciSidxcaLKfrR9WjATkj6vmTm5yCwNwui',
          // By default executable is false and is not required to be in the config
          // executable: false,
          
          // Providing a cluster here will override the accountsCluster field
          cluster: 'https://metaplex.devnet.rpcpool.com'
        }
      ]
  }
}

LICENSE

Apache-2.0