{"_id":"@blockydevs/qubic-hw-app","name":"@blockydevs/qubic-hw-app","dist-tags":{"latest":"0.1.2-RC2"},"versions":{"0.1.2-RC2":{"name":"@blockydevs/qubic-hw-app","version":"0.1.2-RC2","description":"A JavaScript library for interacting with Qubic Ledger hardware wallets using the `@ledgerhq/hw-transport` package.","main":"lib/index.js","module":"lib-es/index.js","types":"lib/index.d.ts","repository":{"type":"git","url":"git+https://github.com/blockydevs/qubic-hw-app.git"},"keywords":["Ledger","Qubic"],"author":{"name":"BlockyDevs"},"license":"MIT","bugs":{"url":"https://github.com/blockydevs/qubic-hw-app/issues"},"homepage":"https://github.com/blockydevs/qubic-hw-app#readme","dependencies":{"@ledgerhq/errors":"^6.16.3","@ledgerhq/hw-transport":"^6.30.5","@qubic-lib/qubic-ts-library":"^0.1.5","zod":"^3.24.2"},"devDependencies":{"@ledgerhq/hw-transport-mocker":"^6.28.5","@ledgerhq/hw-transport-node-speculos":"^6.28.5","@types/jest":"^29.5.12","@types/node":"^20.11.30","jest":"^29.7.0","ts-jest":"^29.1.2","prettier":"3.5.3","ts-node":"^10.9.2","typescript":"5.8.2","zod":"^3.24.2","autoprefixer":"^10.4.20","buffer":"6.0.3","copy-text-to-clipboard":"^3.2.0","eslint":"9.22.0","eslint-config-prettier":"^8.10.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-react":"^7.37.4"},"scripts":{"build":"tsc && tsc -m ES6 --outDir lib-es","watch":"tsc --watch","test":"jest"},"_id":"@blockydevs/qubic-hw-app@0.1.2-RC2","_integrity":"sha512-m9SWrJoZ2yt6ZfWY8VK4gC9wZ/CfOWyEO6gmKAOZQq2dgFj9PXHFN6ye2nDiNTNORtW2DIRyoY95dKDsDprZtQ==","_resolved":"/tmp/70361a4ffdd9092a1fb9240cde9f33e9/blockydevs-qubic-hw-app-0.1.2-RC2.tgz","_from":"file:blockydevs-qubic-hw-app-0.1.2-RC2.tgz","_nodeVersion":"18.20.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-m9SWrJoZ2yt6ZfWY8VK4gC9wZ/CfOWyEO6gmKAOZQq2dgFj9PXHFN6ye2nDiNTNORtW2DIRyoY95dKDsDprZtQ==","shasum":"c178cfc9b861c98a58f0f40f8ac32ad00197b578","tarball":"https://registry.npmjs.org/@blockydevs/qubic-hw-app/-/qubic-hw-app-0.1.2-RC2.tgz","fileCount":50,"unpackedSize":58731,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICN1AHYPhbIaekg6yDtKaNVvqItfIVY4sSr79yUEvCkpAiEA29Iy8JNHdiBTqI6NL3SWhKsUAVSIBkZrRZiB3bRpPkU="}]},"_npmUser":{"name":"0xmmbd","email":"maciej.malik@blockydevs.com"},"directories":{},"maintainers":[{"name":"bartoszsolkabd","email":"bartosz.solka@blockydevs.com"},{"name":"0xmmbd","email":"maciej.malik@blockydevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/qubic-hw-app_0.1.2-RC2_1742541287834_0.44976852016088964"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-21T07:14:47.770Z","0.1.2-RC2":"2025-03-21T07:14:48.041Z","modified":"2025-03-21T07:14:48.603Z"},"maintainers":[{"name":"bartoszsolkabd","email":"bartosz.solka@blockydevs.com"},{"name":"0xmmbd","email":"maciej.malik@blockydevs.com"}],"description":"A JavaScript library for interacting with Qubic Ledger hardware wallets using the `@ledgerhq/hw-transport` package.","homepage":"https://github.com/blockydevs/qubic-hw-app#readme","keywords":["Ledger","Qubic"],"repository":{"type":"git","url":"git+https://github.com/blockydevs/qubic-hw-app.git"},"author":{"name":"BlockyDevs"},"bugs":{"url":"https://github.com/blockydevs/qubic-hw-app/issues"},"license":"MIT","readme":"# qubic-hw-app\n\nA JavaScript library for interacting with Qubic Ledger hardware wallets using the `@ledgerhq/hw-transport` package.\n\n## Installation\n\n```sh\nnpm install qubic-hw-app\n```\n\n### Prerequisite\n\nBefore using the `hw-app-qubic` package, your application must set up its own HID transport to communicate with a Ledger hardware wallet. To install the [`@ledgerhq/hw-transport`](https://github.com/LedgerHQ/ledger-live/tree/develop/libs/ledgerjs/packages/hw-transport) package, run:\n\n```bash\nnpm install @ledgerhq/hw-transport\n```\n\n### Note\n\nThis package relies on [`@qubic-lib/qubic-ts-library`](https://github.com/qubic/ts-library) and expects usage of this library to construct transactions. To install the package, run:\n\n```bash\nnpm install @qubic-lib/qubic-ts-library\n```\n\n## Usage\n\n### Basic App Example\n\n```ts\nimport Transport from \"@ledgerhq/hw-transport-node-hid\";\nimport { HWAppQubic } from \"hw-app-qubic\";\n\nasync function main() {\n    const transport = await Transport.create();\n    const hwAppQubic = new HWAppQubic(transport);\n\n    const version = await hwAppQubic.getVersion();\n    console.log(\"Ledger App Version:\", version);\n\n    const publicKey = await hwAppQubic.getPublicKey();\n    console.log(\"Public Key:\", publicKey.toString(\"hex\"));\n}\n\nmain().catch(console.error);\n```\n\n### Signing a Transaction\n\n```ts\nimport Transport from \"@ledgerhq/hw-transport-node-hid\";\nimport { HWAppQubic } from \"hw-app-qubic\";\nimport { QubicTransaction } from \"@qubic-lib/qubic-ts-library\";\n\nasync function main() {\n    const transport = await Transport.create();\n    const hwAppQubic = new HWAppQubic(transport);\n\n    const transaction = new QubicTransaction({\n        sourcePublicKey: \"sourcePublicKey\",\n        destinationPublicKey: \"destinationPublicKey\",\n        amount: 1000,\n        tick: 123456,\n        inputType: 1,\n        inputSize: 1,\n    });\n\n    const signedTransaction = await hwAppQubic.signTransaction(transaction);\n    console.log(\"Signed Transaction:\", signedTransaction);\n}\n\nmain().catch(console.error);\n```\n\n## API\n\n### `new HWAppQubic(transport: Transport)`\n\nCreates an instance of `HWAppQubic` with the given transport.\n\n### `getVersion(): Promise<{ version: string }>`\n\nRetrieves the installed Qubic Ledger app version.\n\n### `getPublicKey(derivationPath?: string, withConfirm?: boolean): Promise<Buffer>`\n\nRetrieves the public key for the given derivation path. If `withConfirm` is `true`, the user must confirm on the device.\n\n-   `derivationPath`: The BIP32 derivation path (default: `m/44'/1'/0'/0/0`).\n-   `withConfirm`: Whether user confirmation is required (default: `false`).\n\n### `signTransaction(transaction: IQubicTransaction): Promise<ISignTransactionReturn>`\n\nSigns a Qubic transaction.\n\n```ts\ninterface ISignTransactionReturn {\n    signature: Buffer<ArrayBufferLike>;\n    transaction: Uint8Array<ArrayBufferLike>;\n    signedData: Uint8Array<ArrayBuffer>; // Transaction + signature\n}\n```\n\n### `sendToDevice(params: ISendToDeviceParams): Promise<Buffer>`\n\nSends a command to the Ledger device.\n\n-   `params`: The parameters for the command, including `instruction`, `p1`, `p2`, and `payload`.\n\n## Publishing\n\nBefore publishing, ensure that the project is built locally.\n\n### Steps:\n\n1. **Build the project**  \n   This will generate the `lib` and `lib-es` directories.\n\n    ```bash\n    pnpm build\n    ```\n\n2. **Login with npm credentials**  \n   If you haven't logged in yet, authenticate using your npm account credentials.\n\n    ```bash\n    npm adduser\n    ```\n\n3. **Publish the package**  \n   Publish the package to npm with public access.\n\n    ```bash\n    npm publish --access public\n    ```\n","readmeFilename":"README.md","_rev":"1-6045acdc06fced2554ca0a30c065aacd"}