From df4de10e7d62aeac81f25ff297e6f00d15342c0a Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Tue, 23 Jul 2024 23:16:16 -0700 Subject: [PATCH] fix bug --- helpers/servicePipes.js | 6 +++--- helpers/walletPipes.ts | 4 ++-- pages/api/[network]/_common.ts | 2 ++ pages/api/[network]/wallets.ts | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/helpers/servicePipes.js b/helpers/servicePipes.js index 4fae5d8c..794aaa8e 100644 --- a/helpers/servicePipes.js +++ b/helpers/servicePipes.js @@ -61,7 +61,7 @@ export const getServicePipes = ({ // TODO: Make sure that extensions use the provider { supportedVersion: '0.0.0', - pipe: + makePipe: ({ wallets }) => services => pipe( @@ -90,9 +90,9 @@ export const getServicePipes = ({ }, { supportedVersion: '1.3.0-alpha.3', - pipe: + makePipe: ({ wallets }) => - ({ services }) => + services => pipe( filterSupportedStrategies(supportedStrategies), // Remove opt in services unless marked as include, if supported diff --git a/helpers/walletPipes.ts b/helpers/walletPipes.ts index 90cb9384..3cd4fdba 100644 --- a/helpers/walletPipes.ts +++ b/helpers/walletPipes.ts @@ -26,10 +26,10 @@ export const getWalletPipe = ({ ) export const transformWalletServices = - (factory: ServicesPipeFactory) => (wallets: Wallet[]) => + (servicePipeFactory: ServicesPipeFactory) => (wallets: Wallet[]) => pipe( extractWalletServices(true), - (services: ServiceWithWallet[]) => factory({ wallets })(services), + servicePipeFactory({ wallets }), collectWalletsFromServices(wallets) )(wallets) diff --git a/pages/api/[network]/_common.ts b/pages/api/[network]/_common.ts index 494c8d6d..b8a0c621 100644 --- a/pages/api/[network]/_common.ts +++ b/pages/api/[network]/_common.ts @@ -58,6 +58,8 @@ export async function getWalletsFromRequest(req: NextApiRequest) { // Support emulator and use local service configuration const netConfig = network === NETWORKS.EMULATOR ? NETWORKS.LOCAL : network + console.log(versionPipeFactory) + // Get the pipe for processing wallets const walletPipe = getWalletPipe({ network: netConfig, diff --git a/pages/api/[network]/wallets.ts b/pages/api/[network]/wallets.ts index aacce998..ba620610 100644 --- a/pages/api/[network]/wallets.ts +++ b/pages/api/[network]/wallets.ts @@ -4,7 +4,7 @@ import { cors, getWalletsFromRequest, runMiddleware } from './_common' async function handler(req, res) { await runMiddleware(req, res, cors) - const discoveryWallets = getWalletsFromRequest(req) + const discoveryWallets = await getWalletsFromRequest(req) return res.status(200).json(discoveryWallets) }