Skip to content
Merged
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
11 changes: 10 additions & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,19 @@ jobs:
VITE_OMS_PUBLIC_API_KEY: ${{ secrets.OMS_PUBLIC_API_KEY }}
VITE_OMS_PROJECT_ID: ${{ secrets.OMS_PROJECT_ID }}

- name: Build Trails Actions example
run: pnpm build:trails-actions-example
env:
GITHUB_PAGES: 'true'
VITE_OMS_PUBLIC_API_KEY: ${{ secrets.OMS_PUBLIC_API_KEY }}
VITE_OMS_PROJECT_ID: ${{ secrets.OMS_PROJECT_ID }}

- name: Stage Pages artifact
run: |
mkdir -p pages/react-example
mkdir -p pages/trails-actions-example
cp -R examples/react/dist/. pages/react-example/
cp -R examples/trails-actions/dist/. pages/trails-actions-example/

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
Expand All @@ -64,7 +73,7 @@ jobs:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}react-example/
url: ${{ steps.deployment.outputs.page_url }}trails-actions-example/

steps:
- name: Deploy to GitHub Pages
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ cp examples/react/.env.example examples/react/.env.local
pnpm dev:example
```

## Trails Actions React Example

The Trails Actions example prepares and sends Polygon swap, deposit, and swap plus deposit flows with `0xtrails/actions`.

The deployed Trails Actions example is available at [https://0xsequence.github.io/typescript-sdk/trails-actions-example/](https://0xsequence.github.io/typescript-sdk/trails-actions-example/).

To run it locally from the repository root:

```bash
cp examples/trails-actions/.env.example examples/trails-actions/.env.local
# Fill VITE_OMS_PUBLIC_API_KEY and VITE_OMS_PROJECT_ID in examples/trails-actions/.env.local
pnpm dev:trails-actions-example
```

## Quick Start

```typescript
Expand Down
2 changes: 2 additions & 0 deletions examples/trails-actions/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VITE_OMS_PUBLIC_API_KEY=
VITE_OMS_PROJECT_ID=
30 changes: 30 additions & 0 deletions examples/trails-actions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Trails Actions React Example

This Vite React app uses the TypeScript SDK wallet client with Trails actions on Polygon:

- Swap POL to USDC
- Deposit USDC using Earn
- Swap POL to USDC and deposit USDC in one prepared Trails transaction

Run it from the repository root:

```bash
pnpm install
pnpm build
cp examples/trails-actions/.env.example examples/trails-actions/.env.local
# Fill VITE_OMS_PUBLIC_API_KEY and VITE_OMS_PROJECT_ID
pnpm dev:trails-actions-example
```

The dev server runs at `http://localhost:5173`.

The deployed example is available at `https://0xsequence.github.io/typescript-sdk/trails-actions-example`.

The OMS project used by the environment values must support Polygon.

Build it from the repository root:

```bash
pnpm build
pnpm build:trails-actions-example
```
12 changes: 12 additions & 0 deletions examples/trails-actions/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>Trails Actions React Example</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
26 changes: 26 additions & 0 deletions examples/trails-actions/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "trails-actions-example",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"preview": "vite preview"
},
"dependencies": {
"0xtrails": "0.16.0",
"@0xsequence/typescript-sdk": "workspace:*",
"@0xtrails/api": "0.16.0",
"react": "^19.2.5",
"react-dom": "^19.2.5",
"viem": "^2.48.4"
},
"devDependencies": {
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.1",
"typescript": "^5.9.3",
"vite": "^8.0.10"
}
}
Loading
Loading