diff --git a/packages/jellyfish-api-core/__tests__/category/mining.test.ts b/packages/jellyfish-api-core/__tests__/category/mining.test.ts index 10b51e40a3..5fc5bf902e 100644 --- a/packages/jellyfish-api-core/__tests__/category/mining.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/mining.test.ts @@ -2,6 +2,7 @@ import { RegTestContainer, MasterNodeRegTestContainer } from '@defichain/testcon import { ContainerAdapterClient } from '../container_adapter_client' import waitForExpect from 'wait-for-expect' import { wallet } from '../../src' +import { EstimateMode } from '../../src/category/mining' describe('non masternode', () => { const container = new RegTestContainer() @@ -145,7 +146,7 @@ describe('estimatesmartfees', () => { } }) - const result = await client.mining.estimateSmartFee(6, 'ECONOMICAL') + const result = await client.mining.estimateSmartFee(6, EstimateMode.ECONOMICAL) expect(result.errors).toBeUndefined() expect(result.blocks).toBeGreaterThan(0) expect(result.feerate).toBeGreaterThan(0) diff --git a/packages/jellyfish-api-core/src/category/mining.ts b/packages/jellyfish-api-core/src/category/mining.ts index 2c27ae89d2..c8055b58aa 100644 --- a/packages/jellyfish-api-core/src/category/mining.ts +++ b/packages/jellyfish-api-core/src/category/mining.ts @@ -1,5 +1,11 @@ import { ApiClient } from '../.' +export enum EstimateMode { + UNSET = 'UNSET', + ECONOMICAL = 'ECONOMICAL', + CONSERVATIVE = 'CONSERVATIVE' +} + /** * Mining RPCs for DeFi Blockchain */ @@ -44,7 +50,7 @@ export class Mining { * @param {EstimateMode} [estimateMode='CONSERVATIVE'] estimateMode of fees. * @returns {Promise} */ - async estimateSmartFee (confirmationTarget: number, estimateMode: EstimateMode = 'CONSERVATIVE'): Promise { + async estimateSmartFee (confirmationTarget: number, estimateMode: EstimateMode = EstimateMode.CONSERVATIVE): Promise { return await this.client.call('estimatesmartfee', [confirmationTarget, estimateMode], 'number') } } @@ -102,5 +108,3 @@ export interface SmartFeeEstimation { errors?: string[] blocks: number } - -type EstimateMode = 'UNSET' | 'ECONOMICAL' | 'CONSERVATIVE' diff --git a/website/docs/jellyfish/api/mining.md b/website/docs/jellyfish/api/mining.md index de4676dff9..3e3ea3ff17 100644 --- a/website/docs/jellyfish/api/mining.md +++ b/website/docs/jellyfish/api/mining.md @@ -107,5 +107,9 @@ interface SmartFeeEstimation { blocks: number } -type EstimateMode = 'UNSET' | 'ECONOMICAL' | 'CONSERVATIVE'; +enum EstimateMode { + UNSET = 'UNSET', + ECONOMICAL = 'ECONOMICAL', + CONSERVATIVE = 'CONSERVATIVE' +} ```