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

feat: add schemas to display addresses for LSP1 Type Ids #117

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion components/AddressInfos/AddressInfos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ const AddressInfos: React.FC<Props> = ({ assetAddress, userAddress = '' }) => {
);
};

if (assetAddress === null) {
return <span>no address set</span>;
}

return (
<div>
<code className="mr-2">
Expand All @@ -275,7 +279,6 @@ const AddressInfos: React.FC<Props> = ({ assetAddress, userAddress = '' }) => {
</a>
</code>
<AddressTypeBadge text={addressTypeText} isLight={true} />

{renderTags()}
</div>
);
Expand Down
29 changes: 29 additions & 0 deletions components/DataKeysTable/ProfileSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"valueType": "address",
"valueContent": "Address"
},

{
"name": "SupportedStandards:LSP3Profile",
"key": "0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347",
Expand Down Expand Up @@ -47,5 +48,33 @@
"keyType": "Array",
"valueType": "address",
"valueContent": "Address"
},
{
"name": "LSP1UniversalReceiverDelegate:LSP7Tokens_SenderNotification",
"key": "0x0cfc51aec37c55a4d0b10000429ac7a06903dbc9c13dfcb3c9d11df8194581fa",
"keyType": "Mapping",
"valueType": "address",
"valueContent": "Address"
},
{
"name": "LSP1UniversalReceiverDelegate:LSP7Tokens_RecipientNotification",
"key": "0x0cfc51aec37c55a4d0b1000020804611b3e2ea21c480dc465142210acf4a2485",
"keyType": "Mapping",
"valueType": "address",
"valueContent": "Address"
},
{
"name": "LSP1UniversalReceiverDelegate:LSP8Tokens_SenderNotification",
"key": "0x0cfc51aec37c55a4d0b10000b23eae7e6d1564b295b4c3e3be402d9a2f0776c5",
"keyType": "Mapping",
"valueType": "address",
"valueContent": "Address"
},
{
"name": "LSP1UniversalReceiverDelegate:LSP8Tokens_RecipientNotification",
"key": "0x0cfc51aec37c55a4d0b100000b084a55ebf70fd3c06fd755269dac2212c4d3f0",
"keyType": "Mapping",
"valueType": "address",
"valueContent": "Address"
}
]
12 changes: 12 additions & 0 deletions components/ValueTypeDecoder/ValueTypeDecoder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ const ValueTypeDecoder: React.FC<Props> = ({
}, [address, web3, erc725JSONSchema, value]);

try {
if (decodedDataOneKey[0].name.startsWith('LSP1UniversalReceiverDelegate')) {
const badgeContent = decodedDataOneKey[0].value;
Copy link
Member

Choose a reason for hiding this comment

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

badgeContent is the asset's address?

Copy link
Member

Choose a reason for hiding this comment

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

If it's null maybe we should hide AddressButtons?


return (
<>
<code>{value}</code>
<div className="mt-4"></div>
<AddressInfos assetAddress={badgeContent} userAddress={address} />
<AddressButtons address={badgeContent} />
</>
);
}
if (
!decodedDataOneKey[0].name.endsWith('[]') &&
(typeof decodedDataOneKey[0].value === 'string' ||
Expand Down