{"id":13784793,"url":"https://github.com/orbs-network/orbs-client-sdk-javascript","last_synced_at":"2025-07-13T02:32:08.216Z","repository":{"id":34155130,"uuid":"137375253","full_name":"orbs-network/orbs-client-sdk-javascript","owner":"orbs-network","description":"SDK for implementing clients for Orbs network in JavaScript / TypeScript","archived":false,"fork":false,"pushed_at":"2023-01-03T15:18:15.000Z","size":2874,"stargazers_count":9,"open_issues_count":39,"forks_count":2,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-11-18T19:10:56.940Z","etag":null,"topics":["blockchain","client-sdk","sdk"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orbs-network.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-14T15:16:19.000Z","updated_at":"2022-07-03T14:29:56.000Z","dependencies_parsed_at":"2022-07-20T13:23:14.851Z","dependency_job_id":null,"html_url":"https://github.com/orbs-network/orbs-client-sdk-javascript","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbs-network%2Forbs-client-sdk-javascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbs-network%2Forbs-client-sdk-javascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbs-network%2Forbs-client-sdk-javascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbs-network%2Forbs-client-sdk-javascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orbs-network","download_url":"https://codeload.github.com/orbs-network/orbs-client-sdk-javascript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225850248,"owners_count":17534067,"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":["blockchain","client-sdk","sdk"],"created_at":"2024-08-03T19:00:52.611Z","updated_at":"2024-11-22T06:08:59.581Z","avatar_url":"https://github.com/orbs-network.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Orbs Client SDK JavaScript\n\n\u003e Client SDK for the Orbs blockchain in JavaScript and TypeScript for Node.js and browsers\n\nThis page describes SDK API `v2.0.0`, for upgrade from `v1.x` please [follow the instructions](https://github.com/orbs-network/orbs-client-sdk-javascript/pull/21).\n\n## Installation\n\n### Node.js\n\n1. Install the NPM package:\n\n   ```sh\n   npm install orbs-client-sdk\n   ```\n\n2. Import the client in your project\n\n   ```js\n   const Orbs = require(\"orbs-client-sdk\");\n   ```\n\n### Browser\n\n1. Install via NPM package:\n\n\n   ```sh\n   npm install orbs-client-sdk\n   ```\n\n2. Import the client in your project\n\n   ```js\n   import { createAccount, Client } from 'orbs-client-sdk'\n   ```\n\n## Usage\n\n1. Create a few end user accounts:\n\n   ```js\n   const Orbs = require(\"orbs-client-sdk\");\n   const sender = Orbs.createAccount();\n   const receiver = Orbs.createAccount();\n   ```\n\n2. Create a client instance:\n\n   ```js\n   const virtualChainId = 42;\n   const client = new Orbs.Client(\"http://node-endpoint.com\", virtualChainId, \"TEST_NET\", new Orbs.LocalSigner(sender));\n   ```\n\n3. Send a transaction:\n\n   ```js\n   const [tx, txId] = await client.createTransaction( \"BenchmarkToken\", \"transfer\", [Orbs.argUint64(10), Orbs.argAddress(receiver.address)]);\n   const response = await client.sendTransaction(tx);\n   ```\n\n4. Check the transaction status:\n\n   ```js\n   const response = await client.getTransactionStatus(txId);\n   ```\n\n5. Deploy a smart contract:\n\n   ```js\n   // Load the content of the contract file(s) that we want to deploy\n   // NOTE : These two file are part of the same contract. \n   const sources = [\n         readFileSync(`${__dirname}/../contract/increment_base.go`),\n         readFileSync(`${__dirname}/../contract/increment_functions.go`)\n   ];\n\n   // Build The deployment query\n   // Notice that in this case the contract's name will be \"Inc\"\n   const [deploymentTx, deploymentTxId] = await client.createDeployTransaction(\"Inc\", Orbs.PROCESSOR_TYPE_NATIVE, ...sources);\n\n   // Execute the deployment query\n   const deploymentResponse = await client.sendTransaction(deploymentTx);\n   ```\n\n6. Call a smart contract method:\n\n   ```js\n   const query = await client.createQuery(\"BenchmarkToken\", \"getBalance\", [Orbs.argAddress(receiver.address)]);\n   const response = await client.sendQuery(query);\n   ```\n\n## Test\n\n1. After running `npm install` locally, make sure folder `./contract` is created. It's needed for the contract test and cloned from the [reference implementation](https://github.com/orbs-network/orbs-client-sdk-go). The codec contract test encodes and signs all message types and compares to a [JSON file](https://github.com/orbs-network/orbs-client-sdk-go/tree/master/test/codec) containing the official result required to be compatible to the Orbs protocol specifications.\n\n2. Build the library with `npm run build`\n\n3. To run the end-to-end test, install [`gamma-cli`](https://github.com/orbs-network/gamma-cli)\n\n4. Run all tests (unit and e2e) with `npm run test`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forbs-network%2Forbs-client-sdk-javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forbs-network%2Forbs-client-sdk-javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forbs-network%2Forbs-client-sdk-javascript/lists"}