Skip to content

Commit 5cc4f8a

Browse files
committed
fix: update @0xsequence/api dependency to use workspace reference; enhance type declaration in useTokenBalances function
1 parent 7d0332e commit 5cc4f8a

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

packages/wallet/anypay-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"author": "",
3030
"license": "Apache-2.0",
3131
"dependencies": {
32-
"@0xsequence/api": "0.0.0-anypay-20250527101311",
32+
"@0xsequence/api": "workspace:*",
3333
"@0xsequence/design-system": "^2.1.6",
3434
"@0xsequence/hooks": "^5.1.0",
3535
"@0xsequence/indexer": "^2.3.9",

packages/wallet/anypay-sdk/src/tokenBalances.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function useTokenBalances(address: Address.Address): {
3939
error: balanceError,
4040
} = useQuery<GetTokenBalancesSummaryReturn>({
4141
queryKey: ['tokenBalances', address],
42-
queryFn: async () => {
42+
queryFn: async (): Promise<GetTokenBalancesSummaryReturn> => {
4343
if (!address) {
4444
console.warn('No account address or indexer client')
4545
return {
@@ -49,7 +49,7 @@ export function useTokenBalances(address: Address.Address): {
4949
} as GetTokenBalancesSummaryReturn
5050
}
5151
try {
52-
const summary = await indexerClient.getTokenBalancesSummary({
52+
const summaryFromGateway = await indexerClient.getTokenBalancesSummary({
5353
filter: {
5454
accountAddresses: [address],
5555
contractStatus: ContractVerificationStatus.VERIFIED,
@@ -58,7 +58,12 @@ export function useTokenBalances(address: Address.Address): {
5858
},
5959
})
6060

61-
return summary
61+
// Transform the raw gateway response to match GetTokenBalancesSummaryReturn
62+
return {
63+
page: summaryFromGateway.page,
64+
balances: summaryFromGateway.balances.flatMap((b: any) => b.results),
65+
nativeBalances: summaryFromGateway.nativeBalances.flatMap((b: any) => b.results),
66+
}
6267
} catch (error) {
6368
console.error('Failed to fetch token balances:', error)
6469
return {

pnpm-lock.yaml

Lines changed: 21 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)