{"id":22994267,"url":"https://github.com/jccdex/jcc-moac-abi","last_synced_at":"2025-04-02T12:41:22.088Z","repository":{"id":37851428,"uuid":"203993301","full_name":"JCCDex/jcc-moac-abi","owner":"JCCDex","description":"Decoder and encoder for the MOAC ABI and decode events from MOAC transactions","archived":false,"fork":false,"pushed_at":"2023-01-04T08:17:29.000Z","size":2738,"stargazers_count":1,"open_issues_count":26,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-21T10:02:15.915Z","etag":null,"topics":["abi","decoder","encoder","moac","transaction-events"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JCCDex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-23T12:22:12.000Z","updated_at":"2023-11-27T01:04:03.000Z","dependencies_parsed_at":"2023-02-02T04:46:49.587Z","dependency_job_id":null,"html_url":"https://github.com/JCCDex/jcc-moac-abi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCCDex%2Fjcc-moac-abi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCCDex%2Fjcc-moac-abi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCCDex%2Fjcc-moac-abi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCCDex%2Fjcc-moac-abi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JCCDex","download_url":"https://codeload.github.com/JCCDex/jcc-moac-abi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246819691,"owners_count":20839089,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abi","decoder","encoder","moac","transaction-events"],"created_at":"2024-12-15T05:17:39.760Z","updated_at":"2025-04-02T12:41:22.061Z","avatar_url":"https://github.com/JCCDex.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jcc-moac-abi\n\nDecoder and encoder for the MOAC ABI and decode events from MOAC transactions.\n\n![npm](https://img.shields.io/npm/v/jcc-moac-abi.svg)\n[![Build Status](https://travis-ci.com/JCCDex/jcc-moac-abi.svg?branch=master)](https://travis-ci.com/JCCDex/jcc-moac-abi)\n[![Coverage Status](https://coveralls.io/repos/github/JCCDex/jcc-moac-abi/badge.svg?branch=master)](https://coveralls.io/github/JCCDex/jcc-moac-abi?branch=master)\n[![Dependencies](https://img.shields.io/david/JCCDex/jcc-moac-abi.svg?style=flat-square)](https://david-dm.org/JCCDex/jcc-moac-abi)\n[![npm downloads](https://img.shields.io/npm/dm/jcc-moac-abi.svg)](http://npm-stat.com/charts.html?package=jcc-moac-abi)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n\n## Installtion\n\n```shell\nnpm i jcc-moac-abi\n```\n\n## API\n\n[APIs](https://github.com/JCCDex/jcc-moac-abi/blob/master/docs/API.md)\n\n## How to use\n\nSee [abi.spec.js](https://github.com/JCCDex/jcc-moac-abi/blob/master/test/abi.spec.js) for details.\n\n参见[abi.spec.js](https://github.com/JCCDex/jcc-moac-abi/blob/master/test/abi.spec.js)获得更多细节信息\n\njcc-moac-abi的作用是将合约调用演化为对函数名，参数的字符串拼接，类似call by name的方式对合约进行调用。这种方式极大的简化了对合约调用的封装工作。\n\n```javascript\nconst Chain3 = require(\"chain3\");\nconst MoacABI = require(\"jcc-moac-abi\").MoacABI;\nconst erc20ABI = require(\"./test/abi/erc20ABI\");\n\n// for encoding\n\n// create contract instance\nconst chain3 = new Chain3(new Chain3.providers.HttpProvider(\"https://moac1ma17f1.jccdex.cn\"));\nconst contract = chain3.mc.contract(erc20ABI).at(\"0x1b9bae18532eeb8cd4316a20678a0c43f28f0ae2\");\n\nconst moacABI = new MoacABI(contract);\n// encode\nconst data = moacABI.encode(\"transfer\", \"0x533243557dfdc87ae5bda885e22db00f87499971\", \"30000000000000000\")\n\n\n// for decoding data and transaction logs\n\n// add abi to abiDecoder firstly\nMoacABI.addABI(erc20ABI);\n\n// decode\nconst decode = MoacABI.decode(data);\n\n// decode transaction logs\nconst logs = [{\n    TxData: \"0x00000000000000000000000000000000000000000000017aedbc9d648c780000\",\n    address: \"0x4c6007cea426e543551f2cb6392e6d6768f74706\",\n    blockHash: \"0x181c92ab726131010021473d6e444d2f682e013eb12b2d4faa0946a8847c56f1\",\n    blockNumber: 3175749,\n    logIndex: 0,\n    removed: false,\n    topics: [\"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\", \"0x000000000000000000000000687f6ab056708fcfd34b3226c0b70ddf95b2eab2\", \"0x00000000000000000000000066c9b619215db959ec137ede6b96f3fa6fd35a8a\"],\n    transactionHash: \"0x9a7da10a30ad4c8e1bb4461107497130a19f53a844069dd3e019557ee1a423b8\",\n    transactionIndex: 1\n}];\nconst decodeLogs = MoacABI.decodeLogs(logs);\n\n\n// remove ABIs and methodIDs from abiDecoder\nMoacABI.removeABI(erc20ABI);\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjccdex%2Fjcc-moac-abi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjccdex%2Fjcc-moac-abi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjccdex%2Fjcc-moac-abi/lists"}