From 887f0f38373856044165bf976cdbba06eb540dd4 Mon Sep 17 00:00:00 2001 From: fwaszkiewicz Date: Wed, 1 Oct 2025 13:30:11 +0200 Subject: [PATCH 01/12] Replace condenser_api DPGO with database_api DGPO --- apps/blog/playwright/tests/support/apiHelper.ts | 4 ++-- apps/wallet/lib/utils.ts | 16 +++++++--------- apps/wallet/pages/[param]/delegations.tsx | 4 ++-- .../playwright/tests/e2e/witnesses.spec.ts | 9 +++------ .../wallet/playwright/tests/support/apiHelper.ts | 4 ++-- packages/transaction/lib/extended-hive.chain.ts | 6 +++--- packages/transaction/lib/hive.ts | 2 +- packages/ui/lib/utils.ts | 4 ++-- 8 files changed, 22 insertions(+), 27 deletions(-) diff --git a/apps/blog/playwright/tests/support/apiHelper.ts b/apps/blog/playwright/tests/support/apiHelper.ts index 7e868f302..d0c99d238 100644 --- a/apps/blog/playwright/tests/support/apiHelper.ts +++ b/apps/blog/playwright/tests/support/apiHelper.ts @@ -130,8 +130,8 @@ export class ApiHelper { data: { id: 0, jsonrpc: '2.0', - method: 'condenser_api.get_dynamic_global_properties', - params: [] + method: 'database_api.get_dynamic_global_properties', + params: {} }, headers: { Accept: 'application/json, text/plain, */*' diff --git a/apps/wallet/lib/utils.ts b/apps/wallet/lib/utils.ts index 96cb9e13e..b687209f7 100644 --- a/apps/wallet/lib/utils.ts +++ b/apps/wallet/lib/utils.ts @@ -252,16 +252,14 @@ export function createListWithSuggestions( export const prepareRC = (rc: string): string => { return `${numberWithCommas(convertStringToBig(rc).div(1000000000).toFixed(1))}bil`; }; -export function convertToFormattedHivePower(vests: NaiAsset | undefined, totalVestingFund: string | undefined, totalVestingShares: string | undefined, hiveChain: HiveChain): string { + +export function convertToFormattedHivePower(vests: NaiAsset | undefined, totalVestingFund: NaiAsset | undefined, totalVestingShares: NaiAsset | undefined, hiveChain: HiveChain): string { let operationHp = hiveChain?.hiveSatoshis(0); - if (vests) { - // TODO: Replace with better NAI conversion - // operationHp = hiveChain?.vestsToHp(vests, totalVestingFund!, totalVestingShares!); - const totalVestingFundNai = hiveChain!.hiveCoins(Number((totalVestingFund || "0").replace(" HIVE", ""))); - const totalVestingSharesNai = hiveChain!.vestsCoins(Number((totalVestingShares || "0").replace(" VESTS", ""))); - operationHp = hiveChain?.vestsToHp(vests, totalVestingFundNai, totalVestingSharesNai); - } - return hiveChain.formatter.format(operationHp).replace("HIVE", "HIVE POWER"); + + if (vests) + operationHp = hiveChain?.vestsToHp(vests, totalVestingFund!, totalVestingShares!); + + return operationHp.amount; } export function filterSmallerThanOne(asset?: NaiAsset) { diff --git a/apps/wallet/pages/[param]/delegations.tsx b/apps/wallet/pages/[param]/delegations.tsx index 16c9135e7..d7dcf7cd6 100644 --- a/apps/wallet/pages/[param]/delegations.tsx +++ b/apps/wallet/pages/[param]/delegations.tsx @@ -16,8 +16,8 @@ import { IDynamicGlobalProperties } from '@transaction/lib/extended-hive.chain'; import RCTable from '@/wallet/feature/delegations/rc-table'; const convertVestsToSteem = (vests: number, dynamicData: IDynamicGlobalProperties) => { - const totalFund = parseFloat(dynamicData.total_vesting_fund_hive); - const totalShares = parseFloat(dynamicData.total_vesting_shares); + const totalFund = parseFloat(dynamicData.total_vesting_fund_hive.amount); + const totalShares = parseFloat(dynamicData.total_vesting_shares.amount); return ((vests * totalFund) / totalShares).toFixed(2); }; diff --git a/apps/wallet/playwright/tests/e2e/witnesses.spec.ts b/apps/wallet/playwright/tests/e2e/witnesses.spec.ts index 44a491edb..db8ac4f46 100644 --- a/apps/wallet/playwright/tests/e2e/witnesses.spec.ts +++ b/apps/wallet/playwright/tests/e2e/witnesses.spec.ts @@ -157,13 +157,10 @@ test.describe('Witnesses page tests', () => { // Validate Witness votes received const resDynamicGlobalProperties = await apiHelper.getDynamicGlobalPropertiesAPI(); - const totalVesting = await resDynamicGlobalProperties.result.total_vesting_fund_hive.replace( - / HIVE/g, - '' - ); - const totalShares = await resDynamicGlobalProperties.result.total_vesting_shares.replace(/ VESTS/g, ''); + const totalVesting = await resDynamicGlobalProperties.result.total_vesting_fund_hive.amount; + const totalShares = await resDynamicGlobalProperties.result.total_vesting_shares.amount; const witnessVotesAPI = await resWitnessesByVoteAPI.result[0].votes; - const vestsToHp: Big = Big(Big(totalVesting).times(Big(witnessVotesAPI).div(Big(totalShares)))).div( + const vestsToHp: Big = Big(totalVesting).times(Big(witnessVotesAPI).div(totalShares)).div( 1000000 ); expect(await witnessesPage.witnessVotesReceived.first().textContent()).toBe( diff --git a/apps/wallet/playwright/tests/support/apiHelper.ts b/apps/wallet/playwright/tests/support/apiHelper.ts index 130362f4e..1a453433f 100644 --- a/apps/wallet/playwright/tests/support/apiHelper.ts +++ b/apps/wallet/playwright/tests/support/apiHelper.ts @@ -136,8 +136,8 @@ export class ApiHelper { data: { id: 0, jsonrpc: "2.0", - method: "condenser_api.get_dynamic_global_properties", - params: [], + method: "database_api.get_dynamic_global_properties", + params: {}, }, headers: { Accept: "application/json, text/plain, */*", diff --git a/packages/transaction/lib/extended-hive.chain.ts b/packages/transaction/lib/extended-hive.chain.ts index 130449987..84b38cf8a 100644 --- a/packages/transaction/lib/extended-hive.chain.ts +++ b/packages/transaction/lib/extended-hive.chain.ts @@ -596,13 +596,13 @@ export interface IProposalVote { export interface IDynamicGlobalProperties { hbd_print_rate: number; - total_vesting_fund_hive: string; - total_vesting_shares: string; + total_vesting_fund_hive: NaiAsset; + total_vesting_shares: NaiAsset; hbd_interest_rate: number; head_block_number: number; head_block_id: string; vesting_reward_percent: number; - virtual_supply: string; + virtual_supply: NaiAsset; } export interface IAccountReputations { diff --git a/packages/transaction/lib/hive.ts b/packages/transaction/lib/hive.ts index 7fd1b472e..5b05127cf 100644 --- a/packages/transaction/lib/hive.ts +++ b/packages/transaction/lib/hive.ts @@ -20,7 +20,7 @@ const logger = getLogger('app'); const chain = await hiveChainService.getHiveChain(); export const getDynamicGlobalProperties = async (): Promise => { - return chain.api.condenser_api.get_dynamic_global_properties([]).then((r: any) => { + return chain.api.database_api.get_dynamic_global_properties({}).then((r: any) => { return { total_vesting_fund_hive: r.total_vesting_fund_hive || r.total_vesting_fund_steem, total_vesting_shares: r.total_vesting_shares, diff --git a/packages/ui/lib/utils.ts b/packages/ui/lib/utils.ts index 42cddc200..10ac7473e 100644 --- a/packages/ui/lib/utils.ts +++ b/packages/ui/lib/utils.ts @@ -102,8 +102,8 @@ export const numberWithCommas = (x: string) => x.replace(/\B(?=(\d{3})+(?!\d))/g export function convertToHP( vests: Big, - totalVestingShares: string, - totalVestingFundHive: string, + totalVestingShares: NaiAsset, + totalVestingFundHive: NaiAsset, div: number = 1 ) { const total_vests = convertStringToBig(totalVestingShares); -- GitLab From 2a8f4b654bf26ea8c484fc9b205576461a6e37be Mon Sep 17 00:00:00 2001 From: fwaszkiewicz Date: Thu, 2 Oct 2025 10:25:14 +0200 Subject: [PATCH 02/12] Replace condenser_api.get_witnesses_by_vote with database_api.list_witnesses --- .../tests/e2e/witnessesPage.spec.ts | 2 +- .../playwright/tests/support/apiHelper.ts | 4 +-- .../wallet/components/witnesses-list-item.tsx | 2 +- apps/wallet/lib/hive.ts | 2 +- .../playwright/tests/e2e/witnesses.spec.ts | 19 +++++------- .../playwright/tests/support/apiHelper.ts | 4 +-- .../transaction/lib/extended-hive.chain.ts | 29 +++++++++++++------ 7 files changed, 35 insertions(+), 27 deletions(-) diff --git a/apps/blog/playwright/tests/e2e/witnessesPage.spec.ts b/apps/blog/playwright/tests/e2e/witnessesPage.spec.ts index 59eee8080..b2ee31753 100644 --- a/apps/blog/playwright/tests/e2e/witnessesPage.spec.ts +++ b/apps/blog/playwright/tests/e2e/witnessesPage.spec.ts @@ -70,7 +70,7 @@ test.describe.skip('Witnesses page tests', () => { await homePage.moveToNavWitnessesPage(); // First witness's info from API - const firstWitnessInfoAPI = (await apiHelper.getListWitnessesByVoteAPI('', 5)).result[0]; // blocktrades expected + const firstWitnessInfoAPI = (await apiHelper.getListWitnessesByVoteAPI('', 5)).result.witnesses[0]; // blocktrades expected const nameFirstWitnessAPI = await firstWitnessInfoAPI.owner; const lastConfirmedBlockNumberOfFirstWitnessAPI = await firstWitnessInfoAPI.last_confirmed_block_num; const runningVersionOfFirstWitnessAPI = await firstWitnessInfoAPI.running_version; diff --git a/apps/blog/playwright/tests/support/apiHelper.ts b/apps/blog/playwright/tests/support/apiHelper.ts index d0c99d238..81c8061e0 100644 --- a/apps/blog/playwright/tests/support/apiHelper.ts +++ b/apps/blog/playwright/tests/support/apiHelper.ts @@ -111,8 +111,8 @@ export class ApiHelper { data: { id: 0, jsonrpc: '2.0', - method: 'condenser_api.get_witnesses_by_vote', - params: [`${startName}`, `${limit}`] + method: 'database_api.list_witnesses', + params: { start: [0, startName], limit, order: 'by_vote_name' } }, headers: { Accept: 'application/json, text/plain, */*' diff --git a/apps/wallet/components/witnesses-list-item.tsx b/apps/wallet/components/witnesses-list-item.tsx index 76cf12e02..d885f6d1d 100644 --- a/apps/wallet/components/witnesses-list-item.tsx +++ b/apps/wallet/components/witnesses-list-item.tsx @@ -271,7 +271,7 @@ function WitnessListItem({
- ${parseFloat(data.hbd_exchange_rate.base)} + ${parseFloat(data.hbd_exchange_rate.base.amount)}
diff --git a/apps/wallet/lib/hive.ts b/apps/wallet/lib/hive.ts index 1c02eef74..cca12a8e2 100644 --- a/apps/wallet/lib/hive.ts +++ b/apps/wallet/lib/hive.ts @@ -40,7 +40,7 @@ export type ProposalData = Omit & { }; export const getWitnessesByVote = async (from: string, limit: number): Promise => { - return chain.api.condenser_api.get_witnesses_by_vote([from, limit]); + return (await chain.api.database_api.list_witnesses({ start: [9223372036854775807n.toString(), from], limit, order: 'by_vote_name' })).witnesses; }; export const findRcAccounts = async (username: string): Promise<{ rc_accounts: RcAccount[] }> => { diff --git a/apps/wallet/playwright/tests/e2e/witnesses.spec.ts b/apps/wallet/playwright/tests/e2e/witnesses.spec.ts index db8ac4f46..7fa4c7e7a 100644 --- a/apps/wallet/playwright/tests/e2e/witnesses.spec.ts +++ b/apps/wallet/playwright/tests/e2e/witnesses.spec.ts @@ -54,14 +54,14 @@ test.describe('Witnesses page tests', () => { for (let i = 0; i < 250; i++) { if (i >= 0 && i < 101) { - witnessByVoteAPIArray.push(await resWitnessesByVote.result[i].owner); + witnessByVoteAPIArray.push(await resWitnessesByVote.result.witnesses[i].owner); } if (i >= 101 && i < 250) { witnessLastBlockAgeInSecs = - (headBlock - (await resWitnessesByVote.result[i].last_confirmed_block_num)) * 3; + (headBlock - (await resWitnessesByVote.result.witnesses[i].last_confirmed_block_num)) * 3; if (witnessLastBlockAgeInSecs < LAST_BLOCK_AGE_THRESHOLD_IN_SEC) { - witnessByVoteAPIArray.push(await resWitnessesByVote.result[i].owner); + witnessByVoteAPIArray.push(await resWitnessesByVote.result.witnesses[i].owner); } } } @@ -136,20 +136,20 @@ test.describe('Witnesses page tests', () => { await witnessesPage.goToWitnessesPage(); const resWitnessesByVoteAPI = await apiHelper.getListWitnessesByVoteAPI('', 250); - const lastConfirmedBlockNum = await resWitnessesByVoteAPI.result[0].last_confirmed_block_num.toString(); + const lastConfirmedBlockNum = await resWitnessesByVoteAPI.result.witnesses[0].last_confirmed_block_num.toString(); // Validate last confirmed block number expect(await witnessesPage.witnessLastBlockNumber.first()).toBeVisible(); // Below assertion is too unstable // expect(await witnessesPage.witnessLastBlockNumber.first().textContent()).toContain(await lastConfirmedBlockNum); - const witnessCreatedAPI = await resWitnessesByVoteAPI.result[0].created; + const witnessCreatedAPI = await resWitnessesByVoteAPI.result.witnesses[0].created; // Validate Witness's age expect(await witnessesPage.witnessCreated.first().textContent()).toContain( moment().from(witnessCreatedAPI, true) ); // Validate Witness external site - const firstWitnessUrl = await resWitnessesByVoteAPI.result[0].url; + const firstWitnessUrl = await resWitnessesByVoteAPI.result.witnesses[0].url; await expect(witnessesPage.witnessExternalSiteLink.locator('a').first()).toHaveAttribute( 'href', firstWitnessUrl @@ -159,7 +159,7 @@ test.describe('Witnesses page tests', () => { const resDynamicGlobalProperties = await apiHelper.getDynamicGlobalPropertiesAPI(); const totalVesting = await resDynamicGlobalProperties.result.total_vesting_fund_hive.amount; const totalShares = await resDynamicGlobalProperties.result.total_vesting_shares.amount; - const witnessVotesAPI = await resWitnessesByVoteAPI.result[0].votes; + const witnessVotesAPI = await resWitnessesByVoteAPI.result.witnesses[0].votes; const vestsToHp: Big = Big(totalVesting).times(Big(witnessVotesAPI).div(totalShares)).div( 1000000 ); @@ -168,10 +168,7 @@ test.describe('Witnesses page tests', () => { ); // Validate Witness price feed - const firstWitnessPriceFeed = await resWitnessesByVoteAPI.result[0].hbd_exchange_rate.base.replace( - / HBD/g, - '' - ); + const firstWitnessPriceFeed = await resWitnessesByVoteAPI.result.witnesses[0].hbd_exchange_rate.base.amount; expect('$' + firstWitnessPriceFeed).toContain(await witnessesPage.witnessPriceFeed.first().textContent()); }); diff --git a/apps/wallet/playwright/tests/support/apiHelper.ts b/apps/wallet/playwright/tests/support/apiHelper.ts index 1a453433f..446d10392 100644 --- a/apps/wallet/playwright/tests/support/apiHelper.ts +++ b/apps/wallet/playwright/tests/support/apiHelper.ts @@ -117,8 +117,8 @@ export class ApiHelper { data: { id: 0, jsonrpc: "2.0", - method: "condenser_api.get_witnesses_by_vote", - params: [`${startName}`, `${limit}`], + method: "database_api.list_witnesses", + params: { start: [9223372036854775807n.toString(), startName], limit, order: 'by_vote_name' }, }, headers: { Accept: "application/json, text/plain, */*", diff --git a/packages/transaction/lib/extended-hive.chain.ts b/packages/transaction/lib/extended-hive.chain.ts index 84b38cf8a..3f504c579 100644 --- a/packages/transaction/lib/extended-hive.chain.ts +++ b/packages/transaction/lib/extended-hive.chain.ts @@ -177,22 +177,32 @@ export interface IWitness { id: number; total_missed: number; url: string; + votes: number; + virtual_last_update: string; + virtual_position: string; + virtual_scheduled_time: string; + last_aslot: number; + last_confirmed_block_num: number; + pow_worker: number; + signing_key: string; props: { - account_creation_fee: string; - account_subsidy_budget: number; + account_creation_fee: NaiAsset; maximum_block_size: number; + hbd_interest_rate: number; + account_subsidy_budget: number; + account_subsidy_decay: number; }; hbd_exchange_rate: { - base: string; - quote: string; + base: NaiAsset; + quote: NaiAsset; }; - available_witness_account_subsidies: number; + last_hbd_exchange_update: string; + last_work: string; running_version: string; + hardfork_version_vote: string; + hardfork_time_vote: string; + available_witness_account_subsidies: number; owner: string; - signing_key: string; - last_hbd_exchange_update: string; - votes: number; - last_confirmed_block_num: number; } export interface IOrdersDataItem { @@ -946,6 +956,7 @@ export type ExtendedNodeApi = { }, { votes: IVoteListItem[] } >; + list_witnesses: TWaxApiRequest<{ start: string[]; limit: number; order: string }, { witnesses: IWitness[] }>; }; network_broadcast_api: { broadcast_transaction: TWaxApiRequest; -- GitLab From 834659262072fc2e65a43d126524f96239e7d395 Mon Sep 17 00:00:00 2001 From: fwaszkiewicz Date: Fri, 3 Oct 2025 08:16:18 +0200 Subject: [PATCH 03/12] Replace condenser_api.get_vesting_delegations with database_api.list_vesting_delegations --- apps/wallet/lib/hive.ts | 2 +- apps/wallet/lib/utils.ts | 9 +++++++++ apps/wallet/pages/[param]/delegations.tsx | 14 ++++++-------- apps/wallet/playwright/tests/e2e/wallet.spec.ts | 2 +- apps/wallet/playwright/tests/support/apiHelper.ts | 4 ++-- packages/transaction/lib/extended-hive.chain.ts | 3 ++- 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/apps/wallet/lib/hive.ts b/apps/wallet/lib/hive.ts index cca12a8e2..1ea21b322 100644 --- a/apps/wallet/lib/hive.ts +++ b/apps/wallet/lib/hive.ts @@ -83,7 +83,7 @@ export const getVestingDelegations = async ( from: string = '', limit: number = 50 ): Promise => { - return chain.api.condenser_api.get_vesting_delegations([username, from, limit]); + return (await chain.api.database_api.list_vesting_delegations({ start: [username, from], limit, order: 'by_delegation' })).delegations; }; const op = operationOrders; diff --git a/apps/wallet/lib/utils.ts b/apps/wallet/lib/utils.ts index b687209f7..80c03ef09 100644 --- a/apps/wallet/lib/utils.ts +++ b/apps/wallet/lib/utils.ts @@ -262,6 +262,15 @@ export function convertToFormattedHivePower(vests: NaiAsset | undefined, totalVe return operationHp.amount; } +export function convertVestsToHp(vestsAmount: string, totalVestingFund: NaiAsset | undefined, totalVestingShares: NaiAsset | undefined, hiveChain: HiveChain): string { + if (!totalVestingFund || !totalVestingShares) return "0.00"; + + const vests = hiveChain.vestsSatoshis(vestsAmount); + const operationHp = hiveChain.vestsToHp(vests, totalVestingFund, totalVestingShares); + + return operationHp.amount; +} + export function filterSmallerThanOne(asset?: NaiAsset) { if (!asset) return false; const {precision, amount} = asset; diff --git a/apps/wallet/pages/[param]/delegations.tsx b/apps/wallet/pages/[param]/delegations.tsx index d7dcf7cd6..dc0795912 100644 --- a/apps/wallet/pages/[param]/delegations.tsx +++ b/apps/wallet/pages/[param]/delegations.tsx @@ -14,12 +14,8 @@ import Head from 'next/head'; import TimeAgo from '@ui/components/time-ago'; import { IDynamicGlobalProperties } from '@transaction/lib/extended-hive.chain'; import RCTable from '@/wallet/feature/delegations/rc-table'; - -const convertVestsToSteem = (vests: number, dynamicData: IDynamicGlobalProperties) => { - const totalFund = parseFloat(dynamicData.total_vesting_fund_hive.amount); - const totalShares = parseFloat(dynamicData.total_vesting_shares.amount); - return ((vests * totalFund) / totalShares).toFixed(2); -}; +import { hiveChainService } from '@transaction/lib/hive-chain-service'; +import { convertVestsToHp } from '@/wallet/lib/utils'; function DelegationsPage({ username, metadata }: InferGetServerSidePropsType) { const { t } = useTranslation('common_wallet'); @@ -32,10 +28,12 @@ function DelegationsPage({ username, metadata }: InferGetServerSidePropsType; } - if (!vestingData || !dynamicData) { + if (!vestingData || !dynamicData || !hiveChain) { return

{t('global.something_went_wrong')}

; } return ( @@ -62,7 +60,7 @@ function DelegationsPage({ username, metadata }: InferGetServerSidePropsType {numberWithCommas( - convertVestsToSteem(parseFloat(element.vesting_shares), dynamicData) + convertVestsToHp(element.vesting_shares.amount, dynamicData.total_vesting_fund_hive, dynamicData.total_vesting_shares, hiveChain) )}{' '} HP diff --git a/apps/wallet/playwright/tests/e2e/wallet.spec.ts b/apps/wallet/playwright/tests/e2e/wallet.spec.ts index 4e03d3262..fdc438787 100644 --- a/apps/wallet/playwright/tests/e2e/wallet.spec.ts +++ b/apps/wallet/playwright/tests/e2e/wallet.spec.ts @@ -303,7 +303,7 @@ test.describe("Wallet page of @gtg tests", () => { await walletPage.page.waitForSelector(await walletPage.walletDelegationItem["_selector"]); const vestingDelegationAPI = await apiHelper.getVestingDelegationsAPI("blocktrades", "", 50); - const vestingDelegationAPILength = await vestingDelegationAPI.result.length; + const vestingDelegationAPILength = await vestingDelegationAPI.result.delegations.length; // console.log('vesting delegation api response ', await vestingDelegationAPI, await vestingDelegationAPILength); expect((await walletPage.walletDelegationItem.all()).length).toBe(vestingDelegationAPILength); diff --git a/apps/wallet/playwright/tests/support/apiHelper.ts b/apps/wallet/playwright/tests/support/apiHelper.ts index 446d10392..df2bf35bd 100644 --- a/apps/wallet/playwright/tests/support/apiHelper.ts +++ b/apps/wallet/playwright/tests/support/apiHelper.ts @@ -283,8 +283,8 @@ export class ApiHelper { data: { id: 0, jsonrpc: "2.0", - method: "condenser_api.get_vesting_delegations", - params: [account, start_account, limit], + method: "database_api.list_vesting_delegations", + params: { start: [account, start_account], limit, order: 'by_delegation' }, }, headers: { Accept: "application/json, text/plain, */*", diff --git a/packages/transaction/lib/extended-hive.chain.ts b/packages/transaction/lib/extended-hive.chain.ts index 3f504c579..b72e8f0d2 100644 --- a/packages/transaction/lib/extended-hive.chain.ts +++ b/packages/transaction/lib/extended-hive.chain.ts @@ -445,7 +445,7 @@ export interface IDelegatedVestingShare { delegatee: string; delegator: string; min_delegation_time: string; - vesting_shares: string; + vesting_shares: NaiAsset; } export type OpType = @@ -957,6 +957,7 @@ export type ExtendedNodeApi = { { votes: IVoteListItem[] } >; list_witnesses: TWaxApiRequest<{ start: string[]; limit: number; order: string }, { witnesses: IWitness[] }>; + list_vesting_delegations: TWaxApiRequest<{ start: [string, string]; limit: number; order: string }, { delegations: IDelegatedVestingShare[] }>; }; network_broadcast_api: { broadcast_transaction: TWaxApiRequest; -- GitLab From 867ba8bd999159b7b07e586b0d8ec05d409e268f Mon Sep 17 00:00:00 2001 From: fwaszkiewicz Date: Fri, 3 Oct 2025 09:36:47 +0200 Subject: [PATCH 04/12] Replace condenser_api.get_account_history with account_history_api.get_account_history --- apps/wallet/lib/hive.ts | 27 ++++++++++++------- .../playwright/tests/e2e/wallet.spec.ts | 4 +-- .../playwright/tests/support/apiHelper.ts | 9 +++++-- .../transaction/lib/extended-hive.chain.ts | 3 +++ 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/apps/wallet/lib/hive.ts b/apps/wallet/lib/hive.ts index 1ea21b322..5400c5f79 100644 --- a/apps/wallet/lib/hive.ts +++ b/apps/wallet/lib/hive.ts @@ -105,17 +105,21 @@ const wallet_operations_bitmask = [ op.claim_reward_balance ]; +const wallet_operations_filter = makeBitMaskFilter(wallet_operations_bitmask); + export const getAccountHistory = async ( username: string, start: number = -1, limit: number = 20 ): Promise => { - return chain.api.condenser_api.get_account_history([ - username, - start, + const response = await chain.api.account_history_api.get_account_history({ + account: username, + start: start.toString(), limit, - ...wallet_operations_bitmask - ]) as Promise; + operation_filter_low: wallet_operations_filter[0], + operation_filter_high: wallet_operations_filter[1] + }); + return response.history; }; export const getAccountOperations = async ( @@ -171,12 +175,15 @@ export const getAccountRewardsHistory = async ( start: number = -1, limit: number = 20 ): Promise => { - return chain.api.condenser_api.get_account_history([ - username, - start, + const response = await chain.api.account_history_api.get_account_history({ + account: username, + start: start.toString(), limit, - ...wallet_rewards_history_bitmask - ]) as Promise; + operation_filter_low: wallet_rewards_history_bitmask[0], + operation_filter_high: wallet_rewards_history_bitmask[1] + }); + + return response.history as unknown as Promise; }; export const getProposalVotes = async ( diff --git a/apps/wallet/playwright/tests/e2e/wallet.spec.ts b/apps/wallet/playwright/tests/e2e/wallet.spec.ts index fdc438787..53c0e11f8 100644 --- a/apps/wallet/playwright/tests/e2e/wallet.spec.ts +++ b/apps/wallet/playwright/tests/e2e/wallet.spec.ts @@ -223,7 +223,7 @@ test.describe("Wallet page of @gtg tests", () => { if (await walletPage.walletAccountHistoryRow.first().isVisible()){ await walletPage.page.waitForSelector(await walletPage.walletAccountHistoryRow["_selector"]); - await expect(accountHistoryUI.length).toBe(accountHistoryResult.result.length); + await expect(accountHistoryUI.length).toBe(accountHistoryResult.result.history.length); } else { await expect(await walletPage.walletAccountHistoryNoTransactionMsg).toContainText('No transactions found'); } @@ -246,7 +246,7 @@ test.describe("Wallet page of @gtg tests", () => { let accountHistoryResult = null; if (await accountHistoryResultAPI.result != null) - accountHistoryResult = await accountHistoryResultAPI.result.reverse(); + accountHistoryResult = await accountHistoryResultAPI.result.history.reverse(); // console.log('Account history result:\n', await accountHistoryResult); diff --git a/apps/wallet/playwright/tests/support/apiHelper.ts b/apps/wallet/playwright/tests/support/apiHelper.ts index df2bf35bd..39cf8dd34 100644 --- a/apps/wallet/playwright/tests/support/apiHelper.ts +++ b/apps/wallet/playwright/tests/support/apiHelper.ts @@ -264,8 +264,13 @@ export class ApiHelper { data: { id: 0, jsonrpc: "2.0", - method: "condenser_api.get_account_history", - params: [account, start, limit, "199284866418737180"], // last parameter: ...wallet_operations_bitmask + method: "account_history_api.get_account_history", + params: { + account: account, + start: start.toString(), + limit: limit, + operation_filter_low: "199284866418737180" // wallet_operations_bitmask converted to string + }, }, headers: { Accept: "application/json, text/plain, */*", diff --git a/packages/transaction/lib/extended-hive.chain.ts b/packages/transaction/lib/extended-hive.chain.ts index b72e8f0d2..92cfd719f 100644 --- a/packages/transaction/lib/extended-hive.chain.ts +++ b/packages/transaction/lib/extended-hive.chain.ts @@ -959,6 +959,9 @@ export type ExtendedNodeApi = { list_witnesses: TWaxApiRequest<{ start: string[]; limit: number; order: string }, { witnesses: IWitness[] }>; list_vesting_delegations: TWaxApiRequest<{ start: [string, string]; limit: number; order: string }, { delegations: IDelegatedVestingShare[] }>; }; + account_history_api: { + get_account_history: TWaxApiRequest<{ account: string, start: string, limit: number, include_reversible?: boolean, operation_filter_low?: number, operation_filter_high?: number }, { history: AccountHistory[] }>; + }; network_broadcast_api: { broadcast_transaction: TWaxApiRequest; }; -- GitLab From c268ebd20423c1910a6cc76eb7ed77836610a527 Mon Sep 17 00:00:00 2001 From: fwaszkiewicz Date: Fri, 3 Oct 2025 10:29:18 +0200 Subject: [PATCH 05/12] Replace condenser_api.get_ticker with market_history_api.get_ticker --- apps/wallet/components/trade-hive.tsx | 5 +++-- apps/wallet/lib/hive.ts | 2 +- packages/transaction/lib/extended-hive.chain.ts | 7 +++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/wallet/components/trade-hive.tsx b/apps/wallet/components/trade-hive.tsx index 09c282469..f0a027699 100644 --- a/apps/wallet/components/trade-hive.tsx +++ b/apps/wallet/components/trade-hive.tsx @@ -12,11 +12,12 @@ import { useUser } from '@smart-signer/lib/auth/use-user'; import { getOpenOrder } from '../lib/hive'; import OpenOrders from './open-orders'; import { useQuery } from '@tanstack/react-query'; +import { NaiAsset } from '@hiveio/wax'; interface Market { - hbd_volume: string; + hbd_volume: NaiAsset; highest_bid: Big; - hive_volume: string; + hive_volume: NaiAsset; latest: string; lowest_ask: Big; percent_change: string; diff --git a/apps/wallet/lib/hive.ts b/apps/wallet/lib/hive.ts index 5400c5f79..237ee3c74 100644 --- a/apps/wallet/lib/hive.ts +++ b/apps/wallet/lib/hive.ts @@ -203,7 +203,7 @@ export const getUserVotes = async (voter: string, limit: number = 1000): Promise }; export const getMarketStatistics = async (): Promise => { - return chain.api.condenser_api.get_ticker([]); + return chain.api.market_history_api.get_ticker({}); }; export const getOrderBook = async (limit: number = 500): Promise => { diff --git a/packages/transaction/lib/extended-hive.chain.ts b/packages/transaction/lib/extended-hive.chain.ts index 92cfd719f..a60c8284a 100644 --- a/packages/transaction/lib/extended-hive.chain.ts +++ b/packages/transaction/lib/extended-hive.chain.ts @@ -164,9 +164,9 @@ export interface JsonMetadata { export type FollowListType = 'follow_blacklist' | 'follow_muted' | 'blacklisted' | 'muted'; export interface IMarketStatistics { - hbd_volume: string; + hbd_volume: NaiAsset; highest_bid: string; - hive_volume: string; + hive_volume: NaiAsset; latest: string; lowest_ask: string; percent_change: string; @@ -962,6 +962,9 @@ export type ExtendedNodeApi = { account_history_api: { get_account_history: TWaxApiRequest<{ account: string, start: string, limit: number, include_reversible?: boolean, operation_filter_low?: number, operation_filter_high?: number }, { history: AccountHistory[] }>; }; + market_history_api: { + get_ticker: TWaxApiRequest<{}, IMarketStatistics>; + } network_broadcast_api: { broadcast_transaction: TWaxApiRequest; }; -- GitLab From 895f20d24daccd8aae2ecc451fda98ae983a18bc Mon Sep 17 00:00:00 2001 From: fwaszkiewicz Date: Fri, 3 Oct 2025 10:58:25 +0200 Subject: [PATCH 06/12] Replace condenser_api.get_order_book with market_history_api.get_order_book --- apps/wallet/components/market-table.tsx | 5 +++-- apps/wallet/lib/hive.ts | 2 +- packages/transaction/lib/extended-hive.chain.ts | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/wallet/components/market-table.tsx b/apps/wallet/components/market-table.tsx index 785b9439e..24d9f548a 100644 --- a/apps/wallet/components/market-table.tsx +++ b/apps/wallet/components/market-table.tsx @@ -4,6 +4,7 @@ import { useState } from 'react'; import { dateToRelative } from '@ui/lib/parse-date'; import Big from 'big.js'; import { useTranslation } from 'next-i18next'; +import { NaiAsset } from '@hiveio/wax'; export interface OrdersItem { total: number; @@ -11,8 +12,8 @@ export interface OrdersItem { hbd: number; hive: number; order_price: { - base: string; - quote: string; + base: NaiAsset; + quote: NaiAsset; }; real_price: string; } diff --git a/apps/wallet/lib/hive.ts b/apps/wallet/lib/hive.ts index 237ee3c74..443b8a781 100644 --- a/apps/wallet/lib/hive.ts +++ b/apps/wallet/lib/hive.ts @@ -207,7 +207,7 @@ export const getMarketStatistics = async (): Promise => { }; export const getOrderBook = async (limit: number = 500): Promise => { - return chain.api.condenser_api.get_order_book([limit]); + return chain.api.market_history_api.get_order_book({ limit }); }; export const getOpenOrder = async (user: string): Promise => { diff --git a/packages/transaction/lib/extended-hive.chain.ts b/packages/transaction/lib/extended-hive.chain.ts index a60c8284a..2d0b14f2f 100644 --- a/packages/transaction/lib/extended-hive.chain.ts +++ b/packages/transaction/lib/extended-hive.chain.ts @@ -210,8 +210,8 @@ export interface IOrdersDataItem { hbd: number; hive: number; order_price: { - base: string; - quote: string; + base: NaiAsset; + quote: NaiAsset; }; real_price: string; } @@ -964,6 +964,7 @@ export type ExtendedNodeApi = { }; market_history_api: { get_ticker: TWaxApiRequest<{}, IMarketStatistics>; + get_order_book: TWaxApiRequest<{ limit: number }, IOrdersData>; } network_broadcast_api: { broadcast_transaction: TWaxApiRequest; -- GitLab From 81c160eb0d44aefb0a41c13917fbf7f135c73a32 Mon Sep 17 00:00:00 2001 From: fwaszkiewicz Date: Fri, 3 Oct 2025 11:31:06 +0200 Subject: [PATCH 07/12] Replace condenser_api.get_open_orders with database_api.list_limit_orders --- apps/wallet/components/open-orders.tsx | 12 ++++++------ apps/wallet/lib/hive.ts | 2 +- packages/transaction/lib/extended-hive.chain.ts | 9 +++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/wallet/components/open-orders.tsx b/apps/wallet/components/open-orders.tsx index b2fe9f059..3b7010ae3 100644 --- a/apps/wallet/components/open-orders.tsx +++ b/apps/wallet/components/open-orders.tsx @@ -1,5 +1,5 @@ import clsx from 'clsx'; -import { IOpenOrdersData } from '@transaction/lib/extended-hive.chain'; +import { IOpenOrdersData } from '@transaction/lib/extended-hive.chain'; import { useTranslation } from 'next-i18next'; import { Button, Dialog, DialogContent, DialogFooter, DialogTrigger } from '@ui/components'; import { dateToFormatted } from '@ui/lib/parse-date'; @@ -68,10 +68,10 @@ const OpenOrders: React.FC = ({ user, orders, loading }) => { {orders && orders.length ? ( (sortAsc ? orders : orders.toReversed()).map((order: IOpenOrdersData) => { const currency = [ - order.sell_price.base.split(' ')[0], - order.sell_price.quote.split(' ')[0] + order.sell_price.base.amount, + order.sell_price.quote.amount ]; - if (order.sell_price.base.includes('HBD')) currency.reverse(); + if (order.sell_price.base.nai === '@@000000013') currency.reverse(); return ( @@ -79,7 +79,7 @@ const OpenOrders: React.FC = ({ user, orders, loading }) => { {dateToFormatted(order.created, 'YYYY-MM-DD HH:mm:ss')} - {order.sell_price.base.includes('HIVE') + {order.sell_price.base.nai === '@@000000021' ? t('market_page.sell') : t('market_page.buy')} @@ -88,7 +88,7 @@ const OpenOrders: React.FC = ({ user, orders, loading }) => { {currency[1]} {( - (1 - order.for_sale / 1000 / parseFloat(order.sell_price.base.split(' ')[0])) * + (1 - order.for_sale / 1000 / parseFloat(order.sell_price.base.amount)) * 100 ).toFixed(2)} % diff --git a/apps/wallet/lib/hive.ts b/apps/wallet/lib/hive.ts index 443b8a781..1078be1fe 100644 --- a/apps/wallet/lib/hive.ts +++ b/apps/wallet/lib/hive.ts @@ -211,7 +211,7 @@ export const getOrderBook = async (limit: number = 500): Promise => }; export const getOpenOrder = async (user: string): Promise => { - return chain.api.condenser_api.get_open_orders([user]); + return (await chain.api.database_api.list_limit_orders({ start: [user, 0], limit: 100, order: 'by_account' })).orders; }; type GetTradeHistoryData = { diff --git a/packages/transaction/lib/extended-hive.chain.ts b/packages/transaction/lib/extended-hive.chain.ts index 2d0b14f2f..076a386f8 100644 --- a/packages/transaction/lib/extended-hive.chain.ts +++ b/packages/transaction/lib/extended-hive.chain.ts @@ -229,11 +229,11 @@ export interface IOpenOrdersData { orderid: number; for_sale: number; sell_price: { - base: string; - quote: string; + base: NaiAsset; + quote: NaiAsset; }; - real_price: string; - rewarded: boolean; + real_price?: string; + rewarded?: boolean; } export interface IRecentTradesData { @@ -958,6 +958,7 @@ export type ExtendedNodeApi = { >; list_witnesses: TWaxApiRequest<{ start: string[]; limit: number; order: string }, { witnesses: IWitness[] }>; list_vesting_delegations: TWaxApiRequest<{ start: [string, string]; limit: number; order: string }, { delegations: IDelegatedVestingShare[] }>; + list_limit_orders: TWaxApiRequest<{ start: [string, number], limit: number, order: string }, { orders: IOpenOrdersData[] }>; }; account_history_api: { get_account_history: TWaxApiRequest<{ account: string, start: string, limit: number, include_reversible?: boolean, operation_filter_low?: number, operation_filter_high?: number }, { history: AccountHistory[] }>; -- GitLab From c20085e234b0cd988f012db95cbf33c82425b9e3 Mon Sep 17 00:00:00 2001 From: fwaszkiewicz Date: Fri, 3 Oct 2025 11:58:28 +0200 Subject: [PATCH 08/12] Replace condenser_api.get_trade_history with market_history_api.get_trade_history --- apps/wallet/components/market-table.tsx | 9 +++++---- apps/wallet/lib/hive.ts | 5 +++-- packages/transaction/lib/extended-hive.chain.ts | 7 +++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/apps/wallet/components/market-table.tsx b/apps/wallet/components/market-table.tsx index 24d9f548a..0fbae00ac 100644 --- a/apps/wallet/components/market-table.tsx +++ b/apps/wallet/components/market-table.tsx @@ -5,6 +5,7 @@ import { dateToRelative } from '@ui/lib/parse-date'; import Big from 'big.js'; import { useTranslation } from 'next-i18next'; import { NaiAsset } from '@hiveio/wax'; +import { HIVE_NAI_STRING, HBD_NAI_STRING } from '@transaction/lib/utils'; export interface OrdersItem { total: number; @@ -21,8 +22,8 @@ type TradeHistory = { hbd: Big; hive: Big; date: string; - current_pays: string; - open_pays: string; + current_pays: NaiAsset; + open_pays: NaiAsset; }; const PAGE_SIZE = 10; export function MarketTable({ @@ -151,8 +152,8 @@ export function HistoryTable({ data, params, label }: { data: any[]; params: str {dateToRelative(e.date, t)} {e.hbd.div(e.hive).toFixed(6)} diff --git a/apps/wallet/lib/hive.ts b/apps/wallet/lib/hive.ts index 1078be1fe..36c68deb0 100644 --- a/apps/wallet/lib/hive.ts +++ b/apps/wallet/lib/hive.ts @@ -27,6 +27,7 @@ import { IWitness, IDirectDelegation, IGetOperationsByAccountResponse, + ITradesData, } from '@transaction/lib/extended-hive.chain'; import { commonVariables } from '@ui/lib/common-variables'; @@ -220,10 +221,10 @@ type GetTradeHistoryData = { }; }; -export const getTradeHistory = async (limit: number = 1000): Promise => { +export const getTradeHistory = async (limit: number = 1000): Promise => { let todayEarlier = moment(Date.now()).subtract(10, 'h').format().split('+')[0]; let todayNow = moment(Date.now()).format().split('+')[0]; - return chain.api.condenser_api.get_trade_history([todayEarlier, todayNow, limit]); + return (await chain.api.market_history_api.get_trade_history({ start: todayEarlier, end: todayNow, limit })).trades; }; export const getRecentTrades = async (limit: number = 1000): Promise => { diff --git a/packages/transaction/lib/extended-hive.chain.ts b/packages/transaction/lib/extended-hive.chain.ts index 076a386f8..3e14abd8d 100644 --- a/packages/transaction/lib/extended-hive.chain.ts +++ b/packages/transaction/lib/extended-hive.chain.ts @@ -205,6 +205,12 @@ export interface IWitness { owner: string; } +export interface ITradesData { + date: string; + current_pays: NaiAsset; + open_pays: NaiAsset; +} + export interface IOrdersDataItem { created: string; hbd: number; @@ -966,6 +972,7 @@ export type ExtendedNodeApi = { market_history_api: { get_ticker: TWaxApiRequest<{}, IMarketStatistics>; get_order_book: TWaxApiRequest<{ limit: number }, IOrdersData>; + get_trade_history: TWaxApiRequest<{ start: string, end: string, limit: number }, { trades: ITradesData[] }>; } network_broadcast_api: { broadcast_transaction: TWaxApiRequest; -- GitLab From dd8ebc465d979f4e8cdb7f0b2eedf8e78a1580cc Mon Sep 17 00:00:00 2001 From: fwaszkiewicz Date: Fri, 3 Oct 2025 12:18:05 +0200 Subject: [PATCH 09/12] Replace condenser_api.get_recent_trades with market_history_api.get_recent_trades --- apps/wallet/components/hooks/use-trade-history.ts | 4 ++-- apps/wallet/lib/hive.ts | 2 +- packages/transaction/lib/extended-hive.chain.ts | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/wallet/components/hooks/use-trade-history.ts b/apps/wallet/components/hooks/use-trade-history.ts index a0b791736..1c6c0f790 100644 --- a/apps/wallet/components/hooks/use-trade-history.ts +++ b/apps/wallet/components/hooks/use-trade-history.ts @@ -11,8 +11,8 @@ export const useTradeHistory = (config?: useTradeHistoryOptions) => { select: (data) => { return data.map((e) => ({ ...e, - hbd: convertStringToBig(e.current_pays.includes('HBD') ? e.current_pays : e.open_pays), - hive: convertStringToBig(e.current_pays.includes('HIVE') ? e.current_pays : e.open_pays) + hbd: convertStringToBig(e.current_pays.nai === '@@000000013' ? e.current_pays : e.open_pays), + hive: convertStringToBig(e.current_pays.nai === '@@000000021' ? e.current_pays : e.open_pays) })); } }); diff --git a/apps/wallet/lib/hive.ts b/apps/wallet/lib/hive.ts index 36c68deb0..90eb89f53 100644 --- a/apps/wallet/lib/hive.ts +++ b/apps/wallet/lib/hive.ts @@ -228,7 +228,7 @@ export const getTradeHistory = async (limit: number = 1000): Promise => { - return chain.api.condenser_api.get_recent_trades([limit]); + return (await chain.api.market_history_api.get_recent_trades({ limit })).trades; }; export const getSavingsWithdrawals = async (account: string): Promise => { diff --git a/packages/transaction/lib/extended-hive.chain.ts b/packages/transaction/lib/extended-hive.chain.ts index 3e14abd8d..49c508676 100644 --- a/packages/transaction/lib/extended-hive.chain.ts +++ b/packages/transaction/lib/extended-hive.chain.ts @@ -244,8 +244,8 @@ export interface IOpenOrdersData { export interface IRecentTradesData { date: string; - current_pays: string; - open_pays: string; + current_pays: NaiAsset; + open_pays: NaiAsset; } export type OwnerHistory = { @@ -973,6 +973,7 @@ export type ExtendedNodeApi = { get_ticker: TWaxApiRequest<{}, IMarketStatistics>; get_order_book: TWaxApiRequest<{ limit: number }, IOrdersData>; get_trade_history: TWaxApiRequest<{ start: string, end: string, limit: number }, { trades: ITradesData[] }>; + get_recent_trades: TWaxApiRequest<{ limit: number }, { trades: IRecentTradesData[] }>; } network_broadcast_api: { broadcast_transaction: TWaxApiRequest; -- GitLab From 3efb3ba4dd6540b840954df9ac925a9c6f9e6085 Mon Sep 17 00:00:00 2001 From: fwaszkiewicz Date: Fri, 3 Oct 2025 12:41:48 +0200 Subject: [PATCH 10/12] Replace condenser_api.get_owner_history with database_api.list_owner_histories --- apps/wallet/lib/hive.ts | 6 +++--- packages/transaction/lib/extended-hive.chain.ts | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/wallet/lib/hive.ts b/apps/wallet/lib/hive.ts index 90eb89f53..08c105d66 100644 --- a/apps/wallet/lib/hive.ts +++ b/apps/wallet/lib/hive.ts @@ -18,7 +18,6 @@ import { AccountHistory, AccountRewardsHistory, IDelegatedVestingShare, - OwnerHistory, IRecentTradesData, IOrdersDataItem, IOpenOrdersData, @@ -28,6 +27,7 @@ import { IDirectDelegation, IGetOperationsByAccountResponse, ITradesData, + IOwnerHistory, } from '@transaction/lib/extended-hive.chain'; import { commonVariables } from '@ui/lib/common-variables'; @@ -235,8 +235,8 @@ export const getSavingsWithdrawals = async (account: string): Promise => { - return chain.api.condenser_api.get_owner_history([account]); +export const getOwnerHistory = async (account: string): Promise => { + return (await chain.api.database_api.list_owner_histories({ start: [account, '1970-01-01T00:00:00'], limit: 100 })).owner_auths; }; export const getDynamicGlobalPropertiesData = async (): Promise => { diff --git a/packages/transaction/lib/extended-hive.chain.ts b/packages/transaction/lib/extended-hive.chain.ts index 49c508676..94826577e 100644 --- a/packages/transaction/lib/extended-hive.chain.ts +++ b/packages/transaction/lib/extended-hive.chain.ts @@ -248,16 +248,16 @@ export interface IRecentTradesData { open_pays: NaiAsset; } -export type OwnerHistory = { +export interface IOwnerHistory { account: string; id: number; last_valid_time: string; previous_owner_authority: { - account_auths: unknown[]; + account_auths: string[]; key_auths: [string, number][]; weight_threshold: number; }; -}[]; +}; export interface IGetProposalsParams { start: Array; @@ -906,7 +906,7 @@ export type ExtendedNodeApi = { get_open_orders: TWaxApiRequest; get_trade_history: TWaxApiRequest<(string | number)[], IOrdersDataItem[]>; get_recent_trades: TWaxApiRequest; - get_owner_history: TWaxApiRequest; + get_owner_history: TWaxApiRequest; get_follow_count: TWaxApiRequest; get_content: TWaxApiRequest; get_market_history_buckets: TWaxApiRequest; @@ -965,6 +965,7 @@ export type ExtendedNodeApi = { list_witnesses: TWaxApiRequest<{ start: string[]; limit: number; order: string }, { witnesses: IWitness[] }>; list_vesting_delegations: TWaxApiRequest<{ start: [string, string]; limit: number; order: string }, { delegations: IDelegatedVestingShare[] }>; list_limit_orders: TWaxApiRequest<{ start: [string, number], limit: number, order: string }, { orders: IOpenOrdersData[] }>; + list_owner_histories: TWaxApiRequest<{ start: [string, string], limit: number }, { owner_auths: IOwnerHistory[] }>; }; account_history_api: { get_account_history: TWaxApiRequest<{ account: string, start: string, limit: number, include_reversible?: boolean, operation_filter_low?: number, operation_filter_high?: number }, { history: AccountHistory[] }>; -- GitLab From 56afddf1c23b83c406fac5f6899ba4b24d2641c7 Mon Sep 17 00:00:00 2001 From: fwaszkiewicz Date: Mon, 6 Oct 2025 08:21:08 +0200 Subject: [PATCH 11/12] Replace condenser_api.get_follow_count with follow_api.get_follow_count --- apps/blog/playwright/tests/e2e/profilePage.spec.ts | 4 ++-- apps/blog/playwright/tests/support/apiHelper.ts | 6 +++--- apps/blog/playwright/tests/testnet_e2e/followUser.spec.ts | 2 +- apps/wallet/playwright/tests/support/apiHelper.ts | 6 +++--- packages/transaction/lib/extended-hive.chain.ts | 3 +++ packages/transaction/lib/hive.ts | 4 ++-- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/blog/playwright/tests/e2e/profilePage.spec.ts b/apps/blog/playwright/tests/e2e/profilePage.spec.ts index a70187ac9..572853e65 100644 --- a/apps/blog/playwright/tests/e2e/profilePage.spec.ts +++ b/apps/blog/playwright/tests/e2e/profilePage.spec.ts @@ -64,8 +64,8 @@ test.describe('Profile page of @gtg', () => { data: { id: 0, jsonrpc: '2.0', - method: 'condenser_api.get_follow_count', - params: ['gtg'] + method: 'follow_api.get_follow_count', + params: { account: 'gtg' } }, headers: { Accept: 'application/json, text/plain, */*' diff --git a/apps/blog/playwright/tests/support/apiHelper.ts b/apps/blog/playwright/tests/support/apiHelper.ts index 81c8061e0..387afeb36 100644 --- a/apps/blog/playwright/tests/support/apiHelper.ts +++ b/apps/blog/playwright/tests/support/apiHelper.ts @@ -27,15 +27,15 @@ export class ApiHelper { } // Get Follow count info as json from API response - async getFollowCountAPI(username: string) { + async getFollowCountAPI(account: string) { const url = process.env.REACT_APP_API_ENDPOINT; const responseGetFollowCount = await this.page.request.post(`${url}/`, { data: { id: 0, jsonrpc: '2.0', - method: 'condenser_api.get_follow_count', - params: [`${username}`] + method: 'follow_api.get_follow_count', + params: { account } }, headers: { Accept: 'application/json, text/plain, */*' diff --git a/apps/blog/playwright/tests/testnet_e2e/followUser.spec.ts b/apps/blog/playwright/tests/testnet_e2e/followUser.spec.ts index 5cb381a90..1cd025ab8 100644 --- a/apps/blog/playwright/tests/testnet_e2e/followUser.spec.ts +++ b/apps/blog/playwright/tests/testnet_e2e/followUser.spec.ts @@ -5,7 +5,7 @@ import { ProfilePage } from '../support/pages/profilePage'; import { PostPage } from '../support/pages/postPage'; // Unskip these tests after fixing -// - "condenser_api.get_follow_count" will return correct value for following_count, +// - "follow_api.get_follow_count" will return correct value for following_count, // - and Optimistic UI will work correctly test.describe.skip('Follow user - tests', () => { let profileUserMenu: ProfileUserMenu; diff --git a/apps/wallet/playwright/tests/support/apiHelper.ts b/apps/wallet/playwright/tests/support/apiHelper.ts index 39cf8dd34..43c0acb28 100644 --- a/apps/wallet/playwright/tests/support/apiHelper.ts +++ b/apps/wallet/playwright/tests/support/apiHelper.ts @@ -27,15 +27,15 @@ export class ApiHelper { } // Get Follow count info as json from API response - async getFollowCountAPI(username: string) { + async getFollowCountAPI(account: string) { const url = process.env.REACT_APP_API_ENDPOINT; const responseGetFollowCount = await this.page.request.post(`${url}/`, { data: { id: 0, jsonrpc: "2.0", - method: "condenser_api.get_follow_count", - params: [`${username}`], + method: "follow_api.get_follow_count", + params: { account }, }, headers: { Accept: "application/json, text/plain, */*", diff --git a/packages/transaction/lib/extended-hive.chain.ts b/packages/transaction/lib/extended-hive.chain.ts index 94826577e..be6804efe 100644 --- a/packages/transaction/lib/extended-hive.chain.ts +++ b/packages/transaction/lib/extended-hive.chain.ts @@ -979,6 +979,9 @@ export type ExtendedNodeApi = { network_broadcast_api: { broadcast_transaction: TWaxApiRequest; }; + follow_api: { + get_follow_count: TWaxApiRequest<{ account: string }, AccountFollowStats> + } 'search-api': { find_text: TWaxApiRequest; }; diff --git a/packages/transaction/lib/hive.ts b/packages/transaction/lib/hive.ts index 5b05127cf..aa485ce2e 100644 --- a/packages/transaction/lib/hive.ts +++ b/packages/transaction/lib/hive.ts @@ -127,8 +127,8 @@ export const getFeedHistory = async (): Promise => { return chain.api.database_api.get_feed_history(); }; -export const getFollowCount = async (username: string): Promise => { - return chain.api.condenser_api.get_follow_count([username]); +export const getFollowCount = async (account: string): Promise => { + return chain.api.follow_api.get_follow_count({ account }); }; export interface IDynamicProps { -- GitLab From 72bb9ef2736f0e62cc7fa6c72e7d9db05dc608b6 Mon Sep 17 00:00:00 2001 From: fwaszkiewicz Date: Mon, 6 Oct 2025 12:06:02 +0200 Subject: [PATCH 12/12] Fix downloading financial report file --- apps/wallet/components/financial-report.tsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/wallet/components/financial-report.tsx b/apps/wallet/components/financial-report.tsx index 591b6a8e2..cf7bafa9a 100644 --- a/apps/wallet/components/financial-report.tsx +++ b/apps/wallet/components/financial-report.tsx @@ -65,17 +65,18 @@ const convertHistoryToCSV = (transactions: AccountHistory[]) => { transactions.forEach((transaction) => { console.log(transaction); + const opData = transaction[1].op[1]; const formatted = [ transaction[1].timestamp, transaction[1].op[0], - transaction[1].op[1].amount, - transaction[1].op[1].from, - transaction[1].op[1].to, - transaction[1].op[1].memo, - transaction[1].op[1].account, - transaction[1].op[1].reward_hive, - transaction[1].op[1].reward_hbd, - transaction[1].op[1].reward_hive + opData.amount, + opData.from, + opData.to, + opData.memo, + opData.account, + opData.reward_hive, + opData.reward_hbd, + opData.reward_hive // 'payout_must_be_claimed', // 'permlink', // 'vesting_payout', @@ -106,7 +107,7 @@ const downloadCSV = (csv: string) => { const generateReport = async (username: string, financialPeriod: FinancialReportPeriod) => { const transactions = await getAccountHistory(username, -1, 1000); const filtered = transactions.filter((transaction) => { - const opType = transaction[1].op!.at(0); + const opType = transaction[1].op![0]; if (!!opType) { return ( opTypes.includes(opType as OpType) && -- GitLab