restructure (#345)

* restructure

* udpate readme links
This commit is contained in:
Glitch
2023-12-13 15:36:25 -03:00
committed by GitHub
parent 599743deb1
commit deb123f283
573 changed files with 578 additions and 578 deletions
@@ -0,0 +1,3 @@
NEXT_PUBLIC_PROJECT_ID=...
NEXT_PUBLIC_RELAY_URL=wss://relay.walletconnect.com
@@ -0,0 +1,4 @@
{
"extends": "next/core-web-vitals",
"ignorePatterns": ["next.config.js"]
}
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
.DS_Store
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# vercel
.vercel
@@ -0,0 +1,9 @@
{
"arrowParens": "avoid",
"parser": "typescript",
"printWidth": 100,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"semi": false
}
@@ -0,0 +1,34 @@
# Auth Wallet Example (React, Typescript, Ethers, NextJS)
This example aims to demonstrate wallet-facing use cases enabled by WalletConnect Auth Alpha. Please only use this for reference and development purposes, otherwise you are at risk of losing your funds.
# Useful links
🔗 Live wallet app - https://react-auth-wallet.walletconnect.com/ <br />
🔗 Live dapp - https://react-auth-dapp.walletconnect.com/ <br />
📚 WalletConnect docs - https://docs.walletconnect.com/2.0
## Getting started
Example is built atop of [NextJS](https://nextjs.org/) in order to abstract complexity of setting up bundlers, routing etc. So there are few steps you need to follow in order to set everything up
1. Go to [WalletConnect Cloud](https://cloud.walletconnect.com/sign-in) and obtain a project id
2. Add your project details in [WalletConnectUtil.ts](https://github.com/WalletConnect/web-examples/blob/main/wallets/react-wallet-v2/src/utils/WalletConnectUtil.ts) file
3. Install dependencies via `npm install`
4. Setup your environment variables
```bash
cp .env.local.example .env.local
```
Your `.env.local` now contains the following environment variables:
- `NEXT_PUBLIC_PROJECT_ID` (placeholder) - You can generate your own ProjectId at https://cloud.walletconnect.com
- `NEXT_PUBLIC_RELAY_URL` (already set)
5. Run `npm run dev` to start local development
+5
View File
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
@@ -0,0 +1,3 @@
module.exports = {
reactStrictMode: true
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,46 @@
{
"name": "react-wallet-v2",
"private": true,
"scripts": {
"dev": "next dev -p 3001",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@cosmjs/amino": "0.32.0",
"@cosmjs/encoding": "0.32.0",
"@cosmjs/proto-signing": "0.32.0",
"@json-rpc-tools/utils": "1.7.6",
"@nextui-org/react": "1.0.8-beta.5",
"@polkadot/keyring": "^10.1.2",
"@solana/web3.js": "1.78.4",
"@walletconnect/auth-client": "^2.1.0",
"@walletconnect/core": "^2.7.6",
"@walletconnect/push-client": "0.10.4",
"@walletconnect/utils": "^2.7.6",
"bs58": "5.0.0",
"cosmos-wallet": "1.2.0",
"ethers": "5.7.2",
"framer-motion": "6.5.1",
"lokijs": "^1.5.12",
"mnemonic-keyring": "1.4.0",
"next": "12.1.5",
"react": "17.0.2",
"react-code-blocks": "0.0.9-0",
"react-dom": "17.0.2",
"react-qr-reader-es6": "2.2.1-2",
"solana-wallet": "1.0.2",
"valtio": "1.6.0"
},
"devDependencies": {
"@types/node": "17.0.35",
"@types/react": "18.0.9",
"@walletconnect/types": "^2.7.6",
"eslint": "8.15.0",
"eslint-config-next": "12.1.6",
"eslint-config-prettier": "8.5.0",
"prettier": "2.6.2",
"typescript": "4.6.4"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

@@ -0,0 +1,9 @@
<svg width="800" height="800" viewBox="0 0 800 800" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="800" height="800" rx="400" fill="#E6007A"/>
<path d="M400.072 246.038C452.666 246.038 495.302 221.181 495.302 190.519C495.302 159.857 452.666 135 400.072 135C347.478 135 304.843 159.857 304.843 190.519C304.843 221.181 347.478 246.038 400.072 246.038Z" fill="white"/>
<path d="M400.072 664.364C452.666 664.364 495.302 639.507 495.302 608.845C495.302 578.183 452.666 553.326 400.072 553.326C347.478 553.326 304.843 578.183 304.843 608.845C304.843 639.507 347.478 664.364 400.072 664.364Z" fill="white"/>
<path d="M267.363 322.89C293.66 277.233 293.489 227.785 266.982 212.443C240.475 197.102 197.668 221.677 171.371 267.333C145.074 312.989 145.245 362.438 171.753 377.779C198.26 393.121 241.066 368.546 267.363 322.89Z" fill="white"/>
<path d="M628.731 532.027C655.028 486.371 654.872 436.931 628.382 421.6C601.893 406.269 559.101 430.852 532.804 476.508C506.507 522.165 506.663 571.605 533.153 586.936C559.643 602.267 602.434 577.684 628.731 532.027Z" fill="white"/>
<path d="M266.996 586.923C293.503 571.582 293.674 522.133 267.377 476.477C241.08 430.821 198.274 406.246 171.766 421.587C145.259 436.929 145.088 486.377 171.385 532.034C197.682 577.69 240.488 602.265 266.996 586.923Z" fill="white"/>
<path d="M628.405 377.792C654.894 362.461 655.051 313.02 628.754 267.364C602.457 221.708 559.665 197.124 533.175 212.455C506.686 227.787 506.53 277.227 532.827 322.883C559.124 368.539 601.915 393.123 628.405 377.792Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

@@ -0,0 +1,24 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M160 368H448M160 144H448H160ZM160 256H448H160Z" stroke="url(#paint0_linear_46_13)" stroke-width="48" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M80 160C88.8366 160 96 152.837 96 144C96 135.163 88.8366 128 80 128C71.1634 128 64 135.163 64 144C64 152.837 71.1634 160 80 160Z" stroke="url(#paint1_linear_46_13)" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M80 272C88.8366 272 96 264.837 96 256C96 247.163 88.8366 240 80 240C71.1634 240 64 247.163 64 256C64 264.837 71.1634 272 80 272Z" stroke="url(#paint2_linear_46_13)" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M80 384C88.8366 384 96 376.837 96 368C96 359.163 88.8366 352 80 352C71.1634 352 64 359.163 64 368C64 376.837 71.1634 384 80 384Z" stroke="url(#paint3_linear_46_13)" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<linearGradient id="paint0_linear_46_13" x1="160" y1="144.018" x2="380.191" y2="421.745" gradientUnits="userSpaceOnUse">
<stop stop-color="#A562D5"/>
<stop offset="1" stop-color="#306FEB"/>
</linearGradient>
<linearGradient id="paint1_linear_46_13" x1="64" y1="128.003" x2="96.3014" y2="159.69" gradientUnits="userSpaceOnUse">
<stop stop-color="#A562D5"/>
<stop offset="1" stop-color="#306FEB"/>
</linearGradient>
<linearGradient id="paint2_linear_46_13" x1="64" y1="240.003" x2="96.3014" y2="271.69" gradientUnits="userSpaceOnUse">
<stop stop-color="#A562D5"/>
<stop offset="1" stop-color="#306FEB"/>
</linearGradient>
<linearGradient id="paint3_linear_46_13" x1="64" y1="352.003" x2="96.3014" y2="383.69" gradientUnits="userSpaceOnUse">
<stop stop-color="#A562D5"/>
<stop offset="1" stop-color="#306FEB"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,3 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M112 184L256 328L400 184" stroke="white" stroke-width="48" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 224 B

@@ -0,0 +1,3 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M184 112L328 256L184 400" stroke="white" stroke-width="48" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 224 B

@@ -0,0 +1,3 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M416 128L192 384L96 288" stroke="white" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 223 B

@@ -0,0 +1,4 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M336 64H368C380.73 64 392.939 69.0571 401.941 78.0589C410.943 87.0606 416 99.2696 416 112V432C416 444.73 410.943 456.939 401.941 465.941C392.939 474.943 380.73 480 368 480H144C131.27 480 119.061 474.943 110.059 465.941C101.057 456.939 96 444.73 96 432V112C96 99.2696 101.057 87.0606 110.059 78.0589C119.061 69.0571 131.27 64 144 64H176" stroke="white" stroke-width="32" stroke-linejoin="round"/>
<path d="M309.87 32H202.13C187.699 32 176 43.6988 176 58.13V69.87C176 84.3012 187.699 96 202.13 96H309.87C324.301 96 336 84.3012 336 69.87V58.13C336 43.6988 324.301 32 309.87 32Z" stroke="white" stroke-width="32" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 751 B

@@ -0,0 +1,6 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M112 112L132 432C132.95 450.49 146.4 464 164 464H348C365.67 464 378.87 450.49 380 432L400 112" stroke="#F21361" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M80 112H432Z" fill="#F21361"/>
<path d="M80 112H432" stroke="#F21361" stroke-width="32" stroke-miterlimit="10" stroke-linecap="round"/>
<path d="M328 176L320 400M192 112V72.0001C191.991 68.8458 192.605 65.7208 193.808 62.8048C195.011 59.8888 196.778 57.2394 199.009 55.0089C201.239 52.7785 203.889 51.011 206.805 49.8082C209.721 48.6053 212.846 47.9909 216 48.0001H296C299.154 47.9909 302.279 48.6053 305.195 49.8082C308.111 51.011 310.761 52.7785 312.991 55.0089C315.222 57.2394 316.989 59.8888 318.192 62.8048C319.395 65.7208 320.009 68.8458 320 72.0001V112H192ZM256 176V400V176ZM184 176L192 400L184 176Z" stroke="#F21361" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 996 B

@@ -0,0 +1,10 @@
<svg width="15" height="23" viewBox="0 0 15 23" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.0001 0C6.07054 0 3.52589 2.0154 2.8549 4.86708L0.578472 14.5419C0.283081 15.7973 1.23561 17 2.52531 17H15.4749C16.7646 17 17.7171 15.7973 17.4217 14.5419L15.1453 4.86709C14.4743 2.0154 11.9297 0 9.0001 0Z" fill="url(#gradient)" />
<path d="M12.7231 19.9655C13.0268 19.1947 12.3285 15.5 11.5001 15.5H6.5001C5.67167 15.5 4.97344 19.1947 5.27708 19.9655C5.86177 21.4497 7.30827 22.5 9.0001 22.5C10.6919 22.5 12.1384 21.4497 12.7231 19.9655Z" fill="url(#gradient" />
<defs>
<linearGradient id="gradient" x1="0" y1="0" x2="0" y2="100%">
<stop offset="0%" stop-color="#A562D5" />
<stop offset="100%" stop-color="#306FEB" />
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 786 B

@@ -0,0 +1,9 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M208 352H144C118.539 352 94.1212 341.886 76.1178 323.882C58.1143 305.879 48 281.461 48 256C48 230.539 58.1143 206.121 76.1178 188.118C94.1212 170.114 118.539 160 144 160H208M304 160H368C393.461 160 417.879 170.114 435.882 188.118C453.886 206.121 464 230.539 464 256C464 281.461 453.886 305.879 435.882 323.882C417.879 341.886 393.461 352 368 352H304M163.29 256H350.71" stroke="url(#paint0_linear_112_7)" stroke-width="36" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<linearGradient id="paint0_linear_112_7" x1="48.0001" y1="160.015" x2="197.341" y2="477.442" gradientUnits="userSpaceOnUse">
<stop stop-color="#A562D5"/>
<stop offset="1" stop-color="#306FEB"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 814 B

@@ -0,0 +1,13 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M408 336H344C339.582 336 336 339.582 336 344V408C336 412.418 339.582 416 344 416H408C412.418 416 416 412.418 416 408V344C416 339.582 412.418 336 408 336Z" fill="#8B8B8B"/>
<path d="M328 272H280C275.582 272 272 275.582 272 280V328C272 332.418 275.582 336 280 336H328C332.418 336 336 332.418 336 328V280C336 275.582 332.418 272 328 272Z" fill="#8B8B8B"/>
<path d="M472 416H424C419.582 416 416 419.582 416 424V472C416 476.418 419.582 480 424 480H472C476.418 480 480 476.418 480 472V424C480 419.582 476.418 416 472 416Z" fill="#8B8B8B"/>
<path d="M472 272H440C435.582 272 432 275.582 432 280V312C432 316.418 435.582 320 440 320H472C476.418 320 480 316.418 480 312V280C480 275.582 476.418 272 472 272Z" fill="#8B8B8B"/>
<path d="M312 432H280C275.582 432 272 435.582 272 440V472C272 476.418 275.582 480 280 480H312C316.418 480 320 476.418 320 472V440C320 435.582 316.418 432 312 432Z" fill="#8B8B8B"/>
<path d="M408 96H344C339.582 96 336 99.5817 336 104V168C336 172.418 339.582 176 344 176H408C412.418 176 416 172.418 416 168V104C416 99.5817 412.418 96 408 96Z" fill="#8B8B8B"/>
<path d="M448 48H304C295.163 48 288 55.1634 288 64V208C288 216.837 295.163 224 304 224H448C456.837 224 464 216.837 464 208V64C464 55.1634 456.837 48 448 48Z" stroke="#8B8B8B" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M168 96H104C99.5817 96 96 99.5817 96 104V168C96 172.418 99.5817 176 104 176H168C172.418 176 176 172.418 176 168V104C176 99.5817 172.418 96 168 96Z" fill="#8B8B8B"/>
<path d="M208 48H64C55.1634 48 48 55.1634 48 64V208C48 216.837 55.1634 224 64 224H208C216.837 224 224 216.837 224 208V64C224 55.1634 216.837 48 208 48Z" stroke="#8B8B8B" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M168 336H104C99.5817 336 96 339.582 96 344V408C96 412.418 99.5817 416 104 416H168C172.418 416 176 412.418 176 408V344C176 339.582 172.418 336 168 336Z" fill="#8B8B8B"/>
<path d="M208 288H64C55.1634 288 48 295.163 48 304V448C48 456.837 55.1634 464 64 464H208C216.837 464 224 456.837 224 448V304C224 295.163 216.837 288 208 288Z" stroke="#8B8B8B" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.8 KiB

@@ -0,0 +1,86 @@
* {
box-sizing: border-box;
-ms-overflow-style: none;
scrollbar-width: none;
}
::-webkit-scrollbar {
display: none;
}
.routeTransition {
display: flex;
flex: 1;
flex-direction: column;
overflow: hidden;
}
.container {
width: 100%;
height: calc(100% - 220px);
display: flex;
flex: 1;
flex-direction: column;
justify-content: center;
align-items: center;
}
.qrVideoMask {
width: 100%;
border-radius: 15px;
overflow: hidden !important;
position: relative;
}
.qrPlaceholder {
border: 2px rgba(139, 139, 139, 0.4) dashed;
width: 100%;
border-radius: 15px;
padding: 50px;
}
.qrIcon {
opacity: 0.3;
}
.codeBlock code {
flex: 1;
}
.codeBlock span {
background-color: transparent !important;
overflow: scroll;
}
.navLink {
transition: ease-in-out .2s opacity;
}
.navLink:hover {
opacity: 0.6;
}
select {
background-color: rgba(139, 139, 139, 0.2);
background-image: url(/icons/arrow-down-icon.svg);
background-size: 15px 15px;
background-position: right 10px center;
background-repeat: no-repeat;
padding: 5px 30px 6px 10px;
border-radius: 10px;
cursor: pointer;
border: none;
appearance: none;
transition: .2s ease-in-out background-color;
font-family: var(--nextui-fonts-sans);
font-weight: var(--nextui-fontWeights-light);
border: 1px solid rgba(139, 139, 139, 0.25);
}
select:hover {
background-color: rgba(139, 139, 139, 0.35);
}
i {
margin-top: -5px !important;
}
@@ -0,0 +1,4 @@
<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1,3 @@
<svg width="388" height="238" viewBox="0 0 388 238" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M79.4993 46.539C142.716 -15.355 245.209 -15.355 308.426 46.539L316.034 53.988C319.195 57.0827 319.195 62.1002 316.034 65.1949L290.008 90.6766C288.427 92.2239 285.865 92.2239 284.285 90.6766L273.815 80.4258C229.714 37.247 158.211 37.247 114.11 80.4258L102.898 91.4035C101.317 92.9509 98.7551 92.9509 97.1747 91.4035L71.1486 65.9219C67.9878 62.8272 67.9878 57.8096 71.1486 54.715L79.4993 46.539ZM362.25 99.2378L385.413 121.917C388.574 125.011 388.574 130.029 385.413 133.123L280.969 235.385C277.808 238.48 272.683 238.48 269.522 235.385C269.522 235.385 269.522 235.385 269.522 235.385L195.394 162.807C194.604 162.033 193.322 162.033 192.532 162.807C192.532 162.807 192.532 162.807 192.532 162.807L118.405 235.385C115.244 238.48 110.12 238.48 106.959 235.385C106.959 235.385 106.959 235.385 106.959 235.385L2.51129 133.122C-0.649517 130.027 -0.649517 125.01 2.51129 121.915L25.6746 99.2365C28.8354 96.1418 33.9601 96.1418 37.1209 99.2365L111.25 171.816C112.041 172.589 113.322 172.589 114.112 171.816C114.112 171.816 114.112 171.815 114.112 171.815L188.238 99.2365C191.399 96.1417 196.523 96.1416 199.684 99.2362C199.684 99.2362 199.684 99.2363 199.684 99.2363L273.814 171.815C274.604 172.589 275.885 172.589 276.675 171.815L350.804 99.2378C353.964 96.1431 359.089 96.1431 362.25 99.2378Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,51 @@
import ChainCard from '@/components/ChainCard'
import { truncate } from '@/utils/HelperUtil'
import { Avatar, Button, Text, Tooltip } from '@nextui-org/react'
import Image from 'next/image'
import { useState } from 'react'
interface Props {
name: string
logo: string
rgb: string
address: string
}
export default function AccountCard({ name, logo, rgb, address }: Props) {
const [copied, setCopied] = useState(false)
function onCopy() {
navigator?.clipboard?.writeText(address)
setCopied(true)
setTimeout(() => setCopied(false), 1500)
}
return (
<ChainCard rgb={rgb} flexDirection="row" alignItems="center">
<Avatar src={logo} />
<div style={{ flex: 1 }}>
<Text h5 css={{ marginLeft: '$9' }}>
{name}
</Text>
<Text weight="light" size={13} css={{ marginLeft: '$9' }}>
{truncate(address, 19)}
</Text>
</div>
<Tooltip content={copied ? 'Copied!' : 'Copy'} placement="left">
<Button
size="sm"
css={{ minWidth: 'auto', backgroundColor: 'rgba(255, 255, 255, 0.15)' }}
onClick={onCopy}
>
<Image
src={copied ? '/icons/checkmark-icon.svg' : '/icons/copy-icon.svg'}
width={15}
height={15}
alt="copy icon"
/>
</Button>
</Tooltip>
</ChainCard>
)
}
@@ -0,0 +1,20 @@
import SettingsStore from '@/store/SettingsStore'
import { eip155Addresses } from '@/utils/EIP155WalletUtil'
import { useSnapshot } from 'valtio'
export default function AccountPicker() {
const { account } = useSnapshot(SettingsStore.state)
function onSelect(value: string) {
const account = Number(value)
SettingsStore.setAccount(account)
SettingsStore.setEIP155Address(eip155Addresses[account])
}
return (
<select value={account} onChange={e => onSelect(e.currentTarget.value)} aria-label="addresses">
<option value={0}>Account 1</option>
<option value={1}>Account 2</option>
</select>
)
}
@@ -0,0 +1,35 @@
import { truncate } from '@/utils/HelperUtil'
import { Card, Checkbox, Row, Text } from '@nextui-org/react'
/**
* Types
*/
interface IProps {
address: string
index: number
selected: boolean
onSelect: () => void
}
/**
* Component
*/
export default function AccountSelectCard({ address, selected, index, onSelect }: IProps) {
return (
<Card
onClick={onSelect}
clickable
key={address}
css={{
marginTop: '$5',
backgroundColor: selected ? 'rgba(23, 200, 100, 0.2)' : '$accents2'
}}
>
<Row justify="space-between" align="center">
<Checkbox size="lg" color="success" checked={selected} />
<Text>{`${truncate(address, 14)} - Account ${index + 1}`} </Text>
</Row>
</Card>
)
}
@@ -0,0 +1,36 @@
import { Card } from '@nextui-org/react'
import { ReactNode } from 'react'
interface Props {
children: ReactNode | ReactNode[]
rgb: string
flexDirection: 'row' | 'col'
alignItems: 'center' | 'flex-start'
}
export default function ChainCard({ rgb, children, flexDirection, alignItems }: Props) {
return (
<Card
bordered
borderWeight="light"
css={{
borderColor: `rgba(${rgb}, 0.4)`,
boxShadow: `0 0 10px 0 rgba(${rgb}, 0.15)`,
backgroundColor: `rgba(${rgb}, 0.25)`,
marginBottom: '$6',
minHeight: '70px'
}}
>
<Card.Body
css={{
flexDirection,
alignItems,
justifyContent: 'space-between',
overflow: 'hidden'
}}
>
{children}
</Card.Body>
</Card>
)
}
@@ -0,0 +1,89 @@
import Navigation from '@/components/Navigation'
import RouteTransition from '@/components/RouteTransition'
import { Card, Container, Loading } from '@nextui-org/react'
import { Fragment, ReactNode } from 'react'
/**
* Types
*/
interface Props {
initialized: boolean
children: ReactNode | ReactNode[]
}
/**
* Container
*/
export default function Layout({ children, initialized }: Props) {
return (
<Container
display="flex"
justify="center"
alignItems="center"
css={{
width: '100vw',
height: '100vh',
paddingLeft: 0,
paddingRight: 0
}}
>
<Card
bordered={{ '@initial': false, '@xs': true }}
borderWeight={{ '@initial': 'light', '@xs': 'light' }}
css={{
height: '100%',
width: '100%',
justifyContent: initialized ? 'normal' : 'center',
alignItems: initialized ? 'normal' : 'center',
borderRadius: 0,
paddingBottom: 5,
'@xs': {
borderRadius: '$lg',
height: '95vh',
maxWidth: '450px'
}
}}
>
{initialized ? (
<Fragment>
<RouteTransition>
<Card.Body
css={{
display: 'block',
paddingLeft: 2,
paddingRight: 2,
paddingBottom: '40px',
'@xs': {
padding: '20px',
paddingBottom: '40px'
}
}}
>
{children}
</Card.Body>
</RouteTransition>
<Card.Footer
css={{
height: '85px',
minHeight: '85px',
position: 'sticky',
justifyContent: 'flex-end',
alignItems: 'flex-end',
boxShadow: '0 -30px 20px #111111',
backgroundColor: '#111111',
zIndex: 200,
bottom: 0,
left: 0
}}
>
<Navigation />
</Card.Footer>
</Fragment>
) : (
<Loading />
)}
</Card>
</Container>
)
}
@@ -0,0 +1,16 @@
import ModalStore from '@/store/ModalStore'
import AuthenticationRequestModal from '@/views/AuthenticationRequestModal'
import PushRequestModal from '@/views/PushRequestModal'
import { Modal as NextModal } from '@nextui-org/react'
import { useSnapshot } from 'valtio'
export default function Modal() {
const { open, view } = useSnapshot(ModalStore.state)
return (
<NextModal blur open={open} style={{ border: '1px solid rgba(139, 139, 139, 0.4)' }}>
{view === 'AuthenticationRequest' && <AuthenticationRequestModal />}
{view === 'PushRequest' && <PushRequestModal />}
</NextModal>
)
}
@@ -0,0 +1,56 @@
import { Avatar, Row } from '@nextui-org/react'
import Image from 'next/image'
import Link from 'next/link'
export default function Navigation() {
return (
<Row justify="space-between" align="center">
<Link href="/" passHref>
<a className="navLink">
<Image alt="accounts icon" src="/icons/accounts-icon.svg" width={27} height={27} />
</a>
</Link>
<Link href="/pairings" passHref>
<a className="navLink">
<Image alt="pairings icon" src="/icons/pairings-icon.svg" width={25} height={25} />
</a>
</Link>
<Link href="/settings" passHref>
<a className="navLink">
<Image alt="settings icon" src="/icons/settings-icon.svg" width={27} height={27} />
</a>
</Link>
<Link href="/notifications" passHref>
<a className="navLink">
<Image
alt="notifications icon"
src="/icons/notification-icon.svg"
width={25}
height={25}
/>
</a>
</Link>
<Link href="/walletconnect" passHref>
<a className="navLink">
<Avatar
size="lg"
css={{ cursor: 'pointer' }}
color="gradient"
icon={
<Image
alt="wallet connect icon"
src="/wallet-connect-logo.svg"
width={30}
height={30}
/>
}
/>
</a>
</Link>
</Row>
)
}
@@ -0,0 +1,75 @@
import { truncate } from '@/utils/HelperUtil'
import { Avatar, Button, Card, Link, Text, Tooltip } from '@nextui-org/react'
import Image from 'next/image'
/**
* Types
*/
interface IProps {
logo?: string
title?: string
body?: string
url?: string
publishedAt?: number
onDelete: () => Promise<void>
}
/**
* Component
*/
export default function NotificationItem({
logo,
title,
body,
url,
publishedAt,
onDelete
}: IProps) {
return (
<Card
bordered
borderWeight="light"
css={{
position: 'relative',
marginBottom: '$6',
minHeight: '70px'
}}
>
<Card.Body
css={{
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
overflow: 'hidden'
}}
>
<Avatar src={logo} />
<div style={{ flex: 1 }}>
<Text h5 css={{ marginLeft: '$9' }}>
{title}
</Text>
{/* <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
</div> */}
<Text h6 css={{ marginLeft: '$9' }}>
{body}
</Text>
{publishedAt && (
<Text span css={{ marginLeft: '$9', fontSize: '12px' }}>
{new Date(publishedAt).toLocaleDateString()} -{' '}
{new Date(publishedAt).toLocaleTimeString()}
</Text>
)}
<Link href={url} css={{ marginLeft: '$9' }} target="_blank" rel="noopener noreferrer">
{url}
</Link>
</div>
<Tooltip content="Delete" placement="left">
<Button size="sm" color="error" flat onClick={onDelete} css={{ minWidth: 'auto' }}>
<Image src={'/icons/delete-icon.svg'} width={15} height={15} alt="delete icon" />
</Button>
</Tooltip>
</Card.Body>
</Card>
)
}
@@ -0,0 +1,36 @@
import { Col, Divider, Row, Text } from '@nextui-org/react'
import { Fragment, ReactNode } from 'react'
/**
* Types
*/
interface Props {
children?: ReactNode | ReactNode[]
title: string
}
/**
* Component
*/
export default function PageHeader({ title, children }: Props) {
return (
<Fragment>
<Row css={{ marginBottom: '$5', width: '100%' }} justify="space-between" align="center">
<Col>
<Text
h3
weight="bold"
css={{
textGradient: '90deg, $secondary, $primary 30%'
}}
>
{title}
</Text>
</Col>
{children ? <Col css={{ flex: 1 }}>{children}</Col> : null}
</Row>
<Divider css={{ marginBottom: '$10' }} />
</Fragment>
)
}
@@ -0,0 +1,54 @@
import { truncate } from '@/utils/HelperUtil'
import { Avatar, Button, Card, Link, Text, Tooltip } from '@nextui-org/react'
import Image from 'next/image'
/**
* Types
*/
interface IProps {
logo?: string
name?: string
url?: string
onDelete: () => Promise<void>
}
/**
* Component
*/
export default function PairingCard({ logo, name, url, onDelete }: IProps) {
return (
<Card
bordered
borderWeight="light"
css={{
position: 'relative',
marginBottom: '$6',
minHeight: '70px'
}}
>
<Card.Body
css={{
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
overflow: 'hidden'
}}
>
<Avatar src={logo} />
<div style={{ flex: 1 }}>
<Text h5 css={{ marginLeft: '$9' }}>
{name}
</Text>
<Link href={url} css={{ marginLeft: '$9' }}>
{truncate(url?.split('https://')[1] ?? 'Unknown', 23)}
</Link>
</div>
<Tooltip content="Delete" placement="left">
<Button size="sm" color="error" flat onClick={onDelete} css={{ minWidth: 'auto' }}>
<Image src={'/icons/delete-icon.svg'} width={15} height={15} alt="delete icon" />
</Button>
</Tooltip>
</Card.Body>
</Card>
)
}
@@ -0,0 +1,77 @@
import { Button, Loading } from '@nextui-org/react'
import dynamic from 'next/dynamic'
import Image from 'next/image'
import { Fragment, useState } from 'react'
/**
* You can use normal import if you are not within next / ssr environment
* @info https://nextjs.org/docs/advanced-features/dynamic-import
*/
const ReactQrReader = dynamic(() => import('react-qr-reader-es6'), { ssr: false })
/**
* Types
*/
interface IProps {
onConnect: (uri: string) => Promise<void>
}
/**
* Component
*/
export default function QrReader({ onConnect }: IProps) {
const [show, setShow] = useState(false)
const [loading, setLoading] = useState(false)
function onError() {
setShow(false)
}
async function onScan(data: string | null) {
if (data) {
await onConnect(data)
setShow(false)
}
}
function onShowScanner() {
setLoading(true)
setShow(true)
}
return (
<div className="container">
{show ? (
<Fragment>
{loading && <Loading css={{ position: 'absolute' }} />}
<div className="qrVideoMask">
<ReactQrReader
onLoad={() => setLoading(false)}
showViewFinder={false}
onError={onError}
onScan={onScan}
style={{ width: '100%' }}
/>
</div>
</Fragment>
) : (
<div className="container qrPlaceholder">
<Image
src="/icons/qr-icon.svg"
width={100}
height={100}
alt="qr code icon"
className="qrIcon"
/>
<Button
color="gradient"
css={{ marginTop: '$10', width: '100%' }}
onClick={onShowScanner}
>
Scan QR code
</Button>
</div>
)}
</div>
)
}
@@ -0,0 +1,28 @@
import { Col, Row, Text } from '@nextui-org/react'
import { CodeBlock, codepen } from 'react-code-blocks'
/**
* Types
*/
interface IProps {
data: Record<string, unknown>
}
/**
* Component
*/
export default function RequestDataCard({ data }: IProps) {
return (
<Row>
<Col>
<Text h5>Data</Text>
<CodeBlock
showLineNumbers={false}
text={JSON.stringify(data, null, 2)}
theme={codepen}
language="json"
/>
</Col>
</Row>
)
}
@@ -0,0 +1,38 @@
import { EIP155_CHAINS, TEIP155Chain } from '@/data/EIP155Data'
import { Col, Divider, Row, Text } from '@nextui-org/react'
import { Fragment } from 'react'
/**
* Types
*/
interface IProps {
chains: string[]
protocol: string
}
/**
* Component
*/
export default function RequesDetailsCard({ chains, protocol }: IProps) {
return (
<Fragment>
<Row>
<Col>
<Text h5>Blockchain(s)</Text>
<Text color="$gray400">
{chains.map(chain => EIP155_CHAINS[chain as TEIP155Chain]?.name ?? chain).join(', ')}
</Text>
</Col>
</Row>
<Divider y={2} />
<Row>
<Col>
<Text h5>Relay Protocol</Text>
<Text color="$gray400">{protocol}</Text>
</Col>
</Row>
</Fragment>
)
}
@@ -0,0 +1,22 @@
import { Col, Row, Text } from '@nextui-org/react'
/**
* Types
*/
interface IProps {
methods: string[]
}
/**
* Component
*/
export default function RequestMethodCard({ methods }: IProps) {
return (
<Row>
<Col>
<Text h5>Methods</Text>
<Text color="$gray400">{methods.map(method => method).join(', ')}</Text>
</Col>
</Row>
)
}
@@ -0,0 +1,27 @@
import { Container, Modal, Text } from '@nextui-org/react'
import { Fragment, ReactNode } from 'react'
/**
* Types
*/
interface IProps {
title: string
children: ReactNode | ReactNode[]
}
/**
* Component
*/
export default function RequestModalContainer({ children, title }: IProps) {
return (
<Fragment>
<Modal.Header>
<Text h3>{title}</Text>
</Modal.Header>
<Modal.Body>
<Container css={{ padding: 0 }}>{children}</Container>
</Modal.Body>
</Fragment>
)
}
@@ -0,0 +1,32 @@
import { AnimatePresence, motion } from 'framer-motion'
import { useRouter } from 'next/router'
import { ReactNode } from 'react'
/**
* Types
*/
interface IProps {
children: ReactNode | ReactNode[]
}
/**
* Components
*/
export default function RouteTransition({ children }: IProps) {
const { pathname } = useRouter()
return (
<AnimatePresence exitBeforeEnter>
<motion.div
className="routeTransition"
key={pathname}
initial={{ opacity: 0, translateY: 7 }}
animate={{ opacity: 1, translateY: 0 }}
exit={{ opacity: 0, translateY: 7 }}
transition={{ duration: 0.18 }}
>
{children}
</motion.div>
</AnimatePresence>
)
}
@@ -0,0 +1,62 @@
/**
* @desc Refference list of eip155 chains
* @url https://chainlist.org
*/
/**
* Types
*/
export type TEIP155Chain = keyof typeof EIP155_CHAINS
/**
* Chains
*/
export const EIP155_MAINNET_CHAINS = {
'eip155:1': {
chainId: 1,
name: 'Ethereum',
logo: '/chain-logos/eip155-1.png',
rgb: '99, 125, 234',
rpc: 'https://cloudflare-eth.com/'
}
}
export const EIP155_TEST_CHAINS = {
'eip155:42': {
chainId: 42,
name: 'Ethereum Kovan',
logo: '/chain-logos/eip155-1.png',
rgb: '99, 125, 234',
rpc: 'https://kovan.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161'
},
'eip155:43113': {
chainId: 43113,
name: 'Avalanche Fuji',
logo: '/chain-logos/eip155-43113.png',
rgb: '232, 65, 66',
rpc: 'https://api.avax-test.network/ext/bc/C/rpc'
},
'eip155:80001': {
chainId: 80001,
name: 'Polygon Mumbai',
logo: '/chain-logos/eip155-137.png',
rgb: '130, 71, 229',
rpc: 'https://matic-mumbai.chainstacklabs.com'
}
}
export const EIP155_CHAINS = { ...EIP155_MAINNET_CHAINS, ...EIP155_TEST_CHAINS }
/**
* Methods
*/
export const EIP155_SIGNING_METHODS = {
PERSONAL_SIGN: 'personal_sign',
ETH_SIGN: 'eth_sign',
ETH_SIGN_TRANSACTION: 'eth_signTransaction',
ETH_SIGN_TYPED_DATA: 'eth_signTypedData',
ETH_SIGN_TYPED_DATA_V3: 'eth_signTypedData_v3',
ETH_SIGN_TYPED_DATA_V4: 'eth_signTypedData_v4',
ETH_SEND_RAW_TRANSACTION: 'eth_sendRawTransaction',
ETH_SEND_TRANSACTION: 'eth_sendTransaction'
}
@@ -0,0 +1,28 @@
import SettingsStore from '@/store/SettingsStore'
import { createOrRestoreEIP155Wallet } from '@/utils/EIP155WalletUtil'
import { createAuthClient, createPushClient } from '@/utils/WalletConnectUtil'
import { useCallback, useEffect, useState } from 'react'
export default function useInitialization() {
const [initialized, setInitialized] = useState(false)
const onInitialize = useCallback(async () => {
try {
const { eip155Addresses } = createOrRestoreEIP155Wallet()
SettingsStore.setEIP155Address(eip155Addresses[0])
await createAuthClient()
await createPushClient()
setInitialized(true)
} catch (err: unknown) {
alert(err)
}
}, [])
useEffect(() => {
if (!initialized) {
onInitialize()
}
}, [initialized, onInitialize])
return initialized
}
@@ -0,0 +1,37 @@
import ModalStore from '@/store/ModalStore'
import { authClient, pushClient } from '@/utils/WalletConnectUtil'
import { useEffect } from 'react'
export default function useWalletConnectEventsManager(initialized: boolean) {
/******************************************************************************
* Set up WalletConnect event listeners
*****************************************************************************/
useEffect(() => {
if (initialized) {
authClient.on('auth_request', ({ id, params, verifyContext }) => {
console.log('auth_request', { id, params, verifyContext })
ModalStore.open('AuthenticationRequest', {
authenticationRequest: {
id,
params,
verifyContext
}
})
})
}
if (pushClient) {
// Push client events
pushClient.on('push_proposal', async ({ id, topic, params }) => {
console.log('push_proposal', { id, topic, params })
ModalStore.open('PushRequest', {
pushRequest: {
id,
topic,
params
}
})
})
}
}, [initialized])
}
@@ -0,0 +1,49 @@
import { providers, Wallet } from 'ethers'
/**
* Types
*/
interface IInitArgs {
mnemonic?: string
}
/**
* Library
*/
export default class EIP155Lib {
wallet: Wallet
constructor(wallet: Wallet) {
this.wallet = wallet
}
static init({ mnemonic }: IInitArgs) {
const wallet = mnemonic ? Wallet.fromMnemonic(mnemonic) : Wallet.createRandom()
return new EIP155Lib(wallet)
}
getMnemonic() {
return this.wallet.mnemonic.phrase
}
getAddress() {
return this.wallet.address
}
signMessage(message: string) {
return this.wallet.signMessage(message)
}
_signTypedData(domain: any, types: any, data: any) {
return this.wallet._signTypedData(domain, types, data)
}
connect(provider: providers.JsonRpcProvider) {
return this.wallet.connect(provider)
}
signTransaction(transaction: providers.TransactionRequest) {
return this.wallet.signTransaction(transaction)
}
}
@@ -0,0 +1,25 @@
import Layout from '@/components/Layout'
import Modal from '@/components/Modal'
import useInitialization from '@/hooks/useInitialization'
import useWalletConnectEventsManager from '@/hooks/useWalletConnectEventsManager'
import { createTheme, NextUIProvider } from '@nextui-org/react'
import { AppProps } from 'next/app'
import '../../public/main.css'
export default function App({ Component, pageProps }: AppProps) {
// Step 1 - Initialize wallets and wallet connect client
const initialized = useInitialization()
// Step 2 - Once initialized, set up wallet connect event manager
useWalletConnectEventsManager(initialized)
return (
<NextUIProvider theme={createTheme({ type: 'dark' })}>
<Layout initialized={initialized}>
<Component {...pageProps} />
</Layout>
<Modal />
</NextUIProvider>
)
}
@@ -0,0 +1,39 @@
import AccountCard from '@/components/AccountCard'
import AccountPicker from '@/components/AccountPicker'
import PageHeader from '@/components/PageHeader'
import { EIP155_MAINNET_CHAINS, EIP155_TEST_CHAINS } from '@/data/EIP155Data'
import SettingsStore from '@/store/SettingsStore'
import { Text } from '@nextui-org/react'
import { Fragment } from 'react'
import { useSnapshot } from 'valtio'
export default function HomePage() {
const { testNets, eip155Address, cosmosAddress, solanaAddress, polkadotAddress } = useSnapshot(
SettingsStore.state
)
return (
<Fragment>
<PageHeader title="Accounts">
<AccountPicker />
</PageHeader>
<Text h4 css={{ marginBottom: '$5' }}>
Mainnets
</Text>
{Object.values(EIP155_MAINNET_CHAINS).map(({ name, logo, rgb }) => (
<AccountCard key={name} name={name} logo={logo} rgb={rgb} address={eip155Address} />
))}
{testNets ? (
<Fragment>
<Text h4 css={{ marginBottom: '$5' }}>
Testnets
</Text>
{Object.values(EIP155_TEST_CHAINS).map(({ name, logo, rgb }) => (
<AccountCard key={name} name={name} logo={logo} rgb={rgb} address={eip155Address} />
))}
</Fragment>
) : null}
</Fragment>
)
}
@@ -0,0 +1,103 @@
import NotificationItem from '@/components/NotificationItem'
import PageHeader from '@/components/PageHeader'
import { getAndFormatNotifications, pushClient } from '@/utils/WalletConnectUtil'
import { Text, Collapse, Grid, Avatar, Button } from '@nextui-org/react'
import { PushClientTypes } from '@walletconnect/push-client'
import Image from 'next/image'
import { Fragment, useCallback, useEffect, useState } from 'react'
export default function NotificationsPage() {
const [notifications, setNotifications] = useState<
{
subscription: PushClientTypes.PushSubscription
messages: PushClientTypes.PushMessageRecord[]
}[]
>([])
const handleDeleteNotification = useCallback(async (messageId: number) => {
pushClient.deletePushMessage({ id: messageId })
const formattedNotifications = getAndFormatNotifications()
setNotifications(formattedNotifications)
}, [])
const handleDeleteSubscription = useCallback(async (topic: string) => {
await pushClient.deleteSubscription({ topic })
const formattedNotifications = getAndFormatNotifications()
setNotifications(formattedNotifications)
}, [])
useEffect(() => {
pushClient.on('push_message', () => {
const formattedNotifications = getAndFormatNotifications()
setNotifications(formattedNotifications)
})
}, [])
// Get notifications for the initial state
useEffect(() => {
const formattedNotifications = getAndFormatNotifications()
setNotifications(formattedNotifications)
}, [])
return (
<Fragment>
<PageHeader title="Notifications" />
<Grid.Container gap={2}>
<Grid>
<Collapse.Group shadow>
{notifications.map(notification => (
<Collapse
key={notification.subscription.topic}
title={<Text h4>{notification.subscription.metadata.name}</Text>}
subtitle={notification.subscription.metadata.description}
contentLeft={
<Avatar
size="lg"
src={notification.subscription.metadata.icons[0]}
color="secondary"
bordered
squared
/>
}
>
<Button
bordered
css={{
width: '100%',
marginBottom: '$6'
}}
color="error"
auto
onClick={() => handleDeleteSubscription(notification.subscription.topic)}
>
<Image src={'/icons/delete-icon.svg'} width={15} height={15} alt="delete icon" />
Delete subscription
</Button>
{notification.messages.length ? (
notification.messages
.sort((a, b) => b.publishedAt - a.publishedAt)
.map(({ id, message, publishedAt }) => (
<NotificationItem
key={id}
logo={message.icon}
url={message.url}
title={message.title}
body={message.body}
publishedAt={publishedAt}
onDelete={() => handleDeleteNotification(id)}
/>
))
) : (
<Text css={{ opacity: '0.5', textAlign: 'center', marginTop: '$6' }}>
No notifications
</Text>
)}
</Collapse>
))}
</Collapse.Group>
</Grid>
</Grid.Container>
</Fragment>
)
}
@@ -0,0 +1,39 @@
import PageHeader from '@/components/PageHeader'
import PairingCard from '@/components/PairingCard'
import { authClient } from '@/utils/WalletConnectUtil'
import { Text } from '@nextui-org/react'
import { getSdkError } from '@walletconnect/utils'
import { Fragment, useState } from 'react'
export default function PairingsPage() {
const [pairings, setPairings] = useState(authClient.core.pairing.getPairings())
async function onDelete(topic: string) {
// await authClient.disconnect({ topic, reason: getSdkError('USER_DISCONNECTED') })
const newPairings = pairings.filter(pairing => pairing.topic !== topic)
setPairings(newPairings)
}
return (
<Fragment>
<PageHeader title="Pairings" />
{pairings.length ? (
pairings.map(pairing => {
const { peerMetadata } = pairing
return (
<PairingCard
key={pairing.topic}
logo={peerMetadata?.icons[0]}
url={peerMetadata?.url}
name={peerMetadata?.name}
onDelete={() => onDelete(pairing.topic)}
/>
)
})
) : (
<Text css={{ opacity: '0.5', textAlign: 'center', marginTop: '$20' }}>No pairings</Text>
)}
</Fragment>
)
}
@@ -0,0 +1,53 @@
import PageHeader from '@/components/PageHeader'
import SettingsStore from '@/store/SettingsStore'
import { eip155Wallets } from '@/utils/EIP155WalletUtil'
import { Card, Divider, Row, Switch, Text } from '@nextui-org/react'
import { Fragment } from 'react'
import { useSnapshot } from 'valtio'
import packageJSON from '../../package.json'
export default function SettingsPage() {
const { testNets, eip155Address, cosmosAddress, solanaAddress } = useSnapshot(SettingsStore.state)
return (
<Fragment>
<PageHeader title="Settings" />
<Text h4 css={{ marginBottom: '$5' }}>
Packages
</Text>
<Row justify="space-between" align="center">
<Text color="$gray400">@walletconnect/utils</Text>
<Text color="$gray400">{packageJSON.dependencies['@walletconnect/utils']}</Text>
</Row>
<Row justify="space-between" align="center">
<Text color="$gray400">@walletconnect/types</Text>
<Text color="$gray400">{packageJSON.devDependencies['@walletconnect/types']}</Text>
</Row>
<Divider y={2} />
<Text h4 css={{ marginBottom: '$5' }}>
Testnets
</Text>
<Row justify="space-between" align="center">
<Switch checked={testNets} onChange={SettingsStore.toggleTestNets} />
<Text>{testNets ? 'Enabled' : 'Disabled'}</Text>
</Row>
<Divider y={2} />
<Text css={{ color: '$yellow500', marginBottom: '$5', textAlign: 'left', padding: 0 }}>
Warning: mnemonics and secret keys are provided for development purposes only and should not
be used elsewhere!
</Text>
<Text h4 css={{ marginTop: '$5', marginBottom: '$5' }}>
EIP155 Mnemonic
</Text>
<Card bordered borderWeight="light" css={{ minHeight: '100px' }}>
<Text css={{ fontFamily: '$mono' }}>{eip155Wallets[eip155Address].getMnemonic()}</Text>
</Card>
</Fragment>
)
}
@@ -0,0 +1,54 @@
import PageHeader from '@/components/PageHeader'
import QrReader from '@/components/QrReader'
import { authClient } from '@/utils/WalletConnectUtil'
import { Button, Input, Loading, Text } from '@nextui-org/react'
import { Fragment, useState } from 'react'
export default function WalletConnectPage() {
const [uri, setUri] = useState('')
const [loading, setLoading] = useState(false)
async function onConnect(uri: string) {
try {
setLoading(true)
await authClient.core.pairing.pair({ uri })
} catch (err: unknown) {
alert(err)
} finally {
setUri('')
setLoading(false)
}
}
return (
<Fragment>
<PageHeader title="WalletConnect" />
<QrReader onConnect={onConnect} />
<Text size={13} css={{ textAlign: 'center', marginTop: '$10', marginBottom: '$10' }}>
or use walletconnect uri
</Text>
<Input
css={{ width: '100%' }}
bordered
aria-label="wc url connect input"
placeholder="e.g. wc:a281567bb3e4..."
onChange={e => setUri(e.target.value)}
value={uri}
contentRight={
<Button
size="xs"
disabled={!uri}
css={{ marginLeft: -60 }}
onClick={() => onConnect(uri)}
color="gradient"
>
{loading ? <Loading size="sm" /> : 'Connect'}
</Button>
}
/>
</Fragment>
)
}
@@ -0,0 +1,41 @@
import { proxy } from 'valtio'
/**
* Types
*/
interface ModalData {
authenticationRequest?: any
pushRequest?: any
}
interface State {
open: boolean
view?: 'AuthenticationRequest' | 'PushRequest'
data?: ModalData
}
/**
* State
*/
const state = proxy<State>({
open: false
})
/**
* Store / Actions
*/
const ModalStore = {
state,
open(view: State['view'], data: State['data']) {
state.view = view
state.data = data
state.open = true
},
close() {
state.open = false
}
}
export default ModalStore
@@ -0,0 +1,63 @@
import { proxy } from 'valtio'
/**
* Types
*/
interface State {
testNets: boolean
account: number
eip155Address: string
cosmosAddress: string
solanaAddress: string
polkadotAddress: string
}
/**
* State
*/
const state = proxy<State>({
testNets: typeof localStorage !== 'undefined' ? Boolean(localStorage.getItem('TEST_NETS')) : true,
account: 0,
eip155Address: '',
cosmosAddress: '',
solanaAddress: '',
polkadotAddress: ''
})
/**
* Store / Actions
*/
const SettingsStore = {
state,
setAccount(value: number) {
state.account = value
},
setEIP155Address(eip155Address: string) {
state.eip155Address = eip155Address
},
setCosmosAddress(cosmosAddresses: string) {
state.cosmosAddress = cosmosAddresses
},
setSolanaAddress(solanaAddress: string) {
state.solanaAddress = solanaAddress
},
setPolkadotAddress(polkadotAddress: string) {
state.polkadotAddress = polkadotAddress
},
toggleTestNets() {
state.testNets = !state.testNets
if (state.testNets) {
localStorage.setItem('TEST_NETS', 'YES')
} else {
localStorage.removeItem('TEST_NETS')
}
}
}
export default SettingsStore
@@ -0,0 +1,57 @@
import { EIP155_CHAINS, EIP155_SIGNING_METHODS, TEIP155Chain } from '@/data/EIP155Data'
import { eip155Addresses, eip155Wallets } from '@/utils/EIP155WalletUtil'
import {
getSignParamsMessage,
getSignTypedDataParamsData,
getWalletAddressFromParams
} from '@/utils/HelperUtil'
import { formatJsonRpcError, formatJsonRpcResult } from '@json-rpc-tools/utils'
import { SignClientTypes } from '@walletconnect/types'
import { getSdkError } from '@walletconnect/utils'
import { providers } from 'ethers'
export async function approveEIP155Request(
requestEvent: SignClientTypes.EventArguments['session_request']
) {
const { params, id } = requestEvent
const { chainId, request } = params
const wallet = eip155Wallets[getWalletAddressFromParams(eip155Addresses, params)]
switch (request.method) {
case EIP155_SIGNING_METHODS.PERSONAL_SIGN:
case EIP155_SIGNING_METHODS.ETH_SIGN:
const message = getSignParamsMessage(request.params)
const signedMessage = await wallet.signMessage(message)
return formatJsonRpcResult(id, signedMessage)
case EIP155_SIGNING_METHODS.ETH_SIGN_TYPED_DATA:
case EIP155_SIGNING_METHODS.ETH_SIGN_TYPED_DATA_V3:
case EIP155_SIGNING_METHODS.ETH_SIGN_TYPED_DATA_V4:
const { domain, types, message: data } = getSignTypedDataParamsData(request.params)
// https://github.com/ethers-io/ethers.js/issues/687#issuecomment-714069471
delete types.EIP712Domain
const signedData = await wallet._signTypedData(domain, types, data)
return formatJsonRpcResult(id, signedData)
case EIP155_SIGNING_METHODS.ETH_SEND_TRANSACTION:
const provider = new providers.JsonRpcProvider(EIP155_CHAINS[chainId as TEIP155Chain].rpc)
const sendTransaction = request.params[0]
const connectedWallet = wallet.connect(provider)
const { hash } = await connectedWallet.sendTransaction(sendTransaction)
return formatJsonRpcResult(id, hash)
case EIP155_SIGNING_METHODS.ETH_SIGN_TRANSACTION:
const signTransaction = request.params[0]
const signature = await wallet.signTransaction(signTransaction)
return formatJsonRpcResult(id, signature)
default:
throw new Error(getSdkError('INVALID_METHOD').message)
}
}
export function rejectEIP155Request(request: SignClientTypes.EventArguments['session_request']) {
const { id } = request
return formatJsonRpcError(id, getSdkError('USER_REJECTED_METHODS').message)
}
@@ -0,0 +1,43 @@
import EIP155Lib from '@/lib/EIP155Lib'
export let wallet1: EIP155Lib
export let wallet2: EIP155Lib
export let eip155Wallets: Record<string, EIP155Lib>
export let eip155Addresses: string[]
let address1: string
let address2: string
/**
* Utilities
*/
export function createOrRestoreEIP155Wallet() {
const mnemonic1 = localStorage.getItem('EIP155_MNEMONIC_1')
const mnemonic2 = localStorage.getItem('EIP155_MNEMONIC_2')
if (mnemonic1 && mnemonic2) {
wallet1 = EIP155Lib.init({ mnemonic: mnemonic1 })
wallet2 = EIP155Lib.init({ mnemonic: mnemonic2 })
} else {
wallet1 = EIP155Lib.init({})
wallet2 = EIP155Lib.init({})
// Don't store mnemonic in local storage in a production project!
localStorage.setItem('EIP155_MNEMONIC_1', wallet1.getMnemonic())
localStorage.setItem('EIP155_MNEMONIC_2', wallet2.getMnemonic())
}
address1 = wallet1.getAddress()
address2 = wallet2.getAddress()
eip155Wallets = {
[address1]: wallet1,
[address2]: wallet2
}
eip155Addresses = Object.keys(eip155Wallets)
return {
eip155Wallets,
eip155Addresses
}
}
@@ -0,0 +1,107 @@
import { EIP155_CHAINS, TEIP155Chain } from '@/data/EIP155Data'
import { utils } from 'ethers'
/**
* Truncates string (in the middle) via given lenght value
*/
export function truncate(value: string, length: number) {
if (value?.length <= length) {
return value
}
const separator = '...'
const stringLength = length - separator.length
const frontLength = Math.ceil(stringLength / 2)
const backLength = Math.floor(stringLength / 2)
return value.substring(0, frontLength) + separator + value.substring(value.length - backLength)
}
/**
* Converts hex to utf8 string if it is valid bytes
*/
export function convertHexToUtf8(value: string) {
if (utils.isHexString(value)) {
return utils.toUtf8String(value)
}
return value
}
/**
* Gets message from various signing request methods by filtering out
* a value that is not an address (thus is a message).
* If it is a hex string, it gets converted to utf8 string
*/
export function getSignParamsMessage(params: string[]) {
const message = params.filter(p => !utils.isAddress(p))[0]
return convertHexToUtf8(message)
}
/**
* Gets data from various signTypedData request methods by filtering out
* a value that is not an address (thus is data).
* If data is a string convert it to object
*/
export function getSignTypedDataParamsData(params: string[]) {
const data = params.filter(p => !utils.isAddress(p))[0]
if (typeof data === 'string') {
return JSON.parse(data)
}
return data
}
/**
* Get our address from params checking if params string contains one
* of our wallet addresses
*/
export function getWalletAddressFromParams(addresses: string[], params: any) {
const paramsString = JSON.stringify(params)
let address = ''
addresses.forEach(addr => {
if (paramsString.includes(addr)) {
address = addr
}
})
return address
}
/**
* Check if chain is part of EIP155 standard
*/
export function isEIP155Chain(chain: string) {
return chain.includes('eip155')
}
/**
* Check if chain is part of COSMOS standard
*/
export function isCosmosChain(chain: string) {
return chain.includes('cosmos')
}
/**
* Check if chain is part of SOLANA standard
*/
export function isSolanaChain(chain: string) {
return chain.includes('solana')
}
/**
* Check if chain is part of POLKADOT standard
*/
export function isPolkadotChain(chain: string) {
return chain.includes('polkadot')
}
/**
* Formats chainId to its name
*/
export function formatChainName(chainId: string) {
return EIP155_CHAINS[chainId as TEIP155Chain]?.name ?? chainId
}
@@ -0,0 +1,74 @@
import AuthClient from '@walletconnect/auth-client'
import pkg from '@walletconnect/auth-client/package.json'
import { Verify } from '@walletconnect/types'
import { Core } from '@walletconnect/core'
import { WalletClient } from '@walletconnect/push-client'
const core = new Core({
projectId: process.env.NEXT_PUBLIC_PROJECT_ID!
})
console.log(`AuthClient@${pkg.version}`)
export let authClient: AuthClient
export let pushClient: WalletClient
export async function createAuthClient() {
authClient = await AuthClient.init({
core,
projectId: process.env.NEXT_PUBLIC_PROJECT_ID!,
relayUrl: process.env.NEXT_PUBLIC_RELAY_URL || 'wss://relay.walletconnect.com',
metadata: {
name: 'React Wallet',
description: 'React Wallet for WalletConnect',
url: 'https://walletconnect.com/',
icons: ['https://avatars.githubusercontent.com/u/37784886']
}
})
const authClientId = await authClient.core.crypto.getClientId()
console.log({ authClientId })
}
export async function createPushClient() {
pushClient = await WalletClient.init({
logger: 'debug',
core,
projectId: process.env.NEXT_PUBLIC_PROJECT_ID!,
relayUrl: process.env.NEXT_PUBLIC_RELAY_URL || 'wss://relay.walletconnect.com'
})
const pushClientId = await pushClient.core.crypto.getClientId()
console.log({ pushClientId })
}
export const getAndFormatNotifications = () => {
if (!pushClient) {
return []
}
const activeSubscriptions = pushClient.getActiveSubscriptions()
const allMessagesWithSubscription = Object.entries(activeSubscriptions)
.map(([topic, subscription]) => ({
subscription,
messages: Object.values(
pushClient.getMessageHistory({
topic
})
)
}))
.reverse()
return allMessagesWithSubscription
}
export function getVerifyStatus(context?: Verify.Context) {
if (!context) return ''
switch (context.verified.validation) {
case 'VALID':
return '✅'
case 'INVALID':
return '❌'
case 'UNKNOWN':
return '❓'
default:
return ''
}
}
@@ -0,0 +1,93 @@
import { Fragment, useCallback, useEffect, useState } from 'react'
import RequestModalContainer from '@/components/RequestModalContainer'
import ModalStore from '@/store/ModalStore'
import { Button, Col, Modal, Row, Text } from '@nextui-org/react'
import { createOrRestoreEIP155Wallet } from '@/utils/EIP155WalletUtil'
import { authClient } from '@/utils/WalletConnectUtil'
import { getVerifyStatus } from '@/utils/WalletConnectUtil'
export default function AuthenticationRequestModal() {
const authenticationRequest = ModalStore.state.data?.authenticationRequest
const { params, id, verifyContext } = authenticationRequest
const [message, setMessage] = useState<string>()
const [iss, setIss] = useState<string>()
const { eip155Wallets, eip155Addresses } = createOrRestoreEIP155Wallet()
useEffect(() => {
if (message) return
const address = eip155Addresses[0]
const iss = `did:pkh:${params.cacaoPayload.chainId}:${address}`
setMessage(authClient.formatMessage(params.cacaoPayload, iss))
setIss(iss)
}, [params.cacaoPayload, eip155Addresses, message])
const onApprove = useCallback(async () => {
if (authenticationRequest && iss && message) {
try {
const signature = await eip155Wallets[eip155Addresses[0]].signMessage(message)
await authClient.respond(
{
id,
signature: {
s: signature,
t: 'eip191'
}
},
iss
)
} catch (onApproveError) {
console.log({ onApproveError })
} finally {
ModalStore.close()
}
}
}, [authenticationRequest, eip155Addresses, eip155Wallets, id, iss, message])
if (!authenticationRequest) {
return <Text>Missing authentication request</Text>
}
// Handle reject action
async function onReject() {
if (id && iss) {
try {
await authClient.respond(
{
id,
error: {
code: 4001,
message: 'Auth request has been rejected'
}
},
iss
)
} catch (onRejectError) {
console.log({ onRejectError })
}
}
ModalStore.close()
}
return (
<Fragment>
<RequestModalContainer title="Authentication Request">
<Row>
<Col>
<Text h5>Message {getVerifyStatus(verifyContext)}</Text>
<Text style={{ whiteSpace: 'pre-wrap' }} color="$gray400">
{message}
</Text>
</Col>
</Row>
</RequestModalContainer>
<Modal.Footer>
<Button auto flat color="error" onClick={onReject}>
Reject
</Button>
<Button auto flat color="success" onClick={onApprove}>
Approve
</Button>
</Modal.Footer>
</Fragment>
)
}
@@ -0,0 +1,71 @@
import { Fragment, useCallback, useEffect, useState } from 'react'
import RequestModalContainer from '@/components/RequestModalContainer'
import ModalStore from '@/store/ModalStore'
import { Button, Col, Link, Modal, Row, Text } from '@nextui-org/react'
import { createOrRestoreEIP155Wallet } from '@/utils/EIP155WalletUtil'
import { pushClient } from '@/utils/WalletConnectUtil'
import { getWalletAddressFromParams } from '@/utils/HelperUtil'
export default function PushRequestModal() {
const pushRequest = ModalStore.state.data?.pushRequest
const { params, id } = pushRequest
const [iss, setIss] = useState<string>()
const { eip155Wallets, eip155Addresses } = createOrRestoreEIP155Wallet()
useEffect(() => {
const iss = `did:pkh:${pushRequest.params.account}`
setIss(iss)
}, [pushRequest.params.account, eip155Addresses])
const onSign = useCallback(
async (message: string) => {
const wallet = eip155Wallets[getWalletAddressFromParams(eip155Addresses, params.account)]
const signature = await wallet.signMessage(message)
return signature
},
[eip155Wallets, eip155Addresses, params.account]
)
const onApprove = useCallback(async () => {
if (pushRequest && iss) {
await pushClient.approve({ id, onSign })
ModalStore.close()
}
}, [pushRequest, id, iss, onSign])
if (!pushRequest) {
return <Text>Missing push request</Text>
}
// Handle reject action
async function onReject() {
await pushClient.reject({ id, reason: 'User rejected push subscription request' })
ModalStore.close()
}
return (
<Fragment>
<RequestModalContainer title="Push Request">
<Row>
<Col>
<Text h5>Message</Text>
<Text style={{ whiteSpace: 'pre-wrap' }} color="$gray400">
Subscribe to{' '}
<Link href={params.metadata.url} target="_blank" rel="noopener noreferrer">
{params.metadata.url}
</Link>
</Text>
</Col>
</Row>
</RequestModalContainer>
<Modal.Footer>
<Button auto flat color="error" onClick={onReject}>
Reject
</Button>
<Button auto flat color="success" onClick={onApprove}>
Approve
</Button>
</Modal.Footer>
</Fragment>
)
}
@@ -0,0 +1,34 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}
@@ -0,0 +1,2 @@
NEXT_PUBLIC_PROJECT_ID=
NEXT_PUBLIC_RELAY_URL=wss://relay.walletconnect.com
@@ -0,0 +1,4 @@
{
"extends": "next/core-web-vitals",
"ignorePatterns": ["next.config.js"]
}
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
.DS_Store
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# vercel
.vercel
@@ -0,0 +1,9 @@
{
"arrowParens": "avoid",
"parser": "typescript",
"printWidth": 100,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"semi": false
}
+139
View File
@@ -0,0 +1,139 @@
# Wallet Example (React, Typescript, Ethers, NextJS, Cosmos)
This example aims to demonstrate basic and advanced use cases enabled by WalletConnect's Sign SDK.
**The wallet implements Sign v1 and v2 side-by-side**, to serve as a reference for wallet developers
aiming to support both major versions for backwards compatibility. **All files containing code for the legacy
v1 implementation are prefixed with `Legacy...`.**
Please only use this for reference and development purposes, otherwise you are at risk of losing your funds.
# Useful links
🔗 Live wallet app - https://react-wallet.walletconnect.com <br />
🔗 Live dapp - https://react-app.walletconnect.com <br />
📚 WalletConnect docs - https://docs.walletconnect.com/2.0
## Getting started
Example is built atop of [NextJS](https://nextjs.org/) in order to abstract complexity of setting up bundlers, routing etc. So there are few steps you need to follow in order to set everything up
1. Go to [WalletConnect Cloud](https://cloud.walletconnect.com/sign-in) and obtain a project id
2. Add your project details in [WalletConnectUtil.ts](https://github.com/WalletConnect/web-examples/blob/main/wallets/react-wallet-v2/src/utils/WalletConnectUtil.ts) file
3. Install dependencies `yarn install` or `npm install`
4. Setup your environment variables
```bash
cp .env.local.example .env.local
```
Your `.env.local` now contains the following environment variables:
- `NEXT_PUBLIC_PROJECT_ID` (placeholder) - You can generate your own ProjectId at https://cloud.walletconnect.com
- `NEXT_PUBLIC_RELAY_URL` (already set)
5. Run `yarn dev` or `npm run dev` to start local development
## Navigating through example
1. Initial setup and initializations happen in [_app.ts](https://github.com/WalletConnect/web-examples/blob/main/wallets/react-wallet-v2/src/pages/_app.tsx) file
2. WalletConnect client, ethers and cosmos wallets are initialized in [useInitialization.ts ](https://github.com/WalletConnect/web-examples/blob/main/wallets/react-wallet-v2/src/hooks/useInitialization.ts) hook
3. Subscription and handling of WalletConnect events happens in [useWalletConnectEventsManager.ts](https://github.com/WalletConnect/web-examples/blob/main/wallets/react-wallet-v2/src/hooks/useWalletConnectEventsManager.ts) hook, that opens related [Modal views](https://github.com/WalletConnect/web-examples/tree/main/wallets/react-wallet-v2/src/views) and passes them all necessary data
4. [Modal views](https://github.com/WalletConnect/web-examples/tree/main/wallets/react-wallet-v2/src/views) are responsible for data display and handling approval or rejection actions
5. Upon approval or rejection, modals pass the request data to [RequestHandlerUtil.ts](https://github.com/WalletConnect/web-examples/blob/main/wallets/react-wallet-v2/src/utils/RequestHandlerUtil.ts) that performs all necessary work based on the request method and returns formated json rpc result data that can be then used for WalletConnect client responses
## Preview of wallet and dapp examples in action
https://user-images.githubusercontent.com/3154053/156764521-3492c232-7a93-47ba-88bd-2cee3f8366d4.mp4
## DOM Tags
This section is a key of the DOM elements used for internal E2E testing
Accessible with `data-testid`
### Navbar
| Key | Description |
| ----------- | ----------- |
| `accounts` | Accounts page |
| `sessions` | Sessions page |
| `wc-connect` | WC Connect page |
| `pairings` | Pairings page |
| `settings` | Settings Page |
### WC Connect Page
url: `/walletconnect`
| Key | Description |
| ----------- | ----------- |
| `uri-input` | Uri textbox |
| `uri-connect-button` | Uri connect button |
| `qrcode-button` | Use qrcode button |
### Sessions Page
url: `/session`
| Key | Description |
| ----------- | ----------- |
| `session-card` | Session cards can be accessed by topic |
| `session-icon` | Icon used on session card |
| `session-text` | Text listed on session card |
| `session-link` | Link listed on session card |
### Session Details Page
url: `/session?topic=`
| Key | Description |
| ----------- | ----------- |
| `session-card-${chain}` | Session chain info card |
| `session-delete-button` | Session delete button |
| `session-ping-button` | Session ping button |
| `session-emit-button` | Session emit button |
| `session-update-button` | Session update button |
### Pairing Page
url: `/pairings`
| Key | Description |
| ----------- | ----------- |
| `pairing-${topic}` | Pairing cards can be accessed by topic |
| `pairing-text-${topic}` | Pairing card text in label |
| `pairing-url-${topic}` | Pairing card link in label|
| `pairing-delete-${topic}` | Delete pairing by topic |
### Accounts Page
url: `/`
| Key | Description |
| ----------- | ----------- |
| `account-picker` | Account drop down selector|
| `chain-card-${chain id}` | Chain card by chain id |
| `chain-switch-button-${chain id}` | Chain switch button |
| `chain-switch-button-${chain id}` | Chain copy button |
### Settings Page
url: `/settings`
| Key | Description |
| ----------- | ----------- |
| `settings-toggle-testnets` | Toggle testnet support on/off |
| `settings-region-select` | Select relayer region |
### Session Proposal View
| Key | Description |
| ----------- | ----------- |
| `session-approve-button` | Session approve button |
| `session-reject-button` | Session reject button |
| `session-info-card-text` | Session text info in header |
| `session-info-card-url` | Session info url in header |
| `session-info-card-verify` | Session info verify api in header |
| `session-proposal-card-req-{chain}` | Session card for each required chain |
| `session-proposal-card-opt-{chain}` | Session card for each optional chain |
| `account-select-card-${req/opt}-${index}` | Account selection checkbox by account index|
| `account-select-text-${req/opt}-${index}` | Account selection text by account index |
### Sign Request View
| Key | Description |
| ----------- | ----------- |
| `request-details-chain` | List of chains in the request |
| `request-details-relay-protocol` | Protocol used for request |
| `request-methods` | Methods requested |
| `request-button-reject` | Reject button |
| `request-button-approve` | Approve button |
+5
View File
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
@@ -0,0 +1,11 @@
module.exports = {
reactStrictMode: true,
webpack(config) {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false
}
return config
}
}
@@ -0,0 +1,60 @@
{
"name": "react-wallet-v2",
"private": true,
"scripts": {
"dev": "next dev -p 3001",
"build": "next build",
"start": "next start",
"lint": "next lint",
"prettier:write": "prettier --write '**/*.{js,ts,jsx,tsx}'"
},
"dependencies": {
"@cosmjs/amino": "0.32.0",
"@cosmjs/encoding": "0.32.0",
"@cosmjs/proto-signing": "0.32.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@json-rpc-tools/utils": "1.7.6",
"@kadena/cryptography-utils": "^0.4.0",
"@kadena/types": "^0.5.0",
"@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.3",
"@mui/icons-material": "^5.14.9",
"@mui/material": "^5.14.10",
"@multiversx/sdk-core": "12.15.0",
"@multiversx/sdk-wallet": "4.2.0",
"@near-wallet-selector/wallet-utils": "^7.0.2",
"@nextui-org/react": "1.0.8-beta.5",
"@polkadot/keyring": "^10.1.2",
"@polkadot/types": "^9.3.3",
"@solana/web3.js": "1.78.4",
"@taquito/signer": "^15.1.0",
"@taquito/taquito": "^15.1.0",
"@walletconnect/web3wallet": "1.9.5",
"borsh": "^1.0.0",
"bs58": "5.0.0",
"cosmos-wallet": "1.2.0",
"ethers": "5.7.2",
"framer-motion": "6.5.1",
"mnemonic-keyring": "1.4.0",
"near-api-js": "^0.45.0",
"next": "12.1.5",
"react": "17.0.2",
"react-code-blocks": "0.0.9-0",
"react-dom": "17.0.2",
"react-hot-toast": "^2.4.1",
"react-qr-reader-es6": "2.2.1-2",
"solana-wallet": "^1.0.2",
"tronweb": "^4.4.0",
"valtio": "1.6.0"
},
"devDependencies": {
"@types/node": "17.0.35",
"@types/react": "18.0.9",
"eslint": "8.15.0",
"eslint-config-next": "12.1.6",
"eslint-config-prettier": "8.5.0",
"prettier": "2.6.2",
"typescript": "4.6.4"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -0,0 +1,5 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 64C0 28.6538 28.6538 0 64 0H448C483.346 0 512 28.6538 512 64V448C512 483.346 483.346 512 448 512H64C28.6538 512 0 483.346 0 448V64Z" fill="#F2F2F2"/>
<path d="M160 128L32 256L160 384V288L288 192H160V128Z" fill="black"/>
<path d="M480 256L352 128V224L224 320H352V384L480 256Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

@@ -0,0 +1,4 @@
<svg width="300" height="300" viewBox="0 0 300 300" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="300" height="300" rx="150" fill="black"/>
<path d="M158.482 149.928L228.714 112.529L216.919 90L152.575 115.854C150.923 116.523 149.077 116.523 147.425 115.854L83.0814 90L71.25 112.602L141.482 150L71.25 187.398L83.0814 210L147.425 183.948C149.077 183.279 150.923 183.279 152.575 183.948L216.919 209.874L228.75 187.272L158.482 149.928Z" fill="#23F7DD"/>
</svg>

After

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

@@ -0,0 +1,9 @@
<svg width="800" height="800" viewBox="0 0 800 800" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="800" height="800" rx="400" fill="#E6007A"/>
<path d="M400.072 246.038C452.666 246.038 495.302 221.181 495.302 190.519C495.302 159.857 452.666 135 400.072 135C347.478 135 304.843 159.857 304.843 190.519C304.843 221.181 347.478 246.038 400.072 246.038Z" fill="white"/>
<path d="M400.072 664.364C452.666 664.364 495.302 639.507 495.302 608.845C495.302 578.183 452.666 553.326 400.072 553.326C347.478 553.326 304.843 578.183 304.843 608.845C304.843 639.507 347.478 664.364 400.072 664.364Z" fill="white"/>
<path d="M267.363 322.89C293.66 277.233 293.489 227.785 266.982 212.443C240.475 197.102 197.668 221.677 171.371 267.333C145.074 312.989 145.245 362.438 171.753 377.779C198.26 393.121 241.066 368.546 267.363 322.89Z" fill="white"/>
<path d="M628.731 532.027C655.028 486.371 654.872 436.931 628.382 421.6C601.893 406.269 559.101 430.852 532.804 476.508C506.507 522.165 506.663 571.605 533.153 586.936C559.643 602.267 602.434 577.684 628.731 532.027Z" fill="white"/>
<path d="M266.996 586.923C293.503 571.582 293.674 522.133 267.377 476.477C241.08 430.821 198.274 406.246 171.766 421.587C145.259 436.929 145.088 486.377 171.385 532.034C197.682 577.69 240.488 602.265 266.996 586.923Z" fill="white"/>
<path d="M628.405 377.792C654.894 362.461 655.051 313.02 628.754 267.364C602.457 221.708 559.665 197.124 533.175 212.455C506.686 227.787 506.53 277.227 532.827 322.883C559.124 368.539 601.915 393.123 628.405 377.792Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="katman_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 800 600" style="enable-background:new 0 0 800 600;" xml:space="preserve">
<style type="text/css">
.st0{fill:#2C7DF7;}
.st1{fill:#FFFFFF;}
</style>
<path class="st0" d="M399.8,559.9c143.8,0,260.3-116.6,260.3-260.3S543.6,39.2,399.8,39.2c-143.8,0-260.3,116.6-260.3,260.3
S256,559.9,399.8,559.9z"/>
<path class="st1" d="M424.8,449.1c-21.1,0-36.4-5.1-46.1-15.2c-9-8.6-14.2-20.4-14.5-32.8c-0.1-3.8,0.8-7.5,2.5-10.8
c1.7-2.9,4-5.3,6.9-6.9c3.3-1.7,7-2.5,10.8-2.5c3.7,0,7.4,0.9,10.8,2.5c2.9,1.6,5.2,4,6.9,6.9c1.8,3.3,2.7,7.1,2.6,10.8
c0.2,4.5-1.1,9-3.7,12.7c-2.2,3-5.2,5.3-8.8,6.4c3.5,4.4,8.4,7.5,13.8,8.6c6.1,1.8,12.5,2.7,18.9,2.7c8.4,0.1,16.7-2.4,23.7-7.1
c7.3-5.1,12.7-12.5,15.5-21c3.5-10.1,5.2-20.7,5.1-31.4c0.3-11.1-1.6-22.2-5.5-32.6c-3-8.3-8.6-15.5-16-20.3
c-6.9-4.4-14.9-6.6-23-6.6c-7.1,0.6-14,2.9-20,6.8l-14.8,7.4v-7.4l66.5-89.2h-92.2v92.6c-0.3,6.7,1.5,13.3,5.1,18.9
c1.7,2.5,4.1,4.4,6.8,5.7c2.7,1.3,5.7,1.9,8.7,1.7c5.5-0.1,10.9-2,15.3-5.4c5-3.6,9.3-8.1,12.8-13.2c0.3-0.9,0.9-1.7,1.7-2.2
c0.6-0.5,1.4-0.8,2.2-0.8c1.6,0.1,3.1,0.8,4.3,1.8c1.5,1.7,2.4,4,2.3,6.3c-0.2,1.6-0.5,3.1-0.8,4.6c-3.3,7.9-8.8,14.7-15.8,19.6
c-6.5,4.4-14.3,6.8-22.2,6.7c-20,0-33.8-3.9-41.5-11.8c-4-4.3-7-9.4-9-15c-2-5.5-2.8-11.4-2.5-17.3v-92.4h-46.9v-17.2H332v-39.2
l-10.8-10.8v-8.8h31.3l11.8,6.1v52.7l121.8-0.4l12.1,12.2l-74.7,75c4.5-1.8,9.3-3,14.1-3.4c9.6,0.4,18.9,3.1,27.3,7.8
c9.7,4.6,17.8,11.9,23.5,21c5.1,7.7,8.7,16.3,10.6,25.3c1.6,7.1,2.4,14.4,2.5,21.7c0,13.9-3.1,27.6-9.2,40.1
c-5.8,12.1-15.6,21.9-27.7,27.7C452.3,446,438.6,449.1,424.8,449.1L424.8,449.1z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

@@ -0,0 +1,24 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M160 368H448M160 144H448H160ZM160 256H448H160Z" stroke="url(#paint0_linear_46_13)" stroke-width="48" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M80 160C88.8366 160 96 152.837 96 144C96 135.163 88.8366 128 80 128C71.1634 128 64 135.163 64 144C64 152.837 71.1634 160 80 160Z" stroke="url(#paint1_linear_46_13)" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M80 272C88.8366 272 96 264.837 96 256C96 247.163 88.8366 240 80 240C71.1634 240 64 247.163 64 256C64 264.837 71.1634 272 80 272Z" stroke="url(#paint2_linear_46_13)" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M80 384C88.8366 384 96 376.837 96 368C96 359.163 88.8366 352 80 352C71.1634 352 64 359.163 64 368C64 376.837 71.1634 384 80 384Z" stroke="url(#paint3_linear_46_13)" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<linearGradient id="paint0_linear_46_13" x1="160" y1="144.018" x2="380.191" y2="421.745" gradientUnits="userSpaceOnUse">
<stop stop-color="#A562D5"/>
<stop offset="1" stop-color="#306FEB"/>
</linearGradient>
<linearGradient id="paint1_linear_46_13" x1="64" y1="128.003" x2="96.3014" y2="159.69" gradientUnits="userSpaceOnUse">
<stop stop-color="#A562D5"/>
<stop offset="1" stop-color="#306FEB"/>
</linearGradient>
<linearGradient id="paint2_linear_46_13" x1="64" y1="240.003" x2="96.3014" y2="271.69" gradientUnits="userSpaceOnUse">
<stop stop-color="#A562D5"/>
<stop offset="1" stop-color="#306FEB"/>
</linearGradient>
<linearGradient id="paint3_linear_46_13" x1="64" y1="352.003" x2="96.3014" y2="383.69" gradientUnits="userSpaceOnUse">
<stop stop-color="#A562D5"/>
<stop offset="1" stop-color="#306FEB"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,3 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M112 184L256 328L400 184" stroke="white" stroke-width="48" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 224 B

@@ -0,0 +1,3 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M184 112L328 256L184 400" stroke="white" stroke-width="48" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 224 B

@@ -0,0 +1,3 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M416 128L192 384L96 288" stroke="white" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 223 B

@@ -0,0 +1,4 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M336 64H368C380.73 64 392.939 69.0571 401.941 78.0589C410.943 87.0606 416 99.2696 416 112V432C416 444.73 410.943 456.939 401.941 465.941C392.939 474.943 380.73 480 368 480H144C131.27 480 119.061 474.943 110.059 465.941C101.057 456.939 96 444.73 96 432V112C96 99.2696 101.057 87.0606 110.059 78.0589C119.061 69.0571 131.27 64 144 64H176" stroke="white" stroke-width="32" stroke-linejoin="round"/>
<path d="M309.87 32H202.13C187.699 32 176 43.6988 176 58.13V69.87C176 84.3012 187.699 96 202.13 96H309.87C324.301 96 336 84.3012 336 69.87V58.13C336 43.6988 324.301 32 309.87 32Z" stroke="white" stroke-width="32" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 751 B

@@ -0,0 +1,6 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M112 112L132 432C132.95 450.49 146.4 464 164 464H348C365.67 464 378.87 450.49 380 432L400 112" stroke="#F21361" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M80 112H432Z" fill="#F21361"/>
<path d="M80 112H432" stroke="#F21361" stroke-width="32" stroke-miterlimit="10" stroke-linecap="round"/>
<path d="M328 176L320 400M192 112V72.0001C191.991 68.8458 192.605 65.7208 193.808 62.8048C195.011 59.8888 196.778 57.2394 199.009 55.0089C201.239 52.7785 203.889 51.011 206.805 49.8082C209.721 48.6053 212.846 47.9909 216 48.0001H296C299.154 47.9909 302.279 48.6053 305.195 49.8082C308.111 51.011 310.761 52.7785 312.991 55.0089C315.222 57.2394 316.989 59.8888 318.192 62.8048C319.395 65.7208 320.009 68.8458 320 72.0001V112H192ZM256 176V400V176ZM184 176L192 400L184 176Z" stroke="#F21361" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 996 B

@@ -0,0 +1,9 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M208 352H144C118.539 352 94.1212 341.886 76.1178 323.882C58.1143 305.879 48 281.461 48 256C48 230.539 58.1143 206.121 76.1178 188.118C94.1212 170.114 118.539 160 144 160H208M304 160H368C393.461 160 417.879 170.114 435.882 188.118C453.886 206.121 464 230.539 464 256C464 281.461 453.886 305.879 435.882 323.882C417.879 341.886 393.461 352 368 352H304M163.29 256H350.71" stroke="url(#paint0_linear_112_7)" stroke-width="36" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<linearGradient id="paint0_linear_112_7" x1="48.0001" y1="160.015" x2="197.341" y2="477.442" gradientUnits="userSpaceOnUse">
<stop stop-color="#A562D5"/>
<stop offset="1" stop-color="#306FEB"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 814 B

@@ -0,0 +1,13 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M408 336H344C339.582 336 336 339.582 336 344V408C336 412.418 339.582 416 344 416H408C412.418 416 416 412.418 416 408V344C416 339.582 412.418 336 408 336Z" fill="#8B8B8B"/>
<path d="M328 272H280C275.582 272 272 275.582 272 280V328C272 332.418 275.582 336 280 336H328C332.418 336 336 332.418 336 328V280C336 275.582 332.418 272 328 272Z" fill="#8B8B8B"/>
<path d="M472 416H424C419.582 416 416 419.582 416 424V472C416 476.418 419.582 480 424 480H472C476.418 480 480 476.418 480 472V424C480 419.582 476.418 416 472 416Z" fill="#8B8B8B"/>
<path d="M472 272H440C435.582 272 432 275.582 432 280V312C432 316.418 435.582 320 440 320H472C476.418 320 480 316.418 480 312V280C480 275.582 476.418 272 472 272Z" fill="#8B8B8B"/>
<path d="M312 432H280C275.582 432 272 435.582 272 440V472C272 476.418 275.582 480 280 480H312C316.418 480 320 476.418 320 472V440C320 435.582 316.418 432 312 432Z" fill="#8B8B8B"/>
<path d="M408 96H344C339.582 96 336 99.5817 336 104V168C336 172.418 339.582 176 344 176H408C412.418 176 416 172.418 416 168V104C416 99.5817 412.418 96 408 96Z" fill="#8B8B8B"/>
<path d="M448 48H304C295.163 48 288 55.1634 288 64V208C288 216.837 295.163 224 304 224H448C456.837 224 464 216.837 464 208V64C464 55.1634 456.837 48 448 48Z" stroke="#8B8B8B" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M168 96H104C99.5817 96 96 99.5817 96 104V168C96 172.418 99.5817 176 104 176H168C172.418 176 176 172.418 176 168V104C176 99.5817 172.418 96 168 96Z" fill="#8B8B8B"/>
<path d="M208 48H64C55.1634 48 48 55.1634 48 64V208C48 216.837 55.1634 224 64 224H208C216.837 224 224 216.837 224 208V64C224 55.1634 216.837 48 208 48Z" stroke="#8B8B8B" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M168 336H104C99.5817 336 96 339.582 96 344V408C96 412.418 99.5817 416 104 416H168C172.418 416 176 412.418 176 408V344C176 339.582 172.418 336 168 336Z" fill="#8B8B8B"/>
<path d="M208 288H64C55.1634 288 48 295.163 48 304V448C48 456.837 55.1634 464 64 464H208C216.837 464 224 456.837 224 448V304C224 295.163 216.837 288 208 288Z" stroke="#8B8B8B" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

@@ -0,0 +1,19 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M320 120L368 168L320 216" stroke="url(#paint0_linear_101_17)" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M352 168H144C122.802 168.063 102.491 176.512 87.5014 191.501C72.5122 206.491 64.0633 226.802 64 248V264M192 392L144 344L192 296" stroke="url(#paint1_linear_101_17)" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M160 344H368C389.198 343.937 409.509 335.488 424.499 320.499C439.488 305.509 447.937 285.198 448 264V248" stroke="url(#paint2_linear_101_17)" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<linearGradient id="paint0_linear_101_17" x1="320" y1="120.008" x2="396.642" y2="157.601" gradientUnits="userSpaceOnUse">
<stop stop-color="#A562D5"/>
<stop offset="1" stop-color="#306FEB"/>
</linearGradient>
<linearGradient id="paint1_linear_101_17" x1="64.0001" y1="168.018" x2="284.191" y2="445.745" gradientUnits="userSpaceOnUse">
<stop stop-color="#A562D5"/>
<stop offset="1" stop-color="#306FEB"/>
</linearGradient>
<linearGradient id="paint2_linear_101_17" x1="160" y1="248.008" x2="219.048" y2="421.788" gradientUnits="userSpaceOnUse">
<stop stop-color="#A562D5"/>
<stop offset="1" stop-color="#306FEB"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.8 KiB

@@ -0,0 +1,14 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="icon_verified-domain" clip-path="url(#clip0_1779_14845)">
<path id="Vector" d="M7.66667 13.3333C6.54591 13.3333 5.45032 13.001 4.51844 12.3783C3.58656 11.7557 2.86025 10.8707 2.43135 9.83521C2.00246 8.79976 1.89024 7.66038 2.10889 6.56116C2.32754 5.46193 2.86723 4.45223 3.65973 3.65973C4.45223 2.86723 5.46193 2.32754 6.56116 2.10889C7.66038 1.89024 8.79976 2.00246 9.83521 2.43135C10.8707 2.86025 11.7557 3.58656 12.3783 4.51844C13.001 5.45032 13.3333 6.54591 13.3333 7.66667" stroke="#1F81E2" style="stroke:#1F81E2;stroke:color(display-p3 0.1216 0.5059 0.8863);stroke-opacity:1;" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
<path id="Vector_2" d="M2.36328 5.66699H12.9694" stroke="#1F81E2" style="stroke:#1F81E2;stroke:color(display-p3 0.1216 0.5059 0.8863);stroke-opacity:1;" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
<path id="Vector_3" d="M2.36328 9.66699H7.66633" stroke="#1F81E2" style="stroke:#1F81E2;stroke:color(display-p3 0.1216 0.5059 0.8863);stroke-opacity:1;" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
<path id="Vector_4" d="M7.66699 13.3333C6.28628 13.3333 5.16699 10.7963 5.16699 7.66667C5.16699 4.53705 6.28628 2 7.66699 2C9.04771 2 10.167 4.53705 10.167 7.66667C10.167 8.62974 10.0957 9.33043 10.0463 9.70046" stroke="#1F81E2" style="stroke:#1F81E2;stroke:color(display-p3 0.1216 0.5059 0.8863);stroke-opacity:1;" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
<path id="Vector_5" d="M14.5 10.5L12.0557 13.3333L10.7217 12.0003" stroke="#1F81E2" style="stroke:#1F81E2;stroke:color(display-p3 0.1216 0.5059 0.8863);stroke-opacity:1;" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_1779_14845">
<rect width="16" height="16" fill="white" style="fill:white;fill:white;fill-opacity:1;"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@@ -0,0 +1,86 @@
* {
box-sizing: border-box;
-ms-overflow-style: none;
scrollbar-width: none;
}
::-webkit-scrollbar {
display: none;
}
.routeTransition {
display: flex;
flex: 1;
flex-direction: column;
overflow: hidden;
}
.container {
width: 100%;
height: calc(100% - 220px);
display: flex;
flex: 1;
flex-direction: column;
justify-content: center;
align-items: center;
}
.qrVideoMask {
width: 100%;
border-radius: 15px;
overflow: hidden !important;
position: relative;
}
.qrPlaceholder {
border: 2px rgba(139, 139, 139, 0.4) dashed;
width: 100%;
border-radius: 15px;
padding: 50px;
}
.qrIcon {
opacity: 0.3;
}
.codeBlock code {
flex: 1;
}
.codeBlock span {
background-color: transparent !important;
overflow: scroll;
}
.navLink {
transition: ease-in-out .2s opacity;
}
.navLink:hover {
opacity: 0.6;
}
select {
background-color: rgba(139, 139, 139, 0.2);
background-image: url(/icons/arrow-down-icon.svg);
background-size: 15px 15px;
background-position: right 10px center;
background-repeat: no-repeat;
padding: 5px 30px 6px 10px;
border-radius: 10px;
cursor: pointer;
border: none;
appearance: none;
transition: .2s ease-in-out background-color;
font-family: var(--nextui-fonts-sans);
font-weight: var(--nextui-fontWeights-light);
border: 1px solid rgba(139, 139, 139, 0.25);
}
select:hover {
background-color: rgba(139, 139, 139, 0.35);
}
i {
margin-top: -5px !important;
}
@@ -0,0 +1,4 @@
<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1,3 @@
<svg width="388" height="238" viewBox="0 0 388 238" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M79.4993 46.539C142.716 -15.355 245.209 -15.355 308.426 46.539L316.034 53.988C319.195 57.0827 319.195 62.1002 316.034 65.1949L290.008 90.6766C288.427 92.2239 285.865 92.2239 284.285 90.6766L273.815 80.4258C229.714 37.247 158.211 37.247 114.11 80.4258L102.898 91.4035C101.317 92.9509 98.7551 92.9509 97.1747 91.4035L71.1486 65.9219C67.9878 62.8272 67.9878 57.8096 71.1486 54.715L79.4993 46.539ZM362.25 99.2378L385.413 121.917C388.574 125.011 388.574 130.029 385.413 133.123L280.969 235.385C277.808 238.48 272.683 238.48 269.522 235.385C269.522 235.385 269.522 235.385 269.522 235.385L195.394 162.807C194.604 162.033 193.322 162.033 192.532 162.807C192.532 162.807 192.532 162.807 192.532 162.807L118.405 235.385C115.244 238.48 110.12 238.48 106.959 235.385C106.959 235.385 106.959 235.385 106.959 235.385L2.51129 133.122C-0.649517 130.027 -0.649517 125.01 2.51129 121.915L25.6746 99.2365C28.8354 96.1418 33.9601 96.1418 37.1209 99.2365L111.25 171.816C112.041 172.589 113.322 172.589 114.112 171.816C114.112 171.816 114.112 171.815 114.112 171.815L188.238 99.2365C191.399 96.1417 196.523 96.1416 199.684 99.2362C199.684 99.2362 199.684 99.2363 199.684 99.2363L273.814 171.815C274.604 172.589 275.885 172.589 276.675 171.815L350.804 99.2378C353.964 96.1431 359.089 96.1431 362.25 99.2378Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,76 @@
import ChainCard from '@/components/ChainCard'
import SettingsStore from '@/store/SettingsStore'
import { eip155Addresses } from '@/utils/EIP155WalletUtil'
import { truncate } from '@/utils/HelperUtil'
import { updateSignClientChainId } from '@/utils/WalletConnectUtil'
import { Avatar, Button, Text, Tooltip } from '@nextui-org/react'
import Image from 'next/image'
import { useState } from 'react'
import { useSnapshot } from 'valtio'
interface Props {
name: string
logo: string
rgb: string
address: string
chainId: string
}
export default function AccountCard({ name, logo, rgb, address = '', chainId }: Props) {
const [copied, setCopied] = useState(false)
const { activeChainId, account } = useSnapshot(SettingsStore.state)
function onCopy() {
navigator?.clipboard?.writeText(address)
setCopied(true)
setTimeout(() => setCopied(false), 1500)
}
async function onChainChanged(chainId: string, address: string) {
SettingsStore.setActiveChainId(chainId)
await updateSignClientChainId(chainId.toString(), address)
}
return (
<ChainCard rgb={rgb} flexDirection="row" alignItems="center">
<Avatar src={logo} />
<div style={{ flex: 1 }}>
<Text h5 css={{ marginLeft: '$9' }}>
{name}
</Text>
<Text weight="light" size={13} css={{ marginLeft: '$9' }}>
{address ? truncate(address, 19) : '<no address available>'}
</Text>
</div>
<Tooltip content={copied ? 'Copied!' : 'Copy'} placement="left">
<Button
size="sm"
css={{ minWidth: 'auto', backgroundColor: 'rgba(255, 255, 255, 0.15)' }}
data-testid={'chain-copy-button' + chainId}
onClick={onCopy}
>
<Image
src={copied ? '/icons/checkmark-icon.svg' : '/icons/copy-icon.svg'}
width={15}
height={15}
alt="copy icon"
/>
</Button>
</Tooltip>
<Button
size="sm"
css={{
minWidth: 'auto',
backgroundColor: 'rgba(255, 255, 255, 0.15)',
marginLeft: '$5'
}}
data-testid={'chain-switch-button' + chainId}
onPress={() => {
onChainChanged(chainId, address)
}}
>
{activeChainId === chainId ? `` : `🔄`}
</Button>
</ChainCard>
)
}

Some files were not shown because too many files have changed in this diff Show More