2024-07-10 19:11:07 +00:00
|
|
|
# Transfer App
|
|
|
|
|
2024-09-12 16:48:14 +00:00
|
|
|
This is an example frontend that illustrates how to interact with a Quartz app.
|
2024-07-10 19:11:07 +00:00
|
|
|
|
2024-09-12 16:48:14 +00:00
|
|
|
This example offers the ability to:
|
2024-07-10 19:11:07 +00:00
|
|
|
|
|
|
|
- Deposit amounts into a balance
|
|
|
|
- Withdraw the whole deposit
|
2024-09-12 16:48:14 +00:00
|
|
|
- Transfer amounts between wallets in a private-preserving way
|
|
|
|
- Query your encrypted balance
|
2024-07-10 19:11:07 +00:00
|
|
|
- Switch between Keplr wallets
|
|
|
|
|
|
|
|
## Requirements
|
|
|
|
|
|
|
|
In order to get started, you will need:
|
|
|
|
|
|
|
|
- [Node.js](https://nodejs.org/) LTS (v20.x)
|
|
|
|
- `npm`
|
|
|
|
- A [Keplr](https://www.keplr.app/) Wallet
|
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
|
|
Install dependencies:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm ci
|
|
|
|
```
|
|
|
|
|
2024-09-12 16:48:14 +00:00
|
|
|
The app requires some environment variables to fully work. Be sure to set up those accordingly to your local environment.
|
2024-07-10 19:11:07 +00:00
|
|
|
|
|
|
|
You should start from the template:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cp .env.example .env.local
|
|
|
|
```
|
|
|
|
|
2024-09-12 16:48:14 +00:00
|
|
|
Required environment variables:
|
|
|
|
|
|
|
|
```
|
|
|
|
# Choose target chain configuration
|
|
|
|
NEXT_PUBLIC_TARGET_CHAIN=<localWasm | localNeutron | doWasm>
|
|
|
|
# Enclave public key to encrypt transfers
|
|
|
|
NEXT_PUBLIC_ENCLAVE_PUBLIC_KEY=<public_key>
|
|
|
|
# Target transfers contract
|
|
|
|
NEXT_PUBLIC_TRANSFERS_CONTRACT_ADDRESS=<contract_address>
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:11:07 +00:00
|
|
|
Run the app:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm run dev
|
|
|
|
```
|
|
|
|
|
2024-09-12 16:48:14 +00:00
|
|
|
App will be running on http://localhost:3000/ and now everything is up & running 🎉
|
|
|
|
|
|
|
|
## E2E Testing
|
|
|
|
|
|
|
|
For tests to work, you need to set up the following required environment variables:
|
|
|
|
|
|
|
|
```
|
|
|
|
# Frontend base url
|
|
|
|
TEST_BASE_URL=<url>
|
|
|
|
# Keplr browser extension version
|
|
|
|
TEST_KEPLR_EXTENSION_VERSION=<version>
|
|
|
|
# Main wallet mnemonic (Use only funded wallets)
|
|
|
|
TEST_WALLET_MNEMONIC=<mnemonic>
|
|
|
|
# Secondary wallet mnemonic (Use only funded wallets)
|
|
|
|
TEST_SECONDARY_WALLET_MNEMONIC=<mnemonic>
|
|
|
|
# Secondary wallet address
|
|
|
|
TEST_SECONDARY_WALLET_ADDRESS=<wallet_address>
|
|
|
|
# Keplr wallet password. It can be whatever
|
|
|
|
TEST_WALLET_PASSWORD=<password>
|
|
|
|
```
|
|
|
|
|
|
|
|
Run all E2E tests:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm run test
|
|
|
|
```
|
|
|
|
|
|
|
|
If want to run the tests with the Playwright dedicated interface, run:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm run test:ui
|
|
|
|
```
|