Skip to content
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

Closed
wants to merge 5 commits into from
Closed

calculate fees #9

wants to merge 5 commits into from

Conversation

pranaybaldev
Copy link
Contributor

@pranaybaldev pranaybaldev commented Feb 28, 2022

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}]

Copy link

@eitjuh eitjuh left a 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'
Copy link

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?

@sschiessl-bcp
Copy link
Contributor

What's the status here?

@pranaybaldev
Copy link
Contributor Author

What's the status here?

It's on hold for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Allow Array of Tx[] as input to fees endpoint feat: Adjust fees endpoint response
3 participants