{"id":28491472,"url":"https://github.com/line/line-blockchain-developers-sdk-js","last_synced_at":"2025-07-04T23:30:40.440Z","repository":{"id":40415595,"uuid":"385539162","full_name":"line/line-blockchain-developers-sdk-js","owner":"line","description":"Javascript library for line blockchain developers","archived":false,"fork":false,"pushed_at":"2024-05-14T13:05:35.000Z","size":669,"stargazers_count":26,"open_issues_count":0,"forks_count":16,"subscribers_count":14,"default_branch":"develop","last_synced_at":"2025-06-08T08:07:27.773Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/line.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-13T08:52:47.000Z","updated_at":"2025-06-07T10:59:03.000Z","dependencies_parsed_at":"2024-06-21T16:45:11.990Z","dependency_job_id":"f1ad72d9-7386-42f3-b615-50dbad819cfd","html_url":"https://github.com/line/line-blockchain-developers-sdk-js","commit_stats":{"total_commits":197,"total_committers":16,"mean_commits":12.3125,"dds":0.4467005076142132,"last_synced_commit":"9fe01dbda203820eaa72b1ade974967fabe15a1d"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/line/line-blockchain-developers-sdk-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/line%2Fline-blockchain-developers-sdk-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/line%2Fline-blockchain-developers-sdk-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/line%2Fline-blockchain-developers-sdk-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/line%2Fline-blockchain-developers-sdk-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/line","download_url":"https://codeload.github.com/line/line-blockchain-developers-sdk-js/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/line%2Fline-blockchain-developers-sdk-js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263635389,"owners_count":23492185,"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":"2025-06-08T08:07:26.859Z","updated_at":"2025-07-04T23:30:40.427Z","avatar_url":"https://github.com/line.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LINE Blockchain Developers SDK for JavaScript\n\n[![License](https://img.shields.io/github/license/line/line-blockchain-developers-sdk-js)](https://github.com/line/line-blockchain-developers-sdk-js)\n[![NPM version](https://img.shields.io/npm/v/@line/lbd-sdk-js.svg)](https://www.npmjs.com/package/@line/lbd-sdk-js)\n[![NPM downloads](https://img.shields.io/npm/dm/@line/lbd-sdk-js.svg)](https://www.npmjs.com/package/@line/lbd-sdk-js)\n[![CircleCI](https://circleci.com/gh/line/line-blockchain-developers-sdk-js.svg?style=shield)](https://circleci.com/gh/line/line-blockchain-developers-sdk-js)\n\n\n## Table of Contents\n* [Introduction](#introduction)\n* [Getting Started](#getting-Started)\n* [Key objects and usage](#key-objects-and-usage)\n\n## Introduction\nThe LINE Blockchain Developers SDK for JavaScript makes it easy to develop a service(dApp) using [LINE Blockchain Developers API](https://docs-blockchain.line.biz/api-guide/), and there are no worries about generating signature for each request.\n\n### Documentation\nSee the official LINE Blockchain Developers API documentation for more information.\n* English: https://docs-blockchain.line.biz/api-guide/\n* Japanese: https://docs-blockchain.line.biz/ja/api-guide/\n* Korean: https://docs-blockchain.line.biz/ko/api-guide/\n\n### Requirements\n* Node.js 10 or higher\n\n### Installation\nBefore getting started, you need to install the library to your project.\nTo make installation easy, use package managers as follows:\n\nUsing [npm](https://www.npmjs.com/?target=_blank):\n\n`npm install @line/lbd-sdk-js`\n\nUsing [yarn](https://yarnpkg.com/?target=_blank)\n\n`yarn add @line/lbd-sdk-js`\n\n### Versioning\nThis project respects [semantic versioning](http://semver.org/?target=_blank).\n\nSee http://semver.org/\n\n### Contributing\nPlease check [CONTRIBUTING](https://github.com/line/line-blockchain-developers-sdk-js/blob/master/CONTRIBUTING.md) before making a contribution.\n\n### License\n```\nCopyright (C) 2021 LINE Corp.\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\n\n    https://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\n## Getting Started\n### Requirements\n* Node.js \u003e= 10\n  * It uses ES2017.\n\n* [npm](https://www.npmjs.com/?target=_blank), preferably \u003e=7\n\nOther dependencies are installed via npm(or yarn), and do not need to be pre-installed.\n\n### Install\nAll the dependencies can be install via [npm](https://www.npmjs.com/?target=_blank) or [yarn](https://yarnpkg.com/?target=_blank)\n\n* [npm](https://www.npmjs.com/?target=_blank)\n  ```\n  npm install @line/lbd-sdk-js\n  ```\n\n* [yarn](https://yarnpkg.com/?target=_blank)\n  ```\n  yarn add @line/lbd-sdk-js\n  ```\n\nInstead of using package managers, you can clone and build from source as well. Run the following scripts/commends.\n\n```\n$ git clone https://github.com/line/line-blockchain-developers-sdk-js.git\n$ cd line-blockchain-developers-sdk-js\n$ npm install\n$ npm run build\n```\nThe built result will be placed in `build/`.\n\n#### Test\nYou can run all the unit tests by following scripts.\n\n```\nnpm run test\n```\n\n#### Integration tests\nYou can **run** all the integration tests by following scripts.\n\n```\nnpm run test:integration\n```\n\n\u003e Note\n\u003e\n\u003e To run integration tests, `integration-test.env` is required with following properties.\n```\nHOST_URL=[api-url]\nSERVICE_ID=[your service-id]\nSERVICE_API_KEY=[your service-api-key]\nSERVICE_API_SECRET=[your service-api-secret]\nOWNER_ADDRESS=[your service wallet address]\nOWNER_SECRET=[your service wallet secret]\nOWNER_ADDRESS2=[your another service wallet address]\nSERVICE_TOKEN_CONTRACT_ID=[your service-token contract-id]\nITEM_TOKEN_CONTRACT_ID=[your item-token contract-id]\nLINE_USER_ID=[your line user id]\nLINE_USER_WALLET_ADDRESS=[BitMax wallet address of the user]\n```\n\n### Basic Usage\nIt can be imported with [CommonJS](https://nodejs.org/docs/latest/api/modules.html?target=_blank), [ES2015 modules](https://babeljs.io/learn-es2015/#ecmascript-2015-features-modules?target=_blank), and preferably [TypeScript](https://www.typescriptlang.org/?target=_blank).\n\nThe library is written in TypeScript and includes TypeScript definitions by default. Nevertheless, it can surely be used with plain JavaScript too.\n\n#### Create HttpClient\n```\n// CommonJS\nconst devSdk = require('@line/lbd-sdk-js');\nconst httpClient = new devSdk.HttpClient(BASE_URL, SERVICE_API_KEY, SERVICE_API_SECRET)\n\n// ES2015 modules or TypeScript\nimport * as devSdk from '@line/lbd-sdk-js';\nconst httpClient = new devSdk.HttpClient(BASE_URL, SERVICE_API_KEY, SERVICE_API_SECRET)\n\n```\n\n#### Example to get server time\n##### Using promise\n```JavaScript\nhttpClient.time().then(response =\u003e {\n    console.log(\"statusCode\", response.statusCode);\n    console.log(\"responseTime\", response.responseTime);\n    console.log(\"statusMessage\", response.statusMessage);\n    console.log(\"responseData\", response.responseData);\n})\n```\n\n##### Using async function\n```JavaScript\nasync function checkServerTime() {\n    var response = await httpClient.time();\n    console.log(\"statusCode\", response.statusCode);\n    console.log(\"responseTime\", response.responseTime);\n    console.log(\"statusMessage\", response.statusMessage);\n    console.log(\"responseData\", response.responseData);\n}\n```\n\n## Key objects and usage\n### `HttpClient`\nThis class represents an HTTP client to connect and interact with the LINE Blockchain Developers API server. It provides functions to call the endpoints of the API with mandatory and optional parameters.\nIt's an entry point for this library, every dApp for LINE Blockchain Developers should have an instance of `HttpClient`.\n\nCreate an instance with your connection and authentication information as follows:\n\n```JavaScript\n// Directly import\nimport { HttpClient } from './lib/http-client-base';\nconst httpClient = new HttpClient(baseUrl, apiKey, apiSecret);\n\n// CommonJS\nconst devSdk = require('@line/lbd-sdk-js');\nconst httpClient = new devSdk.HttpClient(BASE_URL, SERVICE_API_KEY, SERVICE_API_SECRET)\n\n// ES2015 modules or TypeScript\nimport * as devSdk from '@line/lbd-sdk-js';\nconst httpClient = new devSdk.HttpClient(BASE_URL, SERVICE_API_KEY, SERVICE_API_SECRET)\n```\n\n- `baseUrl` is the address of API server. Find one for the chain your service runs on in [API guide](https://docs-blockchain.line.biz/api-guide/).\n- `apiKey` is your service's API key.\n- `apiSecret` is your service's API secret. **Never** use the secret hard-coded in the source code.\n\nNow, you can call any endpoints via the functions of the instance. A simple example is to get the server time:\n\n```JavaScript\n(async() =\u003e {\n  const response = await httpClient.time();\n  console.log(response['statusCode']);\n})();\n```\n\nRemember that you must handle it in an asynchronous way.\n\n### Request and response\nWhen requesting, you can use predefined request data classes in `lib/request.ts`. Try to send a memo save request for example as follows:\n\n```JavaScript\n//Directly import\nimport { MemoRequest } from './lib/request';\n\n(async() =\u003e {\n  const request = new MemoRequest('my first memo', walletAddress, walletSecret);\n  const response = await httpClient.createMemo(request);\n})();\n```\n\nWhen you need to parse a JSON-formatted `responseData` in a response, find and use the proper response data class in `lib/response.ts`. To get the `txhash` or the above request for example:\n\n```JavaScript\nimport { GenericResponse, TxResultResponse } from './lib/response';\n\n(async() =\u003e {\n  const request = new MemoRequest('my first memo', walletAddress, walletSecret);\n  let response: GenericResponse\u003cTxResultResponse\u003e = await httpClient.createMemo(request);\n  console.log(response.responseData.txhash);\n})();\n```\n\n### `SignatureGenerator`\nThis class provides a functionality to [generate signatures](https://docs-blockchain.line.biz/api-guide/Authentication#generating-signature) for a request.\n\nAll API requests, except for the endpoint to retrieve the server time, must pass authentication information and be signed. Signing is a bit annoying, but never mind, fortunately, `HttpClient` itself will import this and generate signatures before sending a request.\n\nIf you do want to study how LINE Blockchain signature created, it's okay to dive into the source code.\n\n\n### New transaction result\nPlease refer to [New transaction result](./docs/README.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fline%2Fline-blockchain-developers-sdk-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fline%2Fline-blockchain-developers-sdk-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fline%2Fline-blockchain-developers-sdk-js/lists"}