Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@mesg/amino-js
Advanced tools
amino-js
Supported in Node.js and browsers.
Support is planned for Service Workers.
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.
Please note that the NPM package name is @tendermint/amino-js
rather than @cosmos/amino-js
.
yarn add @tendermint/amino-js
npm install --save @tendermint/amino-js
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': 'cosmos-sdk/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);
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.
See FORK.md
for instructions.
See EXTEND.md
for instructions.
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. 🎁
If you wish to build this lib without having to install Go 1.12, GopherJS and Yarn on your local computer, you can build it inside a docker container. You only need docker to be installed on your computer.
export GITHUB_ORG="<github user or org name of your fork>"
git clone https://github.com/$GITHUB_ORG/amino-js
cd ./amino-js
docker build -t cosmos/amino-js:local -f Dockerfile .
docker run --rm -v $(PWD):/project cosmos/amino-js:local yarn setup && yarn test
FAQs
go-amino + GopherJS + TypeScript
The npm package @mesg/amino-js receives a total of 3 weekly downloads. As such, @mesg/amino-js popularity was classified as not popular.
We found that @mesg/amino-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.