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

erc721-mint #107

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
tokeUri fix
gelicamarie committed Jun 14, 2022
commit 4c418dd70f862a6f807e5e0aaf5a3afc2d4a1e00
6 changes: 3 additions & 3 deletions apps/ethereum/erc721/components/WriteFunctions/TenantMint.tsx
Original file line number Diff line number Diff line change
@@ -26,13 +26,13 @@ const TenantMint = () => {
const mint = async () => {
try {
const instanceData: {
to: string;
image: File | undefined;
to: string;
} = {
to: receiver,
image: imageFile,
to: receiver,
};

console.log(instanceData)
mutate(instanceData);
} catch (error) {
throw error;

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/hyperverse-evm-erc721/contracts.json
Original file line number Diff line number Diff line change
@@ -15,8 +15,8 @@
},
"ethereum": {
"testnet": {
"contractAddress": "0xC0C76682E65A32e8b56f3a40a1b46dc9B4E3D51C",
"factoryAddress": "0x317C0916563Ecf0752b1DC886Ae92B685bfE6feE"
"contractAddress": "0x01ddA83E8220326408dbbf30e1E28eA8230be0FE",
"factoryAddress": "0x86d00f4818ffF1092A75b8C06D60925B0A200c5d"
},
"mainnet": {}
},
28 changes: 16 additions & 12 deletions packages/hyperverse-evm-erc721/source/erc721Library.ts
Original file line number Diff line number Diff line change
@@ -50,13 +50,26 @@ export async function ERC721LibraryInternal(
}
};

const tenantMint = async ({ to, image }: { to: string; image?: File }) => {
const tenantMint = async ({ to, image }: { image?: File; to: string; }) => {
try {
let mintTxn;

const erc72Name = await base.proxyContract?.name();
if (image) {
const tokenUri = await hyperverse.storage?.uploadFile(image);
mintTxn = await base.proxyContract?.['tenantMint(address string)'](to, tokenUri);
const Metadata = {
image: `https://ipfs.io/ipfs/${tokenUri}`,
name : `${erc72Name}`,
}
const metadataFile = new File([JSON.stringify(Metadata)], 'metadata.json');
const metadataFileLink = await hyperverse!.storage!.uploadFile(
metadataFile
);

mintTxn = await base.proxyContract?.['tenantMint(address,string)'](to, metadataFileLink, {
gasLimit: '1000000'
});



} else {
mintTxn = await base.proxyContract?.['tenantMint(address)'](to);
@@ -68,14 +81,6 @@ export async function ERC721LibraryInternal(
}
};

const tenantMintUri = async ({ to, tokenURI }: { to: string; tokenURI: string }) => {
try {
const mintTxn = await base.proxyContract?.tenantMint(to, tokenURI);
return mintTxn.wait() as TransactionReceipt;
} catch (error) {
throw error;
}
};

const getBaseURI = async () => {
try {
@@ -195,7 +200,6 @@ export async function ERC721LibraryInternal(
mint,
togglePublicMint,
tenantMint,
tenantMintUri,
getBaseURI,
setMintPrice,
setBaseURI,