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

Commit

Permalink
latest
Browse files Browse the repository at this point in the history
  • Loading branch information
kengoldfarb committed Aug 23, 2022
1 parent a9b27fb commit 6f4ece7
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 347 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
"@mantine/next": "4.2.2",
"@mantine/notifications": "4.2.2",
"@mantine/prism": "^4.2.11",
"@meemproject/api": "^0.7.6",
"@meemproject/meem-contracts": "^0.7.6",
"@meemproject/react": "^0.7.6",
"@meemproject/api": "^0.7.11",
"@meemproject/meem-contracts": "^0.7.11",
"@meemproject/react": "^0.7.11",
"@next/bundle-analyzer": "^12.1.4",
"@types/superagent": "^4.1.15",
"blob-util": "^2.0.2",
Expand Down
25 changes: 14 additions & 11 deletions src/components/Authenticate/Authenticate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ const MAuthenticate: React.FC = () => {

const login = useCallback(
async (walletSig: string) => {
const address = Cookies.get('walletAddress')
// const address = Cookies.get('walletAddress')

log.info('Logging in to Meem...')
log.debug(`address = ${address}`)
log.debug(`address = ${wallet.accounts[0]}`)
log.debug(`sig = ${walletSig}`)

if (address && walletSig) {
if (wallet.accounts[0] && walletSig) {
try {
setIsLoading(true)

Expand All @@ -78,7 +78,7 @@ const MAuthenticate: React.FC = () => {
{
method: MeemAPI.v1.Login.method,
body: {
address,
address: wallet.accounts[0],
signature: walletSig
}
}
Expand All @@ -91,26 +91,30 @@ const MAuthenticate: React.FC = () => {
log.debug(`saved JWT token as cookie.`)

router.push({
pathname: router.query.r as string,
query: JSON.parse(router.query.rq as string)
pathname: router.query.r
? (router.query.r as string)
: '/',
query: router.query.rq
? JSON.parse(router.query.rq as string)
: {}
})
} catch (e) {
log.error(e)
}
}
setIsLoading(false)
},
[router, wallet]
)

const sign = useCallback(async () => {
const address = Cookies.get('walletAddress') ?? ''
setIsLoading(true)

try {
const { nonce } = await getNonceFetcher(
MeemAPI.v1.GetNonce.path(),
{
address
address: wallet.accounts[0]
}
)
log.debug('got nonce')
Expand All @@ -137,14 +141,13 @@ const MAuthenticate: React.FC = () => {
setIsLoading(false)
log.crit(e)
}
}, [getNonceFetcher, login, wallet.signer])
}, [getNonceFetcher, login, wallet.signer, wallet.accounts])

const connectWallet = useCallback(async () => {
setIsLoading(true)
await wallet.connectWallet()

const address = Cookies.get('walletAddress')
if (address) {
if (wallet.accounts[0]) {
setIsConnected(true)
setIsLoading(false)
} else {
Expand Down
8 changes: 6 additions & 2 deletions src/components/ManageDiamond/ManageDiamondContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ import {
import { formList, useForm } from '@mantine/form'
import { showNotification } from '@mantine/notifications'
import { MeemAPI } from '@meemproject/api'
import { getCuts, IFacetVersion, upgrade } from '@meemproject/meem-contracts'
import {
getCuts,
IFacetVersion,
upgrade,
diamondABI
} from '@meemproject/meem-contracts'
import { makeFetcher, useWallet } from '@meemproject/react'
import { ethers } from 'ethers'
import { useRouter } from 'next/router'
Expand All @@ -40,7 +45,6 @@ import {
WalletContractInstances
} from '../../../generated/graphql'
import { SUB_GET_CONTRACTS_BY_ADDRESS } from '../../graphql/contracts'
import { diamondABI } from '../../lib/diamond'
import { downloadFile } from '../../lib/utils'
import { Page } from '../../styles/Page'
import { Address } from '../Atoms/Address'
Expand Down
Loading

0 comments on commit 6f4ece7

Please sign in to comment.