{"id":15297550,"url":"https://github.com/syntifi/near-java-api","last_synced_at":"2025-04-13T22:33:05.572Z","repository":{"id":43371870,"uuid":"441318068","full_name":"syntifi/near-java-api","owner":"syntifi","description":"Java 8+ library to interact with NEAR Protocol via RPC API","archived":false,"fork":false,"pushed_at":"2022-10-04T19:23:13.000Z","size":3468,"stargazers_count":12,"open_issues_count":6,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-27T13:11:36.982Z","etag":null,"topics":["api-client","blockchain","java","nearprotocol","rpc-client","sdk","sdk-java"],"latest_commit_sha":null,"homepage":"https://syntifi.github.io/near-java-api/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syntifi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-23T23:27:29.000Z","updated_at":"2025-03-26T21:02:41.000Z","dependencies_parsed_at":"2022-07-30T15:08:13.761Z","dependency_job_id":null,"html_url":"https://github.com/syntifi/near-java-api","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntifi%2Fnear-java-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntifi%2Fnear-java-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntifi%2Fnear-java-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntifi%2Fnear-java-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syntifi","download_url":"https://codeload.github.com/syntifi/near-java-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248790824,"owners_count":21162092,"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":["api-client","blockchain","java","nearprotocol","rpc-client","sdk","sdk-java"],"created_at":"2024-09-30T19:18:15.814Z","updated_at":"2025-04-13T22:33:00.531Z","avatar_url":"https://github.com/syntifi.png","language":"Java","readme":"# NEAR Java 8+ API\n\nThis project implements the API to interact with a NEAR Node. It wraps the Json-RPC requests and maps the results to Java objects. \n\n## Dependencies\n- Java 8+ \n- Maven (via wrapper)\n\n## Build instructions\n```\n./mvnw package\n```\n\n## Using the Maven Central repository\n\n### Using Maven\n``` xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.syntifi.near\u003c/groupId\u003e\n  \u003cartifactId\u003enear-java-api\u003c/artifactId\u003e\n  \u003cversion\u003e0.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Using gradle\n``` groovy\nimplementation 'com.syntifi.near:near-java-api:0.1.0'\n```\n\n## References\nThis project used the following references:\n\n- Official docs @ [docs.near.org](https://docs.near.org/docs/api/rpc/)\n\n## How to\n\n### 1. [Set-up a connection](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceHelper.java#L21)\n\n``` java\nnearClient = NearService.usingPeer(\"archival-rpc.testnet.near.org\");\n```\n\n\n### 2. [Access Keys](https://docs.near.org/docs/api/rpc/access-keys#access-keys)\n\n\n#### 2.1 [View access key](https://docs.near.org/docs/api/rpc/access-keys#view-access-key)\nReturns information about a single access key for given account.\n\nIf permission of the key is FunctionCall, it will return more details such as the allowance, receiver_id, and method_names.\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L585-L588)\n\n``` java\nString accountId = \"client.chainlink.testnet\";\nString publicKey = \"ed25519:H9k5eiU4xXS3M4z8HzKJSLaZdqGdGwBG49o7orNC4eZW\";\n\nAccessKey accessKey = nearClient.viewAccessKey(Finality.FINAL, accountId, publicKey);\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L610-L613)\n``` java\nString accountId = \"client.chainlink.testnet\";\nString publicKey = \"ed25519:H9k5eiU4xXS3M4z8HzKJSLaZdqGdGwBG49o7orNC4eZW\";\n\nAccessKey accessKey = nearClient.viewAccessKey(78443365, accountId, publicKey);\n```\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L595-L599)\n``` java\nString accountId = \"client.chainlink.testnet\";\nString publicKey = \"ed25519:H9k5eiU4xXS3M4z8HzKJSLaZdqGdGwBG49o7orNC4eZW\";\n\nAccessKey accessKey = nearClient.viewAccessKey(\"8bVg8wugs2QHqXr42oEsCYyH7jvR9pLaAP35dFqx2evU\", accountId, publicKey);\n```\n\n\n#### 2.2 [View access key list](https://docs.near.org/docs/api/rpc/access-keys#view-access-key-list)\nReturns all access keys for a given account.\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L637-L639)\n\n``` java\nString accountId = \"client.chainlink.testnet\";\n\nAccessKeyList accessKeyList = nearClient.viewAccessKeyList(Finality.FINAL, accountId);\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L660-L662)\n``` java\nString accountId = \"client.chainlink.testnet\";\n\nAccessKeyList accessKeyList = nearClient.viewAccessKeyList(78772585, accountId);\n```\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L646-L649)\n``` java\nString accountId = \"client.chainlink.testnet\";\n\nAccessKeyList accessKeyList = nearClient.viewAccessKeyList(\"DwFpDPiQXBaX6Vw3aKazQ4nXjgzw1uk6XpUkfTSJrbXf\", accountId);\n```\n\n\n#### 2.3 [View access key changes (single)](https://docs.near.org/docs/api/rpc/access-keys#view-access-key-changes-single)\nReturns individual access key changes in a specific block. You can query multiple keys by passing an array of objects containing the account_id and public_key.\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L688-L793)\n\n``` java\nKey[] keys = new Key[1];\n\nKey key0 = new Key(\"example-acct.testnet\", \"ed25519:25KEc7t7MQohAJ4EDThd2vkksKkwangnuJFzcoiXj9oM\");\nkeys[0] = key0;\n\nAccessKeyChanges accessKeyChanges = nearClient.viewSingleAccessKeyChanges(Finality.FINAL, keys);\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L718-L723)\n``` java\nKey[] keys = new Key[1];\n\nKey key0 = new Key(\"example-acct.testnet\", \"ed25519:25KEc7t7MQohAJ4EDThd2vkksKkwangnuJFzcoiXj9oM\");\nkeys[0] = key0;\n\nAccessKeyChanges accessKeyChanges = nearClient.viewSingleAccessKeyChanges(78433961, keys);\n```\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L702-L709)\n``` java\nKey[] keys = new Key[1];\n\nKey key0 = new Key(\"example-acct.testnet\", \"ed25519:25KEc7t7MQohAJ4EDThd2vkksKkwangnuJFzcoiXj9oM\");\nkeys[0] = key0;\n\nAccessKeyChanges accessKeyChanges = nearClient.viewSingleAccessKeyChanges(\"Cr82U81VqHgCz9LzZjPivh9t16e8es6aFCv9qvDMMH88\", keys);\n```\n\n\n#### 2.4 [View access key changes (all)](https://docs.near.org/docs/api/rpc/access-keys#view-access-key-changes-all)\nReturns changes to all access keys of a specific block. Multiple accounts can be quereied by passing an array of account_ids.\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L763-L767)\n\n``` java\nString[] accountIds = new String[1];\n\naccountIds[0] = \"client.chainlink.testnet\";\n\nAccessKeyChanges accessKeyChanges = nearClient.viewAllAccessKeyChanges(Finality.FINAL, accountIds);\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L791-L795)\n``` java\nString[] accountIds = new String[1];\n\naccountIds[0] = \"client.chainlink.testnet\";\n\nAccessKeyChanges accessKeyChanges = nearClient.viewAllAccessKeyChanges(78433518, accountIds);\n```\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L776-L782)\n``` java\nString[] accountIds = new String[1];\n\naccountIds[0] = \"client.chainlink.testnet\";\n\nAccessKeyChanges accessKeyChanges = nearClient.viewAllAccessKeyChanges(\"Ais9kPbHvk6XmEYptoEpBtyFW77V16TZNHHnYtmXWr1d\",accountIds);\n```\n\n\n### 3. [Accounts / Contracts](https://docs.near.org/docs/api/rpc/contracts)\n\n\n#### 3.1 [View account](https://docs.near.org/docs/api/rpc/contracts#view-account)\nReturns basic account information.\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L815)\n\n``` java\nAccount account = nearClient.viewAccount(Finality.FINAL, \"nearkat.testnet\");\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L833)\n``` java\nAccount account = nearClient.viewAccount(78439658, \"nearkat.testnet\");\n```\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L822)\n``` java\nAccount account = nearClient.viewAccount(\"5hyGx7LiGaeRiAN4RrKcGomi1QXHqZwKXFQf6xTmvUgb\", \"nearkat.testnet\");\n```\n\n\n#### 3.2 [View account changes](https://docs.near.org/docs/api/rpc/contracts#view-account-changes)\nReturns account changes from transactions in a given account.\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L859-L863)\n\n``` java\nString[] accountIds = new String[1];\n\naccountIds[0] = \"nearkat.testnet\";\n\nAccountChanges accountChanges = nearClient.viewAccountChanges(Finality.FINAL, accountIds);\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L890-L894)\n``` java\nString[] accountIds = new String[1];\n\naccountIds[0] = \"nearkat.testnet\";\n\nAccountChanges accountChanges = nearClient.viewAccountChanges(78440142, accountIds);\n```\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L872-L877)\n``` java\nString[] accountIds = new String[1];\n\naccountIds[0] = \"nearkat.testnet\";\n\nAccountChanges accountChanges = nearClient.viewAccountChanges(\"7vWp2djKLoJ3RE1sr8RzSKQtyzKpe2wZ7NCcDuFNuL7j\", accountIds);\n```\n\n\n#### 3.3 [View contract code](https://docs.near.org/docs/api/rpc/contracts#view-contract-code)\nReturns the contract code (Wasm binary) deployed to the account. Please note that the returned code will be encoded in base64.\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L918)\n\n``` java\nContractCode contractCode = nearClient.viewContractCode(Finality.FINAL, \"guest-book.testnet\");\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L937)\n``` java\nContractCode contractCode = nearClient.viewContractCode(78440518, \"guest-book.testnet\");\n```\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L925-L926)\n``` java\nContractCode contractCode = nearClient.viewContractCode(\"uLxyauKPhSk1tebYKi3k69pHSaT2ZLzWy4JwtGm52pu\", \"guest-book.testnet\");\n```\n\n\n#### 3.4 [View contract state](https://docs.near.org/docs/api/rpc/contracts#view-contract-state)\nReturns the state (key value pairs) of a contract based on the key prefix (base64 encoded). Pass an empty string for prefix_base64 if you would like to return the entire state. Please note that the returned state will be base64 encoded as well.\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L963-L964)\n\n``` java\nContractState contractState = nearClient.viewContractState(Finality.FINAL, \"guest-book.testnet\", \"\");\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L990-L991)\n``` java\nContractState contractState = nearClient.viewContractState(78440679, \"guest-book.testnet\", \"\");\n```\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L974-L975)\n``` java\nContractState contractState = nearClient.viewContractState(\"342bkjvnzoZ7FGRE5BwDVkzSRUYXAScTz3GsDB9sEHXg\", \"guest-book.testnet\", \"\");\n```\n\n\n#### 3.5 [View contract state changes](https://docs.near.org/docs/api/rpc/contracts#view-contract-state-changes)\nReturns the state change details of a contract based on the key prefix (encoded to base64). Pass an empty string for this param if you would like to return all state changes.\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1019-L1024)\n\n``` java\nString[] accountIds = new String[1];\n\naccountIds[0] = \"guest-book.testnet\";\n\nContractStateChanges contractStateChanges = nearClient.viewContractStateChanges(Finality.FINAL, accountIds, \"\");\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1052-L1056)\n``` java\nString[] accountIds = new String[1];\n\naccountIds[0] = \"guest-book.testnet\";\n\nContractStateChanges contractStateChanges = nearClient.viewContractStateChanges(78441183, accountIds, \"\");\n```\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1033-L1039)\n``` java\nString[] accountIds = new String[1];\n\naccountIds[0] = \"guest-book.testnet\";\n\nContractStateChanges contractStateChanges = nearClient.viewContractStateChanges(\"5KgQ8uu17bhUPnMUbkmciHxbpFvsbhwdkJu4ptRfR7Zn\", accountIds, \"\");\n```\n\n\n#### 3.6 [View contract code changes](https://docs.near.org/docs/api/rpc/contracts#view-contract-code-changes)\nReturns code changes made when deploying a contract. Change is returned is a base64 encoded WASM file.\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1083-L1087)\n\n``` java\nString[] accountIds = new String[1];\n\naccountIds[0] = \"dev-1602714453032-7566969\";\n\nContractCodeChanges contractCodeChanges = nearClient.viewContractCodeChanges(Finality.FINAL, accountIds);\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1115-L1119)\n``` java\nString[] accountIds = new String[1];\n\naccountIds[0] = \"dev-1602714453032-7566969\";\n\nContractCodeChanges contractCodeChanges = nearClient.viewContractCodeChanges(78441560, accountIds);\n```\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1096-L1102)\n``` java\nString[] accountIds = new String[1];\n\naccountIds[0] = \"dev-1602714453032-7566969\";\n\nContractCodeChanges contractCodeChanges = nearClient.viewContractCodeChanges(\"HpsjZvjtuxarKRsXGVrgB6qtuCcHRgx3Xof1gfT2Jfj7\", accountIds);\n```\n\n\n#### 3.7 [Call a contract function](https://docs.near.org/docs/api/rpc/contracts#call-a-contract-function)\nAllows you to call a contract method as a [view function](https://docs.near.org/docs/develop/contracts/as/intro#view-and-change-functions).\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1145-L1150)\n\n``` java\nContractFunctionCallResult contractFunctionCallResult = nearClient\n        .callContractFunction(\n                Finality.FINAL,\n                \"guest-book.testnet\",\n                \"getMessages\",\n                \"e30=\");\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1189-L1193)\n``` java\nContractFunctionCallResult contractFunctionCallResult = nearClient\n        .callContractFunction(79272492,\n                \"guest-book.testnet\",\n                \"getMessages\",\n                \"e30=\");\n```\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1157-L1162)\n``` java\nContractFunctionCallResult contractFunctionCallResult = nearClient\n        .callContractFunction(\n                \"J5QTB4Stz3iwtHvgr5KnVzNUgzm4J1bE5Et6JWrJPC8o\",\n                \"guest-book.testnet\",\n                \"getMessages\",\n                \"e30=\");\n```\n\n\n### 4. [Block / Chunk](https://docs.near.org/docs/api/rpc/block-chunk)\n\n\n#### 4.1 [Block details](https://docs.near.org/docs/api/rpc/block-chunk#block-details)\nQueries network and returns block for given height or hash. You can also use finality param to return latest block details.\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L79)\n\n``` java\nBlock block = nearClient.getBlock(Finality.FINAL);\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L110)\n``` java\nBlock block = nearClient.getBlock(78770817);\n```\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L86)\n``` java\nBlock block = nearClient.getBlock(\"FXTWzPjqWztjHfneqJb9cBDB2QLTY1Rja4GHrswAv1b9\");\n```\n\n\n#### 4.2 [Changes in Block](https://docs.near.org/docs/api/rpc/block-chunk#changes-in-block)\nReturns changes in block for given block height or hash. You can also use finality param to return latest block details.\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L134)\n\n``` java\nBlockChanges blockChanges = nearClient.getBlockChanges(Finality.FINAL);\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L152)\n``` java\nBlockChanges blockChanges = nearClient.getBlockChanges(78770674);\n```\n\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L141)\n``` java\nBlockChanges blockChanges = nearClient.getBlockChanges(\"BmEZnrmov6h6rMPpWkMV2JtU1C5LP563V5Y5yXwUW2N5\");\n```\n\n\n#### 4.3 [Chunk Details](https://docs.near.org/docs/api/rpc/block-chunk#chunk-details)\nReturns details of a specific chunk. You can run a block details query to get a valid chunk hash.\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L176)\n\n``` java\nChunk chunk = nearClient.getChunkDetails(\"9mdG2cRcV8Dsb1EoSjtya81NddjRB2stYCTVukZh7zzw\");\n```\n\n#### [By block height and shard id](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L198)\n``` java\nChunk chunk = nearClient.getChunkDetails(78567387, 0);\n```\n\n#### [By block hash and shard id](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L187)\n``` java\nChunk chunk = nearClient.getChunkDetails(\"F1HXTzeYgYq28rgsHuKUrRbo5QTBGKFYG7rbxXkRZWXN\", 0);\n```\n\n\n### 5. [Gas](https://docs.near.org/docs/api/rpc/gas)\n\n\n#### 5.1 [Gas Price](https://docs.near.org/docs/api/rpc/gas#gas-price)\nReturns gas price for a specific block_height or block_hash.\n\n- Using [null] will return the most recent block's gas price.\n\n### [Null](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L306)\n\n``` java\nGasPrice gasPrice = nearClient.getGasPrice(null);\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L328)\n``` java\nGasPrice gasPrice = nearClient.getGasPrice(78770817);\n```\n\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L317)\n``` java\nGasPrice gasPrice = nearClient.getGasPrice(\"FXTWzPjqWztjHfneqJb9cBDB2QLTY1Rja4GHrswAv1b9\");\n```\n\n\n### 6. [Protocol](https://docs.near.org/docs/api/rpc/protocol)\n\n\n#### 6.1 [Genesis Config](https://docs.near.org/docs/api/rpc/protocol#genesis-config)\nReturns current genesis configuration.\n\n### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L352)\n\n``` java\nGenesisConfig genesisConfig = nearClient.getGenesisConfig();\n```\n\n\n#### 6.2 [Protocol Config](https://docs.near.org/docs/api/rpc/protocol#protocol-config)\nReturns most recent protocol configuration or a specific queried block. Useful for finding current storage and transaction costs.\n\n#### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L376)\n\n``` java\nProtocolConfig protocolConfig = nearClient.getProtocolConfig(Finality.FINAL);\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L398)\n``` java\nProtocolConfig protocolConfig = nearClient.getProtocolConfig(78770817);\n```\n\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L387)\n``` java\nProtocolConfig protocolConfig = nearClient.getProtocolConfig(\"FXTWzPjqWztjHfneqJb9cBDB2QLTY1Rja4GHrswAv1b9\");\n```\n\n\n### 7. [Network](https://docs.near.org/docs/api/rpc/network)\n\n\n#### 7.1 [Node Status](https://docs.near.org/docs/api/rpc/network#node-status)\nReturns general status of a given node (sync status, nearcore node version, protocol version, etc), and the current set of validators.\n\n### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L241)\n\n``` java\nNodeStatus nodeStatus = nearClient.getNodeStatus();\n```\n\n\n#### 7.2 [Network Info](https://docs.near.org/docs/api/rpc/network#network-info)\nReturns the current state of node network connections (active peers, transmitted data, etc.)\n\n### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L222)\n\n``` java\nNetworkInfo networkInfo = nearClient.getNetworkInfo();\n```\n\n\n#### 7.3 [Validation Status](https://docs.near.org/docs/api/rpc/network#validation-status)\nQueries active validators on the network returning details and the state of validation on the blockchain.\n\n### [Null](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L262)\n\n``` java\nValidationStatus networkValidationStatus = nearClient.getNetworkValidationStatus(null);\n```\n\n#### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L283-L286)\n``` java\nBlock lastBlock = nearClient.getBlock(Finality.OPTIMISTIC);\n\nValidationStatus networkValidationStatus = nearClient.getNetworkValidationStatus(lastBlock.getHeader().getHeight());\n```\n\n#### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L271-L274)\n``` java\nBlock lastBlock = nearClient.getBlock(Finality.FINAL);\n\nValidationStatus networkValidationStatus = nearClient.getNetworkValidationStatus(lastBlock.getHeader().getHash());\n```\n\n\n### 8. [Transactions](https://docs.near.org/docs/api/rpc/transactions)\n\n\n#### 8.1 [Send transaction (async)](https://docs.near.org/docs/api/rpc/transactions#send-transaction-async)\nSends a transaction and immediately returns transaction hash.\n\n#### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/TransactionServiceTest.java#L132-L139)\n``` java\n\nString signerId = \"syntifi-bob.testnet\";\nString receiverId = \"syntifi-alice.testnet\";\nBigInteger amount = new BigInteger(\"100\", 10);\n\nEncodedHash transactionAsync = TransactionService\n        .sendTransferActionAsync(nearClient, signerId, receiverId, bobNearPublicKey, bobNearPrivateKey, amount);\n```\n\n\n#### 8.2 [Send transaction (await)](https://docs.near.org/docs/api/rpc/transactions#send-transaction-await)\nSends a transaction and waits until transaction is fully complete. (Has a 10 second timeout)\n\n#### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/TransactionServiceTest.java#L90-L97)\n``` java\nString signerId = \"syntifi-alice.testnet\";\nString receiverId = \"syntifi-bob.testnet\";\nBigInteger amount = new BigInteger(\"100\", 10);\n\nTransactionAwait transactionAwait = TransactionService\n        .sendTransferActionAwait(nearClient, signerId, receiverId, aliceNearPublicKey, aliceNearPrivateKey, amount);\n```\n\n\n#### 8.3 [Transaction Status](https://docs.near.org/docs/api/rpc/transactions#transaction-status)\nQueries status of a transaction by hash and returns the final transaction result.\n\n#### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L479-L482)\n``` java        \nString transactionHash = \"DwWUi6WbVHKTCDjVu4gmuQfryqjwTjrZ6ntRcKcGN6Gd\";\nString accountId = \"isonar.testnet\";\n\nTransactionStatus transactionStatus = nearClient.getTransactionStatus(transactionHash, accountId);\n```\n\n\n#### 8.4 [Transaction Status with Receipts](https://docs.near.org/docs/api/rpc/transactions#transaction-status-with-receipts)\nQueries status of a transaction by hash, returning the final transaction result and details of all receipts.\n\n#### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L510-L514)\n``` java        \nString transactionHash = \"DwWUi6WbVHKTCDjVu4gmuQfryqjwTjrZ6ntRcKcGN6Gd\";\nString accountId = \"isonar.testnet\";\n\nTransactionStatus transactionStatusWithReceipts = nearClient.getTransactionStatusWithReceipts(transactionHash, accountId);\n```\n\n\n#### 8.5 [Receipt by ID](https://docs.near.org/docs/api/rpc/transactions#receipt-by-id)\nFetches a receipt by it's ID (as is, without a status or execution outcome)\n\n#### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L542-L544)\n``` java        \nString receiptId = \"8b9Vt1xH8DZecMda1YqUcMWA41NvknUJJVd2XEQikPRs\";\n\nReceipt transactionReceipt = nearClient.getTransactionReceipt(receiptId);\n```\n\n\n### 9. Json File Wallets\n\n#### 9.1 Loads a Wallet from a json file\nLoads a Wallet object from a json file.\n\n#### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/WalletServiceTest.java#L36)\n``` java        \nString fileName = \"./my-wallet.json\";\n\nWalletService.writeWalletToFile(fileName, wallet)\n```\n\n#### 9.2 Writes a Wallet to a json file\nWrites a Wallet object to a json file.\n\n#### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/WalletServiceTest.java#L53)\n``` java        \nString fileName = \"./my-wallet.json\";\n\nWallet wallet = WalletService.loadWalletFromFile(fileName);\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntifi%2Fnear-java-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyntifi%2Fnear-java-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntifi%2Fnear-java-api/lists"}