Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
da90738b
Unverified
Commit
da90738b
authored
Jul 14, 2023
by
Charles Bachmeier
Committed by
GitHub
Jul 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Handle Scientific Notation for NFT Collection Activity Prices (#6936)
wrap nft activity price in
parent
e4dbef80
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
NftActivity.ts
src/graphql/data/nft/NftActivity.ts
+2
-1
currency.ts
src/nft/utils/currency.ts
+4
-5
No files found.
src/graphql/data/nft/NftActivity.ts
View file @
da90738b
import
{
WatchQueryFetchPolicy
}
from
'
@apollo/client
'
import
gql
from
'
graphql-tag
'
import
{
ActivityEvent
}
from
'
nft/types
'
import
{
wrapScientificNotation
}
from
'
nft/utils
'
import
{
useCallback
,
useMemo
}
from
'
react
'
import
{
NftActivityFilterInput
,
useNftActivityQuery
}
from
'
../__generated__/types-and-hooks
'
...
...
@@ -120,7 +121,7 @@ export function useNftActivity(filter: NftActivityFilterInput, first?: number, f
toAddress
:
activity
.
toAddress
,
transactionHash
:
activity
.
transactionHash
,
orderStatus
:
activity
.
orderStatus
,
price
:
activity
.
price
?.
value
.
toString
(
),
price
:
wrapScientificNotation
(
activity
.
price
?.
value
),
symbol
:
asset
?.
collection
?.
image
?.
url
,
quantity
:
activity
.
quantity
,
url
:
activity
.
url
,
...
...
src/nft/utils/currency.ts
View file @
da90738b
...
...
@@ -75,9 +75,8 @@ export const formatWeiToDecimal = (amount: string, removeZeroes = false) => {
}
// prevent BigNumber overflow by properly handling scientific notation and comma delimited values
export
function
wrapScientificNotation
(
value
:
string
|
number
):
string
{
return
parseFloat
(
value
.
toString
())
.
toLocaleString
(
'
fullwide
'
,
{
useGrouping
:
false
})
.
replace
(
'
,
'
,
'
.
'
)
.
replace
(
'
'
,
''
)
export
function
wrapScientificNotation
(
value
?:
string
|
number
):
string
{
return
value
?
parseFloat
(
value
.
toString
()).
toLocaleString
(
'
fullwide
'
,
{
useGrouping
:
false
}).
replace
(
'
,
'
,
'
.
'
).
replace
(
'
'
,
''
)
:
''
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment