{"id":14980177,"url":"https://github.com/renproject/send-crypto","last_synced_at":"2025-10-06T12:53:11.451Z","repository":{"id":41530740,"uuid":"223872103","full_name":"renproject/send-crypto","owner":"renproject","description":"A minimal JavaScript library / wallet for sending crypto assets","archived":false,"fork":false,"pushed_at":"2023-01-08T00:10:31.000Z","size":2097,"stargazers_count":53,"open_issues_count":18,"forks_count":15,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-09-20T04:58:23.827Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/renproject.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-25T05:56:00.000Z","updated_at":"2025-05-22T15:06:39.000Z","dependencies_parsed_at":"2023-02-08T03:45:21.725Z","dependency_job_id":null,"html_url":"https://github.com/renproject/send-crypto","commit_stats":null,"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"purl":"pkg:github/renproject/send-crypto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renproject%2Fsend-crypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renproject%2Fsend-crypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renproject%2Fsend-crypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renproject%2Fsend-crypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renproject","download_url":"https://codeload.github.com/renproject/send-crypto/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renproject%2Fsend-crypto/sbom","scorecard":{"id":771111,"data":{"date":"2025-08-11","repo":{"name":"github.com/renproject/send-crypto","commit":"399f6430b809cc82742cabf1d72477059dbdbf0b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 1/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"41 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-4w2v-q235-vp99","Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-xq7p-g2vc-g82p","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-mhxj-85r3-2x55","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-8mmm-9v2q-x3f9","Warn: Project is vulnerable to: GHSA-7wwv-vh3v-89cq","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-ch52-vgq2-943f","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-g954-5hwp-pp24","Warn: Project is vulnerable to: GHSA-h755-8qp9-cq85","Warn: Project is vulnerable to: GHSA-584q-6j8j-r5pm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-5vhg-9xg4-cv9m","Warn: Project is vulnerable to: GHSA-7mc2-6phr-23xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T02:18:50.379Z","repository_id":41530740,"created_at":"2025-08-23T02:18:50.384Z","updated_at":"2025-08-23T02:18:50.384Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278614462,"owners_count":26015967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T14:01:24.544Z","updated_at":"2025-10-06T12:53:11.418Z","avatar_url":"https://github.com/renproject.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cimg alt=\"send crypto\" src=\"./send-crypto.svg\" width=\"200px\" /\u003e\n\n\u003chr /\u003e\n\nA minimal JavaScript library for sending crypto assets.\n\nCurrently doesn't support hierarchical or single-use addresses.\n\n## Supported assets\n\n-   \u003cimg style=\"margin-bottom: -5px;\" height=\"20\" width=\"20\" src=\"./.github/icons/btc.png\" /\u003e BTC\n\n-   \u003cimg style=\"margin-bottom: -5px;\" height=\"20\" width=\"20\" src=\"./.github/icons/ltc.png\" /\u003e LTC\n\n-   \u003cimg style=\"margin-bottom: -5px;\" height=\"20\" width=\"20\" src=\"./.github/icons/zec.png\" /\u003e ZEC (transparent txs only)\n\n-   \u003cimg style=\"margin-bottom: -5px;\" height=\"20\" width=\"20\" src=\"./.github/icons/bch.png\" /\u003e BCH\n\n-   \u003cimg style=\"margin-bottom: -5px;\" height=\"20\" width=\"20\" src=\"./.github/icons/fil.png\" /\u003e FIL\n\n-   \u003cimg style=\"margin-bottom: -5px;\" height=\"20\" width=\"20\" src=\"./.github/icons/eth.png\" /\u003e ETH\n\n-   \u003cimg style=\"margin-bottom: -5px;\" height=\"20\" width=\"20\" src=\"./.github/icons/eth.png\" /\u003e ERC20 tokens\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n# Usage\n\n```sh\nnpm install --save send-crypto\n# or\nyarn add send-crypto\n```\n\nReplace \"BTC\" with any supported asset:\n\n```ts\nconst CryptoAccount = require(\"send-crypto\");\n\n/* Load account from private key */\nconst privateKey = process.env.PRIVATE_KEY || CryptoAccount.newPrivateKey();\nconst account = new CryptoAccount(privateKey);\n\n/* Print address */\nconsole.log(await account.address(\"BTC\"));\n// \u003e \"1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa\"\n\n/* Print balance */\nconsole.log(await account.getBalance(\"BTC\"));\n// \u003e 0.01\n\n/* Send 0.01 BTC */\nconst txHash = await account\n    .send(\"1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa\", 0.01, \"BTC\")\n    .on(\"transactionHash\", console.log)\n    // \u003e \"3387418aaddb4927209c5032f515aa442a6587d6e54677f08a03b8fa7789e688\"\n    .on(\"confirmation\", console.log);\n// \u003e 1\n// \u003e 2 ...\n```\n\n**UNITS**: `getBalance` and `send` can be replaced with `getBalanceInSats` and `sendSats` respectively to use the blockchain's smallest units (satoshis for BTC, wei for ETH, etc.).\n\n**CONFIG**: Each of the functions `address`, `getBalance` and `send` accept an optional `options` parameter. See the available options in the sections \"All balance and transaction options\" for each asset below.\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n# Examples\n\n## Setup\n\n\u003cdetails\u003e\n\u003chr /\u003e\n\u003csummary\u003eLoad private key from a .env file\u003c/summary\u003e\n\n`.env`:\n\n```sh\nPRIVATE_KEY=\"1234512341\"\n```\n\nUse the `dotenv` library (installed with `npm i -D dotenv`) or run `source .env` before running:\n\n```ts\nrequire(\"dotenv\").config();\nconst CryptoAccount = require(\"send-crypto\");\nconst account = new CryptoAccount(process.env.PRIVATE_KEY);\n```\n\n\u003chr /\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003chr /\u003e\n\u003csummary\u003eCreate new account\u003c/summary\u003e\n\n```ts\nconst privateKey = CryptoAccount.newPrivateKey();\nconsole.log(`Save your key somewhere: ${privateKey}`);\nconst account = new CryptoAccount(privateKey);\n```\n\n\u003chr /\u003e\n\u003c/details\u003e\n\n## BTC, ZEC, BCH\n\n\u003cdetails\u003e\n\u003chr /\u003e\n\u003csummary\u003eSend BTC (Bitcoin)\u003c/summary\u003e\n\n```ts\nconst CryptoAccount = require(\"send-crypto\");\nconst account = new CryptoAccount(process.env.PRIVATE_KEY);\n\n// Send BTC\nawait account.send(\"1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa\", 0.01, \"BTC\");\n```\n\n\u003chr /\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003chr /\u003e\n\u003csummary\u003eSend ZEC (Zcash)\u003c/summary\u003e\n\n```ts\nconst CryptoAccount = require(\"send-crypto\");\nconst account = new CryptoAccount(process.env.PRIVATE_KEY);\n\n// Send ZEC\nawait account.send(\"t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd\", 0.01, \"ZEC\");\n```\n\n\u003chr /\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003chr /\u003e\n\u003csummary\u003eSend BCH (Bitcoin Cash)\u003c/summary\u003e\n\nCashAddr, BitPay and legacy addresses are supported.\n\n```ts\nconst CryptoAccount = require(\"send-crypto\");\nconst account = new CryptoAccount(process.env.PRIVATE_KEY);\n\n// Send BCH\nawait account.send(\n    \"bitcoincash:qp3wjpa3tjlj042z2wv7hahsldgwhwy0rq9sywjpyy\",\n    0.01,\n    \"BCH\"\n);\n```\n\n\u003chr /\u003e\n\u003c/details\u003e\n\nYou can replace `\"BTC\"` with `\"ZEC\"` or `\"BCH\"` in the following examples:\n\n\u003cdetails\u003e\n\u003chr /\u003e\n\u003csummary\u003eSend entire balance\u003c/summary\u003e\n\n```ts\nconst balance = await account.getBalance(\"BTC\");\nawait account.send(\"1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa\", balance, \"BTC\", {\n    subtractFee: true,\n});\n\n// Or using sats as the unit\nconst balanceInSats = await account.getBalanceInSats(\"BTC\");\nawait account.sendSats(\n    \"1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa\",\n    balanceInSats,\n    \"BTC\",\n    { subtractFee: true }\n);\n```\n\n\u003chr /\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003chr /\u003e\n\u003csummary\u003eWait for 6 confirmations\u003c/summary\u003e\n\n```ts\nawait new Promise((resolve, reject) =\u003e\n    account.send(\"1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa\", 0.01, \"BTC\")\n        .on(\"confirmation\", confirmations =\u003e { if (confirmations \u003e= 6) { resolve(); } })\n        .catch(reject);\n);\n```\n\n\u003chr /\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003chr /\u003e\n\u003csummary\u003eSend testnet funds\u003c/summary\u003e\n\n```ts\nconst testnetAccount = new CryptoAccount(process.env.PRIVATE_KEY, {\n    network: \"testnet\",\n});\nawait testnetAccount.send(\"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\", 0.01, \"BTC\");\n```\n\n\u003chr /\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003chr /\u003e\n\u003csummary\u003e\u003cb\u003eAll balance and transaction options\u003c/b\u003e\u003c/summary\u003e\n\nThe `getBalance` and `getBalanceInSats` options are:\n\n```ts\n{\n    // Get the balance of an address other than the current account's\n    address?: string;\n\n    // The number of confirmations UTXOs must have to be included in the balance\n    confirmations?: number; // defaults to 0\n}\n```\n\nThe `send` and `sendSats` options are:\n\n```ts\n{\n    // The number of confirmations UTXOs must have to be included in the inputs\n    confirmations?: number; // defaults to 0\n\n    // The fee in satoshis/zatoshis to use\n    fee?: number;           // defaults to 10000\n\n    // Whether the fee should be included or excluded from `value`\n    subtractFee?: boolean;  // defaults to false\n}\n```\n\n\u003chr /\u003e\n\u003c/details\u003e\n\n## ETH, ERC20\n\n\u003cdetails\u003e\n\u003chr /\u003e\n\u003csummary\u003eSend ETH (Ether, Ethereum)\u003c/summary\u003e\n\n```ts\nconst CryptoAccount = require(\"send-crypto\");\nconst account = new CryptoAccount(process.env.PRIVATE_KEY);\n\n// Send ETH\nawait account.send(\"0x05a56e2d52c817161883f50c441c3228cfe54d9f\", 0.01, \"ETH\");\n```\n\n\u003chr /\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003chr /\u003e\n\u003csummary\u003eSend ERC20 tokens\u003c/summary\u003e\n\nYou can transfer arbitrary ERC20 tokens by providing the token's address:\n\n```ts\nconst CryptoAccount = require(\"send-crypto\");\nconst account = new CryptoAccount(process.env.PRIVATE_KEY);\n\nawait account.send(\"0x05a56e2d52c817161883f50c441c3228cfe54d9f\", 1.234, {\n    type: \"ERC20\",\n    address: \"0x408e41876cccdc0f92210600ef50372656052a38\",\n});\n```\n\nA few well known ERC20 tokens can be referenced by name:\n\n```ts\nawait account.send(\"0x05a56e2d52c817161883f50c441c3228cfe54d9f\", 1.234, {\n    type: \"ERC20\",\n    name: \"DAI\",\n});\n```\n\nSee the [ERC20s.ts](./src/handlers/ERC20/ERC20s.ts) to see the tokens than can be referenced by name.\n\n\u003chr /\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003chr /\u003e\n\u003csummary\u003eSend testnet funds (\u003ci\u003eropsten\u003c/i\u003e, \u003ci\u003ekovan\u003c/i\u003e, etc.)\u003c/summary\u003e\n\nThe supported testnets are `mainnet`, `ropsten`, `kovan`, `rinkeby` and `goerli`.\n\n```ts\n// Use \"testnet\" BTC, BCH \u0026 ZEC; use \"ropsten\" ETH.\nconst testnetAccount = new CryptoAccount(process.env.PRIVATE_KEY, {\n    network: \"testnet\",\n});\nconst testnetAccount = new CryptoAccount(process.env.PRIVATE_KEY, {\n    network: \"ropsten\",\n});\n```\n\n```ts\n// Use \"testnet\" BTC, BCH \u0026 ZEC; use \"kovan\" ETH.\nconst testnetAccount = new CryptoAccount(process.env.PRIVATE_KEY, {\n    network: \"kovan\",\n});\n```\n\n\u003chr /\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003chr /\u003e\n\u003csummary\u003e\u003cb\u003eAll balance and transaction options\u003c/b\u003e\u003c/summary\u003e\n\nThe `getBalance` and `getBalanceInSats` options are:\n\n```ts\n{\n    // Get the balance of an address other than the current account's\n    address?: string;\n}\n```\n\nThe `send` and `sendSats` options are:\n\n```ts\n{\n    // Gas limit\n    gas?: number | string;\n\n    // Gas price in WEI\n    gasPrice?: number | string | BN;\n\n    // Include data with the transfer\n    data?: string;\n\n    // Override the transaction nonce\n    nonce?: number;\n\n    // [ETH] Whether the fee should be included or excluded from `value`\n    subtractFee?: boolean;  // defaults to false\n\n    // [ERC20] Approve instead of transferring\n    approve?: boolean; // defaults to false\n}\n```\n\n\u003chr /\u003e\n\u003c/details\u003e\n\n\u003cbr /\u003e\u003cbr /\u003e\u003cbr /\u003e\u003cbr /\u003e\u003cbr /\u003e\u003cbr /\u003e\n\n# Custom assets\n\nIf you want to send a cryptocurrency or token that isn't supported by the library, or enhance support for one of the assets above (e.g. add support for a new address format), you can write your own handler using the instructions below.\n\n\u003cdetails\u003e\n\u003chr /\u003e\n\u003csummary style=\"font-size: 20px;\"\u003eAdding custom assets\u003c/summary\u003e\n\nHandlers must implement the (TypeScript) interface below.\n\nThe `handlesAsset` function is called to ask if the handler can handle an asset.\n\nAll other functions are optional. If a function isn't provided, the next handler is called instead.\n\n```ts\nexport abstract class Handler\u003c\n    ConstructorOptions = {},\n    AddressOptions = {},\n    BalanceOptions extends { address?: string } = { address?: string },\n    TxOptions = {}\n\u003e {\n    // sharedState allows multiple handlers access common state.\n    constructor(\n        privateKey: string,\n        network: string,\n        constructorOptions?: ConstructorOptions,\n        sharedState?: any\n    ) {\n        /* */\n    }\n\n    // Returns whether or not this can handle the asset\n    public handlesAsset!: (asset: Asset) =\u003e boolean;\n\n    // Returns the address of the account\n    public address?: (\n        asset: Asset,\n        options?: AddressOptions,\n        deferHandler?: DeferHandler\n    ) =\u003e Promise\u003cstring\u003e;\n\n    // Returns the balance of the account\n    public getBalance?: (\n        asset: Asset,\n        options?: BalanceOptions,\n        deferHandler?: DeferHandler\n    ) =\u003e Promise\u003cBigNumber\u003e;\n    public getBalanceInSats?: (\n        asset: Asset,\n        options?: BalanceOptions,\n        deferHandler?: DeferHandler\n    ) =\u003e Promise\u003cBigNumber\u003e;\n\n    // Transfers the asset to the provided address\n    public send?: (\n        to: string,\n        value: BigNumber,\n        asset: Asset,\n        options?: TxOptions,\n        deferHandler?: DeferHandler\n    ) =\u003e PromiEvent\u003cstring\u003e;\n    public sendSats?: (\n        to: string,\n        value: BigNumber,\n        asset: Asset,\n        options?: TxOptions,\n        deferHandler?: DeferHandler\n    ) =\u003e PromiEvent\u003cstring\u003e;\n}\n```\n\nAnd then register the handler:\n\n```ts\nconst CryptoAccount = require(\"send-crypto\");\nconst account = new CryptoAccount(process.env.PRIVATE_KEY);\naccount.registerHandler(MyCystomHandler);\n```\n\n`registerHandler` accepts an optional `priority` parameter for setting the order of handlers (see [`index.ts`](./src/index.ts) to see the default ordering).\n\nYou can wrap around other handlers by using the `defer` parameter passed in to each function. For example, to add support for ENS names for Ethereum, you can resolve the `to` address and then call `defer`:\n\n```ts\nclass ENSResolver {\n    /* ... */\n\n    handlesAsset = (asset: Asset) =\u003e asset === \"ETH\";\n\n    resolveENSName = (to: string): Promise\u003cstring\u003e =\u003e {\n        /* ... */\n    };\n\n    send = async (\n        to: string,\n        value: BigNumber,\n        asset: Asset,\n        deferHandler: Handler\n    ): PromiEvent\u003cstring\u003e =\u003e {\n        return deferHandler.send(await resolveENSName(to), value, asset);\n    };\n}\n```\n\nSee the following handlers as references:\n\n-   [BTC Handler](./src/handlers/BTC/BTCHandler.ts) (ZEC and BCH handlers are similar)\n-   [ETH Handler](./src/handlers/ETH/ETHHandler.ts)\n-   [ERC20 Handler](./src/handlers/ERC20/ERC20Handler.ts)\n\u003chr /\u003e\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenproject%2Fsend-crypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenproject%2Fsend-crypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenproject%2Fsend-crypto/lists"}