Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
fix : remove toHuman() & commaStrToBigInt()
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyji-dev committed Jul 8, 2024
1 parent b44464d commit 8b229d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,9 @@ export const claimedReward = async (
let claimedReward = BigInt('0');

extrinsicEvents.map((e, idx) => {

Check failure on line 293 in packages/sdk-core/src/modules/dapp-staking/pending-rewards/index.ts

View workflow job for this annotation

GitHub Actions / Build Code (18.x)

Parameter 'e' implicitly has an 'any' type.

Check failure on line 293 in packages/sdk-core/src/modules/dapp-staking/pending-rewards/index.ts

View workflow job for this annotation

GitHub Actions / Build Code (18.x)

Parameter 'idx' implicitly has an 'any' type.
console.log(e.toHuman(), idx);
if ((e.toHuman()?.event?.method === methodRwd || e.toHuman()?.event?.method === methodBns) &&
e.toHuman()?.event?.section === section) {
const tmpAmount = e.toHuman().event?.data?.amount;
const tmpAmountBigInt = commaStrToBigInt(tmpAmount);

claimedReward += tmpAmountBigInt;
if ((e.event?.method === methodRwd || e.event?.method === methodBns) &&
e.event?.section === section) {
claimedReward += e.event?.data?.amount;
}
});

Expand Down Expand Up @@ -344,12 +340,9 @@ export const UsedFee = async (
let usedFee = BigInt('0');

extrinsicEvents.map((e) => {

Check failure on line 342 in packages/sdk-core/src/modules/dapp-staking/pending-rewards/index.ts

View workflow job for this annotation

GitHub Actions / Build Code (18.x)

Parameter 'e' implicitly has an 'any' type.
if (e.toHuman()?.event?.method === method &&
e.toHuman()?.event?.section === section) {
const tmpUsedFee = e.toHuman().event?.data?.actualFee;
const tmpUsedFeeBigInt = commaStrToBigInt(tmpUsedFee);

usedFee = tmpUsedFeeBigInt;
if (e.event?.method === method &&
e.event?.section === section) {
usedFee = e.event?.data?.actualFee;
}
});

Expand Down
18 changes: 0 additions & 18 deletions packages/sdk-core/src/modules/units/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,3 @@ export const formatNumber = (value: number, digits: number): string => {

return item ? (value / item.value).toFixed(digits).replace(rx, '$1') + item.symbol : '0';
};


export function commaStrToBigInt(_str: string) {

let _strToStr = String(_str);

let _noCommaStr = _strToStr.replace(/,/g, '');

let rlt = BigInt("0");

if (_noCommaStr === "undefined") {
console.log(' _noCommaStr :undefined ');
} else {
rlt = BigInt(_noCommaStr);
}

return rlt;
}

0 comments on commit 8b229d5

Please sign in to comment.