-
Notifications
You must be signed in to change notification settings - Fork 2
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
bridge: transaction functionality #9
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
e03e4af
to
cd11484
Compare
66bb0cb
to
01db6e6
Compare
01db6e6
to
50b6a86
Compare
✅ Deploy Preview for warm-jelly-e126f7 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
50b6a86
to
d0894a0
Compare
d0894a0
to
edec8ff
Compare
4bcc710
to
82e4e25
Compare
edec8ff
to
0a6e560
Compare
82e4e25
to
b90fc69
Compare
0a6e560
to
2626059
Compare
2626059
to
2249eb1
Compare
1886900
to
86c06c7
Compare
86c06c7
to
7f77d26
Compare
7f77d26
to
92808ae
Compare
7352c24
to
2eeda49
Compare
aa36681
to
2329c9b
Compare
2eeda49
to
9e93f57
Compare
2329c9b
to
af3b62d
Compare
9e93f57
to
c9c52ed
Compare
af3b62d
to
1cf9072
Compare
222c8ab
to
e637519
Compare
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.
Looks good! Most things can be spun into another. Feel free to do so as you see fit.
chainId: l1Config.chain.id, | ||
address: l1Config.tokenAddress, | ||
abi: parseAbi([ | ||
"function allowance(address, address) public view returns (uint256)", |
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.
It might be good to move these abis to a constants file in case we ever need to make changes
isSuccess: bridgeToL1IsSuccess, | ||
// error: bridgeToL1Error, | ||
write: bridgeToL1, | ||
} = useContractWrite(bridgeToL1Config); |
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.
It might be good to abstract these to hooks
@@ -20,9 +21,12 @@ export const useEasyWrite = ( | |||
const error = prepareError || writeError; | |||
const isLoading = prepareIsLoading || writeIsLoading; | |||
|
|||
useEffect(() => { | |||
if (writeData?.hash) notify({ hash: writeData?.hash, status }); | |||
}, [notify, writeData?.hash, status]); |
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.
Does this need to be in a useEffect
? Could it be an if statement outside of a useEffect
?
)} | ||
</div> | ||
<div className="mt-5"> | ||
{bridgeTarget === BridgeTarget.L2 |
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.
We can eliminate one class of issues if we prompt the user to switch their chain. Either when they switch are try to bridge while on the wrong chain. I have an example of switching chains in the delegate page pr.
> | ||
Bridge to {target.chain.name} | ||
</button> | ||
{bridgeTarget === BridgeTarget.L2 && needsAllowanceL1 ? ( |
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.
@@ -115,6 +204,7 @@ const Bridge = () => { | |||
defaultValue="" | |||
aria-invalid={isAmountError} | |||
aria-describedby="amount" | |||
onChange={handleInputChange} |
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 input can go negative
? "Transaction succeeded" | ||
: "Transaction pending"} | ||
</p> | ||
<p className="mt-1 text-sm text-gray-500"> | ||
{description} | ||
</p> | ||
<p className="mt-1 text-sm text-gray-500"> | ||
<a href="https://etherscan.io">View on Etherscan</a> | ||
<a href={`https://etherscan.io/tx/${hash}`}> |
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 could be pulled out into a constant
data: bridgeToL1Response, | ||
isLoading: bridgeToL1IsLoading, | ||
isSuccess: bridgeToL1IsSuccess, | ||
// error: bridgeToL1Error, |
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.
Might be good to delete and make an issue for these.
Merge activity
|
e637519
to
c294a17
Compare
No description provided.