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

Obscuroscan#2323 #1640

Merged
merged 61 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
f4ee8d6
light theme and other changes
BedrockSquirrel Nov 3, 2023
3ba73a7
feat: initial react commit 🎉
Jennievon Nov 8, 2023
30082c4
feat: install shadcn-ui
Jennievon Nov 8, 2023
dafb770
wip: setup dashboard components
Jennievon Nov 8, 2023
a304cfe
wip: dashboard
Jennievon Nov 9, 2023
8cc3019
wip: personal pages
Jennievon Nov 10, 2023
2bbbef3
chore: move Obscuroscan v3 to a new folder
Jennievon Nov 11, 2023
b0781fa
feat: hooks and API for data fetching
Jennievon Nov 13, 2023
4842780
feat: dashboard analytics
Jennievon Nov 13, 2023
b38d970
wip: blockchain data tables
Jennievon Nov 13, 2023
59e6dfd
chore: move blockchain pages to folder
Jennievon Nov 13, 2023
58a6647
fix: build error
Jennievon Nov 13, 2023
a25eba6
refactor: blockchain module
Jennievon Nov 13, 2023
a1e570e
feat: add Obscuro favicon
Jennievon Nov 13, 2023
25a9cd7
wip: blocks pages
Jennievon Nov 13, 2023
f78baa9
wip: blocks data table
Jennievon Nov 13, 2023
4f8b3b8
feat: blocks data table
Jennievon Nov 13, 2023
b9b9cc0
feat: batches data table
Jennievon Nov 13, 2023
ab11385
feat: wallet provider
Jennievon Nov 13, 2023
1a2ef6a
feat: personal transactions
Jennievon Nov 13, 2023
a219289
refactor: dashboard analytics
Jennievon Nov 13, 2023
fb5e67c
refactor: folder structure
Jennievon Nov 13, 2023
b4fd162
refactor: dashboard analytics view
Jennievon Nov 13, 2023
86bb8e0
feat: view for batch by hash
Jennievon Nov 13, 2023
a346f77
Merge branch 'main' of https://github.com/obscuronet/go-obscuro into …
Jennievon Nov 13, 2023
173cbc1
chore: refetch interval for stale data
Jennievon Nov 13, 2023
ba57f4f
wip: resources
Jennievon Nov 13, 2023
3039530
update alert component
Jennievon Nov 14, 2023
4f01b09
fix: batch view
Jennievon Nov 14, 2023
c6ec9a2
refactor: personal transactions and data table
Jennievon Nov 14, 2023
76d8ec2
revert v2 changes
Jennievon Nov 14, 2023
9d60fd4
revert backend server changes
Jennievon Nov 14, 2023
66bb69e
feat:
Jennievon Nov 15, 2023
f654b72
refactor: main nav
Jennievon Nov 15, 2023
60fca42
feat:
Jennievon Nov 15, 2023
05f867c
chore: use tree structure for main nav
Jennievon Nov 15, 2023
96055f7
move components to src folder
Jennievon Nov 15, 2023
9f17cc0
update tailwind config
Jennievon Nov 15, 2023
0508423
fix: build error
Jennievon Nov 15, 2023
9c2e607
refactor: naming conventions
Jennievon Nov 15, 2023
d878db0
style modifications
Jennievon Nov 16, 2023
f335443
Merge branch 'main' of https://github.com/obscuronet/go-obscuro into …
Jennievon Nov 16, 2023
872f9e7
update favicon
Jennievon Nov 16, 2023
62dd05c
feat: mobile responsiveness
Jennievon Nov 16, 2023
33b26d6
Merge branch 'main' of https://github.com/obscuronet/go-obscuro into …
Jennievon Nov 17, 2023
e8ceb8a
Merge branch 'main' of https://github.com/obscuronet/go-obscuro into …
Jennievon Nov 17, 2023
5a9ec03
Merge branch 'jennifer/new-scan-config-setup' of https://github.com/o…
Jennievon Nov 17, 2023
45b1536
Merge pull request #1646 from ten-protocol/jennifer/scan-updates
Jennievon Nov 18, 2023
60e4952
add `services` folder
Jennievon Nov 20, 2023
834576b
wip: update font to `Cloud Soft`
Jennievon Nov 20, 2023
7be5e96
add README to Tenscan
Jennievon Nov 20, 2023
8b171ed
update Tenscan README
Jennievon Nov 21, 2023
d98ba61
feat: add a copy component
Jennievon Nov 22, 2023
1354cfc
style: update custom font, logo
Jennievon Nov 22, 2023
f4b8cc6
chore: rm unused code
Jennievon Nov 22, 2023
3bbf793
Merge branch 'main' of https://github.com/obscuronet/go-obscuro into …
Jennievon Nov 22, 2023
963e70b
wip: deployment workflow
Jennievon Nov 22, 2023
5ebb300
update API routes to use env variables
Jennievon Nov 23, 2023
ef418f2
feat: update workflow and dockerfile
Jennievon Nov 23, 2023
2c56a25
chore: replace Obscuro with Ten
Jennievon Nov 23, 2023
507e17a
update `dns-name-label` and instance `name`
Jennievon Nov 23, 2023
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
3 changes: 3 additions & 0 deletions tools/obscuroscan_v3/frontend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
36 changes: 36 additions & 0 deletions tools/obscuroscan_v3/frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
62 changes: 62 additions & 0 deletions tools/obscuroscan_v3/frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Tenscan: Blockchain Explorer for The Encryption Network (TEN)

