@medibloc/amino-js
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

amino-js

Supported in Node.js and browsers.

Support is planned for Service Workers.

Foked from cosmos/amino-js

Install

NPM
npm install --save @medibloc/amino-js

Usage

Encoding decoding of basic values:

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

Encoding/decoding of registered types:

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

const tx = {
  "type": "auth/StdTx",
  "value": {
    "msg": [
      {
        "type": "aol/MsgCreateTopic",
        "value": {
          "TopicName": "certification",
          "Description": "",
          "OwnerAddress": "panacea1d8xsncdn4m9e0gxx4u9jq3u84rd88tdkthz6pu"
        }
      }
    ],
    "fee": {
      "amount": [
        {
          "denom": "umed",
          "amount": "10000000"
        }
      ],
      "gas": "200000"
    },
    "signatures": [
      {
        "pub_key": {
          "type": "tendermint/PubKeySecp256k1",
          "value": "AyGbSDc7t55/bjIjpJODurciLqA8j2Bize5A065rZXf6"
        },
        "signature": "rUDhsKm5yAX4C9PsluBsWB10xZVpk7W2L2Pot+8ODIsoVLmdYnnng+Dxy8eji7angvtDPC7/8cqvQ9S5wUR+8Q=="
      }
    ],
    "memo": ""
  }
};

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

Package Sidebar

Install

npm i @medibloc/amino-js

Homepage

medibloc.org

Weekly Downloads

4

Version

1.2.0

License

Apache-2.0

Unpacked Size

27.1 MB

Total Files

85

Last publish

Collaborators

  • medibloc