@edgex-web/components
Version:
EdgeX Universal UI Components Library - Reusable React components for deposit, withdraw and other common UI patterns
93 lines (92 loc) • 2.8 kB
TypeScript
import { ChainInfo } from '../../../types';
import { Account } from '../../shared/types';
export interface DepositResult {
chainId: number;
tokenAddress: string;
amount: string;
txHash?: string;
}
export interface DepositProps {
isOpen: boolean;
isLoading?: boolean;
onClose: () => void;
children?: React.ReactNode;
currentActiveAccount: Account;
chains: ChainInfo[];
spotChains?: ChainInfo[];
defaultAccountType?: 'perpetual' | 'spot';
defaultChainId: number;
defaultSymbol?: string;
balances?: {
spot?: Record<string, string>;
perpetual?: Record<string, string>;
};
wagmiHooks?: {
useBalance: any;
useReadContract: any;
useAccount: any;
useWriteContract: any;
useSwitchChain: any;
usePublicClient: any;
};
onDeposit?: (depositInfo: {
amount: string;
chainId: number;
tokenAddress: string;
tokenSymbol: string;
accountType?: 'perpetual' | 'spot';
}) => void;
onCopy?: (address: string) => void;
onChainChange: (chainId: number) => void;
onTokenChange: (tokenSymbol: string) => void;
}
export interface OpenDepositOptions {
currentActiveAccount: DepositProps['currentActiveAccount'];
chains: ChainInfo[];
spotChains?: ChainInfo[];
defaultAccountType?: DepositProps['defaultAccountType'];
defaultChainId: number;
defaultSymbol?: string;
balances?: {
spot?: Record<string, string>;
perpetual?: Record<string, string>;
};
wagmiHooks?: DepositProps['wagmiHooks'];
curSelectToken?: string;
currentActiveChain?: any;
depositAmount?: string;
tokens?: any[];
curSelectTokenData?: any;
amount?: string;
onDeposit?: (depositInfo: {
amount: string;
chainId: number;
tokenAddress: string;
tokenSymbol: string;
accountType?: 'perpetual' | 'spot';
}) => void;
onCopy?: (address: string) => void;
onClose?: () => void;
onTokenChange?: (token: string) => void;
onChainChange?: (chainId: number) => void;
onDepositAmountChange?: (amount: string) => void;
}
export interface DepositInternalState {
selectedChainId: number;
selectedTokenAddress: string;
amount: string;
isLoading: boolean;
error: string | null;
txHash: string | null;
selectedChain?: ChainInfo;
selectedToken?: ChainInfo['tokenList'][0];
}
export interface DepositAPI {
openDeposit: (options: OpenDepositOptions) => void;
closeDeposit: () => void;
updateDepositOptions: (options: Partial<OpenDepositOptions>) => void;
setDepositLoading: (loading: boolean) => void;
isOpen: () => boolean;
isLoading: () => boolean;
}
//# sourceMappingURL=index.d.ts.map