Skip to content

Commit

Permalink
chore: reverted to EstimateMode type
Browse files Browse the repository at this point in the history
  • Loading branch information
thedoublejay committed May 19, 2021
1 parent a117a51 commit 545c85e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ describe('estimatesmartfees', () => {
}
})

const result = await client.mining.estimateSmartFee(6, wallet.Mode.ECONOMICAL)
const result = await client.mining.estimateSmartFee(6, 'ECONOMICAL')
expect(result.errors).toBeUndefined()
expect(result.blocks).toBeGreaterThan(0)
expect(result.feerate).toBeGreaterThan(0)
Expand Down
6 changes: 4 additions & 2 deletions packages/jellyfish-api-core/src/category/mining.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApiClient, wallet } from '../.'
import { ApiClient } from '../.'

/**
* Mining RPCs for DeFi Blockchain
Expand Down Expand Up @@ -44,7 +44,7 @@ export class Mining {
* @param {EstimateMode} [estimateMode='CONSERVATIVE'] estimateMode of fees.
* @returns {Promise<SmartFeeEstimation>}
*/
async estimateSmartFee (confirmationTarget: number, estimateMode: wallet.Mode = wallet.Mode.CONSERVATIVE): Promise<SmartFeeEstimation> {
async estimateSmartFee (confirmationTarget: number, estimateMode: EstimateMode = 'CONSERVATIVE'): Promise<SmartFeeEstimation> {
return await this.client.call('estimatesmartfee', [confirmationTarget, estimateMode], 'number')
}
}
Expand Down Expand Up @@ -102,3 +102,5 @@ export interface SmartFeeEstimation {
errors?: string[]
blocks: number
}

type EstimateMode = 'UNSET' | 'ECONOMICAL' | 'CONSERVATIVE'
4 changes: 3 additions & 1 deletion website/docs/jellyfish/api/mining.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ Estimates the approximate fee per kilobyte needed for a transaction

```ts title="client.mining.estimateSmartFee()"
interface mining {
estimateSmartFee (confirmationTarget: number, estimateMode: wallet.Mode = wallet.Mode.CONSERVATIVE): Promise<SmartFeeEstimation>
estimateSmartFee (confirmationTarget: number, estimateMode: EstimateMode = 'CONSERVATIVE'): Promise<SmartFeeEstimation>
}

interface SmartFeeEstimation {
feerate?: number
errors?: string[]
blocks: number
}

type EstimateMode = 'UNSET' | 'ECONOMICAL' | 'CONSERVATIVE';
```

0 comments on commit 545c85e

Please sign in to comment.