Skip to content

Conversation

@tremarkley
Copy link
Contributor

@tremarkley tremarkley commented Sep 24, 2025

Closes #139

Description

Add TurnKeyWallet class for supporting Turnkey server wallets

@netlify
Copy link

netlify bot commented Sep 24, 2025

Deploy Preview for verbs-ui ready!

Name Link
🔨 Latest commit b1cb30d
🔍 Latest deploy log https://app.netlify.com/projects/verbs-ui/deploys/68d48bd85850cc0008ee2f47
😎 Deploy Preview https://deploy-preview-137--verbs-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@tremarkley
Copy link
Contributor Author

tremarkley commented Sep 24, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@wiz-inc-a178a98b5d
Copy link

wiz-inc-a178a98b5d bot commented Sep 24, 2025

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Total -

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High Vulnerability Finding on line 0

More Details

Vulnerabilities [axios:1.9.0]

Name Severity Source Fixed version CVSS score CVSS exploitability score Has public exploit Has CISA KEV exploit
CVE-2025-58754 High GHSA-4hjh-wcwx-xvwj 1.12.0 7.5 3.9 false false

To ignore this finding as an exception, reply to this conversation with #wiz_ignore reason

If you'd like to ignore this finding in all future scans, add an exception in the .wiz file (learn more) or create an Ignore Rule (learn more).

Copy link
Contributor Author

@tremarkley tremarkley Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#wiz_ignore this vulnerability is related to a peer dependency which is only installed in the dev build of this library

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The finding has been successfully ignored for these checks.

If you'd like to ignore this finding in all future scans, you can add a matching exception in the .wiz file.
Learn more

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High Vulnerability Finding on line 0

More Details

Vulnerabilities [bigint-buffer:1.1.5]

Name Severity Source Fixed version CVSS score CVSS exploitability score Has public exploit Has CISA KEV exploit
CVE-2025-3194 High GHSA-3gc7-fjrx-p6mg - 7.7 3.9 false false

To ignore this finding as an exception, reply to this conversation with #wiz_ignore reason

If you'd like to ignore this finding in all future scans, add an exception in the .wiz file (learn more) or create an Ignore Rule (learn more).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#wiz_ignore this vulnerability would cause the app server to potentially crash if exploited. the app server is only being used for a demo application and a crash would not impact any production services.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The finding has been successfully ignored for these checks.

If you'd like to ignore this finding in all future scans, you can add a matching exception in the .wiz file.
Learn more

@tremarkley tremarkley force-pushed the harry/node_turnkey branch 3 times, most recently from a09ba09 to dcdfe34 Compare September 25, 2025 00:21
@tremarkley tremarkley marked this pull request as ready for review September 25, 2025 00:24
@tremarkley tremarkley requested a review from a team as a code owner September 25, 2025 00:24
@tremarkley tremarkley changed the title feat: Turnkey server side wallets feat: Add support for Turnkey server wallets Sep 25, 2025
@tremarkley tremarkley changed the title feat: Add support for Turnkey server wallets feat: add support for Turnkey server wallets Sep 25, 2025
@tremarkley tremarkley removed the request for review from fahimsachedina September 25, 2025 00:42
* @returns Promise resolving to a Verbs-compatible wallet instance
*/
async toVerbsWallet(
params: TurnkeyHostedWalletToVerbsWalletOptions,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been avoiding using this params attr, but I think it actually makes sense. I'll probably switch LendProvider functions to use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I'm in general a fan of using param types, I find it more readable and ergonomic

/**
* Turnkey organization ID that owns the signing key
*/
private readonly organizationId: string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Will this ever change from wallet to wallet? If not, should it live at an abstraction above the wallet instance, like the VerbsConfig?

Copy link
Contributor Author

@tremarkley tremarkley Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, so looking at the turnkey docs, it is possible that all wallets could be under the same organizationId, but they also have support for each wallet being in its own sub-organization, which would mean a different organizationId per wallet. Here is more info: https://docs.turnkey.com/embedded-wallets/sub-organizations-as-wallets.

Given this I think it makes sense to abstract this at the wallet-level for now and we can always pull it into a higher level later if we find this is a big point of friction, but at least this design supports both use-cases (ie wallets as sub-organizations or all wallets under same organization)

}) {
const { chainManager, client, organizationId, signWith, ethereumAddress } =
params
super(chainManager)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I know this isn't new to this class, but I've wondered if the ChainManager needs to be passed through every instance of everything, or if it can live at an abstraction above? Thinking out loud, I'm not sure what that would look like, but like supported assets and supported networks, it's not something that will change from wallet to wallet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even though ChainManager doesnt change from wallet to wallet, it does change for each Verbs instance and the wallet needs a way to access it. Right now we've opted for accessing it through dependency injection, which has it's tradeoffs, but the only other way we could potentially access it is through a global variable, which might make things more difficult to test and harder to trace. Let me know if there is another way you were thinking though or if you think a global variable would be preferred here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having thought through it a bit more, I think this is totally fine. Global state gets dangerous and passing around a single dependency is very manageable.

I’m imaging a future where additional context providers are added to verbs that allow the dev to overwrite functionality like:

  • ChainExplorerProvider: overwrite all receipt urls with blockscout or etherscan
  • TransactionSimulationProvider: overwrite all wallet.action.quote functions with tenderly or alchemy simulations

If we get to that world, we might pull these dependencies into a shared context provider registry and pass that single object around, but that's well into the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense! if we get to a point where providers are coupled, I could see combining them making sense

Copy link
Collaborator

@its-everdred its-everdred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some ❓s but looks good

@tremarkley tremarkley merged commit 7d75e23 into main Sep 25, 2025
10 checks passed
@tremarkley tremarkley deleted the harry/node_turnkey branch September 25, 2025 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wallet adapter for Turnkey server wallets

3 participants