{"_id":"@alayanetwork/web3x","_rev":"1-246c8cbbb3af34347ddfc3bd50434f5f","name":"@alayanetwork/web3x","dist-tags":{"latest":"4.0.7"},"versions":{"4.0.7":{"name":"@alayanetwork/web3x","version":"4.0.7","license":"LGPL-3.0","description":"Typescript port of web3.js","repository":{"type":"git","url":"git+https://github.com/AlayaNetwork/web3x.git"},"homepage":"https://github.com/AlayaNetwork/web3x","bugs":{"url":"https://github.com/AlayaNetwork/web3x/issues"},"keywords":["Ethereum","TypeScript","API","Web3"],"contributors":[{"name":"alayanetwork","email":"npm@latticex.foundation","url":"https://github.com/AlayaNetwork"}],"main":"./index.js","types":"./index.d.ts","sideEffects":false,"dependencies":{"@types/bn.js":"^4.11.2","@types/node":"^10.12.18","@types/ws":"^6.0.1","bip39":"^2.5.0","bn.js":"^4.11.8","browserify-aes":"^1.2.0","elliptic":"^6.4.0","hdkey":"^1.1.0","idna-uts46-hx":"^2.3.1","isomorphic-fetch":"^2.2.1","isomorphic-ws":"^4.0.1","pbkdf2":"^3.0.17","randombytes":"^2.0.6","rlp":"^2.2.3","swarm-js":"^0.1.39","tslib":"^1.9.3","utf8":"^3.0.0","ws":"^6.1.0","@alayanetwork/web3-utils":"^0.13.2"},"_id":"@alayanetwork/web3x@4.0.7","_nodeVersion":"10.18.1","_npmVersion":"7.6.2","dist":{"integrity":"sha512-fDeWSlbAaNTbsjxKx2jXNbIk+8sdwbaTs/t/LIChfGV2zmBjHgYbxYaCB5ApRwzHC8vfQDa+xX2skxBDn5r/QQ==","shasum":"92854b83ee32b63cfe06d232980150e579997bae","tarball":"https://registry.npmjs.org/@alayanetwork/web3x/-/web3x-4.0.7.tgz","fileCount":226,"unpackedSize":823664,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgp0yDCRA9TVsSAnZWagAAYkkQAINgP7N70e+Xou3r2tt2\nqaPpVIByn4ApNroXAFg2N2VvJQgnWbgz4mwd3SDmNasdMNsz0FU6CAGnJ5RI\n3s6A0FyrAERuCKmjIN6X7GEOZ9q6s7VvDeq0LDoODiZtv9q2RPkgckjthiA3\nNMx9VF9GR2QH3ZZsSh5axw/s8ugcFnN7XWkNeOaRvEgyX/UdER1d6CrVM4f5\nAqG93EqUISOLikU/ppoSkc1PK0ed5YxsysV6dvCcHawzLR0ysXYPLQeF4Kgc\ntzYWXd3zRFLTdXpDCAYTTpPJkEmBc70ftlQOHHQTVj+cL2RoBhHXpXP4jXjj\nQSZfFCb43OM4/RGgPO69VpJ3bhPhgmQZTh0zUMiJVXlTC6HG9xr0hWxEQLw2\nXTcjF807Fbz7/uRhS9dWMDUjhGhA0hK0RQ5a70/Z1tAG4AVmuCoQKltaUcXY\nFuGOttNX1W4Vi50q+rg/S1mm9ccUOXRMhzvoE22ZG0qBxFUJrbwr6Elf7yjr\nJ+e/WrxRNIYsA83MJRP9BwrB05PkUoXNCUZYoovIkw8sM3wKh8bSDs9lOmyY\nEGBWElS/u54458cHySbwQsVZ9wgQpxmkukD8Na/ywkz/Tycxg8UOxvf6F6BW\nhbWd97wKm5coCGgGr+w7IN24RFUS21gTJWZI70tapTziUHjBhmjif4+8p0Oe\nVfX3\r\n=a7Lx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHGVQlBjgZfkwKZnShvpyvdle6QlgqnFNOUMLPCwFq0AAiApc4uLfZgcOu84WVLccKnk0V8qEFlDPF3XDW68ltCCTw=="}]},"_npmUser":{"name":"alayanetwork","email":"npm@latticex.foundation"},"directories":{},"maintainers":[{"name":"alayanetwork","email":"npm@latticex.foundation"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/web3x_4.0.7_1621576835170_0.6406404947634483"},"_hasShrinkwrap":false}},"time":{"created":"2021-05-21T06:00:35.103Z","4.0.7":"2021-05-21T06:00:35.360Z","modified":"2022-04-04T12:34:02.891Z"},"maintainers":[{"name":"alayanetwork","email":"npm@latticex.foundation"}],"description":"Typescript port of web3.js","homepage":"https://github.com/AlayaNetwork/web3x","keywords":["Ethereum","TypeScript","API","Web3"],"repository":{"type":"git","url":"git+https://github.com/AlayaNetwork/web3x.git"},"contributors":[{"name":"alayanetwork","email":"npm@latticex.foundation","url":"https://github.com/AlayaNetwork"}],"bugs":{"url":"https://github.com/AlayaNetwork/web3x/issues"},"license":"LGPL-3.0","readme":"# web3x\n\n[![Version](https://img.shields.io/npm/v/web3x.svg)](https://www.npmjs.com/package/web3x)\n[![Downloads](https://img.shields.io/npm/dm/web3x.svg)](https://www.npmjs.com/package/web3x)\n[![Downloads](https://img.shields.io/npm/dm/web3x-es.svg)](https://www.npmjs.com/package/web3x-es)\n[![GitHub Stars](https://img.shields.io/github/stars/xf00f/web3x.svg)](https://github.com/xf00f/web3x/stargazers)\n[![GitHub Issues](https://img.shields.io/github/issues/xf00f/web3x.svg)](https://github.com/xf00f/web3x/issues)\n[![Coverage](https://img.shields.io/coveralls/github/xf00f/web3x/master.svg)](https://coveralls.io/github/xf00f/web3x)\n[![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](https://github.com/xf00f/web3x/blob/master/LICENSE)\n\nEthereum TypeScript Client Library - for perfect types and tiny builds.\n\n![Demo](https://user-images.githubusercontent.com/44038056/48001064-5d377d00-e0ff-11e8-994f-36d165f9124e.gif)\n\n## Table of contents\n\n- [Why?](#why)\n- [Usage](#usage)\n- [Contract type safety](#contract-type-safety)\n- [The EVM provider](#the-evm-provider)\n- [Differences](#differences)\n- [Example projects](#example-projects)\n- [Documentation](#documentation)\n- [Packages](#packages)\n\n## Why?\n\nweb3.js is a very popular Ethereum library, but:\n\n- It has inaccurate typings and there's no way to to introduce type safety to contract code.\n- It's large, weighing in at ~800k uncompressed.\n\nweb3x solves the above issues and more.\n\n- It's pure TypeScript and generates contract types from ABIs.\n- It's small, with a minimum sized contract interaction weighing in at ~150k uncompressed.\n- It's expanding with additional features. For example the `EvmProvider` which provides a full inplace EVM implementation for executing contract code in your DAPP for simplified development workflows.\n\nweb3x also adopts a lean, functional design, and resolves many out the outstanding issues in the web3.js repository.\n\n## Usage\n\nThere are two builds of the library. `web3x` uses CommonJS style imports and is best used for Node.js backends. `web3x-es` uses ES6 imports and is best used for ES6 aware tools like Webpack.\n\n### Using inbuilt providers\n\nThe inbuilt providers are all [EIP-1193](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md) compatible, and are used as follows:\n\n```typescript\nimport { Address } from 'web3x-es/address';\nimport { WebsocketProvider } from 'web3x-es/providers';\nimport { Eth } from 'web3x-es/eth';\nimport { fromWei } from 'web3x-es/utils';\n\nasync function main() {\n  const provider = new WebsocketProvider('wss://mainnet.infura.io/ws');\n  const eth = new Eth(provider);\n  const balance = await eth.getBalance(Address.ZERO);\n  document.body.innerText = `Balance of 0 address ETH: ${fromWei(balance, 'ether')}`;\n}\n\nmain().catch(console.error);\n```\n\n### Using legacy providers, e.g. MetaMask\n\nUntil MetaMask and other providers are EIP-1193 compatible, you can use them with an adapter as follows:\n\n```typescript\nimport { LegacyProvider, LegacyProviderAdapter } from 'web3x-es/providers';\nimport { Eth } from 'web3x-es/eth';\n\ndeclare const web3: {\n  currentProvider: LegacyProvider;\n};\n\nconst eth = new Eth(new LegacyProviderAdapter(web3.currentProvider));\n```\n\nOr a shorthand version:\n\n```typescript\nimport { Eth } from 'web3x-es/eth';\nconst eth = Eth.fromCurrentProvider();\n```\n\nSee example projects for more complex usage examples.\n\n## Contract type safety\n\nInteracting with contracts without type safety is tedious at best, and dangerous at worst. `web3x` provides a code generator called `web3x-codegen` to generate typings for contract ABIs either local, or remote from a simple configuration file called `contracts.json`.\n\nRead more at [web3x-codegen](../web3x-codegen).\n\n## The EVM provider\n\nThere is an implementation of the EVM which can be used for simplifying development workflows.\n\nRead more at [web3x-evm](../web3x-evm).\n\n## Differences\n\nThis is not a perfect drop in replacement for web3.js, there are differences.\n\n- Callbacks for request/response style calls no longer supported, promises only.\n- PromiEvent interface has been removed, in favour of `getTxHash()`, `getReceipt()` methods.\n- Address objects must be used insead of strings. e.g. `Address.fromString('0x903ddd91207f737255ca93eb5885c0e087be0fc3')`\n- Buffers are used for keys and data instead of `0x` prefixed strings.\n- You should explicitly import parts of the library rather then accessing them via the web3 object.\n- Sanitized some hybrid types, e.g. access wallet accounts via `wallet.get(0)` rather than `wallet[0]`.\n\n## Example projects\n\nTwo example TypeScript projects are included, one for [webpack](../web3x-webpack-example) and one for [node.js](../web3x-node-example). They are configured to work with jest for testing. Adapting them to pure JavaScript if you don't want to use TypeScript should be trivial.\n\n## Documentation\n\nAPI documentation has not yet been ported from web3.js. For now the recommended approach for familiarising yourself with the library would be the following, in preferential order:\n\n- Read the web3.js documentation at https://web3js.readthedocs.io/en/1.0/ to familiarise yourself with its API.\n- Take a look at the example projects such as the [webpack example](../web3x-webpack-example/src/index.ts).\n- Rely on your IDE and TypeScript to provide insight into the API.\n- Delve into the code. It's significantly easier to follow and understand than web3.js.\n\n## Packages\n\n- [web3x](https://www.npmjs.com/package/web3x) (for Node.js)\n- [web3x-es](https://www.npmjs.com/package/web3x-es) (for ES6 aware tools such as Webpack)\n","readmeFilename":"README.md"}