Tenscan is a Next.js and Tailwind CSS-powered application that serves as a Blockchain Explorer for The Encryption Network (TEN). This explorer allows users to interact with and explore the blocks, transactions, batches, resources, and personal data on the TEN blockchain. Tenscan is built using the Shadcn-UI Component Library for a consistent and visually appealing user interface.

## Folder Structure

```
📁 Tenscan
├── 📁 api - Contains server-side code, such as API routes or server logic
├── 📁 pages - Typically used for Next.js pages. Each .tsx or .js file in this directory becomes a route in your application
├── 📁 public - This directory is used to serve static assets. Files inside this directory can be referenced in your code with a URL path
├── 📁 src - Main source code directory for this project
│ ├── 📁 components - Contains reusable React components used throughout the application
│ ├── 📁 hooks - Custom React hooks that can be shared and reused across components
│ ├── 📁 lib - Utility functions or modules that provide common functionalities across the application
│ ├── 📁 routes - Route-related logic or configuration can be placed in this directory
│ ├── 📁 services - Used for services that interact with external APIs or handle other data-related tasks
│ └── 📁 types - Type definitions (.d.ts files or TypeScript files) for TypeScript, describing the shape of data and objects used in the application
└── 📁 styles - Global styles, stylesheets, or styling-related configurations for this project
```

## Getting Started

1. **Clone the Repository:**
```bash
git clone https://github.com/ten-protocol/go-ten.git
cd go-ten/tools/obscuroscan_v3/frontend
```

2. **Install Dependencies:**
```bash
npm install
```

3. **Run the Development Server:**
```bash
npm run dev
```

