-
Notifications
You must be signed in to change notification settings - Fork 542
[SDK] Feature: Adds deploySmartAccount
and re-adds 1271 signatures
#5845
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
Merged
gregfromstl
merged 4 commits into
main
from
greg/tool-2837-sdk-smart-accounts-use-6492-even-when-already-deployed
Jan 7, 2025
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f4678cd
fix: Adds 1271 signatures and force deployment function
gregfromstl ce0a301
Merge branch 'main' into greg/tool-2837-sdk-smart-accounts-use-6492-e…
gregfromstl 7846be4
fix(sdk): ox cjs imports
gregfromstl 720f290
fix(sdk): smart account transactions on non-original chain
gregfromstl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
"thirdweb": minor | ||
--- | ||
|
||
Feature: Adds `deploySmartAccount` function to force the deployment of a smart account. | ||
|
||
```ts | ||
const account = await deploySmartAccount({ | ||
smartAccount, | ||
chain, | ||
client, | ||
accountContract, | ||
}); | ||
``` | ||
|
||
Fix: Uses 1271 signatures if the smart account is already deployed. |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,8 +129,7 @@ export async function verifyHash({ | |
try { | ||
const result = await eth_call(rpcRequest, verificationData); | ||
return hexToBool(result); | ||
} catch (err) { | ||
console.error("Error verifying ERC-6492 signature", err); | ||
} catch { | ||
// Some chains do not support the eth_call simulation and will fail, so we fall back to regular EIP1271 validation | ||
const validEip1271 = await verifyEip1271Signature({ | ||
hash, | ||
|
@@ -154,7 +153,7 @@ export async function verifyHash({ | |
} | ||
|
||
const EIP_1271_MAGIC_VALUE = "0x1626ba7e"; | ||
async function verifyEip1271Signature({ | ||
export async function verifyEip1271Signature({ | ||
hash, | ||
signature, | ||
contract, | ||
|
@@ -163,10 +162,14 @@ async function verifyEip1271Signature({ | |
signature: Hex; | ||
contract: ThirdwebContract; | ||
}): Promise<boolean> { | ||
const result = await isValidSignature({ | ||
hash, | ||
signature, | ||
contract, | ||
}); | ||
return result === EIP_1271_MAGIC_VALUE; | ||
try { | ||
const result = await isValidSignature({ | ||
hash, | ||
signature, | ||
contract, | ||
}); | ||
return result === EIP_1271_MAGIC_VALUE; | ||
} catch { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generally really want to log something for the dev to understand why the sig was not valid, same with the catch above |
||
return false; | ||
} | ||
} |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 was the actual issue here?
6492 should automatically use 1271 if the account is already deployed, the deployed check happens inside the universal validator contract.
We shouldn't need to force it manually ever