Experimental RPC method for creating sub accounts
Creates a new sub account associated with the main wallet account. Sub accounts allow for hierarchical account management and delegation.
Parameters
The account configuration object.Show Account object properties
The type of sub account to create. Can be “create” or “deployed”.
Array of key objects for the sub account (required for “create” type).Show Key object properties
Type of key: “address”, “p256”, “webcrypto-p256”, or “webauthn-p256”.
Hex string of the public key.
The address of the deployed account to add as a sub account. (required for “deployed” type).
The chain ID that the account is deployed on. (required for “deployed” type).
Returns
Sub account information including address and deployment details.
The address of the created sub account.
The factory contract address (optional).
Factory deployment data (optional).
{
"id": 1,
"jsonrpc": "2.0",
"method": "wallet_addSubAccount",
"params": [{
"account": {
"type": "create",
"keys": [{
"type": "p256",
"publicKey": "0x0123456789abcdef..."
}]
}
}]
}
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"address": "0x1234567890123456789012345678901234567890",
"chainId": "0x2105"
}
}
Error Handling
Code | Message | Description |
---|
4001 | User rejected the request | User denied creating the sub account |
4100 | Requested method not supported | The method is not supported by the wallet |
-32602 | Invalid params | Invalid account configuration |
This is an experimental feature and the API may change in future versions.