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

# Wallet provider priority

> Understand WalletProviderPriority levels and registry replacement in the Dynamic JavaScript SDK.

When a `WalletProvider` is registered, it is given a `WalletProviderPriority`. The priority tells the SDK how the wallet was discovered and which registration should win if two providers claim the same key.

## Priority levels

```typescript theme={"system"}
import { WalletProviderPriority } from "@dynamic-labs-sdk/client/core";

// Highest priority. Use when you control the wallet's own SDK or extension.
WalletProviderPriority.WALLET_SDK = 100;

// Standard-based discovery, such as EIP-6963 announcements.
WalletProviderPriority.WALLET_SELF_ANNOUNCEMENT_STANDARD = 50;

// Legacy providers that rely on a global object, such as window.ethereum.
// This is not a standard and can conflict with other injected wallets.
WalletProviderPriority.WINDOW_INJECT = 20;
```

* `WALLET_SDK` is for first-party SDK integrations where the wallet explicitly registers itself.
* `WALLET_SELF_ANNOUNCEMENT_STANDARD` is for wallets that follow a standard discovery protocol. If your wallet supports a standard listed in [Supported wallet standards](/docs/javascript/reference/creating-extensions/wallet-provider/supported-standards), it already works with Dynamic through that standard.
* `WINDOW_INJECT` is for backwards compatibility with wallets that inject a global provider. Use this only when no standard is available, because multiple injected providers can conflict with each other.

## Registry replacement and re-registration

The `WalletProviderRegistry` stores at most one provider per `key`.

* If a provider with the same `key` is registered again, the higher-priority registration wins.
* A lower-priority registration cannot replace an existing higher-priority one.
* If the priorities are equal, the new registration wins.

Keep `key` stable by using `formatWalletProviderKey`. The `key` is derived from `chain`, `displayName`, and `walletProviderType`.

```typescript theme={"system"}
import {
  formatWalletProviderKey,
  getWalletProviderRegistry,
  WalletProviderPriority,
} from "@dynamic-labs-sdk/client/core";
import { WalletProviderEnum } from "@dynamic-labs/sdk-api-core";

const key = formatWalletProviderKey({
  chain: "EVM",
  displayName: "My Wallet",
  walletProviderType: WalletProviderEnum.BrowserExtension,
});

getWalletProviderRegistry(client).register({
  priority: WalletProviderPriority.WALLET_SDK,
  walletProvider: { key, /* ... */ },
});
```

## Why priority matters

Priority prevents a built-in or injected provider from silently shadowing a first-party SDK integration. If your extension controls the wallet and you register with `WALLET_SDK`, your provider will take precedence over any standard or injected provider that uses the same key.

## Related

* [Build a WalletProvider](/docs/javascript/reference/creating-extensions/wallet-provider/build-wallet-provider)
* [Supported wallet standards](/docs/javascript/reference/creating-extensions/wallet-provider/supported-standards)
