Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
manolingam committed May 26, 2023
1 parent 60b2eb5 commit 6a51c54
Show file tree
Hide file tree
Showing 14 changed files with 19,158 additions and 836 deletions.
43 changes: 43 additions & 0 deletions app/api/channel/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { GetObjectCommand } from '@aws-sdk/client-s3';
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
import { JsonRpcProvider, Interface, Contract, verifyMessage } from 'ethers';
import { NextResponse } from 'next/server';

import { s3Client } from '../../config';

export async function POST(req, res) {
let request = await req.json();

const address = verifyMessage(
'gm raidguild member',
request.signature.toString()
);

const abi = new Interface([
'function members(address account) view returns (address, uint256, uint256, bool, uint256, uint256)'
]);
const contract = new Contract(
'0xfe1084bc16427e5eb7f13fc19bcd4e641f7d571f',
abi,
new JsonRpcProvider('https://rpc.ankr.com/gnosis')
);

const member = await contract.members(address);

if (member[3]) {
const bucketParams = {
Bucket: 'raidguild',
Key: request.key
};

const url = await getSignedUrl(
s3Client,
new GetObjectCommand(bucketParams),
{
expiresIn: 15 * 60
}
);

return NextResponse.json({ channel: url });
}
}
32 changes: 32 additions & 0 deletions app/api/files/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ListObjectsCommand } from '@aws-sdk/client-s3';
import { JsonRpcProvider, Interface, Contract, verifyMessage } from 'ethers';
import { NextResponse } from 'next/server';

import { s3Client } from '../../config';

const bucketParams = { Bucket: 'raidguild' };

export async function POST(req) {
let request = await req.json();

const address = verifyMessage(
'gm raidguild member',
request.signature.toString()
);

const abi = new Interface([
'function members(address account) view returns (address, uint256, uint256, bool, uint256, uint256)'
]);
const contract = new Contract(
'0xfe1084bc16427e5eb7f13fc19bcd4e641f7d571f',
abi,
new JsonRpcProvider('https://rpc.ankr.com/gnosis')
);

const member = await contract.members(address);

if (member[3]) {
const data = await s3Client.send(new ListObjectsCommand(bucketParams));
return NextResponse.json({ response: data.Contents });
}
}
14 changes: 14 additions & 0 deletions app/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { S3 } from '@aws-sdk/client-s3';

export const CONFIG = {
JWT_SECRET: process.env.JWT_SECRET
};

export const s3Client = new S3({
endpoint: process.env.S3_ENDPOINT,
region: process.env.S3_REGION,
credentials: {
accessKeyId: process.env.S3_KEY,
secretAccessKey: process.env.S3_SECRET
}
});
108 changes: 12 additions & 96 deletions app/globals.css
Original file line number Diff line number Diff line change
@@ -1,107 +1,23 @@
:root {
--max-width: 1100px;
--border-radius: 12px;
--font-mono: ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono',
'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro',
'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace;

--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;

--primary-glow: conic-gradient(
from 180deg at 50% 50%,
#16abff33 0deg,
#0885ff33 55deg,
#54d6ff33 120deg,
#0071ff33 160deg,
transparent 360deg
);
--secondary-glow: radial-gradient(
rgba(255, 255, 255, 1),
rgba(255, 255, 255, 0)
);

--tile-start-rgb: 239, 245, 249;
--tile-end-rgb: 228, 232, 233;
--tile-border: conic-gradient(
#00000080,
#00000040,
#00000030,
#00000020,
#00000010,
#00000010,
#00000080
);

--callout-rgb: 238, 240, 241;
--callout-border-rgb: 172, 175, 176;
--card-rgb: 180, 185, 188;
--card-border-rgb: 131, 134, 135;
}

@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;

--primary-glow: radial-gradient(rgba(1, 65, 255, 0.4), rgba(1, 65, 255, 0));
--secondary-glow: linear-gradient(
to bottom right,
rgba(1, 65, 255, 0),
rgba(1, 65, 255, 0),
rgba(1, 65, 255, 0.3)
);

--tile-start-rgb: 2, 13, 46;
--tile-end-rgb: 2, 5, 19;
--tile-border: conic-gradient(
#ffffff80,
#ffffff40,
#ffffff30,
#ffffff20,
#ffffff10,
#ffffff10,
#ffffff80
);

--callout-rgb: 20, 20, 20;
--callout-border-rgb: 108, 108, 108;
--card-rgb: 100, 100, 100;
--card-border-rgb: 200, 200, 200;
}
}

* {
box-sizing: border-box;
padding: 0;
margin: 0;
padding: 0;
box-sizing: border-box;
}

html,
body {
max-width: 100vw;
overflow-x: hidden;
html {
scroll-behavior: smooth;
}

body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
::-webkit-scrollbar {
width: 10px;
background: transparent;
}

a {
color: inherit;
text-decoration: none;
::-webkit-scrollbar-thumb {
background: #ff3864;
border-radius: 5px;
}

@media (prefers-color-scheme: dark) {
html {
color-scheme: dark;
}
::-webkit-scrollbar-thumb:hover {
background: #e4728b;
}
62 changes: 52 additions & 10 deletions app/layout.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,59 @@
import './globals.css'
import { Inter } from 'next/font/google'
'use client';

const inter = Inter({ subsets: ['latin'] })
import './globals.css';
import { Titillium_Web } from 'next/font/google';
import { Providers } from './providers';
import { Flex } from '@chakra-ui/react';
import { Footer } from './shared/Footer';
import { Header } from './shared/Header';

export const metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
}
import {
EthereumClient,
w3mConnectors,
w3mProvider
} from '@web3modal/ethereum';
import { Web3Modal } from '@web3modal/react';
import { configureChains, createConfig, WagmiConfig } from 'wagmi';
import { gnosis } from 'wagmi/chains';

const chains = [gnosis];
const projectId = process.env.NEXT_PUBLIC_PROJECT_ID;

const { publicClient } = configureChains(chains, [w3mProvider({ projectId })]);
const wagmiConfig = createConfig({
autoConnect: false,
connectors: w3mConnectors({ projectId, version: 1, chains }),
publicClient
});
const ethereumClient = new EthereumClient(wagmiConfig, chains);

const titillium = Titillium_Web({ subsets: ['latin'], weight: ['400'] });

export default function RootLayout({ children }) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
<html lang='en'>
<body className={titillium.className}>
<Providers>
<WagmiConfig config={wagmiConfig}>
<Flex
direction='column'
justifyContent='space-between'
maxW='80rem'
minH='100vh'
mx='auto'
pt='2rem'
px={{ lg: '4rem', sm: '2rem' }}
bg='black'
color='white'
>
<Header />
{children}
<Footer />
</Flex>
</WagmiConfig>
</Providers>
<Web3Modal projectId={projectId} ethereumClient={ethereumClient} />
</body>
</html>
)
);
}
Loading

1 comment on commit 6a51c54

@vercel
Copy link

@vercel vercel bot commented on 6a51c54 May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

the-valhalla – ./

the-valhalla.vercel.app
the-valhalla-git-main-manolingam.vercel.app
the-valhalla-manolingam.vercel.app

Please sign in to comment.