{"id":13746697,"url":"https://github.com/loomnetwork/loom-js","last_synced_at":"2026-02-02T13:53:30.258Z","repository":{"id":47013253,"uuid":"119220133","full_name":"loomnetwork/loom-js","owner":"loomnetwork","description":"JS library for building browser apps \u0026 NodeJS services that interact with Loom DAppChains","archived":false,"fork":false,"pushed_at":"2023-07-05T08:55:55.000Z","size":4361,"stargazers_count":204,"open_issues_count":49,"forks_count":47,"subscribers_count":29,"default_branch":"master","last_synced_at":"2024-11-15T19:37:52.769Z","etag":null,"topics":["blockchain","dappchain","ethereum","javascript","nodejs","typescript"],"latest_commit_sha":null,"homepage":"https://loomx.io","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loomnetwork.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-28T02:15:06.000Z","updated_at":"2024-05-12T13:42:46.000Z","dependencies_parsed_at":"2024-11-15T19:32:36.771Z","dependency_job_id":"c14a2649-6601-4383-8ab0-f059dbb10a0c","html_url":"https://github.com/loomnetwork/loom-js","commit_stats":null,"previous_names":[],"tags_count":121,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loomnetwork%2Floom-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loomnetwork%2Floom-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loomnetwork%2Floom-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loomnetwork%2Floom-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loomnetwork","download_url":"https://codeload.github.com/loomnetwork/loom-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253209294,"owners_count":21871629,"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","dappchain","ethereum","javascript","nodejs","typescript"],"created_at":"2024-08-03T06:00:58.902Z","updated_at":"2026-02-02T13:53:30.177Z","avatar_url":"https://github.com/loomnetwork.png","language":"TypeScript","readme":"# [Loom.js](https://loomx.io) ![Build Status](https://github.com/github/docs/actions/workflows/main.yml/badge.svg?branch=master)\n\nJS library for building browser apps \u0026 NodeJS services that interact with Loom DAppChains.\n\n## Install\n\n### NodeJS\n\n```\n# NPM\nnpm install loom-js\n# Yarn\nyarn add loom-js\n```\n\n### Browser\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/loom-js@1.15.0/dist/loom.umd.js\"\u003e\u003c/script\u003e\n```\n\n## Debugging\n\n`loom-js` uses the [`debug`](https://github.com/visionmedia/debug) package for logging.\n- To inspect the logs when running in the browser set `localStorage.debug = '*'`\n- To inspect the logs when running in NodeJS set the `DEBUG` env var to `*`\n\nSee docs for `debug` package if you wish to filter the log messages.\n\n## Development\n\n```shell\n# build for Node\nyarn build\n# build for Browser\nyarn build:browser\n# build for Node while targeting ES2017 (more readable than ES5)\nyarn build:dev\n# run unit tests on Node \u0026 Browser\nyarn test\n# auto-format source files\nyarn format\n# run unit tests in Node\nyarn test:node\n# run unit tests in Electon\nyarn test:browser\n# run e2e test in Node (local DAppChain node must be running first)\nyarn e2e:node\n# run e2e test in Electron (local DAppChain node must be running first)\nyarn e2e:browser\n```\n\nThe e2e test environment can be configured by changing `.env.test` (see `.env.test.example` for\ndefault values).\n\n### Debugging\n\nTo debug loom-js while using it another project:\n1. Clone the Git repo from https://github.com/loomnetwork/loom-js\n2. Inside the loom-js repo run:\n   ```bash\n   yarn link\n   yarn build:dev\n   ```\n3. In your project repo run `yarn link loom-js`.\n4. Debug your project normally.\n\n`yarn build:dev` will compile the TypeScript source to target ES2017, which requires a lot less\ntransformation of async/await constructs than the ES5 code released on NPM.\n\n### Regenerating Protobufs\n\nWhenever you change `src/proto/loom.proto`, or `src/tests/tests.proto` you will need to regenerate\nthe corresponding `*_pb.js` by running:\n\n```shell\nyarn proto\n```\n\nThe shell must be able to locate the `protoc` binary, which can be obtained from https://github.com/google/protobuf/releases\n\n### Custom Middlewares\n\nLoomProvider takes a custom function that lets you customize what middlewares it runs. For example, we have an experimental nonce caching middleware that has more advanced nonce tracking. You can add it as such:\n\n```js\nconst setupMiddlewareFn = function(client, privateKey) {\n  const publicKey = CryptoUtils.publicKeyFromPrivateKey(privateKey)\n  return [new CachedNonceTxMiddleware(publicKey, client), new SignedTxMiddleware(privateKey)]\n}\n\nconst loomProviderObj = new LoomProvider(client, privateKey, setupMiddlewareFn)\n```\n\nMore examples here: https://github.com/loomnetwork/loom-js/blob/master/src/tests/e2e/loom-provider-web3-middlewares-tests.ts\n\n### JSON RPC supported calls\n\nLoomProvider combined with Web3 supports the following `JSON RPC` calls\n\n#### Current implemented\n\n- [x] eth_accounts\n- [x] eth_blockNumber\n- [x] eth_call\n- [x] eth_gasPrice\n- [x] eth_getBlockByHash\n- [x] eth_getBlockByNumber\n- [x] eth_getCode\n- [x] eth_getFilterChanges\n- [x] eth_getLogs\n- [x] eth_getTransactionByHash\n- [x] eth_getTransactionReceipt\n- [x] eth_newBlockFilter\n- [x] eth_newFilter\n- [x] eth_newPendingTransactionFilter\n- [x] eth_sendTransaction\n- [x] eth_subscribe\n- [x] eth_uninstallFilter\n- [x] eth_unsubscribe\n- [x] net_version\n\n#### Should\n\n- [ ] eth_getFilterLogs (Returns an array of all logs matching filter with given id)\n- [ ] eth_estimateGas (Currently, it always returns zero)\n\n#### Maybe\n\n- [ ] net_peerCount (Returns the current ethereum protocol version)\n- [ ] eth_syncing (Returns an object with data about the sync status or false)\n- [ ] eth_coinbase (Returns the client coinbase address)\n- [ ] web3_clientVersion (Returns the current client version)\n- [ ] eth_getTransactionCount (Returns the number of transactions sent from an address)\n- [ ] eth_getBlockTransactionCountByHash (Returns the number of transactions in a block from a block matching the given block hash)\n- [ ] eth_getBlockTransactionCountByNumber (Returns the number of transactions in a block matching the given block number)\n\n### Custom Loom provider methods\n\nSometimes the project requires few functions that aren't provided directly from LoomProvider in this case is possible to add a custom Eth RPC method. You can add it as such:\n\n```js\nconst loomProviderObj = new LoomProvider(client, privateKey)\nloomProviderObj.addCustomMethod('eth_balance', payload =\u003e {\n  return '0x1'\n})\n```\n\nThe first param should be the Ethereum RPC call method to add on LoomProvider and the second parameter a callback function with the result\n\n### Overwrite Loom provider methods\n\nIf the project requires to overwrite a RPC function that already exists on LoomProvider. You can add it as such:\n\n```js\nloomProvider.overwriteMethod('eth_estimateGas', payload =\u003e {\n  return '0x123'\n})\n```\n\nThe first param should be the Ethereum RPC call method to overwrite on LoomProvider and the second parameter a callback function with the result\n\n## License\n\nBSD 3-Clause, see `LICENSE` file for details.\n","funding_links":[],"categories":["Web 3.0","TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floomnetwork%2Floom-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floomnetwork%2Floom-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floomnetwork%2Floom-js/lists"}