{"_id":"@agworld/tronweb","name":"@agworld/tronweb","dist-tags":{"latest":"6.0.0-beta.4"},"versions":{"6.0.0-beta.4":{"name":"@agworld/tronweb","version":"6.0.0-beta.4","description":"JavaScript SDK that encapsulates the TRON HTTP API","main":"./lib/commonjs/index.js","module":"./lib/esm/index.js","types":"./lib/esm/index.d.ts","exports":{".":{"import":"./lib/esm/index.js","require":"./lib/commonjs/index.js"},"./utils":{"import":"./lib/esm/utils/index.js","require":"./lib/commonjs/utils/index.js"}},"keywords":["TRON","tronweb"],"scripts":{"build:esm":"tsc --project tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json && npm run copy-protocol:esm","build:cjs":"tsc --project tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > ./lib/commonjs/package.json && npm run copy-protocol:cjs","build:types":"tsc --project tsconfig.types.json","build:test":"tsc --project tsconfig.test.json && echo '{\"type\": \"commonjs\"}' > ./lib/commonjs/package.json && cp -R ./src/protocol ./lib/commonjs/src/","build:dist":"webpack --config webpack.config.js --progress --color","build:all":"npm run clean:all && npm run build:esm && npm run build:cjs","copy-protocol:cjs":"cp -R ./src/protocol ./lib/commonjs/","copy-protocol:esm":"cp -R ./src/protocol ./lib/esm/","prepare":"husky install && npm run build","build":"npm run clean:all && npm run build:esm && npm run build:cjs","build:dev":"NODE_ENV=development npm run build","clean:all":"rimraf dist lib","clean":"rimraf dist","newaccount":"node scripts/test-node.js && node lib/commonjs/test/helpers/newAccounts 100","test":"npm run build:test && npm run-script newaccount && npx mocha 'lib/commonjs/test/**/*.test.js' --timeout 120000","test:esm":"npm run-script newaccount && npx mocha 'lib/esm/test/**/*.test.js' --timeout 120000","testAbi":"node scripts/test-node.js && node test/helpers/newAccounts 1 && npx mocha 'test/**/abi.test.js' --timeout 120000","testTx":"node scripts/test-node.js && node test/helpers/newAccounts 100 && npx mocha 'test/**/transaction.test.js' --timeout 120000","test-no-accounts":"node scripts/test-node.js && npx mocha 'test/**/*.test.js'","test:browser":"npm run-script newaccount && node scripts/test-browser.js && npx karma start --single-run --browsers ChromeHeadless","coverage":"npm run-script test:browser && npm run-script test","btest":"npm run build:dev && npm run test","format-all":"prettier --write ./src","lint":"eslint src","lint:fix":"eslint src --fix"},"husky":{"hooks":{"pre-commit":"node ./scripts/pre-commit.js"}},"dependencies":{"@babel/runtime":"^7.0.0","@tronweb3/google-protobuf":"^3.21.2","axios":"^1.6.8","bignumber.js":"^9.0.1","ethereum-cryptography":"^2.1.3","ethers":"^6.13.1","eventemitter3":"^3.1.0","semver":"^5.6.0","validator":"^13.7.0"},"devDependencies":{"@babel/core":"^7.21.0","@babel/plugin-transform-class-properties":"^7.23.3","@babel/plugin-transform-numeric-separator":"^7.23.3","@babel/plugin-transform-object-rest-spread":"^7.23.3","@babel/plugin-transform-private-methods":"^7.23.3","@babel/plugin-transform-private-property-in-object":"^7.23.3","@babel/plugin-transform-runtime":"^7.23.3","@babel/preset-env":"^7.23.3","@babel/preset-typescript":"^7.23.3","@types/chai":"^4.3.6","@types/estree":"^1.0.1","@types/json-schema":"^7.0.12","@types/lodash":"^4.14.197","@types/mocha":"^10.0.1","@types/node":"^22.5.0","@types/validator":"^13.7.17","@typescript-eslint/eslint-plugin":"^5.61.0","@typescript-eslint/parser":"^5.61.0","babel-loader":"^8.0.2","babel-plugin-istanbul":"^6.1.1","babel-plugin-source-map-support":"^2.1.3","buffer":"^6.0.3","chai":"^4.3.7","chalk":"^2.4.1","eslint":"^8.44.0","eslint-config-prettier":"^8.8.0","eslint-import-resolver-typescript":"^3.5.5","events":"^3.3.0","globby":"^13.1.3","husky":"^7.0.0","istanbul":"^0.4.5","json-schema":"^0.4.0","jsonwebtoken":"^9.0.0","karma":"^6.3.17","karma-chrome-launcher":"^2.2.0","karma-coverage":"^2.0.3","karma-coverage-istanbul-reporter":"^3.0.3","karma-edge-launcher":"^0.4.2","karma-firefox-launcher":"^1.1.0","karma-mocha":"^2.0.1","karma-sourcemap-loader":"^0.3.7","karma-spec-reporter":"^0.0.32","karma-webpack":"^5.0.0","mocha":"^10.2.0","prettier":"^2.8.8","puppeteer":"^22.11.2","querystring-es3":"^0.2.1","rimraf":"^3.0.2","source-map-support":"^0.5.19","ts-loader":"^9.4.3","typescript":"^5.1.6","webpack":"^5.78.0","webpack-cli":"^5.0.1","webpack-node-externals":"^3.0.0"},"author":{"name":"Tron Protocol","url":"https://github.com/tronprotocol"},"homepage":"https://tronweb.network","license":"MIT","repository":{"type":"git","url":"git+https://github.com/tronprotocol/tronweb.git"},"_id":"@agworld/tronweb@6.0.0-beta.4","gitHead":"2760cbd397b8e45f8b48ea72586f19ec44283956","bugs":{"url":"https://github.com/tronprotocol/tronweb/issues"},"_nodeVersion":"20.15.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-8+2DH0eTaxExAobYEnXzggvR/hTMEm0HE3LOiI2G0J8c+p+VrJsbC20wD0/qWkQN+LCOgvkpZZPgzTVQolxPng==","shasum":"eed02ae6eb7b70e096c095d4cdfda523a21b7d04","tarball":"https://registry.npmjs.org/@agworld/tronweb/-/tronweb-6.0.0-beta.4.tgz","fileCount":305,"unpackedSize":4033295,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCazOJs6shsW9i+YIoND6VsGaQFDDlXNF8vJeoSfQIMYgIgYOG8Nk3R6IyhSFNAO/382rs5oL+iudSlhAMaVWm95n8="}]},"_npmUser":{"name":"agworld","email":"agworld1046@gmail.com"},"directories":{},"maintainers":[{"name":"agworld","email":"agworld1046@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tronweb_6.0.0-beta.4_1724325468785_0.9088708510047716"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-22T11:17:48.650Z","6.0.0-beta.4":"2024-08-22T11:17:49.067Z","modified":"2024-08-22T11:17:49.396Z"},"maintainers":[{"name":"agworld","email":"agworld1046@gmail.com"}],"description":"JavaScript SDK that encapsulates the TRON HTTP API","homepage":"https://tronweb.network","keywords":["TRON","tronweb"],"repository":{"type":"git","url":"git+https://github.com/tronprotocol/tronweb.git"},"author":{"name":"Tron Protocol","url":"https://github.com/tronprotocol"},"bugs":{"url":"https://github.com/tronprotocol/tronweb/issues"},"license":"MIT","readme":"<h1 align=\"center\">\n  <a href=\"https://tronweb.network\">\n    <img align=\"center\" src=\"https://raw.githubusercontent.com/tronprotocol/tronweb/master/assets/logo.png\"/>\n  </a>\n</h1>\n\n<p align=\"center\">\n  <a href=\"https://discord.gg/FgvVFQgdCW\">\n    <img src=\"https://img.shields.io/badge/chat-on%20discord-brightgreen.svg\">\n  </a>\n\n  <a href=\"https://github.com/tronprotocol/tronweb/issues\">\n    <img src=\"https://img.shields.io/github/issues/tron-us/tronweb.svg\">\n  </a>\n\n  <a href=\"https://github.com/tronprotocol/tronweb/pulls\">\n    <img src=\"https://img.shields.io/github/issues-pr/tron-us/tronweb.svg\">\n  </a>\n\n  <a href=\"https://github.com/tronprotocol/tronweb/graphs/contributors\">\n    <img src=\"https://img.shields.io/github/contributors/tron-us/tronweb.svg\">\n  </a>\n\n  <a href=\"LICENSE\">\n    <img src=\"https://img.shields.io/github/license/tron-us/tronweb.svg\">\n  </a>\n</p>\n\n## What is TronWeb?\n\n[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.\n\n<font color=red>Please note that this version is an experimental beta version.</font> 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. <font color=red>Please check out [<font color=red>6.x API documentation</font>](https://tronweb.network/docu/docs/intro/)</font> 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).\n\n**Project scope**\n\nAny 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.\n\n## HomePage\n\n__[tronweb.network](https://tronweb.network)__\n\n## Compatibility\n- Version built for Node.js v14 and above\n- Version built for browsers with more than 0.25% market share\n\nYou can access either version specifically from the dist folder.\n\nTronWeb is also compatible with frontend frameworks such as:\n- Angular\n- React\n- Vue.\n\nYou can also ship TronWeb in a Chrome extension.\n\n## Recent History\n\nFor recent history, see the [CHANGELOG](https://github.com/tronprotocol/tronweb/blob/master/CHANGELOG.md). You can check it out for:\n- New features\n- Dependencies update\n- Bug fix\n\n## Installation\n\n### Node.js\n```bash\nnpm install tronweb@beta\n```\nor\n```bash\nyarn add tronweb@beta\n```\n\n### Browser\n\nThe 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:\n```\ncp node_modules/tronweb/dist/TronWeb.js ./js/tronweb.js\n```\nso that you can call it in your HTML page as\n```\n<script src=\"./js/tronweb.js\"><script>\n```\n\nThis project is also published on NPM and you can access CDN mirrors of this release (please use sub-resource integrity for any `<script>` includes).\n\n## Testnet\n\nShasta is the official Tron testnet. To use it use the following endpoint:\n```\nhttps://api.shasta.trongrid.io\n```\nGet some Shasta TRX at https://www.trongrid.io/shasta and play with it.\nAnything you do should be explorable on https://shasta.tronscan.org\n\n## Your local private network for heavy testing\n\nYou can set up your own private network, running Tron Quickstart. To do it you must [install Docker](https://docs.docker.com/install/) and, when ready, run a command like\n\n```bash\ndocker run -it --rm \\\n  -p 9090:9090 \\\n  -e \"defaultBalance=100000\" \\\n  -e \"showQueryString=true\" \\\n  -e \"showBody=true\" \\\n  -e \"formatJson=true\" \\\n  --name tron \\\n  trontools/quickstart\n```\n\n[More details about Tron Quickstart on GitHub](https://github.com/tron-us/docker-tron-quickstart)\n\n## Creating an Instance\n\nFirst of all, in your typescript file, define TronWeb:\n\n```typescript\nimport { TronWeb, utils as TronWebUtils, Trx, TransactionBuilder, Contract, Event, Plugin } from 'tronweb';\n```\n\nPlease note that this is not the same as v5.x. If you want to dive into more differences, check out [migration guide](https://tronweb.network/docu/docs/6.0.0-beta.3/Migrating%20from%20v5)\n\nWhen you instantiate TronWeb you can define\n\n* fullNode\n* solidityNode\n* eventServer\n* privateKey\n\nyou can also set a\n\n* fullHost\n\nwhich works as a jolly. If you do so, though, the more precise specification has priority.\nSupposing you are using a server which provides everything, like TronGrid, you can instantiate TronWeb as:\n\n```js\nconst tronWeb = new TronWeb({\n    fullHost: 'https://api.trongrid.io',\n    headers: { \"TRON-PRO-API-KEY\": 'your api key' },\n    privateKey: 'your private key'\n})\n```\n\nFor retro-compatibility, though, you can continue to use the old approach, where any parameter is passed separately:\n```js\nconst tronWeb = new TronWeb(fullNode, solidityNode, eventServer, privateKey)\ntronWeb.setHeader({ \"TRON-PRO-API-KEY\": 'your api key' });\n```\n\nIf you are, for example, using a server as full and solidity node, and another server for the events, you can set it as:\n\n```js\nconst tronWeb = new TronWeb({\n    fullHost: 'https://api.trongrid.io',\n    eventServer: 'https://api.someotherevent.io',\n    privateKey: 'your private key'\n  }\n)\n```\n\nIf you are using different servers for anything, you can do\n```js\nconst tronWeb = new TronWeb({\n    fullNode: 'https://some-node.tld',\n    solidityNode: 'https://some-other-node.tld',\n    eventServer: 'https://some-event-server.tld',\n    privateKey: 'your private key'\n  }\n)\n```\n\n## Contributions\n\nIn order to contribute you can\n\n* fork this repo and clone it locally\n* install the dependencies — `npm i`\n* do your changes to the code\n* build the TronWeb dist files — `npm run build:all`\n* run a local private network using Tron Quickstart\n* run the tests — `npm run test`\n* push your changes and open a pull request\n\nContact the team at https://cn.developers.tron.network/docs/online-technical-support\n\n\n## Licence\n\nTronWeb is distributed under a MIT licence.\n\n\n","readmeFilename":"README.md"}