Giter Site home page Giter Site logo

metamask / metamask-docs Goto Github PK

View Code? Open in Web Editor NEW
619.0 78.0 876.0 628.75 MB

Developer documentation for MetaMask

Home Page: https://docs.metamask.io

License: Apache License 2.0

JavaScript 48.95% CSS 16.47% TypeScript 21.11% MDX 13.48%
blockchain cryptocurrency documentation ethereum metamask

metamask-docs's Introduction

MetaMask developer documentation

This is the MetaMask developer documentation repository. The documentation site is hosted at docs.metamask.io, and it's built using Docusaurus, a static site generator purpose-built for technical documentation.

Build locally

Build the documentation site locally using the following steps.

Prerequisites

Steps

  1. Clone the repository.

    git clone https://github.com/MetaMask/metamask-docs.git
    cd metamask-docs

    Note: If you don't have write access to this repository, you must fork the repository to your personal account and clone your forked repository instead. Add an upstream remote to be able to pull from and push to the original repository.

    git clone https://github.com/<YOUR-USERNAME>/metamask-docs.git
    cd metamask-docs
    git remote add upstream https://github.com/MetaMask/metamask-docs.git
  2. Install dependencies.

    yarn install
  3. Start the development server.

    yarn start

    Once the server starts, you can view the documentation at http://localhost:3000.

For more information on contributing to the documentation, see the full contribution guidelines.

metamask-docs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

metamask-docs's Issues

Add a "Contributors" section to the docs for the MetaMask Extension and docs

Thought it'd be a great idea to add a "Contributor" tab at the bottom of the "Resource" section.

To Do:

Create a getting started tutorial app

Create a getting started tutorial app that will help guide developers on where to start with the different methods when communicating with the network. Reference here as a starting point for the getting started application.

Possible typo: reason instead of error

The code in this page:

https://metamask.github.io/metamask-docs/API_Reference/Ethereum_Provider#ethereum.enable()

Example usage (ES6), assuming async function:

try {
  const accounts = await ethereum.enable()
  // You now have an array of accounts!
  // Currently only ever one:
  // ['0xFDEa65C8e26263F6d9A1B5de9555D2931A33b825']

} catch (error) {
  // Handle error. Likely the user rejected the login:
  console.log(reason === "User rejected provider access")
}

logs an error: reason is not defined

reason might have been mistaken which should've been error

Replace codepen examples with components

making the docs more interactive by replacing the codepen examples with actual vue components. Will keep a link to the codepen examples for people to play with

Bug in documentation code?

I believe the code contained at this link: https://metamask.github.io/metamask-docs/Examples/Low_Level_Ether_Transfer

    const rejected = 'User denied transaction signature.'
    if (response.error && response.error.message.includes(rejected)) {
      return alert(`We can't take your money without your permission.`)
    }

Should be:

        const rejected = 'User denied transaction signature.'
        if (response.error && response.error.stack.includes(rejected)) {
          return alert(`We can't take your money without your permission.`)
        }

Detect if the metamask is installed fail

Hi,
I use the Metamask "Quick Started" sample code to detect that,
But I always got the alert 'Looks like you need a Dapp browser to get started.' even the metamask is installed.

The Metamask info is V7.4.0 in Chrome.
Someone help me to fix that?
thank you :)

if (typeof window.ethereum === 'undefined') {
alert('Looks like you need a Dapp browser to get started.')
alert('Consider installing MetaMask!')

} else {

    // In the case the user has MetaMask installed, you can easily
    // ask them to sign in and reveal their accounts:
    ethereum.enable()

        // Remember to handle the case they reject the request:
        .catch(function (reason) {
            if (reason === 'User rejected provider access') {
                // The user didn't want to sign in!
            } else {
                // This shouldn't happen, so you might want to log this...
                alert('There was an issue signing you in.')
            }
        })
        // In the case they approve the log-in request, you'll receive their accounts:
        .then(function (accounts) {
            // You also should verify the user is on the correct network:
            if (ethereum.networkVersion !== desiredNetwork) {
                alert('This application requires the main network, please switch it in your MetaMask UI.')

                // We plan to provide an API to make this request in the near future.
                // https://github.com/MetaMask/metamask-extension/issues/3663
            }

            // Once you have a reference to user accounts,
            // you can suggest transactions and signatures:
            const account = accounts[0]
            sendEtherFrom(account, function (err, transaction) {
                if (err) {
                    return alert(`Sorry you weren't able to contribute!`)
                }

                alert('Thanks for your successful contribution!')
            })

        })
}

Update structure of mobile docs

Current structure of mobile docs is:

image

New structure (to update to):

Mobile

1. Introduction (has content updates)

2. Checklist to make site compatible

3. Best practices

  • Dapp interactions with MetaMask browser & Wallet Connect
    a) MetaMask users can access your site/DApp directly via MetaMask’s Web3 browser (apply to be listed here). Or they can simply search it in the browser
    b) Use the link generator to open your site with MetaMask app (https://metamask.github.io/metamask-deeplinks/#)
    c) WalletConnect (same content): Use mobile deeplinking to sign using MetaMask while your users use the web3 site on the browser of their choice (GIF of walletconnect working on MetaMask mobile)
  • Deeplinks (same content) - enable payment requests with MetaMask
  • Make your web3 site mobile friendly

