├── advanced ├── dapps │ ├── chain-abstraction-demo │ │ ├── .env.example │ │ ├── .eslintrc.json │ │ ├── next.config.mjs │ │ ├── app │ │ │ └── favicon.ico │ │ ├── public │ │ │ ├── donut.png │ │ │ ├── .well-known │ │ │ │ └── walletconnect.txt │ │ │ ├── donut-cover.png │ │ │ ├── chain-logos │ │ │ │ ├── ETH.png │ │ │ │ ├── SOL.png │ │ │ │ ├── base.webp │ │ │ │ ├── arbitrum.png │ │ │ │ ├── eip155-10.png │ │ │ │ └── chain-placeholder.png │ │ │ ├── token-images │ │ │ │ ├── ETH.png │ │ │ │ ├── SOL.png │ │ │ │ ├── USDC.png │ │ │ │ ├── USDT.png │ │ │ │ ├── USDS(DAI).png │ │ │ │ └── token-placeholder.png │ │ │ ├── chain_abstraction_demo.png │ │ │ └── vercel.svg │ │ ├── postcss.config.mjs │ │ ├── lib │ │ │ └── utils.ts │ │ ├── components │ │ │ ├── DonutInfo.tsx │ │ │ ├── DonutImage.tsx │ │ │ ├── theme-provider.tsx │ │ │ ├── CheckWalletToast.tsx │ │ │ ├── gift-donut-modal-views │ │ │ │ └── index.tsx │ │ │ ├── BalanceDisplay.tsx │ │ │ ├── ui │ │ │ │ ├── label.tsx │ │ │ │ ├── separator.tsx │ │ │ │ ├── input.tsx │ │ │ │ ├── sonner.tsx │ │ │ │ └── badge.tsx │ │ │ ├── Navbar.tsx │ │ │ └── WalletCheckoutModal.tsx │ │ ├── utils │ │ │ ├── NetworksUtil.ts │ │ │ └── FormatterUtil.ts │ │ ├── types │ │ │ ├── ERC5792.ts │ │ │ └── ERC7811.ts │ │ ├── components.json │ │ ├── hooks │ │ │ └── use-media-query.ts │ │ ├── .gitignore │ │ ├── tsconfig.json │ │ └── config │ │ │ ├── index.tsx │ │ │ └── checkoutViews.ts │ ├── react-dapp-v2 │ │ ├── src │ │ │ ├── constants │ │ │ │ └── index.ts │ │ │ ├── pages │ │ │ │ ├── 404.tsx │ │ │ │ ├── _error.tsx │ │ │ │ └── _app.tsx │ │ │ ├── helpers │ │ │ │ ├── index.ts │ │ │ │ ├── tron.ts │ │ │ │ ├── solana.ts │ │ │ │ ├── sui.ts │ │ │ │ ├── eip712.ts │ │ │ │ └── eip1271.ts │ │ │ ├── modals │ │ │ │ ├── shared │ │ │ │ │ └── index.ts │ │ │ │ ├── LoaderModal.tsx │ │ │ │ └── PingModal.tsx │ │ │ ├── styles │ │ │ │ └── globals.css │ │ │ ├── components │ │ │ │ ├── Metadata.tsx │ │ │ │ ├── Banner.tsx │ │ │ │ ├── shared │ │ │ │ │ └── index.ts │ │ │ │ ├── Pairing.tsx │ │ │ │ ├── Icon.tsx │ │ │ │ ├── Wrapper.tsx │ │ │ │ └── Column.tsx │ │ │ └── chains │ │ │ │ ├── ton.ts │ │ │ │ ├── stacks.ts │ │ │ │ ├── tron.ts │ │ │ │ ├── bip122.ts │ │ │ │ └── near.ts │ │ ├── .prettierignore │ │ ├── .env.local.example │ │ ├── public │ │ │ ├── favicon.ico │ │ │ └── assets │ │ │ │ ├── sui.png │ │ │ │ ├── ton.png │ │ │ │ ├── tron.png │ │ │ │ ├── eip155-1.png │ │ │ │ ├── kadena.png │ │ │ │ ├── stacks.png │ │ │ │ ├── eip155-10.png │ │ │ │ ├── eip155-100.png │ │ │ │ ├── eip155-137.png │ │ │ │ ├── eip155-420.png │ │ │ │ ├── btc-testnet.png │ │ │ │ ├── eip155-42161.png │ │ │ │ ├── eip155-421611.png │ │ │ │ ├── eip155-42220.png │ │ │ │ ├── eip155-44787.png │ │ │ │ ├── eip155-80001.png │ │ │ │ ├── solana_logo.png │ │ │ │ ├── walletconnect.png │ │ │ │ ├── cosmos-cosmoshub-4.png │ │ │ │ ├── eth.svg │ │ │ │ ├── eip155-324.svg │ │ │ │ ├── multiversx_logo.svg │ │ │ │ ├── polkadot.svg │ │ │ │ ├── githubLogo.svg │ │ │ │ └── settings.svg │ │ ├── next.config.js │ │ ├── .eslintrc.json │ │ ├── .gitignore │ │ ├── tsconfig.json │ │ └── README.md │ ├── react-dapp-v2-cosmos-provider │ │ ├── src │ │ │ ├── constants │ │ │ │ ├── index.ts │ │ │ │ └── default.ts │ │ │ ├── react-app-env.d.ts │ │ │ ├── pages │ │ │ │ ├── 404.tsx │ │ │ │ ├── _error.tsx │ │ │ │ └── _app.tsx │ │ │ ├── helpers │ │ │ │ ├── index.ts │ │ │ │ ├── tx.ts │ │ │ │ └── eip1271.ts │ │ │ ├── modals │ │ │ │ ├── shared │ │ │ │ │ └── index.ts │ │ │ │ ├── PingModal.tsx │ │ │ │ └── PairingModal.tsx │ │ │ ├── styles │ │ │ │ └── globals.css │ │ │ ├── components │ │ │ │ ├── Metadata.tsx │ │ │ │ ├── Banner.tsx │ │ │ │ ├── shared │ │ │ │ │ └── index.ts │ │ │ │ ├── Pairing.tsx │ │ │ │ ├── Icon.tsx │ │ │ │ └── Wrapper.tsx │ │ │ └── chains │ │ │ │ ├── polkadot.ts │ │ │ │ └── index.ts │ │ ├── public │ │ │ ├── favicon.ico │ │ │ ├── assets │ │ │ │ ├── eip155-1.png │ │ │ │ ├── eip155-10.png │ │ │ │ ├── eip155-100.png │ │ │ │ ├── eip155-137.png │ │ │ │ ├── eip155-420.png │ │ │ │ ├── eip155-42161.png │ │ │ │ ├── eip155-42220.png │ │ │ │ ├── eip155-44787.png │ │ │ │ ├── eip155-80001.png │ │ │ │ ├── eip155-421611.png │ │ │ │ ├── walletconnect.png │ │ │ │ ├── cosmos-cosmoshub-4.png │ │ │ │ ├── eth.svg │ │ │ │ └── polkadot.svg │ │ │ ├── manifest.json │ │ │ └── index.html │ │ ├── .env.local.example │ │ ├── .prettierrc │ │ ├── images.d.ts │ │ ├── next-env.d.ts │ │ ├── next.config.js │ │ ├── .gitignore │ │ ├── tsconfig.json │ │ └── LICENSE │ ├── react-dapp-v2-with-ethers │ │ ├── src │ │ │ ├── constants │ │ │ │ ├── index.ts │ │ │ │ └── default.ts │ │ │ ├── react-app-env.d.ts │ │ │ ├── pages │ │ │ │ ├── 404.tsx │ │ │ │ ├── _error.tsx │ │ │ │ └── _app.tsx │ │ │ ├── helpers │ │ │ │ ├── index.ts │ │ │ │ ├── eip712.ts │ │ │ │ ├── tx.ts │ │ │ │ └── eip1271.ts │ │ │ ├── assets │ │ │ │ ├── eth.svg │ │ │ │ └── polkadot.svg │ │ │ ├── modals │ │ │ │ ├── shared │ │ │ │ │ └── index.ts │ │ │ │ ├── PingModal.tsx │ │ │ │ └── PairingModal.tsx │ │ │ ├── components │ │ │ │ ├── Metadata.tsx │ │ │ │ ├── Banner.tsx │ │ │ │ ├── shared │ │ │ │ │ └── index.ts │ │ │ │ ├── Pairing.tsx │ │ │ │ ├── Icon.tsx │ │ │ │ └── Wrapper.tsx │ │ │ └── chains │ │ │ │ ├── cosmos.ts │ │ │ │ ├── polkadot.ts │ │ │ │ └── index.ts │ │ ├── .env.local.example │ │ ├── public │ │ │ ├── favicon.ico │ │ │ ├── assets │ │ │ │ ├── eip155-1.png │ │ │ │ ├── eip155-5.png │ │ │ │ ├── eip155-10.png │ │ │ │ ├── eip155-100.png │ │ │ │ ├── eip155-137.png │ │ │ │ ├── eip155-420.png │ │ │ │ ├── eip155-69.png │ │ │ │ ├── eip155-42161.png │ │ │ │ ├── eip155-421611.png │ │ │ │ ├── eip155-42220.png │ │ │ │ ├── eip155-44787.png │ │ │ │ ├── eip155-80001.png │ │ │ │ ├── walletconnect.png │ │ │ │ └── cosmos-cosmoshub-4.png │ │ │ ├── manifest.json │ │ │ └── index.html │ │ ├── .prettierrc │ │ ├── images.d.ts │ │ ├── next-env.d.ts │ │ ├── next.config.js │ │ ├── .gitignore │ │ ├── tsconfig.json │ │ └── LICENSE │ ├── pos-dapp │ │ ├── postcss.config.mjs │ │ ├── src │ │ │ └── app │ │ │ │ ├── favicon.ico │ │ │ │ ├── spinner.tsx │ │ │ │ ├── globals.css │ │ │ │ └── layout.tsx │ │ ├── next.config.ts │ │ ├── public │ │ │ ├── vercel.svg │ │ │ ├── window.svg │ │ │ ├── file.svg │ │ │ ├── globe.svg │ │ │ └── next.svg │ │ ├── eslint.config.mjs │ │ ├── .gitignore │ │ ├── tsconfig.json │ │ └── package.json │ └── smart-sessions-demo │ │ ├── next.config.mjs │ │ ├── src │ │ ├── app │ │ │ ├── favicon.ico │ │ │ ├── page.tsx │ │ │ ├── api │ │ │ │ └── signer │ │ │ │ │ └── route.ts │ │ │ ├── layout.tsx │ │ │ └── HomePage.tsx │ │ ├── lib │ │ │ └── utils.ts │ │ ├── utils │ │ │ ├── CommonUtils.ts │ │ │ ├── DataUtil.ts │ │ │ └── ChainsUtil.ts │ │ └── components │ │ │ ├── ConnectWalletButton.tsx │ │ │ ├── ui │ │ │ ├── label.tsx │ │ │ ├── separator.tsx │ │ │ ├── progress.tsx │ │ │ ├── input.tsx │ │ │ ├── sonner.tsx │ │ │ └── tooltip.tsx │ │ │ ├── TicTacToeComponents │ │ │ ├── DisplayPlayerScore.tsx │ │ │ └── StartGameButton.tsx │ │ │ └── DcaComponents │ │ │ └── AssetBalance.tsx │ │ ├── public │ │ └── .well-known │ │ │ └── walletconnect.txt │ │ ├── .env.example │ │ ├── postcss.config.mjs │ │ ├── components.json │ │ ├── eslint.config.mjs │ │ ├── .gitignore │ │ └── tsconfig.json └── wallets │ └── react-wallet-v2 │ ├── .prettierignore │ ├── public │ ├── favicon.ico │ ├── chain-logos │ │ ├── near.png │ │ ├── sui.png │ │ ├── ton.png │ │ ├── tron.png │ │ ├── base.webp │ │ ├── kadena.png │ │ ├── stacks.png │ │ ├── arbitrum.webp │ │ ├── eip155-1.png │ │ ├── eip155-10.png │ │ ├── btc-testnet.png │ │ ├── eip155-137.png │ │ ├── eip155-43113.png │ │ ├── chain-placeholder.png │ │ ├── cosmos-cosmoshub-4.png │ │ ├── solana-5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.png │ │ ├── eip155-324.svg │ │ ├── multiversx-1.svg │ │ └── polkadot.svg │ ├── token-logos │ │ ├── ETH.png │ │ ├── SOL.png │ │ ├── USDC.png │ │ ├── USDT.png │ │ └── token-placeholder.png │ ├── icons │ │ ├── checkmark-icon.svg │ │ ├── arrow-down-icon.svg │ │ ├── arrow-right-icon.svg │ │ ├── copy-icon.svg │ │ ├── pairings-icon.svg │ │ ├── delete-icon.svg │ │ ├── sessions-icon.svg │ │ └── accounts-icon.svg │ ├── wallet-connect-logo.svg │ └── vercel.svg │ ├── src │ ├── types │ │ └── auth.ts │ ├── utils │ │ ├── ConstantsUtil.ts │ │ ├── ChainUtil.ts │ │ ├── KadenaWalletUtil.ts │ │ ├── SuiWalletUtil.ts │ │ ├── NearWalletUtil.ts │ │ └── EIP5792WalletUtil.ts │ ├── data │ │ ├── EIP7715Data.ts │ │ ├── COSMOSData.ts │ │ ├── RelayerRegions.ts │ │ ├── KadenaData.ts │ │ ├── PolkadotData.ts │ │ ├── TezosData.ts │ │ ├── TronData.ts │ │ ├── TonData.ts │ │ └── tokenUtil.ts │ ├── components │ │ ├── ChainAddressMini.tsx │ │ ├── RequestMethodCard.tsx │ │ ├── RequestDataCard.tsx │ │ ├── PermissionDetailsCard.tsx │ │ ├── ChainSmartAddressMini.tsx │ │ ├── RequestModalContainer.tsx │ │ ├── ChainDataMini.tsx │ │ ├── PaymentCheckout │ │ │ └── visual │ │ │ │ ├── BadgeCheckIcon.tsx │ │ │ │ ├── BadgeAlertIcon.tsx │ │ │ │ └── WalletIcon.tsx │ │ ├── ModuleActions.tsx │ │ ├── RouteTransition.tsx │ │ ├── RelayRegionPicker.tsx │ │ ├── PageHeader.tsx │ │ ├── ChainCard.tsx │ │ ├── ProposalSelectSection.tsx │ │ └── AccountSelectCard.tsx │ ├── views │ │ ├── OwnableValidatorUninstallAction.tsx │ │ └── LoadingModal.tsx │ ├── consts │ │ └── smartAccounts.ts │ └── pages │ │ └── sessions.tsx │ ├── .prettierrc.json │ ├── next-env.d.ts │ ├── .eslintrc.json │ ├── .env.local.example │ ├── .gitignore │ ├── docker-compose.yaml │ ├── tsconfig.json │ └── next.config.js ├── dapps └── README.md ├── roadmap.md └── .gitignore /advanced/dapps/chain-abstraction-demo/.env.example: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_PROJECT_ID= -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/constants/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./default"; 2 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/constants/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./default"; 2 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/constants/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./default"; 2 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/.prettierignore: -------------------------------------------------------------------------------- 1 | .changeset 2 | coverage 3 | .idea 4 | .next 5 | node_modules -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/.prettierignore: -------------------------------------------------------------------------------- 1 | .changeset 2 | coverage 3 | .idea 4 | .next 5 | node_modules -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/.env.local.example: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_PROJECT_ID=39bc... 2 | NEXT_PUBLIC_RELAY_URL=wss://relay.walletconnect.com -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/pages/404.tsx: -------------------------------------------------------------------------------- 1 | export default function FourOhFour() { 2 | return

404 Page Not Found

