{"_id":"@cardano-foundation/cf-flat-decoder-ts","_rev":"6-0e3678164d3d058831dd55c35ef5fde2","name":"@cardano-foundation/cf-flat-decoder-ts","dist-tags":{"latest":"0.1.1"},"versions":{"0.0.1":{"name":"@cardano-foundation/cf-flat-decoder-ts","version":"0.0.1","keywords":["flat","binary","decoder","typescript","javascript","node","browser"],"author":{"name":"Cardano Foundation"},"license":"MIT","_id":"@cardano-foundation/cf-flat-decoder-ts@0.0.1","maintainers":[{"name":"fabianbormann","email":"bormann.fabian@gmail.com"},{"name":"jan.mazak","email":"jan.mazak@vacuumlabs.com"},{"name":"steve.wagendorp","email":"steve.wagendorp@cardanofoundation.org"},{"name":"ppershing","email":"ppershing@gmail.com"},{"name":"refi93","email":"rafael.korbas@gmail.com"},{"name":"gabrielkerekes","email":"gabriel.kerekes@vacuumlabs.com"}],"homepage":"https://github.com/cardano-foundation/cf-flat-decoder-ts","dist":{"shasum":"561a68e5ae31fe8249bb38ba799bfd45a8c97698","tarball":"https://registry.npmjs.org/@cardano-foundation/cf-flat-decoder-ts/-/cf-flat-decoder-ts-0.0.1.tgz","fileCount":34,"integrity":"sha512-nQvR1NsE7OifnjAGmoUiZDj2qTZXZLJTDYM3Vfl97NB6xXpSsFBl6Et7gk2crum16H9zcyKefVqizlzo3G4ctA==","signatures":[{"sig":"MEYCIQCrdiLLaP0m9beQ59/UHoxiDgCIYmdC+g5myN4Z7ggZPgIhAOPcdO47tp0Z+Nstqjh3abWWnmfIXfx5ud66sQ2csfEx","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":300466},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.js","gitHead":"27a1e3929b810c894631bd4f995339b0b6fecbde","scripts":{"test":"jest","build":"webpack && tsc --emitDeclarationOnly","test:ci":"jest --ci --coverage"},"_npmUser":{"name":"fabianbormann","email":"bormann.fabian@gmail.com"},"_npmVersion":"8.18.0","description":"This package aims to offer a simple and fast method for decoding flat binary-encoded data using TypeScript and plain JavaScript, suitable for both node.js and browser","directories":{},"_nodeVersion":"16.17.0","dependencies":{"jest":"^29.7.0","cbor-x":"^1.5.7","ts-jest":"^29.1.1","@types/jest":"^29.5.11"},"_hasShrinkwrap":false,"devDependencies":{"webpack":"^5.89.0","typescript":"^5.3.3","@babel/core":"^7.23.7","webpack-cli":"^5.1.4","babel-loader":"^9.1.3","@babel/preset-env":"^7.23.7","clean-webpack-plugin":"^4.0.0","@babel/preset-typescript":"^7.23.3"},"_npmOperationalInternal":{"tmp":"tmp/cf-flat-decoder-ts_0.0.1_1705001782289_0.8822472415016585","host":"s3://npm-registry-packages"}},"0.1.0":{"name":"@cardano-foundation/cf-flat-decoder-ts","version":"0.1.0","keywords":["flat","binary","decoder","typescript","javascript","node","browser"],"author":{"name":"Cardano Foundation"},"license":"MIT","_id":"@cardano-foundation/cf-flat-decoder-ts@0.1.0","maintainers":[{"name":"fabianbormann","email":"bormann.fabian@gmail.com"},{"name":"jan.mazak","email":"jan.mazak@vacuumlabs.com"},{"name":"steve.wagendorp","email":"steve.wagendorp@cardanofoundation.org"},{"name":"ppershing","email":"ppershing@gmail.com"},{"name":"refi93","email":"rafael.korbas@gmail.com"},{"name":"gabrielkerekes","email":"gabriel.kerekes@vacuumlabs.com"}],"homepage":"https://github.com/cardano-foundation/cf-flat-decoder-ts","dist":{"shasum":"67aa5252a277337666a7e0733d838c8fca1c359c","tarball":"https://registry.npmjs.org/@cardano-foundation/cf-flat-decoder-ts/-/cf-flat-decoder-ts-0.1.0.tgz","fileCount":35,"integrity":"sha512-l1DrlrffaGLDloQlutaVxXL5tFbOyF34PIJMkSqnSMXef7cUSaJg7V4nJd7gTUPETdlyp+nYZbkMKxNCnuI6Ug==","signatures":[{"sig":"MEQCIHVI9nvj/h7UCkGMa4tLDDR5UtdRydPWpTzsnh0sKyHoAiBKe2RTvMtdKGAJ9cwcL1Fd2f5LVSKlX6lCsAHGdtpriA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":301420},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.js","gitHead":"73b0092ffdf9b7dca6d0fb17fb9a298885c9e6fd","scripts":{"test":"jest","build":"webpack && tsc --emitDeclarationOnly","test:ci":"jest --ci --coverage"},"_npmUser":{"name":"fabianbormann","email":"bormann.fabian@gmail.com"},"_npmVersion":"8.19.4","description":"This package aims to offer a simple and fast method for decoding flat binary-encoded data using TypeScript and plain JavaScript, suitable for both node.js and browser","directories":{},"_nodeVersion":"16.20.2","dependencies":{"jest":"^29.7.0","cbor-x":"^1.5.7","ts-jest":"^29.1.1","@types/jest":"^29.5.11"},"_hasShrinkwrap":false,"devDependencies":{"webpack":"^5.89.0","typescript":"^5.3.3","@babel/core":"^7.23.7","webpack-cli":"^5.1.4","babel-loader":"^9.1.3","@babel/preset-env":"^7.23.7","clean-webpack-plugin":"^4.0.0","@babel/preset-typescript":"^7.23.3"},"_npmOperationalInternal":{"tmp":"tmp/cf-flat-decoder-ts_0.1.0_1705002106487_0.5411341357278401","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"@cardano-foundation/cf-flat-decoder-ts","version":"0.1.1","keywords":["flat","binary","decoder","typescript","javascript","node","browser"],"author":{"name":"Cardano Foundation"},"license":"MIT","_id":"@cardano-foundation/cf-flat-decoder-ts@0.1.1","maintainers":[{"name":"cf-npmjs","email":"itops+npm@cardanofoundation.org"},{"name":"fabianbormann","email":"bormann.fabian@gmail.com"},{"name":"jan.mazak","email":"jan.mazak@vacuumlabs.com"},{"name":"steve.wagendorp","email":"steve.wagendorp@cardanofoundation.org"},{"name":"ppershing","email":"ppershing@gmail.com"},{"name":"refi93","email":"rafael.korbas@gmail.com"},{"name":"gabrielkerekes","email":"gabriel.kerekes@vacuumlabs.com"}],"homepage":"https://github.com/cardano-foundation/cf-flat-decoder-ts","dist":{"shasum":"0c9745bfb65e073523ddb122c6bf2af584542038","tarball":"https://registry.npmjs.org/@cardano-foundation/cf-flat-decoder-ts/-/cf-flat-decoder-ts-0.1.1.tgz","fileCount":35,"integrity":"sha512-vL4MXJn4uOvTKAVTYFVDJrEq8oGge/KHhTuAgRR3X87PRpBJKQjmlom3qUZGk44WHp4GC7uKxQiPtHRZ9qwwZw==","signatures":[{"sig":"MEQCIHaLxfIjVm1dgr2cmU24bHhHlhgXK6L5xE1CT8qmF3IlAiBdSvTrQTmekp2mZm9l8RkXz5I/HxP7aa3ZKATUT4Lwjw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":309278},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.js","gitHead":"622a7404f418ca61041235b17d180968d7ba1b89","scripts":{"test":"jest","build":"webpack && tsc --emitDeclarationOnly","test:ci":"jest --ci --coverage"},"_npmUser":{"name":"fabianbormann","email":"bormann.fabian@gmail.com"},"_npmVersion":"8.19.4","description":"This package aims to offer a simple and fast method for decoding flat binary-encoded data using TypeScript and plain JavaScript, suitable for both node.js and browser","directories":{},"_nodeVersion":"16.20.2","dependencies":{"jest":"^29.7.0","cbor-x":"^1.5.7","ts-jest":"^29.1.1","@types/jest":"^29.5.11"},"_hasShrinkwrap":false,"devDependencies":{"webpack":"^5.89.0","typescript":"^5.3.3","@babel/core":"^7.23.7","webpack-cli":"^5.1.4","babel-loader":"^9.1.3","@babel/preset-env":"^7.23.7","clean-webpack-plugin":"^4.0.0","@babel/preset-typescript":"^7.23.3"},"_npmOperationalInternal":{"tmp":"tmp/cf-flat-decoder-ts_0.1.1_1706523511134_0.03791517973304703","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-01-11T19:36:22.154Z","modified":"2026-05-06T10:44:50.820Z","0.0.1":"2024-01-11T19:36:22.493Z","0.1.0":"2024-01-11T19:41:46.639Z","0.1.1":"2024-01-29T10:18:31.273Z"},"author":{"name":"Cardano Foundation"},"license":"MIT","homepage":"https://github.com/cardano-foundation/cf-flat-decoder-ts","keywords":["flat","binary","decoder","typescript","javascript","node","browser"],"description":"This package aims to offer a simple and fast method for decoding flat binary-encoded data using TypeScript and plain JavaScript, suitable for both node.js and browser","maintainers":[{"email":"bormann.fabian@gmail.com","name":"fabianbormann"},{"email":"itops+npm@cardanofoundation.org","name":"cf-npmjs"}],"readme":"# Typescript Flat Decoder\n\n<p align=\"left\">\n<img alt=\"Tests\" src=\"https://github.com/cardano-foundation/cf-flat-decoder-ts/actions/workflows/test.yml/badge.svg?branch=main\" />\n<img alt=\"Coverage\" src=\"https://cardano-foundation.github.io/cf-flat-decoder-ts/coverage-report/coverage-jest%20coverage.svg\" />\n<img alt=\"Release\" src=\"https://github.com/cardano-foundation/cf-flat-decoder-ts/actions/workflows/release.yml/badge.svg?branch=main\" />\n<img alt=\"Publish\" src=\"https://github.com/cardano-foundation/cf-flat-decoder-ts/actions/workflows/publish.yml/badge.svg?branch=main\" />\n<img alt=\"Bundle\" src=\"https://github.com/cardano-foundation/cf-flat-decoder-ts/actions/workflows/bundle.yml/badge.svg?branch=main\" />\n<a href=\"https://conventionalcommits.org\"><img alt=\"conventionalcommits\" src=\"https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits\" /></a>\n<a href=\"https://discord.gg/4WVNHgQ7bP\"><img alt=\"Discord\" src=\"https://img.shields.io/discord/1022471509173882950\"></a>\n</p>\n\nThis project aims to provide a [flat binary](https://github.com/Quid2/flat) decoder. It is written in Typescript and can be used in both NodeJS and the browser.\n\n## Getting Started\n\n```\nnpm i @cardano-foundation/cf-flat-decoder-ts\n```\n\n## Usage\n\nYou can use the decoder in node backend but also in the browser. This example shows how to use it in a React app.\n\n```typescript\nimport { useState } from 'react';\nimport { decodeFlatUplc, Term } from '@cardano-foundation/cf-flat-decoder-ts';\n\nfunction App() {\n  const [deserializeContract, setDeserializeContract] = useState(\n    '59050c010000333323232323232323232323232323232323232323232323222232222533301a3375e0049801018000132323232533301e323001222222333301b232333322323232533302c3370e9000001080d8a99981619b87480100084c068c0b80044cc8cc0748c888c00800cc0c8004dd48009bae302e001004302f00230240013754004605260500020064a66605066e1ccc070014dd59815001240042602c6eb0c8c8c8c8c8c8c8c8c8c8c8c8c8c803d4ccc0d000452616303500653330333370e90000010991919299981b29981419b87001480004cdc3800a40702646493299981b0008a4c2c606e0082c6e34004dd7000981a8008a99981999b87480080084c926533303200114985858c0d8008c0ac004dd500098188009817803299981699b87480000084c8c8c8c8c8c8c9265333032001149858c0cc0194ccc0c4cdc3a400000426464646464646493299981b0008a4c2c606e0066eb4004c0d8004c0d000ccc8c0c4894ccc0d000440c04cc0c4c00cc0dc004c008c0d80048c94ccc0d0cdc39b8d001480e0400858dd70009bac001303300116303400230290013754002605e0022a66605a66e1d20020021324994ccc0b0004526161630300023025001375400260560026eb0004405c4894004c09cc0a4c0a0c09cc0a400401094cc060ccc07d281191800911191980e91999980e9191118010019bab303200137520066eacc0bcc0b8c0c0c0bcc0b8c0c00048cc07c94ccc0bccdc4a40046eb4c0cc0044c010dd718148008a5000114a0006466e212000330200010043232233300100b003002375c0046604a44a666050002201026604a60560026004605400200e6050604e002266603e9408c8cdc49bad302a3029001333026222533302a00110021330033370000490011816000a4000664604e44a666054002204c264a66605860080022660500026006605a00426006605a004605a00266444660060020044604e44a666054002294054ccc0accdd798168008018a5113002302c00100637586054002605400260500022940c8c8c8c8c88cccccc00401801401000c038008dd59812181198118029bac30230043758604400a6eb0c084014dd598100010a4c2c64603e6036002603c0026032603a0026038002603a6038603a002266666030444a666038002244a0022a66603a6004603e002264446004006603e002266006004603c00246466ebc00401cc8c078c07c004c8c078c07c004c074c070c078004c8dd6180e980f000980e180e800924c2c6eb8008888c00800c894004888cc044894ccc050004489400454ccc054cdd79807980b80080209802980b80089801180b000800918071129998088008a5015330043003301400113002301300123300f00100214a2446666660060100246ea40080048ccc01c88cdc01bad301500200148000dd58008a40004444666600a6600c0080040024644460040066008002244a0024601244a666018002244a0022666006601e002444600400626004601c002444a66601866ebc008c00c004488c00800c489400488c020894ccc02c004400c4cc010c038004c008c034004888c8c8c94ccc034cdc3a4004004200c2600a601e0026020004600a0026ea800555cea5eb815d0118029802800919180111980100100091801119801001000aab9f5734ae895d0918011baa0015573c9810100004c011e581c9cae3d41ae05882f5f357f0042d71842f1cc8a8e5230411ddb4daf17004c0122d87a9f581cca925263da4c59bf675f3cc485c894575cfe9b2b50ae5c3a360a62cdff0001'\n  );\n  const [uplc, setUplc] = useState('');\n\n  const handleGetUplc = () => {\n    const uplc = decodeFlatUplc(deserializeContract);\n    setUplc(uplc);\n    Term.indent = 5; //Reset indent\n  };\n\n  return (\n    <>\n      <h1>Flat decoder</h1>\n      <div>\n        <input\n          value={deserializeContract}\n          onChange={(e) => {\n            setDeserializeContract(e.target.value);\n          }}\n        />\n        <button onClick={handleGetUplc}>Get uplc</button>\n      </div>\n      <div\n        style={{ margin: '10px 0', padding: 10, whiteSpace: 'nowrap' }}\n        dangerouslySetInnerHTML={{ __html: uplc }}\n      ></div>\n    </>\n  );\n}\n\nexport default App;\n```\n","readmeFilename":"README.md"}