Configuration

Configure Mexa as per your requirement with multiple options

Biconomy constructor takes 2 parameters

const biconomy = new Biconomy(<existing web3 provider>, options);

<existing web3 provider>

object required

Any web3 provider that supports personal_sign, eth_accounts, eth_sendTransaction, eth_call RPC methods and web3 subscriptions.

For example, it can be window.ethereum for Metamask or portis.provider for Portis and so on.

options

object required

A json object having following configuration values for initializing mexa sdk.

dappId

string required DApp ID can be found on mexa dashboard.

Unique id assigned to each DApp on mexa dashboard.

apiKey

string required API Key can be found on mexa dashboard.

Unique id assigned to each DApp that used to authenticate requests coming from mexa sdk.

strictMode

boolean optional

Default false

If strict mode is on, and method/api called by user is not registered on mexa dashboard then no transaction will be initiated.

If strict mode is off, and method called by user is not registered on mexa dashboard then existing provider will be used to send user transaction but in this case, the user will have to pay the transaction fee.

readViaContract

boolean optional

Default false

Boolean value if true, then all read calls also will go through Biconomy else read calls will fetch data directly from blockchain.

If false, msg.sender property in read method will be user client wallet public address.

If true, msg.sender property in read method will be user contract wallet address.

loginMessageToSign

string optional

Default "Sign message to login to Biconomy with counter "

This is the message to be shown to user to sign when user login using external wallets. User address transaction nonce will be appended in the above message at the end to avoid any replay attacks.

messageToSign

string optional

Default "Sign message to prove the ownership of your account with counter "

This is the message to be shown to user to provide signature while interacting with DApps contract methods. User address transaction nonce will be appended in the above message at the end to avoid any replay attacks.

Example Code

For metamask biconomy initialization code would look like:

let options = {
dappId: <DAPP ID>,
apiKey: <API KEY>,
strictMode: true
};
const biconomy = new Biconomy(window.ethereum, options);