window.ethereum.enable()
but returns a promise that resolves to a web3Provider
instance from Ethers.js. Use this when you need a fully functional web3Provider
instance, such as for making contract calls.โ๏ธ Note: make sure to have v1.0.0 or higher of the SDK installed. Otherwise Moralis.enableWeb3() will return an instance of web3.js instead of ethers.js
Moralis.provider
to initialize the web3.js library. Moralis.provider
will only be set after calling Moralis.authenticate or Moralis.enableWeb3.Note: Ethers.js is included in the Moralis SDK. So The function responses of Moralis.executeFunction and Moralis.transfer will always be formatted by Ethers.js (see below for more information)
provider
option:privateKey
option to sign transactions:executeFunction
, you can execute read-only (view) functions, and write methods. They both give a slightly different response. So we handle them seperately below.setMessage
function.hash
and other information.transaction.wait()
. That will resolve into a transaction receipt. This receipt will also include a log of all the events that have been fired in the transaction. For example here we wait for 3 confirmations:msg.value
Moralis.executeFunction()
returns:Moralis.authenticate()
/ Moralis.enableWeb3()
):Moralis.deactivateWeb3()
):The Provider emits connect when it:
first connects to a chain after being initialized. first connects to a chain, after the disconnect event was emitted.
The Provider emits disconnect when it becomes disconnected from all chains
Moralis.onXXX
. For example:link
function after the user has been authenticated.unlink
function removes the given address from the user's profile.signingMessage
option:True
or False
Note: this method can only be used, when Metamask is used as a connector
chain
(required): The chain id to switch to. Accepts values in numbers or in hex strings. Valid values are listed on the intro page in the Transactions and Balances section. Examples: 56
, "0x38"
Note: this method can only be used, when Metamask is used as a connector
chainid
(required): Network Chain IdchainName
(required): Network namecurrencyName
(required): Name of native currencycurrencySymbol
(required): Currency SymbolrpcUrl
(required): New RPC URLblockExplorerUrl
(required): BLock Explorer URL