Skip to content

Commit

Permalink
fix up types
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-jake committed Feb 25, 2025
1 parent 5eb29a7 commit a8c44c9
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 30 deletions.
30 changes: 0 additions & 30 deletions packages/wallet-sdk/src/core/rpc/wallet_addAddress.ts

This file was deleted.

41 changes: 41 additions & 0 deletions packages/wallet-sdk/src/core/rpc/wallet_addSubAccount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Address, Hex } from 'viem';

type AccountCreate = {
type: 'create';
keys: {
type: 'address' | 'p256' | 'webcrypto-p256' | 'webauthn-p256';
key: '0x...';
}[];
};

type AccountDeployed = {
type: 'deployed';
address: Address;
};

type AccountUndeployed = {
type: 'undeployed';
address?: Address;
factory?: Address;
factoryData?: Hex;
chainId?: Hex;
};

type Account = AccountDeployed | AccountCreate | AccountUndeployed;

export type WalletAddSubAccountRequest = {
method: 'wallet_addSubAccount';
params: [
{
version: '1';
account: Account;
},
];
};

export type WalletAddSubAccountResponse = {
address: Address;
chainId?: Hex;
factory?: Address;
factoryData?: Hex;
};
2 changes: 2 additions & 0 deletions packages/wallet-sdk/src/sign/scw/utils/createSmartAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ export async function createSmartAccount(
},

async getFactoryArgs() {
if (factoryData) return { factory: factory.address, factoryData };
// TODO: support creating factory data
return { factory: factory.address, factoryData };
},

Expand Down

0 comments on commit a8c44c9

Please sign in to comment.