Skip to content

Commit 0b01c96

Browse files
Merge pull request #51 from Golem-Base/develop
Develop -> main
2 parents 17bf03b + 95f6cd8 commit 0b01c96

File tree

113 files changed

+1918
-71
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+1918
-71
lines changed

.github/workflows/docker.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ name: Docker
22

33
on:
44
push:
5-
branches: [ main ]
6-
tags: [ 'release-**' ]
5+
branches:
6+
- main
7+
- develop
8+
tags:
9+
- 'release-**'
710

811
jobs:
912
build_and_push:

README.md

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,23 @@
1-
<h1 align="center">Blockscout frontend</h1>
1+
# Blockscout frontend for Golem Base L3s
22

3-
<p align="center">
4-
<span>Frontend application for </span>
5-
<a href="https://github.com/blockscout/blockscout/blob/master/README.md">Blockscout</a>
6-
<span> blockchain explorer</span>
7-
</p>
3+
Frontend application for [Golem Base L3 Blockscsout Explorer](https://github.com/Golem-Base/blockscout)
84

95
## Running and configuring the app
106

11-
App is distributed as a docker image. Here you can find information about the [package](https://github.com/blockscout/frontend/pkgs/container/frontend) and its recent [releases](https://github.com/blockscout/frontend/releases).
7+
See full list of ENVs and their description [here](./docs/ENVS.md).
128

13-
You can configure your app by passing necessary environment variables when starting the container. See full list of ENVs and their description [here](./docs/ENVS.md).
14-
15-
```sh
16-
docker run -p 3000:3000 --env-file <path-to-your-env-file> ghcr.io/blockscout/frontend:latest
17-
```
9+
App is distributed as a [docker image](https://hub.docker.com/r/golemnetwork/blockscout-frontend).
1810

1911
Alternatively, you can build your own docker image and run your app from that. Please follow this [guide](./docs/CUSTOM_BUILD.md).
2012

21-
For more information on migrating from the previous frontend, please see the [frontend migration docs](https://docs.blockscout.com/for-developers/frontend-migration).
22-
23-
## Contributing
24-
25-
See our [Contribution guide](./docs/CONTRIBUTING.md) for pull request protocol. We expect contributors to follow our [code of conduct](./CODE_OF_CONDUCT.md) when submitting code or comments.
13+
See also [compose files](https://github.com/Golem-Base/blockscout-compose-files).
2614

2715
## Resources
2816

2917
- [App ENVs list](./docs/ENVS.md)
3018
- [Contribution guide](./docs/CONTRIBUTING.md)
3119
- [Making a custom build](./docs/CUSTOM_BUILD.md)
3220
- [Golem Base L3 Development Guide](./docs/GOLEMBASE_L3_DEV.md) - Development guide for Golem Base L3 network
33-
- [Frontend migration guide](https://docs.blockscout.com/for-developers/frontend-migration)
34-
- [Manual deployment guide with backend and microservices](https://docs.blockscout.com/for-developers/deployment/manual-deployment-guide)
3521

3622
## License
3723

configs/app/features/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export { default as growthBook } from './growthBook';
2424
export { default as marketplace } from './marketplace';
2525
export { default as metasuites } from './metasuites';
2626
export { default as mixpanel } from './mixpanel';
27+
export { default as umami } from './umami';
2728
export { default as mudFramework } from './mudFramework';
2829
export { default as multichainButton } from './multichainButton';
2930
export { default as nameService } from './nameService';
@@ -47,3 +48,4 @@ export { default as validators } from './validators';
4748
export { default as verifiedTokens } from './verifiedTokens';
4849
export { default as web3Wallet } from './web3Wallet';
4950
export { default as xStarScore } from './xStarScore';
51+
export { default as topNotice } from './topNotice';

configs/app/features/topNotice.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { Feature } from './types';
2+
3+
import { getEnvValue } from '../utils';
4+
5+
const notice = getEnvValue('NEXT_PUBLIC_TOP_NOTICE_HTML');
6+
7+
const title = 'Top Notice';
8+
9+
const config: Feature<{ notice: string }> = (() => {
10+
if (notice) {
11+
return Object.freeze({
12+
title,
13+
isEnabled: true,
14+
notice,
15+
});
16+
}
17+
18+
return Object.freeze({
19+
title,
20+
isEnabled: false,
21+
});
22+
})();
23+
24+
export default config;

configs/app/features/umami.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import type { Feature } from './types';
2+
3+
import { getEnvValue } from '../utils';
4+
5+
const src = getEnvValue('NEXT_PUBLIC_UMAMI_SCRIPT_SRC');
6+
const id = getEnvValue('NEXT_PUBLIC_UMAMI_WEBSITE_ID');
7+
8+
const title = 'Umami analytics';
9+
10+
const config: Feature<{ src: string; id: string }> = (() => {
11+
if (id && src) {
12+
return Object.freeze({
13+
title,
14+
isEnabled: true,
15+
id,
16+
src,
17+
});
18+
}
19+
20+
return Object.freeze({
21+
title,
22+
isEnabled: false,
23+
});
24+
})();
25+
26+
export default config;

configs/envs/.env.golembase_l3_local

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,9 @@ NEXT_PUBLIC_ROLLUP_HOMEPAGE_SHOW_LATEST_BLOCKS=true
7171
NEXT_PUBLIC_ROLLUP_L1_BASE_URL='http://explorer.golem-base.io'
7272
NEXT_PUBLIC_ROLLUP_L2_WITHDRAWAL_URL='http://example.com' # FIXME should be an URL to UI for making withdrawals, but there's none for now (or maybe no withdrawals at all ever?)
7373
NEXT_PUBLIC_ROLLUP_OUTPUT_ROOTS_ENABLED=true # FIXME why? what's that?
74+
75+
# UMAMI
76+
NEXT_PUBLIC_UMAMI_SCRIPT_SRC=https://cloud.umami.is/script.js
77+
NEXT_PUBLIC_UMAMI_WEBSITE_ID=25e4aea8-49a0-4b6f-8983-249b9a3160b3
78+
79+
NEXT_PUBLIC_TOP_NOTICE_HTML="Get test ETH for this chain on <a style='font-weight: bold; color: var(--chakra-colors-link-primary)' href='https://kaolin.holesky.golem-base.io/faucet/'>our faucet</a>!"

deploy/tools/envs-validator/schema.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ const golemSchema = yup
305305
NEXT_PUBLIC_COLOR_THEME_LIGHT_SAMPLE_BG: yup.string(),
306306
NEXT_PUBLIC_COLOR_THEME_DARK_HEX: yup.string(),
307307
NEXT_PUBLIC_COLOR_THEME_DARK_SAMPLE_BG: yup.string(),
308+
NEXT_PUBLIC_TOP_NOTICE_HTML: yup.string(),
308309
});
309310

310311
const parentChainCurrencySchema = yup
@@ -1153,6 +1154,8 @@ const schema = yup
11531154
NEXT_PUBLIC_RE_CAPTCHA_V3_APP_SITE_KEY: yup.string(), // DEPRECATED
11541155
NEXT_PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID: yup.string(),
11551156
NEXT_PUBLIC_MIXPANEL_PROJECT_TOKEN: yup.string(),
1157+
NEXT_PUBLIC_UMAMI_SCRIPT_SRC: yup.string(),
1158+
NEXT_PUBLIC_UMAMI_WEBSITE_ID: yup.string(),
11561159
NEXT_PUBLIC_GROWTH_BOOK_CLIENT_KEY: yup.string(),
11571160
NEXT_PUBLIC_ROLLBAR_CLIENT_TOKEN: yup.string(),
11581161

docs/ENVS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,15 @@ This feature is **enabled by default** with the `coinzilla` ads provider. To swi
520520

521521
&nbsp;
522522

523+
### Umami analytics
524+
525+
| Variable | Type| Description | Compulsoriness | Default value | Example value | Version |
526+
| --- | --- | --- | --- | --- | --- | --- |
527+
| NEXT_PUBLIC_UMAMI_SCRIPT_SRC | `string` | Script src for [Umami](https://umami.is/) analytics service | true | - | `https://cloud.umami.is/script.js` | v1.1.0+ |
528+
| NEXT_PUBLIC_UMAMI_WEBSITE_ID | `string` | Website ID for [Umami](https://umami.is/) analytics service | true | - | `<your-secret>` | v1.1.0+ |
529+
530+
&nbsp;
531+
523532
### GrowthBook feature flagging and A/B testing
524533

525534
| Variable | Type| Description | Compulsoriness | Default value | Example value | Version |
@@ -968,6 +977,7 @@ This feature allows to display widgets on the address page with data from 3rd pa
968977
| NEXT_PUBLIC_COLOR_THEME_LIGHT_SAMPLE_BG | `string` | CSS background value for light theme sample | - | `linear-gradient(154deg, #EFEFEF 50%, rgba(255, 255, 255, 0.00) 330.86%)` | `linear-gradient(154deg, #EFEFEF 50%, rgba(255, 255, 255, 0.00) 330.86%)` | v2.2.0+ |
969978
| NEXT_PUBLIC_COLOR_THEME_DARK_HEX | `string` | Hex color code for dark theme background | - | `#101112` | `#101112` | v2.2.0+ |
970979
| NEXT_PUBLIC_COLOR_THEME_DARK_SAMPLE_BG | `string` | CSS background value for dark theme sample | - | `linear-gradient(161deg, #000 9.37%, #383838 92.52%)` | `linear-gradient(161deg, #000 9.37%, #383838 92.52%)` | v2.2.0+ |
980+
| NEXT_PUBLIC_TOP_NOTICE_HTML | `string` | HTML element that will be displayed at the top of landing page | - | `` | `Check out our faucet at <a href="faucet.example.org">faucet.example.org</a>` | v2.2.0+ |
971981

972982
&nbsp;
973983

lib/api/services/golem-base-indexer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { PaginatedResponse } from './paginationConverter';
66

77
export const GOLEM_BASE_INDEXER_API_RESOURCES = {
88
entity: {
9-
path: '/api/v1/entities/:key',
9+
path: '/api/v1/entity/:key',
1010
pathParams: [ 'key' as const ],
1111
},
1212
entities: {
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import type { GolemBaseClient } from 'golem-base-sdk';
2+
import { createClient as createGolemBaseClient, Tagged } from 'golem-base-sdk';
3+
import { useCallback } from 'react';
4+
import { useAccount, useWalletClient } from 'wagmi';
5+
6+
import config from 'configs/app';
7+
import { httpToWs } from 'lib/httpToWs';
8+
9+
export interface GolemBaseClientReturn {
10+
isConnected: boolean;
11+
isLoading: boolean;
12+
createClient: () => Promise<GolemBaseClient>;
13+
}
14+
15+
export function useGolemBaseClient(): GolemBaseClientReturn {
16+
const { address } = useAccount();
17+
const { data: walletClient, isPending } = useWalletClient();
18+
19+
const createClient = useCallback(async() => {
20+
if (!address || !walletClient) {
21+
throw new Error('Wallet not connected');
22+
}
23+
24+
const httpRpcUrl = config.chain.rpcUrls[0];
25+
const wsRpcUrl = httpToWs(httpRpcUrl);
26+
27+
return createGolemBaseClient(
28+
Number(config.chain.id),
29+
new Tagged('ethereumprovider', walletClient),
30+
httpRpcUrl,
31+
wsRpcUrl,
32+
);
33+
}, [ address, walletClient ]);
34+
35+
return {
36+
isConnected: Boolean(address && walletClient),
37+
isLoading: isPending,
38+
createClient,
39+
};
40+
}

0 commit comments

Comments
 (0)