; 3 | } 4 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/pages/_error.tsx: -------------------------------------------------------------------------------- 1 | export default function Error() { 2 | return
An error as occured
; 3 | } 4 | -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | const config = { 2 | plugins: ["@tailwindcss/postcss"], 3 | }; 4 | 5 | export default config; 6 | -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/pos-dapp/src/app/favicon.ico -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/pages/404.tsx: -------------------------------------------------------------------------------- 1 | export default function FourOhFour() { 2 | return

404 Page Not Found

; 3 | } 4 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/pages/404.tsx: -------------------------------------------------------------------------------- 1 | export default function FourOhFour() { 2 | return

404 Page Not Found

; 3 | } 4 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/pages/_error.tsx: -------------------------------------------------------------------------------- 1 | export default function Error() { 2 | return
An error as occured
; 3 | } 4 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/favicon.ico -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/pages/_error.tsx: -------------------------------------------------------------------------------- 1 | export default function Error() { 2 | return
An error as occured
; 3 | } 4 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/.env.local.example: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_PROJECT_ID=39bc93c... 2 | NEXT_PUBLIC_RELAY_URL=wss://relay.walletconnect.com 3 | 4 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/sui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/sui.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/ton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/ton.png -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = {}; 3 | 4 | export default nextConfig; 5 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = {}; 3 | 4 | export default nextConfig; 5 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/tron.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/tron.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/favicon.ico -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/app/favicon.ico -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/donut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/donut.png -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/next.config.ts: -------------------------------------------------------------------------------- 1 | import type { NextConfig } from "next"; 2 | 3 | const nextConfig: NextConfig = {}; 4 | 5 | module.exports = nextConfig; 6 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/eip155-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/eip155-1.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/kadena.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/kadena.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/stacks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/stacks.png -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/smart-sessions-demo/src/app/favicon.ico -------------------------------------------------------------------------------- /dapps/README.md: -------------------------------------------------------------------------------- 1 | # AppKit Examples 2 | 3 | Head over to [appkit-web-examples](https://github.com/reown-com/appkit-web-examples/) to find all of our latest examples. 4 | -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/eip155-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/eip155-10.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/eip155-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/eip155-100.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/eip155-137.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/eip155-137.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/eip155-420.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/eip155-420.png -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/public/.well-known/walletconnect.txt: -------------------------------------------------------------------------------- 1 | 036e2dea-947e-4ab5-b5a6-cc007ba52c13=cd9cfc50fcb49c77b511f53fcdd336589c05f1ec6e6cc5d4fbf4ebe7f8b9cb07 -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/.well-known/walletconnect.txt: -------------------------------------------------------------------------------- 1 | 6025eb18-b3cb-471c-af2f-d4945777886a=cd9cfc50fcb49c77b511f53fcdd336589c05f1ec6e6cc5d4fbf4ebe7f8b9cb07 -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/donut-cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/donut-cover.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/favicon.ico -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/btc-testnet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/btc-testnet.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/eip155-42161.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/eip155-42161.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/eip155-421611.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/eip155-421611.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/eip155-42220.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/eip155-42220.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/eip155-44787.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/eip155-44787.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/eip155-80001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/eip155-80001.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/solana_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/solana_logo.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/walletconnect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/walletconnect.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/near.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/near.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/sui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/sui.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/ton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/ton.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/tron.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/tron.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/token-logos/ETH.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/token-logos/ETH.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/token-logos/SOL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/token-logos/SOL.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/token-logos/USDC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/token-logos/USDC.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/token-logos/USDT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/token-logos/USDT.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/base.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/base.webp -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/kadena.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/kadena.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/stacks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/stacks.png -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/chain-logos/ETH.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/chain-logos/ETH.png -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/chain-logos/SOL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/chain-logos/SOL.png -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/token-images/ETH.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/token-images/ETH.png -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/token-images/SOL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/token-images/SOL.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-cosmos-provider/public/favicon.ico -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/cosmos-cosmoshub-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2/public/assets/cosmos-cosmoshub-4.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/arbitrum.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/arbitrum.webp -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/eip155-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/eip155-1.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/eip155-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/eip155-10.png -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/chain-logos/base.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/chain-logos/base.webp -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/token-images/USDC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/token-images/USDC.png -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/token-images/USDT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/token-images/USDT.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/.env.local.example: -------------------------------------------------------------------------------- 1 | REACT_APP_PROJECT_ID=39bc93c... 2 | REACT_APP_INFURA_ID=5dc0df... 3 | REACT_APP_RELAY_URL=wss://relay.walletconnect.com 4 | 5 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 2, 3 | "useTabs": false, 4 | "trailingComma": "all", 5 | "printWidth": 100, 6 | "arrowParens": "avoid" 7 | } 8 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-1.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-5.png -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/.env.example: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_PROJECT_ID= 2 | NEXT_PUBLIC_RELAY_URL=wss://relay.walletconnect.org 3 | NEXT_PUBLIC_SECURE_SITE_SDK_URL= 4 | APPLICATION_PRIVATE_KEY= -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/btc-testnet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/btc-testnet.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/eip155-137.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/eip155-137.png -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/chain-logos/arbitrum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/chain-logos/arbitrum.png -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/chain-logos/eip155-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/chain-logos/eip155-10.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 2, 3 | "useTabs": false, 4 | "trailingComma": "all", 5 | "printWidth": 100, 6 | "arrowParens": "avoid" 7 | } 8 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-10.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-100.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-137.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-137.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-420.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-420.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-69.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-69.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/eip155-43113.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/eip155-43113.png -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/chain_abstraction_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/chain_abstraction_demo.png -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/token-images/USDS(DAI).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/token-images/USDS(DAI).png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-1.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-10.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-42161.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-42161.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-421611.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-421611.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-42220.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-42220.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-44787.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-44787.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-80001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/assets/eip155-80001.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/assets/walletconnect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/assets/walletconnect.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-100.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-137.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-137.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-420.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-420.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-42161.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-42161.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-42220.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-42220.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-44787.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-44787.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-80001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-80001.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/chain-placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/chain-placeholder.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/cosmos-cosmoshub-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/cosmos-cosmoshub-4.png -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/token-logos/token-placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/token-logos/token-placeholder.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-421611.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eip155-421611.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/walletconnect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/walletconnect.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/assets/cosmos-cosmoshub-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-with-ethers/public/assets/cosmos-cosmoshub-4.png -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/chain-logos/chain-placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/chain-logos/chain-placeholder.png -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/token-images/token-placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/chain-abstraction-demo/public/token-images/token-placeholder.png -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/cosmos-cosmoshub-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/cosmos-cosmoshub-4.png -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/types/auth.ts: -------------------------------------------------------------------------------- 1 | import { AuthTypes } from '@walletconnect/types' 2 | 3 | export type AuthenticationMessage = AuthTypes.AuthenticateParams & { 4 | message: string 5 | iss: string 6 | } 7 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/helpers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./api"; 2 | export * from "./eip712"; 3 | export * from "./eip1271"; 4 | export * from "./tx"; 5 | export * from "./types"; 6 | export * from "./utilities"; 7 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/utils/ConstantsUtil.ts: -------------------------------------------------------------------------------- 1 | export const COSIGNER_BASE_URL = 'https://rpc.walletconnect.org/v1/sessions' 2 | export const CA_ORCHESTRATOR_BASE_URL = 'https://rpc.walletconnect.org/v1/ca/orchestrator' 3 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { clsx, type ClassValue } from "clsx"; 2 | import { twMerge } from "tailwind-merge"; 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)); 6 | } 7 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/helpers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./api"; 2 | export * from "./eip712"; 3 | export * from "./eip1271"; 4 | export * from "./tx"; 5 | export * from "./types"; 6 | export * from "./utilities"; 7 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/eth.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { type ClassValue, clsx } from "clsx"; 2 | import { twMerge } from "tailwind-merge"; 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)); 6 | } 7 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/solana-5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reown-com/web-examples/HEAD/advanced/wallets/react-wallet-v2/public/chain-logos/solana-5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.png -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/images.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.svg"; 2 | declare module "*.png"; 3 | declare module "*.jpg"; 4 | declare module "*.jpeg"; 5 | declare module "*.gif"; 6 | declare module "*.bmp"; 7 | declare module "*.tiff"; 8 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/assets/eth.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/images.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.svg"; 2 | declare module "*.png"; 3 | declare module "*.jpg"; 4 | declare module "*.jpeg"; 5 | declare module "*.gif"; 6 | declare module "*.bmp"; 7 | declare module "*.tiff"; 8 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "parser": "typescript", 4 | "printWidth": 100, 5 | "singleQuote": true, 6 | "tabWidth": 2, 7 | "trailingComma": "none", 8 | "semi": false 9 | } 10 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/helpers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./api"; 2 | export * from "./eip712"; 3 | export * from "./eip1271"; 4 | export * from "./tx"; 5 | export * from "./types"; 6 | export * from "./utilities"; 7 | export * from "./sui"; 8 | export * from "./ton"; 9 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/icons/checkmark-icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. 6 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/icons/arrow-down-icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/icons/arrow-right-icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. 6 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/eth.svg: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | 5 | // NOTE: This file should not be edited 6 | // see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. 7 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/components/DonutInfo.tsx: -------------------------------------------------------------------------------- 1 | interface DonutInfoProps {} 2 | 3 | export const DonutInfo: React.FC = ({}) => ( 4 |
5 |

Donut #1

6 |

Lorem ipsum dolor sit...

