Connecting Ditto with your Ethereum dApps
Step 1: Create a Niomon Developer Account
caution
Niomon is currently in closed beta. If you don't have access, you can request it using the beta sign-up form.
- Sign in with your email address at https://admin.niomon.io.
- Register a new tenant.
- From the Ditto tab in Niomon Admin Console, create a new Application.
- Copy your Ditto Application's
appId
.
Step 2: Install Niomon JS SDK
Using NPM
npm install --save @niomon/niomon-js
Using Yarn
yarn add @niomon/niomon-js
Step 3: Set up Ditto Ethereum Provider
import {ditto} from "@niomon/niomon-js";
const dittoProvider = new ditto.EthereumProvider({
appId: "appId",
network: "ethereum",
infuraId: "infuraId",
});
// Trigger sign in flow
await provider.enable();
Step 4: Using Ditto Ethereum Provider
Ditto Ethereum Provider is compatible with web3.js and ethers.js.
web3.js
import Web3 from "web3";
const web3 = new Web3(dittoProvider);
// Get addresses
const addresses = await web3.eth.getAccounts();
ethers.js
import { ethers } from "ethers";
const provider = new ethers.providers.Web3Provider(dittoProvider);
const signer = provider.getSigner();
// Get addresses
const address = await signer.getAddress();
Next Steps
🔥 Well done! Your users can now sign in with Ditto using email addresses, and create crypto wallets without dealing with seed phrases.
To learn more, check out: