> ## 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.

# 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 (100). Use when you control the wallet's own SDK or extension.
WalletProviderPriority.WALLET_SDK;

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

// Global-object providers (20), such as window.ethereum.
// This is not a standard and can conflict with other injected wallets.
WalletProviderPriority.WINDOW_INJECT;
```

* `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](https://docs.dynamic.xyz/docs/javascript/reference/creating-extensions/wallet-provider/supported-standards.md), 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: {
    chain: "EVM",
    groupKey: "my-wallet",
    key,
    metadata: {
      displayName: "My Wallet",
      icon: "https://example.com/my-wallet.svg",
    },
    walletProviderType: WalletProviderEnum.BrowserExtension,
    getActiveNetworkId: async () => ({ networkId: "1" }),
    getConnectedAddresses: async () => ({ addresses: [] }),
  },
});
```

## 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](https://docs.dynamic.xyz/docs/javascript/reference/creating-extensions/wallet-provider/build-wallet-provider.md)
* [Supported wallet standards](https://docs.dynamic.xyz/docs/javascript/reference/creating-extensions/wallet-provider/supported-standards.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.