Skip to content

Commit d4541d5

Browse files
authored
Extend heightInfo for WalletConnect (#2894)
* extend heightData * name change
1 parent 73ed655 commit d4541d5

8 files changed

Lines changed: 17 additions & 8 deletions

File tree

packages/api-react/src/services/wallet.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,6 @@ export const walletApi = apiWithTag.injectEndpoints({
553553
getTimestampForHeight: query(build, WalletService, 'getTimestampForHeight'),
554554

555555
getHeightInfo: query(build, WalletService, 'getHeightInfo', {
556-
transformResponse: (response) => response.height,
557556
onCacheEntryAdded: onCacheEntryAddedInvalidate(baseQuery, api, [
558557
{
559558
command: 'onSyncChanged',

packages/api/src/services/WalletService.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,11 @@ export default class Wallet extends Service {
211211
}
212212

213213
async getHeightInfo() {
214-
return this.command<{ height: number }>('get_height_info');
214+
return this.command<{
215+
height: number;
216+
isTransactionBlock: boolean | null;
217+
prevTransactionBlockHeight: number | null;
218+
}>('get_height_info');
215219
}
216220

217221
async getNetworkInfo() {

packages/core/src/screens/SelectKey/WalletStatusHeight.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import React from 'react';
44
import FormatLargeNumber from '../../components/FormatLargeNumber';
55

66
export default function WalletStatusHeight() {
7-
const { data: height, isLoading } = useGetHeightInfoQuery(
7+
const { data: heightData, isLoading } = useGetHeightInfoQuery(
88
{},
99
{
1010
pollingInterval: 10_000,
1111
},
1212
);
13+
const height = heightData?.height;
1314

1415
if (isLoading) {
1516
return null;

packages/gui/src/components/offers/OfferManager.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ function OfferList(props: OfferListProps) {
105105

106106
const isWalletSynced = useIsWalletSynced();
107107

108-
const { data: height, isLoading: isGetHeightInfoLoading } = useGetHeightInfoQuery(undefined, {
108+
const { data: heightData, isLoading: isGetHeightInfoLoading } = useGetHeightInfoQuery(undefined, {
109109
pollingInterval: 3000,
110110
});
111+
const height = heightData?.height;
111112
const { data: lastBlockTimeStampData, isLoading: isGetTimestampForHeightLoading } = useGetTimestampForHeightQuery(
112113
{ height: height || 0 },
113114
{ skip: !height },

packages/gui/src/components/offers2/CreateOfferBuilder.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ export default function CreateOfferBuilder(props: CreateOfferBuilderProps) {
7676

7777
const [suppressShareOnCreate] = useSuppressShareOnCreate();
7878

79-
const { data: height, isLoading: isGetHeightInfoLoading } = useGetHeightInfoQuery(undefined, {
79+
const { data: heightData, isLoading: isGetHeightInfoLoading } = useGetHeightInfoQuery(undefined, {
8080
pollingInterval: 3000,
8181
});
82+
const height = heightData?.height;
8283
const { data: lastBlockTimeStampData, isLoading: isGetTimestampForHeightLoading } = useGetTimestampForHeightQuery(
8384
{ height: height || 0 },
8485
{ skip: !height },

packages/gui/src/components/offers2/OfferBuilderViewer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,10 @@ function OfferBuilderViewer(props: OfferBuilderViewerProps, ref: any) {
114114
let expirationTime = null;
115115
let isExpired = false;
116116

117-
const { data: height, isLoading: isGetHeightInfoLoading } = useGetHeightInfoQuery(undefined, {
117+
const { data: heightData, isLoading: isGetHeightInfoLoading } = useGetHeightInfoQuery(undefined, {
118118
pollingInterval: 3000,
119119
});
120+
const height = heightData?.height;
120121
const { data: lastBlockTimeStampData, isLoading: isGetTimestampForHeightLoading } = useGetTimestampForHeightQuery(
121122
{ height: height || 0 },
122123
{ skip: !height },

packages/wallets/src/components/WalletHistoryClawbackChip.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ export default function WalletHistoryClawbackChip(props: Props) {
1919
const { data: autoClaimData, isLoading: isGetAutoClaimLoading } = useGetAutoClaimQuery();
2020
const isAutoClaimEnabled = !isGetAutoClaimLoading && autoClaimData?.enabled;
2121

22-
const { data: height, isLoading: isGetHeightInfoLoading } = useGetHeightInfoQuery(undefined, {
22+
const { data: heightData, isLoading: isGetHeightInfoLoading } = useGetHeightInfoQuery(undefined, {
2323
pollingInterval: 3000,
2424
});
25+
const height = heightData?.height;
2526

2627
const { data: lastBlockTimeStampData, isLoading: isGetTimestampForHeightLoading } = useGetTimestampForHeightQuery({
2728
height: height || 0,

packages/wallets/src/components/WalletStatusHeight.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import { FormatLargeNumber } from '@chia-network/core';
33
import React from 'react';
44

55
export default function WalletStatusHeight() {
6-
const { data: height, isLoading } = useGetHeightInfoQuery(
6+
const { data: heightData, isLoading } = useGetHeightInfoQuery(
77
{},
88
{
99
pollingInterval: 10_000,
1010
},
1111
);
12+
const height = heightData?.height;
1213

1314
if (isLoading) {
1415
return null;

0 commit comments

Comments
 (0)