Web3Auth
Published in

Web3Auth

Build Seamless User Flows with Torus at ETH India Online 2020

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.

For ETH India Online 2020, we will be awarding prizes totalling ₹140,000 to 6 teams that integrate Torus as their login mechanism with the following criteria:

  • 1 Grand prize of ₹40,000 in ETH will be awarded to the DApp with the best use case for Reddit, Twitch, or Discord logins with Torus (for Google, Reddit, and Discord accounts).
  • 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.

After which, developers can integrate Torus into their DApp website by installing the NPM package.

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.

The user would have to be logged in, and only the first call in the session would open a pop-up window to prompt for the user’s consent.

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.

Reference

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']
}
}

Example

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.

To keep abreast of our developments, subscribe to our social channels and join in the discussion.

Telegram Group: https://t.me/TorusLabs
Discord Channel: https://discord.gg/UGHUFVb
Twitter: https://twitter.com/toruslabs
Facebook: https://www.facebook.com/torusprotocol
LinkedIn: https://www.linkedin.com/company/toruslabs
Reddit: https://reddit.com/r/toruslabs
YouTube: https://www.youtube.com/c/toruslabs
Blog: https://medium.com/toruslabs
Website: https://tor.us/

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.

--

--

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