Skip to content
This repository has been archived by the owner on Jul 23, 2021. It is now read-only.

Commit

Permalink
Update docs for shipped breaking changes (MetaMask#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
rekmarks authored Jan 22, 2021
1 parent d71dc5f commit fc40bad
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 116 deletions.
16 changes: 6 additions & 10 deletions docs/guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,18 @@ Welcome to MetaMask’s Developer Documentation. This documentation is for learn
- For up to the minute news, follow our [Peepeth](https://peepeth.com/MetaMask/), [Twitter](https://twitter.com/metamask_io) or [Medium](https://medium.com/metamask) pages.
- To learn how to contribute to the MetaMask project itself, visit our [Internal Docs](https://github.com/MetaMask/metamask-extension/tree/develop/docs).

::: warning Breaking Provider Changes
We are in the process of shipping changes that will break some Ethereum web applications.
These changes have already shipped for the MetaMask browser extension, and may ship for MetaMask Mobile at any time.
Please read our [Migration Guide](./provider-migration.html) for more details.

Action is required for Ethereum application developers only.
MetaMask users do not need to do anything.
::: tip Recent Breaking Provider Changes
If you are an Ethereum application developer and are looking for information about our January 2021 provider API changes,
please see our [Migration Guide](./guide/provider-migration.html) for more details.
:::

## Why MetaMask

MetaMask was created to meet the needs of secure and usable Ethereum-based web sites. In particular, it handles account management and connecting the user to the blockchain.

- [Get started here](/guide/getting-started.html)
- [Learn more about our JavaScript Provider API](/guide/ethereum-provider.html)
- [Learn more about our RPC API](/guide/rpc-api.html)
- [Get started here](./guide/getting-started.html)
- [Learn more about our JavaScript Provider API](./guide/ethereum-provider.html)
- [Learn more about our RPC API](./guide/rpc-api.html)

## Account Management

Expand Down
4 changes: 2 additions & 2 deletions docs/guide/create-dapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ We will be building this [app](https://metamask.github.io/test-dapp/)

## Project Setup

Before you setup make sure you've visited and gone through our [Getting Started Guide](/guide/getting-started.html#getting-started)
Before you setup make sure you've visited and gone through our [Getting Started Guide](./guide/getting-started.html#getting-started)

Make sure you have:

Expand Down Expand Up @@ -69,7 +69,7 @@ As you can see here, as soon as the content in the DOM is loaded we are calling

What we'll cover in part one:

- [Connecting to the MetaMask Wallet](/guide/create-dapp.html#connecting-to-the-metamask-wallet)
- [Connecting to the MetaMask Wallet](./guide/create-dapp.html#connecting-to-the-metamask-wallet)
- See our eth_accounts result
- Display our network number
- Display our ChainId
Expand Down
57 changes: 5 additions & 52 deletions docs/guide/ethereum-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@
We recommend that all web3 site developers read the [Basic Usage](#basic-usage) section.
:::

::: warning Breaking Provider Changes
We are in the process of shipping changes that will break some Ethereum web applications.
These changes have already shipped for the MetaMask browser extension, and may ship for MetaMask Mobile at any time.
Please see the [Breaking Provider Changes](#upcoming-breaking-changes) section for details.

If your website is broken and you're wondering how to fix it, please see the [Migration Guide](./provider-migration.html).

Action is required for Ethereum application developers only.
MetaMask users do not need to do anything.
::: tip Recent Breaking Provider Changes
If you are an Ethereum application developer and are looking for information about our January 2021 provider API changes,
please see our [Migration Guide](./guide/provider-migration.html) for more details.
:::

MetaMask injects a global API into websites visited by its users at `window.ethereum`.
Expand Down Expand Up @@ -41,47 +35,6 @@ if (provider) {

[[toc]]

## Breaking Changes

::: tip Tip
If you are new to using the provider, you do not have to worry about these changes, and can skip ahead [to the next section](#api).
:::

::: warning Breaking Changes are Live
On January 12, 2020, these changes went live for the Firefox extension.
Chrome, Brave, and Edge will go live in the coming days.
MetaMask Mobile will receive these changes as soon as possible.

If your website is broken and you're wondering how to fix it, please see the [Migration Guide](./provider-migration.html).
If you want to learn more about the changes, please read on.
:::

### `window.ethereum` API Changes

The following changes to the `window.ethereum` API are breaking:

- Ensure that chain IDs returned by `eth_chainId` are **not** 0-padded
- For example, instead of `0x01`, we will always return `0x1`, wherever the chain ID is returned or accessible.
- Note that this _only_ affects the [default Ethereum chains](#chain-ids), _except_ Kovan, whose chain ID is formatted correctly (`0x2a`).
- Stop emitting `chainIdChanged`, and instead emit `chainChanged`
- Remove the following experimental methods:
- `ethereum._metamask.isEnabled`
- `ethereum._metamask.isApproved`
- Remove the `ethereum.publicConfigStore` object
- This object was, despite its name, never intended for public consumption.
Its removal _may_ affect those who do not use it directly, e.g. if another library you use relies on the object.
- Remove the `ethereum.autoRefreshOnNetworkChange` property
- Consumers will still be able to set this property on the provider, it just won't do anything.

### `window.web3` Removal

::: tip Tip
If you do not use the `window.web3` object injected by MetaMask, you can ignore this section.
:::

As part of the breaking changes, we will stop injecting `web3.js` as `window.web3` into web pages.
MetaMask will continue to inject a shim object as `window.web3`, to issue warnings when websites attempt to access `window.web3`.

## Basic Usage

For any non-trivial Ethereum web application — a.k.a. dapp, web3 site etc. — to work, you will have to:
Expand All @@ -95,7 +48,7 @@ You can learn how to accomplish the other two by reviewing the snippet in the [U

The provider API is all you need to create a full-featured web3 application.

That said, many developers use a convenience library, such as [ethers](https://www.npmjs.com/package/ethers) and [web3.js](https://www.npmjs.com/package/web3), instead of using the provider directly.
That said, many developers use a convenience library, such as [ethers](https://www.npmjs.com/package/ethers), instead of using the provider directly.
If you are in need of higher-level abstractions than those provided by this API, we recommend that you use a convenience library.

## Chain IDs
Expand Down Expand Up @@ -162,7 +115,7 @@ If the request fails for any reason, the Promise will reject with an [Ethereum R

MetaMask supports most standardized Ethereum RPC methods, in addition to a number of methods that may not be
supported by other wallets.
See the MetaMask [RPC API documentation](./rpc-api.html) for details.
See the MetaMask [RPC API documentation](./guide/rpc-api.html) for details.

#### Example

Expand Down
8 changes: 4 additions & 4 deletions docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This guide assumes intermediate knowledge of HTML, CSS, and JavaScript.
Once MetaMask is installed and running, you should find that new browser tabs have a `window.ethereum` object available in the developer console.
This is how your website will interact with MetaMask.

You can review the full API for that object [here](./ethereum-provider.html).
You can review the full API for that object [here](./guide/ethereum-provider.html).
Note that in **over the course of 2020**, we are introducing significant changes to this API, and we recommend that you refer to its documentation.

## Basic Considerations
Expand All @@ -24,7 +24,7 @@ if (typeof window.ethereum !== 'undefined') {
}
```

You can review the full API for the `window.ethereum` object [here](./ethereum-provider.html).
You can review the full API for the `window.ethereum` object [here](./guide/ethereum-provider.html).

### Running a Test Network

Expand All @@ -36,7 +36,7 @@ Since your seed phrase is the power to control all your accounts, it is probably

#### Resetting Your Local Nonce Calculation

If you're running a test blockchain and restart it, you can accidentally confuse MetaMask because it calculates the next [nonce](./sending-transactions.html#nonce-ignored)
If you're running a test blockchain and restart it, you can accidentally confuse MetaMask because it calculates the next [nonce](./guide/sending-transactions.html#nonce-ignored)
based on both the network state _and_ the known sent transactions.

To clear MetaMask's transaction queue, and effectively reset its nonce calculation, you can use the `Reset Account` button in `Settings` (available in the top-right sandwich menu).
Expand All @@ -53,7 +53,7 @@ Currently there are a few stateful things to consider when interacting with this
- What is the current account?

Both of these are available synchronously as `ethereum.networkVersion` and `ethereum.selectedAddress`.
You can listen for changes using events too, see ([the API reference](./ethereum-provider.html)).
You can listen for changes using events too, see ([the API reference](./guide/ethereum-provider.html)).

### Connecting to MetaMask

Expand Down
12 changes: 4 additions & 8 deletions docs/guide/mobile-best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ If this page doesn't answer your question, please feel free to open an issue [in

## The Provider (window.ethereum)

::: danger Breaking Provider Changes
We are in the process of shipping changes that will break some Ethereum web applications.
These changes have already shipped for the MetaMask browser extension, and may ship for MetaMask Mobile at any time.
Please read our [Migration Guide](./provider-migration.html) for more details.

Action is required for Ethereum application developers only.
MetaMask users do not need to do anything.
::: tip Recent Breaking Provider Changes
If you are an Ethereum application developer and are looking for information about our January 2021 provider API changes,
please see our [Migration Guide](./guide/provider-migration.html) for more details.
:::

The [provider API](./ethereum-provider.html) is the same for both MetaMask Mobile and the desktop extension.
The [provider API](./guide/ethereum-provider.html) is the same for both MetaMask Mobile and the desktop extension.
However, the providers become available (i.e., are injected into the page) at different points in the page lifecycle.

### Provider Availability
Expand Down
Loading

0 comments on commit fc40bad

Please sign in to comment.