javascript/typescript version amino

Usage no npm install needed!

<script type="module">
  import chainapsisTsAmino from 'https://cdn.skypack.dev/@chainapsis/ts-amino';



This software implements typescript(javascript) bindings for the Amino encoding protocol.

Amino is an object encoding specification. It is a subset of Proto3 with an extension for interface support. See the Proto3 spec for more information on Proto3, which Amino is largely compatible with (but not with Proto2).

The goal of the Amino encoding protocol is to bring parity into logic objects and persistence objects.

But now this is very early stage, so the immediate goal is to be fully compatible with go-amino to use for Cosmos-sdk.


  • Support basic encoding binary/json
  • Support basic decoding binary/json
  • Support (u)int64 with BigInteger.js as BigInt polyfill
  • Encode/decode Time type
  • Support decorator for ES7 (You need to use babel or typescript)


More details and documents will be available soon

import  {  Amino,  Type  }  from  "ts-amino";
const { Field,  Concrete,  DefineStruct } =  Amino;
import  bigInteger  from  "big-integer";

class  MsgSend {
  @Field.Defined(0, {
    jsonName:  "from_address"
  public fromAddress:  AccAddress;

  @Field.Defined(1, {
    jsonName:  "to_address"
  public toAddress:  AccAddress;

    { type:  Type.Defined },
      jsonName:  "amount"
  public amount:  Coin[];

  constructor(fromAddress:  AccAddress, toAddress:  AccAddress, amount:  Coin[]) {
    this.fromAddress  = fromAddress;
    this.toAddress  = toAddress;
    this.amount  = amount;

  public  getSigners():  AccAddress[] {
    return [this.fromAddress];

class  AccAddress {
  @Field.Array(0, { type:  Type.Uint8 })
  private address:  Uint8Array;

  constructor(address:  Uint8Array) {
    this.address  = address

  public  marshalJSON():  Uint8Array {
    return  Buffer.from(`"${this.toBech32()}"`, "utf8");

class  Coin {
  public denom:  string;

  public amount:  Int;

  constructor(denom:  string, amount:  Int) {
    this.denom  = denom;
    this.amount  = amount;

class  Int {
  private int:  bigInteger.BigInteger;
    int:  bigInteger.BigInteger,
  ) {
    this.int  =  int;

  @Method.AminoMarshaler({ type:  Type.String })
  public  marshalAmino():  string {
    return  this.int.toString(10);