{"_id":"@acentswap/multiwallet-ui","_rev":"2-16edbd2605d5bbd9574e8f8bfddffe4a","name":"@acentswap/multiwallet-ui","dist-tags":{"latest":"8.0.0"},"versions":{"8.0.0":{"name":"@acentswap/multiwallet-ui","author":{"name":"acentswap"},"version":"8.0.0","license":"MIT","main":"dist/index.js","typings":"dist/index.d.ts","publishConfig":{"access":"public"},"keywords":["acentvm","acent","bitcoin","dogecoin","web3","ethereum","solana","defi"],"engines":{"node":">=10"},"scripts":{"start":"tsdx watch","build":"tsdx build","clean":"yarn rimraf ./dist","test":"tsdx test --passWithNoTests","lint":"tsdx lint","prepare":"tsdx build","size":"size-limit","analyze":"size-limit --why","storybook":"start-storybook -p 6006","build-storybook":"build-storybook"},"dependencies":{"@acentswap/interfaces":"8.1.0","@acentswap/multiwallet-base-connector":"8.3.0"},"peerDependencies":{"@material-ui/core":"^4.9.1","@material-ui/icons":"^4.9.1","react":">=16"},"husky":{"hooks":{"pre-commit":"tsdx lint"}},"prettier":{"printWidth":80,"semi":true,"singleQuote":false,"tabWidth":2,"trailingComma":"es5","endOfLine":"lf","arrowParens":"always"},"module":"dist/multiwallet-ui-tsdx.esm.js","size-limit":[{"path":"dist/multiwallet-ui-tsdx.cjs.production.min.js","limit":"10 KB"},{"path":"dist/multiwallet-ui-tsdx.esm.js","limit":"10 KB"}],"devDependencies":{"@babel/core":"^7.11.6","@material-ui/core":"^4.9.1","@material-ui/icons":"^4.9.1","@size-limit/preset-small-lib":"^4.6.0","@storybook/addon-essentials":"^6.0.21","@storybook/addon-info":"^5.3.21","@storybook/addon-links":"^6.0.21","@storybook/addons":"^6.0.21","@storybook/react":"^6.0.21","@types/react":"^16.9.49","@types/react-dom":"^16.9.8","@weiran.zsd/tsdx":"^0.14.0","babel-loader":"^8.1.0","husky":"^4.3.0","react":"^17","react-dom":"^16.13.1","react-is":"^16.13.1","size-limit":"^4.6.0","tslib":"^2.3.0","typescript":"^4"},"jest":{"testTimeout":20000},"gitHead":"18d6877f16a36888e0f8874affc4cd1160439cad","description":"This package provides a React wallet selection modal and state management for Multiwallet connectors.","_id":"@acentswap/multiwallet-ui@8.0.0","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-Rpp06oHgKYXqS7B8JLy3i/OEnhrBQCU6yw2Hka3fWVmj1sUrYy4lgvnLLpa0E+T32sxioCLjrbKVTxZYLt9oXg==","shasum":"7633104689906f3f4b0d860f0010159844579110","tarball":"https://registry.npmjs.org/@acentswap/multiwallet-ui/-/multiwallet-ui-8.0.0.tgz","fileCount":16,"unpackedSize":375311,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh0+meCRA9TVsSAnZWagAAndgP/1tIzcuDTm4Hj2eKz8GB\n+WtFG5ybYEr/Gcixab6BRc9HUpbxNOU0ZdzSmY8hG2i/Oh4XMYN5Ubxi6zy0\nhl6sO4J3+25/reG/kWcZrwHMJ5QB6zCACMn6TmvK8rz6G46pMrtOpYXalDOy\n5YAQFBqLU1oErTaT63cfnaBSD+3cIyVDONlSqoaI4JUb5N214QnZySN/fSy1\nPAVafgPzssbuh9GBje63m01mjL4r2RkQaNWANMID7PWWCpeCdfrbhBIWHHXd\n5bLDYbyVd2hQ/sVlq5cRYxEvXNrFmVk6oDfU41Rm2d2IDuOfv3z8eFKLe0gt\nzMUVEyJn6vZ1FAF2rTdwt60JzLPnK/LQKb/1j6RY4C7qS/bBm33op9iTyDoE\nQ2adwBc1gjsyJNdW8Yaj5ljhZBF6vSDL63/RxyEZv/7jVmHzivrW/PqdYd3i\nrWsnFwEul1ayRgK0MpuBYWhKnK1W1hsQqiZsKGzGpUhgUCoMKpGU+j/MV92p\nyRFLsOvFlIhl0EtTaVZBi38w+dd2lfT4PrBhncv1LL6cjZ+yq2L/oxqSC7pl\nrIQOODGAv9gpJXvbTAL3y6aK5hrftnCnXBa56C+Mm2qnKD2VOz+SUMg4SCUb\nbCWZKlHYXKQI4fkspj0yAamlc897yRdMNDa8Z92ijCpAMx/Mbpi+HTULpmRF\nuEON\r\n=kLbI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHTZY6T0qkjUlTe2SoakQnKspv4+dVWa8JPz0B4WBk7eAiEAmg7hvjvNEzEubgsNQs6n3jofEQ4iuukqxktA38Z4iOM="}]},"_npmUser":{"name":"helloacent","email":"melme890@gmail.com"},"directories":{},"maintainers":[{"name":"helloacent","email":"melme890@gmail.com"},{"name":"nara7875","email":"tmdgml7875@gmail.com"},{"name":"webcgi","email":"webcgi@kakao.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/multiwallet-ui_8.0.0_1641277854095_0.3170065036032512"},"_hasShrinkwrap":false}},"time":{"created":"2022-01-04T06:30:54.047Z","8.0.0":"2022-01-04T06:30:54.238Z","modified":"2022-06-03T04:48:22.148Z"},"maintainers":[{"email":"melme890@gmail.com","name":"helloacent"},{"email":"webcgi@kakao.com","name":"webcgi"}],"description":"This package provides a React wallet selection modal and state management for Multiwallet connectors.","keywords":["acentvm","acent","bitcoin","dogecoin","web3","ethereum","solana","defi"],"author":{"name":"acentswap"},"license":"MIT","readme":"# `Multiwallet UI`\r\n\r\nThis package provides a React wallet selection modal and state management for Multiwallet connectors.\r\n\r\n## Usage\r\n\r\n```bash\r\nyarn add @acentswap/multiwallet-ui @material-ui/core @material-ui/icons\r\n# For each chain / connector\r\nyarn add @acentswap/multiwallet-{DESIRED_CHAIN}-{DESIRED_WALLET}-connector\r\n# Ensure peer dependencies are installed\r\n```\r\n\r\nAt the root of your app, add the provider\r\n\r\n```ts\r\nimport React from 'react';\r\nimport ReactDOM from 'react-dom';\r\n\r\nimport { MultiwalletProvider } from '@acentswap/multiwallet-ui';\r\nimport App from './App';\r\n\r\nReactDOM.render(\r\n  <MultiwalletProvider>\r\n    <App />\r\n  </MultiwalletProvider>,\r\n  document.getElementById('root')\r\n);\r\n```\r\n\r\nIn your app, configure the desired providers for their chains eg.\r\n\r\n```ts\r\nimport { EthereumInjectedConnector } from '@acentswap/multiwallet-ethereum-injected-connector';\r\nimport { EthereumWalletConnectConnector } from '@acentswap/multiwallet-ethereum-walletconnect-connector';\r\nimport { BinanceSmartChainInjectedConnector } from '@acentswap/multiwallet-binancesmartchain-injected-connector';\r\n\r\nconst options = {\r\n  chains: {\r\n    ethereum: [\r\n      {\r\n        name: 'Metamask',\r\n        logo: 'https://avatars1.githubusercontent.com/u/11744586?s=60&v=4',\r\n        connector: new EthereumInjectedConnector({ debug: true }),\r\n      },\r\n      {\r\n        name: 'WalletConnect',\r\n        logo: 'https://avatars0.githubusercontent.com/u/37784886?s=60&v=4',\r\n        connector: new EthereumWalletConnectConnector({\r\n          rpc: {\r\n            42: `https://kovan.infura.io/v3/${process.env.INFURA_KEY}`,\r\n          },\r\n          qrcode: true,\r\n          debug: true,\r\n        }),\r\n      },\r\n    ],\r\n    bsc: [\r\n      {\r\n        name: 'BinanceSmartWallet',\r\n        logo: 'https://avatars2.githubusercontent.com/u/45615063?s=60&v=4',\r\n        connector: new BinanceSmartChainInjectedConnector({ debug: true }),\r\n      },\r\n    ],\r\n  },\r\n};\r\n```\r\n\r\nFinally, render the modal and use the `useMultiwallet` hook to request a connection to the chain.\r\n\r\n```tsx\r\nimport * as React from 'react';\r\nimport { WalletPickerModal, useMultiwallet } from '@acentswap/multiwallet-ui';\r\n// import options object\r\n\r\nconst WalletDemo: React.FC = () => {\r\n  const { enabledChains } = useMultiwallet();\r\n  return (\r\n    <div>\r\n      {Object.entries(enabledChains).map(([chain, connector]) => (\r\n        <span key={chain}>\r\n          {chain}: Status {connector.status} to {connector.account}\r\n        </span>\r\n      ))}\r\n    </div>\r\n  );\r\n};\r\n\r\nconst App = () => {\r\n  const [open, setOpen] = React.useState(false);\r\n  const [chain, setChain] = React.useState('');\r\n  const setClosed = React.useMemo(() => () => setOpen(false), [setOpen]);\r\n\r\n  return (\r\n    <>\r\n      <WalletDemo />\r\n      <button\r\n        onClick={() => {\r\n          setChain('ethereum');\r\n          setOpen(true);\r\n        }}\r\n      >\r\n        Request Ethereum\r\n      </button>\r\n      <button\r\n        onClick={() => {\r\n          setChain('bsc');\r\n          setOpen(true);\r\n        }}\r\n      >\r\n        Request BSC\r\n      </button>\r\n      <WalletPickerModal\r\n        open={open}\r\n        options={{\r\n          chain,\r\n          onClose: setClosed,\r\n          config: options,\r\n          targetNetwork: 'mainnet',\r\n        }}\r\n      />\r\n    </>\r\n  );\r\n};\r\n```\r\n\r\nSee the `/example` directory for a working example, or check the storybook as detailed below for further usage guides.\r\n\r\n## Developing\r\n\r\nThis library uses [TSDX](https://tsdx.io/) to bootstrap, build and run tests.\r\n\r\n### Commands\r\n\r\nTSDX scaffolds your new library inside `/src`, and also sets up a [Parcel-based](https://parceljs.org) playground for it inside `/example`.\r\n\r\nThe recommended workflow is to run TSDX in one terminal:\r\n\r\n```bash\r\nnpm start # or yarn start\r\n```\r\n\r\nThis builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.\r\n\r\nThen run either Storybook or the example playground:\r\n\r\n#### Storybook\r\n\r\nRun inside another terminal:\r\n\r\n```bash\r\nyarn storybook\r\n```\r\n\r\nThis loads the stories from `./stories`.\r\n\r\n> NOTE: Stories should reference the components as if using the library, similar to the example playground. This means importing from the root project directory. This has been aliased in the tsconfig and the storybook webpack config as a helper.\r\n\r\n#### Example\r\n\r\nThen run the example inside another:\r\n\r\n```bash\r\ncd example\r\nnpm i # or yarn to install dependencies\r\nnpm start # or yarn start\r\n```\r\n\r\nThe default example imports and live reloads whatever is in `/dist`, so if you are seeing an out of date component, make sure TSDX is running in watch mode like we recommend above. **No symlinking required**, we use [Parcel's aliasing](https://parceljs.org/module_resolution.html#aliases).\r\n\r\nTo do a one-off build, use `npm run build` or `yarn build`.\r\n\r\nTo run tests, use `npm test` or `yarn test`.\r\n\r\n### Configuration\r\n\r\nCode quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly.\r\n\r\n#### Jest\r\n\r\nJest tests are set up to run with `npm test` or `yarn test`.\r\n\r\n#### Bundle analysis\r\n\r\nCalculates the real cost of your library using [size-limit](https://github.com/ai/size-limit) with `npm run size` and visulize it with `npm run analyze`.\r\n\r\n##### Setup Files\r\n\r\nThis is the folder structure we set up for you:\r\n\r\n```txt\r\n/example\r\n  index.html\r\n  index.tsx       # test your component here in a demo app\r\n  package.json\r\n  tsconfig.json\r\n/src\r\n  index.tsx       # EDIT THIS\r\n/test\r\n  blah.test.tsx   # EDIT THIS\r\n/stories\r\n  Thing.stories.tsx # EDIT THIS\r\n/.storybook\r\n  main.js\r\n  preview.js\r\n.gitignore\r\npackage.json\r\nREADME.md         # EDIT THIS\r\ntsconfig.json\r\n```\r\n\r\n#### Rollup\r\n\r\nTSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.\r\n\r\n#### TypeScript\r\n\r\n`tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.\r\n\r\n### Continuous Integration\r\n\r\n#### GitHub Actions\r\n\r\nTwo actions are added by default:\r\n\r\n- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix\r\n- `size` which comments cost comparison of your library on every pull request using [size-limit](https://github.com/ai/size-limit)\r\n\r\n### Module Formats\r\n\r\nCJS, ESModules, and UMD module formats are supported.\r\n\r\nThe appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.\r\n\r\n### Named Exports\r\n\r\nPer Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library.\r\n","readmeFilename":"README.md"}