Skip to content

Commit a54543d

Browse files
Update .github resources
1 parent 97a72af commit a54543d

File tree

170 files changed

+3110
-2651
lines changed

Some content is hidden

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

170 files changed

+3110
-2651
lines changed

.github/CONTRIBUTING.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# Contributing
2+
3+
Thank you for your interest in contributing to Petra Vault! Please refer to the guidelines to get started.
4+
5+
## Overview
6+
7+
These guidelines are intended to help you get started with the project. By following these guidelines, you will be able to understand how to contribute to the project while maintaining the project's security and quality standards. If you would like to contribute, you can visit the [Github Issues](https://github.com/aptos-labs/petra-vault/issues) page to find issues you can help with.
8+
9+
> [!IMPORTANT]
10+
> If you are looking to add a new feature, please make sure to open an issue first to discuss the feature with the maintainers. Doing so will help avoid rejected/declined pull requests, and ensure that your time is spent on the most relevant work.
11+
12+
## 1. Cloning the Repository
13+
14+
To clone the repository, you can use the following command on your local machine:
15+
16+
```bash
17+
git clone https://github.com/aptos-labs/petra-vault.git
18+
```
19+
20+
## 2. Installing Runtimes
21+
22+
Petra Vault uses [pnpm](https://pnpm.io/) as its package manager and [Node.js](https://nodejs.org/) as its JavaScript runtime.
23+
24+
It's important to use the correct runtime versions to avoid any issues. The versions are specified in the [`.tool-versions`](../.tool-versions) file to ensure consistency across all developers.
25+
26+
To check your runtime versions, you can use the following command:
27+
28+
```bash
29+
node -v
30+
pnpm -v
31+
```
32+
33+
If the runtime versions do not align with the versions defined in the [`.tool-versions`](../.tool-versions) file, we recommend that you install the correct runtimes using [mise](https://mise.jdx.dev/), which helps manage multiple versions of development tools.
34+
35+
## 3. Installing Dependencies
36+
37+
Once your runtimes are installed, you can install the project's dependencies through pnpm using the following command:
38+
39+
```bash
40+
pnpm install
41+
```
42+
43+
If you encounter any issues during installation:
44+
45+
- Try deleting the `node_modules` directory
46+
- Run `pnpm install` again
47+
- Check if your runtime versions are correct
48+
49+
## 4. Setting Up Environment Variables
50+
51+
Some subdirectories may contain an `.env.example` file. These files are templates that you can use to create your own `.env` file.
52+
53+
To create your own `.env` file, you can use the following command:
54+
55+
```bash
56+
cp .env.example .env
57+
```
58+
59+
This will create a new `.env` file in the directory with the correct environment variable names. Once you have created the `.env` file, make sure to fill in the correct values for the environment variables. For example, here is the `.env.example` file in the `apps/web` directory:
60+
61+
```bash
62+
# .env.example
63+
64+
NEXT_PUBLIC_ENABLE_REACT_SCAN=0
65+
66+
# Obtain from: https://developers.aptos.dev
67+
NEXT_PUBLIC_APTOS_MAINNET_API_KEY=<api_key>
68+
NEXT_PUBLIC_APTOS_TESTNET_API_KEY=<api_key>
69+
70+
# Obtain from: https://analytics.google.com
71+
NEXT_PUBLIC_GA4_ID=<ga4_id>
72+
73+
CI=false
74+
```
75+
76+
It is important to set these up to avoid any issues such as rate limiting or missing functionality. If you don't have access to certain API keys, please obtain them using the links provided in the `.env.example` file.
77+
78+
## 5. Running Development Servers
79+
80+
To run the development servers, you can use the following command:
81+
82+
```bash
83+
pnpm dev
84+
```
85+
86+
If you need to run the development servers for a specific project, you can use the `--filter` flag:
87+
88+
```bash
89+
pnpm dev --filter <web|other-project-name>
90+
```
91+
92+
Alternatively, you can run the development servers directly from the projects:
93+
94+
```bash
95+
cd apps/web
96+
pnpm dev
97+
```
98+
99+
Development servers will automatically update as changes are made to the codebase and in their respective directories.
100+
101+
## 6. Running Tests
102+
103+
Petra Vault uses [Vitest](https://vitest.dev/) for unit testing and [Playwright](https://playwright.dev/) for end-to-end testing.
104+
105+
- **Vitest** is used for testing individual components and functions
106+
- **Playwright** is used for testing complete user flows in a real browser environment
107+
108+
It's important that you have set up all environment variables before running the tests. Make sure to find the `.env.example` file in all projects in `apps/` and create their corresponding `.env` file.
109+
110+
Now that you have set up the environment variables, you can run the tests using the following command from the root directory:
111+
112+
- **Unit Tests:** `pnpm test`
113+
- **End-to-End Tests:** `pnpm test:e2e`
114+
115+
When adding new features and flows, it's important to create tests that thoroughly cover the new functionality. This helps ensure that:
116+
117+
1. Your code works as expected
118+
2. Future changes don't break existing functionality
119+
3. Other developers can understand how your code should behave
120+
121+
## 7. Developer Configurations
122+
123+
Petra Vault uses [Prettier](https://prettier.io/) for formatting and [ESLint](https://eslint.org/) for linting.
124+
125+
- **Prettier** automatically formats your code to maintain consistent style
126+
- **ESLint** helps catch potential errors and enforce coding standards
127+
128+
You can run these tools using:
129+
130+
- **Prettier:** `pnpm format`
131+
- **ESLint:** `pnpm lint`
132+
133+
In addition, to edit configurations we've centralized them into subpackages.
134+
135+
- **tsconfig:** `packages/eslint-config` - TypeScript configuration
136+
- **eslint:** `packages/typescript-config` - ESLint rules and settings
137+
138+
When making changes to the configurations, it's best to make changes to child configurations rather than root configurations, as this ensures that changes are reflected in relevant projects without conflicts.
139+
140+
## 8. Documentation
141+
142+
The project's user-facing documentation is currently being handled through a closed-source repository. To make modifications to the documentation, please coordinate with a maintainer using a [Github Issue](https://github.com/aptos-labs/petra-vault/issues).
143+
144+
## 9. Submitting a Pull Request
145+
146+
When you submit a pull request, GitHub will automatically run checks and tests against your changes. If any of the checks fail:
147+
148+
1. Review the test logs to identify the cause of the failure
149+
2. Fix the issues in your code
150+
3. Push the changes to your branch
151+
4. The checks will automatically re-run
152+
153+
Please ensure all checks pass before requesting a review.
154+
155+
## 10. That's it!
156+
157+
You're all set! If you have any questions, please reach out to a maintainer using a [Github Issue](https://github.com/aptos-labs/petra-vault/issues). We're here to help!

.github/README.md

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
<p align="center">
2+
<a href="https://vault.petra.app">
3+
<img alt="petra logo" src="https://raw.githubusercontent.com/aptos-labs/petra-vault/main/.github/petra_logo.png" width="auto" height="60">
4+
</a>
5+
</p>
6+
7+
<p align="center" style="font-size: 24px; font-weight: bold;">
8+
Petra Vault
9+
</p>
10+
<p align="center">
11+
Multisig wallet solution on the Aptos blockchain
12+
</p>
13+
14+
<div align="center">
15+
<a href="https://github.com/aptos-labs/petra-vault/blob/main/LICENSE">
16+
<img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg" alt="Apache 2.0 License">
17+
</a>
18+
</div>
19+
20+
---
21+
22+
### Features
23+
24+
Petra Vault enables you to create and manage multisig vaults on the Aptos blockchain.
25+
26+
<p align="center">
27+
<b>Create or Import Vaults</b>: Quickly create a new vault or import an existing one (including those created from other platforms).
28+
</p>
29+
<div style="border-radius: 8px; overflow: hidden; box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1); width: 50%; margin: 0 auto;">
30+
<img src="./assets/onboarding_page.png" alt="Onboarding Flow" >
31+
</div>
32+
33+
<br/>
34+
35+
<p align="center">
36+
<b>Proposal Presets</b>: Packed with presets with seamless experiences for common transactions (e.g. sending coins, adding/removing owners, publishing modules, etc.)
37+
</p>
38+
39+
<div style="border-radius: 8px; overflow: hidden; box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1); width: 50%; margin: 0 auto;">
40+
<img src="./assets/send_flow.png" alt="Proposal Presets" >
41+
</div>
42+
43+
<br/>
44+
45+
<p align="center">
46+
<b>Transaction Simulations</b>: Preview the effects of transactions before sending them.
47+
</p>
48+
49+
<div style="border-radius: 8px; overflow: hidden; box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1); width: 50%; margin: 0 auto;">
50+
<img src="./assets/proposal_page.png" alt="Proposal Page" >
51+
</div>
52+
53+
<br/>
54+
55+
And that's not it, explore the rest of the features yourself at [vault.petra.app](https://vault.petra.app)!
56+
57+
## Documentation
58+
59+
For documentation, please refer to the [petra.app/vault](https://petra.app/vault).
60+
61+
## Getting Started
62+
63+
### Prerequisites
64+
65+
- Node.js
66+
- pnpm
67+
68+
Runtime versions are defined in the [`.tool-versions`](../.tool-versions) file. You can install these runtimes using [mise](https://mise.jdx.dev/).
69+
70+
### Installation
71+
72+
1. Clone the repository:
73+
74+
```bash
75+
git clone https://github.com/aptos-labs/petra-vault.git
76+
cd petra-vault
77+
```
78+
79+
2. Install dependencies:
80+
81+
```bash
82+
pnpm install
83+
```
84+
85+
3. Start the development server:
86+
87+
```bash
88+
pnpm dev
89+
```
90+
91+
4. Open [http://localhost:3000](http://localhost:3000) in your browser to see the application.
92+
93+
### Environment Variables
94+
95+
Create a `.env.local` file in the `apps/web` directory by copying the example file:
96+
97+
```bash
98+
cp .env.example .env.local
99+
```
100+
101+
Required environment variables:
102+
103+
```bash
104+
# Enable React performance scanning
105+
NEXT_PUBLIC_ENABLE_REACT_SCAN=0
106+
107+
# API Keys for Aptos networks (obtain from https://developers.aptos.dev)
108+
NEXT_PUBLIC_APTOS_MAINNET_API_KEY=<api_key>
109+
NEXT_PUBLIC_APTOS_TESTNET_API_KEY=<api_key>
110+
111+
# Google Analytics ID (obtain from https://analytics.google.com)
112+
NEXT_PUBLIC_GA4_ID=<ga4_id>
113+
114+
CI=false
115+
```
116+
117+
> **Note**: Make sure to obtain the necessary API keys from the provided links to avoid rate limiting issues.
118+
119+
## Testing
120+
121+
The monorepo uses [vitest](https://vitest.dev/) for unit testing and [playwright](https://playwright.dev/) for end-to-end testing.
122+
123+
### Unit Tests
124+
125+
To run the unit tests, you can use the following command:
126+
127+
```bash
128+
pnpm test
129+
```
130+
131+
### End-to-End (E2E) Tests
132+
133+
To get started with E2E tests, you must first install the Playwright dependencies:
134+
135+
```bash
136+
pnpx playwright install --with-deps chromium
137+
```
138+
139+
Then, you can run the E2E tests using the following command:
140+
141+
```bash
142+
pnpm test:e2e
143+
```
144+
145+
![End-to-End Tests](./assets/e2e_tests.png)
146+
147+
> **Note**: Running it from the root directory will automatically do any necessary builds steps. If done in a subdirectory, make sure to manually build the project using `pnpm build` before running the tests.
148+
149+
## Deployments
150+
151+
The deployment points to [https://vault.petra.app](https://vault.petra.app). The application is deployed onto [Vercel](https://vercel.com) using the `main` branch. Deployments are automatically triggered when a push is made to the `main` branch.
152+
153+
## Contributing
154+
155+
Contributions are welcome! Please refer to the [CONTRIBUTING.md](./CONTRIBUTING.md) file for more information.

.github/assets/backup_restore.png

406 KB
Loading

.github/assets/e2e_tests.png

197 KB
Loading

.github/assets/onboarding_page.png

301 KB
Loading

.github/assets/proposal_page.png

672 KB
Loading

.github/assets/send_flow.png

557 KB
Loading

.github/petra_logo.png

941 Bytes
Loading

.github/workflows/run-checks.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
- name: Install Dependencies
2828
run: pnpm i
2929

30+
- name: Run Checks
31+
run: pnpm check
32+
3033
- name: Install Playwright
3134
run: pnpx playwright install --with-deps chromium
3235

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"trailingComma": "none",
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true
6+
}

0 commit comments

Comments
 (0)