Add method to get gas price in util
This commit is contained in:
parent
186d9b9b2e
commit
b5ccd8ae84
10
src/util.ts
10
src/util.ts
@ -2,7 +2,7 @@ import * as Block from 'multiformats/block';
|
||||
import { sha256 as hasher } from 'multiformats/hashes/sha2';
|
||||
import assert from 'assert';
|
||||
|
||||
import { StdFee, parseCoins } from '@cosmjs/stargate';
|
||||
import { GasPrice, StdFee, parseCoins } from '@cosmjs/stargate';
|
||||
import * as dagCBOR from '@ipld/dag-cbor';
|
||||
import * as dagJSON from '@ipld/dag-json';
|
||||
|
||||
@ -143,4 +143,12 @@ export class Util {
|
||||
gas: String(gas)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gas price in proper format
|
||||
*/
|
||||
static getGasPrice (gasPrice: string | null): GasPrice | undefined {
|
||||
const gasPriceString = gasPrice;
|
||||
return gasPriceString != null ? GasPrice.fromString(String(gasPriceString)) : undefined;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user