{"id":26163485,"url":"https://github.com/findeth/abi","last_synced_at":"2025-03-11T14:27:16.137Z","repository":{"id":40716606,"uuid":"269441011","full_name":"FindETH/abi","owner":"FindETH","description":"A zero-dependencies Solidity ABI encoder and decoder","archived":false,"fork":false,"pushed_at":"2023-01-06T07:55:33.000Z","size":1376,"stargazers_count":4,"open_issues_count":22,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-03-23T19:21:37.175Z","etag":null,"topics":["abi","decoder","encoder","ethereum","findeth","hacktoberfest","library","solidity","solidity-abi"],"latest_commit_sha":null,"homepage":"https://findeth.github.io/abi/","language":"TypeScript","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/FindETH.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":"2020-06-04T18:58:11.000Z","updated_at":"2023-11-27T01:04:22.000Z","dependencies_parsed_at":"2023-02-05T16:16:06.330Z","dependency_job_id":null,"html_url":"https://github.com/FindETH/abi","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FindETH%2Fabi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FindETH%2Fabi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FindETH%2Fabi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FindETH%2Fabi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FindETH","download_url":"https://codeload.github.com/FindETH/abi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243050903,"owners_count":20228091,"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","ethereum","findeth","hacktoberfest","library","solidity","solidity-abi"],"created_at":"2025-03-11T14:27:15.274Z","updated_at":"2025-03-11T14:27:16.122Z","avatar_url":"https://github.com/FindETH.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `@findeth/abi`\n\n![Version](https://img.shields.io/npm/v/@findeth/abi) ![License](https://img.shields.io/github/license/FindETH/abi) [![GitHub CI](https://github.com/FindETH/abi/workflows/CI/badge.svg)](https://github.com/FindETH/abi/actions) [![codecov](https://codecov.io/gh/FindETH/abi/branch/master/graph/badge.svg)](https://codecov.io/gh/FindETH/abi)\n\n`@findeth/abi` is a zero-dependencies ABI encoder and decoder library for FindETH. It supports both Node.js and web browsers. **This library is experimental**, and may not work with all contract interfaces. It is used in the FindETH applications, that can be found here:\n\n- [Web](https://github.com/FindETH/web)\n\nCurrently, most types (except fixed-point numbers (`fixed\u003cM\u003ex\u003cN\u003e`), and fixed-length arrays `type\u003cM\u003e`) are supported.\n\n**Note**: This is a work-in-progress version of FindETH, and is **not** production-ready. For the current version of FindETH, please refer to [this repository](https://github.com/Mrtenz/FindETH/tree/master). The public API _may_ change in minor releases below 1.0.0 (though this is unlikely).\n\n---\n\n## Installation\n\nYou can install `@findeth/abi` with Yarn (recommended) or NPM:\n\n```\n$ yarn add @findeth/abi\n```\n\n```\n$ npm install @findeth/abi\n```\n\n**Note**: If you are using TypeScript, `@findeth/abi` requires TypeScript 4.1 or newer. This is used for automatically inferring the types of the input and output, based on the specified `types`.\n\n## Getting Started\n\nYou can use the `encode` and `decode` functions to encode and decode ABI respectively.\n\n### Encode\n\nThe encode function takes an array of ABI types (e.g., `[\"string\", \"uint256\"]`) and an array of values to encode. For example:\n\n```ts\nimport { encode, toHex } from \"@findeth/abi\";\n\nconst buffer = encode([\"string\", \"uint256\"], [\"foo bar\", 12345]);\nconsole.log(toHex(buffer));\n\n// 000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000030390000000000000000000000000000000000000000000000000000000000000007666f6f2062617200000000000000000000000000000000000000000000000000\n```\n\n### Decode\n\nThe decode function takes an array of ABI types, and a buffer (`Uint8Array`) to decode. Note that Node.js `Buffer`s are compatible with `Uint8Array`, but in order to maintain full compatibility with web browsers (without the need for polyfills), this library does not use `Buffer`. Example:\n\n```ts\nimport { decode, fromHex } from \"@findeth/abi\";\n\nconst value = fromHex(\"000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000030390000000000000000000000000000000000000000000000000000000000000007666f6f2062617200000000000000000000000000000000000000000000000000\");\nconsole.log(decode([\"string\", \"uint256\"], value));\n\n// [\"foo bar\", 12345n]\n```\n\n## Development\n\nInstall dependencies with `yarn`:\n\n```\n$ yarn\n```\n\nTo run automated tests, use the `test` script:\n\n```\n$ yarn test\n```\n\n\nTo build the library, use the `build` script:\n\n```\n$ yarn build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffindeth%2Fabi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffindeth%2Fabi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffindeth%2Fabi/lists"}