-
Notifications
You must be signed in to change notification settings - Fork 13
[TASK-14095] feat: add fallback transport to viem clients #1131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Use viem fallback transport to handle RPC errors and fallback to other providers.
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughSynchronous refactor of getPublicClient with a new fallback transport, updates to all call sites, migration away from ethers/SDK provider utilities, adjustments to ENS utilities’ RPC handling, constants cleanup, zerodev clients switched to fallback transport, and test mocks updated to include viem.fallback. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
src/app/actions/claimLinks.ts (1)
12-48
: Sanity-check complete: remove direct http imports outside the transport builder
- No
await getPublicClient(...)
calls remain.- Direct
http
imports found only in:
• src/app/actions/clients.ts (line 2) — this file implementsgetTransportWithFallback
, so importinghttp
andfallback
here is expected.
• src/context/kernelClient.context.tsx (line 20) — must be refactored.- Raw
http(...)
invocations found in kernelClient.context.tsx (lines 78, 103) and in clients.ts (lines 19, 22). The latter are part of the transport-builder logic and can remain; the former need to usegetTransportWithFallback
.- No
createPublicClient
calls missing atransport
fallback.Action items in src/context/kernelClient.context.tsx:
- Update your imports around line 20:
-import { Chain, http, PublicClient, Transport } from 'viem' +import { Chain, PublicClient, Transport } from 'viem' +import { getTransportWithFallback } from '@/app/actions/clients'- Replace the two
http(...)
calls (around lines 78 and 103) with the fallback transport:-bundlerTransport: http(bundlerUrl), +bundlerTransport: getTransportWithFallback(chain.id), … -transport: http(paymasterUrl), +transport: getTransportWithFallback(chain.id),src/app/actions/tokens.ts (3)
151-189
: Cache key missing dynamic params will cause cross-token/chain collisions.
unstable_cache
is configured with a static key['fetchTokenDetails']
. This will cache the first token details fetched and return it for subsequent calls, regardless oftokenAddress
orchainId
. Same pattern exists below for gas price/estimate. Include the parameters in the cache key (or switch to a small wrapper that derives keys per call).Apply this refactor pattern:
-export const fetchTokenDetails = unstable_cache( - async ( - tokenAddress: string, - chainId: string - ): Promise<{ - symbol: string - name: string - decimals: number - }> => { +export const fetchTokenDetails = async ( + tokenAddress: string, + chainId: string +): Promise<{ symbol: string; name: string; decimals: number }> => + unstable_cache( + async () => { console.log('chain id', chainId) const tokenDetails = getTokenDetails({ tokenAddress: tokenAddress as Address, chainId: chainId! }) if (tokenDetails) return tokenDetails const client = getPublicClient(Number(chainId) as ChainId) console.log('token address', tokenAddress) const [symbol, name, decimals] = await Promise.all([ /* ... */ ]) if (!symbol || !name || !decimals) throw new Error('Failed to fetch token details') return { symbol, name, decimals } - }, - ['fetchTokenDetails'], - { - tags: ['fetchTokenDetails'], - } -) + }, + ['fetchTokenDetails', chainId, tokenAddress], + { tags: ['fetchTokenDetails'] } + )()Repeat the same approach for the gas helpers below to include their inputs in the cache key.
194-204
: Gas price cache key is global; include chainId.
['getGasPrice']
will cache a single chain’s gas price for all chains. This yields incorrect estimates across networks.Proposed change:
-const getCachedGasPrice = unstable_cache( - async (chainId: string) => { - const client = getPublicClient(Number(chainId) as ChainId) - const gasPrice = await client.getGasPrice() - return gasPrice.toString() - }, - ['getGasPrice'], - { - revalidate: 2 * 60, // 2 minutes - } -) +const getCachedGasPrice = (chainId: string) => + unstable_cache( + async () => { + const client = getPublicClient(Number(chainId) as ChainId) + const gasPrice = await client.getGasPrice() + return gasPrice.toString() + }, + ['getGasPrice', chainId], + { revalidate: 2 * 60 } + )()
209-223
: Gas estimate cache key ignores from/to/data/chain; collisions likely.The current key
['getGasEstimate']
will reuse the first gas estimate for arbitrary transactions and networks. This can severely skew cost calculations.Apply a safer per-call key. Consider hashing
data
to avoid a very long key:-import type { Address, Hex } from 'viem' +import type { Address, Hex } from 'viem' +import { keccak256 } from 'viem' +import { toHex } from 'viem' -const getCachedGasEstimate = unstable_cache( - async (fromAddress: Address, contractAddress: Address, data: Hex, chainId: string) => { - const client = getPublicClient(Number(chainId) as ChainId) - const gasEstimate = await client.estimateGas({ - account: fromAddress, - to: contractAddress, - data, - }) - return gasEstimate.toString() - }, - ['getGasEstimate'], - { - revalidate: 5 * 60, // 5 minutes - gas estimates are more stable - } -) +const getCachedGasEstimate = ( + fromAddress: Address, + contractAddress: Address, + data: Hex, + chainId: string +) => + unstable_cache( + async () => { + const client = getPublicClient(Number(chainId) as ChainId) + const gasEstimate = await client.estimateGas({ + account: fromAddress, + to: contractAddress, + data, + }) + return gasEstimate.toString() + }, + [ + 'getGasEstimate', + chainId, + fromAddress, + contractAddress, + // compact key for calldata + keccak256(data as Hex), + ], + { revalidate: 5 * 60 } + )()
🧹 Nitpick comments (9)
src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx (2)
42-47
: Mock viem.fallback to return a minimal Transport functionRight now
fallback: jest.fn()
returns a bare mock. If any path actually callsviem.fallback(...)
,createPublicClient
may expect a Transport function and could crash. Return a minimal transport to harden the test double.jest.mock('viem', () => ({ isAddress: (address: string) => address.startsWith('0x') && address.length === 42, http: jest.fn(), createPublicClient: jest.fn(), - fallback: jest.fn(), + // Return a minimal viem Transport function shape + fallback: jest.fn(() => () => ({ request: jest.fn() })), }))
42-47
: Prefer partial mocking to avoid unintentionally stripping needed viem exportsIf other imports inside this test (or transitive deps) rely on additional viem exports, a full module mock can cause surprising failures. Consider spreading the real module and overriding only what you need.
-jest.mock('viem', () => ({ - isAddress: (address: string) => address.startsWith('0x') && address.length === 42, - http: jest.fn(), - createPublicClient: jest.fn(), - fallback: jest.fn(() => () => ({ request: jest.fn() })), -})) +jest.mock('viem', () => { + const actual = jest.requireActual('viem') + return { + ...actual, + isAddress: (address: string) => address.startsWith('0x') && address.length === 42, + http: jest.fn(() => () => ({ request: jest.fn() })), + createPublicClient: jest.fn(), + fallback: jest.fn(() => () => ({ request: jest.fn() })), + } +})src/utils/ens.utils.ts (2)
21-39
: Consider memoizing JustaName instance
JustaName.init(...)
on every call can be wasteful. Cache per-process (single-threaded Next.js) keyed bysiteUrl
to reduce init overhead and improve latency.// outside the function let cachedJan: ReturnType<typeof JustaName.init> | null = null // inside resolveAddressToUsername(...) if (!cachedJan) { cachedJan = JustaName.init({ /* same config */ }) } const justAName = cachedJan
32-33
: Remove informal comment in production codeThe “i dont even have an API key but it works haha” comment is unprofessional and can confuse future maintainers.
- apiKey: process.env.JUSTANAME_API_KEY || '', // i dont even have an API key but it works haha @facu + apiKey: process.env.JUSTANAME_API_KEY || '',src/app/actions/claimLinks.ts (1)
38-41
: Unreachable/null-check is ineffective for deposit existence
deposit
is an object you’ve just constructed; theif (!deposit)
guard will never trigger. If you need a “not found” signal, check fields onrawDeposit
(e.g., all-zero tuple) instead.- if (!deposit) { - throw new Error(`No deposit found for depositIdx ${depositIdx}`) - } + // Example: treat a zero sender address as "not found" (adjust to actual contract semantics) + if (!rawDeposit || rawDeposit[8] === '0x0000000000000000000000000000000000000000') { + throw new Error(`No deposit found for depositIdx ${depositIdx}`) + }src/constants/zerodev.consts.ts (1)
49-57
: Key type mismatch: use numeric keys for chain-indexed map
Record<string, …>
works at runtime, but these keys are numeric chain IDs in practice. Switching toRecord<number, …>
improves type safety when indexing witharbitrum.id
/polygon.id
.-export const PUBLIC_CLIENTS_BY_CHAIN: Record< - string, +export const PUBLIC_CLIENTS_BY_CHAIN: Record< + number, { client: PublicClient chain: Chain bundlerUrl: string paymasterUrl: string } > = {src/utils/general.utils.ts (1)
1059-1066
: Add bytes32 fallback for non-standard ERC20symbol
.Some ERC-20s (legacy or proxies) implement
symbol() -> bytes32
. Reading viaerc20Abi
(string) will revert. Add a fallback read to bytes32 and decode.Suggested patch:
- const client = getPublicClient(Number(chainId) as ChainId) - tokenSymbol = (await client.readContract({ - address: tokenAddress as Address, - abi: erc20Abi, - functionName: 'symbol', - args: [], - })) as string + const client = getPublicClient(Number(chainId) as ChainId) + try { + tokenSymbol = (await client.readContract({ + address: tokenAddress as Address, + abi: erc20Abi, + functionName: 'symbol', + args: [], + })) as string + } catch { + // Fallback: bytes32 symbol + const bytes32Symbol = (await client.readContract({ + address: tokenAddress as Address, + abi: [{ type: 'function', name: 'symbol', stateMutability: 'view', inputs: [], outputs: [{ type: 'bytes32' }] }] as const, + functionName: 'symbol', + })) as `0x${string}` + // Decode bytes32 -> string and trim null bytes + const { hexToString } = await import('viem') + tokenSymbol = hexToString(bytes32Symbol).replace(/\u0000+$/g, '') + }If you prefer to avoid dynamic import, pull
hexToString
in the top-level Viem import.src/app/actions/clients.ts (2)
10-28
: Good centralization of fallback transport; consider a couple of small hardening tweaks.
- Edge case: if
rpcUrls[chainId]
exists but is an empty array,fallback([])
would throw. Guard by checking length.- You may want to set
retryCount
/stallTimeout
to reduce time to first success under provider stalls.Proposed tweak:
-export function getTransportWithFallback(chainId: ChainId): Transport { - const providerUrls = rpcUrls[chainId] - if (!providerUrls) { +export function getTransportWithFallback(chainId: ChainId): Transport { + const providerUrls = rpcUrls[chainId] + if (!providerUrls || providerUrls.length === 0) { // If no premium providers are configured, viem will use a default one return http() } return fallback( providerUrls.map((u) => http(u)), - // Viem checks the status of the provider every 60 seconds and notes latency - // and stability. The provider that viem will try first depend on this - // ranking - { rank: { interval: 60_000 } } + { + // Rank providers every 60s and fail over promptly if one stalls. + rank: { interval: 60_000 }, + retryCount: 2, + stallTimeout: 2_500, + } ) }
30-39
: Avoid repeatedPublicClient
instantiation for non-preconfigured chains.
PUBLIC_CLIENTS_BY_CHAIN
covers a subset of chains. For others,getPublicClient
creates a new client each call. Adding a small in-module cache avoids extra instantiation and keeps connections/stats warm across requests.Patch:
-const allChains = Object.values(chains) +const allChains = Object.values(chains) export type ChainId = (typeof allChains)[number]['id'] +// Lightweight per-process cache for chains not listed in PUBLIC_CLIENTS_BY_CHAIN +const EPHEMERAL_CLIENTS = new Map<ChainId, PublicClient>() + export function getPublicClient(chainId: ChainId): PublicClient { - let client: PublicClient | undefined = PUBLIC_CLIENTS_BY_CHAIN[chainId]?.client - if (client) return client + let client: PublicClient | undefined = PUBLIC_CLIENTS_BY_CHAIN[chainId]?.client ?? EPHEMERAL_CLIENTS.get(chainId) + if (client) return client const chain: Chain = extractChain({ chains: allChains, id: chainId }) if (!chain) throw new Error(`No chain found for chainId ${chainId}`) - return createPublicClient({ + const created = createPublicClient({ transport: getTransportWithFallback(chainId), chain, }) + EPHEMERAL_CLIENTS.set(chainId, created) + return created }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (10)
src/app/actions/claimLinks.ts
(3 hunks)src/app/actions/clients.ts
(1 hunks)src/app/actions/tokens.ts
(3 hunks)src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx
(1 hunks)src/constants/general.consts.ts
(0 hunks)src/constants/zerodev.consts.ts
(3 hunks)src/services/swap.ts
(1 hunks)src/utils/ens.utils.ts
(2 hunks)src/utils/general.utils.ts
(2 hunks)src/utils/sdk.utils.ts
(0 hunks)
💤 Files with no reviewable changes (2)
- src/constants/general.consts.ts
- src/utils/sdk.utils.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-05-23T19:26:58.220Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#873
File: src/components/Withdraw/views/Initial.withdraw.view.tsx:95-95
Timestamp: 2025-05-23T19:26:58.220Z
Learning: The GeneralRecipientInput component supports username validation and resolution through the validateAndResolveRecipient function in src/lib/validation/recipient.ts. The function automatically detects usernames (inputs that don't contain '.' for ENS and don't start with '0x' for addresses), validates them via API HEAD request, fetches user data, and resolves them to Ethereum addresses from the user's PEANUT_WALLET account.
Applied to files:
src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx
🧬 Code graph analysis (7)
src/utils/ens.utils.ts (2)
src/constants/general.consts.ts (1)
rpcUrls
(18-29)src/utils/__mocks__/wagmi.ts (1)
mainnet
(2-14)
src/constants/zerodev.consts.ts (1)
src/app/actions/clients.ts (1)
getTransportWithFallback
(15-28)
src/services/swap.ts (1)
src/app/actions/clients.ts (2)
getPublicClient
(30-39)ChainId
(8-8)
src/utils/general.utils.ts (1)
src/app/actions/clients.ts (2)
getPublicClient
(30-39)ChainId
(8-8)
src/app/actions/tokens.ts (1)
src/app/actions/clients.ts (2)
getPublicClient
(30-39)ChainId
(8-8)
src/app/actions/claimLinks.ts (2)
src/app/actions/clients.ts (2)
getPublicClient
(30-39)ChainId
(8-8)src/constants/zerodev.consts.ts (1)
PEANUT_WALLET_CHAIN
(18-18)
src/app/actions/clients.ts (2)
src/constants/general.consts.ts (1)
rpcUrls
(18-29)src/constants/zerodev.consts.ts (1)
PUBLIC_CLIENTS_BY_CHAIN
(49-78)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Deploy-Preview
🔇 Additional comments (11)
src/utils/ens.utils.ts (1)
25-26
: Propagate the guarded URL into JustaName provider configMake sure the safe
mainnetRpcUrl
is used here; no change needed after applying the previous fix, just calling out the dependency.src/app/actions/claimLinks.ts (3)
18-25
: Good: switched to synchronous PublicClientThe transition to
getPublicClient(...)
withoutawait
matches the new synchronous API and simplifies control flow.
61-66
: LGTM: synchronous client usage for receipt pollingUsing the sync public client for
waitForTransactionReceipt
is correct and aligns with the refactor.
71-83
: LGTM: synchronous client used for readContract
getNextDepositIndex
now uses the directPublicClient
, consistent with the repo-wide change.src/services/swap.ts (1)
194-201
: LGTM: updated to sync PublicClient
getPublicClient(Number(chainId) as ChainId)
aligns with the new API. Casting viaNumber(chainId)
is appropriate given the input type isstring
.src/constants/zerodev.consts.ts (3)
3-5
: LGTM: centralizing on fallback transportImporting
createPublicClient
andgetTransportWithFallback
matches the new transport strategy and keeps transport logic consistent.
60-63
: LGTM: arbitrum client now uses fallback transportUsing
getTransportWithFallback(arbitrum.id)
is consistent with the PR objective and improves resiliency.
70-73
: LGTM: polygon client now uses fallback transportSame benefits as above; polling interval retained.
src/app/actions/tokens.ts (2)
163-163
: SyncgetPublicClient
swap looks correct.Replacing
await getPublicClient(...)
with the synchronousgetPublicClient(...)
at all call sites is aligned with the new API and avoids unnecessary awaits. No functional issues spotted here.Also applies to: 196-196, 211-211
160-166
: Validate and enforce numeric-only chainId inputs before castingI reran a scan across
.ts/.tsx
files and didn’t find any literal"0x…"
or"evm:…"
prefixes passed directly aschainId
. However, since the code doesNumber(chainId) as ChainId
, any non-numeric string (e.g."evm:42161"
,"0x1"
) would becomeNaN
and break client creation. Please:
Verify that all upstream sources of
chainId
are guaranteed to be plain numeric strings. In particular, confirm how these variables are derived:
selectedChainID
in
src/components/Request/link/views/Create.request.link.view.tsx
(l.141)sendLink.chainId
in
src/components/Claim/Claim.tsx
(l.177)deposit.chainId
in
src/app/actions/claimLinks.ts
(l.41)- The
chainId
argument passed to
estimateTransactionCostUsd
in
src/services/swap.ts
(l.237) and
src/hooks/usePaymentInitiator.ts
(l.268)- The
chainId
prop used in
src/app/actions/tokens.ts
(l.237–240)If any of these can ever be non-numeric, either:
- Add a simple runtime guard (e.g.
if (isNaN(+chainId)) throw new Error("Invalid chainId")
), or- Use a dedicated parser/util (e.g.
parseChainId(chainId)
) that fails fast on bad inputs.This will ensure we never feed
NaN
intogetPublicClient
or other downstream calls.src/utils/general.utils.ts (1)
18-21
: Imports updated for Viem client + ERC20 ABI.The move to
getPublicClient
anderc20Abi
aligns with the PR direction and removes SDK-provider coupling. Looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i creamed my pants with this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as BE, amazinng
* feat: handle send link claims to bank account for peanut users (#1078) * reafactor: create reusable country list component and use it for all the flows * feat: reusable user accounts components * feat: handle different cases based on kyc status for bank claim * fix: account creation * chore: add docstring to hooks * chore: better comments for bank flow manager * fix: kyc modal closing after tos acceptance issue * fix: remove bank acc caching from withdraw flow * fix: update confirm claim modal copy * fix: remove bank acc caching from claim flow * fix: navheader title * remove duplicate debounce code and use `useDebounce` hook instead (#1079) * Landing page v2.1 (#1089) * lpv2.1 part 1 * Add exchange widget * add and integrate exchange API * add yourMoney component bg * update landing countries svg * integrate frankfurter API * fixes and improvements * decrease hero section height * allow max 2 decimal places * Add `/exchange` route * fix: overlay * make destination amount editable and bugg fixes * some fixes & currency improvements * crucial commit * fix checkmark, font size and weight --------- Co-authored-by: Hugo Montenegro <[email protected]> * [TASK-13186] refactor: use networkName instead of axelarChainName (#1095) * refactor: use networkName instead of axelarChainName * fix: types * fix: onramp currency (#1096) * fix: stretched favicon (#1099) * [TASK-13971] fix: scientific notation in eip681 parsing (#1097) * fix: scientific notation in eip681 parsing * fix: qr handling tests * fix: peanut sdk mock * pull iban hotfix (#1100) * fix: claim flow bugs (#1102) * fix: cross chain claim * fix: full name issue on confirm bank claim view * fix: back navigation on desktop views * Fix back button not working on /profile (#1101) * Fix back button not working * fix public profile page * extract internal navigation logic to utility function * fix: send link claims to us bank accounts (#1108) * fix: usa bank account claims * fix: show bank account details in confirm claim view * Sync Landing page changes (#1111) * reduce clouds size and update font * fix: hero section responsiveness issue * fix: formatting errors * add currency animation * fix: us bank claims after kyc for logged in users (#1112) * fix: trim account form inputs for spaces (#1114) * [TASK-14107] fix: don't allow claiming on xChain if route is not found (#1115) * fix: don't allow claiming on xChain if route is not found * fix(claim): use correct decimals for min receive amount * feat: handle redirect uri when on unsupported browsers (#1117) * feat: handle redirect uri when on unsupported browsers * fix: confirm bank claim ui rows for iban guest claim * remove animation (#1118) * Prod to staging (#1124) * HOTFIX - IBAN country detection and incorrect bank acc details (#1094) * Fix: Iban country detection and incorrect bank acc details * Fix: update IBAN country validation to use correct locale string comparison * add validations for US and mexican bank accounts * fix typo * fix claim flow and create a reusable function for getting 3 letter code * fix country code mismatch * fix: show error below input field * remove unnecessary checks * remove unnecessary CLABE check * Prod LP v2.1 (#1098) * feat: lpv2.1 * fix: gigaclouds, font and exchange widget * fixes and improvements * remove duplicate export * remove unused component * Fix: Landing page hero section responsiveness issue (#1107) * fix: hero section responsiveness issue * fix: stars position * fix height on desktop * remove unused code * fix margins (#1113) * [TASK-14052] Prod release 105 (#1122) * feat: handle send link claims to bank account for peanut users (#1078) * reafactor: create reusable country list component and use it for all the flows * feat: reusable user accounts components * feat: handle different cases based on kyc status for bank claim * fix: account creation * chore: add docstring to hooks * chore: better comments for bank flow manager * fix: kyc modal closing after tos acceptance issue * fix: remove bank acc caching from withdraw flow * fix: update confirm claim modal copy * fix: remove bank acc caching from claim flow * fix: navheader title * remove duplicate debounce code and use `useDebounce` hook instead (#1079) * Landing page v2.1 (#1089) * lpv2.1 part 1 * Add exchange widget * add and integrate exchange API * add yourMoney component bg * update landing countries svg * integrate frankfurter API * fixes and improvements * decrease hero section height * allow max 2 decimal places * Add `/exchange` route * fix: overlay * make destination amount editable and bugg fixes * some fixes & currency improvements * crucial commit * fix checkmark, font size and weight --------- Co-authored-by: Hugo Montenegro <[email protected]> * [TASK-13186] refactor: use networkName instead of axelarChainName (#1095) * refactor: use networkName instead of axelarChainName * fix: types * fix: onramp currency (#1096) * fix: stretched favicon (#1099) * [TASK-13971] fix: scientific notation in eip681 parsing (#1097) * fix: scientific notation in eip681 parsing * fix: qr handling tests * fix: peanut sdk mock * pull iban hotfix (#1100) * fix: claim flow bugs (#1102) * fix: cross chain claim * fix: full name issue on confirm bank claim view * fix: back navigation on desktop views * Fix back button not working on /profile (#1101) * Fix back button not working * fix public profile page * extract internal navigation logic to utility function * fix: send link claims to us bank accounts (#1108) * fix: usa bank account claims * fix: show bank account details in confirm claim view * Sync Landing page changes (#1111) * reduce clouds size and update font * fix: hero section responsiveness issue * fix: formatting errors * add currency animation * fix: us bank claims after kyc for logged in users (#1112) * fix: trim account form inputs for spaces (#1114) * [TASK-14107] fix: don't allow claiming on xChain if route is not found (#1115) * fix: don't allow claiming on xChain if route is not found * fix(claim): use correct decimals for min receive amount * feat: handle redirect uri when on unsupported browsers (#1117) * feat: handle redirect uri when on unsupported browsers * fix: confirm bank claim ui rows for iban guest claim * remove animation (#1118) * fix: formatting --------- Co-authored-by: Kushagra Sarathe <[email protected]> Co-authored-by: Mohd Zishan <[email protected]> Co-authored-by: Hugo Montenegro <[email protected]> --------- Co-authored-by: Mohd Zishan <[email protected]> Co-authored-by: Kushagra Sarathe <[email protected]> Co-authored-by: Hugo Montenegro <[email protected]> * fix: dates in receipts (#1105) * [TASK-13865] fix: add tx info on receipt (#1109) * fix: add tx info on receipt * feat: use address explorer url for depositor address * fix(history): check befroe creating address explorer url * Fix: logged in users have to re-login after installing PWA (#1103) * store `LOCAL_STORAGE_WEB_AUTHN_KEY` in cookies * ensure backward compatibility * refactor: move syncLocalStorageToCookie call into useEffect for better lifecycle management * feat: links v2.1 req fulfilment flows (#1085) * reafactor: create reusable country list component and use it for all the flows * feat: reusable user accounts components * feat: handle different cases based on kyc status for bank claim * fix: account creation * chore: add docstring to hooks * chore: better comments for bank flow manager * fix: kyc modal closing after tos acceptance issue * fix: remove bank acc caching from withdraw flow * fix: update confirm claim modal copy * fix: remove bank acc caching from claim flow * fix: navheader title * feat: req fulfillment exchange flow * fix: header title * feat: req fulfillment using connected external wallet * fix: navigation and ui * fix: file name * feat: abstract reusbale components from onramp flow for bank fulfilment * feat: handle onramp creation for request fulfilment * feat: reusable verification component * feat: handle bank req fulfilment for peanut users * fix: show all supported countries in req/claim bank flow * feat: show google-pay/apple-pay based on users device * fix: resolve pr review comments * fix: exhange rate hook fallback value * fix: resolve pr comments * Feat: Collect tg username (#1110) * feat: collect tg username * update animations * fix api route * add thinking peanut gif * fix typescript errors * fix typo and reset telegramHandle field on logout * fix: spacing and describe regex rules * add missing export * feat: add sound in success views (#1127) * feat: handle history ui changes for links v2.1 (#1106) * reafactor: create reusable country list component and use it for all the flows * feat: reusable user accounts components * feat: handle different cases based on kyc status for bank claim * fix: account creation * chore: add docstring to hooks * chore: better comments for bank flow manager * fix: kyc modal closing after tos acceptance issue * fix: remove bank acc caching from withdraw flow * fix: update confirm claim modal copy * fix: remove bank acc caching from claim flow * fix: navheader title * feat: req fulfillment exchange flow * fix: header title * feat: req fulfillment using connected external wallet * fix: navigation and ui * fix: file name * feat: abstract reusbale components from onramp flow for bank fulfilment * feat: handle onramp creation for request fulfilment * feat: reusable verification component * feat: handle bank req fulfilment for peanut users * fix: show all supported countries in req/claim bank flow * feat: show google-pay/apple-pay based on users device * feat: handle bank send link claim hisotry for peanut users * feat: handle history ui changes for request fulfillment using bank accounts * fix: resolve pr review comments * fix: exhange rate hook fallback value * fix: resolve pr comments * fix: review comments * feat: badges updates (#1119) * feat: badges updates and hook to check for interactions * feat: handle badges for receipts and drawer header * feat: handle badges on request and send flow * feat: tooltip for badges * fix: tooltip positioning * fix: associate a external wallet claim to user if logged in (#1126) * fix: associate a external wallet claim to user if logged in * chore: fix comments * [TASK-14113] fix: handle rpc outage when creating sendlinks (#1120) * HOTFIX - IBAN country detection and incorrect bank acc details (#1094) * Fix: Iban country detection and incorrect bank acc details * Fix: update IBAN country validation to use correct locale string comparison * add validations for US and mexican bank accounts * fix typo * fix claim flow and create a reusable function for getting 3 letter code * fix country code mismatch * fix: show error below input field * remove unnecessary checks * remove unnecessary CLABE check * Prod LP v2.1 (#1098) * feat: lpv2.1 * fix: gigaclouds, font and exchange widget * fixes and improvements * remove duplicate export * remove unused component * Fix: Landing page hero section responsiveness issue (#1107) * fix: hero section responsiveness issue * fix: stars position * fix height on desktop * remove unused code * fix margins (#1113) * fix: handle rpc outage when creating sendlinks * fix: formatting * fix: parallelize geting deposit index --------- Co-authored-by: Mohd Zishan <[email protected]> * Integrate Daimo Pay (#1104) * add daimo pay * minor improvements * cleanup and add success state * resolve dependency issues * fix: formatting * fix: recent methods redirection * add functions for daimo payment in request fulfilment flow * Integrate daimo in request fulfilment flow * remove hardcoded address * add separate arbitrum usdc flow for deposits * Add risk modal * fix overlay blur * Enhance loading state indication in payment process * Add payer's address in deposit history entry * Add validation * add error handling * remove action and move logic to API route * fix errors * fix: request flow * fix: validation * fixes * add daimo flow in country specific method * fix: slider not working on first attempt * filter supported networks * create reusable daimo button * remove space * remove route.ts file and move logic to server actions * fix: infinite loading edge case * update api and remove delay * fix: layout shift * fix: shadow * update function name * fix: success receipt (#1129) * fix: roboto font not working (#1130) * fix: allow cancel link from the claim page * fix: allow canceling links from the shared receipt (#1134) * fix: send flow cta (#1133) * fix: send flow ctas * fix: success sound on send flow * fix: disabled btn on req pay flow * Fix Daimo bugs (#1132) * fix: bugs * fix cross chain deposit details not correct * fix: request screen UI * add loading state * remove old daimo button * fix: missing dependencies and dead code * add try catch finally block * remove clear Daimo errors inside the balance-check effect * fix copy * minor fixes * move ACTION_METHODS to constants file to remove circular dependency * fix: circular dependency * fix ts error * update daimo version * [TASK-14095] feat: add fallback transport to viem clients (#1131) * feat: add fallback transport to viem clients Use viem fallback transport to handle RPC errors and fallback to other providers. * style: Apply prettier formatting * test: add fallback to viem mock * fix: external claim links history ui + badges fix (#1136) * fix: external claim links history ui + badges fix * fix: resolve codderrabbit suggestions * fix: coderrabbit comment on state stale * Fix: disable add money button on default state + disable sound on IOS (#1145) * fix: add money success screen shows usernmae * disable add money button in default state * disable sound on IOS * Fix: daimo bugs part2 (#1149) * fix: black screen on IOS * fix: sucess screen showed without paying - add money flow * fix currency and double $ in txn history * fix: x-chan token size and add API to get missing token icons * fix: req fulfilment * add default value to tokenData * fix: move useeffect above transaction null check * format amount * fix: space between currency and amount (#1135) * Lock token to USDC arb for peanut ens username (#1128) * Lock token to USDC arb for peanut ens username * add comment * revert variable declaration for sanitizedValue in GeneralRecipientInput component * fix add regex to strip only from the end * [TASK-13900] Feat/kyc modal changes (#1137) * fix: pointer events * fix: modal btns not working on mobile * add missing dependency * remove close button * Chore/prod to dev 106 (#1152) * HOTFIX - IBAN country detection and incorrect bank acc details (#1094) * Fix: Iban country detection and incorrect bank acc details * Fix: update IBAN country validation to use correct locale string comparison * add validations for US and mexican bank accounts * fix typo * fix claim flow and create a reusable function for getting 3 letter code * fix country code mismatch * fix: show error below input field * remove unnecessary checks * remove unnecessary CLABE check * Prod LP v2.1 (#1098) * feat: lpv2.1 * fix: gigaclouds, font and exchange widget * fixes and improvements * remove duplicate export * remove unused component * Fix: Landing page hero section responsiveness issue (#1107) * fix: hero section responsiveness issue * fix: stars position * fix height on desktop * remove unused code * fix margins (#1113) * [TASK-14052] Prod release 105 (#1122) * feat: handle send link claims to bank account for peanut users (#1078) * reafactor: create reusable country list component and use it for all the flows * feat: reusable user accounts components * feat: handle different cases based on kyc status for bank claim * fix: account creation * chore: add docstring to hooks * chore: better comments for bank flow manager * fix: kyc modal closing after tos acceptance issue * fix: remove bank acc caching from withdraw flow * fix: update confirm claim modal copy * fix: remove bank acc caching from claim flow * fix: navheader title * remove duplicate debounce code and use `useDebounce` hook instead (#1079) * Landing page v2.1 (#1089) * lpv2.1 part 1 * Add exchange widget * add and integrate exchange API * add yourMoney component bg * update landing countries svg * integrate frankfurter API * fixes and improvements * decrease hero section height * allow max 2 decimal places * Add `/exchange` route * fix: overlay * make destination amount editable and bugg fixes * some fixes & currency improvements * crucial commit * fix checkmark, font size and weight --------- Co-authored-by: Hugo Montenegro <[email protected]> * [TASK-13186] refactor: use networkName instead of axelarChainName (#1095) * refactor: use networkName instead of axelarChainName * fix: types * fix: onramp currency (#1096) * fix: stretched favicon (#1099) * [TASK-13971] fix: scientific notation in eip681 parsing (#1097) * fix: scientific notation in eip681 parsing * fix: qr handling tests * fix: peanut sdk mock * pull iban hotfix (#1100) * fix: claim flow bugs (#1102) * fix: cross chain claim * fix: full name issue on confirm bank claim view * fix: back navigation on desktop views * Fix back button not working on /profile (#1101) * Fix back button not working * fix public profile page * extract internal navigation logic to utility function * fix: send link claims to us bank accounts (#1108) * fix: usa bank account claims * fix: show bank account details in confirm claim view * Sync Landing page changes (#1111) * reduce clouds size and update font * fix: hero section responsiveness issue * fix: formatting errors * add currency animation * fix: us bank claims after kyc for logged in users (#1112) * fix: trim account form inputs for spaces (#1114) * [TASK-14107] fix: don't allow claiming on xChain if route is not found (#1115) * fix: don't allow claiming on xChain if route is not found * fix(claim): use correct decimals for min receive amount * feat: handle redirect uri when on unsupported browsers (#1117) * feat: handle redirect uri when on unsupported browsers * fix: confirm bank claim ui rows for iban guest claim * remove animation (#1118) * fix: formatting --------- Co-authored-by: Kushagra Sarathe <[email protected]> Co-authored-by: Mohd Zishan <[email protected]> Co-authored-by: Hugo Montenegro <[email protected]> * fix: bank claim flow runtime error (#1138) * hotfix: make iban non optional (#1139) * fix: bank claim flow runtime error * fix: dont have iban as optional * fix: merge conflicts * fix: merge external account with bank details (#1140) * fix: add id to external account (#1142) * added tg footer (#1144) * Hotfix : add missing countries - claim as guest flow (#1146) * fix: add missing countries * remove duplicate comment * fix: show error on dynamic bank account form (#1147) * fix: Invalid IBAN for UK (#1151) --------- Co-authored-by: Mohd Zishan <[email protected]> Co-authored-by: Kushagra Sarathe <[email protected]> Co-authored-by: Hugo Montenegro <[email protected]> Co-authored-by: Hugo Montenegro <[email protected]> * [TASK-13950] Fix: incorrect token amount on second withdraw (#1150) * fix: incorrect token amount on second withdraw * move `resetTokenContextProvider()` to unmount callback * fix: transaction explorer url for deposits * fix: history skeleton copy * save token and chain details for cross chain req-fulfilments (#1154) * fix: send links history ui for senders pov when claimed to bank accounts (#1156) * fix: sort action list methods * fix: send links claimed to bank accounts history ui for senders pov * fix: issues for request link paying with bank (#1158) - Specify recipient when creating onramp for request fulfillment - Use correct amount depending on currency * fix: stop cleaning error by bic field (#1159) We now always clear before starting submission and also bic field will always show, so that logic is not needed anymore. * fix: claim country currency and amount, fallback to $ (#1164) * feat: show local bank currency incase of bank claims * fix: activity rows for sender's send link history * fix: verification modal when claiming * fix: state issue when new user tries to claim to bank * fix: request pay copy (#1165) * fix: close kyc modal btn (#1166) * Fix testing github action (#1167) * chore: remove prettier action When commiting it clashes with signature verification rules * chore: update test action setup version * fix: install first * fix: actually make sure that cancelledDate is a Date (#1170) * fix: icon and margin (#1171) * Hide pay with wallet button in Daimo component (#1172) * hide pay with wallet button * improve targeted css approach * Fix: Daimo bug and activity receipt bug (#1175) * sligify chain name * fix: stale state issue * hide row if tokenData is not present * Fix/conflicts (#1177) * HOTFIX - IBAN country detection and incorrect bank acc details (#1094) * Fix: Iban country detection and incorrect bank acc details * Fix: update IBAN country validation to use correct locale string comparison * add validations for US and mexican bank accounts * fix typo * fix claim flow and create a reusable function for getting 3 letter code * fix country code mismatch * fix: show error below input field * remove unnecessary checks * remove unnecessary CLABE check * Prod LP v2.1 (#1098) * feat: lpv2.1 * fix: gigaclouds, font and exchange widget * fixes and improvements * remove duplicate export * remove unused component * Fix: Landing page hero section responsiveness issue (#1107) * fix: hero section responsiveness issue * fix: stars position * fix height on desktop * remove unused code * fix margins (#1113) * [TASK-14052] Prod release 105 (#1122) * feat: handle send link claims to bank account for peanut users (#1078) * reafactor: create reusable country list component and use it for all the flows * feat: reusable user accounts components * feat: handle different cases based on kyc status for bank claim * fix: account creation * chore: add docstring to hooks * chore: better comments for bank flow manager * fix: kyc modal closing after tos acceptance issue * fix: remove bank acc caching from withdraw flow * fix: update confirm claim modal copy * fix: remove bank acc caching from claim flow * fix: navheader title * remove duplicate debounce code and use `useDebounce` hook instead (#1079) * Landing page v2.1 (#1089) * lpv2.1 part 1 * Add exchange widget * add and integrate exchange API * add yourMoney component bg * update landing countries svg * integrate frankfurter API * fixes and improvements * decrease hero section height * allow max 2 decimal places * Add `/exchange` route * fix: overlay * make destination amount editable and bugg fixes * some fixes & currency improvements * crucial commit * fix checkmark, font size and weight --------- Co-authored-by: Hugo Montenegro <[email protected]> * [TASK-13186] refactor: use networkName instead of axelarChainName (#1095) * refactor: use networkName instead of axelarChainName * fix: types * fix: onramp currency (#1096) * fix: stretched favicon (#1099) * [TASK-13971] fix: scientific notation in eip681 parsing (#1097) * fix: scientific notation in eip681 parsing * fix: qr handling tests * fix: peanut sdk mock * pull iban hotfix (#1100) * fix: claim flow bugs (#1102) * fix: cross chain claim * fix: full name issue on confirm bank claim view * fix: back navigation on desktop views * Fix back button not working on /profile (#1101) * Fix back button not working * fix public profile page * extract internal navigation logic to utility function * fix: send link claims to us bank accounts (#1108) * fix: usa bank account claims * fix: show bank account details in confirm claim view * Sync Landing page changes (#1111) * reduce clouds size and update font * fix: hero section responsiveness issue * fix: formatting errors * add currency animation * fix: us bank claims after kyc for logged in users (#1112) * fix: trim account form inputs for spaces (#1114) * [TASK-14107] fix: don't allow claiming on xChain if route is not found (#1115) * fix: don't allow claiming on xChain if route is not found * fix(claim): use correct decimals for min receive amount * feat: handle redirect uri when on unsupported browsers (#1117) * feat: handle redirect uri when on unsupported browsers * fix: confirm bank claim ui rows for iban guest claim * remove animation (#1118) * fix: formatting --------- Co-authored-by: Kushagra Sarathe <[email protected]> Co-authored-by: Mohd Zishan <[email protected]> Co-authored-by: Hugo Montenegro <[email protected]> * fix: bank claim flow runtime error (#1138) * hotfix: make iban non optional (#1139) * fix: bank claim flow runtime error * fix: dont have iban as optional * fix: merge conflicts * fix: merge external account with bank details (#1140) * fix: add id to external account (#1142) * added tg footer (#1144) * Hotfix : add missing countries - claim as guest flow (#1146) * fix: add missing countries * remove duplicate comment * fix: show error on dynamic bank account form (#1147) * fix: Invalid IBAN for UK (#1151) --------- Co-authored-by: Mohd Zishan <[email protected]> Co-authored-by: Juan José Ramírez <[email protected]> Co-authored-by: Hugo Montenegro <[email protected]> Co-authored-by: Hugo Montenegro <[email protected]> --------- Co-authored-by: Mohd Zishan <[email protected]> Co-authored-by: Hugo Montenegro <[email protected]> Co-authored-by: Juan José Ramírez <[email protected]> Co-authored-by: Juan José Ramírez <[email protected]> Co-authored-by: Hugo Montenegro <[email protected]>
Use viem fallback transport to handle RPC errors and fallback to other providers.