- Gasless DAI transfers via the Mosendo API
- Browser & Node.js support
- Injected web3 provider (e.g. Metamask) support
- EIP712 for readable user signed messages
npm i --save gasless
import Gasless from 'gasless';
(async ()=>{
await window.ethereum.enable();
const gasless = new Gasless(window.web3.currentProvider);
const gasPrice = await window.web3.eth.getGasPrice();
const daiFee = await gasless.getFee(gasPrice);
const from = window.web3.eth.defaultAccount;
const txHash = await gasless.send(
from, // Sender address (string)
to, // Recipient address (string)
value, // base unit DAI amount (string)
daiFee // Base unit DAI fee. (string)
gasPrice // Tx gas price in Wei. (string)
);
})()
Please make sure that your custom provider supports EIP712 signTypedData_v3.
Just replace window.web3.currentProvider
in the example above with your custom provider.