games_app/backend/dist-test-faq/services/blockchain/bscService.d.ts

54 lines
2.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* BSC (EVM) blockchain integration via JSON-RPC.
* USDT BEP20 Transfer event scanning and outbound ERC-20 transfers.
*/
export declare function resolveUsdtContract(dbContract: string | null | undefined): string;
export declare function getCurrentBlock(): Promise<number>;
export type ParsedErc20Transfer = {
contract: string;
from: string;
to: string;
value: bigint;
};
export type TxReceiptSummary = {
status: number;
blockNumber: number;
transfers: ParsedErc20Transfer[];
};
/** Fetches a tx receipt and parses ERC-20 Transfer logs (for deposit recovery). */
export declare function getTransactionReceipt(txHash: string): Promise<TxReceiptSummary | null>;
/** Native BNB transfer details (for cold↔hot gas funding confirm). */
export declare function getNativeTransfer(txHash: string): Promise<{
status: number;
from: string;
to: string | null;
value: bigint;
} | null>;
type TransferHit = {
txHash: string;
from: string;
to: string;
value: bigint;
blockNumber: number;
};
/**
* eth_getLogs for USDT transfers to an HD address.
* Tries primary RPC then configured fallbacks (public dataseed often returns -32005).
*/
export declare function getUsdtTransfersToAddress(toAddress: string, contractAddress: string, fromBlock: number, maxEndBlock?: number): Promise<TransferHit[]>;
/**
* Newest-first getLogs for unpaid HDs: stop once cumulative Transfer value covers on-chain balance.
* Avoids scanning a full 7-day window when the deposit is only ~1–2 days old.
*/
export declare function getUsdtTransfersToAddressUntilValue(toAddress: string, contractAddress: string, fromBlock: number, maxEndBlock: number, minValue: bigint): Promise<TransferHit[]>;
/**
* Incoming USDT tx hashes for an address (Etherscan-compatible explorer).
* Used when eth_getLogs is empty/rate-limited but the HD still holds USDT.
*/
export declare function listIncomingUsdtTxHashesViaExplorer(toAddress: string, contractAddress: string): Promise<string[]>;
export declare function sendUsdt(fromPrivateKeyHex: string, contractAddress: string, toAddress: string, amountRaw: bigint): Promise<string>;
export declare function getNativeBalanceWei(address: string): Promise<bigint>;
export declare function getUsdtBalanceRaw(address: string, contractAddress: string): Promise<bigint>;
export declare function sendBnb(fromPrivateKeyHex: string, toAddress: string, amountWei: bigint): Promise<string>;
export {};
//# sourceMappingURL=bscService.d.ts.map