Skip to content
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

Add sub account SDK helper methods #1534

Merged
merged 5 commits into from
Feb 24, 2025
Merged

Add sub account SDK helper methods #1534

merged 5 commits into from
Feb 24, 2025

Conversation

cb-jake
Copy link
Contributor

@cb-jake cb-jake commented Feb 24, 2025

Add SDK Utility methods

Changes

  • Renamed accounts namespace to subaccount for consistency
  • Added subaccount.create() method for creating new smart wallets
  • Added subaccount.get() method for retrieving existing wallets
  • Added subaccount.addOwner() method that accepts either:
    • An Ethereum address
    • A public key (as compressed hex)
  • Added comprehensive test coverage for all new methods
  • Updated example app to use production keys URL

Testing Instructions

  1. Create a new smart wallet:
const sdk = createCoinbaseWalletSDK({...});
await sdk.subaccount.create("0x123..."); // signer address
  1. Add an owner by address:
await sdk.subaccount.addOwner({
  address: "0xabc..." 
});
  1. Add an owner by public key:
await sdk.subaccount.addOwner({
  publicKey: "0x7da44d..." // compressed public key
});
  1. Verify the new owner can sign transactions for the wallet

Test Coverage

  • Added tests for error cases (missing signer, missing account)
  • Added tests for both address and public key flows
  • Added integration test in example app

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Feb 24, 2025

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

Copy link
Contributor

@fan-zhang-sv fan-zhang-sv left a comment

Choose a reason for hiding this comment

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

ty!

@cb-jake cb-jake merged commit 56da6e5 into master Feb 24, 2025
7 checks passed
@cb-jake cb-jake deleted the jake/helper-methods branch February 24, 2025 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants