Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MetaMask + Discord integration - with Weba-Wallet #1762

Merged
merged 43 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
340f18a
Discord Login & Metamask integration
utf94 Oct 24, 2021
8740920
Login Fixes
utf94 Oct 26, 2021
b04d49a
hide sidebar on login
mujabmuneeb Oct 26, 2021
98bafca
Merge branch 'master' into discord-integration-a
utf94 Oct 26, 2021
5fcaf8a
Merge branch 'master' into discord-integration-a
mujabmuneeb Nov 4, 2021
acb8702
discord integrated
mujabmuneeb Nov 4, 2021
a3d4857
localstorage added
mujabmuneeb Nov 4, 2021
9b276f9
url added
mujabmuneeb Nov 4, 2021
75b31b7
uri added
mujabmuneeb Nov 4, 2021
6b688c0
id check removed
mujabmuneeb Nov 4, 2021
9d91bd8
url updated
mujabmuneeb Nov 4, 2021
c25db42
url updated
mujabmuneeb Nov 4, 2021
5d551d3
modal added
mujabmuneeb Nov 8, 2021
8240e52
modal css
mujabmuneeb Nov 8, 2021
3a37697
modal css
mujabmuneeb Nov 8, 2021
88c4ec8
logo removed
mujabmuneeb Nov 8, 2021
36bce7f
logout added
mujabmuneeb Nov 8, 2021
d39aa76
modal redone
mujabmuneeb Nov 8, 2021
3d5256f
modal updated
mujabmuneeb Nov 9, 2021
fe75a91
modal updated
mujabmuneeb Nov 9, 2021
8e8e50d
code refactor
mujabmuneeb Nov 9, 2021
3517996
Merge branch 'master' into discord-integration-a
utf94 Nov 9, 2021
8567cd1
discordAuthUrl & propTypes removed
mujabmuneeb Nov 9, 2021
ee9b352
Merge branch 'discord-integration-a' of https://github.com/webaverse/…
mujabmuneeb Nov 9, 2021
baab4b0
Merge branch 'master' into discord-integration-a
utf94 Nov 16, 2021
ad743af
fixed tokenhost const issue
utf94 Nov 16, 2021
04a5feb
secure storage system implemented
mujabmuneeb Nov 17, 2021
d801b20
wallet integrated
mujabmuneeb Nov 22, 2021
7d8a8da
Merge branch 'master' into discord-integration-a
mujabmuneeb Nov 25, 2021
6138dea
functions updated
mujabmuneeb Nov 25, 2021
ccbd7de
wallet integrated
mujabmuneeb Nov 25, 2021
8f34891
Merge branch 'master' into discord-integration-a
mujabmuneeb Nov 27, 2021
4f3eae4
temp_token replaced with mnemonic
mujabmuneeb Nov 28, 2021
7c7453e
Event listener remover added
mujabmuneeb Nov 28, 2021
f4b8668
updated Wallet integration
mujabmuneeb Nov 29, 2021
7b4546b
iframe hidden
mujabmuneeb Nov 29, 2021
7180da4
fetch from wallet storage and setAddress
mujabmuneeb Nov 30, 2021
2a12872
Update index.mjs
utf94 Nov 30, 2021
8a970c3
setOpen added
mujabmuneeb Nov 30, 2021
fa04d79
Merge branch 'discord-integration-a' of https://github.com/webaverse/…
mujabmuneeb Nov 30, 2021
498fec3
package-files-fixed
utf94 Nov 30, 2021
c1857d1
Update index.mjs
utf94 Nov 30, 2021
de56b7d
Update index.mjs
utf94 Nov 30, 2021
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
2 changes: 2 additions & 0 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export const aiHost = `https://ai.webaverse.com`;
export const web3MainnetSidechainEndpoint = 'https://mainnetsidechain.exokit.org';
export const web3TestnetSidechainEndpoint = 'https://testnetsidechain.exokit.org';
export const worldUrl = 'worlds.webaverse.com';
export const discordClientId = '684141574808272937';
export const walletHost = 'https://webaverse.github.io/weba-wallet';

export const worldMapName = 'world';
export const actionsMapName = 'actions';
Expand Down
Binary file added public/images/discord-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/discord.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/metamask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 1 addition & 52 deletions src/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import cameraManager from '../camera-manager.js'
import metaversefile from '../metaversefile-api.js'
import ioManager from '../io-manager.js'
import {parseQuery} from '../util.js'
import * as ceramicApi from '../ceramic.js';
import User from './User';
// import * as ceramicAdmin from '../ceramic-admin.js';
import sceneNames from '../scenes/scenes.json';

Expand Down Expand Up @@ -190,57 +190,6 @@ const Location = ({sceneName, setSceneName, roomName, setRoomName, open, setOpen
</div>
);
};
const User = ({address, setAddress, open, setOpen, toggleOpen}) => {
const userOpen = open === 'user';

const [loggingIn, setLoggingIn] = useState(false);

/* (async () => {
const {createSchema} = await ceramicAdmin.waitForLoad();
const schema = await createSchema();
console.log('create', schema);
})(); */

/* const login = async () => {
if (typeof window.ethereum !== 'undefined') {
const addresses = await window.ethereum.request({
method: 'eth_requestAccounts',
});
const [address] = addresses;
// console.log('address', {address});
setAddress(address);
} else {
console.warn('no ethereum');
}
}; */

return (
<div className={classnames(styles.user, loggingIn ? styles.loggingIn : null)} onClick={async e => {
e.preventDefault();
e.stopPropagation();

if (address) {
toggleOpen('user');
} else {
if (!loggingIn) {
setLoggingIn(true);
try {
const {address, profile} = await ceramicApi.login();
// console.log('login', {address, profile});
setAddress(address);
} catch(err) {
console.warn(err);
} finally {
setLoggingIn(false);
}
}
}
}}>
<img src="images/soul.png" className={styles.icon} />
<div className={styles.name}>{loggingIn ? 'Logging in... ' : (address || 'Log in')}</div>
</div>
);
};

const Tab = ({className, type, left, right, top, bottom, disabled, label, panels, before, after, open, toggleOpen, onclick, panelsRef}) => {
if (!onclick) {
Expand Down
78 changes: 78 additions & 0 deletions src/Header.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
.loginDiv {
width: 100%;
margin: 10px 0;
text-align: -webkit-center;
}

.loginBtnText {
display: inline-block;
transform: skewX(20deg);
}

.loginBtnImg {
vertical-align: middle;
margin: 0 10px;
}

.loginBtn {
transform: skewX(-20deg);
background: rgb(0, 168, 252);
color: rgb(0, 0, 0);
padding: 0.5em;
width: 10em;
text-align: left;
cursor: pointer;
}

.logoutBtn {
position: absolute;
right: 0;
background: black;
color: white;
padding: 6px;
font-size: 14px;
cursor: pointer;
}

.logoutBtn:hover {
background: #ef5350;
color: white;
}

body {
--header-height: 50px;
}
Expand Down Expand Up @@ -73,6 +114,13 @@ body {
height: 100vh;
overflow: hidden;
}
.header .tab .panelsLogin {
position: fixed;
display: flex;
/* width: 400px;
height: 100vh; */
overflow: hidden;
}
.header .tab .panels .panel {
display: flex;
width: 100%;
Expand Down Expand Up @@ -688,4 +736,34 @@ body {
.equipment .button:active + .background2 {
background-color: #b71c1c;
transition: none;
}

.login_options {
background: black;
color: white;
font-size: initial;
text-align: left;
cursor: pointer;
}

.metamask {
margin-left: 10px;
display: flex;
align-items: center;
}

.discord {
margin-left: 10px;
display: flex;
align-items: center;
}

.metamask_text {
margin-left: 10px;

}

.discord_text {
margin-left: 10px;

}
Loading