Redesign Documentation

Theme/Content Redesign (Will link several different pull requests)

Base 2.0 PR #189

  • Add MetaMask color pallet for the base theme #189
  • Guide Section: (In Progress)
    • Introduction (In Progress: #191)
    • Getting Started
    • Common Terms
    • Initializing Dapps
    • Accessing Accounts
    • Sending Transactions
  • Change all the live example's CSS to follow the MetaMask branding guidelines
  • Add dark theme toggling capabilities
  • API Reference changes
    • Ethereum Provider API:
      • Push code snippets into JavaScript files (discuss with MetaMask team on maintainability)
    • Signing Data:
    • Create a video on Sign Typed Data V4
    • Clean up Sign Typed Data V4 parameter definitions
  • Mobile Section:
    • Redesign Introduction Page
    • Create Interactive Site Compatibility Checklist

Create a Tutorial App for Developers (Typescript Rewrite) (Will link several different pull requests)

  • Refactor testing dapp and create modules to prep for the "Getting Started" tutorial
  • Create Step by step guide to building a basic Dapp (4 Parts)
  • Create Video on building out of the "Getting Started" tutorial web app

Brand Resources:
https://github.com/MetaMask/brand-resources

Create Simple Dapp Part 1 Improvements

1. Number/Letter the subheaders to correspond with the TOC
a. The five steps under Basic Action (Part 1) are not numbered , so it's harder for the reader to follow along in the steps. I think the bullets in the first section of Basic Action (Part 1) should be numbered, and the headers that correspond to those bullets be numbered as well.
b. Only the first bullet point in Basic Action (Part 1) is a link to its respective section. All of the bullets should have corresponding links

2. Avoid adding code to the middle of blocks
As much as possible, the tutorial should try to build the code linearly. On two occasions in this tutorial, the reader is asked to add code in the middle of a block, which increases the likelihood of errors and adds confusion.

3. Increased feedback loops so the user can verify exactly what happened
As a user who is fairly new to any programming language or platform, having tight feedback loops ensures that they are on the right track and boosts confidence. I would personally prefer to have less steps with more feedback, even at the expense of longer code blocks.

4. A final code block that shows the entire page/tutorial in a single block
At the end of the tutorial, having the entire code block on the page provides a checkpoint for the reader. They are then able to compare their work to the completed code block and make any chances to their work if they are seeing any errors. Having this larger code block also allows for the users to paste the entire code snippet and work through the tutorial with complete code .

Docs we want to add

Here are some docs we agreed we'd like to add. Please check off an item as you begin it, so nobody else does! (Also maybe reload first to make sure someone else didn't just check it).

  • Inter-linking between docs sites
    • Refine verbiage of three docs site types (extension, Ðapp, user)
    • Link each to each other
  • Quick Start Guide (build on our hackathon guide but with EIP 1102 support)
  • Getting started
    • 1102 Sign-in
    • running ganache
    • reset ganache
    • Common terms
  • Interacting with user accounts
    • Sending Transactions
      • Gas price (user editable)
      • Gas limit (Ðapp default editable)
      • Nonce (Not Ðapp editable)
      • Transaction retries (tx hash not currently an absolute source of truth!)
    • Signing Data
      • History
      • eth_sign
      • personal_sign
      • eth_signTypedData
  • Best practices
    • Detect network changes
    • Add your method names to the registry
    • Add your tokens to the user’s list.
  • Full supported JSON-RPC subset
  • Our experimental APIs?
    • watchAsset
  • how gas is calculated
  • #92
    • current & planned support
    • compatible signing methods
  • (soon) contract account setup / how-to
  • #416

add chrome error

error:
Name of a key "directdepositqitmm'erexplainer" is invalid. Only ASCII [a-z], [A-Z], [0-9] and "_" are allowed.

chrome 78.0.3904.108 (64)

Documentation Bug Submitter Obscures Best Practices

Google Chrome
Version 74.0.3729.169 (Official Build) (64-bit)

Can't access 'Best Practices' in the docs because the link is obscured by the Bug submitter panel and there is no option (or way) to scroll further down ...
web 3 docs bug

Add search indexing with Algolia

From @rekmarks:

Our documentation’s search functionality sucks, because we’re using a limited, local, markdown header-based JS search library. As it turns out, lots of big projects use VuePress for their docs like we do, and you can do a free integration with a search engine called Algolia to provide full-text site search.
The gist is that Algolia indexes your docs site, and then you incorporate their widget into your docs (very straightforward with VuePress). It does not appear to inject any trackers into the website, at least none that Brave can detect.
Users include Babel, React, Yarn, TypeScript, Webpack, and ESLint.
VuePress docs for integration: https://vuepress.vuejs.org/theme/default-theme-config.html#algolia-search
Algolia’s docsearch product home page: https://docsearch.algolia.com/

Wrong return value for eth_requestAccounts

The documentation says the method eth_requestAccounts returns an array of accounts, however it returns a JSON-RPC response as of MetaMask 7.4.0. Probably a bug of MetaMask.

To reproduce

In any page containing an EthereumProvider for a browser installed MetaMask 7.4.0, evaluate the following statement:

ethereum.send('eth_requestAccounts').then(console.log)
// {id: 1, jsonrpc: "2.0", result: ['0x1234...']}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.