-
Notifications
You must be signed in to change notification settings - Fork 3
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] Wire up create font project submit button to the backend and smart contract apis #11
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Awesome as always JP, reading your code is like going to school, a lot of learning, you really are a master of your craft!
} catch(err) { | ||
console.log(err); | ||
} | ||
} |
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.
I'll take this as example for the user :) Does make sense to have these files:
createIPFontsUser.js
editIPFontsUser.js
createLensUser.js
(just in testnet)editLensUser.js
And condition them according to how the user has been authenticated
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.
Nice yeah makes sense 😃
functionName: 'addressToUser', | ||
args: [lensAddress] | ||
}); | ||
const { createdAt } = await getIPFontsUser(address); | ||
|
||
const isRegistered = !ethers.BigNumber.from(createdAt).isZero; | ||
|
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.
This file is related to the part I'm testing, didn't modify it (but I used parts of it) to avoid merging stashing, but my plan is to refactor some of the logic I'm using in the form here, does that make sense?
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.
cool yeah makes sense to me 👍
|
||
export default function Submit() { | ||
const { activeStepIndex, setActiveStepIndex, formData, setFormData } = | ||
useContext(FormContext); | ||
const { address, isConnected } = useAccount(); |
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.
Haven't seen this before, looks smart!
perCharacterMintPrice: formData.setPrice, | ||
mintLimit: formData.minLimit | ||
}); | ||
} |
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.
This file really got cleaned 💯 sweet!
return res.status(401).json({ message: 'You have to sign-in first' }); | ||
} | ||
|
||
return await storeFontMetadata(req, res); |
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.
What do you think about making a generic storeMetadata
method instead storeFontMetadata
and using it for both, lens and user, maybe add a string parameter that makes custom messages "Error uploading ${type} metadata"
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.
ah yeah good call 👍 Let me update in a follow up PR. The type variable could be a param passed in the request body
}); | ||
|
||
return result.cid.toString(); | ||
} |
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.
Already used this file for the user :) thanks a lot JP
This change wires up the create font project submit button to the backend and smart contract apis so that the create font project wizard works end to end. The following changes where made as part of this work...
/api/upload-metadata
endpoint for uploading smart contract entity metadata to IPFS using Infura IPFS nodecreateIPFontProject
client api util function which takes care of making backend calls to upload font files and font project metadata json to IPFS along with making thecreateFontProject
in our smart contractAfter this change all metadata json uploads will be done through our Infura IPFS node and actual font files will be uploaded to IPFS using web3.storage. web3.storage does not pin our metadata files quick enough for our graph subgraph to pick up the files during indexing leading to null data in our subgraph queries. Thanks @hyperalchemy for the heads up on this 🙌 😃