Concepts, value, and typical clone scenarios — less code.
Concepts, value, and typical clone scenarios — less code.
Підготовка контенту платформи Ring
Підготовка контенту платформи Ring
Підготовка контенту платформи Ring
Use the Founder / Developer tabs in the docs sidebar to filter this page. Founders get the operator view of what the EVM wallet layer enables; developers get verified module paths, the RPC/token single sources of truth, and connector white-labeling steps.
Ring's EVM (Ethereum / Polygon) wallet stack is Wagmi v3 + viem 2.x with a custom connector picker and account menu — Ring does not bundle @rainbow-me/rainbowkit. Wallet providers mount only on crypto routes through Web3ScopeProvider, and all RPC endpoints and the RING ERC-20 address resolve through config helpers instead of hardcoded strings.
| Concern | Single source of truth | Never do |
|---|---|---|
| Connectors / UI | lib/wagmi-config.ts + custom picker | Add RainbowKit |
| EVM RPC URL | getEvmRpcUrl() (lib/ring-config-chain.ts) | Hardcode polygon-rpc.com |
| EVM chain id | getEvmChainId() (lib/ring-config-chain.ts) | Assume 137 inline |
| RING ERC-20 address | getEvmTokenAddress() / getRingTokenAddress() | Use getNativeTokenAddress() (Solana SPL mint) |
| App runtime library | wagmi + viem | ethers in features/ / app/ / lib/ |
EVM wallets let members connect MetaMask, Coinbase Wallet, or any WalletConnect-compatible mobile wallet to your Ring clone — for RING token holdings, staking, and on-chain referral rewards on Polygon. The stack is config-driven: you enable it with environment variables, no code changes for the common case.
| Variable | Purpose |
|---|---|
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID | WalletConnect / Reown Cloud project ID (cloud.reown.com). Enables QR / deep-link flows; omit to disable WalletConnect. |
POLYGON_RPC_URL / NEXT_PUBLIC_POLYGON_RPC_URL | Authenticated Polygon JSON-RPC endpoint (e.g. Alchemy/Infura). Also settable per-clone via chains.evm.rpcUrlEnv. |
RING_CONTRACT_ADDRESS / NEXT_PUBLIC_RING_TOKEN_ADDRESS | RING ERC-20 address on the configured EVM chain. |
Treat every NEXT_PUBLIC_* value as public — it ships in the browser bundle. Keep server-only secrets out of NEXT_PUBLIC_ names.
Next-step: custodial wallets, credits, and getWalletBalance Server Action SSOT.
Deep-dive: wallet HTTP routes and Server Actions.
Same-workflow: custodial provisioning and native-token orchestration.
See-also: EVM staking adapter on viem (not ethers).
Use the Founder / Developer tabs in the docs sidebar to filter this page. Founders get the operator view of what the EVM wallet layer enables; developers get verified module paths, the RPC/token single sources of truth, and connector white-labeling steps.
Ring's EVM (Ethereum / Polygon) wallet stack is Wagmi v3 + viem 2.x with a custom connector picker and account menu — Ring does not bundle @rainbow-me/rainbowkit. Wallet providers mount only on crypto routes through Web3ScopeProvider, and all RPC endpoints and the RING ERC-20 address resolve through config helpers instead of hardcoded strings.
| Concern | Single source of truth | Never do |
|---|---|---|
| Connectors / UI | lib/wagmi-config.ts + custom picker | Add RainbowKit |
| EVM RPC URL | getEvmRpcUrl() (lib/ring-config-chain.ts) | Hardcode polygon-rpc.com |
| EVM chain id | getEvmChainId() (lib/ring-config-chain.ts) | Assume 137 inline |
| RING ERC-20 address | getEvmTokenAddress() / getRingTokenAddress() | Use getNativeTokenAddress() (Solana SPL mint) |
| App runtime library | wagmi + viem | ethers in features/ / app/ / lib/ |
EVM wallets let members connect MetaMask, Coinbase Wallet, or any WalletConnect-compatible mobile wallet to your Ring clone — for RING token holdings, staking, and on-chain referral rewards on Polygon. The stack is config-driven: you enable it with environment variables, no code changes for the common case.
| Variable | Purpose |
|---|---|
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID | WalletConnect / Reown Cloud project ID (cloud.reown.com). Enables QR / deep-link flows; omit to disable WalletConnect. |
POLYGON_RPC_URL / NEXT_PUBLIC_POLYGON_RPC_URL | Authenticated Polygon JSON-RPC endpoint (e.g. Alchemy/Infura). Also settable per-clone via chains.evm.rpcUrlEnv. |
RING_CONTRACT_ADDRESS / NEXT_PUBLIC_RING_TOKEN_ADDRESS | RING ERC-20 address on the configured EVM chain. |
Treat every NEXT_PUBLIC_* value as public — it ships in the browser bundle. Keep server-only secrets out of NEXT_PUBLIC_ names.
Next-step: custodial wallets, credits, and getWalletBalance Server Action SSOT.
Deep-dive: wallet HTTP routes and Server Actions.
Same-workflow: custodial provisioning and native-token orchestration.
See-also: EVM staking adapter on viem (not ethers).
Use the Founder / Developer tabs in the docs sidebar to filter this page. Founders get the operator view of what the EVM wallet layer enables; developers get verified module paths, the RPC/token single sources of truth, and connector white-labeling steps.
Ring's EVM (Ethereum / Polygon) wallet stack is Wagmi v3 + viem 2.x with a custom connector picker and account menu — Ring does not bundle @rainbow-me/rainbowkit. Wallet providers mount only on crypto routes through Web3ScopeProvider, and all RPC endpoints and the RING ERC-20 address resolve through config helpers instead of hardcoded strings.
| Concern | Single source of truth | Never do |
|---|---|---|
| Connectors / UI | lib/wagmi-config.ts + custom picker | Add RainbowKit |
| EVM RPC URL | getEvmRpcUrl() (lib/ring-config-chain.ts) | Hardcode polygon-rpc.com |
| EVM chain id | getEvmChainId() (lib/ring-config-chain.ts) | Assume 137 inline |
| RING ERC-20 address | getEvmTokenAddress() / getRingTokenAddress() | Use getNativeTokenAddress() (Solana SPL mint) |
| App runtime library | wagmi + viem | ethers in features/ / app/ / lib/ |
EVM wallets let members connect MetaMask, Coinbase Wallet, or any WalletConnect-compatible mobile wallet to your Ring clone — for RING token holdings, staking, and on-chain referral rewards on Polygon. The stack is config-driven: you enable it with environment variables, no code changes for the common case.
| Variable | Purpose |
|---|---|
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID | WalletConnect / Reown Cloud project ID (cloud.reown.com). Enables QR / deep-link flows; omit to disable WalletConnect. |
POLYGON_RPC_URL / NEXT_PUBLIC_POLYGON_RPC_URL | Authenticated Polygon JSON-RPC endpoint (e.g. Alchemy/Infura). Also settable per-clone via chains.evm.rpcUrlEnv. |
RING_CONTRACT_ADDRESS / NEXT_PUBLIC_RING_TOKEN_ADDRESS | RING ERC-20 address on the configured EVM chain. |
Treat every NEXT_PUBLIC_* value as public — it ships in the browser bundle. Keep server-only secrets out of NEXT_PUBLIC_ names.
Next-step: custodial wallets, credits, and getWalletBalance Server Action SSOT.
Deep-dive: wallet HTTP routes and Server Actions.
Same-workflow: custodial provisioning and native-token orchestration.
See-also: EVM staking adapter on viem (not ethers).
APR pools and reward claims on the EVM adapter (viem).
POLYGON_RPC_URL, e.g. an Alchemy or Infura key) — never rely on anonymous public hosts.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID set from Reown Cloud if you want mobile QR connections.RING_CONTRACT_ADDRESS) set once your token is deployed.appName, logo) updated in the connector config for your domain.components/web3/connected-wallet-menu.tsx, components/web3/wallet-shell.tsx |
| Custom picker + connected account UI |
| RPC / chain SSOT | lib/ring-config-chain.ts | getEvmRpcUrl(), getEvmChainId() |
| Low-level RPC | lib/web3/polygon-rpc.ts | getPolygonRpcUrl() (env → Ankr fallback) |
| Token SSOT | lib/ring-config-chain.ts, constants/web3.ts | getEvmTokenAddress(), getRingTokenAddress() |
Do not hardcode public Polygon RPC hosts (polygon-rpc.com blocks anonymous traffic). Resolution order:
| Helper | Location | Resolves |
|---|---|---|
getEvmRpcUrl() | lib/ring-config-chain.ts | chains.evm.rpcUrlEnv env → getPolygonRpcUrl() fallback |
getEvmChainId() | lib/ring-config-chain.ts | chains.evm.chainId (default 137) |
getPolygonRpcUrl() | lib/web3/polygon-rpc.ts | POLYGON_RPC_URL → NEXT_PUBLIC_POLYGON_RPC_URL → Ankr fallback |
lib/wagmi-config.ts wires the Polygon transport as http(getEvmRpcUrl()) and lists polygon first in chains. Server routes, NFT market, staking, and wallet transfer adapters resolve RPC through the same helpers — never ad-hoc strings.
For the RING ERC-20 address use getEvmTokenAddress() (or getRingTokenAddress(), which wraps it). Never use getNativeTokenAddress() for EVM: when chains.native === 'solana' that helper returns the Solana SPL mint, which is not a valid EVM address.
WalletConnect is only added when NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID is present and not the demo-project-id placeholder — this avoids 403 responses from WalletConnect Cloud.
useConnection() over legacy useAccount() for address / chain / isConnected.useConnectors(); connect via useConnect().mutate({ connector }) (or mutateAsync).useSwitchChain().mutate({ chainId }); read configured chains with useChains().Edit lib/wagmi-config.ts — add or remove connectors from wagmi/connectors / @wagmi/connectors.
Install only the peer dependencies for connectors you enable (@metamask/connect-evm, @coinbase/wallet-sdk, @walletconnect/ethereum-provider).
Set branding (appName, appLogoUrl, WalletConnect metadata) for your domain and update the RPC/token env vars.
The picker lists useConnectors() output and dedupes EIP-6963 entries by connector.id — verify no duplicate wallet rows after adding a connector.
The EVM stack is consolidated to a single wagmi SSOT:
getEvmRpcUrl() / getEvmTokenAddress() in lib/ring-config-chain.ts — never hardcode public Polygon hosts or confuse with Solana getNativeTokenAddress().pathNeedsWeb3() mounts wagmi only on /login*, /auth/wallet-connect*, /wallet*, /store/checkout*, /nft*, /ai-web3*, /admin/nft*, /admin/web3*.app/_actions/get-wallet-balance.ts is deleted — use getWalletBalance in app/_actions/wallet.ts.WalletClient (features/staking/adapters/evm.ts). Earlier removals: WalletConnectPopup stub, legacy web3-context wrappers, lib/ring-config.ts facade.See-also: legacy ethers examples retired — Wagmi v3 pointer.
APR pools and reward claims on the EVM adapter (viem).
POLYGON_RPC_URL, e.g. an Alchemy or Infura key) — never rely on anonymous public hosts.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID set from Reown Cloud if you want mobile QR connections.RING_CONTRACT_ADDRESS) set once your token is deployed.appName, logo) updated in the connector config for your domain.components/web3/connected-wallet-menu.tsx, components/web3/wallet-shell.tsx |
| Custom picker + connected account UI |
| RPC / chain SSOT | lib/ring-config-chain.ts | getEvmRpcUrl(), getEvmChainId() |
| Low-level RPC | lib/web3/polygon-rpc.ts | getPolygonRpcUrl() (env → Ankr fallback) |
| Token SSOT | lib/ring-config-chain.ts, constants/web3.ts | getEvmTokenAddress(), getRingTokenAddress() |
Do not hardcode public Polygon RPC hosts (polygon-rpc.com blocks anonymous traffic). Resolution order:
| Helper | Location | Resolves |
|---|---|---|
getEvmRpcUrl() | lib/ring-config-chain.ts | chains.evm.rpcUrlEnv env → getPolygonRpcUrl() fallback |
getEvmChainId() | lib/ring-config-chain.ts | chains.evm.chainId (default 137) |
getPolygonRpcUrl() | lib/web3/polygon-rpc.ts | POLYGON_RPC_URL → NEXT_PUBLIC_POLYGON_RPC_URL → Ankr fallback |
lib/wagmi-config.ts wires the Polygon transport as http(getEvmRpcUrl()) and lists polygon first in chains. Server routes, NFT market, staking, and wallet transfer adapters resolve RPC through the same helpers — never ad-hoc strings.
For the RING ERC-20 address use getEvmTokenAddress() (or getRingTokenAddress(), which wraps it). Never use getNativeTokenAddress() for EVM: when chains.native === 'solana' that helper returns the Solana SPL mint, which is not a valid EVM address.
WalletConnect is only added when NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID is present and not the demo-project-id placeholder — this avoids 403 responses from WalletConnect Cloud.
useConnection() over legacy useAccount() for address / chain / isConnected.useConnectors(); connect via useConnect().mutate({ connector }) (or mutateAsync).useSwitchChain().mutate({ chainId }); read configured chains with useChains().Edit lib/wagmi-config.ts — add or remove connectors from wagmi/connectors / @wagmi/connectors.
Install only the peer dependencies for connectors you enable (@metamask/connect-evm, @coinbase/wallet-sdk, @walletconnect/ethereum-provider).
Set branding (appName, appLogoUrl, WalletConnect metadata) for your domain and update the RPC/token env vars.
The picker lists useConnectors() output and dedupes EIP-6963 entries by connector.id — verify no duplicate wallet rows after adding a connector.
The EVM stack is consolidated to a single wagmi SSOT:
getEvmRpcUrl() / getEvmTokenAddress() in lib/ring-config-chain.ts — never hardcode public Polygon hosts or confuse with Solana getNativeTokenAddress().pathNeedsWeb3() mounts wagmi only on /login*, /auth/wallet-connect*, /wallet*, /store/checkout*, /nft*, /ai-web3*, /admin/nft*, /admin/web3*.app/_actions/get-wallet-balance.ts is deleted — use getWalletBalance in app/_actions/wallet.ts.WalletClient (features/staking/adapters/evm.ts). Earlier removals: WalletConnectPopup stub, legacy web3-context wrappers, lib/ring-config.ts facade.See-also: legacy ethers examples retired — Wagmi v3 pointer.
APR pools and reward claims on the EVM adapter (viem).
POLYGON_RPC_URL, e.g. an Alchemy or Infura key) — never rely on anonymous public hosts.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID set from Reown Cloud if you want mobile QR connections.RING_CONTRACT_ADDRESS) set once your token is deployed.appName, logo) updated in the connector config for your domain.components/web3/connected-wallet-menu.tsx, components/web3/wallet-shell.tsx |
| Custom picker + connected account UI |
| RPC / chain SSOT | lib/ring-config-chain.ts | getEvmRpcUrl(), getEvmChainId() |
| Low-level RPC | lib/web3/polygon-rpc.ts | getPolygonRpcUrl() (env → Ankr fallback) |
| Token SSOT | lib/ring-config-chain.ts, constants/web3.ts | getEvmTokenAddress(), getRingTokenAddress() |
Do not hardcode public Polygon RPC hosts (polygon-rpc.com blocks anonymous traffic). Resolution order:
| Helper | Location | Resolves |
|---|---|---|
getEvmRpcUrl() | lib/ring-config-chain.ts | chains.evm.rpcUrlEnv env → getPolygonRpcUrl() fallback |
getEvmChainId() | lib/ring-config-chain.ts | chains.evm.chainId (default 137) |
getPolygonRpcUrl() | lib/web3/polygon-rpc.ts | POLYGON_RPC_URL → NEXT_PUBLIC_POLYGON_RPC_URL → Ankr fallback |
lib/wagmi-config.ts wires the Polygon transport as http(getEvmRpcUrl()) and lists polygon first in chains. Server routes, NFT market, staking, and wallet transfer adapters resolve RPC through the same helpers — never ad-hoc strings.
For the RING ERC-20 address use getEvmTokenAddress() (or getRingTokenAddress(), which wraps it). Never use getNativeTokenAddress() for EVM: when chains.native === 'solana' that helper returns the Solana SPL mint, which is not a valid EVM address.
WalletConnect is only added when NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID is present and not the demo-project-id placeholder — this avoids 403 responses from WalletConnect Cloud.
useConnection() over legacy useAccount() for address / chain / isConnected.useConnectors(); connect via useConnect().mutate({ connector }) (or mutateAsync).useSwitchChain().mutate({ chainId }); read configured chains with useChains().Edit lib/wagmi-config.ts — add or remove connectors from wagmi/connectors / @wagmi/connectors.
Install only the peer dependencies for connectors you enable (@metamask/connect-evm, @coinbase/wallet-sdk, @walletconnect/ethereum-provider).
Set branding (appName, appLogoUrl, WalletConnect metadata) for your domain and update the RPC/token env vars.
The picker lists useConnectors() output and dedupes EIP-6963 entries by connector.id — verify no duplicate wallet rows after adding a connector.
The EVM stack is consolidated to a single wagmi SSOT:
getEvmRpcUrl() / getEvmTokenAddress() in lib/ring-config-chain.ts — never hardcode public Polygon hosts or confuse with Solana getNativeTokenAddress().pathNeedsWeb3() mounts wagmi only on /login*, /auth/wallet-connect*, /wallet*, /store/checkout*, /nft*, /ai-web3*, /admin/nft*, /admin/web3*.app/_actions/get-wallet-balance.ts is deleted — use getWalletBalance in app/_actions/wallet.ts.WalletClient (features/staking/adapters/evm.ts). Earlier removals: WalletConnectPopup stub, legacy web3-context wrappers, lib/ring-config.ts facade.See-also: legacy ethers examples retired — Wagmi v3 pointer.