Skip to content

Commit

Permalink
format resurces.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ttwishing committed Oct 2, 2024
1 parent 127efe0 commit 45d3d38
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/pages/resources/resources.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { derived, Readable } from 'svelte/store'
import { Int64, API, Asset } from '@greymass/eosio'
import { Resources, SampleUsage, PowerUpState, RAMState, REXState } from '@greymass/eosio-resources'
import { API, Asset } from '@greymass/eosio'
import { Resources, SampleUsage, PowerUpState, RAMState, REXState, BNPrecision } from '@greymass/eosio-resources'
import { activeBlockchain } from '~/store'
import { BNPrecision } from '@greymass/eosio-resources'

import { getClient } from '../../api-client'
import { ChainConfig, ChainFeatures, resourceFeatures } from '~/config'
Expand Down Expand Up @@ -113,7 +112,7 @@ export const cpuPowerupPrice = derived(

// price per kb
export const netPowerupPrice = derived(
[activeBlockchain,sampleUsage, statePowerUp, info],
[activeBlockchain, sampleUsage, statePowerUp, info],
([$activeBlockchain, $sampleUsage, $statePowerUp, $info]) => {
if ($sampleUsage && $statePowerUp) {
return Asset.from(
Expand Down Expand Up @@ -206,9 +205,9 @@ export const netRexPrice = derived(
}
)

function compatPriceWithPrecision(price : number, coreTokenSymbol : Asset.Symbol){
function compatPriceWithPrecision(price: number, coreTokenSymbol: Asset.Symbol) {
let precision = coreTokenSymbol.precision;
if (price > 0 && price < 1/Math.pow(10, precision)) {
if (price > 0 && price < 1 / Math.pow(10, precision)) {
precision = Number(price.toExponential().split('-')[1])
}
return Asset.from(price, `${precision},${coreTokenSymbol.name}`)
Expand Down

0 comments on commit 45d3d38

Please sign in to comment.