Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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 apps/app-integration-template/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Free WalletConnect Cloud project id (used by RainbowKit on the EVM side).
# https://cloud.reown.com
VITE_WALLETCONNECT_PROJECT_ID=
41 changes: 41 additions & 0 deletions apps/app-integration-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Application integration template (EVM + Aptos)

Minimal React app that mirrors the same product flow on **Ethereum (Sepolia)** and **Aptos** side by side: connect a wallet, read a native balance, submit a simple transfer, and read on-chain state. It exists to pair with the [Application Integration Guide](https://aptos.dev/build/guides/application-integration).

## Patterns included

| Concern | Ethereum | Aptos |
| --- | --- | --- |
| Wallet UX | RainbowKit + wagmi | `@aptos-labs/wallet-adapter-react` + Ant Design selector |
| Balance | `useBalance` | `aptos.getBalance` (`0x1::aptos_coin::AptosCoin`) |
| Submit + wait | `useSendTransaction` + `useWaitForTransactionReceipt` | `signAndSubmitTransaction` + `aptos.waitForTransaction` |
| Read state | `useChainId` / `useBlockNumber` | `aptos.view` (`0x1::account::exists_at`) |
| Parallel / nonce txs | N/A in this demo | Optional `replayProtectionNonce` (orderless, AIP-123) |

## Run locally

```bash
cd apps/app-integration-template
cp .env.example .env
# Set VITE_WALLETCONNECT_PROJECT_ID for RainbowKit (EVM connect button).

pnpm install
pnpm dev
```

Open the URL Vite prints (default port `5175`). Use testnet faucets for Sepolia ETH and Aptos testnet APT as needed.

## Test

```bash
pnpm test
pnpm lint
```

## Splitting to a standalone repo

This folder is self-contained (`package.json`, `pnpm-lock.yaml`). To publish as `aptos-labs/app-integration-template`, copy the directory to a new repository root and push; then change the integration guide link from this monorepo path to the new repository URL.

## SDK note

The template pins `@aptos-labs/ts-sdk` to the **v5** line because current `@aptos-labs/wallet-adapter-react` peer dependencies expect it. When the adapter declares compatibility with ts-sdk v6, bump the dependency here and re-run `pnpm test`.
12 changes: 12 additions & 0 deletions apps/app-integration-template/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>EVM ↔ Aptos integration template</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
37 changes: 37 additions & 0 deletions apps/app-integration-template/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "app-integration-template",
"private": true,
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"lint": "pnpm exec biome check .",
"format": "pnpm exec biome check --write .",
"test": "vitest run"
},
"dependencies": {
"@aptos-labs/ts-sdk": "^5.2.1",
"@aptos-labs/wallet-adapter-ant-design": "^5.3.19",
"@aptos-labs/wallet-adapter-react": "^8.3.3",
"@rainbow-me/rainbowkit": "^2.2.10",
"@tanstack/react-query": "^5.90.2",
"antd": "^5.27.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "^2.47.16",
"wagmi": "^2.19.5",
"zod": "^3.24.2"
},
"devDependencies": {
"@biomejs/biome": "2.4.4",
"@types/react": "^18.3.26",
"@types/react-dom": "^18.3.7",
"@vitejs/plugin-react": "^5.0.4",
"jsdom": "^27.0.0",
"typescript": "^5.9.3",
"vite": "^7.1.9",
"vitest": "^3.2.4"
}
}
Loading
Loading