Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mls.onchainden.com/llms.txt

Use this file to discover all available pages before exploring further.

What is an account?

Accounts are on-chain wallets managed by your organization. They hold assets and are the source for transactions. Accounts are created through proposals that admins approve and execute.

1) Set up the client

Create the SDK client used to submit account proposals.
import { DenClient } from "@onchainden/mls-sdk-ts";

const client = new DenClient({
  apiKey: process.env.DEN_API_KEY!,
  baseUrl: process.env.DEN_API_BASE_URL!,
});

2) Create an account proposal

Define the account details and submit the proposal.
const { data: proposal } = await client.proposeAccountCreation({
  items: [
    {
      name: "Treasury",
      networkIds: [1, 137],
    },
  ],
});

3) Sign and execute the proposal

Collect the required approvals and execute the proposal.
await client.signAccountProposal(proposal.id, {
  type: "approve",
  signature: "0x...",
});

const { data: executed } = await client.executeAccountProposal(proposal.id, {
  type: "approve",
});

4) Get the account

Fetch the created account once the proposal is executed.
const { data: account } = await client.getAccount("acc_123");

Full example

import { DenClient } from "@onchainden/mls-sdk-ts";

// 1) Set up the client.
const client = new DenClient({
  apiKey: process.env.DEN_API_KEY!,
  baseUrl: process.env.DEN_API_BASE_URL!,
});

// 2) Create an account proposal.
const { data: proposal } = await client.proposeAccountCreation({
  items: [
    {
      name: "Treasury",
      networkIds: [1, 137],
    },
  ],
});

// 3) Sign and execute the proposal.
await client.signAccountProposal(proposal.id, {
  type: "approve",
  signature: "0x...",
});

const { data: executed } = await client.executeAccountProposal(proposal.id, {
  type: "approve",
});

// 4) Get the account.
const { data: account } = await client.getAccount("acc_123");