{"_id":"@aloe2/unspents","name":"@aloe2/unspents","dist-tags":{"aloe-bbc82c9c9":"0.8.20228282226","latest":"0.8.20228282226"},"versions":{"0.8.20228282226":{"name":"@aloe2/unspents","version":"0.8.20228282226","description":"Defines the chain codes used for different unspent types and methods to calculate bitcoin transaction sizes","main":"dist/index.js","types":"dist/index.d.ts","directories":{"test":"test"},"scripts":{"build":"tsc --project tsconfig.build.json","test":"mocha","lint":"eslint --quiet .","prepare":"npm run build","unit-test":"npm run test"},"repository":{"type":"git","url":"git+https://github.com/BitGo/BitGoJS.git","directory":"modules/unspents"},"keywords":["bitcoin","utxo"],"author":{"name":"BitGo SDK Team","email":"sdkteam@bitgo.com"},"license":"Apache-2.0","bugs":{"url":"https://github.com/BitGo/BitGoJS/issues"},"homepage":"https://github.com/BitGo/BitGoJS/tree/master/modules/unspents#bitgounspents","devDependencies":{"@types/lodash":"~4.14.123","@types/node":"~14.17.5","lodash.combinations":"~18.9.19","should":"~13.2.3"},"dependencies":{"@aloe2/utxo-lib":"^2.4.20228282226","lodash":"~4.17.21","tcomb":"~3.2.29","varuint-bitcoin":"^1.0.4"},"lint-staged":{"*.{js,ts}":["yarn prettier --write","yarn eslint --fix"]},"publishConfig":{"access":"public"},"gitHead":"ff34e1949ea30d3016d4a8e17d459eee4436eda5","_id":"@aloe2/unspents@0.8.20228282226","_nodeVersion":"14.18.0","_npmVersion":"lerna/5.5.0/node@v14.18.0+x64 (darwin)","dist":{"integrity":"sha512-SK2i4963X64xEn5SLXfiTD+ydhYn3zbbwA+wbg8ldynmeJ/VVXDk1tmC8sLj+AyT9MlIGYfAksBu5Q6++tj1nQ==","shasum":"de1efacd1550f9513956b54ebc941381b09bd322","tarball":"https://registry.npmjs.org/@aloe2/unspents/-/unspents-0.8.20228282226.tgz","fileCount":22,"unpackedSize":67302,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFd4xiSeQpSUI5N+qQxpv7RwrkzCb/scBzubW1w31WQxAiBRSN0PjlNwCFt2yVWkw0OexWsghlSzaFqz1+NRNqfk7Q=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjNS5XACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpDRBAAoFV/MAxhWQgctZyBRO+dIx3V1ehcGiZB+hxZnFYTJ+67zJ9Q\r\nfNAW/epWP3+KlGFRej9EkNkGpyceSLgPJi6alyGPandq1y/Nuy6HabXdaRzo\r\nP1f475dL21nEAdNdytgiD+49L0BY4fiqPxq/7Cv7Pmu9F53wOzWlZii2OsSB\r\nBM/jBAV6187ZQQomwJUw/1qDHh3XHoCAEM1EoN2mHJIRHhv71spNg80YFG7i\r\nrMmV976M3YC9K+lxD+B9w+lkifl5pZwZSJQq4d79SGO2YH6Rlebz9hSWCfQh\r\nwOXILJXxrFGs6xaUIKxMclJ16EoxjbvgcH0GwKVQYiV+i6Zr5d1dwfqBdPJ8\r\nmuIuQLREP5QR0nyhKM6p2ZgfEba9e1AO27shKgAlyYaxUUuYvXN6IfQfzKHf\r\n+BVKWlJfBIVPQb2uBkM1UjQFAh6iN0lGVVMW4djBkbDVPGOQnh2tJlQlv0RU\r\nKjTJazpjvE5O3VTujsXCwjIcNJZzsBKC8apGs5KUcFE4VdAcpp2bAoI3IxYJ\r\nzJAwAm7qWRh/PV81elAs8sT2U1qjJPJ6PdGiqZAbvY/2/u6gAadu//29rfk8\r\nMAoUH3BpNG065loMsKNb4W6mCs/T5J9AyHjfNYtkZLTDzlQwPwrEdB9Ry4aM\r\nAzcPQARvRRIJlHnPg6R8MYpEUBL+oaXvHc0=\r\n=eQXy\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aaronloe","email":"aaronloe@gmail.com"},"maintainers":[{"name":"aaronloe","email":"aaronloe@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/unspents_0.8.20228282226_1664429655051_0.6003253205396546"},"_hasShrinkwrap":false}},"time":{"created":"2022-09-29T05:34:14.991Z","0.8.20228282226":"2022-09-29T05:34:15.295Z","modified":"2022-09-29T05:34:15.421Z"},"maintainers":[{"name":"aaronloe","email":"aaronloe@gmail.com"}],"description":"Defines the chain codes used for different unspent types and methods to calculate bitcoin transaction sizes","homepage":"https://github.com/BitGo/BitGoJS/tree/master/modules/unspents#bitgounspents","keywords":["bitcoin","utxo"],"repository":{"type":"git","url":"git+https://github.com/BitGo/BitGoJS.git","directory":"modules/unspents"},"author":{"name":"BitGo SDK Team","email":"sdkteam@bitgo.com"},"bugs":{"url":"https://github.com/BitGo/BitGoJS/issues"},"license":"Apache-2.0","readme":"# @bitgo/unspents\n\nThe package provides a `Dimensions` class with methods to calculate bitcoin transaction sizes\n\n## Installation\n\n```\nnpm install --save @bitgo/unspents\n```\n\n## Dimensions, Virtual Size Estimation\n\nThe transaction vSize is critical to calculating the proper transaction fee.\n\nThe class `unspents.Dimensions` provides a class that helps work with the components required\nto calculate an accurate estimate of a transaction vSize.\n\n### Examples\n\n```typescript\nimport { Codes, Dimensions } from '@bitgo/unspents';\n// using raw attributes\nnew Dimensions({\n  nP2shInputs: 1,\n  nP2shP2wshInputs: 1,\n  nP2wshInputs: 1,\n  outputs: { count: 1, size: 32 },\n});\n\n// calculate from unspents that have `chain` property (see Chain Codes)\nDimensions.fromUnspents(unspent[0]);\nDimensions.fromUnspents(unspents);\n\n// Signed inputs work too\nDimensions.fromInput(inputs[0]);\nDimensions.fromInputs(inputs);\n\n// Transaction outputs\nDimensions.fromOutputs(outputs[0]);\nDimensions.fromOutputs(outputs);\nDimensions.fromOutputOnChain(Codes.p2sh.internal);\nDimensions.fromOutputScriptLength(31);\n\n// Combining dimensions and estimating their vSize\nDimensions.fromUnspents({ unspents })\n  .plus(Dimensions.fromOutputOnChain(Codes.p2shP2wsh.internal).times(nOutputs))\n  .getVSize();\n```\n\n## Publishing new versions\n\nPublishing new versions should be done by running the publish script in `scripts/publish.sh`.\n\nIt can be invoked with the name of the branch to release, and will default to the currently checked out branch if not given.\n\nIt will perform validation of all prepublish conditions, run a dry-run publish, then, if successful, a real publish. After that is complete,\nthe newly installed package will be downloaded and `require()`'d to ensure the package was published correctly.\n\n## Continuous Integration\n\n`@bitgo/unspents` uses Drone for continuous integration, which is configured by the `.drone.yml` file in the project root. However, this file should not be modified by hand. All changes to the CI process should be done by modifying the `.drone.jsonnet` file, then running `npm run generate_drone` to rebuild the `.drone.yml` file.\n\n## `Codes`\n\nThe exported `Codes` module is now deprecated.\n\nPlease use [`utxo-lib/src/bitgo/wallet/chains`](https://github.com/BitGo/BitGoJS/blob/0439a0d4ffe4a15a9932ed70f98cc5745cc6526f/modules/utxo-lib/src/bitgo/wallet/chains.ts) instead.\n","readmeFilename":"README.md"}