-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
**BREAKING**: Fetch and return token image as part of getDetails
calls on ERC721Standard and ERC1155Standard
#702
Conversation
386f39f
to
529638f
Compare
90c459e
to
fb4fa72
Compare
BREAKING: Fetch and return token image as part of
getDetails` calls on ERC721Standard and ERC1155StandardgetDetails
calls on ERC721Standard and ERC1155Standard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Three questions:
- Are the new tests for
getDetails
actually hitting the IPFS gateway? I see you were trying to use Nock to mock some kind of API, perhaps it would be worth doing this for the IPFS gateway? This raises the question of "how should we handle external APIs in tests?" again. - Perhaps tying into 1, is it possible to test the case in which
getDetails
returns a non-nullish value forimage
in the expected set of data? - How are we testing the new change to AssetsContractController where
onPreferencesStateChange
can update the configuration object?
All good callouts. Will add/modify tests to address these concerns. |
fb4fa72
to
ad4599c
Compare
ad4599c
to
cec4496
Compare
standard: 'ERC721', | ||
symbol: 'BAYC', | ||
tokenURI: | ||
'https://bafybeihpjhkeuiq3k6nqa3fkgeigeri7iebtrsuyuey5y6vy36n345xmbi.ipfs.cloudflare-ipfs.com/3', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
image: 'https://card.godsunchained.com/?id=1329&q=4', | ||
}; | ||
}); | ||
|
||
const expectedResult = { | ||
name: 'Gods Unchained', | ||
standard: 'ERC721', | ||
symbol: 'GODS', | ||
tokenURI: 'https://api.godsunchained.com/card/4', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('should update the ipfsGateWay config value when this value is changed in the preferences controller', () => { | ||
expect(assetsContract.config).toStrictEqual({ | ||
ipfsGateway: IPFS_DEFAULT_GATEWAY_URL, | ||
provider: undefined, | ||
}); | ||
|
||
preferences.setIpfsGateway('newIPFSGateWay'); | ||
expect(assetsContract.config).toStrictEqual({ | ||
ipfsGateway: 'newIPFSGateWay', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test new preferences listener updates to controller config values cc @mcmire
For all except the test I added on
cc @mcmire |
…lls on ERC721Standard and ERC1155Standard (MetaMask#702) * Fetch and return token image as part of getDetails call * adapt tests
…lls on ERC721Standard and ERC1155Standard (#702) * Fetch and return token image as part of getDetails call * adapt tests
…lls on ERC721Standard and ERC1155Standard (#702) * Fetch and return token image as part of getDetails call * adapt tests
ADDED:
getDetails
calls on ERC721Standard and ERC1155StandardonPreferencesStateChange
from thePreferencesController
so that it can use the user's preferred IPFSGateway to fetch any images hosted on IPFS. Consumers will have to passonPreferencesStateChange
in an options object (first arg) to the AssetsContractController constructor when initializing.Resolves #689