Last active
January 26, 2022 22:41
-
-
Save nenadjaja/94389ea38964106d851507798b7f0eec to your computer and use it in GitHub Desktop.
Approval in components
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Components | |
----------- | |
1. Check for allowance (ethereum address, contract) | |
3. Compare with amount in input field | |
2. Approval buttons - render correct states | |
3. Approval logic (contract address, amount) | |
4. Step 2 button as well | |
type Props = { | |
ethereumAddress, | |
amount, | |
contractGRT, | |
otherContract, | |
button2Copy # step 2 button copy | |
} | |
// allowance | |
otherContract.allowance(ethereumAddress) | |
// approval | |
contractGRT(amount, otherContract) | |
// handleSubmit - passed from props | |
props.handleSubmit() | |
// States | |
1. Enabled: infinite + partial | |
2. Pending: 3 dots | |
3. Success: infinite + partial (amount) | |
4. Failed: red button | |
useEffeect(() => { | |
}, [amount]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment