Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

registerAccount

Register an additional account for an existing user.

Each user has a BTreeMap<AccountIndex, Addr> of up to 5 accounts; this action mints the next one and (optionally) seeds it with funds. The new account's address can be computed deterministically ahead of time. See protocol book: overview/3-dango-contracts §3.

Signature

function registerAccount(
  client: Client<Signer>,
  parameters: {
    sender: Address
    funds?: Funds
  },
  txParameters?: { gasLimit?: number },
): Promise<{ hash: Uint8Array } & TxData>

Example

import { createSignerClient, createTransport, testnet, PrivateKeySigner } from "@left-curve/sdk"
import type { Address } from "@left-curve/sdk"
 
const client = createSignerClient({
  chain: testnet,
  transport: createTransport(),
  signer: PrivateKeySigner.fromMnemonic(process.env.DANGO_MNEMONIC!),
})
const sender: Address = "0x1234567890abcdef1234567890abcdef12345678"
 
await client.registerAccount({ sender }, { gasLimit: 250_000 })

Parameters

senderAddress. An existing account of the user.

fundsFunds, optional. Initial coins to send into the new account.

txParameters{ gasLimit?: number }, optional. Positional second argument used by the action builder to forward gas overrides.

Returns

{ hash: Uint8Array } & TxData — see broadcastTxSync.

Notes

  • The action builder accepts txParameters as a positional second argument, not as a field on the first parameter. This is unique among mutations.
  • The new account address can be derived ahead of time via getNextAccountIndex + computeAddress.
  • Rejected if the user already owns 5 accounts (the per-user cap).

See also