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: assets #31

Merged
merged 54 commits into from
Aug 24, 2023
Merged

feat: assets #31

merged 54 commits into from
Aug 24, 2023

Conversation

dzbo
Copy link
Collaborator

@dzbo dzbo commented Aug 18, 2023

Ticket ID

DEV-5750
DEV-5751
DEV-5753
DEV-5754

Description

Loading LSP7 and LSP8 assets on wallet dashboard.

@Hugoo
Copy link
Contributor

Hugoo commented Aug 18, 2023

@Hugoo
Copy link
Contributor

Hugoo commented Aug 18, 2023

@Hugoo
Copy link
Contributor

Hugoo commented Aug 18, 2023

@Hugoo
Copy link
Contributor

Hugoo commented Aug 18, 2023

@github-actions
Copy link
Contributor

github-actions bot commented Aug 18, 2023

Deployed with Cloudflare Pages ☁️ 🚀 🆗

Copy link
Contributor

@Hugoo Hugoo left a comment

Choose a reason for hiding this comment

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

wow nice PR!!

It rly makes me think that fetching our data/info is quite hard!

Maybe we rly need a SDK on top of erc725js which abstracts all these calls even more 🤔

const { tokens, assetFilter } = storeToRefs(useProfileStore())
const lyxAsset = computed<Token>(() => {
return {
address: '0x0',
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 0x0 over undefined or null?

Copy link
Contributor

Choose a reason for hiding this comment

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

When i try to use it from the preview URL i see this, might be related?

image

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah now my bad - i think it is a version issue,
image

But maybe still, the 0x0 default / init state should not log an error in the dev console imo

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

address field is required here but since we don't really show it for LYX it's 0x0.

const config = {
ipfsGateway: network.ipfsUrl,
ipfsGateway: currentNetwork.ipfsUrl,
Copy link
Contributor

Choose a reason for hiding this comment

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

why is IPFS related to the network? It should not?

We use the same IPFS for any L14, L16, testnet, mainnet etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it is needed to put the ipfsUrl in the network settings. It is not related.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Alright I will change this. I was thinking that we might want to use different storage per network but I guess I was wrong.

import { LSP3Profile } from '@lukso/lsp-factory.js'
import Web3 from 'web3'
import { LSP4DigitalAssetJSON } from '@lukso/lsp-factory.js/build/main/src/lib/interfaces/lsp4-digital-asset'
Copy link
Contributor

Choose a reason for hiding this comment

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

Im not sure we want to have a "link" here to lsp-factory.js

Im not sure if it is lsp-factory.js 's responsibility to provide these interfaces.

It is very handy, but maybe these interfaces could have a better "home" than lsp-factory.js

@CallumGrindle what do you think?

Copy link
Contributor

@CallumGrindle CallumGrindle Aug 18, 2023

Choose a reason for hiding this comment

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

yeah these typings are handy but it seems overkill to have to import the whole lsp-factory just for metadata types. I think we can move the types + the LSP6 methods + schemas from erc725.js into some kind of lsp utils lib. There isnt loads but there starts to be enough for its own lib

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

idd we use package just for types here. I guess we should have npm package with just typings maybe

const result = await erc725.fetchData(schema)
const assetAddresses = result.value as Address[]
const { profile } = useProfileStore()
console.log(schema, assetAddresses)
Copy link
Contributor

Choose a reason for hiding this comment

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

do you want to keep this console log?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, it was just for debugging

composables/useErc725.ts Show resolved Hide resolved
Comment on lines 178 to 188
if (tokenIdType === TokenIdType.address) {
return lsp8MetadataGetter(
'address',
// ethers.utils.hexDataSlice(tokenId.toString(), 12)
tokenId.toString()
)
} else if (tokenIdType === TokenIdType.number) {
return lsp8MetadataGetter('uint256', parseInt(tokenId).toString())
} else if (tokenIdType === TokenIdType.bytes32) {
return lsp8MetadataGetter('bytes32', tokenId.toString())
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks like a good candidate for a switch case on the tokenIdType variable no?

package.json Show resolved Hide resolved
package.json Show resolved Hide resolved
@@ -0,0 +1,51 @@
[
Copy link
Contributor

Choose a reason for hiding this comment

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

it makes me think wheter or not we should also put this schema here:

https://github.com/ERC725Alliance/erc725.js/tree/develop/schemas

I think yes bc why not?

@CallumGrindle what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah def! Good idea

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I mentioned this a while ago and created ticket as well https://app.clickup.com/t/2645698/DEV-5997

Comment on lines +5 to +7
export const detectStandard = async (
contractAddress: Address
): Promise<InterfaceId | undefined> => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, I didn't know about this function!

@dzbo dzbo merged commit e58e640 into develop Aug 24, 2023
2 checks passed
@dzbo dzbo deleted the feat/lsp7-assets-DEV-5750 branch August 24, 2023 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants