{"bugs":{"url":"https://github.com/trufflesuite/truffle/issues"},"dist":{"shasum":"72bdd7ed17fabfb801a9b4ad0791604657d4c3e4","tarball":"https://registry.npmjs.org/@truffle/abi-utils/-/abi-utils-0.2.15-typescript-migrations.0.tgz","fileCount":27,"integrity":"sha512-f9Hm3NtpDs8baDAevVhXxJlkOWvpb+wOal/L2o3hQSXgsS7xg0Pk20cbb/EvSC+T8k4gg0ujeWh7KVpZDN/ZZA==","signatures":[{"sig":"MEQCIC/jUW8vcLtKoa6e3dmVijLZVXZvWkFv071xHErZKxzfAiA/cwUpDy3IyGAsJtH/UY1wJvuNG2M/XRTAr+Eoepr77Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":48353,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi2LyOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmofMBAAnkGVqEKRoefm0O8LFpIBbruyvRABjsXYatgEEQbLbLpTrdXn\r\nbfcb1xMUPWj5+Oa8hqTIPDBZOtHwGrWxQ5+cIg4NzSjtirvP5LBrulx+mZfd\r\n5b8ks6D5w43vA0du2CDbJ5x4Pcin1uKxbuYO3ELiG+5+uIXpkw/dwCQcrUkQ\r\neNYD2E91tqpadHABC3esj7WuExxXudfRT3lkMLDE/JWX4s3sTWbZ6mbA6c1G\r\nRXZYUqHarrTtyNMrDk7GiY9zeCjZ/buHfmZkVMQVmLhxFpT114n5jYKmlza8\r\n7bk3KxM7IQbNIiJskIpycSvjLxIdurJt7STOYUulpyS8NCo5rqKciD28EQ6U\r\ni1B6kZzAcuLi3eN+12y0zoPjJhCH3YR4bWcgKXGw8lFb6CGeCjxmPGVDtGLp\r\ntrUvQUZfs1NfRtR8QbTeoQ9iSjJXjEzGtqS7dGzQ26W3Fa/uW/86EUqRsxWi\r\ngS54iXCpz67k8gs8c9lyx5y7RgJBrSswvVeQnwjHja8d2W2K2M9sG3JB8Ffa\r\n198IHNwpFz8WT2ijj/zGc5iIFMyf8h1EZo9WEFtzcS48dVRglWTEWkLxnl5K\r\n/YLe7FT+rZ2FLUq0+T7caG/GW1LfX2hvzizZ0bi7V+kf05NwsH1uuj3N8WPk\r\n4jw6ETjPx7cEvh2ml+wBXF9YwUa5p5AhWww=\r\n=9Hq4\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/lib/index.js","name":"@truffle/abi-utils","types":"dist/lib/index.d.ts","author":{"name":"g. nicholas d'andrea","email":"gnidan@trufflesuite.com"},"readme":"# `@truffle/abi-utils`\n\nContains a few utilities for dealing with ABIs.\n\n## Contents\n\nThis package contains a few different components:\n\n- [Normalize ABIs](#normalize-abis)\n- [TypeScript types](#typescript-types)\n- [Arbitrary random ABIs](#arbitrary-random-abis)\n\n## Normalize ABIs\n\n> ```typescript\n> // handle function entries omitting \"type\" from JSON\n> const isFunctionEntry = entry.type === \"function\" || !(\"type\" in entry);\n>\n> // handle:        v--- new way                           v--- old way     v--- default\n> const isPayable = entry.stateMutability === \"payable\" || entry.payable || false;\n>\n> // handle \"outputs\" possibly being undefined\n> const outputs = entry.outputs || [];\n> ```\n_^ Have you ever had to do this sort of thing?_ :scream:\n\nSolidity's official [JSON ABI specification](https://solidity.readthedocs.io/en/v0.7.3/abi-spec.html)\nis rather permissive, since it remains backwards compatible with older\nversions of the language and because it permits omitting fields with default\nvalues. This can get annoying if you're programmatically processing ABIs.\n\n:information_source: This package provides a `normalize` function to purge\nthese kinds of inconsistencies.\n\n```javascript\nconst { normalize } = require(\"@truffle/abi-utils\");\n```\n\n```typescript\nimport { normalize } from \"@truffle/abi-utils\";\n```\n\nSpecifically, this normalizes by:\n- Ensuring every ABI entry has a `type` field, since it's optional for\n  `type: \"function\"`\n- Populating default value `[]` for function `outputs` field\n- Removing all instances of the legacy `payable` and `constant` fields\n- Replacing those two fields with the newer `stateMutability` field\n\nTo use, provide the ABI as a JavaScript array, as the sole argument to the\nfunction:\n\n```typescript\n// accepts ABIs from Solidity versions back to 0.4.12 or earlier!\nconst abi = normalize([{\"type\": \"constructor\"/*, ...*/}/*, ...*/);\n\n// don't even worry about it\nconst isFunctionEntry = entry.type === \"function\";\nconst isPayable = entry.stateMutability === \"payable\";\n```\n\n\n## TypeScript types\n\nThis package exports the following types for **normalized** ABIs.\n\n- `Abi`, to represent the full ABI array\n- `Entry`, to represent items in ABI arrays\n- `FunctionEntry`, to represent named functions\n- `ConstructorEntry`, to represent constructors\n- `FallbackEntry`, to represent old or new fallback functions\n- `ReceiveEntry`, to represent receive functions\n- `Parameter`, to represent parameters defined in entry inputs or outputs\n- `EventParameter`, to represent event parameters\n\nTo use these, you should first call [`normalize`](#normalize-abis), described\nabove.\n\n```typescript\nimport * as Abi from \"@truffle/abi-utils\";\n\nconst abi: Abi.Abi = [{\"type\": \"constructor\"/*, ...*/}/*, ...*/];\nconst parameter: Abi.Parameter = {\"type\": \"tuple[]\", \"components\": [/*...*/]};\n// etc.\n```\n\n\n## Arbitrary random ABIs\n\n_Do you need to test all the different kinds of ABIs, including testing your\nsupport for the various quirks across different Solidity versions?_ :flushed:\n\nYou can use this package for generating all sorts of random ABIs, random ABI\nevents, random ABI parameter values, etc.\n\nThis package provides [fast-check](https://github.com/dubzzz/fast-check)\narbitraries for property-based testing methodologies. If you're not familiar\nwith fast-check or property-based testing, please see the link above for more\ninformation.\n\n```typescript\nimport * as fc from \"fast-check\";\nimport { Arbitrary } from \"@truffle/abi-utils\";\n\n// generate 10 random ABIs\nconst randomAbis = fc.sample(Arbitrary.Abi(), 10);\n```\n\nSee this package's [internal tests for `normalize`](./lib/normalize.test.ts)\nfor example usage in automated tests.\n","gitHead":"a686945780ca094faaa3c237f4f94ceb659863e1","license":"MIT","scripts":{"test":"jest lib/**","build":"tsc","prepare":"yarn build"},"_npmUser":{"name":"benjamincburns","email":"benjamin.c.burns@gmail.com"},"homepage":"https://github.com/trufflesuite/truffle/tree/master/packages/abi-utils#readme","keywords":["abi","ethereum","solidity"],"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/trufflesuite/truffle.git","type":"git","directory":"packages/abi-utils"},"_npmVersion":"lerna/4.0.0/node@v12.22.12+x64 (darwin)","description":"Utilities for working with ABIs","directories":{},"maintainers":[{"name":"sukanyaparashar","email":"sukanyaparashar111@gmail.com"},{"name":"cliffoo","email":"cliffzhang08@gmail.com"},{"name":"benjamincburns","email":"benjamin.c.burns@gmail.com"},{"name":"kevinbluer","email":"kevin@bluer.com"},{"name":"tenthirtyone","email":"ASherbuck@gmail.com"},{"name":"lsqproduction","email":"ll@trufflesuite.com"},{"name":"kevinweaver","email":"kevinweaver2@gmail.com"},{"name":"leeftk","email":"leandro.faria@consensys.net"},{"name":"gnidan","email":"nick@gnidan.org"},{"name":"haltman","email":"harry.j.altman@gmail.com"},{"name":"eggplantzzz","email":"pobol234@gmail.com"},{"name":"fainashalts","email":"fainashalts@gmail.com"},{"name":"rkalis","email":"roscokalis@gmail.com"},{"name":"cds-amal","email":"cds.sudama@gmail.com"}],"_nodeVersion":"12.22.12","dependencies":{"faker":"5.5.3","fast-check":"2.15.1","change-case":"3.0.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"28.1.3","ts-jest":"28.0.6","ts-node":"10.7.0","typescript":"^4.1.4","@types/jest":"27.4.1","@types/faker":"^5.1.2","jest-extended":"^0.11.5","jest-fast-check":"2.0.0","jest-json-schema":"^2.1.0","@types/jest-json-schema":"^2.1.2","@truffle/contract-schema":"^3.4.8"},"_npmOperationalInternal":{"tmp":"tmp/abi-utils_0.2.15-typescript-migrations.0_1658371214474_0.8124119348618486","host":"s3://npm-registry-packages"},"_id":"@truffle/abi-utils@0.2.15-typescript-migrations.0","version":"0.2.15-typescript-migrations.0"}