Skip to content

Commit e66e0d6

Browse files
enesozturkclaude
andcommitted
feat(controllers): add includePayOnly and sort options to fetchWallets
Surface wallets that support WalletConnect Pay but are not v2-compatible (filtered out by default) and allow sorting WCP-supporting wallets to the top, via two new useAppKitWallets().fetchWallets() options: - includePayOnly -> include_pay_only=true query param - sort: 'wcpay' -> sort=wcpay query param Both flow through fetchWalletsByPage and searchWallet into the /getWallets request. Default behavior is unchanged when the options are omitted, so general AppKit consumers keep hiding WCP-only wallets. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 7726bcd commit e66e0d6

4 files changed

Lines changed: 35 additions & 5 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@reown/appkit-controllers': minor
3+
---
4+
5+
Add `includePayOnly` and `sort` options to `useAppKitWallets().fetchWallets()`. `includePayOnly` surfaces wallets that support WalletConnect Pay but are not v2-compatible (filtered out by default), and `sort: 'wcpay'` bubbles WalletConnect Pay-supporting wallets to the top.

packages/controllers/exports/react.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,13 @@ export interface FetchWalletsOptions {
325325
include?: string[]
326326
/** Wallet IDs to exclude. Overrides the default exclude list when provided. */
327327
exclude?: string[]
328+
/**
329+
* Include wallets that support WalletConnect Pay but are not v2-compatible.
330+
* By default these are filtered out. Enable for WalletConnect Pay surfaces.
331+
*/
332+
includePayOnly?: boolean
333+
/** Sort mode. 'wcpay' bubbles WalletConnect Pay-supporting wallets to the top. */
334+
sort?: 'default' | 'wcpay'
328335
}
329336

330337
export interface UseAppKitWalletsReturn {

packages/controllers/src/controllers/ApiController.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ export const ApiController = {
281281
page: String(params.page),
282282
entries: String(params.entries),
283283
include: params.include?.join(',') || undefined,
284-
exclude: exclude.join(',') || undefined
284+
exclude: exclude.join(',') || undefined,
285+
include_pay_only: params.include_pay_only ? 'true' : undefined
285286
}
286287
})
287288

@@ -391,12 +392,15 @@ export const ApiController = {
391392
entries: entriesOverride,
392393
badge,
393394
include: includeOverride,
394-
exclude: excludeOverride
395-
}: Pick<ApiGetWalletsRequest, 'page'> & {
395+
exclude: excludeOverride,
396+
includePayOnly,
397+
sort
398+
}: Pick<ApiGetWalletsRequest, 'page' | 'sort'> & {
396399
entries?: number
397400
badge?: BadgeType
398401
include?: string[]
399402
exclude?: string[]
403+
includePayOnly?: boolean
400404
}) {
401405
const { includeWalletIds, excludeWalletIds, featuredWalletIds } = OptionsController.state
402406
const chains = ChainController.getRequestedCaipNetworkIds().join(',')
@@ -411,6 +415,8 @@ export const ApiController = {
411415
include: includeOverride ?? includeWalletIds,
412416
exclude: excludeOverride ?? defaultExclude,
413417
badge_type: badge,
418+
include_pay_only: includePayOnly,
419+
sort,
414420
chains
415421
}
416422
const { data, count, mobileFilteredOutWalletsLength } = await ApiController.fetchWallets(params)
@@ -454,12 +460,15 @@ export const ApiController = {
454460
entries: entriesOverride,
455461
page: pageOverride,
456462
include: includeOverride,
457-
exclude: excludeOverride
458-
}: Pick<ApiGetWalletsRequest, 'search' | 'badge'> & {
463+
exclude: excludeOverride,
464+
includePayOnly,
465+
sort
466+
}: Pick<ApiGetWalletsRequest, 'search' | 'badge' | 'sort'> & {
459467
entries?: number
460468
page?: number
461469
include?: string[]
462470
exclude?: string[]
471+
includePayOnly?: boolean
463472
}) {
464473
const { includeWalletIds, excludeWalletIds } = OptionsController.state
465474
const chains = ChainController.getRequestedCaipNetworkIds().join(',')
@@ -472,6 +481,8 @@ export const ApiController = {
472481
badge_type: badge,
473482
include: includeOverride ?? includeWalletIds,
474483
exclude: excludeOverride ?? excludeWalletIds,
484+
include_pay_only: includePayOnly,
485+
sort,
475486
chains
476487
}
477488

packages/controllers/src/utils/TypeUtil.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,13 @@ export interface ApiGetWalletsRequest {
192192
exclude?: string[]
193193
names?: string
194194
rdns?: string
195+
/**
196+
* Include wallets that support WalletConnect Pay but are not v2-compatible.
197+
* By default the API returns only v2-compatible wallets, which filters these out.
198+
*/
199+
include_pay_only?: boolean
200+
/** Sort mode. 'wcpay' bubbles WalletConnect Pay-supporting wallets to the top. */
201+
sort?: 'default' | 'wcpay'
195202
}
196203

197204
export interface ApiGetWalletsResponse {

0 commit comments

Comments
 (0)