{"_id":"@ar-packages-changeit/bitcoin-runes-utxo-selection","_rev":"2-97696290b0603d8caa0acfc19640d52b","name":"@ar-packages-changeit/bitcoin-runes-utxo-selection","dist-tags":{"develop":"2.0.2-7bc25721","latest":"2.0.2"},"versions":{"2.0.2-7bc25721":{"name":"@ar-packages-changeit/bitcoin-runes-utxo-selection","version":"2.0.2-7bc25721","author":{"name":"Rosen Team"},"license":"MIT","_id":"@ar-packages-changeit/bitcoin-runes-utxo-selection@2.0.2-7bc25721","maintainers":[{"name":"arsalanyavari","email":"arya48.yavari79@gmail.com"}],"homepage":"https://github.com/rosen-bridge/selection#readme","bugs":{"url":"https://github.com/rosen-bridge/selection/issues"},"dist":{"shasum":"a9d925255ab1434b2ddb62c5b832f869547d7de6","tarball":"https://registry.npmjs.org/@ar-packages-changeit/bitcoin-runes-utxo-selection/-/bitcoin-runes-utxo-selection-2.0.2-7bc25721.tgz","fileCount":12,"integrity":"sha512-RJZsUwDxueuQz7ptjllsrl+xohyUqj7rtb4ccvy8JV4vgxWlElS8Rz5WDPa7S2rdPTUe1v3OCx+EI0cXGb8OhQ==","signatures":[{"sig":"MEUCIFjNH9BeJjQjnEgFxbnxamCUjq5oxT68hYjjgt1SKFKcAiEA6WkpO3QVkQuHnoBaMRm6I7WmAVunwe3l8FNh2/7N6zM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10184},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=22.18.0"},"gitHead":"7bc25721f554f9b4be8b1c1599b621955c6dbb6c","scripts":{"lint":"eslint --fix . && npm run prettify","test":"NODE_OPTIONS='--import tsx' vitest","build":"tsc --build tsconfig.build.json","clean":"rimraf dist && rimraf tsconfig.build.tsbuildinfo","release":"npm run clean && npm run build && npm run test -- --run && npm publish --access public","coverage":"npm run test -- --run --coverage","prettify":"prettier --write . --ignore-path ../../.gitignore","lint:check":"eslint . && npm run prettify:check","type-check":"tsc --noEmit","prettify:check":"prettier --check . --ignore-path ../../.gitignore"},"_npmUser":{"name":"arsalanyavari","email":"arya48.yavari79@gmail.com"},"repository":{"url":"git+https://github.com/rosen-bridge/selection.git","type":"git"},"_npmVersion":"11.6.2","description":"A Typescript package to select enough Bitcoin utxos for required amount of BTC and Runes","directories":{},"_nodeVersion":"22.18.0","dependencies":{"@rosen-bridge/selection-types":"^1.0.1","@rosen-bridge/abstract-box-selection":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.20.5","vitest":"^3.1.4","@vitest/coverage-istanbul":"^3.1.4"},"_npmOperationalInternal":{"tmp":"tmp/bitcoin-runes-utxo-selection_2.0.2-7bc25721_1763557933695_0.9439933431081442","host":"s3://npm-registry-packages-npm-production"}},"2.0.2":{"name":"@ar-packages-changeit/bitcoin-runes-utxo-selection","version":"2.0.2","description":"A Typescript package to select enough Bitcoin utxos for required amount of BTC and Runes","repository":{"type":"git","url":"git+https://github.com/rosen-bridge/selection.git"},"license":"MIT","author":{"name":"Rosen Team"},"type":"module","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc --build tsconfig.build.json","clean":"rimraf dist && rimraf tsconfig.build.tsbuildinfo","coverage":"npm run test -- --run --coverage","lint":"eslint --fix . && npm run prettify","lint:check":"eslint . && npm run prettify:check","prettify":"prettier --write . --ignore-path ../../.gitignore","prettify:check":"prettier --check . --ignore-path ../../.gitignore","release":"npm run clean && npm run build && npm run test -- --run && npm publish --access public","test":"NODE_OPTIONS='--import tsx' vitest","type-check":"tsc --noEmit"},"dependencies":{"@rosen-bridge/abstract-box-selection":"^1.0.1","@rosen-bridge/selection-types":"^1.0.1"},"devDependencies":{"@vitest/coverage-istanbul":"^3.1.4","tsx":"^4.20.5","vitest":"^3.1.4"},"engines":{"node":">=22.18.0"},"gitHead":"fc55a043c8019b3f18d0c1a033f12d43a4693458","_id":"@ar-packages-changeit/bitcoin-runes-utxo-selection@2.0.2","bugs":{"url":"https://github.com/rosen-bridge/selection/issues"},"homepage":"https://github.com/rosen-bridge/selection#readme","_nodeVersion":"22.18.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-S2hC19GhIm2eucJRwD7tMHgk+ZeSZ/xnYMB/YHkJQIqMTbctTmMAkJLavCUqvYrSzs45R0EETrrWfrM4h8IITA==","shasum":"7c6c3d9c2118e5800b386910e3458d7ad26c09b5","tarball":"https://registry.npmjs.org/@ar-packages-changeit/bitcoin-runes-utxo-selection/-/bitcoin-runes-utxo-selection-2.0.2.tgz","fileCount":13,"unpackedSize":63505,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDs5KLiHvYi+dXdBrZIah0asp7uYbpXCl930+uErCr1iAIhAJXJzmVYtkBOy4v1X7IRv17scFvnAWvafhoKbk1Fm7Mg"}]},"_npmUser":{"name":"arsalanyavari","email":"arya48.yavari79@gmail.com"},"directories":{},"maintainers":[{"name":"arsalanyavari","email":"arya48.yavari79@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bitcoin-runes-utxo-selection_2.0.2_1763558449311_0.9009697324796231"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-19T13:12:13.583Z","modified":"2025-11-19T13:20:49.708Z","2.0.2-7bc25721":"2025-11-19T13:12:13.906Z","2.0.2":"2025-11-19T13:20:49.488Z"},"bugs":{"url":"https://github.com/rosen-bridge/selection/issues"},"author":{"name":"Rosen Team"},"license":"MIT","homepage":"https://github.com/rosen-bridge/selection#readme","repository":{"type":"git","url":"git+https://github.com/rosen-bridge/selection.git"},"description":"A Typescript package to select enough Bitcoin utxos for required amount of BTC and Runes","maintainers":[{"name":"arsalanyavari","email":"arya48.yavari79@gmail.com"}],"readme":"# @rosen-bridge/bitcoin-runes-utxo-selection\n\n## Table of contents\n\n- [Introduction](#introduction)\n- [Installation](#installation)\n- [Usage](#usage)\n\n## Introduction\n\nA TypeScript package for selecting Bitcoin UTXOs to cover required amounts of BTC and Runes, built on top of the abstract box selection framework.\n\n## Installation\n\nnpm:\n\n```sh\nnpm i @rosen-bridge/bitcoin-runes-utxo-selection\n```\n\nyarn:\n\n```sh\nyarn add @rosen-bridge/bitcoin-runes-utxo-selection\n```\n\n## Usage\n\nHere's a basic example of how to use this package:\n\n```typescript\nimport { DummyLogger } from '@rosen-bridge/abstract-logger';\nimport { BitcoinRunesBoxSelection } from '@rosen-bridge/bitcoin-runes-utxo-selection';\n\n// Create the selection instance\nconst selector = new BitcoinRunesBoxSelection(new DummyLogger());\n\n// Define required assets\nconst requiredAssets = {\n  nativeToken: 1000n, // 1000 satoshis\n  tokens: [\n    { id: 'rune1', value: 100n },\n    { id: 'rune2', value: 200n },\n  ],\n};\n\n// Define UTXOs with Runes\nconst utxos: BitcoinRunesUtxo[] = [\n  {\n    txId: 'tx1',\n    index: 0,\n    value: 5000n, // 5000 satoshis\n    runes: [{ runeId: 'rune1', quantity: 100n }],\n  },\n  {\n    txId: 'tx2',\n    index: 0,\n    value: 3000n, // 3000 satoshis\n    runes: [{ runeId: 'rune2', quantity: 200n }],\n  },\n];\n\n// Get covering boxes\nconst result = await selector.getCoveringBoxes(\n  requiredAssets,\n  [], // forbidden box IDs\n  new Map(), // track map\n  utxos.values(),\n);\n\nif (result.covered) {\n  console.log('Selected UTXOs:', result.boxes);\n  console.log('Additional assets:', result.additionalAssets);\n} else {\n  console.log('Could not cover requirements');\n}\n```\n\nYou can also use custom min box value and limit number of Runes per change box by passing them as arguments to the `getCoveringBoxes` method.\n\n```typescript\nconst result = await selector.getCoveringBoxes(\n  requiredAssets,\n  [], // forbidden box IDs\n  new Map(), // track map\n  boxes.values(),\n  546n, // min box value\n  1, // max token count\n);\n```\n","readmeFilename":"README.md"}