Web3Auth
Published in

Web3Auth

Build Seamless User Flows with Torus at ETH India Online 2020

Torus is Sponsoring ETH India Online 2020

Torus API Bounty Prizes

Dive into Torus Documentation

Integrating Torus

import Torus from "@toruslabs/torus-embed";
import Web3 from "web3";
const torus = new Torus({
buttonPosition: "top-left" // default: bottom-left
});
await torus.init({
buildEnv: "production", // default: production
enableLogging: true, // default: false
network: {
host: "kovan", // default: mainnet
chainId: 42, // default: 1
networkName: "Main Ethereum Network"
},
showTorusButton: false
});
await torus.login(); // await torus.ethereum.enable()
const web3 = new Web3(torus.provider);

Get User Public Information

const userInfo = await torus.getUserInfo();interface UserInfo {
email: string;
name: string;
profileImage: string;
verifier: string;
verifierId: string;
}

Torus Name Resolver

const publicAddress = await torus.getPublicAddress({
verifier: "google" | "reddit" | "discord";
verifierId: "random@gmail.com"
});

Initiating Top Ups

const paymentProviders = {
moonpay: {
minOrderValue: 24.99,
maxOrderValue: 2000,
validCurrencies: ['USD', 'EUR', 'GBP'],
validCryptoCurrencies: ['ETH', 'DAI', 'TUSD', 'USDC', 'USDT']
},
wyre: {
minOrderValue: 20,
maxOrderValue: 250,
validCurrencies: ['USD'],
validCryptoCurrencies: ['ETH', 'DAI', 'USDC']
}
}
const paymentStatus = await torus.initiateTopup('moonpay', {
selectedCurrency: "USD",
fiatValue: 50,
selectedCryptoCurrency: "ETH"
});

Join the Torus Community

Register Now!

--

--

Simple auth infra for Web3 apps and wallets

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store