├── .editorconfig ├── .gitignore ├── .husky └── pre-commit ├── .npmignore ├── .prettierignore ├── .prettierrc ├── CHANGELOG.md ├── LICENSE ├── README.md ├── assets └── logo.png ├── eslint.config.mjs ├── karma.conf.js ├── package-lock.json ├── package.json ├── scripts ├── pre-commit.js ├── test-browser.js └── test-node.js ├── src ├── index.ts ├── lib │ ├── TransactionBuilder │ │ ├── TransactionBuilder.ts │ │ └── helper.ts │ ├── contract │ │ ├── index.ts │ │ └── method.ts │ ├── event.ts │ ├── plugin.ts │ ├── providers │ │ ├── HttpProvider.ts │ │ └── index.ts │ └── trx.ts ├── paramValidator │ └── index.ts ├── protocol │ └── core │ │ ├── Tron_pb.cjs │ │ └── contract │ │ ├── account_contract_pb.cjs │ │ ├── asset_issue_contract_pb.cjs │ │ ├── balance_contract_pb.cjs │ │ ├── common_pb.cjs │ │ ├── exchange_contract_pb.cjs │ │ ├── proposal_contract_pb.cjs │ │ ├── smart_contract_pb.cjs │ │ ├── storage_contract_pb.cjs │ │ ├── vote_asset_contract_pb.cjs │ │ └── witness_contract_pb.cjs ├── tronweb.ts ├── types │ ├── ABI.ts │ ├── APIResponse.ts │ ├── Contract.ts │ ├── Providers.ts │ ├── Transaction.ts │ ├── TransactionBuilder.ts │ ├── TronWeb.ts │ ├── Trx.ts │ ├── UtilsTypes.ts │ ├── index.ts │ └── interface.d.ts └── utils │ ├── abi.ts │ ├── accounts.ts │ ├── address.ts │ ├── base58.ts │ ├── base64.ts │ ├── bytes.ts │ ├── code.ts │ ├── crypto.ts │ ├── ethersUtils.ts │ ├── fragments.ts │ ├── help.ts │ ├── index.ts │ ├── interface.ts │ ├── message.ts │ ├── transaction.ts │ ├── typedData.ts │ └── validations.ts ├── test ├── fixtures │ └── contracts.ts ├── helpers │ ├── BlockLib.ts │ ├── GetNowBlock.ts │ ├── MetaCoin.json │ ├── assertEqualHex.ts │ ├── assertThrow.ts │ ├── broadcaster.ts │ ├── config.ts │ ├── getBlockHeader.ts │ ├── jlog.ts │ ├── log.ts │ ├── newAccounts.ts │ ├── pollAccountFor.ts │ ├── testUtils.ts │ ├── tronWebBuilder.ts │ ├── txPars.ts │ ├── wait.ts │ └── waitChainData.ts ├── index.test.ts ├── lib │ ├── contract │ │ ├── index.test.ts │ │ └── method.test.ts │ ├── event.test.ts │ ├── plugin.test.ts │ ├── transactionBuilder.test.ts │ └── trx.test.ts ├── setup │ ├── TronWeb.ts │ └── node.ts ├── testcases │ ├── contract-interface-abi2.json.gz │ ├── contract-interface.json.gz │ ├── eip712.json.gz │ └── src │ │ ├── disk-utils.ts │ │ └── sign-message.ts └── utils │ ├── abi.test.ts │ ├── accounts.test.ts │ ├── base58.test.ts │ ├── bytes.test.ts │ ├── code.test.ts │ ├── index.test.ts │ ├── message.test.ts │ ├── transaction.test.ts │ └── typedData.test.ts ├── tsconfig.base.json ├── tsconfig.cjs.json ├── tsconfig.esm.json ├── tsconfig.json ├── tsconfig.test.json ├── tsconfig.types.json ├── webpack.base.config.js └── webpack.config.js /.editorconfig: -------------------------------------------------------------------------------- 1 | ; editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 4 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.json] 13 | indent_size = 4 14 | 15 | [*.ts] 16 | indent_size = 4 17 | quote_type = single 18 | 19 | [*.js] 20 | indent_size = 4 21 | quote_type = single 22 | 23 | [*.html] 24 | indent_size = 4 25 | 26 | [*.yaml] 27 | indent_size = 4 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .next 2 | node_modules 3 | .DS_Store 4 | test/setup/TronWeb.js 5 | coverage 6 | yarn-error.log 7 | /dist 8 | .env 9 | .vscode/ 10 | .idea/ 11 | example/ 12 | test/lib/dist/ 13 | /lib/ 14 | !src/lib 15 | !test/lib 16 | 17 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm run lint 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .next 2 | .DS_Store 3 | test 4 | coverage 5 | .idea 6 | .scratch 7 | scripts 8 | src 9 | demo 10 | .vscode 11 | test-git-hash 12 | test-report 13 | pre-commit-result 14 | .editorconfig 15 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | !.vscode/settings.json 19 | .idea 20 | .DS_Store 21 | *.suo 22 | *.ntvs* 23 | *.njsproj 24 | *.sln 25 | *.sw? 26 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 130, 3 | "tabWidth": 4, 4 | "useTabs": false, 5 | "semi": true, 6 | "singleQuote": true, 7 | "quoteProps": "as-needed", 8 | "jsxSingleQuote": false, 9 | "trailingComma": "es5", 10 | "bracketSpacing": true, 11 | "bracketSameLine": false, 12 | "jsxBracketSameLine": false, 13 | "arrowParens": "always", 14 | "requirePragma": false, 15 | "insertPragma": false, 16 | "proseWrap": "preserve", 17 | "htmlWhitespaceSensitivity": "css", 18 | "vueIndentScriptAndStyle": false, 19 | "endOfLine": "lf", 20 | "embeddedLanguageFormatting": "auto", 21 | "singleAttributePerLine": false 22 | } 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 TRON Foundation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 |

