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

Custom network + IPFS support #616

Merged
merged 76 commits into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from 73 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
c554b15
Add package human-standard-multi-collectible-abi
Oct 14, 2021
f3a2dec
Get NFT standard from OpenSea
Oct 14, 2021
a240a1e
Add ERC1155 standard class
Oct 15, 2021
e63cfc3
Add ERC721 standard class
Oct 15, 2021
9b7f086
Update AssetContract controller
Oct 15, 2021
a0ee10e
Update tests
Oct 15, 2021
ec7aaac
Update AssetsContractController test
Oct 17, 2021
862fe90
Update method names
Oct 17, 2021
626a025
Update method names
Oct 17, 2021
909d63c
Update standard params
Oct 17, 2021
a713b59
Update standard tests
Oct 17, 2021
b9e6c94
Change variable name
Oct 17, 2021
fac7f5c
Change variable name
Oct 17, 2021
2dd05eb
Change variable name
Oct 17, 2021
5282b7a
Update AssetsContractController methods
Oct 18, 2021
c224f72
Add method to verify collectible ownership
Oct 18, 2021
d08cf1f
Update CollectiblesController tests
Oct 18, 2021
ffe7983
Nit
Oct 18, 2021
b8331d7
Update test
Oct 18, 2021
3c57e51
Update tests
Oct 18, 2021
87fc46a
Change tokenId from number to string
Oct 19, 2021
5363bed
Update method name
Oct 19, 2021
68af6da
Update comments
Oct 19, 2021
3efc2c3
Update tests
Oct 19, 2021
cfafaf0
Update tests
Oct 19, 2021
2a265fd
feat(AddCustomCollectible): Update version
Oct 19, 2021
b62753f
feat(ERC1155): Update smart contract methods.
Oct 21, 2021
7fc748c
feat(ERC1155): Update standard
Oct 23, 2021
a899204
feat(ERC1155): Update standard
Oct 23, 2021
a79126f
feat(ERC1155): Get collection from OpenSea
Oct 25, 2021
324ef91
feat(ERC1155): Get collection from OpenSea
Oct 25, 2021
b240cd6
Merge branch 'feat/erc1155' of https://github.com/MetaMask/controller…
Oct 25, 2021
1663dc5
feat(NFTuri): Change query order
Oct 25, 2021
8b4d565
Throw error if erc721 contract extension isn't supported
Oct 25, 2021
83fdf12
Change query order
Oct 25, 2021
a2866f6
Fix version
Oct 25, 2021
4d9d8bc
Fix version
Oct 25, 2021
c09a4a1
Remove comments
Oct 25, 2021
204ba1d
Remove comments
Oct 25, 2021
d223a97
Add TODO comments
Oct 25, 2021
d9eb48b
Update ERC1155 uri compliance
Oct 25, 2021
d431323
Update tests
Oct 26, 2021
92f47f2
Update object creations
Oct 26, 2021
ad2cdcc
Handle ipfs urls
Oct 26, 2021
fbf67c4
Update util tests
Oct 26, 2021
fcbb8f6
Update assetUtils test
Oct 26, 2021
4f9cda5
Remove logs
Oct 26, 2021
151c8c0
Update condition
Oct 26, 2021
8aa6b77
Update collectibles tests
Oct 26, 2021
8d343f6
Update tests
Oct 26, 2021
7c9b8b1
Add method to get token standard
Oct 27, 2021
7d27391
Merge branch 'feat/erc1155' of https://github.com/MetaMask/controller…
Oct 27, 2021
57e3623
Add rinkeby network id as constant
Oct 27, 2021
fd3f5cf
Update interface structure
Oct 28, 2021
b9974c3
Update testing
Oct 28, 2021
5bdb719
Clean tests
Oct 28, 2021
fa3a558
Remove logs
Oct 28, 2021
36e50e3
Add standard to CollectibleMetadata object
Oct 28, 2021
078d9c6
Clean tests
Oct 28, 2021
2370a31
Update constant name
Oct 28, 2021
672e00e
Clean tests
Oct 28, 2021
48e094c
Remove standard from object
Oct 28, 2021
8172299
Merge branch 'feat/erc1155' of https://github.com/MetaMask/controller…
Oct 28, 2021
9d79d1a
Update tests
Oct 28, 2021
208ee4d
Clean tests
Oct 28, 2021
60fa910
Merge branch 'main' of https://github.com/MetaMask/controllers into f…
Oct 28, 2021
ed3824a
Solve test errors
Oct 28, 2021
e9b9e7e
Solve test errors
Oct 28, 2021
ca4963f
Merge branch 'main' into feat/nfts-uri
Oct 28, 2021
daa9662
Update error message
Oct 28, 2021
e098084
Update error message
Oct 28, 2021
739fb38
Update test
Oct 28, 2021
6d577c3
Update CollectiblesController test
Oct 28, 2021
a11a57a
Add EIP1155 metadata URI ID substition comment and reference
wachunei Oct 28, 2021
6115134
Remove comment
Oct 28, 2021
975b435
Update method access
Oct 29, 2021
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
16 changes: 10 additions & 6 deletions src/assets/AssetsContractController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,17 @@ describe('AssetsContractController', () => {
expect(tokenId).toStrictEqual('https://api.godsunchained.com/card/0');
});

it('should return empty string as URI when address given is not an ERC-721 collectible', async () => {
it('should throw an error when address given is not an ERC-721 collectible', async () => {
assetsContract.configure({ provider: MAINNET_PROVIDER });
const tokenId = await assetsContract.getCollectibleTokenURI(
'0x0000000000000000000000000000000000000000',
'0',
);
expect(tokenId).toStrictEqual('');
const result = async () => {
await assetsContract.getCollectibleTokenURI(
'0x0000000000000000000000000000000000000000',
'0',
);
};

const error = 'Contract does not support ERC721 metadata interface.';
await expect(result).rejects.toThrow(error);
});

it('should get ERC-721 collectible name', async () => {
Expand Down
2 changes: 2 additions & 0 deletions src/assets/AssetsDetectionController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ describe('AssetsDetectionController', () => {
description: 'Description 2573',
image: 'image/2573.png',
name: 'ID 2573',
standard: 'ERC721',
},
);
await assetsDetection.detectCollectibles();
Expand All @@ -456,6 +457,7 @@ describe('AssetsDetectionController', () => {
description: 'Description 2573',
image: 'image/2573.png',
name: 'ID 2573',
standard: 'ERC721',
tokenId: '2573',
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/assets/CollectibleStandards/ERC721/ERC721Standard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class ERC721Standard {
contract,
);
if (!supportsMetadata) {
return '';
throw new Error('Contract does not support ERC721 metadata interface.');
}
return new Promise<string>((resolve, reject) => {
contract.tokenURI(tokenId, (error: Error, result: string) => {
Expand Down
Loading