bnb-passport-attestation
Version:
BAS SDK - A toolkit for blockchain interaction
70 lines (69 loc) • 2.44 kB
TypeScript
import { EnvType } from './useWalletConnection';
/**
* usePassportAttention Hook input parameters
* @interface UsePassportAttentionProps
* @property {number} inviteCode - Invite code
* @property {EnvType} [env='testnet'] - Environment type
*/
interface UsePassportAttentionProps {
inviteCode: number;
env?: EnvType;
}
/**
* usePassportAttention Hook return value
* @interface UsePassportAttentionReturn
* @property {boolean} loaded - Whether iframe is loaded
* @property {Function} handleMint - Function to handle minting
* @property {boolean} isLoading - Whether loading is in progress
* @property {string | null} account - Currently connected account address
* @property {string | null} txHash - Transaction hash
* @property {boolean} isConfirmed - Whether transaction is confirmed
* @property {Function} connect - Function to connect wallet
* @property {boolean} isConnected - Whether wallet is connected
* @property {string} currentNetwork - Currently connected network
* @property {boolean} isCorrectNetwork - Whether the connected network is correct
* @property {Function} onAccountChange - Callback for account changes
* @property {Function} onNetworkChange - Callback for network changes
* @property {Function} onDisconnect - Callback for wallet disconnection
*/
interface UsePassportAttentionReturn {
loaded: boolean;
handleMint: (type: string) => Promise<any>;
isLoading: boolean;
account: string | null;
txHash: string | null;
isConfirmed: boolean;
connect: () => Promise<string>;
isConnected: boolean;
currentNetwork: string;
isCorrectNetwork: boolean;
onAccountChange: (callback: (account: string | null) => void) => void;
onNetworkChange: (callback: (network: string) => void) => void;
onDisconnect: (callback: () => void) => void;
}
declare global {
interface Window {
ethereum: any;
}
}
/**
* Passport Attention Hook
* Handles wallet connection, chain switching, and minting operations
*
* @param {UsePassportAttentionProps} props - Hook parameters
* @returns {UsePassportAttentionReturn} Hook return value
*
* @example
* const {
* handleMint,
* isLoading,
* account,
* connect,
* isConnected
* } = usePassportAttention({
* inviteCode: 123,
* env: 'testnet'
* });
*/
export declare function usePassportAttention({ inviteCode, env }: UsePassportAttentionProps): UsePassportAttentionReturn;
export {};