6 | 7 |

8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |

28 | 29 | ## What is TronWeb? 30 | 31 | [TronWeb](https://tronweb.network) aims to deliver a unified, seamless development experience influenced by Ethereum's [Web3](https://github.com/ethereum/web3.js/) implementation. We have taken the core ideas and expanded upon them to unlock the functionality of TRON's unique feature set along with offering new tools for integrating DApps in the browser, Node.js and IoT devices. 32 | 33 | To better support its use in TypeScript projects, we have rewritten the entire library in TypeScript. And to make the TronWeb API more secure and consistent, there are some breaking changes. Please check out [6.x API documentation](https://tronweb.network/docu/docs/intro/) for detailed changes so you can start using the new TypeScript version of TronWeb early. Any questions or feedback are welcome [here](https://github.com/tronprotocol/tronweb/issues/new). 34 | 35 | **Project scope** 36 | 37 | Any new TRON feature will be incorporated into TronWeb. Changes to the API to improve quality-of-life are in-scope for the project. We will not necessarily maintain feature parity with Web3.js going forward as this is a separate project, not a synchronized fork. 38 | 39 | ## HomePage 40 | 41 | __[tronweb.network](https://tronweb.network)__ 42 | 43 | ## Compatibility 44 | - Version built for Node.js v14 and above 45 | - Version built for browsers with more than 0.25% market share 46 | 47 | You can access either version specifically from the dist folder. 48 | 49 | TronWeb is also compatible with frontend frameworks such as: 50 | - Angular 51 | - React 52 | - Vue. 53 | 54 | You can also ship TronWeb in a Chrome extension. 55 | 56 | ## Recent History 57 | 58 | For recent history, see the [CHANGELOG](https://github.com/tronprotocol/tronweb/blob/master/CHANGELOG.md). You can check it out for: 59 | - New features 60 | - Dependencies update 61 | - Bug fix 62 | 63 | ## Installation 64 | 65 | ### Node.js 66 | ```bash 67 | npm install tronweb 68 | ``` 69 | or 70 | ```bash 71 | yarn add tronweb 72 | ``` 73 | 74 | ### Browser 75 | 76 | The easiest way to use TronWeb in a browser is to install it as above and copy the dist file to your working folder. For example: 77 | ``` 78 | cp node_modules/tronweb/dist/TronWeb.js ./js/tronweb.js 79 | ``` 80 | so that you can call it in your HTML page as 81 | ``` 82 |