{"id":20109979,"url":"https://github.com/distributed-lab/tron-sdk","last_synced_at":"2025-03-02T18:25:27.832Z","repository":{"id":188720425,"uuid":"679255698","full_name":"distributed-lab/tron-sdk","owner":"distributed-lab","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-06T14:43:50.000Z","size":35,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-13T05:41:47.371Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/distributed-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-16T12:42:24.000Z","updated_at":"2024-12-16T16:09:25.000Z","dependencies_parsed_at":"2025-01-13T05:41:17.680Z","dependency_job_id":"aaa34b88-7c1b-4223-8581-05276cdf4502","html_url":"https://github.com/distributed-lab/tron-sdk","commit_stats":null,"previous_names":["distributed-lab/tron-sdk"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributed-lab%2Ftron-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributed-lab%2Ftron-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributed-lab%2Ftron-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributed-lab%2Ftron-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/distributed-lab","download_url":"https://codeload.github.com/distributed-lab/tron-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241550247,"owners_count":19980677,"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","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-11-13T18:09:58.521Z","updated_at":"2025-03-02T18:25:27.784Z","avatar_url":"https://github.com/distributed-lab.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TRON SDK\n\nThe **TRON SDK** is a Go client library designed to simplify interaction with the TRON blockchain's API, specifically the **TronGrid** service. TronGrid is a public API service provided by the TRON Foundation that offers various endpoints for querying TRON blockchain data.\n\n## Features\n\n- Retrieve information about blocks, transactions, and contract events.\n- Check account balances for native tokens and TRC20 tokens.\n- Obtain details about transactions and their results.\n- Interact with smart contract functions and retrieve contract owner information.\n\n## Installation\n\nTo install the **tron-api** SDK, you can use the `go get` command:\n\n```bash\ngo get -u github.com/distributed-lab/tron-api\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/distributed-lab/tron-sdk/tron_api\"\n)\n\nfunc main() {\n\tapiKey := \"your-api-key\"\n\thttpApiURL := \"https://api.trongrid.io\"\n\tgrpcURL := \"grpc.trongrid.io:50051\"\n\n\tclient := tron_api.NewTronClient(httpApiURL, grpcURL, apiKey)\n\n\tblockNumber, err := client.GetNowBlock()\n\tif err != nil {\n\t\tfmt.Println(\"Error:\", err)\n\t\treturn\n\t}\n\n\tfmt.Println(\"Latest Block Number:\", blockNumber)\n\n\t// Perform other operations using the provided methods\n\t// ...\n}\n```\n\n## TronGrid Usage\n\nThis SDK interacts with the TRON blockchain through the **TronGrid** service, which offers a range of methods to retrieve blockchain data. Some of the key methods utilized by this SDK include:\n\n- `GetNowBlock()`: Retrieve the latest block number.\n- `GetTransactionInfoByBlockNum(block int64)`: Get transaction information by block number.\n- `GetTransactionResultById(id string)`: Fetch the result of a transaction by its ID.\n- `GetTxInfo(id string)`: Obtain detailed transaction information by ID.\n- `BalanceOf(address address.Address, tokenAddress string)`: Check account balances for native tokens and TRC20 tokens.\n- `GetContractOwner(c address.Address)`: Retrieve the owner of a smart contract.\n\nFor more details on these methods and other available endpoints, refer to the official [TronGrid API documentation](https://developers.tron.network/reference/full-node-api-overview).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistributed-lab%2Ftron-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdistributed-lab%2Ftron-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistributed-lab%2Ftron-sdk/lists"}