Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Integrated with SimpleID #600

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 139 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"redux": "^4.0.0",
"redux-thunk": "^2.3.0",
"scrypt-shim": "github:web3-js/scrypt-shim",
"simpleid-js-sdk": "^1.0.0",
"source-map-explorer": "^2.1.2",
"squarelink": "^1.1.4",
"web3": "^1.2.4",
Expand Down
9 changes: 9 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ import {
ChatboxComponent,
} from './DynamicImports';
import './index.scss';
import SimpleID from 'simpleid-js-sdk';

new SimpleID({
appOrigin: window.location.origin,
appName: "App Name",
appId: "YOUR APP ID HERE",
useSimpledIdWidget: false,
network: 'mainnet'
});

const {
handleSignInModal,
Expand Down
1 change: 1 addition & 0 deletions src/state/actions/signin/connectProviderToDapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const connectProviderToDapp = async (provider, directLogin, dispatch) => {
await web3Obj.currentProvider.enable() :
await accountsPromise;
const currentAddress = accounts[0];
//Check if SimpleID data already passed
// const currentAddress = provider.isAuthereum ? accounts[0] : accounts.account.accountAddress;
window.localStorage.setItem('userEthAddress', currentAddress);

Expand Down
22 changes: 22 additions & 0 deletions src/state/actions/signin/openBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ import {
import getCollectibles from '../profile/getCollectibles';
import getGeneralProfile from '../profile/getGeneralProfile';
import fetchEns from '../utils';
import SimpleID from 'simpleid-js-sdk';

const simple = new SimpleID({
appOrigin: window.location.origin,
appName: "App Name",
appId: "YOUR APP ID HERE",
useSimpledIdWidget: false,
network: 'mainnet'
});

const openBox = (fromSignIn, fromFollowButton) => async (dispatch) => {
const {
Expand Down Expand Up @@ -151,6 +160,19 @@ const openBox = (fromSignIn, fromFollowButton) => async (dispatch) => {
isSyncing: true,
});
});

const userData = simple.getUserData()
if(userData && userData.wallet) {
//Don't do anything here for now
} else {
//Need to pass eth addr (and email if wanted)
const userInfo = {
address: currentAddress
}
console.log("Passing data to simpleid")
const simpleid = await simple.passUserInfo(userInfo)
console.log(simpleid)
}
} catch (err) {
history.push(routes.LANDING);
dispatch({
Expand Down