{"_id":"@aloe2/account-lib","name":"@aloe2/account-lib","dist-tags":{"aloe-bbc82c9c9":"2.20.20228282226","latest":"2.20.20228282226"},"versions":{"2.20.20228282226":{"name":"@aloe2/account-lib","version":"2.20.20228282226","description":"BitGo's account library functions","main":"./dist/src/index.js","types":"./dist/src/index.d.ts","scripts":{"build":"npm run prepare","clean":"rm -rf dist/*","coverage":"npm run gen-coverage && npm run upload-coverage","lint":"eslint --quiet 'src/**/*.ts' 'test/**/*.ts'","lint-fix":"eslint --fix 'src/**/*.ts' 'test/**/*.ts'","prepare":"npm run build-ts && cp -r ./resources ./dist","build-ts":"tsc --build --incremental --verbose .","unit-test":"nyc -- mocha","test":"npm run unit-test","unprettied":"grep -R -L --include '*.ts' --include '*.js' --include '*.json' '@prettier' src test"},"repository":{"type":"git","url":"git+https://github.com/BitGo/BitGoJS.git","directory":"modules/account-lib"},"author":{"name":"BitGo SDK Team","email":"sdkteam@bitgo.com"},"license":"ISC","engines":{"node":">=14 <17"},"dependencies":{"@aloe2/sdk-coin-algo":"^1.1.20228282226","@aloe2/sdk-coin-avaxc":"^1.1.20228282226","@aloe2/sdk-coin-avaxp":"^2.0.20228282226","@aloe2/sdk-coin-bsc":"^1.0.20228282226","@aloe2/sdk-coin-celo":"^1.1.20228282226","@aloe2/sdk-coin-cspr":"^1.0.20228282226","@aloe2/sdk-coin-dot":"^1.0.20228282226","@aloe2/sdk-coin-etc":"^1.0.20228282226","@aloe2/sdk-coin-eth":"^1.1.20228282226","@aloe2/sdk-coin-eth2":"^1.0.20228282226","@aloe2/sdk-coin-hbar":"^1.0.20228282226","@aloe2/sdk-coin-near":"^1.1.20228282226","@aloe2/sdk-coin-polygon":"^1.0.20228282226","@aloe2/sdk-coin-rbtc":"^1.1.20228282226","@aloe2/sdk-coin-sol":"^1.0.20228282226","@aloe2/sdk-coin-stx":"^1.1.20228282226","@aloe2/sdk-coin-trx":"^1.0.20228282226","@aloe2/sdk-coin-xtz":"^1.1.20228282226","@aloe2/sdk-core":"^1.1.20228282226","@aloe2/statics":"^7.0.20228282226","bignumber.js":"^9.0.0","bs58":"^4.0.1"},"devDependencies":{"@solana/web3.js":"1.56.0","@types/bs58":"^4.0.1","@types/keccak":"^3.0.1","keccak":"3.0.2","paillier-bigint":"3.3.0"},"nyc":{"extension":[".ts"],"include":["src/**/*.ts"]},"lint-staged":{"*.{js,ts}":["yarn prettier --write","yarn eslint --fix"]},"publishConfig":{"access":"public"},"gitHead":"ff34e1949ea30d3016d4a8e17d459eee4436eda5","bugs":{"url":"https://github.com/BitGo/BitGoJS/issues"},"homepage":"https://github.com/BitGo/BitGoJS#readme","_id":"@aloe2/account-lib@2.20.20228282226","_nodeVersion":"14.18.0","_npmVersion":"lerna/5.5.0/node@v14.18.0+x64 (darwin)","dist":{"integrity":"sha512-Vaf9/Z6x+qlFoIpe/FXMM7Ire+WMdc/ooBOCVtScTiQ6t5f4Kbslc2PquzkMcSlHnOy2fK96RoelJ9BjYj22Jw==","shasum":"181ec35373e4c9a449f5174acb4d356a8f746a9b","tarball":"https://registry.npmjs.org/@aloe2/account-lib/-/account-lib-2.20.20228282226.tgz","fileCount":35,"unpackedSize":6972829,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCcPPsBul2jkE+373BilVXDvuwVIUGead8EA63DHRdprAIge+WX/SIONma6pqDwx4EnDyaDMqayCUrblJbRSS4CUTI="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjNS5iACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrF9w//coJ89T+aZuHwK6OViBZvMfmaownF4/Eg6+ISc89V0bK0fJz9\r\noEFiUMDKmhlsTSTv8/jCCqQeXfxp9SQN4p+p7W/P0XLJj4jsQqmBQocQHkqN\r\nzXk0iALtp+2jVNptJGuSiaXuYDq1lGq8HtWEhX+erfgOHkIsLJuSaFXAfhgg\r\nFXGow4r6mqzNkqTvbcG39rNkOWX4vP33IK/BmXbNd9EzpQL3yt46/2mWKsVJ\r\nuVjUIzD0N4uV8+X9TNjokSGdzstyVKru3/Hi4YlYdFaw1eFb+MHS10ztLL5t\r\nGJYRITj+v8H+LBA/Q4GfUW2hgp28i8op0UgjjxxE5ZD3MkGRgViRTuoOxBzA\r\niwCgIqSUXcQbm7/yk1lPPEjRjmytahyDOEzTsXvM7m6gqvhiQUpbbGexmUoE\r\n7zjHyB3mu8T4cFBKA17Ypuu6q7w4LmYD4kSGSycjPSqGs15Ghr7S600Z3AsH\r\np1ZiJVwlFdZ/EDhwXgvU22crs6oFKzqgvMIMNY9dyYxIyZhdqAGDgbBnd+II\r\nJ+9CyayCcLYDbCZOC3FyNPgL9kW4J5e+cU9nWrxTQJKvCbU0LLuFF1EryBHI\r\npN65qReMcIye792q1yFniFZagND/3Xk4IapMo8EzDEcJsgBffnBLk8XKnpXR\r\nwvI/UvBK2Crcmc8yrHtGF0REFdV3WsTxdxQ=\r\n=2rIq\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aaronloe","email":"aaronloe@gmail.com"},"directories":{},"maintainers":[{"name":"aaronloe","email":"aaronloe@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/account-lib_2.20.20228282226_1664429666480_0.13513424239440286"},"_hasShrinkwrap":false}},"time":{"created":"2022-09-29T05:34:26.424Z","2.20.20228282226":"2022-09-29T05:34:26.770Z","modified":"2022-09-29T05:34:26.943Z"},"maintainers":[{"name":"aaronloe","email":"aaronloe@gmail.com"}],"description":"BitGo's account library functions","homepage":"https://github.com/BitGo/BitGoJS#readme","repository":{"type":"git","url":"git+https://github.com/BitGo/BitGoJS.git","directory":"modules/account-lib"},"author":{"name":"BitGo SDK Team","email":"sdkteam@bitgo.com"},"bugs":{"url":"https://github.com/BitGo/BitGoJS/issues"},"license":"ISC","readme":"# BitGo Account Lib\n\nThis library is responsible for building and signing transactions for\naccount-based coins (for example, Ethereum, Algorand, EOS, Tron, etc.). Account\nLib was developed for BitGo and BitGo's multi-sig wallets, but it can also be\nused independently, outside of our wallet ecosystem.\n\n> Account Lib can be used in an offline environment.\n\n## Supported Coins\n\nBelow is the list of coins supported by this library -- as well as those that\nare on the roadmap.\n\n| Coin             | Mainnet Ticker | Testnet Ticker | Supported In Library |\n|:-----------------|:---------------|:---------------|:---------------------|\n| Alogrand         | algo           | talgo          | Yes                  |\n| CELO             | celo           | tcelo          | Yes                  |\n| Ethereum         | eth            | teth           | Yes                  |\n| Ethereum Classic | etc            | tetc           | Yes                  |\n| RSK              | rbtc           | trbtc          | Yes                  |\n| Stellar          | xlm            | txlm           | Not yet...           |\n| Tezos            | xtz            | txtz           | Yes                  |\n| Tron             | trx            | ttrx           | Yes                  |\n\n## Core Concepts\n\n### TransactionBuilder\n\nThe `TranssactionBuilder` class guides a user through the construction of a\ntransaction. The purpose of the `TransactionBuilder` is to yield a `Transaction`\nobject that can broadcast to the network.\n\n### Transaction\n\n`Transaction` objects are JavaScript representations of blockchain transactions\nthat implement protocol specific validation rules. `Transactions` provide\nencoding mechanisms that allow them to be validly broadcast to their respective\nnetwork.\n\n#### Transaction Types\n\n`TransactionBuilder` supports the following transaction types:\n\n- **Send**: Transfers funds from a wallet.\n\n- **Wallet Initialization**: Initializes a wallet's account on the network\n  (e.g., multi-sig contract deployment).\n\n- **Address Initialization**: Initializes a wallet's address on the network\n  (e.g., forwarder contract deployment).\n\n- **Account Update**: Updates an account on the network (e.g., public key\n  revelation operation for Tezos).\n\n### Offline Availability\n\nAccount Lib was designed to be used for offline signings in an offline\nenvironment.\n\n---\n\n## Installation\n\nInstall the library with npm. If you plan on contributing to the project, you\nmay wish to follow different installation instructions\n[outlined in this doc](DEVELOPER.md).\n\n```\n$ cd <your_project>\n$ npm install @bitgo/account-lib\n```\n\n## Usage\n\nBelow is an example that demonstrates how the library can be used to build and\nsign a Tron testnet transaction.\n\n### Instantiation\n\nInstantiate the `TransactionBuilder` for the coin you want to work with:\n\n```javascript\n// Import the package (javascript import)\nconst accountLib = require('@bitgo/account-lib');\n// or import the pacakage using typescript\nimport * as accountLib from '@bitgo/account-lib';\n\n// Instantiate the Transaction Builder for Tron (testnet)\nconst txBuilder = accountLib.getBuilder('ttrx');\n```\n\n### Transaction Construction and Signing\n\nUse the transaction builder instance (created in the previous step) to sign a\ntransaction:\n\n```javascript\n// Define an unsigned Tron transaction object\nconst unsignedBuildTransaction = {\n  visible: false,\n  txID: '80b8b9eaed51c8bba3b49f7f0e7cc5f21ac99a6f3e2893c663b544bf2c695b1d',\n  raw_data: {\n    contract: [\n      {\n        parameter: {\n          value: {\n            amount: 1718,\n            owner_address: '41c4530f6bfa902b7398ac773da56106a15af15f92',\n            to_address: '4189ffaf9da8c6fae32189b2e6dce228249b1129aa',\n          },\n          type_url: 'type.googleapis.com/protocol.TransferContract',\n        },\n        type: 'TransferContract',\n      },\n    ],\n    ref_block_bytes: '90e4',\n    ref_block_hash: 'a018bf9892ddb138',\n    expiration: 1571811468000,\n    timestamp: 1571811410819,\n  },\n  raw_data_hex:\n    '0a0290e42208a018bf9892ddb13840e0c58ebadf2d5a66080112620a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412310a1541c4530f6bfa902b7398ac773da56106a15af15f9212154189ffaf9da8c6fae32189b2e6dce228249b1129aa18b60d7083878bbadf2d',\n};\n\n// Use that object to build and sign a transaction\ntxBuilder.from(unsignedBuildTransaction);\ntxBuilder.sign({\n  key: 'A81B2E0C55A7E2B2E837ZZC437A6397B316536196989A6F09EE49C19AD33590W',\n});\nconst tx = await txBuilder.build();\n```\n\nMore examples:\n\n- [Tron transaction building examples](https://github.com/BitGo/bitgo-account-lib/blob/master/test/unit/coin/trx/transactionBuilder.ts)\n- [Tezos transaction building examples](https://github.com/BitGo/bitgo-account-lib/blob/master/test/unit/coin/xtz/transactionBuilder.ts)\n\n## Developers\n\nIf you'd like to contribute to this project, see the\n[developer guide](DEVELOPER.md) for contribution norms and expectations.\n\nThere is a near-term goal to move this library toward a plugin-based\narchitecture for coin registration. Until then, PRs adding support for new coins\nwill be put on hold.\n","readmeFilename":"README.md"}