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.

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.

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.

debug

boolean optional

Default false

By default there will be no logs printed on console but if you want to run Mexa in debug mode, set the debug value as true and all logs will be printed that will help you in debugging the code.

Example Code

For metamask biconomy initialization code would look like:

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