Skip to content

Commit f0a37e6

Browse files
authored
Merge branch 'main' into release-0.20.0
2 parents 6a9a7e0 + 1d889cd commit f0a37e6

File tree

7 files changed

+46
-15
lines changed

7 files changed

+46
-15
lines changed

.github/ISSUE_TEMPLATE/BUG.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ body:
5252
description: What version of the extension are you running?
5353
options:
5454
- v0.20.0
55+
- v0.19.3
5556
- v0.19.2
5657
- v0.19.1
5758
- v0.19.0

background/lib/poap_update.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import logger from "./logger"
33
import { ETHEREUM } from "../constants"
44
import { NFT, NFTCollection, NFTsWithPagesResponse } from "../nfts"
55

6-
export const POAP_CONTRACT = "poap_contract"
6+
export const POAP_CONTRACT = "0x22C1f6050E56d2876009903609a2cC3fEf83B415" // POAP contract address https://etherscan.io/address/0x22C1f6050E56d2876009903609a2cC3fEf83B415
77
export const POAP_COLLECTION_ID = "POAP"
88

99
type PoapNFTModel = {
@@ -39,6 +39,7 @@ function poapNFTModelToNFT(original: PoapNFTModel, owner: string): NFT {
3939
country,
4040
city,
4141
year,
42+
supply,
4243
},
4344
} = original
4445
return {
@@ -58,6 +59,7 @@ function poapNFTModelToNFT(original: PoapNFTModel, owner: string): NFT {
5859
contract: POAP_CONTRACT, // contract address doesn't make sense for POAPs
5960
owner,
6061
network: ETHEREUM,
62+
supply,
6163
isBadge: true,
6264
}
6365
}

background/nfts.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ export type NFT = {
5454
contract: string
5555
owner: string
5656
network: EVMNetwork
57-
isBadge: boolean
57+
supply?: number // only for POAPs
58+
isBadge: boolean // POAPs, Galxe NFTs and OATs
5859
}
5960

