From ef47fac7fc2259cf3121f9ecdb7b336aeb323127 Mon Sep 17 00:00:00 2001 From: cryptooda Date: Thu, 1 Jan 2026 22:13:23 +0700 Subject: [PATCH] Fix web3proxy --- src/Managing.Web3Proxy/src/plugins/custom/privy.ts | 5 ++++- .../test/plugins/getWalletBalances.test.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Managing.Web3Proxy/src/plugins/custom/privy.ts b/src/Managing.Web3Proxy/src/plugins/custom/privy.ts index 238b8781..236fee1e 100644 --- a/src/Managing.Web3Proxy/src/plugins/custom/privy.ts +++ b/src/Managing.Web3Proxy/src/plugins/custom/privy.ts @@ -1106,11 +1106,14 @@ export const getWalletBalanceImpl = async ( throw new Error(`User not found for wallet address: ${address}`); } + console.log('User:', user); + // Find the embedded wallet for this address const embeddedWallet = user.linked_accounts.find( (account: any) => account.type === 'wallet' && - account.chainType === 'ethereum' && + (account.chain_type === 'ethereum' || account.chainType === 'ethereum') && + (account.connector_type === 'embedded' || account.wallet_client_type === 'privy') && account.address?.toLowerCase() === address.toLowerCase() ); diff --git a/src/Managing.Web3Proxy/test/plugins/getWalletBalances.test.ts b/src/Managing.Web3Proxy/test/plugins/getWalletBalances.test.ts index 078c4479..47e1a1e8 100644 --- a/src/Managing.Web3Proxy/test/plugins/getWalletBalances.test.ts +++ b/src/Managing.Web3Proxy/test/plugins/getWalletBalances.test.ts @@ -6,7 +6,7 @@ import {Ticker} from '../../src/generated/ManagingApiTypes.js' test('getWalletBalanceImpl should fetch wallet balance for valid address', async () => { const testWalletId = 'cm7vxs99f0007blcl8cmzv74t' // Note: Replace with actual wallet address associated with the wallet ID from Privy dashboard - const testAddress = '0x932167388dD9aad41149b3cA23eBD489E2E2DD78' + const testAddress = '0x75335492b9C96CFb48207643451c40bAb9422974' const assets = [Ticker.USDC, Ticker.ETH] // Required: array of assets using Ticker enum const chains = ['arbitrum', 'ethereum'] // Required: array of chains