Accounts

Create a smart account and read its address.

// New user: creates a passkey signer, then the account.
const account = await sdk.accounts.create({ inviteCode })

// Returning user: reuse a signer you already have.
const { signer } = await sdk.signers.authenticate()
const account = await sdk.accounts.create({ signer })

// By id, if you stored it.
const account = await sdk.accounts.create({ signer: { id: 'sig_…' } })

create accepts { signer?, chain?, inviteCode? }. inviteCode is only used when the SDK has to create the signer itself.

The AccountClient

Member Type What it gives you
id string The account id. Stable across chains.
address string The smart account contract on the configured chain. Throws if the account is not deployed there.
data AccountAggregate id, contractsByChainId, and the signer id.
signer SignerClient The signer that controls this account.
prepareDeposit(…) method See Deposits.
prepareTradeQuote(…) method See Trading.
prepareBorrowQuote(…) method See Borrowing and repaying.

Deployment is lazy

The server assigns an address when the account is created and deploys the contract on first use, so account.address can be read before the first transaction. If you call it for a chain where no contract exists yet, you get Account not deployed on chain 8453. Check with the API client:

const status = await sdk.getInternalClient().accounts.getAccountDeploymentStatus({
  id: account.id,
  namespaceSlug: 'main',
})

Profiles

Handles and avatars are separate from accounts. Use the generated client:

const api = sdk.getInternalClient()
await api.accounts.setAccountProfile({ accountId: account.id, username: 'nova_7' })
const { profile } = await api.accounts.getAccountProfile({ accountId: account.id })

Handles are 3 to 20 letters, numbers or underscores, start with a letter, and are unique regardless of case.