Skip to main content

Installation

To interact with the Polygon network, you will need to use a web3 provider library, such as ethers.js, with Magic. For a more in-depth guide on available functions provided, refer to the EVM documentation.⁠ ⁠To get started, install the following dependencies for your project:

Ethers.js

Initialization

The Magic class is the entry-point to the Magic SDK. It must be instantiated with a Magic publishable key.
ImportantEthereum provider is only supported in [email protected] or later versions.

Mainnet

Mainnet Block Explorer URL: https://polygonscan.com/
JavaScript

Testnet

Mumbai Block Explorer: https://www.oklink.com/amoy Mumbai ⁠Testnet Faucet: https://faucet.polygon.technology/
JavaScript

Send Transaction

Ethers.js

Sign Message

Ethers.js

Personal Sign

Sign Typed Data v1

Sign Typed Data v3

Sign Typed Data v4

Get Balance

Ethers.js

Resources