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

@okexchain/amino-js

v0.1.3

Published

go-amino + GopherJS + TypeScript, base on tendermint/amino-js

Downloads

10

Readme

amino-js

Supported in Node.js and browsers.

Support is planned for Service Workers.

Demo

Documentation

https://cosmos.github.io/amino-js/

All exported functions are documented. Some Amino registered TypeScript interfaces are documented. The codec works as is, but we'll work on adding more TS definitions to improve the developer experience.

Install

Please note that the NPM package name is @tendermint/amino-js rather than @cosmos/amino-js.

Yarn
yarn add @tendermint/amino-js
NPM
npm install --save @tendermint/amino-js

Usage

Encoding decoding of basic values:

import { encodeString, decodeString } from '@tendermint/amino-js';
decodeString(encodeString('hello world'));
// [ "hello world", 12 ]

Encoding/decoding of registered types:

import { marshalTx, unmarshalTx } from '@tendermint/amino-js';

const tx = {
   'type':  'auth/StdTx',
   'value': {
       'msg':        [{
           'type':  'cosmos-sdk/MsgSend',
           'value': {
               'from_address': 'cosmos1h806c7khnvmjlywdrkdgk2vrayy2mmvf9rxk2r',
               'to_address':   'cosmos1z7g5w84ynmjyg0kqpahdjqpj7yq34v3suckp0e',
               'amount':       [{
                   'denom':  'uatom',
                   'amount': '11657995'
               }]
           }
       }],
       'fee':        {
           'amount': [{
               'denom':  'uatom',
               'amount': '5000'
           }],
           'gas':    '200000'
       },
       'signatures': [{
           'pub_key':   {
               'type':  'tendermint/PubKeySecp256k1',
               'value': 'AtQaCqFnshaZQp6rIkvAPyzThvCvXSDO+9AzbxVErqJP'
           },
           'signature': '1nUcIH0CLT0/nQ0mBTDrT6kMG20NY/PsH7P2gc4bpYNGLEYjBmdWevXUJouSE/9A/60QG9cYeqyTe5kFDeIPxQ=='
       }],
       'memo':       '1122672754'
   }
};

const encodedTx = marshalTx(tx);
const decodedTx = unmarshalTx(encodedTx);

Register custom types

To register your own types with Amino, you'll need to add Go structs and interfaces, register them with the codec, compile the Go code with GopherJS, and then rebuild the JS lib.

To keep the compiled output small, the recommended way to do this is to add your Go structs, but strip out methods, private properties, and anything else that you don't plan to marshal to Amino.

This is all (hopefully) less complicated than it sounds.

1. Fork

See FORK.md for instructions.

2. Extend

See EXTEND.md for instructions.

Contributing

amino-js is very new! Questions, feedback, use cases, issues, and code are all very, very welcome.

Thank you for helping us help you help us all. 🎁