@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
37 lines (36 loc) • 1.72 kB
TypeScript
import type { Address } from 'viem';
import { type FunkitUserInfo } from '../consts/funkit';
export declare enum LoginType {
Web3 = "web3",
Guest = "guest"
}
/**
* Whether externalUserId should be treated as a trusted wallet address.
* Currently only Lighter mobile QR flow passes externalUserId as an L1 address.
*/
export declare function getIsExternalUserIdAddress(apiKey: string, externalUserId: string | undefined): boolean;
/**
* Resolve the wallet address, preferring wagmi's connected address.
* When `isExternalUserIdAddress` is true, externalUserId is treated as a trusted
* wallet address and used as fallback when wagmi is not connected.
* Currently used by Lighter mobile QR flow where the L1 address is passed via externalUserId.
*/
export declare function resolveWalletAddress(address: Address | undefined, externalUserId: string | undefined, isExternalUserIdAddress: boolean): Address | undefined;
/**
* Resolve the userId for the current session.
*/
export declare function resolveUserId(address: Address | undefined, externalUserId: string | undefined, apiKey: string, isExternalUserIdAddress: boolean): string;
/**
* Build the FunkitUserInfo for the current session.
*/
export declare function buildUserInfo({ address, effectiveAddress, externalUserId, apiKey, isExternalUserIdAddress, loginType, connectorName, ensName, ensAvatar, }: {
address: Address | undefined;
effectiveAddress: Address | undefined;
externalUserId: string | undefined;
apiKey: string;
isExternalUserIdAddress: boolean;
loginType: LoginType;
connectorName: string | undefined;
ensName: string | null | undefined;
ensAvatar: string | null | undefined;
}): FunkitUserInfo;