A wrapper written in typescript that wraps around the Monaverse API;
- Install with
npm i mona-js-sdk
- Instance the
Mona
class and use it as you want;
Instancing:
const Mona = new MonaAPI({
apiKey: api,
autoLogin: {
enabled: true,
callbackOnLogin: setUser
}
});
export default Mona;
Generate one time password:
await Mona.OTP_Generate('my@email.com');
Note that OTP_Generate
will always resolve (unless the api key is wrong) for security reasons.
Verify One time password:
const p = await Mona.OTP_Verify('my@email.com', 123123);
if (p.success) {
...
}
Get User :
const user = await Mona.getUser();
console.log(user)
> {
wallets: ['0x0fa074262d6af...'],
email: 'my@email.com',
username: 'fayelure',
name: 'Fayelure'
};
- Git clone the repo;
- Run
npm i
Create a new branch and push your changes, make sure npm run build
still works. Then make a PR;