{"bugs":{"url":"https://github.com/zksync-sdk/zksync2-js/issues"},"dist":{"shasum":"aabe379464963ab573e15948660a709f409b5316","tarball":"https://registry.npmjs.org/zksync-web3/-/zksync-web3-0.15.5.tgz","fileCount":107,"integrity":"sha512-97gB7OKJL4spegl8fGO54g6cvTd/75G6yFWZWEa2J09zhjTrfqabbwE/GwiUJkFQ5BbzoH4JaTlVz1hoYZI+DQ==","signatures":[{"sig":"MEUCIQCZmNXe4MvZO/cL99Avl0naDZ35t7GvRP4pZz8ZqgUD/wIgQLPUm0AokL1c3/mjnuUFR7K11DcdEJJMmNAYEvQIXlM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1098333},"main":"build/src/index.js","name":"zksync-web3","types":"build/src/index.d.ts","readme":"# 🚀 zksync-web3 JavaScript SDK 🚀\n\n\nIn order to provide easy access to all the features of zkSync Era, the `zksync-web3` JavaScript SDK was created,\nwhich is made in a way that has an interface very similar to those of [ethers](https://docs.ethers.io/v5/). In\nfact, `ethers` is a peer dependency of our library and most of the objects exported by `zksync-web3` (\ne.g. `Wallet`, `Provider` etc.) inherit from the corresponding `ethers` objects and override only the fields that need\nto be changed.\n\nWhile most of the existing SDKs should work out of the box, deploying smart contracts or using unique zkSync features,\nlike account abstraction, requires providing additional fields to those that Ethereum transactions have by default.\n\nThe library is made in such a way that after replacing `ethers` with `zksync-web3` most client apps will work out of\nbox.\n\n\n🔗 For a detailed walkthrough, refer to the [official documentation](https://era.zksync.io/docs/api/js/).\n\n## 📌 Overview\n\nTo begin, it is useful to have a basic understanding of the types of objects available and what they are responsible for, at a high level:\n\n- `Provider` provides connection to the zkSync Era blockchain, which allows querying the blockchain state, such as account, block or transaction details,\n  querying event logs or evaluating read-only code using call. Additionally, the client facilitates writing to the blockchain by sending\n  transactions.\n- `Wallet` wraps all operations that interact with an account. An account generally has a private key, which can be used to sign a variety of\n  types of payloads. It provides easy usage of the most common features.\n\n## 🛠 Prerequisites\n\n- `node: >= 14.20.0` ([installation guide](https://nodejs.org/en/download/package-manager))\n- `ethers: ~5.7.0`\n\n## 📥 Installation & Setup\n\n```bash\nyarn add zksync-web3\nyarn add ethers@5 # ethers is a peer dependency of zksync-web3\n```\n\n## 📝 Examples\n\n### Connect to the zkSync Era network:\n\n```ts\nimport { Wallet, Provider, utils } from \"zksync-web3\";\nimport { ethers } from \"ethers\";\n\nconst provider = new Provider(\"https://testnet.era.zksync.dev\"); // zkSync Era testnet (L2)\nconst ethProvider = ethers.getDefaultProvider(\"goerli\"); // goerli testnet (L1)\n```\n\n### Get the latest block number\n\n```ts\nconst blockNumber = await provider.getBlockNumber();\n```\n\n### Get the latest block\n\n```ts\nconst block = await provider.getBlock(\"latest\");\n```\n\n### Create a wallet\n\n```ts\nconst PRIVATE_KEY = process.env.PRIVATE_KEY;\nconst wallet = new Wallet(PRIVATE_KEY, provider, ethProvider);\n```\n\n### Check account balances\n\n```ts\nconst ethBalance = await wallet.getBalance(); // balance on zkSync Era network\n\nconst ethBalanceL1 = await wallet.getBalanceL1(); // balance on goerli network\n```\n\n\n### Transfer funds\n\nTransfer funds among accounts on L2 network.\n```ts\nconst receiver = Wallet.createRandom();\n\nconst transfer = await wallet.transfer({\n  to: receiver,\n  token: utils.ETH_ADDRESS,\n  amount: ethers.utils.parseEther(\"1.0\"),\n});\n```\n\n### Deposit funds\n\nTransfer funds from L1 to L2 network.\n```ts\nconst deposit = await wallet.deposit({\n  token: utils.ETH_ADDRESS,\n  amount: ethers.utils.parseEther(\"1.0\"),\n});\n```\n\n### Withdraw funds\n\nTransfer funds from L2 to L1 network.\n```ts\nconst withdrawal = await wallet.withdraw({\n  token: utils.ETH_ADDRESS,\n  amount: ethers.utils.parseEther(\"1.0\"),\n});\n```\n\n## 🤝 Contributing\n\nWe welcome contributions from the community! If you're interested in contributing to the zksync-web JavaScript SDK,\nplease take a look at our [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for guidelines and details on the process.\n\nThank you for making zksync-web3 JavaScript SDK better! 🙌\n","gitHead":"80107cb66f8fa8251b8aa3e8111096536ae172ff","license":"MIT","scripts":{"lint":"prettier . --write","test":"mocha -r ts-node/register --bail tests/setup.test.ts tests/unit/*.test.ts tests/integration/*.test.ts","build":"tsc && cp -f typechain/*.d.ts build/typechain && ncp ./abi ./build/abi","types":"find ./abi -name \"*.json\" -print0 | xargs -0 -I {} npx typechain --target ethers-v5 --outDir typechain {}","watch":"tsc --watch","lint:check":"prettier . --check"},"_npmUser":{"name":"npm-matterlabs","email":"npm@matterlabs.dev"},"homepage":"https://github.com/zksync-sdk/zksync2-js/tree/ethers-v5#readme","keywords":["zksync","web3","ethereum","layer2"],"deprecated":"This package has been deprecated in favor of zksync-ethers@5.0.0","repository":{"url":"git+https://github.com/zksync-sdk/zksync2-js.git","type":"git"},"_npmVersion":"9.8.1","description":"A Web3 library for interacting with the ZkSync Layer 2 scaling solution.","directories":{},"maintainers":[{"name":"gluk64","email":"ag@thematter.io"},{"name":"stanislavbezkor","email":"stanislavbezkor@gmail.com"},{"name":"popzxc","email":"popzxc@yandex.ru"},{"name":"ly0va","email":"lp@matterlabs.dev"},{"name":"npm-matterlabs","email":"npm@matterlabs.dev"}],"_nodeVersion":"18.18.0","dependencies":{"ethers":"~5.7.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ncp":"^2.0.0","chai":"^4.3.4","mocha":"10.1.0","ethers":"~5.7.0","ts-node":"^10.0.0","prettier":"3.0.3","typechain":"^3.0.0","typescript":"^4.3.5","@types/chai":"^4.2.19","@types/node":"^16.0.0","@types/mocha":"^8.2.2","@typechain/ethers-v5":"^2.0.0"},"peerDependencies":{"ethers":"~5.7.0"},"_npmOperationalInternal":{"tmp":"tmp/zksync-web3_0.15.5_1696427810268_0.7624491413451351","host":"s3://npm-registry-packages"},"_id":"zksync-web3@0.15.5","version":"0.15.5"}