Function createSpyreClient

  • Creates an ISpyreClient instance.


    const client = createSpyreClient({
    options, thirdweb, connectionManager
    });

    await client.initialize();

    Parameters

    • options: CreateSpyreClientOptions

      Options for creating the client.

    • thirdweb: ThirdwebClient

      A Thirdweb client instance. This allows external applications to manage the connection to the Thirdweb wallet.

    • connectionManager: {
          activeAccountStore: Store<undefined | Account>;
          activeWalletChainStore: Store<undefined | Readonly<ChainOptions & {
              rpc: string;
          }>>;
          activeWalletConnectionStatusStore: Store<ConnectionStatus>;
          activeWalletStore: Store<undefined | Wallet>;
          addConnectedWallet: ((wallet: Wallet) => void);
          connect: ((wallet: Wallet, options?: ConnectManagerOptions) => Promise<Wallet>);
          connectedWallets: ReadonlyStore<Wallet[]>;
          disconnectWallet: ((wallet: Wallet) => void);
          handleConnection: ((wallet: Wallet, options?: ConnectManagerOptions) => Promise<Wallet>);
          isAutoConnecting: Store<boolean>;
          removeConnectedWallet: ((wallet: Wallet) => void);
          setActiveWallet: ((activeWallet: Wallet) => Promise<void>);
          switchActiveWalletChain: ((chain: Readonly<ChainOptions & {
              rpc: string;
          }>) => Promise<void>);
      }

      A Thirdweb connection manager instance.

      • activeAccountStore: Store<undefined | Account>
      • activeWalletChainStore: Store<undefined | Readonly<ChainOptions & {
            rpc: string;
        }>>
      • activeWalletConnectionStatusStore: Store<ConnectionStatus>
      • activeWalletStore: Store<undefined | Wallet>
      • addConnectedWallet: ((wallet: Wallet) => void)
          • (wallet): void
          • Parameters

            • wallet: Wallet

            Returns void

      • connect: ((wallet: Wallet, options?: ConnectManagerOptions) => Promise<Wallet>)
          • (wallet, options?): Promise<Wallet>
          • Parameters

            • wallet: Wallet
            • Optionaloptions: ConnectManagerOptions

            Returns Promise<Wallet>

      • connectedWallets: ReadonlyStore<Wallet[]>
      • disconnectWallet: ((wallet: Wallet) => void)
          • (wallet): void
          • Parameters

            • wallet: Wallet

            Returns void

      • handleConnection: ((wallet: Wallet, options?: ConnectManagerOptions) => Promise<Wallet>)
          • (wallet, options?): Promise<Wallet>
          • Parameters

            • wallet: Wallet
            • Optionaloptions: ConnectManagerOptions

            Returns Promise<Wallet>

      • isAutoConnecting: Store<boolean>
      • removeConnectedWallet: ((wallet: Wallet) => void)
          • (wallet): void
          • Parameters

            • wallet: Wallet

            Returns void

      • setActiveWallet: ((activeWallet: Wallet) => Promise<void>)
          • (activeWallet): Promise<void>
          • Parameters

            • activeWallet: Wallet

            Returns Promise<void>

      • switchActiveWalletChain: ((chain: Readonly<ChainOptions & {
            rpc: string;
        }>) => Promise<void>)
          • (chain): Promise<void>
          • Parameters

            • chain: Readonly<ChainOptions & {
                  rpc: string;
              }>

            Returns Promise<void>

    Returns ISpyreClient