> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# refreshWalletAccountShares

> Refreshes wallet account shares for a specific wallet

## Function Signature

```typescript theme={"system"}
refreshWalletAccountShares(params: {
  accountAddress: string;
  chainName: string;
  walletMetadata: WalletMetadata;
  password?: string;
  externalServerKeyShares?: ServerKeyShare[];
  backUpToDynamic?: boolean;
}): Promise<{
  externalServerKeyShares: ServerKeyShare[];
  backupInfo: KeyShareBackupInfo;
}>
```

## Description

Refreshes the wallet's MPC key shares while maintaining the same threshold signature scheme. Returns both the new `externalServerKeyShares` and an updated `backupInfo`. **You must re-cache the `backupInfo`** into your stored `walletMetadata.externalServerKeySharesBackupInfo`.

## Parameters

### Required Parameters

* **`accountAddress`** (`string`) - The wallet address. Must match `walletMetadata.accountAddress`.
* **`chainName`** (`string`) - The chain name (e.g., `'SVM'`)
* **`walletMetadata`** ([`WalletMetadata`](/node/reference/types/wallet-metadata)) - The cached metadata for this wallet

### Optional Parameters

* **`password`** (`string`) - **Required when `backUpToDynamic` is `true`.**
* **`externalServerKeyShares`** ([`ServerKeyShare[]`](/node/reference/types/server-key-share)) - Current plaintext shares.
* **`backUpToDynamic`** (`boolean`) - Whether to back the new shares up to Dynamic.

## Returns

* **`Promise<{ externalServerKeyShares, backupInfo }>`**
  * `externalServerKeyShares` — The newly-generated shares. Re-vault these.
  * `backupInfo` ([`KeyShareBackupInfo`](/node/reference/types/key-share-backup-info)) — Updated backup-pointer state. Merge into cached `walletMetadata`.

## Example

```typescript theme={"system"}
import { authenticatedSvmClient } from './client';

const svmClient = await authenticatedSvmClient();

const walletMetadata = JSON.parse(await redis.get(`wallet:${accountAddress}`));
const externalServerKeyShares = await vault.read(`wallet:${accountAddress}/shares`);

const { externalServerKeyShares: refreshedShares, backupInfo } =
  await svmClient.refreshWalletAccountShares({
    accountAddress,
    chainName: 'SVM',
    walletMetadata,
    externalServerKeyShares,
    password: 'user-password',
    backUpToDynamic: true,
  });

const updatedMetadata = {
  ...walletMetadata,
  externalServerKeySharesBackupInfo: backupInfo,
};
await redis.set(`wallet:${accountAddress}`, JSON.stringify(updatedMetadata));
await vault.write(`wallet:${accountAddress}/shares`, refreshedShares);
```

## Related

* [`WalletMetadata`](/node/reference/types/wallet-metadata) - The metadata object passed to every operation
* [`reshare()`](/node/reference/svm/reshare) - Change threshold scheme + refresh shares in one call
