-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a demo repository for an NTT transfer using the Wormhole Connect
- Loading branch information
Showing
15 changed files
with
11,787 additions
and
1 deletion.
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,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
/node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
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,13 @@ | ||
Copyright 2022 Wormhole Project Contributors | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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 +1,52 @@ | ||
# demo-ntt-connect | ||
# Wormhole NTT Connect demo | ||
|
||
This project sets up a Vite-React TypeScript application and integrates it with the Wormhole Connect SDK. | ||
|
||
## Prerequisites | ||
|
||
Ensure you have the following installed on your system: | ||
|
||
- **Node.js** & **TypeScript** | ||
- **npm** or **yarn** | ||
|
||
## Setup | ||
|
||
### 1. Clone the Repository | ||
|
||
First, clone the repository to your local machine: | ||
|
||
```bash | ||
git clone https://github.com/wormhole-foundation/demo-ntt-connect.git | ||
cd demo-ntt-connect | ||
``` | ||
|
||
### 2. Download Dependencies | ||
|
||
Make sure to install all required dependencies using `npm` or `yarn`: | ||
|
||
```bash | ||
# Using npm | ||
npm install | ||
|
||
# Or using yarn | ||
yarn | ||
``` | ||
``` | ||
### 3. Adjust WormholeConnectConfig | ||
Adjust the `WormholeConnectConfig` in `App.tsx` based on the `deployment.json` file from your NTT deployment. This configuration is essential to ensure proper integration with your deployment environment. | ||
### 4. Run the App | ||
Finally, run your application: | ||
```bash | ||
yarn dev | ||
``` | ||
|
||
or, if using npm: | ||
|
||
```bash | ||
npm run dev | ||
``` |
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import js from '@eslint/js' | ||
import globals from 'globals' | ||
import reactHooks from 'eslint-plugin-react-hooks' | ||
import reactRefresh from 'eslint-plugin-react-refresh' | ||
import tseslint from 'typescript-eslint' | ||
|
||
export default tseslint.config( | ||
{ ignores: ['dist'] }, | ||
{ | ||
extends: [js.configs.recommended, ...tseslint.configs.recommended], | ||
files: ['**/*.{ts,tsx}'], | ||
languageOptions: { | ||
ecmaVersion: 2020, | ||
globals: globals.browser, | ||
}, | ||
plugins: { | ||
'react-hooks': reactHooks, | ||
'react-refresh': reactRefresh, | ||
}, | ||
rules: { | ||
...reactHooks.configs.recommended.rules, | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
}, | ||
}, | ||
) |
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,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + React + TS</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
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,30 @@ | ||
{ | ||
"name": "connect-ntt-test", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc -b && vite build", | ||
"lint": "eslint .", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"@wormhole-foundation/wormhole-connect": "^0.3.21", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1" | ||
}, | ||
"devDependencies": { | ||
"@eslint/js": "^9.9.0", | ||
"@types/react": "^18.3.3", | ||
"@types/react-dom": "^18.3.0", | ||
"@vitejs/plugin-react": "^4.3.1", | ||
"eslint": "^9.9.0", | ||
"eslint-plugin-react-hooks": "^5.1.0-rc.0", | ||
"eslint-plugin-react-refresh": "^0.4.9", | ||
"globals": "^15.9.0", | ||
"typescript": "^5.5.3", | ||
"typescript-eslint": "^8.0.1", | ||
"vite": "^5.4.1" | ||
} | ||
} |
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,42 @@ | ||
#root { | ||
max-width: 1280px; | ||
margin: 0 auto; | ||
padding: 2rem; | ||
text-align: center; | ||
} | ||
|
||
.logo { | ||
height: 6em; | ||
padding: 1.5em; | ||
will-change: filter; | ||
transition: filter 300ms; | ||
} | ||
.logo:hover { | ||
filter: drop-shadow(0 0 2em #646cffaa); | ||
} | ||
.logo.react:hover { | ||
filter: drop-shadow(0 0 2em #61dafbaa); | ||
} | ||
|
||
@keyframes logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
a:nth-of-type(2) .logo { | ||
animation: logo-spin infinite 20s linear; | ||
} | ||
} | ||
|
||
.card { | ||
padding: 2em; | ||
} | ||
|
||
.read-the-docs { | ||
color: #888; | ||
} |
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,92 @@ | ||
import type { WormholeConnectConfig } from '@wormhole-foundation/wormhole-connect' | ||
import WormholeConnect from '@wormhole-foundation/wormhole-connect' | ||
|
||
const wormholeConfig: WormholeConnectConfig = { | ||
env: 'testnet', // from deployment.json of the NTT deployment directory | ||
networks: ['sepolia', 'solana'], // from https://github.com/wormhole-foundation/wormhole-connect/blob/development/wormhole-connect/src/config/testnet/chains.ts#L170 | ||
// tokens: ['FTTsep', 'FTTsol'], // this will limit the available tokens that can be transferred to the other chain | ||
// routes: ['nttManual'], // this will limit the available routes - from https://github.com/wormhole-foundation/wormhole-connect/blob/d7a6b67b18db2c8eb4a249d19ef77d0174deffbe/wormhole-connect/src/config/types.ts#L70 | ||
bridgeDefaults: { | ||
fromNetwork: 'bsepolia', | ||
toNetwork: 'solana' | ||
}, | ||
nttGroups: { | ||
FTT_NTT: { // arbitrary name for the ntt group | ||
nttManagers: [ | ||
{ | ||
chainName: 'sepolia', | ||
address: '0xeBdEFbC8111439449293A98f552a4BE57e2D5FAD', // nttManagers Address from deployment.json | ||
tokenKey: 'FTTsep', | ||
transceivers: [ | ||
{ | ||
address: '0xf5D15B2F36A34918bD18C9D1382B98B9C22a7d3e', // transceivers address from deployment.json | ||
type: 'wormhole' | ||
} | ||
] | ||
}, | ||
{ | ||
chainName: 'solana', | ||
address: 'NTttPKktsauausafEimYigoDKfb193P94L3Vyff6LvV', // nttManagers Address from deployment.json | ||
tokenKey: 'FTTsol', | ||
transceivers: [ | ||
{ | ||
address: 'AQmPbngJJHmKcC482pVshfLeS3KP4iK5q863a2DhH992', // transceivers address from deployment.json | ||
type: 'wormhole' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
|
||
tokensConfig: { | ||
FTTsep: { | ||
key: 'FTTsep', | ||
symbol: 'FTT', | ||
nativeChain: 'sepolia', // will be shown as native only on this chain, otherwise as "Wormhole wrapped" | ||
displayName: 'FTT (Sep)', // name that is displayed in the Route | ||
tokenId: { | ||
chain: 'sepolia', | ||
address: '0xF7cbc69c6259Cf06582EEDF9477D58a15Dc5332e' // token address | ||
}, | ||
coinGeckoId: 'test', | ||
icon: 'https://wormhole.com/token.png', | ||
color: '#00C3D9', | ||
decimals: { | ||
Ethereum: 18, | ||
default: 8 | ||
} | ||
}, | ||
|
||
FTTsol: { | ||
key: 'FTTsol', | ||
symbol: 'FTT', | ||
nativeChain: 'solana', // will be shown as native only on this chain, otherwise as "Wormhole wrapped" | ||
displayName: 'FTT (Solana)', // name that is displayed in the Route | ||
tokenId: { | ||
chain: 'solana', | ||
address: 'GCzVVsjMjkg8EpoidnFW9bqegwhbp1GWGpzuSfhH6fyB' // token address | ||
}, | ||
coinGeckoId: 'test', | ||
icon: 'https://wormhole.com/token.png', | ||
color: '#00C3D9', | ||
decimals: { | ||
Solana: 9, | ||
Ethereum: 9, | ||
default: 8 | ||
} | ||
} | ||
} | ||
} | ||
|
||
function App() { | ||
return ( | ||
<div> | ||
<h1>My Wormhole Connect NTT App</h1> | ||
<WormholeConnect config={wormholeConfig} /> | ||
</div> | ||
) | ||
} | ||
|
||
|
||
export default App |
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,9 @@ | ||
import { StrictMode } from 'react' | ||
import { createRoot } from 'react-dom/client' | ||
import App from './App.tsx' | ||
|
||
createRoot(document.getElementById('root')!).render( | ||
<StrictMode> | ||
<App /> | ||
</StrictMode>, | ||
) |
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,24 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"useDefineForClassFields": true, | ||
"lib": ["ES2020", "DOM", "DOM.Iterable"], | ||
"module": "ESNext", | ||
"skipLibCheck": true, | ||
|
||
/* Bundler mode */ | ||
"moduleResolution": "bundler", | ||
"allowImportingTsExtensions": true, | ||
"isolatedModules": true, | ||
"moduleDetection": "force", | ||
"noEmit": true, | ||
"jsx": "react-jsx", | ||
|
||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"include": ["src"] | ||
} |
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,7 @@ | ||
{ | ||
"files": [], | ||
"references": [ | ||
{ "path": "./tsconfig.app.json" }, | ||
{ "path": "./tsconfig.node.json" } | ||
] | ||
} |
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,22 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2022", | ||
"lib": ["ES2023"], | ||
"module": "ESNext", | ||
"skipLibCheck": true, | ||
|
||
/* Bundler mode */ | ||
"moduleResolution": "bundler", | ||
"allowImportingTsExtensions": true, | ||
"isolatedModules": true, | ||
"moduleDetection": "force", | ||
"noEmit": true, | ||
|
||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"include": ["vite.config.ts"] | ||
} |
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,7 @@ | ||
import { defineConfig } from 'vite' | ||
import react from '@vitejs/plugin-react' | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react()], | ||
}) |
Oops, something went wrong.