{"_id":"@defi-3s/bsc-use-wallet","_rev":"3-86f808daa33e82afc00684feac561b8a","name":"@defi-3s/bsc-use-wallet","dist-tags":{"latest":"1.0.0"},"versions":{"0.8.1":{"name":"@defi-3s/bsc-use-wallet","version":"0.8.1","author":{"name":"Aragon Association","email":"legal@aragon.org"},"license":"MIT","main":"dist/cjs/index.js","module":"dist/index.js","sideEffects":false,"types":"types/index.d.ts","scripts":{"build":"yarn rollup --config","dev":"yarn rollup --config --watch","lint":"yarn eslint ./src","test":"yarn lint","prepare":"rm -rf ./dist && yarn build","prepublishOnly":"git push && git push --tags"},"dependencies":{"@aragon/provided-connector":"^6.0.7","@binance-chain/bsc-connector":"^1.0.3","@web3-react/authereum-connector":"^6.1.1","@web3-react/core":"^6.1.1","@web3-react/fortmatic-connector":"^6.0.9","@web3-react/frame-connector":"^6.0.9","@web3-react/injected-connector":"^6.0.7","@web3-react/portis-connector":"^6.1.1","@web3-react/squarelink-connector":"^6.1.1","@web3-react/torus-connector":"^6.1.1","@web3-react/walletconnect-connector":"^6.1.4","@web3-react/walletlink-connector":"^6.1.1","jsbi":"^3.1.1"},"devDependencies":{"@babel/cli":"^7.8.3","@babel/core":"^7.8.3","@babel/preset-env":"^7.8.3","@babel/preset-react":"^7.8.3","@rollup/plugin-commonjs":"^11.0.1","@rollup/plugin-json":"^4.0.1","@rollup/plugin-node-resolve":"^7.0.0","babel-eslint":"^10.0.3","builtin-modules":"^3.1.0","eslint":"^6.8.0","eslint-config-prettier":"^6.9.0","eslint-config-standard":"^14.1.0","eslint-config-standard-react":"^9.2.0","eslint-plugin-import":"^2.20.0","eslint-plugin-node":"^11.0.0","eslint-plugin-prettier":"^3.1.2","eslint-plugin-promise":"^4.2.1","eslint-plugin-react":"^7.18.0","eslint-plugin-react-hooks":"^2.3.0","eslint-plugin-standard":"^4.0.1","prettier":"^1.19.1","rollup":"^2.57.0","rollup-plugin-babel":"^4.3.3","rollup-plugin-terser":"^5.2.0"},"peerDependencies":{"react":"^16.12.0"},"gitHead":"dfd272842d00b987e948bc4f1db78de76f05abae","description":"[<img src=\"https://img.shields.io/npm/v/use-wallet\" alt=\"\" />](https://www.npmjs.com/package/use-wallet) [<img src=\"https://img.shields.io/bundlephobia/minzip/use-wallet\" alt=\"\" />](https://bundlephobia.com/result?p=use-wallet)","_id":"@defi-3s/bsc-use-wallet@0.8.1","_nodeVersion":"16.9.1","_npmVersion":"7.23.0","dist":{"integrity":"sha512-sGx9/X9AKd05y/+uWxDbMnxgSCHHW2Kruq7pKTKgFlyPQ2RqVnDKyd9q4LvJgwUXJq65H47MRtqjjx6tdAxPRQ==","shasum":"a882542ee1964fae9d6862db9deb7009f25498fc","tarball":"https://registry.npmjs.org/@defi-3s/bsc-use-wallet/-/bsc-use-wallet-0.8.1.tgz","fileCount":52,"unpackedSize":25192956,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDy7zCjptysYCiDH4TkDFdBcEpPEsH8mrKfeYWkrGYVnwIhAPkCjmS1lYIIp6+4XM2lx6lJ3OySavxSLgYAmxGiSoZv"}]},"_npmUser":{"name":"defi-3s","email":"eagle.warriorc17@gmail.com"},"directories":{},"maintainers":[{"name":"defi-3s","email":"eagle.warriorc17@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bsc-use-wallet_0.8.1_1632636201272_0.9607664443174055"},"_hasShrinkwrap":false},"1.0.0":{"name":"@defi-3s/bsc-use-wallet","version":"1.0.0","author":{"name":"Aragon Association","email":"legal@aragon.org"},"license":"MIT","main":"dist/cjs/index.js","module":"dist/index.js","sideEffects":false,"types":"types/index.d.ts","scripts":{"build":"yarn rollup --config","dev":"yarn rollup --config --watch","lint":"yarn eslint ./src","test":"yarn lint","prepare":"rm -rf ./dist && yarn build","prepublishOnly":"git push && git push --tags"},"dependencies":{"@aragon/provided-connector":"^6.0.7","@binance-chain/bsc-connector":"^1.0.3","@web3-react/authereum-connector":"^6.1.1","@web3-react/core":"^6.1.1","@web3-react/fortmatic-connector":"^6.0.9","@web3-react/frame-connector":"^6.0.9","@web3-react/injected-connector":"^6.0.7","@web3-react/portis-connector":"^6.1.1","@web3-react/squarelink-connector":"^6.1.1","@web3-react/torus-connector":"^6.1.1","@web3-react/walletconnect-connector":"^6.1.4","@web3-react/walletlink-connector":"^6.1.1","jsbi":"^3.1.1"},"devDependencies":{"@babel/cli":"^7.8.3","@babel/core":"^7.8.3","@babel/preset-env":"^7.8.3","@babel/preset-react":"^7.8.3","@rollup/plugin-commonjs":"^11.0.1","@rollup/plugin-json":"^4.0.1","@rollup/plugin-node-resolve":"^7.0.0","babel-eslint":"^10.0.3","builtin-modules":"^3.1.0","eslint":"^6.8.0","eslint-config-prettier":"^6.9.0","eslint-config-standard":"^14.1.0","eslint-config-standard-react":"^9.2.0","eslint-plugin-import":"^2.20.0","eslint-plugin-node":"^11.0.0","eslint-plugin-prettier":"^3.1.2","eslint-plugin-promise":"^4.2.1","eslint-plugin-react":"^7.18.0","eslint-plugin-react-hooks":"^2.3.0","eslint-plugin-standard":"^4.0.1","prettier":"^1.19.1","rollup":"^2.57.0","rollup-plugin-babel":"^4.3.3","rollup-plugin-terser":"^5.2.0"},"peerDependencies":{"react":"^17.0.2"},"gitHead":"dfd272842d00b987e948bc4f1db78de76f05abae","description":"[<img src=\"https://img.shields.io/npm/v/use-wallet\" alt=\"\" />](https://www.npmjs.com/package/use-wallet) [<img src=\"https://img.shields.io/bundlephobia/minzip/use-wallet\" alt=\"\" />](https://bundlephobia.com/result?p=use-wallet)","_id":"@defi-3s/bsc-use-wallet@1.0.0","_nodeVersion":"16.9.1","_npmVersion":"7.23.0","dist":{"integrity":"sha512-kbdn7w9jymFqEs0C92z97XYUwT8w8gZViwWZihmmom9BwgLJ/Blrl9jWS0ihOpdq8KEJWpm1txRQm9VHSfyy/g==","shasum":"6dfc97a71605d543492e18ac51d277d11feda1a7","tarball":"https://registry.npmjs.org/@defi-3s/bsc-use-wallet/-/bsc-use-wallet-1.0.0.tgz","fileCount":52,"unpackedSize":25192955,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzssoCRA9TVsSAnZWagAAmvEP/App2HzcyQjwDxuyHDch\n9rn2gMNfurTk3T/3SHTzLxAXc272ir0Cp2Y3nvhghyNd7wnOBszwfbzLU15O\n9B3tbT7NdIc88HqMkL85Sjt44cJuouPLBLUof61/CB/PoAnUyzufQ1kklX7D\nCF1OnP1Nmx/xjVecTZe+2axjFX27Gy4BACPCK1Qz3+4KT623txSzyii+ocKn\n99CL6x/cNthJxI24l86elCU0mouR8MX/PFdo9YHzUezmex5hjHpZ+EInXfXX\nYYLXnWJTzanqmEHl/huUMwMdQlDFcLp4j1L/ewZgEzU1ZeAffVXGGymfQHwW\nzK696X71Org5ZZ/qbeolbhbNf7BVcT1Yk1E7Hl46VJeGC2/ahSdaUwocLvH6\nX5+K/NGFe1EZmgxPr7U6/29dUR2PP3hbIHWezcwEKlmRSB98Y6DIqern9Rgu\noi3FPXsIbRetEKw7I5tZXM1OZWI+SWbXeOudbStOigAtOSdAw+Mi1FbWyoYx\nVWIwEbwNoXpF9q0q+GC9HWZW+k8n5FTgNSTaCWwOPqTc0v+CHCp3XiKyAaHd\n5+xjxdQSVgH/tIIdE1E/+n4b64wPFNo0zNc6kRT4klHAF1bM6trhIcTd8UYm\nblcIgBUlTYZdFHomeoQxTqpD0jyA5NzT3JrZepa9T5PWAQYNA4Nk/WfBpwcy\ndYLr\r\n=pfJd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDEMELzkkzXfhl6+XT6uT4uUYbaw6MQ6M7Cqft8f2rC3AIhAOfK6EEMOTLHDcd6MUByks6n2H5RgjnUdAgzzzyu7kQu"}]},"_npmUser":{"name":"defi-3s","email":"eagle.warriorc17@gmail.com"},"directories":{},"maintainers":[{"name":"defi-3s","email":"eagle.warriorc17@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bsc-use-wallet_1.0.0_1632638008271_0.32453105060396403"},"_hasShrinkwrap":false}},"time":{"created":"2021-09-26T06:03:21.229Z","0.8.1":"2021-09-26T06:03:21.553Z","modified":"2022-04-05T03:37:56.206Z","1.0.0":"2021-09-26T06:33:28.569Z"},"maintainers":[{"name":"defi-3s","email":"eagle.warriorc17@gmail.com"}],"description":"[<img src=\"https://img.shields.io/npm/v/use-wallet\" alt=\"\" />](https://www.npmjs.com/package/use-wallet) [<img src=\"https://img.shields.io/bundlephobia/minzip/use-wallet\" alt=\"\" />](https://bundlephobia.com/result?p=use-wallet)","author":{"name":"Aragon Association","email":"legal@aragon.org"},"license":"MIT","readme":"# 👛 useWallet()\n\n[<img src=\"https://img.shields.io/npm/v/use-wallet\" alt=\"\" />](https://www.npmjs.com/package/use-wallet) [<img src=\"https://img.shields.io/bundlephobia/minzip/use-wallet\" alt=\"\" />](https://bundlephobia.com/result?p=use-wallet)\n\nuseWallet() allows dapp users to connect to the provider of their choice in a way that is as straightforward as possible. It provides a common data structure for any connected account, no matter what provider has been chosen by the user. It aims to provide some features that are often reimplemented by dapp developers: connecting to a wallet, keeping track of transactions, and more (submit a [issue](https://github.com/aragon/use-wallet/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) or PR!).\n\n## Features\n\n- All-in-one solution to connect to Ethereum providers.\n- Completely library agnostic (use Web3.js, ethers.js, …).\n- Provides the current balance.\n- Keeps track of the recent transactions (coming soon).\n\n### Opinionated?\n\nOh yes:\n\n- React only.\n- Ethereum and Binance Smart Chain only (for now).\n- Supports one network at a time.\n- Embeds as many providers as possible.\n- Every prop and parameter is optional.\n\n### What useWallet() is not\n\n- An Ethereum wallet implementation.\n- A low-level, fully configurable connection system for Ethereum providers (see [web3-react](https://github.com/NoahZinsmeister/web3-react) if you are after that).\n- An general library to interact with Ethereum (see ethers.js, Web3.js, etc.).\n\n### Used by\n\n- [Aragon client](https://github.com/aragon/aragon)\n- [Aragon's Court Dashboard](https://github.com/aragon/court-dashboard)\n- _(Your project!)_\n\n## Usage\n\nAdd it to your project:\n\n```console\nyarn add @binance-chain/bsc-use-wallet\n```\n\nUse it in your React app:\n\n```jsx\n// App.js\n\nimport React from 'react'\nimport { render } from 'react-dom'\nimport bsc from '@binance-chain/bsc-use-wallet'\nimport { UseWalletProvider } from 'use-wallet'\n\nfunction App() {\n  const wallet = useWallet()\n  const blockNumber = wallet.getBlockNumber()\n\n  return (\n    <>\n      <h1>Wallet</h1>\n      {wallet.status === 'connected' ? (\n        <div>\n          <div>Account: {wallet.account}</div>\n          <div>Balance: {wallet.balance}</div>\n          <button onClick={() => wallet.reset()}>disconnect</button>\n        </div>\n      ) : (\n        <div>\n          Connect:\n          <button onClick={() => wallet.connect()}>MetaMask</button>\n          <button onClick={() => wallet.connect('frame')}>Frame</button>\n          <button onClick={() => wallet.connect('portis')}>Portis</button>\n        </div>\n      )}\n    </>\n  )\n}\n\n// Wrap everything in <UseWalletProvider />\nexport default () => (\n  (\n    <UseWalletProvider connectors={{ bsc }}>\n      <App />\n    </UseWalletProvider>\n  ),\n  document.getElementById('root')\n)\n```\n\n## API\n\n### &lt;UseWalletProvider />\n\nThis is the provider component. It should be placed above any component using `useWallet()`. Apart from `children`, it accepts two other props:\n\n#### chainId\n\nThe [Chain ID](https://chainid.network/) supported by the connection. Defaults to 1.\n\n#### connectors\n\nConfiguration for the different connectors. If you use a connector that requires a configuration but do not provide one, an error will be thrown.\n\n- `injected`: no configuration needed.\n- `frame`: no configuration needed.\n- `fortmatic`: `{ apiKey }`\n- `portis`: `{ dAppId }`\n- `provided`: `{ provider }`\n- `authereum`: no configuration needed.\n- `squarelink`: `{ clientId, options }`\n- `walletconnect`: `{ rpcUrl }`\n- `walletlink`: `{ url, appName, appLogoUrl }`\n- `bsc`: no configuration needed.\n\nSee the [web3-react documentation](https://github.com/NoahZinsmeister/web3-react/tree/v6/docs) for more details.\n\n### useWallet()\n\nThis is the hook to be used throughout the app.\n\nIt takes an optional object as a single param, containing the following:\n\n- `pollBalanceInterval`: the interval used to poll the wallet balance. Defaults to 2000.\n- `pollBlockNumberInterval`: the interval used to poll the block number. Defaults to 5000.\n\nIt returns an object representing the connected account (“wallet”), containing:\n\n- `account`: the address of the account, or `null` when disconnected.\n- `balance`: the balance of the account, in wei.\n- `chainId`: The specified Chain ID of the network you're connected to.\n- `connect(connectorId)`: call this function with a connector ID to “connect” to a provider (see above for the connectors provided by default).\n- `connector`: The \"key\" of the wallet you're connected to (e.g \"metamask\", \"portis\").\n- `connectors`: the full list of connectors.\n- `error`: contains an error object with the corresponding name and message if `status` is set to `error`.\n- `ethereum`: the connected [Ethereum provider](https://eips.ethereum.org/EIPS/eip-1193).\n- `getBlockNumber()`: this function returns the current block number. This is a function because the block number updates often, which could trigger as many extra renders. Making an explicit call for the block number allows users of `useWallet()` to avoid extra renders when the block number is not needed.\n- `networkName`: a human-readable name corresponding to the Chain ID.\n- `reset()`: call this function to “disconnect” from the current provider. This will also clean the latest error value stored in `use-wallet`'s state.\n- `status`: contains the current status of the wallet connection. The possible values are:\n  - \"disconnected\": no wallet connected (default state).\n  - \"connecting\": trying to connect to the wallet.\n  - \"connected\": connected to the wallet (i.e. the account is available).\n  - \"error\": a connection error happened.\n- `type`: whether or not the account is a contract. Can be `null` when you're disconnected, or either `\"contract\"` or `\"normal\"`.\n\n## Special thanks\n\nuseWallet() is a built on [web3-react](https://github.com/NoahZinsmeister/web3-react) and its connectors, which are doing all the hard work internally.\n","readmeFilename":"README.md"}