6061
export type NFTCollection = {

background/redux-slices/accounts.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const enum AccountType {
2929
Internal = "internal",
3030
}
3131

32-
const availableDefaultNames = [
32+
export const DEFAULT_ACCOUNT_NAMES = [
3333
"Phoenix",
3434
"Matilda",
3535
"Sirius",
@@ -40,6 +40,8 @@ const availableDefaultNames = [
4040
"Foz",
4141
]
4242

43+
const availableDefaultNames = [...DEFAULT_ACCOUNT_NAMES]
44+
4345
export type AccountData = {
4446
address: HexString
4547
network: Network

background/redux-slices/selectors/accountsSelectors.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { createSelector } from "@reduxjs/toolkit"
22
import { selectHideDust } from "../ui"
33
import { RootState } from ".."
4-
import { AccountType, CompleteAssetAmount } from "../accounts"
4+
import {
5+
AccountType,
6+
DEFAULT_ACCOUNT_NAMES,
7+
CompleteAssetAmount,
8+
} from "../accounts"
59
import { AssetsState, selectAssetPricePoint } from "../assets"
610
import {
711
enrichAssetAmountWithDecimalValues,
@@ -519,6 +523,17 @@ export const getAccountTotal = (
519523
accountAddressOnNetwork
520524
)
521525

526+
export const getAccountNameOnChain = (
527+
state: RootState,
528+
accountAddressOnNetwork: AddressOnNetwork
529+
): string | undefined => {
530+
const account = getAccountTotal(state, accountAddressOnNetwork)
531+
532+
return account?.name && !DEFAULT_ACCOUNT_NAMES.includes(account.name)
533+
? account.name
534+
: undefined
535+
}
536+
522537
export const selectCurrentAccountTotal = createSelector(
523538
selectCurrentNetworkAccountTotalsByCategory,
524539
selectCurrentAccount,

ui/components/NFTS_update/NFTPreview.tsx

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { FeatureFlags, isEnabled } from "@tallyho/tally-background/features"
2-
import {
3-
isProbablyEVMAddress,
4-
truncateAddress,
5-
} from "@tallyho/tally-background/lib/utils"
62
import { NFTWithCollection } from "@tallyho/tally-background/redux-slices/nfts_update"
3+
import { getAccountNameOnChain } from "@tallyho/tally-background/redux-slices/selectors"
74
import React, { ReactElement, useMemo } from "react"
85
import { useTranslation } from "react-i18next"
9-
import { useIntersectionObserver } from "../../hooks"
6+
import { useBackgroundSelector, useIntersectionObserver } from "../../hooks"
107
import { trimWithEllipsis } from "../../utils/textUtils"
8+
import SharedAddress from "../Shared/SharedAddress"
119
import SharedButton from "../Shared/SharedButton"
1210
import SharedNetworkIcon from "../Shared/SharedNetworkIcon"
1311
import ExploreMarketLink, { getRelevantMarketsList } from "./ExploreMarketLink"
@@ -38,6 +36,7 @@ export default function NFTPreview(props: NFTWithCollection): ReactElement {
3836
owner,
3937
description,
4038
attributes,
39+
supply,
4140
isBadge,
4241
} = nft
4342
const { totalNftCount } = collection
@@ -46,6 +45,10 @@ export default function NFTPreview(props: NFTWithCollection): ReactElement {
4645
collection.floorPrice?.value !== undefined &&
4746
collection.floorPrice
4847

48+
const ownerName = useBackgroundSelector((state) =>
49+
getAccountNameOnChain(state, { address: owner, network })
50+
)
51+
4952
// Chrome seems to have problems when elements with backdrop style are rendered initially
5053
// out of the viewport - browser is not rendering them at all. This is a workaround
5154
// to force them to rerender.
@@ -87,10 +90,10 @@ export default function NFTPreview(props: NFTWithCollection): ReactElement {
8790
{t("preview.owner")}
8891
</span>
8992
<span className="preview_details_value">
90-
{truncateAddress(owner)}
93+
<SharedAddress address={owner} name={ownerName} elide />
9194
</span>
9295
</div>
93-
<div className="preview_section_column align_right">
96+
<div className="preview_section_column align_right no_shrink">
9497
<span className="preview_details_header">
9598
{t("preview.floorPrice")}
9699
</span>
@@ -153,13 +156,15 @@ export default function NFTPreview(props: NFTWithCollection): ReactElement {
153156
<div className="preview_section_header">
154157
{t("preview.itemsCount")}
155158
</div>
156-
<p>{totalNftCount ?? "-"}</p>
159+
<p>{totalNftCount ?? supply ?? "-"}</p>
157160
</div>
158161
<div className="preview_section_column align_right">
159162
<div className="preview_section_header">{t("preview.creator")}</div>
160-
<p>
161-
{isProbablyEVMAddress(contract) ? truncateAddress(contract) : "-"}
162-
</p>
163+
{contract?.length ? (
164+
<SharedAddress address={contract} elide />
165+
) : (
166+
"-"
167+
)}
163168
</div>
164169
</div>
165170

@@ -261,6 +266,7 @@ export default function NFTPreview(props: NFTWithCollection): ReactElement {
261266
.preview_section_column {
262267
display: flex;
263268
flex-direction: column;
269+
min-width: 0;
264270
}
265271
.preview_section_row {
266272
display: flex;
@@ -309,6 +315,9 @@ export default function NFTPreview(props: NFTWithCollection): ReactElement {
309315
gap: 16px;
310316
justify-content: flex-start;
311317
}
318+
.no_shrink {
319+
flex-shrink: 0;
320+
}
312321
`}</style>
313322
</>
314323
)

ui/components/Shared/SharedAddress.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export default function SharedAddress({
7474
<style jsx>{`
7575
button {
7676
transition: 300ms color;
77+
max-width: 100%;
7778
}
7879
button :last-child {
7980
top: 3px;

0 commit comments

Comments
 (0)