The application will be accessible at [http://localhost:3000](http://localhost:3000).

## Usage

- Visit the different sections of the explorer through the navigation links in the UI.
- Explore the different blocks, transactions, batches, resources, and personal data on the TEN.
- View the details of each batch by their hash.

## Built With

- [Next.js](https://nextjs.org/)
- [Tailwind CSS](https://tailwindcss.com/)
- [Shadcn-UI](https://shadcn.com/)
- [TypeScript](https://www.typescriptlang.org/)


## Contributing

Contributions are welcome! Please follow our [contribution guidelines](/docs/_docs/community/contributions.md).

## License

This project is licensed under the [GNU Affero General Public License v3.0](/LICENSE).
41 changes: 41 additions & 0 deletions tools/obscuroscan_v3/frontend/api/batches.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { httpRequest } from ".";
import { apiRoutes } from "@/src/routes";
import { pathToUrl } from "@/src/routes/router";
import { ResponseDataInterface } from "@/src/types/interfaces";
import {
Batch,
BatchDetails,
BatchResponse,
} from "@/src/types/interfaces/BatchInterfaces";

export const fetchBatches = async (
payload?: Record<string, any>
): Promise<ResponseDataInterface<BatchResponse>> => {
const data = await httpRequest<ResponseDataInterface<BatchResponse>>({
method: "get",
url: pathToUrl(apiRoutes.getBatches),
searchParams: payload,
});
return data;
};

export const fetchLatestBatch = async (
payload?: Record<string, any>
): Promise<ResponseDataInterface<Batch>> => {
const data = await httpRequest<ResponseDataInterface<Batch>>({
method: "get",
url: pathToUrl(apiRoutes.getLatestBatch),
searchParams: payload,
});
return data;
};

export const fetchBatchByHash = async (
hash: string
): Promise<ResponseDataInterface<BatchDetails>> => {
const data = await httpRequest<ResponseDataInterface<BatchDetails>>({
method: "get",
url: pathToUrl(apiRoutes.getBatchByHash, { hash }),
});
return data;
};
15 changes: 15 additions & 0 deletions tools/obscuroscan_v3/frontend/api/blocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { httpRequest } from ".";
import { apiRoutes } from "@/src/routes";
import { pathToUrl } from "@/src/routes/router";
import { ResponseDataInterface } from "@/src/types/interfaces";

export const fetchBlocks = async (
payload?: Record<string, any>
): Promise<ResponseDataInterface<any>> => {
const data = await httpRequest<ResponseDataInterface<any>>({
method: "get",
url: pathToUrl(apiRoutes.getBlocks),
searchParams: payload,
});
return data;
};
27 changes: 27 additions & 0 deletions tools/obscuroscan_v3/frontend/api/contracts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { httpRequest } from ".";
import { apiRoutes } from "@/src/routes";
import { pathToUrl } from "@/src/routes/router";
import { ResponseDataInterface } from "@/src/types/interfaces";
import { ContractCount } from "@/src/types/interfaces/ContractInterface";

export const fetchContractCount = async (
payload?: Record<string, any>
): Promise<ContractCount> => {
const data = await httpRequest<ContractCount>({
method: "get",
url: pathToUrl(apiRoutes.getContractCount),
searchParams: payload,
});
return data;
};

export const fetchVerifiedContracts = async (
payload?: Record<string, any>
): Promise<ResponseDataInterface<any>> => {
const data = await httpRequest<ResponseDataInterface<any>>({
method: "get",
url: pathToUrl(apiRoutes.getVerifiedContracts),
searchParams: payload,
});
return data;
};
63 changes: 63 additions & 0 deletions tools/obscuroscan_v3/frontend/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import axios, { AxiosInstance, AxiosRequestConfig } from 'axios'

type HttpMethod = 'get' | 'post' | 'put' | 'patch' | 'delete'

interface HttpOptions {
method?: HttpMethod
url: string
data?: Record<string, any>
params?: Record<string, any>
headers?: Record<string, any>
timeout?: number
responseType?: 'json' | 'arraybuffer' | 'blob' | 'document' | 'text' | undefined
download?: boolean
searchParams?: Record<string, any>
}

const baseConfig: AxiosRequestConfig = {
// baseURL: process.env.BASE_URL,
baseURL: 'http://127.0.0.1:43910',
timeout: 10000
}

export const https: AxiosInstance = axios.create(baseConfig)

export const httpRequest = async <ResponseData>(
options: HttpOptions,
config: AxiosRequestConfig = {}
): Promise<ResponseData> => {
const {
method = 'get',
url,
data,
params,
headers,
timeout,
responseType,
searchParams
} = options
let query = ''
if (searchParams) {
const filteredParams = Object.fromEntries(
Object.entries(searchParams).filter(
([, value]) => value !== undefined && value !== null && value !== ''
)
)
if (Object.keys(filteredParams).length) {
query = new URLSearchParams(filteredParams).toString()
}
}

const httpConfig: AxiosRequestConfig = {
method,
url: query ? `${url}?${query}` : url,
data,
params,
headers: { ...(headers || {}) },
timeout,
responseType: responseType,
...config
}
const response = await https(httpConfig)
return response.data as ResponseData
}
28 changes: 28 additions & 0 deletions tools/obscuroscan_v3/frontend/api/rollups.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { httpRequest } from ".";
import { apiRoutes } from "@/src/routes";
import { pathToUrl } from "@/src/routes/router";
import { ResponseDataInterface } from "@/src/types/interfaces";

export const fetchRollups = async (
payload?: Record<string, any>
): Promise<ResponseDataInterface<any>> => {
const data = await httpRequest<ResponseDataInterface<any>>({
method: "get",
url: pathToUrl(apiRoutes.getRollups),
searchParams: payload,
});
return data;
};

export const decryptEncryptedRollup = async ({
StrData,
}: {
StrData: string;
}): Promise<ResponseDataInterface<any>> => {
const data = await httpRequest<ResponseDataInterface<any>>({
method: "post",
url: pathToUrl(apiRoutes.decryptEncryptedRollup),
data: { StrData },
});
return data;
};
36 changes: 36 additions & 0 deletions tools/obscuroscan_v3/frontend/api/transactions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { httpRequest } from ".";
import { apiRoutes } from "@/src/routes";
import { pathToUrl } from "@/src/routes/router";
import { ResponseDataInterface } from "@/src/types/interfaces";
import {
TransactionCount,
Price,
TransactionResponse,
} from "@/src/types/interfaces/TransactionInterfaces";

export const fetchTransactions = async (
payload?: Record<string, any>
): Promise<ResponseDataInterface<TransactionResponse>> => {
const data = await httpRequest<ResponseDataInterface<TransactionResponse>>({
method: "get",
url: pathToUrl(apiRoutes.getTransactions),
searchParams: payload,
});
return data;
};

export const fetchTransactionCount = async (): Promise<TransactionCount> => {
const data = await httpRequest<TransactionCount>({
method: "get",
url: pathToUrl(apiRoutes.getTransactionCount),
});
return data;
};

export const fetchEtherPrice = async (): Promise<Price> => {
const data = await httpRequest<Price>({
method: "get",
url: apiRoutes.getEtherPrice,
});
return data;
};
16 changes: 16 additions & 0 deletions tools/obscuroscan_v3/frontend/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "app/globals.css",
"baseColor": "slate",
"cssVariables": true
},
"aliases": {
"components": "@/src/components",
"utils": "@/src/lib/utils"
}
}
6 changes: 6 additions & 0 deletions tools/obscuroscan_v3/frontend/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}

module.exports = nextConfig
Loading