Documentation
    Preparing search index...

    Interface DAppClientOptions

    interface DAppClientOptions {
        analytics?: AnalyticsInterface;
        appUrl?: string;
        blockExplorer?: BlockExplorer;
        colorMode?: ColorMode;
        description?: string;
        disableDefaultEvents?: boolean;
        disclaimerText?: string;
        enableAppSwitching?: boolean;
        enableMetrics?: boolean;
        errorMessages?: Record<string, Record<string | number, string>>;
        eventHandlers?: {
            ACKNOWLEDGE_RECEIVED?: {
                handler: BeaconEventHandlerFunction<
                    {
                        extraInfo: ExtraInfo;
                        message: AcknowledgeResponse;
                        walletInfo: WalletInfo;
                    },
                >;
            };
            ACTIVE_ACCOUNT_SET?: { handler: BeaconEventHandlerFunction<AccountInfo> };
            ACTIVE_TRANSPORT_SET?: {
                handler: BeaconEventHandlerFunction<Transport<PeerInfo, any, any>>;
            };
            BLOCKCHAIN_REQUEST_SUCCESS?: {
                handler: BeaconEventHandlerFunction<RequestSentInfo>;
            };
            BROADCAST_REQUEST_ERROR?: {
                handler: BeaconEventHandlerFunction<
                    { errorResponse: ErrorResponse; walletInfo: WalletInfo },
                >;
            };
            BROADCAST_REQUEST_SENT?: {
                handler: BeaconEventHandlerFunction<RequestSentInfo>;
            };
            BROADCAST_REQUEST_SUCCESS?: {
                handler: BeaconEventHandlerFunction<
                    {
                        blockExplorer: BlockExplorer;
                        connectionContext: ConnectionContext;
                        network: Network;
                        output: BroadcastResponse;
                        walletInfo: WalletInfo;
                    },
                >;
            };
            CHANNEL_CLOSED?: { handler: BeaconEventHandlerFunction<string> };
            GENERIC_ERROR?: { handler: BeaconEventHandlerFunction<string> };
            HIDE_UI?: {
                handler: BeaconEventHandlerFunction<undefined | ("alert" | "toast")[]>;
            };
            INTERNAL_ERROR?: {
                handler: BeaconEventHandlerFunction<
                    { buttons?: AlertButton[]; text: string },
                >;
            };
            INVALID_ACCOUNT_DEACTIVATED?: {
                handler: BeaconEventHandlerFunction<undefined>;
            };
            INVALID_ACTIVE_ACCOUNT_STATE?: {
                handler: BeaconEventHandlerFunction<undefined>;
            };
            LOCAL_RATE_LIMIT_REACHED?: {
                handler: BeaconEventHandlerFunction<undefined>;
            };
            NO_PERMISSIONS?: { handler: BeaconEventHandlerFunction<undefined> };
            OPEN_BUG_REPORT?: { handler: BeaconEventHandlerFunction<undefined> };
            OPERATION_REQUEST_ERROR?: {
                handler: BeaconEventHandlerFunction<
                    {
                        errorMessages: Record<string, Record<string | number, string>>;
                        errorResponse: ErrorResponse;
                        walletInfo: WalletInfo;
                    },
                >;
            };
            OPERATION_REQUEST_SENT?: {
                handler: BeaconEventHandlerFunction<RequestSentInfo>;
            };
            OPERATION_REQUEST_SUCCESS?: {
                handler: BeaconEventHandlerFunction<
                    {
                        account: AccountInfo;
                        blockExplorer: BlockExplorer;
                        connectionContext: ConnectionContext;
                        output: OperationResponse;
                        walletInfo: WalletInfo;
                    },
                >;
            };
            PAIR_INIT?: {
                handler: BeaconEventHandlerFunction<
                    {
                        analytics: AnalyticsInterface;
                        disclaimerText?: string;
                        featuredWallets?: string[];
                        networkType: NetworkType;
                        p2pPeerInfo: Promise<string>;
                        postmessagePeerInfo: Promise<string>;
                        substratePairing?: boolean;
                        walletConnectPeerInfo: Promise<string>;
                        abortedHandler(): void;
                    },
                >;
            };
            PAIR_SUCCESS?: {
                handler: BeaconEventHandlerFunction<
                    | ExtendedP2PPairingResponse
                    | ExtendedPostMessagePairingResponse
                    | ExtendedWalletConnectPairingResponse,
                >;
            };
            PERMISSION_REQUEST_ERROR?: {
                handler: BeaconEventHandlerFunction<
                    { errorResponse: ErrorResponse; walletInfo: WalletInfo },
                >;
            };
            PERMISSION_REQUEST_SENT?: {
                handler: BeaconEventHandlerFunction<RequestSentInfo>;
            };
            PERMISSION_REQUEST_SUCCESS?: {
                handler: BeaconEventHandlerFunction<
                    {
                        account: AccountInfo;
                        blockExplorer: BlockExplorer;
                        connectionContext: ConnectionContext;
                        output: PermissionResponseOutput;
                        walletInfo: WalletInfo;
                    },
                >;
            };
            PROOF_OF_EVENT_CHALLENGE_REQUEST_ERROR?: {
                handler: BeaconEventHandlerFunction<
                    { errorResponse: ErrorResponse; walletInfo: WalletInfo },
                >;
            };
            PROOF_OF_EVENT_CHALLENGE_REQUEST_SENT?: {
                handler: BeaconEventHandlerFunction<RequestSentInfo>;
            };
            PROOF_OF_EVENT_CHALLENGE_REQUEST_SUCCESS?: {
                handler: BeaconEventHandlerFunction<
                    {
                        account: AccountInfo;
                        blockExplorer: BlockExplorer;
                        connectionContext: ConnectionContext;
                        output: ProofOfEventChallengeResponse;
                        walletInfo: WalletInfo;
                    },
                >;
            };
            RELAYER_ERROR?: { handler: BeaconEventHandlerFunction<undefined> };
            SHOW_PREPARE?: {
                handler: BeaconEventHandlerFunction<{ walletInfo?: WalletInfo }>;
            };
            SIGN_REQUEST_ERROR?: {
                handler: BeaconEventHandlerFunction<
                    { errorResponse: ErrorResponse; walletInfo: WalletInfo },
                >;
            };
            SIGN_REQUEST_SENT?: {
                handler: BeaconEventHandlerFunction<RequestSentInfo>;
            };
            SIGN_REQUEST_SUCCESS?: {
                handler: BeaconEventHandlerFunction<
                    {
                        connectionContext: ConnectionContext;
                        output: SignPayloadResponse;
                        walletInfo: WalletInfo;
                    },
                >;
            };
            SIMULATED_PROOF_OF_EVENT_CHALLENGE_REQUEST_ERROR?: {
                handler: BeaconEventHandlerFunction<
                    { errorResponse: ErrorResponse; walletInfo: WalletInfo },
                >;
            };
            SIMULATED_PROOF_OF_EVENT_CHALLENGE_REQUEST_SENT?: {
                handler: BeaconEventHandlerFunction<RequestSentInfo>;
            };
            SIMULATED_PROOF_OF_EVENT_CHALLENGE_REQUEST_SUCCESS?: {
                handler: BeaconEventHandlerFunction<
                    {
                        account: AccountInfo;
                        blockExplorer: BlockExplorer;
                        connectionContext: ConnectionContext;
                        output: SimulatedProofOfEventChallengeResponse;
                        walletInfo: WalletInfo;
                    },
                >;
            };
            UNKNOWN?: { handler: BeaconEventHandlerFunction<undefined> };
        };
        featuredWallets?: string[];
        iconUrl?: string;
        matrixNodes?: NodeDistributions;
        name: string;
        network?: Network;
        preferredNetwork?: NetworkType;
        storage?: Storage;
        walletConnectOptions?: RequireAtLeastOne<
            { projectId?: string; relayUrl?: string },
            "projectId" | "relayUrl",
        >;
    }
    Index

    Properties

    analytics?: AnalyticsInterface

    The analytics instance that will be used by the SDK

    appUrl?: string

    A URL to the website of the application

    blockExplorer?: BlockExplorer

    The block explorer used by the SDK

    colorMode?: ColorMode

    Set the color mode for the UI elements (alerts and toasts)

    description?: string

    Description of the application

    disableDefaultEvents?: boolean

    Disable all default Events and UI elements. If passed together with "eventHandlers", the default eventHandlers will be removed, and the ones passed by the user will be added.

    disclaimerText?: string

    A disclaimer text that will be displayed in the pairing alert

    enableAppSwitching?: boolean

    Automatically switch between apps on Mobile Devices (Enabled by Default)

    enableMetrics?: boolean

    Enable metrics tracking (Disabled by Default)

    errorMessages?: Record<string, Record<string | number, string>>

    A list of contracts that the DApp is using. Allows to attach human readable error messages for to error codes

    eventHandlers?: {
        ACKNOWLEDGE_RECEIVED?: {
            handler: BeaconEventHandlerFunction<
                {
                    extraInfo: ExtraInfo;
                    message: AcknowledgeResponse;
                    walletInfo: WalletInfo;
                },
            >;
        };
        ACTIVE_ACCOUNT_SET?: { handler: BeaconEventHandlerFunction<AccountInfo> };
        ACTIVE_TRANSPORT_SET?: {
            handler: BeaconEventHandlerFunction<Transport<PeerInfo, any, any>>;
        };
        BLOCKCHAIN_REQUEST_SUCCESS?: {
            handler: BeaconEventHandlerFunction<RequestSentInfo>;
        };
        BROADCAST_REQUEST_ERROR?: {
            handler: BeaconEventHandlerFunction<
                { errorResponse: ErrorResponse; walletInfo: WalletInfo },
            >;
        };
        BROADCAST_REQUEST_SENT?: {
            handler: BeaconEventHandlerFunction<RequestSentInfo>;
        };
        BROADCAST_REQUEST_SUCCESS?: {
            handler: BeaconEventHandlerFunction<
                {
                    blockExplorer: BlockExplorer;
                    connectionContext: ConnectionContext;
                    network: Network;
                    output: BroadcastResponse;
                    walletInfo: WalletInfo;
                },
            >;
        };
        CHANNEL_CLOSED?: { handler: BeaconEventHandlerFunction<string> };
        GENERIC_ERROR?: { handler: BeaconEventHandlerFunction<string> };
        HIDE_UI?: {
            handler: BeaconEventHandlerFunction<undefined | ("alert" | "toast")[]>;
        };
        INTERNAL_ERROR?: {
            handler: BeaconEventHandlerFunction<
                { buttons?: AlertButton[]; text: string },
            >;
        };
        INVALID_ACCOUNT_DEACTIVATED?: {
            handler: BeaconEventHandlerFunction<undefined>;
        };
        INVALID_ACTIVE_ACCOUNT_STATE?: {
            handler: BeaconEventHandlerFunction<undefined>;
        };
        LOCAL_RATE_LIMIT_REACHED?: {
            handler: BeaconEventHandlerFunction<undefined>;
        };
        NO_PERMISSIONS?: { handler: BeaconEventHandlerFunction<undefined> };
        OPEN_BUG_REPORT?: { handler: BeaconEventHandlerFunction<undefined> };
        OPERATION_REQUEST_ERROR?: {
            handler: BeaconEventHandlerFunction<
                {
                    errorMessages: Record<string, Record<string | number, string>>;
                    errorResponse: ErrorResponse;
                    walletInfo: WalletInfo;
                },
            >;
        };
        OPERATION_REQUEST_SENT?: {
            handler: BeaconEventHandlerFunction<RequestSentInfo>;
        };
        OPERATION_REQUEST_SUCCESS?: {
            handler: BeaconEventHandlerFunction<
                {
                    account: AccountInfo;
                    blockExplorer: BlockExplorer;
                    connectionContext: ConnectionContext;
                    output: OperationResponse;
                    walletInfo: WalletInfo;
                },
            >;
        };
        PAIR_INIT?: {
            handler: BeaconEventHandlerFunction<
                {
                    analytics: AnalyticsInterface;
                    disclaimerText?: string;
                    featuredWallets?: string[];
                    networkType: NetworkType;
                    p2pPeerInfo: Promise<string>;
                    postmessagePeerInfo: Promise<string>;
                    substratePairing?: boolean;
                    walletConnectPeerInfo: Promise<string>;
                    abortedHandler(): void;
                },
            >;
        };
        PAIR_SUCCESS?: {
            handler: BeaconEventHandlerFunction<
                | ExtendedP2PPairingResponse
                | ExtendedPostMessagePairingResponse
                | ExtendedWalletConnectPairingResponse,
            >;
        };
        PERMISSION_REQUEST_ERROR?: {
            handler: BeaconEventHandlerFunction<
                { errorResponse: ErrorResponse; walletInfo: WalletInfo },
            >;
        };
        PERMISSION_REQUEST_SENT?: {
            handler: BeaconEventHandlerFunction<RequestSentInfo>;
        };
        PERMISSION_REQUEST_SUCCESS?: {
            handler: BeaconEventHandlerFunction<
                {
                    account: AccountInfo;
                    blockExplorer: BlockExplorer;
                    connectionContext: ConnectionContext;
                    output: PermissionResponseOutput;
                    walletInfo: WalletInfo;
                },
            >;
        };
        PROOF_OF_EVENT_CHALLENGE_REQUEST_ERROR?: {
            handler: BeaconEventHandlerFunction<
                { errorResponse: ErrorResponse; walletInfo: WalletInfo },
            >;
        };
        PROOF_OF_EVENT_CHALLENGE_REQUEST_SENT?: {
            handler: BeaconEventHandlerFunction<RequestSentInfo>;
        };
        PROOF_OF_EVENT_CHALLENGE_REQUEST_SUCCESS?: {
            handler: BeaconEventHandlerFunction<
                {
                    account: AccountInfo;
                    blockExplorer: BlockExplorer;
                    connectionContext: ConnectionContext;
                    output: ProofOfEventChallengeResponse;
                    walletInfo: WalletInfo;
                },
            >;
        };
        RELAYER_ERROR?: { handler: BeaconEventHandlerFunction<undefined> };
        SHOW_PREPARE?: {
            handler: BeaconEventHandlerFunction<{ walletInfo?: WalletInfo }>;
        };
        SIGN_REQUEST_ERROR?: {
            handler: BeaconEventHandlerFunction<
                { errorResponse: ErrorResponse; walletInfo: WalletInfo },
            >;
        };
        SIGN_REQUEST_SENT?: {
            handler: BeaconEventHandlerFunction<RequestSentInfo>;
        };
        SIGN_REQUEST_SUCCESS?: {
            handler: BeaconEventHandlerFunction<
                {
                    connectionContext: ConnectionContext;
                    output: SignPayloadResponse;
                    walletInfo: WalletInfo;
                },
            >;
        };
        SIMULATED_PROOF_OF_EVENT_CHALLENGE_REQUEST_ERROR?: {
            handler: BeaconEventHandlerFunction<
                { errorResponse: ErrorResponse; walletInfo: WalletInfo },
            >;
        };
        SIMULATED_PROOF_OF_EVENT_CHALLENGE_REQUEST_SENT?: {
            handler: BeaconEventHandlerFunction<RequestSentInfo>;
        };
        SIMULATED_PROOF_OF_EVENT_CHALLENGE_REQUEST_SUCCESS?: {
            handler: BeaconEventHandlerFunction<
                {
                    account: AccountInfo;
                    blockExplorer: BlockExplorer;
                    connectionContext: ConnectionContext;
                    output: SimulatedProofOfEventChallengeResponse;
                    walletInfo: WalletInfo;
                },
            >;
        };
        UNKNOWN?: { handler: BeaconEventHandlerFunction<undefined> };
    }

    An object that will be used to overwrite default event handler behaviour.

    If you plan to overwrite all default events, use "disableDefaultEvents" instead.

    This will overwrite the default event handler, so this can lead to unexpected behavior in some cases. We recommend that you overwrite all handlers if you want to use your own UI.

    If you simply want to be notified of events happening, but do not want to overwrite the default behavior, please use subscribeToEvent() on the DAppClient instead.

    featuredWallets?: string[]

    The wallets that will be featured in the UI.

    iconUrl?: string

    A URL to the icon of the application

    matrixNodes?: NodeDistributions

    A list of matrix nodes to connect to. If a non-empty array is passed, the default options will be overwritten. One node will be randomly selected based on the local keypair and the other nodes will be used as a fallback in case the primary node goes down.

    Only provide the hostname, no https:// prefix. Eg. { [Regions.EU1]: ['matrix.example.com'] }

    name: string

    Name of the application

    network?: Network

    Indicates on which network the DApp is running on.

    preferredNetwork?: NetworkType

    Please use "network" instead. Indicates on which network the DApp is planning to run. This is currently used to adjust the URLs of web-wallets in the pairing alert if they use different URLs for testnets. You will still have to define the network you intend to use during the permission request.

    storage?: Storage

    The storage that will be used by the SDK

    walletConnectOptions?: RequireAtLeastOne<
        { projectId?: string; relayUrl?: string },
        "projectId" | "relayUrl",
    >

    Configuration that is passed to the WalletConnect transport.

    This is required to enable WalletConnect connections.