Skip to content
LogoLogo

addSubAccount

Requests to add a Sub Account. See more

What is a Sub Account?

Usage

import {  } from './config'
 
const  = await .({
  : 'create',
})

Returns

The created Sub Account.

type ReturnType = {
  address: Address
  factory?: Address | undefined
  factoryData?: Hex | undefined
}

Parameters

New Accounts

Allows the wallet to create a Sub Account with a set of known signing keys. Learn more

keys

Set of signing keys that will belong to the Sub Account.

import {  } from './config'
 
const  = await .({
  : [{ 
    : '0xefd5fb29a274ea6682673d8b3caa9263e936d48d486e5df68893003e01241522', 
    : 'p256'
  }], 
  : 'create',
})

keys.publicKey

  • Type: Hex

The public key of the signing key.

  • This is a 32-byte hexadecimal string.
  • For type: "address", this is a 20-byte address.
import {  } from './config'
 
const  = await .({
  : [{
    : '0xefd5fb29a274ea6682673d8b3caa9263e936d48d486e5df68893003e01241522', 
    : 'p256'
  }],
  : 'create',
})

keys.type

  • Type: 'address' | 'p256' | 'webcrypto-p256' | 'webauthn-p256'

The type of signing key.

import {  } from './config'
 
const  = await .({
  : [{
    : '0xefd5fb29a274ea6682673d8b3caa9263e936d48d486e5df68893003e01241522',
    : 'p256'
  }],
  : 'create',
})

Deployed Accounts

An existing account that the user wants to link to their global account. Learn more

address

Address of the deployed account.

import {  } from './config'
 
const  = await .({
  : '0x0000000000000000000000000000000000000000', 
  : 'deployed',
})

chainId

The chain ID of the deployed account.

import {  } from './config'
 
const  = await .({
  : '0x0000000000000000000000000000000000000000',
  : 1, 
  : 'deployed',
})

Undeployed Accounts

An account that has been created, but is not yet deployed. The wallet will decide whether or not to deploy it. Learn more

address

Address of the undeployed account.

import {  } from './config'
 
const  = await .({
  : '0x0000000000000000000000000000000000000000', 
  : '0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce', 
  : '0xdeadbeef',
  : 'undeployed',
})

chainId

The chain ID the account will be deployed on.

import {  } from './config'
 
const  = await .({
  : '0x0000000000000000000000000000000000000000',
  : 1, 
  : '0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce', 
  : '0xdeadbeef',
  : 'undeployed',
})

factory

The address of the factory contract.

import {  } from './config'
 
const  = await .({
  : '0x0000000000000000000000000000000000000000',
  : '0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce', 
  : '0xdeadbeef',
  : 'undeployed',
})

factoryData

The data to be passed to the factory contract.

import {  } from './config'
 
const  = await .({
  : '0x0000000000000000000000000000000000000000',
  : '0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce',
  : '0xdeadbeef', 
  : 'undeployed',
})