@kanalabs/kana-widget-v2
Version:
Kana Widget for cross-chain bridging and swap.
91 lines (90 loc) • 5.7 kB
TypeScript
import { Connection, PublicKey } from "@solana/web3.js";
import { BridgeId, NetworkId } from "@kanalabs/aggregator";
import { AccountAddress, AccountAuthenticator, AnyRawTransaction, PendingTransactionResponse, Aptos as AptosClient } from "@aptos-labs/ts-sdk";
import { AptosExchangeFilter, SuiExchangeFilter, EvmExchangeFilter, SolanaExchangeFilter } from "types";
export declare const optionsCctp: {
label: import("react/jsx-runtime").JSX.Element;
value: NetworkId;
}[];
export declare const optionsBridge: {
label: import("react/jsx-runtime").JSX.Element;
value: BridgeId;
}[];
export declare const sleep: (ms: any) => Promise<unknown>;
export declare const getTokenDecimals: (connection: Connection, mint: PublicKey) => Promise<number>;
export declare function getUiAmount(number: number, tokenDecimal: number): number;
export declare const getEvmStructuredRoutes: (routes: any, tokensList: any) => Promise<any>;
export declare const getAptosStructuredRoutes: (routes: any, aptosTokensList: any) => Promise<any>;
export declare const getSuiStructuredRoutes: (routes: any, suiTokensList: any) => Promise<any>;
export declare const getSolanaStructuredRoutes: (routes: any, solanaTokensList: any) => Promise<any>;
export declare const joinDuplicatesAndSumBalances: (arr: any) => unknown[];
export declare const trimToFloor: (value: any, toFloor?: number) => any;
export declare function getAllSolanaTokenBalance(address: string, tokenList: any, connection: Connection): Promise<{
success: boolean;
data: any;
}>;
export declare function getTokenBalance(account: string, tokenList: Array<any>, chainId: number, apiKey: string, indexerApiKey?: string): Promise<{
success: boolean;
data: any[];
}>;
export declare const getCrossChainSolanaRoute: (route: any, solanaTokensList: any) => Promise<any>;
export declare const getCrossChainAptosRoute: (route: any, aptosTokensList: any) => Promise<any>;
export declare const getCrossChainEvmRoute: (route: any, tokensList: any) => Promise<any>;
export declare const isObjectNonEmpty: (data: any) => boolean;
export declare const validateSolAddress: (publickey: string, connection: Connection) => Promise<void>;
export declare const preventPasteNegativeNumber: (e: any) => void;
export declare const validataSolanaTokenAddress: (ownerKey: PublicKey, connection: Connection, mint: PublicKey) => Promise<{
status: boolean;
instruction?: undefined;
} | {
status: boolean;
instruction: import("@solana/web3.js").TransactionInstruction;
}>;
export declare const isValidNumber: (value: number | string) => boolean;
export declare const saveTransactionCount: (received: any, key: any) => Promise<any>;
export declare const submitTransactionData: (walletAddress: string, transactionType: "crosschainswap" | "swap", sourceChain: number, sourceAmount: number, transactionHash: string, sourceTokenAddress: string, sourceTokenSymbol: string, fromChain: string, toChain: string, sourceToken: string, targetToken: string, sourceValue: string, targetValue: string, targetTokenName: string, selectedRoute: any, swapTime: any, integrator: any, apiKey: any) => Promise<void>;
export declare const handleSwapInstructionForEtherspot: (swapData: any, payload: any, tokenList: any) => Promise<unknown>;
export declare function getUiAmountbignumber(number: number, tokenDecimal: number): number;
export declare const isSwapableCrosschain: (gasinstruction: any, selectedRoute: any, sourceInfo: any, targetInfo: any, availablePolygonTokens: any, availableEthereumTokens: any, availableBinanceTokens: any, availableArbitrumTokens: any, availableAvalancheTokens: any, availableBaseTokens: any, showNotification: any) => Promise<{
error: boolean;
data: null;
} | {
error: null;
data: boolean;
}>;
export declare const isSwapableSamechainGasFee: (selectedRoute: any, sourceInfo: any, availablePolygonTokens: any, availableEthereumTokens: any, availableBinanceTokens: any, availableArbitrumTokens: any, availableAvalancheTokens: any, availableBaseTokens: any, availableZksyncTokens: any, showNotification: any) => Promise<{
error: boolean;
data: null;
} | {
error: null;
data: boolean;
}>;
export declare const checkPriceImpact: (sourcePrice: string, targetPrice: string) => Promise<string>;
export declare const getDexImages: (chainId: number, isDarkMode: boolean) => {
[key: string]: string;
};
export declare const getDexUiNames: (chainId: number) => {
[key: string]: string;
};
export declare const getDexFilterByChainId: (chainId: number) => typeof SolanaExchangeFilter | typeof AptosExchangeFilter | typeof SuiExchangeFilter | typeof EvmExchangeFilter;
export declare const getExplorerLink: (hash: any, chain: any) => string;
export declare const getTokenExplorerLink: (token: any, chain: any) => string;
export declare const getAddressExplorerLink: (address: any, chain: any) => string;
interface Bridge {
img: string;
name: string;
}
export declare const getBridge: (id: number) => Bridge;
export declare function sponsoredTxnWithSenderAuth(args: {
transaction: AnyRawTransaction;
senderAuth: AccountAuthenticator;
additionalAuthenticators?: AccountAuthenticator[];
additionalAddresses?: AccountAddress[];
aptosClient: AptosClient | any;
paymasterApikey: string;
paymasterUrl: string;
}): Promise<PendingTransactionResponse>;
export declare const addToWhitelist: (address: string, apikey: string, paymaterUrl: string) => Promise<any>;
export declare const isWhitelisted: (address: string, apikey: string, paymaterUrl: string) => Promise<any>;
export declare const initAccount: (address: string, apikey: string, paymaterUrl: string) => Promise<any>;
export {};