7 |
8 | ); 9 | -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/src/app/spinner.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function Spinner() { 4 | return ( 5 |
6 |
7 |
8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/app/page.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import React from "react"; 3 | 4 | import HomePage from "./HomePage"; 5 | 6 | export default function Home() { 7 | return ( 8 |
9 | 10 |
11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/utils/NetworksUtil.ts: -------------------------------------------------------------------------------- 1 | import * as viemChains from "viem/chains"; 2 | 3 | export function getChain(chainId: number) { 4 | const chain = Object.values(viemChains).find((chain) => chain.id === chainId); 5 | if (!chain) { 6 | throw new Error(`Unsupported chain ID: ${chainId}`); 7 | } 8 | return chain; 9 | } 10 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["next/core-web-vitals","prettier"], 3 | "ignorePatterns": ["next.config.js"], 4 | "overrides": [ 5 | { 6 | "extends": ["plugin:package-json/recommended"], 7 | "files": ["package.json"], 8 | "parser": "jsonc-eslint-parser", 9 | "plugins": ["package-json"] 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/types/ERC5792.ts: -------------------------------------------------------------------------------- 1 | interface WalletCapability { 2 | wallet_getAssets?: string; 3 | } 4 | 5 | interface ChainCapabilities { 6 | walletService?: WalletCapability; 7 | assetDiscovery?: { 8 | supported: boolean; 9 | }; 10 | } 11 | 12 | export interface Capabilities { 13 | [chainId: string]: ChainCapabilities; 14 | } 15 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/components/DonutImage.tsx: -------------------------------------------------------------------------------- 1 | import Image from "next/image"; 2 | 3 | export const DonutImage = () => ( 4 |
5 | Gift Donut 11 |
12 | ); 13 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | reactStrictMode: true, 4 | distDir: "build", 5 | webpack(config) { 6 | config.resolve.fallback = { 7 | ...config.resolve.fallback, 8 | fs: false, 9 | }; 10 | 11 | return config; 12 | }, 13 | }; 14 | 15 | module.exports = nextConfig; 16 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | reactStrictMode: true, 4 | distDir: "build", 5 | webpack(config) { 6 | config.resolve.fallback = { 7 | ...config.resolve.fallback, 8 | fs: false, 9 | }; 10 | 11 | return config; 12 | }, 13 | }; 14 | 15 | module.exports = nextConfig; 16 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/data/EIP7715Data.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * EIP7715Method 3 | */ 4 | export const EIP7715_METHOD = { 5 | WALLET_GRANT_PERMISSIONS: 'wallet_grantPermissions' 6 | } 7 | // The types of keys that are supported for the following `key` and `keys` signer types. 8 | export enum SignerKeyType { 9 | SECP256K1 = 0, // EOA - k1 10 | SECP256R1 = 1 // Passkey - r1 11 | } 12 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | reactStrictMode: true, 4 | distDir: "build", 5 | webpack(config) { 6 | config.resolve.fallback = { 7 | ...config.resolve.fallback, 8 | fs: false, 9 | }; 10 | 11 | return config; 12 | }, 13 | }; 14 | 15 | module.exports = nextConfig; 16 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/utils/ChainUtil.ts: -------------------------------------------------------------------------------- 1 | import * as chains from 'viem/chains' 2 | import { Chain } from 'viem/chains' 3 | 4 | export function getChainById(chainId: number): Chain { 5 | for (const chain of Object.values(chains)) { 6 | if (chain.id === chainId) { 7 | return chain 8 | } 9 | } 10 | 11 | throw new Error(`Chain with id ${chainId} not found`) 12 | } 13 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/components/theme-provider.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as React from "react"; 4 | import { 5 | ThemeProvider as NextThemesProvider, 6 | ThemeProviderProps, 7 | } from "next-themes"; 8 | 9 | export function ThemeProvider({ children, ...props }: ThemeProviderProps) { 10 | return {children}; 11 | } 12 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals", 3 | "rules": { 4 | "no-trailing-spaces": 1, 5 | "@next/next/no-img-element": "off" 6 | }, 7 | "overrides": [ 8 | { 9 | "extends": ["plugin:package-json/recommended"], 10 | "files": ["package.json"], 11 | "parser": "jsonc-eslint-parser", 12 | "plugins": ["package-json"] 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/public/window.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/.env.local.example: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_PROJECT_ID= 2 | NEXT_PUBLIC_RELAY_URL=wss://relay.walletconnect.com 3 | NEXT_PUBLIC_PIMLICO_KEY= 4 | NEXT_PUBLIC_ZERODEV_PROJECT_ID= 5 | #if using local AA infra then set these values 6 | NEXT_PUBLIC_LOCAL_BUNDLER_URL= 7 | NEXT_PUBLIC_LOCAL_PAYMASTER_URL= 8 | NEXT_PUBLIC_LOCAL_CLIENT_URL= 9 | 10 | #only for testing 11 | NEXT_PUBLIC_SOCKET_KEY= 12 | -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/public/file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/eip155-324.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/eip155-324.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "WalletConnect", 3 | "name": "WalletConnect React App", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/modals/shared/index.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const SModalContainer = styled.div` 4 | width: 100%; 5 | position: relative; 6 | word-wrap: break-word; 7 | `; 8 | 9 | export const SModalTitle = styled.div` 10 | margin: 1em 0; 11 | font-size: 20px; 12 | font-weight: 700; 13 | `; 14 | 15 | export const SModalParagraph = styled.p` 16 | margin-top: 30px; 17 | `; 18 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "WalletConnect", 3 | "name": "WalletConnect React App", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/modals/shared/index.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const SModalContainer = styled.div` 4 | width: 100%; 5 | position: relative; 6 | word-wrap: break-word; 7 | `; 8 | 9 | export const SModalTitle = styled.div` 10 | margin: 1em 0; 11 | font-size: 20px; 12 | font-weight: 700; 13 | `; 14 | 15 | export const SModalParagraph = styled.p` 16 | margin-top: 30px; 17 | `; 18 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/components/CheckWalletToast.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Loader2 } from "lucide-react"; 3 | 4 | export const CheckWalletToast = () => { 5 | return ( 6 |
7 | 8 |

9 | Check your wallet to approve transaction 10 |

11 |
12 | ); 13 | }; 14 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/modals/shared/index.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const SModalContainer = styled.div` 4 | width: 100%; 5 | position: relative; 6 | word-wrap: break-word; 7 | `; 8 | 9 | export const SModalTitle = styled.div` 10 | margin: 1em 0; 11 | font-size: 20px; 12 | font-weight: 700; 13 | `; 14 | 15 | export const SModalParagraph = styled.p` 16 | margin-top: 30px; 17 | `; 18 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/multiversx_logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "src/app/globals.css", 9 | "baseColor": "slate", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/multiversx-1.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import globals from "globals"; 2 | import pluginJs from "@eslint/js"; 3 | import tseslint from "typescript-eslint"; 4 | import pluginReact from "eslint-plugin-react"; 5 | 6 | 7 | export default [ 8 | {files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]}, 9 | {languageOptions: { globals: globals.browser }}, 10 | pluginJs.configs.recommended, 11 | ...tseslint.configs.recommended, 12 | pluginReact.configs.flat.recommended, 13 | ]; -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | 25 | .eslintcache -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | 25 | .eslintcache -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/utils/CommonUtils.ts: -------------------------------------------------------------------------------- 1 | export function parseJSON(str: string) { 2 | try { 3 | return JSON.parse(str); 4 | } catch (error) { 5 | return { error: `Invalid JSON: ${error}` }; 6 | } 7 | } 8 | 9 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 10 | export function bigIntReplacer(_key: string, value: any) { 11 | if (typeof value === "bigint") { 12 | return `0x${value.toString(16)}`; 13 | } 14 | 15 | return value; 16 | } 17 | -------------------------------------------------------------------------------- /roadmap.md: -------------------------------------------------------------------------------- 1 | # Basic Web Examples 2 | 3 | Basic examples/templates for using WalletConnect SDKs 4 | 5 | ## Table Of Contents: 6 | 7 | ```bash 8 | . 9 | ├── dapps/ 10 | │ ├── web3modal 11 | │ ├── web3inbox(TODO) 12 | │ ├── ethereum-provider 13 | │ ├── universal-provider-solana 14 | │ └── universal-provider-cosmos(TODO) 15 | └── wallets/ 16 | ├── web3wallet(TODO) 17 | ├── web3wallet-ethers(TODO) 18 | ├── web3wallet-viem(TODO) 19 | └── web3wallet-wagmi(TODO) 20 | ``` 21 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/utils/DataUtil.ts: -------------------------------------------------------------------------------- 1 | export type DemoAppMetadata = { 2 | title: string; 3 | link: string; 4 | description: string; 5 | randomLinks?: string[]; 6 | }; 7 | 8 | export const smartSessionsDemoAppMetadata: DemoAppMetadata[] = [ 9 | { 10 | title: "DCA", 11 | link: "/demo/dca", 12 | description: "Dollar Cost Averaging Dapp Demo", 13 | }, 14 | { 15 | title: "TicTacToe", 16 | link: "/demo/tictactoe", 17 | description: "Play TicTacToe", 18 | }, 19 | ]; 20 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/components/ConnectWalletButton.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { useAppKit } from "@reown/appkit/react"; 3 | import { Button } from "./ui/button"; 4 | 5 | export function ConnectWalletButton() { 6 | const { open } = useAppKit(); 7 | 8 | return ( 9 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "app/globals.css", 9 | "baseColor": "zinc", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils", 16 | "ui": "@/components/ui", 17 | "lib": "@/lib", 18 | "hooks": "@/hooks" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/utils/FormatterUtil.ts: -------------------------------------------------------------------------------- 1 | export const formatBalance = (balance: bigint, decimals: number): string => { 2 | const value = Number(balance) / Math.pow(10, decimals); 3 | if (value >= 0.01) return value.toFixed(2); 4 | const significantDecimals = Math.min(6, decimals); 5 | return value.toFixed(significantDecimals).replace(/\.?0+$/, ""); 6 | }; 7 | 8 | export const convertChainIdToHex = (chainId: number): `0x${string}` => { 9 | return `0x${parseInt(chainId.toString()).toString(16)}` as `0x${string}`; 10 | }; 11 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/components/gift-donut-modal-views/index.tsx: -------------------------------------------------------------------------------- 1 | import CheckoutView from "./CheckoutView"; 2 | import CheckoutReceipentAddressView from "./CheckoutReceipentAddressView"; 3 | import ChooseNetworkView from "./ChooseNetworkView"; 4 | import PayWithkView from "./PayWithView"; 5 | 6 | // Default Views with clear type annotations 7 | export const GiftDonutModalViews = { 8 | Checkout: CheckoutView, 9 | ChooseNetwork: ChooseNetworkView, 10 | PayWith: PayWithkView, 11 | CheckoutReceipentAddress: CheckoutReceipentAddressView, 12 | }; 13 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/ChainAddressMini.tsx: -------------------------------------------------------------------------------- 1 | import { Row } from '@nextui-org/react' 2 | 3 | interface Props { 4 | address?: string 5 | } 6 | 7 | export default function ChainAddressMini({ address }: Props) { 8 | if (!address || address === 'N/A') return <> 9 | console.log('address', address) 10 | return ( 11 | <> 12 | 13 | 14 | {address.substring(0, 6)}...{address.substring(address.length - 6)} 15 | 16 | 17 | 18 | ) 19 | } 20 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/styles/globals.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | padding: 0; 4 | margin: 0; 5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 7 | } 8 | 9 | a { 10 | color: inherit; 11 | text-decoration: none; 12 | } 13 | 14 | * { 15 | box-sizing: border-box; 16 | } 17 | 18 | @media (prefers-color-scheme: dark) { 19 | html { 20 | color-scheme: dark; 21 | } 22 | body { 23 | color: white; 24 | background: black; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/styles/globals.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | padding: 0; 4 | margin: 0; 5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 7 | } 8 | 9 | a { 10 | color: inherit; 11 | text-decoration: none; 12 | } 13 | 14 | * { 15 | box-sizing: border-box; 16 | } 17 | 18 | @media (prefers-color-scheme: dark) { 19 | html { 20 | color-scheme: dark; 21 | } 22 | body { 23 | color: white; 24 | background: black; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | .pnpm-debug.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/RequestMethodCard.tsx: -------------------------------------------------------------------------------- 1 | import { Col, Row, Text } from '@nextui-org/react' 2 | 3 | /** 4 | * Types 5 | */ 6 | interface IProps { 7 | methods: string[] 8 | } 9 | 10 | /** 11 | * Component 12 | */ 13 | export default function RequestMethodCard({ methods }: IProps) { 14 | return ( 15 | 16 | 17 | Methods 18 | 19 | {methods.map(method => method).join(', ')} 20 | 21 | 22 | 23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/hooks/use-media-query.ts: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | export function useMediaQuery(query: string) { 4 | const [value, setValue] = React.useState(false); 5 | 6 | React.useEffect(() => { 7 | function onChange(event: MediaQueryListEvent) { 8 | setValue(event.matches); 9 | } 10 | 11 | const result = matchMedia(query); 12 | result.addEventListener("change", onChange); 13 | setValue(result.matches); 14 | 15 | return () => result.removeEventListener("change", onChange); 16 | }, [query]); 17 | 18 | return value; 19 | } 20 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | .DS_Store 4 | 5 | # dependencies 6 | /node_modules 7 | /.pnp 8 | .pnp.js 9 | 10 | # testing 11 | /coverage 12 | 13 | # next.js 14 | /.next/ 15 | /out/ 16 | 17 | # production 18 | /build 19 | 20 | # misc 21 | .DS_Store 22 | *.pem 23 | 24 | # debug 25 | npm-debug.log* 26 | yarn-debug.log* 27 | yarn-error.log* 28 | 29 | # local env files 30 | .env.local 31 | .env.development.local 32 | .env.test.local 33 | .env.production.local 34 | 35 | # vercel 36 | .vercel 37 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/components/Metadata.tsx: -------------------------------------------------------------------------------- 1 | import Head from "next/head"; 2 | import * as React from "react"; 3 | import { DEFAULT_APP_METADATA } from "../constants"; 4 | 5 | const Metadata = () => ( 6 | 7 | {DEFAULT_APP_METADATA.name} 8 | 9 | 10 | 11 | {DEFAULT_APP_METADATA.icons.map((icon, index) => ( 12 | 13 | ))} 14 | 15 | ); 16 | 17 | export default Metadata; 18 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | .env 31 | 32 | # vercel 33 | .vercel 34 | 35 | # typescript 36 | *.tsbuildinfo 37 | next-env.d.ts 38 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | .env 31 | 32 | # vercel 33 | .vercel 34 | 35 | # typescript 36 | *.tsbuildinfo 37 | next-env.d.ts 38 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/components/Banner.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import styled from "styled-components"; 3 | 4 | const SBannerWrapper = styled.div` 5 | display: flex; 6 | align-items: center; 7 | position: relative; 8 | `; 9 | 10 | const SBanner = styled.div` 11 | width: 275px; 12 | height: 45px; 13 | background: url(/assets/walletconnect.png) no-repeat; 14 | background-size: cover; 15 | background-position: center; 16 | `; 17 | 18 | const Banner = () => ( 19 | 20 | 21 | 22 | ); 23 | 24 | export default Banner; 25 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/components/Metadata.tsx: -------------------------------------------------------------------------------- 1 | import Head from "next/head"; 2 | import * as React from "react"; 3 | import { DEFAULT_APP_METADATA } from "../constants"; 4 | 5 | const Metadata = () => ( 6 | 7 | {DEFAULT_APP_METADATA.name} 8 | 9 | 10 | 11 | {DEFAULT_APP_METADATA.icons.map((icon, index) => ( 12 | 13 | ))} 14 | 15 | ); 16 | 17 | export default Metadata; 18 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/components/Metadata.tsx: -------------------------------------------------------------------------------- 1 | import Head from "next/head"; 2 | import * as React from "react"; 3 | import { DEFAULT_APP_METADATA } from "../constants"; 4 | 5 | const Metadata = () => ( 6 | 7 | {DEFAULT_APP_METADATA.name} 8 | 9 | 10 | 11 | {DEFAULT_APP_METADATA.icons.map((icon, index) => ( 12 | 13 | ))} 14 | 15 | ); 16 | 17 | export default Metadata; 18 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/components/Banner.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import styled from "styled-components"; 3 | 4 | const SBannerWrapper = styled.div` 5 | display: flex; 6 | align-items: center; 7 | position: relative; 8 | `; 9 | 10 | const SBanner = styled.div` 11 | width: 275px; 12 | height: 45px; 13 | background: url(/assets/walletconnect.png) no-repeat; 14 | background-size: cover; 15 | background-position: center; 16 | `; 17 | 18 | const Banner = () => ( 19 | 20 | 21 | 22 | ); 23 | 24 | export default Banner; 25 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/components/Banner.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import styled from "styled-components"; 3 | 4 | const SBannerWrapper = styled.div` 5 | display: flex; 6 | align-items: center; 7 | position: relative; 8 | `; 9 | 10 | const SBanner = styled.div` 11 | width: 275px; 12 | height: 45px; 13 | background: url(/assets/walletconnect.png) no-repeat; 14 | background-size: cover; 15 | background-position: center; 16 | `; 17 | 18 | const Banner = () => ( 19 | 20 | 21 | 22 | ); 23 | 24 | export default Banner; 25 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "noEmit": true, 10 | "esModuleInterop": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "jsx": "preserve", 16 | "incremental": true 17 | }, 18 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], 19 | "exclude": ["node_modules"] 20 | } 21 | -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/src/app/globals.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | 3 | :root { 4 | --background: #ffffff; 5 | --foreground: #171717; 6 | } 7 | 8 | @theme inline { 9 | --color-background: var(--background); 10 | --color-foreground: var(--foreground); 11 | --font-sans: var(--font-geist-sans); 12 | --font-mono: var(--font-geist-mono); 13 | } 14 | 15 | @media (prefers-color-scheme: dark) { 16 | :root { 17 | --background: #0a0a0a; 18 | --foreground: #ededed; 19 | } 20 | } 21 | 22 | body { 23 | background: var(--background); 24 | color: var(--foreground); 25 | font-family: Arial, Helvetica, sans-serif; 26 | } 27 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "noEmit": true, 10 | "esModuleInterop": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "jsx": "preserve", 16 | "incremental": true 17 | }, 18 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], 19 | "exclude": ["node_modules"] 20 | } 21 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "noEmit": true, 10 | "esModuleInterop": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "jsx": "preserve", 16 | "incremental": true 17 | }, 18 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], 19 | "exclude": ["node_modules"] 20 | } 21 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/data/COSMOSData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Types 3 | */ 4 | export type TCosmosChain = keyof typeof COSMOS_MAINNET_CHAINS 5 | 6 | /** 7 | * Chains 8 | */ 9 | export const COSMOS_MAINNET_CHAINS = { 10 | 'cosmos:cosmoshub-4': { 11 | chainId: 'cosmoshub-4', 12 | name: 'Cosmos Hub', 13 | logo: '/chain-logos/cosmos-cosmoshub-4.png', 14 | rgb: '107, 111, 147', 15 | rpc: '', 16 | namespace: 'cosmos' 17 | } 18 | } 19 | 20 | /** 21 | * Methods 22 | */ 23 | export const COSMOS_SIGNING_METHODS = { 24 | COSMOS_SIGN_DIRECT: 'cosmos_signDirect', 25 | COSMOS_SIGN_AMINO: 'cosmos_signAmino' 26 | } 27 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import { dirname } from "path"; 2 | import { fileURLToPath } from "url"; 3 | import { FlatCompat } from "@eslint/eslintrc"; 4 | 5 | const __filename = fileURLToPath(import.meta.url); 6 | const __dirname = dirname(__filename); 7 | 8 | const compat = new FlatCompat({ 9 | baseDirectory: __dirname, 10 | }); 11 | 12 | const eslintConfig = [ 13 | ...compat.extends("next/core-web-vitals", "next/typescript"), 14 | { 15 | ignores: [ 16 | "node_modules/**", 17 | ".next/**", 18 | "out/**", 19 | "build/**", 20 | "next-env.d.ts", 21 | ], 22 | }, 23 | ]; 24 | 25 | export default eslintConfig; 26 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/app/api/signer/route.ts: -------------------------------------------------------------------------------- 1 | import { NextResponse } from "next/server"; 2 | import { privateKeyToAccount } from "viem/accounts"; 3 | 4 | export function GET() { 5 | try { 6 | const APPLICATION_PRIVATE_KEY = process.env 7 | .APPLICATION_PRIVATE_KEY as `0x${string}`; 8 | const account = privateKeyToAccount(APPLICATION_PRIVATE_KEY); 9 | 10 | return NextResponse.json({ key: account.publicKey }); 11 | } catch (e) { 12 | console.warn("Error getting signer:", e); 13 | 14 | return NextResponse.json( 15 | { message: "Error getting application signer" }, 16 | { status: 500 }, 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | .DS_Store 4 | .next 5 | 6 | # dependencies 7 | node_modules 8 | /node_modules 9 | /.pnp 10 | .pnp.js 11 | 12 | # testing 13 | /coverage 14 | 15 | # next.js 16 | /.next/ 17 | /out/ 18 | 19 | # production 20 | /build 21 | 22 | # misc 23 | .DS_Store 24 | *.pem 25 | 26 | # debug 27 | npm-debug.log* 28 | yarn-debug.log* 29 | yarn-error.log* 30 | 31 | # local env files 32 | .env 33 | .env.local 34 | .env.development.local 35 | .env.test.local 36 | .env.production.local 37 | 38 | # vercel 39 | .vercel 40 | 41 | # webstorm ide 42 | .idea 43 | 44 | # vscode 45 | .vscode/settings.json -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/types/ERC7811.ts: -------------------------------------------------------------------------------- 1 | type Hex = `0x${string}`; 2 | 3 | interface TokenMetadata { 4 | name: string; 5 | symbol: string; 6 | decimals: number; 7 | } 8 | 9 | export interface Asset { 10 | address: Hex | "native"; 11 | balance: Hex; 12 | type: string; 13 | metadata: TokenMetadata; 14 | } 15 | 16 | export interface WalletGetAssetsRPCResponse { 17 | jsonrpc: string; 18 | id: number; 19 | result: Record; 20 | } 21 | 22 | export type WalletGetAssetsRPCRequest = { 23 | account: string; 24 | chainFilter?: Hex[]; 25 | assetFilter?: Record; 26 | assetTypeFilter?: ("NATIVE" | "ERC20")[]; 27 | }; 28 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | import { Inter } from "next/font/google"; 3 | import "./globals.css"; 4 | import React from "react"; 5 | 6 | // eslint-disable-next-line new-cap 7 | const inter = Inter({ subsets: ["latin"] }); 8 | 9 | export const metadata: Metadata = { 10 | title: "Smart Sessions Demo", 11 | description: "Smart Sessions Demo", 12 | }; 13 | 14 | export default function RootLayout({ 15 | children, 16 | }: Readonly<{ 17 | children: React.ReactNode; 18 | }>) { 19 | return ( 20 | 21 | {children} 22 | 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/helpers/tron.ts: -------------------------------------------------------------------------------- 1 | import { TronWeb } from "tronweb"; 2 | let tronWebMainnet: TronWeb; 3 | let tronWebTestnet: TronWeb; 4 | export const getTronWeb = (network: string) => { 5 | if (network === "tron:0xcd8690dc") { 6 | if (!tronWebTestnet) { 7 | tronWebTestnet = new TronWeb({ 8 | fullHost: "https://nile.trongrid.io/", 9 | }); 10 | } 11 | return tronWebTestnet; 12 | } 13 | if (network === "tron:0x2b6653dc") { 14 | if (!tronWebMainnet) { 15 | tronWebMainnet = new TronWeb({ 16 | fullHost: "https://api.trongrid.io/", 17 | }); 18 | } 19 | return tronWebMainnet; 20 | } 21 | return undefined; 22 | }; 23 | -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.* 7 | .yarn/* 8 | !.yarn/patches 9 | !.yarn/plugins 10 | !.yarn/releases 11 | !.yarn/versions 12 | 13 | # testing 14 | /coverage 15 | 16 | # next.js 17 | /.next/ 18 | /out/ 19 | 20 | # production 21 | /build 22 | 23 | # misc 24 | .DS_Store 25 | *.pem 26 | 27 | # debug 28 | npm-debug.log* 29 | yarn-debug.log* 30 | yarn-error.log* 31 | .pnpm-debug.log* 32 | 33 | # env files (can opt-in for committing if needed) 34 | .env* 35 | 36 | # vercel 37 | .vercel 38 | 39 | # typescript 40 | *.tsbuildinfo 41 | next-env.d.ts 42 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/RequestDataCard.tsx: -------------------------------------------------------------------------------- 1 | import { Col, Row, Text } from '@nextui-org/react' 2 | import { CodeBlock, codepen } from 'react-code-blocks' 3 | 4 | /** 5 | * Types 6 | */ 7 | interface IProps { 8 | data: Record 9 | } 10 | 11 | /** 12 | * Component 13 | */ 14 | export default function RequestDataCard({ data }: IProps) { 15 | return ( 16 | 17 | 18 | Data 19 | 25 | 26 | 27 | ) 28 | } 29 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/polkadot.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/PermissionDetailsCard.tsx: -------------------------------------------------------------------------------- 1 | import { Col, Row, Text } from '@nextui-org/react' 2 | 3 | type PermissionAction = { 4 | description: string 5 | } 6 | 7 | interface IProps { 8 | scope: PermissionAction[] 9 | } 10 | 11 | export default function PermissionDetailsCard({ scope }: IProps) { 12 | return ( 13 | 14 | 15 | Dapp is requesting following permissions 16 | {scope.map((action, index) => { 17 | return ( 18 | 19 | {action.description} 20 | 21 | ) 22 | })} 23 | 24 | 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import type { AppProps } from "next/app"; 2 | import { createGlobalStyle } from "styled-components"; 3 | import Metadata from "../components/Metadata"; 4 | 5 | import { ClientContextProvider } from "../contexts/ClientContext"; 6 | 7 | import { globalStyle } from "../styles"; 8 | const GlobalStyle = createGlobalStyle` 9 | ${globalStyle} 10 | `; 11 | 12 | function MyApp({ Component, pageProps }: AppProps) { 13 | return ( 14 | <> 15 | 16 | 17 | 18 | 19 | 20 | 21 | ); 22 | } 23 | 24 | export default MyApp; 25 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/assets/polkadot.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/data/RelayerRegions.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Types 3 | */ 4 | 5 | type RelayerType = { 6 | value: string 7 | label: string 8 | } 9 | 10 | /** 11 | * Relayer Regions 12 | */ 13 | export const REGIONALIZED_RELAYER_ENDPOINTS: RelayerType[] = [ 14 | { 15 | value: process.env.NEXT_PUBLIC_RELAY_URL || 'wss://relay.walletconnect.com', 16 | label: 'Default' 17 | }, 18 | 19 | { 20 | value: 'wss://us-east-1.relay.walletconnect.com', 21 | label: 'US' 22 | }, 23 | { 24 | value: 'wss://eu-central-1.relay.walletconnect.com', 25 | label: 'EU' 26 | }, 27 | { 28 | value: 'wss://ap-southeast-1.relay.walletconnect.com', 29 | label: 'Asia Pacific' 30 | } 31 | ] 32 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/icons/copy-icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": true, 7 | "noEmit": true, 8 | "esModuleInterop": true, 9 | "module": "esnext", 10 | "moduleResolution": "bundler", 11 | "resolveJsonModule": true, 12 | "isolatedModules": true, 13 | "jsx": "preserve", 14 | "incremental": true, 15 | "plugins": [ 16 | { 17 | "name": "next" 18 | } 19 | ], 20 | "paths": { 21 | "@/*": ["./*"] 22 | } 23 | }, 24 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 25 | "exclude": ["node_modules"] 26 | } 27 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/components/BalanceDisplay.tsx: -------------------------------------------------------------------------------- 1 | import { type TokenBalance } from "@/utils/BalanceFetcherUtil"; 2 | 3 | interface BalanceDisplayProps { 4 | balances: TokenBalance[]; 5 | isLoading: boolean; 6 | } 7 | 8 | export const BalanceDisplay: React.FC = ({ 9 | balances, 10 | isLoading, 11 | }) => { 12 | if (isLoading) { 13 | return null; 14 | } 15 | 16 | return ( 17 |
18 | {balances.map((token) => ( 19 |
20 | Available {token.symbol} Balance: {token.balance} {token.symbol} 21 |
22 | ))} 23 |
24 | ); 25 | }; 26 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/ChainSmartAddressMini.tsx: -------------------------------------------------------------------------------- 1 | import ChainAddressMini from './ChainAddressMini' 2 | import { Button, Col, Row, Spinner, Text, Tooltip } from '@nextui-org/react' 3 | import InfoIcon from '@mui/icons-material/Info' 4 | 5 | type SmartAccount = { 6 | address: string 7 | type: string 8 | } 9 | 10 | interface Props { 11 | account: SmartAccount 12 | } 13 | 14 | export default function ChainSmartAddressMini({ account }: Props) { 15 | if (!account) return 16 | return ( 17 | 18 | 19 | ({account.type}) 20 | 21 | 22 | 23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/RequestModalContainer.tsx: -------------------------------------------------------------------------------- 1 | import { Container, Modal, Text } from '@nextui-org/react' 2 | import { Fragment, ReactNode } from 'react' 3 | 4 | /** 5 | * Types 6 | */ 7 | interface IProps { 8 | title?: string 9 | children: ReactNode | ReactNode[] 10 | } 11 | 12 | /** 13 | * Component 14 | */ 15 | export default function RequestModalContainer({ children, title }: IProps) { 16 | return ( 17 | 18 | {title ? ( 19 | 20 | {title} 21 | 22 | ) : null} 23 | 24 | {children} 25 | 26 | 27 | ) 28 | } 29 | -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2017", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noEmit": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "bundler", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "preserve", 15 | "incremental": true, 16 | "plugins": [ 17 | { 18 | "name": "next" 19 | } 20 | ], 21 | "paths": { 22 | "@/*": ["./src/*"] 23 | } 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import "../styles/globals.css"; 2 | import type { AppProps } from "next/app"; 3 | import { createGlobalStyle } from "styled-components"; 4 | import { ClientContextProvider } from "../contexts/ClientContext"; 5 | import Metadata from "../components/Metadata"; 6 | 7 | import { globalStyle } from "./../styles"; 8 | const GlobalStyle = createGlobalStyle` 9 | ${globalStyle} 10 | `; 11 | 12 | function MyApp({ Component, pageProps }: AppProps) { 13 | return ( 14 | <> 15 | 16 | 17 | 18 | 19 | 20 | 21 | ); 22 | } 23 | 24 | export default MyApp; 25 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/components/shared/index.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const SContainer = styled.div` 4 | height: 100%; 5 | min-height: 200px; 6 | display: flex; 7 | flex-direction: column; 8 | justify-content: center; 9 | align-items: center; 10 | word-break: break-word; 11 | `; 12 | 13 | export const STable = styled(SContainer)` 14 | flex-direction: column; 15 | text-align: left; 16 | `; 17 | 18 | export const SRow = styled.div` 19 | width: 100%; 20 | display: flex; 21 | margin: 6px 0; 22 | `; 23 | 24 | export const SKey = styled.div` 25 | width: 30%; 26 | font-weight: 700; 27 | `; 28 | 29 | export const SValue = styled.div` 30 | width: 70%; 31 | font-family: monospace; 32 | `; 33 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/helpers/solana.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from "@solana/web3.js"; 2 | 3 | export function getPublicKeysFromAccounts(accounts: string[]) { 4 | return ( 5 | accounts 6 | // Filter out any non-solana accounts. 7 | .filter((account) => account.startsWith("solana:")) 8 | // Create a map of Solana address -> publicKey. 9 | .reduce((map: Record, account) => { 10 | const address = account.split(":").pop(); 11 | if (!address) { 12 | throw new Error( 13 | `Could not derive Solana address from CAIP account: ${account}` 14 | ); 15 | } 16 | map[address] = new PublicKey(address); 17 | return map; 18 | }, {}) 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/ChainDataMini.tsx: -------------------------------------------------------------------------------- 1 | import { getChainData } from '@/data/chainsUtil' 2 | import { Row, Avatar } from '@nextui-org/react' 3 | import { useMemo } from 'react' 4 | 5 | interface Props { 6 | chainId?: string // namespace + ":" + reference 7 | } 8 | 9 | // const StyledLogo = styled(Image, {}) 10 | 11 | export default function ChainDataMini({ chainId }: Props) { 12 | const chainData = useMemo(() => getChainData(chainId), [chainId]) 13 | console.log(chainData) 14 | 15 | if (!chainData) return <> 16 | return ( 17 | <> 18 | 19 | 20 | {chainData.name} 21 | 22 | 23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/PaymentCheckout/visual/BadgeCheckIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const BadgeCheckIcon = ({ color = 'green', size = 24 }) => { 4 | return ( 5 | 16 | 17 | 18 | 19 | ) 20 | } 21 | 22 | export default BadgeCheckIcon 23 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/components/shared/index.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const SContainer = styled.div` 4 | height: 100%; 5 | min-height: 200px; 6 | display: flex; 7 | flex-direction: column; 8 | justify-content: center; 9 | align-items: center; 10 | word-break: break-word; 11 | `; 12 | 13 | export const STable = styled(SContainer as any)` 14 | flex-direction: column; 15 | text-align: left; 16 | `; 17 | 18 | export const SRow = styled.div` 19 | width: 100%; 20 | display: flex; 21 | margin: 6px 0; 22 | `; 23 | 24 | export const SKey = styled.div` 25 | width: 30%; 26 | font-weight: 700; 27 | `; 28 | 29 | export const SValue = styled.div` 30 | width: 70%; 31 | font-family: monospace; 32 | `; 33 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/components/shared/index.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const SContainer = styled.div` 4 | height: 100%; 5 | min-height: 200px; 6 | display: flex; 7 | flex-direction: column; 8 | justify-content: center; 9 | align-items: center; 10 | word-break: break-word; 11 | `; 12 | 13 | export const STable = styled(SContainer as any)` 14 | flex-direction: column; 15 | text-align: left; 16 | `; 17 | 18 | export const SRow = styled.div` 19 | width: 100%; 20 | display: flex; 21 | margin: 6px 0; 22 | `; 23 | 24 | export const SKey = styled.div` 25 | width: 30%; 26 | font-weight: 700; 27 | `; 28 | 29 | export const SValue = styled.div` 30 | width: 70%; 31 | font-family: monospace; 32 | `; 33 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/githubLogo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/assets/polkadot.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/utils/ChainsUtil.ts: -------------------------------------------------------------------------------- 1 | import * as viemChains from "viem/chains"; 2 | 3 | if (!process.env["NEXT_PUBLIC_PROJECT_ID"]) { 4 | throw new Error("NEXT_PUBLIC_PROJECT_ID is required"); 5 | } 6 | 7 | export function getBlockchainApiRpcUrl(chainId: number) { 8 | return `https://rpc.walletconnect.org/v1/?chainId=eip155:${chainId}&projectId=${process.env["NEXT_PUBLIC_PROJECT_ID"]}`; 9 | } 10 | 11 | export const baseSepolia = { 12 | chainId: 84532, 13 | name: "Base Sepolia", 14 | currency: "BASE", 15 | explorerUrl: "https://sepolia.basescan.org", 16 | rpcUrl: getBlockchainApiRpcUrl(84532), 17 | }; 18 | 19 | export function getChain(id: number) { 20 | const chains = Object.values(viemChains) as viemChains.Chain[]; 21 | 22 | return chains.find((x) => x.id === id); 23 | } 24 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | React App 11 | 12 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | React App 11 | 12 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": true, 7 | "noEmit": true, 8 | "esModuleInterop": true, 9 | "module": "esnext", 10 | "moduleResolution": "bundler", 11 | "resolveJsonModule": true, 12 | "isolatedModules": true, 13 | "jsx": "preserve", 14 | "incremental": true, 15 | "plugins": [ 16 | { 17 | "name": "next" 18 | } 19 | ], 20 | "baseUrl": ".", 21 | "paths": { 22 | "@/*": ["src/*"] 23 | } 24 | }, 25 | "include": [ 26 | "next-env.d.ts", 27 | "**/*.ts", 28 | "**/*.tsx", 29 | ".next/types/**/*.ts", 30 | "src/app/**/*.tsx" 31 | ], 32 | "exclude": ["node_modules"] 33 | } 34 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | anvil: 3 | image: ghcr.io/foundry-rs/foundry:nightly-f6208d8db68f9acbe4ff8cd76958309efb61ea0b 4 | ports: ["8545:8545"] 5 | entrypoint: [ "anvil","--chain-id", "31337", "--fork-url", "https://gateway.tenderly.co/public/sepolia", "--host", "0.0.0.0", "--block-time", "0.1", "--gas-price", "1", "--silent",] 6 | platform: linux/amd64 7 | 8 | mock-paymaster: 9 | image: ghcr.io/pimlicolabs/mock-verifying-paymaster:main 10 | ports: ["3000:3000"] 11 | environment: 12 | - ALTO_RPC=http://alto:4337 13 | - ANVIL_RPC=http://anvil:8545 14 | 15 | alto: 16 | image: ghcr.io/pimlicolabs/mock-alto-bundler:main 17 | ports: ["4337:4337"] 18 | environment: 19 | - ANVIL_RPC=http://anvil:8545 20 | - SKIP_DEPLOYMENTS=true -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/icons/pairings-icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/icons/delete-icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/PaymentCheckout/visual/BadgeAlertIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const BadgeAlertIcon = ({ color = 'red', size = 24 }) => { 4 | return ( 5 | 16 | 17 | 18 | 19 | 20 | ) 21 | } 22 | 23 | export default BadgeAlertIcon 24 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/ModuleActions.tsx: -------------------------------------------------------------------------------- 1 | import { Fragment, useMemo } from 'react' 2 | import OwnableValidatorActions from '@/views/OwnableValidatorActions' 3 | import { ModuleView } from '@/data/ERC7579ModuleData' 4 | import { Module } from '@rhinestone/module-sdk' 5 | 6 | export default function ModuleActions({ 7 | accountAddress, 8 | chainId, 9 | view 10 | }: { 11 | accountAddress: string 12 | chainId: string 13 | view?: ModuleView 14 | }) { 15 | const componentView = useMemo(() => { 16 | switch (view) { 17 | case 'OwnableValidatorActions': 18 | return 19 | default: 20 | return null 21 | } 22 | }, [accountAddress, chainId, view]) 23 | 24 | return {componentView} 25 | } 26 | -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pos-dapp", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev --turbopack", 7 | "build": "next build --turbopack", 8 | "start": "next start", 9 | "lint": "eslint" 10 | }, 11 | "dependencies": { 12 | "@reown/appkit": "1.8.2", 13 | "next": "15.5.9", 14 | "react": "19.1.0", 15 | "react-dom": "19.1.0", 16 | "react-hot-toast": "^2.6.0", 17 | "@walletconnect/pos-client": "0.0.0-canary.1" 18 | }, 19 | "devDependencies": { 20 | "@eslint/eslintrc": "^3", 21 | "@tailwindcss/postcss": "^4", 22 | "@types/node": "^20", 23 | "@types/react": "^19", 24 | "@types/react-dom": "^19", 25 | "eslint": "^9", 26 | "eslint-config-next": "15.5.2", 27 | "tailwindcss": "^4", 28 | "typescript": "^5" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/components/Pairing.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import styled from "styled-components"; 3 | 4 | import { PairingTypes } from "@walletconnect/types"; 5 | 6 | import Peer from "./Peer"; 7 | 8 | interface PairingProps { 9 | pairing: PairingTypes.Struct; 10 | onClick?: any; 11 | } 12 | 13 | const SPairingContainer = styled.div` 14 | width: 100%; 15 | cursor: pointer; 16 | `; 17 | 18 | const Pairing = (props: PairingProps) => { 19 | const { peerMetadata } = props.pairing; 20 | return ( 21 | 22 |
23 | {typeof peerMetadata !== "undefined" ? ( 24 | 25 | ) : ( 26 |
{`Unknown Wallet`}
27 | )} 28 |
29 |
30 | ); 31 | }; 32 | 33 | export default Pairing; 34 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/helpers/sui.ts: -------------------------------------------------------------------------------- 1 | import { SuiClient } from "@mysten/sui/client"; 2 | 3 | // Cache clients 4 | const clients = new Map(); 5 | 6 | export function getSuiClient(chainId: string): SuiClient { 7 | if (clients.has(chainId)) { 8 | return clients.get(chainId)!; 9 | } 10 | let client: SuiClient; 11 | switch (chainId) { 12 | case "sui:mainnet": 13 | client = new SuiClient({ url: "https://fullnode.mainnet.sui.io/" }); 14 | break; 15 | case "sui:testnet": 16 | client = new SuiClient({ url: "https://fullnode.testnet.sui.io/" }); 17 | break; 18 | case "sui:devnet": 19 | client = new SuiClient({ url: "https://fullnode.devnet.sui.io/" }); 20 | break; 21 | default: 22 | throw new Error(`Unknown chainId: ${chainId}`); 23 | } 24 | clients.set(chainId, client); 25 | return client; 26 | } 27 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/components/ui/label.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as React from "react"; 4 | import * as LabelPrimitive from "@radix-ui/react-label"; 5 | import { cva, type VariantProps } from "class-variance-authority"; 6 | 7 | import { cn } from "@/lib/utils"; 8 | 9 | const labelVariants = cva( 10 | "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", 11 | ); 12 | 13 | const Label = React.forwardRef< 14 | React.ElementRef, 15 | React.ComponentPropsWithoutRef & 16 | VariantProps 17 | >(({ className, ...props }, ref) => ( 18 | 23 | )); 24 | Label.displayName = LabelPrimitive.Root.displayName; 25 | 26 | export { Label }; 27 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/components/Pairing.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import styled from "styled-components"; 3 | 4 | import { PairingTypes } from "@walletconnect/types"; 5 | 6 | import Peer from "./Peer"; 7 | 8 | interface PairingProps { 9 | pairing: PairingTypes.Struct; 10 | onClick?: any; 11 | } 12 | 13 | const SPairingContainer = styled.div` 14 | width: 100%; 15 | cursor: pointer; 16 | `; 17 | 18 | const Pairing = (props: PairingProps) => { 19 | const { peerMetadata } = props.pairing; 20 | return ( 21 | 22 |
23 | {typeof peerMetadata !== "undefined" ? ( 24 | 25 | ) : ( 26 |
{`Unknown`}
27 | )} 28 |
29 |
30 | ); 31 | }; 32 | 33 | export default Pairing; 34 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/components/ui/label.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as React from "react"; 4 | import * as LabelPrimitive from "@radix-ui/react-label"; 5 | import { cva, type VariantProps } from "class-variance-authority"; 6 | 7 | import { cn } from "@/lib/utils"; 8 | 9 | const labelVariants = cva( 10 | "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", 11 | ); 12 | 13 | const Label = React.forwardRef< 14 | React.ElementRef, 15 | React.ComponentPropsWithoutRef & 16 | VariantProps 17 | >(({ className, ...props }, ref) => ( 18 | 23 | )); 24 | Label.displayName = LabelPrimitive.Root.displayName; 25 | 26 | export { Label }; 27 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/utils/KadenaWalletUtil.ts: -------------------------------------------------------------------------------- 1 | import KadenaLib from '@/lib/KadenaLib' 2 | 3 | export let wallet: KadenaLib 4 | export let kadenaWallets: Record 5 | export let kadenaAddresses: string[] 6 | 7 | /** 8 | * Utilities 9 | */ 10 | 11 | export async function createOrRestoreKadenaWallet() { 12 | const secretKey = localStorage.getItem('KADENA_SECRET_KEY') 13 | 14 | if (secretKey) { 15 | wallet = KadenaLib.init({ secretKey }) 16 | } else { 17 | wallet = KadenaLib.init({}) 18 | } 19 | 20 | if (wallet.getSecretKey()) { 21 | localStorage.setItem('KADENA_SECRET_KEY', wallet.getSecretKey()) 22 | } 23 | 24 | const address = wallet.getAddress() 25 | kadenaAddresses = [address] 26 | 27 | kadenaWallets = { 28 | [address]: wallet 29 | } 30 | 31 | return { 32 | kadenaWallets, 33 | kadenaAddresses 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/utils/SuiWalletUtil.ts: -------------------------------------------------------------------------------- 1 | import SuiLib from '@/lib/SuiLib' 2 | 3 | export let wallet1: SuiLib 4 | export let suiAddresses: string[] 5 | 6 | /** 7 | * Utilities 8 | */ 9 | export async function createOrRestoreSuiWallet() { 10 | const mnemonic1 = localStorage.getItem('SUI_MNEMONIC_1') 11 | 12 | if (mnemonic1) { 13 | wallet1 = await SuiLib.init({ mnemonic: mnemonic1 }) 14 | } else { 15 | wallet1 = await SuiLib.init({}) 16 | // Don't store private keys in local storage in a production project! 17 | localStorage.setItem('SUI_MNEMONIC_1', wallet1.getMnemonic()) 18 | console.log('SUI_MNEMONIC_1', wallet1.getMnemonic()) 19 | } 20 | 21 | suiAddresses = [wallet1.getAddress()] 22 | 23 | return { 24 | suiWallet: wallet1, 25 | suiAddresses 26 | } 27 | } 28 | 29 | export const getWallet = async () => { 30 | return wallet1 31 | } 32 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/components/Pairing.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import styled from "styled-components"; 3 | 4 | import { PairingTypes } from "@walletconnect/types"; 5 | 6 | import Peer from "./Peer"; 7 | 8 | interface PairingProps { 9 | pairing: PairingTypes.Struct; 10 | onClick?: any; 11 | } 12 | 13 | const SPairingContainer = styled.div` 14 | width: 100%; 15 | cursor: pointer; 16 | `; 17 | 18 | const Pairing = (props: PairingProps) => { 19 | const { peerMetadata } = props.pairing; 20 | return ( 21 | 22 |
23 | {typeof peerMetadata !== "undefined" ? ( 24 | 25 | ) : ( 26 |
{`Unknown`}
27 | )} 28 |
29 |
30 | ); 31 | }; 32 | 33 | export default Pairing; 34 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "strict": true, 12 | "forceConsistentCasingInFileNames": true, 13 | "noEmit": true, 14 | "incremental": true, 15 | "esModuleInterop": true, 16 | "downlevelIteration": true, 17 | "module": "esnext", 18 | "moduleResolution": "node", 19 | "resolveJsonModule": true, 20 | "isolatedModules": true, 21 | "jsx": "preserve", 22 | "baseUrl": ".", 23 | "paths": { 24 | "@/*": ["src/*"], 25 | "react": ["node_modules/@types/react"], 26 | } 27 | }, 28 | "include": [ 29 | "next-env.d.ts", 30 | "**/*.ts", 31 | "**/*.tsx" 32 | ], 33 | "exclude": [ 34 | "node_modules" 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/RouteTransition.tsx: -------------------------------------------------------------------------------- 1 | import { AnimatePresence, motion } from 'framer-motion' 2 | import { useRouter } from 'next/router' 3 | import { ReactNode } from 'react' 4 | 5 | /** 6 | * Types 7 | */ 8 | interface IProps { 9 | children: ReactNode | ReactNode[] 10 | } 11 | 12 | /** 13 | * Components 14 | */ 15 | export default function RouteTransition({ children }: IProps) { 16 | const { pathname } = useRouter() 17 | 18 | return ( 19 | 20 | 28 | {children} 29 | 30 | 31 | ) 32 | } 33 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/utils/NearWalletUtil.ts: -------------------------------------------------------------------------------- 1 | import { NearWallet } from '@/lib/NearLib' 2 | import { generateSeedPhrase } from 'near-seed-phrase' 3 | 4 | export let nearAddresses: string[] 5 | export let nearWallet: NearWallet 6 | const SEED_PHRASE_KEY = 'NEAR_SEED_PHRASE' 7 | 8 | /** 9 | * Utilities 10 | */ 11 | export async function createOrRestoreNearWallet() { 12 | const seedPhrase = localStorage.getItem(SEED_PHRASE_KEY) || generateSeedPhrase().seedPhrase 13 | 14 | // NEAR only supports dev accounts in testnet. 15 | const wallet = await NearWallet.init('testnet', seedPhrase) 16 | 17 | localStorage.setItem(SEED_PHRASE_KEY, seedPhrase) 18 | 19 | const accounts = await wallet.getAllAccounts() 20 | console.log('near accounts', accounts) 21 | nearAddresses = accounts.map(x => x.accountId) 22 | nearWallet = wallet 23 | 24 | return { 25 | nearWallet, 26 | nearAddresses 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/app/HomePage.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import DemoApplicationList from "@/components/DemoApplicationList"; 3 | import { smartSessionsDemoAppMetadata } from "@/utils/DataUtil"; 4 | import { Separator } from "@/components/ui/separator"; 5 | 6 | export default function HomePage() { 7 | return ( 8 |
9 |
10 | 15 |
16 | 17 |
18 | 19 |
20 |
21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/RelayRegionPicker.tsx: -------------------------------------------------------------------------------- 1 | import { REGIONALIZED_RELAYER_ENDPOINTS } from '@/data/RelayerRegions' 2 | import SettingsStore from '@/store/SettingsStore' 3 | import { useSnapshot } from 'valtio' 4 | 5 | export default function AccountPicker() { 6 | const { relayerRegionURL } = useSnapshot(SettingsStore.state) 7 | 8 | function onSelect(value: string) { 9 | SettingsStore.setRelayerRegionURL(value) 10 | } 11 | 12 | return ( 13 | 27 | ) 28 | } 29 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/config/index.tsx: -------------------------------------------------------------------------------- 1 | import { WagmiAdapter } from "@reown/appkit-adapter-wagmi"; 2 | import { SolanaAdapter } from "@reown/appkit-adapter-solana"; 3 | import { arbitrum, optimism, base } from "@reown/appkit/networks"; 4 | 5 | export const projectId = process.env.NEXT_PUBLIC_PROJECT_ID; 6 | 7 | if (!projectId) { 8 | throw new Error("Project ID is not defined"); 9 | } 10 | 11 | export const networks = [base, optimism, arbitrum]; 12 | 13 | export const wagmiAdapter = new WagmiAdapter({ 14 | ssr: true, 15 | projectId, 16 | networks, 17 | }); 18 | 19 | export const solanaAdapter = new SolanaAdapter() 20 | 21 | export const metadata = { 22 | name: "Chain Abstraction Demo", 23 | description: "A demo of Chain Abstraction", 24 | url: "https://ca-demo.reown.com", // origin must match your domain & subdomain 25 | icons: ["https://ca-demo.reown.com/donut.png"], 26 | }; 27 | 28 | export const config = wagmiAdapter.wagmiConfig; 29 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/components/ui/separator.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as React from "react"; 4 | import * as SeparatorPrimitive from "@radix-ui/react-separator"; 5 | 6 | import { cn } from "@/lib/utils"; 7 | 8 | const Separator = React.forwardRef< 9 | React.ElementRef, 10 | React.ComponentPropsWithoutRef 11 | >( 12 | ( 13 | { className, orientation = "horizontal", decorative = true, ...props }, 14 | ref, 15 | ) => ( 16 | 27 | ), 28 | ); 29 | Separator.displayName = SeparatorPrimitive.Root.displayName; 30 | 31 | export { Separator }; 32 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/components/ui/separator.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as React from "react"; 4 | import * as SeparatorPrimitive from "@radix-ui/react-separator"; 5 | 6 | import { cn } from "@/lib/utils"; 7 | 8 | const Separator = React.forwardRef< 9 | React.ElementRef, 10 | React.ComponentPropsWithoutRef 11 | >( 12 | ( 13 | { className, orientation = "horizontal", decorative = true, ...props }, 14 | ref, 15 | ) => ( 16 | 27 | ), 28 | ); 29 | Separator.displayName = SeparatorPrimitive.Root.displayName; 30 | 31 | export { Separator }; 32 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/components/ui/progress.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as React from "react"; 4 | import * as ProgressPrimitive from "@radix-ui/react-progress"; 5 | 6 | import { cn } from "@/lib/utils"; 7 | 8 | const Progress = React.forwardRef< 9 | React.ElementRef, 10 | React.ComponentPropsWithoutRef 11 | >(({ className, value, ...props }, ref) => ( 12 | 20 | 24 | 25 | )); 26 | Progress.displayName = ProgressPrimitive.Root.displayName; 27 | 28 | export { Progress }; 29 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/components/ui/input.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { cn } from "@/lib/utils"; 4 | 5 | export interface InputProps 6 | extends React.InputHTMLAttributes {} 7 | 8 | const Input = React.forwardRef( 9 | ({ className, type, ...props }, ref) => { 10 | return ( 11 | 20 | ); 21 | }, 22 | ); 23 | Input.displayName = "Input"; 24 | 25 | export { Input }; 26 | -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/src/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | import { Geist, Geist_Mono } from "next/font/google"; 3 | import "./globals.css"; 4 | 5 | const geistSans = Geist({ 6 | variable: "--font-geist-sans", 7 | subsets: ["latin"], 8 | }); 9 | 10 | const geistMono = Geist_Mono({ 11 | variable: "--font-geist-mono", 12 | subsets: ["latin"], 13 | }); 14 | 15 | export const metadata: Metadata = { 16 | title: "POS Terminal - Crypto Payment System", 17 | description: 18 | "Professional Point of Sale terminal for cryptocurrency payments with USDC support on Ethereum, Base, and Optimism", 19 | }; 20 | 21 | export default function RootLayout({ 22 | children, 23 | }: Readonly<{ 24 | children: React.ReactNode; 25 | }>) { 26 | return ( 27 | 28 | 31 | {children} 32 | 33 | 34 | ); 35 | } 36 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/components/Icon.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import * as PropTypes from "prop-types"; 3 | import styled from "styled-components"; 4 | 5 | interface IconStyleProps { 6 | size: number; 7 | } 8 | 9 | const SIcon = styled.img` 10 | width: ${({ size }) => `${size}px`}; 11 | height: ${({ size }) => `${size}px`}; 12 | `; 13 | 14 | const Icon = (props: any) => { 15 | const { src, fallback, size } = props; 16 | return ( 17 | { 22 | if (fallback) { 23 | event.target.src = fallback; 24 | } 25 | }} 26 | /> 27 | ); 28 | }; 29 | 30 | Icon.propTypes = { 31 | src: PropTypes.string, 32 | fallback: PropTypes.string, 33 | size: PropTypes.number, 34 | }; 35 | 36 | Icon.defaultProps = { 37 | src: null, 38 | fallback: "", 39 | size: 20, 40 | }; 41 | 42 | export default Icon; 43 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/modals/LoaderModal.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import Loader from "../components/Loader"; 4 | import { SContainer } from "../components/shared"; 5 | 6 | import { SModalContainer, SModalParagraph, SModalTitle } from "./shared"; 7 | 8 | interface LoaderModal { 9 | title: string; 10 | text?: string; 11 | subtitle?: string; 12 | isError?: boolean; 13 | } 14 | 15 | const LoaderModal = (props: LoaderModal) => { 16 | const { title, text, subtitle, isError } = props; 17 | return ( 18 | <> 19 | 20 | {title} 21 | 22 | {!isError && } 23 | {!isError &&
} 24 | {text && {text}} 25 | {subtitle && {subtitle}} 26 |
27 |
28 | 29 | ); 30 | }; 31 | 32 | export default LoaderModal; 33 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/data/KadenaData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Types 3 | */ 4 | export type TKadenaChain = keyof typeof KADENA_MAINNET_CHAINS 5 | 6 | /** 7 | * Chains 8 | */ 9 | export const KADENA_MAINNET_CHAINS = { 10 | 'kadena:mainnet01': { 11 | chainId: 'mainnet01', 12 | name: 'Kadena', 13 | logo: '/chain-logos/kadena.png', 14 | rgb: '237, 9, 143', 15 | namespace: 'kadena' 16 | } 17 | } 18 | 19 | export const KADENA_TEST_CHAINS = { 20 | 'kadena:testnet04': { 21 | chainId: 'testnet04', 22 | name: 'Kadena Testnet', 23 | logo: '/chain-logos/kadena.png', 24 | rgb: '237, 9, 143', 25 | namespace: 'kadena' 26 | } 27 | } 28 | 29 | export const KADENA_CHAINS = { ...KADENA_MAINNET_CHAINS, ...KADENA_TEST_CHAINS } 30 | 31 | /** 32 | * Methods 33 | */ 34 | export const KADENA_SIGNING_METHODS = { 35 | KADENA_GET_ACCOUNTS: 'kadena_getAccounts_v1', 36 | KADENA_SIGN: 'kadena_sign_v1', 37 | KADENA_QUICKSIGN: 'kadena_quicksign_v1' 38 | } 39 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/components/ui/input.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { cn } from "@/lib/utils"; 4 | 5 | export interface InputProps 6 | extends React.InputHTMLAttributes {} 7 | 8 | const Input = React.forwardRef( 9 | ({ className, type, ...props }, ref) => { 10 | return ( 11 | 20 | ); 21 | }, 22 | ); 23 | Input.displayName = "Input"; 24 | 25 | export { Input }; 26 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/components/Icon.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import * as PropTypes from "prop-types"; 3 | import styled from "styled-components"; 4 | 5 | interface IconStyleProps { 6 | size: number; 7 | } 8 | 9 | const SIcon = styled.img` 10 | width: ${({ size }) => `${size}px`}; 11 | height: ${({ size }) => `${size}px`}; 12 | `; 13 | 14 | const Icon = (props: any) => { 15 | const { src, fallback, size } = props; 16 | return ( 17 | { 22 | if (fallback) { 23 | event.target.src = fallback; 24 | } 25 | }} 26 | /> 27 | ); 28 | }; 29 | 30 | Icon.propTypes = { 31 | src: PropTypes.string, 32 | fallback: PropTypes.string, 33 | size: PropTypes.number, 34 | }; 35 | 36 | Icon.defaultProps = { 37 | src: null, 38 | fallback: "", 39 | size: 20, 40 | }; 41 | 42 | export default Icon; 43 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/views/OwnableValidatorUninstallAction.tsx: -------------------------------------------------------------------------------- 1 | import { Button, Collapse, Loading, Row, Text } from '@nextui-org/react' 2 | import { useState } from 'react' 3 | 4 | export default function OwnableValidatorUninstallActions({ 5 | accountAddress, 6 | chainId 7 | }: { 8 | accountAddress: string 9 | chainId: string 10 | }) { 11 | const [isUninstalling, setUninstalling] = useState(false) 12 | 13 | const uninstall = async () => { 14 | setUninstalling(true) 15 | setUninstalling(false) 16 | } 17 | 18 | return ( 19 | Uninstall}> 20 | 21 | Coming soon... 22 | 25 | 26 | 27 | ) 28 | } 29 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/components/Icon.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import * as PropTypes from "prop-types"; 3 | import styled from "styled-components"; 4 | 5 | interface IconStyleProps { 6 | size: number; 7 | } 8 | 9 | const SIcon = styled.img` 10 | width: ${({ size }) => `${size}px`}; 11 | height: ${({ size }) => `${size}px`}; 12 | `; 13 | 14 | const Icon = (props: any) => { 15 | const { src, fallback, size } = props; 16 | return ( 17 | { 22 | if (fallback) { 23 | event.target.src = fallback; 24 | } 25 | }} 26 | /> 27 | ); 28 | }; 29 | 30 | Icon.propTypes = { 31 | src: PropTypes.string, 32 | fallback: PropTypes.string, 33 | size: PropTypes.number, 34 | }; 35 | 36 | Icon.defaultProps = { 37 | src: null, 38 | fallback: "", 39 | size: 20, 40 | }; 41 | 42 | export default Icon; 43 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/PageHeader.tsx: -------------------------------------------------------------------------------- 1 | import { Col, Divider, Row, Text } from '@nextui-org/react' 2 | import { Fragment, ReactNode } from 'react' 3 | 4 | /** 5 | * Types 6 | */ 7 | interface Props { 8 | children?: ReactNode | ReactNode[] 9 | title: string 10 | } 11 | 12 | /** 13 | * Component 14 | */ 15 | export default function PageHeader({ title, children }: Props) { 16 | return ( 17 | 18 | 19 | 20 | 27 | {title} 28 | 29 | 30 | {children ? {children} : null} 31 | 32 | 33 | 34 | 35 | ) 36 | } 37 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/wallet-connect-logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/chains/ton.ts: -------------------------------------------------------------------------------- 1 | import { NamespaceMetadata, ChainMetadata, ChainsMap } from "../helpers"; 2 | 3 | export const TonChainData: ChainsMap = { 4 | "-239": { 5 | id: "ton:-239", 6 | name: "TON Mainnet", 7 | rpc: [], 8 | slip44: 607, 9 | testnet: false, 10 | }, 11 | "-3": { 12 | id: "ton:-3", 13 | name: "TON Testnet", 14 | rpc: [], 15 | slip44: 607, 16 | testnet: true, 17 | }, 18 | }; 19 | 20 | export const TonMetadata: NamespaceMetadata = { 21 | "-239": { 22 | logo: "/assets/ton.png", 23 | rgb: "0, 153, 255", 24 | }, 25 | "-3": { 26 | logo: "/assets/ton.png", 27 | rgb: "0, 153, 255", 28 | }, 29 | }; 30 | 31 | export function getChainMetadata(chainId: string): ChainMetadata { 32 | const reference = chainId.split(":")[1]; 33 | const metadata = TonMetadata[reference]; 34 | if (typeof metadata === "undefined") { 35 | throw new Error(`No chain metadata found for chainId: ${chainId}`); 36 | } 37 | return metadata; 38 | } 39 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/next.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | reactStrictMode: true, 3 | webpack(config) { 4 | config.resolve.fallback = { 5 | ...config.resolve.fallback, 6 | fs: false 7 | } 8 | // needed for tiny-secp256k1 package 9 | config.experiments.asyncWebAssembly = true 10 | config.module.rules.push({ 11 | test: /\.wasm$/, 12 | type: 'webassembly/async' 13 | }) 14 | return config 15 | }, 16 | async headers() { 17 | return [ 18 | { 19 | source: '/api/:path*', 20 | headers: [ 21 | { 22 | key: 'Access-Control-Allow-Origin', 23 | value: '*' 24 | }, 25 | { 26 | key: 'Access-Control-Allow-Methods', 27 | value: 'GET, POST, PUT, DELETE, OPTIONS' 28 | }, 29 | { 30 | key: 'Access-Control-Allow-Headers', 31 | value: 'Content-Type, Authorization' 32 | } 33 | ] 34 | } 35 | ] 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/constants/default.ts: -------------------------------------------------------------------------------- 1 | export const DEFAULT_MAIN_CHAINS = [ 2 | // mainnets 3 | "cosmos:cosmoshub-4", 4 | ]; 5 | 6 | export const DEFAULT_TEST_CHAINS = [ 7 | // testnets 8 | ]; 9 | 10 | export const DEFAULT_CHAINS = [...DEFAULT_MAIN_CHAINS, ...DEFAULT_TEST_CHAINS]; 11 | 12 | export const DEFAULT_PROJECT_ID = process.env.NEXT_PUBLIC_PROJECT_ID; 13 | 14 | export const DEFAULT_INFURA_ID = process.env.NEXT_PUBLIC_INFURA_ID; 15 | 16 | export const DEFAULT_RELAY_URL = process.env.NEXT_PUBLIC_RELAY_URL; 17 | 18 | export const DEFAULT_EIP155_METHODS = ["eth_sendTransaction", "personal_sign", "eth_signTypedData"]; 19 | 20 | export const DEFAULT_COSMOS_METHODS = ["cosmos_signDirect", "cosmos_signAmino"]; 21 | 22 | export const DEFAULT_LOGGER = "debug"; 23 | 24 | export const DEFAULT_APP_METADATA = { 25 | name: "React App", 26 | description: "React App for WalletConnect", 27 | url: "https://walletconnect.com/", 28 | icons: ["https://avatars.githubusercontent.com/u/37784886"], 29 | }; 30 | -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/public/globe.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/icons/sessions-icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/components/ui/sonner.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { useTheme } from "next-themes"; 4 | import { Toaster as Sonner } from "sonner"; 5 | 6 | type ToasterProps = React.ComponentProps; 7 | 8 | const Toaster = ({ ...props }: ToasterProps) => { 9 | const { theme = "system" } = useTheme(); 10 | 11 | return ( 12 | 28 | ); 29 | }; 30 | 31 | export { Toaster }; 32 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/ChainCard.tsx: -------------------------------------------------------------------------------- 1 | import { Card } from '@nextui-org/react' 2 | import { ReactNode } from 'react' 3 | 4 | interface Props { 5 | children: ReactNode | ReactNode[] 6 | rgb: string 7 | flexDirection: 'row' | 'col' 8 | alignItems: 'center' | 'flex-start' 9 | flexWrap?: 'wrap' | 'nowrap' 10 | } 11 | 12 | export default function ChainCard({ rgb, children, flexDirection, alignItems, flexWrap }: Props) { 13 | return ( 14 | 25 | 34 | {children} 35 | 36 | 37 | ) 38 | } 39 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/components/ui/sonner.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import React from "react"; 3 | import { useTheme } from "next-themes"; 4 | import { Toaster as Sonner } from "sonner"; 5 | 6 | type ToasterProps = React.ComponentProps; 7 | 8 | const Toaster = ({ ...props }: ToasterProps) => { 9 | const { theme = "system" } = useTheme(); 10 | 11 | return ( 12 | 28 | ); 29 | }; 30 | 31 | export { Toaster }; 32 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/chains/stacks.ts: -------------------------------------------------------------------------------- 1 | import { NamespaceMetadata, ChainMetadata, ChainsMap } from "../helpers"; 2 | 3 | export const StacksChainData: ChainsMap = { 4 | "1": { 5 | id: "stacks:1", 6 | name: "Stacks Mainnet", 7 | rpc: [], 8 | slip44: 195, 9 | testnet: false, 10 | }, 11 | "2147483648": { 12 | id: "stacks:2147483648", 13 | name: "Stacks Testnet", 14 | rpc: [], 15 | slip44: 195, 16 | testnet: true, 17 | }, 18 | }; 19 | 20 | export const StacksMetadata: NamespaceMetadata = { 21 | // Stacks Mainnet 22 | "1": { 23 | logo: "/assets/stacks.png", 24 | rgb: "85, 70, 254", 25 | }, 26 | // Stacks TestNet 27 | "2147483648": { 28 | logo: "/assets/stacks.png", 29 | rgb: "85, 70, 254", 30 | }, 31 | }; 32 | 33 | export function getChainMetadata(chainId: string): ChainMetadata { 34 | const reference = chainId.split(":")[1]; 35 | const metadata = StacksMetadata[reference]; 36 | if (typeof metadata === "undefined") { 37 | throw new Error(`No chain metadata found for chainId: ${chainId}`); 38 | } 39 | return metadata; 40 | } 41 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/data/PolkadotData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Types 3 | */ 4 | export type TPolkadotChain = keyof typeof POLKADOT_MAINNET_CHAINS 5 | 6 | /** 7 | * Chains 8 | */ 9 | export const POLKADOT_MAINNET_CHAINS = { 10 | 'polkadot:91b171bb158e2d3848fa23a9f1c25182': { 11 | chainId: '91b171bb158e2d3848fa23a9f1c25182', 12 | name: 'Polkadot', 13 | logo: '/chain-logos/polkadot.svg', 14 | rgb: '230, 1, 122', 15 | rpc: '', 16 | namespace: 'polkadot' 17 | } 18 | } 19 | 20 | export const POLKADOT_TEST_CHAINS = { 21 | 'polkadot:e143f23803ac50e8f6f8e62695d1ce9e': { 22 | chainId: 'e143f23803ac50e8f6f8e62695d1ce9e', 23 | name: 'Polkadot Westend', 24 | logo: '/chain-logos/westend.svg', 25 | rgb: '218, 104, 167', 26 | rpc: '', 27 | namespace: 'polkadot' 28 | } 29 | } 30 | 31 | export const POLKADOT_CHAINS = { ...POLKADOT_MAINNET_CHAINS, ...POLKADOT_TEST_CHAINS } 32 | /** 33 | * Methods 34 | */ 35 | export const POLKADOT_SIGNING_METHODS = { 36 | POLKADOT_SIGN_TRANSACTION: 'polkadot_signTransaction', 37 | POLKADOT_SIGN_MESSAGE: 'polkadot_signMessage' 38 | } 39 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/components/Navbar.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import Image from "next/image"; 3 | import { ConnectWalletButton } from "@/components/ConnectWalletButton"; 4 | import { useAppKitAccount } from "@reown/appkit/react"; 5 | 6 | const Navbar = () => { 7 | const { status, address } = useAppKitAccount(); 8 | return ( 9 | 27 | ); 28 | }; 29 | 30 | export default Navbar; 31 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/chains/tron.ts: -------------------------------------------------------------------------------- 1 | import { NamespaceMetadata, ChainMetadata, ChainsMap } from "../helpers"; 2 | 3 | export const TronChainData: ChainsMap = { 4 | "0x2b6653dc": { 5 | id: "tron:0x2b6653dc", 6 | name: "Tron Mainnet", 7 | rpc: [], 8 | slip44: 195, 9 | testnet: false, 10 | }, 11 | "0xcd8690dc": { 12 | id: "tron:0xcd8690dc", 13 | name: "Tron Testnet", 14 | rpc: [], 15 | slip44: 195, 16 | testnet: true, 17 | }, 18 | }; 19 | 20 | export const TronMetadata: NamespaceMetadata = { 21 | // Tron Mainnet 22 | "0x2b6653dc": { 23 | logo: "/assets/tron.png", 24 | rgb: "183, 62, 49", 25 | }, 26 | // Tron TestNet 27 | "0xcd8690dc": { 28 | logo: "assets/tron.png", 29 | rgb: "183, 62, 49", 30 | }, 31 | }; 32 | 33 | export function getChainMetadata(chainId: string): ChainMetadata { 34 | const reference = chainId.split(":")[1]; 35 | const metadata = TronMetadata[reference]; 36 | if (typeof metadata === "undefined") { 37 | throw new Error(`No chain metadata found for chainId: ${chainId}`); 38 | } 39 | return metadata; 40 | } 41 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import "../styles/globals.css"; 2 | import type { AppProps } from "next/app"; 3 | import { createGlobalStyle } from "styled-components"; 4 | import { Toaster } from "react-hot-toast"; 5 | 6 | import { ClientContextProvider } from "../contexts/ClientContext"; 7 | import { JsonRpcContextProvider } from "../contexts/JsonRpcContext"; 8 | import { ChainDataContextProvider } from "../contexts/ChainDataContext"; 9 | import Metadata from "../components/Metadata"; 10 | 11 | import { globalStyle } from "../styles"; 12 | const GlobalStyle = createGlobalStyle` 13 | ${globalStyle} 14 | `; 15 | 16 | function MyApp({ Component, pageProps }: AppProps) { 17 | return ( 18 | <> 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | ); 31 | } 32 | 33 | export default MyApp; 34 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/components/TicTacToeComponents/DisplayPlayerScore.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | function DisplayPlayerScore({ 4 | icon, 5 | label, 6 | score, 7 | color, 8 | }: { 9 | icon: React.ReactNode; 10 | label: string; 11 | score: number; 12 | color: string; 13 | }) { 14 | return ( 15 |
16 |
17 |
24 | {icon} 25 |
26 |
27 |
28 |

{label}:

29 | 30 | {score} 31 | 32 |
33 |
34 | ); 35 | } 36 | 37 | export default DisplayPlayerScore; 38 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/helpers/eip712.ts: -------------------------------------------------------------------------------- 1 | // From spec: https://eips.ethereum.org/EIPS/eip-712 2 | const example = { 3 | types: { 4 | EIP712Domain: [ 5 | { name: "name", type: "string" }, 6 | { name: "version", type: "string" }, 7 | { name: "chainId", type: "uint256" }, 8 | { name: "verifyingContract", type: "address" }, 9 | ], 10 | Person: [ 11 | { name: "name", type: "string" }, 12 | { name: "wallet", type: "address" }, 13 | ], 14 | Mail: [ 15 | { name: "from", type: "Person" }, 16 | { name: "to", type: "Person" }, 17 | { name: "contents", type: "string" }, 18 | ], 19 | }, 20 | primaryType: "Mail", 21 | domain: { 22 | name: "Ether Mail", 23 | version: "1", 24 | chainId: 1, 25 | verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", 26 | }, 27 | message: { 28 | from: { name: "Cow", wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826" }, 29 | to: { name: "Bob", wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" }, 30 | contents: "Hello, Bob!", 31 | }, 32 | }; 33 | 34 | export const eip712 = { 35 | example, 36 | }; 37 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/PaymentCheckout/visual/WalletIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | /** 4 | * Wallet icon 5 | */ 6 | export const WalletIcon: React.FC<{ width?: number; height?: number }> = ({ 7 | width = 10, 8 | height = 9 9 | }) => { 10 | return ( 11 | 12 | 16 | 17 | ) 18 | } 19 | 20 | export default WalletIcon 21 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/modals/PingModal.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import Loader from "../components/Loader"; 4 | import { SContainer } from "../components/shared"; 5 | 6 | import { SModalContainer, SModalTitle } from "./shared"; 7 | 8 | interface PingModalProps { 9 | pending: boolean; 10 | result: any; 11 | } 12 | 13 | const PingModal = (props: PingModalProps) => { 14 | const { pending, result } = props; 15 | return ( 16 | <> 17 | {pending ? ( 18 | 19 | {"Pending Session Ping"} 20 | 21 | 22 | 23 | 24 | ) : result ? ( 25 | 26 | 27 | {result.valid ? "Successful Session Ping" : "Failed Session Ping"} 28 | 29 | 30 | ) : ( 31 | 32 | {"Unknown Error with Session Ping"} 33 | 34 | )} 35 | 36 | ); 37 | }; 38 | 39 | export default PingModal; 40 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/helpers/eip712.ts: -------------------------------------------------------------------------------- 1 | // From spec: https://eips.ethereum.org/EIPS/eip-712 2 | const example = { 3 | types: { 4 | EIP712Domain: [ 5 | { name: "name", type: "string" }, 6 | { name: "version", type: "string" }, 7 | { name: "chainId", type: "uint256" }, 8 | { name: "verifyingContract", type: "address" }, 9 | ], 10 | Person: [ 11 | { name: "name", type: "string" }, 12 | { name: "wallet", type: "address" }, 13 | ], 14 | Mail: [ 15 | { name: "from", type: "Person" }, 16 | { name: "to", type: "Person" }, 17 | { name: "contents", type: "string" }, 18 | ], 19 | }, 20 | primaryType: "Mail", 21 | domain: { 22 | name: "Ether Mail", 23 | version: "1", 24 | chainId: 1, 25 | verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", 26 | }, 27 | message: { 28 | from: { name: "Cow", wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826" }, 29 | to: { name: "Bob", wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" }, 30 | contents: "Hello, Bob!", 31 | }, 32 | }; 33 | 34 | export const eip712 = { 35 | example, 36 | }; 37 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/modals/PingModal.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import Loader from "../components/Loader"; 4 | import { SContainer } from "../components/shared"; 5 | 6 | import { SModalContainer, SModalTitle } from "./shared"; 7 | 8 | interface PingModalProps { 9 | pending: boolean; 10 | result: any; 11 | } 12 | 13 | const PingModal = (props: PingModalProps) => { 14 | const { pending, result } = props; 15 | return ( 16 | <> 17 | {pending ? ( 18 | 19 | {"Pending Session Ping"} 20 | 21 | 22 | 23 | 24 | ) : result ? ( 25 | 26 | 27 | {result.valid ? "Successful Session Ping" : "Failed Session Ping"} 28 | 29 | 30 | ) : ( 31 | 32 | {"Unknown Error with Session Ping"} 33 | 34 | )} 35 | 36 | ); 37 | }; 38 | 39 | export default PingModal; 40 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/modals/PingModal.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import Loader from "../components/Loader"; 4 | import { SContainer } from "../components/shared"; 5 | 6 | import { SModalContainer, SModalTitle } from "./shared"; 7 | 8 | interface PingModalProps { 9 | pending: boolean; 10 | result: any; 11 | } 12 | 13 | const PingModal = (props: PingModalProps) => { 14 | const { pending, result } = props; 15 | return ( 16 | <> 17 | {pending ? ( 18 | 19 | {"Pending Session Ping"} 20 | 21 | 22 | 23 | 24 | ) : result ? ( 25 | 26 | 27 | {result.valid ? "Successful Session Ping" : "Failed Session Ping"} 28 | 29 | 30 | ) : ( 31 | 32 | {"Unknown Error with Session Ping"} 33 | 34 | )} 35 | 36 | ); 37 | }; 38 | 39 | export default PingModal; 40 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/chains/cosmos.ts: -------------------------------------------------------------------------------- 1 | import { JsonRpcRequest } from "@walletconnect/jsonrpc-utils"; 2 | 3 | import { NamespaceMetadata, ChainMetadata, ChainRequestRender } from "../helpers"; 4 | 5 | export const CosmosMetadata: NamespaceMetadata = { 6 | "cosmoshub-4": { 7 | logo: "/assets/" + "cosmos-cosmoshub-4.png", 8 | rgb: "27, 31, 53", 9 | }, 10 | }; 11 | 12 | export function getChainMetadata(chainId: string): ChainMetadata { 13 | const reference = chainId.split(":")[1]; 14 | const metadata = CosmosMetadata[reference]; 15 | if (typeof metadata === "undefined") { 16 | throw new Error(`No chain metadata found for chainId: ${chainId}`); 17 | } 18 | return metadata; 19 | } 20 | 21 | export function getChainRequestRender(request: JsonRpcRequest): ChainRequestRender[] { 22 | let params = [{ label: "Method", value: request.method }]; 23 | 24 | switch (request.method) { 25 | default: 26 | params = [ 27 | ...params, 28 | { 29 | label: "params", 30 | value: JSON.stringify(request.params, null, "\t"), 31 | }, 32 | ]; 33 | break; 34 | } 35 | return params; 36 | } 37 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/modals/PairingModal.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { PairingTypes } from "@walletconnect/types"; 4 | 5 | import Button from "../components/Button"; 6 | import Pairing from "../components/Pairing"; 7 | import { STable } from "../components/shared"; 8 | 9 | import { SModalContainer, SModalTitle } from "./shared"; 10 | 11 | interface PairingModalProps { 12 | pairings: PairingTypes.Struct[]; 13 | connect: (pairing?: { topic: string }) => Promise; 14 | } 15 | 16 | const PairingModal = (props: PairingModalProps) => { 17 | const { pairings, connect } = props; 18 | return ( 19 | 20 | {"Select available pairing or create new one"} 21 | 22 | {pairings.map(pairing => ( 23 | connect({ topic: pairing.topic })} 27 | /> 28 | ))} 29 | 30 | 31 | 32 | ); 33 | }; 34 | 35 | export default PairingModal; 36 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/modals/PairingModal.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { PairingTypes } from "@walletconnect/types"; 4 | 5 | import Button from "../components/Button"; 6 | import Pairing from "../components/Pairing"; 7 | import { STable } from "../components/shared"; 8 | 9 | import { SModalContainer, SModalTitle } from "./shared"; 10 | 11 | interface PairingModalProps { 12 | pairings: PairingTypes.Struct[]; 13 | connect: (pairing?: { topic: string }) => Promise; 14 | } 15 | 16 | const PairingModal = (props: PairingModalProps) => { 17 | const { pairings, connect } = props; 18 | return ( 19 | 20 | {"Select available pairing or create new one"} 21 | 22 | {pairings.map(pairing => ( 23 | connect({ topic: pairing.topic })} 27 | /> 28 | ))} 29 | 30 | 31 | 32 | ); 33 | }; 34 | 35 | export default PairingModal; 36 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/utils/EIP5792WalletUtil.ts: -------------------------------------------------------------------------------- 1 | import { eip155Addresses } from './EIP155WalletUtil' 2 | import { 3 | GetCapabilitiesResult, 4 | SendCallsParams, 5 | supportedEIP5792CapabilitiesForEOA, 6 | supportedEIP5792CapabilitiesForSCA 7 | } from '@/data/EIP5792Data' 8 | 9 | export function getWalletCapabilities(addresses: string[]) { 10 | const walletCapabilities: GetCapabilitiesResult = {} 11 | addresses.forEach(address => { 12 | const namespacesAddress = address.split(':') 13 | // address will be the last index element whether 14 | // its a simple address or namespace:chainId:address 15 | const addr = namespacesAddress[namespacesAddress.length - 1] 16 | if (eip155Addresses.includes(addr)) { 17 | // no capabilities support for EOA for now. 18 | return 19 | } 20 | walletCapabilities[addr] = supportedEIP5792CapabilitiesForSCA 21 | }) 22 | return walletCapabilities 23 | } 24 | 25 | export const getSendCallData = (sendCallParams: SendCallsParams) => { 26 | return sendCallParams.calls.map(call => ({ 27 | to: call.to, 28 | value: BigInt(call.value || 0), 29 | data: call.data || '0x' 30 | })) 31 | } 32 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/ProposalSelectSection.tsx: -------------------------------------------------------------------------------- 1 | import AccountSelectCard from '@/components/AccountSelectCard' 2 | import { Col, Row, Text } from '@nextui-org/react' 3 | 4 | /** 5 | * Types 6 | */ 7 | interface IProps { 8 | chain: string 9 | addresses: string[] 10 | selectedAddresses: string[] | undefined 11 | onSelect: (chain: string, address: string) => void 12 | isRequired: boolean 13 | } 14 | 15 | /** 16 | * Component 17 | */ 18 | export default function ProposalSelectSection({ 19 | addresses, 20 | selectedAddresses, 21 | chain, 22 | onSelect, 23 | isRequired 24 | }: IProps) { 25 | return ( 26 | 27 | 28 | {`Choose ${chain} accounts`} 29 | {addresses.map((address, index) => ( 30 | onSelect(chain, address)} 35 | selected={selectedAddresses?.includes(address) ?? false} 36 | isRequired={isRequired} 37 | /> 38 | ))} 39 | 40 | 41 | ) 42 | } 43 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 WalletConnect, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/helpers/tx.ts: -------------------------------------------------------------------------------- 1 | import * as encoding from "@walletconnect/encoding"; 2 | 3 | import { apiGetAccountNonce, apiGetGasPrice } from "./api"; 4 | 5 | export async function getGasPrice(chainId: string): Promise { 6 | const gasPrice = await apiGetGasPrice(chainId); 7 | return gasPrice; 8 | } 9 | 10 | export async function formatTestTransaction(account: string) { 11 | const [namespace, reference, address] = account.split(":"); 12 | const chainId = `${namespace}:${reference}`; 13 | // nonce 14 | const _nonce = await apiGetAccountNonce(address, chainId); 15 | 16 | const nonce = encoding.sanitizeHex(encoding.numberToHex(_nonce)); 17 | 18 | // gasPrice 19 | const _gasPrice = await getGasPrice(chainId); 20 | const gasPrice = encoding.sanitizeHex(_gasPrice); 21 | 22 | // gasLimit 23 | const _gasLimit = 21000; 24 | const gasLimit = encoding.sanitizeHex(encoding.numberToHex(_gasLimit)); 25 | 26 | // value 27 | const _value = 0; 28 | const value = encoding.sanitizeHex(encoding.numberToHex(_value)); 29 | 30 | const tx = { from: address, to: address, data: "0x", nonce, gasPrice, gasLimit, value }; 31 | 32 | return tx; 33 | } 34 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/public/assets/settings.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/consts/smartAccounts.ts: -------------------------------------------------------------------------------- 1 | import { KernelSmartAccountLib } from '@/lib/smart-accounts/KernelSmartAccountLib' 2 | import { SafeSmartAccountLib } from '@/lib/smart-accounts/SafeSmartAccountLib' 3 | import { getAddress } from 'viem' 4 | import { baseSepolia, goerli, polygonMumbai, sepolia } from 'viem/chains' 5 | 6 | // Types 7 | export const allowedChains = [sepolia, polygonMumbai, goerli, baseSepolia] 8 | // build chains so I can access them by id 9 | export const chains = allowedChains.reduce((acc, chain) => { 10 | acc[chain.id] = chain 11 | return acc 12 | }, {} as Record) 13 | export type Chain = typeof allowedChains[number] 14 | 15 | export const availableSmartAccounts = { 16 | safe: SafeSmartAccountLib, 17 | kernel: KernelSmartAccountLib 18 | } 19 | 20 | export const SAFE_FALLBACK_HANDLER_STORAGE_SLOT = 21 | '0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5' 22 | 23 | export const SAFE_4337_MODULE_ADDRESSES = [ 24 | getAddress('0xa581c4A4DB7175302464fF3C06380BC3270b4037'), 25 | getAddress('0x75cf11467937ce3F2f357CE24ffc3DBF8fD5c226'), 26 | getAddress('0x3Fdb5BC686e861480ef99A6E3FaAe03c0b9F32e2') 27 | ] 28 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 WalletConnect, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/helpers/tx.ts: -------------------------------------------------------------------------------- 1 | import * as encoding from "@walletconnect/encoding"; 2 | 3 | import { apiGetAccountNonce, apiGetGasPrice } from "./api"; 4 | 5 | export async function getGasPrice(chainId: string): Promise { 6 | const gasPrice = await apiGetGasPrice(chainId); 7 | return gasPrice; 8 | } 9 | 10 | export async function formatTestTransaction(account: string) { 11 | const [namespace, reference, address] = account.split(":"); 12 | const chainId = `${namespace}:${reference}`; 13 | // nonce 14 | const _nonce = await apiGetAccountNonce(address, chainId); 15 | 16 | const nonce = encoding.sanitizeHex(encoding.numberToHex(_nonce)); 17 | 18 | // gasPrice 19 | const _gasPrice = await getGasPrice(chainId); 20 | const gasPrice = encoding.sanitizeHex(_gasPrice); 21 | 22 | // gasLimit 23 | const _gasLimit = 21000; 24 | const gasLimit = encoding.sanitizeHex(encoding.numberToHex(_gasLimit)); 25 | 26 | // value 27 | const _value = 0; 28 | const value = encoding.sanitizeHex(encoding.numberToHex(_value)); 29 | 30 | const tx = { from: address, to: address, data: "0x", nonce, gasPrice, gasLimit, value }; 31 | 32 | return tx; 33 | } 34 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/chain-logos/polkadot.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/constants/default.ts: -------------------------------------------------------------------------------- 1 | export const DEFAULT_MAIN_CHAINS = [ 2 | // mainnets 3 | "eip155:1", 4 | "eip155:10", 5 | "eip155:100", 6 | "eip155:137", 7 | "eip155:42161", 8 | "eip155:42220", 9 | ]; 10 | 11 | export const DEFAULT_TEST_CHAINS = [ 12 | // testnets 13 | "eip155:5", 14 | "eip155:69", 15 | "eip155:80001", 16 | "eip155:421611", 17 | "eip155:44787", 18 | ]; 19 | 20 | export const DEFAULT_CHAINS = [...DEFAULT_MAIN_CHAINS, ...DEFAULT_TEST_CHAINS]; 21 | 22 | export const DEFAULT_PROJECT_ID = process.env.NEXT_PUBLIC_PROJECT_ID; 23 | 24 | export const DEFAULT_RELAY_URL = process.env.NEXT_PUBLIC_RELAY_URL; 25 | 26 | export const DEFAULT_EIP155_METHODS = ["eth_sendTransaction", "personal_sign", "eth_signTypedData"]; 27 | 28 | export enum DEFAULT_EIP_155_EVENTS { 29 | ETH_CHAIN_CHANGED = "chainChanged", 30 | ETH_ACCOUNTS_CHANGED = "accountsChanged", 31 | } 32 | 33 | export const DEFAULT_LOGGER = "debug"; 34 | 35 | export const DEFAULT_APP_METADATA = { 36 | name: "React App with ethers", 37 | description: "React App for WalletConnect", 38 | url: "https://walletconnect.com/", 39 | icons: ["https://avatars.githubusercontent.com/u/37784886"], 40 | }; 41 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/views/LoadingModal.tsx: -------------------------------------------------------------------------------- 1 | import { Col, Divider, Link, Loading, Row, Text, styled } from '@nextui-org/react' 2 | import { CoreTypes } from '@walletconnect/types' 3 | import NewReleasesIcon from '@mui/icons-material/NewReleases' 4 | import RequestModalContainer from '@/components/RequestModalContainer' 5 | import { useSnapshot } from 'valtio' 6 | import ModalStore from '@/store/ModalStore' 7 | 8 | export default function LoadingModal() { 9 | const state = useSnapshot(ModalStore.state) 10 | const message = state.data?.loadingMessage 11 | 12 | return ( 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Loading your request... 23 | 24 | 25 | {message ? ( 26 |
27 | 28 | {message} 29 |
30 | ) : null} 31 |
32 |
33 | ) 34 | } 35 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/components/AccountSelectCard.tsx: -------------------------------------------------------------------------------- 1 | import { truncate } from '@/utils/HelperUtil' 2 | import { Card, Checkbox, Row, Text } from '@nextui-org/react' 3 | 4 | /** 5 | * Types 6 | */ 7 | interface IProps { 8 | address: string 9 | index: number 10 | selected: boolean 11 | onSelect: () => void 12 | isRequired: boolean 13 | } 14 | 15 | /** 16 | * Component 17 | */ 18 | export default function AccountSelectCard({ 19 | address, 20 | selected, 21 | index, 22 | onSelect, 23 | isRequired 24 | }: IProps) { 25 | return ( 26 | 36 | 37 | 38 | 39 | 40 | {`${truncate(address, 14)} - Account ${index + 1}`} 41 | 42 | 43 | 44 | ) 45 | } 46 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/config/checkoutViews.ts: -------------------------------------------------------------------------------- 1 | import { ReceiptView } from "@/components/purchase-donut-modal-views/RecieptView"; 2 | import { ErrorView } from "@/components/purchase-donut-modal-views/ErrorView"; 3 | import { CheckoutView } from "@/components/purchase-donut-modal-views/CheckoutView"; 4 | import { PaymentOptionsView } from "@/components/purchase-donut-modal-views/PaymentOptionsView"; 5 | import { walletCheckoutManager, WalletCheckoutModalView } from "@/controllers/WalletCheckoutModalManager"; 6 | 7 | export const WALLET_CHECKOUT_VIEWS: Record = { 8 | checkout: { 9 | component: CheckoutView, 10 | title: "Checkout" 11 | }, 12 | receipt: { 13 | component: ReceiptView, 14 | title: "Receipt" 15 | }, 16 | error: { 17 | component: ErrorView, 18 | title: "Error" 19 | }, 20 | paymentOptions: { 21 | component: PaymentOptionsView, 22 | title: "Payment Options" 23 | } 24 | }; 25 | 26 | export function registerCheckoutViews(): void { 27 | Object.entries(WALLET_CHECKOUT_VIEWS).forEach(([key, view]) => { 28 | if (!walletCheckoutManager.getState().views[key]) { 29 | walletCheckoutManager.registerView(key, view); 30 | } 31 | }); 32 | } -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/components/Wrapper.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import * as PropTypes from "prop-types"; 3 | import styled, { keyframes } from "styled-components"; 4 | 5 | const fadeIn = keyframes` 6 | 0% { 7 | opacity: 0; 8 | } 9 | 100% { 10 | opacity: 1; 11 | } 12 | `; 13 | 14 | interface WrapperStyleProps { 15 | center: boolean; 16 | } 17 | 18 | const SWrapper = styled.div` 19 | will-change: transform, opacity; 20 | animation: ${fadeIn} 0.7s ease 0s normal 1; 21 | min-height: 200px; 22 | display: flex; 23 | flex-wrap: wrap; 24 | justify-content: center; 25 | align-items: ${({ center }) => (center ? `center` : `flex-start`)}; 26 | `; 27 | 28 | interface WrapperProps extends WrapperStyleProps { 29 | children: React.ReactNode; 30 | } 31 | 32 | const Wrapper = (props: WrapperProps) => { 33 | const { children, center } = props; 34 | return ( 35 | 36 | {children} 37 | 38 | ); 39 | }; 40 | 41 | Wrapper.propTypes = { 42 | children: PropTypes.node.isRequired, 43 | center: PropTypes.bool, 44 | }; 45 | 46 | Wrapper.defaultProps = { 47 | center: false, 48 | }; 49 | 50 | export default Wrapper; 51 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/chains/polkadot.ts: -------------------------------------------------------------------------------- 1 | import { JsonRpcRequest } from "@walletconnect/jsonrpc-utils"; 2 | 3 | import { NamespaceMetadata, ChainMetadata, ChainRequestRender } from "../helpers"; 4 | 5 | export const PolkadotMetadata: NamespaceMetadata = { 6 | // eslint-disable-next-line no-useless-computed-key 7 | ["91b171bb158e2d3848fa23a9f1c25182"]: { 8 | logo: "/assets/polkadot.svg", 9 | rgb: "230, 1, 122", 10 | }, 11 | }; 12 | 13 | export function getChainMetadata(chainId: string): ChainMetadata { 14 | const reference = chainId.split(":")[1]; 15 | const metadata = PolkadotMetadata[reference]; 16 | if (typeof metadata === "undefined") { 17 | throw new Error(`No chain metadata found for chainId: ${chainId}`); 18 | } 19 | return metadata; 20 | } 21 | 22 | export function getChainRequestRender(request: JsonRpcRequest): ChainRequestRender[] { 23 | let params = [{ label: "Method", value: request.method }]; 24 | 25 | switch (request.method) { 26 | default: 27 | params = [ 28 | ...params, 29 | { 30 | label: "params", 31 | value: JSON.stringify(request.params, null, "\t"), 32 | }, 33 | ]; 34 | break; 35 | } 36 | return params; 37 | } 38 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/components/Wrapper.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import * as PropTypes from "prop-types"; 3 | import styled, { keyframes } from "styled-components"; 4 | 5 | const fadeIn = keyframes` 6 | 0% { 7 | opacity: 0; 8 | } 9 | 100% { 10 | opacity: 1; 11 | } 12 | `; 13 | 14 | interface WrapperStyleProps { 15 | center: boolean; 16 | } 17 | 18 | const SWrapper = styled.div` 19 | will-change: transform, opacity; 20 | animation: ${fadeIn} 0.7s ease 0s normal 1; 21 | min-height: 200px; 22 | display: flex; 23 | flex-wrap: wrap; 24 | justify-content: center; 25 | align-items: ${({ center }) => (center ? `center` : `flex-start`)}; 26 | `; 27 | 28 | interface WrapperProps extends WrapperStyleProps { 29 | children: React.ReactNode; 30 | } 31 | 32 | const Wrapper = (props: WrapperProps) => { 33 | const { children, center } = props; 34 | return ( 35 | 36 | {children} 37 | 38 | ); 39 | }; 40 | 41 | Wrapper.propTypes = { 42 | children: PropTypes.node.isRequired, 43 | center: PropTypes.bool, 44 | }; 45 | 46 | Wrapper.defaultProps = { 47 | center: false, 48 | }; 49 | 50 | export default Wrapper; 51 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/public/icons/accounts-icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/data/TezosData.ts: -------------------------------------------------------------------------------- 1 | type ChainMetadata = { 2 | chainId: string 3 | name: string 4 | logo: string 5 | rgb: string 6 | rpc: string 7 | namespace: string 8 | } 9 | 10 | /** 11 | * Types 12 | */ 13 | export type TTezosChain = keyof typeof TEZOS_MAINNET_CHAINS 14 | 15 | /** 16 | * Chains 17 | */ 18 | export const TEZOS_MAINNET_CHAINS: Record = { 19 | 'tezos:mainnet': { 20 | chainId: 'mainnet', 21 | name: 'Tezos', 22 | logo: '/chain-logos/tezos.svg', 23 | rgb: '44, 125, 247', 24 | rpc: 'https://mainnet.api.tez.ie', 25 | namespace: 'tezos' 26 | } 27 | } 28 | 29 | export const TEZOS_TEST_CHAINS: Record = { 30 | 'tezos:testnet': { 31 | chainId: 'testnet', 32 | name: 'Tezos Testnet', 33 | logo: '/chain-logos/tezos.svg', 34 | rgb: '44, 125, 247', 35 | rpc: 'https://ghostnet.ecadinfra.com', 36 | namespace: 'tezos' 37 | } 38 | } 39 | 40 | export const TEZOS_CHAINS = { ...TEZOS_MAINNET_CHAINS, ...TEZOS_TEST_CHAINS } 41 | 42 | /** 43 | * Methods 44 | */ 45 | export const TEZOS_SIGNING_METHODS = { 46 | TEZOS_GET_ACCOUNTS: 'tezos_getAccounts', 47 | TEZOS_SEND: 'tezos_send', 48 | TEZOS_SIGN: 'tezos_sign' 49 | } 50 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/chains/polkadot.ts: -------------------------------------------------------------------------------- 1 | import { JsonRpcRequest } from "@walletconnect/jsonrpc-utils"; 2 | 3 | import { NamespaceMetadata, ChainMetadata, ChainRequestRender } from "../helpers"; 4 | 5 | export const PolkadotMetadata: NamespaceMetadata = { 6 | // eslint-disable-next-line no-useless-computed-key 7 | ["91b171bb158e2d3848fa23a9f1c25182"]: { 8 | logo: "/assets/polkadot.svg", 9 | rgb: "230, 1, 122", 10 | }, 11 | }; 12 | 13 | export function getChainMetadata(chainId: string): ChainMetadata { 14 | const reference = chainId.split(":")[1]; 15 | const metadata = PolkadotMetadata[reference]; 16 | if (typeof metadata === "undefined") { 17 | throw new Error(`No chain metadata found for chainId: ${chainId}`); 18 | } 19 | return metadata; 20 | } 21 | 22 | export function getChainRequestRender(request: JsonRpcRequest): ChainRequestRender[] { 23 | let params = [{ label: "Method", value: request.method }]; 24 | 25 | switch (request.method) { 26 | default: 27 | params = [ 28 | ...params, 29 | { 30 | label: "params", 31 | value: JSON.stringify(request.params, null, "\t"), 32 | }, 33 | ]; 34 | break; 35 | } 36 | return params; 37 | } 38 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/components/Wrapper.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import * as PropTypes from "prop-types"; 3 | import styled, { keyframes } from "styled-components"; 4 | 5 | const fadeIn = keyframes` 6 | 0% { 7 | opacity: 0; 8 | } 9 | 100% { 10 | opacity: 1; 11 | } 12 | `; 13 | 14 | interface WrapperStyleProps { 15 | center: boolean; 16 | } 17 | 18 | const SWrapper = styled.div` 19 | will-change: transform, opacity; 20 | animation: ${fadeIn} 0.7s ease 0s normal 1; 21 | min-height: 200px; 22 | display: flex; 23 | flex-wrap: wrap; 24 | justify-content: center; 25 | align-items: ${({ center }) => (center ? `center` : `flex-start`)}; 26 | `; 27 | 28 | interface WrapperProps extends WrapperStyleProps { 29 | children: React.ReactNode; 30 | } 31 | 32 | const Wrapper = (props: WrapperProps) => { 33 | const { children, center } = props; 34 | return ( 35 | 36 | {children} 37 | 38 | ); 39 | }; 40 | 41 | Wrapper.propTypes = { 42 | children: PropTypes.node.isRequired, 43 | center: PropTypes.bool, 44 | }; 45 | 46 | Wrapper.defaultProps = { 47 | center: false, 48 | }; 49 | 50 | export default Wrapper; 51 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/README.md: -------------------------------------------------------------------------------- 1 | # React dApp (with standalone v2 client) 2 | 3 | 🔗 Live dapp demo - https://react-app.walletconnect.com/
4 | 🔗 Live wallet demo - https://react-wallet.walletconnect.com/
5 | 📚 WalletConnect v2 Docs - https://docs.walletconnect.com/2.0 6 | 7 | ## Overview 8 | 9 | This is an example implementation of a React dApp (generated via `create-react-app`) using the standalone 10 | client for WalletConnect v2 to: 11 | 12 | - handle pairings 13 | - manage sessions 14 | - send JSON-RPC requests to a paired wallet 15 | 16 | ## Running locally 17 | 18 | Install the app's dependencies: 19 | 20 | ```bash 21 | yarn 22 | ``` 23 | 24 | Set up your local environment variables by copying the example into your own `.env.local` file: 25 | 26 | ```bash 27 | cp .env.local.example .env.local 28 | ``` 29 | 30 | Your `.env.local` now contains the following environment variables: 31 | 32 | - `NEXT_PUBLIC_PROJECT_ID` (placeholder) - You can generate your own ProjectId at https://cloud.walletconnect.com 33 | - `NEXT_PUBLIC_RELAY_URL` (already set) 34 | 35 | ## Develop 36 | 37 | ```bash 38 | yarn dev 39 | ``` 40 | 41 | ## Test 42 | 43 | ```bash 44 | yarn test 45 | ``` 46 | 47 | ## Build 48 | 49 | ```bash 50 | yarn build 51 | ``` 52 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/data/TronData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Types 3 | */ 4 | export type TTronChain = keyof typeof TRON_MAINNET_CHAINS 5 | 6 | interface TRONChains { 7 | [key: string]: ChainMetadata 8 | } 9 | 10 | type ChainMetadata = { 11 | chainId: string 12 | name: string 13 | logo: string 14 | rgb: string 15 | fullNode: string 16 | namespace: string 17 | } 18 | 19 | /** 20 | * Chains 21 | */ 22 | export const TRON_MAINNET_CHAINS: TRONChains = { 23 | 'tron:0x2b6653dc': { 24 | chainId: '0x2b6653dc', 25 | name: 'Tron', 26 | logo: 'chain-logos/tron.png', 27 | rgb: '183, 62, 49', 28 | fullNode: 'https://api.trongrid.io', 29 | namespace: 'tron' 30 | } 31 | } 32 | 33 | export const TRON_TEST_CHAINS: TRONChains = { 34 | 'tron:0xcd8690dc': { 35 | chainId: '0xcd8690dc', 36 | name: 'Tron Testnet', 37 | logo: 'chain-logos/tron.png', 38 | rgb: '183, 62, 49', 39 | fullNode: 'https://nile.trongrid.io/', 40 | namespace: 'tron' 41 | } 42 | } 43 | 44 | export const TRON_CHAINS = { ...TRON_MAINNET_CHAINS, ...TRON_TEST_CHAINS } 45 | 46 | /** 47 | * Methods 48 | */ 49 | export const TRON_SIGNING_METHODS = { 50 | TRON_SIGN_TRANSACTION: 'tron_signTransaction', 51 | TRON_SIGN_MESSAGE: 'tron_signMessage' 52 | } 53 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/components/TicTacToeComponents/StartGameButton.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Loader2 } from "lucide-react"; 3 | import { Button } from "@/components/ui/button"; 4 | import { 5 | Tooltip, 6 | TooltipContent, 7 | TooltipProvider, 8 | TooltipTrigger, 9 | } from "@/components/ui/tooltip"; 10 | 11 | const StartGameButton = ({ 12 | isWalletConnected, 13 | loading, 14 | startGame, 15 | }: { 16 | isWalletConnected: boolean; 17 | loading: boolean; 18 | startGame: () => void; 19 | }) => { 20 | const button = ( 21 | 30 | ); 31 | 32 | return isWalletConnected ? ( 33 | button 34 | ) : ( 35 | 36 | 37 | {button} 38 | 39 |

Connect your wallet

40 |
41 |
42 |
43 | ); 44 | }; 45 | 46 | export default StartGameButton; 47 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/chains/bip122.ts: -------------------------------------------------------------------------------- 1 | import { NamespaceMetadata, ChainMetadata, ChainsMap } from "../helpers"; 2 | 3 | export const BIP122_MAINNET = "000000000019d6689c085ae165831e93"; 4 | export const BIP122_TESTNET = "000000000933ea01ad0ee984209779ba"; 5 | export const BIP122_DUST_LIMIT = "1001"; 6 | 7 | export const BtcChainData: ChainsMap = { 8 | [BIP122_MAINNET]: { 9 | id: `bip122:${BIP122_MAINNET}`, 10 | name: "BTC Mainnet", 11 | rpc: [], 12 | slip44: 0, 13 | testnet: false, 14 | }, 15 | [BIP122_TESTNET]: { 16 | id: `bip122:${BIP122_TESTNET}`, 17 | name: "BTC Testnet", 18 | rpc: [], 19 | slip44: 501, 20 | testnet: true, 21 | }, 22 | }; 23 | 24 | export const BtcMetadata: NamespaceMetadata = { 25 | [BIP122_MAINNET]: { 26 | logo: "/assets/btc-testnet.png", 27 | rgb: "247, 147, 25", 28 | }, 29 | [BIP122_TESTNET]: { 30 | logo: "/assets/btc-testnet.png", 31 | rgb: "247, 147, 25", 32 | }, 33 | }; 34 | 35 | export function getChainMetadata(chainId: string): ChainMetadata { 36 | const reference = chainId.split(":")[1]; 37 | const metadata = BtcMetadata[reference]; 38 | if (typeof metadata === "undefined") { 39 | throw new Error(`No chain metadata found for chainId: ${chainId}`); 40 | } 41 | return metadata; 42 | } 43 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/chains/near.ts: -------------------------------------------------------------------------------- 1 | import { JsonRpcRequest } from "@walletconnect/jsonrpc-utils"; 2 | 3 | import { 4 | NamespaceMetadata, 5 | ChainMetadata, 6 | ChainRequestRender, 7 | ChainsMap, 8 | } from "../helpers"; 9 | 10 | export const NearMetadata: NamespaceMetadata = { 11 | testnet: { 12 | logo: "https://avatars.githubusercontent.com/u/7613128?s=200&v=4", 13 | rgb: "27, 31, 53", 14 | }, 15 | }; 16 | 17 | export const NearChainData: ChainsMap = { 18 | testnet: { 19 | name: "NEAR Testnet", 20 | id: "near:testnet", 21 | rpc: ["https://rpc.testnet.near.org"], 22 | slip44: 397, 23 | testnet: true, 24 | }, 25 | }; 26 | 27 | export function getChainMetadata(chainId: string): ChainMetadata { 28 | const reference = chainId.split(":")[1]; 29 | const metadata = NearMetadata[reference]; 30 | if (typeof metadata === "undefined") { 31 | throw new Error(`No chain metadata found for chainId: ${chainId}`); 32 | } 33 | return metadata; 34 | } 35 | 36 | export function getChainRequestRender( 37 | request: JsonRpcRequest 38 | ): ChainRequestRender[] { 39 | return [ 40 | { label: "Method", value: request.method }, 41 | { 42 | label: "params", 43 | value: JSON.stringify(request.params, null, "\t"), 44 | }, 45 | ]; 46 | } 47 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/helpers/eip1271.ts: -------------------------------------------------------------------------------- 1 | import { Contract, providers, utils } from "ethers"; 2 | 3 | const spec = { 4 | magicValue: "0x1626ba7e", 5 | abi: [ 6 | { 7 | constant: true, 8 | inputs: [ 9 | { 10 | name: "_hash", 11 | type: "bytes32", 12 | }, 13 | { 14 | name: "_sig", 15 | type: "bytes", 16 | }, 17 | ], 18 | name: "isValidSignature", 19 | outputs: [ 20 | { 21 | name: "magicValue", 22 | type: "bytes4", 23 | }, 24 | ], 25 | payable: false, 26 | stateMutability: "view", 27 | type: "function", 28 | }, 29 | ], 30 | }; 31 | 32 | async function isValidSignature( 33 | address: string, 34 | sig: string, 35 | data: string, 36 | provider: providers.Provider, 37 | abi = eip1271.spec.abi, 38 | magicValue = eip1271.spec.magicValue 39 | ): Promise { 40 | let returnValue; 41 | try { 42 | returnValue = await new Contract(address, abi, provider).isValidSignature( 43 | utils.arrayify(data), 44 | sig 45 | ); 46 | } catch (e) { 47 | return false; 48 | } 49 | return returnValue.toLowerCase() === magicValue.toLowerCase(); 50 | } 51 | 52 | export const eip1271 = { 53 | spec, 54 | isValidSignature, 55 | }; 56 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/data/TonData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Types 3 | */ 4 | export type TTonChain = keyof typeof TON_MAINNET_CHAINS | keyof typeof TON_TEST_CHAINS 5 | 6 | export const blockchainApiRpc = (chainId: string) => { 7 | return `https://rpc.walletconnect.org/v1?chainId=ton:${chainId}&projectId=${process.env.NEXT_PUBLIC_PROJECT_ID}` 8 | } 9 | 10 | export const tonCenterRpc = (testnet: boolean) => { 11 | return testnet 12 | ? 'https://ton-testnet.api.onfinality.io/public' 13 | : 'https://toncenter.com/api/v2/jsonRPC' 14 | } 15 | 16 | /** 17 | * Chains 18 | */ 19 | export const TON_MAINNET_CHAINS = { 20 | 'ton:-239': { 21 | chainId: '-239', 22 | name: 'TON', 23 | logo: '/chain-logos/ton.png', 24 | rgb: '0, 136, 204', 25 | rpc: tonCenterRpc(false), 26 | namespace: 'ton' 27 | } 28 | } 29 | 30 | export const TON_TEST_CHAINS = { 31 | 'ton:-3': { 32 | chainId: '-3', 33 | name: 'TON Testnet', 34 | logo: '/chain-logos/ton.png', 35 | rgb: '0, 136, 204', 36 | rpc: tonCenterRpc(true), 37 | namespace: 'ton' 38 | } 39 | } 40 | 41 | export const TON_CHAINS = { ...TON_MAINNET_CHAINS, ...TON_TEST_CHAINS } 42 | 43 | /** 44 | * Methods 45 | */ 46 | export const TON_SIGNING_METHODS = { 47 | SEND_MESSAGE: 'ton_sendMessage', 48 | SIGN_DATA: 'ton_signData' 49 | } 50 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/components/ui/badge.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { cva, type VariantProps } from "class-variance-authority" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const badgeVariants = cva( 7 | "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", 8 | { 9 | variants: { 10 | variant: { 11 | default: 12 | "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80", 13 | secondary: 14 | "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", 15 | destructive: 16 | "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80", 17 | outline: "text-foreground", 18 | }, 19 | }, 20 | defaultVariants: { 21 | variant: "default", 22 | }, 23 | } 24 | ) 25 | 26 | export interface BadgeProps 27 | extends React.HTMLAttributes, 28 | VariantProps {} 29 | 30 | function Badge({ className, variant, ...props }: BadgeProps) { 31 | return ( 32 |
33 | ) 34 | } 35 | 36 | export { Badge, badgeVariants } 37 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2/src/components/Column.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import * as PropTypes from "prop-types"; 3 | import { styled } from "styled-components"; 4 | 5 | interface ColumnStyleProps { 6 | spanHeight: boolean; 7 | maxWidth: number; 8 | center: boolean; 9 | children?: React.ReactNode; 10 | } 11 | 12 | interface ColumnProps extends ColumnStyleProps { 13 | children: React.ReactNode; 14 | } 15 | 16 | const SColumn = styled.div` 17 | position: relative; 18 | width: 100%; 19 | height: ${({ spanHeight }) => (spanHeight ? "100%" : "auto")}; 20 | max-width: ${({ maxWidth }) => `${maxWidth}px`}; 21 | margin: 0 auto; 22 | display: flex; 23 | flex-direction: column; 24 | align-items: center; 25 | justify-content: ${({ center }) => (center ? "center" : "flex-start")}; 26 | `; 27 | 28 | const Column = (props: ColumnProps) => { 29 | const { children, spanHeight, maxWidth, center } = props; 30 | return {children}; 31 | }; 32 | 33 | Column.propTypes = { 34 | children: PropTypes.node.isRequired, 35 | spanHeight: PropTypes.bool, 36 | maxWidth: PropTypes.number, 37 | center: PropTypes.bool, 38 | }; 39 | 40 | Column.defaultProps = { 41 | spanHeight: false, 42 | maxWidth: 600, 43 | center: false, 44 | }; 45 | 46 | export default Column; 47 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/components/DcaComponents/AssetBalance.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Button } from "../ui/button"; 3 | import { RefreshCcw } from "lucide-react"; 4 | 5 | interface AssetBalanceProps { 6 | assetName: string; 7 | balance: string | undefined; 8 | isLoading: boolean; 9 | // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type 10 | refetch: Function; 11 | } 12 | 13 | export default function AssetBalance({ 14 | assetName, 15 | balance, 16 | isLoading, 17 | refetch, 18 | }: AssetBalanceProps) { 19 | return ( 20 | <> 21 |
22 |

Asset

23 |

Balance

24 |
25 |
26 |

{assetName}

27 | {isLoading ? ( 28 |

...

29 | ) : ( 30 |

31 | {balance} 32 | 40 |

41 | )} 42 |
43 | 44 | ); 45 | } 46 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/helpers/eip1271.ts: -------------------------------------------------------------------------------- 1 | import { Contract, providers, utils } from "ethers"; 2 | 3 | const spec = { 4 | magicValue: "0x1626ba7e", 5 | abi: [ 6 | { 7 | constant: true, 8 | inputs: [ 9 | { 10 | name: "_hash", 11 | type: "bytes32", 12 | }, 13 | { 14 | name: "_sig", 15 | type: "bytes", 16 | }, 17 | ], 18 | name: "isValidSignature", 19 | outputs: [ 20 | { 21 | name: "magicValue", 22 | type: "bytes4", 23 | }, 24 | ], 25 | payable: false, 26 | stateMutability: "view", 27 | type: "function", 28 | }, 29 | ], 30 | }; 31 | 32 | async function isValidSignature( 33 | address: string, 34 | sig: string, 35 | data: string, 36 | provider: providers.Provider, 37 | abi = eip1271.spec.abi, 38 | magicValue = eip1271.spec.magicValue, 39 | ): Promise { 40 | let returnValue; 41 | try { 42 | returnValue = await new Contract(address, abi, provider).isValidSignature( 43 | utils.arrayify(data), 44 | sig, 45 | ); 46 | } catch (e) { 47 | return false; 48 | } 49 | return returnValue.toLowerCase() === magicValue.toLowerCase(); 50 | } 51 | 52 | export const eip1271 = { 53 | spec, 54 | isValidSignature, 55 | }; 56 | -------------------------------------------------------------------------------- /advanced/dapps/smart-sessions-demo/src/components/ui/tooltip.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as React from "react"; 4 | import * as TooltipPrimitive from "@radix-ui/react-tooltip"; 5 | 6 | import { cn } from "@/lib/utils"; 7 | 8 | const TooltipProvider = TooltipPrimitive.Provider; 9 | 10 | const Tooltip = TooltipPrimitive.Root; 11 | 12 | const TooltipTrigger = TooltipPrimitive.Trigger; 13 | 14 | const TooltipContent = React.forwardRef< 15 | React.ElementRef, 16 | React.ComponentPropsWithoutRef 17 | >(({ className, sideOffset = 4, ...props }, ref) => ( 18 | 27 | )); 28 | TooltipContent.displayName = TooltipPrimitive.Content.displayName; 29 | 30 | export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }; 31 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/helpers/eip1271.ts: -------------------------------------------------------------------------------- 1 | import { Contract, providers, utils } from "ethers"; 2 | 3 | const spec = { 4 | magicValue: "0x1626ba7e", 5 | abi: [ 6 | { 7 | constant: true, 8 | inputs: [ 9 | { 10 | name: "_hash", 11 | type: "bytes32", 12 | }, 13 | { 14 | name: "_sig", 15 | type: "bytes", 16 | }, 17 | ], 18 | name: "isValidSignature", 19 | outputs: [ 20 | { 21 | name: "magicValue", 22 | type: "bytes4", 23 | }, 24 | ], 25 | payable: false, 26 | stateMutability: "view", 27 | type: "function", 28 | }, 29 | ], 30 | }; 31 | 32 | async function isValidSignature( 33 | address: string, 34 | sig: string, 35 | data: string, 36 | provider: providers.Provider, 37 | abi = eip1271.spec.abi, 38 | magicValue = eip1271.spec.magicValue, 39 | ): Promise { 40 | let returnValue; 41 | try { 42 | returnValue = await new Contract(address, abi, provider).isValidSignature( 43 | utils.arrayify(data), 44 | sig, 45 | ); 46 | } catch (e) { 47 | return false; 48 | } 49 | return returnValue.toLowerCase() === magicValue.toLowerCase(); 50 | } 51 | 52 | export const eip1271 = { 53 | spec, 54 | isValidSignature, 55 | }; 56 | -------------------------------------------------------------------------------- /advanced/dapps/chain-abstraction-demo/components/WalletCheckoutModal.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import React from "react"; 4 | import { useSnapshot } from "valtio"; 5 | import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog"; 6 | import { walletCheckoutManager } from "../controllers/WalletCheckoutModalManager"; 7 | import * as VisuallyHidden from "@radix-ui/react-visually-hidden"; 8 | 9 | export const WalletCheckoutModal: React.FC = () => { 10 | const snap = useSnapshot(walletCheckoutManager.getState()); 11 | 12 | const handleClose = () => { 13 | walletCheckoutManager.close(); 14 | }; 15 | 16 | if (!snap.isOpen) return null; 17 | 18 | const CurrentView = snap.views[snap.currentView]?.component; 19 | 20 | if (!CurrentView) return null; 21 | 22 | return ( 23 | 24 | 28 | 29 | Modal Title 30 | 31 | walletCheckoutManager.switchView(viewKey)} 34 | /> 35 | 36 | 37 | ); 38 | }; -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-with-ethers/src/chains/index.ts: -------------------------------------------------------------------------------- 1 | import { JsonRpcRequest } from "@walletconnect/jsonrpc-utils"; 2 | 3 | import * as eip155 from "./eip155"; 4 | import * as cosmos from "./cosmos"; 5 | import * as polkadot from "./polkadot"; 6 | 7 | import { ChainMetadata, ChainRequestRender } from "../helpers"; 8 | 9 | export function getChainMetadata(chainId: string): ChainMetadata { 10 | const namespace = chainId.split(":")[0]; 11 | switch (namespace) { 12 | case "eip155": 13 | return eip155.getChainMetadata(chainId); 14 | case "cosmos": 15 | return cosmos.getChainMetadata(chainId); 16 | case "polkadot": 17 | return polkadot.getChainMetadata(chainId); 18 | default: 19 | throw new Error(`No metadata handler for namespace ${namespace}`); 20 | } 21 | } 22 | 23 | export function getChainRequestRender( 24 | request: JsonRpcRequest, 25 | chainId: string, 26 | ): ChainRequestRender[] { 27 | const namespace = chainId.split(":")[0]; 28 | switch (namespace) { 29 | case "eip155": 30 | return eip155.getChainRequestRender(request); 31 | case "cosmos": 32 | return cosmos.getChainRequestRender(request); 33 | case "polkadot": 34 | return polkadot.getChainRequestRender(request); 35 | default: 36 | throw new Error(`No render handler for namespace ${namespace}`); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /advanced/dapps/react-dapp-v2-cosmos-provider/src/chains/index.ts: -------------------------------------------------------------------------------- 1 | import { JsonRpcRequest } from "@walletconnect/jsonrpc-utils"; 2 | 3 | import * as eip155 from "./eip155"; 4 | import * as cosmos from "./cosmos"; 5 | import * as polkadot from "./polkadot"; 6 | 7 | import { ChainMetadata, ChainRequestRender } from "../helpers"; 8 | 9 | export function getChainMetadata(chainId: string): ChainMetadata { 10 | const namespace = chainId.split(":")[0]; 11 | switch (namespace) { 12 | case "eip155": 13 | return eip155.getChainMetadata(chainId); 14 | case "cosmos": 15 | return cosmos.getChainMetadata(chainId); 16 | case "polkadot": 17 | return polkadot.getChainMetadata(chainId); 18 | default: 19 | throw new Error(`No metadata handler for namespace ${namespace}`); 20 | } 21 | } 22 | 23 | export function getChainRequestRender( 24 | request: JsonRpcRequest, 25 | chainId: string, 26 | ): ChainRequestRender[] { 27 | const namespace = chainId.split(":")[0]; 28 | switch (namespace) { 29 | case "eip155": 30 | return eip155.getChainRequestRender(request); 31 | case "cosmos": 32 | return cosmos.getChainRequestRender(request); 33 | case "polkadot": 34 | return polkadot.getChainRequestRender(request); 35 | default: 36 | throw new Error(`No render handler for namespace ${namespace}`); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /advanced/dapps/pos-dapp/public/next.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/pages/sessions.tsx: -------------------------------------------------------------------------------- 1 | import PageHeader from '@/components/PageHeader' 2 | import SessionCard from '@/components/SessionCard' 3 | import SettingsStore from '@/store/SettingsStore' 4 | import { Text } from '@nextui-org/react' 5 | import { Fragment, useEffect } from 'react' 6 | import { useSnapshot } from 'valtio' 7 | import { refreshSessionsList } from './wc' 8 | 9 | export default function SessionsPage() { 10 | const { sessions } = useSnapshot(SettingsStore.state) 11 | useEffect(() => refreshSessionsList(), []) 12 | if (!sessions.length) { 13 | return ( 14 | 15 | 16 | No sessions 17 | 18 | ) 19 | } 20 | 21 | return ( 22 | 23 | 24 | {sessions.length 25 | ? sessions.map(session => { 26 | const { name, icons, url } = session.peer.metadata 27 | 28 | return ( 29 | 36 | ) 37 | }) 38 | : null} 39 | 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /advanced/wallets/react-wallet-v2/src/data/tokenUtil.ts: -------------------------------------------------------------------------------- 1 | export type EIP155Token = { 2 | name: string 3 | icon: string 4 | assetAddress?: string 5 | symbol: string 6 | decimals: number 7 | } 8 | 9 | const ALL_TOKENS: EIP155Token[] = [ 10 | { 11 | name: 'USDC', 12 | icon: '/token-logos/USDC.png', 13 | symbol: 'USDC', 14 | decimals: 6 15 | }, 16 | { 17 | name: 'USDT', 18 | icon: '/token-logos/USDT.png', 19 | symbol: 'USDT', 20 | decimals: 6 21 | }, 22 | { 23 | name: 'ETH', 24 | icon: '/token-logos/ETH.png', 25 | symbol: 'ETH', 26 | decimals: 18 27 | }, 28 | { 29 | name: 'SOL', 30 | icon: '/token-logos/SOL.png', 31 | symbol: 'SOL', 32 | decimals: 9 33 | } 34 | ] 35 | 36 | export function getTokenData(tokenSymbol: string) { 37 | return Object.values(ALL_TOKENS).find(token => token.symbol === tokenSymbol) 38 | } 39 | 40 | const SOLANA_KNOWN_TOKENS = [ 41 | { 42 | name: 'USDC', 43 | icon: '/token-logos/USDC.png', 44 | symbol: 'USDC', 45 | decimals: 6, 46 | assetAddress: [ 47 | 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU' 48 | ] 49 | } 50 | ] 51 | 52 | export function getSolanaTokenData(caip19AssetAddress: string) { 53 | return SOLANA_KNOWN_TOKENS.find(token => token.assetAddress.includes(caip19AssetAddress)) 54 | } 55 | --------------------------------------------------------------------------------