├── .eslintignore ├── .eslintrc ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── feature_request.yml │ └── questions_and_help.yml └── workflows │ ├── main.yml │ └── pr.yml ├── .gitignore ├── .nvmrc ├── .prettierrc ├── .releaserc.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── examples └── basic-ts │ ├── .babelrc │ ├── .eslintrc │ ├── .gitignore │ ├── .rescriptsrc.js │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt │ ├── src │ ├── App.css │ ├── App.tsx │ ├── index.css │ ├── index.tsx │ ├── logo.svg │ ├── react-app-env.d.ts │ └── setupTests.ts │ └── tsconfig.json ├── jest.config.js ├── package-lock.json ├── package.json ├── src ├── __tests__ │ ├── ethereum-conflicts.test.tsx │ ├── index.test.tsx │ ├── reducer.test.ts │ └── use-metamask.test.tsx ├── index.tsx ├── metamask-context.ts ├── metamask-provider.tsx ├── reducer.ts ├── use-metamask.ts └── utils │ └── useSafeDispatch.ts ├── test-utils └── jest.setup.ts └── tsconfig.json /.eslintignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules 3 | .pnp 4 | .pnp.js 5 | 6 | # testing 7 | coverage 8 | 9 | # production 10 | lib 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["react-app", "react-app/jest"] 3 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: 🐛 Bug Report 2 | description: Something isn't working correctly. 3 | body: 4 | - type: markdown 5 | attributes: 6 | value: | 7 | Thank you for contributing to open source! 8 | 9 | Think you found a bug? 10 | ====================== 11 | The best bug report is a failing test in the repository as a pull request. Otherwise, please use the form below. 12 | - type: textarea 13 | attributes: 14 | label: What version of React and MetaMask-React are you using? 15 | value: | 16 | - React: 17 | - MetaMask-React: 18 | validations: 19 | required: true 20 | - type: textarea 21 | attributes: 22 | label: What is the current behavior? 23 | description: | 24 | If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to a CodeSandbox (https://codesandbox.io/s/new) example below 25 | validations: 26 | required: true 27 | - type: textarea 28 | attributes: 29 | label: What is the expected behavior? 30 | validations: 31 | required: true 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: 👍 Feature Request 2 | description: I'd like MetaMask-React to do something new. 3 | body: 4 | - type: markdown 5 | attributes: 6 | value: | 7 | Thank you for contributing to open source! 8 | - type: textarea 9 | attributes: 10 | label: What is the new or updated feature that you are suggesting? 11 | description: | 12 | Please provide thoughtful commentary *and code samples* on what this feature means for your product. What will it allow you to do that you can't do today? How will it make current work-arounds straightforward? What potential bugs and edge cases does it help to avoid? etc. Please keep it product-centric. 13 | validations: 14 | required: true 15 | - type: textarea 16 | attributes: 17 | label: Why should this feature be included? 18 | validations: 19 | required: true 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/questions_and_help.yml: -------------------------------------------------------------------------------- 1 | name: 🤔 Questions and Help 2 | description: The place to ask and / or say anything. 3 | body: 4 | - type: markdown 5 | attributes: 6 | value: | 7 | Thank you for contributing to open source! 8 | - type: textarea 9 | attributes: 10 | label: Open 11 | validations: 12 | required: true -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Main Build 2 | on: 3 | push: 4 | branches: 5 | - main 6 | jobs: 7 | coverage: 8 | runs-on: ubuntu-latest 9 | name: Coverage 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Setup node 13 | uses: actions/setup-node@v2 14 | with: 15 | node-version: '16.x' 16 | cache: npm 17 | - run: npm ci 18 | - run: npm run test:cover 19 | - name: Coveralls 20 | uses: coverallsapp/github-action@master 21 | with: 22 | github-token: ${{ secrets.GITHUB_TOKEN }} 23 | publish: 24 | runs-on: ubuntu-latest 25 | name: Versionning and Publish 26 | steps: 27 | - uses: actions/checkout@v2 28 | - name: Setup node 29 | uses: actions/setup-node@v2 30 | with: 31 | node-version: '14.x' 32 | cache: npm 33 | - run: npm ci 34 | - run: npm run build 35 | - run: npm test 36 | - run: npm run test:cover 37 | - name: Release 38 | env: 39 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 40 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 41 | run: npx semantic-release 42 | -------------------------------------------------------------------------------- /.github/workflows/pr.yml: -------------------------------------------------------------------------------- 1 | name: Pull Request Build 2 | on: 3 | pull_request: 4 | jobs: 5 | test: 6 | runs-on: ubuntu-latest 7 | strategy: 8 | matrix: 9 | node: [ '14', '16' ] 10 | name: Node ${{ matrix.node }} - Test 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: Setup node 14 | uses: actions/setup-node@v2 15 | with: 16 | node-version: ${{ matrix.node }} 17 | - run: npm ci 18 | - run: npm run build 19 | - run: npm test 20 | - run: npm run test:cover 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /lib 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | v16 2 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "useTabs": false, 3 | "tabWidth": 2 4 | } -------------------------------------------------------------------------------- /.releaserc.yml: -------------------------------------------------------------------------------- 1 | { 2 | "branches": ["main", "next"] 3 | } -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Questions 4 | 5 | If you have questions about implementation details, help or support, then please open an issue with your question. 6 | 7 | ## Reporting Issues 8 | 9 | If you have found what you think is a bug, please [file an issue](https://github.com/VGLoic/metamask-react/issues/new). 10 | 11 | ## Suggesting new features 12 | 13 | If you are here to suggest a feature, first create an issue if it does not already exist. From there, we will discuss use-cases for the feature and then finally discuss how it could be implemented. 14 | 15 | ## Development 16 | 17 | If you have been assigned to fix an issue or develop a new feature, please follow these steps to get started: 18 | 19 | - Fork this repository 20 | - Set up the proper Node version by running `$ nvm use` 21 | - Install dependencies by running `$ npm install` 22 | - Implement your changes and tests to files in the `src/` directory and corresponding test files 23 | - To run examples, follow their individual directions. 24 | - Git stage your required changes and commit (see below commit guidelines) 25 | - Submit PR for review 26 | 27 | ## Commit message conventions 28 | 29 | `metamask-react` is using [Angular Commit Message Conventions](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines). 30 | 31 | We have very precise rules over how our git commit messages can be formatted. This leads to **more readable messages** that are easy to follow when looking through the **project history**. 32 | 33 | ### Commit Message Format 34 | 35 | Each commit message consists of a **header**, a **body** and a **footer**. The header has a special 36 | format that includes a **type**, a **scope** and a **subject**: 37 | 38 | ``` 39 | (): 40 | 41 | 42 | 43 |