-
Notifications
You must be signed in to change notification settings - Fork 43
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
Support Coinbase Smart Wallet #245
base: main
Are you sure you want to change the base?
Conversation
|
683436d
to
d432512
Compare
FYI this is the test suite that I have in our Rainmaker repo, I've just pulled it out as a snippet because I wasn't sure where this belongs in your codebase. Note that I have some test PKs that I pulled out (they'll need to be put back in), encoded data tests will have to change too.
|
Legend I've been waiting for this 🙏 plz merge asap |
ty |
whoa thank you @cstoneham !!!!! merge merge merge |
export const COINBASE_SMART_WALLET_FACTORY_ADDRESS = | ||
"0x0BA5ED0c6AA8c49038F819E587E2633c4A9F428a" | ||
|
||
export const ERC1271InputGeneratorByteCode = |
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've actually moved away from using this in favor of just manually computing the replaySafeHash. Will try to share code
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.
yeah would love to see how you guys do that, thanks
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.
Here you go:
import { hashTypedData, type Address, type Hash } from 'viem'
function replaySafeHash({
address,
chainId,
hash,
}: { address: Address; chainId: number; hash: Hash }) {
return hashTypedData({
domain: {
chainId,
name: 'Coinbase Smart Wallet',
verifyingContract: address,
version: '1',
},
types: {
CoinbaseSmartWalletMessage: [
{
name: 'hash',
type: 'bytes32',
},
],
},
primaryType: 'CoinbaseSmartWalletMessage',
message: {
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.
thanks, works.
@wilsoncusack I notice that I'll sometimes get:
have you seen this before? I assume there's some hex padding or something that needs to be done. more specifically the |
@cstoneham – that may be a small bug (or inconsistency rather) in Viem. Can you try |
Confirmed that this version fixes the issue, thanks @jxom. What was the problem? |
Released! We needed to pad the signature properties to 32 bytes to conform with |
thanks @jxom, so fast! when do you think the next patch version might be released (2.17.6)? |
Released on 2.17.7 |
thanks for your help @jxom @wilsoncusack, think this is ready for another review. |
@kristofgazso thoughts on this? |
Thank you @cstoneham let me check this today. I will be updating this branch and merging this with #265 so that it's part of the 0.2 release. |
Hey I had a few question:
|
Also in v0.2 we are using Viem's account-abstraction methods and viem already had coin base implementation at toCoinbaseSmartAccount I am not sure permissionless also need to host the implementation again. |
Adds support for Coinbase Smart Wallet.
Working
Not working
References
https://github.com/wilsoncusack/scw-tx
https://github.com/coinbase/smart-wallet