Skip to content

Commit 9508089

Browse files
committed
First commit
0 parents  commit 9508089

35 files changed

+24165
-0
lines changed

.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

.gitignore

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
.pnpm-debug.log*
27+
28+
# local env files
29+
.env*.local
30+
.env
31+
32+
# vercel
33+
.vercel
34+
35+
# typescript
36+
*.tsbuildinfo
37+
next-env.d.ts

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
```
12+
13+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
14+
15+
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
16+
17+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
18+
19+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
20+
21+
## Learn More
22+
23+
To learn more about Next.js, take a look at the following resources:
24+
25+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27+
28+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29+
30+
## Deploy on Vercel
31+
32+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33+
34+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

components/App.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import Header from '../components/Header';
2+
import Test from '../components/Test';
3+
import Test2 from '../components/Test2';
4+
import { useEffect, useState } from 'react'
5+
import { useAccount } from 'wagmi';
6+
7+
const App = () => {
8+
9+
const account = useAccount();
10+
const [tab, setTab] = useState(0);
11+
12+
useEffect(() => {
13+
console.log(account)
14+
},[account])
15+
16+
return (
17+
<div>
18+
<Header />
19+
{account.address ?
20+
<div>
21+
<Test />
22+
<Test2 />
23+
</div>
24+
:
25+
tab != 2 &&
26+
<div>
27+
Tab2
28+
</div>
29+
}
30+
</div>
31+
)
32+
}
33+
34+
export default App;

components/Header.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Flex, Spacer, Button, Image } from '@chakra-ui/react'
2+
import { useRouter } from 'next/router'
3+
4+
5+
const Header = () => {
6+
7+
const router = useRouter();
8+
9+
const handleConnect = () => {
10+
//router.push('App');
11+
}
12+
13+
return (
14+
<Flex p='10px 30px 0 30px' align='center'>
15+
<Image src='/HeaderLogo.svg' maxH='120px'/>
16+
<Spacer />
17+
<Button
18+
mr='10px'
19+
variant='solid'
20+
borderRadius='20px'
21+
onClick={handleConnect}
22+
colorScheme='blue'
23+
>Connect Wallet</Button>
24+
</Flex>
25+
)
26+
}
27+
28+
export default Header;

components/Test.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { Button, ButtonGroup } from '@chakra-ui/react'
2+
const ethers = require("ethers");
3+
const { WalletService } = require("@unlock-protocol/unlock-js");
4+
import { useProvider, useSigner } from 'wagmi';
5+
import { unlockAddress } from '../utils/constants';
6+
7+
const Test = () => {
8+
9+
const provider = useProvider()
10+
const signer = useSigner();
11+
12+
const handleDeploy = async () => {
13+
console.log('Deploying');
14+
const walletService = new WalletService(unlockAddress);
15+
console.log(walletService);
16+
17+
await walletService.connect(provider, signer.data);
18+
19+
const res = await walletService.createLock({
20+
//address: unlockAddress[5],
21+
publicLockVersion: 11,
22+
name: 'test',
23+
maxNumberOfKeys: 1000,
24+
expirationDuration: 1000,
25+
keyPrice: '0.1',
26+
currencyContractAddress: '0x5c221e77624690fff6dd741493d735a17716c26b'
27+
}, (err, hash) => {
28+
console.log(err, hash)
29+
})
30+
31+
console.log(res)
32+
}
33+
34+
return (
35+
<Button colorScheme='blue' variant='solid' onClick={handleDeploy}>Deploy Lock</Button>
36+
)
37+
}
38+
39+
export default Test;

components/Test2.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { Input, Button } from '@chakra-ui/react'
2+
import { Orbis } from '@orbisclub/orbis-sdk'
3+
import { useEffect, useState } from 'react';
4+
import { useAccount } from 'wagmi';
5+
import { useRouter } from 'next/router'
6+
7+
let orbis = new Orbis();
8+
9+
const Test2 = () => {
10+
11+
const address = useAccount();
12+
const [profile, setProfile] = useState('')
13+
const router = useRouter();
14+
15+
const connectOrbis = async () => {
16+
if(await orbis.isConnected()) {return;}
17+
const res = await orbis.connect();
18+
19+
console.log(res);
20+
}
21+
22+
const handleSend = async () => {
23+
const res = await orbis.getDids(address)
24+
console.log(res);
25+
//const a = await orbis.updateProfile({
26+
// username: 'Test1',
27+
// description: 'Test description aaaaa'
28+
//})
29+
//console.log(a);
30+
const ue = await orbis.getProfilesByUsername('Test1')
31+
console.log(ue);
32+
}
33+
34+
useEffect(() => {
35+
connectOrbis();
36+
}, [])
37+
38+
return(
39+
<div>
40+
<Input htmlSize={4} width='auto' value={profile} onChange={e=>setProfile(e.target.value)} />
41+
<Input htmlSize={4} width='auto' />
42+
<Button onClick={handleSend}>Send</Button>
43+
<Button onClick={()=>router.push('App')}>PUSH</Button>
44+
</div>
45+
)
46+
}
47+
48+
export default Test2;

next.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
reactStrictMode: true,
4+
swcMinify: true,
5+
}
6+
7+
module.exports = nextConfig

0 commit comments

Comments
 (0)