-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
calculate fees #9
Conversation
Use enum gaspricelevel instead of hardcoded string
import types
…r/fee-req-res-type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Building this results in errors:
src/routes/fees.ts:13:30 - error TS2495: Type '{ gasPriceLevel: GasPriceLevel; tx: any; }' is not an array type or a string type.
13 for (const feesRequest of request.body){
~~~~~~~~~~~~
src/routes/fees.ts:23:15 - error TS2345: Argument of type 'any[]' is not assignable to parameter of type '{ gasUsed: string; fee: StaticArray<TObject<{ denom: TString; amount: TString; }>>; totalUSD: number; }'.
Type 'any[]' is missing the following properties from type '{ gasUsed: string; fee: StaticArray<TObject<{ denom: TString; amount: TString; }>>; totalUSD: number; }': gasUsed, fee, totalUSD
23 reply.send(response)
~~~~~~~~
Found 2 errors.
import EmerisSigner from '@emeris/signer'; | ||
import emerisMapper from '@emeris/mapper'; | ||
import { AminoMsg } from "@cosmjs/amino"; | ||
import ChainConfig from "../chainConfig"; | ||
import FeeService from '../services/fees.service' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename the file to feeService so it matches with the class and all the other files?
What's the status here? |
It's on hold for now. |
closes: #6, closes: #8
Prerequisite: publishing EmerisHQ/emeris-libraries#48
Approx calculations:
57135 * 0.03 (high) = 1714.05
1714.05 * 26 (atom) = 44565 ~ (0.04 * 10^6)
Req used for testing. (Change the port in the curl) -
No gasPriceLevel, all 3 levels (low, average, high)
Response:
[{"gasUsed":"57135","fee":[{"denom":"uatom","amount":"571.35"}],"totalUSD":0.015664},{"gasUsed":"57135","fee":[{"denom":"uatom","amount":"285.675"}],"totalUSD":0.00783},{"gasUsed":"57135","fee":[{"denom":"uatom","amount":"1714.05"}],"totalUSD":0.046982},{"gasUsed":"57135","fee":[{"denom":"uatom","amount":"571.35"}],"totalUSD":0.015661},{"gasUsed":"57135","fee":[{"denom":"uatom","amount":"1714.05"}],"totalUSD":0.046982}]