games_app/backend/dist/services/blockchain/polygonService.d.ts
2026-06-29 15:01:23 +02:00

38 lines
1.7 KiB
TypeScript

/**
* Polygon (EVM) blockchain integration via JSON-RPC.
* USDC Transfer event scanning and outbound ERC-20 transfers.
*/
/**
* Returns the current Polygon block number.
* @returns Latest block height
*/
export declare function getCurrentBlock(): Promise<number>;
/**
* Queries USDC Transfer events to an address within a block range (chunked for RPC limits).
* @param toAddress Recipient address (0x-prefixed or raw hex)
* @param fromBlock Inclusive start block
* @param maxEndBlock Optional inclusive end block cap (defaults to current block)
* @returns Matching transfers with tx hash, parties, value, and block number
*/
export declare function getUsdcTransfersToAddress(toAddress: string, fromBlock: number, maxEndBlock?: number): Promise<Array<{
txHash: string;
from: string;
to: string;
value: bigint;
blockNumber: number;
}>>;
/**
* Sends USDC on Polygon from a wallet private key.
* @param fromPrivateKeyHex Sender private key (with or without 0x prefix)
* @param toAddress Recipient checksummed or hex address
* @param amountRaw USDC amount in smallest unit (6 decimals)
* @returns Confirmed transaction hash from receipt
*/
export declare function sendUsdc(fromPrivateKeyHex: string, toAddress: string, amountRaw: bigint): Promise<string>;
/** Returns native MATIC balance in wei. */
export declare function getNativeBalanceWei(address: string): Promise<bigint>;
/** Returns USDC balance in smallest units for an address. */
export declare function getUsdcBalanceRaw(address: string): Promise<bigint>;
/** Sends native MATIC for gas sponsorship. */
export declare function sendMatic(fromPrivateKeyHex: string, toAddress: string, amountWei: bigint): Promise<string>;
//# sourceMappingURL=polygonService.d.ts.map