Skip to content

[SDK] Feat: Add engineAccount() for backend transaction handling #5947

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

Conversation

joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Jan 14, 2025

Fixes: TOOL-3057

Notes for the reviewer

Requires new env variables for testing, see .env.example

How to test

Add env variables, run engine-account.test.ts


PR-Codex overview

This PR introduces the engineAccount() function for backend usage, allowing the creation of accounts that can send transactions through an engine instance. It enhances the SDK with options for signing messages, sending transactions, and managing accounts effectively.

Detailed summary

  • Added export for EngineAccountOptions and engineAccount from ../../wallets/engine/index.js.
  • Updated .env.example to include ENGINE_URL, ENGINE_AUTH_TOKEN, and ENGINE_WALLET_ADDRESS.
  • Introduced tests for engineAccount in engine-account.test.ts, covering message signing and transaction sending.
  • Enhanced engineAccount function to handle signing messages, typed data, and sending transactions with error handling.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

vercel bot commented Jan 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 1:34am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 1:34am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 1:34am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 1:34am

Copy link

changeset-bot bot commented Jan 14, 2025

🦋 Changeset detected

Latest commit: d256799

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
thirdweb Minor
@thirdweb-dev/wagmi-adapter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Jan 14, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

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

throw new Error("Transaction timed out after 5 minutes");
},
signMessage: async ({ message }) => {
let engineMesasage: string | Hex;
Copy link
Contributor

Choose a reason for hiding this comment

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

The variable engineMesasage contains a typo and should be renamed to engineMessage for correct spelling.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

@joaquim-verges joaquim-verges changed the title feat: Add engineAccount() for backend transaction handling [SDK] Feat: Add engineAccount() for backend transaction handling Jan 14, 2025
Copy link

linear bot commented Jan 14, 2025

Copy link
Contributor

github-actions bot commented Jan 14, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 46.68 KB (0%) 934 ms (0%) 2.7 s (-25.43% 🔽) 3.7 s
thirdweb (cjs) 116.72 KB (0%) 2.4 s (0%) 6.4 s (-11.14% 🔽) 8.7 s
thirdweb (minimal + tree-shaking) 5.59 KB (0%) 112 ms (0%) 539 ms (+28.73% 🔺) 651 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 159 ms (+61.84% 🔺) 169 ms
thirdweb/react (minimal + tree-shaking) 19.24 KB (0%) 385 ms (0%) 1.5 s (+16.45% 🔺) 1.9 s

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

Attention: Patch coverage is 13.39286% with 97 lines in your changes missing coverage. Please review.

Project coverage is 54.89%. Comparing base (0fdfb8a) to head (d256799).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/thirdweb/src/wallets/engine/index.ts 13.39% 97 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5947      +/-   ##
==========================================
- Coverage   54.96%   54.89%   -0.07%     
==========================================
  Files        1145     1146       +1     
  Lines       60996    61108     +112     
  Branches     5156     5154       -2     
==========================================
+ Hits        33528    33548      +20     
- Misses      26740    26832      +92     
  Partials      728      728              
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from 0fdfb8a
packages 52.56% <13.39%> (-0.08%) ⬇️

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
packages/thirdweb/src/wallets/smart/lib/signing.ts 88.69% <ø> (ø)
packages/thirdweb/src/wallets/engine/index.ts 13.39% <13.39%> (ø)

... and 2 files with indirect coverage changes

@joaquim-verges joaquim-verges force-pushed the feat_Add_engineAccount_for_backend_transaction_handling branch from eb96d45 to d256799 Compare January 15, 2025 01:25
@joaquim-verges joaquim-verges merged commit d1c03b0 into main Jan 15, 2025
31 of 32 checks passed
@joaquim-verges joaquim-verges deleted the feat_Add_engineAccount_for_backend_transaction_handling branch January 15, 2025 01:36
@jnsdls jnsdls mentioned this pull request Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant