Merge pull request #357 from public-awesome/wl-merkletree-updates

Display spinner during merkle root hash acquisiton
This commit is contained in:
Serkan Reis 2024-04-04 12:10:24 +03:00 committed by GitHub
commit e26068085d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 9 deletions

View File

@ -223,9 +223,9 @@ export const WhitelistDetails = ({
})
} else if (importedWhitelistDetails.whitelistType === 'merkletree') {
setWhitelistMerkleTreeArray([])
importedWhitelistDetails.members?.forEach((member) => {
setWhitelistMerkleTreeArray((merkleTreeArray) => [...merkleTreeArray, member as string])
})
// importedWhitelistDetails.members?.forEach((member) => {
// setWhitelistMerkleTreeArray((merkleTreeArray) => [...merkleTreeArray, member as string])
// })
} else if (importedWhitelistDetails.whitelistType === 'flex') {
setWhitelistFlexArray([])
importedWhitelistDetails.members?.forEach((member) => {

View File

@ -564,16 +564,24 @@ const CollectionCreationPage: NextPage = () => {
const membersFile = new File([membersBlob], 'members.csv', { type: 'text/csv' })
const formData = new FormData()
formData.append('whitelist', membersFile)
const response = await axios
.post(`${WHITELIST_MERKLE_TREE_API_URL}/create_whitelist`, formData, {
headers: {
'Content-Type': 'multipart/form-data',
const response = await toast
.promise(
axios.post(`${WHITELIST_MERKLE_TREE_API_URL}/create_whitelist`, formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
}),
{
loading: 'Fetching merkle root hash...',
success: 'Merkle root fetched successfully.',
error: 'Error fetching root hash from Whitelist Merkle Tree API.',
},
})
)
.catch((error) => {
console.log('error', error)
throw new Error('Error fetching root hash from Whitelist Merkle Tree API.')
throw new Error('Whitelist instantiation failed.')
})
const rootHash = response.data.root_hash
console.log('rootHash', rootHash)