Add helper methods to parse gas, fees and gasPrice #29
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 { sha256 as hasher } from 'multiformats/hashes/sha2';
|
||||||
import assert from 'assert';
|
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 dagCBOR from '@ipld/dag-cbor';
|
||||||
import * as dagJSON from '@ipld/dag-json';
|
import * as dagJSON from '@ipld/dag-json';
|
||||||
|
|
||||||
@ -143,4 +143,12 @@ export class Util {
|
|||||||
gas: String(gas)
|
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