Skip to content

Commit

Permalink
Merge pull request #103 from paraswap/fix/by-network-response-to-fixed
Browse files Browse the repository at this point in the history
fix: by-network response to fixed
  • Loading branch information
alexshchur authored Nov 22, 2023
2 parents 43084d2 + e9828e8 commit d58cb93
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/lib/gas-refund/multi-staking-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ type BigNumberByEpochByChain = {
type ComputedAggregatedEpochData = {
transactionsWithClaimable: TransactionWithCaimableByStakeChain[];

refundedByChain: { [chainId: number]: BigNumber };
claimableByChain: { [chainId: number]: BigNumber };
refundedByChain: { [chainId: number]: string };
claimableByChain: { [chainId: number]: string };
};
type ComputeAggregatedStakeChainDetailsResult = {
[epoch: number]: ComputedAggregatedEpochData;
Expand Down Expand Up @@ -203,12 +203,18 @@ export function computeAggregatedStakeChainDetails(
{
transactionsWithClaimable: transactionsWithClaimableByEpoch[epoch],

refundedByChain: refundedByEpochByChain[epoch],
claimableByChain: claimableByEpochByChain[epoch],
refundedByChain: toFixed(refundedByEpochByChain[epoch]),
claimableByChain: toFixed(claimableByEpochByChain[epoch]),
},
];
});
const byEpoch = Object.fromEntries(entries);

return byEpoch;
}


function toFixed<K extends string | number | symbol>(dictionary: Record<K, BigNumber>): Record<K, string> {
const entries = Object.entries<BigNumber>(dictionary).map(([k, v]) => [k, v.toFixed()]);
return Object.fromEntries(entries)
}

0 comments on commit d58cb93

Please sign in to comment.