{"_id":"@dfinity/ledger","_rev":"361-d040551b794090acc20959d5eb8b79f7","name":"@dfinity/ledger","dist-tags":{"latest":"1.0.0","next":"1.0.0-next-2023-10-02.1"},"versions":{"0.0.1":{"name":"@dfinity/ledger","version":"0.0.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"42b42fe1655d327d9bf222dd935117b96a737850","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.1.tgz","fileCount":27,"integrity":"sha512-LyuZ1G7mk5y2uHVrOogoZIm9tWLZeKVOT+EOzprhK/usWF7OPY4vyQXyhJ5DGKW2qc/1SeG+WdtCaxrnpYpmmA==","signatures":[{"sig":"MEYCIQDacmAWZob6ciShtEEWtpVgh1gb1cQq3D0r0nVBChI6+AIhAKuPGwsuZwOWy/O7/+SSws6x5ccRw8tN87V7QBh8cLf5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90770,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjz+OLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrA5Q/+OJbXfWcztUJRDFXWAsrzI4LCFAP4GLQMgptsZruQVRh8AEzL\r\npxyC8I7zKMdycCVllBr0hs1/gl3VGDw27Kymqg3TAdtrnZiCNro9OqC2bui7\r\n04SwNpjQrD2B/bK3iI9z4zZY8AVBUNBwmOm5u5WDLad+nE145P9x/4CsRf4X\r\nOFvi965zm9cQ8opbwgDq5A3iYclZyTC0vjtmfyl8JOs59c6y6xK4fSbIOsCh\r\nyAgDvnxyKrmG4YkMtxB6F5K5YdWid2epQK9a5xGm6OAvlkSGrkaFNYJfFCiO\r\nJNq0np0tGhEH+r0nBxaXmxGOTqfLSYkTlMAihV8Ht0Nt1HOXAeDYxPjDhHmH\r\nsTfhUiFx9mDyEXZvZ05DvVffaLzzrRvBwC4PXMDnDfONO1PXGm/lLH8CF9rP\r\nkV4Z/GduzsN+ydVb/1aTnZkMuAOUMMrrHizj4qsKxa1W9sZjdn3IQzV5Qxhs\r\n47DhUiSd/TeQrMSFH0GYQmBZ95FuJzLDOq5FVdQnlnG+frugLwrLyQ8y6i+e\r\nMIpVPoXqeWPfDPRPUw0ifkP4iPz4A3LMcv9SUjpw6cY5i3gDVnLUnyRhoQZS\r\nDgq3KUaRWPpkjfH65xqhbNv5JCh3Yp4CU4Op9wBkbuyAkKQzYrx34Zbgss3x\r\nn8WmfhtNC9fUnaEpRr/Oqz/3kcv7Le9kZ/M=\r\n=dt52\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"0b745178238870eeeb326ac86adfc50ca62dd227","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/utils":"^0.0.8"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.1_1674568587015_0.8520170299002265","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@dfinity/ledger","version":"0.0.2","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.2","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f2df4f1a63352dfee56a9954e663dc73a8b89c42","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.2.tgz","fileCount":27,"integrity":"sha512-Ob6krYzjjSbREMpxGaBKqEG7nSJZO55/qHA8Gg6JmdJaWcA9sV+jUntEhI2tMQ6xztHtLnfYzWxgMbUD57UfDQ==","signatures":[{"sig":"MEYCIQCFHJ4Fe7NRLcA1L1OhA/elHFLDm5yqRx5Uf+51RkquUwIhAONb5KZs5AM9pp6nIwXsOlMPZ5G4QmbLF8n9BOO65WEi","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90770,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjz+WKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpyUw/+MjVWURa7lLq5uVCnmgm5aew5ogLvyIKOre29mzeLnEXk21Ez\r\nDHAKBiQvZaSreEdO0pJ6HKoU3KV5qv9FU/+yNM+HGK0ayKYL72rz1B3gzf+Q\r\nEEat9drEik+7L3Oo4KNDZ05/jitn4/YB5E+eKrIqQRJhzFRd2WaWHIBbux3S\r\nFsmzrVDQvg4H2bPW7y4JQD3gHaH3Pic7TGcScLHDZ27jJvgXVQaFk6zoZTNA\r\n/jCYrXbbGcd//ui3JUbT1aV5zceGWPpjDPtpWiyGbCYxBD8f8XnIi2OycnDE\r\n+BFB3MwG/lkecvLW2GZbd5q7j/BKUl+jBcu3a1Uwqa8fTD71obtfOWdCD9eV\r\nD6dHWj/QdcXzURj4kvEnyEeMGnXiLQA1E10eGZIOhpUi8N3Tka820SqmxE4O\r\nxbYuztyXRoICVkwk17Nd20yRffzu6Rm9igatXpNnY456VMAsX6MKkHzzRp+g\r\nJLQB1ScPg2hm7l5Hb32ipkJhw7uXSsY22jmzVVihLVKqWLRwsFbCmRgWPtUH\r\nCHfUdVIaoYsz1AcdjAyTLqcrCK+7rjYYC/wAXF+RI4957UOh/lOZFTWN2zez\r\n3mmfGKq23xy6d7GX3Pj5MNO07U2iYLmLXgbPbh7nS8zyxCL1H8CzSa0b+ZKM\r\nT7HzMh7Y5DICLuVmPekzYdNDQdCA/RHH4ec=\r\n=K0Ne\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"aed56262c499ef6163858e019528a9f2fcaa7959","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"^0.0.9"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.2_1674569098318_0.15165563959076134","host":"s3://npm-registry-packages"}},"0.0.2-next-2023-01-24":{"name":"@dfinity/ledger","version":"0.0.2-next-2023-01-24","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.2-next-2023-01-24","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"39b986fce496a9d98d2f2b5a7e3450e7406986f7","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.2-next-2023-01-24.tgz","fileCount":27,"integrity":"sha512-DWe+DNJhKc9A0YOy1TPVeTG5MKZP0jG3+9VNT4v/YQA3oH5Zt3E4wlEbB3BNjkfc33z0SHVMAoSH2tuXVjkawQ==","signatures":[{"sig":"MEUCIQC6tkKy797CEDi2VZ/C6IWNqYdZp8vod3D3pI/+deqeQwIgf919y1f0cKQdLGsWUFncrm5c9n7kL+uppldsMwNmX8I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90790,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjz+qiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpCkQ/+MtICZ8XwGvgM19YXrKhK4MbYXBp5ft5l3g8avzezsyvcM/cx\r\neBObtiJw2NgaichCvk4MGY4Z7zUwy0Xqdg545Zeu6CS+nsEFhfWaIEKFdv8F\r\n+Toco841HuhRuZbYpO0gYStZFV58Aropv98s7p/zETNhZiYBcKD3DG/C3jos\r\nsQ3fXiO9eFuCcd/nbKGzyOP0z0FvJafF+Eh8ojMVkBRiyYFiw2Onln9HCds0\r\nQ09bwpQvkqBXeoP/5VGFR3YcP8g7oXJA2Y1DetHz7rC3s4YxeJuLW2gAVCYU\r\nZr+GpZorTF8s+OnFbsLFMmVg5p6xbagV0oauXgJx+3kEu1Q/598rz6sWx5Gu\r\n+hecfoeoUYMDQWRuCecCbvXg2BeQUhfct2+N0aeXGi/1E6/JaM1U0Ty+XOIO\r\nLqRpMZny9pqeK2jMm477oFb7dgYt77MzHP1p2HYgs9SKpcuI6oJJxgyum979\r\ng2ihpyf1y2S4wXvSs4+Uxa6GTJDldt/VOJOcwTZOGxuNElIgHgFB1Q63fSHH\r\nvqCWaF9lqytWpqKU/c7dVqq7J2pYznz2q/NsyogcOPeIXa7iTqQHp0WU+yis\r\nwNl388/EkoOCU8tSjb9XuzEnZlIzGn0VFsah1zj6WqDL9zr5phBFf+Q2Js6v\r\n9/3BVj0NPo2u/ruKr7G0UZovTamZ/m4RQT4=\r\n=mcd2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"839d13b7a0d5d31f8b2b64b5073b83a887f5cf02","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"^0.0.9-next"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.2-next-2023-01-24_1674570401884_0.10632839917102421","host":"s3://npm-registry-packages"}},"0.0.3":{"name":"@dfinity/ledger","version":"0.0.3","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.3","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"1055b91d20def7c450893e59b4dc3827d7218b76","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.3.tgz","fileCount":27,"integrity":"sha512-hM75c/x7mf8vhPao70AzsaxCgHraAN29eMVhgPnWer1NB9Q9cD9NyKa9kjcMmKg4SHKY6zx28H+0unn0S3siHA==","signatures":[{"sig":"MEYCIQCTXL65IvQl7oznJBSUfJqAPJ4iuoOCwRiyzUvIaxQf+QIhALtN4JFNm3YqUY1zjixxeoo43yP3e6uj9m8P+C+jqXAK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90771,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjz/LLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmro5g//Y5/omjyHIF27t8UUBi1vjkXTUoP4ZauHQJkludbcE6qyOJL9\r\nhF7mPiwY9UKl6p4HbJ+ZBcQJY3Rwz3IOW1c/ThHtEA7uWVN8BGPmSut0iSEA\r\nvE282h/banPCoNJdOXklON7g1byVx9PppMUVGEgqfKwZYsU9G9y1gl0l7pcj\r\nHWIK2xPxqJD+Lgetsu38fAQ8W/aXkKzlQGpGcV7KFqBOGfY4zQXKHeNmu6Ub\r\nobTp4qV28crGJbPbSqlzyWZkzKd0LV0Tla1n2RrRuWJeSFnEtOBzETtBw79e\r\nAuf/nUvwvVihnqgvLUIE44mKnzTM3qmtjD07mkg5b6YbQLG64P/NxDzvIllJ\r\nd5qzAxn6MmM/YL6qonYDoSsKEeMZmzd7UytA9Sfbs95bg8FDyBp3vSfI++4j\r\nxLfS00h+CuzUEdM/QzmibNQ8mNfCoxrS/at6BUqpytD5k05gHrE488bfIUSH\r\nYAx98HK0Cn1Nlre1J9zfEL1sTfojaWvnudDy7b3OTZZkzQlp3uYWxn/SLV8A\r\nk6Z0wFryOykPoqoDpKkibkDPA/QDmY/ypIm4Mc5wwwCH/AjtP0wHtVncOJnf\r\nQ/WQ8ozmYw2pqm00cD49wWENFm3X5DTOfUvWeOyrStLbmgJmn3jYOwYvpXdC\r\ncInYXQAb+GWTC1kEL7kJWiKEVRAMwiCkxj0=\r\n=xX7P\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"69c42318ca7b46f14e3e21a51b67a0ebf4119785","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/utils":"^0.0.10"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.3_1674572491111_0.854134993735747","host":"s3://npm-registry-packages"}},"0.0.4-next-2023-01-24":{"name":"@dfinity/ledger","version":"0.0.4-next-2023-01-24","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.4-next-2023-01-24","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"e73bb95721de16328cfc662a542004dce050c7af","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.4-next-2023-01-24.tgz","fileCount":27,"integrity":"sha512-bBFtBIaLNzLq27NZN5deakZbNA19ceKD4U7JXaFz60xE1AMGr1eLk66R1UNShXSmPtPI65BNRIhFl9Nn50Y3Yg==","signatures":[{"sig":"MEQCIGIpVjl6e6hCjg/izq49aXSbTrp83iemDTmEUla9AHlSAiBDDHNLVdHOkj3cuEsrKNBocJQDP1blo0CwWbqF1wffqA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90780,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjz/ToACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqWRA/+PlHkk4C/e/P0i9Mt/VSgFSgt1L2psofr6e/0zwjI4M5jKNG7\r\njxWnjZiPfxzm1H6JP2so9yT1/gbD/JKGnX40o9CqmjtqT5FA4lpHeBoAiPzz\r\nsyszTWP337qfP4pfjt/VRRC/CRt/TPt5VKs7VeCNME4nHKSok9nzyZiKh3TD\r\nwsMzG57bQMHXJMHMwPDip1hpLj0qoRgeHLNOPnsxQNpZ0r0ZAYgOfM+Yacdc\r\n6OwGlIQKqDngH8U7qJpJJRQJVV51fU/eM7VV5eC6/7zpTw7Q9C2eAN184103\r\ngp+ZRWhwAnzqJukdyfxTGtNQiK1Tm/SPNeKV91qOYI5KP15w9x3wyJ/fVf36\r\ncBZ8Z1IY3cyBZ1SOTuLaewiqcYI0RmXugRtaQPm7MmG2GT7/GAKnCSY2IRdp\r\nJNBxaHyvLc0+ZprUGzlP5M8Lxvodqq/iEqfpMSNyfvOku+Vh4+xFKBr39Hiu\r\nymGfVWyKmutI+AWsG32XxwYAyoqpldl8+ejkTP8ImmOgAR12josLYn8VT7uh\r\nnzdfF+vyoDQGUqHNQo54VK3vpSiY6I1dNKxlRasDMBK+XQLO/SAqz5zX8BZq\r\nmymh0aikPZW4aNk1LEtH1sf686ITFnToJfuFTvJqLEdlZIcPjGSjKbC+5TaJ\r\nGhX4//GVu/OovJOtEGGn+6oIhVkWqKoLsVY=\r\n=d49R\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"58108d137842f4e01d6ba36fe07be913e976d716","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.4-next-2023-01-24_1674573031938_0.7622346284800334","host":"s3://npm-registry-packages"}},"0.0.4-next-2023-01-25":{"name":"@dfinity/ledger","version":"0.0.4-next-2023-01-25","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.4-next-2023-01-25","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"4f7c95b1ea2899e5a9fc0904024890578d700d66","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.4-next-2023-01-25.tgz","fileCount":27,"integrity":"sha512-VhZKNLU+JWPnz3mWKB+wBkeQbuXzO0y69UrsVMDsh9pgJpSPDR1FIn8cwZVSe5JBPoES1q6acfQGuOEV/srMwQ==","signatures":[{"sig":"MEYCIQDCjRGScHEA5IN27QJXAIYIhDWEeGQaA1MtHs+w9xq9TgIhAJVQR0SgZuNKNOxoh0DFw3Geg4MOhbiHoaldG0FJfrsx","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90780,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj0HPXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrM+w//TfYtXFdctCpQfdipZOfNBu/xvAMI2OLHyisYjyNeiMB1+W+N\r\nOKHkAmIJsIQi+dCV+d8eKp1O+hqmGLEPozq83EC2AA3MJD/qVHXW2l5AsDNy\r\nfmHmLdBCwHaonL7l0Hzm5LMrKnq5FKcD7fTkrGL8YHec0PBX3iNYLlw+QODI\r\nqhnZ3aDsyDt8tA8a9H5u0l84H96w74o2CgBaheMwNn6EBEReyqT+OX3B/zcT\r\nKsT6RKmaIJsw83nS0czyWi4WJfWUYPXAZjjiRM5VH7Vu/65hL4bs3//7APMA\r\nvX9UGKABmeSls6ihtbzSSEbJhfaC5IXRCk7lqCOnvOr3NWoPrp8erj4yofjO\r\nzR5sS6R+3+E1mIRldphdLG3CqWACHtqFfJv6lArnqE65wNkFOY8UM2yw5LxK\r\nSWeRxHBz7Ry0WZOZ1g9gv5y7/WvCnA5YKsnwtf5G0Tprzo+n1kk3GqoUIM43\r\nPyYfxq+8Smk8FYtZMNWgie8DykyeBcI3CBVCNyE5RUc30N76tf8ukfo2oiN1\r\n33TwymJPJUtR/++Wio0Yu47a4o8BZcHVwNeFYiEol/K8Rl+p+gCWeRzQmVA7\r\nMh6ZntzfWqOJwXal95IerqgHq3pHKtls4Sl2E1n5KsK6uq4udNFQwVfKhDbV\r\nEKl4TKTHbFM9zpHKyR3s4eUowA6IXdRlv+M=\r\n=EC7V\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"58108d137842f4e01d6ba36fe07be913e976d716","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.4-next-2023-01-25_1674605525886_0.9586654989717338","host":"s3://npm-registry-packages"}},"0.0.4-next-2023-01-25.1":{"name":"@dfinity/ledger","version":"0.0.4-next-2023-01-25.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.4-next-2023-01-25.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"9630dae1f0d25a7758506943935cce6536f3445e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.4-next-2023-01-25.1.tgz","fileCount":27,"integrity":"sha512-8R6kwqqJJsbfGotzDvOwuF6uiyInMuXf1MCCrRqLi+2G6TeucsDRGQCpJ4jCAk8+Y3vL/yj3FcUgCUy1ErYvsg==","signatures":[{"sig":"MEYCIQCSAv+8XVkmr+DAXtGuI/g9xMxtkDklsibIPIeq9eD4YAIhANtVYL5fb6MZjdcV/VMd+qUycM47BBBc3xkRpeJQg801","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90782,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj0VL8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoxCQ//cXJUzw+kSHcKQKW4bTjabSuMbYBO0cTue+hcg/SOlDCNUWMr\r\n8F3SHJuJ3AhoLgpD6rbFFtHNDsY/uz/ihe4/lfZ3I+ZFuQQNgkddgscWWyNe\r\nZommp9kf9aayT6+4LVsFxya+oi2m6lZtkv9HrcRLsK/ctTCmStEkid9PAMyl\r\nxKxBb/He/oUiKHuk2s9oz5JZWwGxzbmo/eA95ORAq0/WsV3yOErI06uh7OlT\r\n7EDGWG1R3VHazKbDRU0rhjwEwiFGciVeu8Q0NCmdO+RApj6Giku6ZPEiaCCH\r\n89y1q/8tuwSphl0oKbgz/pz9hwMEMUdtR6O2pI89Jf7jZWC8qX5gwuh1Pcot\r\n8mDk8ni1fmlC/0Q3/Y8CiyN+pbvfwD34GYKumuLASWjQzME4fwpxhLKOiVU5\r\nzm28kGMrCojvsCIx3yTqF1VIOpGMf7R2uET2l9ml6foFH96gm5V3u5Ar0sJ7\r\nc1fpz4XVXYPd0ftjTgbsC7EqhaPHWUwcV7ziJOGK7zj1poM86cjpBqF479Dh\r\nVtBjNi3r54cHQZYkrGUHBZw6+z4PsmoMVyPDaBAk+n8L4o1XmryBUkZfQ2qk\r\nTfqHAUFdnjSirrBXNvYlKiUFIQFtjKyC/C85b5OSA+J+DfzP/OvVOmtwAOeO\r\nNV9LI9+J6TIKXjuEWHRX5XOmN/lSjEf+NnI=\r\n=BSIU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"269e253911a2cb7a30e68e6cc655464598e86b46","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.4-next-2023-01-25.1_1674662652745_0.13921351493460832","host":"s3://npm-registry-packages"}},"0.0.4-next-2023-01-26":{"name":"@dfinity/ledger","version":"0.0.4-next-2023-01-26","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.4-next-2023-01-26","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"45838189c532acba5de716ec535e5644123227eb","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.4-next-2023-01-26.tgz","fileCount":27,"integrity":"sha512-RQQTBXORcXUoJCIvw7VVbWLGCAotjOf2Jde1M8CDa2XF92SbDCsNcD0vdmTsWwoOmPVEP8qYnHK2tmtX0MuXNg==","signatures":[{"sig":"MEYCIQDqhMZuRXolVgZolRde1K05GkJPUopuhONIlgrr64NWHwIhAIfZMCAo1mp8ipUQhx+PuKqiGaKdgbcuRNgsmMxB6jW0","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90780,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj0cVuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqc3A//XWEwTUm1JBhdxezYxqPfuhh+ZgPEaK/Qz0u+CAfw7Mrllwhh\r\nwXIXy+uO74ba86J587b8Ue04FuD4GnwvFJ58QzrnZweAM0x/YNOc2Eiyxj19\r\nNFtLGwz1SKxVDfgUO6Pnxqnpe5MIaFx2vRecabkiN14xAKhnO4z85CyLFXi5\r\n1JnPcg2fxGkz9utvig7Lnqz79iiSuQR6s9C/gdVR9c9VLCSf5dKacs34NpX1\r\nZ1fhHyAEZ7UFJdo/HbTJiekezr5bcq+hkV2xwp5rasYMG9JtO2EZkZ9ivxfH\r\nl3YRZqpwlJa+FKZR1LNcACi49geBREuS7X5JbbZy9Qsqc7wrQYK1lzM62AhT\r\n4ynfYo03ZxXHAhSDojdMLgqK5iBDWcLZIfjg7bfW46kXmUCOKHZNmbvTHF+B\r\nbQisv2BgAL0PMKwcooVYuw+xNuoS84R0qmYegP2w/SpFVYkAWFC9nds+Zbtt\r\nh+TAMQvCRv23mFOQ8x70zN4avSXWAlxmwx3KTyd/hETvtdtFhvzdy6IFnvBd\r\nhcwWeECYfmJ9uYG18xWnaYzJCKaznSuGUuwCZgZu4dtSp2MHy/E0LkjB1vkw\r\nRVLv1ouiglSEX0X8pT01p1OiYDprhDtz9le4uwxgVxBIyUtjcQ3KUf3YG9hV\r\nhZ/Ks7Do8esCMuU/oGGFVIFVrbnmzKUdElQ=\r\n=x7VB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"269e253911a2cb7a30e68e6cc655464598e86b46","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.4-next-2023-01-26_1674691950692_0.45075534415274365","host":"s3://npm-registry-packages"}},"0.0.4-next-2023-01-26.1":{"name":"@dfinity/ledger","version":"0.0.4-next-2023-01-26.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.4-next-2023-01-26.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f535113174cb73cc893888e456a594656794a476","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.4-next-2023-01-26.1.tgz","fileCount":27,"integrity":"sha512-F9sBYqAH/h9juJP/ERX+DTGRCRVgde5ow37+zoNbRC0Obw1acW4oPX/C+8qYSyV2Qc78/0fx/PUc+B3ygxTbMw==","signatures":[{"sig":"MEQCIBPZZAySxBC19VIyxIpooM67ZXd2deHeti3Nz50z+HZTAiAim2OMBek9npxzDnqVXah9zY95xo+MKBWKZgGK1R4irA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90782,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj0oebACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrtqQ//c5AnG2YuJYLbdSN0iLIId745d5SX295+/SLw2jh9bJ4l5l9/\r\nMNDHt7akvbp6tvBx0V5bwKD4RGj8yapo2r29SjZWbDDJcMZFrlKGax+DI3Fc\r\n/E0ZWk9rk5EtaKYEbW2xG+Rm/rqRFeax/d7CrQ0e1rFphZ5uu6Qz0Ow4Z2rs\r\nrSTbU+RYoALtLRNd3t3XILKypxLAwuN5hdHLgGxuh4NhwvIPiNY1VoliU/gP\r\nuuTdIvPvOfXi9IPbhLIfOXNht2ks2+4I+xrLleWseQLRb4eUis2iDYU1YSE+\r\nirwI92ZNxStagko6FOzgCy2qIVjCPgztRjLUkrXuUSWqd9Su8NmprJWbN5ig\r\nxbP/NYG6+dXlsyAZY5Zo8GR6avktN6Bdx0pvKJDZxdg6khIoF0Dlce2ihQzQ\r\nl9jbvtOXk5QVcWIRWD+kt1LNDFozyovU4QwQfQciqLuXXj0hjkeweNODcdOO\r\npj5qCeEo6MyGQctmDLAGP52T2qxFVCIdXgseiHUOS1KBeQeSODWEnjflUMRV\r\nV6R5C+tqAdihwsaZovgxgCyThzzxrOjVlRuCy1X8rOB+Utd/YS78D7bhVrKj\r\ngUr+yKtyv0YjfCQXYo+L2U3IO7GFCr0Xr92Ysp+igFe4qPJmgjBrxoP4NQ9+\r\ngeNQyDYl2KN5RS3KjHZ3CZtRt+O6zGR9Rq0=\r\n=Elva\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"7bff2374689c7890b98ac801e154ff904742bff5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.4-next-2023-01-26.1_1674741659331_0.5549043741439001","host":"s3://npm-registry-packages"}},"0.0.4-next-2023-01-27":{"name":"@dfinity/ledger","version":"0.0.4-next-2023-01-27","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.4-next-2023-01-27","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"ad54e7ba463623229bbc2aea8318ab00da168291","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.4-next-2023-01-27.tgz","fileCount":27,"integrity":"sha512-Ehej46vRrJspL6xLxXpQfpuboiogRxs9WzZxSgXLNkOF2YIFtxBf4O3LNvCjSsc0gasPPjw/R1gldgEhZMlljA==","signatures":[{"sig":"MEUCIQCTC2NnfOK4/k1oxbxHNdqsuMHpaT85eUj3R2Ek2St9agIgEi8an7jioGGIu957TWFHnsZCgs+kOGkB8lnKS4YZ5IU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90780,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj0xb4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpnfhAAhgFDbbcK3DOe+NityvZ62DDL4lxmdRI6ufWjcvQtj+sInGOn\r\nEOx9xjbPqYTzh5/cyQpVCH66xsfu2gaxQ2xrZ9Ek4t4pH3lBcDYOuRTm0NZe\r\nI7mXvpY6vsELCfuXWUBcu6n0wZL8P8jNLfduYjbj9cYlJgO6NzvNih2JGxBo\r\nbSwmNnj4618FaTbo/zGaokd78Fgsz4UDh35+7SZ2oI9GySn4j4U8WUryMWQC\r\nuN31GiQRTWEv90H2yIWhT2aiDtR9q6R+SzpplgItciL5bgjWHK1c3SB8ymkb\r\n4M/j4aZssMMaPzS0owgL8azHvuJOuxvuKfv30JD60Yf3kvdoLOaNOxWGbQXh\r\nDS7zJr0v2Qq5lZ7vZqQ2yM7atgi2MX/gR4iRrSXh4Cyr9ahrFdAjTGpMVC4M\r\neqBGv7xPD2YPchOu/FlTnH53RkPQP9kvHlE8jhMilvyq/DyL8RF3lRyHwsBd\r\nMqU+aCMFv7AEy69g9grKe3PKdbIr6hWxMReZ31UpPqQTQTRD7Qm8NBev3FzY\r\nZ74Nvd7eEK3u4YIfTmNl+Th0eBswTT5t0zfd+o01X3QUK2M6AhFHKqqc4dhS\r\nDP+/4R0oAwdBPqnB/f2Pae1+pbZNN8oc6CPjUMBoL8h06eSB3KgchM/1b5iF\r\ntdl7iFGzJwItqGDV/mwmkajWAnFA2J1Jb+4=\r\n=UUbw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"7bff2374689c7890b98ac801e154ff904742bff5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.4-next-2023-01-27_1674778360689_0.12662010971198612","host":"s3://npm-registry-packages"}},"0.0.4-next-2023-01-28":{"name":"@dfinity/ledger","version":"0.0.4-next-2023-01-28","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.4-next-2023-01-28","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"a9549903b0307435dd3a95b03ce4961f923b68dc","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.4-next-2023-01-28.tgz","fileCount":27,"integrity":"sha512-ekRejn9vSk4YEiZfbK9lroCmWMeTCYud25emYpx8858vc2RjDrVeFqMEYGu+co0ebBmyqeMEp37Xd0AfIsyKQg==","signatures":[{"sig":"MEQCIE3L5PnuDgHL9YaXNvPGHI56E9pJX+dnL/WchY0tS24GAiBR909oP16Q0hYf726gzvXFedZGShej5u/wDw/p9BSHwA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90780,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj1GhCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrs3A//dJuiqzWRYyUPptYxhOEsqZ6lwn9B0zEFg8PllJ7nvXrWDyFq\r\n1suNCVbJa4hBVzUcrLi7i1fAIvsbvwysRx64KcngsqO9qa1sMerSnm+wQHQu\r\nvx92Jtz3dEcm9CIBdPH2b7nNAIjZPxyAlF0n6m9OQ0Yz2dqzw9zCDB9+v20V\r\njtUXzOsDczYHw5MG7NSdRo0rHsuREGxPrXlv6feFseiWryaDvtOW4EtStFzO\r\nZvdgPwAI6FuxpIxM17b3RSRw2DOtzBB9qtqQXbKnaD5Wx9Brorhd9XhU4upz\r\nWN274gcF90gW6bcMTq80nrtJsyIZgxoahC0EDbQZTBgE8n7PXS0A8+fTcUBj\r\nCIHOudGjAcNqLRgg5ZUY14iSvfZWFLfRYN7NyY2RvgLWvvyi6xrds22gTwcC\r\nfEMv1qw2d7p2Hht6fWwO/INArKPlqUD7QrgjhcEqwICCHrRJ+qi5BseUse0I\r\nsuP2ijJoPi/YonGBbweHAnSSauR0dbdD7hXVUPccjDvbFUd6mmiIFxehyN5K\r\nLI5aUDiBagRWtqS9cObq2CfdNwk+941qIEMKwAlSP0tWJrpUFZRMZU2p8YB9\r\n2TG3PAvOsQC8+HOCo74Lma1dRT2L4/g7PerX3EybSvXTN4RPJNdpHlaiHl9c\r\nU0PN1tUFl3BH9jiJJVkoTOz23x9EgWIofpc=\r\n=sTMK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"7bff2374689c7890b98ac801e154ff904742bff5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.4-next-2023-01-28_1674864706690_0.5307056104566648","host":"s3://npm-registry-packages"}},"0.0.4-next-2023-01-28.1":{"name":"@dfinity/ledger","version":"0.0.4-next-2023-01-28.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.4-next-2023-01-28.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"53a715f032cc9f3b498bea95b4f9beccc9b524ce","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.4-next-2023-01-28.1.tgz","fileCount":27,"integrity":"sha512-oslTifGyWDtl87ZLV1Z+N9kayzMkps20xlvJT8hZs5yBsPeNxb9mYsCyi3uZYzrfpz2Fsua9v7nq6is8kdlm7Q==","signatures":[{"sig":"MEQCIChUMZX1kw6dPHQJCgdcBOWBBVxaEfCcO/do39XWs7aKAiA2fUpdmE4Eo3mW00LZHUgXAMv3Mo34tWe5HF6i1oSdzQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90832,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj1Or8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpISw/+OJgAiF5eFeyE09WjR4V5Ih5g4TA825COUl9PSdqzepWEpihB\r\n452R+cCpbRa+7WywQc4LZSAflsqnOWxnuW1JpA02G+F7Ila0js7lAP0DQmdB\r\nRjFELzr7IhbLbeLQ1pFEEpPlzZStbIEJvrSusYqHKRMWvY5RE/sSpTVJiOPJ\r\n/was8KN92WTBcrS7O0KGzwDyF1DPAUdizqtj5ZMuM86GECzo86lGyfN7bJt3\r\nQ3c2TuCu68252VE7pxZepShZ0eCG3Fq6HIRXjYjOAGApBl5noV3LOoKZrJb+\r\nNrpmcQRx8Zo6fc6Sr6Yyl0cKLqjIY+k/gTqgqzKB2aclTRaYvplxY8SEkjGk\r\nn841ox2LaHpvm/kJJN834GsxVA3I5TwIbzTTNRrOWX4ht432FxNlazdvxyIE\r\ntbF/6Ux2P+GxdRY0XLC+YiLZds9Cqram+z0nSLhqZ8mRN73G/6bztni72VwL\r\n6A0a98OsrNv2m8l9hZBnPbwC+hHGTgYdnH2GtlDOFQeLLU7qqkuCyspX0KWw\r\nXj2hBc3YugUSQpSZdojh1aqOJVoCQLa/TvjEwGxEr9/Za3zPNOqI4tY3s3Fn\r\nNslgh8DvDN3DjUHe6tjivamyJR9Y04VCTTrtGQJKHe8r6M8zg6kRW7qrtRIv\r\nRZQqCZwNDRqMdJfDoSvwZn74nsLMuTU51cw=\r\n=znzO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"35c0fab280744b59c2296f366fd75a993eb434a4","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.4-next-2023-01-28.1_1674898172351_0.9919372373153585","host":"s3://npm-registry-packages"}},"0.0.4":{"name":"@dfinity/ledger","version":"0.0.4","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.4","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"50ab827bdd523b0831e37fc952d11d69ceb60cf0","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.4.tgz","fileCount":27,"integrity":"sha512-E0CoDmb08GxyV5cvv/PiiEPSbiJLl8si3Z/jIK8UvKeyIz8WZOhgagHKUMZYBkm2OlB4cC69QkhpqPRwEtz2ew==","signatures":[{"sig":"MEUCIQClNUkkbKxH8ssVJzvPjW9ZIv/lIzJ87Ag/Watg6+bAJQIgS0Pyq12XJxvvRFmqaPfUNWwvL4ZfleZorDeAxIo7dLU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90821,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj1O08ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmql7w/8D7YmrUDc5G704KuZkCZxeW1stgF9sbyvcDv8w1KvDajy6Cdz\r\nIDsa41g9YnX7jQHR8W1l3oA501kZesZgkHUu2LVQNUjCljSPPfbXc+J8foVZ\r\nMLhvyMikvYDK8zzjQblqFtgD/Lt+uqyervHutrWoOOgmAEePrUKEOdJB9UY7\r\nAqdypUOnWHRHsyvVFIaAggF1eWfr1Q2dMKZ1m1fmpl5hQ2J1mIhj5uFjrqkc\r\ntOx5XuVaGN/HbQ424Whh4PaYFf6sXH1/jzqyt/5nASRuf4dd3AvSw6YV+h1A\r\nUNxHDpbOxBhGaigNhdEDlaYIW6cEv0lEuQ9XjGHmViFrUtQeqHrJKuzTLV7Z\r\n1qnwiy6FhaAkT6DQXDsIcfIP7D1z3AegbEML8Nrj0bYlZJIFccGepK57T4Bc\r\nArZXRB+1RbeNl5icQ/A+e8d9biaZgZu97MIzButTb9orYMlXDfTwpFfNkqCP\r\n16JHf/XB40jh6Ej0hye/tTOB+0gorkB1pM8aVEXQnusUp24cUghIoahjD87m\r\nqWA/XOaatP4tbfdmUO/bZNi+FXyaT9u1lk2sq+xibzlEtzx8O1c31eelTT/Z\r\nNv12tn8I3CuRQhikwGTMXLggXyiCasQ2nE01Bk6dQWdIv+fRaGaaT8oMlI7n\r\n0YXx1flEb+7xJ6bVH5Dn+Yhb3TjRFaevjRc=\r\n=LybL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"3205ae6405534133970ba8f62a22c2ff6b8cefb5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/utils":"^0.0.11"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.4_1674898748041_0.013123656348111634","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-01-28":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-01-28","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-01-28","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d6c5ffcb12ff496b11192b5d84bf190ec031e6fa","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-01-28.tgz","fileCount":27,"integrity":"sha512-gceu2V6WUlWMQqLmHmAuqHaxl4DC1+QPXXEYvnAtNP7CKkTdCvzIsSnKvgCFlSWKST1l9fK4WouWkscIGK6GuA==","signatures":[{"sig":"MEYCIQCMbIABByrx1ydEN4iERc3Ft2vqkJ+Op4/yqdLYDHU/4AIhAN+12ytBuS8a7S3swb4KjxQhbbfd+wFN9EQjq+3ap8Iw","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90830,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj1O51ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqxiA//fdnEIYRX1CowRjfJ1OQS6hrRwruWLCCK+0TmrHuVqm5013NE\r\nm2YL5dS8MC07Q4IFldZz6hIwuwZ6JPN58n2hGujou2lvaWjeueTmSGkp1JAz\r\n8f2oBk2oNAaV9gNyJcBaHthmUNnH97rXk9ZstqAWfqG8UA1Q84soGeci1ZGx\r\ncS7BO13bR7VYHrXVcYnTMZgRDjhpcTvAwe2jTJNe/4OdIEnUgheDPxoDnP0v\r\n9nHdbPDP2kSa+/s+J2tgTn/eiCbXBlg9OFcyYQgXg383unuAo1cr83Z90ICZ\r\nMNxJg8ZngTPkeESLi69cv8xA0ls6k86SiTuj02+zQBW/nYSwfMKdbE6Iyr7e\r\n9krrMi/g2Z4uXlAS/OA2glmQlifVtrTipaaC3n9ZwQLu0ihUkp1l6GEw1LCM\r\no3AhD+WZJ2sG4TOhxGMG89uAy8rkUbcYqDQWokCfPGyr+BjD7y8GiSAIsVnl\r\ncIYIV5Miy+/07Zkf3Hkmmi4S2ZXp81H7/2EJtaNaYdtdjg6HgUsTkQ89N131\r\nd2M1Xkr+iFkRsjRz8/rPyo1U9+HrKQLaMU/Hd212yE/TmUsvtGy0LDAsdus9\r\nPAfeT+acrk+7R9Fj/RnL4gn0WpyQMLHT1AOX/0791uuPVx/Y9R//dy7I+wTb\r\nTLx+lACz9VU90PIfcrLLd6F70lKudOVy2AA=\r\n=6y9x\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"7d09bdf2b56b2588653b02abb6606ac30321b79c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-01-28_1674899061763_0.07234700098133451","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-01-28.1":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-01-28.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-01-28.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"001ca4271379f5fa6c78d20b499862157fce1fba","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-01-28.1.tgz","fileCount":27,"integrity":"sha512-33Je8yuLm4MNU02ILMrgzJvut2hWZnVfg4sJLyZJrAiGjvy6cw/5hgfLrAXFyyC14L23apI8BShNZDwgVVMmBw==","signatures":[{"sig":"MEQCIDdsxzwDwOVqYQNyI/+aKc46hmy6dWsVTlVyvtaBEKsIAiAc0btLLnkprSNbdSMb6AlZAwBXDVbK+3igO+3QjY0hsA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90832,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj1QGvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqb7BAAlvhsPss57IhZa4pdyvpt656mjKYYBW4VryyIfcSFV1FcOP+j\r\nZtnJdFNtdjB/O4bIQLo/09C/ZqAb8tWJ7bDs6vzVeXhx/1DzORcgywnYAh8L\r\nXs2Etnb9j1Qhj6XWBVq6hRo7hQtOtZvXI5R0lu/Nlm8k7F08bO5oYI4C2VYV\r\nL67zrOP6vXsa+OhPS3XuPokua0Ff3IEi2NcDWLM15nltllNLkKvEfeTjHTqP\r\n2mzf/CdnBlWXn+qSGzCaQi5+Um2fOWqDvj+2C36pO9Y1Ox4XsWTlExE/YHj1\r\n6dGjpEVLEgM2QSNciIDK54n3pp415UbAJBH25ooPHrk1rhb6+/1blUz+QagD\r\nV8G2rZ9p6A2sxAEdz46igS3O3l37an5eHkNs6TAlr2TEWOfdY4vjPS0Gdjg4\r\n4HptgP4dfCfMYOdFYz60rr4deOFv65xDrnZKqTG0trjXJRCOEXZu7vGaXi7i\r\n5OlDh7hef+B83oMQ3qTqyNKxlyh0Xq77tVGPzkykPdGeLcbRE1tUTa0pecuM\r\noxSBpMcNoGvpx4VM2pCZicoq8HcPgQme9NbGup2UUT82OBTDu4qS46pJof35\r\nac8s2XLupChqtcKWCXKnLG9XJhk9cBxGXqBsnVeCeQ7f6V/Pkprk6qiodoN0\r\nwzS6/vDBvsfv1CUd1yY7i7eqdILJ+HxMRM8=\r\n=JdbZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"fd0efd24c10c8d1a867a762903c45ab1cdeff414","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-01-28.1_1674903983430_0.4466455547815176","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-01-29":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-01-29","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-01-29","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"9a7ddf6652d911d43ce97de3fb788fa4350cc338","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-01-29.tgz","fileCount":27,"integrity":"sha512-CPGfsHpsB5EQo/hIXPDqB7M6k3iiHiaPclq2x8FqZR0Hi+q505GY78V7zpiGbAEsxNfQJASPeQl7rTcBU21/JA==","signatures":[{"sig":"MEUCIETkXFM9cPnI1o5U/3RO+ok+kSmQFPfMLrJI8Hw2n5YWAiEAk+XhSnnU/uT+hH352K3Us/yJdjsiGkjaogTZqCuDr/o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90830,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj1bokACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpr3w//YnLng+k/3Oy1juJS5g1CpFvH8VfPMvyJZ6Kv29TZ7yP0d/Am\r\nKyNEnOQmYdQyvAqJwJC3PUpfMflmYsbtVZ7/B0GCKorSLCreYpCQ7Vqal52d\r\nW1TFdt1j9DUcVL3QW06aljTS8ZNOYzN3M/J1xo10hB1totsHw0uyPCuMEXeD\r\nvv7afkg+mKpuF81A9VNa8oRVaJf59eyYizM07y5QvpqqBef65O26TU2BNnUa\r\nfJ8l35faDk+JoXriWP0crUGyJpc5p1k4y+B3RBAZ/S/KePJCIsYFp7Ka6PbA\r\nDBqzybxmDLSH+FyI6EOXOTmYrRkjgc8G5dmCHiwS0Cr/MjY0UNEE7APg+QVi\r\npFRXGf59cfLHCgbv0YERA3Ap5CRF/6QtGLCVkcVfgsJp4XZew8o9UXZCM+hg\r\nJ1lcrwNADNGbtFuiL6QKAEzwrJgAtCwfm6DchH4g30Dai81qS7lvlLkUvGGi\r\nL8wXvivsiZcGr+pT1QeWiQY2MZyo3z7Umyag8gmZVGVMwD44qmDPh4kcH7Bi\r\ntxShWgse7JZkp+nMHL7bKuIjelZ3Y5gCD0SCLgA2YKEMrFATjjq23AStY6B2\r\nfA0zrqVIQjD6KjpF2OUaFgF6S96GwPPKnVlKgCvbkyLzqrUvbd4xHywUWaB9\r\njm2pLXaaNiaJ7+JqmmT8EvscOAzJmBjpfxI=\r\n=RV1D\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"fd0efd24c10c8d1a867a762903c45ab1cdeff414","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-01-29_1674951204532_0.08857063654738262","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-01-30":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-01-30","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-01-30","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"57dba2513f613eeb101eddd6bb05f8488bba516a","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-01-30.tgz","fileCount":27,"integrity":"sha512-wP/hFGK/jMYU5KgE/3DbR0fPvOKJMOWT9i2sRvcchpjGSrr6lmNoq4EY8+ffjcGofrdyOQjmb/KdKvleFSdzfQ==","signatures":[{"sig":"MEQCIClEjbD7N/tCdhIJrloJ7mKy3O3VXgWDMuwHO91GwGwFAiByaz7ddm/nVSJsDpNmL55viK+m4kU77leJz9Fo+Vqx2A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90830,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj1ws6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrvbA//Q5pUhwpr7z7fAijsRmRdeLHU6wfqceq+RsW1Sr6YNEVJm1B6\r\n5B0nm2jgdblkcar+oWOKNN1RGXZ8fhPSGrtw79i2tAtArLzNRsblIC+EHCuj\r\n6p7UfWUz+DRgwWbZUxAhY3Ez65fK2CAN5N7FMMEFpS6i1/GvNQrakQhP4H+7\r\nZurM7Bmq49q8RyU1kXyzqEKlev5e1YQgMeoOvxqvJzPhJZ8BBqJHbsUcofIz\r\nyWICS9zA27IgPHW28/pZBw91zOTI1Cq8ofpkGWscET6jZPbOMGff4nDrSKEV\r\nSnGJaItu+7ptMVT9a0BelpCSkzBS48KLpfjDa+dMNleV1fortP0+/EyNd5nT\r\n+AAIjFshChQjnSnv9LBBb+6LpPP6jX+QCHLhQYMBIFR6ik/iROJ15mui3VMt\r\nVk66lWEyT8VnFu6PKNsMWC5wuzhV+EXRaD3as9QkPH7KS0xEDqif6vtanV8S\r\nsC/G3ADwQohK7NITbltJw35xX0AIfFtpUp3nqFHP5lrn/y+0kfDmDoQFhFuO\r\nFjIwwPYfVkctrU1pJWFNQGpi81p58Ph+4H1qF5d1j1VTRwgdICsh3rsvyMzB\r\nLv53ujrJvDgfYoiDoaaB9rT2ZA3+r1TXpgYBPB5Texi1tvXZ4YQcEx2KKjsO\r\nyN8J6cy2wZrr5f2SzK+oHYdemficw7p6TuI=\r\n=72GH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"fd0efd24c10c8d1a867a762903c45ab1cdeff414","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-01-30_1675037498219_0.011209425358333913","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-01-30.1":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-01-30.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-01-30.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"9f0ee8455f48572190d73c160775fd744058757a","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-01-30.1.tgz","fileCount":27,"integrity":"sha512-INIm0PVgI7E7cXw1MZs/GwbDEyN7joNMFCASiLxgvN/avTIT8kJxQE8/lrlzDBzqyLeKdy2WK98lCviBdRy9sg==","signatures":[{"sig":"MEUCIQCBppgelRxxTNrVRZwN7Mj1t0coRMKIT1qmCgI5P6t44wIgL54nEmjmu885JV/EeDj61kJYUGkeEDVLFHkiiv0xLfM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90981,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj16d4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmotBw/9EZHIHgsFXXGfoUaHuc26jyiJgO2bNK6PoO3sDXa5K66e/qZG\r\n1TOMGYGECv0+7su8G0LnJVadTgDc+cu/L+Gw/22TxMz9xj2FLXrNhuoD7Rv/\r\n4oLmSbNUPV6/wWnHg+920kO9pumBS0Z8fGHBL2I7DnQ2ENQs5s04TJUIqOQ7\r\nna1/w1OTfCzCSjDN3C5w2s413M5jxHlz9y30jyx0u+esWsm7drbbCsrYEqXY\r\nJ/91V0p56YSBg9lcUPwiRu9npN+DFJtN5djMsV4T5CQrxBZXOda7oD7w185a\r\n4vBHhlkmjjDEDuo9C2IivABQJ2KtDIscHTTyMBbd2+cj1tfwZaOnIkL4deGQ\r\nxb/Km49jJ15SqzhtHosmioRqhOQ76k4vweGnJlmCOqss1VOiE21f0XuqhltP\r\n4QMgyVQdbnpE5YVqxm6l/iJOaTKFrBL3ya9AvGQx4Ompq5yvUmrAbMwOWKqt\r\nR+UqocMRWCKCuVpCdnjXDa0DmvD1zEcL9CA3YV2Ojy8VLGr0jnKAWGjC//CL\r\nZISEWCJWNGYT97ROx2nb2Thxy/dxHlII5Y7cS0BlOVnR8J/QkV3IkL9SYyIi\r\nFyWSciGZXU3KO7pW/4R2K64PZnIkpbGx1aKBlWlCExSFlvaGWHvNGM6fqjAR\r\n/o1g17fo98V5akhKaXin0xrXfsztd5eZofo=\r\n=tePo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"e6726f6f26ed5bb332aa51ddecc32e0ce206b2c0","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-01-30.1_1675077496683_0.622196791504205","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-01-30.2":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-01-30.2","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-01-30.2","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"a04a76817f256f7200d41f741778ec59d0d1af2e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-01-30.2.tgz","fileCount":27,"integrity":"sha512-hGIWKK0dUbfzXiyixv0EGtZtisICVjd0x/ZgFTHLYmRKBBDnN4FOxwbaadAeToHqo0GhOomHS8/z8CzwVfvLgg==","signatures":[{"sig":"MEYCIQCNG+VDJ144stPKcwfq1aNBpHERkDdG+JuwWk1o5XomdAIhAJYsd5SbseE3pGz5i1ezS04ej+hxdBJcRnqSEvv9DSSx","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90981,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj17R9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoXWA/+Id5URigCNAOfoEJeuUndFUpOKzI7V0TsUFoHa6VZg9HxMaJ/\r\nnkVgyg1NNnAaiusbC+T0ABJSXqOjDcpimvDq/xDjUTaDmyUlfmexDEKI7hWs\r\n+qiC0Qkv2QcomP3l863mYJ34WFrP7GGhAuuKUcRXF9d4lb5LQ0t8R5ZsHme3\r\n1Ll+M38XmumRQkdfzUAClh2xFINOc8FaXxJX8OHXqSFqIg7HxafIqZD0allv\r\nHOCdHEXundJd6fGtqmenmw2VIc05yIhQ3spV3oQMkQKDjhzOTnc5NcOJkfiA\r\nImFtPzQy+h3beqCvjxuYq5Wn1RkhkXBtgsG1stsr8eCaOgWcsA0cdcLixeoy\r\n6y+tEuHnwy+0hnxAcXylpBnyKFBWmh4lOfPS40SPIRPzuVN3tBNQkEhFBuce\r\nv1qe3wX3sXjNcKHHk0xJLMasa/VisVPXjKTCHuQg9Mv5gsNLKSgs3OtAjSNp\r\nVEaaPBKPCFgnoxcPw205FqBr78Gb5FerXQ4Avu/Fxv3VSNTddI9+QT+d1QID\r\nB/KwLUG1mtooY3vtCnLmnQuDSkenwJMaCa1+2D1PkJk2srZrpB706HppGkJG\r\n1ZJq9QzhoZiWgPHx1FAE99qshNmHfzKNRdO3FqnNy2i0OosiZOU4SYmx6VPl\r\nVuufnjGmJ0KJfpNcRotEf9o9SWNYRgFhBkg=\r\n=9ZDy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"621fba694b6a490e0bf5977b3614e0de6a27b288","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-01-30.2_1675080829296_0.4452887117037352","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-01-31":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-01-31","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-01-31","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"694656b849fff3a8cb5d4548864e7f7daa250631","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-01-31.tgz","fileCount":27,"integrity":"sha512-uD4LkWsT10cG+voZN2tR/uU7nTxgpFJGXvp7QYKYvyK30YqkrTxFxwtQluIwfI0g+rYbT/VEcz26RBjv006l/Q==","signatures":[{"sig":"MEYCIQCIZ4onSvhHdy757G12KLNIp5jqrOP6ILgReSh1oW3dXwIhAPc1arwh+UvwREdpgP91ofuUZFW+70Fv3kvrRW+gBaT3","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90979,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj2Fz2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqbQhAAi23DZtdXu18aYhELKOqBfYhH7CxyPBT6gqQ2rU+g/1sbfev5\r\nnKjjNNCsYEgMY5KwrG/He0gSFUIIwAAeC4s0RrlFaA0u1GkVhgQXnFR0Vhwy\r\nRw/FZb6QvQKajcnLkPaINhV/8DDAGDtlJxMIgLA/MteB/eqE80k657JqsYnX\r\n2n9x5RGjLBcBwPN9v9G7D4cqGOmKAw+SBLUz4Wm/3l43WQCcC5t3nnVjyff6\r\n4XcEN17Q6Arwg8SIOMwbJUM4f7/ClDXiBHizpS1GqgDxg3xXJL+WL9XtaKty\r\nAMt7QEchlghfCHcTZpG1P+YpVKLbp2iZAPbBaWht2G5l3cJaR0rMRbHh6x9a\r\n1GwuYd6q81xL92HtATT6QWY3jUMq260spbw1rp3k6ajs7XCdi0Rk779Pw8zM\r\nNTC3La5bfoJXyyzC9jsD8V8fe/gFUOAzpmAuWrtJwGDlDGtz14dPZrF/gYEV\r\naMKTtGf6C/5m2cXrANt2tYRl7rXVLpcxWULApwTjPxwdffyeUZHnqHFaufNY\r\nhwRnFVpYjJu+gfrV7m+FDMMBV+MUM7Dq/91pE1Y5ekTgvfSdgWH4Qui9zlvZ\r\nQcWSLbqPANOqe48Iqbldy5tvOjWGAS/YDXx/SAUPexrVKGjam5FyYgr33ILU\r\n+mUbFNN2QiMS/fevyF0MLYe7Ux3gCmB2/es=\r\n=qcjO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"621fba694b6a490e0bf5977b3614e0de6a27b288","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-01-31_1675123958604_0.4767899308418906","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-01-31.1":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-01-31.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-01-31.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"6962368649afff972425bea7ee5f8c8a397e881f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-01-31.1.tgz","fileCount":41,"integrity":"sha512-5YMMaL5uCgrt2nNr3jXCfZnPOkHWK8DtWOcNBC0A7son4TQwnXaOK2JZFOheV+TibRR2/RXoJfhEqscpkEGuXg==","signatures":[{"sig":"MEUCIQDJdFVp05RmiR0wpRm/B+uLHefAVHmyob7KR1amMNYpcQIgcHoakW062xcV3OnAnKdiC6eSIlnsrJZ/0yVxDaxCrLc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131714,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj2QRiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqa6g//UG4g7xLX0sHmLYEOICuBsg78CLJPZpC/B8ppgfX+5vwe14Fc\r\n19goTb6fpHie/UuQGirm7aGElcXoseN07d7Kd5ygKgkfN+MhHJiZRGQI0WAk\r\nc0XOmrSgpS3iADNp3L6ijnKklqP7oE7HqJGPjUPd/kaIFrTPzMQOQX8r5if3\r\nO+iCmQgpdMyjRkPs+H4CH2c2M1CdUK7mCav3BtHyhCJNa2CErlZ7EQbukRks\r\nZCI3noS8lzsBdE6IGPglxTuKBz1e1+NMaePQn/luRnsQ87epZBJTlzoWk0I/\r\noZ7o5f6r8jRqsZ7CZpl0CnYCBbnKlQVrEd+zmRXcpClxQGCuVxW5plsHmhQs\r\n5sgGh9/wcb5BI4ya3RcUsWREUydjKpFrExbs/o6isFdLe8kj281FpGLamYiI\r\nDtQ0RnAqH3Oxlt0QkjYBOnBUdCQyYsJ0iUUc/C3pkRS/Eoo/OqHNjy7L3XiS\r\nJxJ7KCouQxbaSdhX9tQ0FKX2VrbdLNwHdXIT1FlCOyfnCtm8bWfv2Ma0sPdG\r\nqHih2gzt44J9aYFU/qxcAXP4j5rsptduVnX4jPfMiQ2PWFWt2PQn0HP5Kf8p\r\n6JBtMrIUweOA10vJmJaGrAYWtPeOY00r5tLljw+0G4GtIgURN3BX56rlVUef\r\nlNEdMUrtu5UQBoWhTbol2tAuICFHopWuKEw=\r\n=rhm1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"b189627c8f75a496943009d1d01cdc0c0adf408b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-01-31.1_1675166818527_0.17987749062933123","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-02-01":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-02-01","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-02-01","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"ab0d492f97c577520a0eb926ec720da593ea02c8","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-02-01.tgz","fileCount":41,"integrity":"sha512-hOfG5ZrxGPqpSlPRTKD8q1NAp4SSVzCMqCkgm/23Odi+4SabvLqN5ArBFhcAN1HO7iHLlRQTds9AhQey8gLk4A==","signatures":[{"sig":"MEUCIB0GplFNuiF+Z5yPYyW7cLbkYqNXoKNCtIfnLKqibWEVAiEA3ow7MWo90V0tQ4cKVbvGHTqJVBs/T6WoojzuCmi65EA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131712,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj2a59ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpPpQ/+MJZIKZOAGTxGXKjaxsfmsCGDG6TQbVWukBdfIodQyqceQeb3\r\nPAwzIpHcY7+smEpjANUzi2KWkep1bfry/W8Y6lABBqnRN7V1WgjtjgOA0EYo\r\ndvb1B8F2reffj7F8ggga9byz3SEV0EXCLahG31fFBqvxH9Mj7UrSp08uu96X\r\nhynw4obhdPzY1CJoxBYRdsZlMre/IPloetBlLNRjNBD5XnA5XnFPAiZaU/57\r\nWziJMhcQcjvILyBkDKMsIC0sjMYnik6b+eoNDSBvOOsZyiiun5RtoiiC7xvl\r\nPQAfFAAkA9ZR//tKa0nyid0Nmu3//oOAMl0+1a7/qzjdqVlvwVjjdA6YP1+C\r\nKu7kntVU3bBvzevCqbCjPkSNxBFFRGcBs2pubF8xLjU3XmNwL9iBjoPuPnzy\r\nGDwxd1mbDKAe6ljR3PsVQtkn/ysvmg2e/k2WpN0fbG6s6829aN6IYBpSgbQg\r\nWC6PQ52jmPwGjRilxRMdDdNEo23dFxegG7LYliIyZlUfs1o22hkK4/K0881c\r\nPG7jNaqffdySI4RhBV/YJpt8JT43TQqNqiFDCJy62dfffPU6H2kOw2ClBYjX\r\nkVrmpq883YIb+pwJ+VlPMmWC28x4Xc1IGqE48PL96KSa/r6HTY6QcUVx2g0O\r\nPmdNFjjhzYhL5Hfjm41C8HkF/Bcy9xXr1/E=\r\n=21d3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"b189627c8f75a496943009d1d01cdc0c0adf408b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-02-01_1675210364807_0.44455161673294574","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-02-02":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-02-02","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-02-02","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"e24783171d26244184ca5d5df5688e82a9fc060e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-02-02.tgz","fileCount":41,"integrity":"sha512-0QTHI1ncxrnu0wKlHAAHJKNlH99DjIXyRn3SZ/3VpwL49JS/prP6PnSmiGZTOBPUsHdjltzkxiREaVzK9ovhoA==","signatures":[{"sig":"MEUCIQD36HTRjDc/aVd+Bs2ZY45En63RsVr7tHKuV54rjoHhvwIgFAHbGHKcEM/3Rza8vgofh33nJxuytl0CeqLx7QKB1s4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131712,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj2v/dACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqFfxAAkQj6U29U/Hr97Bv2xoMP7x/EPFMcX8qWHQdUxVCpSLtB09tD\r\nDiWhe37HeSCDtgv2++DAvdetOFxZULV80xTg1mf4ggSy9Yw+aXW2wAJonj3d\r\n4ZF8iaj7fSHG6Tx7guboVptVu6sezrc4yEfzuSgJTzU95V+eUfDLtL9uRa6g\r\njledYVbdCiflnY5KedZrgsqwwcn2DyB3rIQDKba127yH13/c0/aCM1iChPal\r\ngZ0ihKn+HHqrumja1b1b6co9mk8QB5j4E7nRfgzSOrzTnTj/kaBMn2inS/K4\r\nbiL9a8KnSxoqq4yA+tucj/oHXGcRELFD9q+cU0pMYXeS+/yhHwNhKPyxdDfj\r\nGaOg+o9KDogXPkbVW0v0AB1y6h6Pn1kgDa4MZ4dbR1fuRhCI6DoO8cjxBN+r\r\nsmqkRKGKMDIu7fa6qprDkGkl/sYs1EVBGabuSKjvWMiWuRzmM5J6bw86vHKW\r\nzh/ap8aZxM1kRyltBSeN1engGnZeHz2AJNjkWBnJ4cDiNJsVCDKAoO2UCnGh\r\nR2TCnQbfgj3Pr+zRyvCFlACi3Rrzzr6qcHmrqfSR8JVrEX6lZk59j6v3CmOa\r\nGvT1+RIQL9RikDPuGAmgmt9bq5bTJq9QKahYUJIWt+4y/Un7m2PFmmggoxDN\r\nQlrQxkdAK3RKFj39sE3qYuWv0pUMmDT84rk=\r\n=LxaZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"b189627c8f75a496943009d1d01cdc0c0adf408b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-02-02_1675296733520_0.4125222865523721","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-02-03":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-02-03","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-02-03","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c9f8d701c2b9f7666275d6efe0b9ca589271ec56","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-02-03.tgz","fileCount":41,"integrity":"sha512-ENISn5oPXPbVLDNiuG8rxLmCcmPjmI3D3H+2hJa4x2zJgrag3cn49mhy861VjgyF6NvcgHqwo9JiegK5HTxf9w==","signatures":[{"sig":"MEQCIEVqhF24s8RUOLU0thlKFfZnGkg1rz6DMFT08IUw/66iAiAxkxpPgLbJUi+9O8Kn8qyAntsGwA6AywX/s9ZAAqAjcQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131712,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj3FE4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpHkhAAm12nHEpIcqRPtGfLoYjNgtr+dSbvzMP1IAEqIANMSIb0To6x\r\n97NjZ+1pPQFN0M/D2sDwg615GUejACjNVIoxjiKhf1TahHmF2oQhGN9FMfGL\r\nSprMcf9NoxP9dg5p/kh6q0Fb9op9QUIbdgsbVCXWq1/sWq/hrFQ0bS1E7rXc\r\nwoa9V5jfuRqmRqPYtHDBGWF0pj2Cw/q+CqSajWKverCaT3CoHgzToCOpf6bY\r\n4XsR6jY685+RlsapiHLBjgmNEnfGDziV7BPDDPFrGDm94JLcwZCrCftwubrS\r\nlL4O62cHt0xSvLjO9ynaLA+OIPnQGDFB/NuRBF70fwa9ujpaT1bjPdqHsWBj\r\nNxi8hnL+3tuhGGqU4/7sLDc695XWgX9Ml73deCmrNOFHIXRqiMACYeo/0zPL\r\n53NZAZBY4Q9LURF/ONya+NJOiOq04koy5HNtA3YqVSJAC+mE9K73jkoOhtru\r\nqXSeDJbVCa0X6yZ9ehRQwrvzaEbjYEZI9q6N9ijRI1tcF4XHq5wOikjzVQrO\r\n/ZEwpIp0guduGR7f5y2ZrnXi92Em9oB3KP7aYM6H+f3B/VlyWr0u9qvEe/Xv\r\nJam8o2RJvU4tf/p2Gv+HnueppoeWDSIU4kiFXXQvE/E8aWvrMVVd0oOPB81T\r\nLNlL9oNRSyqXjF1k/7QY2yrHxgA8AL5QkK4=\r\n=Do31\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"b189627c8f75a496943009d1d01cdc0c0adf408b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-02-03_1675383096572_0.6625187690473067","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-02-04":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-02-04","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-02-04","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"40169aec10e4f483843cc695ba3c98f88a9f9180","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-02-04.tgz","fileCount":41,"integrity":"sha512-VgH/2uojWKsNT67dfo2rf5TUm0s2FsBvAhfb10KXF+0ptoGNh2Ss9lgr0t357aXqVFcLz9Fta867uX0Xa8a++g==","signatures":[{"sig":"MEUCIQDryugyfHkRQZYIldZipef4Xn+MEDHTLVKdxZlEzi0FsQIgdyfD+S/Ie8uCGTVbtzs7FiQaJX2RQvBqvEzb0EaoDng=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131712,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj3aKnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrSVw//WOni1P0pof4S6zlCVtoS36n+yov7KQ4jcocRo2eVMZz9+gCa\r\nn9oHZFLHq8Y5OTkQNFr7wlohaOXkFEzJqiJiXPlUB9t0UqX5UCXwFaNwW4O/\r\ngepkZH2S7DDShCZyQ9iBE/61qqP7VTO17TZC+Kx16DYpsD6eBA0W/hqT3Ds+\r\nNWcpyHVF1a7XDZj4hm3bkfXFI9blLkXyFKIWxLAExeyYXxD4KluxsX3f7+DW\r\nLb2juyUUj8ZadzZwYgAVjMR8FCJQCYTnMxg9T1ArNlhaTQnqhYZA/zystYXs\r\n9ApGTFKJ3A0O85/b77JhCY6bcIzqaXgxGdYEHg9sElKhCoKaTmfpVTD/hUnb\r\nNypU2Tor0hk7zArLYiGgBMlUaFlD3wsPH/7JsqtWGowHHxdmNJIgIFqfEp3s\r\ntErioyh5+yaJul1FM+c8C8psGT8mehFq+xQku24smhgSBSk67MpyqlOMsI7t\r\nsfqFnmHN6ED8em0azYaO/zO158//Kz9nryiPLtARpOrFyZPYNc/fWRWh2jr2\r\nRUqnIoCGqQJH0hnAOsfBFlhEc4guShu3moMfSWEhA8JT6CXK4hIUBmUhedn9\r\nTFyenIVY+yj8EByDunpRc6opZzyXiDyXWNPgwzkOtGT6odsKQCGMN4DWD1sb\r\nj/VtKo3o/mvuCxhlioQSHLtmtXziS4EawRY=\r\n=KPIn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"b189627c8f75a496943009d1d01cdc0c0adf408b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-02-04_1675469478793_0.45440369854907825","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-02-05":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-02-05","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-02-05","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"2d6ce2777fc9e14adb81a21c4d7af7f118e45b70","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-02-05.tgz","fileCount":41,"integrity":"sha512-4svS0YjTHMi651L4nkyKJ+uNylr/hUVfFURWZtF1m1B2yPQXla+e+TmooV3jP0T07iw7gOaY72UFKIYXYKImEQ==","signatures":[{"sig":"MEQCIF0w2qxd2lDyqW/fOaV2/LbG1RDdCAJ7s5jwm4zxAC1WAiATnkbfmMgYP/oSR3UfQYs5OW4obreYGXbIVp5gw9Y5VQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131712,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj3vRqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrT6w/8DlRciarxbYBhRbzGf00+zusDeY8NPuiqMv3ZpSanY6LgyhLr\r\nvUmoytwEyEWwbcov1hiOSw8BiXjRMG38kbrip9mhm6DQSiUnS0NVhO8gugaL\r\nhXXeZeD0q7u83RbAldUargI4sR7I0nzcDT+JRZfmICW+ltZe8aR/yRdrmCBV\r\nxYsdCFXw8l+oNpnPovEnV65VKF9nw+nc3wGy/yYb+Onn6BlzyCksyVYz0P4y\r\n3+5h9fOfZ5ksovMtOI4q/ajwu2txpEEYD8A8AT01XpVJDUlf/uDuQPYmnjcR\r\nw4GVsFBemqPrrbvKw7yHH5lGOeUK2pVj2xRgqWqIs9W0RjZgYSvgo2u2EhlB\r\nWsep1X9ca6aD9CAY3LrlW+qFra6cmLBPm+ikdvRr6fmoAbqh82ZtqhdA3aza\r\nsHzwQ+F9+EdszSJllBMXp3i/1B1KAGpYhrEWgDX2R44Qpl7NDKkxUs4WIGi9\r\nJ14633sX5KvCnQ8QrNgo8w70fFletcNWdqfhrf+dKkp/VNitR6ni81IiLgxD\r\n6yXhPfc1SDVnWXMqCgmDKLw0HmU9WtRpjtvAX1VaFCVlMoEgxFvdnOQ10l7x\r\na6bP4SAGxq3JGR2Ft4QjuIRWgQd0yOewhSmH+hb092t6RPw6uuNiG4+oIkfl\r\nJAXUsRQrqYz92YPNboh3rGX24XxDDIN7HpQ=\r\n=/jXi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"b189627c8f75a496943009d1d01cdc0c0adf408b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-02-05_1675555946644_0.37455612595923937","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-02-06":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-02-06","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-02-06","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"95afa59a10fdcb31aece8178af2b1b885e5ea7ed","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-02-06.tgz","fileCount":41,"integrity":"sha512-9+CspTLAUjgGS1qsXM3TbVZrfwHSwqFm5yPFvPSqDDCcpNSTCq+VdoQGv+Ky/aq6DoG06lYgdmT+Y8PW6JBQ4A==","signatures":[{"sig":"MEYCIQCA9ChtYbuOSD6Wpvik+Y++YAyAjQVs6M6V4JlygKll4AIhAKssb+6BM9+FlsGSo9reji1A9W6LfDF17Eaig6E92ngx","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131712,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4EXEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqfSBAAoWgINukLL4mgCKdPPAMYf8fwBWSnXcTcEV3jaVplD82IkIgU\r\nsilrFcQjmLpCcpVjWKWU+qvLNRN/vwP7Cvr1/AAzeot8sLqGE+wRu4OaZ3ks\r\nDlksOCrYzvn3a2YAbGw3unMum3Qf6OjXcvB78BPnrqKHQgwdJh9F2etmn5AX\r\n6CSrB+ZtwXXe5LH6iOQIu/oO5Wz9kQZefOezh3Z0qyw2WIdMKkfyT9l75pg7\r\n0zKZRs4JIDCdafXBwV/A96aCBPY7IjjEO7VYrR9bagZ7sfgrPzbplAtvXRj+\r\nhtM3cFVpZKOrO1y+IGj24NNv+TDitbBQhdrYXXlHzJgMXh2uoUaVknVYwLtT\r\nHHekSXAf4cgJb3VXpb82dvEuEXS6BOsm52OCcSQPPfyYQN+t+DDcKYrk5Wjg\r\naN6sstm71DfcH3KTrEA05fcPQi4TzBkNOUhuITkkQgXTPsLGCWPWSkFn2svL\r\nPmJQI7qDSVnz0ILwxZ+JkEGYocl94/D5wydku6SOCY51/6uU2ELnqfY0OfXk\r\nV4ciPOfqD+edykp38nIJBCTbPTk4Acr5Nn275ZqN7MT930CzdqUmoHWiNDqQ\r\nT8di55lsHUqIepJaBNDXyOXYgz3CqyiqY7Gd6b3a4bqttpM3xBOflzCMOkeH\r\n7A+HYb5quFeOwCvjUyKVqL+284B41a/Wozo=\r\n=4jTU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"b189627c8f75a496943009d1d01cdc0c0adf408b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-02-06_1675642308043_0.39622314842608763","host":"s3://npm-registry-packages"}},"0.0.5-next-2023-02-07":{"name":"@dfinity/ledger","version":"0.0.5-next-2023-02-07","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5-next-2023-02-07","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c0556b262e8e844944d632b7184acb706d64d283","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5-next-2023-02-07.tgz","fileCount":41,"integrity":"sha512-moJBmB6JjBrdUsu0X/eAUThMM6TAjh8heqx+U8qE/2LAkt6Sw31VKyKA+XQCDBu8WGScM5CS8dme8It+mR/PlQ==","signatures":[{"sig":"MEUCIA2JEQehuw7XZ6HtNsvxox3cbiRE4JI+uQK6dfCVSOi2AiEA2Noy602UDMOog5NMclmgIxIGmXh8lcKh0CCDelKXRQY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131712,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4ZdZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp60g/+KH9GkQclNOYuxujj20g2JUXNsQNGwlLBjrI70DMGuZfhG7Tu\r\nkMc6et+whF9jZ/xIUAD4Fw5XhEs/zyC58FtLrDKnYs0YjSNEsjl8GBCVhVQ4\r\nF4uy0gE//6F+Y6mvEE1UhkYrjKjfbc3Mf/yv8fmr8WXXjOKfrv2JL1xbtZHy\r\nKvSRcWR+GVXhu57Zn53hyCq1IYz+VInLRsijQo2meZNfPsVZVUT2ju1+DVNH\r\nyPiI5+BIODBlbKJ9XP6V6SYsP3Hgl8rkHJ2Nyia9GiAFAebXE7xZs36SA//f\r\njYljGgPxJ++pMQh/J7vZ2eCUUas5unMEh6LRN2lzw2r/JIGJi0X1Lfr6hjKg\r\nOuHofuT2eiHKshzFB238u4wjMe1RRMdUyylHjG+zbsu8yheT4d6Xq7oNUOYn\r\nsB8UPJ9n+AMamarchMkS5VhzsdHOySA/+YrIB9JEqBAQyeFtZPLBIKabtVwZ\r\nJBMxu0NZf1V8CMjXHA5s30yzfb5wXF3N7lWzfF90YeAn24zSl6bCI1OCtor1\r\naW06Ez4qsx4WsGTLGY7o0E+EtqZTv5uNmx5Ouq/beO2e+2Pqtpn9YwbIV/Q2\r\nbPFvdLdFMYMZ32tkQS/NfKFjgEajahwKGVEJe2e9M759UbqffYAiQC7NRSMl\r\nlcaXpOqyMUnytFbWZZ5XPCeJzhO/zQgX37o=\r\n=Ll2a\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"b189627c8f75a496943009d1d01cdc0c0adf408b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/cmc"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5-next-2023-02-07_1675728729311_0.3067795812600793","host":"s3://npm-registry-packages"}},"0.0.5":{"name":"@dfinity/ledger","version":"0.0.5","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.5","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d94adc808e8c80a3c35974a77a79dc9322d768ed","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.5.tgz","fileCount":41,"integrity":"sha512-Yb7dsX+8unwtFPyqIZK+Ioz+llINuwtXKud1l9tCfUdrqQcuEG705+FokY4d2KidoMR1Ti7AmcI1oEEP9AXsiA==","signatures":[{"sig":"MEYCIQDtW1QJam0EEiDEJ5MlPGhOI0Emk+8py8Ok/TcEFyMVxgIhAN1+vBECNMYe+ixofO7fCAloRZ6oklp/XpoxVOwA456T","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131706,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4g/zACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpdOw/+IyoPZyQFo+Jn7zayghG7agC0/41iHMgUqC43rIlb2xWW2wDX\r\n9/UFZMGuIjvJ6ua/1va0DPuEMU5Oupja1lrNfdzP1yK5OYWzxPmfK5dZzSkP\r\nEcmNBweldaBOtvZtYUswGwMCAi7g03m6ZQOoJWAzih/HvX46w8x7KMhfXqLI\r\nxEtV2pWY0bt467uEV3uLeCiKRT8qxgBLqJpDQnoDC2Dy0jSVRdGPbHoNdMCY\r\nuy2dK0JhSiMxRhxrccFoQ23Yp2mCdou62L/ht0TrevHpvWMW49gWPAum5FK6\r\nJ1c//iZI67IpJvs6GlvK158Hj7d3zw9kIxrv7l1+FEAiw1gRMDv640PgBl+M\r\nCdUzBaehfG0ZXdaBEpZS1r1GnWd/abHXjlCmN1ORgCCiY1O8lcCM8MAWKp8G\r\nolXfQv8ejaTM5DVhZPFwR72bmz20vmQPp9VzCd5A+y8NTS/JGIcPZCL1Tu4j\r\nb76wLRj5zwWwZ1RLtzdDWqJR+pDyntILMxvvIBU5NM1WmKR1LN5qz2ULVO9o\r\nvkO0AkeoT3kz3iqwwDOc0XNr2AQnuoTtX7AmEx0n2G64wsd/vSzNYHqd61U8\r\nEV8Xt8k0TKd9ykh2JXzarqo147eVkdGhwapyR3UfZjPkBrrhrtBdC6EDQB6z\r\nzbeufPpaMLqalyXqwdPmoBNrBDq0FYHPoYc=\r\n=bhFu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"6adc46bc561c801c1362bd7cddb0027d35e095d7","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/utils":"^0.0.12"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.5_1675759603708_0.03315539545017665","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-07":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-07","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-07","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"110ad69e31473aa55a401a16395c828a8c29f6f1","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-07.tgz","fileCount":41,"integrity":"sha512-sIFElw7B3z9dG2Tw+oxVFabj56HxoA3yS/MfoHrpgSmySXbKOqho690Vp52u/USBAVyrYB68eesJ6Tr5xllHeg==","signatures":[{"sig":"MEYCIQC+eIMOuAAGvbaV+z53xckqlZWsspxA1Onin9jUQ+faYQIhAKVVXxLa2zVrvScuVhPUbYAV63Rk9V13/0e0Z5J0KMgb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131715,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4hQ9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrfvhAAk8QQ4Mmq2Lqfwa5DvnFcWw6aNlsrarf5FW4YEEgb6a76zIXL\r\neOn3uNF5Nv2uKhcWbfOh+dhUudQHIE7fodJSHABQ0SZdadvKvtaYm7BX1LPe\r\n0bxrbZPCTz2tLv1I8Lj1V4bp1rdgR1f6ClsRvZXd4S7f6Drc3lQruZ9tHNOM\r\n/NFuMsCW+dTbHuoFIl63ovo0EybWINhTmhDBVKM7wcvWZqAjjrtEOyUOrihs\r\nS83p9L5gNs+cP4GggcyzoT+Cw36xmWcKqchuncLsgZyrtlM9E+OfN5jPMOd7\r\nYB3w2OoP+8t622y3Uqyflaf3ob6TP+UGq8eMq1r4JdUP/SooeZZ/gp74dclG\r\nuKA9iDqIVLx9rUbSkfLdNWa0zL+6JRyUv+B1bOETPOpZJp06Go/U3YyAqplA\r\nUNciepmKSVyou0ReLlMkRM/fgTiK2XHQzgGIlqkqtEB2ZMOoqrkWLyj5TZN1\r\nkzM7y/z8RnDrWcskO/OvkZVr5wgB3yjEhguc2Vz8gUns0icNm0Mt3oN4uRtk\r\nXYynURtvBBcmfEslHNfDzYlPcN9sRNGUCqAl6HTYA+bD0hz0ZyeGuAWYU8BN\r\nmXalM6XCFXKEEMS09r8otq5S4yCT8rHlt9Qjwg0Myh4kMBx+J8gafP5eBDc8\r\n+99PYiLT8N9o/OTplNS85kpHwN7z+SkSg7I=\r\n=+VxV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"4879f17a2ed62ec9b24a45cac4d39c5a32e8de7e","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-07_1675760700768_0.5060866200294374","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-07.1":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-07.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-07.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"1fca880bfabbf25eb1a10249f4d694c620882816","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-07.1.tgz","fileCount":41,"integrity":"sha512-mbQzoT0OVTYxx47D5emg1Tr72NkwJA8/2YtABk/03RKLewQ+ZAxn+3SRXMQXCRwrj/3q8tWWP/q++Gd0TFlx+w==","signatures":[{"sig":"MEYCIQDyH8evozO0aa3YLtpvkREoK9/gmVcwO6lEn5KW1v1rKwIhAOEJwsIWunglHmKnBC2tUYp/q51l0Rh9SkILJR7uUWxl","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131717,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4lWoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoecw//TpJssz350EDQhYJQ0/MEeiy1I/x4zJ8SVkWztFFxixNyMCS1\r\nVMt/ud1jcY/Nx4aahGSCFrlkUYv9ZbQA6xxUnZGjVBGVDwv1N2/c2bSK7pym\r\nsWzkIdaJQ8AUg4N5mvHVPbFfjVC9m182jQ8HlXhCJaTQITseNJ6kOq3zflE4\r\nbR62IHgB+b2anasxHaF7vf/g/5SWN7auUHUs3ysCyer6P4RAyhpMAO9QzFGX\r\nmQhZ485T9hmDWnSc0msypIIHHRMF+bZhmFQ+trVkHaOK2RaKZ+//6Ky4U2pV\r\nUoYE1dHucb4xtql0mVbsDeUnKOw9tU7jJX+kA68FpcfiDLa9ImXD4mkCVfrz\r\nC3b4ZjMLDFkkbyqmQrLl29cFEC7k83kVjWRq1OUHWethkVTOhAHr2gGOWC2G\r\nJ36neEuasy7irpA4bXDXPqvkS4l8afreWSrznJtcffWsYZqdYJT1IlSUQNDX\r\nVTQaZl+n0IVi/81KpIefLTkCU4TiXy2UHEO7HTDx+/kJmsCrvkZEp8ysNsOc\r\neHz8jPm3IZn2jab/7zuwP0PJBY1z8mVxN+3e+ebrZdGpnXiwXAgPSJyNfN12\r\nFxXXrWu/uYQXwrP8pgFeWBXzZDPa9rINLAJuv074brwqXmITQztrQ5cBAyes\r\n5JSsWTEFBGysxJ6RuW1bvukKviAp9ikP+uY=\r\n=p6oK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"65d17606bf3b572fede484c76c37e901ca6dca42","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-07.1_1675777447928_0.955272595651744","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-08":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-08","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-08","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"7858339136f86cc0b5c2cfcdc0bdc696b7e07746","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-08.tgz","fileCount":41,"integrity":"sha512-7d/9ywv/CCDhIrs8OoJLKuuTAvtVPH0hklq/PsY8KlszPW+p3uvH8C+UqzqVp1ThMjw/Te1C+nwSu8D9oMXFUQ==","signatures":[{"sig":"MEUCIFWnZ9BKuMLYetd7z89MTohu7FIZYE9sfWysdTo/MTnIAiEArDunQjpSxSG5szMbYim5QVQppx15RG/hL73SfqSLh+4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131715,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4ujhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmorWQ//TiS8ofLrYKjr7IMHDuQoONP+Ex8mVKhikccc7FfijSeTyWzb\r\nk0rCrnB/yJUAYKV/qBkGWi7vAanpiGNfzZ/Yy2P0rDXJjqqyrVfPDABGvEmz\r\nSX5HFaFnsYGILwKHObM4bFkjE8MSTM3WJq82E2GnM84/dqtVVRQ2YeGSMg4o\r\nffOynBX35lpv3wprLkJtrfV6nqakV3JFqFjADCJC20oEyhkyFIqq10TgPlDi\r\nDOWYxUffRmdTz6ATIkA63Omp3LT5Tzz4nKjeOPNo4j8y4389ik2PBFE/8dja\r\nZ6zGvqfP9G5cmrZfORfIGgPNRBGZ9Q4JVPxU00aD0GqeoQGcEg0DSMpVwPB0\r\n5MTWGVeQenNjsjTApKIuo3AYxa+6oKdo4qQhNoscNazxWij/fwXlLJbWS+2I\r\n9IBR65HJ9sgy+mbUB1H1uua25qUiQzmEiJttbW58Kp5H/S2m2I+cK93ChgtC\r\n48gDYKzvC5IJVvKo+eSnj10hzk2rjCSp5vR3xyiBAXIOi9fRvBhO72T5FZjQ\r\nx9sDssqwkX8NxEEdI5dusgZbL9iunPcac0g9ltU+jbR8BNXSUBdWsCc0/CuE\r\n+6syzhVDeGBTa5tWom5cSVYAJKQtWqTvZtFTs8P7h+r3k73p4qxiG0cONhMX\r\n8JuJyW0m9VHofAHblfU7fVh0yszem8ntar4=\r\n=NfXl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"65d17606bf3b572fede484c76c37e901ca6dca42","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-08_1675815137031_0.022631835407486367","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-08.1":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-08.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-08.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"804c3774c090b6ba9ae3da5936ec3476fe6bd00b","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-08.1.tgz","fileCount":41,"integrity":"sha512-grCJPEJq1dbCr/t1Yp5g8Ba2VZqCWogypowXzz1hoT4OMNv7D0mOSLiBildUdf6Of9Xj+3VuALGTJj5yfAWayQ==","signatures":[{"sig":"MEUCIDWMqhsHlacpaE2LHlF6pv7QIV0BSL6IzyFH6kjFtFrGAiEAybv6fHSdrMIVkRS03KsFNtXtVQBc9nDapDpZ/f2zdgE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131717,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4zhjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmociw/+Oy8qJYF/DoiGvf1ebfastseuTDlDxw6lr9xpo4byjQSmZ/FT\r\nkTT9cCxlamUsKoZhfTeQAx6RyFlxx30W9UQHmzc6ufJpR65KD8f3JLPoEtmd\r\nwWbk/zpKbPhcQGmJPTkdlZHCBQLx3/TFdO1zZdYJOHQwfvT0laBMB9O1cRgP\r\nikDjo3jR+87oNoAoeWFjbrT/gLi8N20jZFyAeXUC6yuf8ZznOXWnivlhCTSJ\r\n65cKmzfLEHscavnpCokCNOvX/JlEqPIdV5CDwF6z35vFv9D2pA7MQZQ5YVvh\r\nA2DHCRg6FD0hKL6jzhQOf/of+A/jnWB70t0W8cIHr+OdIgiXYZgU/dIcDnwd\r\nBvfmgVmk4IV68CRlqF1B5Rm5VwUACPyyg32QhE96HAn2/KG+sDev+YhO+IeH\r\nuNkS71mfCBOULem+6sGEJqnWhfWHEwQGrNGZ6tS/mvg5O9ZgfJtbQvIZ5tJ6\r\n4qUSf1eBnAflM54yk+LFIiDMabyeTk706zHpLnxxeEKrnQIKYT0/A1xH7bus\r\nuw2AeaFvH+4QMs1f8E8rsDY2zdl6qP4qdnAutQ6HoO/0bDoZYfNVL3uC2MEV\r\nEVYHUFQnm5CO/1ZVr9nmO0d/vxw2X4AQM6/U8LMyX1nH+6Tn+nOnr6WHNNxx\r\nmK/JSjyDW49o3PdKQRv5k/u6gLPt/8pMDEY=\r\n=9XIx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"65e0271b2fcacb1c8074a0ff20b4bc05f23936ac","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-08.1_1675835491220_0.2838321572128668","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-09":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-09","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-09","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"6d82953e57f2a00a02ef91fdd4fc5ae57f6c0fa8","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-09.tgz","fileCount":41,"integrity":"sha512-E7Ztomw+om0q+FlseRm8JzsfZ2Xuluxxgm7nA1YyB9B4TG+mfPSxHMADDHAsYK5qvPz+B477+DZrXUIToVYvmg==","signatures":[{"sig":"MEYCIQDEfaaC/CCxlK2TGxJBkwCN8mzH1AUZdNb4Q8JyyDkY+AIhAJ+O5obWziquT/Wq6JVPETubPFmS189NQxnQwhPHNy1M","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131715,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5DpXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrdOw/+LG7w4taVY0bXINJ5TJ+fScMqCxzaei1vY6lYR2w6d3NgvXT4\r\ncS2uGjFm9HOSqd46qK9+x04dOxQQR5opo0XJ410DkI8obNV5UGamqL2EPlL0\r\n1a2DrysUV6lYcvdFBJSXKgUmKUz4rgHRSt8jH+79+k9W93961NjMkj8ekQWN\r\nsxfBxCeKdawta/um2jOe9c+b+x3Xy2oiIU6dTfGTyDtgbeXeb5KXbCWKvgLy\r\njo4ShJqfwfVZFsDF8IKiyFOsm24bfq+Jn8Z7jz+/6FYa76x1u95e0BZqPeAr\r\nwsP2HJIrvjExmYmqZopIgHl9csL/a5JxrMFxBQ5QS3iwaYX9t8DVy4PZILdD\r\n8xx92aHnQCAN0lcjiO0YemMQ0dqCgTporoU9jcPIfYy/e90n38IYOHmsNhLc\r\nk3ywRdLK+heQG3q/Vi4iBGLMldEXWN4lJFOp5GfsPJFZ0YBoYt7/xc552cED\r\nwiBT5UkY1VzU+svPdZ3XjouZBHLqlgUN3ffGX/uMJI+aIDsl6mu5cbVjzORV\r\nWSbE74rJJLXj1oFOyBMqyUdFOfO3wJFPJpN4tnjd6zVx/EJqtiBoY14vNZyB\r\nw/dxiSu3iyz7/C5u9tYxxrObUt8f+nUHQ4aCZvNyvAseMP/flaPyR08xNsxM\r\nfVZF/y9vPPdUnTtQuWcztJgDCq6XjMriOPc=\r\n=bJI3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"65e0271b2fcacb1c8074a0ff20b4bc05f23936ac","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-09_1675901527490_0.12122975349783749","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-10":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-10","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-10","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"5472e310d8ce70d34244f82dc325e3e8f14fd5fb","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-10.tgz","fileCount":41,"integrity":"sha512-g+IFEHjJkC6aiJORLuwdQQx2TD6wW6TSq8p+x6VSlB0m5yOnSNdyCByL4yw7vrYMnWcxCM3XdUXdhXJMYeSntw==","signatures":[{"sig":"MEUCIGLOQkjUwzjKOIYcpJNMqjEmCqATfuA/Enq/19AA1+q1AiEApUKxbEgqsINg909L0HPLCmVekJwx7hcsI0eLEyyYOIs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131715,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5YvnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoXyQ//cX5Qk7aW0zXH6ycuAcUZaW9eIPm25ZSiIEiEW3V6TpJpbDWx\r\nCa5x/tgZnkTh/JO+p5J0V1KTdHMWQNAiVHENJKfDU3wzwmudkiQo0HRRx05+\r\nuEuTF69J4rs+s2kIHp2xIS8RIlVdMd/o3iP9N1PgpPX3Crd+yyIdgXO1hUe4\r\nIsccLocNiPWw1FzoWotMF3EJe/jLj4WnGcB1bE7ylKPbtlBxIDNnbQBYIIHF\r\nGrxUZnb1gF/MOhvtcAr0dmG/4b2SxvNhvEqtlORcWeA10RekFmCqmPJlDptj\r\nugiVbjG4GScsjmMW3XYtUQJAQ/BXMX8GCPE3j1XrhwOTHt/qwYZGDbbkAaI6\r\n1ZPORYlapIIG5nLAnkqD21AV1gCbvXc1t62+953qc3ifWvq+8JHiXDD3Kjk0\r\nr2VLSayqq1Fzj+TDCR5r72C40EHvQSgqE0CZkd1EpQLVTaO4wnEM44z4wUpz\r\nFOcHV8J5ZylTHngndC4dmomktbH8znHDA/iXcVHHX5CjdUYciLEBm12VPwfH\r\nwJxn/T7MHzlktDeEfvCHIQgXPyd9rbJyR8SWhKYR/QJEuJwtgdnQBYzpW/fg\r\nYII+G+UCC+g9i62tQv8iZwx6stM5GECKGWLX8HGMCxweJqW8L/PxbaBEl81H\r\nK9oXIGqivAlWCjpc6kGX3MDlpYyUL+FdUPU=\r\n=Ey5i\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"7f4c41545e6535f455ab00a948ad147cf470f1d3","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-10_1675987943262_0.5539735084300501","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-11":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-11","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-11","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"367eca4858c976a141dd46ac534da32d5e18317f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-11.tgz","fileCount":41,"integrity":"sha512-OYnIS0xHOomHq7UcXueMk7ER0W4ZqQSgzs+skd4ZV5QOdgTqgDorLpSwxDq2IDVRbAoB1fVPFhengjxX9QCX6Q==","signatures":[{"sig":"MEUCIA2wK7Am7IsS4hEgGe4X2aSy19OJk2tpMcqoyCa3s7+iAiEA92l0fQcbSAPq/CO+HUFOtlsyNvPH99ZauLJTeJOKfIc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131715,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5t0nACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpY9RAAlxiv+2TnEqGie2MTwx5T9hVt4u6q9DIXON2HYnSMlj5RfcWW\r\nT2SkrU8TGnZGZOy9AqvebCiMN/DUMDCyXZ7ZzIO26YYYc3h9hG7nDa8A8j1H\r\nzmGK63P3yiZU4+erHcrf3BIv3SKBImgPqEFMM0tUlFMLFIh2L98Jt6F3+lxh\r\nDW0f7n3Dzt68kI9DbmSApE51TuxVYDzare5A8E2PnmD/kqmdkHl572wIXemD\r\nBRXfhIl0eAmMKVrLl7SbJQgk2QfwwKPjeCfX3Wi0MpBO1l6a3nMlrE38POub\r\nrX4/YUYZIxlI8VOEa6wRQ+aCzQIcCdKROmisYHkYn/gP/ePLsiG8VOW86fBg\r\nSpsQgG1pYUvb2ixG6/gCN3iCYcOMJZe6iBeMwd1g+NCLq0nAHuyrSkSanEo1\r\n4lsqUu2MVYqfatXhUu1ad/HyMAmvXooYWwwgSS5IhtOCckPrMzDoYrOJWxLE\r\nB2menY+bpRCtY5N5wOuMdO7EQp5TkuxpdDefProfFxmrZ7dHIeq4pzX8/vF7\r\nZUbeu+YM1/iMGzup4phSbv5gAnsxW3R9ZferkHEwjVnKjLrSKcyooBlfBcRU\r\nGYNe6RYf+dzDsxcEB2a2GRmHX7uj3XZili+Q7gDYcsdBlEKzr4l/GP7PXCsR\r\nSeJAzn8+QC6hQzMkAMP12exXRM871P9Tb5I=\r\n=LL1X\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"7f4c41545e6535f455ab00a948ad147cf470f1d3","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-11_1676074278796_0.16930870799827336","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-12":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-12","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-12","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"851b9cb763154fbf038d09c5a2b25d22289ec6aa","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-12.tgz","fileCount":41,"integrity":"sha512-p3UuZKDvvXdyquy6r/UR9GUgnvy/9gC6/y1um3JQIpKBkR6yE4w+McyvFzzdUxLHlZI9HUr+pSe4oRKiLGFg3g==","signatures":[{"sig":"MEYCIQDs4T2fptd9/MjASNYlr8H7f0pABmg+fwN1WyD2EAaD2wIhAOfah7WLllD9YJuA1RKC+afDD4AKvPF8fvsSHfXfnugp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131715,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj6C8JACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpZrhAAgG8qz3J8dNbB34xFGEBA/bS470dpagWKhmK9lC+SYSjd4uMH\r\nkTFM3j/TEgfbX9WnA2eobe1RnFCJ6E6+/Ot7HRaCi8uS+2vxGrk2nlC5AddY\r\nrOpXAZhJfZflhBPksyV/iqg6HMPv0sUUKdmWVosIQPEVNu/DZr2A9Md6DQbJ\r\n4VMzSgTsuBVOK//EDKqBT0FKJ0m0MCZdrcp0zxHlENQYSddmFd7CfUtU25v0\r\n1kOjQlBGPAHvnhrjwZeAU7TNsVx3TcG/2vvQW3Jk3XqKFcZh2Ey036YXqfTl\r\n+txyI/EGTSjeu16dH06SQe7Gv8ykdTlG0yVwAS+/Fmj+wn0jEqlP2w2ASvi5\r\nR9QwmlCb1TKT+cVTMs/bhzXGQ+/vm7rM88gNPGDoFDujkX7jW7va7iv6Ot2d\r\nhgZzu48jf4SEKcGaZtoks5VMI7v8f/TidRDccvlN+YMInCCQj7O/3ZSuBlSE\r\nbJyQ2K66hzssakHQfBjZtibMSsjkuwl0wY6ZTxPE6vpwDohrVKipRgKsGO02\r\nNEk0OaxXYd7t7RJNr+JVy5n+3onN91pPZloDd+RIsYOuv2GyYG9WmMu8eeNb\r\nGNaUEsg6dsWrJagtW3ZCPY8W721OwfjMe9yRr7ABv3z5E5SWbjDRaF3OIQtd\r\ntCOVhd5SYhXozwAn/O1gg/IZuPjIijEeyLg=\r\n=LFFw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"7f4c41545e6535f455ab00a948ad147cf470f1d3","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-12_1676160776996_0.38995710788812254","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-13":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-13","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-13","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"12ec815afb0a74b6a27e5bda592689e21aa76592","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-13.tgz","fileCount":41,"integrity":"sha512-AeBAI2CmCFjZZ4IxPe0cPhqBHl7QG4Xj2EdhuNCtVsxvBeFwejnWY+cOePDfXOyRjfeFI1N4MQ/DRJA/Vjn4Dw==","signatures":[{"sig":"MEUCIGOf0aTHZ+hANninMmksbX/zMrKV9rYUNWahwH4roRmSAiEAxs8DTXn4JH8lH+Pmmp3bVIuhxInj1ZBAHh1xQzjJDV0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131715,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj6YBmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrZOQ//U9Hx1ZeWtoeIxy++lFCdFgLIv6JfwsVebBLGN5SoJaBTy0pe\r\nlZnigdqvAopQRIb7d4XqM040OFpXMaDwxK5ydQNC9q6Ew8m+SwyIwaSA9jU1\r\neoQFo4JzkhwgUDUmJtTv/75VWd/AXlwz6xtKdN6FsGkC2PUFVUn+y0E6M1SH\r\nlqlL1fLkj6P4srQLSFBtg0kZgqky0ASEbsfjolSZI9u1cwYezsqxh/Jg1YkM\r\n9wFwVTjF1HtnzgxO8MTx7TISTYAUeUc2Vjly4Nh73N/lMNEjR6P03qkppozV\r\nYjm8wFYA1f6LcQIOslHXgNEvDzqBQf0m0Hkvn6fbIf0TU3sZcuV03ru1nZKf\r\njJoIGA2AjNTSzZ07LURts2511NWNxdpKxMZcGSlbp1uHfM8tvVZDSSJzgzpq\r\noW648fw+Yai2peB6q+s/gOgC4U6xok+czoodInL83e2lS+UtdVPHrmj7HxdG\r\nASRRZvrRt2KxPe54ZM6q6eHlxMjFxHSgkl1KBnYglqdgwntcxov0H0u1DLIw\r\n3OZshushsvbXaaMQW7ewEpDONzaGyeXO/mlRXeQOwKOuIcvD2B5uFYFdeUlF\r\nu5uqp8ZeVuc44A8O/x2Hm9dWGCSj9qTUtqQxz8gNKb9MdmY3kSdxhoEhhfTW\r\nbC8jmMfTrq7pajRpfvj8UdX9hF3Y1sTcF3M=\r\n=+GQq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"22d962c4d1cf9fc22ebaf21f811784dc71e1a233","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-13_1676247141898_0.4482538887759657","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-13.1":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-13.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-13.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c94724a895ec011e5bd20ac73096f45c9f3c010f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-13.1.tgz","fileCount":41,"integrity":"sha512-ufQicOXgBUlStC0hqEJos5vkJ+Po7VhW8W5ElrATP76PY9I2Ic8hCetfKT0AYkeY3GaeLzNG/gTaebiTtAMTgw==","signatures":[{"sig":"MEUCIQCjQdwX3A0nBRvm/ZQTqvwNP3lN+swQjK89u4ZHM2VwTQIgeLe3gSi16hkkg/rXhBjmNJF5by5H3PiNrdvSm40rQCI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131717,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj6giuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpT7A/9FArKq9KKHMwc2/3k/8hW2jQ9outonCtmhxrQU7RQHekAkfSG\r\neFvHy6rn9kSI+vQf5NOFSoC3QW8qbb1ybFhhn9aBMRa4jYTMgXGpowginxBu\r\nwDvmJwKSMUUtjBot30BAREGh6VKgQ3Nv9o+Ef1ecNc56fAp+OMtwazczcvr8\r\nfCk3w3z8OapvGneB7sfjc8Ahn8wHPYjp8mubHEy5iETvRaJNz9Tq4n7htNjW\r\nvxpM+tyOOaVwrm8Pn9cT1ZXrzOFHdDqR+7y/jZNXaanLnI+7duXvvEP/uJbP\r\na5+Smi2yD2fXeU7rvF3UwYoCAI5Y4YazP8Yu7mstd4At7ZbMgp2+/zhp8zmC\r\ns+XDH4Eey69qQI6ar4AeUQ+oTEqcrZtjzzkJZ6rVFxL9NHMi1upAfl150Ooo\r\nbRwqGZ2Xn6UlAjFTJ6TqadL7Mc7A78vZ4+kdf8a6Rp2JsNt1cSyeKjC1zEux\r\ngpZsH/Cmifp+oKYq6LONpjNn1IRQGKnPBT0zpG4ai4mcwcFYzkglVcdNdqae\r\n51pZ1pjvWCFR3htrekorscZcj+A+ybC2cVacL3/os+qwUexpCF3E5NT0kTx/\r\nxxPB2+CL29Do1f36fyYvAlEZBAWYBQYwucw/DhW2ehUbe2s2z2ypZOYyn83f\r\nvRpiVYsW8ecHkYJgnb/xaqPkHNhN7zPWER0=\r\n=lMyY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n","gitHead":"f48f964da4c63adf5099ec062138085b19a92f02","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-13.1_1676282030649_0.6934855364261729","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-13.2":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-13.2","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-13.2","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"be9dc5bdb8d33005f4e3d7801ebb805228f34c30","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-13.2.tgz","fileCount":41,"integrity":"sha512-Tl1rzgFobDqaNMoC4TzS3sQzLUc6u06JFISZ3tyLEVQpXe7UbZ8JRIJAhVAP5W+7Ib0TNsXGYnfDmbOUZCnsHA==","signatures":[{"sig":"MEUCIQCthpcDcx6gj5PrEd5R+PDZBIXNEWa+lWj0Eazj9tYz/wIgBuOKAfFDgwWtQSVdO1zLl71Nh4StrG81dLhl/E4iwUs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131799,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj6hJaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrCvg//QGlAvLk/Kw7/qHcJ68EPLuXfuzV5J+76yIYzNTHpBl0XiXqs\r\n/+lJ2TnNnZtVT3PqvEAZ+JHZzLi7B2x+PniXPhhWKERk0nJSCF+nvV3sJrfa\r\n8WxbadY1G78lSgpCihr07wbRiAYFWnYjMNI5t9l22CZf68GD5fXeKYcOgZmn\r\nWf3WC5uchjfODscfoKoo/mh0wPZ1gVX4q7bKea9W/cyZ5C0gHPEpNqeVxXtG\r\nyMHn6SQtRkBRtb0Pwg0QoYs+a35bYKHtvKDRKeGqkbHlFJCmdyn1PGWhTckV\r\n7JkeqVNcjXP5NPbEr2uDIv2ipRKLMn3EtmdCCE/Upq5Stc21gQobUW210HfD\r\nQUdsnGv6ppIFX9m2kwYyNwst6RSiikBAIijcec6QdRwIi9o7ITArVJDUBxf5\r\nVgQpUN6n8UlT4xCQRdvbx6GPFRLolAfslsCRW2jrAuOG+MjlQ3F6U/X/vpKd\r\nHq6/8PCnZPuSgKZ9riRqYbMn3/WIKouZGCRQ/AuJnEHlkusmbWSDulbQAbk9\r\nNWoJnQgjQdBZ5vVNuDKHKP7k71ZNc5ZT/GMHxOaKv87rv3kYKVDw4FardaYf\r\neuSpKECBGMiLuCxCHprzvUnMT8xCSy4b18NUFKb+GgM/39TsvsxrkuJr6Wyv\r\nCqd7FJW4Iw608MvAirz0XWofp35Ax3MNMxI=\r\n=SxoX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d775fc093b4caa26402271512582c1f8047a8cb5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-13.2_1676284506086_0.8462835588655726","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-13.3":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-13.3","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-13.3","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"cab191c90abe0ef6c522183524ce18f6d1a0dcca","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-13.3.tgz","fileCount":41,"integrity":"sha512-jvVaXuUinXKLardnl7+w8jy/z0LeieP5Fsbg3+aRg0SCq9tl2J/syf6xhUtTJCKg6Hm5/5XIIxrno7vvZDldww==","signatures":[{"sig":"MEUCIFIQFuo5bUPJsDDnd3shT/ivvQg9gxALo1uViTIqek49AiEAjdn1PfJkGIHWbmlutVrBBiazlococz+Dq2b1mKHS5hA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131799,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj6m/CACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrwxg//apHTZQswvr1g4SekVdyyixfXLNtiOPlVnnJyjy+dGNpWt6Az\r\nAlOII/8elk7ROb0VbhhCLaFOQEGuxNgaSq2W5+Aj6d2GPjQYliKcN35GdXXq\r\notOajLuFrLuowo83LvtpRdOsFBsQ6NwllC1r6CIdKRqPQ5+8CtIj27CBVQ2O\r\nqeDZCD6+qa6xfpUo5N7/SQ93EyRufzbLnSuxMaO5YAPh1z1wDbZT+6ckMkA0\r\nZ8HpF+AigmNHDVgSO2J+ivrFA4OPlfudX+7YxNeVgDW7auPYnDMpRl+xidCs\r\ntWD8wrUaHlpVlkL1Qr+oj1KLRH6g1Y9J4l2uY66223kPHB/nBoEXIKzCpR8K\r\ngRfcMQ3CJOqirDfzln/MPmayz1iXmT+Uk4Qa4mmiLKsLuo9F9hnHqsp//+HS\r\n54AcJYaohl+IpBcQKmga4BmRYybmKBitqqVt1GhlI1SjL3Rg0BQn3Tuyc5UI\r\nocxwesOuKD3p2efo6BptfbHvoxi0NjfdHbzqpnW7YvyeB8VsclUPBboe1OeV\r\ncku2YByNooq/98oIRfyBBHMCmtP9vn650pwsNTSeCqP9m3GC4WECy1y46w+G\r\nMIIDv8zNw2hu7ftln7GvBHEoWpjQ5pftBuuQJ+7k0QWiF6gpiMfzOUp9wVfT\r\n3CxLqQzQEMAlVqR8yxGwur78bCyCXvwYmI4=\r\n=RQIG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f0cf6bc090a96b3900d6e4aa100d44d5b03df7f3","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-13.3_1676308418278_0.2765575007048138","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-14":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-14","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-14","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"282b78f2ae59631afb83752db7e94e4b6b5604d7","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-14.tgz","fileCount":41,"integrity":"sha512-n4k8MAYygPkw2q9vQGwJyBrSc1mrqYEnX7LdVEv3QTf2hvFoOkxpo/HC6IuC8sOEajDgzfQ03INhtqIEZe/ifg==","signatures":[{"sig":"MEUCIBS85MKLTI8V9DKTowDeB+etRAqGKKRDNnoat/I5Pf9cAiEAsR4cPKMyKwvJrzM9JLg9QekCibd+VSTPouWUT2E83vw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131797,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj6tIOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmotgA//ZK6db4mpEKtQX1aClGVCQLk6jCMRvJ35tNDlNZ0SeKPU1/+x\r\nfuUpjzy2hGPpk31UgvDaws+ahrsDJWVyQi1rcyZaH1y5AiCi0MTNuoitt5nu\r\nbBxzsnDzuVOmLc7EDFt/xWXnjmAinCBN6MXggFkp6v7Shy8rbJOjVZ3QkKAl\r\nvOHq2BGsHcz6hnrvwu57QEuqgfAYIOW5gS0Ek4jrF0NoSNIdf4BKL21X5M1I\r\n8PHYlYRq7b6ARBSpNg7AtDsKPzxkwQUPIxR+AOPBzEavzTGVdlXOv/kFzU+X\r\n8W86fZH4BNtzBFzIDwUGy6VKsqxCI726rEx7F1trq3bdSXd6KNFGroJefstq\r\nAPpauFe9bCX9vTdF0ohjG9ZqKj8N98MPyiWm3EzYmMyurnUAGLAFvOxauIY6\r\nUL+Zm6b+/KvxD8dOmQI8D/B1V5PxqyPYV1uR/SIdMEFYL9IVYgVxmD8KyOx9\r\nmeO1FbCQ0iLJMtlQyFUo3cqa2cooIsR7M+RoEjv4h43+QFJdxDysll1Lohrw\r\nXbVRPxKWERyvA8B2NOtah1QKTsukd7on2BhZN5o7CwvsmA/0/pp39GVd6Rvj\r\nq2vV1z84ANwbWmF4/EpCbMxm/suBhjfznVdb8tnS/gWXv/PdZsOxW077cTky\r\n/GEL4pSKyd5KednPuWRdgoxNj7JuJZ4bH84=\r\n=E4ST\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f0cf6bc090a96b3900d6e4aa100d44d5b03df7f3","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-14_1676333582013_0.3546853744283691","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-14.1":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-14.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-14.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"7895471ce20f50941d99d89954ae6e8abf1e45fa","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-14.1.tgz","fileCount":41,"integrity":"sha512-TQ9orKDpI8AzL+uErm9afdBjXtaWXTtVFASnAiCDHG6VsJEoxOP480iKjJox8EvFAbXuQHIzcoVVGBQBGe1S/Q==","signatures":[{"sig":"MEQCIFO3MPRXWp93YcSocqacnoW8QGRtP7ucP5XdfpHddQx9AiAK4q6u+wNUV3ef2ZFkBLtcOh3QtX91mdpkvK5LaAlVXA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131799,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj6yPIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpiUBAAkGyiB07YHaNRlbKhukYe3wJB9N140lT2cNLp2er2e+rfkqKr\r\nKkSiEE187DP8buqyC8g17OMOyxPmoe3/fXxRs5d1KAdVruHuB7wEm0TRIxHR\r\nELq5Gn3SOfNV7IQnFzHuQ3HMKAzGerqElLw6+XaX8msj2J6O/FWNPVyFmYhK\r\nPzL1L6r6YPvK4KsTuIM6T3NiD68TxsUU03JBKC9ZvdIOkFCpHmSC1ldnGYhe\r\nXbGfx6aTIYhAyx8y1f/322BQAPwJ0Y7V1VIP81bGekUMROSp72InPNN+lAH4\r\n4Ys2a/XCE5X0nRxKrjJGB3aCU3YQD3HJ0b07XABwL+4ZdRVxEDdFyDBkDCW+\r\n0kOMosFjYQlootQ6UM4TVqJdpby7LGJ22y5loQugjr9NjipdSR1d1jT9AMn2\r\nAkhwXlqhfNiDjNsyfop+KmmrfZtRZVtfUcQpVGjhHNublT37F1QSEK03cRAm\r\n84MqI00FwxBVTav3AEMzmDZjHe5rKBqiFtGKYLRgs55alUZNiNS1LSpJe1DE\r\nCYrPv9I7RwQFyGYpURedd3EYS8Vz8wB80KdL74OXc2YXVLbCckmxt8XCpC79\r\n7CrUPSRf8ZcLTAeifUO8s3aoVGPAR1nxSfVBelH2NhTkH+Sf3cP3t48MSZuH\r\nrVstw0O+wMCWL92taHT1oy6pDEv66PMTqus=\r\n=5pLa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"25d4d5d61bf4ccdf970330057a29ebb619035aab","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-14.1_1676354504620_0.2951842991293223","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-14.2":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-14.2","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-14.2","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"16bb9ba0c1c2bb0915367e212f8f5744f1d669c3","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-14.2.tgz","fileCount":41,"integrity":"sha512-iaZWDr3+UV5OjAGHldIvu9oCCVUCFda9pdZSvJncPiLspkfjrV+IujlfQnGSlVHH65FXRD8RaDfB9mCKlz19qg==","signatures":[{"sig":"MEYCIQD2NYNLJidJC/1rfSiK02w05ZSqvIfHEia2zu3GJWu1fAIhAM1vhphnNdHHmaGxjOv51lrMKF7KgGkQK4s+6JOpml0Q","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131799,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj64NmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDwhAAmw0/RqCXliSpsEUriZczCCJh0g+tXzG8cr0LQMIdUKYy9wzW\r\ncojk+z1sSMWVuOdTuzLGUevLC71fqakJKF+gBvS36B6lsJNViv8ALXmM1yWD\r\n340lMg/dV5aKXdQKHGqFbIn2nX8QYHAFWm+tvZwvJCIym2EV95JclJm+WeB9\r\nwAskL1t5MQQsbEKy0QbPv7GUei0wHE53Auw1scyP3ZtPLTsLpHwBm6RKzqsz\r\nTPf3eHdNw8qiZIM3F80CoEy9OMIf9YHJ6Rh3fwAMyYrDd6RECxcf4QijkFj4\r\nkJJt3eLIiS1fdKYiAWpdXeY1b3hNdYXt5XXPgDrYg6Aunv2jkQUxzA0dh0hX\r\nbbkCq6M2bgkPCpd9y1tOGfcYyEQ5rZH+DVbzKuwWzZT6tV/o+uobmUahIj0b\r\nRdksvarblV1h3BCtcEjEq6guJlMmvdR0f3s0VHrDqf6v9zgy9gf0HBYzsSCd\r\n7cTVIDSVaXYd59C/630wuVhYqlBgXrL8CuanTjkQ8HJoU7vwu7flhiyj6yJM\r\nVYHIMmHwCpj9zlLNYaoAMC7dFKsVKLs6NffNL2TrgwMaejdtIyrANcbJFR0U\r\nBqRpSxuMp9RkaQSxlu0xFHNb5W6nYGFyTBZamdHKEAevgbBLF62vj6kNYyXl\r\nD4kODZWprLoYT/qUa9OkjIR/b+zYnWI+PhU=\r\n=8oOd\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"221c94e7ca2528fa427ca4d0d429a88995609094","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-14.2_1676378981947_0.3935380124727421","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-15":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-15","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-15","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"75d5210f2a8857972f1809639449afba3970277f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-15.tgz","fileCount":41,"integrity":"sha512-C8vGwEh6Jqiztdc8bj2DU5HKyA5Dj7+Y9thshYmXOYP1YKTW0T0DAfVGUbG1fN8bxenYOM3ut436UR54lLveUQ==","signatures":[{"sig":"MEQCIDAFoKUSK4Gp/yutE8zoDEVIa7/ze/v34G9H0qshQ8DBAiAurDE1uREaHoAcspGDhjQIjB+4QDaeL458oq8Idt8Nxw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131797,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj7CNwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo66Q//WLe+dsvKa8pFX8TY2jdPj+sQ6HegFJb4RxTKhf0Bp7Jkxzpt\r\nbqOx5IkdltPJr9p1H2AvxwALqxdF+n77N+kFlhxhjTX4qG/AuRSO0c88FS30\r\nOVATxoiATS/A63Wddq06rTU5TyhqSuJlLQgeuoLgjTKDbrbQtKwEksjl5EOV\r\nF94GqELx3TB0MkX7xy8Vgs9IYtTyJ1D29zfmTrPwa2Av2g9IPNlqdBrkirB/\r\naADJMFGrWxlzp6/rjJAaiKFnUp6c1gS7BEaojuSdU5j2IpgWs8c08k3jZ8fp\r\nOlTmn0fU+iXHdUmR7awUvlBGax2Ua4b0d03hp8bxox8LnI2hq9WLFC5qunOY\r\nmYDPd8wpkV+ypn3G8ExPY8PO0+NM2T080xpjhOb3SoEI72bugnC89GR3//sH\r\nmqfkiG2DKb94Ms3Sbnw4rn3o1AdFBBT5S2Lfgw68xBuO5Q2+s2tdy3dsARIi\r\nGoAoVZC1ki4sahmz3la1DphuUWfeVEURBXolSjX7LvQi6oMtKlcFUqa+yaln\r\nzriX2AhvBZeHPSSF1mFOyZqrLbK7nOH6ywiHlvvy267mJPiKGM98/K+3FjXo\r\ncKZPRi8DE0cyZlzNnuJ4TMizesTJTw9Qcc3usNly8VHKPmis6888B949B9Sf\r\nfITG7CK1driaezDlx+qZrrlEoyQ3LkgdkrQ=\r\n=ZxWc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"221c94e7ca2528fa427ca4d0d429a88995609094","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-15_1676419951895_0.7704044757932629","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-15.1":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-15.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-15.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"04903a070b2d8fa4c31fe181cd65e9c510adae06","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-15.1.tgz","fileCount":41,"integrity":"sha512-wkYe4R+KzTe0yJcHU7yQ5K0/mT4EJjaBmIIUC03SVzX0ZvDlELM5zEfJo0MJSGPG0ky4+cYu4x4M/qvKAJ0WKg==","signatures":[{"sig":"MEUCIA4Nkfy1IRfm0HsamlNg9tcdirbf1jXuuI4PYxmrKhLKAiEAgqoPuEkl4UD0LkYxZn3O5AdRqIlHpi9Bfu5px56w7og=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131799,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj7M0AACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmodQg//b+U8JQ5SwZMPrdNiaw3NzuRr8olmal9l0MYyZKQ9dgjP4u7v\r\nKAhy7e8r1joQmj116IILOp07ZR2zAoBZGxFySQ0itv8hwi/j2mir/MYXmXL6\r\nntqJLNq+IPaLUKBsuL3roM1ED5fWPf1zS1nOJnnihtIdL0qNptL3pW9m9UUR\r\nxHKRTSmW44/yCaSiOSP5caCBT3ehl4csx6/3NiUjn6u6bOzdxigEpVX5bT0C\r\nbbcReDmUZZuAfE9fpryyK5amCrBxOzel56zaDKZvBgDsJSNy5+td7f6K2YJP\r\nR3y2fFfP5il1AVV25freBZ9DRbbjTGKv5Hr7DKyd8deUdbgyrLOj2227ilwa\r\n2z2JDPgu6JLRGgFiEb/d0T8QNg17+c9bwgZCSQqBd5d6VSjyUky1CXxaMIbN\r\nLb+fZdGUBHyWbdt877EVL5usKyF8NXWdQgWLxq+Fg/gGxI94KUdtBbhFe1sQ\r\nsaDK2lPGjkLukLsRW86HL3a7D55fR9mfOsejyR5vf1PC+KaiyWKnimDvfWFv\r\n5GCA5o+JA+GpQG7Yn/mMZMF4GSzMxng4F3AjnroQ+pTW1l2pqbRO5WMO8qxc\r\npfaUMsGYYZ7P0TOgDHZlnLU+pnfvr31+kNVBp05WbM5/oJqYLU9ABzpQDGoU\r\nFVChG7Cr4XZq8vt73x/ta3aCEcj9mS2IC/8=\r\n=Fnt9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"cb101ebecfed4273b46ca209e6f77f7b0c263c12","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-15.1_1676463360128_0.6363893450233093","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-16":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-16","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-16","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"af23bf8c7a0df0870aebefd8beb9c53b4e2fbf58","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-16.tgz","fileCount":41,"integrity":"sha512-cOSzgJ3QgTsCMqowZHF6j0ryuUeejDqoEwU6VdoIRSAtl+XRqYjKUt298EpzauKm7SAqTOi2wVPM1NaoIcWcig==","signatures":[{"sig":"MEUCID9YfDUTGRaz42dwb7TtxmeDEil78Mrz8ZjLmIWcvtkcAiEAx267bG1B9yDBtls89NT96vEnI/T0eXzM506fjIJhJMg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131797,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj7XTaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqncQ//eeIFQ4KMtWMtuOmiMZHSR3c4BSCqVB3feyL8W6qOJfaSpmAe\r\nJlWkJdb64Npyt9k30RCbO1jARreoHpylJb4gPIdmmgI6U3NZqO6EZo0aLHd1\r\ntXMRs+fYtJrPDm/PNqU7t05JYftpKwUMYYzgavaH19PlOigmUdlm8ZQ4VRXe\r\ny0LfKeE4/teONBpxAXPMJOAdx/Mfj+QWzlngeMD91rQBusDa1NAqCJD1gY+W\r\nxLDKlIs4gC3GyvCjC1MI4q6Gv/nsS9YsZVfEEEk+9Bt4k4OcPflakMzGXJZv\r\nBN4JrkN7Bgj/+tpe68BL8HOqP9Rh5a3KHPAyNTi1MdFVLSHrrujFrS0YUJbm\r\n/1otNvHFBEz4o3tTryF0adAPPJA0stNTLYxffevrHC6xcgb5yPoXoeG5H4N+\r\ncuIxUn4qkSCKtttuJa9bdHa0kck3YHiTsMrTwZw+qskyWcvP03bNDCYM5oZB\r\nmnvNtJsqWyso5dicArA/kncSLH1KbOQtQKVly7pyYXWA2TDCfQ5QSMA+uokE\r\nosbibL0wKPW6/MnEv6no7IakfYQPOxcU3mwrKmXQENUKhtFn2Qj/mO5CPlyn\r\np9tUsjJmAUh+DAxsz+ZRhP95MvYnb095JFPcb7StVRIu+nAAFrq6P62JRaqH\r\nFDrCSE5p0RQfy+GYCIXmT4jHQ+R0e6+HdSA=\r\n=29vR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"cb101ebecfed4273b46ca209e6f77f7b0c263c12","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-16_1676506330450_0.6052647220634901","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-17":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-17","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-17","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c342259854567db8f34727ab13bd621729cd189e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-17.tgz","fileCount":41,"integrity":"sha512-EpO5nfqKgkDSAzesa4XZpC6JLasSCKB3MNrJGu9U5+6mXGUE/3xPFeMncI66N1bjFIuyRqmcfVCPf0KJN4YJCw==","signatures":[{"sig":"MEUCIQC1gQtS72ht4FFUwWSGdAhVwSEic0e5hp/69CrUOpvBLAIgOZ4wpXQb0CxVFqkGm0xgLfcsFMsqlyQZgmw99rIeXgk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131797,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj7saaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrIdRAAlzjWHd7jco/DRJjk8tsGS7e5WoDYprC7OOWUR5vBDGpKLOzo\r\nR/+Ep+ukpYsyJZesd8Ld/JK7jZ59bj83eTvAnF8+GLU+J3MItW3mOCs+/wEo\r\nvHZPjE9PVvT9EvCv7K1cPzs9O9JocPs1c6iLmj0GX3OPxCHAtWxR1Bakp0pS\r\nF7OGGN1YxMO6VaWPeHLU2jdjsXoLEYPz03FpQmXefWFNNv0b5vVHrWbOfREv\r\nIMa0XCFEsC4Gc7sXKp4YqH9GLn6nyXymvu8TCUz5HWfgmC5Z3lLjYdReG5ce\r\n/V0wsZJu4odptuJQ/3KjAs2bV6pB/rLEztbCoEE3uXXuzBVmFnLBAsLk9kr6\r\n0N/zPQzylTUPqygI2kasLwxvSYb9ziezPNfwvPoDFlKdSbGW2wW1HAmkJLej\r\nbCaH9hJwksqfAvBXVb4Wk6oRLLuCkSjtiNQMz4iPAq1dS6Pu1e2xzKY61LHP\r\nRkAqsUDrceN4Y1NDtewJRaF9bCoGmlZoAUxDUhtt9up19DcGqoK4eHk0L4cA\r\nGdSSFPPBZk1eqM0odJKK36Iw55TeLjtxTBkWgm99HNKQRqWMQpXZDlM7UUTs\r\nCdN2IYu4Ss+0xclyK0L2d9bVUlY3qqyuuhO4gOLHimNvc/PP18k5ogYP7DrB\r\n4lOmIvJ2UQZWDMQe4ISuZHdaQBR43JMqSMg=\r\n=oTVM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f29548f3d0fe7ded6f2468a1ccbeb65b316fbb8f","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-17_1676592793858_0.3360906220918445","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-18":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-18","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-18","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"9f1cac63292da7e2c114c52a484cfb0f69050197","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-18.tgz","fileCount":41,"integrity":"sha512-KNeRsj5IVRYdg72xf1+osAbcZd0A47JUTktyU5naAF8LLbqOLhGOnIfybBA47BiojZV4rSvdBz21wbh5iRBSsw==","signatures":[{"sig":"MEYCIQDLmZT3n4X1nXuzD6YE2h0waErmOvgfr5EYGy8R0t1XeAIhALjvdAgwhxCuk2/BfhzZbeekEu6rO7M28gn8+6grOyz3","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131797,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj8BfMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoG8w/+M9U0yD3NCmZ4bUPsbGMD06g0MMFK1N/swa6n1bQGDxaZxwOC\r\n8N0UfYRlCpqJzSp42MQl9tYQALPOkmv+rI4mQSzOkXBk0MYPBFSqsLfuq71n\r\nJ3abvMhGYP0W8vSQQi7vy2CFxFYX5MQ7Z+/Vf/w/m65YHBSfPoBju+CKaQbB\r\nQbghsK+2yj3fPftW1fYkanriLe6dckzv/M3Vm/G/Qt3DoqMhCwo6II+p7qQB\r\nW8LbX91OeSX8Rf54msAv4fFEqd0xuDJzHO52ZzaEzT24yMm/E0ZGUVG3Wh5n\r\noFOqe1xJ1+XS+88bmubQ3wnhQQ3XouDmBaEbbf2VXIf8VIQhYrOfEe7awv3t\r\nPFIuZg0WpfP2ggjF7Aqc2AGT2ksjSCY4KmJ0UiSZW0TEkmFIyOzIYPHozF5T\r\nyIIQmb/tpVNcY/HHhnVcAv3SEz1aK1wi+tTtHpOY6OOqRvhR3pjOtxOwkbCK\r\npc35vHogzeCRLz3QrlWxZ0u5X7omtc9bBU33jfos+524XKTPdb+vCwF0nExb\r\ndQ8by3pEGurT9wD4fhcTFTvPL99XTWantsodkE9LdQfH4da7LD5qGR+r3njn\r\niJMleWKrHSukbM4CukvsirWULsgFfU+x1jj+momBZGg3O5hbE5PqlVpUI+3k\r\n0LHK2v7Ze8BLAAdmqnn1i6N4CRaTrX12aus=\r\n=aQ1r\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f29548f3d0fe7ded6f2468a1ccbeb65b316fbb8f","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"8.19.3","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"16.19.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/utils":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-18_1676679116115_0.48588611616149624","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-19":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-19","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-19","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f17ed67edaa8740e73657401aacdcec898debfe6","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-19.tgz","fileCount":41,"integrity":"sha512-v7Kee16br+6v9bawNHyMKya0KHl7otteqoN1CeKR7VoVZ7/9J0GujjWIuyDRuHIM35FnnyZ15w6ueOyVsCfjdA==","signatures":[{"sig":"MEUCIEpaB08tKoxFHiduqyZIEkpwdFMmA+oG5NA+MyLE03ltAiEAnAUHyLxwaIv3bD3RkfRNJCB5apBZbh77km7sozGrl68=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj8WmVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmozkw/9EyOXNntt+vF6ypFJ5UdtS1jQZDNdzSpnah5p1zHo0xTqLDw5\r\nNXFxzWXLWLb3Ctboha80kGR5ij//NoM4I4Y1AemnM5hy4gtPokeKK5a177CZ\r\n2jBilfgQ4apYOagXUdQU9K0K17fiXezH5uhaoXxaqMaBFEnM53T8tsR6PZuX\r\nKJN3LcDL3YI9Zx1j4uYFPAK91e9POI8yUlBz3LoKztFt8fOI0b3o6mGEeQ0R\r\nMZBeZUGyiHUhcdgLmotNrpKIzZPaN6giDtmpN5YqG8REY6JcicZwmXOpo+Yf\r\ngpmPWrDyKAw+VqRaZVjhJCerRabMYIBzx6IicxMxZ7xbCxcMaOYuXM95GMWm\r\n4KpGYJpRSIqYMGelRaxgI/tLVhOs9k0W/vAy7KyZK7jks5fFDDJZBkT2FqM5\r\nv4s/yWtziq1dJxOcL6WbbPTN+OvRtGK29zRytZOd7EunbfcwdFyNnsOQv4O5\r\nE8ITS+wstNg8Kb5XcxhIG5mUu+0Qxe04Ab2RlZNvafMUqvA9Ecog96SLzYEv\r\nPbDuByy/cVqz56wQp6yUy8ovDcPITe1z7LHAaLYR2bwFhiz9qBXDCb71Ky+M\r\nzCGWMpG+X3RxdgT/1X8bh8eXzpanrgaskpZP/RQSCJqF3CGPgpL+IeE1of/2\r\nggHkIgsvf2fPGAfy6+sTyl5aMrIuwgdIQks=\r\n=HOe2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"13c2dc722799e62828d708ddde3c77d7e54e4922","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.3.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-19_1676765589128_0.1364218258294716","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-20":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-20","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-20","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"b5949e46d9dc6020df7fe611c99f087c58f52266","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-20.tgz","fileCount":41,"integrity":"sha512-JhcfxhqH/x8GcgFkT2Inpn83Mycx3Die6GvcWkY7JLKCsx3nld1joaNn/IVoHfAZ87PqlgazFTsM71oxSmgkgw==","signatures":[{"sig":"MEQCIEAXj0NfEC5dgYlt56V/sxxUWGOyYSJgT75X9Ye0bc7vAiBK+Ui/LhjnMIfElQKnR8bRocacF4d+5XKIZNUhXYdipA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj8rsUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrHuQ/9GnmTSNfgugsBpizyG/zz8GJCe2UX/439dWvPyMUdo/OXBTo1\r\nC0kfYgUTxMS1+G5EfsqczG074CGkAhvfD+idAbgRGLW9iEFKR3ODcJ+iVd2r\r\ngmkgjNr+2BK2zOznguKQ+Kq2ipCHXGJSuWllMhLEemGHtseyUA7OCPuueZD6\r\nFbvgJXxn1tk+eOztX92H3csiuVzUT18X7xSjt11SBa+N15jKjsoZORaSZqGe\r\ndSbXOVXIa4F/piWjlWUcRGmKwZzqj3ut99rb45Y224vwUhGFOqrSXr3Ky3YG\r\nb5xw+gFmm2JZ3ywhPqwzJhZ/HeY5vgr06UCyT0WTedOJRGYq3joaQHioKrtu\r\n9ww38sNdGyHQu/TIO07Tq88Ngf+3e3+NFHzILPpEZySCK97+9m0WMqphIcix\r\n7deFsgjNyLthTy1vSyFj4ISa6JsyxGaPWMsuIrFtIzIOl/ggu8NfYct+Su8g\r\nOQPpYlltffQc8SNfKycUUBeKiBg2p2yRfoUieeOlBe3EAAlsjablNJ/2vw0w\r\nAw3ajlZ9m2U8jOy2sdlS8loD/riWseuBFkxXoxctuHr8D0suxJptReTTjcd7\r\nFluS6DPVRBJj3eaENd/wzSO3s2NVL6bFEx/UXWU3aEC1v4dPR2usz7SUQLKV\r\nd5CtkhWBK8KI8HXcrDwydHIxf+0NPDblkDA=\r\n=pvoq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"13c2dc722799e62828d708ddde3c77d7e54e4922","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.3.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-20_1676851988655_0.8634618279659607","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-21":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-21","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-21","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"6bfd2bcc9a37044b10df3dc1151a65e77b9faf07","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-21.tgz","fileCount":41,"integrity":"sha512-u9LqOKclKY7nWAMP40IHVQdmxyZqDDspv19aCpt7x/7Yw4kLuvZBFj5xbQIM3e9NXPUq5aZj3fKSE3RFUjHA9Q==","signatures":[{"sig":"MEUCIQCo6ORC3UaVjpZte3YUhcQwbpvuI5FkiN/42ePqQHKBOAIgNPBY4M/KtpX9at0lhb5reFWQNQQlBKcSlX9JQ+aHu0Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj9AxUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoKNQ/+M+bTZ09g6JMRvvzdjHPcq1va/xxj6OnoOoCifWFy7t809jcM\r\neu+kBhGE3x63QKd51XstuaZQBDjJNyFilvmdabucmgWwimyHkaY23oJYH37L\r\nql1FoJ+690BGpyUmgDtuTxHAd0432E0OG3DxrwkjfvtAqrHyPzmzWn45W7Rj\r\nSzWa7vEKd5G4/UPH76sodhLw2q3WKk8S1Fkxlybfpe82tqyogGcULgYmXszm\r\nUcuseoxiwHZs1Q6frzOolA22sZI+uaU/tLhmYIzSehotjRiIc+We90Qd2j/v\r\nNHHena2tUnNUh8ex03guglx0VTw4wLWkWux0hqF0i8qZ77Hf8i4ckPxVLSVY\r\n5tSeyjW9hv2Mqjey1OPKqKMF2v0ci9X6WX1xtfUkRrKUY7knT/OWwyf+NVC2\r\ns88g+ocBlZ34qdo30xAaCalgb6mWEt/j1NWDaZ2ISRO+5BfR7ypQj8P0MJCq\r\nxRtDHEgUIM+IHlbWtMT33qwNlIrLsp9clRXFurQYGVPHI0TUckTV8dCpqpEs\r\nwe+Hf/pwU/Oa1h+zKnEtOz/49n46hnwscjd+aLEXt1S6sBuR5wDaW8bqdqXp\r\nM0UiBR5fVTt0Rdl5Iwo76hCbq6tGBiMqyaembl41rWb55KaYIusQQeK6TmVX\r\nnQ+5VzUFoimlp1h9M3X4JJ7Ovpph/V8oPN8=\r\n=TXqM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"13c2dc722799e62828d708ddde3c77d7e54e4922","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.3.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-21_1676938324101_0.93861268172107","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-22":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-22","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-22","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"53bfa00c617a943799c038020c51fbd7d9b3f2f0","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-22.tgz","fileCount":41,"integrity":"sha512-XSy5Bj+waN6wXVmXuasZJqylTRghwDXdEtY7l/mH/PBBfZMtgfdbNEbYorcxIeCbeDiL72P+wo1QSDYHNe1Mtw==","signatures":[{"sig":"MEUCIH/nbGFMO6I2Dtm3QXTcC4955SNjnua2A1KVUcQbN9X/AiEAhuzx4xOey5O/pEyfFlMaQ8lmLHEtPCKBAYhXbiiV/To=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj9V3qACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpNSA/+P8SFbAoTovhygerH7YgKraqWdMLXIHZNF7vbPN+k+VkXILr5\r\nyY4rfxIkkiu5wR+FpBWBqGo4QM8aOXXKhb3Thlky98Uucl9mnqNjnqnsBYOl\r\nFkg/MoOQrKQxBWpKhOlkg56hNh6AoPFoPFLza5zrJ1aAbc1L2EhuaQGzCYlr\r\nJLB8v7wtkFkN6AdrwMLFmdWyw43wGT2mspXfPK3lNRSkreUQjoAfTykTGt1P\r\n/efEfnnxegj2jBgCsVe5XU+tLesWKwEpu47DHComs9VW79fuuODK26uGTl75\r\nrX/uJgmwABg4+J902rfaWgEdiE542+xVJqlh52W87WZQUmbcQT4mBKn1kWH2\r\nH73sVvGbbmFvBY7KVbRhIatcioeNYI/ee+R+Bl3kNFXpbbmb/ZvD+aGcoObG\r\nFfMKhOAK0Lfy2RcLQZKBb56lXm8xBuGAT0PKwA3fXTmhitaVthd7si5wFIbS\r\nfaMZuBFcTHtyQg3xrUX6tohvaM1ZeJaD4XDQbdMPwt7MVKcq5u6Apiujfo7I\r\ncHm9l6UjFxvZr6CUphl19RDqsJHt44kX0gnoD2BoTQg+QhCGKelU4+yuIRJz\r\nlxRCq8/Pm1e0NvujSXnfwEURePFXSdn4W4x39mV6TLblZ/3VbvhCQl4nE6mK\r\nMKXr3jXS0IfbS9c1WNlbQgnuzoSSWh4/UyI=\r\n=CQ5m\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"13c2dc722799e62828d708ddde3c77d7e54e4922","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.3.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-22_1677024746251_0.25921249796009493","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-22.1":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-22.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-22.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"2d490f7556fab00d78148670330f0070b7104e37","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-22.1.tgz","fileCount":41,"integrity":"sha512-LcQv9wd00BclbX/zmafpIymlw2aMwp/xKYXYpJNuGEPLRSq0K2JtWWS6tcPzzV99NmgvUSacNNxLjEWKUaBfjQ==","signatures":[{"sig":"MEUCIQD9jtCNEYnmi2HKKZ50RzhJVb0JIAmySml+ZerGjypkVwIgbxppC3vxqHRgR26NP/r+kGPglAkPEJJCtOP09bNHtKM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131885,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj9o2DACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp9kw//fiT+hTx78nCCOccVt90qjHWr+hq7QDB4AZ/akZUUtuZD/0FP\r\nruoQzwhFvvxE4hQHePhvpWJA2ii57sXvQOy+aUeaBh3Kt8N9G3g5cD7g44XY\r\n86cOoIUK1z2a2SD2w4NdXXlAMF0ZYVSrx5yOfhLZgvEhCQLHn7F7YPv3jJmV\r\naJCKnEINKjPzGndRhtTo3X80Mc31KhOTixzNYTiuNwJXg6TTMslIoKD4DPc4\r\nxA9QOWq+FwBeUtLCdR+vtGK+Znl4kcE4l+mJQYnc3wwc5FnB4wdHNM34e1Rd\r\n09wLWR7hFLsyMydIQJTWBSsQm9jfcLBEVsQ+fO6oBUh4R0nR8uUDx4qBWkYo\r\ntnsaMqDphS/5HHJf74AnhlDlvniieV4b9plfFacWz3+fKgPZH8THg1+b7AAz\r\ncVkEaz03HJjZCU1j+ufle6d6spAzIj+twCIrnSB8fOA68orRZCrgqaTXu8+Q\r\nguuEYxqX7DOAZxig6/xTCi89/Am8y0xB5SUw/ho8zjYPtCyUghOwmFU2Pcrw\r\nuybyBtZbF0DAGgQR59yILoKiE1VaOHQ24itdxfFD3KoFsHp8fXGiWoN1j/PG\r\ncuIzvNRLTw4q7kQNNawuLUFUoEyUTRTrn6k5H/ARo3zUom4SmJgrByxL4c02\r\nTQOSGkua+8kVx7VEcNdxUdcxOUUN8s2Q9cA=\r\n=B+ju\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"76d180e8fc20a30357589cb909b8b7c80a0e90ee","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.3.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-22.1_1677102466824_0.2897294084649822","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-23":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-23","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-23","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"fe32951002dc6deae44a60cc3a07c5debd10db37","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-23.tgz","fileCount":41,"integrity":"sha512-bGTOqs+ExuEVAL1aWzmHAIeszmm1FBHRqDVjgj5OIz1+ICgqA4l+d6Tieg4OjqagGgeT/2sW61WUGgKdYYYYfg==","signatures":[{"sig":"MEUCIB/pGqNnY+gnDLo1h1rlO9FR/ejNeEYa5viRLIgJNG7IAiEA1SJNVSMCwokdXuLDLC89lgLRJmYzKjZ4hu4yrgrO/ho=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj9q+YACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrQtQ//Vwo+K/FZKwesucfh57AqTD415m2GNPzZMGcqq9oriOmkOp6V\r\n11tmKnfrfnlP6tl95tbPXF1wNajQQbEu4fxoMOzWXY9AIdp39YBaWOmoQ/8E\r\n46qCV984XLgBeCApnygZ0+X5EgyWvfPzwbMHmyCU7c0yE9MIqvuSpKLLjQcV\r\nFxwY+9supXQgwKxGzNs25ixCGFZd4942cQCVeRo1HILfFukremKZI/DgYhP6\r\nltJY++SBo0lpsmfzRR01J5YamXZPQ+LnW2INLeXvuQdgl4c6/WpBRw7WAC0b\r\nFLU8eWA1AsJmApLmtYT+STwh+a6/7MkI+PzBr8LovvaPgL0gprqvzcKmONZC\r\nSHjaSCwMUlH5BmS7kiLkwOAGfKN4HHvkskaw5GGtwR9CNdDnuxf6uPJZCHmK\r\nkuGTG8dnc/v7lHFuhw4wDKZ4EBysFBMNlzyXjEMN+WSYGdq5RnWUd4iH/7ha\r\nxeGp/nk3qfu4YYtvHdyZlSySjDYDGLaVYd1HOlIFqfW5vqPHGQMX8fsOTqBe\r\n/9oz+pdkzDpuOFfIj2l4VTvTQncONR3pAbEWeMTAiMX8T9QmSVCEsYo3iVY8\r\nb4abfAzLl2C2VwEWLbfikl9aNHwv0BSMQ11Mq930Zm+PMUvuR4+Gk9nQ37IQ\r\nRDFLSsB4W4pjoNoQ5bfkNXxp0Hv1VX14x8g=\r\n=aaIF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"76d180e8fc20a30357589cb909b8b7c80a0e90ee","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.3.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-23_1677111192623_0.6565215869840249","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-24":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-24","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-24","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"0aabc89cb3e976069c891787298fcb7c46f741b3","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-24.tgz","fileCount":41,"integrity":"sha512-1Ec0iSYACoSZR0Ujf4ZuWt4QGqXaYTgUlPVxYjir9WXrolZfNRxKmMypncAhf4mO0ufoXyi7X9SoWSq9REkVdQ==","signatures":[{"sig":"MEUCIQDSWk71YTjV8fLotMFYQgB8QumRo8qBHZY//bUf3A0dbwIgP/rL6n6k1+UbZ6mQWfJNc9B1N4zuHhntkM6X/KFY3uo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj+ADKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqUhA/8CVlS0Xusmqw3QSKEzWW9Jsx6nsi/Ii8fE4zOFGJ9EBlfQE+J\r\no6BksmvAZ+9ktM+M3nHjLDeSOZaH0feJN3ZptigIt904LsjZEHGxhwWKbuMA\r\nbWOST8Bi9thcP+hbxg3hAxzOV3OPl4E5WNhdUPtqxanJ4kh3yq/oYWwEWeIA\r\nTkXCT8UkiAoX1AMBoFOy717Xb4mA7VmNjTe8piP4hCPGkO63sowTBJdUkxpH\r\nVzxzqN/SH0x659c7wbL/sQb4UKXkqUsjx2sGJORlbdkwTjQqx10U+QpitsKa\r\nU6zn+6HW8oBkv2kl3RNt7zZoGF4vrfvz9iqCVVccL+oXA26WHR5X5dtIVPvM\r\nQ/OmPVaCCIEAZEJ87STTSQ7fkcD5zpkdKpQ1mJ70BfpHWDWa18dTgXitHL47\r\nAnZum9GB8LynsB3mfyr8wbC+9z45WEW1+Jp/q6ItpcQZAh8cMc8hDbRwQPta\r\n6nkAMM2F14ZXNZGCFdjnLgeMyMKD2YSgImdXRBFSbXlAMdQNXqCLCC0YJ80s\r\n/XyK0wH4SN9ru56PDtCCMva85agsJjB12ZnXdIZn8NiIbs2pq1iDfpikJrjZ\r\nqF6PQ5XKP84Y/DZcj3xsTNuuu3FhePGI3Et1wWw+Q5Hcivd/98+F1mUi9DQP\r\nfTkdYBhw48KQdH7JJpdjDTJb5I8U2h3fAm8=\r\n=m+bS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"76d180e8fc20a30357589cb909b8b7c80a0e90ee","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.3.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-24_1677197513764_0.9336542191630421","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-25":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-25","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-25","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"68820b83af1b189d6eb8f1b9c8388568585acf53","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-25.tgz","fileCount":41,"integrity":"sha512-P9o6jJL6CfM0Huh0SP5meo0vmDEKKjjeqV8Udj3hhFux3qDoUvBeSbcqVk/Guf/IF5YrFVILMreM99gX2yhfxg==","signatures":[{"sig":"MEUCIBCtR340rmpJLakTtW+5PZjk5raSFG4e6LytrdJ3hOGPAiEArFpl9oEEDRk4Ypr2uqBEycj+9aOzmVxoAbgVkEjGtFY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj+VKpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpVVQ//fPbY4exm3S8t952tZs4gpXtnT6/inAYvMJdtWmIkz0jGPloF\r\n9s5nkFpc5MjuYgwdqdzGr8TCryqE+a50FVlcwb7VaNzTCcv6WMYF8cnojejg\r\nYqNlqXofWAW62c4/ISXU5sA4Yg+2tFV+VQZqO9Ct2dEBHUL7plkPn8CVvH7J\r\nSZqDkYBkL97pvxxf573yyOqySc9f4whA1RS+nASnX2p8AuM2mUH3/bVx2UzU\r\nFmYjeomzpHR38bzNSMjDK26ZjtMpGPz0ep88qhiEKAKjLLf8ON2zivHuueLu\r\n/7gY9Yl4t5+8DPbviY7T8fyqSbbPTab8RBVnFkNaJ/vyJ/0Eag9LPknlpSDj\r\n9zYV1+nsjsF0adbnV1Ijj4mvROcIsjzVz928nmxZWGqr+5OWbMvHn4Zkll1N\r\nNXWW3ruM6+FRd+9EJ18iFLIFlx/kCeeDxrUTQzgOfl+dOJZHp9GX+NvCshJu\r\nEYV3YfRfDtKFqC5kp/WZmBEktb4zw0K63kpguc3ShRe1gAtLaCV8O7ntAx8Z\r\nCy88gYlip9bOfx/ccwL/xvz36G7F+khnde2zedVCes1CxzONWagkTzwI6rCP\r\nGBQ1hqCYTHYjzp38AXCt+ujxBv9Y/TCCOdJGCgl5E38qiS/xOZEAp7mujLw7\r\nFWjabvy94rP0b7oiwqa/PUWh7RR8PLn/JVo=\r\n=YReN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0f06eee90023d6ca5ba15cd2ac334819c2d34281","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.3.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-25_1677284009581_0.5293201011633124","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-26":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-26","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-26","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"0630a5a0ca01a9121eb2ca2b7ec451523eed31a1","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-26.tgz","fileCount":41,"integrity":"sha512-jK3kWwqB2XDwbcSYLoWa1Ecb+mpphLRIeOpWsgoWIAITKZEF9E0Urt6hedvyZreQHs5SzCrxrmRHfble2sCLWA==","signatures":[{"sig":"MEUCICXInXM0UTaHC6JYG53Vg1+z8h+cNLdR8ruqytkUYDu3AiEA/+3bIjZoz2MeEFGZ0f0s7InT1a0iMtuhCRivPBnRKiA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj+qQFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmravA//dz8BWm5bOPkIWr8IfLPe7wGpB5n8bJt1NV0MrgSOZhM/Hj6a\r\nL5J06MLONu14AZp29tqZi0jLIfMF11EfqOMc4ynNyTuig/+OpDyLrsCkeTA8\r\nfkLBvo0TE1+9OAUwNHNr3Pnr3hZMs42orRJl5mjelOh06l4AIEAe1T9qJvWX\r\nkpD2QrtLP3qZIGUEkKzlCDJ9Fyd0hEt1K1pFEbMbHOkn7y9V/cuF6N0Mlt7t\r\nxDsZAxU69Y3qPuLeJWH/LCC1sRZdHzNFvpsrJatPZqIcLoFrhJQw+Rqj5rJI\r\nILuEfxvp5LGXa8c2bwFRZ61B8QXxpMYQhSztsZTUq6mj8Ny5sJ1XSD3HNxFX\r\nWrrfKiCdvWPhbXDLxENuEJIB+0ENahYW+28FbL2K7sdzRaFLPOrP9TO3uPj5\r\nT0xdVm12XCCYGGTn0Bb/vYGtbzdPzmKzwj1t+t4uYQonoUdokufdgMYQOJQc\r\nMgnVYK7WMuDqFyJ/XgZs2CkmTNEUCt/Hmq/e+4e80V+tBRdXemclCdryOBKO\r\nGhOeo+24l6zZv2DMHfpgBsTqITo6gt4DjhIj92PvGE2NZ9A8wlpdUnBtlh32\r\nrILuR1DddBTSPo19HMNw97ncdGX7e08BV3eHBFCXoRnpIsqC+DAXXDGh8kvI\r\nR4mcQOrmUI/l3wzL3gflsvGrtPBj43IlfY4=\r\n=Vi1O\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0f06eee90023d6ca5ba15cd2ac334819c2d34281","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.3.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-26_1677370372739_0.11661630902048437","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-27":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-27","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-27","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c3034e938f0517474b1b47419f473bb43ab3dff0","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-27.tgz","fileCount":41,"integrity":"sha512-iPhecx4PS7uZcSn/WOEVQob0Alh5YWMXvSOkZwBuXkSlyr6hkxdPObDAeZiaO7ZUsS4VEDW0WYR/c++4YpnjUg==","signatures":[{"sig":"MEUCIFAhTQ2Nkt7aHv8XpwCjNR/jRRm2Rge4BgbcxpZZnBjKAiEA+OIGRPqrFiAniT3og1xp+Eej33MH45pXpkOHHhwDN2s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj+/VwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoyCg/8C33D7awWzZxXqmZ630zxvL19NN2D8i4Jt0FvHLXMDhxyz81+\r\nsqJEfA0p83+L/gbpqyjh5YYLzJjBFR24A3rC8watL715KoN9/xlVRypR2li6\r\njKn93SSdXo7cY3fCmuadStb7QVikxhVpdqZ8jlXUpuM9+sFSavUdXKNLSPpu\r\nmwSsojTD7gUkYZfDd+UDh8plYl3fKYXqOTuU4rFLc7YuzeZv1HY4croWXU5d\r\nAN1wAhn1WXZ0dMY8Z+3Xd82qrBfN99sn8PqaaD9HJtrAfya7XnPMFXFilu/g\r\nGzFV/oDZ5Cyaal+m+8KjEuktZ0TbJxngNvjGC4XfHXH6np/z8L13wlCFIpxw\r\nQ19adtFnmE/JBV4kDMoAXfF+YeySaVc6zgTLoaXhHT5VfZwxsQFLpD48gWOe\r\nWyYfiRmGLRz5Yzot4O9R3mWufqayE0rBt6nlp90yZk+Qw9hk8VShO4Oc19qc\r\nx+9qSh61nLVIUujotT1xYZRI4XUnQOUt65G7Q46kCWZmfDLs4zEZJhofVjF9\r\nNJsyoss1M2c9QK/lRA3g2d5fZ5Qex54u7J3/67aPLdC7LtrN+fJ+0iMKroaS\r\nyEaqTYomfH6p4L6X6V2uw7Sqc7qqtrEt/KKYDvtS4r+izgU1lz7qi2Ladw+H\r\nNlSl1ZzOO2cAgi8UqMY7YR+1aa/VUoongKw=\r\n=C3WO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0f06eee90023d6ca5ba15cd2ac334819c2d34281","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.3.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-27_1677456752251_0.6474113092270279","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-27.1":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-27.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-27.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"78c9e8019632ebdf4e8760813691a720c73c130e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-27.1.tgz","fileCount":41,"integrity":"sha512-Ycat2m8/qRdWNDFnIAG+iDn12b5POQrS/t3RZ8DDrCRyJKGkoldqozYIDvX12+wRuSoPVt7yJWkYDhjhc58hWw==","signatures":[{"sig":"MEYCIQCSZMQVU943r/3ikHvM8jnwXk9RX3N7Eib26bFwBd5c5QIhAI7r9aKKPVKo5Ml/33ZEyTZMj3lm0wI8KzelsraA0zXg","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131885,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj/FAjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo7jw//dMVRF/etFQFW6H1dV8pLS79KGmByxesktSa+QBwIzkjZR62D\r\nTXZSqAmH2exfddEAc0m6xmvd/1zb6kpH9Mi3fJFANLTnjeVwXMDcrc7lSgVN\r\nDnwXggProF2M2PrkeN5dtrkquzz8iWP4RIOb0P8A2M+qjLGNyVbTQ/qMuYQv\r\neVbKJBhvtS9vb66DoZ97XjA2OxNsR7LONT0lWuzyVnvPRjoNI1Dx7ZR1nC1X\r\nPFoaQ22811KAmbGi1CBOZQwTyoHTGHtJKJibZ7Vehh6GBzUnYb0qV/ii1KzB\r\nfxRQKZcb93l7cq3tU3EOYTRTrYIExpr2Oetr8/ekLPNAPrsEDlOkzXvZmadw\r\nME0R6eW15QBYTaiYeq8gvpkn5EYN/oejmkXM4B+rc6e2N5QqNV4jC8Eu4/0e\r\nZJOW+NSzMVBbZuT+AOn44iSQM2iRiWODXlh5RLUb7zYu3g20mH0i4HCsQ6LX\r\nU4W+ulJzQPANs/xjl9ptoIJs0pH+C6I2lS8XTXX9yAPB5qJCAHgz8VdqA9dt\r\neK5SCy3RPrEiZmpD6XTEAFk7yO/0Yb0qrRypPUr83cjwzu4yBfgUbtNjBj//\r\nOSRahzuL0inJQED0IAngMbRZ/H1lxp1gXJPW3FmKd7OxSaxcMRqyHhPA0DzN\r\nj0eED4Dxr+vm3s3vPMLy159uXMoIm5SYJws=\r\n=ICuM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"ec29081e3761502fe2fde92f4a81654617bd092d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.3.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-27.1_1677479970729_0.7356558918033065","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-02-28":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-02-28","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-02-28","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"7f01be5988a8a790b61e991dd6025ab0068cd810","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-02-28.tgz","fileCount":41,"integrity":"sha512-pj7csKBlQSZhdL3rcJRz5BvuZKsUR5N5QR1OIhpA1wU1sjhAIRmnfYR9BjbTHknj/JRgA4lhaR+gt6EmBB7hSw==","signatures":[{"sig":"MEUCIQCzbyAoQJCEQROFddiR02TIKDv2XOAhlw0EKbtqN2eTRAIgDLB+CYfBy6rqPoKnFs7nhCT+dquzvR9Q689B16ySynE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj/UbpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpSUxAAh9KJamqueclng13KjzhX7zT8AxRMLk4C82nPLXJ8Su4LOBY/\r\naIqiQLvIJe+6nqXas82b0IT3w3s7pKr1S2zGqgoweGqiAIhZpTUxf7upV7NH\r\ncqlbKBCBrWhs6UYGVj4I249aqu5jNmyfS1Wrv5BXD4vuwnt0z1ZzVWKwCJjv\r\nQg3D2CIfCCutQDuJ0ge5rlXYhZpQMU7+Q07HcfvN65bphIV+lGI2V+7yUDYV\r\nhMcrAgSrV8uIVF8VkE3B+ueAgRD8BxO5mGe6u1BoTvM15Te3if/mhg5OSuCk\r\nvEal/zFRoEYSTQkDDpSilaKvQKRPyqLOGOpS4ffpDUllOMMiZH+BW3uFWQ54\r\nRDB0MeOxAwYJWyDOPtAxh2nadqyqdRBDcDWnXx1E36RvifiCrprJrE6GzJ59\r\nMA/8QLgqA1aPmmX4GN1JCzMI1/ATPQvj5xYv0f8Awa7H/20UR74e5TC17vdX\r\nRDhqrJgPtmno5dmXax0+HCwpqoFoh57sjSe8oymXtCExpmCM83ojnWCf1SWd\r\nvpBMbN1T3CYuh+AoLldd5QHw5iGo6IXf6uj3qkQOU7gc2qYGR9DV+eojnPi6\r\n6jgTMd3orzIYXw4npPyoKQJ0jK+dVbfEBTg6sbu5YFBztyJT/JoBvP+NBxeK\r\nBDdBRmD5CXHAtPQs1EYUxqEtDxsMsp/FyQ4=\r\n=zAX+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"ec29081e3761502fe2fde92f4a81654617bd092d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.3.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-02-28_1677543145164_0.8480061593669708","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-01":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-01","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-01","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"91e0e61d9dc591c54625b2b85f2fdff2706a1921","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-01.tgz","fileCount":41,"integrity":"sha512-F1GWfpp1EgrLhUHH6ixGJIHjj440R9HTnJ836g3aZAcHyDbHDrDl/E2bEjJmSw1f30aidiNrXsRU5pa5dX8inw==","signatures":[{"sig":"MEUCIGscKv24XE17Bu2qiBBiFA8ku/bKn/GyjvxIN0CvzGeIAiEAo6N/vOCeNmP2mGQsUS+gJCteEms3xVN0XAqKovAGIkY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj/pi2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrbEhAAoB3E8fUpaOWv7k9Lf58gAAW35kkJ8t25xmNXfWRXAGVVS1k1\r\nJB+nVNIh8a9dpaX2hzXpmpEgryzheFUo3lDPRrhzLPcWCyVyK8K6m9HYYxlZ\r\nasAzbs7n+HubAvQ5MILKLAMpDSy0MLJCZHD9fzz8OappScPACGihD9Jf9l+6\r\nj4HcTHogZGMHioXV8STPbhVB6sD4ZUD98Im4kxThF3U00B161p8/d6a0a5c8\r\nzBPgdH12Ai+vYpFpXF8WLletUwmRmW+83ebCBpdHMUS+hFpnQkSUH1iJcC+Y\r\ndV9nUoNaokjqPBpStZGC7NqTsPgk7ed2Q+qTEfJYeL/bqsYcqdYpAewF55hn\r\n2VenV7z1MnbCdegvH29ZKcXqIh6UURgugoubSUE0miquUl3YXxFvQ++nyiVm\r\n1jDCOJm/c4TMXemVNqiEl9TkW0tYZxS0LAl3ZJLi3KpqA7pIyveRlJfkefGk\r\nMM9NYsvloPoBLr33H3lnWNt4W3d8v0YOS9mthno0l3Fhfh4R3SG0BaWCAZq+\r\nlBC+pwnslQfeQV4T6+2lkd81Aj2WjSTRCeW6YIU5543n0LqK5/OhkW8DLjTi\r\nm2W50Vbct789esEJjIRb/v/sk01cOR37Jt7ObfA2u3PTjqQo+4X+0DiK28Ym\r\nrmUz1gbn7UmLMt80Ndzd90UKoqvT31Elo+o=\r\n=IFiH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"ec29081e3761502fe2fde92f4a81654617bd092d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.3.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-01_1677629622334_0.9265793404656462","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-02":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-02","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-02","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"2de58b86b86d4784c1d56f1da4120b3506d3778b","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-02.tgz","fileCount":41,"integrity":"sha512-7yoysA++pPJ/LcVJP5atJvjJAKrso/BjdcWhA6TbU8VlOM49CFh7UbrhSNeHX/jLdJye37IGa3A002MRoLVRXg==","signatures":[{"sig":"MEQCIBk84FvAf6Ct58xA5qlhAIXMKTz1vFuG8O8h1ZZ0KquUAiA1AMLhPm3pHmCWfBfZLc6k3luhukYMn75d1tPcf6FVVg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj/+ogACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoFmxAAmxDMVmQwBKJ7ZKx0CpyOj4EJpSxoZOVANcZf2gFj4XKfg5vM\r\nHChxlEc7yJ2+5eACpBZcEJSctE1v7ku4DqB+ScDEZRPNEiOTPDzlAYwtJOof\r\n3CMrACkoC0X5VsKvp48bo3fvzICpjZEgu2ulOB3f8gpUbRMoFEO9lnL6C6js\r\nc7INknDAq1UflBozWUWdBmSlIGJ31Y5CsOnMH1CNeqI50BvLDOZjGB1dXriz\r\nPst9dC7nmmzvEDkl57dMyIYbqErn1mlQtDQliEWfihgwqKk/iip+5Sp/P5QX\r\nEuofiQH7XYXHT+cGJ+ySNeIISdyTR+qIQSVz7UuWz2yLgf3vgTCvEC8G5r83\r\nIWs0Ky/Jping3+eQgJKBQ02iizRUIkOVxS8PY4k5bBg/dlxStVJPml6Kuya/\r\ncjyUFWw/jtay9gCeE+CxD+Ek/8Fn/35OzN5RBWpGE9/nmn24UNCO3/UhTBTS\r\n8913f2ldpIzdnXEQNCRYW49+AeWgga+Jfpwnq6gALiU/6k0P67V9oOEcuhdR\r\nolfPU879r1ceVy7xHDuupXYrfMrHyYJlQgHGOOF5H52XK+JDDPH+i16wOZGu\r\nw3dbhasuIDG9a+TgwuF33TBXO7j3eTNyq8VDk79LTxMez9PqDS6FY/jxFxQZ\r\nAvjj0h0ySmPo+8fufEAS8Gi6DIDI5fJj7LA=\r\n=mZXc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"ec29081e3761502fe2fde92f4a81654617bd092d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.3.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-02_1677715999936_0.877969023670762","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-03":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-03","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-03","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"05c346ae7bff6896e6bab1d47ec9b95c87e74dc7","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-03.tgz","fileCount":41,"integrity":"sha512-ZUJ7LH42OlUQnH7/HAo99Zd1UZsR7KGJoMovRjo0uOZDcjynuNf1knfuthIWmHxc93NewcAa0ITsCvapflRhdw==","signatures":[{"sig":"MEQCIDp1VKjcuGiLPJiao3FuhOPMWRQGOvDxcI5W6t9HRBi0AiAjLXdANCreDhuzcDaH18t6cpuRGwW8CFhGU2Pwpw6Dag==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkAVLuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpI0w/+Or6fFwREB1F/jVPCUMAsq55S90hkEuRjY95j2nsa3YDwB9qd\r\n3DQ+b3a4v0fDNUNuqjJfsI0nJ+3W+CQYhadaEBpxNHrqsLrKihVl4ae8LPPQ\r\nUrAnDa13KrY3ktHLnuMdIC521GCRr5kJjiQG0jJGPv71CEWW1a8z3HywpRuO\r\np6mZrerIRzjPB79oMBB3rfylvsCOHezwYcTPlLh4rfGjSMu0NSc2ABx+5k2U\r\ntxY9dYF9FupZcukMNul7zuExvWQ+8it8CHDSlBkI24ykvUIXDhCQYR1tloh1\r\npuwa002riRtSB7lOuXd1+sziSafVUxpRJVKTp9LsuJXqNGZlUTDDIhqBEOB1\r\nG0wDefTkQhTEfYqPf93SJcDkRL3d85OjUf8aKATStcwM1BMEK/ZUkbZuj0d3\r\nU74woLvEVVYWEup+C1R0qQzUUaGgiQphgDFuTIEQe2P4a5+erElZHsLPWM/L\r\njfMyZqzQCzz81dX6jTgjPUOp4EjCH9HiEG9zDR6a8IDpmT7tBt/hugmqwbIM\r\nlZ3kehnhA4pmbEEzu+mRUK5M9mGm/ycRzQXojX+F+VV0QnvVAq3hexyhHSvP\r\nDNMRaSNzTf1H8GgU2R93n/2k/kVWpprUfcFaDXx2sSFBYwbiRO583s2vNZMZ\r\nPVXjCUBDTy1VjYisnh67MOEj+zr69bI+Unc=\r\n=89GV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"ec29081e3761502fe2fde92f4a81654617bd092d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-03_1677808366333_0.8500443978819625","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-04":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-04","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-04","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"72b79503e6463fd130156966a947bcd10f51f5cf","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-04.tgz","fileCount":41,"integrity":"sha512-QQhnu4t+IgBlo3Qs3SNfrZbx5PZW2BesMr0ccW0iCkMoshaikZV73Rc/iye6sFrq8H4rZJciRnmgSz//fScVtw==","signatures":[{"sig":"MEYCIQCKV3gA17JmNKE9incWnOupgo+rXcLtSaTN7uoCl9Go4gIhAIHxED0NoS2xKU/7wfOmkirfRPlBvP/XDQXj4VGs/nc2","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkAoy8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqPSw/+Np/2hFevkL/bcWE/cIcgiBdRcJbGXOIsbhVpzqENp3rTvI2N\r\nDzu7TNAEWnsA5v6p2Sq5v3xxk3gybE5pqBnQfoLP4XrJgD18ETqAfvVvEWZW\r\nZcfWV4mUfPdpEP8KU15V5EnJbCclz8P8Wmxc2jJOCAfIdfVYHWy3q0GI27c4\r\n3xh7R2qIej4pM5InHmv6HTho73McLLhWrKYt4LRHIQz4zrdu8tJhOhw0iF2/\r\n4YgwcuQNFMcP2u9GNTkrqITro/RZTho86H3rxwfQCs5vJmzEcoGcR2KWbATY\r\nFGfxsYs9oZYUW4f9FdwYvNHcQaJRsRqR3z6JFtUpqqn69EBj8Isw1TIPZUC7\r\nTccST5SpkDjDQAyus1zyre8mKXsjFNBN9tFYuWJ5w0Ngr9g1aFmCI9HpWXeI\r\natOFfhwPcq1m54ddqjGTeNomUeJ9zELPHKXba+/hiiBKV3Ip1em6MQqTLj27\r\nuuCwfjtycHPPv0ehzf0Zha5YDe0SIES/D4P67w+2+gL9xpoG4txq/HBiMLs8\r\nViy+tXLj1JfcAS3zw6IWSS0PAsxnBXXNyaqvrXq7TjuY2iIa5yRAC/054VVm\r\nv15EOnSWkml/vI5h98WT10zZBNCwkJl73HL+TZbO90LRpZ3koNgBtOyztU6n\r\nQQ5mRt+zbx2zviJFufBNr4vgWvmS082vqF8=\r\n=NXHh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"ec29081e3761502fe2fde92f4a81654617bd092d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-04_1677888700369_0.7716492011996383","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-05":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-05","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-05","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d574e8d522767cc92a4fdedbd098b7eb92e35499","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-05.tgz","fileCount":41,"integrity":"sha512-6kYvOmZeWGQK6zVPUvY4wFMZ3+h+opoG5DCiXnNI7PXCuKVPXfTzMAP+AJ40cHdg9bG5KpGz2hRGF5TKLUVzAA==","signatures":[{"sig":"MEYCIQD96JqoEryp6U0IXddYJGTn+N6T97pGk1exF2g9/tRZOgIhAOFJAuoS8hxSsGkW22NP+8rsVsFSu5IEt4FmUHYQhrKE","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkA965ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmolZhAAkZ3SwB60MW2aSS4UGu6YNF4USFuvDEPdtT+MdJMM9GIRb46L\r\n8ZsQt5Ts90w5xTCaQtcsfRS/hG8JKBD00iQ36vv00tikQWXFZahp4eLWDrVX\r\nhDS2X8QH9JdGI6S1lbzJu9FST53sAMSvDCJzYBlgXNcVzqQ1avsMPm+EZ2WQ\r\nbdp/vL36NyMpMNMlOLkDZDzDXXkGN+WMt2lUgZRnkvrf1kWnj3YNckQKIwLv\r\nIGxI3C/Yvhb0tSRQMUZ37/kQW60/SjxeluPVPqwhcQ8i+94dl3lbKvGlIsxp\r\n5ah46wYDnKp1NW+aridvk/SY6BliJIpNGIbpcwScauA6FxqKhvHtgZ4dT51H\r\nhbmWVzAKx17HgRHVQecazeGyK7WgkrU5WaS5eeV314A50AKnVp5tUIOqQn9i\r\nK4Y8V9PZ5FnlcoT0gqDTlDquQlxB7eaQP6nBaDTgfQksjd9rWbyi4pIMdnPo\r\nZD8VIDlaHa3+34MoGJ12x4Oltm5f/U/vXzoGOXkDTTMZZsvfyTiwu6Dd9q8v\r\nC1x1uN+y25Y/FSuficpXjKatSQwfNhMYtXYhcAk4m+i7pzwIlqsVMoHHbY1L\r\n0MPobm2ldG46aGA/gV76YvU3UgB5nXQiX71Mwvjx+Cp66eQ8+WSL3VCwbYvb\r\nVr9o6AWTuiQ24DvnDr8ECWxcKq7tkrpIYTo=\r\n=0tLe\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"ec29081e3761502fe2fde92f4a81654617bd092d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-05_1677975224955_0.3666411365890885","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-06":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-06","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-06","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"e1833ef3702482778ce233066dca9d3947ff94e4","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-06.tgz","fileCount":41,"integrity":"sha512-JsW52ZX/YJDdyD/LgAr5jm9TGoObEG5X/9b6KZZ+cGcvFIzuKBBROWUA8AM2L1ldlBF4ykQC7cQ9RRKQfcJ7Ng==","signatures":[{"sig":"MEYCIQDbhaza8LOCTuKYbAsU1/ZDrXXsEdmdjtGTfBEuNmlX9gIhAMDc+AxLMsq6IMKTQa5R3N5Aa2SuIIrENKRctWLbF0Za","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkBTALACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqRdQ/9HQp2MxiXcnrojSzsPejh05CsZe7iqd4q808teT9TT8kc0IKC\r\nIOARCl+cJ7fncW9Gm5jENGpdvohQohNtgxivTrqB+gvvF9XQFu/jggqLewXI\r\nLuQZTE6d1ASf44hPu1nKo9/0Q0hJ3pFCk0+6vrWENvU/K2+BE0RHe6G5WfYE\r\nsRhUGiCmnAVQ6i1zh4s+t4pMRJvUUN8sXQYHs5fWP6eBVtafI3v/ttyLkaZF\r\nDOkgQV/pxMPUivKWebc+rjH0TQjOXGToyS3LIdFwxAm3s5yYGl4WToHhMdQC\r\noYzZkqhYa9GMxQtBNahYgpSUDo8MdYfh9q6kNIjmOmEiE+nci7ELJ/TRXOjU\r\n0PGwm0MmcfhUCxzVX8GE68Rx4/Qrt8B0Ishr5j48aYcJ53+a/VPBQSgqmeaW\r\n+JbNLnrVL5EEu5Yo0POw5qhs+34P5hKOA5PyoeVOE5/XfLuUd0YYKe5/QRma\r\nGE41Kh/ShNNorwJHoOa4RXUOIHJv6/xmcQsn271aWnfI7/mFTkYEq72Kw4zO\r\nPKtcp4jwgU6A/MdxFu2nWEIjS3vzbnLbD7mt75Dcaij/MjW07L4hkcHaz2Yy\r\narrQ8zW0+5/5KTqKAGlCQZswbaCoEIgbKfO3Tb0KV5IJ+ccxC6j6is1KA+8z\r\n7Z9bfL1FTkd8rUxtptd1fekgQ2bJp5YvzUo=\r\n=Mmdc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"ec29081e3761502fe2fde92f4a81654617bd092d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-06_1678061579372_0.27353244879025085","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-06.1":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-06.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-06.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"710a0dc2884f0d97b7d27d8382d96942d7c74001","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-06.1.tgz","fileCount":41,"integrity":"sha512-x/NWPOGiPLfs/PXTI0aV6ZMxUUjkf1wn+tFi6gxTkNaXApVaruAwBqYICsF9o/ACiweq6MCryyEKs408k0UjHQ==","signatures":[{"sig":"MEUCIQDbAXB1lAHtP7I5GyKiFSaZUgdMywp0i9lusMxzSGo/YAIgIkznTVFQ1aVf6oLpuLIUdy7LRgF0tovuPP2hbdgdM60=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131885,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkBjXCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrb/A//QFUQks4tNqWyNCRGAoYfieczAQr6Of3cwxSlPBJ1Inec8Lsf\r\nHEJznBQVeUdP/KrtoQ+Rz9LzCil9bMohVhA5EpG/8NJvujf542zzKLC101fk\r\nGpCSsMLGslzyNSvxfSpaIYfBuL70fTB7Ww2RCV+0uOqdxqxU8F7/unKrqOPR\r\nmc7yzE7CWhEZVx2piVLjJO7OXfAlGP40oWarx+YA/TBeTtALvuLFQ1w7HbAR\r\nFbiN/Ky+HYe3Kfh3Xk6VVlLx6pdfzeW0YnPs5Pq2VKO2Y2O7nCnl9ZPLAEBv\r\nSk5x96Y1xZ63FwyNTNc2oHmTdSSl5yu+0DkK5hI70tc/ido6DkCFKSJM9QCI\r\n+iNa3qlr02qVeWxcg8lbegYGBwD4yd9CW3jfkzLZyxk0E91nZ9/VHDjj+/55\r\nsKQ4pdFZQ7xlXFSaeYcpP6XnKXO9LTjEUph6rhG8Srx2fMtI8jJiVmrLYWzz\r\nyCBezWsl6zApN8Dal6y3aO5RoRB8lmFIJFpGPZiUm0APcnm9dB1NVcNoUdaY\r\n9mAddNlhwtiEg6sFp0YEoKeW7VfDCk5IgNCmTWGL9/sKpnogaerNIz24tO2b\r\nMP/7t4yQNoflKiUVAbeK7DRvaZrMRdFVeEYiy2Dzd9q7ed0+aYeJCychywLe\r\nEQnKu3x4rxlV7A3rn9f9DfRBYQ4BvFQLLTA=\r\n=TTeH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"67a229f335c9879c0bc6e340d9f866e68a24f8a3","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-06.1_1678128578695_0.08943487508168002","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-07":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-07","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-07","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"e95586e49b8ed2f0f62ede20e0e505e9a380bf69","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-07.tgz","fileCount":41,"integrity":"sha512-ej+ykZWKN1uTFwUqFZFznA3wHjbwsyBXKjHL2Kc5zRdjmkDDpza2ziCKuKibTwFGzm2rt4YdZi33FFZtUvtP5g==","signatures":[{"sig":"MEUCIGW27cGnM0OTX4haudm//OEP5/7iaFCfc8gzA7PGS/RqAiEA0K6iCwxPT4JkWjxF9OrUujDPOvdHl7Z1WnsEbCmYfUg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkBoGhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoo8g//RFFMDTcf0O9LSPI32da3HGVWbDy7TYReA0MepLjxqlFSy2tL\r\nNeWpyLeTDaEDiR2Cfy7T2yaFFsEpYxwPhE0R5TA+ru8jz/OS3m8jcWT4Sx8M\r\nWxLBFw3aoCAHSS3VmUo8/CDmBkJWP/HU4OTdBTGhGlz7qmIATYgQyBrZgSME\r\n21AKRCYAw6tJVzvNles4l4a+fXlVcuYRXSstJ3ZPrsjwr6Bhpxhl+bikMTpt\r\nQgDdvN0lMRRCPIHJV5Uky8lm0jruVla08JQg9LFqTSh4Ukk8UjjQtDetiwQr\r\nbjxCTjDp74kCkNJtSDKunMtr/rR9g7JzpC6OVpq6sVxSSAWlnezIBdbTPAaq\r\nlpellaUe/I70fqtruuAfZTDQ2tRBqHJxzGUC5fZF2mBoATZiDt7CKvWJNK8j\r\nD4CJwwpbuUEjCMlz0Jr0nDzjygC2bZQlXmRK5nmjrLTBM8Jfu7AL/glQJmwd\r\n4oIaRKSOjath4Feg7S3Vk1kZ44JkNVxsMjjWV1gdL9PZD/6+UZ0oy34SQlrf\r\nl/I6WMG5wxdzpCuysQT8LhONCF+ATGM2KyuivYDwvVAuZAU2EXuAcjpLN2E7\r\nh+6526Ls9UpBtTYAP25uJ8XMNv5JieMjwUoAmzXCfXUd9yOx+KcxUxXpAZ0K\r\nJrlcw4sZ2L8X8JqzQS7EhF4qkZs5+BOM3t4=\r\n=cPX4\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"67a229f335c9879c0bc6e340d9f866e68a24f8a3","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-07_1678148000896_0.027870244806112332","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-07.1":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-07.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-07.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"73e707d9e7a887b4c778972bd05843295869e3ba","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-07.1.tgz","fileCount":41,"integrity":"sha512-tQAues/kbWsKJa+WURgbErtC6dg+H5OqzNcr7Vq2dtVyosBCqRjF7GdOKr8+Ou+9L0BtRTu8t7mAu5ZJiL8cOA==","signatures":[{"sig":"MEYCIQDBElnAf7SNET1q+v33a+lrlPJp4vA0KCAXmXvxU/rpmAIhALmcMT4aJxowxihggGAqjZKd/dymZV1nP6GI1uCf4dej","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131885,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkBtvhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoLjg//ThqfCzQfV0cDj4vIQYOCxXyiX2I9ixTscIZQhoblDlW1vKsN\r\nmMzdue+3hG5flUfJZCt9McQ0wFapvZgQnxzS+5iXyaItPAfmxvFPr3Qe0DqQ\r\neNZaTj2eHn4EFZoD9RByyrAm/u2nZpX75CuTq/C0vTHVc1LEWY3zuz2WfAon\r\nl4QUdhbSo9h+HKKcQkjRobvP6ubm9npOGvzS0nsyWZh9FMKy8O+FLRI2Hy4/\r\nTkCEJQR4ui6As9ZBGlaWdXlsH2kJk2WDzeAdWPLuKTWYeO4+uaMZV+vKXmD5\r\nWZcVk1PftEMUNJ3v/K5LcXclfZhxpDbjcuOgnSE/NrJ2gGnidzK4JUvUp5Kt\r\n9sDzfyFyR325J9Cn01NMve8hqNgEESdCfsT10jCi6API2wU5ecGInI5sZ8kD\r\nPeMCW5EvbvaZEtg/RKzIpRbQotxmnmpQuWWOFmyAgnLLj0/TOn2YwsPr9zgv\r\npLhGrj4eog3TY1yqYw/l4RTX4Om2zgZLT9+b9GqZ+BpC0vl5h/I2cN/rTK9J\r\nCPfiBp3R0YbqxNbsRnSkz2EETvvEIYx5drrfGBpOjVqhJGSJJ/ELlBUrv41c\r\nqKw5FZv0pfg8l96K/Xe5uTogT8oQeZ/P6eLtYPOW82oiXxnkfjJS1fl2Wnhe\r\nF9VRe6orl2pW0X1ey3b8hmYTIrN+1VaJx7c=\r\n=c4fz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0ba9689e281f43423febe13d018365e5ac92b57e","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-07.1_1678171105551_0.11785464682368385","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-08":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-08","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-08","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"bfcef6690d41c2441bd01456e1a2336b32bba984","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-08.tgz","fileCount":41,"integrity":"sha512-+ufizOQe9cxmQXpsyAPA/CNEOtpA90UZIWdyWDJ1WSxAzXgnie/HEr6b+jYZO/9F6FoHhwDX497H9+j9QtiY2g==","signatures":[{"sig":"MEYCIQCC1Z5J3V/tCc7HBMcq/O95ArwKpcA7o+EJyIddq/UezQIhAJ6j+0qAoNccsAZpcSlzpYviJ9M3BfepVszuVW441qaV","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkB9LPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqF3RAAoxwb3DLD4UU6U0QFjE47nVtGKZQyTVb0h6n7QbYJPTvx34ph\r\nWqK7dAoW/9YRT6dIaATF70SlxVxlbj0ooVRZPLjp3Yx/y2RfqOKnRb4xdSxd\r\nc1oBpf78wVQW9m9PcICCoJDja1h6+8LDEbYycm0UFXABoLHZs6LV7zHIMSY5\r\n2RzAhAzsgCWHN2lpAezCENFUb+4Lt9h5C6pCXxS7BkGZF4uW7LcEuZhJYXxH\r\nVrU4VMhI87AAsL5tWdSbrv17Tt5gCsbiJAVBOgPJE8WUSMMS7S5YvIkVSwa8\r\nup4QbolRsiR2SLRPUlCDpos+Wi8+q6H7YGZ5yZFzRNqFuyUPZp/Aq+h9Ec6a\r\nbLbJjdTcmG+JowqSf3W/EPcOccFW2VRP+3ZPFdP5pR/xnubs/PqhtZtdJ9nh\r\npWmJDllkvDrhwMuUThfVbV14q5USR9CKsXEoAfuhggRCW4BCaw84lHBA8FZs\r\nX49/uliFpG1Y6DwF6lKYDLbsKWJW/YUa5fPTwWm8tuYvfmcKUz5WNoOD8NKo\r\n14Z7AoSOav97PDqWHABRrppgpL41HTdqDIA1B2wPI46ouoMw7T5ZxF5+uGtQ\r\nju/4YjcvhMb+k8wsvR61Ay/v+g2XFpQoaFD3oEa3mizAY6v+oUmDqJt5jt0J\r\nixX3E3B0kzwmN0uOnS9xjOCEoZp7dypcXQ0=\r\n=9bDC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"86d0fafd012fb3c3b3ef31c8aa4000cb6ff87c28","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-08_1678234318944_0.4554550383575793","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-09":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-09","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-09","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"88bdccd269c4e5d0e9aa3448eada5069788f5286","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-09.tgz","fileCount":41,"integrity":"sha512-aEHWveXzmhm23xdCIdwUZNDnCShd+UwLOo//JFQ2SH3CWr44T4hzuE9aET0caAaXCbtxzXlm/bxk0HE2qzPKmQ==","signatures":[{"sig":"MEQCIFHcx61uzJiPl9Wo3AtHbW+KpAGgJH4DIDeuRO3ui1gPAiBxr6WMi4v+gO3LXZUThIjyd3yIS1jxz9Z0ZaMIFqTxBQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkCSRZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrwNQ/+MfgcLOjC6s15iJne7xbRarbzzOh6UvbPuWf0qf1UK2aeUSd6\r\nm/CL14IVYG4iecJMPrGHYWJm/itHzMlYwaUwGzjeJbX2Z9AvXkX1armpusYF\r\nVrFB/Ord5G1t/Lk9EeQY9iR5LLWmQTOAg+L3rR7DGNUura4K7bo90jP3X7Mi\r\nryQMqLtiKSd135hmgkSltOGwQOVCxTWa4yr3YxHyyziE5dTzPu3DqsIHILtX\r\ngQLrXoDX7vK3zadXh/AF8rb6ie7Yy3zodtk7wb2DpnkIY50X4cVs0jMJU67E\r\nAY9G23k6QZtfxljbeQv/8CK5xIkpI0XaQBS0raAr2ob4uHeqdX5VCiGGZSHu\r\nb079SLqp/I1awv0cN6VgNHsienYpBhUF/h3WgIsyR8JJN7M77cJNmEsLAjnv\r\nVANvfm4MkTVrFuSnhshmmb+B99mNggT/oM3T3PE4E40l/pZa9/fkY9T5UFNF\r\ncVs5rdMNkuI8UD3GH+kDY33CgQk3hG5b93+oRwJqSaPtmsx/cMebvjlqoY12\r\n0gK/YxfBMmx2BqC865ufCVk8FRBNzbDMbrRiWQIG0ARd90gsqJpEor9bcvLD\r\nm0iTIuwYHmpTPeU8TUa4NbN0VniJzsKxfJnZwTBKZdH+6C8RU/nVu0FKBFSJ\r\nTsnmyxWD3grh8SDOsg9QFaa0YK9yEJyzCDE=\r\n=OL/a\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"5866c4463d0acb4bb06b520736dd058d8e0bfe5e","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-09_1678320729045_0.12582409050480292","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-10":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-10","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-10","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"5f9ba927bd4ec2a93c9ac44858fe6c65257c5278","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-10.tgz","fileCount":41,"integrity":"sha512-aiFazecL+1rJtdxRm3HkyzC4xd5HONhXNtKrylKxcaMsdujiwP26QtWltS/E1qEvWUQZEQ3wkGOPFYkngxUBAQ==","signatures":[{"sig":"MEYCIQD1NBP2FZ1HdJ1dmtEOou9/NvYvqcoddo3IS3toHmpKGgIhAOO1RLy0zIpc4+/ICs2wnZ6IyMt5+CWP9Inagb/dnZ1k","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkCnX5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr7cQ//VXZG7lMvIy95OkHaro1EZ2zBes2HjKRcO5TLDm8Hi9r3d2IZ\r\nMFM8I4dLDWCJIUVTXV81s2XIVNWHR7QkvVFbsI7CJhZh4fYsUUSvY7bci/T9\r\nFdctBjO+iEv96qOIz84TYpnDBjQPJjciF8GwZtMS2mZV4OhCfIFSA11x4rI0\r\nzeJIKw/XCwgyDB+1NbSAKumqpvibMRTKJeWrNtq4jgCIal2QAeeM6jx3k/de\r\nrRLAEMCNDbSeSEJeIhHL8iWseEM5e3O4AQ6Yko2WXu5eSXlOXzBvMUwomtVx\r\nFQk0xjysiSZoN/06ce7tdLOD0beKrDmjFavcDoofYe3h4SrD3wY16JSgtpXV\r\n2kj2BRDYh1aEUeW6cQkhLRIbztBnBlRMrTGfqI66UlfQmfi+cZTRzjAQKtxo\r\nT7GC4z82JeEeN45IzWQpZkd04tTt5QaQNW4nSr/FHssHCZAzqpihENonXLBI\r\neZLByHItQXPmvx/IDVBE4ioQUT8KmWen7IEhEzqR1lxLHsYo/1hzVzjW65y7\r\npukCU0rU0lssSCrNP4ubMTuaYqEYmKXQCrvEf5CyFBVBdQl2ItV6uZ+5og2Y\r\nqP4F4iGHpVht/6rXKr8/ZYzMMc5m4KcIlWnM8DIot1gTRE+CfIMXMJChMb2g\r\neltlhvBAyasLqLRREKkxtF1lg0ukG3wuVB0=\r\n=GHuk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"5866c4463d0acb4bb06b520736dd058d8e0bfe5e","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-10_1678407160669_0.9622561414553699","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-11":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-11","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-11","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"ca3e3d9f15e5d68cb3f6f86f1a514fb472bc4b0f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-11.tgz","fileCount":41,"integrity":"sha512-RxoFkbD9wGhuGgcyyMwhzLBjGhiPT/FL6q7slfqDYuAk5zPJrz5LqPTfxg+PF+71fKbQN3PDrmAOJJvP/fd49Q==","signatures":[{"sig":"MEUCICM0qH1m4FO+lpjBaE2uWg4ycmgm4tdriCVACMFKYRSiAiEAjAf+Q9MHn0bsPLNWMsWBBNi90FI08p2VuaYGyu5pqlo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkC8c3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpppg//Z3T+wm6lNS06t9CnDTONVirQ4PD5HWbBgNCcdQmBvs6rYDvE\r\nmbk+mZ6I+SiaqUDKbs5E2lVuvrLqXb2PmujMrVOUfBlfG7p/cmzcsHuBkD04\r\nMvj6jtJT4X9Paj5eoxktbFLsQK7J7eP4ejjxyDwE27azYZPrXRtYFU2ynQqL\r\nJBCAlM/Ta/Rjaj+5NO42mWaMwTNyOuxLvZo6btWGDS8cJKi6WK8XPYl8VDyW\r\nauwAiUHskI5kDRYM1+CtaICcE+M8OXmaQYeEdruQQzfXdKC52B31d4kVaB68\r\nOODnDJWqGvzZgza2PKnaV1Ym/j+f7qj1slrBJT+Fw00/HQ9x/8zuGjOGfb9Q\r\nFL3Tdpc12ltiYOSXJt/eubAJGY+G2gUwckcRrOAGqKrtQvP+0PudUfgOzhRT\r\npMs0siSku5Ci6HLoY+BYrj9gUs/zm7YeoNfZ6wi0r8fvhb25VNvy2O/AEa3N\r\nNM4prWFftrbIlnvOl4zrMdZdLQnAgil2x7gSYYT5w6tmVAGzmobRHMkwjPQv\r\nxBpqNyqx52aLB6g1NhiCXKVJrVq/cRysr1QTL//2rAp/5ptXmJ3zs21Cj2F4\r\nfhO8ijFPtt/4N4tMHSr4Fk76V8ZLLymaZOEIrQJepGQJTA+3WFQphKI9xR0z\r\nHBYhFk6DZFL9qWAfVl5VZNduUA5XKFYRdjQ=\r\n=dnPF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"5866c4463d0acb4bb06b520736dd058d8e0bfe5e","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-11_1678493495239_0.09498928529000206","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-12":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-12","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-12","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"95151a92c99e34a84920d415037bff3bc66399ea","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-12.tgz","fileCount":41,"integrity":"sha512-3VGQ0kUMREG/Cq04Fv40CRn3xdZnP6hZbnFO6hncy2M+K7IG2CrT40SfT/aGRVLDIlPSTc9p02YXZZb/oF320A==","signatures":[{"sig":"MEQCIEHZzRqwJR7LXgxDc9eZ/qdGUUrESTy3jqHzFuw2B6sEAiASrBwZBKvPHmhFCkL3Q8tED+v1RviQRLNk4VEEBolC3Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkDRj7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoMsRAAhTFBc2v5k2KsmDz81pNYlC4oA+1La2F0CSIKz4bn69k7CEc6\r\nr0/RruX10PA7qb7E6ce5oxNffs77tj/aOw+N4YlOEgX7sTzh1LncK38ac5Yo\r\nFH2G17ou2yQHM9kTIjTiy9ffe+cMsPZQ929ujF5TCNJtLAKJ+T8Jp10kcDfj\r\nNQd1xBar7c/6VoI+jw8aDLD2HnBI86zZ2nS9jL3PA+hw2ieCMPOAN38kFZMz\r\nbhAhwLjIKNjlqxzMjSvD0WAwsTOWVk5Pkf4ZVHigqGi6Nivai5LAGz8iWvl1\r\n8tbslbgFp44kazLbdFkki2i1lFRiuZQu26ueL/gYL1gHAYEG+61u/gY3UFc8\r\nCUkMikUerzXoD9kjrgBY5wGeNkdqGMj4fdtE6WYtHldrQhgupw/kCiNYAoX1\r\nGvg2TvnIZRsR5E6vjKGix1Ne44aHVuz1MaVSX3Za0J3WfeE9yDYy4WuNfvrl\r\n22J1APK702PfkJX+KW9OGtbU1liisDvrTv29bAaW7xSmq10JxA8YZnyYehh5\r\nwDdhky3k/6YBSETqvWc5q+ib/O3Dlzkw/p260FWNQHtTlGtw6Hf+2WUGROLr\r\n3WNbF6RiBE9qT6i3lakwsLhpwYGo42RrqOQ43iXEFndH+YlANGzvprcbXRwO\r\n0p1X/Kc2J7BuNoV9ZUeMKwKlUQTtoPmQ1Ow=\r\n=FcWU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"5866c4463d0acb4bb06b520736dd058d8e0bfe5e","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-12_1678579962969_0.0031506193544763583","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-13":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-13","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-13","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"4adbd0e09a7ea07318dcf1f7698a9b8b9baede1f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-13.tgz","fileCount":41,"integrity":"sha512-e+g+lLq3ThbviawLouFBc8f6/CXWr9xlrwYoco2AkGjfxYZvehgETc+2xxh7t5hbGwMD2fYoAU3K9WsEAxGBDA==","signatures":[{"sig":"MEQCIBiHNkRAPQ8wt3Qs2Nq0QyGy/4Lx8CQz0qmf7zlRICidAiB0jqn2hYH4p957pf8LzsXhMDP3YTlYT61E6upKorGd/g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkDmpdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp4Vw/8CCPchy4os3GgNW0CMkNk9r4hRqeju7OnK8Y6dQ2jcX7F2w7g\r\neZqevzJq6VjZbt+LBrhhisZvkQEJQzIZ7srb6EILF+1LG/PC9tkao7zBx+Ua\r\nu+hIYoU5i4GDdpSuJhcrzsfnZYme0hDUBQtmyIPPMI7AxwV5OtHi98Yl88tb\r\n4H15VZ9jK2Lc6wLwPAafjFkJOF8dEN0S0lis7NElXFZTb2stDKL1I5QyBLxi\r\ntRNEP20kNbFFHFu8KIjaa4SSv4fDQAyUqfZGw+vqbdmhRamo2YbDTP+0YhhY\r\nt4V1UZ3Cu2GFjfcGfMSOO4/79euaFL9V2YytH49Evb23BcWmPCIcqIjWOSsg\r\nfXKbA5kFPh3j1RfwfMQvPcXusDN7LCZDiGvd6G4rJKLOPYA9377MPfPPAo+O\r\nkhky0hLun0YVvYYnvSUK6b1pVW5LFOfu1sNgzEDWlE807KgJj0joLsLisd8C\r\n6AUVP4g79CoT/RNFzcao5v3QWU+H0d8aB1lvQ+wyyCTt8J+1GQoKrggoFgQf\r\n2/OBLsWdQnrKlPqiTXNkfeOlVlDCtVKrzQ7weRbcEED4b6J8e8FVuhayMMT7\r\nOSG6hkkVRJoZglLF7rujbuh2weKpStb46jVBmsS6C9EKA99IJt6ZkaWCIg2W\r\n1j5OXceev8SBk+DD+IkRoBoQfxH4r0fHe1I=\r\n=3WK3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"5866c4463d0acb4bb06b520736dd058d8e0bfe5e","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-13_1678666333142_0.6377241338202166","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-13.1":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-13.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-13.1","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f9fff1764795c9d6d6f01366044d408bd4ad3724","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-13.1.tgz","fileCount":41,"integrity":"sha512-KAV6jeGBWbm0IZXFHIzSKLFhUUkD6qpI8XWw63PsHgRhqnTCgotLl2KZi3oqO+WWBwOk1ykP0Oczi5B3RXIQ7Q==","signatures":[{"sig":"MEQCICWLVA2pDtL2m9S1+Z4MLlNVTzdarWTHkIO6YLFq8NffAiB1hNREUfhJJM3Pzl5Lrfm19kVWqZ8c+H70Yr0/0z3qyQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132916,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkD1BWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmptVQ//X98k3s1O8gS/l7g1LaJ+/uH7Al2NDTvcx2iNIO7sP9QxegUm\r\nt1+dHVT2jCt1Kg01B/sCxyDS4VUs5KfGLpMiEwmNlKVkO5qZ3y/1PRLurYsB\r\nxlwYXHPXGWrzL0QsgtH6w7t+I6ktMbf2moN0pGGgbLLXiAUskZhvP42uddJZ\r\nf/vK7Zdp4u/PNeZTBR4/ETfxa1SD7ICm8iFLJCWksyRkiBmYka6EC2uwTb2b\r\nBCTeIuO3koE/2OIym3kKi7BYSVbJ7BHqq4ArvwujGcYDJqNwXqxX9NvDhR3g\r\nMeIlCzzkx8JTezEW2M7AOobyzlAP9AIe+cgixfMnUdUPueh02GDKmVa3m61U\r\nSbw7EGAxqzH/HMBxov/WljNE3pYGJ53aL1YIFqzEAy9fzDJ6xB6EmV59t3KC\r\nKoQtej3Jx+x45xGbnoN5NCiemUyaXVfC1xLhjXwpo3ErMmevYP69IqHJ9OOU\r\ntzAA217e/W6AaJRwFrVCdQs4xNHQHX7HHTSzKoB9kqiH2crYYwNk9HHAdNdq\r\n8M1Wa+PDAOIIfavY4az5qSYbNj5q6Cn4h8pptTKb0esVaPPCtNCvA3uxIK35\r\naf6ICss++efRKbSHOrQN1rza3+iPSpcMlmeA80DseAf6KDED0jL4K7ulfrLH\r\nrqBz/EDOAmenQ7tRKZXLe98PMQOA4ZdOfgM=\r\n=qWb0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"b2d3c19b69e463e9bc8de83248235054ec0ee1d6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-13.1_1678725206174_0.5598848705348838","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-14":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-14","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-14","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"94d02fdf5241d5115ff9c10273570678a8fecc53","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-14.tgz","fileCount":41,"integrity":"sha512-ma1K6PdqRs9DFzyG3jVqApOkwaj2fQxvOn/j4g33EsBxM7uMomJD5gJWpBaCHQSDGIbAKYERKIcLW5KTfQ6Wxw==","signatures":[{"sig":"MEUCIFCSEQhl2GEPMqa1zPzIfWIG5p6gvaRZ0apM9KJcEuipAiEA+PrmODny2MY8gxM2hAWSkI6bSApjw35F6nL53TVuWU8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkD7vHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqEuA//WyO+Q4cpOKMweINDgxYVfL8Q/MRH/wAiaejd7nQSf+qb9rOI\r\nKcwm1p4mi1gASwoXkIWbW0/7hF0YUd3uVKTSS4WDL5pIQvhkf9d7U3di/cgY\r\nZ9yXJXTw2L37webyUC8P8Y6suXXJ4KLKFvUexQ8yEG7UKb76wYzjU7cdZPkQ\r\nYWXdpi7PGDqF3nxJIFN9u7BvFYRWo/EgYQoiwMcpvnEFRrISm0yiW48tPtjh\r\ndGhu0EqvGz8D8HfEGs2nAkNM7ssJxbDmz2krTkvDfZz1Cbg19uwxLBwXNGkn\r\noPTp+eCcCaerE5sdr1qH/s5yag0eVvWjyLwCsMH6sEW8/QINxk2PPFKpi1OH\r\nnFNAffFxXYRPAuhmgapvWIU0RKOKpbHP8SHqWySheuaDjAU00kmH34gbOIhE\r\nD7saY1gI0M+GwomqpETSGWUBkDu5KmWD3Z/c2HlZ7bmbyZdh2TaodoH/HxrD\r\nwJ5OBSKe+NluehqILJIzdsqiE+uwchJvFTYc5k7UafTszfHo2Tx9m4HyGtIK\r\nNkQaae5O0VwTe0VkHFzpFmnAMZg5wE3sLhDWdmxwoFfBLyXHDgM26pJSDTgm\r\n9apY28ouXa06KKT3mFFhp+xl1/sgO+vtoQ4q+8wk17LfShuOOuLb9lqW/5Gp\r\nUywkrL+2exR/UrNWOn6LI2qPjEaDBIEHTuM=\r\n=uctZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"b2d3c19b69e463e9bc8de83248235054ec0ee1d6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-14_1678752710767_0.8893444008525175","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-15":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-15","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-15","maintainers":[{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"9a8d0ce1c0446e08e5e050ec0b239bb6cfa2f1c8","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-15.tgz","fileCount":41,"integrity":"sha512-uiLjHhDkqV5XzE6mRo/j2Q0sTenXCSCcdX+jbql9Y/AADviDiRIEsg8HjVOhTbysRXcYOJho2BFZCi1AL8HrYQ==","signatures":[{"sig":"MEUCIQDIJTskXGXkILbfyvOwuyKFbrw+ngsMO6YWN6t3+twQWAIgfs+4F4+X2VQe6He+WqvvqmWE+IPEirljHuY2H5ERhRE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkEQ1RACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr3jQ//XDClq6T1dKfEL6uPYzZl0+WEhxXDghRT4t9nSs43Og1tHelr\r\nUAUgvEufvcOh5r22M8qQezMHfZOHR41rOrPK4VHLYXZvBRe7BtoemnRyKGdS\r\ngtLyKGLmGXiCKdsnInve6piu+GDogIl6KUieX3CbbzuwpHjiiwTzwyMa2hTc\r\n6PdVpYW2W+40hNG+pnjqkq9htDc8cyHeWa6zjIVquWXC8daqIi1nyNTJeDml\r\n8zZtf22ZtOV9ok4Ya3iKW/aJfBlLumwVF7YzwoWMzxarHwR/wJ2ReaBK1ctv\r\nE1owDscyBXgtXhVka64jFz3DVTxcxDR0wGgy3jniDdciP5rqfSZmQhJzLUKN\r\nj3kwov6Tab2uWAB6zKwx3x8ic1Kr/rSjMzNjGn1rL3fX3iFcorybpeGTRb4V\r\nFvAss7cV2LFGKvvjucn+Kylr5JfAFS4aHfOb9EdKty8HIcBrmKZc9pj9bAXF\r\nbjEtIvV8CwH37AMSNi40Zdxwu6iunjOZDElywWO9Dh0sOrJ2r1WtfQ86fibi\r\nu+NR1bgyctFZkPD9oDJ7aE+l/+t+tC8NkycwJY4pSLq1bX/B6EDukbpTTCOS\r\n9Ts43XOsGIfqctq5i9PvRkgf8uPkFM3exC0AETlX35po69sr4TRalJ5m5Rla\r\nNVt6r/NZUKxl8EREHdlxLYi25Ne/Qrj2Pvs=\r\n=CQN+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"b2d3c19b69e463e9bc8de83248235054ec0ee1d6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-15_1678839121494_0.02788180218212566","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-16":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-16","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-16","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"bb0c5b6b7231030a0045c01017fc4012200ab8b3","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-16.tgz","fileCount":41,"integrity":"sha512-H8iplH0wZoN0GUsIkYOL8k46cDxj/8mS5EZk+L+yXGhXV1ijZdsDnMaJGwtivpx/cUnGEIIWbAktBP1UGYlk5Q==","signatures":[{"sig":"MEUCIGZCfRrx/WwH341+xzmPQTir8u4Koc9hujKqnAIy+4wFAiEA85b0fU8rzfbiuvwdnqN4qt4uqSgVoluJqS9B7OZOhwM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkEl72ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpW3A//SZ2i4ra7QP57kbpxeAn7KctYPG5stzU357v8AS1EHgwmcxUg\r\nycPZpMnLQI0AGvA7gPlD6dXYARlaEJc0+2BSfK0s0m0DAp5RD0TNy9Zcvx4C\r\nabmhNME0PEpHtqMr52VbOgoe/nOP7QXQyIPXhD2qXwc6ex7+hfavS9UumEnF\r\n+MHs16WL/YT8qYzvgyZN+cinv28k7cIODLH7nHv7TNjUotqBjSqR1qQ0AjHo\r\nCdcwpNIphGD9OXGRgzvzlulfoQvHFWhQ5+GHMAtCL0DgNHjMQYat2CeTD72y\r\nHgs39t2ZH4cU3eVmZlrl/+tJ5yrEpXczoB/ZkgHug6KqeQGlUiE+hiOxj89W\r\nTuzeV/q2Zm7kj0LVSpN8apja4m8+jt6d7v4qvfaVWgN3aGSWL4Px3oRSgQ8m\r\nxxrBjaeACj2lEZU4wrTsBvx+xl199F6ZpBSp8zg9v6Spk6vnjPm4NWbRbALD\r\n6RuXI4xKXuobT73lMNgzsx7gW5EWMLZ0L5MSzjnspytR4izWqNCGjv/2q8cK\r\nZfI+lLKZ+UHEmr7sjXY6GtcsA69qUXZZSIORbpL7Gghy8wSdYmoUEq8cDfxC\r\nmMXtOMvFhAaTcS80ONxG9wI/jjq1y7/hwhFeRJ3yVJxsxmpQKRe0uPKbGEPt\r\nYkl4ikm22D7QOo/uwMIKEzMlRPUXXIrTskQ=\r\n=Nx6y\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"b2d3c19b69e463e9bc8de83248235054ec0ee1d6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-16_1678925558703_0.30015693128294485","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-17":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-17","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-17","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d4c79e6cc37720fb14ac4de95b71414e17e1a028","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-17.tgz","fileCount":41,"integrity":"sha512-4VyEpuJgyOBua4hRJul5X+K2ZefxLb3FJq/JaLRo4fxy2AU7815SEXGacxhRvRekYSDUlcaEoe4GD0eavKl3KA==","signatures":[{"sig":"MEYCIQDPount93JfWK+ZLkCZcE2Ed8l/Cyiht1Gdft6ZFVi9ogIhAKuUzdmEbHviqeaEj86ZCnlLxCbJ7meHf17jH5YY0l+1","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkE7BUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr69A/8DBk0VGgT8D8wLNVoeyTASaWyY7aPRhLTH37PPfMQljVCCMh0\r\ndXpdFVUrHTHjUnLoRe4zDxV03B7iKqFL6+c5/6ugYS9RueCfV86QDYLrdYSq\r\nkxcLQLwxGu+wKv2tiypAOF5xnxeggClJzjaEFsNdY7wVDdEMWEQdwG912ZpN\r\n17HOdJzG+riThE0RtBEzIPFaFiu6CrN9HxPlgs+bGhmZQYIQOko2mbrBIqwN\r\nzAw0WvY4cZyDY4//HXlL7mqqBrvLBDOjr8scKgsPh+2mPd63gEFWuLPeiJ3u\r\ndQW5jmVEhBp90bl41XX/EXQEDuJTjbCcUYwMFxaQFm02WLjlnxYlg8D6dxaG\r\nhiHAQ6gRSmaYooByDwJT7I1d4SqVqcD3H7OAPjioPRvq3iOY7j8tOISWgEWE\r\nrUkmHlaGHzseEg99xdwvymiYvl+yD/rk026qCOAAekJOB6yO2AZaJhKgPcAU\r\n/bAIPXPFjxFh955ptsoaHnwKZAKnAwCIdJBM5TcAfgYc0AePcXIykhIInYX5\r\nxNAsFK/FZRaYPg/fstl9JCzKY0K/kCeZ9nxwABnx0ddg9ntep5pzeIx+4X5o\r\nssW+JGWPsq38MnVpKgVbg2NJxwKLC9wv59ZgKClA73WJMnZ++BBTnjFrASm4\r\n7CDixF7BISmlNPw3jlQc1PdiK4WsRHaKyBo=\r\n=NJt/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"b2d3c19b69e463e9bc8de83248235054ec0ee1d6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-17_1679011924138_0.8450576930870104","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-18":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-18","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-18","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f7694af0b35dcef6e2975daaf00dd5e165971ab2","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-18.tgz","fileCount":41,"integrity":"sha512-JSObC9v+R/bo4oB38iYm0t9iKgd1Zm7aLclPILKgcZBkf9uv+qFVZNGUXltKRIYILWEGH9oDk2PZD1CCXD3dLw==","signatures":[{"sig":"MEQCIB0EvCmhbtmREZESwBCGy8szgSIUz0apm0mC92WX5uOCAiABEVPFOcvZnAybtuhuN2dRQ8PBLquur8PLpI+9Q9mWIg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkFQG5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrA1w//eEmTmePKFLdkmW/VjeKf9HL0hKbA+XKh1EXPf+1+N6d1Rky8\r\nDQw/AoYkMTWo+DwyBWoGcCBbrfKv95UXWM4vuWom9+HFFot+TEbkrr/LB19Y\r\n0t1EkMh+OH1/MWGK+UgXg4nY3h4U7xPEeldXC3RPyT0e5HrLGQbxpuMSJ2/I\r\n+Z+xBPqsPyW+i8QK9jdyel75jPUNF4YpsFvcAdz90PtqS6frXrwSUsDKJfYe\r\n+ttv0GwdEVhb5tY6XGhz2J6KZMDReWD6O+L5s4cS5KFQj9sHBNQw0y3SXO2Y\r\nBk9Tp7gNPXR4l7mbbTtDala6TNfKXtcJoKQsa83A9Dh2Rnyo5U1vEwq2BgJr\r\nEZn271RAnW7tNnv1IZK4v7WVf/M1OlckSo8vNHwn+dQpLh/WPcQcLYqioFnx\r\no6dizRzYVSzw5azZYy2af4PzmQH+QNdOHaqb7G3PPs1ae5RoVZXNprVaLi/j\r\n01gIkbrmREa8IV4+dBnijmDZIL6TiZkWBmY2iuon32B2QwkS/71HmXOXBntb\r\nHZCOcLxN9DYkpvj/XwojWqyguOWizSaUjqbcqWHUnxtO1NAXym8fCpSmk7KH\r\nphyDd+j44hV03JAGsmuO6aySqrsMHDOf7Mx125UrFdTgvWdYFfdyyGgc26U9\r\nQyZQ+bqa21igP2MqRRmNV3PEX5PjEIl9W5A=\r\n=xF/9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"b2d3c19b69e463e9bc8de83248235054ec0ee1d6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-18_1679098296928_0.5052102949660451","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-19":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-19","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-19","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d5a62f3c2a6208acdc199e2e001f875e6c2c9c7e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-19.tgz","fileCount":41,"integrity":"sha512-8VgvpXy57Hwv0gQld7leYI5iHpPY4Yc3yB/RqpyWfjo4U/wwEl/v47lB0lO/PoyXhuk8JWaKw+eQz6dBZQeQiA==","signatures":[{"sig":"MEUCIE8wbVRJmb/EqLYwcxgq8PM+FwSS+41lM84eNrBnUlf7AiEA1+yECGEj0Ozgff9KIpvLxmDPAHdJd0GDlvBmW2ZXo9M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkFlOqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpfmhAAks8sUnmV/V5FmVXJZHPX92HFWtsVE7jqHZxATuo47s7uTWJT\r\n4xyTPzhSD0oCUzMekqSH2lSt8dHZio2GcXuq3SS0GXaPrk9qY38s/FSkH4sY\r\nVbEpC3HtSyeWdSKTUmXDoNK6QZGPTZVwI98dMkgett5pEKTMNJVa0YS7nJTE\r\nMDn72XMYTmGfwkfoH11O1ZBXChxoGGfW4ts9P1VC1yBFL3+gtMtJAuieAPvr\r\nWHpcnSDB++w1nH55xQ6xfuy6hWWG3U11wH9jP6QkYGRRwqD3DoJXTNnG0fT3\r\nl0bhhj5OrwidA0VNeqFy6okg89boQylAfrsQ8AKiaU52SFThs2ERiJhKFDqt\r\nKVLnD8S+4FKfAVuWFZlffxsn7JQA1HmgB5L0pPS1Akvg59Vp8+qQoE2zWJ9q\r\nz2XfAQI+AtQfhPDBpq+raywGlT+dIZDUkVbIZvHb4EkZ5rkxTXcIqf1K3al/\r\nbAnjfIAOYcU41Baot3HfCpfYYFY+jCcN7iRlbdpt+xUB4gtYxPqfltIfUU8T\r\nMgeBbWT/mYVfJ6zpitMFd1aXu6vdtIuMMZvN97YVxrJnxfVhFOEht64q5rLq\r\nz2wEsFzTy9oYkP0o0SEdioPOY0UoTGPweRFeDx7ke3jGCS9kKkGztS1+4gqS\r\nSygwOWj6Z2J2kY/udwxi+fCQIfAxn21h3w0=\r\n=QhWG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"b2d3c19b69e463e9bc8de83248235054ec0ee1d6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-19_1679184809851_0.618635611539085","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-20":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-20","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-20","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"bb8fe149f1fcedfe47e88daee80bf248f6331f41","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-20.tgz","fileCount":41,"integrity":"sha512-9x42BrM7/+qjN48cSxChGcoXFEwfxmPlIg75s1gn4c5jvJLMDIA630qo0Kx+jEi+G1aVc7R94Svdt+l4WExszQ==","signatures":[{"sig":"MEYCIQCWn6OyGmEBlGyYc5Vpe93maOhf4UxDGKSZhRTuUzIIHgIhAP4nRq/VLH9F49wIkwsti3nansNmEhUKYT9kCG9E9PBf","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkF6T5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo9DA//eNgkkG5NBVhHdV3t2vxCudQGCG8U7NEfMFzNsoTiOkp2Gjfx\r\nO/Tecqms7DpmA/KrdoR07Eyxs2rsu249NLg6aMWx9A+86NvIlr5eWQFJbN4J\r\nUkSyNwKhwIKvFSxDFuof8G3iU3byLzkMj+cU+RmoHHBxcTIFawnjkJlgbfWq\r\nTDpZO4Oh+hPviA6Yn/9oWHsECirU4xrqVWWDJaIBqzaSKDLfYDx22m+DHxUK\r\nPQBrqprtTlW5mJ+o70EYB4i9wdp2w/auH0/DAbAdMzm+a6E+NTG0wfphNxAT\r\nj/WsdlWxgpktq3jMGxJs5oU7kwUdXpa2PEk+J+5p8tguChLgZPEA3Sz/c3fH\r\njXk+C/CdZAB67BqMd4necOqeZ+ZAu79qOCJQ4ooeoMQ96a8G5k+Gy5UqZ+06\r\nVEc0Xh3XAZmoIiL4CEIcIXHdeFyaM1SSEz+JZ97z7WIzweVO7kAK7T/VSeaM\r\nPSrHu70vS6fXoJnyj6aWLh79F/TwcH+WDP6o+bxQgQ7++av56vpI8KXkdIO9\r\nOICeMUbhUNrL7kf3yWLyddgvH4sQGg9R44MpaE3R6+OmTo6UD+H/6ajCZzo0\r\npFHXb/offVg+iug2FIKVrccFgr3uxWytoaANtvOOfejUk6kKzkYt5t3WiYaD\r\n9jvU3Tpbq1noLzdz4DDSdTOQcayQmbwp8CQ=\r\n=mvKa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"b2d3c19b69e463e9bc8de83248235054ec0ee1d6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-20_1679271161162_0.02496181065184566","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-21":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-21","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-21","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"e84e1a089dc9a16295aa1cbb6541f724c6735c08","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-21.tgz","fileCount":41,"integrity":"sha512-GN8v41+A3uFD8cWuGFvLwg96oVa6iEzRu7voL0sQKWQ86C/w5m2nKE3818X0GlBIQctz0GbszTGrHx8lC7PXOQ==","signatures":[{"sig":"MEUCIQDAukqP8n3jUxvRidgvPKx0JqQxKa+49N1j1HGPqZVgSwIgcT+sQNYXeqBsNDRxDzqQCl5cDVms9miqDbLtw2wD1xg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkGPYcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoFvA/9HhgOFwY4SXLtOVQs6GD2U8c/cIbId4zx/mD/e+Fo75oMYvNs\r\nSb5EpneBB8ufRnq2lt5pB8rzfZuDJDnIBOx3LVQmNXKdgGPoqc/XpcW4nTfG\r\nrjhlKXpZ9VNyuUZXguw4GTfMAa/C61N3RF5Y3plnGEWznfHN7WyOt8tVkLfg\r\nRjuLLSoHiF+spTsPGCgXELiLWdZg+74bbvBAO8PzzsKcQqFtEcKgT+0MLUwg\r\n4zrIKaNintpqdXrlG/kJf4UQOTE4eGuybMsI8rQs6peweDuqTflfoDXzup7l\r\nd54iPkFkcw3Hc3b7Wi7rKw3pBm/GxJeSBm1fmSSFTz1hAFLNfIr3vyn5M0Ub\r\nRt5dkrTK61IzMtV2EpU6oVLYn9XW8OEdmrtQyfk9qt89GFPGvZit+Kb0qXlK\r\nglVCpimOYFIH7M4jXe7h/c0+5/hFaeMefTtQ6AmzQeZ+bImIj+mToZNA60ea\r\nvYDdnc/8vKKmfILGVYIHYpuxwiejb86m4o5pKNUwvSL5IqxvYmVQUBuTmOE2\r\nQA19bLxbb/JHEWZ/UTD553H/BKc1PTED6GijrbvhhOEHDwyCsMgHmoix6GRp\r\nCyRQR88xffl6T6/EsPzzsLM5BO6zDX/aR5u+nk+1inW6fvg/Jv1NZ1cEaS0H\r\nP3gR+Kl+69MHOymlujVjE/UKr3l4AWxdw9I=\r\n=TrHD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"b2d3c19b69e463e9bc8de83248235054ec0ee1d6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-21_1679357467807_0.38057019415203963","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-21.1":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-21.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-21.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"80bbdcd0684ffae4df65d00fb82929729a6114b4","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-21.1.tgz","fileCount":41,"integrity":"sha512-8AD4HJW05wQWOTI4nNXIBIQeoZmr32wApdEG2X0HDknzIaqDeWRib6/FLx175DLlnEiwjarSJMvBi1ynCiDZyQ==","signatures":[{"sig":"MEYCIQDM00qGgeK/kMWbgru51L/RQcBa4dmDdgKYgU7Lenw1ywIhAPp0FeW/csLbtdw1e/l5KG2vnGOCDHxNVdDGQbBykFt5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132916,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkGUkcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqgoQ/+NZvjl4pwjLvP7Afnz0UOJth40j/u79h9BIOeSu/1y21WzZP6\r\n2HVAEFf/XMk/ioSqCTjOiR3haO7FmgKnqBeXvXLaQGmHg4pWsAYs4bOZo92J\r\nSdJruPUbBlf05jbv5lcj7HrymdoedEFHHda/WjYmDlcrNjUwAo/NvJJlB7mx\r\nwlwwsTVJtlzZwVMI2d0b8ssrj+YNBQ9HKzV9yF4WXD5wBBDM/zFIYn6pI7QU\r\n6KesGJSzHxQxzwFIoPxKY2Zc0CAos7o7vKR4BvnQN7TUT4sA9PqiEVa7IOEV\r\n6m6d5zeAOYgNeFV6/w6/E98L1DJ0hFiwBa3x6Ax87JLK9Vzizq2RgXTu+ikT\r\nyvmPMbOgZ/hS3/lvacrhatlUl4V5gTSA5nSF4ACTCn99HYwWuWcE+IGNJR+J\r\nHBDOEgDby1mXt5nhWWb8pwpMcWr2Z+tv09/awCQ1kcxBIOw5k/8AJ/ApEkgl\r\nRVNBIClgRFyAWVP0LMYVBOdMo0TIIjpFWnprONqgj0BjscayjRUMTUFXSr56\r\nK+6glz/vGL5DIzARlaD0B844fA3Irf101jGy8gsXlCRup6P0r1hxN05JLqen\r\nqRekMxV4RoGp6qTFbgnUpQeFwhxUS1rosTuTz9qy2JIXv6q540lY4KbpCiv5\r\nw9VzpD80xc+S6Nhh2duzKjPI/f2dZ5s6Cf4=\r\n=5Lli\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0293d2633de2ea531d9c97eecabffd28cf564b06","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-21.1_1679378716460_0.6892280073153494","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-22":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-22","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-22","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"9f2dedc9ea7fe311e4b3bc3ae166153616bfe295","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-22.tgz","fileCount":41,"integrity":"sha512-lF8UmIlwTop3RNbrAWupSa80yHgSnWjxvLnie3dUspsNjv2JFJ0qaw8A3qkop9QAtx1MA0BOvoTV+aI9yHqU6Q==","signatures":[{"sig":"MEYCIQDrdPER1H4upzYttKB8OORx+GlV53OxXdLT8v+PVWC8SgIhAOdW7FkdL7XoRmDtNMOrbuCV3I3zaC5rz+jMDq1mrlz7","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkGkeNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrUIw//U7zQ6mN73DXdtEwmvNB3hYu02xxUddOH9kFNAVohZWcRFO7q\r\nLw5Q58aRkqkjocFqpq7BER/k3353MVC2MAdyvysAzjPZ88w9c3tSi9W3C8LP\r\ndHrHe7jYUIgyndI/acjijik93VVUMUxZtRCwFWlGkL3PQO/pcGz8c57lOBgR\r\nph2kHmFqScUi+51pcnQDBa7Q/YZc4vlrATD9/0F81DZrksvZTgIjxLNH3GPL\r\n+vNmxg37mn35Cl4xyb/tYeBE6n51jYn5iSOkhU3upXEmNWsJ51RJnWMDscsC\r\n92aW5sqwIDAaUktvDuyVQ2nQK5xBB5RfN8mTex+9kGpSTTyqKhgWGeRmumPK\r\n3+bleW5GiZbbjZRehtL7C3PioW036d0Qta5O3tg0hyT56nui9JqhcnDL/dUH\r\nOZ+pU++EYmurqAdIK1aMJBwepBJNVQbI2X+VdvsAWSyXawNppmYhg3RCIhSB\r\nW5O5HVlT9h21mjzHdU6XtCv5EBt2d1fFj1Ok84196GSlE1/jD/qLVODyVbzg\r\nN29THEQpUJKuncU2fcA19peSbvOBKpX2Vq0ErFYLaVdWQxbXBbN3/k4oij2O\r\nQBBv0cE8KK1bN468PaddVt3VQtLN6kQ0kETGjuM7BwJhrxHjUpAir1cgNtWr\r\nLVNXHz/E1YeWrNEcEgKcnd2E9FNyp4FC4I0=\r\n=/4Ut\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f21c0c4b5566290dde485c6c944158cd86960251","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-22_1679443853648_0.6504442009553175","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-23":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-23","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-23","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"e3d9d92a4a6818170da3ac7dd99f3e5d0f737292","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-23.tgz","fileCount":41,"integrity":"sha512-JjbkM+BnZor/f9PEMv321/xpqcmP4fDfEaGrHdYWQB2bxlEBzb7bF5U3rmZ5h7Btr9EDlSkAsNNrqdknye+Z/g==","signatures":[{"sig":"MEQCID0z9rzPV8gn1pShecI4EiBSmGlurGFIJb7gdnxODMoPAiAp4HBfeeUUeKW36OGMk/71GbNsCAxUviD43jRjXwxGIQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkG5kaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrEKg//UdUvScXCvEgXaximRwlLG6WxgirJOAaicpf9rdNrFLhQoQgj\r\nNAjoVvjRSZzTmM3jsQZunSrBUSdLUqWC2EGm1t2mqlworE24zIGzmTyCTAeJ\r\nth/J4SnTO6/mzUEn5lllXXoq/RMsVX3OqpNYZATnPhMzZoM0ewA7ZbjIKrU9\r\nenl7awRIuLxuCNaE6hY77r0k3MbQZHSag5uED+ODfclnVjnuiXNB+eRJ0i0o\r\nm4M3cwB129GrK7U/Dv8/INLHpuFaY2VRc46feP/K2eA6ADWEV4/PbZ4tdSoJ\r\nkwGWpGI0EtMusJ1wu0nBA+XAfGCakmDAMMU+gonPxkaTCITw1yIMg0xLgtEX\r\nkXNmqmQnJpuOETJ/RW3JLczPdprBeUpZ6Z08/WTdPa1UY96BXPdWt+zDzdcV\r\n+ofc1vPVScn8s6gzJTa8vuV0pkYd9TDMVDBp1JR714/puV7mEhMuj2b+31oh\r\nqqX8JuLcrtceNFVbsp2yR1ElkS4/Dk1xTq0RJb0FK9YbkKAhsuKSZY3O8P22\r\nBGikvWnRS1F5rFCschT9EdH6dGw+qE2il4iMfwhI9HZcOd8nqPOCyTfNCZig\r\n0jE9ijLnBLnK3b5j1p0L1KE7WN5d0HoSqoHTAxJtqC7kkT33Kra4lmZzQFhC\r\nDQ+IcaParjnW5QDtEy1TyYC0J9Hd+JRmI0U=\r\n=Ocea\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f21c0c4b5566290dde485c6c944158cd86960251","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-23_1679530266531_0.7189121435674184","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-24":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-24","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-24","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"14a9fe9b90c15fca6f48c9d3bcc476aac624b095","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-24.tgz","fileCount":41,"integrity":"sha512-lCObmp21KTAZYPtFWVAATmslOpTQ2eZYuCebzOfv8QupDG7i845JLbonsSa3g/w/Kh4ZcOrrGuPXQ4RddTGYuA==","signatures":[{"sig":"MEUCIQDOWvMbaCUIwmlzX0eWwEMa1H36mAswQFc+Wu72GOaHbAIgJ/RTxbUNN+TBCNvH4Pk0/ZvQ7RYRptuZgiw6JWHDkNc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkHOq8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoxsRAAmWspXwOGhWYDeXDaoYCVJJOfrPklCP8PyYXsxuvA+cVx7+yy\r\nBTQfVYBh0ZsxiUGXEKWWSnd2LjPrpd8XG8K15OdEXLTwDXtDymt2jHxpPDT/\r\negZtp/uQ/viD17lAkxfq9+OghTFuZNJJunQ9kGkY9Q2p9NW0nCLiZsXRQJJ4\r\nQ8t5AHJMI4b6edoqUyYAnHV/dDmL7YxOthse8Gn5GOBXc64Qutr7/G0xH0Jl\r\nEce7ZNGCVDlkXPmF5/ljnZxlogvP8oG5a/iD288hVQffjUYromg0TYI5Z9BA\r\negMmHXNuHVWPNJdLkMOB19Os/WcSLsbCtb7Tj5po5WNrkVkSjTgK9nLT5fnh\r\nJd27QPtf7UEaHwJfVdrO4BTRHg7+u/ls6NjpRmyJD5FHqcMuNkBfL0C2SNp0\r\nKDZrJY+XG8TcJOLbChVHhI3S9Nyk2RoNBv0Zr27WLsbdhxCIt/PAl7V9WORx\r\nDuE0sJIbujlt2iBtqDubTUf7ld56J08Xbg074hpdFtf3CWWFbnIUs0fKGlOj\r\nzk3A7+UPx5DGAqX3O+x4t7anC0qiCFoUj2OLZORh51VInsuYXQjX+MTvxAT9\r\nPS7SeXOW59c1RBIdlxL3WpwlVIqyTHq4sVOIXGNNxdFtansOmRtyH2o06hnX\r\nNR8WJUMmy1e6mRlHPJ1QJMb72aUTHA9cHL4=\r\n=Dj2K\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f21c0c4b5566290dde485c6c944158cd86960251","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-24_1679616700384_0.7693642172203019","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-25":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-25","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-25","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"88709f315190720b7a7e8e26b86b949ebf730d40","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-25.tgz","fileCount":41,"integrity":"sha512-cbNEEpbrEjiEelQELcMmtZzGvRw+BTO/PlcAvzYr/CSGqjGAyWOb3CDGozxWZsmlhLt4GmL4bn3hofZ6WXIktw==","signatures":[{"sig":"MEYCIQChJ1+rZ//MVfgQQU/Ja1/8W2JOEGVsOZG2z0SMmBJ7pQIhAKxeJm02VwnxpYB3rbuM9ZRaBgDD+1KRD4tZ5RFEhFog","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkHjwPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmooURAAnVGaVTvuMnZz7iXCkKfBu+mxr4LJ4i5ldcK0ahj9jH73cO6I\r\nkpB8E+bQgGNm9ihA2e7+eUiweMOTSx4OLSoyI7QJyNUhPFJ6Qqyz1H6erUgf\r\nX47o7rmaaDMrBXRV2lx2ZrJAFq7RggwZLqzyC3hEgu87iPO1MNyow14f0uAq\r\nyGmLt+8CuiLgKJisK8GBf3nL7vh5BvvZu7kA/8phnlABbep5k0y4T+lWDCS0\r\nL31JNLhZtHCguKY5UJgeEv6WKcOugVyb1IQBNySWep8W1K0ogvpk44rjOpgf\r\nohtm5dqVahz2OcAZGX6vQOgqJiCio2a0yhw213jvejEsWBOkBA3v2ilAY35a\r\nKnBRIOPWckD07CrvSLz9hg9Nt4Dkk7ClOo+5PIZtT4GmUyAuosDA1cSTth54\r\n0WIhTaCtxi8laCRoLcS6vwWchGm6yn1LtBND+BwAZenp9/+zAgnzcDqFHVnO\r\neH3vLpTxUjbWORwdmMtqsQ7vVGPud+UFSlC81t84i7dFHRYECPdNBL0j4ekd\r\nDx9hZgLldWRbTEHjz3c7dGc5MNYp3krKtKE+Mq3NfabUBtFEcYPZ6S+1D088\r\nQ8/NNJpscTvslDms/53m++t79jmeXTBOUnOpJY5MXKRPOuf2eelCOEs8oCEr\r\nW5Qbps6QNXEYp9NW+FS76mUiEB/fKs6t4yo=\r\n=wTyK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f21c0c4b5566290dde485c6c944158cd86960251","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-25_1679703055038_0.6350676102107293","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-26":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-26","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-26","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f8175d6e50e0c4d0fe5eb4dc75bd60e3f6b18e3a","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-26.tgz","fileCount":41,"integrity":"sha512-gQmbDYINs2pCGkTZKXEvxBdO6YyO75fVqQAO6ekPthd3osKngGukS3PNLEHD87ocCIgsk/lJIBmiGI/PhKzsuw==","signatures":[{"sig":"MEQCIA57CruL1b7/M9+YyY0K0Gfi40s+N5XvbT28Nd3OaM8BAiACh/cWI4Oe+E1lvbdyYVYiFNgkUfcPy7EuqMjDnaC9YQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkH43fACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo8VxAAm0e5xgy918Xp8wYDpC/b8fyTQshYhqsjXqIIH7iLbyGoOzm4\r\ntA6E+3+sfNN31nskAMv4qCRhxqvM23hvuCN/2yPKpumAA6Bu4ONOiKRE3D8A\r\nfT8X9sBbyOXInaCtKUGzphUgHcwbkhXmnVG3TBRjh6Q4OXsxqx/TD4qVnJBj\r\nUMB9+Fzvm4X+zPg6wy17j6AgqD+upQ9Mb1RqgdueAPSzlTyiD5zrsndiNJ5x\r\n04QF2nKXdH6zmIpZzrS+fQEuLFYyOjWG5L+UoZOiBB5eioGikW8zPBU/GbH8\r\nsrUTOZrARZ1IOGxVkMSPIKWL0F9h2P1ITLNh4vidJozPhMOTPU/ix5aLCTEQ\r\niwLt0/lnjQDp+lGdrZzJXeYFyDHc68NGYSLRH6bz/U6yLNi5becpGd+h/FLf\r\nlL0cjLfHEJZx4iP6xPoZTrkGekkyKS9Sn+gAnMp5CHvqhmhbLt5B0MdXPIIy\r\nXoMLL3GsvQURXShqVkw1YA+dGAL9gilgKUO1ooXuVMQ5Dafw7iYCablOevU8\r\neTbPfK0MMdPtID0NLzdc4QCZ2jMcN02a4XetLzgB4uR+7SGRfBlr6kHjOA6+\r\n+ahSOjNoMM2SIiQ0oW1KnKN67ThdsVrJ/RxIxFFi8PNYRwJGuouyvNORIV+m\r\n7GPzaV8oGFyHl5GN/ckW7ePqtuSVJv5rgHM=\r\n=4oFa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f21c0c4b5566290dde485c6c944158cd86960251","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-26_1679789534957_0.23708767116028517","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-27":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-27","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-27","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"87b2d132a27a5fe09a274dbd3a37f97da308f4d1","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-27.tgz","fileCount":41,"integrity":"sha512-AvXdj+/JhcKz4zkbcmILdrhoPiUwehF3wHmF/OgIK3kw2qHw9DLl4iG5py1R76U/0Zy7r/6QwzAYtsabBySumg==","signatures":[{"sig":"MEUCIQDGhX5v88Wg8UCiP6GoeqcvAOGkOHmTwJRz+nW+ahm2ZQIgIBSe6ZU+YfYs72kPDK5BMrulMXFJRYcNcHfI83bvXSI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkIN9IACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo6qRAAgDc30BXGrmR+ju6nc2PDFGHtosalkecl7a1V2oUf3Oh7bJYA\r\na7GPZOySCsSTOgQu0vTu4/33rgZIJgOFSyUlkt3gtoLnbwtbrkNHYHUQ3DRF\r\nJnx9KmGqyRRQFGgMa5BmxRgcfvSK6eL3gr5R440xLbSrIq8amJPtETWgYhNr\r\nwvDEuKK8/DBfOMneM+MWQorebfRIt2XGAXO/vrBWh9KWOqy3GAG1ryIz9qt+\r\nW3Hdv1Z2hRi2ZUYXz19xDUBZqmkhAOC790SHpXt3fX6FGqVme708HEZd6PEZ\r\nWQwkKS6fz9ernkmFoyUX3OxwQkt+5k2CsAtpX4hfVJbLvBeWoOQLzIWUP5oD\r\nBdlAGfRK7zRhGuvdAVw595f9GCkl5IQWlWJgU2emrnSFRTEaXdcAFOpmMDCt\r\ngEQaJdtKTEopgBuE3X4Ueqtdv3YeRpbyonZNfocESFbGmGj3vNJadyp8YKcV\r\nsv2EU+o0EnYvzv9aHWRclMX1qW1M8Wd2epq3OV53eQ0QTjT+Rr5OFra2a5W6\r\njHjeg/pVqjJ2MpmR7UtwPTXEEnS/zTEInouVGi04Rvf4uG3vSgApcPojvyBf\r\nWWRRIbeSincW6MGn3gLDyY6Ll3zLJ7h25j+l3DWANHZ502DtCwhq4uUDU8xu\r\nKUE+EyQM6q9Z54vbYDAHZ9w3YOOXP12NLnk=\r\n=w4xQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f21c0c4b5566290dde485c6c944158cd86960251","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-27_1679875912229_0.7969247958965764","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-28":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-28","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-28","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"48008acde2451ccf667e6d5dce801e66c278fcca","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-28.tgz","fileCount":41,"integrity":"sha512-cFD3+u3H/VPXPqumyl2STxNBQ2N0EfWaTdx+w2IlshDdE/KJORGMym0+ZBugf0SZ7dLKSG9mZNrosqfFfwvGQA==","signatures":[{"sig":"MEUCIQDCpHE8qYbW4z2/VA6tnVRwoREEWcma9f/nWFRUHkizkgIgV81pdVPEP3C3dABACvfjeKpkWvu8eu/lsaIgFux3fo4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkIjDJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrEmg//Vnw9/16OEH+67u6o5yRguvPRBKNFGvlAmiOSYlbkZ32Uyjle\r\nB2RmwvqUZ+DoVHqV9T3VUICK43Y3IBGY9F8U0kquhsg+rBtoKPtiW4ZGvsHE\r\nSKxBArHBvY+GdpOuHZsbWLO0tzDxChXbusLhKYhhs7KUbjRjUtOxxamFoX7U\r\nbVGJZ5A47/lyetYCeNZWDB38uQsFfYkRbTDUFWuADtth5v/4adpmmEm7296L\r\nOObCCUSS1cbvVeIm5GQUyeWPhujmbIs293cIIGbUfIwCTmyc7F2+j8PbumH8\r\n/d52EsEpjKQz8od/4pIgURMc7z2KT2o9LaqpV0j9a67tsrLU3nIOOOxB4D/S\r\nee4m51K99UlSgjIwINbdeQWqdLTf9wwUN+KRmqfWKoZbYo6ek8lP2ppjmETL\r\nH6eHyL0YdocSiBE04WP2nI1nHrhXO5kE5pWDU406SWmmL/xNccU3B4RqGBZp\r\nIz6oyw1aMfHSg+h3phuUUTWBxm73/x2LKuKXgGpLyL7ZoOuiOHLtMEFHXYBN\r\nx+OqoX0smOnMU/l3KhaMGP1FqjohCYZ0vZiqynCokht2EpSrkXnep9IQbjxM\r\n9qgMAKqjIkWWjKHICZHBSqqCO92h/s7XnbBhoqyQ1Y7cllWMuwJvYOn2/TYa\r\nPzieszPg0KGJVlaPnNC/CX6pZ5Dy3I5rf7Y=\r\n=G8/c\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"8e9695411cab2c9480224baa968743466342ab13","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-28_1679962313504_0.6376346813625955","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-29":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-29","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-29","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"81e67500ae49c4577fd7be5070d0ba8d8dce6526","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-29.tgz","fileCount":41,"integrity":"sha512-pry5/RAIgzIxfFevLGzioQ9GYPsgs1HKaU37oZ6nk+lF9qDRdgjA801ccjIX7R412mYN3A/Ceeipr5hmu1nVdQ==","signatures":[{"sig":"MEQCIDduTvFQRhD3Y+2Vkjrcn19wFbXQ6pCi5W0MdbjWWipbAiAgn4bBHDjx5b9qQXCZu7QMsySCH9eyD8Wjt9oqWPMcag==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkI4KOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpkyg//ef/A8Uu59vtj56Oo67Lje8JcWSu2pXhtW7I/G2WykZ42DCoB\r\nmC9ryFznrgfHPS2DBFNx4Fg1OMuv9MCdErCJnl7kAMLkTVpswEg/jEwV7wGa\r\nDwz3pIWv1v/6oYcLE4mzWIf0HBOtviRkq2Od7VYgf+l7oiM43dcNMxZFWNR/\r\n4+98uWz+i4D1UxsYKdjMFrVMhhw3OORONNw0cN7GrP37jhxVkfCMLzE9DksR\r\nXYGzv4RIByc56vWW/1a1P4jbpnxn0LoNYY7fp93K6igU1kMdTXoBVAHnOWA6\r\nGoPvL7YCt0ppQ3TCy9oGey1QoolG5S/E1TCBmCRpgbN91SRvHZ1sIdKnT4dE\r\nBo6eNKhStdKhSE16/cV0pipN8Cv8qsShEpB6XORHFxnS0UjI0NcgM/WUbV3t\r\nUdl58C6jR64QzLUqy8HZZwNYc410WgH8K3V0YVcxpE9KzRCES0QBJib7TxCi\r\nW6NC2fu1Daiilw+o1o1vpRivWbG4FHG8FbcNAuSuOB3JanhCkmKo6NgHZFpc\r\nFG7z6ddZMRI3gJkRYcC6DDLLAM8YPM3OVdzbcVJXG35kWcutsrADpuzMQNnn\r\nsbROKR89z5HaTlUUMUCXocOGMXZ+ZCybjFKpK3fFACtPfJYqMaazbt3mQyZc\r\nz9SQOvbrXseq0/rl0vFQd5OosGmRBl5Gua0=\r\n=d5an\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"8e9695411cab2c9480224baa968743466342ab13","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-29_1680048781760_0.835693835318774","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-30":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-30","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-30","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"560f42d3a7703e70ecf81e96f664c1c3661a369f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-30.tgz","fileCount":41,"integrity":"sha512-X233hLKNZTtZfy03oTm+WxtExHc7WWRmU2ieVZZpq5AFTzl1geUBZzIeNoHuvARRou7DAZjzgV3YR9PvkN6WzQ==","signatures":[{"sig":"MEUCIQClUKsLX5wBtz+ron7zJZBB5jy2DuUe7eYqr088Pvo5rQIgWGA0u9jFun6eG1mLT6wPzlZpLhpArn942kr/3w28ln8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJNOkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp85RAAjDtS4OpT9qlhr+IE3KGn9RvZ9W1me6ftW3UeUjdQQoBSaQ2A\r\njYwWuZd+bvASlWfVbJl04us6li9Ut3RAyonZre4Hs90S5YLv9WoM6pCeY+MR\r\ne1hCND6eZ5RxgOgVSIwstyBhKN/rLrdf2CFPk6FCJv7Lj2OGBczsblRckedi\r\nGFJ4HGq6FC47rPPAQNLqDr79lOhuyVngkL+rY6LhhS///NcS2f85jY6reLrr\r\nqohn+P7OfhaTGP0JNoRAfVUYF3tjJKZpJS3kcpfT3qjfXFTyoqEbRrdpnjyE\r\n5IxJebMIFiVoiY6tHQD0+UNrZ8tC5+j9Z7VxCQLoEAAkGFaocxKI7G1Orgc0\r\nVOqbZhsAXOPzqzECAACutE7LW6D13WcKH2CekTDWrzMWBIwAKoDW34SUG2zA\r\nW1n3ye/Xy7AFAS1ljMfP452YMPukRHZuZALUbwLRu9qS0R4Vi8eJxlMp1FXB\r\ntdVTgbP2Bu8I89Gk0ivjMzPiA7xadUPOiSNecSf85lu49kLvOKyoMLVIDxl6\r\nRn/vVoGc8hZ8S3i8Bt+1kj3fcJkDDBCk61bJs9ACzRX5h5uDxwApNSxNIgMS\r\nYXd7iWDXwRa5JT09YU5qRnVaNVKwtOh36dJBzYdaRTNmAETal5rKN4q8ArqV\r\nIOfQDN8psaVlKcqzmujTunNnTdc2EnykOsI=\r\n=n8nF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"8e9695411cab2c9480224baa968743466342ab13","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-30_1680135076771_0.6590048593753437","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-03-31":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-03-31","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-03-31","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"fa40499b60df62c161b4c16d627a9909dfa03f1f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-03-31.tgz","fileCount":41,"integrity":"sha512-560rqp+AVtBBlKpxk4hO8R6L9j11+F6g2gc3eC+DAtyVz3EClVTVSx0VOxnfWVJJozRLPslwRoG6lu5j/k1UwQ==","signatures":[{"sig":"MEUCIQCbOxCPJuz5sWkLCIWL5VF0goqxKXHV3sIqldoudP0sAAIgNGTsPDnshrvC+6hU2VvuKAwWuGjbhtlMLpvfwDrIGc8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJiVJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrECxAAo3pFpF3IDpEW3cITQj0l5z5Uq7TxZ56pePZlYRgig0xiyJ5U\r\nI/zzXvtl1gmWlCSgZ3O472su2I/BYoidmgbYOdWQHmrc1gx89O71cocySZEu\r\nbCZEl5/7nCltypo7079OGV6rkS/WVIpSyfxt02yBJQvEPeBcOtMUmsxXnUJj\r\nPayKQPFGthwzQz1+vuNFurJ+hkwZrKI38pxy5oBNOZdV0IOOSkR91gG/XrMX\r\n705YwBYgl9rHRyweq/WO65A2/olWw2hMjgyYX/L8stj0FgIUfI/vKzIkoKPQ\r\njeRky2G3RV4uM9yMxXL6PUjn4eeySQeiKGpae5RHqtX/H1zix9BJeIDaghM8\r\nEQgIEQyhs5ENdOehPlAt9AbqlAsvvM6whu9e8KN6OehEJpN/JsQACoNbK+M1\r\nNvYA4FwNYZVop9zBHufe/d5H8al4kao3rQM6sVumAZjbAlH0+Eb9Edg9ujoY\r\n6e3QUtRZoU4Slj8Jawbmjv2F09GZDAnLf6R2OBXhKWZpH+6FevXC/tkXbjCl\r\n6qcBV4fLVrFY/vDw5SbuegAeSJhcXTOv7FGlHcwBQbVpUzgBPRcK3frdtEV4\r\nZB6PnWsxFk9hUGw8DWx5vMQBr6Zys+ryxfKOl2QIj8RmRjO0ff1MibSdtRoV\r\naC+pGytGiqRWe1IGhw+43lgvhrLoH0qDLtA=\r\n=fq6m\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"8e9695411cab2c9480224baa968743466342ab13","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-03-31_1680221513214_0.6746285375246472","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-01":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-01","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-01","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"ea2ccfac98421396a0d60c570a0bcf033e0fe596","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-01.tgz","fileCount":41,"integrity":"sha512-/Fcn74C5SEqFBZfGG1VzYs+/5mlB8a7RXdmdgmkCb3/IaRrEmiFMdM4vmhGIyBaeFEBZQaZiVF0kv7cjpVCTNw==","signatures":[{"sig":"MEUCIGhl89ebjXXGWKEsdPJEk//WgJCjZT6tioy26UBoTkoHAiEA06W/9XqnMMBaOLNeBB2u+9nZit1mbnM8PRZMYqKk2vQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJ3a3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrdGBAAjJjKWrrabXJRdJcN59W2BX6r9Ye+FA6PxXcZAtTu8k0Z07LP\r\nHnRprdija9QGLj/c8v+PCBrOitUgG6JYdZoCh1SkHOgoniWnOgk8WJK/chXm\r\n5+LisvrhQZacKMX5BJycj/Zgy+kZ62kRXKUMn9qxR5QSrktAEHDHII50q8IT\r\nIbe04Ekuu3qDFT7VKtpn4pkUqzxqfnLB1zqLFaCS15rDy3LXIs+TQvWpmLUJ\r\nRMz0Z7sY2N+gVCieEfJB9/Uiuwc0DI72fjfJgw8XfcvCuX7Puev46OXYHiRx\r\nwRKXb3VOZwErl0+lR2b6Epckwg/QwxWJuwvY///b965ccyYvqSpV630zDWIb\r\ne1KWL6rLw4E5ZibfD0aHZM8UPqHUuTEYNIBWnsUuSYJU0HJxYZKN1QdsLASN\r\n/2cgICFiPMzA/vAKhK12p8tkfP9xG1aszzR2xr3KlDZjRKBKi7X7EIoPaToB\r\nGMMZWTISy2vOMab4PPHW4wInnnrMNuK13NvrjPqSbVkoc0tvkurv+Z03309+\r\nfHZYkzJpJaBF0LaEBjkBW3XtTGBPmfNkdCqh3i2VKMjgi/Cwnzc4BKAJePue\r\nOmc/6/h12s6h16RVLe72YXqlGti4gADbPyaRn8VxkMx4MiVdTeh/Y2mQaa17\r\noA1S1QDvZlg82BsrtUMtAGxy5V2Z7Nm+fSs=\r\n=E21i\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"31f18a2fd4bb5f226b0f5e366bd9c51f09734b75","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-01_1680307895235_0.8572486457915105","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-02":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-02","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-02","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f83b04babbe75e9297392b2ff1fb6002d7a5af51","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-02.tgz","fileCount":41,"integrity":"sha512-2lnsau7dJLVd9XZDty6xQdkskS+SFyE7e26kotFfDBN5RD35LkB4bUts8y66ED15BpFnR4Gsu9KsFRzoFAAYxg==","signatures":[{"sig":"MEUCIG2t2ImArDSX4KHq+Yf/fQdIDitISZoEcs5TvUOJ0Ge9AiEA4aMvBO35txOkKZ8E5vJXQfI4sBUy5qbHQ/tE/Z3wLj4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkKMhmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmok2Q//Z0/YwDCjV6gFp4e5vbaC+uScofkur3Xrf6gyCgLhszLaOTAX\r\n4HXfEjw6pKVLp/aZa7CK9ZrwSkZ6+3Bxwz/7JmF7/8mg+YMJHZhCkcHDxK73\r\nftvzsJS3ZHbGDsekZf8p60BoNciq3+tW9sFcOCe+sn8lxx5F3SewDyrdpdiZ\r\nnNMKGXwj1SSWMCTA/FRGVD84q0s4UfS9jhjr5fCQ/uKH9t+qSW1VjZ0Y7uai\r\nqHHCjSh/4phhtrbGCwm8fjwNKb16btNXnH0MTj2vM/pMn/sSzwT/DzhxJOVU\r\nDUVMdfTrqp2K3l5SpabmC6rDhVFcCliaGJU0eAHCfKj1KwMFknmNkTX9mneH\r\nq9JLQBGLwEK6dE+kx7dSFQ3D4vj9JBxvG4Y65a1tFLfvnwiInZWQeWGZcpzg\r\nCLAdVhl3U3EcyQnWt+95/etJkn9lCYdeyqNrRs6Ll1hHXCSzeyj+yj2MJknl\r\nhm3eyc11eO7urOD4n3UMGbBAm56EX0tp6ylkbZr5CRO3r5v9TQEMUTQqoJkI\r\na9gKTYc4MJEtHAiEcYBfJNOr1peTqWEJ46Q5Oyx3XfMHnTWD2oI7bBoZkDNk\r\nbpvkamThK/doswEaLtp1Cm0XfbcMwk7BivnU8C7fMlaq5nYl7A1z5kFpBhb6\r\nHhxqvBud+49u4HmH7yZZ5hZejPXKl9fmsCQ=\r\n=r9zP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"31f18a2fd4bb5f226b0f5e366bd9c51f09734b75","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-02_1680394342290_0.2720878837468357","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-03":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-03","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-03","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"19e013dff644fb792db4e30653ecc85195860b4d","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-03.tgz","fileCount":41,"integrity":"sha512-rBPE843OONu2FG3oBvL5izbLn2bghExZH/H5YxgcmV9fUkytUAYRLp33lJ6sdPpMqbukoV99ZC154Hwet7wcuQ==","signatures":[{"sig":"MEYCIQCyVTQno4pWZO6K7WZlv9K5xJJCyumnCOS8JHPvq1afqAIhAOtKesBpOn/8MuxHuEEQclnRbGF+o4AKnaKwIkVJqhAz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkKhm5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmohMw/+KeIoQXRC8J48sIUV46TUF/CKEtNUTJu4752TK86an40WHgCm\r\nV63ffr5SgIpVKqbaxzwM4gyXr0r3TiqhZX8vO8HxabDuh3RjNIJDAp90MnM9\r\nhQvBF3qNjLMdrtlINpNI4uTXcnXMpgD08crs0dZKPaIM69FBnMvhYGlSxzHL\r\n9cQthyQVaopDKIW3sQo5PmPvuJTDRz6XUxVJP2yak46+G/SyMfaNffqkOvpN\r\nDTXHIz0NaGhax1a8GyKzWnlpwkGKepQrfWeJS9G/UOfkTAH30cN5IFBNTh37\r\nHWGkKrWIMWR/pGVtN1HTl+Qtd/pJFp4F4LNnVp0swJv+AXfqvZrikVJ7urbE\r\n2NypMFQzL/euplQ8iaJudL55wGjHbSAlnEyY2Grd61zLUE4YyD0mnB+pxQCD\r\nDoyGc/PuL9VS0yyD1rsciiE2XUIo3/Ity9WJoK9zATxaF60snXA2hoEACVZt\r\nU2BsjvfkhM5Rv5BIOEB450ILxyUfOt8d/008YzH69BhzkAk2I7/nN6Ok1iXt\r\n9XjY4woMAeMj1b+awAc8R80fuFX7Shwh5ziXvW4ywDT85mwjl+fF14Ckpmod\r\n2vamxpt3cG47Ojn9qKh7y4eXJfIDAmPhlJnVXiE9XECBt8KO6vzEUdHVJagL\r\nvJ4Pe8YipFIhS/4NSdKvBi3hf/yhfHJ/ojU=\r\n=56Wf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"31f18a2fd4bb5f226b0f5e366bd9c51f09734b75","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-03_1680480696881_0.1660523667920093","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-04":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-04","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-04","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"938168b99bebb1266d900a7d214031c5d7561930","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-04.tgz","fileCount":41,"integrity":"sha512-ySKiCr1NyPYoqHT2rTdownBBvYxtiXg+xgwRnnUOS1bAiWvSQaN8nsBFvLP+15QIlluSv3FQBv2qJCcd1CWT1w==","signatures":[{"sig":"MEQCIExMFZ9RQ3XeHNfYMMvxSL4klXkx8alGy+R9Z5M69fw5AiBa/R2Bz6ZYyagXnrYz3km4uYpX/1VKYpw9F/WEGTsYCw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkK2sSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp2Fw/9Ge44nGSb7/qQCajDiRs6iQjE055z/pkNu5XbRkHFawQWM4Zt\r\nVna33tMkxVJs5/EfMf/18UW8SFIXa+RtRY+YjGpYDMhYKl9O+YiHBm45W9Is\r\n7LwLdHOkVBunrp/Y0Ng9yEtCYtsgRyo2UYINdya/6rS3gIQCa1UiymzyUzg6\r\nuMzCD035MjxrRnj/LPVxTXOMorRc7UfF7+ePrtp2wMFZyO2j17CNyTVqA3P8\r\nMyAkm90Y/vAsM3M1l3gGRLhSU16I8qSOQeEzDWtxlRQFT105ApgPcBKdhi//\r\nJud4dezGoW7zTAdwFe/8ppr0e0gwYYD9rCz+LV1l5UrbxQ0HdT1+jGZ0W/Wo\r\nFPGuc2jtjEIog3DKCzmrqoUFR1x28aYaGlyn4PCyrDXFVmpVGwl30TZP1ee3\r\nm+DoFjLpfU4MVNPNzX5tVvUrxFkT5BxsfyaP+yai1tTy8gtKEjZcLqGzD0kE\r\nMQntZXM45D4sjWaSN37eD7MqfjHoJhhfqdxC73O0YSDZjBjnNYSdYdHwB8Mf\r\n8mf1uZOHMl3HtUqS6p5olmWIG2O9M5xSjbW4NlA5lWhC8gzioKLAOM6BZCJ8\r\nWx4N161GXRNcNDAsMb/bUaq+gSjw2q2W+M6ZSfey86YS11oYCigip56VOyv+\r\nHbAushQ8GLEzzPfFS8wNfJUagh4c+P585Ac=\r\n=+nNU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"31f18a2fd4bb5f226b0f5e366bd9c51f09734b75","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-04_1680567057850_0.36621730374480066","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-04.1":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-04.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-04.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"ac65bf061f8c47762c73185c829e942b50e9b2b2","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-04.1.tgz","fileCount":41,"integrity":"sha512-4FumvgveX4L98rXpA5rnsqbKdm1XIdzgpfuyUSiQLWcH8Sdo5DCy8e4tBAJhxVjS9CRuWvc9WqoEwl5er2yhhg==","signatures":[{"sig":"MEQCIER6Rs+TUlqSU87Us600qdZ9TSR/5Zy5Uk0sb0cGklgEAiArGMd8yZU4S9YIFz5ewO4o2xLWZo3Pw3SF98JpX+OHWw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132916,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkLFTFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmotDA//WG2tnNp3ysRp7QNAZrcf0CglK1i5Vw8bt/AkORuxoob67Xm9\r\nVZ/XIIZQSrwq2Q7NYbAvhfeJ57buL5FMty0HuUyYlx9d/Fuj0DqVmg8hfVsD\r\n4/dd8HxIN+jb14D4c7Gk8lWcMxLwt7wRdNyJAH+vL1DM/dL4XZZoe/NxX2PI\r\nL9uDMAQN0B8y/JTFBoA+nQzZGGXavScAG8HXgieKL0/ipznTDGPvz2pZ+bm1\r\nU8GwfHo/3eQtXC6t4j6auIAtx8thyrp8X8PcqXG2bv3nMBU85ia0vUo9C7wZ\r\nHN+OPVOXOliekTxdw58t83Z/l4CcTjKw/lG9iDjSYfBkwq4Ec8X7mg5cLbTt\r\nHZ1KuYsWHUAKlJhBRd1uQrPBJI9d5YRQMrAenLNWc9NHDmiAlUIsy60Fx21a\r\nlNT/av37w1/7SkTF0BL6IQOv8xKSMZGistdxNpWPChYWJZvvkyKMmvigDYGu\r\nUSh3Z28B1iTC9VbLI3Khdi32QkaDae60/igt0L6aJ0T2RaiDzIAfq2juBEHF\r\nkhD+O/imwvwQ9hXgGJcVeXTFgAnGxFMmKMUJAd/JHT4ACyuiMjHHpnFBGmW2\r\nwlSAPLsaDVnP5Hub+myjHMF6OzS93Pa2oXXSze8Ga8WIIEtXIEu8gHJuZZ/E\r\n81MtkS4inwVK1yDNvNDpBWMYiOHNZe/Ya80=\r\n=0cFH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f6a0e76336471cc1dd20c842d932cf45fd287e6e","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-04.1_1680626885071_0.7483555635376014","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-04.2":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-04.2","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-04.2","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"edd25fdbed3bc950260092ffe80d3b4fc1566cac","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-04.2.tgz","fileCount":41,"integrity":"sha512-GkwdxdIhKHUeU7m8TbMcvhz3KjvOptUhSiL8kVRYfbSPJYtrVxpBW7YEBrX1ZffUJgwMH2eZbUWUQss3YcR3SQ==","signatures":[{"sig":"MEQCICufYjeyX/xGNnIbbID9fr3NxF1ZyT8gi7ZcPdwZK3S+AiAmgmQXSPQpe3gzVBU7fDT7Kz5As74kWa/R9OAnkPMv0Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132916,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkLF4DACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpAxw/9Fs/0kDtN8+iTz1nuzmyIt6ML02LFhK0V/XdpDpQTS5qoOZ7d\r\nHcigRzPVQWBGxP7gDMIf8qFkKY8Pd8ITeq4pS/+jqZM5z4+7Sqs/xs9GufCl\r\nA1Q6ErGQoKr9RNX1LOVZXxtnJAp+xjJ8lIW4KY7Oh54UbuowQh4oX545G51+\r\nDo7rBSZYfrds9kpmtOFCzulnygh/GoE3IdG1QRJqhFhSmS/5YzxghvDiKOPD\r\n8UZLYNrUXc3n8ZCg1R8wN5QGIqH8DISUC2LhKa5+T/AZJiJVesVE+b3WDOJ6\r\nnef48FoMf2l/VmxfxFH/18utF1MCHYskhMqCU1kiEghARG2kFZTdMOh8WTaS\r\noxFIl/DAugAQ4P4p1Cnvu7s6pDzP0B/QUnUNbe6lphEUGk1o2ou1Rbu+0N2n\r\nrdWTPT5a/O0mk7W/WFLGTylMcsBJYa7m/q81NfmF0vsqKvoLyRi5Lpnnf5Dy\r\ncfgTd6qS93duzFIQbnXLr23D8M5Y7g/NhrOLG3ZOlSoXxiFmKnMvmlXyfL4W\r\niSJqL7tY92R0yRtiUvykJHVFpJMjwRwfeWGC2ChEyJ2iVSUJ1IruH4BBP14S\r\nPdBGULxv7NrGMeBq7qYpb1+rxPV1ZWkxZVPYj4EzfXy9Vd+/zQeFQ0x60lOd\r\npVE5wWq550S9aYurphkhKYswaPf9mQn7/6w=\r\n=6B+T\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f6a0e76336471cc1dd20c842d932cf45fd287e6e","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-04.2_1680629250865_0.8580460654280906","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-05":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-05","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-05","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"7038be68eb6303eaa3a6cee31f91f37eb3a1a17e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-05.tgz","fileCount":41,"integrity":"sha512-6z5SC8OyTOz1JWabYCJvALtsumTxbY2HECqLzl9pG1IWQnIX2NnCA12nSGKjGuFsY/quxY7F3qKy90W72/WuQw==","signatures":[{"sig":"MEYCIQDo6q1Di1f2B0ZTq5bPwi4xXlDwWYvrl0+Clj7V7HoUCgIhAIguttbqgz4LOl2QNC1ESgqAsYbujcrT5LKNSkTPswd3","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkLLx6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrTEw//UE9Uo1FS2fSBPqLFk2Yfy4qBHQYfO+ZEsP+HcFd/SCfv8lL4\r\nz88iQ6hsRSh8hc8PoMdYkkJiESI5QqdUl0UT+YDPrUmwwjLlpnPew0Qc860O\r\naGOnwzqA41IFxe0/R8Rr1tTDMG6CpaQZifZHGey9+Ug7ZCTso3IZpboxRdn8\r\nXjMY2coaw5y4rdo0qj0J+akB8dwngfriILEfH9ldbM7ciC8P3jN26/uCKsjK\r\nw8BZ+aeNtED556pSgTto74XFtTIUBAl9tukftwuhZRbNfDxPa9d0gr4oq15k\r\nmo22OZX7pAC2nFVImRZj4/TH3y0EZmSDcQmHrurDO1HW4iUDFJ0IDzEWPsLw\r\nU1CK4PVGTWKp6DGe7DsJdYptyuFkzxDy9KsBNXOwPEhXY/sMOvd00llxotpK\r\nPwN375Q2lWGCaM/JbngvHyu+Wy+VE4aRyytRkBnnRMpW8c0gpivXRRzhZwuk\r\ndBLl2tI2l7Ue5D/0BeJ3Td1oUGLO1z/15xI2bvl92FgjFsGDULT+r8bcfskD\r\nMUVJiZJAuZXIfeGamRKy2QonkpCterxsPDbyDv75jZYuQdKt9AWlTapCPPqE\r\nRu3o+SPYvcbtXR6tHPrAwqZ7QLE4tMkHNxliPdOVLp6VXpgZFGrHKwuwl/sp\r\n+gUVCaE4vdsMish8JkZSApysnvq7zoi4KGI=\r\n=FTFp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f6a0e76336471cc1dd20c842d932cf45fd287e6e","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-05_1680653434536_0.5009536953484479","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-06":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-06","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-06","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"48dce32a28221c2c71dea372672dc67445a78a8d","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-06.tgz","fileCount":41,"integrity":"sha512-RhAAQ0flFX951w6rqrT3blTsZu4CGvTEJbE0DI24dgXCLAsMsPL6YY6dAWUrFbKuCVQ557AjNv763oWa6ICafg==","signatures":[{"sig":"MEUCIQDuhUCyhbnDc03nwKtIwiUCNIvV4/6QYoLHIcvEkBQqOQIgXtpTct/jeDWtqArtxFQmSJn7bWOs82mu2kGh0SomZV0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkLg4AACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo1Yw/8DtE/UWYFYoamlxK8kdzfunNkzP9q+5oW3bQZ2/wCEf97Sn2R\r\nyq9yiD4I67pp0riEni+8MfKFiNpaSqxGjPiIQc1qkhw2LV18VMFBQyiVOX4h\r\n4PhHUsJuv+8BnjQlC8jdSTb+n3un81S4gFEe1/trPoCCCpuYHAbgRpE2nIhd\r\nZe5NTtkoWBr1EYz6QAjt91RheOIiFSZkogMAsZ2OS6S9WyChkmYif/OMtFGK\r\n0Dbz237v1qDXOORa3e5MZxiZOVC6Xax/r7bK8s7Ywsw8nRde/W5r0EPiDsQV\r\nt+iI+IMiXb5vC8vEoYUspFM9HUHHjjRIudgK4/3Hk83Vd3eN/xy47rztPkzD\r\nSVKK0D8SM/bsbrml7BWWnf1EaRVMxhQC/FOmf/HcYUb8qTSVZOD9JuMBfRmf\r\numY0qqrlmdueWopmw344BB3V9tkeYX6H2p8g2B44Qvqti5qk2+QxCjjLd9C/\r\nceNjlR0KhEE5SgeBpxgzO6O2WFU4iROGJA807VjxZcr5yOVGtRDFrfe0qwWV\r\n4awbgfijB146BShk7JQwfp7nIDMOMahW6NTR3RXDyT0Pe+dZ8HT1uJoff1Cm\r\n2sPM7+o81kfJB6A9sbJJoEV/PAmA0y4eA81XL6OpCh5eJ+PltHOAFivG+xtL\r\nDWy1viQXj4q4p5sVv+bz4DIgKlBCmF0efGY=\r\n=DheZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f6a0e76336471cc1dd20c842d932cf45fd287e6e","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-06_1680739840445_0.8676118269358635","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-07":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-07","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-07","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"3aee5b34c999f8b148f855a1668ee1179e5d3f73","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-07.tgz","fileCount":41,"integrity":"sha512-/zVpAQ0+IEVLxxUX00tiyVPJtvimknnZLzcFxzS/DFDi13v3V4hTPU97MQnQIlH4CfLEe4ZXds1/0UK6bT4+cQ==","signatures":[{"sig":"MEUCIQCa4xU+Wn+H7OwPIySg8rx0tJkl+E1AtGALF088kijk8AIgDnmWS6iS810B7nH5Yi/SKR2EANAADoU35zc4Q5D4j5Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkL1+DACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrOLQ//fBbcR+qSJu96M8Qve4Cr0wZXodcP8Dz+6vUWswXKTloKdoqT\r\ni+GErRiTFpG+f6Cdv0QbGgew0XrmGS8NA3OiwYxVbw4vW6BEEN/gLlhoa/O4\r\nlAHQHvZTWw6S0WJgdUI0lnRa7CR5nI12tcopwMw5BZPA05oHUHJztR1Cd9uv\r\nAWkMZLn6NAyh09/M1iGHjwvOHguQaVVNYjDgYwBxhbLZ1aeRZKNp6rBTreOQ\r\nwrIZaZ3aEaKYs5MErtNd42aYC1lS3k86L9AAAXrEXqaj8811OabjyCmHQNyK\r\nKINzGQLKRxGOxFqY76JjL5E30s3MDyLoJgEyNuEQB8i02PM/PJevPUSoTVsF\r\nKp2MaUbLS08cS7qPB/p5DEsRiTLG2Q8l5UfpOA124N0BrG0EUd3/gptv4BXm\r\nb2PCQEUR3LnhgwRiTpy+sr4jcRvSAfZ11w/9Xem7YX+6Stbjl8SCBUPtjC+d\r\nwUpxb1p0JzIXVHQqtVkpRgxhowcadUr350esCemvW2Rgi7oIauydxwmr1JuV\r\nrIiQIZRyZt/Qy5fKOmz+voBgYCR9wosF984AiUecOU0QWd2KmAs8PJij+BF6\r\nHx0mwFfPLQRwtCzjBNCXGhoVUUKIuqAfJlUuUFJvVkv9S30oAFCPv5W5c/5G\r\nllauY5hnQkQKGeJS75D7r2wjD/KGsz3qtco=\r\n=wmvc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"6689100fafbea9d3aa6853c73a6435ee7432912c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-07_1680826243352_0.2562096180043818","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-08":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-08","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-08","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"0bd33ada65eaa16649f42591834d8ebbc10e93dd","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-08.tgz","fileCount":41,"integrity":"sha512-xShP2JZcMyys02gAE7A0OcljFJrCUP0sjPX+bsdax55vNr7q8+thrs1+YbNUVRpZykCDPgz1VG4xXAaakh9xdg==","signatures":[{"sig":"MEUCIQC1Py+4cgCEfvXQC+TZ3e6rP5OWNeXvOxWmc0ynYg9O6QIgQEocxoic3MzbnbHbl/1MS8A31ytIdk4pvdR6a/0EEYU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkMLEGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqsXRAAj1wYsa65LbdWltwUb5WlvPyv+JXoedc1QZDi2fDfQXFrF1Vd\r\nHTprGHg3sAtX9+V8JsDjSlN87R0mKedNCCzjCtorIrVtgoLoEI4OGS8oZiEo\r\nW5f+7g8fkoot7sQa1R3EowliMg6N4hB9Rmk2qImK+SKw7QqB15kGmZ07JqiS\r\n6IxfzyhM+PEsNHSXvZ5r+CJ4euRdbsNopj3D7S+onCYFs9JcyOgyJGqpruQM\r\naqg1mLlp4zP040wLlNo8GSNlQTDSUKhN9Kg8nggX+OoZ9KfGrHxE0Jood5jo\r\no3cLUc0yytZaQ7pwlvVQWF6svhNASrFiFRc5UJ0CCoEZbWCefDgLy866EuOV\r\ns9NsZgepshDX4OB8U0Dnaphotnn4hfOgSw3sN86VAeAqhbiQ76mxJIJbjw3Q\r\n7s9ECLkkGTA1Snk624yThsAzjLTpeF+vRragbDVbksWzE5XbRNIi8JbNIr8J\r\ngJtdEfVWwGysX3XFM6I+NL8DkV0MuH/zgmR6fYCz4A0ppv6ZCZGRGhBoTIoc\r\nkGkluS22pAbNAbGLRL+Ov89GoJQwdLXei1cnv45wyf08UQ5QnxEohcHWmC9a\r\nzX8bkbNiFZc7KlsTWCmYX4dPWXSqwZc88PEifP7e52IzB1pesSHKIXm6WRYT\r\nqRzPgc3A17ApC9wEYcy6W9NliWAaJ1DbT0Q=\r\n=lIdj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"6689100fafbea9d3aa6853c73a6435ee7432912c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-08_1680912646669_0.45132067193944536","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-09":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-09","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-09","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"248259556e7c7edded1c85c485f1d4c1dcd02d9f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-09.tgz","fileCount":41,"integrity":"sha512-cUSpVGDQulRwmf7DmfObHIpW+nB5PcyLUvUpfrfNh+/HOyTUadoXsf4T4ebpEEx5EUHduuGrHPpOnMyMrxM2+g==","signatures":[{"sig":"MEUCIQCiLm/T5QSRxq7MnS0AbkVEP7lr8Zf4mDOCnjPs54ZHWwIgbu8Xb4vEtpsbP/8xjVv6o/ysuTxXwPuOXpx5azM3ZLU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkMgLoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqRtRAAitVLfXJUh+RNelLbYLK8zZSy0RFmvZs7OcJSr2tleXEvy9tU\r\nxlAIshcXmhSyUsEhAy5jYhGvfF2hL7BGbBP4YfN2m9AJWtE1YWVO6M7SqJWV\r\n62JnZujuRFrFM1YA592jd97KpDz1R34G8YI26EJbGdpmizQGP6Exhld5zA2Q\r\nNKH/j2fmwhXnSEEwsJNTY9tvx4k8YT/RUvQ9NZWAc6pHHvk8J7xl+qu45UmA\r\nWA2yRNoCXHp6czaBi2qER/G9lO1IcefvIAjlfZJVRVsx7IAQiQhHU1br6h4K\r\n9v64AmzxAESU89duvejPZzmmN+Gu0r/W49Y5K3qEJ7ah6CclqV8Ts5b+YYVx\r\nc1aRnjA3eMOO2OmQ1OoIVHTw8nc1ZY8dc+Qt32+Y6Vi9mLS90tJAG7THeV9R\r\nTAC07bgj02RGOZHliciQOwQq16fXC8TZLFnM6P2Tjqcrib/lusAINAZDKk1L\r\nXpzNaASpjdh1VX+uYC2vimrQYzINGQafKd6cashyoQXdO61cXtEavmrUxUE3\r\nkiLXlRrpMOENlgjn03pSdX54Sok1pcYXfuwz5dLUyS6bFI8M0a93cFQlq4Yn\r\n/k2KzWcTsA+y/yOEVAYLiJjHhT9rgR+5T9xygMi7mCOv9mlAUE/bE+fGJNXG\r\nTaqvwuWQQcPkd0VoTubwhya38sWLPhrXAfo=\r\n=3sJn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"6689100fafbea9d3aa6853c73a6435ee7432912c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-09_1680999144685_0.03443909955211155","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-10":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-10","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-10","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"a595d6daa80ed93ade5b8f7a8f2a8557396153e2","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-10.tgz","fileCount":41,"integrity":"sha512-Y/NjVxOq0XA9lB92Iw5cmwLzUbfOd2sfV6ZXCH/gpTHXUGNMTcoABhc+jkaij6oab3vwGLyGbFIe87nyGcX8xg==","signatures":[{"sig":"MEQCIDQ7smJyTYA55JSZP82zuO3poZKTkjaTkhQP4YqqYfAEAiBC03cobFLuStioCnDi06OfdXPto1tBTAk6sYm7InkLEQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkM1QtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrqhA//diI8DTp3OFI9Lf+bTxpogV0ryrYRc53Sg6FRuXLLiMAUN/s1\r\npHR59uWXgUB7np9a4RG+XrQT5UDC1PDEGbxvITdhTjblV4k5WRdG5UA+By9i\r\nt148BAN2s0Js2KIVWlke8oQtVSoD9GwKG2RO9ixosR2Xx0Ka0yMBy6c7Vq7V\r\n3mWbDJZkocZySKssU7EQA3/nLcLosZb42LK1kpBq35F7nXU/ioHBeVVHudlq\r\nKq8m0D89TmnAncIyEEDwYmfMN0KG10eoPWVxnL4Rwx467LZdtpI9qbZ1J40Q\r\n/Hb399B9xjz9kfHJYf7hpxi0XxdQXemzd0aWj7GhwA72jPUPPNUSptqlfNwX\r\nJw9nahjrwHneN51EMt7YHaoKOrof1nSnWsyxeEhP+KU/fOI3m69CfNqETjdU\r\nNcR5GvXYPJLXBN1u5lIYZ2JtyJqHQV7a+IrtAUZc8N+h75X03Ue8ZPm7MXUk\r\nNRFlaGtsefUPF9P+0obkbWE5lsTutjsH0BvwsQVsNIIGTZKM0gklqOAT0x7Q\r\nzyzV5OY0yBRfJQrTu49ixPqu+nmB5h1mzqz0sr2dAvyU1ha4k4lufZ1gOs+l\r\ndbljwUyf8k5BE96xolMCwAv4fT/n4QXqG4BQzgyJbNfIbY95x8izkIa1Yo3f\r\nGnBhgCsMJQlOLaY2WHAkKwUxLoQtBio26Ts=\r\n=/7eh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"6689100fafbea9d3aa6853c73a6435ee7432912c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-10_1681085485141_0.7287913426008235","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-11":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-11","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-11","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"91436dbcca5c51856502a23829baad1fab5de508","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-11.tgz","fileCount":41,"integrity":"sha512-oImrUtFosDyKXEZXkUKhLTQgmtQ8ii0sfqtfIb3zDT5iwrelbKoLSH5j87sx+AvQC3RYzhEn8raHAqVE54pcug==","signatures":[{"sig":"MEUCIQDBdqEf9WbnZcVfREMXxugOnu20WePWew9mHDyqr7vUwQIgNzy0SO9jOF8arfrinqCLmEzzK1EpI8MenPPpQXPCyWY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkNKWRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrVPw/9GHCUreGk/xxlhuQpcsoqRnq8fN8tnFyhDAkoP+88mUDZaBbS\r\n2QB7e6Qsm23AO9MdXehADumTeFhvF7xVcMll3+IZmn8YezZcaLATgsBNud/6\r\n1sHU67YWertVV14i0AL0zRYlXdNCxMMkWCsWfgPD/mpdNGqJ4rJe7SSYylHA\r\nl3BxiE1L/Qv2cA82g9KIpowZNOmcuuZBNlq/LlaMwVPBWCAeQ9kJLQehHDXN\r\nn+6+kahJwh5d/FHNc7kJHTmS+ditXriXkb8oc/W2nbgpeDoV8XKOn9BIdYDf\r\n/eA3kULuMQpMUi4G3Gp+NERrLuipijLmh97V2On2YftVfDdb+0YkcJCt4QQd\r\nxVFEHb0a85p4sieCiknPzJFyM0isGNneStGzlwUE92ECVWoHO6Mg9t2VAwak\r\npUzu5nGXmBEuqpnMzFh8Th3rx+nXcLcVwke2fN0CxAKju66k5OyI8Nnlwzaw\r\npbO11/HMcopMym8VpegmstaaYZLutpOa5Q+cwTLLsHgfqhHycYF9tLOmi1gW\r\nUFehsbWcODduP3wZjSraPw4/IhNiuCxp0XMjJ8rSRidK0+c991SzWz4J/d+3\r\nCYqxD7OfUuE8tOh4/+0sOI/LqqfpXKz4bRHEgETXPXQ8yNpCHF47zUgsXZZC\r\nW6WnyItcy9Wd1O7RTmSZ4fQ8HXumht8qqQk=\r\n=7sZv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"6689100fafbea9d3aa6853c73a6435ee7432912c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-11_1681171857735_0.2104227873725244","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-12":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-12","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-12","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"90a47285c03c0a538adb772e88f83e0e4b23a058","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-12.tgz","fileCount":41,"integrity":"sha512-Ezkz70gQFBhiRTag/Zt7cDPIcr1kV7LpsuPacoffWZ9yrmWoNeTnzNUHgVaE4dUrkCPDS/F91FTJGIQ7Ae617Q==","signatures":[{"sig":"MEQCIAiVvM9XfghbuEMfemSOgULTu6i8OAcvW1ICDTnIBvmsAiBv4XMf5UfA/bjuWpLTqoStDUYxdLlWBBp+oCqKnVEMKg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkNfclACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq7vQ//QwxdyE+GyTrNI4+fnQCCFn6ZmnVvhKQhP9wWqRMWUL839DVQ\r\n75WMrdOd9MsRyauzaB7ysB+Ce0Q4+/P7PwwzIWJeNVI8EGpiWXlHXTYrD8sP\r\nJomeSnwGyLiv8IzMFoA6ZcAkRTwTXS6guXMcU/tbY4bf5RFzMv788+3I6jC+\r\nD5xDxNHpgWlVpOo/VCn0hovulY2a0qSxQ6pxK9XHjQfHms1h962EBn3ajKlW\r\n2wpTuLeJcig0sLHZUnBaCGqniPyuyTSUXoyJzFuQ7Krb8tnGXfu/xLSjPLhp\r\nwRxvytMjrdilQ3AQzoHA87gLDYN0BHsGsc1Q4nm/pnIVqhnRcAfWjvi5F7dh\r\nVeoQy0tF9uv/2B3AAOUcio+3Fsvp3HMPUvc6RaYDD50TiXYkOQai+1WIRU4J\r\n0WWqRpjIGQq5rwTZplmCjsYTA2aHXqxv5Bxel0EMLSE2mFMi2Ak/oa552o5j\r\n0pnV4dRPdT+ukINMJeLbR1YVyzRg/dmlV24p+EKWvvcuAdsd7mGc5c6oBNUt\r\n58aBVj8FRTqCvWKLuNFkODlX1SMl/AG1BUECPkr0rp/h/dn+eYJNfGuOe4PL\r\nk2fz30PnYAjuu/c1H4oSKTLGFcO4GkEDS2ik8t7kYCbsy9rq4hUYbWfjyyxc\r\nSczsQ2crHzUGLhTzcYXxTCr50QVGGt8fAeE=\r\n=kPMg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"fe6f5b10af70c9e654f658a31366a1226336ce43","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-12_1681258277252_0.020194589262169327","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-13":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-13","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-13","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"a3a0b43c4789759da3a45bbe2c3295921e963e95","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-13.tgz","fileCount":41,"integrity":"sha512-94atU9l+P7kUI9EhaL6IbPNht/hvOdZ7ZwF5bQUGqfphdfWRV1x69dsV6Na9Ws7wWotYss/IaudQxfzbJFXPCQ==","signatures":[{"sig":"MEYCIQD2dJOLgfXwxagFaC5WYBkSKNlsCLQYMbJXhwpYf4XArgIhALp5ImtLiNjSeXcqI4qKNDJgMP6XzPDhT15tdhHpFe6b","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkN0h6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr1WQ/9FCRipltuRXl2ZMnKPGkC7WLyYML8wNPbdyaTmNAoq+8c6ZRW\r\nFb0yjrrsR0FLpxe6lQKysmO6KcYtcq9XnBXXebcjxwMI/51OlCITyBw62WD2\r\n2MYYsgnnMCCxdSHnMz/OGank82oM+Cda0o/6znOcMSeYlh3VxAskT6h/It//\r\nLl0vz9DHp6boPuNnmet65JueX0XqFbd3AoY8eNqgxAitcuNzv4CqEHyNFHTO\r\nwWt1R0nTZqQkJeRbBQlDkqQ/eQcBrn2HIaQ/CmJFTiXVEUG+qtxFxfLRvG1E\r\nTNS00KeXBCADkCaChuDOtu9HpRWniuB3F3xqTTWPuwkcRfDkF/wG/tJAsRm9\r\nTKBxWLwK9l9LDnkSZt7mizKMjl1yYxDpfjxpWxUTl0tA3LzQcdmuR1vMxyw2\r\nMFQWUUtv6cYaVu8SItTMWxhYSf6BK2sFHpNNgwlKz0SjhcK+BiroZn1iMG8z\r\nSrMgtwuKydQKZ3JkjRnb6IPPTt0pLUj/g1A2qksr06cJCCY9AbVAvulsyxKV\r\n62q20oEbfZ/V8Q7eTbGDCdfZWn/u9bEX0vjN6PTeWsm3F1UVkkjgizbyBmiG\r\nhEenU5+EbrNXfiPoCSjFNw9JRLtXfjk1R1UTvhRsAhAkA6HB8RzErDBOOODq\r\nOzG+y6oJ5fso0WLNLgh1iXiXRlqAG8LTkRo=\r\n=gMKm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"fe6f5b10af70c9e654f658a31366a1226336ce43","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-13_1681344634727_0.36584342610449117","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-13.1":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-13.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-13.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"a59d6e79c82b6ec39674077ff58eaa94563a71f5","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-13.1.tgz","fileCount":41,"integrity":"sha512-CNnjl54V/r4Ae4yjX/tWAA8GYBfDoeFoykoj8eudaUXyy0794PP+EDV+DeokPmicJWGm7odksENVSVEFcnLOEg==","signatures":[{"sig":"MEYCIQD7RVggZYTMnosDCxp1na66JovHA1MVwSE4uVJIzuWTYAIhALYF/IjglHSvyvPTqI1WYgkK8ImQPtixui76uB+jE3ul","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132916,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkN7b0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo72g/8DMXd8qaHz/KIM7uNOo6aXfgjuzfzl92B4nji/pSbYk5sLpvR\r\nCa+8Bpn5qViHJTFrRGqm9PFfWiXFHkKDezyGn+lP43eO1zkgzrZPhZQC+02u\r\nSYhMl+kqYgSeDIz+D3ewdGgANZWeCHTK9r8Y/5GqiIgFlHkYItFnj/b7Y+OV\r\nvJ4+O7hPo+Ic6zUxHSWZVpdfCiu82ZUfeGYPNlX0cbiDuiEuTQLOgBe+O3Jm\r\n7P4aCRNe+79WmWMO1gO6UwkAIxr0W4fqwYNoKfH1rmD3/wC0wPWG1Aur+3MP\r\n6XUmO3HRseJ7H09xF86jkYtAkEVoH4PPTiLiycNUlqJ7RXDs4gEiXm6JGgZc\r\n4tAnHYGLbRjoNIJX6L7SuRWnaNqSE6U3f2BA1LHt1y9xERiES6em9kjWzqBQ\r\ngcPKRlNgYykEYXoGnYdBFMS1hqOiRVIh+lYb0WMReH9y0pHLd0y7+mWXunhm\r\nLfvL9LvmZMZhHE8N2lE27Tn3kBVMvJiyjEuSj8PwgoxWI9jB9OkNIGjhc9GD\r\nlvmX8jGTNQzIlMesKq7ALCJf4HZ3STMi4Yi57tuiDl7TsxWIpoKX8/SHkNrt\r\nIC9lLTM8Zm9gx+4U4TTAgatoe84dQWDvM4LRKuYHLszhqdqKP/HfUhYTjXwu\r\nQBVVHD8WjSWvUfaQyTVbzGL9ke99ahYpfPY=\r\n=x6hH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"6fe4f94e370f59d545a676990b3265641d106f41","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-13.1_1681372916194_0.8509425612316499","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-13.2":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-13.2","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-13.2","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"05285df77bf73b549eb4b90e845b738ec0b27a4a","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-13.2.tgz","fileCount":41,"integrity":"sha512-8OlYXd/0cYN1sBciBOfQqyhz1ls0AK1cvhZbTQ3s/Si3vXUDf2+8uhjmSsNnMVg+IC4xesa6MCtIWHB74c8A/g==","signatures":[{"sig":"MEYCIQD6jt8psp2fc4olvSleOaVGQ04g7NbUKfJiDjuu2CyKKAIhAMx5iBncFPqlS67y7zX6qFrlFlfm6QZSyXLYan7pF9tJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132916,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkN7yuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpJvA/6A/Y/m09a6HOMRrB4OaxU2EzOSzDYpelmjXLamGVz/sLi76U0\r\nZlRwBG/9nda+BZC2mqhsTqJaeY7gX1xZE5RNJQzcF2bl3XySWmA8eCzcrYYv\r\n8nYl113+lVYgCB1WaVJ3AcDJEArwx/0aaAJoqSrccI0sneu4gRT8zMG7cP9O\r\nQlJGFpunxSR2+ARUrR+/JQ9/U0mfYQA/tfcN0y/OUvnTqn51h+CLbog0LmlC\r\n8TnNx9Jvm9/V4jwhuozhNHHftcjDKLtdeBmTs1tBJlupdgFJqHt4C68zwoSb\r\nulZWJvwvFSRkFsU5nMDBjTt30RsRMUJ71XDJKQoxmsUPogxIVglHBcJsHj/t\r\ncSsxZ0OujiKwuvWdLSOsyoIG79EyccsOe0/aTDHT6T3N2jFDSPlT/mzlSJ7l\r\ngg05gF8TxdkeoDT9QoDIU9jpnPcjgs5sYTLEZMjz5HX8V1qWYU+Jsw8gjdDI\r\npOr8jSWNxtCbEnJz0KBhMdofw8vDGIfUfKe9cFy/MFM/obHAPaohKLvgrtA2\r\neRRgqaDM/+7CCYiDukrW+X1nRKK/wZfu6gDjfFlt8Rf8ODYCJMp4dFJDAV31\r\nU76YsVztKgr3FkSBZp608DOP4bc7F4Fo46rd8uO9ovLxier61+HiewJHWI+5\r\nm9EZN7Oo2ijZkzcZJ2crpDXqyLHFhDcLV40=\r\n=1sMH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"dd43de579488c75999f03fc2905b404a792e4e62","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-13.2_1681374381784_0.8321749662580549","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-14":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-14","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-14","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"0a3dd5b5cc27cab3438fb88468f99074f478d05a","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-14.tgz","fileCount":41,"integrity":"sha512-o4J29Ac1H3OI2AzptImETguVivjpG3j9iyDSnRSigDCpxu3MG2TZHsH8XDC8y+SDrqQjcRg4JOnb04A6zuilDg==","signatures":[{"sig":"MEQCIF6gjgO1q0IowMnVo/yFHRqqZF44dMaC7NU2NH2w/WXJAiBE+OykAXEPjxocfLhGydOq/pnXFqtJIvYsDgtItagocw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkOJoSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqbJQ//a9rsM/A2D6uUw70M/xt4MSDPXfH+VAfnHCHBTPfl1tEMdrmY\r\nm9Rh3P06DTHBtpITw2qmRQbF1Za3PEbvxW7Avtjo5VeBMRgimy9TJ4FP5WVJ\r\n6fR80AN4od0gPFnC+yQjPLS+2579YeXWANd9AhNDLb7VmaOiVYSV1s5dCX1z\r\nJDPimniD9j1LxCn4NnWI6TET0Xd7e/VxkZ7APcyHpXLaX5W4OenxCaPP70aw\r\nPbPiGKGmKV3hrImSq5pWnWBMkLbvAWXluq14nrJBbetZsRUq6xQHawaYYHqX\r\nXOAYYoUnXKGqGGn3TpX9UsDXngIS0GJvVPu46s1ndN/mCaDR1Ttmjd1rjevE\r\nvcJFg8cToCYBanATQqLmp1Wwh9JrATXgrDbCthb1Y9TXj6+lT34o+AG4k2Vu\r\njDphS0lzGtXtrxB+ZZPPIGtxPLpKWb446dN6U41vxzUQVPs8cutY4XpMqHsy\r\n6gJZM2RPP3ETldE/guxw6rzUGMJ5knQvKPz3EY23ypTHowbf8fZEK/1Gz/PE\r\n/73QrlUm19Yzqd54sN2bBWEKSbjFS0HdqyGFgr3Rg5lhPEnyxOTVBsHec21w\r\nWwPaiUqlFY95TxZvSjGBp/sOjj51mzD8TVDMk3gZO6JIB1LCYVoMGe4KT5Cf\r\nX5BGzlRQ9s07G6AAPzC8HLx88PtA+XnH/Nw=\r\n=wL7S\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"dd43de579488c75999f03fc2905b404a792e4e62","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-14_1681431057965_0.7257341188870476","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-15":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-15","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-15","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"b7abd6d90847939b0e4448cc68550bb5eb434da0","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-15.tgz","fileCount":41,"integrity":"sha512-5yJDR0MFQ2KvhioyTSWYFPZL838XGtPJmRJlorC26jspZNrTOjkndICSC14yLblND9FS8STQDiBMFbsXiyIaGQ==","signatures":[{"sig":"MEYCIQCmunJmFFHHUhEqL7kabS4jZW+sVDAplNCLTpQ2f2tUwwIhANFtXeQZhRTslYYXtQC3QjgUP/qVOrSchKEP6GQODgUv","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkOeu8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpPLQ//W875FJnOn2HIGnWPD6M4z74n6iuJsWjXHrzC6I58UwrpJr9G\r\nrJfGyYElNGkqaIV+KCBMQVodsibShKLkp5as30aQc5kxW0KgbcBDI3BFDnx0\r\n3ZFgWfJSZwmoHPwyAnUT21ug7b97BnnrId+WCcwwxx+DgGxDbjwpUOlJaFgh\r\nDo+yIJ853YlqfIM0hF9ZFtF6uSRd3mguKmNNUMR8tiRXFJIudNFrhxNtfNNv\r\nfXwwTG76TcdZAAJox66qz8bnZzlQvhLLUjovRdGP+R4d/swBDA3Bo7K78pBQ\r\nL/BGRaZK9e/WT/IPAuzC58t2RDSSmRQMu+dbhMonRQ5NNvmu7XQdGuqkPDGl\r\nwO5erDxLeBqELsV7lPnQ+CCkV6gQq9amzJsQqgI/4BIS3o9z6gXNh2BfmZGw\r\nHcBb36jBctmflo5dM5odn1ITnz/vnqU8RGA190E/V/tzBDpZYrJT+jy9ynl0\r\nSp5NKI5bENBw4ug72ZEQ4+EGTlS7d/yZuQd0d2tTmS7CeUx4C4WgChBnAUmh\r\nAHtE5/qcBVVCD8291jiD0Ud4WiUc7nisIZGCSJfl+wvwZK7fEFHPJ+GndFBA\r\nuD7DL72yDvdWiK99POByxNFovutdi5SV3LMj/+XZ9zE8TOmJCAZHdIqWVgS4\r\nwffs5IhzxpSEkhnDomLQ0tEkFkrqwc9Kcug=\r\n=Nc0D\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"dd43de579488c75999f03fc2905b404a792e4e62","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-15_1681517500009_0.837723287464839","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-16":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-16","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-16","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"a50d1131aeb7137d0ffb27c05c6387c93b6eebcf","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-16.tgz","fileCount":41,"integrity":"sha512-yz8cqIzAnHDnZS5IEvuiEE6Ger6SYslzRDAU/HyvpwieXxSaFm/pJozUCzOVEj7nDzmXqO4SGeglkFNYKBb5hA==","signatures":[{"sig":"MEQCIEnraEvT4RBOuZQaxpo5iPJrvDh76wXJOslxCtQd5WckAiB/+l8DVHC8ptUPWYr5ns/Gb6ZuyFFpGIkEzSuHu5Zt1A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkOz1bACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq+kxAAmFA34A6cMCz1DewQqzDOwHkiHI4lTVTL406wEEETblGzBDpe\r\n7eh2ios9/J1lTffKIFK6+XDs+j8DEnuAWBj3R3VLGnX0oASxyz69/belE17G\r\nq7kgY4LG09KsXrbJidgRAXkfGPbGdz9mznczXeVhZToxRVPUZnl0/1E5zAe7\r\nVHhvIvTkzgRs7ReT5RT63vlAI24oGC3jpuNQ6pC0gVAn08P/F2/pFcFLZnX5\r\n/gheu4qxuU7f3IwqeAUE7O9IMFvKxobLvdIfDyZ2wRcJwHGYFNzJJgG64Mna\r\nt7v5acPEqO1476WBKpsOBF5QjMakWqeVcTsftsfcfogaEK65uWSv32d2iNTB\r\nVsbl1NH0g0lgDH4letmZ8XnG0rpO1LoktIvz4rK5nzxikhbOCmT5fqlyEs+B\r\nWA4iUQyDXxnhS/9l5PV0btMCERiiCSZljW4LSN8o9hFCzPffv3M1JMyoCj4M\r\nzAk5hzksu1mRU+GWcNiCtkPIbifntd05VKadYjwJhRoL6VQbLCRd9Bv7AlZ8\r\n1dddzAhMBrlHe3QJhxNN+M6ZMnlFPnPZEwVShB4cGv6Y4d+SLVAF1J9YbOMt\r\nM6l/Npjrs2eyOl/2nhTjrQEsCeCtoVhXaaOSVEla5mKz0NFH5uTDf3NKIeIs\r\nAHMZxN12nM9vnqzuhGtbKcwwyuqK41ieaHo=\r\n=+E/+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"dd43de579488c75999f03fc2905b404a792e4e62","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-16_1681603931246_0.6117964836586287","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-17":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-17","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-17","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"cf27e86f3d7018b672fa718dfbda8016ef189a4b","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-17.tgz","fileCount":41,"integrity":"sha512-ceFs3tWapTdK8DPNWmecZywF3A8pfpFEOTy1u1yQc5fhy851+mxViV8arWlmEZXCZrBUqQ0AXP3uAcGWHi/DPg==","signatures":[{"sig":"MEYCIQDgwt57XoAenX8idCarREmvzWpVX/heCKCcH9vqCUJwcAIhAI4M81QW3jqQ6EgoQmfUeTCx6Z3JIAjx3G+aD1H93x72","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkPI6oACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoY+A/8Cp9ZG8A8os5osShIMVej5OjSvYFNTdLeBUk8Yp5T8C1oDeU8\r\noLjZ2VL090Xtd/frmQPwetT0LPA/jQY4nmJknJd1A9YJOjT1KFmzKjXId/Iq\r\nU2pAOMcpDThPJDhSMGeKo/ckk95O6c/TVrpIj7DhAS4pCZCbJxKxiY5sB05G\r\nlNLpQp34KHHDMSAB7xC855CWf0/oGUCj4E9I8OJLULRvcRzZnlTsJrkNc3gZ\r\nMXeR6KzRx/oU0KGkWy+L9NuuFZ46BHyKkgQq8VeVc+ABqdT3gQSqgx0L9q8P\r\niX/uuRWyoHSsk9W+yMPYiRxBGyoKLIQ7MAmfzdgT1s0u6MquBT0umuOrz4ba\r\nqjUP+rLFth6JHwB0ojHBUX+94zvJ5ntqg/x+7KeLrNLOhnjEFLF4rU4nW2QQ\r\nHo9cmT9NTAWovYM/RNgdczS1x2uhXZtudiyRFFM2n1Wr6GPg+bogZbQCtS5O\r\nMaE9bqwTPO03oYaSEqCNBpJq6wa/5DRdLn6FCyqpHJoRTSCbv9LeE/BC1zw0\r\n1znFM9slgbD/oQCiA2AJnyYy/i8AL5BB4B22o6M6XisucGrpz66BJWO+UDR1\r\n2eszIJQmQmlkS7IGUj0u1k9hE3aoQytgDG2IovzJmcHKr+TdpEiqqvB0Ry15\r\n15xw9cxsu8Vqpgh9Objjgjp++ZNEANOhpTk=\r\n=r39K\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"dd43de579488c75999f03fc2905b404a792e4e62","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-17_1681690279778_0.7366227832264427","host":"s3://npm-registry-packages"}},"0.0.6-next-2023-04-18":{"name":"@dfinity/ledger","version":"0.0.6-next-2023-04-18","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6-next-2023-04-18","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"fd5f0ab9de869e1b8a26d586308785d8e92bfadb","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6-next-2023-04-18.tgz","fileCount":41,"integrity":"sha512-tagm84IUfx2xjl9PN4oYoFpqZCSy722/nVK9Efqo2BAhjJqlHl5VG8E8ztRKQnZiOTrYc/QzasW/Y5aMtMqLKA==","signatures":[{"sig":"MEUCIQC/xlZebeHJvFdgNGsh2B6Ndoj8nUkXBwCuZ+4UG6YbJwIgBWwq+u4XwopSont6kySbYxwqHFeIHmUHhe0DnhTwDaQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkPeAlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrV/A//XSku3qjaQdlQJMsT5x8UVK1PtUi1GllETHkzEpUj2qQU+Dwg\r\nLH+wfS+b8De2pSwP80U/7fzEHfmTuM5L720ZLS0dWGov+Ng32OHy0K+gOQT8\r\nOV8k3DrfFv/ImFsD+wsGE8akPKSA032SsMYptKjCXYJn5U8E/2UNCz0zWsWe\r\nv+lQGVrMO+FVQPlb0OMb+Bxm/PghshxcfBnprtUj+Vw6gPO2rMddwYwt6BDD\r\nshe34ihb7Vm3qBZTDvSjGjiK8ssE0lytmDRr2DA3YTg/bMsRXeAEMrVXa8Xc\r\ncbjXDRSuidYsNINSPsrRwFomDQ5Ry0RWUhoH3uPFCfJnAysvyTUecvABklD0\r\nMvHYODBbIYSHJwX7kAlsu1F/Gr8jfkyK6ALaMMxFsduL7LzcqqYgju4gnOER\r\nb4sUSftHgLjDiMYfrrkeTjN0cZxWYEDEADuOJ/e08lX9bA6sMwFiOP7MJTNS\r\n/xHKx6ZX5biaSXsgTzyZsIFGWx/ngBO/bxlz6DcrxQCQyePFPpsX4zdZuaUZ\r\nhp16O1K5nkcLpn3Cl8RfpY7IicscjVsCC/bjDqbgZz1vhcXWb3ZcVcHcdA/0\r\nV3gKQFOeY83Wk5KIlVLXxGUupHR0/Zjw00P/t02AWJxi2Cf7eaXbFCxWmRZW\r\n+nbmnYfVwZOEyKsBEVhRlnfWd2a9HbdG0QQ=\r\n=w5Fg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R268\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"dd43de579488c75999f03fc2905b404a792e4e62","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6-next-2023-04-18_1681776677270_0.5982598243169654","host":"s3://npm-registry-packages"}},"0.0.6":{"name":"@dfinity/ledger","version":"0.0.6","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.6","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"3f1d9fb96c87bc8b86715ed03368a0854d08654e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.6.tgz","fileCount":41,"integrity":"sha512-85ImuHII2fgufJcBCVwAVKI6NumwqW0SEp6iABUQON2NYL4xpLaFrpvD6vF7e+kIbfT5cNkebLu/O3NCfmYE9Q==","signatures":[{"sig":"MEUCIHUgExzwIqVy418FMk7EuXHKGdzfrruv2c1U4bkUuZwkAiEArLYRpvgBekg+p0fxeItKpPkbGU8ytBnIa5zhHgC6k7Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132107,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkPj4LACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoX6BAAgvN6BvGTG8q9TwwMgQWACpELVkTN1vWjxZoIi4Dxs9/cgVW4\r\nL9zfkJCnHepBTG0FRwohDJRxWC4admmYHnO3XgebANCSbllYsRrmPKJncVQ8\r\n0929a/qHnBAl7N3iyfSuto8o/GLVR8RQTzjhtrRhuKX8iLrOWYtqWIHIZTy7\r\nai1/CSdLrFiX4B/wwLLSZia72Cp1b0/9Gp0jg8I9iqTNzJmOmWOSOAdHWw/c\r\nWCVmECSSFBNC4G2D+a2Sf28pb3jxEesOIYTHVOikS6/112R/QqWGiHu1aQaj\r\nSGirPJytO/LsvluZ5Bd6l3+UgBziHJWF/5VJijLUqf2hUcq7vflQ6L7y/b6H\r\n6otxCHdxcyS3rv1P6JH2fnTw/F50rQjvgGD6ZKtNJDpo7mmaasuC5Tv13d9q\r\nH0At5lRnqxxloY9veE/PiwltlJVyIpNaL60q1wtoIyI95JlSTo/Cp7f1PHX+\r\nnb6kNuQYBi2HoAxICKjSDh3WCiRDV29pTBuKdjHxY3Omfrn9lxoYBq4IKH9I\r\nfHWaN7BefeVK7citjl8wsqwTEyEEZKl2GWypdeyuJOVaCme8xG73o2lyaKA4\r\n7HsniopZp2Jys1OOPGyrPu4ax86gXLgoiDPTnDAkU2nHu8Wyy+lQEo8gY6Q4\r\nw2cthy4r7FsRIAEEM2vmW/C2Yw7hb0UwQdA=\r\n=V38R\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"16dafe0ba6c004973e60b7794b13f84ab2f36e23","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/agent":"^0.15.4","@dfinity/utils":"^0.0.13","@dfinity/candid":"^0.15.4","@dfinity/principal":"^0.15.4"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.6_1681800714988_0.7204946873699707","host":"s3://npm-registry-packages"}},"0.0.7-next-2023-04-18":{"name":"@dfinity/ledger","version":"0.0.7-next-2023-04-18","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.7-next-2023-04-18","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"62a49d27fcaca1be6107308034d364b5fd5f5efb","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.7-next-2023-04-18.tgz","fileCount":41,"integrity":"sha512-bEbXRzoTr4sYzBBk/8yESHvbG4XuR4bQKwG53Zjc2i7ioRaPikbCYr7PH4ou4vv6NT84qgkx+gPKIBCFTrXpZw==","signatures":[{"sig":"MEQCIDS9yPDrcPKsFuLl5dZLn8mSBV+C28586iAEl/npRct+AiBSQlJS5XYd/7rez1HMNyFaADFYr8/TYLpLQg0FtQa69g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132098,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkPkfKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq4wRAAjfZmkDRPvz/PqrPi8YI2joz9o/YziIgLXB2F1fzpw3RfNv2J\r\nr2GHxP7JnnAZTMAkwI/mkjcMKJEpl+/Cfhi25G6nnHecEYKv3lNeyiOniyGP\r\nsBt5NoUXLwBtODDhECz+qpD0bXclZ4sfY9T7RHL3mPDo00SVC7iZK0Nxta1t\r\n1hsaQtj9PxVhu9IO8/nm8ar+onND4m3Lgmr1z2eFaGxXWjKN6dG4x28pRjq6\r\ngxPcdYCXir2pg+AAVtUhpM0TFsIrjcH/yYEd8xev9LqOp+t1bKbofOsSw74Q\r\nH4jULhv7jDr9CTYw9OssWxQ3fFpqUWm23KjsIobLMFTa9OwM0wfWL1oGHmJw\r\n0IqKqfO23fpx32cSSTWkBZoreTFuwgJAhYEWAso04z9ixUq1tYsxx6An/lDJ\r\nEUYcwgJBTcoSG0ibHMVFHzmaE+NfP68LFtcsDoD7LCQY9h4/RZrHD7A2aaOx\r\nJvh9rsSt05J13qgPQBV7qc8z/U6KQeIhWYUu5wy+Mpj/oAlYPpbR/0+4kz4k\r\ndRcEDnxgdDSaeUznCHO5py8DuqY4m+FmOxOEjNszYLQ0ycxzlT+2C+RQngL4\r\ncbHIczQIE+RKOEXzwJYE5w5Q4peNU8LgUnC/dByoBjoXjVD9u9NGBHovEY7n\r\nDgPxkrkeG+ZSu4cpxxzfeNA7ShV/68+NnK8=\r\n=MY90\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"81289e5a42f09490ae2f48ee512f17a7867d5f18","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.7-next-2023-04-18_1681803210338_0.6177567643328983","host":"s3://npm-registry-packages"}},"0.0.7":{"name":"@dfinity/ledger","version":"0.0.7","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.7","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"0f62ca104ceedb82acb8657070bafc4e5b161c2d","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.7.tgz","fileCount":41,"integrity":"sha512-ZxFK28jI17OTn73I/xHaGRRjgyYUP7Fnxv9BfDKKQ/3B+5hcwU0rJrmCMhIZrdit3z7Ryzsj5NPa75sRKq2W/A==","signatures":[{"sig":"MEYCIQCiKb2I8HQ7gDQnRFsYxXVO3azRasiqP+TdeH06FDZWtAIhAP8Syf47Joz2Wa3ev92P7Nn5cyzBrz6RupqxAGzvKO41","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131675,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkPk09ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmockRAAoc7VkkXZ/mzq7RKW3u0ct3sfsNqjkP51ZM4XZzdTzEtsRFA2\r\nFCFjOtX1gE99HQKzlrNbS0D8mWOkCVa9vGPChrkPi25eKaaM3w7yB5RthZ8K\r\nm55Iem7n8OwP4wff/HQbkIIOJ92NbuUSVpHpoB3+sjD2d4TOk38of5xgSPgj\r\nNr8RO09PuKcw1un57Yi4qxzgsxjeUtCObj4krB6z52UlXUDzz+lhwa6lTdZp\r\n26mIIr+61OP4mYsB3BzzUIp8oN0q9D/VRtTxVcaHph/xVnpmD5QorikTLrUj\r\nAQSdC+AzuddUDbx+BMSi8WmcuxkTnZogiQWO3Lhie6aOUhMPM+UW+NqoBeQE\r\nBBc5rcoYnJ+n8LfO/gN0J52k6ujIgAw4fuFSbSTIT9+JQ+HXh2u7ZzhKdgFE\r\nlpkvLyGhhK5c3D4JqPJlGAD6lc2yl/srl8wU7659isECaF6aHgCKhbqlE6CI\r\niZlA4KTvm0BUX022UWyaXbArMmnAcrTBOXF+GbTkp55QynxfgorB9m/OB6MC\r\nxNFxbcoBbcXESqqpaeyrB+5urxZPt1jXUCuJsU0ICn6n38nLYBrEBZGTr42k\r\nItRoLIObtnv/uPG5B01NcIKbGdrtuT9BE2FEfhCSpG9bW83ejL7CwVsBlyjs\r\nlId+O2t8Fd7XGK5u5nwbfjxxn0IXBwimjQc=\r\n=nbHz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"303ebe5abbfeb5aa301df2d2a11781ebe9d4c8c3","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/agent":"^0.15.4","@dfinity/utils":"^0.0.14","@dfinity/candid":"^0.15.4","@dfinity/principal":"^0.15.4"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.7_1681804605156_0.28081304362451887","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-18":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-18","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-18","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"63390423619b42e8432c0b4fd5be7a2c496fce72","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-18.tgz","fileCount":41,"integrity":"sha512-FWACXqSs7niGNHzQVSFqrBzOA82nuoAOvtf82wtO00dK/gvgQgLvdYE3Pjs+cdwP0CLI1eBOwzNDjrYJ9CvScg==","signatures":[{"sig":"MEQCIF5ckEpGhxJG/+WQotnrG8C3eaPHaEEdKy5tzVKKCereAiBWllVhwttFvZkfjJ3SIuM728ZbSL4xziI2GjYab89pmA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkPlWeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoWMw//QY0WXI4lYJKB/QtJMrIGOldYLwrUgT/nqPXggSlNsTVVdZV9\r\njlcPvsffCOAtAgelB1/yHXNp4QL8T/ci51u0y/ZB3NB+F1tnhDLs2OUIArJi\r\neZdCB6NTCoA2HaG5TMw4cHMqmzYAWdO6izAHco09TizLvQ/qyWdYNOvU0DAj\r\n3IaED4EqSIJy/wioWG/b52D/wWft8zYByQFFN53pbcrsUirQtt/SqNi6pl8c\r\n5VTZridbcwgMi9aCSftCO2LPuiwuyZOplDt2ly8Lw58mWYavjwufoWdNfwkE\r\n4oartZuccSwieU66Gav4pqDU7j93jZhpF4+T2BBmJK5jmbygJ6ftA1P+MI+p\r\nTbdDrlHIGZBtP2YIk9L+sil+KV/JJfLfjaBli8KScg08p4XWFsmnfcoYiNiw\r\neCQ3TxGakYI1R3KQNFeIWpardwzD2BAz4aBfLpCEr6cqH6pT/LQ98OS20v6c\r\nvCEDtL2APNySzxbNmdO745MXbU2X8J56yKjwl7EBC90fwKBPKe0+HOyd5WBV\r\njO874kqZw0Nj7GoQI79E7BJMjERVUH3MSY+kABREZXgFFYLaBq3Q468tOTWA\r\nHk1kSRMPkz3tReokBAWO0pTpilhSg+Zrk0kLj9cHT7ZOfVuRzB3Xz8LZa4zu\r\n6eIBxPN+G6cgGFNNLR/+/Lstgj7pqLUkFsY=\r\n=NXpu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"86984174631d8fdb52ead1d485a06d37c9943e43","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-18_1681806749820_0.7904524053207536","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-19":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-19","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-19","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"ae7c107576b4289f20d39e9c1d3cc1ae4e5d6ac2","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-19.tgz","fileCount":41,"integrity":"sha512-7mHOk6QSQfYTLzUnI+X9wBAM8VLQ8GYAS7NKBr4XIWFpPVHs1thvcA0oX6vYXB2Sk+Lz/t1BsusxE0ZzRPs4dw==","signatures":[{"sig":"MEQCIAkFwqWHNwTXJtLceot+XbRNkS0rY1EvYYUyz43USVtOAiBFSo7Dkul4S+ksOh2o79Rro9nDk1hnjatR9CSV9OR7jQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkPzHQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqw/w/9G6uhJl0mUX9dM5FHoPKvxvwKC57AzEHPvo7xutkAK4fcm7PD\r\nhc0xi2f1y1syyQKb+vPg+QJbLAOVwsqGvj4ryzAtS93xGl9gPSkuVR09ryKj\r\ndNKtbzwe8pjcgVKzkIpMG5o+fK/1ggILTQsyCTXvsgOao9Jd5uKGsr7jgUEL\r\ntt+JoQehNBN9dOxVUR9ITHTql2pRl5HjnmTEOuUncU9GV64iEn2RsJhNZcyN\r\njTdsZ7LAjKz2Kam1lTP86L+kavpZgqlgsuSw/uP7yg6jtkicmYMMMic94rG6\r\ntpB9cq+zb+k3tShYe/Aaalq7x7depsZ71Rb6eVB+9/2tnklJyCOrYqsXM7DW\r\nfeVBFv8GX8ehPSnOQkz3nVo1wusv82dELEUBCJB3qTlqrcj1eR9qD/fJ7pfx\r\n/ocXdr5qf219YnQVjTgbp//63FyBEpzY/6KPyAH+/VXlUIWMViidHyssHUgK\r\nfMmeUeHYEWQi3WKGsCqzcQChn/mQKY8a94i+tm7SA74tbnwNP47SvRVy4nlH\r\nYresmc8b5p2TCE6I4UvOZujkbR/RSNe2wAiCdiDusUiwbWI8Ifrw4ErQXXaF\r\n20YMu2gOQyltHDZigFfyFNI3mCp335BGRMeyTLPmRz0zYhb6+v8d1mu/Wmcw\r\npqXx79dikNFUvNZiwfbcr/MEsISenU69US8=\r\n=Z261\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"86984174631d8fdb52ead1d485a06d37c9943e43","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.0","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-19_1681863120404_0.7465489612305984","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-20":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-20","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-20","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"1a3a57e949f3d67180378b48017ea2e940e863ea","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-20.tgz","fileCount":41,"integrity":"sha512-rb8k/zuy5xi+k4E6gNrGtgGmFbPCfHifMy/zLJbbn//HnwBa7h6kKxh9vdVl/zzG6r+KICfCxub7aXJLdRZAiQ==","signatures":[{"sig":"MEUCICy0joDTOmF+1EZ07MI6jsuWjPqKGWxdp9oQSD2Pe6p5AiEAqmKGWFwyAA/E9xNP6GO3B9wcyJBHJdALf9UnRkICOEA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkQIMMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrIrA/6A6zohamG1e8E1D//Gv+IvGMDNcVyTa3fsnBJAiTeiJQcJlt7\r\nnsCMVyaCLKSCohBu9WmZJGlamtA8HaoBh51lbBNMHFpE5jeMkxmSBg/p4MxV\r\n+RCUKeRvar+Y8iaXpE7UC75HgrQE999OkHIoUFe3F8h2hWQysWqV4CdCZcZl\r\nXD+NV76JeeuFiT4FFT4v8mZyR8Kedc+lw8dTxk/Ecc7vcsZMiG/lQjA9kqxo\r\nshsLslerd0AIPSyO+JAkpT30WR+rwMh+EMVCbHHn011r2AHALRiZpUY/WuCp\r\nxLVgTRqb8SkC6k+XuztQ8lOW9n23YgFwjp9FBhsOmN01R7gbaSrLiT+j3I4W\r\n5u3JwPYIYLU548/TK1+x92696NQJGaHO+MnqEpmJEmyP7CtWPTcryC4nwvwM\r\nyN3Y5u9NRpkkeNqIYggE1uc8BJfprtMBvEL/QVSvF0Mqwmktzmd6nmaSKzJK\r\nk6Gi0+i3bIoWyJEiyhSo4ZskfQIRd6Y63jZvwrJpryU06PpP3y9wMM3MnsYc\r\nva9VsQ6HIX92cf0bz0/NGvxkXxXEKDpzx2EhaUCVAIrqbTevza6fXioj7L5Q\r\nts2R0LRcuwg1Iz0mc0l5kMbzbhN8DYKXTuXPvqc7NoAV9tQvrNJAKRvDAdEe\r\nR86UHDFOpyNM1pUipWyhss1Chhvok/Y6fVw=\r\n=Ix4t\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"86984174631d8fdb52ead1d485a06d37c9943e43","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-20_1681949452748_0.9523012465139311","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-20.1":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-20.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-20.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"066e6f3947f6671074ee592a5a763897e5fcbed1","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-20.1.tgz","fileCount":41,"integrity":"sha512-upTLwcHJ3LYX3C17NX5gTlx/ZeapbDi8+UdG8AVRq8D89j78xdfItJnGvPicOBkAZsMAlZTw0JW9oSEd1nlCUg==","signatures":[{"sig":"MEQCICPdu1Ufk44slChuA1aq1Hl2jFB7CXnEMOp9BdJ4GnPWAiAnTIz5j9pLHvV70eub16lsBstGCamUAdsf+5H0FPsk0w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-04-20.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131668,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkQRiwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq0RRAApHEZHI97meMWE6plnmIZ5ZCLlAbaqHgav29SAKAlgpKEZmVj\r\nJOt0heQQh/gcGU0JfncQRV+9BWGQs6tU6/PtRZ6iCxyPs1QX8y0OiR67EWjp\r\n0J82TiyjHoD7m+2OQxQy8yx2X5wqCTz6RSDY/Z+Q8fz7LYdNMzgKnPseVnoJ\r\nGok3j5Axrmd4XSUd2sEWNc9YY2Ea9bkubbTqSKSYjIwH6YMJa5IbnzBkyjzd\r\nH7S30ytoXaR8dm2pEumermUt17q/6RBPg7qcilI9gdK26cft8XbgJ1rVJP2K\r\nF9NsUGAPIzph+q1Koik80LtWPH7jaIqtIZhD+xnLOEcnfMINgbddT7hm5Ibe\r\nWUHMqbac0lCJHdDMtBvf6Yqj1Z1ClFX2r/NM3lKEGmxbv0TKZ+Z7Tmjy1/eo\r\nnZT2JAjOcQR2yvNV7c+iGH6A0cMAZU3JM6RkJb/pAbKAmb3fo6OoUavTxbJ8\r\nAlUazf6K1ptIba5DqimuZzwdKiuVHkY+klrUttlgPkugV1ZReSttq3wzqkS0\r\nNGBoCM7BVjCBWSWwYDMbg6yylyNRibadBdJmlYPsU1GP9D56Qc/jpHJcbfnp\r\nmMmzpU+eZChTmGa4wtmDNTTwL3HefWwitoKCHMFrjjA3p8R01JMK1zvVR/wp\r\nobYeropH5jnUc1Cwk1SzFo457uroHl4JE4M=\r\n=Rzy3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"c95e48871173c98e6dcbcb6744d1ba624e2d1341","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-20.1_1681987760504_0.19529484409018272","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-21":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-21","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-21","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"3141b0bff5d95c8dde2bafde241b0a81606bcbaf","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-21.tgz","fileCount":41,"integrity":"sha512-XN1aKpxRodMqsj8vYq1kMQl0qUTPZhDpCYyBVre93GKUTpIIvjMzLWi0U6s+YrwGvMKGYox2NU5yWwSxs6xabQ==","signatures":[{"sig":"MEUCIAVK/Z+lmcG+zOF2Pm7E2X0A5dV/q7ksLqq87PvYMm/fAiEAzqBIRj3tsUUgneklYQGo/VDMTuT+mJA/4hyGwLA6Vuo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-04-21","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkQdSgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo+kQ//asZUCubH+ic2qKJRRHMB0NrHr1Nh4Wn5LDN56//JU56Rxv3B\r\nrcn2OzB6c8rrISbXmoAeoeeg9aXeDsuFQrzfTAEJYzY6Wq5+c+HazJMQdkd2\r\ngWCTiTShsOK+Fa5FE02CsHX4g5J6U4VSEHY81eovY24cmFiRZ2mzFjL+TFsZ\r\nbHIvZ/IdY16/Sz7JPu2ArNmhaamRhHANoOFOzSQRJuEHKyudYLmpZd8xQwFE\r\nTWQvsuZF1bJHKLJBBsrKQ6kku9OHA9Fh+pXXWhxav/6HKHxMkgkhekzPgL3F\r\nbbW7Rax/gEucK+JC7r6nk9SmJHnZCiBfy6vf1i20OKRyNVekxetC2Ya9SZto\r\nMrQVHR+F6La4v/n9vBA7TkZxq+idY+UBN9Q7uPaR0w7E6RktWZdxtCwcgumG\r\nlrjoI6ShfsJgeejLJWFH4+SFBdEbwny/2W5r8KrU0T9rxjOePOUdbpUSbUfE\r\noOCT23upmxqGMg/XFtcvRVqgw03C7hy/pM0581mzeg3gNb32QQ/TloEGbSjZ\r\nPpT+hW9F6tGmsvyGRw9JzBFO7b3ODpWuELU1MO/5za6kNJ4bDHg7QfaUzmrG\r\n7MixNN8SiFWP07xmFJCO5T1EU6DVXmuDIwtqJtDDvXTGU4oYeGYeG+YtBQ5y\r\nXDpnMkd1z/l7/IJGqYmKYONzd00/wgS6l9k=\r\n=k1A2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"c95e48871173c98e6dcbcb6744d1ba624e2d1341","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-21_1682035872558_0.9727626863979371","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-22":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-22","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-22","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"11475ead3ce3f0e6c2e8fe03def1e2070fd4f03a","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-22.tgz","fileCount":41,"integrity":"sha512-AAvs4whiRas1sxmXJhLR6xc5NULQ4MkbGSqtkT6DKWYnNhh5fnO3pAnvVlUcptRIlvk7txxFMqn44GiQoGNOnw==","signatures":[{"sig":"MEQCIHYpmIrJi5ubd9DP+525ARpDQnEayDG+TmCAqboeji8TAiAMkw1wFvSGvnCyC0gFaiYreeiH5EyG6AhHI4ZCeKZrLA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-04-22","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkQyYhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp3DRAAkTU0EOqjjvEEcaJgXS8HKM1en/qSL5Y0+Y4gbU8zoSZPVYBR\r\n7a3tNctNrUiLxFMFUtTZqZCSRiMbvKt7zBGMPSDLtE1DWjNXcXxzkuhMU+cE\r\nmH3AQLsGz4ift1nqDWcbCPN86mCUD33ZW7WmPr/IGNGfZwpFQPUCUVf91Rft\r\njoHfXMlTcTNUuCkHi8xJl//CzRoQU7L71WOqd6l9rKMI+vQEs921c79zpuHM\r\n7J5SIgHcHsIDflFvwxYqboolJD4D78hZrUYq0iCD9WRdd8/jRMkc5mDG/rnA\r\nzvd3E2QqOpy/bE58XW+rgraNzedAZUDKjpBjmAyXAEUP0hUNj0YZpNGN5Hhj\r\n9Sj1rO601alx6umhIecTsBhnq2XAYs7qPbTx8nf0Kng+XL/Y+9SgAqI+ZJyx\r\npk/TN0zmXV3cNW3TMKH7/zs2SRTCJD+FsOoUJasKMJJR32FdIuYEBTOAErh5\r\nWwhAQYpJY35IfSqn56eSLJVT36MdNaHoQqOfu4K8g/ouKkhvmGRAbzYKsU/b\r\n0UPDY2uJ8XVygWEag8uOWUEKtowQP0qsP0yIR9EdnrGFtz+6P1siqkhP1h+d\r\nWz/fupWRHRTyvZcFghpkuM8uqVnmOFTOas22+j/ctkndmnlkuILI6Ur+bFgH\r\ndhHhrGkym98Ix4X3KdLA37HyOXUM2jtxpvk=\r\n=+zp9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"c95e48871173c98e6dcbcb6744d1ba624e2d1341","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-22_1682122273187_0.19846710674992107","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-23":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-23","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-23","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"0b36ed6ad0a1feefd53dc64ee87270a75ad2d664","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-23.tgz","fileCount":41,"integrity":"sha512-n2sdm5c4//NPRbz1YragrszuqeNS0rmW2rbtP6BkjlwfBTQEH34ZDIsUWaHsi5+i881xSb2q0lrxrHAD9seA2g==","signatures":[{"sig":"MEUCIQDj6zzZgg7EBwKAbIQNqgStem1IBOuvsIFWdmc8ruhBDQIgYWsme+MYHcCnPM0QoNecc+LwMVE3zshsTcOqzo7kw94=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-04-23","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkRHfmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpq+Q//e3sFRitnxqUwzmmsmEs/qEmf1mZ06Vkz2KrKhuuSEKtUYdk5\r\n6n0q7OvN/T/B0kRxfv/FIMKDG+n6PUNDW+1UTrDd5WbBKOY93bOiIqqgzz/r\r\nFK7GWZ21xyrCUC6aMUaMh/P69roL99Iz2816c7/quoZvxMISN3ywNGc6Ozvo\r\n81f2zXjMtubHl0Mc3QnWdDVdxPtLjcSYjwoS33y7zWBuZZbU2zp2/45NStQy\r\nw9lxRt3G08SbMayrtousXF7ewgkPI6W/vpeNWkMoE08ke5CZaRmbP2Xd8tEi\r\nGcBq5xfgkAMtmvTVUhJ4htJEBaQD4HafsdbUPJO54nmk6rU/Nlxi70769dHC\r\nBt6QBXyoGthEllnHQN0WmWa21ZXR7K3Lrf4I2f4pNjr8qRk4ze9zBwJkeMa4\r\nw8UtDH0qiUWnA/skhNBBihvzNazdUHdrsZy3K2fujf84eJTrpbj88Ln4wPPX\r\nWIkVeLgOdEfIHjSfXlswtOR4PR4LHivYf07XYmznONFvquRL/7WlzWcAOX+S\r\nlBU7q3Pkg7OAWvyodd+q+oGbKrKfiMKzp2jYOIboqCQxMcacHGiFMbH5ZOmP\r\n8/GqlO21RVVLL8IC06530KSujXSn5RS0p22YEvSD1G7Arm0xm5Sr1VKblpCz\r\n6AGQqWYd066i8GIz0XqOpf88P2+LomG2pqo=\r\n=pnQj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"c95e48871173c98e6dcbcb6744d1ba624e2d1341","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-23_1682208742280_0.6568906022294085","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-24":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-24","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-24","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"3b9de3a67db014a277609af72e97456f98cf5efb","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-24.tgz","fileCount":41,"integrity":"sha512-ozsv0DHuaM0T8/5vRdDHOypbuyYgD0iwWgPIC7u+pZjoLrkBcnsp+cIHoD2R76eU2eJG6JyrQLFOjRxS674gcA==","signatures":[{"sig":"MEQCIAZRIb7Dcg3c01wkdxwz/dtEzaBjwfdnu8pOHlCBYQ6dAiBO560meuXO1acx/pW7UkyPQ32hoV2ccXbOZWtnjp8qOw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-04-24","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkRclIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqkURAAgyzXl9PStnREs7zMJM3/qUbVXlufXp4x5FhKuCTquNI/NdjO\r\nWmmT79ll8RhzBIg7kBQB0Ym5VReC0xWHUackGau/72AhVDImallop23qHJvA\r\nmbqP0GyBpC66Kzyhtl2jRMCYEpvCxZzX74NzAgikRWuZldS7lAWtQseLNIsW\r\nRwiLFeOXx9SQkzM93jxCri1KzwNzY78xfueIneI2CyOxu7BhrqtnxiICSsca\r\nAazqvs4YOl1e4OoLCxoghVMGHQJShml9bchh5j1cToVN9dx3VqOIMU6aMMs8\r\nr6vER7kP2hrbp0pvhGTteuRZRoxbqj3kgaHVDR+pzXcTRob6NU5Atjj0k9WO\r\nRf4lW563nPGSdAbmnmYSgpnKWBE+la1JMDfDivyyAWCeybpfHFfc5lNa6r8Z\r\n/x4q295kvP5Wg279qZkD2/Erxl4VN7f+ssyA0HDsWKJc47z9DV7+gp1FUPjq\r\ndmLlPzWRI+Oc3m7n48ehBfFkSm1lpLY0wJZNfH/R0X7yamXVfYu7ztxQm/Tq\r\nP6SCy46AJ9l1r6DeFAIZO/jwAFWhpPPgZZFe/WtKo27I0nsCyi+bnNwVTwk+\r\nK7EmUyjL0OTtEdZbCJll9m5QeswK2td9QhPKL/+PvOoaQ/3i43jXXUiHgONX\r\n1DkBH3dSkOcqnhqf5aDhQrmYFLui9XLCxo8=\r\n=Plyp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"c95e48871173c98e6dcbcb6744d1ba624e2d1341","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-24_1682295111653_0.18119235689613689","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-24.1":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-24.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-24.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"5db7d61e031b698b56b90ce953ef4be13cdce364","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-24.1.tgz","fileCount":41,"integrity":"sha512-lgGmtM9GZPRoXFMzVZIsOTP4qQpwqSCnEVylVUq4VdFdRKEujOSluZR0P1tuRoPtGX8+OdwkEqZjOT2Mpfb+dw==","signatures":[{"sig":"MEYCIQDprnRKSQF0sxr0Esr8HPUBwfpXbOa31ebtD4D36vcyhwIhAP0mR8g6bKFef+g8VHTEbi4uQRBeHae4YSPEaeNm0nDk","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-04-24.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131668,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkRiuXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqk2g/9FEzYEWVOMkWsOTobgLGfcwZWrX/QhArVX3p5jFifJhxJcuC1\r\nVVvkhG2+o+FQ88VilTP1KA+RYhUqPaZ6o8E1Y6e+9er3bO5Ri7zUOIjWoJl7\r\nHRspSM7m5akjHD4pw2vtlWkNSlrkOMltGIsPSLeJFP/20pHqhUo/RPE6f4LA\r\nq6o5iE7alUmZQggXreqMJ5KXIS5l9vf9Za7i5LdP4BDar+4DLiEUodt85yLI\r\nJpopQiJHsyVIdF5SdSsapttDB5k3PhbfPcy2bf4hn+LdQbvAAOE92gXu5q99\r\nL19MhlqOrZEBqgslYFiE9RwtIzYlx4M6SiQATBkqjw8zp5llWU9RQE9Je1Ay\r\nHgmkH3rrAa+T2gJZdqyafzkyGmKa0SBr50LFQfWf856Rl3P/fFExF+0OEzYH\r\ntLxVRY9osGUw9Az9LlS6zDfBLDB9T4azoJQXAA3EUT+Rk9q7SKCWFFNAd8NJ\r\nAdgOeA6rAFIUAtrLQTXuoH/Zy9LvAXmiaenh2FlGV6Bl3gegtlVhzAYTatof\r\npyOpsIkyVgBIcACDhUpzcm58jt8W/g971el7hV6OpDAhFpJiJCqMUNPhe091\r\nCRc9XeWT6uFI5tGh1ZoLvDk1RHhiIx1NZxl7oo85jnylrC7pQr5dsXulRM0P\r\nHNzKlOl9WKaZhb6eMe1mTRFFlVc6cwzKnm4=\r\n=K9X3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"5e8196889cd9495e697f117ef28fd227dfb31584","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-24.1_1682320279445_0.7534302816968161","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-24.2":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-24.2","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-24.2","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"3b672133f1fd5cd23276ebe1ddcff51c4d37ec08","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-24.2.tgz","fileCount":41,"integrity":"sha512-81cWE/RwahemVh/gtsjeHDtwdTd5t3ZaPfIxUXbn0mHCKCenm3UCaVulHOld9i5LtQopB2RlFyj5qxebPLH4Xw==","signatures":[{"sig":"MEUCIGNQFPPe+BGTD8eVOupb85TbkX9wNX4GOsCPyK0q4cUdAiEAn+MYehQQl60yHIrP11bPKbO+/iV1FpbF6TodJrXiKK8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-04-24.2","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131668,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkRkQpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp+CxAAm17DdEkoVxZtN6w88o64YPNV4m+nt7Vyy32PptiZhnNSvLrc\r\nUNOjSTMKe8LVZ6fOJxNgytlnipn97oDlTEO68BIQ8Pyb+KK51MllpHKGMicr\r\nOsxC9IIRx2PT8/xSb8AmtVwLsQfJGmu36rixHgKDNp2dk5r7Um5MKh+v0T2x\r\ndGutnqqnjDho392wTC4e1tSzQLrO4HaJnc2shy84+nCgZSZ5wMbIoh5w7fZk\r\nr+psQy/QDEoy0t9aMmPeqVgqeJy1NtayX4F9C8RurHXXNa4h6UyowKrc48FD\r\nwd3NSGSt7E8BMsPDuqgRM+Fuff64Se5vwNCCR/GqySI2BIr/h7sBNjsB8dK5\r\nN0PD82oh8t6Pf8DaZOBYECPstzJDJTtaceHNvSn8HiozK3jGSBYsZ+VCF23s\r\nxXoL8swEpnml2HfK/V4deFbin00o2ac0CCmn2/rJzaiXd20m6rEnfoh2UbuS\r\nAhWtisC3kDPcv/0iUQIhqKIEyd9TbPWMyfP+wUbEIZ2liARfdSKwz8aScbQX\r\nmyhiq+k0pOi/3gtFKajefgA9h9f3MzXdFc9mYUMbpQ+rnwYm1qxwF79feSpY\r\nur97DrG/oT4xQLMaqfLNwl8PIaiLaj4ePEdhGZfA+Z1hb1DjGaYgFevrasXq\r\n6k+a02PmhV7IHp8UM4oPfbv5AHHYfJK2XQE=\r\n=hkjq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d39602e4d1e955990af5fe93c8fa106040fa046c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-24.2_1682326568992_0.36937058367209263","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-25":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-25","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-25","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"393adb0b7da43e8727a15d120f89ec6b1e78585c","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-25.tgz","fileCount":41,"integrity":"sha512-bJXY/kfSnX6dK+hnRmKQ8Owp5qX3AUeNklGXIjetNhJ3sYhZ9SQSNsa1AKOODGMTFIJ0HwcLBZ7MC2ATqeowFQ==","signatures":[{"sig":"MEUCIQCA2Nf1ONA0HpwwhC2o1bHUsSma8yEySE+UDos8RIR41wIgMS3WKJyQV9vdNGCCFydsipolVd5USVFgZSHQuu4yReY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-04-25","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkRxqVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpi8w/7BHcyPqsl2TXKpT6ZMe9uKxiU5xeuusFCAS25WMw6BVmC4Olr\r\nk/jFCm8wXnusl0BW8lGT+ePXfpmIcYYrPrT5Lvt49iJ58D8KUToHyzRnOgKy\r\nR5qxAo9d2Htwc78AIAMPJulCSNzzIWLd+2NEPv4cwXkzusvN5rPOjtf0Qqyk\r\n1K0mse4BeBig8Z0ZCb6tSj/xYiXt/wLYEWSH/ODgD6KM1Ts5jbSMZ0M5OjC1\r\n+4VU7PQTwy0bdztrUqAVdneZ3kKFCkGyAcam6drmnIZtBBWbfRbpZc96ocJM\r\nZ5ZKr1Kt7IA0kDnkg9zgEb8oJ4xFZJPU+hK3c/iGj4x1PuhAO3hLasCHmW2D\r\nzGYMKNNZy7WH9Gs8YlaqlDjnZlDivSpmKHajqeIPy4bX4wm13+lrAGaJm6qw\r\nL0/p7KeQDbdTcErU5E/bzeaNK1B5OIMWZqhPs/axKckKhJnHqrOFfyjJd5Wk\r\nvBYhKKW7i/Jj6/cPC3NX2wXpkEGW6EcedGuTgN0k0T89C1UCOspEgJz8pJdM\r\nynJdp4saQzTHQrM8TABWW7Xs1r9Zs4DT+zoIWwowBonrlDI990BFdQnIEhKK\r\ndGfJEv/M9/AaDYXEEmQ0pxb5KLHyvD6rim5MwNZa1IczAmzW9ry8CcLdeVhy\r\njQ9/aQIajU4Mkt9Cg3XXYsqIEiJU793GqJQ=\r\n=ChcH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d39602e4d1e955990af5fe93c8fa106040fa046c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-25_1682381461518_0.05960845456671171","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-26":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-26","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-26","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"1510a533965679035b1eeff4f9a6e7c4d4961ff7","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-26.tgz","fileCount":41,"integrity":"sha512-pIpYqeOfKCgDII4H48idJFu64BQ3TzIw1yD6n5X6GEQgjrqD0HxUVzZQFsTLoF4djVt1qmsH1zw0zbbqOMVwng==","signatures":[{"sig":"MEUCIAowsvM12cgaiqm84D83FV1HTnpGV5pB7wK3iaetykeCAiEA3JTy5kr2+lj0qonRh+Au4+syspteQY/jWfXcDDM6meY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-04-26","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkSGwtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoy1w//Wu3r898EBuc4DlSxVmiWs/31W/Y1d8B9Rc3P8+Jx2dBCHbVy\r\nmXvZ6GRvFhuQOyS5An4CtmWB/1xWEET6p76h65gLkhoRtAPzLwjZWKJ/VfjZ\r\n0bA9qVhS6FJHXZFHe33/k0gOYaNjSFpe+MVXaECelYmOgn7BiATAu3grwFFo\r\nvviG102J9B7fVEzfZNjdHhvF/Ysp3z9K3jsrxyHa9aMAQnSn8LYg6/9u9+Hx\r\nhqU+9kbUldTPv2aoqoZohJ8mYiTH1f6/e2WnVNNoYqqJc3rWL2Dg6ooDKrJP\r\n22Pw0CsohRWeJ/HOd55AJLkR5f46Ev2i/yS0gEgPkgHX5lKULzwt87SB007O\r\noy/C6e/2m3jFHI3Wu0wmxMEROgyVhKwuR48HTexOgEPcUOw4kciCQl4PGsLP\r\nA/PWrDtoMLo+zefex13B1PFdjU21ehYSsEwWfdYTSe8h7OWTZjaDIxWW6UmJ\r\n9yCDubPHOuDyceqnuMunpFbhrGh/Zg5OSibyfLZd8qAymo92MPpCCjUM3zs6\r\nk46Sr86Dqdd8UjXZz5vFoaHYij6xgiFFjKWzbZHzNv1hsc2azZJ20CItRV6H\r\n2lwwPj4sdpvrzjZv11C4hi4wZXE7295Fas9l37SDHjQBFH1SUD1kzTlFNfUU\r\nUioUxa2+NWidRLpZWbvV4YhQd4QaPmqwbtw=\r\n=1lW9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d39602e4d1e955990af5fe93c8fa106040fa046c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-26_1682467884819_0.49134537521078614","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-27":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-27","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-27","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"ae1b9c17208696d1f08a6cef872717d96f6cd85f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-27.tgz","fileCount":41,"integrity":"sha512-Ntk9bkIY0P+hc01RzjnX3DIV2ruTqGYMZC9cmJ8qVex6IdrxRYJoUyUeIvSTntt3g+rFhSOb0iitJst26p+ocQ==","signatures":[{"sig":"MEYCIQDdWHog9Y3kdbJnsxcuAew5zCSRFr2/YaAv11hih7RyMQIhAJ1zNk01sQnd0T4R4etYeMhGajuSDxdkNGgPZIhm7CtR","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-04-27","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkSb3NACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrHog//X/A6FjX+3QAAa3+beJaMu8MOUaKpAYx8bWZZ55KkImlIdm6n\r\nv50UiXdqWLYCCKMsGDZQWjOJACSe+yxxZFa0F0TYRDMKq7ak3ZFB8GapH6vd\r\nr1NPwJj/0XzR33LdT6WHOikkpYcdvYn1m2EaPLrz6rVrIjXb0w1sICl1RJLQ\r\ngHo+dXOgiLVPbqmLALqe92XUK3/76GCCBTBmxQGhzcXSbF4/T/kB0tQiLWvH\r\n51tD+5RVbzmbO6mjeRf2gqfKqjQnm1W51V0/pvyL1iYx/agBqNU8irZ//NnB\r\nc9kJ3+aZ9NWx0b9JRnp7CksQSfJZHJgAxmnXtv6DG73BaxbHN/GMZKL3JU68\r\nnk5egxJ/jfEwZHxjZXdJqTNLV3UWif0tivfywKasMolBMLHfKElp9Ej1nGis\r\ndLJzWZdCkBANRDTlR+7m5Z6S5z9WL6cn1ebtawVI2Sp4Qw4D6PDSMPMmwTEq\r\nIUqkFaNriMjdBQCRauCAgpiH9rSsPmGiFide+46bDKvfEvpUWRysraSZhBCm\r\nzNZ+CVdN/hz7nNuxDLHteZ/Zg4TFX6FhK2Qz5Hg7SrLg5Wy/YBNUWGsm5jCl\r\nt8f7Qm18fTZb19/sVPom1VkwH+B7IiIn4dAGekocl90aEuXwu3Nd7kgweELf\r\n0VrN/T4lgN47kGCo6BUaw7CrIhunJz730yo=\r\n=8YJO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d39602e4d1e955990af5fe93c8fa106040fa046c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-27_1682554317194_0.8447927363499073","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-27.1":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-27.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-27.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"5b90e2ab8e4a475a293b40ca5c5af43d1e3f5fa3","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-27.1.tgz","fileCount":41,"integrity":"sha512-G24oaTSQG/z/BbXaoqnU9paLfziSQrW3OjilEITjFbVxvvlBtWHxnMGmITwE0tWI80wjF3jQtR3jsETLj9tkoA==","signatures":[{"sig":"MEUCIQCvdiGg9JPVITpyg1QbBxwePAP9AkfxNKf6r0cFVvfAhQIgNa/ZVzGdYfvEHVnsBu2bDVdL62EYvizEnW0SU3IBgKA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-04-27.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131668,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkSko7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrT/w/7B4n+cFjxtlzdntfcmDfKcSrKpCX6oTqdgT/IykJB7sJSbe5P\r\nA+W0GeDppb7iEjYkqFZqD3QyXjs98R1eJxHa9G0fTuwwCyik4bFAMrKnxJOm\r\nVKUGYd5vORc1oJhNkpYA8pXxhXWlSb9rA02jimOE40v7ATZ0ajPjKIZNDbli\r\nXZg/5YdwFEqvEuz65SIZJMuWgOh23hgI/JQN+WEc/ZzwDMkQWozoeIMfU7eq\r\nZ7SE6g+GGszBJVz687+L7slTkYxfMM4DQI8380hbM2uIrdagOPOWlaHcPj5Y\r\nGcctM/pIt6MX3GPb730vSttwJu6mvBPKEYVtdmA9AGg2F4y+9e0AxRb1c3eu\r\n9SUI9Gmsllp34v7ZU9II6B14fr/P+FLEhykekJwYgvlv0ALVq+gytEiAfhyQ\r\n0wpBCwuWLgEmxa2JucQXWKH2Zw0GFcPnnbHpzFW/ZBpPHBZZo0dWsfO6co1m\r\nLBkVtopvM3w7wJA2BKBPi5bct3jMBpXKzp5/w0Azr5xzud+0Fe9qKBE/G+Pi\r\nt69I49KhXHwej/1fEuHmd1Nxr7/i6oesuhpe04IIcaK9w1Vlx/fSllR659LQ\r\nrsGCo0JmhnyC19Ai6DrZuMQ6+t4+ha+ZBKIT45WItBGc8sVUdDwGKUFD8Pzf\r\n8Q3JxneH59HWp9pn+LiwKvMddTjnwWzmyQc=\r\n=2vaL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"79ef47edfd75accd4e9346e0d5f08f255dff46b0","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-27.1_1682590267212_0.38309874234564356","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-28":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-28","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-28","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"e542a698281b3c9d766220ca756771c68af1924f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-28.tgz","fileCount":41,"integrity":"sha512-gemu9kPb1bxo198QxE7N3LQKOaV9JZp/UX80R6YlARUUb2IHHB90o8e+xwcvFJc4R2VsmuzQvj6Mc6NcMjotEA==","signatures":[{"sig":"MEUCIBRjgzBKQQ4q0tNMIXZ81hD+7t/uyDlAn8NqnpzezdIbAiEAzIxAckcefUoj7lb8xpIt0cKBZMVob5KSMOP0e2EDGAs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-04-28","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkSw9iACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoIzA//ZcaFu+bKt1UWVbOspJ8AWjCCT3IEbPalyNTtPmmhO9i0TDmH\r\no7b9UaKHYM7pPkQMpQVM9ifGZ6il8ah5bsj3Q5tEeODPu8J1+/ZyE6uwdkcQ\r\nQAbJVrwnk/EdVoPGI5pIheJ6xgDxqSgwu3Bb5khsUuNj5bUSJ7KzAWRmH6k5\r\nvbwwsNVQYyaEx3KEPLoEhNtOPSX85mBMUaQJJeD/s4BUz5/rsz7y9bWZ8Fcx\r\nVLyhQH7+pPqtdu1uaqlHVAZ0X6t+yLH75jfYSwiVRraj1/GmgAZBP45e6gfM\r\nFvtgm4vHIoIiBAbtzW6eELKPtYBEHIWFluwcrYEtfVsJAFhpbBw+sO9ps4Jb\r\n/HAoCWMydaL8cDXBgsJjecNIPPncONfwIYRIQgw+6hQO5rMi/36QGa/D6mfZ\r\n+o3sFIsJw3T40QrpaJY+//LX2EBw9A2gnAXwzRl4+Lyd45BXKZjFsM/maDwo\r\nf2l3aVf9IrIWnAvKnnO2ksVEkILhn9hDDnSYSV303tbVh+KLbd4E3bFs/t8m\r\n0fcJCdT541MV2SoOrCRnOeR84tOL+AVbE1SNpNQa9OCqslSd/Rnl1M0UQNPf\r\nzWylawmsHUEcPRfRtZ5o3cfXz+fvagsLrvq0ryDzNBGSAeMUNmSIinlcYS1y\r\nSVAaapQGAHTenV+ysL0ZMn9TPx7Ep8Z0Ue0=\r\n=qrtT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f53d5d59628fd486bc13490afccbd911e24423ec","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-28_1682640737742_0.9293229250951212","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-29":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-29","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-29","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"5a01a46887057479c177622796a5a7310f6745c4","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-29.tgz","fileCount":41,"integrity":"sha512-N+RnppZeuvHCq0cVlgxWxOhHaml3x+KE00xOVsI0dTY7XO+OedRGAsgN/sAAuMOLvbCXIVONptJJp2hFqB2Z9A==","signatures":[{"sig":"MEYCIQCBV9FeABtC30R5VAsJn9MNjoaWwDCGRAY65YuMZ0gdnAIhAMIJFrBp45UF72S5bVNpfNkfRYouXxlh5Qs9vjvAAER5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-04-29","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkTGCZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq6rA/9FpZuhO8YjKfTtV2Fq5gMcrNRshfHFBNhNPDPHHFucOtmHF/Y\r\nR20BStXNjmFO8tXQnc4ZJWcOMj1jnUu//YKI6k2TpC4bpHisziRXj2g9QQct\r\ntrrkgOtbNinDnjU8sr5Rq4QtqmeGvCE9CaxejmGxq3lxh7y0bPrgb+cmdN5l\r\nntUq8yskawCkxeIq8ueqRodp9PXdTIiBU35j0ByQPS4XMzbl938OXf1srRfc\r\nFbaVhEzS08KBPNe3PARfwxFxiZgzcpkxDsz4lgSdOcWE6a+RdDfQwZsOcGU9\r\ngfE+6Ma7LAQxRYmPQ8Up1PSlpfglpMK8lPOjQ6XI80w0qOSrKHZueLrVndZa\r\newg9UVLwLJ0++pf9h4Q2bdV77+bMbAO9lKOaN7lr6GfM20bZVXyBSTfOx4o+\r\nmmBV4Wz2QLNqUwM6m4QBL+5NqOhKyGZvFZ3lUtjnqD9pWXCZ43RDoKlMfOtD\r\nVO6Mma3E9A/7qox5WN4nOFx+RdB3cMCe3XJZnA3R6QnJ4zigLC09ToZ6AAkQ\r\nyqYIKM+WcLpuHMCuN0DxkM/yHro+LUVxnz4Rw6dMpQIGrtXBhi5jqDRzaYZy\r\nP4cjorh4xKcd5J+YvoxymaOTXVB9nVnF6+eIep6zBQSuyLkzFEYs48qpInWi\r\nXfxkBQkgvwoTNdLDdlm2OypYanQ/gbJyr28=\r\n=+ZZs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f53d5d59628fd486bc13490afccbd911e24423ec","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-29_1682727065104_0.8014373770367309","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-04-30":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-04-30","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-04-30","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"80aec8fedae5012fb83081f4d591a19f3c76d76c","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-04-30.tgz","fileCount":41,"integrity":"sha512-Ngo9XkebLRBNvrNEz2GdWV3Ep7j9j0zhaL6hCQ0zV4uNAsM2sLTfjVRSgLxcckI7Ra/MX9M0FtcY94VXjUfAuQ==","signatures":[{"sig":"MEUCIEwB+Zm0D2kUbL1qXD6nkXbwVGv7L0d/v470UXwFkMyCAiEA4Mz4qHIsBdVRO0Dqkj6avk1f1NklTkK1LHiBgFaccoU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-04-30","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkTbKcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqt5w/+PTLSGT7glXRvIMPnEj1Ef9x2Qt6EDdSEfaOsOpCUWlruU4ZG\r\nvuhw4fdPjcoU/eD6wMXlSak4jSbgh8Aa1wT8qaLq+AOKSpNUL2tkKIxgIWCx\r\n8IxlFlwErXvyFlIkzibmzcMNTRfDmPJpW7mmVpAJoyBlPt4n+a0G1iW4CE42\r\nwobGuMVHTpKvnWtcYWq9kITlf7ZzLwXzXD4pIDbeQLmktJogl8IBuhz7A9Nj\r\nw/k4LwX6rrMC56AOo/PZFlrfRWncirxXT86IXSVdG7nywY0nDxO80rsFU37E\r\nSlnn6VJpjwwCEu1scbQJl5DJbQk+QchMBYCKO0KYz7odjOTXbzLGz40r0Hi2\r\neKUZj/ReqwxTDLxNWG0Xf+W0YyMID10OwzTGGIJcxZDcIbbrXO3hXY9tk0D8\r\nMEt8xwJTLck+CNeldUDbeyHtAnUBLEMt7EUxUbZuyCKMgejq/F7/iB1u4VfD\r\nNHZriYA7oeLAqaLAcCmUwlcTkauHSHt4a2ek9t2XYWzHOOmxl3FVcgZ0K9lg\r\nARaM7RxsGlOLd/nEVISPeGYtBd3gqu6n5gpFPRWk2W7iM+VDKudh5bMw1ZSb\r\ni8d5o7GW99bz+BI0dUoW4TueU56mc/lPcSqPJpBNgk99e7exY4y+3aQIBBGB\r\nnHKNbuP1tWRpaa62kyS9nGhhKqV6gwUkxHA=\r\n=YjFS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f53d5d59628fd486bc13490afccbd911e24423ec","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-04-30_1682813595640_0.24235402800449624","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-01":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-01","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-01","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"44c5f4b6a1a5e9025b1e20c49087470f54dafb17","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-01.tgz","fileCount":41,"integrity":"sha512-S7sS7C7OH+qeYRXcXqo5wtXlh02bWC7l8nsFra0rXSTTZlzMoRqzBtlpFpnj9Of/blpKJH+rAZ6cV0rsGMSw/w==","signatures":[{"sig":"MEYCIQD0uRMRXOObm3ufVHEZIeDpd9Y7h6kXukSmSJza9ycAlwIhAKX58cRLJo28w+Glc308bzhw8nbmVzyOMVWhtzYkjkMR","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-01","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkTwPeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrR+Q//YxsfgOuUqm6lKCaw5U0xZYY1Vw2saBPdQaV9L/BG62VC5sFR\r\nv12BSFhdFSNCW22ohJ3b3vOdKiQgaRWPXsie3z6eAgIygjtpzRmx7kfhKMsS\r\nRuOdLuayK7NsOyEePF/AmcyO8aznF1zafnMUP2tBtkWTtrFsxMncNKdgSrJP\r\nBtevrSSEdA60ueiTYj1DpK6b4LcX3i3qxaQgpNDtHp8RkKkpZEKZaXbMryk4\r\nw0i6EF2EJVyl2FLG94duP4g1RPBH6LZ56a5FuEEbTB/Q/FwD6TLKsm+le3Xz\r\nb4q3deWAVWdM+uf7c97rDl8hYaVXo83bRt5ZQKarqaCRrStoa7RxhWElcfpC\r\njpePUJ9P2rU2WWWZKg0m3u8AUL9xRMSvMY0YRBqWIfKG8Jps0Z5AQwJgGbAc\r\nhK0UKwIcd1OOAgzivd5FTxjpOlMZFA6QsPkNghsa5f4CPURMIR+i5nK2li2a\r\nKGgrEywTCWau+hxaGTclemny+QyJINtk+J8TP2COijCdUnh6fwnrbH2taNJz\r\nf8l0wO2c+34iBGFKOBRaiNndexm9gFSnwBSYkL/gIDSlHMYPBl2k/ru+Lf9t\r\n2BePT3YDejJDZVbLsj712pttNqPOZTP3z8We428798u153JjLKl0oXjgvlCl\r\nmtVVMxPLwl0zX1Y1tBWPAbpj36zRV7tVeUY=\r\n=lwSz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f53d5d59628fd486bc13490afccbd911e24423ec","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-01_1682899934255_0.6475135232521407","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-02":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-02","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-02","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"493c36a1d0736b472d314930f82be1ffdaadffc3","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-02.tgz","fileCount":41,"integrity":"sha512-TsqH4obp6C0n2Ep7XocS7qI+kHXtbFGgi42ZDr7S7vuJKmuEgacDRF6QpAtG8/sVhh5NfPBeUfRq4oGMO3QFQA==","signatures":[{"sig":"MEUCIQCLmLJqq8OBNwa2NARLqGsRm+vJtWB10BrBVBXHSgzVPwIgYBKNlmH1I2ejci5gQ/1hz43urdKuqtuRFRf5UbaJNjU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-02","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkUFUgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpcyw//byGkTVtNS2C8+UlKwZLbO31xZg2MC23spWOmdD0gRwZBHmfq\r\n/34At1y36mSZXrzC98hS5nlTShKNcidjNqYxFQ+JnIC5BLjmuXo/Np8q5Koi\r\nM8bqSCxKhM/BSaagtysYLN9+mbvhfmDxHK7LHopaxvVo59RCBSuYXC6whg5S\r\n/XNe9trPNv5XD6OKDDJIvZBsvijheUbKqzLq2f70CXJ0USyx+N2oJ8JDRYkt\r\nLn8i99l0ioIM59XvbsaGw/Eehzd4IGUbc/5eWSxy2GMkSaxYWc5FukikP5Ns\r\nC9T2WpLXjmsdVOxyk9rv+3DTPGoF4Nb69TYrbwz6Wlzq0zUCIPTJsQwMWn/C\r\n5cfg6DpuniNGJ70LikiMscehXDVdEYQ/iymZatrXPci0nMo2+wrjrL+LlXFP\r\nOX7Oqew8NlVFQ3Yiv/M5o0it8VdQdbYnFRwYv3BtKab0/2yFHgB/d9cipSao\r\nyVS4xs46wsB08/V7CDrh9BM//xCuTxEo8PZ/E0wfH6l7k+XIEuz1k1rYgfLv\r\nOjyowONCbCRJSzZP1QgOe2Zbwk9kKiZN96jLDFISrVq048iEPrxkqjw3Uon1\r\nU8JrB4BOip9mwsV97+/WqUDLufzmuN4MTq3fUHHV8MDqsSVGh78e4jYQt8y9\r\n6UrBGHqjQIBHQDta7zMPDVGLJuPOWN7onJA=\r\n=2oa7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f53d5d59628fd486bc13490afccbd911e24423ec","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-02_1682986272380_0.38359359816087335","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-03":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-03","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-03","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"cb0a608b9c425a8221cacdfd7679f65b107ae3df","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-03.tgz","fileCount":41,"integrity":"sha512-MMKwkX/Ng8mPEV5ysbqzVwq7JHUpG5nSwBuWkg9WfyNZBdZnawBGsGet7DpWc7lJEu5qbNent+0486JGJlo/Iw==","signatures":[{"sig":"MEQCIF13PYUhIrosZyg6+p+ziIxQgKZv/aSuDtWTb+qivwzfAiAW9715yM8zeeddwUwq319xAt0g3nKuNu35tR/w7+cFBg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-03","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkUaafACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmprTQ/7BhdCkjCcwIBIS+55IcQBj2849y8yJqG3cH2Yco5TCUybLz5T\r\nfCFZzdg92ixOWFJ4fsNmmdkGYe3+5ZJQwu7IY5Gfci9oiLyEvUv0Z9QSItQU\r\nq0Gje9O99+LeFMDe+/xfYT1+Dw59CPdNktMGZk0YVALDmvCFmQEbGJhOEWOE\r\nHPEFUUcIB0NLKolLQMJqPRF91GTWbxNYxUhUqgGbRiC7m009wLiZw3d7OTrH\r\nGxrE2it8X1FmdIFbPbT0dz9uU/8PWUj8LkrJPjY3/xASWbsUneugQHBw1NXy\r\n0TfTCJhFSgdDDJzga6clzOIMqaeBwceNmxEaKEs5pCw9oA/oIF3DKBeA4uQd\r\nFlW0fNJkuMT1VIl8qJAVznMb6BUKbeTbs+TwY1AkeSOUMa0t7ANDQGPTTbf1\r\nfcr/9/a9ZNXJEMiCMQxh7SaMUYV1H0ogpOY4k4DQR15/O7F16WUdQsRepiD/\r\nFVkSLun3y7lRdYZDxnumSQABGoDOBjpuDYYIPRYlIFOSPnHSjnzO9UPuRxjc\r\nDmpHJT2ZDOGUN9fVXHgfIBeZ8nvGaYPSB25nDWrJ9LH5JcPT5F0Nctx4g/0Q\r\nfztk/no5Rqf97D+0+Uhw4zQeM8Hd3X6odqmjOFFdY/E51CY7IdFFatU0S0NS\r\nIi7UFivxKa+jQXe4xMk8lX5UXtsPUOyW7XI=\r\n=mjWA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d46eb9f67182b41c82d146e68b08ed36291d6b3c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-03_1683072670998_0.9098334451490324","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-04":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-04","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-04","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"9e6859f8bd05958c0308e43f21816b481bff94aa","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-04.tgz","fileCount":41,"integrity":"sha512-QFKgc1Myl5kjFfBPmhGOKS3b8O6TdlFnTvK00PGcJnzBETWEw30BD8CyaVTw8A9VdCOMoTtVZqBXpVCpJIQ/Kw==","signatures":[{"sig":"MEUCIQDW+G3uXOigSgGq8mx3BWV1WRjRa9UM/LMsLC+jyVG2JwIgB8Ocu4LDCtHq+LBISj9BsNq/u530PscYdFPa2ZrpHZA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-04","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkUvgQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpo3A//ZKUcoBu9lHTvsizWQ90KqcTlBMJi5SuyWodTS6r3jbRUHMc6\r\nwVDR/K+NHPjDTia8gNVij0yw+wMll7wHcpHA8spkjP3klOdViwCdmDZD4WUH\r\nQEIRWRdV50CCA7OU1+2Ct2otJC9ASY0E9JDsJBwuUrjHwgkPAuoFbRC+wzZ0\r\nqIvWrrj+V+sByCV5x9b6yugxHFFaRL1Dr5kIve/BeDQuAqMGteDk01zXi4S9\r\nRonZE1/fTeSpcJ/XyMoYhzci4TTSOjA1IkeCVxbK++VMTasbyFOJ+dY1tVcs\r\n/FYrCM/37vNC9KvaLOtU+E9tqS5igbSL1YRISi+kW/JUHqVfGTtnKlTuWTXH\r\nwnlMl9QDkC15+7ocexeiQ7d9OBP0bAR6PVa0g+di2edyBGhghIXRlW0Di07w\r\nNcfQ5rwBzixP1PH7Fw3pvmZ8Vr2QF0SZfV3tmTN7OtmAqp9x/L9HBZMtMCfF\r\nW0ZdLkrsbt1JfQoxbyJh6DyCfxbMMlYiPAtEeF4ZO9lSAPK3+49zr3KCyYEc\r\nqs3wJR+O0JkIaflEFIL8SqFQ/rmfuPsZadZaQ7Atr/g3zOW7/8mcjGTve7Hd\r\nC9RJKBdZFzhvoUKWEOKMUiWtV4v3dHwHbd2ZFX4BvEs4H/kHf485VqSnIuEJ\r\nURWNMQ+8J/9kBa+TDWLqe87/3jzkXpbFB7E=\r\n=gurg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d46eb9f67182b41c82d146e68b08ed36291d6b3c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-04_1683159056305_0.10929386309768385","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-05":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-05","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-05","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"2bf42ef68be034dc56550ef5b424349d7093ce1f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-05.tgz","fileCount":41,"integrity":"sha512-/7mav5dzuyPkJs8T+Y5CZ9CormnZIzwTe7Ut/NcGBOmClIznJ1CvLklGGAkUY7UviaWk33FUc+S9D5Z6fOoKGA==","signatures":[{"sig":"MEUCIQC2FsiC8P2dlb54THfCueuB70sEJx04jcGgBSm1wkbB8AIgJEVmoKu3jIqXVbCExWZiyNWdzr3+Yo8HspljY1I4lkY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-05","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkVEmZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmovUBAAlXw3Y20LD5kM+DFvexPA7WU6blvMhpy88d+XyQ3dW8Y/9zyF\r\nzATupRN7jKi6cxP7DLlzhhKhw7NTP7d2VTIGtL59frzx8uhRzQFLsZhx9dud\r\noObS43sGFsRG6NA8CFpDTuUq7mwKx5EyfIveR+X8mIxUrBDbggeKStYyIHPn\r\nKTPA9IFg8mj+mrOcxB1JmnasoNqgWjLuyW+S4gqzBTKT122iL6dG1SzyginM\r\nppNRTdPFIL41tSmfSdF8lDxKwvF5v2zk7/H7vDss1nvw0JPbNU8i9oj075a/\r\nNQFLdLmRvrNCPMx4+zQh1NKX6suvAXG1fniPzLk4BPki3kTVg+ERS+WVI9/s\r\n0FaMJwkA3bSjwdinNzp68OnMXjGIdyt7ijYi9h7U6ck8eHKxf2nHzLUak2i6\r\nnb1N5v1eo1S1UMoXuWLQsOHHvDAzgSiGO7qo1CellO8gwf0jLm/JlGTBGirz\r\nx79Cq6QV2qtxZCNfDDryzKPhIdzBmue7HbMHyyYhslNoFdxCBqN+q6eRQ9NL\r\n00G7A/9pSFZfEM7Tb2u8Tb0Q7dAczSgfTYp+Pm3G5M+pU6az0ihARxVD6p7J\r\nVV5/5qEEm/Ic7zRx9hBibZ2df0N6mCcpgYDx2gm2+rkqg51euuhv1K3+j9Tp\r\nOkygEhPRvk6nuBHFuCiYU85beDs40iLNH8Y=\r\n=78BM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d46eb9f67182b41c82d146e68b08ed36291d6b3c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-05_1683245465525_0.45495386816217387","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-06":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-06","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-06","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"2d9c2c0c472e9ef26ddba26c862c68f4a67bbf62","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-06.tgz","fileCount":41,"integrity":"sha512-mULQhsT/xYBGFmpMUoJs7bYwH1j1TSfyQAEaTBQS9sogQqMnuzm4VyJm+bbVtzClPM2gcOZQkmM+9Jsp5F8zYg==","signatures":[{"sig":"MEQCIGSdEEOYt+PZ1eVPbIL/Djbxeq4GSBXsgsuezWUgtomwAiA5cgKPQ+nXemmfJQY8/SBTE+CUifI3FJzgqHo53vau1Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-06","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d46eb9f67182b41c82d146e68b08ed36291d6b3c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-06_1683331820076_0.6213632058272318","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-07":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-07","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-07","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"69818d23f14bf834966419942c55bca0ca684684","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-07.tgz","fileCount":41,"integrity":"sha512-yNrKN0Uzpph43tz7BX90SovAuTX6bHpQFIvNul2AUvWmvgrVb6PgYMOp+RMnKgzpdBwa9+qRQKfGy8Vw2HridQ==","signatures":[{"sig":"MEQCIAP94w0m4e+cgTqUbNGZ3jcMhSxl2rKn2D0yjJl7GyjKAiBzwF6wIoq669I64xbcZY3Rj81x7o6so7TcWWGcx0cPZA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-07","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d46eb9f67182b41c82d146e68b08ed36291d6b3c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-07_1683418321489_0.4992628138947597","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-08":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-08","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-08","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"56daa2f1e0df388b11e51d3192ba9e09ca234387","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-08.tgz","fileCount":41,"integrity":"sha512-RiWUaF2f+MsdfyNVAcbEDabBNZoZ3xtYZKGL6J5UiQ/ULB1C4yezw31qBeeZRIKg50I2pkk3T6wb8l7coBWYyA==","signatures":[{"sig":"MEUCIF/+fIwl1ZZgnsb1S7o9fDWq4RLx88QO2eTRHd3LZGTsAiEAlKb4aUpS+hJfeaTyv27j6LSO6vGR9XLbWNPTIh83Tgs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-08","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d46eb9f67182b41c82d146e68b08ed36291d6b3c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-08_1683504661073_0.644255248991694","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-09":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-09","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-09","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d19f20f56bb25493fae6a7bbe8c58f84558de03d","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-09.tgz","fileCount":41,"integrity":"sha512-nl97aKH829mieimy1AUgBiKFP07IJHQpuPnyFTXWn+HWipHJebVUCpd7sLFDM4HAW9uPB5TBTh1GNAoi8VNAxg==","signatures":[{"sig":"MEYCIQClhZnR00kZa4wS826SMFavHhthauZAVCNdJ0W6pn2NiwIhAKlWRxcQJ9eBnCbDbg1VGoQq5NiuujGoBSaMj0lfTWOq","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-09","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"85b321dc2b66d1283c8e14306d8c6daa8a7c29cc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-09_1683591089196_0.11456867309810503","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-10":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-10","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-10","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"1788ca247472405b94c18089a8601a6fcaf5580a","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-10.tgz","fileCount":41,"integrity":"sha512-hiqTs05kQuZkr41ugwWIAGZL57uQCeMGGhrPM8/7Z+lf0y4MeTs8v4bskSTHu2L09rC4DvUind6ZlDA0V/b8YQ==","signatures":[{"sig":"MEUCIHyPVzu121oChZkYJ5XzyfXSkrCQgEIHIEFdbqBLRdrdAiEAzJo+HxLTsAXO5t+7w70+4xoD7Cv3l1Yam61ZIPUEiSQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-10","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"85b321dc2b66d1283c8e14306d8c6daa8a7c29cc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-10_1683677481279_0.3560295109547351","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-11":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-11","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-11","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"bef65c4d1397b85ff9093968db8ea43a63869e1d","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-11.tgz","fileCount":41,"integrity":"sha512-VtXjCCXfDJhBlXrBi5W4hqC8oBbZoV1Jz1wnNcvbBldrN40rjntiMvSn4FCJ0ZwtVoA2NrB20Ka0hNoy2yyFjg==","signatures":[{"sig":"MEUCIC88orr/x1E6+XEk9VkfKxVJlij+nzW5MeoN5rKyYdmuAiEAuM5k1Rqq3eJ9OBLByMpZON+PcFrmO3bdoplpadi2KNo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-11","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"85b321dc2b66d1283c8e14306d8c6daa8a7c29cc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-11_1683763901231_0.6807417838486689","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-12":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-12","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-12","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"db1ce194ba1b46375fe6ac66463b032dc4a721c1","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-12.tgz","fileCount":41,"integrity":"sha512-XPkJJ+iTqAlFreeRSLbk7f0HnZAx0/feXMdjcn3YEshtZIJoDSCVu8otYVUxeU9mDAyxx4PUXsUL8RpMAEThoA==","signatures":[{"sig":"MEUCIQCctD660Inrr3SStz3IU9oHPY2osdgMZrIrp6yeq1e3eQIgJmASItrS5bnGQYkCJH6hmcOlTJ/klQiVipMI9+svUno=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-12","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"85b321dc2b66d1283c8e14306d8c6daa8a7c29cc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-12_1683850240679_0.5049201743369875","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-13":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-13","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-13","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c25c588cb00c889bccccae4740d3b472dc4a164b","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-13.tgz","fileCount":41,"integrity":"sha512-dXi2GBCwG8/GPsPXy1wHgOv6Ak0hS0E+y8UuE5Kl6IWuGAhypYRyilOJwJ1NBnm+y8dmVJYJdt2vjbwVY+p9dQ==","signatures":[{"sig":"MEUCIFCN4jYPimMQ/JRZrkFQWMdH+0xncvCxD2U8t+K219LSAiEA9GMThiQqTFJj889OudbXM9EsUT8jvA0QkK8Wl6YZHTk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-13","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"85b321dc2b66d1283c8e14306d8c6daa8a7c29cc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-13_1683936641247_0.7890754820671859","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-14":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-14","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-14","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"0d6c6c5997c6b5cb958d7592302ede38eca24472","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-14.tgz","fileCount":41,"integrity":"sha512-RyGQymWuignJ9iFzfCNUnfvxN6vP/09qxcjylvRSgUiv5o4Hj6t2sL/Vqty+7LkFdshkKjjQseqFqUFEMazPkQ==","signatures":[{"sig":"MEUCIFVk0oJLgmwY8lLdQTTbkS6YqHu5waSNmPaqzC7QP9b2AiEAvypt9VCe/tAIzGGJY5Bc6nDQG4K9dVKlSDUbe8NFxdA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-14","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"85b321dc2b66d1283c8e14306d8c6daa8a7c29cc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-14_1684023126069_0.1435339940282072","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-15":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-15","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-15","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"0103dd54861d943dc1b2fa1313f107b5c49ef7b5","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-15.tgz","fileCount":41,"integrity":"sha512-rGG1yYh+hbZs/BwqTGxeyQKy3CB5UfIwHIFPdQALBOltaBWZ1b2nI2eifdv7XEqvLCTmwX67jpvy/dcCnL7ahA==","signatures":[{"sig":"MEUCIEvR3f13zNJUwEqG3SmcxBoihW0NvDgEKjjcMMY44KdbAiEAhWopUUDTigwu+97WUJqcQt88ec7btpbQVOGHqGwiLhw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-15","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"85b321dc2b66d1283c8e14306d8c6daa8a7c29cc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-15_1684109487426_0.6167188363323755","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-16":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-16","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-16","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d86cbabeb2dc25c2c8106085f27645db3cc04487","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-16.tgz","fileCount":41,"integrity":"sha512-QarIKy3AUFFaflZ1wDQzHE4S8DINtTO1yfrABQIHdVe7FhAIxG6z98e5A+11Aw80v7rIrlYKx2UJ2lzOLSohPw==","signatures":[{"sig":"MEYCIQCttNRrShOrcZhG1b71ZGeXNmVqE/7RFzkTgVW9KOObiwIhAOsHKyR9FRPIbbW5J6OykwBnIwH+vQYYX0nLYS+etAc4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-16","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"85b321dc2b66d1283c8e14306d8c6daa8a7c29cc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-16_1684195879826_0.8586644679350448","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-17":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-17","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-17","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"dda8ed9c4a10418ea2bf6f94949497615c7a5b2b","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-17.tgz","fileCount":41,"integrity":"sha512-VCZAiviMDysLh1r67SSc7EYmgkw86lfL8XMpBEzw+k5yvoq5ImoguNvZRcD4Duxag2MkBqMMuey7RCTsDjXkfw==","signatures":[{"sig":"MEUCIEtv6jendgHVvc8UYUaYJneLEcT3o2su4UigQvPVmc3iAiEAubDKkYdE6cS25J6W91sLDiCsbdOC7P68PYBgYzdNV8w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-17","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"85b321dc2b66d1283c8e14306d8c6daa8a7c29cc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-17_1684282345042_0.4657401943808419","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-18":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-18","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-18","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"e6bfb18493fddd4db28ede00fa5593578112a8ca","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-18.tgz","fileCount":41,"integrity":"sha512-34KLxrbIh4J4BFKPqH/GZQZBmiTU4dbi4vbiYM/NA0Bf+ev4QA3aZXDwqGdanq95O524UOwTrRsoi3QYEW/Ceg==","signatures":[{"sig":"MEUCIQD5Z3VbcKy9PKipR2YYy9HtGpCz4IcFcRc6HSPGqxWHrAIgVJPhERwN5ExR8TL0WoCxLcYCTfo+xjPUpwPiwuKQrmQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-18","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"560d1b034d7b33a246ed366a111417604002990a","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-18_1684368651831_0.7066067457695295","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-19":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-19","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-19","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"e54e97973a3794b50a71d603ccdc43d7595fd3c7","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-19.tgz","fileCount":41,"integrity":"sha512-1r6Adc2khdZv+lJJ/uoUMlPzUtoiWTzjXBD9WO9Il0muuElauUpTnIIVVb6RQ/5Z7sylgFssGASPAHmdHyaz0A==","signatures":[{"sig":"MEYCIQCHMSI/Tgaw/qOBZmtN/trV1haJhSH+IkJuM0kVuSKGmgIhANOs02srs1VwbpLshRKCvK50sJf4JlHM2JwpTHPkxqnr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-19","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"560d1b034d7b33a246ed366a111417604002990a","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-19_1684455095109_0.06986543696554381","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-20":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-20","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-20","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"96f64764140c9e55509e4cbb1d86c233aed3fc58","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-20.tgz","fileCount":41,"integrity":"sha512-1Ur4cKrC5LPjPnnvt/MIRK34rUr6zvFJaHJvLeZQ+0leoGQnc1ONUkKVSLu4Xi6zPm1S/lyferd7mwfiAKZh8A==","signatures":[{"sig":"MEQCIEvTiAzUQ5jLzcwoTVYUKujGnxngWTOUMNpF/JrCpZYrAiAOELjhgOeE+hRKFYjjEYsEOrdk7AOy7uFFNlGm9OSyPQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-20","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"560d1b034d7b33a246ed366a111417604002990a","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-20_1684541452753_0.7993576610822961","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-21":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-21","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-21","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"2399f35b5c6d56b8979d5d23c91cf77dce580e55","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-21.tgz","fileCount":41,"integrity":"sha512-FXZz48UjYOZRIWxB2LROLdw4SCpN3IM28zzTe0UMvIVw0QjlIr8oXbues2b25+OApnV3HTOjo7kb9z3a00IsuA==","signatures":[{"sig":"MEQCICRA77BkzKy4qn2P+TkRiNxqcmyAdQGMbrUbzbAyT6HPAiBK7PszKBu0kPy7ODCeNEjJzEp8bj3DUhpkbsHIasAI+g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-21","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"560d1b034d7b33a246ed366a111417604002990a","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-21_1684627928381_0.7172419484677222","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-22":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-22","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-22","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"a5be5511d311d1d3b61ca115b18c1a53e44a6804","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-22.tgz","fileCount":41,"integrity":"sha512-ojyXTx5wCjiRJC/VlnpUbck26Vh952I4vmgSt7eoyd/0BvgdvYg8zJ4NMl5oSkbIFy3aEKumrQXNmwjejkk/tQ==","signatures":[{"sig":"MEUCIQCE9NTjVP3MTJorV67gBIAASlU0iETs3PzkpbyTHHrBMwIgMCXjau/3WSB98UV15iLs1Bj9hac5O5KR2vB+JOWI2q8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-22","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"560d1b034d7b33a246ed366a111417604002990a","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-22_1684714310139_0.8643142761925444","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-23":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-23","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-23","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"693c39e8e9a3718dc0b2b00a98ce607a78bc8396","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-23.tgz","fileCount":41,"integrity":"sha512-VygRusJjghkFcAGYjwVeV84jjYzGprISwr8SnsyRWGdv1OuQvfP386H44aA9MLYeMXRRqImCgxTe4xjQpUFGPw==","signatures":[{"sig":"MEYCIQDUklU/yqcTPCk6td1+WoeSiFe60Rf47ou7rNUifKdNhQIhAO/EoUTtKz0iFgvDRqEQRbQropV+3a8lp3//xe1Jla9c","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-23","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"560d1b034d7b33a246ed366a111417604002990a","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-23_1684800680257_0.9292587054964001","host":"s3://npm-registry-packages"}},"0.0.8-next-2023-05-24":{"name":"@dfinity/ledger","version":"0.0.8-next-2023-05-24","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8-next-2023-05-24","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"9221b34a8585e910da488b08942213f0dbea71ac","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8-next-2023-05-24.tgz","fileCount":41,"integrity":"sha512-RAziwlfmMoK889g5SDMBdzX/qknkCWATMK9HwXUzTRSuIzkD/RfadGvSvW18JJiSdHJGMW1BPa0OOgRqZtadfA==","signatures":[{"sig":"MEUCIQD4HsB90YoePrxU0Jzo3LJkVfiFAkJr4uXJ2EZOEx+g9AIgY0TG2156Ja/aoDvMkG9yeJ0F0QIiXDvRcGR9hk7Xh/Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8-next-2023-05-24","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"560d1b034d7b33a246ed366a111417604002990a","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8-next-2023-05-24_1684887050446_0.0009946276964021283","host":"s3://npm-registry-packages"}},"0.0.8":{"name":"@dfinity/ledger","version":"0.0.8","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.8","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f059bc68dcb4f597dbd9b2001437101657facf77","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.8.tgz","fileCount":41,"integrity":"sha512-50LfD9UX4PvvNfSwhHji5/AYCXe3oMKz5xDLq0PqAPvyolu6JBFwn0UEwbQwqzZAC57TrTz69kzJu23GAW9p7A==","signatures":[{"sig":"MEQCIGTzNITLV8zMUzCOfKjZOZ5tT1BkNymB8sfYuy38jXMrAiB+1nJ9nqNGlO5hez9Czl2fHrXh3DUGmBgHs1lpfAVX3w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.8","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131596},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"3498d7baebfdf36317730fb7bfd8280f3c0b3808","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/agent":"^0.15.4","@dfinity/utils":"^0.0.15","@dfinity/candid":"^0.15.4","@dfinity/principal":"^0.15.4"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.8_1684912456515_0.7005491400284387","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-05-24":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-05-24","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-05-24","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"77e0642cbf868200c0f867e35cd378af768f858a","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-05-24.tgz","fileCount":41,"integrity":"sha512-Bxm2xap9UrvRpeQtvQ025wlRKxQTdoAlD9pf94J2/CpIPqmYdqKI5GHLlyczN/2UzZEtD9xaaOWgPPcZrvqs3w==","signatures":[{"sig":"MEUCIQCp7PuE+UKLulK41wnIjapb8A2YN6tfJBomut6/Jpx2kAIgP4hytopMl3bKWZYLfA/4dh4gZSOY02Cf4OeTrVAm9uY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-05-24","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"bfcd9f7360df0e20bff77c31237b96b409544576","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-05-24_1684919581642_0.7432204490246868","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-05-25":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-05-25","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-05-25","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"04358a25cad94b0cd1655c1a86370793bb61345f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-05-25.tgz","fileCount":41,"integrity":"sha512-PKuL8oX93JTsssZKx/Rmd9v/OUv+Rz9kDeiYP/uSFbQQ/jbgTeFzGDLWhHuVPr7fhFX4EGnXKqM9WZh3OtIV4A==","signatures":[{"sig":"MEYCIQCt4iN2OpaPQYwesgkIxfW9rIOTAXYdz1VhpZMyhMVDYQIhANN6BCjHv3PTlrP2VUeVjYttgzS5wsHVx/SSL+w1DKGp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-05-25","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"bfcd9f7360df0e20bff77c31237b96b409544576","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-05-25_1684973498887_0.21434195031555903","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-05-26":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-05-26","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-05-26","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"3fd817a7482b81b746386eea060dbf8083996051","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-05-26.tgz","fileCount":41,"integrity":"sha512-kqHSXgJfe17aBTtWmOmcZYCslmEp9AEDy8b1p+47eNLReG6pPYayYTigRAMFK7huLpOQGiEJ6L2uq8qPdE0Lhg==","signatures":[{"sig":"MEYCIQDqLQ7XBIGYF/6AF/hOVTmyWP14qd/WFj2CZi9fvAagaAIhAMYpFCBK+AQaD0eMPvvahw3lVRzn5e6LbUTvMneIDeLM","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-05-26","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"bfcd9f7360df0e20bff77c31237b96b409544576","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-05-26_1685059893795_0.7997067768937292","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-05-27":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-05-27","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-05-27","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"a766e2b3dc0a31592639cfff6555bd247b55a96d","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-05-27.tgz","fileCount":41,"integrity":"sha512-afwX29/HxOO1xXEbT2dlo1mRW49hVYj8hBQS5IIR5pET4IgT6S6H7qx/YrwaVciC31I/kUUoJQzmCSm1uZlh/g==","signatures":[{"sig":"MEUCIHv3yqcS4dPaWoVGdCDnIXfo6NzuTLdTqEB8OZkuJU0VAiEA3S6Qlsod00qywhNUHlF50Gq8vnQncqsGD8HrHPJgtdg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-05-27","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"bfcd9f7360df0e20bff77c31237b96b409544576","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-05-27_1685146319725_0.0189951337343488","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-05-28":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-05-28","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-05-28","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"9f28c70d61dcd0fe2091f6778d74d022ddaced10","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-05-28.tgz","fileCount":41,"integrity":"sha512-wEHu7D2jNUd1WdZqHkG71QS6QXPGZIrJPAJYVXUgQKq7PvaHVRz4YUsJExCSyALjaVZHhRLAGHns0pcw58R4Hg==","signatures":[{"sig":"MEYCIQDuEF551jXnN0mglI5RSF37Am5UrGwbRKs/Xie+geY4zQIhAIzT3SrMKJtKGfGgmSIsSNvA1o8HYiGIvxIqrnxhQU7w","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-05-28","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"bfcd9f7360df0e20bff77c31237b96b409544576","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-05-28_1685232753235_0.6256834570895342","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-05-29":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-05-29","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-05-29","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d2ebdd1ab753a6fc0d6c200ca2778f32301a7e0e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-05-29.tgz","fileCount":41,"integrity":"sha512-lbvnf2SaJmmSLqg8SKyG62Ffp6ohUmABn0TY0qMKeRFvr5PJwpPJKOZ3/N4UOPHvlS/6smtbvH/SZR/rZtYcGw==","signatures":[{"sig":"MEQCIEFek6+RYs/b0KxNg8d27HULn7qkJLrxhq8f7tzLmxzNAiBEB59TXQLq1Duo+wuKlKleNDGbPCB26PSQxVqUsxzUXQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-05-29","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"bfcd9f7360df0e20bff77c31237b96b409544576","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-05-29_1685319142637_0.9938303039122092","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-05-30":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-05-30","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-05-30","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d7a67e3e90970cf4ce306a86bd27b5a051945c34","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-05-30.tgz","fileCount":41,"integrity":"sha512-0nBlFKGZyBvD4fHQKQd7Nt7uirGz9XsWKp1BwFizWUz/dJC5+eHk90R/pBabPl1N4TZmj2XA4TOjyhsbYq9l0Q==","signatures":[{"sig":"MEQCIG4Uak+JkT0Rzvvyz40jaRBDGiApD742uI/tB3c2mUigAiA904790NbCYnohI0xinfn5FJ9cTDje3bMW+Xo55NsK8g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-05-30","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"bfcd9f7360df0e20bff77c31237b96b409544576","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-05-30_1685405482480_0.09044244724541906","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-05-30.1":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-05-30.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-05-30.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"1b04f2a2791a74c32005c211f77b169ea24da68a","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-05-30.1.tgz","fileCount":41,"integrity":"sha512-LLwN2l6WWXgE+jaylUHSY6X/aT2eCLUGCrWxpFBlaMqKIMbYVYx0ddfKLvINsXg1pAvVK8SJfsG5W1HxKvHQag==","signatures":[{"sig":"MEUCIHUh8KSRl6rI1bkFcGI/78qn2QbiCWToppEogMmDGgxGAiEA9dnjBI3wEAQZDJVgwaotHLdvNQTHgOAwP1WW2+fA4jc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-05-30.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131589},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"32e05b490272a259320fe3979620623fb1d2b8a6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-05-30.1_1685439910892_0.7753430226159115","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-05-31":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-05-31","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-05-31","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"cba23c5763bf7fce3c925e9b9399862e95214b44","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-05-31.tgz","fileCount":41,"integrity":"sha512-shIly/x0v6s0tfitOGUhBQ+fFFt0lxqZ8vyAYiDpELK13tSG77lySwNf7pDeYdO4RdtZ+0+YH8Z7RgcHLwqx+A==","signatures":[{"sig":"MEQCICFggkr3DnfMjtnTxhi5fFVUpU+ZVdHV7Gx0Z5Oo8KQcAiBEp944pTVJu8eHrlADrTZSy8n9sbxf894Kswb+4yoP/Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-05-31","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"2a6c0be1d6bb8b1442eac4da367bd1fe44ce6d96","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-05-31_1685491954759_0.3018762112728117","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-01":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-01","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-01","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c681a1edf1d6fddda968045d4c26602160a8ae17","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-01.tgz","fileCount":41,"integrity":"sha512-m9PyHMgJNfbDskVChaMnnwId3KfUBGu1WWh5luC059dA7BvAybUdKnFQmEGPtWaPUkOdvrAEBWuAOzE7/VNrPg==","signatures":[{"sig":"MEYCIQDym0xrFsXtsXk89dpYO7cyQR6E79LSqzmUZZnDfNVIEQIhAL2q+JSWdFJInPDUIRDkSkFTJF2HCGgwED3VKavIDnYV","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-01","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0ff407de8472af518a9d1e6755b5e2c8aef388f5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-01_1685578501801_0.9411831379227233","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-02":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-02","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-02","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f60e324f5f47f6138ee3ff20d052a4671a41e2d1","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-02.tgz","fileCount":41,"integrity":"sha512-VUwRsT2Xh/VV1oacKa3K7qG7U7NNE97yINM8wgB9KwgCnYOZmvYoRCAE9lL4tMCtw0mGdlENrv2azwcH+Q9roQ==","signatures":[{"sig":"MEUCIQDApBpVW6AED63McV17Rp1p6+6TX6EBhhuzoAO+s8J3zwIgHZ7U1cSVfiVPIHSaSOmAPsHC8MzYQ48fX04zD8JciJM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-02","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0ff407de8472af518a9d1e6755b5e2c8aef388f5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-02_1685664733255_0.799612645465394","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-03":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-03","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-03","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"0c27a564003d4fe098f7c378e14bc0825d79b679","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-03.tgz","fileCount":41,"integrity":"sha512-8nVp4YZkjZpIB8KsOhyHCR5JLqxzq/Tf1HhW6+EZZp5X/IThCx6fJsJ/fD3/sqB22jb7yLwCoDnc6o0NO41QUg==","signatures":[{"sig":"MEUCIQCMJKnCvEuHLWCuj1U4LW+dwD7fZs9GWBwSAV0wo2yJDgIgR/+mxRYZ00W6DlluBddG9DdaNm7UGya1kpaN2GKvH1s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-03","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0ff407de8472af518a9d1e6755b5e2c8aef388f5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-03_1685751174059_0.9290127839680535","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-04":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-04","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-04","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"cfdfe84a67a4d3e3b423ab30d5dd80bc62165b73","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-04.tgz","fileCount":41,"integrity":"sha512-YjblVgw5xMxG7WG5R/kgStiIFfuaKr/Rdzeccrmyg6Meo5wObPa59/PbLrOeZiEZz8iQvEyaRRafHzl5dtY28g==","signatures":[{"sig":"MEYCIQDCsQ87GNZXiPpWmI4jDLmQa6CVcpCLDkI13fbmgzQtkwIhAJQkljwTbS8Fl+Xb6L7ZsG703NUtznjEPrtNx0NW/3Ki","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-04","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0ff407de8472af518a9d1e6755b5e2c8aef388f5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-04_1685837602150_0.9931999096023905","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-05":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-05","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-05","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c466b7acaed1453811b15e099164a7e8cc0dca73","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-05.tgz","fileCount":41,"integrity":"sha512-VdXlXivWHVWuBIpMhQ8OY+t9XPD5rpznairHL3gSAv33/YHfmwQOjn8DOKC8UALPAviwgCU8clTF5eDm8zplYA==","signatures":[{"sig":"MEQCIEozj+e2wP+rlrVTMtSzvBjy+yFrxu2mo3XSlXoCF8QQAiBiPRmXJzxzwF7i/M2KdiLxdlWGtWa6eB4KCA2GLA7Q1w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-05","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0ff407de8472af518a9d1e6755b5e2c8aef388f5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-05_1685923958092_0.9396958686312555","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-06":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-06","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-06","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"749915becffb642b8bf8e838c3041f3b68361168","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-06.tgz","fileCount":41,"integrity":"sha512-1Ph4hLFPcfjmenicSEq9gkwo4fKLQWIFAka4yhFgRX/pcspnkx0xN748GjG2roy/KRRAx2t9tuyZ96fr7nquLg==","signatures":[{"sig":"MEUCIEa3fp2vdzPrkD7gNw6TZHPSbkhKnp9hi6WLROVPBtrmAiEA0TJVMgo6gILvjEbREXC7TO684PLyp1ppX2nuZz8rU9s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-06","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0ff407de8472af518a9d1e6755b5e2c8aef388f5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-06_1686010375131_0.5557532735316897","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-06.1":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-06.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-06.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"19a38c947b2c8f6a424bf180b01103e5d63c581d","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-06.1.tgz","fileCount":41,"integrity":"sha512-Hyd2PiNNY5fPzXfSWCStx2SFhTxZZSy/21EY02ic54ne1bVFyNquaBUgEuqV8aRWqdJ/SIrrEDfS1/vEp1qC4g==","signatures":[{"sig":"MEUCIQCF9IxKkehOwGwBy81VOwrsiofVgUrNRYsdyVzIAqDEXwIgORlJ9EKr0r9eRda2J4mfjJWut8BVMZXHJHWWPBsiWH4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-06.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131589},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"e7669a41aec1ee270bf611e72d62abdad9c5f429","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-06.1_1686045922507_0.521744028654963","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-07":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-07","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-07","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"447d5c7f1ee177cb08480e03a1e83d7af292c66b","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-07.tgz","fileCount":41,"integrity":"sha512-1moEmVhalt7hX/et2jOIiLF2MnyQo0T3DD2cUyJcK+a9FLuFR4nksVkbBsqhkO05yGaE9eRU7pJ/xs38K9oAZg==","signatures":[{"sig":"MEQCICP4basXe/zAAQ4qXX7ZZAWekn5gUzP2oC0ZIu9xTasiAiAL58YKQq5RgAuX0hDuwn3o5o2GgzSZwjEd3UMzHqW5XQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-07","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"e7669a41aec1ee270bf611e72d62abdad9c5f429","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-07_1686096761338_0.5352647059003015","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-08":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-08","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-08","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"661d73e8aa426e3d432fb993255c8fc012360adb","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-08.tgz","fileCount":41,"integrity":"sha512-xfF5wOkETpJ8ysUs654ps5lWL+UKga0rm5qKtkKFpO5fxEkYRTfARj6bgDwZjxCafBdEiCc/eivxGMRDZ2B40g==","signatures":[{"sig":"MEUCIQDvrmWF6IJOeKqX7Gbb9mVU1ChgJdVEd0+WpXaqIf9jZwIgYUI4h2OYOluvx/2yxSnVVsCBv4whU/u2wMYhwhDG+Sc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-08","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131587},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledgers](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance of the given account.\n\n| Method    | Type                               |\n| --------- | ---------------------------------- |\n| `balance` | `(params: any) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"af1e9d9aa8d07bcbfcf0e7068d598d86c4c62607","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-08_1686183161289_0.08743983219552387","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-09":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-09","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-09","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"2e9c229bbcf534e2a8cc14ca10efbd781f2e5443","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-09.tgz","fileCount":41,"integrity":"sha512-gTKjZ4fF7/1UFm9DsOL/aBnAeb6nWsYFOM2aPtTQwn+BbFNLVt3FLN1S0OJTVYdZN2UN8WLuiM9mN9yyUy/irg==","signatures":[{"sig":"MEUCIQDXssk5YHUJUARNa+zOxHG5d8BpmkZx7nFA6ANiIC9riQIgUoNwQp9P7SuuxBwbNwug/9Tb2kVsHqV7iLyD8nQ1QBo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-09","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131908},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"9545c59510d89ea35c399a3ff74c70a71d9944c9","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-09_1686269578339_0.5931506109824523","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-10":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-10","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-10","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"8e1861ad0c94370f1ac842e822581f7eb8f3d264","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-10.tgz","fileCount":41,"integrity":"sha512-yLrStCWgtP0jj7GwBNAU3+byv9TvuM6Xg/gnYaQR0nUvO+hz5anqnPSS2cD/aMw7EJpgYaEfzxP9elK8qpzCRw==","signatures":[{"sig":"MEUCIQDdQJeNuRX2OBsZWICNFkOKzMq8qbVoqiNhQ1BpAQdZ9AIgGv/bd6Mn2KbUqTGNGAvWJNhtkaVbXW2zOVP+XGsZf6A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-10","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131908},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"9545c59510d89ea35c399a3ff74c70a71d9944c9","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-10_1686355903333_0.27074833169219814","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-11":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-11","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-11","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"05ec6ce370398ad9e8ea03de256d827586c47a0a","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-11.tgz","fileCount":41,"integrity":"sha512-pTmD6JUw9eoCrx4k/gQ+sZ+SG5sA3kzD4wz0GXjcAdgLsiBmRti3SewcxPrFna9U62CxHo+8uY9H/Ik4LiZQzg==","signatures":[{"sig":"MEUCICNkzab/WvQDv60cvHJglEjvki8whDo51wdExl8PFmJLAiEA1dk+U95J/tpVl2RQjQBwgDxaqnXbY3PSqFIC5lIUykI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-11","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131908},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"9545c59510d89ea35c399a3ff74c70a71d9944c9","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-11_1686442422362_0.6377491488361935","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-12":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-12","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-12","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"1eaac44b7b74af75e477a85d7c7794966657f28e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-12.tgz","fileCount":41,"integrity":"sha512-DT+IJMNUpCWmLqgbiRTq1L9GRXBqDPCJ27PsVS8vQSXSiW2LVNDNiRJc8Bgoq6P7Wb+7eJGWwhdCwCW8Q4zKNw==","signatures":[{"sig":"MEQCIC9CyhjU5AI6JwSJX1g4MnE678MTBPjknswejiVvzvWkAiBkgngmtqVs5vBXvXyuwj6zggFuX1G4Zh7rRLZhDbNBNQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-12","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131908},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"9545c59510d89ea35c399a3ff74c70a71d9944c9","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-12_1686528795713_0.5569082079613161","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-12.1":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-12.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-12.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"832e7abff4ac86440f30224126cd378415ea840f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-12.1.tgz","fileCount":41,"integrity":"sha512-9iv+BuLf8RNBpor2nsoMP7GaUq8l7UU0W+iwz2XGiqVJJI9xd3H9XVwyyLwMAu35ZEFj4vrV5oH1QSHxUYZC/Q==","signatures":[{"sig":"MEYCIQCunt1k/j4AKclHsj19N5pyTTuPL6LhFjAEPjwwTmgUPgIhAM3T80n4MzuuGuhT30eMigAcR5D5c1qOu4YGAQwNI6aP","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-12.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131910},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"33a1817f5fb2eb4b04b570a1411a9345458c1047","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-12.1_1686572687384_0.43460005385758227","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-13":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-13","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-13","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"445fde1a73699686fac0b3afe82d0853746a24d4","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-13.tgz","fileCount":41,"integrity":"sha512-u/ZdbL/qWwO6vd1UWixzQcWOsng0pEqfntXcannu+Ka9ff7/mZ2AMVcn+HSoJgksV4L3FISOdAfbbg31Fwz8ww==","signatures":[{"sig":"MEYCIQCBHo8vl/c5j+UhkDn/vlQMEt7G8F+BJ1uS8K4n22DtrwIhAJyhXB/K1GEa6bct0ehthhYoei6GrKTZv/mYoXmZTUG5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-13","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131908},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"33a1817f5fb2eb4b04b570a1411a9345458c1047","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-13_1686615150507_0.6713908150614751","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-13.1":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-13.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-13.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"75c81b9a0284420f0ee447adafcc26976881686c","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-13.1.tgz","fileCount":41,"integrity":"sha512-1WkwQovf6OF3rlv91Wz93QANEVl/de8zJjhZJ9HUtMc4c4eQSK6C/6NFh4QvHjLws3VTk0p7sqEIYCiX0jtwEA==","signatures":[{"sig":"MEUCIQCU/Y09+ZE2pTK1gl6zMpfnQ95yUDQ68KG1vVkkjCnT4AIgPEH0MBNJcZokdPL6UkmRrtRhX21u7ia32zsz0OcMbUI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-13.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131910},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"eac810b0a9c31edd61a641ab38be7a3665491f02","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-13.1_1686661814075_0.8711776121278094","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-13.2":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-13.2","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-13.2","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"0b5020949e5f731e01b2311f254310408cbdb6d5","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-13.2.tgz","fileCount":41,"integrity":"sha512-Q7hOJ1iUty/JSfSOIKI41LCq0NaIqGRthM+hjBNDL5ebjJLmjgcYBlor8lg2m3ZbcxHxlLaHP5cb9s42DbaS2A==","signatures":[{"sig":"MEUCIC49d7dWvqDYWzjKtexzeghWZobFfSyfVe/uhjYGgKNiAiEA5976SBKv6bCYiPbBMeO6hnIWY786eurn4Nzu78yqDxo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-13.2","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131910},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"065c58d6d6bd4dbe237d0e9a757d1a636daf74be","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-13.2_1686665080528_0.7698921073779699","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-14":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-14","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-14","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c2bc4a37429b465179f2df69052f923b6f21460f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-14.tgz","fileCount":41,"integrity":"sha512-D8t/HjWV/rLVR39XhT59L5eWKYbCHUP8OmZAcY4hBLN07xeGa0eP346m7eYmPgWSLcjkmDq4gdZmUiAFccfBmA==","signatures":[{"sig":"MEUCICyw0gAVg++RtP8w0uOdPsYqIOTdeUkO/AR1b/PwrlzsAiEAvijdcbkiJEkS/rpU02NMuiknHZw46ZiSgE6hXC9HbTM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-14","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131908},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"065c58d6d6bd4dbe237d0e9a757d1a636daf74be","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-14_1686701499896_0.3952433614696478","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-15":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-15","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-15","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"a1bf0677404b4e112d08c5ffd25f1898ec508d8f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-15.tgz","fileCount":41,"integrity":"sha512-Dm5848P/fZ/mrZlwg8KmWHw83T2Sm+DQ1WoYhomk6ZQ2biN/Wi4XjafGm9XnQRL/jscDtZu5tIVxgMZKyAXxzg==","signatures":[{"sig":"MEUCIQDa7VdvGe1NLLnhbmcQ4GayDCU8mg5McjtrQ7IEwZinNAIgclY+OR5beHy/fK+hBbMMDegk8kiIQJmDTGwKSCbTQCs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-15","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131908},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"065c58d6d6bd4dbe237d0e9a757d1a636daf74be","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-15_1686788002604_0.2465956360658874","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-15.1":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-15.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-15.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"29e38d912067971ddb9cc57905362cca3fa54650","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-15.1.tgz","fileCount":41,"integrity":"sha512-CLLNPp9FeOKWOZNwwcLIi/TW81l34zjJLsFceamadBXRQaTCMktgIsb9NI+0DfHRJHBrbUyvQqIUHyEfyhot1A==","signatures":[{"sig":"MEUCIHoJQISYX8gr38b2aSPkxg0vUNJPzCTQ51+C/mbCoUUZAiEA8/jViuU5nH0xfXUkrSYrgSKDhbvgmZ5x9Rj/8p5Rco4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-15.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131910},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"54339525850a85ba8f2dfd32f823c6612d0e7a79","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-15.1_1686833773232_0.5984856778993992","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-16":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-16","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-16","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"860881b13a89f746429979d7b9bbb4f23e30763e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-16.tgz","fileCount":41,"integrity":"sha512-Gv2lDaRrIlzymtTL9/Yc8sBc0UTKmavYZIaj65WoMOsWeeDoKI1pjME2F5BnSLv6RVt2u0QvJufp2JVRs4wu3g==","signatures":[{"sig":"MEUCIDZ1Bxxpn7FgrB3nbmNmy1qMX21xOvO78gOEM6U1+jQGAiEA8vZOz/sI0I0aifTmJwQTj0J1i1jGLZLYXN9vLwwrbBE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-16","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131908},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"54339525850a85ba8f2dfd32f823c6612d0e7a79","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-16_1686874346248_0.06951472087099053","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-17":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-17","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-17","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f6fc061478635f028d917ca481655fab78c6c328","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-17.tgz","fileCount":41,"integrity":"sha512-38odqtbSR6SHv4kfNPsiH59WJzu2KFBdPV+ChHwWl6wVnogclSouIInF6j0UEdfxIFHyV2TZ5a1/cG8Do04rOA==","signatures":[{"sig":"MEUCIDapYyROox9NkUXwcKYdLnntCK+I2uNUy1OkLU1TYqwFAiEAxy6IZcx+JallTHj4odlMA+gmx+FDsfVroH7C9DGI+UM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-17","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131908},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"54339525850a85ba8f2dfd32f823c6612d0e7a79","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-17_1686960693344_0.37508579961383903","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-18":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-18","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-18","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"1d01b52ef06af903e9f7cc943319ffa14e1b1253","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-18.tgz","fileCount":41,"integrity":"sha512-0b9RN2A9SAkwUfrKWO4a/F3fGVtiJ90guvbAwRIhO31OGHB8kC6VrPok8cdL6/16Zs6tCGDs1ONPjSnZqQt8JQ==","signatures":[{"sig":"MEQCIF3MGJJaNNWp9nm/m8TkFQufq1rikYiZn+7nr3H2ujfnAiB2pnilZRdgWQKsop4HfpXVgjY/HrfNgxytQWX7Fj4Rsg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-18","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131908},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"54339525850a85ba8f2dfd32f823c6612d0e7a79","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-18_1687047200050_0.83063374206932","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-19":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-19","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-19","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c05889ffacf2c228133736a9e4b51a62180a357f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-19.tgz","fileCount":41,"integrity":"sha512-jTKQCofckbl/Izc52gUm8ivU+kELWhmNP79/JO0YhoCgz6q+iBmXeBKU4sIBtUdEpX+IvtcNbBJqeavM3eYgwA==","signatures":[{"sig":"MEUCIGc8/1jFuin4E73rTfVdqLm9rapyEsFE08fiF2KKuDV4AiEAmA/KtEEmaOH15dCFyieNA3gdzkKJ9h1mXqTVnPiLlDQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-19","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131908},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"54339525850a85ba8f2dfd32f823c6612d0e7a79","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-19_1687133554691_0.2156527706254283","host":"s3://npm-registry-packages"}},"0.0.9-next-2023-06-20":{"name":"@dfinity/ledger","version":"0.0.9-next-2023-06-20","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9-next-2023-06-20","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"232c9f7607106fa7377f9895940da109b48c97e1","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9-next-2023-06-20.tgz","fileCount":41,"integrity":"sha512-pk0gD/8qO9J7zbNHacBeqV9M5n1aNJcA50SNhHE35+qrSyuKSVaQ6FWDErlaUHTXCMC0iiYzcqj0DTQXaJMLog==","signatures":[{"sig":"MEUCICWuiTuECJHjoKlhnKSvi+MTN55+TC8c/PAliuXOZ6aFAiEAhYF4pakVlyRfsEPKhSQMwWghAGaRemt0lPHjMIkW0aE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9-next-2023-06-20","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131908},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"43e8dfd1f81fc428ddfd72657111d1655deb94a1","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9-next-2023-06-20_1687219848218_0.6428097818561607","host":"s3://npm-registry-packages"}},"0.0.9":{"name":"@dfinity/ledger","version":"0.0.9","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.9","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d0b30cb809a16e5e14b66450b4de7891d89e246d","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.9.tgz","fileCount":41,"integrity":"sha512-beQJxAVLC2E71ne477It3jPGlleYCWX24iE+NQ3+6ZmJoF9JwqlsHdC70i/iXcugKbFCsUEVMGq6IdJDxeh4AA==","signatures":[{"sig":"MEQCIGC/x87mno5pISG+e6yA0YIHBmdrULe4zSrABhBW31OxAiBaWF92EvH4gnxUk6VUSubpo63gIJMldGkmm5Jy54d6IQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.9","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131917},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"3fd13d01a94e78ff1530b973e3310e10f794b015","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/agent":"^0.15.4","@dfinity/utils":"^0.0.16","@dfinity/candid":"^0.15.4","@dfinity/principal":"^0.15.4"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.9_1687269837096_0.17079907209787315","host":"s3://npm-registry-packages"}},"0.0.10-next-2023-06-21":{"name":"@dfinity/ledger","version":"0.0.10-next-2023-06-21","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.10-next-2023-06-21","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"8ed2bfcaa34000939aa19974ef330a4c2bb5b460","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.10-next-2023-06-21.tgz","fileCount":41,"integrity":"sha512-up3C7MjgGFbJHIh7Lqsdpsp9YDr+fGCwD/CV34eowuVSCO73Y3Flo+M1yt5SJ09X2dVm6ojF2v8Ki9atSEIqRw==","signatures":[{"sig":"MEUCIBgjcraNo0xvIMWE1IgHfsf75ZsOOhGBBlcNuOv5Mx4rAiEA0FHITE5SIgsUf6zF1ozoVzj3E4iUstEH4OZvFWNfm4s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.10-next-2023-06-21","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131909},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"622e177d150ea72fe6cd96bb4f8f42ee27aef2e9","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.10-next-2023-06-21_1687306355530_0.2382948333052135","host":"s3://npm-registry-packages"}},"0.0.10-next-2023-06-21.1":{"name":"@dfinity/ledger","version":"0.0.10-next-2023-06-21.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.10-next-2023-06-21.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"645967ffc3642473dafe79c2aa1e3c4400957f7d","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.10-next-2023-06-21.1.tgz","fileCount":41,"integrity":"sha512-zZED1omIXch3ogLfgGc32M+okIiouV86yld3kpAOdidCC6frh7ng4mXag/Z3P8iymymwWPS9rTVf5opjxMDTFw==","signatures":[{"sig":"MEUCIQDj3IRpScqPYDSmpQ6+A13uLVagAGjl6nRl5JO/mLjO8QIgFPgo6ABj5NhSin4kBN80p92j3lo/LfT5ptgWLv3JCVw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.10-next-2023-06-21.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131911},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f1530c22b15a8f6ea5eaefde3d9e5dee9615fc4f","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.10-next-2023-06-21.1_1687325247992_0.8243750067223936","host":"s3://npm-registry-packages"}},"0.0.10-next-2023-06-21.2":{"name":"@dfinity/ledger","version":"0.0.10-next-2023-06-21.2","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.10-next-2023-06-21.2","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"a515aebf67fa3571bcc163f357138caf4397396a","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.10-next-2023-06-21.2.tgz","fileCount":41,"integrity":"sha512-P6CBberk6RN1Y/bwbvozECxW7qQCkb7Mf6SxDjgl34Q+rwKuDv5OsW2hijR4o51iix0Z4RjOEe99l+i/OFnIAg==","signatures":[{"sig":"MEUCIBmDeppg/bFTbg36wleQV9Z8ARn72W7jVBHBA2P/ZCrJAiEA3A9pXurueDgwqO9/p0VZQyBnDMBIMMoKskxxm/D+3dg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.10-next-2023-06-21.2","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131911},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"26c6124c12be9b13c12042c872462a16153db97c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.10-next-2023-06-21.2_1687328185433_0.5504186749156066","host":"s3://npm-registry-packages"}},"0.0.10":{"name":"@dfinity/ledger","version":"0.0.10","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.10","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"b9d7ccf63eb2c0f04e390d9b5e0c346dcc6fdb9c","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.10.tgz","fileCount":41,"integrity":"sha512-J998E2HTu0zU5ZO9MocnhgwQZRgO1kaWrBY4rqpGy70mvpb6HnYYdBQayzuX+OEUM1nsn1uC2DU3OKSW9K1lfw==","signatures":[{"sig":"MEYCIQD65M8lQvRa3lmpJr2ijhhJzurs+qTWCiK4R0pGngKPQAIhAPgPrRCPZ0WmuCO3/vn+5DTg8OLAgrl1GVtP4PqQPby2","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.10","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131918},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"21089c0c5711a2d7da3a54759d37c7de50a01e32","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/agent":"^0.15.4","@dfinity/utils":"^0.0.17","@dfinity/candid":"^0.15.4","@dfinity/principal":"^0.15.4"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.10_1687341401516_0.4072108938649144","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-21":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-21","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-21","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c7e9b413ad6efedce178c3ba54a7cef93287a880","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-21.tgz","fileCount":41,"integrity":"sha512-uFQHQORClhK8NYXjkAYnFJUeqzh7xCpA1OonBBxQ2yYCoUQTYsbRB+ZO1nQbSuOUTQMPsshrwpcuEfmGbnMuOg==","signatures":[{"sig":"MEUCIQCG5pOGPKUrS2oqjKGHc0kDRo9iLF9+GWGCR7rpy8GbcQIgEhasRBshu4ae658FRHpRQERtvyir3aR+Il8RWHL4BGo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-21","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131909},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"24aeafabf01aadc67f837649796a44e1f44f47d5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-21_1687343966326_0.3998518516381835","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-22":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-22","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-22","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"5a3532780dc9d762ad9fd31d57e4c435bda3e035","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-22.tgz","fileCount":41,"integrity":"sha512-57Eu6MvvPMNBKNpdsQ1ZF/s9fSU55d//L+3DdlNm7Pfp/suF+c2ymzgN6sxiAa56o+bglAVRhhyB29PF9xYNeQ==","signatures":[{"sig":"MEYCIQD/N62dhMtwuT6/L2m+GNaYjDJv7me+iGHR8ruyn1UpMwIhAPGaI7FqLa0sIHGEug0z4IhbvlE/TnaWLr8w4Dg49nyr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-22","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":131909},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"24aeafabf01aadc67f837649796a44e1f44f47d5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-22_1687392755140_0.6289426966135336","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-22.1":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-22.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-22.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"ef48c43680572be01da5aa0b099e9287fc9a2537","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-22.1.tgz","fileCount":42,"integrity":"sha512-TegXgThdi6RIKndyX0kRNLh3m/PWvJhIXsXdxG7TqyppiaL6pWPQg7Q40R2FgcTYL93fyYwj101z3v8VuKIVHA==","signatures":[{"sig":"MEQCIBq0PfW0wIC+W9zkjzPSvuWEO6wYGGiy5FmxM/2Sod+lAiB3up40cpWvYZjOx7ReM27dTqR1qE/J5U/LbFpg2Un0hw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-22.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139173},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"43622ad60bf18a4be3756751dc059c5b15bca999","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-22.1_1687414858709_0.49138900294547927","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-23":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-23","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-23","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"18c7d45ff20f81048ef8559fe9211e381e4108ac","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-23.tgz","fileCount":42,"integrity":"sha512-VIFqcnSCopD9v/07/QaFu9pMvhkq+J/NnbhaDL2La2+5639FeAIP0K3vc96KMZXCb4wVm/gqpKyicTay0i5zFQ==","signatures":[{"sig":"MEUCIQDzNMR/gzuqNhF7MLhcWpNzBckEtuX9MfUKcA/3Je1O+QIgU4nOTd+niuB1HfayXAoLElwkpy4YXcwPw9lM+Zp35yk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-23","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139171},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"43622ad60bf18a4be3756751dc059c5b15bca999","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-23_1687479259388_0.9351385641725019","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-24":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-24","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-24","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c0376c67241e216118f89ba8f81cda0d1382478e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-24.tgz","fileCount":42,"integrity":"sha512-yGclKAollvT9Jmpp3jdY2TBhWqGIocKfFfC5PwJ2I1G3BC0Lx4pDDYZaqhPnBxg7QfY8EbcMsC1RJzEBdvjv1w==","signatures":[{"sig":"MEUCIQDyXRcnCBsvfJA4i2AXWM/KLin48v8KocMsGiTlhfGm/gIgZBxrCh1N1sYrXy49EyCG7CfsMQ4J68CIxPQG701uTq4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-24","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139171},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"43622ad60bf18a4be3756751dc059c5b15bca999","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-24_1687565673882_0.5603800941347157","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-25":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-25","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-25","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"0b219578acd913b45f5e9b1bd8ee9b7ae7e8a085","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-25.tgz","fileCount":42,"integrity":"sha512-2orq/WHJLhqJygLTvUvh0Dj2lb5ECRy7geNJibUebr1gmX1Rc1c/Zru2ITA3n5cHXa3JToMcKyLxQO+5HGZyHA==","signatures":[{"sig":"MEUCIF4qxOpnkxmJeZ/IIbpJMNxIFmgJ/DitlPIQ2BEc6zAXAiEA4Pi5KavLOwufX7b61QksCJaKdyu0PbtAJiShT7//Wxs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-25","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139171},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"43622ad60bf18a4be3756751dc059c5b15bca999","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-25_1687652087245_0.7522950303015841","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-26":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-26","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-26","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"91335f7366c1a0b25f69291dee1d51e40974e53a","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-26.tgz","fileCount":42,"integrity":"sha512-GJCHnLOpFFG/296K1CW6Y8Ge/vYB6eGYq5bnltLhsJrqlAsVvphmy4oCbo6NWuwgM1p2VnSMrplBLbrHWh9KKA==","signatures":[{"sig":"MEUCIC+3Fy2VFmLmys/riCEFl7baVWsgF+KK57oXqmDccaGnAiEAvRy7oCP2aflyTXyTL9VqBnRTnk4bVcbml3+Y8A5AyHQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-26","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139171},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"43622ad60bf18a4be3756751dc059c5b15bca999","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-26_1687738485192_0.873789351359334","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-26.1":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-26.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-26.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c3b0462f237e63e86595e2ebb4603b1097198b89","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-26.1.tgz","fileCount":42,"integrity":"sha512-KQc2RoqihUn28BGI7U8tfGyfKj9RAEjH//2XkgnoSsWjgz7I8BVlsfq5vBRc8fERFKJ4wnwFEiGZlNGshwYLzg==","signatures":[{"sig":"MEYCIQCTo+KlxiFApAsRPeD/zjSQ5NUU+PIMRJ1Z4M/NPGfPvwIhAPC5elZESvhSuE9X2gCxAmzz9DdUn+CmlENRA9i6Puq3","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-26.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139173},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"913235a850d3e691cd10fb9537b91caa3301d3df","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-26.1_1687759117334_0.6898298453964311","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-26.2":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-26.2","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-26.2","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f5102575f3b5c303cf7a11cccbd88a8265429820","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-26.2.tgz","fileCount":42,"integrity":"sha512-ws1wQUOcRO83l+kBsmTY3lcDOx2N7YSz+lameu5IpCLR1oivvNn93qjQLn3BnS8V3H6Nfckj78g28ZVVWDYGVw==","signatures":[{"sig":"MEUCICBuCKfwMAmczvCka2TA4EApOfM/zH7777/yI+xME9VeAiEAunBalhJA+hzsviZozg6jpyI4ckf97R+lqssVtJ6M/og=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-26.2","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139173},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"11b36b058519d33261a0fbaf57f65c68d115d8b8","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-26.2_1687774096992_0.13626275519150943","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-27":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-27","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-27","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"50aa51fdd68af55e304060509c2862588c5fc538","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-27.tgz","fileCount":42,"integrity":"sha512-tg7RMeD1vH5SnzGmameiTfHR8YNTQVv3STIpkKp0E7kIT5ZIr+Plbota7OfQf/HRDN2BW5/LYG5UCZ6A0ws77A==","signatures":[{"sig":"MEUCIQCKYSOngg83r/sGEibPlzBKGYURfGG9vC9B37hRMLYpJgIgc/pYtu7TMvEncs2NieKY6U0SfE0QB2kJzCeS2w3j21c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-27","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139171},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"da291d796ae11af913470615bfda421548271e93","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-27_1687824823421_0.7123497324868948","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-28":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-28","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-28","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"24ef5b0317fda9c9f781d06e2849cebfe517dadd","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-28.tgz","fileCount":42,"integrity":"sha512-GwAUgi3B2ZNt0Fn1oVWPOjAW/HB28vSIrZRZDpvocLt+d1dv1oRiN8ORg5EJ0yea7qnVfCJXYdSDwkw2hvLlAQ==","signatures":[{"sig":"MEQCIA13ayNuGz8h6I+r1LOyphy7+zRRUb4cvjNsMKBdUf7yAiAnDd4GODPOQgbMUcr4zkT1avAZleRospDv4qpcvVwvEw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-28","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139171},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"da291d796ae11af913470615bfda421548271e93","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-28_1687911220101_0.9189253010760985","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-29":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-29","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-29","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"cbc0f6257930c8d08b54e666a7d956920a87b531","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-29.tgz","fileCount":42,"integrity":"sha512-ZTYKFqrYF4Z1pECwbPu+3jM3jh7AnkDDPW+BxXcHF7eBf1BstP+58+g5esmCRXdHD6p3YHW+bfOSp/LpyWgsAA==","signatures":[{"sig":"MEQCIDtuUvm8TNHVRsbNxhHKwaangPbyj1W3IqFyiUA5Q8uXAiAVeQLHBsHptG11AyNNEmMwlJqUHPm9wcNS+IpShbhFBw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-29","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139171},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"da291d796ae11af913470615bfda421548271e93","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-29_1687997647944_0.7469980706396608","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-29.1":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-29.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-29.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"2b2ea4439b59ed4900a7e7c6105ee98266c1ea3c","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-29.1.tgz","fileCount":42,"integrity":"sha512-uxgSOiJqjmQPt2XHjWHuNAm9y1RRYXn7vQh0IQUdWcor0VjReYaklJCxAwgwVKqXdcXYq4PZG0HfO+L1N1Ek9A==","signatures":[{"sig":"MEYCIQDk69gqrNwgqZXml+hZiPz6qKhwbU6bqHtvCFf7Ib5S1QIhAMIbFnlRD5i1ThYaNg6VhJGxpCiI1BNXTilPCoU2E4ju","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-29.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139173},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"8f9e46632ada36b3409a395719b993953bada1f5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-29.1_1688022041108_0.43521759093153345","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-30":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-30","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-30","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"ca2b70834055609523c2982aace24c21ff3220b3","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-30.tgz","fileCount":42,"integrity":"sha512-Oo3t170qaXC7Egua4VxIb4pd5PS8rUpScaT7GEdZ62PeH5WnOSOgXphnnwrvz0jxouFpqdDKYMvLnTWgQBevRg==","signatures":[{"sig":"MEYCIQCeky/bEhjadjhVQpjwP1W7oTHmNDfO3oQY+kyp0BWDJQIhANe3aVgHPKfJFNQTzxp/l7P0BVkcSQYYdinp35HyXUTf","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-30","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139171},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"8f9e46632ada36b3409a395719b993953bada1f5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-30_1688083950424_0.10679713746893671","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-30.1":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-30.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-30.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"4324c08b7d71ca3c297723890a87be26bc8a70ba","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-30.1.tgz","fileCount":42,"integrity":"sha512-3BNzmrtAiqeDjCzkGt1I1yg/+rna6GKqKHQfcTPdvi7i3d6uZr60kKncVDnggnJKeyTgMd+SeZJ+qD4aZ0XczA==","signatures":[{"sig":"MEQCIDVP8lk3gZZwP1ZE1ZFcSIutbP70vPxjsvqz+CGe3fU4AiAY+zkl90IPfDb+nzjO5i673CQo8nFCE6qRKb4M9aWLvA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-30.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139173},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"545db816d69e3188305dee42f6e0714ac2312f31","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-30.1_1688154451294_0.22592081307122935","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-06-30.2":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-06-30.2","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-06-30.2","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"bc30c0630ae6f871997632d45fa8b6b0b5797584","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-06-30.2.tgz","fileCount":42,"integrity":"sha512-+Hfk1ZwvSsUxUs4EThw5p5OPWx8TgmVCi4A71XpXI11KB6cuYItRsl6PKxtdzB51kS3XgyvsEwiwdpPj8LotsA==","signatures":[{"sig":"MEUCIQCTgnInMKjNcVUxA/+JE/aK51d4U/ZjhcVkxY5RVhDP7AIgYKAvo5mqLu/qz3XfebPH9E71Y13Hg9hpwuExIFe+tWY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-06-30.2","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139173},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"545db816d69e3188305dee42f6e0714ac2312f31","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-06-30.2_1688161118532_0.803044513276931","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-07-01":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-07-01","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-07-01","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f9234b544a6aeb155dfafe78a1269029e14354d9","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-07-01.tgz","fileCount":42,"integrity":"sha512-8HW3eUT/apNpvi/R7Pbeq7nCHMzqx0hyGPCnVSTixMhO4sP0zeVLArRshkJnP0xs3FuLBTlI/Qete6puXOd0eA==","signatures":[{"sig":"MEQCIHnUCy7J/Zm+GjZjENBvHn/fvdCXl+1rGrnBvN/2mUs+AiAOi/iIJs2Ue0ItojgmTeFW53qFtMLkGRH4cZyZis0bKg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-07-01","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139171},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"545db816d69e3188305dee42f6e0714ac2312f31","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-07-01_1688170514265_0.5672744661649844","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-07-01.1":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-07-01.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-07-01.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d1700d118986c3b2dba03f2f89fd093d276f0310","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-07-01.1.tgz","fileCount":42,"integrity":"sha512-MSPHUdNuGNG0gGb+AtBm3EqLIOfw+6NXpYxv8CWxekEbnUD0acxRZD8xWBkC4Z5CcpXp+ip9y3fBL6Anl/8hJg==","signatures":[{"sig":"MEUCIQCd0m/QhgcBrZe+QqtQ1Z6P5q7X6LNso/BgsiNzXo7tewIgVAS+/gSRe1NaRHP0G/F4+AbxIQd7cBsavWisUuotpdc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-07-01.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139173},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"1bf4fe437d496458ad9fc8920c1efeee4c992eea","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-07-01.1_1688191832704_0.4331796759197739","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-07-02":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-07-02","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-07-02","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"e378999c1dd0a9b1c503838d6933dc3b137b9a9f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-07-02.tgz","fileCount":42,"integrity":"sha512-daDe/JHwoCwgvL12VmSvcTbeZ7nS+CkWs5ltt8iuFZEfnBmFiRjx2xMJRrPKIvTVrDvOt6gHUldDoedLwRA8Vg==","signatures":[{"sig":"MEUCIBTY4bP3Vsnd4ZtefSWrFO+dRviEee2khwTj/CYuCQLlAiEA6kkhINycZf2ZNIwDYkD1wandm91eXRrdQgKlqqJdQLQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-07-02","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139171},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"9b1784ef4be85c2b1dbbe596ff4dfdeb825d0257","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-07-02_1688256884025_0.9142148102087135","host":"s3://npm-registry-packages"}},"0.0.11-next-2023-07-03":{"name":"@dfinity/ledger","version":"0.0.11-next-2023-07-03","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11-next-2023-07-03","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"adfefdd2f4d04e4d582161a26aa71a5288b2afd5","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11-next-2023-07-03.tgz","fileCount":42,"integrity":"sha512-/+h5/cprl8QVpz3lSVQTJPskkSFBFARsPm6NgXgWDTof3MJaImkH/Pkw5wvs8eJU0SFvwLcwGs7OpA6AyhCKQg==","signatures":[{"sig":"MEYCIQCoOZ8L/lJngSJ0zn6LQ6Gk4U4trX4axRCggruYxHDe3wIhALHJID3c236wJOLhqYmCt5FMs5Oeu6eWx+B/EK8gRI5r","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11-next-2023-07-03","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":139171},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\nurn = token \":\" address [ \"?\" params]\ntoken = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress = STRING\nparams = param [ \"&\" params ]\nparam = [ amountparam ]\namountparam = \"amount=\" *digit [ \".\" *digit ]\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n### :factory: IcrcLedgerCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n### :factory: IcrcIndexCanister\n\n#### Constructors\n\n`public`\n\nParameters:\n\n- `id`\n- `service`\n- `certifiedService`\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"9b1784ef4be85c2b1dbbe596ff4dfdeb825d0257","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11-next-2023-07-03_1688343253230_0.8794343605116535","host":"s3://npm-registry-packages"}},"0.0.11":{"name":"@dfinity/ledger","version":"0.0.11","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.11","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c0dcbcfd35b6001b562afdd0c132c30226eea686","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.11.tgz","fileCount":42,"integrity":"sha512-QkjVAeSjXysMwqnIQUhXqE2nT2KxdhdXv2frW5NsAw1fpuFvoRhaCOkTiTmt/X/1llfyjMI1VpKIb9nmhh2zcw==","signatures":[{"sig":"MEUCIDrx5p0+OV3psrBbck0W0D9NVNX0Ieg0jvupWdqeYpP3AiEAmzBa3p92v6eKp4NTDteQK1142gfJX3UwKCXpRVIFwsM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.11","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":140469},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"a9ab75ce2504684c47cc4f55f5e55673ac2b8068","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/agent":"^0.15.4","@dfinity/utils":"^0.0.18","@dfinity/candid":"^0.15.4","@dfinity/principal":"^0.15.4"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.11_1688362273740_0.2625508150467557","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-03":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-03","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-03","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"b0c13681149aab6271677504cd2d82e787508760","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-03.tgz","fileCount":42,"integrity":"sha512-Lp6FYHxuA3qlhemPomQKu8aK2wOMj4wKvRpyn+vBh2glSXE4waLnSxmwHVcdZyYM7lhhstB+BEGdJDIsoke3Uw==","signatures":[{"sig":"MEYCIQD7Ev6K4/qqIcWEGFTTW59b2lYPRbWzje9pyUwOo9JFAwIhAKpWfhkZVnLR3gQUPAFZ8k0q9O/WJ0nkU8v0akqDw8po","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-03","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":140460},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L24)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"a35f65b1270a89f59cb977382c60c1422acc4b2d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-03_1688363390328_0.5330381379267213","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-03.1":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-03.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-03.1","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"34c473da037bb8da37e78dcbd974a5000a571446","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-03.1.tgz","fileCount":42,"integrity":"sha512-4IPiUvsrEggiY2eIpSoQuc/nNJUtvBOGVlT1rLvNN2DGFNxg/ujk3tK1W0qYkJhKBxdIRQNfLge0AWeSIfxI3A==","signatures":[{"sig":"MEYCIQDcIGswmSI9eL/iHb/Eiuxk+eeWiwbKDmOsZi9vQ+vZiAIhAKaC6ndWYaYUiBSVJkfZZAPoh+a8Jac/JksRP05OqRxv","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-03.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":140462},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L24)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"93f718c51cbb5cc4c699bcabd7eee3dabac42811","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-03.1_1688377564386_0.4340652096988342","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-04":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-04","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-04","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f15847899f3a2401dbfdb3adbd3dc3826fb5ae71","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-04.tgz","fileCount":42,"integrity":"sha512-2Ug1Kp/QfD+qGLR/KYxLiypqhZK2y1tUl+B7W/ySqNURgxaTGPZwP0WLoQLCHaNhOaPejwCsYWef67elYPB9Uw==","signatures":[{"sig":"MEUCIGYJgKaR7HZudFE+1sOFnWE6TNTL61VGK7ELY+eihdwbAiEA2xmfjQGT+RbedEzFUfNA46V8E3JOC4mxSiVF0M1Q7PE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-04","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":140460},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L24)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"93f718c51cbb5cc4c699bcabd7eee3dabac42811","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-04_1688429632981_0.1672639380881069","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-05":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-05","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-05","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"058fb0949dc0bca0da628c65dfe175ea9b8fc129","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-05.tgz","fileCount":42,"integrity":"sha512-WbaovRU5Iz7JT+wYvUpTpxubRlcr5qzc3XO0E7jokmQvibIqkLxiBZ/ItNiKy2aTAdhw/e2WxVfgmUxLweAtKg==","signatures":[{"sig":"MEUCIQDleX8uj7eOJh5KWyYHs6URE63CTn8k6CQ1yJeE/N/fogIgbWKrLn/lcv9SubhYvbyYJ/V51K4u0o7zHFGZuHY8sGg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-05","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":140460},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L24)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"93f718c51cbb5cc4c699bcabd7eee3dabac42811","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-05_1688516070753_0.9976414391783128","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-06":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-06","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-06","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"a616f6628c282859f3ecb0e19b7364c06afaa62c","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-06.tgz","fileCount":42,"integrity":"sha512-QLozXWfosM7mIDwf6cHNyWt/5JJLPHa9vxQ2ACa9Q408aGG3cwWKkiqBUztXE75uh/rzUuM3usYUwwDNg1Eo9g==","signatures":[{"sig":"MEYCIQC7BmPJn+9EijGOu7NY0c1rj47MQ8Xf71IZSWt63KwGrQIhAJYJfMeWAKaD77yHoBaRIHqTeA23100SqAPZ5NhMkZQ8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-06","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191356},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L24)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d86055dd1181fe9bc1f5810db4bee4c3a0995811","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-06_1688602452100_0.16181800786624922","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-07":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-07","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-07","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"38551787670963e5f5d0f6d78a3eb878f225af38","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-07.tgz","fileCount":42,"integrity":"sha512-Z3JdWlfQ9LFxYQLThJXLGYXWYKI5yW5g6h0/uYz7ULCLpJiCFAcJSxi7ivzwR1DfFIVu9cZHfxI6k3Scf795vw==","signatures":[{"sig":"MEYCIQDjoMciJ2EFpe3YwTDReVOkbE189gBBgoGkiRnetq6BlwIhAPEBkZneew3XOgYL92FWebN5f192FfEXVXHWbGLgRdw+","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-07","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191356},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/55/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R238\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/pull/98\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L24)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"4eb189722c6e4052edef3ecd98e23d6330240e0b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-07_1688688856075_0.1922925160950999","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-08":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-08","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-08","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"410ba59372e0a2f4319b6fd3b27a330e9a8a594d","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-08.tgz","fileCount":42,"integrity":"sha512-PABY01khHHNhMCx8Sa5YseWh4XoxJTx7LX2W9lrJ9QtxSuECl8uGJoI3UuRkzSToV6f2t/xRNVCcpMa0J7nNkg==","signatures":[{"sig":"MEYCIQDprqKFp7wmTIx1hkivt8VVfwv7tka2Fws1OhCE/x3IAQIhAK0DsBoKWtVpoiqfLk56zq9zU3OY7gzAEs9OVvHOUeH1","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-08","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191340},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L24)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"95e1eee44995a8a9981473a9061326b8f2d9a64c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-08_1688775303640_0.7766220840073814","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-09":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-09","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-09","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"a49f89134c77b99208d07cc93a6406cc7ba985b8","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-09.tgz","fileCount":42,"integrity":"sha512-B7K4YzFhQj1/zS0tIdWYro2SyCWmOHhStX2qZAlFAA6aWDNUykAGtTjk3yskXbOj8ZbNcVMxbYivk2C/tPZUDA==","signatures":[{"sig":"MEUCIFcaLoCB5ERuE6C2Z2Ne83/zU4DGnZ/DGfNansKHO0ofAiEA+ucx6JHO67d325GARMP1SBKB3AaZUD0o4X5E/QH/+KM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-09","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191340},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L24)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"95e1eee44995a8a9981473a9061326b8f2d9a64c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-09_1688861714932_0.013362090075236033","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-10":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-10","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-10","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c2fb7a6cc554681a8da9fcfc8539dcbd19e4c8f8","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-10.tgz","fileCount":42,"integrity":"sha512-1O8j91w/Isklm1/EHUFlwSsml4iiX8BQklZtxeVthoh4AUIB6bAsNMVcsv74rWMuV607WLWTFZcvXzXiKJmQOw==","signatures":[{"sig":"MEUCIQDqPrQfyUyxS56NMJh0RBo2gESjVSsV2ICM1W7jtT5XbwIgePeciEYwsoS+WzF/M6g894cm+nML+oETPfeftBRnsx4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-10","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191340},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L24)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"95e1eee44995a8a9981473a9061326b8f2d9a64c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-10_1688948077614_0.011192140687797725","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-11":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-11","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-11","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"985b3f1f760ce85c0f61ff481f31779e6c5ceb21","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-11.tgz","fileCount":42,"integrity":"sha512-kMb6gz0QpbIW//GQsTbX4NYp24RNUXn4VuAFcZHpRbvQKKK+XToDJrB9S8idThPKuQIS6G5WzMf/0FXHiv1sGA==","signatures":[{"sig":"MEQCIGgF/VQnx28pE9/dNYFPaF/nXxHUoidLbomOqkOHjKweAiAQX7E+7yk+v2jNQmjIiqXDBmLYgNrHz9v+CL8L563D7w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-11","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191340},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L24)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"95e1eee44995a8a9981473a9061326b8f2d9a64c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-11_1689034513940_0.3305056674062672","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-12":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-12","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-12","maintainers":[{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"083c4dec39126558e97b2d6105dad91edcfad5b2","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-12.tgz","fileCount":42,"integrity":"sha512-DDeSMvTkoYUl8x+l2hd/7zIM0ruZDin67F/l96JHwlomqUp0cy4gPi0ARjszYxUvJhINTOAcwiJypUh2iPGHpQ==","signatures":[{"sig":"MEUCIBgwTLsLriG8vqhW4R3d4ybTwzNADqCUzcnOysuFnZD9AiEAnKVSBGBeI+b6L2P0XNtzHfXYGn2UOgt2eP4NIFMbYog=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-12","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191340},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L24)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"95e1eee44995a8a9981473a9061326b8f2d9a64c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-12_1689120916286_0.5416944295001793","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-13":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-13","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-13","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"0e7fe584a95549e3c84e8cb230620859b34a5da8","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-13.tgz","fileCount":42,"integrity":"sha512-31d4TKKZu5zkDWtlqM+OoQRzLlc1EwMFGeqEFh/Wv5FqvzCerX+70gy5+EV64ewFtLsW+hQEVIXjo5HSg9fHWQ==","signatures":[{"sig":"MEUCIQDA6KJOO0RbVDqbMnhCsbzn9E38F0+co1TGB7VVzfzQwQIgA+7yF2ptOipDBBgqdYiwMiaTj174foSiN7q160icQEs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-13","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191340},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L24)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"95e1eee44995a8a9981473a9061326b8f2d9a64c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-13_1689207304232_0.1791879629072819","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-14":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-14","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-14","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"anthony_dfinity","email":"anthony@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"1228e146d7ece71e0336e63e9a269d2c74a500d8","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-14.tgz","fileCount":42,"integrity":"sha512-w/XHWTkZBEFRCr2CU2mkh0lW+fGH9XaqZPaY3AoXi0YKaBd+WKLfsxolanlwbkUoGFYjNlPDoU5MFbkJppROqg==","signatures":[{"sig":"MEUCIQDtieHoYbY8FQyfmLSodXOh/gHYsWSCKuw+9aO1FRHt8wIgEl1KjeTeE3Unq5YR88tBcpy7x2vg11g9jcRSHeiF5i8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-14","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191340},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L24)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"95e1eee44995a8a9981473a9061326b8f2d9a64c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-14_1689293665961_0.4630182937843328","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-15":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-15","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-15","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"df2a7bba7e29efb9c1f5ea3ac263802a58f5205c","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-15.tgz","fileCount":42,"integrity":"sha512-dXXPyRSHqhSd30cwvMN5xLcoXmzSqf443CCTmRoE+tMje/QDFRPRHU0d9tXpz8RnktfBSn2mLoaC1mV1pSj+xw==","signatures":[{"sig":"MEQCIFabifYkQ+DbkdZRgdvxSi1iPyORkuvvBMLVJNZEFKabAiAiGkiBWLgcXVA/XEGx3J0Z31cD4RCdzqEPfamQqoxnzQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-15","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191883},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"499bb100876c8bae624a6a96dd67cae7bc1d9668","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-15_1689380045102_0.4883364214615318","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-16":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-16","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-16","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f0de0d61261aec4667d42c6a7cf1b78393225105","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-16.tgz","fileCount":42,"integrity":"sha512-1Og17P6JXdB2K6D4cFfnJm/VbRm5p42WFxv6w7R6y77CYwoqj2qzjjJzRtzz5H8ULTmjkvDsrKYo3XcQe/5kEQ==","signatures":[{"sig":"MEYCIQCgtYtZKJZGRpB48FLvx56Vgp/eFbznEGe7dUbCmrHqEgIhAJlyQaxh9hYqIpiJZvqT9RKxxMXfqyfQw4qV/wmRyxWa","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-16","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191883},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"499bb100876c8bae624a6a96dd67cae7bc1d9668","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-16_1689466649834_0.2181677030325626","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-17":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-17","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-17","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"05569d8852581daca4b1fb10bd85a3e0adadf580","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-17.tgz","fileCount":42,"integrity":"sha512-DiYLt9ybboSAGsdQBL/1TkBdiQb/8dYiWmmrM55tOg9b+7O5k+Lu2U77+uyVKeI0tvRuP2TLedNySgxzIlkNbg==","signatures":[{"sig":"MEYCIQCQWxZxriDh4uF2z9TjWatn64wcTsn7dPA14UfZir+y7QIhANI9VJzo7JIk9Q5bDaxbFXe5Tz7BB81wpWS/CuW54m/v","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-17","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191883},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"499bb100876c8bae624a6a96dd67cae7bc1d9668","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-17_1689552887270_0.4631801780476472","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-18":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-18","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-18","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"fa51eed679a2cd7c31a00ddc4fee036e06d7d7a3","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-18.tgz","fileCount":42,"integrity":"sha512-tHZQQ0GjOM4g9q+EG1NZUiWASPjYKyrY/v7UmTJErj0Hnpbb0EeG4K802KQiuLxcSU/9xGN9MHT6puX7K8UnvA==","signatures":[{"sig":"MEQCIAWApLCwsGz/5XOx1LhAYmAXQVBce3m7llDd9Srmc8pEAiBfplf0H7sZeLCM2BtW5NvLk3e44yrTT/3ng6Cu0CV4IA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-18","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191883},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"499bb100876c8bae624a6a96dd67cae7bc1d9668","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-18_1689639518362_0.8904495062253794","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-19":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-19","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-19","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"78e2f5ccd32b6d5fb15a7548394c7e40a4512494","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-19.tgz","fileCount":42,"integrity":"sha512-J1rotBP5QI5iuBzt8F9gcjM0VbpM3RHDWyf6ZDqtfom0ozecpohiPVRyuPcc9Zn7RqjGpwVfaLftpBza3yutlw==","signatures":[{"sig":"MEUCIDvWs0nLoz7DUkSlPK02v74gocCKahRXBKNaTATqwzceAiEA9eTKDxlK4UOq6fDPmegwu15xW9l4K+TXNGjquJgFhTY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-19","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191883},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"499bb100876c8bae624a6a96dd67cae7bc1d9668","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-19_1689725880702_0.10852197248319584","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-20":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-20","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-20","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"2d677ecbe644c90ecbc1d07db3fb289389d4ccc5","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-20.tgz","fileCount":42,"integrity":"sha512-ULI57+7BuJZEqG0TNiPgYRytuwY9rSOmTANbAGHCAAcqVGBb7/50+qRwlc4996c7G0iej8H72XFMvgP6vFEmPg==","signatures":[{"sig":"MEUCIEXowAq1sMssMLeOKElQNP/s+TjQyR5LAmM6knYw7D+PAiEAogLeb6kLk2ZN9p7MKbo0XTY6hztok+48Q93k/gStbc4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-20","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"90e8d0110529ffeba3341f8fba9fbb5059ffea94","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-20_1689811978346_0.5545079813003295","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-21":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-21","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-21","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f59b7cab16c554faf98beb9a91680ddce1c46fd6","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-21.tgz","fileCount":42,"integrity":"sha512-DtWh0TeNuaNX1HeEcMH2RTyzPbTpLgRyQxN4r1cmLKC6XCeLyNyvlP79wYUUyGT5uDx2uyaEUosywx0PRT1vRw==","signatures":[{"sig":"MEQCIFuPsAk5pBUbrl9FEHPxy2G1CLnLVZMd13OSrIM3sE3vAiBCNfhP+wucFeaagS6Xs9e5qj4yRBSVeDSneZ5WR9KS9A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-21","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"90e8d0110529ffeba3341f8fba9fbb5059ffea94","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-21_1689898371447_0.5269138737307884","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-22":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-22","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-22","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"6d0f48dccd05745ae8d32e481b4fa14cd7c2b2cd","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-22.tgz","fileCount":42,"integrity":"sha512-XOnb9VTgR95jTi7OOtPVk9T3kbj18hZy9VA4zr/WYKUrVIeVBibMId7mn3zetuulUSzJOdlnmOKeBTrn6rV3Wg==","signatures":[{"sig":"MEQCIBDQEsrMc0X3UtkX4UDIQYP/k+VbluJoIjT4CGiH8XJOAiAiTceTkqJ0jKAZlokO7YzQyoO0P3Qv3iWv34MLJagLCg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-22","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"90e8d0110529ffeba3341f8fba9fbb5059ffea94","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-22_1689984737913_0.7859755685532785","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-23":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-23","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-23","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"602733170962d14f4506b31b3b63c145ba164443","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-23.tgz","fileCount":42,"integrity":"sha512-eyD+j76OOJsTHoSxEOXfwHzLMTl3Xk1BSr8WpddQ3cVlmy93uaUSvI1d+vU2glkmOIEa/s11Uc9wrM4z7jLHMA==","signatures":[{"sig":"MEUCIQCN7LgJ1Hv2njTVgL0aaTNVvMqmz+9Gww1D8qFFj/WD4gIgYfSdg0Yd9PLEU2wB9+Hu5/QEZ+xfeA5DJRVuW28LH8E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-23","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"90e8d0110529ffeba3341f8fba9fbb5059ffea94","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-23_1690071201300_0.4389295515184253","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-24":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-24","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-24","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"276a30d9988f8e6f8e364ceb3b9cdcb5e62fc1c6","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-24.tgz","fileCount":42,"integrity":"sha512-2JTxTtFGYAQu7uWerzXDeT2rP3BkzcyHkrwg+cT7k08OhYqAfom/41rd4srQzU7SIwWTelGTXqbne3/d089c2g==","signatures":[{"sig":"MEQCIGtotvHmhm7t5SVWeQWfmycLgJuRlBkkmvx5MgDOhcqwAiBFf+Ynq78br1HgG6WWlXUxap0TGrwR1bTk7XeUwbLiXg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-24","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"90e8d0110529ffeba3341f8fba9fbb5059ffea94","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-24_1690157599578_0.2550120372124136","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-24.1":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-24.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-24.1","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"8335785fc4eea6f3a5ee75d1be6f53e5f04237f7","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-24.1.tgz","fileCount":42,"integrity":"sha512-8cS02K/N3mQANPhRbagwWo7o9XrLiIc2bVcSa6XTiyCj3K11YtJ+C3QisVPtRZOdeLEVK8cLtJmdGhimevuOWw==","signatures":[{"sig":"MEQCIA5X8bdIb+CkQkRNeXZfdcg2rmnyeNNvABlmXDHvF3H5AiBoKTWlIxrs+RE2r+S1oHh5ugGf2xwDHScnJnTZ6m9C7g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-24.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191903},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"affe5ea2dada46de60364ae3baf3c6cdbde1c78b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-24.1_1690202738058_0.8727308621342982","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-25":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-25","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-25","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"4f2d4539a705269046021381b6dddaeda4922393","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-25.tgz","fileCount":42,"integrity":"sha512-PNbW3j4ntOzOneSzJjCrj+0XLoCxsNEAGbDOUN8PnFPH5nW38el+5E+N8mynm10BPcMR1DIK/FfXQwMJ9f9ZwA==","signatures":[{"sig":"MEQCIAy2VX0aARHxOdN509cmkwCjfzumfEdf1pd2IQ7x/Q8zAiBv8uMD7mxzQ9LwqVblGGzDfVFWlYD2nSnwmjA4dxeSBw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-25","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"affe5ea2dada46de60364ae3baf3c6cdbde1c78b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-25_1690244009559_0.24176905112912705","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-26":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-26","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-26","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"fb7ce774af590cbaa9914a5b0a723d161c426dc0","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-26.tgz","fileCount":42,"integrity":"sha512-Ed9JoLhlRpQ09K485UM0Rjy3qxmHSgIJi1tJXg1vjvjpn+7EUlW6sPSGaAFIORH86NILrxszrZDDxxK5GB070A==","signatures":[{"sig":"MEUCIQCPTrlSm7Ys9+6THPXflepGOquEP2e7tiT0TqR7m/MLnAIgUu4LNdAQ2BTXAaH6n9VDtoW0fy868VkUEA6cxoQ95F8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-26","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"affe5ea2dada46de60364ae3baf3c6cdbde1c78b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.5.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-26_1690330359599_0.2382589239431594","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-27":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-27","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-27","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"5d5439c7c803ccc9117a03d162a9a05424b249b3","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-27.tgz","fileCount":42,"integrity":"sha512-tEsGHnfQHk6UKD79stKb6Ui/P5oera82UWK/zqh15mqfRxxp7TAW24RGgbVcnoENNZIFc5CGgkitaAmkTCJK0g==","signatures":[{"sig":"MEUCIQDPDoIh4uGC2Uor0rwahgNIJrpnQHOGRQ0tLDMLvGF2lAIgc+KiIg+SXhyL6LpeDmbzn/afse1djCSixgfCJug9Fsw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-27","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"affe5ea2dada46de60364ae3baf3c6cdbde1c78b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-27_1690416693498_0.5865235740846948","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-28":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-28","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-28","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c978819a16c12e579e9cf2e21cb336ef5b27183e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-28.tgz","fileCount":42,"integrity":"sha512-XMpycDuyYgDF5fCA9DIfLuH6SXY47wgfVzPJaV0/S9E1rmsCm5bHwY2ayDBN5xnceuKb5p2DuOCnUKhnBIfTRA==","signatures":[{"sig":"MEYCIQC8aSH3GomNObwnhI/CxMfRjhQt+z6O48QIKVSA96iw7AIhAIPryBxvH1sPFsZtfzu/eQR4jDUDV9zQNQwh1CbqYWGl","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-28","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"affe5ea2dada46de60364ae3baf3c6cdbde1c78b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-28_1690503151749_0.09303599817521668","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-29":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-29","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-29","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d9926c1b171e146633c7b3f1ea64f7374586428c","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-29.tgz","fileCount":42,"integrity":"sha512-NND2MrGpv6DELkByszjw2yYVASu88T1b8PJKuyrPGjgioVEj/dsW0NNmDHn42sdjCbfUR9loPSWtsFrtrpxlIw==","signatures":[{"sig":"MEYCIQDiMnXIREDIq/koV7gYgWqD1bCq8Fn96XMDPA18d1ZIawIhAP49r9V/nBQ9Z/q4xkfkfr7BCLqBam70aRdu4LMOyKMZ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-29","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"affe5ea2dada46de60364ae3baf3c6cdbde1c78b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-29_1690589539905_0.8477704811660922","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-30":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-30","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-30","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"dde339eba1d726ceb615fabf5192f45bb1f53943","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-30.tgz","fileCount":42,"integrity":"sha512-9P8yn3JTp1rK/jOvitV7zXkelf1WIaeTAVvzvd/SoSgtc2JxerxIm0qHqLi3TGrn8vXAHFwoXDOZ0ANpamBT0g==","signatures":[{"sig":"MEYCIQCFtyz8HIVidjxFidaoloyUmJFx3Aa9vXegMicXoV6XKAIhALTIn1D1nARwFyryPvI/70j+nNf45OQZc0S1+yjQ9lDV","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-30","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"affe5ea2dada46de60364ae3baf3c6cdbde1c78b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-30_1690676006215_0.5996278318184121","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-07-31":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-07-31","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-07-31","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"6c48b56e9cf1a4b31cedd340e0ea27c2b3da257e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-07-31.tgz","fileCount":42,"integrity":"sha512-X5uGav+2TarEWE7XHNn/Vhtbhmye6rCAU0Mxgq1DoXpXAny8ijWTE+qnSZwwlLvn78hLsTyBTOA62qtJzO5kxQ==","signatures":[{"sig":"MEYCIQCmfj9JTF9QQ9UfoCQpJsat35cy55Hjsyf9b7Qk9hXkPQIhAPbZF9fASPsUUB9NNyol1WrYFA2R7EgyUZu4zqYm9p6e","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-07-31","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"affe5ea2dada46de60364ae3baf3c6cdbde1c78b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-07-31_1690762345644_0.9570867196386106","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-08-01":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-08-01","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-08-01","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"52aa9ff571876cae630c31b7720b959b9834efbd","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-08-01.tgz","fileCount":42,"integrity":"sha512-S6BomwZhiIqrcHZ8tnq4AnkZHkhaTLF8Vk0bpnPxaEduioUl03Vjgq1BwPczh0IG1iYec28HPV3fibGIPdLoCA==","signatures":[{"sig":"MEUCIQCgUkTBUnS4ulSfFlz8fSGbBOqmHDPGC+DwHIokGS8StwIgC7VdQ80u98yxZTd76VqDQ0+9li0h68CBGaXIDJvaCgY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-08-01","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"affe5ea2dada46de60364ae3baf3c6cdbde1c78b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-08-01_1690848862810_0.33858250971470927","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-08-02":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-08-02","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-08-02","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"8055ffebf8884a51291bc6ff06ede3c0b45822c5","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-08-02.tgz","fileCount":42,"integrity":"sha512-WSSl7Jxwj+bgCTcBPeYq/LBhJr0BkBSdntGVtwswvua6b7TjMUm37jIvA2j8m14nfS+RG7+QmZognEI8Hv8lWg==","signatures":[{"sig":"MEQCIBYbXWWk/swCUpiWRw5geo/URV3RJusUm2OE1ZctOStHAiBF+eMHXV5Gewx/Qrn4un0Uh/jfZ/q7EOQT9EAXNLo67w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-08-02","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"affe5ea2dada46de60364ae3baf3c6cdbde1c78b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-08-02_1690935155895_0.9871161479704509","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-08-02.1":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-08-02.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-08-02.1","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"9b84cfd9a18fa479196757218feea74aa73d0d42","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-08-02.1.tgz","fileCount":42,"integrity":"sha512-JLPOSfRGLGPO3sdNXnF5ndFSa8BQLAkqtD3fG1WXZVLWaPRIusOuLt5vG9gN8UlzRmkhj43cCUIVm6yMHLwY8A==","signatures":[{"sig":"MEUCIQDu8S+5tjuQwIXNhRvjsNzsOB96KvhzKWj4xSCzea3RZwIgAQXSuZ148WtZz7r/xJwvPJQ1utGB1EbPVSy0LFeYbMo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-08-02.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191903},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0697cdc3469a303b0eb89763a0e71419f0753906","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-08-02.1_1690965286477_0.17593789185733688","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-08-03":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-08-03","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-08-03","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c5d8472636f5a0ded84cb8c825e2fb36039b45e5","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-08-03.tgz","fileCount":42,"integrity":"sha512-J/ir/0otEjQfzDbvWjaBq5UvTK2M9EVQEhqvR1fARsduyC+j7gR/WM1s4oFbhCgVEE/03AUfTO/QUgxNaUOlWw==","signatures":[{"sig":"MEYCIQClj4NObfZagtWDQRGKtR7givUz179jB6aZjxCM2cCqPgIhAJNJkV161vPFg/EusAcHhCy8b+pCc7R4MYHFsYOGQme5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-08-03","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"1be050b123eb9d0be623f9a9267983d5666c9ee5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-08-03_1691021588799_0.40707012879999205","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-08-04":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-08-04","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-08-04","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"2a3673dbd730d8a7f517ce8f9ab967713b1e03b4","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-08-04.tgz","fileCount":42,"integrity":"sha512-SoeaIHOdz39CtT9JAnAl602sn87JrfXwMPsnXKbVtClIvznZ4LivvvbRUkflPvn0YUouE0wQtYcubB672pyfEA==","signatures":[{"sig":"MEYCIQDwvahUgck//3sWFlqIGz+FOSeM1syivH810uFgLrjqYAIhAJp7KqGCkGMG8ZQLYWmrynEaC6f0c4tAv4J/E5lMPtDW","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-08-04","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"1be050b123eb9d0be623f9a9267983d5666c9ee5","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-08-04_1691107984236_0.6815319976547003","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-08-04.1":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-08-04.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-08-04.1","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d799d2dc3323d8bd4ba75c02a6d0528c0e55b357","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-08-04.1.tgz","fileCount":42,"integrity":"sha512-ZyL1+hrGHI1kd4olqkByL7FyLFC7NhYsdgRT0YFtz3bNkeacTJB7u47Hflruwg/j6cv47yu8cvW8M+2d992cow==","signatures":[{"sig":"MEUCIGUGDdyyCTfjGvMAxON5Ojf2qx6FmHfT3v9JXdC7b3foAiEAy3PwbpT6A3MrdyQyRz5eEpX/m5aUZO2kctY5kBy/BpY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-08-04.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191903},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"cd62540f359aa17ebee41046728a3c1427f04e8d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-08-04.1_1691141934857_0.21421303290729776","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-08-05":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-08-05","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-08-05","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"12839e2de1547dfb3b24b89d94d42eb099f83bc8","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-08-05.tgz","fileCount":42,"integrity":"sha512-J+z6O59B+xe+oJpU112IqpGZ11Kup2nxpMoA0xIMgSniNqwd1cpQE/RxHzLlGRdiuYcEfbEGfgSSLhY+HdKLKg==","signatures":[{"sig":"MEUCIH+5sJhJk/ksokBVt7E2EbWjTiEXr2qzPNK4DCK313NqAiEAtQ11pmGOGZqJgUUe6W6sAPS698DdiJnHvDqo3hWkfQc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-08-05","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"cd62540f359aa17ebee41046728a3c1427f04e8d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-08-05_1691194367902_0.39026392426123335","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-08-06":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-08-06","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-08-06","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"5ac8b3d0a32e1e4a4036e753371a903eedf394bf","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-08-06.tgz","fileCount":42,"integrity":"sha512-ddzuGkO0A30SM0b3rurAqbfT69kSJ6rRqAZ94lbndwCNEFdNMOtir51E3L2hr0pfJm4QH7JEfhtPxEmHDPbO1A==","signatures":[{"sig":"MEQCIA6+w2kinlyXdxVMkvt3paG7qF3SaWJKt9B/rluCYaW3AiAbv2j0qz5RThIhRPb5Afii9a+yKbj3lIONMcJi1kaK+A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-08-06","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"cd62540f359aa17ebee41046728a3c1427f04e8d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-08-06_1691280744416_0.5673599462623364","host":"s3://npm-registry-packages"}},"0.0.12-next-2023-08-07":{"name":"@dfinity/ledger","version":"0.0.12-next-2023-08-07","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12-next-2023-08-07","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"bebecfebd0f59cea9241a5afb2c34e3959f6bfd0","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12-next-2023-08-07.tgz","fileCount":42,"integrity":"sha512-j3aermAEDywsFG5CD0YpH9AEVzyTWMzR69gHw2MVRfFB9SmSbOnfEWVYsies+gqbB5OtDOZO4TSJU9sO2twE5g==","signatures":[{"sig":"MEUCIHvYRGlbby2kAikXCo3THlrcpWk6Sfo71iw6vxrrU/jCAiEA8fV7BQM32bypdqqvSXmpBcg0spQof+SpTIvqNtGoHzM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12-next-2023-08-07","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"cd62540f359aa17ebee41046728a3c1427f04e8d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12-next-2023-08-07_1691367180239_0.29097704781169154","host":"s3://npm-registry-packages"}},"0.0.12":{"name":"@dfinity/ledger","version":"0.0.12","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.12","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"2df36603051e8dfd020b017e4a54bdef484ba2d8","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.12.tgz","fileCount":42,"integrity":"sha512-HoSY28+V3brYqqo81eebv7YtSf4In7LGGBOFSzfphI0Ma8sCDlaOhSN7YoORATW5LFWAGM0h9hWDJDWYk3crNw==","signatures":[{"sig":"MEUCIAio8wz73nwmglpdyTQGEiAkdbCUKaxnuX16fw4AxtKNAiEAuXXRg68vBZiYAUjGUdS6w/j1KZuFV5srTxGdk4+u7yo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.12","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191910},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"cd62540f359aa17ebee41046728a3c1427f04e8d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/agent":"^0.18.1","@dfinity/utils":"^0.0.19","@dfinity/candid":"^0.18.1","@dfinity/principal":"^0.18.1"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.12_1691384281657_0.14713797804009876","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-07":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-07","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-07","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"5744b478107cf458449a80f073a477202b8a3032","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-07.tgz","fileCount":42,"integrity":"sha512-lXlAvpGTWyvYDsCEZZjYhXnb8jwtqyUta+I+Ax/Z7/OD+grlN4iMFEXyNt9acy+2vrCYT/Wvh8X+lbXjf0EMHQ==","signatures":[{"sig":"MEQCIFW/GMtUozl9c0M0gwoImZ7MIrqYuJ41W4cxfFEphBVvAiBX6N13cQ52d11VbShRGIQdwrjM6mNYzew4j4o5N1h42Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-07","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"5398e8a1e0435a9afa26d3c294c13520f775cde6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-07_1691389465044_0.2674326322418985","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-08":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-08","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-08","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"41a147bb1e4ca898c11f44f74fded1ae7fdad254","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-08.tgz","fileCount":42,"integrity":"sha512-C7Vo3tfHFIhYrR+wiG65YJ971LO8oFEpkMHWl643qm/7CqRxerDjrECg/1+7DXkim5la2ED+eeccFhP10X2DaA==","signatures":[{"sig":"MEQCIDk0jcKo7QbA65I6+E2JB/R2Ocyxc+I0iqrPkNalQNieAiATNB3FkHeYmuFIWWV38ex/PTJpyFtMTYcGx5djNZHUNg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-08","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"5398e8a1e0435a9afa26d3c294c13520f775cde6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-08_1691453540175_0.9273446892963304","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-09":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-09","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-09","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"63467bfe49f4dc73aa0277698af4a66a9c4c86b8","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-09.tgz","fileCount":42,"integrity":"sha512-ifOE7Lbrybq1AqiY27oHZgkK5FVGRri7QWzP8DkwWL03W15YkA0xq3/pJyC6EUET4xj0uDIhDQNWFutes/sP1Q==","signatures":[{"sig":"MEUCIChYcKJ5QCvtUHDmzdEBIuS5mn+r8o0hJLmGI1ctuLMaAiEAqL/LXcr+TgMvun8w7s95TU3DOJGHHOn7lSV6C++hGu8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-09","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"223d9da352c20aedbeed76c61ef60cf9b800778c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-09_1691565961120_0.5772264869896266","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-10":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-10","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-10","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"2090c4a3ecd8ce5954d89d780b35a8ed96f22222","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-10.tgz","fileCount":42,"integrity":"sha512-m8uWXvcyHWF5iI6vuoKxdchLCZST2wxY53e21f9xQyBUJnIPyuKoU33Vna0ChaHzB9rlZ/DVC8TwHsOADAJ87w==","signatures":[{"sig":"MEQCIAs7gSK3DqvSkrz4kKlcf3pKpwa1MrMKIq3GPFammhxCAiA/AOl4ERoHdWJmWITzKCXjSf9kpp2wKm8xj6jOQvrvLA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-10","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"223d9da352c20aedbeed76c61ef60cf9b800778c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-10_1691626368404_0.9930894451472647","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-11":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-11","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-11","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f59a17420af0a0fc98dc2dcc3ffaa8be4c90f7f7","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-11.tgz","fileCount":42,"integrity":"sha512-qTz0r4Pd1TAmA+NOChIx4Ey7R+7OSPsw8dWWM6obab6nbEwE7mf1Jb2k+6X+Zu8spyEwyWfOMAxlH/+n555DPQ==","signatures":[{"sig":"MEUCIB788vD4dhhTjVBeKvOzcpUCzYUcgJC5u6QZwezRhSl0AiEAqEaKqriKPvYTtlFEqioK+Kufd1RbVXMKleJ+w43FXI8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-11","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"223d9da352c20aedbeed76c61ef60cf9b800778c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-11_1691712672821_0.9297794160269037","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-12":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-12","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-12","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"5c845e1ae446ea69cfd707c57d89d677694fbeb0","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-12.tgz","fileCount":42,"integrity":"sha512-jRCKyPnFYzBev7tz4+B7CMxPIzQ0WA9FgqXdxQQfa7WweKWCcHgo4ciS3lKDaDr0mRehvwMSSQ+4xNa2lJulWw==","signatures":[{"sig":"MEUCIDV3mGY47JVNCPcZF9/A2u579ez42Xfn0eN9x1JQqHj0AiEAo4Wa+BTQjM+rvhFhtbMEBoUU5b0Pcw2//rbesASGlJo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-12","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"223d9da352c20aedbeed76c61ef60cf9b800778c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-12_1691799024150_0.14275442905766722","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-13":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-13","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-13","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"432cf95f6f64cf3f19aad75c9a78207a8bc820a1","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-13.tgz","fileCount":42,"integrity":"sha512-wgjjMC9F8iSBTvB6guDd2wpMK17e6lQyc5vcQm2HP03c7dEPktTlBaaopeF2cDqLf7iLVGVcOgEDSD072JO5/Q==","signatures":[{"sig":"MEQCIFvv/wg9Hts9KMA/mouwuR+Q18qYwe/kxn73VGOokjzLAiBu+FA+VWfcLnsVR5iTlSM0wSbzqWHaNqtIbzmkbKvdrA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-13","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"223d9da352c20aedbeed76c61ef60cf9b800778c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-13_1691885481026_0.2622712800653699","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-14":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-14","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-14","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"b3403166b311a118db7185447340ada7f268800f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-14.tgz","fileCount":42,"integrity":"sha512-/D8wHotG4jg1SsuF30Bf2lHC/wVMze725LkOVyuUqIud2AKML+uDQ6E+e4KumqNVtedPaEpEW2HP/vMMvsIu9A==","signatures":[{"sig":"MEYCIQDTA3p2BOAMTzOK/KlS0FCQpX+vP3vkzAW4/0ph+d6oEAIhAKj/Gvbp1lIQN06lbChqhTxaT+SHVmdA3nB8Kk5+nSxE","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-14","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"223d9da352c20aedbeed76c61ef60cf9b800778c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-14_1691971875738_0.49399924037985543","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-14.1":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-14.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-14.1","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"5d7001433afa3cade9a091709b02d4176e5d324a","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-14.1.tgz","fileCount":42,"integrity":"sha512-3Gt8yTdviAlzS69M1tpvC1f71TKtEnIS8S6xSjk0BNzfYc0WxliQvh1QBmbLD4kxsGEqdYw8eZPy1+UYkADc+A==","signatures":[{"sig":"MEQCIDJlMmh2uS2BXab4tLXHBVonfu360hJA5AeRjs1DfXsOAiA2VwEOP2FmJgdjvmXDfYk7X9h4Npo4nhEZoNkudduYtA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-14.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191903},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"e5679f7f7773ed7e389ee8488c765e0ad7490fdc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-14.1_1691990945502_0.21758310810218617","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-15":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-15","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-15","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"4cf8f8d60ca55bf82e7d3a2f660417e5fa770f77","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-15.tgz","fileCount":42,"integrity":"sha512-0yRoLqpoXXSUycDPA/1lxC+Jnp8+wejK//p4pqICJLFO2B56zclSMEBkmTqRihE55+MY4UDZK/ZDf+qlSjUayg==","signatures":[{"sig":"MEUCICy/6lI6EZARYLP6ZFz1uYL3I940npZwhfVtTNXorpOxAiEA8BbJDEC2pz1G8p7pNgD1z71IvcykiyjLBNFzBTeKUcg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-15","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"e5679f7f7773ed7e389ee8488c765e0ad7490fdc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-15_1692058270467_0.7149844549394981","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-16":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-16","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-16","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"40caf28378f7c55ef1c44d2e0b1c94bbcf1b4104","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-16.tgz","fileCount":42,"integrity":"sha512-2SBht7x3pov99pfw4Vaz/LRBxGG4w+gGHj7b+LbNFM1N5SiMG/V0j9kMYMrJHDxHcyLIBsfAcijmgPgAWPD7Cw==","signatures":[{"sig":"MEUCIGvqRSotdT91KVx1N+QNcW7NHG8iJQJacU+5D36/a9Q1AiEAmxvT/BTFlouWMx72bLzmqQuoDX7hLMVD7ePqUx1y5/Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-16","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"e5679f7f7773ed7e389ee8488c765e0ad7490fdc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-16_1692144651304_0.42197591345071417","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-17":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-17","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-17","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c5fee38d91c92a7ac8e42092acce42dd5ef27947","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-17.tgz","fileCount":42,"integrity":"sha512-+mXf9KnY7uJsS63cK4OMrfxiIhjhSQiL8tfoO/cO3+fKTZfD2FAxKFEcQv1X7xs0d+6fei/VVP9ewxePLHJpSg==","signatures":[{"sig":"MEUCIGInMHLtFZgiqDYapjtrNurBxuztaMhY5VZBU98Zo4SnAiEAzFxoudRD2LnVIs0tbr83d6JObHlH5HDl0aiI+zUPQfE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-17","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"e5679f7f7773ed7e389ee8488c765e0ad7490fdc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-17_1692231045198_0.6082289090611464","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-18":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-18","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-18","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"7bcf2caac5e2c90e535cff75a1c654e31f7f9486","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-18.tgz","fileCount":42,"integrity":"sha512-acS5c24ODK7msC6ebxerIHMRp7NFvqREaqhfZomcpfz7MqzlusQAU1D8zeAnz/6ogdD7KMe7z2nAevVSx6YAWw==","signatures":[{"sig":"MEYCIQD09T03OO0KLpY0iSUQTty2dRgOxqBP3H0tcjMnQ8D0PgIhAKeLRyfNB8h735GRXzeEij7sQn8z3O+AV9UPXLylmz0r","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-18","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"e5679f7f7773ed7e389ee8488c765e0ad7490fdc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-18_1692317445171_0.5011103638542886","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-19":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-19","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-19","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"60d9bf477c90fe1dce0430c6c916eb92e7eb69d5","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-19.tgz","fileCount":42,"integrity":"sha512-G9VXDyEYjbiV5j4VsFM/PjBkf9DW4tjGaW014uHG0UXxGbS3NhHiZ8+HxbtxLuAulEvYwCbl+aYhThemVgsl5A==","signatures":[{"sig":"MEYCIQDfKlj1GblcNKRUP91l8WoiGr/+HCY71MxUcfIXHt4kuAIhAJvaVSAsqTqx1mPel8io2RuTzx9gW+PjV0fgfHhR0l1F","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-19","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"e5679f7f7773ed7e389ee8488c765e0ad7490fdc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-19_1692403838612_0.19929721974356718","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-20":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-20","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-20","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"dd3b0d5fed11081443ad3ef7ba7c38c75f287119","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-20.tgz","fileCount":42,"integrity":"sha512-t5BSscCroAKEe8xfGRd8Z1+nRky4/I/VtRC65eFYTYl1FqcFLkcheSX/NJPOtAFPRdlBB891VzyNXJBcc5jFZQ==","signatures":[{"sig":"MEUCIAZJDp4lmTNwZIi5e4mICknOs84cMCuKlD/VeFSKlklPAiEAwiudW0zcNej1z1s5YN46a/ohdn872dKXQJ7KGlewU8Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-20","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"e5679f7f7773ed7e389ee8488c765e0ad7490fdc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-20_1692490285239_0.8267899297702983","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-21":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-21","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-21","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"439f252d11de0da54462d9c0e95c25458668d83f","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-21.tgz","fileCount":42,"integrity":"sha512-ppB80uLx4PlQPWi7CMP4f3F/Thl+JRfh0nAMXbtExAKraLCMjwteydZz5k4Z694IASJlpLl6S7F8fs1Bf073oQ==","signatures":[{"sig":"MEQCIAK4l4jTt5G0KUagePLxms1Lf2vj4/h7GuBGx7kftB20AiAOly+C/d+4s3OeA9R8fapzv83DtKxA9e2DrRjeYnDvNQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-21","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"e5679f7f7773ed7e389ee8488c765e0ad7490fdc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-21_1692576651676_0.7974556938942172","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-22":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-22","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-22","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c08594f70285faf23852a12da7441fc9d5b20336","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-22.tgz","fileCount":42,"integrity":"sha512-T0sbyhJEw3Lzo4hx/SqNnRVjLtBCqLav6nEktJDC/VV8jI0SLYWGj91EZPuUIx5W8pA7wngnPPO7CHEyTF13YA==","signatures":[{"sig":"MEQCIBfVC5sWs3FQOSnpnlMencbxV+YGhexBZeaU6P6BOk19AiBrxhjG2wufWzGoRZ0MTJ2GVY7DTOWLeTydFjdPHO2Xpg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-22","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"e5679f7f7773ed7e389ee8488c765e0ad7490fdc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-22_1692663087692_0.8262067912553681","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-23":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-23","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-23","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"a0c46609b971467d348fa213201ebdf1536924ad","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-23.tgz","fileCount":42,"integrity":"sha512-WFRBpNyKA9YVsxHSLr05K9Eh0NIHdz5KewxBtUPSoXId+AGDuipmrUQgTHOceIGEBIj6FICWe1wmIG6cFfM1+A==","signatures":[{"sig":"MEUCIQDzWPYCdIeHMHNYx91pO1IjhVXQdTM4+LqU7/TGioKudQIgWCb8eXqQI54mlubtSOqcigZGLUXS4vrmrdPvxqUAG2s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-23","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"e5679f7f7773ed7e389ee8488c765e0ad7490fdc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-23_1692749456165_0.9152374471123932","host":"s3://npm-registry-packages"}},"0.0.13-next-2023-08-24":{"name":"@dfinity/ledger","version":"0.0.13-next-2023-08-24","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13-next-2023-08-24","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"7aafcfc2978f4c12380b60eac3133a4c8c0abaa1","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13-next-2023-08-24.tgz","fileCount":42,"integrity":"sha512-bJCKI9KtAZD5swd6tjK1Oe+wjjC534lZ6Ik646bFp9PzdBGgI0y549aV///lZz7Xw7802j1DUyvTBOJn6/GE4w==","signatures":[{"sig":"MEYCIQDJe8N7yWGglxC2yMIIFOY7zJTjuRzEsq1BkY4cTrk3egIhAI5HulEo+4fS4hy3mfNdrK75HZbtZ1kRYmZ3Ksdr09lQ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13-next-2023-08-24","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"e5679f7f7773ed7e389ee8488c765e0ad7490fdc","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13-next-2023-08-24_1692835863975_0.3680367399487414","host":"s3://npm-registry-packages"}},"0.0.13":{"name":"@dfinity/ledger","version":"0.0.13","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.13","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"ab1ed0fbf56fb66a20225c2cc9418315dd1188b1","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.13.tgz","fileCount":42,"integrity":"sha512-SAJGMy24luIlPyIMgOKbwfvzaTKweQpqurGAJkl0UQAz094/scooN0MSmo22bJRdwrqxnuSZFYgLyuBKDIot6w==","signatures":[{"sig":"MEUCIQDi3aMLEgIM1nnFFewtopAsXXmHlrfrEnY7X4Yllwhn3AIgA1XlCBbjJkH5U/sMbNqud0+eEOmETut0bJgbGqtFNME=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.13","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191910},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"2fd7c861c146f350b44d678ecada86fd8d373145","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/agent":"^0.19.1","@dfinity/utils":"^0.0.20","@dfinity/candid":"^0.19.1","@dfinity/principal":"^0.19.1"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.13_1692892899008_0.3853036139983361","host":"s3://npm-registry-packages"}},"0.0.14-next-2023-08-24":{"name":"@dfinity/ledger","version":"0.0.14-next-2023-08-24","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.14-next-2023-08-24","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"944b121d9d3939b412d8efba82b868f16c9c0280","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.14-next-2023-08-24.tgz","fileCount":42,"integrity":"sha512-0njERxjApLgzcFTLYi+fP8vwmCbVrTvXWeSM95ZnHJpNS8Y3gSUVXWoWYBVPAAhUyscWbC/O4rXVVzFcP/LDzQ==","signatures":[{"sig":"MEQCIDDZ95uFqdRpjn49tOoPlgnoUFE6aeF89Zs66gl6z8H9AiBcKjJuckv6S4q6meCURXNLfZOt/Tn5TMwKE+rpPpuMmw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.14-next-2023-08-24","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"3ff3a2961c237d2dab9ed2ed4eefc26f5ceb1a08","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.14-next-2023-08-24_1692893423884_0.12653735241864195","host":"s3://npm-registry-packages"}},"0.0.14-next-2023-08-25":{"name":"@dfinity/ledger","version":"0.0.14-next-2023-08-25","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.14-next-2023-08-25","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f0533d1aeb683a26d228bf04ceffac205556222b","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.14-next-2023-08-25.tgz","fileCount":42,"integrity":"sha512-xVKPopF/3tPk7PB4CZUZDmGU0VqP/sJEQI5PMtqlLM+wgaGlDg3yyFgDFxJnTT8eiVrZyIkeeM7SdQiFKT01Yw==","signatures":[{"sig":"MEYCIQDRp9Sxdxw2vQSGK22YqRtj7XffsRr/2HLw7b6hSnAd3QIhAJ7bx5P4O46E00YlEmtyTAhcMqjb4FxuEWZiU0xhbv/D","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.14-next-2023-08-25","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"3ff3a2961c237d2dab9ed2ed4eefc26f5ceb1a08","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.14-next-2023-08-25_1692922256141_0.18992819047653264","host":"s3://npm-registry-packages"}},"0.0.14-next-2023-08-26":{"name":"@dfinity/ledger","version":"0.0.14-next-2023-08-26","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.14-next-2023-08-26","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"4703351142e69797c145502f78eb4eb3e97a3643","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.14-next-2023-08-26.tgz","fileCount":42,"integrity":"sha512-3/xcBfmJCqZkM0xdhxDlriz8RaRdVsdhKogIzqnX2Yj7nykZMl8eBZL5ax/3f8jhlPJuQVNoHdrbunrR0cYSxw==","signatures":[{"sig":"MEQCIDPgOsKWjr+DsPqoDwwU1S5A+G5jK5w7CViT6NR/yDThAiAzJp/TLWrAL+uWzIBvdWanRKQ2LcCXwpmAPKQBmiZ67w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.14-next-2023-08-26","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"3ff3a2961c237d2dab9ed2ed4eefc26f5ceb1a08","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.14-next-2023-08-26_1693008671397_0.18553126743407122","host":"s3://npm-registry-packages"}},"0.0.14-next-2023-08-27":{"name":"@dfinity/ledger","version":"0.0.14-next-2023-08-27","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.14-next-2023-08-27","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"70782f858df3e029ed9dc4ab3b09a2107a744f51","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.14-next-2023-08-27.tgz","fileCount":42,"integrity":"sha512-q6YMHIcBVX9Istzs5H+FTNyn7UOFOp6JPCM1Iq+aKANeCmPFZnxlQi8jUD7Tvjn4+mF6kO4iyl6Hjt2dJyZoUw==","signatures":[{"sig":"MEUCIQCvz7G9nrzJJmTAhN2nqVYnyyfhD3ACuCpQ8UOOdLbJuwIgPAC1ykmAHZc5VsQnA8E6F2ZJMQtioQbRoaibCpzS3FA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.14-next-2023-08-27","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"3ff3a2961c237d2dab9ed2ed4eefc26f5ceb1a08","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.14-next-2023-08-27_1693095099695_0.886513022033681","host":"s3://npm-registry-packages"}},"0.0.14-next-2023-08-28":{"name":"@dfinity/ledger","version":"0.0.14-next-2023-08-28","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.14-next-2023-08-28","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"60a2fb7cf7b1be9038a2c97c6962a05508d3f116","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.14-next-2023-08-28.tgz","fileCount":42,"integrity":"sha512-Y0E4D8Hiow+Iwb2n3mXrs0nqx4TBzF79ErEmdvP4fSuu8naIDo8FmyQ08vRUetmzNoLZxQs+uTqBDm8QIEW/yg==","signatures":[{"sig":"MEYCIQDgqPIGb7j8qNgVK4ANyjpYMFIR50ua9guSkruQ88M3MgIhALJQa6IiG59/HXoMEt3+3cIGp1xobVU/InxosL2nOhEt","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.14-next-2023-08-28","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"3ff3a2961c237d2dab9ed2ed4eefc26f5ceb1a08","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.14-next-2023-08-28_1693181479208_0.2852521972475144","host":"s3://npm-registry-packages"}},"0.0.14-next-2023-08-28.1":{"name":"@dfinity/ledger","version":"0.0.14-next-2023-08-28.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.14-next-2023-08-28.1","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d3f919bac81d3cb26cc4d385860b586f115a7f21","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.14-next-2023-08-28.1.tgz","fileCount":42,"integrity":"sha512-djfhCc5ou1ZTjzLtG9unVQZFt92i6z0Re8TgOAf1jpRPyWemWmvE39rYtXYujfP9grgKruYM9tR4s1TCAkmpAQ==","signatures":[{"sig":"MEUCIQDRJNw8jirbb5V1MuO51AvfD2A61K0f4cBe8w7nEh8OLwIgKh4YizZincxr279KspWM3dnazhd3pDFgfY1hiXqfmt0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.14-next-2023-08-28.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191903},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f0a9b9bb14e91ccb96c42a992d7adcc7bebafa06","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.14-next-2023-08-28.1_1693208710488_0.19517991122210865","host":"s3://npm-registry-packages"}},"0.0.14-next-2023-08-29":{"name":"@dfinity/ledger","version":"0.0.14-next-2023-08-29","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.14-next-2023-08-29","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"875abcf1c3b0a591f94ed589d2c72c3b93678efd","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.14-next-2023-08-29.tgz","fileCount":42,"integrity":"sha512-+j/UGhovNziRtZKZItYlofw95vEeWKyJNR7vboi8yTN17l/Cfmio6/c5J1AEPraw2RN5wK1qwpSjCKh/prQGyw==","signatures":[{"sig":"MEQCIH8OwmY4+PMhB4Cjv7H/QHtA2QYrJCsiFEWBWWPeGNAiAiB94A50oeKkiza9rMFl9iXN1X1FOOBd9hBqb1AHVT4yfg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.14-next-2023-08-29","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f0a9b9bb14e91ccb96c42a992d7adcc7bebafa06","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.14-next-2023-08-29_1693267886945_0.9482150829450109","host":"s3://npm-registry-packages"}},"0.0.14-next-2023-08-30":{"name":"@dfinity/ledger","version":"0.0.14-next-2023-08-30","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.14-next-2023-08-30","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d0ccc58d932622d37eedca0873fb4e0ee9caba72","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.14-next-2023-08-30.tgz","fileCount":42,"integrity":"sha512-CC9JKCdo6zi6nlqtP8YxnOHnzxPBN4l61PrYAwNBPT+tHHIr89cTrzm7aUR0nlZcqZiR0egRLOFTduSoNvcf2A==","signatures":[{"sig":"MEYCIQDQcJzP2LI++kjq82mxS3DzpHOZDReLqt5SwQQz2y3jHwIhAKDXdljQem73A492vfJ5g0mjTz/FRvqiTYaw/odvUxek","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.14-next-2023-08-30","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"8ec4222fd954a536aaea8c92c5cb282864d951f6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.14-next-2023-08-30_1693354260176_0.008226405228747735","host":"s3://npm-registry-packages"}},"0.0.14-next-2023-08-31":{"name":"@dfinity/ledger","version":"0.0.14-next-2023-08-31","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.14-next-2023-08-31","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c20c20226bea3f1cb5b36d6ce70e6247ed6b6181","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.14-next-2023-08-31.tgz","fileCount":42,"integrity":"sha512-i+WofhIr8crGQweJrzolD1ThnPATO35biSqd0v2C/+U2GMT3SXH7AI+6t9mOMxm3GGx/iOmT4bjyjewN7NOaqQ==","signatures":[{"sig":"MEUCIQDC5ouuX1DlCALrLFvsjGv+ScbI7pWwoxQoWF2SRT/QJQIgQOn9FencWaRlaejKUu8gzcHxl0+TYg7ey+7cSfiHN0A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.14-next-2023-08-31","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"8ec4222fd954a536aaea8c92c5cb282864d951f6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.14-next-2023-08-31_1693440671649_0.3326241610315075","host":"s3://npm-registry-packages"}},"0.0.14-next-2023-09-01":{"name":"@dfinity/ledger","version":"0.0.14-next-2023-09-01","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.14-next-2023-09-01","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c510ad67445edd015dfd31e5485073d2263d8342","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.14-next-2023-09-01.tgz","fileCount":42,"integrity":"sha512-4iKBiPVoPz5UlPGhJiUtUMiq6P8MGCVZ85p1lwcqOwnuQ04b8FwxTV6BJQdxsh/f6sB+zjsE+ZUZ5PkSrfWCgQ==","signatures":[{"sig":"MEUCIQDWgVnPbEeW4FR1dN0XYqbs6fGFb33L767YaicB99il3QIgb4MJajIOol1DuqR8ZPlkebYL26BajoGXAxY2nqSl21E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.14-next-2023-09-01","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"8ec4222fd954a536aaea8c92c5cb282864d951f6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.14-next-2023-09-01_1693527110165_0.24691328910810695","host":"s3://npm-registry-packages"}},"0.0.14-next-2023-09-02":{"name":"@dfinity/ledger","version":"0.0.14-next-2023-09-02","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.14-next-2023-09-02","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"649ac37c6ff79c1f0798fa9431880c1648a5ebfe","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.14-next-2023-09-02.tgz","fileCount":42,"integrity":"sha512-kaBWTcn5cmYyJqvJAUntSUrJs0M/zrj/W0s5EGn2m6AfbzOJQGdRFgonzkHqTDbhly5a10MlDckqWAq/s9UPeQ==","signatures":[{"sig":"MEQCIEF00DJlZHGq1fzjFgP2T8ud4IxoIthTp+tK9VQbimN6AiBj0ip8s34+qeaIYSBpmalOCxCrcUX9aGNsOmZMJabi2A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.14-next-2023-09-02","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"8ec4222fd954a536aaea8c92c5cb282864d951f6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.14-next-2023-09-02_1693613446663_0.5004596611436947","host":"s3://npm-registry-packages"}},"0.0.14-next-2023-09-03":{"name":"@dfinity/ledger","version":"0.0.14-next-2023-09-03","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.14-next-2023-09-03","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"5b0dba2a74897704ec390948efbd03f5fd6cc074","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.14-next-2023-09-03.tgz","fileCount":42,"integrity":"sha512-FAMd2DabpjR05OqXeQ3S7dYeJXaA5ko+RA53H9dx1Fyxd7E8u4huEr1y740zVsZmc0p0G71yG4YxKsqO/c87LA==","signatures":[{"sig":"MEQCIDx88NxCyrF1xJ+d46hszyELJYvGNwkBBlV4MjeIsd60AiBsQnTQx7bCXu5WIqD6cddJ47tTmzGRWILNQg8bozthBA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.14-next-2023-09-03","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"8ec4222fd954a536aaea8c92c5cb282864d951f6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.14-next-2023-09-03_1693699960190_0.8798379227761024","host":"s3://npm-registry-packages"}},"0.0.14-next-2023-09-04":{"name":"@dfinity/ledger","version":"0.0.14-next-2023-09-04","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.14-next-2023-09-04","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"97845b9cc09c8411037a1b0640da95be53a78185","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.14-next-2023-09-04.tgz","fileCount":42,"integrity":"sha512-znP8Y1tyfrW7N2PFnUV3PDuyhYThaIEPpfpI5cQHo+bFM8Kd01DCgOxIHEvvam9MOrkvA5q7GRTEkn5sO5cnzA==","signatures":[{"sig":"MEUCIDlkqIb5p9aUc39U0bnrS8KR7dNJyKwM64EJzPa4XLNlAiEAw3X7Ydt1BF3GgxSk8+1Nk4CuACsnZQBKYrEAcT0Ga8s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.14-next-2023-09-04","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"8ec4222fd954a536aaea8c92c5cb282864d951f6","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.14-next-2023-09-04_1693786276999_0.7222781369892388","host":"s3://npm-registry-packages"}},"0.0.14":{"name":"@dfinity/ledger","version":"0.0.14","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.14","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"54c28af096623ecf442ba7bf9646917966426ffd","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.14.tgz","fileCount":42,"integrity":"sha512-8hdU1FEg84E5X3uYarBDViFzdNuXKGEPvE3DaQM+hj6Nndth6zBahKu0At5guYkTPoB+AdXOHqWZcmLDUTOpsg==","signatures":[{"sig":"MEQCIANwR0gD0r5GfeKjPIz2ZFH52jeIETL8yXo0P148TA8hAiAo8BTPOBRchRGa70IJ3vr1TU6l64P/0WZqnoBYMaBICg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.14","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191910},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"802fc9c5ed29555ed25ad87726adc73042c03244","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/agent":"^0.19.2","@dfinity/utils":"^0.0.21","@dfinity/candid":"^0.19.2","@dfinity/principal":"^0.19.2"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.14_1693803741984_0.46608834605904903","host":"s3://npm-registry-packages"}},"0.0.15-next-2023-09-04":{"name":"@dfinity/ledger","version":"0.0.15-next-2023-09-04","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.15-next-2023-09-04","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"ff6b15ff5ad22a215d30ad72b47c56f641410781","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.15-next-2023-09-04.tgz","fileCount":42,"integrity":"sha512-ZjeXUjNa2YTOgwe12hejTsRmlBW/Wixnj3vR/VfAEhuAOcaOYvGjGFRu545OAuzbA+sOvQHHwfbpTA4kPMJRAw==","signatures":[{"sig":"MEQCIF7EO5H5ZlY6KBV00wAYako1quDROULXetUidKMQ7S5nAiBHMYwuXUhzduMNnPdGhdBiIZS5R8dar2xN3tG1L3btvg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.15-next-2023-09-04","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f9ea40c6c961ac692011cea492a918fdf27c0237","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.15-next-2023-09-04_1693804920377_0.7393736968205402","host":"s3://npm-registry-packages"}},"0.0.15-next-2023-09-05":{"name":"@dfinity/ledger","version":"0.0.15-next-2023-09-05","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.15-next-2023-09-05","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c831d0ccfac04cb5521f80723098090d5f08944b","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.15-next-2023-09-05.tgz","fileCount":42,"integrity":"sha512-jCq55TQM/7+AE/tpm0oxfeXmuyEI9Hj9L/7mV2uRJUH6QYqTHWGv55cymZG9xy1WsWYt1kkBG031CeKsk++8jg==","signatures":[{"sig":"MEUCIAD7TDprikhf0AXoooMkLY8JwtkZUSq4EZLun1DrAhf7AiEAh8ujmEV8pLvojFcPLqmcp1UfBa1QILWKLsSEBff6PYw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.15-next-2023-09-05","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"f9ea40c6c961ac692011cea492a918fdf27c0237","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.15-next-2023-09-05_1693872651404_0.4087498071134168","host":"s3://npm-registry-packages"}},"0.0.15":{"name":"@dfinity/ledger","version":"0.0.15","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.15","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"27554d855b85628cdb353737be2ec64acbd7bd54","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.15.tgz","fileCount":42,"integrity":"sha512-8cem0ryQgSecOl2cY4cQbAiEZK5GGckqKrqWdJ7EK3KqGgI8a1PLyGtM+iLPVdzWMS/rzZCbCQGF3NnMxTBq8g==","signatures":[{"sig":"MEYCIQD7/ZCHimlvUeBdTyAC16hElD3g01iYJ94ZKT2kK3yjlgIhAO4NQMwB3Xwy5wAoq0Z4rrY3zZQGhoIEvqBL3fXoyw3I","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.15","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191910},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"15f59709c0e841be7d5b3000ad8817ee572b6319","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/agent":"^0.19.2","@dfinity/utils":"^0.0.22","@dfinity/candid":"^0.19.2","@dfinity/principal":"^0.19.2"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.15_1693898735811_0.24883591323584953","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-05":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-05","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-05","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"30f84ed816a190f03fbd277902f1a5ee9d520235","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-05.tgz","fileCount":42,"integrity":"sha512-GCd2ryevP6Sv/IgUhzAe8D88AhoF0eOYFu+6tRPD8fUIT4gcZRI0F154w4aSK6/5svLIjPChV3BWnPzu2miHYA==","signatures":[{"sig":"MEQCICroYT6XHPzZXxKr0X4/tc+KorsAg4iewmGF3pBssjQmAiAB0+ERI3hmkS6nay3nxsqRYr/S3d0b5yHtWDik69geRQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-05","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"6b0317dcfae707fe44f2807eec9aec726207cc4b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-05_1693899299564_0.8494958859303225","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-06":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-06","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-06","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"f80f27cacd312352973afa0175655c04fe5e8508","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-06.tgz","fileCount":42,"integrity":"sha512-qfOZ/8f3asNtHM4AdUn9YZ0fxKzgOeoMCGwsCq8kCORg4VVDayt9gVOW5d45Kr74hwTvh4oz8Yr1e+Pq8jyFNg==","signatures":[{"sig":"MEUCIQCFWLzUYUGpUAOmYX+aMUAlyASCzXssWHe9HBDCmqMw4gIgQtWDraw15VSnkKsOrH7F3qVkcGWr+E+VZi2xS02V3hI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-06","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"6b0317dcfae707fe44f2807eec9aec726207cc4b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-06_1693959058857_0.12883125560950792","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-07":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-07","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-07","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c61e62fdf13347fd35e47d5dc57d66b07765dd0d","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-07.tgz","fileCount":42,"integrity":"sha512-o+ed8twW+GbNlNOKJFNyaXDPla6EsqP7JapnAkKSfhyS7nBRTVE8VUnJd3bSfR5hybGvZUrDHD/khnP456g/Zw==","signatures":[{"sig":"MEUCIQD87NVAgvZAinyZT/mgxUSQngpMcgQdRN/e9ZbelyKofgIgdez3VqyFfh6aIzWZN2SfFuGw2iH7JW4JzN+J45t5Agc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-07","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"6b0317dcfae707fe44f2807eec9aec726207cc4b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-07_1694045467242_0.7932673868392595","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-08":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-08","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-08","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"1259b9a11fee98d3c3bb187224b7fcad64bda9f2","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-08.tgz","fileCount":42,"integrity":"sha512-JODmt0D8IH1Chazna5tHnPQxawpvP2dVppC0E1TY65/UK6GaibbahKMHhAiOH1IXttq9/KDE1O8eZkPky7PbSw==","signatures":[{"sig":"MEUCIQCDg2LDcoHMSerS7tpEpD1NDFeqTfL3oR1KgCS0zuF3gQIgM4ImPPjX1lReEZn66rrZC3Hk9s4iH7dN6JtTKCWwL08=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-08","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"6b0317dcfae707fe44f2807eec9aec726207cc4b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-08_1694131856852_0.7524976480314254","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-09":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-09","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-09","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"9319ff5914a8d961af205b8605b10d0ea7005d8d","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-09.tgz","fileCount":42,"integrity":"sha512-gs7pK/ESGeQqMItGYNT1OEK7j45oY2GGq+kWtuc3hfe30X/jWIXqTRe9IS1QcBq5/ZhOGskO8ebsmzMJ5bN38w==","signatures":[{"sig":"MEYCIQCe4z9TRyIGHaQRSs0d/NpXHfH9q/JLt+bjYLtjgkLgWwIhAOLC+eR9stsV+39d0SA2ujW6TArUjVG8l+20GTxZjp1R","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-09","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"6b0317dcfae707fe44f2807eec9aec726207cc4b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-09_1694218254695_0.4179927772551997","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-10":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-10","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-10","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"fb6d43fe55f20e54c96e57724ce77a833b714f43","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-10.tgz","fileCount":42,"integrity":"sha512-wulwLe38C8FNDqLiK4LR41kGMAOsIxopZLGePl1gUDSMIF1gvmAC9/bhQtS+ogvHVHxfUgU8txJRfO0DCrloug==","signatures":[{"sig":"MEUCICLP1morJDR0/wbC+3krljHYLGt8a7QBn3MXBp0XYlzlAiEAr96vgi2e21jr2nT91yXjqbWGdFWlPdoatwzMj7d5tok=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-10","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"6b0317dcfae707fe44f2807eec9aec726207cc4b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-10_1694304712754_0.8107008298138416","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-11":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-11","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-11","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c1f9df6be5f31deb2a171989352a8146dee217a3","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-11.tgz","fileCount":42,"integrity":"sha512-qtPTf+blPT3Lx/4KM7T/K6j0AKpb0v8c9N/ArxR13FJ8XWBko/Ym+AsdScC7lp6iBxwUrCP64sE3nqafre5ZUw==","signatures":[{"sig":"MEUCIER16/bCfjIXvPJtYC/+r0p4pX3h/Tg0x5Q3JGdtaD1OAiEAvJEhTCS0/l1uF4cKkJzf0Alwm8eJFRvzuoPosAdDnb0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-11","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"6b0317dcfae707fe44f2807eec9aec726207cc4b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-11_1694391124613_0.12597229347391092","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-12":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-12","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-12","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"4bbd54c1379dfb62f7d374d1f4be1be292d3b940","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-12.tgz","fileCount":42,"integrity":"sha512-h98tWRIBqnP+dSIH3eZMgQCcBTXQ1MyEaySWJGUwZNL+QUDuVV1ufI5jXr+Ei+S+9ay5FWSyCBs+1cU0+Z7zBQ==","signatures":[{"sig":"MEYCIQCUY0Srd9ho21Kam4VjAXk2UCjZ05nA+djiXYtMgbnejQIhAKMyGzN9GzsQIZoSRST+U5fCodIEePcG7Na8IP8AKV07","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-12","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"6b0317dcfae707fe44f2807eec9aec726207cc4b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-12_1694477469721_0.7615455462034117","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-12.1":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-12.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-12.1","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"23ecedd9d7fee537dc7fa56a9716c3215246bd27","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-12.1.tgz","fileCount":42,"integrity":"sha512-ehgnuaAGI18l243JutBxJ1mnUsKpoa2pAXot0gsjt0GFK4UbvHBQr4ZMlae0nwlYeZuuHBMnwqeM4orirwmIpg==","signatures":[{"sig":"MEUCIEhCpnuo2JnFAbRzm20QWAHR4SmoAit2DZys7XNapupxAiEA9iyLo40qo13bmCxG1K3U0tdiqKE6DWvfTPT0CGRmgyY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-12.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191903},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0f09db44fc20ae1e3fbd4d56ea7780f917fb7c8c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-12.1_1694512193165_0.7798132118175352","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-13":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-13","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-13","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"9e23074c4dccc6e054b2d30a01df2af44395ace2","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-13.tgz","fileCount":42,"integrity":"sha512-E+jp/mEPqpJkFn/jgRqLkCGOsysMZF6vaP9BZza6vI/hXAL6qQMg1C+0EvIqgwi3zeAaEv9tSE7O72NQnXzuHQ==","signatures":[{"sig":"MEUCIFHdH4OUQ3p1a5IKLDPNXSC01vUVVF0nQbY+EjmZJiwSAiEA4WYIdbW5nqJY6+r6XN54FmvRbaUqs0NHn2mDHxuRtTI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-13","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":191901},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0f09db44fc20ae1e3fbd4d56ea7780f917fb7c8c","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-13_1694563922542_0.5775534616069453","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-14":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-14","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-14","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"d4c929dee3a36eee1b46ec7e41867967d548407b","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-14.tgz","fileCount":42,"integrity":"sha512-MmsfpE0lev/eyqIWDnhEPp1H6kcJ7uzTtrU1JP8vmGqO87O54Y4XI3c8/HNd2rWDlhxk58MwC4Gv/Lfuc6izWw==","signatures":[{"sig":"MEUCIB7KkRtr410e8atyFyZFmt43HF89/nePcJPQKk2VJ3QCAiEApQKJ3OBT/b1+6laM/+otDpi0lt8I2mSsmUGbG0ES+1U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-14","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":197251},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"be8ffe06aea84542671dc70697b692bf9fb228a7","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-14_1694650264849_0.5639061562569534","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-15":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-15","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-15","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"36918cfb73a1424901c170db0c21184b016443c5","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-15.tgz","fileCount":42,"integrity":"sha512-ggIQBvEE1aSvSmwUJTkbPHDuWQsMH+5jzp5PBvGQoRRE4W6XLvo7DkolhvECjHJKNK+zROJeEngM5QRC9qGxWQ==","signatures":[{"sig":"MEQCIBP3Lhkwl0NlNN5G1KS+shEBjqNr38kJg9G+flyNiddSAiAUS2OdKlYEyVCOqnqDoShzotiUxw8s8q7K4DIUDEm/7g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-15","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":197251},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"595f6a49355b31b60c1b244a49502a7c3e58738d","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-15_1694736682054_0.5761194205995614","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-16":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-16","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-16","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"1e2c4f6abe634a0e32d0ffffd53b689c76805c38","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-16.tgz","fileCount":42,"integrity":"sha512-NPsnG0BElW1QtzdL3wGIouZkylrfLQe+M3siwGpN8Ic6gS8Jxxo0c+NtzPrhWQ8gwWy5aiJF6WotJFsjsdlpMg==","signatures":[{"sig":"MEUCIQDxgJ4b1vXXpDJ3T0cwm/w607g/3qNrRJEkYQfJjjJbEQIgXEjkV/l4gk3+7EaEG67CYXT83M7nRx42FHTjopCIexc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-16","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":197251},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0a62333744574e3112d279b8e4fba265e1b84317","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-16_1694823070894_0.49918471905336803","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-17":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-17","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-17","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"fe3ca2ebf9a0a26c0ab39b30523a4f04c355b4ed","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-17.tgz","fileCount":42,"integrity":"sha512-R3zMzi7RLfelku5HQypHOljM5XHFO2PYwmY51DqhggkzmZM+550CfafUv3vbg1v3gvF72IWOPWJsI1y+kS/DQg==","signatures":[{"sig":"MEQCICm0qWwY8//PQ8Djw0Jjg2WFdr4TpnXaTrpvtjr3vy2yAiAhVitW7BG//XKj97k0Oqvi3Z23YjUbKfyw8djMZRlzfw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-17","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":197251},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0a62333744574e3112d279b8e4fba265e1b84317","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-17_1694909552730_0.7017204673566082","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-18":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-18","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-18","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"ee7b274137f1ab7918c0ea7f681e42d965c282f9","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-18.tgz","fileCount":42,"integrity":"sha512-ibjGN4GYxcBh0noYNUDN9fpkKD0XQS+J5KLiYaoEN3/B57XZt/W6Dj/bjVLgB3IBsGnVqOa0hJAS4ROhqEnrag==","signatures":[{"sig":"MEQCIE4x+WBnMKQkJs4fYT4LHQKk2ifG4sdXlAjEH4F1t0GvAiBiLzYybVonCaMFlBK9E8J83nCNvPPwidy4ia1Evo8XpQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-18","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":197251},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L16)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L17)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L31)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L39)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L48)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L61)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L77)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"0a62333744574e3112d279b8e4fba265e1b84317","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-18_1694995874566_0.17514142227722562","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-18.1":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-18.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-18.1","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"b582526367e69e087c1f68b68697c40d62caf972","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-18.1.tgz","fileCount":42,"integrity":"sha512-rOqxa3HdwLTY+X27xsoHHe8M+hhHVsHe6RdylaZ10chKHWD1a7u2TXunyMZvyGEuYiKw/kr/S4Yh789EL5Y+Kw==","signatures":[{"sig":"MEYCIQD9jhp1KWU49Wbf6ziNXQxLPDWs+9X45vmgClSyh4UBFAIhAJGtJKdrr8mDPW7MS6P/KosrL/PO/F9daIYfODErS1UY","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-18.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":261935},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"4c8dd0b22416f86f75b5a957fa6a210b44fd5156","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-18.1_1695027683266_0.6982817840255724","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-18.2":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-18.2","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-18.2","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"9e2dcb0fd7031733874ee71e933e66e5901716f4","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-18.2.tgz","fileCount":42,"integrity":"sha512-+RPBsd6X4f23FO0KKvNDSwaiz3t21OYgBerjOT6yuAcjxWVwMchr3vUU/lHfO9DCM0m3Z/3FfZg4vHQJwvsPXg==","signatures":[{"sig":"MEQCIHmfHeJAhLU00YKeS3EskO+iRx6RcYBovlQsKYL+mEiIAiATlv3Gwf0afP6sYxImbM4t9YPs3tWfo+XmR5DvCc7oDw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-18.2","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":261935},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"4c8dd0b22416f86f75b5a957fa6a210b44fd5156","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-18.2_1695050048386_0.21839935942227884","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-19":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-19","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-19","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"819852f9eae4b9d3854d888b1ac3c48037733de7","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-19.tgz","fileCount":42,"integrity":"sha512-+98QEd7kTWPNKTWgpQQJN0cCKIXnsQyD+JkzIrNrnqOcmG7EQCi3HEv9kS8ZgvnhDVps+tIfbwyX+sh8vMcbPg==","signatures":[{"sig":"MEUCIQCoa6HCx4dkvzV1WBi6FLa1muzIyBr10uro5KZSd+cZPAIgLpQlsGqEsmgcvYUH/BO/dGfC9TNWfcyeA9sKG1rDRag=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-19","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":261933},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"4c8dd0b22416f86f75b5a957fa6a210b44fd5156","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-19_1695082301851_0.9338669176283918","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-20":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-20","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-20","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"113f656179a85f4cb4a4481c57984bfa7dd6fedd","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-20.tgz","fileCount":42,"integrity":"sha512-FO34SX9kyjokph9NUh32M/O5/6M07p4o7EMM8K8JYUQB/7J+JJvp+o88Z7UDMA+g4pUfh0tlMhdD8Y3CkwfhXA==","signatures":[{"sig":"MEUCIH973zQEgBSXB+3X4wp2Xr91NWbKkDltx2mt+GRuaburAiEA1Plr5RC8C0cJU4KWGf6mbGmtU163tVQq5SBNmH84Z8g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-20","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":261933},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"4c8dd0b22416f86f75b5a957fa6a210b44fd5156","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-20_1695168687963_0.5249255881364705","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-21":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-21","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-21","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"82b61ef7cfe41779364c5ccb2735fe33a1212b75","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-21.tgz","fileCount":42,"integrity":"sha512-hnBe0ruflxI75WhKTB9cCrKCzWVPOqZiJIkJwKIINiUQequwwpjkzM8BguPFPXMQmIXc6RyyF+D3ECh0yjuLZg==","signatures":[{"sig":"MEUCIQDPfKX0ZAQwUajY/2lT0x8QD58Ph9hj/Gvefg2nUm94hgIgDXPva2o+kPETUNXhwkVQvNuzZ8n0XgOZ52eO3nuheK8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-21","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":261933},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"1f2e7d9dbd6c06e57fa55c6c8cc4c07e0ebee31b","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-21_1695255049856_0.41952521120416675","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-21.1":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-21.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-21.1","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"26f2005ad3a79ad3bb47cd25ddd23833661fa805","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-21.1.tgz","fileCount":42,"integrity":"sha512-4dgLtB9wK0Kj3uVCnqgP/4Eci9nMp+HrkHovZrbzvUPU/3vYNNMD7FTGyzvvuUIWxDEvpCl9ayNAA/Yw/pUDag==","signatures":[{"sig":"MEYCIQCtwIuiN8NHuIUCTlUBO5bEGZwWEswCBgl7cset1xfIFQIhAM6Ydcvf3oAz8dLq+z6wyw7OzWysIPvsIWQIQcWDdYCP","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-21.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":261935},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"99ed44c7a2d1c4f49e7f3f497c78be17af81f65a","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-21.1_1695286976977_0.5229992354697286","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-22":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-22","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-22","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"706a4dcaec93bd2a2d00634dfb38f399d2411a83","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-22.tgz","fileCount":42,"integrity":"sha512-NauwcRQrtnEJOF7ZTfJXO54fyy2FUQ4hVOSujavIn8xhxhxTwUpNcZtO0yZ2FuHwX/JLektQKYmiJkhIFwCsdg==","signatures":[{"sig":"MEQCIFqMCN7mlt5EGV+vY9JqobiYD13G5qqSXyIN3EO47XnBAiA4oKclMgygRWbhyzldRtxiu2EzEu0g423h38RwYwNX9w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-22","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":261933},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = LedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"99ed44c7a2d1c4f49e7f3f497c78be17af81f65a","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-22_1695341500438_0.9356339557259508","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-22.1":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-22.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-22.1","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"e68ecfd4ac94f50a936eee44dc2ba326bf7b0ef1","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-22.1.tgz","fileCount":42,"integrity":"sha512-RhrdX86RQuZsDNTZwWY8pp1vQHw/MT8f5AbPW0vUaB/AIygyjbXcbaHBXT3gAfuAoGg3CQHVAY3EwDQRqjgUXQ==","signatures":[{"sig":"MEUCIQDuddv6ppo/RiDSxaIWCF2qdjllBTtHZNAk4CBrXuFIZwIgRs3DSbVsO3KE0C7/XlhItV4WIYk0pU6p/fJPTJH/bRU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-22.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":262218},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = IcrcLedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d9cf048b20d0696ce8922aa93fca414c5b49baa4","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-22.1_1695392275321_0.10438617804663419","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-23":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-23","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-23","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"2b13906d7ccd695ceafd51af821debf866e36143","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-23.tgz","fileCount":42,"integrity":"sha512-LC9aZ0u0SjcMXCLH/4WBQpHNABHvtS5fQQN8EwBhEVpzI9zb1jGWa3LrBWYeKD8uw818w3nW3NCYAH7bR6CTFg==","signatures":[{"sig":"MEUCIQDo7DUNltoDhmpITw4B0h4tUW53VGV5R8r5egpelZTvcgIgNEFmRC4zYFDv1W//ePtVKiLr3E8JDIeKSMpvfEqqkuc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-23","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":262216},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = IcrcLedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d9cf048b20d0696ce8922aa93fca414c5b49baa4","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-23_1695427854174_0.37427551791843694","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-24":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-24","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-24","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"cf0de3709f62026b5bbf7f99867e77bdee3a8fa2","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-24.tgz","fileCount":42,"integrity":"sha512-p6mc7dL63LpgnjTIbw0xsCG6iLLlNEIGCZQYcegnxGVMo/vDHLipC0QhwtYR9IELWSUjjOZQcYDZdw0G7u3jzQ==","signatures":[{"sig":"MEQCIDSqzkfa0SwXzLQAxyknRfjl5SK4EhTmse168PXCUV7BAiAxXQM3vy65k0Qwdi1yfVALi6ma828i3K7lDTujfoR9Mw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-24","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":262216},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = IcrcLedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d9cf048b20d0696ce8922aa93fca414c5b49baa4","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-24_1695514316954_0.8198775015303528","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-25":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-25","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-25","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"e96cb4988a5b555cecb09d3a0789f22ec7ad4650","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-25.tgz","fileCount":42,"integrity":"sha512-WtI05n+b3Mf8Yx9MkSAUShCmcTS/T4+Lj7Q/GoZue/St+OBJtAc6+Y4OLOnRcQII3Jh9u5meIDVn+aMHTn4iZA==","signatures":[{"sig":"MEYCIQCNVe9AAPBLnAEtzcdrOEzkqYTJGi4uR/TPYRNHjOhblgIhAMWtOC7LEwtJKMNqfF9wGNbjf2rPDtGsU9uJHdN8MWBx","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-25","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":262216},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = IcrcLedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d9cf048b20d0696ce8922aa93fca414c5b49baa4","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-25_1695600680488_0.3577462955061599","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-26":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-26","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-26","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"84da81b78b89cd4b3409672fd5d3ed49d0496af8","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-26.tgz","fileCount":42,"integrity":"sha512-7yZeLU8wb7MXu4ZUPs6+6aac5+MIKxbliPOYRxOd4x1XN/r12DceWQgeRu8Lljx0xwzVl3PaolduweILESgN9g==","signatures":[{"sig":"MEUCIHcFhBINBmatbq5BLvek9jatMuOur/RHu1h8HzywfZmGAiEAsyoUM0cALj0gUikGu7buauqSzR1ImkMrAjpjc1wGAFQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-26","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":262216},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = IcrcLedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d9cf048b20d0696ce8922aa93fca414c5b49baa4","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-26_1695687130525_0.3350724831008478","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-27":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-27","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-27","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"68b9a598f47b7cda4fce5b74e035edba9ce354cc","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-27.tgz","fileCount":42,"integrity":"sha512-7trsnsgJD8Ybnlll4WS9kBE9XTdxnRj1GAC/PPVlL5PS9SIBh0SwkM/C6Plo28m7dWkp6EBjxRHdhw8alkZX/w==","signatures":[{"sig":"MEQCIFjGhtR9J/4byvix/8A4/6OqJE9s7rYddcXWvmhEoKi7AiAHPAGjX2/NubcWPsNG84NBD2CIYFBAxetanWf6c17PxA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-27","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":262930},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = IcrcLedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"d9f3f5a70d31cadedd7ed24370d9e5daff8a8a32","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-27_1695804644066_0.9314822103436762","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-28":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-28","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-28","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"01ab96034d9e4ad28b8bd04c8ff76e8b6528f00a","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-28.tgz","fileCount":42,"integrity":"sha512-UjzxamoUo1UBe/0/PPyIe29pjpd2KRRuCHWPrTkyTqMeN3huaPbSM4WYfWnVIT5FXvRrmR9zjB5EbUJv0sH4Iw==","signatures":[{"sig":"MEUCIQCZz9nZPJKwLFpsnXAmPoAqgJguynb4LNlOxgdEM5FhTQIgY9FU9RttT3vayuwBImd3zKMHPDTH7lu2H3fEf/2t+ew=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-28","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":262930},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = IcrcLedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"1a11bfb138e80ef62f8111639c446a5afb09583a","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.6.7","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-28_1695859920426_0.04340221306862313","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-29":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-29","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-29","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"9fc72af4e99fd0c1b07df03233e0a55fb35aeda2","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-29.tgz","fileCount":42,"integrity":"sha512-lbWdWnT1iLSI3tVy+Q1rwLQ3KPDchAQCuBTLx2jKPpKCRYeGWVu3RMud69b99mEe+3pLCRZ2wyXAVfm5VgHVeg==","signatures":[{"sig":"MEYCIQC2YOtALqPCV9Eou3bNCO69BUH6CmvT/ACcOOSH66vtbQIhALlbU64BZbFxK7UfuOz/r6+udmRG6kyU/Hz9lMGTVw2k","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-29","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":262930},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = IcrcLedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"1a11bfb138e80ef62f8111639c446a5afb09583a","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.8.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-29_1695946294343_0.2595296716964921","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-09-30":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-09-30","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-09-30","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"193eb1348b19b0dcbccde5c8b74eead277c81025","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-30.tgz","fileCount":42,"integrity":"sha512-Mqvyo8MwRDs3Q1ZLLxzZr5Bd7yrU+6/myZBISkiW5jj7jslP5Lpr8n6HF9NO4012vk8AmTR1k99siR7vYHuIUw==","signatures":[{"sig":"MEQCIEWFZwBzLny3oKY4oQEz/BEVne2337+1EmfpsLODJAt3AiBtWxslvnWDYaI1DZr0dtJMDxARgmHeCgEeSujlwD6hmg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-09-30","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":262930},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = IcrcLedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"1a11bfb138e80ef62f8111639c446a5afb09583a","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.8.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-09-30_1696032649281_0.5880402523385322","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-10-01":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-10-01","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-10-01","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"63052ce7e82a0295ff519a4fa320305374f9e14e","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-10-01.tgz","fileCount":42,"integrity":"sha512-4aDESOiDDxMVVNR16u1fnq7dt3s6LLMNUbzM1oAslQBqO9y2tpsyYQa9u/8ZdB99WL3Qs/2tfVjpOCBhtMjQSg==","signatures":[{"sig":"MEUCIQDulitCelVX6SWu1iaQo1guljLC126UObWsFNgZKUttyAIgdQOPE0H+kPAiJcfvImwtSnVKj1O2bpJFAfiPGYXND3Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-10-01","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":262930},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = IcrcLedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"1a11bfb138e80ef62f8111639c446a5afb09583a","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.8.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-10-01_1696119207044_0.2420648249882087","host":"s3://npm-registry-packages"}},"0.0.16-next-2023-10-02":{"name":"@dfinity/ledger","version":"0.0.16-next-2023-10-02","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@0.0.16-next-2023-10-02","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"858888eae1c5abcbe56bfc3a463c64049ae155a8","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-10-02.tgz","fileCount":42,"integrity":"sha512-1cFxgLkTj9C1FUKGYRygxkAKy/JWmzBti0uNdeEKS3iCsSm7T37oXzwtYVbVt+TyZL8RYejho6ChRK2XeLqb7w==","signatures":[{"sig":"MEYCIQDCdeLFLE9/AYemTFUZ2ZEMn7e0CGGuqRr9WJnDL2lJhgIhAIp52EGdrDWcA12kmro1Ct//WkN6bSUWuGXFEviDvRRY","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@0.0.16-next-2023-10-02","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":262930},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = IcrcLedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"1a11bfb138e80ef62f8111639c446a5afb09583a","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.8.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_0.0.16-next-2023-10-02_1696205537678_0.12318023389709243","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"@dfinity/ledger","version":"1.0.0","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@1.0.0","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"c85c73fe10d118ef1ca025c39a015a0ec79aaffd","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-1.0.0.tgz","fileCount":42,"integrity":"sha512-n18kjbqxf1GW9D8wKFT5A9doKRetXDJZnIq0fp+426Lxa8HBoXXDQr76VG3s+B6uWRqJo9e+o2XMR0B2MZSoSg==","signatures":[{"sig":"MEUCIGq3dSuwt7T8hVRmcbPc726y7mJ2PUXscetMaUJVZ9h8AiEAhwksKIAEd46qhH3EVC8mRaN4ycwEU/FYijyey7V9eto=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":262937},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"21a73b7bd188f3f531b6d24db4941180f0ede6ff","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.8.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"peerDependencies":{"@dfinity/agent":"^0.19.2","@dfinity/utils":"^1.0.0","@dfinity/candid":"^0.19.2","@dfinity/principal":"^0.19.2"},"_npmOperationalInternal":{"tmp":"tmp/ledger_1.0.0_1696240060784_0.005597594024298269","host":"s3://npm-registry-packages"}},"1.0.0-next-2023-10-02":{"name":"@dfinity/ledger","version":"1.0.0-next-2023-10-02","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@1.0.0-next-2023-10-02","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"62f1a0c33262f068819951e0433cd109df93b4c0","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-1.0.0-next-2023-10-02.tgz","fileCount":42,"integrity":"sha512-dyp7FedU8JTEldDgWm5tDxXGJpXDfL+Rk+F3qa+YY+vc7DhkajfuSMnnnXKHaUyFAnf4CbzJ7ETIuxFjRjNuzw==","signatures":[{"sig":"MEUCIEgp8DPsgymAgCGMm+e2em2l1pQyORG2laEXjstLqoC9AiEAtKcWx4u1rAr4Yz/HBRp/uei9C+8j2/bW43nCqw9z60w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@1.0.0-next-2023-10-02","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":262929},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = IcrcLedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"21a73b7bd188f3f531b6d24db4941180f0ede6ff","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.8.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_1.0.0-next-2023-10-02_1696240331012_0.4925172665070925","host":"s3://npm-registry-packages"}},"1.0.0-next-2023-10-02.1":{"name":"@dfinity/ledger","version":"1.0.0-next-2023-10-02.1","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"license":"Apache-2.0","_id":"@dfinity/ledger@1.0.0-next-2023-10-02.1","maintainers":[{"name":"dfx-json","email":"jason.ibrahim@dfinity.org"},{"name":"dfn_wndlng","email":"jan.wendling@dfinity.org"},{"name":"nathan.mcgrath.dfinity","email":"nathan.mcgrath@dfinity.org"},{"name":"frederikrothenberger","email":"frederik.rothenberger@dfinity.org"},{"name":"bitdivine","email":"bitdivine69@gmail.com"},{"name":"ielashi","email":"diner-rodding@ic8.org"},{"name":"liadrit","email":"lia.bajraliu@dfinity.org"},{"name":"dayyildiz","email":"dominik.ayyildiz@dfinity.org"},{"name":"eric-swanson-dfinity","email":"eric.swanson@dfinity.org"},{"name":"krpeacock","email":"kylpeacock@gmail.com"},{"name":"terrorjack","email":"astrohavoc@gmail.com"},{"name":"npm-dfinity-org","email":"npm@dfinity.org"}],"homepage":"https://github.com/dfinity/ic-js#readme","bugs":{"url":"https://github.com/dfinity/ic-js"},"dist":{"shasum":"0b59cfc194198f2953205873e25a92a558d32a4b","tarball":"https://registry.npmjs.org/@dfinity/ledger/-/ledger-1.0.0-next-2023-10-02.1.tgz","fileCount":42,"integrity":"sha512-L+YouK2HH1lT0eMmqCM6DS8zEhg3U8oOsIWewnRg2n2c16JjkydMRWZJb+iB7dFL4aqeB90T5nvzpZqgNtNUdQ==","signatures":[{"sig":"MEQCIE3ul/l/ISYXFvMGrL8nftQt3oHlnIj9HGJ8p+qj9zzUAiA2I5eIqOyHm27cML3jXq/ZxZICMT5Alk8r9CZLFn8TBw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dfinity%2fledger@1.0.0-next-2023-10-02.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":262931},"main":"dist/cjs/index.cjs.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# ledger-js\n\nA library for interfacing with [ICRC ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1) on the Internet Computer.\n\n[![npm version](https://img.shields.io/npm/v/@dfinity/ledger.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/ledger) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Resources](#resources)\n\n## Installation\n\nYou can use `ledger-js` by installing it in your project.\n\n```bash\nnpm i @dfinity/ledger\n```\n\nThe bundle needs peer dependencies, be sure that following resources are available in your project as well.\n\n```bash\nnpm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils\n```\n\n## Usage\n\nThe features are available through the class `LedgerCanister`. It has to be instantiated with a canister ID.\n\ne.g. fetching a token metadata.\n\n```ts\nimport { IcrcLedgerCanister } from \"@dfinity/ledger\";\nimport { createAgent } from \"@dfinity/utils\";\n\nconst agent = await createAgent({\n  identity,\n  host: HOST,\n});\n\nconst { metadata } = IcrcLedgerCanister.create({\n  agent,\n  canisterId: MY_LEDGER_CANISTER_ID,\n});\n\nconst data = await metadata();\n```\n\n## Features\n\n`ledger-js` implements following features:\n\n<!-- TSDOC_START -->\n\n### :toolbox: Functions\n\n- [encodeIcrcAccount](#gear-encodeicrcaccount)\n- [decodeIcrcAccount](#gear-decodeicrcaccount)\n- [decodePayment](#gear-decodepayment)\n\n#### :gear: encodeIcrcAccount\n\nEncodes an Icrc-1 account compatible into a string.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                              |\n| ------------------- | ------------------------------------------------- |\n| `encodeIcrcAccount` | `({ owner, subaccount, }: IcrcAccount) => string` |\n\nParameters:\n\n- `account`: : Principal, subaccount?: Uint8Array }\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L21)\n\n#### :gear: decodeIcrcAccount\n\nDecodes a string into an Icrc-1 compatible account.\nFormatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n\n| Function            | Type                                     |\n| ------------------- | ---------------------------------------- |\n| `decodeIcrcAccount` | `(accountString: string) => IcrcAccount` |\n\nParameters:\n\n- `accountString`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/ledger.utils.ts#L59)\n\n#### :gear: decodePayment\n\n👀 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n\nA naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n\nIf the code doesn't match the expected pattern, `undefined` is returned for simplicity.\nSimilarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n\nPlease note that this function doesn't perform any validity checks on the extracted information.\nIt does not verify if the token is known or if the identifier is a valid address.\n\n```\nurn            = token \":\" address [ \"?\" params]\ntoken         = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\naddress       = STRING\nparams        = param [ \"&\" params ]\nparam         = [ amountparam ]\namountparam   = \"amount=\" *digit [ \".\" *digit ]\n```\n\n| Function        | Type                                                                        |\n| --------------- | --------------------------------------------------------------------------- |\n| `decodePayment` | `(code: string) => { token: string; identifier: string; amount?: number; }` |\n\nParameters:\n\n- `code`: string\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/utils/payment.utils.ts#L26)\n\n### :factory: IcrcLedgerCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L27)\n\n#### Methods\n\n- [create](#gear-create)\n- [metadata](#gear-metadata)\n- [transactionFee](#gear-transactionfee)\n- [balance](#gear-balance)\n- [transfer](#gear-transfer)\n- [totalTokensSupply](#gear-totaltokenssupply)\n- [transferFrom](#gear-transferfrom)\n- [approve](#gear-approve)\n- [allowance](#gear-allowance)\n\n##### :gear: create\n\n| Method   | Type                                                                   |\n| -------- | ---------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L28)\n\n##### :gear: metadata\n\nThe token metadata (name, symbol, etc.).\n\n| Method     | Type                                                          |\n| ---------- | ------------------------------------------------------------- |\n| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L42)\n\n##### :gear: transactionFee\n\nThe ledger transaction fees.\n\n| Method           | Type                                       |\n| ---------------- | ------------------------------------------ |\n| `transactionFee` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L50)\n\n##### :gear: balance\n\nReturns the balance for a given account provided as owner and with optional subaccount.\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `balance` | `(params: BalanceParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to get the balance of an account.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L59)\n\n##### :gear: transfer\n\nTransfers tokens from the sender to the given account.\n\n| Method     | Type                                          |\n| ---------- | --------------------------------------------- |\n| `transfer` | `(params: TransferParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L72)\n\n##### :gear: totalTokensSupply\n\nReturns the total supply of tokens.\n\n| Method              | Type                                       |\n| ------------------- | ------------------------------------------ |\n| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L88)\n\n##### :gear: transferFrom\n\nTransfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n\n| Method         | Type                                              |\n| -------------- | ------------------------------------------------- |\n| `transferFrom` | `(params: TransferFromParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to transfer tokens from to.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L101)\n\n##### :gear: approve\n\nThis method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n\n| Method    | Type                                         |\n| --------- | -------------------------------------------- |\n| `approve` | `(params: ApproveParams) => Promise<bigint>` |\n\nParameters:\n\n- `params`: The parameters to approve.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L123)\n\n##### :gear: allowance\n\nReturns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n\nReference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n\n| Method      | Type                                              |\n| ----------- | ------------------------------------------------- |\n| `allowance` | `(params: AllowanceParams) => Promise<Allowance>` |\n\nParameters:\n\n- `params`: The parameters to call the allowance.\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/ledger.canister.ts#L145)\n\n### :factory: IcrcIndexCanister\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L13)\n\n#### Methods\n\n- [create](#gear-create)\n- [getTransactions](#gear-gettransactions)\n\n##### :gear: create\n\n| Method   | Type                                                                  |\n| -------- | --------------------------------------------------------------------- |\n| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L14)\n\n##### :gear: getTransactions\n\nGet the transactions of an account\n\nAlways certified.\n`get_account_transactions` needs to be called with an update\nbecause the index canisters makes a call to the ledger canister to get the transaction data.\nIndex Canister only holds the transactions ids in state, not the whole transaction data.\n\n| Method            | Type                                                                 |\n| ----------------- | -------------------------------------------------------------------- |\n| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |\n\n[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger/src/index.canister.ts#L33)\n\n<!-- TSDOC_END -->\n\n## Resources\n\n- [Ledger & Tokenization Working Group Standards](https://github.com/dfinity/ICRC-1/)\n- [ICRC-1 Ledger](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1)\n","gitHead":"21a73b7bd188f3f531b6d24db4941180f0ede6ff","scripts":{"test":"jest","build":"npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration","rmdir":"node ../../scripts/rmdir.mjs","prepack":"npm run build","ts-declaration":"tsc --emitDeclarationOnly --outDir dist/types"},"_npmUser":{"name":"bitdivine","email":"bitdivine69@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"_npmVersion":"9.8.1","description":"A library for interfacing with ICRC ledgers on the Internet Computer.","directories":{},"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@dfinity/agent":"*","@dfinity/utils":"*","@dfinity/candid":"*","@dfinity/principal":"*"},"_npmOperationalInternal":{"tmp":"tmp/ledger_1.0.0-next-2023-10-02.1_1696241274869_0.07338048720775969","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-01-24T13:56:26.936Z","modified":"2026-10-05T08:13:59.429Z","0.0.1":"2023-01-24T13:56:27.219Z","0.0.2":"2023-01-24T14:04:58.558Z","0.0.2-next-2023-01-24":"2023-01-24T14:26:42.064Z","0.0.3":"2023-01-24T15:01:31.281Z","0.0.4-next-2023-01-24":"2023-01-24T15:10:32.118Z","0.0.4-next-2023-01-25":"2023-01-25T00:12:07.085Z","0.0.4-next-2023-01-25.1":"2023-01-25T16:04:12.902Z","0.0.4-next-2023-01-26":"2023-01-26T00:12:30.888Z","0.0.4-next-2023-01-26.1":"2023-01-26T14:00:59.558Z","0.0.4-next-2023-01-27":"2023-01-27T00:12:40.813Z","0.0.4-next-2023-01-28":"2023-01-28T00:11:46.877Z","0.0.4-next-2023-01-28.1":"2023-01-28T09:29:32.522Z","0.0.4":"2023-01-28T09:39:08.262Z","0.0.5-next-2023-01-28":"2023-01-28T09:44:21.940Z","0.0.5-next-2023-01-28.1":"2023-01-28T11:06:23.600Z","0.0.5-next-2023-01-29":"2023-01-29T00:13:24.711Z","0.0.5-next-2023-01-30":"2023-01-30T00:11:38.353Z","0.0.5-next-2023-01-30.1":"2023-01-30T11:18:16.939Z","0.0.5-next-2023-01-30.2":"2023-01-30T12:13:49.469Z","0.0.5-next-2023-01-31":"2023-01-31T00:12:38.768Z","0.0.5-next-2023-01-31.1":"2023-01-31T12:06:58.701Z","0.0.5-next-2023-02-01":"2023-02-01T00:12:45.015Z","0.0.5-next-2023-02-02":"2023-02-02T00:12:13.683Z","0.0.5-next-2023-02-03":"2023-02-03T00:11:36.752Z","0.0.5-next-2023-02-04":"2023-02-04T00:11:18.958Z","0.0.5-next-2023-02-05":"2023-02-05T00:12:26.890Z","0.0.5-next-2023-02-06":"2023-02-06T00:11:48.289Z","0.0.5-next-2023-02-07":"2023-02-07T00:12:09.480Z","0.0.5":"2023-02-07T08:46:43.885Z","0.0.6-next-2023-02-07":"2023-02-07T09:05:01.067Z","0.0.6-next-2023-02-07.1":"2023-02-07T13:44:08.132Z","0.0.6-next-2023-02-08":"2023-02-08T00:12:17.233Z","0.0.6-next-2023-02-08.1":"2023-02-08T05:51:31.429Z","0.0.6-next-2023-02-09":"2023-02-09T00:12:07.681Z","0.0.6-next-2023-02-10":"2023-02-10T00:12:23.442Z","0.0.6-next-2023-02-11":"2023-02-11T00:11:19.042Z","0.0.6-next-2023-02-12":"2023-02-12T00:12:57.191Z","0.0.6-next-2023-02-13":"2023-02-13T00:12:22.092Z","0.0.6-next-2023-02-13.1":"2023-02-13T09:53:50.833Z","0.0.6-next-2023-02-13.2":"2023-02-13T10:35:06.256Z","0.0.6-next-2023-02-13.3":"2023-02-13T17:13:38.434Z","0.0.6-next-2023-02-14":"2023-02-14T00:13:02.161Z","0.0.6-next-2023-02-14.1":"2023-02-14T06:01:44.787Z","0.0.6-next-2023-02-14.2":"2023-02-14T12:49:42.130Z","0.0.6-next-2023-02-15":"2023-02-15T00:12:32.078Z","0.0.6-next-2023-02-15.1":"2023-02-15T12:16:00.332Z","0.0.6-next-2023-02-16":"2023-02-16T00:12:10.636Z","0.0.6-next-2023-02-17":"2023-02-17T00:13:14.054Z","0.0.6-next-2023-02-18":"2023-02-18T00:11:56.356Z","0.0.6-next-2023-02-19":"2023-02-19T00:13:09.332Z","0.0.6-next-2023-02-20":"2023-02-20T00:13:08.796Z","0.0.6-next-2023-02-21":"2023-02-21T00:12:04.275Z","0.0.6-next-2023-02-22":"2023-02-22T00:12:26.468Z","0.0.6-next-2023-02-22.1":"2023-02-22T21:47:47.020Z","0.0.6-next-2023-02-23":"2023-02-23T00:13:12.787Z","0.0.6-next-2023-02-24":"2023-02-24T00:11:53.970Z","0.0.6-next-2023-02-25":"2023-02-25T00:13:29.755Z","0.0.6-next-2023-02-26":"2023-02-26T00:12:53.111Z","0.0.6-next-2023-02-27":"2023-02-27T00:12:32.573Z","0.0.6-next-2023-02-27.1":"2023-02-27T06:39:30.977Z","0.0.6-next-2023-02-28":"2023-02-28T00:12:25.294Z","0.0.6-next-2023-03-01":"2023-03-01T00:13:42.522Z","0.0.6-next-2023-03-02":"2023-03-02T00:13:20.082Z","0.0.6-next-2023-03-03":"2023-03-03T01:52:46.501Z","0.0.6-next-2023-03-04":"2023-03-04T00:11:40.515Z","0.0.6-next-2023-03-05":"2023-03-05T00:13:45.247Z","0.0.6-next-2023-03-06":"2023-03-06T00:12:59.591Z","0.0.6-next-2023-03-06.1":"2023-03-06T18:49:38.895Z","0.0.6-next-2023-03-07":"2023-03-07T00:13:21.060Z","0.0.6-next-2023-03-07.1":"2023-03-07T06:38:25.822Z","0.0.6-next-2023-03-08":"2023-03-08T00:11:59.180Z","0.0.6-next-2023-03-09":"2023-03-09T00:12:09.223Z","0.0.6-next-2023-03-10":"2023-03-10T00:12:40.974Z","0.0.6-next-2023-03-11":"2023-03-11T00:11:35.411Z","0.0.6-next-2023-03-12":"2023-03-12T00:12:43.113Z","0.0.6-next-2023-03-13":"2023-03-13T00:12:13.333Z","0.0.6-next-2023-03-13.1":"2023-03-13T16:33:26.358Z","0.0.6-next-2023-03-14":"2023-03-14T00:11:50.979Z","0.0.6-next-2023-03-15":"2023-03-15T00:12:01.715Z","0.0.6-next-2023-03-16":"2023-03-16T00:12:38.862Z","0.0.6-next-2023-03-17":"2023-03-17T00:12:04.344Z","0.0.6-next-2023-03-18":"2023-03-18T00:11:37.094Z","0.0.6-next-2023-03-19":"2023-03-19T00:13:30.015Z","0.0.6-next-2023-03-20":"2023-03-20T00:12:41.304Z","0.0.6-next-2023-03-21":"2023-03-21T00:11:08.002Z","0.0.6-next-2023-03-21.1":"2023-03-21T06:05:16.589Z","0.0.6-next-2023-03-22":"2023-03-22T00:10:53.873Z","0.0.6-next-2023-03-23":"2023-03-23T00:11:06.703Z","0.0.6-next-2023-03-24":"2023-03-24T00:11:40.551Z","0.0.6-next-2023-03-25":"2023-03-25T00:10:55.239Z","0.0.6-next-2023-03-26":"2023-03-26T00:12:15.127Z","0.0.6-next-2023-03-27":"2023-03-27T00:11:52.393Z","0.0.6-next-2023-03-28":"2023-03-28T00:11:53.651Z","0.0.6-next-2023-03-29":"2023-03-29T00:13:02.028Z","0.0.6-next-2023-03-30":"2023-03-30T00:11:16.917Z","0.0.6-next-2023-03-31":"2023-03-31T00:11:53.390Z","0.0.6-next-2023-04-01":"2023-04-01T00:11:35.411Z","0.0.6-next-2023-04-02":"2023-04-02T00:12:22.508Z","0.0.6-next-2023-04-03":"2023-04-03T00:11:37.146Z","0.0.6-next-2023-04-04":"2023-04-04T00:10:58.012Z","0.0.6-next-2023-04-04.1":"2023-04-04T16:48:05.232Z","0.0.6-next-2023-04-04.2":"2023-04-04T17:27:31.131Z","0.0.6-next-2023-04-05":"2023-04-05T00:10:34.719Z","0.0.6-next-2023-04-06":"2023-04-06T00:10:40.616Z","0.0.6-next-2023-04-07":"2023-04-07T00:10:43.488Z","0.0.6-next-2023-04-08":"2023-04-08T00:10:46.902Z","0.0.6-next-2023-04-09":"2023-04-09T00:12:24.862Z","0.0.6-next-2023-04-10":"2023-04-10T00:11:25.345Z","0.0.6-next-2023-04-11":"2023-04-11T00:10:57.947Z","0.0.6-next-2023-04-12":"2023-04-12T00:11:17.449Z","0.0.6-next-2023-04-13":"2023-04-13T00:10:34.888Z","0.0.6-next-2023-04-13.1":"2023-04-13T08:01:56.381Z","0.0.6-next-2023-04-13.2":"2023-04-13T08:26:22.019Z","0.0.6-next-2023-04-14":"2023-04-14T00:10:58.265Z","0.0.6-next-2023-04-15":"2023-04-15T00:11:40.166Z","0.0.6-next-2023-04-16":"2023-04-16T00:12:11.405Z","0.0.6-next-2023-04-17":"2023-04-17T00:11:19.978Z","0.0.6-next-2023-04-18":"2023-04-18T00:11:17.452Z","0.0.6":"2023-04-18T06:51:55.136Z","0.0.7-next-2023-04-18":"2023-04-18T07:33:30.492Z","0.0.7":"2023-04-18T07:56:45.336Z","0.0.8-next-2023-04-18":"2023-04-18T08:32:30.055Z","0.0.8-next-2023-04-19":"2023-04-19T00:12:00.592Z","0.0.8-next-2023-04-20":"2023-04-20T00:10:52.925Z","0.0.8-next-2023-04-20.1":"2023-04-20T10:49:20.746Z","0.0.8-next-2023-04-21":"2023-04-21T00:11:12.698Z","0.0.8-next-2023-04-22":"2023-04-22T00:11:13.410Z","0.0.8-next-2023-04-23":"2023-04-23T00:12:22.483Z","0.0.8-next-2023-04-24":"2023-04-24T00:11:51.825Z","0.0.8-next-2023-04-24.1":"2023-04-24T07:11:19.633Z","0.0.8-next-2023-04-24.2":"2023-04-24T08:56:09.153Z","0.0.8-next-2023-04-25":"2023-04-25T00:11:01.725Z","0.0.8-next-2023-04-26":"2023-04-26T00:11:24.967Z","0.0.8-next-2023-04-27":"2023-04-27T00:11:57.427Z","0.0.8-next-2023-04-27.1":"2023-04-27T10:11:07.420Z","0.0.8-next-2023-04-28":"2023-04-28T00:12:17.902Z","0.0.8-next-2023-04-29":"2023-04-29T00:11:05.277Z","0.0.8-next-2023-04-30":"2023-04-30T00:13:15.881Z","0.0.8-next-2023-05-01":"2023-05-01T00:12:14.485Z","0.0.8-next-2023-05-02":"2023-05-02T00:11:12.560Z","0.0.8-next-2023-05-03":"2023-05-03T00:11:11.143Z","0.0.8-next-2023-05-04":"2023-05-04T00:10:56.508Z","0.0.8-next-2023-05-05":"2023-05-05T00:11:05.718Z","0.0.8-next-2023-05-06":"2023-05-06T00:10:20.241Z","0.0.8-next-2023-05-07":"2023-05-07T00:12:01.695Z","0.0.8-next-2023-05-08":"2023-05-08T00:11:01.249Z","0.0.8-next-2023-05-09":"2023-05-09T00:11:29.374Z","0.0.8-next-2023-05-10":"2023-05-10T00:11:21.537Z","0.0.8-next-2023-05-11":"2023-05-11T00:11:41.420Z","0.0.8-next-2023-05-12":"2023-05-12T00:10:40.839Z","0.0.8-next-2023-05-13":"2023-05-13T00:10:41.443Z","0.0.8-next-2023-05-14":"2023-05-14T00:12:06.253Z","0.0.8-next-2023-05-15":"2023-05-15T00:11:27.583Z","0.0.8-next-2023-05-16":"2023-05-16T00:11:20.030Z","0.0.8-next-2023-05-17":"2023-05-17T00:12:25.234Z","0.0.8-next-2023-05-18":"2023-05-18T00:10:52.137Z","0.0.8-next-2023-05-19":"2023-05-19T00:11:35.289Z","0.0.8-next-2023-05-20":"2023-05-20T00:10:52.965Z","0.0.8-next-2023-05-21":"2023-05-21T00:12:08.596Z","0.0.8-next-2023-05-22":"2023-05-22T00:11:50.330Z","0.0.8-next-2023-05-23":"2023-05-23T00:11:20.439Z","0.0.8-next-2023-05-24":"2023-05-24T00:10:50.630Z","0.0.8":"2023-05-24T07:14:16.691Z","0.0.9-next-2023-05-24":"2023-05-24T09:13:01.808Z","0.0.9-next-2023-05-25":"2023-05-25T00:11:39.135Z","0.0.9-next-2023-05-26":"2023-05-26T00:11:33.963Z","0.0.9-next-2023-05-27":"2023-05-27T00:11:59.915Z","0.0.9-next-2023-05-28":"2023-05-28T00:12:33.447Z","0.0.9-next-2023-05-29":"2023-05-29T00:12:22.826Z","0.0.9-next-2023-05-30":"2023-05-30T00:11:22.741Z","0.0.9-next-2023-05-30.1":"2023-05-30T09:45:11.052Z","0.0.9-next-2023-05-31":"2023-05-31T00:12:35.019Z","0.0.9-next-2023-06-01":"2023-06-01T00:15:02.094Z","0.0.9-next-2023-06-02":"2023-06-02T00:12:13.585Z","0.0.9-next-2023-06-03":"2023-06-03T00:12:54.284Z","0.0.9-next-2023-06-04":"2023-06-04T00:13:22.420Z","0.0.9-next-2023-06-05":"2023-06-05T00:12:38.268Z","0.0.9-next-2023-06-06":"2023-06-06T00:12:55.357Z","0.0.9-next-2023-06-06.1":"2023-06-06T10:05:22.782Z","0.0.9-next-2023-06-07":"2023-06-07T00:12:41.642Z","0.0.9-next-2023-06-08":"2023-06-08T00:12:41.586Z","0.0.9-next-2023-06-09":"2023-06-09T00:12:58.529Z","0.0.9-next-2023-06-10":"2023-06-10T00:11:43.510Z","0.0.9-next-2023-06-11":"2023-06-11T00:13:42.605Z","0.0.9-next-2023-06-12":"2023-06-12T00:13:15.890Z","0.0.9-next-2023-06-12.1":"2023-06-12T12:24:47.574Z","0.0.9-next-2023-06-13":"2023-06-13T00:12:30.744Z","0.0.9-next-2023-06-13.1":"2023-06-13T13:10:14.289Z","0.0.9-next-2023-06-13.2":"2023-06-13T14:04:40.744Z","0.0.9-next-2023-06-14":"2023-06-14T00:11:40.156Z","0.0.9-next-2023-06-15":"2023-06-15T00:13:22.852Z","0.0.9-next-2023-06-15.1":"2023-06-15T12:56:13.441Z","0.0.9-next-2023-06-16":"2023-06-16T00:12:26.475Z","0.0.9-next-2023-06-17":"2023-06-17T00:11:33.590Z","0.0.9-next-2023-06-18":"2023-06-18T00:13:20.217Z","0.0.9-next-2023-06-19":"2023-06-19T00:12:34.913Z","0.0.9-next-2023-06-20":"2023-06-20T00:10:48.401Z","0.0.9":"2023-06-20T14:03:57.265Z","0.0.10-next-2023-06-21":"2023-06-21T00:12:35.689Z","0.0.10-next-2023-06-21.1":"2023-06-21T05:27:28.152Z","0.0.10-next-2023-06-21.2":"2023-06-21T06:16:25.602Z","0.0.10":"2023-06-21T09:56:41.703Z","0.0.11-next-2023-06-21":"2023-06-21T10:39:26.555Z","0.0.11-next-2023-06-22":"2023-06-22T00:12:35.366Z","0.0.11-next-2023-06-22.1":"2023-06-22T06:20:58.972Z","0.0.11-next-2023-06-23":"2023-06-23T00:14:19.605Z","0.0.11-next-2023-06-24":"2023-06-24T00:14:34.054Z","0.0.11-next-2023-06-25":"2023-06-25T00:14:47.529Z","0.0.11-next-2023-06-26":"2023-06-26T00:14:45.393Z","0.0.11-next-2023-06-26.1":"2023-06-26T05:58:37.616Z","0.0.11-next-2023-06-26.2":"2023-06-26T10:08:17.136Z","0.0.11-next-2023-06-27":"2023-06-27T00:13:43.613Z","0.0.11-next-2023-06-28":"2023-06-28T00:13:40.282Z","0.0.11-next-2023-06-29":"2023-06-29T00:14:08.167Z","0.0.11-next-2023-06-29.1":"2023-06-29T07:00:41.354Z","0.0.11-next-2023-06-30":"2023-06-30T00:12:30.633Z","0.0.11-next-2023-06-30.1":"2023-06-30T19:47:31.530Z","0.0.11-next-2023-06-30.2":"2023-06-30T21:38:38.753Z","0.0.11-next-2023-07-01":"2023-07-01T00:15:14.475Z","0.0.11-next-2023-07-01.1":"2023-07-01T06:10:32.925Z","0.0.11-next-2023-07-02":"2023-07-02T00:14:44.253Z","0.0.11-next-2023-07-03":"2023-07-03T00:14:13.466Z","0.0.11":"2023-07-03T05:31:13.905Z","0.0.12-next-2023-07-03":"2023-07-03T05:49:50.524Z","0.0.12-next-2023-07-03.1":"2023-07-03T09:46:04.605Z","0.0.12-next-2023-07-04":"2023-07-04T00:13:53.148Z","0.0.12-next-2023-07-05":"2023-07-05T00:14:31.109Z","0.0.12-next-2023-07-06":"2023-07-06T00:14:12.308Z","0.0.12-next-2023-07-07":"2023-07-07T00:14:16.331Z","0.0.12-next-2023-07-08":"2023-07-08T00:15:03.933Z","0.0.12-next-2023-07-09":"2023-07-09T00:15:15.135Z","0.0.12-next-2023-07-10":"2023-07-10T00:14:37.908Z","0.0.12-next-2023-07-11":"2023-07-11T00:15:14.229Z","0.0.12-next-2023-07-12":"2023-07-12T00:15:16.502Z","0.0.12-next-2023-07-13":"2023-07-13T00:15:04.614Z","0.0.12-next-2023-07-14":"2023-07-14T00:14:26.210Z","0.0.12-next-2023-07-15":"2023-07-15T00:14:05.387Z","0.0.12-next-2023-07-16":"2023-07-16T00:17:30.042Z","0.0.12-next-2023-07-17":"2023-07-17T00:14:47.452Z","0.0.12-next-2023-07-18":"2023-07-18T00:18:38.695Z","0.0.12-next-2023-07-19":"2023-07-19T00:18:00.900Z","0.0.12-next-2023-07-20":"2023-07-20T00:12:58.515Z","0.0.12-next-2023-07-21":"2023-07-21T00:12:51.633Z","0.0.12-next-2023-07-22":"2023-07-22T00:12:18.148Z","0.0.12-next-2023-07-23":"2023-07-23T00:13:21.482Z","0.0.12-next-2023-07-24":"2023-07-24T00:13:19.800Z","0.0.12-next-2023-07-24.1":"2023-07-24T12:45:38.262Z","0.0.12-next-2023-07-25":"2023-07-25T00:13:29.850Z","0.0.12-next-2023-07-26":"2023-07-26T00:12:39.816Z","0.0.12-next-2023-07-27":"2023-07-27T00:11:33.819Z","0.0.12-next-2023-07-28":"2023-07-28T00:12:31.960Z","0.0.12-next-2023-07-29":"2023-07-29T00:12:20.093Z","0.0.12-next-2023-07-30":"2023-07-30T00:13:26.449Z","0.0.12-next-2023-07-31":"2023-07-31T00:12:25.803Z","0.0.12-next-2023-08-01":"2023-08-01T00:14:23.042Z","0.0.12-next-2023-08-02":"2023-08-02T00:12:36.074Z","0.0.12-next-2023-08-02.1":"2023-08-02T08:34:46.676Z","0.0.12-next-2023-08-03":"2023-08-03T00:13:09.013Z","0.0.12-next-2023-08-04":"2023-08-04T00:13:04.455Z","0.0.12-next-2023-08-04.1":"2023-08-04T09:38:55.045Z","0.0.12-next-2023-08-05":"2023-08-05T00:12:48.110Z","0.0.12-next-2023-08-06":"2023-08-06T00:12:24.604Z","0.0.12-next-2023-08-07":"2023-08-07T00:13:00.426Z","0.0.12":"2023-08-07T04:58:01.837Z","0.0.13-next-2023-08-07":"2023-08-07T06:24:25.270Z","0.0.13-next-2023-08-08":"2023-08-08T00:12:20.348Z","0.0.13-next-2023-08-09":"2023-08-09T07:26:01.330Z","0.0.13-next-2023-08-10":"2023-08-10T00:12:48.643Z","0.0.13-next-2023-08-11":"2023-08-11T00:11:13.067Z","0.0.13-next-2023-08-12":"2023-08-12T00:10:24.347Z","0.0.13-next-2023-08-13":"2023-08-13T00:11:21.352Z","0.0.13-next-2023-08-14":"2023-08-14T00:11:15.988Z","0.0.13-next-2023-08-14.1":"2023-08-14T05:29:05.768Z","0.0.13-next-2023-08-15":"2023-08-15T00:11:10.792Z","0.0.13-next-2023-08-16":"2023-08-16T00:10:51.545Z","0.0.13-next-2023-08-17":"2023-08-17T00:10:45.406Z","0.0.13-next-2023-08-18":"2023-08-18T00:10:45.373Z","0.0.13-next-2023-08-19":"2023-08-19T00:10:38.889Z","0.0.13-next-2023-08-20":"2023-08-20T00:11:25.522Z","0.0.13-next-2023-08-21":"2023-08-21T00:10:51.965Z","0.0.13-next-2023-08-22":"2023-08-22T00:11:27.943Z","0.0.13-next-2023-08-23":"2023-08-23T00:10:56.462Z","0.0.13-next-2023-08-24":"2023-08-24T00:11:04.228Z","0.0.13":"2023-08-24T16:01:39.191Z","0.0.14-next-2023-08-24":"2023-08-24T16:10:24.149Z","0.0.14-next-2023-08-25":"2023-08-25T00:10:56.436Z","0.0.14-next-2023-08-26":"2023-08-26T00:11:11.592Z","0.0.14-next-2023-08-27":"2023-08-27T00:11:39.888Z","0.0.14-next-2023-08-28":"2023-08-28T00:11:19.399Z","0.0.14-next-2023-08-28.1":"2023-08-28T07:45:10.723Z","0.0.14-next-2023-08-29":"2023-08-29T00:11:27.147Z","0.0.14-next-2023-08-30":"2023-08-30T00:11:00.430Z","0.0.14-next-2023-08-31":"2023-08-31T00:11:12.125Z","0.0.14-next-2023-09-01":"2023-09-01T00:11:50.535Z","0.0.14-next-2023-09-02":"2023-09-02T00:10:46.880Z","0.0.14-next-2023-09-03":"2023-09-03T00:12:40.388Z","0.0.14-next-2023-09-04":"2023-09-04T00:11:17.239Z","0.0.14":"2023-09-04T05:02:22.189Z","0.0.15-next-2023-09-04":"2023-09-04T05:22:00.651Z","0.0.15-next-2023-09-05":"2023-09-05T00:10:51.711Z","0.0.15":"2023-09-05T07:25:36.045Z","0.0.16-next-2023-09-05":"2023-09-05T07:34:59.809Z","0.0.16-next-2023-09-06":"2023-09-06T00:10:59.121Z","0.0.16-next-2023-09-07":"2023-09-07T00:11:07.480Z","0.0.16-next-2023-09-08":"2023-09-08T00:10:57.030Z","0.0.16-next-2023-09-09":"2023-09-09T00:10:54.963Z","0.0.16-next-2023-09-10":"2023-09-10T00:11:53.475Z","0.0.16-next-2023-09-11":"2023-09-11T00:12:04.836Z","0.0.16-next-2023-09-12":"2023-09-12T00:11:09.978Z","0.0.16-next-2023-09-12.1":"2023-09-12T09:49:53.380Z","0.0.16-next-2023-09-13":"2023-09-13T00:12:02.741Z","0.0.16-next-2023-09-14":"2023-09-14T00:11:05.048Z","0.0.16-next-2023-09-15":"2023-09-15T00:11:22.364Z","0.0.16-next-2023-09-16":"2023-09-16T00:11:11.151Z","0.0.16-next-2023-09-17":"2023-09-17T00:12:32.988Z","0.0.16-next-2023-09-18":"2023-09-18T00:11:14.770Z","0.0.16-next-2023-09-18.1":"2023-09-18T09:01:23.601Z","0.0.16-next-2023-09-18.2":"2023-09-18T15:14:08.588Z","0.0.16-next-2023-09-19":"2023-09-19T00:11:42.119Z","0.0.16-next-2023-09-20":"2023-09-20T00:11:28.318Z","0.0.16-next-2023-09-21":"2023-09-21T00:10:50.041Z","0.0.16-next-2023-09-21.1":"2023-09-21T09:02:57.361Z","0.0.16-next-2023-09-22":"2023-09-22T00:11:40.680Z","0.0.16-next-2023-09-22.1":"2023-09-22T14:17:55.544Z","0.0.16-next-2023-09-23":"2023-09-23T00:10:54.419Z","0.0.16-next-2023-09-24":"2023-09-24T00:11:57.231Z","0.0.16-next-2023-09-25":"2023-09-25T00:11:20.734Z","0.0.16-next-2023-09-26":"2023-09-26T00:12:10.737Z","0.0.16-next-2023-09-27":"2023-09-27T08:50:44.251Z","0.0.16-next-2023-09-28":"2023-09-28T00:12:00.640Z","0.0.16-next-2023-09-29":"2023-09-29T00:11:34.566Z","0.0.16-next-2023-09-30":"2023-09-30T00:10:49.490Z","0.0.16-next-2023-10-01":"2023-10-01T00:13:27.292Z","0.0.16-next-2023-10-02":"2023-10-02T00:12:17.893Z","1.0.0":"2023-10-02T09:47:41.007Z","1.0.0-next-2023-10-02":"2023-10-02T09:52:11.267Z","1.0.0-next-2023-10-02.1":"2023-10-02T10:07:55.076Z"},"bugs":{"url":"https://github.com/dfinity/ic-js"},"license":"Apache-2.0","homepage":"https://github.com/dfinity/ic-js#readme","keywords":["internet computer","internet-computer","ic","dfinity","Ledger","ICRC-1 ledger","token"],"repository":{"url":"git+https://github.com/dfinity/ic-js.git","type":"git","directory":"packages/ledger"},"description":"A library for interfacing with ICRC ledgers on the Internet Computer.","maintainers":[{"email":"dominik.ayyildiz@dfinity.org","name":"dayyildiz"},{"email":"npm@dfinity.org","name":"npm-dfinity-org"},{"email":"itowner@dfinity.org","name":"dfn-it-owner"}],"readme":"","readmeFilename":""}