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

jcc-moac-abi

v0.1.7

Published

Decoder and encoder for the MOAC ABI and decode events from MOAC transactions

Downloads

36

Readme

jcc-moac-abi

Decoder and encoder for the MOAC ABI and decode events from MOAC transactions.

npm Build Status Coverage Status Dependencies npm downloads PRs Welcome

Installtion

npm i jcc-moac-abi

API

APIs

How to use

See abi.spec.js for details.

参见abi.spec.js获得更多细节信息

jcc-moac-abi的作用是将合约调用演化为对函数名,参数的字符串拼接,类似call by name的方式对合约进行调用。这种方式极大的简化了对合约调用的封装工作。

const Chain3 = require("chain3");
const MoacABI = require("jcc-moac-abi").MoacABI;
const erc20ABI = require("./test/abi/erc20ABI");

// for encoding

// create contract instance
const chain3 = new Chain3(new Chain3.providers.HttpProvider("https://moac1ma17f1.jccdex.cn"));
const contract = chain3.mc.contract(erc20ABI).at("0x1b9bae18532eeb8cd4316a20678a0c43f28f0ae2");

const moacABI = new MoacABI(contract);
// encode
const data = moacABI.encode("transfer", "0x533243557dfdc87ae5bda885e22db00f87499971", "30000000000000000")


// for decoding data and transaction logs

// add abi to abiDecoder firstly
MoacABI.addABI(erc20ABI);

// decode
const decode = MoacABI.decode(data);

// decode transaction logs
const logs = [{
    TxData: "0x00000000000000000000000000000000000000000000017aedbc9d648c780000",
    address: "0x4c6007cea426e543551f2cb6392e6d6768f74706",
    blockHash: "0x181c92ab726131010021473d6e444d2f682e013eb12b2d4faa0946a8847c56f1",
    blockNumber: 3175749,
    logIndex: 0,
    removed: false,
    topics: ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x000000000000000000000000687f6ab056708fcfd34b3226c0b70ddf95b2eab2", "0x00000000000000000000000066c9b619215db959ec137ede6b96f3fa6fd35a8a"],
    transactionHash: "0x9a7da10a30ad4c8e1bb4461107497130a19f53a844069dd3e019557ee1a423b8",
    transactionIndex: 1
}];
const decodeLogs = MoacABI.decodeLogs(logs);


// remove ABIs and methodIDs from abiDecoder
MoacABI.removeABI(erc20ABI);