Skip to main content

CreateAccount

Method Details​

Description: Creates a new wallet account. This is a write operation restricted to administrative roles.

Required Roles: Check proto file for roles

Parameters:

  • Label (string): A user-defined label for the new account, e.g., "Primary Savings".
  • Ledger (enum): The ledger upon which the account should be created.
  • Open (bool): If true, the account will be opened immediately after creation, which may result in a transaction.

Returns: Account

Method Type: METHOD_TYPE_WRITE

Code Examples​

package main

import (
"context"
"log"

accountv1 "github.com/meshtrade/api/go/wallet/account/v1"
)

func main() {
ctx := context.Background()

// Default configuration is used and credentials come from MESH_API_CREDENTIALS
// environment variable or default discovery methods. Zero config required
// unless you want custom configuration.
service, err := accountv1.NewAccountService()
if err != nil {
log.Fatalf("Failed to create service: %v", err)
}
defer service.Close()

// Create request with service-specific parameters
request := &accountv1.CreateAccountRequest{
// FIXME: Populate service-specific request fields
}

// Call the CreateAccount method
account, err := service.CreateAccount(ctx, request)
if err != nil {
log.Fatalf("CreateAccount failed: %v", err)
}

// FIXME: Add relevant response object usage
log.Printf("CreateAccount successful: %+v", account)
}

Advanced Configuration​

For advanced client configuration options (custom endpoints, TLS settings, timeouts), see the SDK Configuration Guide.

Other Methods​