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

fix(feeByEvent): sanitize fee for hex values #990

Merged
merged 2 commits into from
Jul 27, 2022
Merged

Conversation

TarikGul
Copy link
Member

closes: #989

When a fee is represented as a hex value, sanitize the fee correctly.

@TarikGul TarikGul requested a review from a team as a code owner July 20, 2022 19:28
@TarikGul TarikGul self-assigned this Jul 20, 2022
@@ -532,7 +532,9 @@ export class BlocksService extends AbstractService {
if (withdrawEvent.length > 0 && withdrawEvent[0].data) {
const dataArr = withdrawEvent[0].data.toJSON();
if (Array.isArray(dataArr)) {
const fee = (dataArr as Array<number>)[dataArr.length - 1];
const fee = this.sanitizeFee(
(dataArr as Array<string>)[dataArr.length - 1]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the shape change here or do we want to have it seen as string for the sanitizeFee/isHex call?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the shape was inaccurately type casted for fees (technically number or string work here for BN.js but I changed it to its proper type to be more accurate). The type returned from .toJSON() should be a string, because any u128/u64 value interpreted by polkadot-js will be returned as a string.

@TarikGul TarikGul merged commit 3f9a2c3 into master Jul 27, 2022
@TarikGul TarikGul deleted the tarik-santize-fee branch July 27, 2022 14:46
This pull request was closed.
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.

get Shiden 1500094 fee failed
4 participants