Build Seamless User Flows with Torus at ETH India Online 2020

Torus Labs
Jan 14, 2020 · 4 min read

Torus is Sponsoring ETH India Online 2020

ETH India 2019 was an incredible hackathon for Torus, where we got to meet talented developers and fellow sponsors focused on pushing the ecosystem forward. There, we saw several amazing projects built over the short weekend. This year, we are thrilled to sponsor ETH India Online 2020 and hope to witness the genesis of our ecosystem’s next revolutionary project.

Torus API Bounty Prizes

We have released several new features since our last hackathon and would love for developers to take them out for a spin.

  • 1 Prize of ₹20,000 in ETH will be awarded to the best DApp that fully utilises Torus’ NameResolver Feature (using Google, Reddit or Discord accounts for distributing tokens through a contact list).
  • 1 Prize of ₹20,000 in ETH will be awarded to the best DApp that implements Proof of Signing for documents (DocuSign) with Torus.
  • 1 Prize of ₹20,000 in ETH will be awarded to the best DApp that integrates Torus with Aragon or other DAO Factories.
  • 1 Prize of ₹20,000 in ETH will be awarded to the best DApp that integrates Torus with other Smart Contract Wallets.
  • 1 Prize of ₹20,000 in ETH will be awarded to the best DApp that integrates Torus with other Layer 2 Solutions.

Dive into Torus Documentation

https://docs.tor.us spells out the code necessary for developers to integrate Torus with their project, and implement the coolest DApp features that Torus has to offer.

Integrating Torus

To ensure an efficient implementation process, we highly recommend developers configure their environment for NodeJS: 10.x.

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

With Torus, developers are able to pull basic public user information from the accounts that users log in with. This gives developers the ability to personalise each log in with the user’s profile picture, name and email address for seamless user experience.

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

Torus Name Resolver

Users are able to send tokens directly to Google email accounts, Reddit usernames and Discord IDs regardless of whether the recipient has logged into Torus prior. Developers can get the public Ethereum address associated with the Google, Reddit or Discord account for seamless user transaction flows.

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

Initiating Top Ups

Torus has integrated with several FIAT On-Ramp providers to allow users to directly top-up their wallet balances with ETH or DAI without having to ever leave the DApp. Developers can initiate top-up transactions directly to maintain smooth overall user experience.

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

In this post, we briefly covered functions that developers would find useful for ETH India Online 2020. For more functions, head over to https://docs.tor.us for more detailed documentation breakdowns and examples.

Register Now!

ETH India Online will run from 22 January to 20 February. With over 2,000 applicants already registered, don’t miss your chance to take part in this online hackathon. Register at https://online.ethindia.co/, and join other developers in building out pragmatic solutions for our community.

Torus Labs

Non-Custodial Key Management, Meets Passwordless Auth