Creates and connects a wallet to be used with the Treasure Connect login system and Thirdweb SDK.

Usage

import { connectWallet } from "@treasure-dev/tdk-core";

// const client = ...

const wallet = await connectWallet({
  client,
  ecosystemPartnerId: "...",
  method: "email",
  email: "example@treasure.lol",
  verificationCode: "123456",
});

Props

client

TreasureConnectClient

ecosystemId

string | undefined

  • The ecosystem ID for the ecosystem wallets.
  • Defaults to "ecosystem.treasure".

ecosystemPartnerId

string

  • The ecosystem partner ID for the ecosystem wallets.

chainId

number | undefined

  • The chain ID to use for initial connection.
  • Defaults to 42161 (Arbitrum One).

method

"email" | "passkey" | "google" | "apple" | "discord" | "telegram" | "x"

  • Desired connect method.

authMode

"popup" | "redirect" | "window" | undefined

  • Determines the authentication mode for SSO connect methods.
  • Defaults to "popup".

redirectUrl

string | undefined

  • Optional URL to redirect to after SSO connect.

email

string | undefined

  • Email address to use for connecting.
  • Required if mode is "email".

verificationCode

string | undefined

passkeyName

string | undefined

  • Optional name of the passkey to create.
  • Defaults to a generated name

passkeyDomain

string | undefined

  • The domain of the passkey to use for authentication.