Skip to main content

UpdateAccount

Updates an existing account's mutable metadata.

Only the display_name field can be modified. All other fields including ownership, ledger, and account number are immutable after creation.

Method Options​

Authorisation specification of the UpdateAccount method.

TypeMETHOD_TYPE_WRITE
Access LevelMETHOD_ACCESS_LEVEL_AUTHORISED
Roles
  • ROLE_WALLET_ADMIN
  • ROLE_WALLET_ACCOUNT_ADMIN

Parameters​

Request and response parameter message overview:

Input: UpdateAccountRequest Message​

FieldTypeRequiredDescription
Account

meshtrade.wallet.account.v1.Account

True

Complete account resource with updated fields. Only display_name can be modified.

Returns: Account Message​

Code Examples​

Select supported SDK in the language of your choice for a full example of how to invoke the this method:

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()

// Get the existing account first
existingAccount, err := service.GetAccount(ctx, &accountv1.GetAccountRequest{
Name: "accounts/01HQ3K5M8XYZ2NFVJT9BKR7P4C",
PopulateLedgerData: false,
})
if err != nil {
log.Fatalf("GetAccount failed: %v", err)
}

// Create request to update only the display name
updatedAccount := *existingAccount
updatedAccount.DisplayName = "Updated Trading Account Name"

request := &accountv1.UpdateAccountRequest{
Account: &updatedAccount,
}

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

// Display the updated account
log.Printf("Account updated successfully:")
log.Printf(" Name: %s", account.Name)
log.Printf(" Display Name: %s", account.DisplayName)
log.Printf(" Number: %s", account.Number)
log.Printf(" Ledger: %s", account.Ledger)
}

Advanced Configuration​

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

Other Methods​