diff --git a/packages/api-react/src/services/index.ts b/packages/api-react/src/services/index.ts index 475319d731..0572c6b0c9 100644 --- a/packages/api-react/src/services/index.ts +++ b/packages/api-react/src/services/index.ts @@ -169,6 +169,7 @@ export const { useGetPuzzleAndSolutionMutation, useGetNetworkInfoQuery, useGetFullNodePeerCountQuery, + useGetWalletFeeEstimateQuery, useGetSyncStatusQuery, useGetWalletConnectionsQuery, useGetAllOffersQuery, diff --git a/packages/api-react/src/services/wallet.ts b/packages/api-react/src/services/wallet.ts index c6333f1050..28582265a2 100644 --- a/packages/api-react/src/services/wallet.ts +++ b/packages/api-react/src/services/wallet.ts @@ -625,6 +625,8 @@ export const walletApi = apiWithTag.injectEndpoints({ getFullNodePeerCount: query(build, WalletService, 'getFullNodePeerCount'), + getWalletFeeEstimate: query(build, WalletService, 'getFeeEstimate'), + getSyncStatus: query(build, WalletService, 'getSyncStatus', { onCacheEntryAdded: onCacheEntryAddedInvalidate(baseQuery, api, [ { @@ -1633,6 +1635,7 @@ export const { useGetPuzzleAndSolutionMutation, useGetNetworkInfoQuery, useGetFullNodePeerCountQuery, + useGetWalletFeeEstimateQuery, useGetSyncStatusQuery, useGetWalletConnectionsQuery, useGetAllOffersQuery, diff --git a/packages/api/src/services/WalletService.ts b/packages/api/src/services/WalletService.ts index e0eaee72bb..a28bc9f54d 100644 --- a/packages/api/src/services/WalletService.ts +++ b/packages/api/src/services/WalletService.ts @@ -309,6 +309,10 @@ export default class Wallet extends Service { return this.command<{ peerCount: number }>('get_full_node_peer_count'); } + async getFeeEstimate() { + return this.command<{ feePerCost: number }>('get_fee_estimate'); + } + async getSyncStatus() { return this.command<{ genesisInitialized: boolean; diff --git a/packages/gui/src/electron/commands/Commands.ts b/packages/gui/src/electron/commands/Commands.ts index 03322779bd..124b41dbf3 100644 --- a/packages/gui/src/electron/commands/Commands.ts +++ b/packages/gui/src/electron/commands/Commands.ts @@ -1896,6 +1896,20 @@ export const Commands: Record = { }, ], }, + 'chia_wallet.get_fee_estimate': { + title: () => i18n._(/* i18n */ { id: 'Get Fee Estimate' }), + message: () => i18n._(/* i18n */ { id: 'Requests the current fee per cost estimate from the wallet' }), + confirmLabel: () => i18n._(/* i18n */ { id: 'Proceed' }), + params: [], + dapp: [ + { + command: 'chia_getFeeEstimate', + title: () => i18n._(/* i18n */ { id: 'Get Fee Estimate' }), + message: () => i18n._(/* i18n */ { id: 'Requests the current fee per cost estimate from the wallet' }), + allowConfirmationBypass: true, + }, + ], + }, 'chia_wallet.get_height_info': { title: () => i18n._(/* i18n */ { id: 'Get Height Info' }), diff --git a/packages/gui/src/electron/commands/isAllowedCommand.ts b/packages/gui/src/electron/commands/isAllowedCommand.ts index 016714fc9e..5050625437 100644 --- a/packages/gui/src/electron/commands/isAllowedCommand.ts +++ b/packages/gui/src/electron/commands/isAllowedCommand.ts @@ -34,6 +34,7 @@ const ALLOWED_COMMANDS_SET = new Set([ 'chia_wallet.get_notifications', 'chia_wallet.get_sync_status', 'chia_wallet.get_full_node_peer_count', + 'chia_wallet.get_fee_estimate', 'chia_wallet.get_wallets', 'chia_wallet.get_coin_records_by_names', 'chia_wallet.select_coins', diff --git a/packages/gui/src/electron/commands/isDappAllowedCommand.ts b/packages/gui/src/electron/commands/isDappAllowedCommand.ts index 834a88a067..fdfc464fd4 100644 --- a/packages/gui/src/electron/commands/isDappAllowedCommand.ts +++ b/packages/gui/src/electron/commands/isDappAllowedCommand.ts @@ -6,6 +6,7 @@ const DAPP_ALLOWED_COMMANDS = new Set([ 'chia_wallet.get_next_address', 'chia_wallet.get_sync_status', 'chia_wallet.get_full_node_peer_count', + 'chia_wallet.get_fee_estimate', 'chia_wallet.get_coin_records_by_names', 'chia_wallet.select_coins', 'chia_wallet.get_height_info',