From 9267102e1d1c723680f97f855ee22a6e3de81893 Mon Sep 17 00:00:00 2001 From: Kevin Prigel Date: Fri, 27 Sep 2024 09:56:38 -0500 Subject: [PATCH 1/3] no message --- packages/core/src/controllers/ApiController.ts | 4 ++-- packages/core/src/controllers/OptionsController.ts | 10 ++++++++++ packages/core/src/utils/ConstantsUtil.ts | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/core/src/controllers/ApiController.ts b/packages/core/src/controllers/ApiController.ts index d57e69f432..6cfaa0a997 100644 --- a/packages/core/src/controllers/ApiController.ts +++ b/packages/core/src/controllers/ApiController.ts @@ -182,7 +182,7 @@ export const ApiController = { }, async fetchWallets({ page }: Pick) { - const { includeWalletIds, excludeWalletIds, featuredWalletIds } = OptionsController.state + const { includeWalletIds, excludeWalletIds, featuredWalletIds, allEthWallets } = OptionsController.state const exclude = [ ...state.recommended.map(({ id }) => id), @@ -195,7 +195,7 @@ export const ApiController = { params: { page: String(page), entries, - chains: ChainController.state.activeCaipNetwork?.id, + chains: ChainController.state.activeCaipNetwork?.id.includes("eip155") && allEthWallets ? "eip155:1" : ChainController.state.activeCaipNetwork?.id, include: includeWalletIds?.join(','), exclude: exclude.join(',') } diff --git a/packages/core/src/controllers/OptionsController.ts b/packages/core/src/controllers/OptionsController.ts index 0f81ca54e7..4596c5a64f 100644 --- a/packages/core/src/controllers/OptionsController.ts +++ b/packages/core/src/controllers/OptionsController.ts @@ -12,6 +12,12 @@ import { ConstantsUtil } from '../utils/ConstantsUtil.js' // -- Types --------------------------------------------- // export interface OptionsControllerStatePublic { + /** + * A boolean that forces the loading of all Ethereum wallets from the API. + * Forces the chain ID to 1. + * @default false + */ + allEthWallets?: boolean /** * A boolean that allows you to add or remove the "All Wallets" button on the modal * @default 'SHOW' @@ -161,6 +167,10 @@ export const OptionsController = { state.allWallets = allWallets }, + setAllEthWallets(allEthWallets: OptionsControllerState['allEthWallets']) { + state.allEthWallets = allEthWallets + }, + setIncludeWalletIds(includeWalletIds: OptionsControllerState['includeWalletIds']) { state.includeWalletIds = includeWalletIds }, diff --git a/packages/core/src/utils/ConstantsUtil.ts b/packages/core/src/utils/ConstantsUtil.ts index eebbf87fd4..5e51caf451 100644 --- a/packages/core/src/utils/ConstantsUtil.ts +++ b/packages/core/src/utils/ConstantsUtil.ts @@ -211,6 +211,7 @@ export const ConstantsUtil = { socials: ['google', 'x', 'discord', 'farcaster', 'github', 'apple', 'facebook'], history: true, analytics: true, - allWallets: true + allWallets: true, + allEthWallets: false } as Features } From 92653fef47b518ee07e921006c54ae8e33524129 Mon Sep 17 00:00:00 2001 From: Kevin Prigel Date: Fri, 27 Sep 2024 12:45:51 -0500 Subject: [PATCH 2/3] no message --- packages/appkit/src/client.ts | 1 + packages/core/src/controllers/ApiController.ts | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/appkit/src/client.ts b/packages/appkit/src/client.ts index b5f77d2135..70e6682574 100644 --- a/packages/appkit/src/client.ts +++ b/packages/appkit/src/client.ts @@ -428,6 +428,7 @@ export class AppKit { this.setDefaultNetwork(options) OptionsController.setAllWallets(options.allWallets) + OptionsController.setAllEthWallets(options.allEthWallets) OptionsController.setIncludeWalletIds(options.includeWalletIds) OptionsController.setExcludeWalletIds(options.excludeWalletIds) if (options.excludeWalletIds) { diff --git a/packages/core/src/controllers/ApiController.ts b/packages/core/src/controllers/ApiController.ts index 6cfaa0a997..b8cb0631f1 100644 --- a/packages/core/src/controllers/ApiController.ts +++ b/packages/core/src/controllers/ApiController.ts @@ -153,14 +153,14 @@ export const ApiController = { async fetchRecommendedWallets() { try { - const { includeWalletIds, excludeWalletIds, featuredWalletIds } = OptionsController.state + const { includeWalletIds, excludeWalletIds, featuredWalletIds, allEthWallets } = OptionsController.state const exclude = [...(excludeWalletIds ?? []), ...(featuredWalletIds ?? [])].filter(Boolean) const { data, count } = await api.get({ path: '/getWallets', headers: ApiController._getApiHeaders(), params: { page: '1', - chains: ChainController.state.activeCaipNetwork?.id, + chains: ChainController.state.activeCaipNetwork?.id.includes("eip155") && allEthWallets ? "eip155:1" : ChainController.state.activeCaipNetwork?.id, entries: recommendedEntries, include: includeWalletIds?.join(','), exclude: exclude?.join(',') @@ -221,7 +221,6 @@ export const ApiController = { params: { page: '1', entries: String(ids.length), - chains: ChainController.state.activeCaipNetwork?.id, include: ids?.join(',') } }) @@ -236,7 +235,7 @@ export const ApiController = { }, async searchWallet({ search }: Pick) { - const { includeWalletIds, excludeWalletIds } = OptionsController.state + const { includeWalletIds, excludeWalletIds, allEthWallets } = OptionsController.state state.search = [] const { data } = await api.get({ path: '/getWallets', @@ -245,7 +244,7 @@ export const ApiController = { page: '1', entries: '100', search: search?.trim(), - chains: ChainController.state.activeCaipNetwork?.id, + chains: ChainController.state.activeCaipNetwork?.id.includes("eip155") && allEthWallets ? "eip155:1" : ChainController.state.activeCaipNetwork?.id, include: includeWalletIds?.join(','), exclude: excludeWalletIds?.join(',') } From 798bd8174329a90b6e9b83bbb21e1fbad78907ae Mon Sep 17 00:00:00 2001 From: Kevin Prigel Date: Fri, 27 Sep 2024 13:38:29 -0500 Subject: [PATCH 3/3] no message --- .../core/src/controllers/ApiController.ts | 21 ++++++++++++++----- .../core/src/controllers/OptionsController.ts | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/packages/core/src/controllers/ApiController.ts b/packages/core/src/controllers/ApiController.ts index b8cb0631f1..0c4bf51a22 100644 --- a/packages/core/src/controllers/ApiController.ts +++ b/packages/core/src/controllers/ApiController.ts @@ -153,14 +153,18 @@ export const ApiController = { async fetchRecommendedWallets() { try { - const { includeWalletIds, excludeWalletIds, featuredWalletIds, allEthWallets } = OptionsController.state + const { includeWalletIds, excludeWalletIds, featuredWalletIds, allEthWallets } = + OptionsController.state const exclude = [...(excludeWalletIds ?? []), ...(featuredWalletIds ?? [])].filter(Boolean) const { data, count } = await api.get({ path: '/getWallets', headers: ApiController._getApiHeaders(), params: { page: '1', - chains: ChainController.state.activeCaipNetwork?.id.includes("eip155") && allEthWallets ? "eip155:1" : ChainController.state.activeCaipNetwork?.id, + chains: + ChainController.state.activeCaipNetwork?.id.includes('eip155') && allEthWallets + ? 'eip155:1' + : ChainController.state.activeCaipNetwork?.id, entries: recommendedEntries, include: includeWalletIds?.join(','), exclude: exclude?.join(',') @@ -182,7 +186,8 @@ export const ApiController = { }, async fetchWallets({ page }: Pick) { - const { includeWalletIds, excludeWalletIds, featuredWalletIds, allEthWallets } = OptionsController.state + const { includeWalletIds, excludeWalletIds, featuredWalletIds, allEthWallets } = + OptionsController.state const exclude = [ ...state.recommended.map(({ id }) => id), @@ -195,7 +200,10 @@ export const ApiController = { params: { page: String(page), entries, - chains: ChainController.state.activeCaipNetwork?.id.includes("eip155") && allEthWallets ? "eip155:1" : ChainController.state.activeCaipNetwork?.id, + chains: + ChainController.state.activeCaipNetwork?.id.includes('eip155') && allEthWallets + ? 'eip155:1' + : ChainController.state.activeCaipNetwork?.id, include: includeWalletIds?.join(','), exclude: exclude.join(',') } @@ -244,7 +252,10 @@ export const ApiController = { page: '1', entries: '100', search: search?.trim(), - chains: ChainController.state.activeCaipNetwork?.id.includes("eip155") && allEthWallets ? "eip155:1" : ChainController.state.activeCaipNetwork?.id, + chains: + ChainController.state.activeCaipNetwork?.id.includes('eip155') && allEthWallets + ? 'eip155:1' + : ChainController.state.activeCaipNetwork?.id, include: includeWalletIds?.join(','), exclude: excludeWalletIds?.join(',') } diff --git a/packages/core/src/controllers/OptionsController.ts b/packages/core/src/controllers/OptionsController.ts index 4596c5a64f..320327ed19 100644 --- a/packages/core/src/controllers/OptionsController.ts +++ b/packages/core/src/controllers/OptionsController.ts @@ -13,7 +13,7 @@ import { ConstantsUtil } from '../utils/ConstantsUtil.js' // -- Types --------------------------------------------- // export interface OptionsControllerStatePublic { /** - * A boolean that forces the loading of all Ethereum wallets from the API. + * A boolean that forces the loading of all Ethereum wallets from the API. * Forces the chain ID to 1. * @default false */