{"id":13709913,"url":"https://github.com/broxus/ton-client","last_synced_at":"2025-07-24T11:30:39.345Z","repository":{"id":66355200,"uuid":"211144745","full_name":"broxus/ton-client","owner":"broxus","description":"Java wrapper for TON client","archived":false,"fork":false,"pushed_at":"2021-05-14T08:38:31.000Z","size":23352,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-13T20:40:23.959Z","etag":null,"topics":["client","java","ton"],"latest_commit_sha":null,"homepage":"","language":"Java","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/broxus.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":"2019-09-26T17:26:45.000Z","updated_at":"2022-04-08T07:45:57.000Z","dependencies_parsed_at":"2023-06-08T06:45:26.717Z","dependency_job_id":null,"html_url":"https://github.com/broxus/ton-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/broxus%2Fton-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/broxus%2Fton-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/broxus%2Fton-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/broxus%2Fton-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/broxus","download_url":"https://codeload.github.com/broxus/ton-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227432007,"owners_count":17775893,"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":["client","java","ton"],"created_at":"2024-08-02T23:00:48.434Z","updated_at":"2024-11-30T21:13:38.896Z","avatar_url":"https://github.com/broxus.png","language":"Java","funding_links":[],"categories":["SDKs, Client Libraries and toolkits"],"sub_categories":[],"readme":"# TON Client\n\n## Overview\nThis is a java wrapper for telegram open network client. Base on original [native-lib.cpp](https://github.com/ton-blockchain/ton/blob/master/example/android/native-lib.cpp).\n\n## Supported OS\n\n* \u003cb\u003eLinux\u003c/b\u003e - build on Ubuntu 18.04 LTS and Java 8.\n\n* \u003cb\u003eMacOS\u003c/b\u003e - build on Sierra and Java 8.\n\nSupported features\n-----\n\n* Keys, create, import and export as seed phrase.\n\n* Accounts, create wallet, send grams, get statuses.\n\n* Transactions, account transaction history, messages and binary data.\n\nExample docker and http api\n----\nYou can find docker example and simple http api [here](https://github.com/broxus/ton-api).\n\nBuild native-lib\n----\nYou can use [docker](docker/Dockerfile) container to build native-lib from sources.\n```bash\n# run this commands in repo root\n\n# prepare builder container with all needed dependencies\ndocker build --tag ton-builder -f docker/Dockerfile .\n\n# now run build process where:\n#  GIT_URL is your ton repository\n#  COMMIT_SHA (defaulat master HEAD) sha1 of commit to build\n#  BUILD_THREAD_COUNT (default is 1) is number of threads used for building\ndocker run -ti --rm --mount type=bind,source=\"$(pwd)/build\",target=/workdir/build ton-builder url=GIT_URL commit=COMMIT_SHA threads=BUILD_THREAD_COUNT\n\n# copy native lib and updated src\ncp build/ton/build/native-lib/libnative-lib.so src/main/resources/nativelib/libnative-lib.so\ncp build/ton/native-lib/src/com/broxus/ton/TonApi.java src/main/java/com/broxus/ton/TonApi.java\n```\n\nExample\n----\n```java\nimport io.broxus.ton.TonClient;\nimport io.broxus.ton.TonApi;\n\nclass ExampleApp {\n \n    private TonClient client = TonClient.create(\n                updatesHandler, \n                updatesExceptionHandler, \n                defaultExceptionHandler\n            );\n    \n    // lite client config https://test.ton.org/ton-lite-client-test1.config.json\n    private final String config = \"{ \\\"liteservers\\\": [ { \\\"ip\\\": 1137658550, \\\"port\\\": 4924, \\\"id\\\": { \\\"@type\\\": \\\"pub.ed25519\\\", \\\"key\\\": \\\"peJTw/arlRfssgTuf9BMypJzqOi7SXEqSPSWiEw2U1M=\\\" } } ], \\\"validator\\\": { \\\"@type\\\": \\\"validator.config.global\\\", \\\"zero_state\\\": { \\\"workchain\\\": -1, \\\"shard\\\": -9223372036854775808, \\\"seqno\\\": 0, \\\"root_hash\\\": \\\"VCSXxDHhTALFxReyTZRd8E4Ya3ySOmpOWAS4rBX9XBY=\\\", \\\"file_hash\\\": \\\"eh9yveSz1qMdJ7mOsO+I+H77jkLr9NpAuEkoJuseXBo=\\\" } } }\";\n    \n    // path to directory with state (keystore and last block)\n    private final String keystore = \".\";\n    \n    public static void main(args String[]) {\n        \n        // init ton client first\n        client.send(new TonApi.Init(\n            new TonApi.Options(\n                new TonApi.Config(\n                    config, // lite client config\n                    \"\", // chain name\n                    false, // network callbacks\n                    false // cache usage\n                ),                \n                new TonApi.KeyStoreTypeDirectory(keystore) // or new TonApi.KeyStoreTypeInMemory() \n            )\n        ), new TonClient.ResultHandler() {\n            \n            @Override\n            void onResult(TonApi.Object object) {\n                System.out.println(\"Inited!\");\n                \n                // request giver state\n                client.send(new TonApi.TestGiverGetAccountState(), new TonClient.ResultHandler() {\n                    \n                    @Override\n                    void onResult(TonApi.Object object) {\n\n                        if(object instanceof TonApi.Error) {\n                            \n                            TonApi.Error error = (TonApi.Error) object;\n                            System.err.println(\"Get an error on test giver request state \" + error.message);\n                            \n                        } else if (object instanceof TonApi.TestGiverAccountState) {\n\n                            TonApi.TestGiverAccountState giverState = (TonApi.TestGiverAccountState) object;\n                            System.out.println(\"Giver seq \" + giverState.seqno);\n                            System.out.println(\"Giver balance \" + giverState.balance);\n\n                            // send gram request to giver\n                            client.send(new TonApi.TestGiverSendGrams(\n                                new TonApi.AccountAddress(\n                                    // your account address\n                                ),\n                                giverState.seqno,\n                                5L * 1000000000L, // 5 grams\n                                null\n                            ));\n                            \n                        } else {\n                            \n                            // ...\n                        }\n                    }\n                });\n            }\n        });\n        \n        // ... \n        \n        // at this moment never close client\n        // client.close();\n    }\n    \n    \n}\n```\n\n## License\n\n```\nCopyright 2019 FINEX FUTURE LTD\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbroxus%2Fton-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbroxus%2Fton-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbroxus%2Fton-client/lists"}