New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

augur-abi

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

augur-abi

Contract ABI serialization

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-61.9%
Maintainers
1
Weekly downloads
 
Created
Source

augur-abi

Build Status Coverage Status npm version

augur-abi is a standalone JavaScript module that provides Ethereum contract ABI data serialization methods. ABI encoding is needed to invoke functions on Ethereum smart contracts.

This module presently supports only Serpent contracts; it's my intention to add Solidity data type support when I have time!

Installation

$ npm install augur-abi

Usage

To use augur-abi in Node.js, just require it:

var augur_abi = require("augur-abi");

A minified, browserified file dist/augur-abi.min.js is included for use in the browser. Including this file simply attaches the augur_abi object to window:

<script src="dist/augur-abi.min.js" type="text/javascript"></script>

The encode method encodes the full ABI data (prefix + parameters) needed for a contract function call. For example, to encode a method named double that takes a single integer parameter with a value of 3:

var encoded = augur_abi.encode({
    method: "double",
    signature: "i",
    params: [3]
});
// encoded:
'0x6ffa1caa0000000000000000000000000000000000000000000000000000000000000003'

encoded is the concatenation of the method's prefix 0x6ffa1caa, which is derived from the name of the method "double" and its signature "i", and the encoded parameter value, [3].

"Signature" refers to the short-form Serpent parameter signature, which allows i (int256), a (variable-sized int256 array) and s (variable-length string/bytes). For example, a method which takes parameter types int256, string, int256, int256, int256, array would have signature isiiia.

Tests

Unit tests are in the test directory, and can be run with mocha:

$ npm test

FAQs

Package last updated on 14 Jan 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc