UNPKG

@reservoir0x/relay-kit-ui

Version:

Relay is the Fastest and Cheapest Way to Bridge and Transact Across Chains.

23 lines 954 B
import { useQuery } from '@tanstack/react-query'; import { setParams } from '@reservoir0x/relay-sdk'; export default (externalTransactionId, queryParams, queryOptions) => { const queryKey = ['useMoonPayTransaction', externalTransactionId]; const response = useQuery({ queryKey: queryKey, queryFn: () => { const url = new URL(`https://api.moonpay.com/v1/transactions/ext/${externalTransactionId}`); setParams(url, queryParams); return fetch(url.href) .then((response) => response.json()) .then((response) => { return response && response.length > 0 ? response[0] : response; }); }, ...queryOptions, enabled: queryParams?.apiKey !== undefined && externalTransactionId !== undefined && queryOptions?.enabled }); return response; }; //# sourceMappingURL=useMoonPayTransaction.js.map