-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
122 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Deploy static content to Pages | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
|
||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: 'pages' | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Single deploy job since we're just deploying | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 'lts/*' | ||
cache: 'yarn' | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
|
||
- name: Install deps | ||
run: yarn | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: CNAME | ||
run: cp ./CNAME ./dist | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: './dist' | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,67 @@ | ||
# React + Vite | ||
# Wallet.id | ||
|
||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
This is a white label template for [hns.id](https://hns.id). You can fork and modify to be used with any staked TLD | ||
|
||
Currently, two official plugins are available: | ||
## Customization | ||
|
||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh | ||
Basic customization are in the [`constants.js`](./src/constants.js) file and the [`src/assets`](./src/assets/) folder, more specifically `avatar.png` and `brand.png`, as well as `public/favicon.svg`. | ||
|
||
For more advanced customization, any component can be updated. | ||
|
||
## Contracts | ||
|
||
The contracts addresses are also in the [constants.js](/src/constants.js#L17-L23) file. First is the testnet (Optimism Sepolia), and second the mainnet (Optimism). | ||
|
||
## Data | ||
|
||
This project can be deployed as static website. All the data needed comes from smart contracts. | ||
|
||
Handling the communication with the contracts can be done with 2 React hooks: | ||
|
||
### useDomainStatus() | ||
|
||
```jsx | ||
const { data } = useDomainStatus({ label: 'my-sld' }); | ||
|
||
/* Returns: | ||
{ | ||
"isAvailable": true, | ||
"labelValid": true, | ||
"publicRegistrationOpen": false, | ||
"isPremium": false, | ||
"priceInDollars": "5.00", | ||
"priceInWei": "2500000000000000", | ||
"label": "my-sld" | ||
} | ||
/* | ||
``` | ||
### useRegister() | ||
```jsx | ||
const register = useRegister({ | ||
label: 'my-sld', | ||
priceInWei: '2500000000000000', | ||
}); | ||
<button onClick={register}>🤝</button>; | ||
``` | ||
`register` is an async function that will invoke Metamask (or any other wallet the user choose) and will be resolved once the user signs the transaction. | ||
## Running locally | ||
It uses yarn, so... | ||
``` | ||
yarn install | ||
yarn dev | ||
``` | ||
... should do the magic. | ||
## GitHub Pages | ||
As mentioned about, this project can be deployed as a static webpage, with no need for a backend like NodeJS or even Vercel, making it a great fit for GitHub pages. | ||
After forking the project, enable **Pages** in the repository settings and update the [`CNAME`](./CNAME) file. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters