diff --git a/.vscode/settings.json b/.vscode/settings.json index 3445265af..1bba5dea7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,6 @@ { "editor.defaultFormatter": "biomejs.biome", - "editor.formatOnSave": true, + "editor.formatOnSave": false, "editor.codeActionsOnSave": { "quickfix.biome": "explicit" }, diff --git a/packages/app-explorer/package.json b/packages/app-explorer/package.json index 77b2636d3..7d9144955 100644 --- a/packages/app-explorer/package.json +++ b/packages/app-explorer/package.json @@ -42,6 +42,7 @@ "react-json-view-lite": "1.4.0", "react-use": "17.5.0", "react-window": "1.8.10", + "recharts": "2.12.7", "tai64": "1.0.0", "tailwind-variants": "0.1.20", "wagmi": "2.12.7", diff --git a/packages/app-explorer/src/app/globals.css b/packages/app-explorer/src/app/globals.css index 74bb3cab0..03d3ced33 100644 --- a/packages/app-explorer/src/app/globals.css +++ b/packages/app-explorer/src/app/globals.css @@ -1,8 +1,8 @@ :root { --hero-bg: #000; + --font-geist-mono: 'GeistMono', 'SF Mono', 'Segoe UI Mono', 'Roboto Mono', Menlo, Courier, monospace; } -h1, h2, h3, h4, @@ -11,6 +11,11 @@ h6 { font-weight: 600; letter-spacing: -0.025em; } + +h1, +h2{ + font-family: var(--font-geist-mono); +} kbd { font-size: 0.875rem; font-family: var(--default-font-family); diff --git a/packages/app-explorer/src/app/statistics/layout.tsx b/packages/app-explorer/src/app/statistics/layout.tsx new file mode 100644 index 000000000..c7db70b56 --- /dev/null +++ b/packages/app-explorer/src/app/statistics/layout.tsx @@ -0,0 +1,17 @@ +import { OverlayDialog, Providers } from 'app-portal'; +import type { Metadata } from 'next'; + +export const metadata: Metadata = { + title: 'Statistics', +}; + +export default function Layout({ children }: { children: React.ReactNode }) { + return ( + + + {children} + + ); +} + +export const dynamic = 'force-static'; diff --git a/packages/app-explorer/src/app/statistics/page.tsx b/packages/app-explorer/src/app/statistics/page.tsx new file mode 100644 index 000000000..d877533ce --- /dev/null +++ b/packages/app-explorer/src/app/statistics/page.tsx @@ -0,0 +1,23 @@ +'use client'; +import { Box, Flex } from '@fuels/ui'; +import { tv } from 'tailwind-variants'; +import { StatisticsScreen } from '~/systems/Statistics/screens/StatisticsScreen'; + +const Statistics = () => { + const classes = styles(); + return ( + + + + + + ); +}; +const styles = tv({ + slots: { + content: 'w-full max-w-[100%]', + }, +}); +export default Statistics; + +export const dynamic = 'force-static'; diff --git a/packages/app-explorer/src/systems/Statistics/actions/getAccounts.ts b/packages/app-explorer/src/systems/Statistics/actions/getAccounts.ts new file mode 100644 index 000000000..24ab2d9a8 --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/actions/getAccounts.ts @@ -0,0 +1,124 @@ +'use server'; + +import { z } from 'zod'; +import { act } from '~/systems/Core/utils/act-server'; +import { sdk } from '~/systems/Core/utils/sdk'; +import { + createIntervals, + getUnitAndInterval, + processAccounts, // You would need to implement this to handle account-specific data +} from '../utils/utils'; + +const schema = z.object({ + timeFilter: z.string().optional().nullable(), +}); + +interface AccountParams { + timeFilter?: string; +} + +interface AccountNode { + __typename: 'Account'; + timestamp: string; +} + +// Common function to process account statistics +async function fetchAccountStatistics( + params: AccountParams, + fieldName: + | 'accountCreationStatistics' + | 'cumulativeAccountCreationStatistics', + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, + isCumulative = false, +) { + const data = await (isCumulative + ? sdk.cumulativeAccountCreationStatistics(params) + : sdk.accountCreationStatistics(params)); + + const { nodes, offset } = extractAccountData(data, fieldName); + + if (!nodes.length) { + return isCumulative ? { accounts: [], offset: 0 } : { accounts: [] }; + } + + const firstTimestamp = Number(nodes[0].timestamp); + const lastTimestamp = Number(nodes[nodes.length - 1].timestamp); + + const intervalMap = createIntervals( + firstTimestamp, + lastTimestamp, + unit, + intervalSize, + ); + const accounts = processAccounts(nodes, intervalMap); // Use this function for account-specific logic + console.log('Account Stats --->', offset, accounts); + if (isCumulative) { + return { accounts, offset }; + } + + return accounts; +} + +// Helper to extract nodes and timestamps from the response +function extractAccountData( + data: any, + fieldName: string, +): { nodes: AccountNode[]; offset?: number } { + const nodes = data.data[fieldName]?.nodes || []; + const offset = data.data[fieldName]?.accountOffset; + return { nodes, offset }; +} + +async function getCumulativeAccountCreationStats( + params: AccountParams, + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, +) { + return fetchAccountStatistics( + params, + 'cumulativeAccountCreationStatistics', + unit, + intervalSize, + true, + ); +} + +export async function getAccountCreationStats( + params: AccountParams, + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, +) { + return fetchAccountStatistics( + params, + 'accountCreationStatistics', + unit, + intervalSize, + ); +} + +export const getAccountStats = act(schema, async ({ timeFilter }) => { + const params = { timeFilter: timeFilter } as { timeFilter?: string }; + const { unit, intervalSize } = getUnitAndInterval(params.timeFilter || ''); + console.log('Hello its is called'); + + return getAccountCreationStats(params, unit, intervalSize); +}); + +export const getDailyAccountCreationStats = act( + schema, + async ({ timeFilter }) => { + const params = { timeFilter: timeFilter } as { timeFilter?: string }; + console.log('The timefilter for the new accounts', timeFilter); + + // Use 'day' as the unit and 1 as the interval size + return getAccountCreationStats(params, 'day', 1); + }, +); + +export const getCumulativeAccountStats = act(schema, async ({ timeFilter }) => { + const params = { timeFilter: timeFilter } as { timeFilter?: string }; + const { unit, intervalSize } = getUnitAndInterval(params.timeFilter || ''); + + return getCumulativeAccountCreationStats(params, unit, intervalSize); +}); diff --git a/packages/app-explorer/src/systems/Statistics/actions/getBlocks.ts b/packages/app-explorer/src/systems/Statistics/actions/getBlocks.ts new file mode 100644 index 000000000..00b463e99 --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/actions/getBlocks.ts @@ -0,0 +1,62 @@ +'use server'; + +import { z } from 'zod'; +import { act } from '~/systems/Core/utils/act-server'; +import { sdk } from '~/systems/Core/utils/sdk'; +import { DateHelper } from '../utils/date'; +import { createIntervals, getUnitAndInterval } from '../utils/utils'; + +const schema = z.object({ + timeFilter: z.string().optional().nullable(), +}); + +export const getBlockStats = act(schema, async ({ timeFilter }) => { + const params = { timeFilter: timeFilter } as { + timeFilter?: string; + }; + const data = await sdk.blockRewardStatistics(params); + + if (!data.data.blockRewardStatistics.nodes) { + return {}; + } + const { unit, intervalSize } = getUnitAndInterval(params.timeFilter || ''); + const nodes = data.data.blockRewardStatistics.nodes; + const firstTimestamp = Number(DateHelper.tai64toDate(nodes[0].timestamp)); + const lastTimestamp = Number( + DateHelper.tai64toDate(nodes[nodes.length - 1].timestamp), + ); + + const intervals = createIntervals( + firstTimestamp, + lastTimestamp, + unit, + intervalSize, + ); + + const intervalMap = intervals.map((interval) => ({ + start: interval.start.toISOString(), + end: interval.end.toISOString(), + count: 0, + totalRewards: 0, + })); + + // Process blocks and put them into the correct interval + nodes.forEach((block) => { + const blockTimestamp = Number(DateHelper.tai64toDate(block.timestamp)); + const blockReward = Number(block.reward); + + // Find the correct interval for the current block + for (const interval of intervalMap) { + const intervalStart = new Date(interval.start).getTime(); + const intervalEnd = new Date(interval.end).getTime(); + + if (blockTimestamp >= intervalStart && blockTimestamp < intervalEnd) { + // Increment count and add the reward to totalRewards + interval.count += 1; + interval.totalRewards += blockReward; + break; // Block has been assigned to the correct interval, no need to check further + } + } + }); + return intervalMap; +}); diff --git a/packages/app-explorer/src/systems/Statistics/actions/getTransactions.ts b/packages/app-explorer/src/systems/Statistics/actions/getTransactions.ts new file mode 100644 index 000000000..89806e652 --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/actions/getTransactions.ts @@ -0,0 +1,131 @@ +'use server'; + +import { z } from 'zod'; +import { act } from '~/systems/Core/utils/act-server'; +import { sdk } from '~/systems/Core/utils/sdk'; +import { DateHelper } from '../utils/date'; +import { + createIntervals, + getUnitAndInterval, + processTransactions, +} from '../utils/utils'; + +const schema = z.object({ + timeFilter: z.string().optional().nullable(), +}); + +interface TransactionParams { + timeFilter?: string; +} + +interface TransactionNode { + __typename: 'TransactionFee'; + fee: string; + timestamp: string; +} + +// Common function to process transaction statistics +async function fetchTransactionStatistics( + params: TransactionParams, + fieldName: + | 'transactionsFeeStatistics' + | 'cumulativeTransactionsFeeStatistics', + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, + isCumulative = false, +) { + const data = await (isCumulative + ? sdk.cumulativeTransactionsFeeStatistics(params) + : sdk.transactionsFeeStatistics(params)); + + const { nodes, offset } = extractTransactionData(data, fieldName); + + if (!nodes.length) { + return isCumulative + ? { transactions: [], offset: 0 } + : { transactions: [] }; + } + + const firstTimestamp = Number(DateHelper.tai64toDate(nodes[0].timestamp)); + const lastTimestamp = Number( + DateHelper.tai64toDate(nodes[nodes.length - 1].timestamp), + ); + + const intervalMap = createIntervals( + firstTimestamp, + lastTimestamp, + unit, + intervalSize, + ); + const transactions = processTransactions(nodes, intervalMap); + + if (isCumulative) { + return { transactions, offset }; + } + + return transactions; +} + +// Helper to extract nodes and timestamps from the response +function extractTransactionData( + data: any, + fieldName: string, +): { nodes: TransactionNode[]; offset?: number } { + const nodes = data.data[fieldName]?.nodes || []; + const offset = data.data[fieldName]?.transactionOffset; + return { nodes, offset }; +} + +async function getCumulativeTransactionFeeStats( + params: TransactionParams, + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, +) { + return fetchTransactionStatistics( + params, + 'cumulativeTransactionsFeeStatistics', + unit, + intervalSize, + true, + ); +} + +export async function getTransactionFeeStats( + params: TransactionParams, + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, +) { + return fetchTransactionStatistics( + params, + 'transactionsFeeStatistics', + unit, + intervalSize, + ); +} + +export const getTransactionStats = act(schema, async ({ timeFilter }) => { + const params = { timeFilter: timeFilter } as { timeFilter?: string }; + const { unit, intervalSize } = getUnitAndInterval(params.timeFilter || ''); + + return getTransactionFeeStats(params, unit, intervalSize); +}); + +export const getDailyTransactionFeeStats = act( + schema, + async ({ timeFilter }) => { + const params = { timeFilter: timeFilter } as { timeFilter?: string }; + + // Use 'day' as the unit and 1 as the interval size + return getTransactionFeeStats(params, 'day', 1); + }, +); + +export const getCumulativeTransactionStats = act( + schema, + async ({ timeFilter }) => { + const params = { timeFilter: timeFilter } as { timeFilter?: string }; + const { unit, intervalSize } = getUnitAndInterval(params.timeFilter || ''); + + return getCumulativeTransactionFeeStats(params, unit, intervalSize); + }, +); diff --git a/packages/app-explorer/src/systems/Statistics/components/Hero/Hero.tsx b/packages/app-explorer/src/systems/Statistics/components/Hero/Hero.tsx new file mode 100644 index 000000000..ff6b5adf4 --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/components/Hero/Hero.tsx @@ -0,0 +1,24 @@ +import { StatsHeaderTile } from '../StatsHeaderTile/StatsHeaderTile'; + +interface StatsData { + titleProp: string; + valuesProp: string; + timeProp: string; +} + +const Hero = ({ stats }: { stats: StatsData[] }) => { + return ( +
+ {stats.map((stat, index) => ( + + ))} +
+ ); +}; + +export default Hero; diff --git a/packages/app-explorer/src/systems/Statistics/components/StatsHeaderTile/StatsHeaderTile.tsx b/packages/app-explorer/src/systems/Statistics/components/StatsHeaderTile/StatsHeaderTile.tsx new file mode 100644 index 000000000..2ef2aaad5 --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/components/StatsHeaderTile/StatsHeaderTile.tsx @@ -0,0 +1,33 @@ +import { RoundedContainer } from '@fuels/ui'; + +interface LineGraphProps { + titleProp: string; + valuesProp: string; + timeProp: string; +} + +export const StatsHeaderTile: React.FC = ({ + titleProp, + valuesProp, + timeProp, +}) => { + return ( + +

+ {titleProp} +

+

+ {valuesProp} +

+

+ {timeProp} +

+
+ ); +}; diff --git a/packages/app-explorer/src/systems/Statistics/components/accountStats.tsx b/packages/app-explorer/src/systems/Statistics/components/accountStats.tsx new file mode 100644 index 000000000..ae46bdac3 --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/components/accountStats.tsx @@ -0,0 +1,218 @@ +import { Grid, LineGraph, LoadingBox, LoadingWrapper } from '@fuels/ui'; +import React, { useState, useEffect } from 'react'; + +import { + getCumulativeAccountStats, + getDailyActiveAccountStatsAction, + getNewAccountStats, +} from '../getAccounts'; +import { + filterOption, + getFilterOptionByValue, + mapTimeRangeFilterToDataValue, +} from '../utils/utils'; + +const TransaccountStats = () => { + const [cumulativeAccountsData, setCumulativeAccountsData] = useState( + [], + ); + const [newAccountsData, setNewAccountsData] = useState([]); + const [dailyAccountsData, setDailyAccountsData] = useState([]); + + const [cumulativeAccountFilter, setCumulativeAccountFilter] = + useState(filterOption.d7); + const [newAccountsFilter, setNewAccountsFilter] = useState( + filterOption.d7, + ); + const [dailyAccountsDataFilter, setDailyAccountsDataFilter] = + useState(filterOption.d7); + + const [isLoadingNewAccountsData, setIsLoadingNewAccountsData] = + useState(true); + const [isLoadingCumulativeAccountsData, setIsLoadingCumulativeAccountsData] = + useState(true); + const [isLoadingDailyAccountsData, setIsLoadingDailyAccountsData] = + useState(true); + + const getNewAccountStatistics = async (selectedFilter: filterOption) => { + const displayValue = mapTimeRangeFilterToDataValue(selectedFilter); + try { + const data: any = await getNewAccountStats({ + timeFilter: displayValue, + }); + + if (!Array.isArray(data)) { + throw new Error('Expected data to be an array'); + } + const transformedData = data.map((item: any) => ({ + start: item.start, + count: item.count, + dailyRewards: item.dailyFee, + })); + return transformedData; + } catch (error) { + console.error('Error fetching or processing block statistics:', error); + return []; + } + }; + + const getCumulativeAccountStatistics = async ( + selectedFilter: filterOption, + ) => { + const displayValue = mapTimeRangeFilterToDataValue(selectedFilter); + try { + const data: any = await getCumulativeAccountStats({ + timeFilter: displayValue, + }); + + if (!Array.isArray(data.accounts)) { + throw new Error('Expected data to be an array'); + } + let previousCount = data.offset ?? 0; + const transformedData = data.accounts.map((item: any) => { + const currentCount = previousCount + item.count; + const result = { + start: item.start, + count: currentCount, + rewards: item.totalFee, + }; + previousCount = currentCount; + return result; + }); + + return transformedData; + } catch (error) { + console.error('Error fetching or processing account statistics:', error); + return []; + } + }; + + const getDailyAccountsData = async (selectedFilter: filterOption) => { + const _displayValue = mapTimeRangeFilterToDataValue(selectedFilter); + try { + const data: any = await getDailyActiveAccountStatsAction({ + timeFilter: _displayValue, + }); + + if (!Array.isArray(data)) { + throw new Error('Expected data to be an array'); + } + const transformedData = data.map((item: any) => ({ + start: item.start, + count: item.count, + rewards: item.dailyFee, + })); + + return transformedData; + } catch (error) { + console.error('Error fetching or processing block statistics:', error); + return []; + } + }; + + useEffect(() => { + setIsLoadingNewAccountsData(true); + getNewAccountStatistics(newAccountsFilter).then((value: any) => { + setNewAccountsData(value); + setIsLoadingNewAccountsData(false); + }); + }, [newAccountsFilter]); + + useEffect(() => { + setIsLoadingCumulativeAccountsData(true); + getCumulativeAccountStatistics(cumulativeAccountFilter).then( + (value: any) => { + setCumulativeAccountsData(value); + setIsLoadingCumulativeAccountsData(false); + }, + ); + }, [cumulativeAccountFilter]); + + useEffect(() => { + setIsLoadingDailyAccountsData(true); + getDailyAccountsData(dailyAccountsDataFilter).then((value: any) => { + setDailyAccountsData(value); + setIsLoadingDailyAccountsData(false); + }); + }, [dailyAccountsDataFilter]); + + return ( +
+

+ Accounts +

+ + + +
+ } + regularEl={ + { + setCumulativeAccountFilter(getFilterOptionByValue(days)); + }} + /> + } + /> + + + + + } + regularEl={ + total + item.count, + 0, + )} + timeRangeOptions={Object.values(filterOption) as []} + onTimeRangeChange={(days) => { + setDailyAccountsDataFilter(getFilterOptionByValue(days)); + }} + /> + } + /> + + + + + } + regularEl={ + total + item.count, + 0, + )} + onTimeRangeChange={(days) => { + setNewAccountsFilter(getFilterOptionByValue(days)); + }} + /> + } + /> + + + ); +}; + +export default TransaccountStats; diff --git a/packages/app-explorer/src/systems/Statistics/components/blockStats.tsx b/packages/app-explorer/src/systems/Statistics/components/blockStats.tsx new file mode 100644 index 000000000..6d395b01c --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/components/blockStats.tsx @@ -0,0 +1,132 @@ +import { Grid, LoadingBox, LoadingWrapper } from '@fuels/ui'; +import { LineGraph } from '@fuels/ui'; +import { useEffect, useState } from 'react'; +import { getBlockStats } from '../actions/getBlocks'; +import { + filterOption, + getFilterOptionByValue, + mapTimeRangeFilterToDataValue, +} from '../utils/utils'; + +const BlockStats = () => { + const [newBlocksData, setNewBlocksData] = useState([]); + const [averageBlocksData, setAverageBlocksData] = useState([]); + + const [blockTimeFilter, setBlockTimeFilter] = useState( + filterOption.d7, + ); + const [blockAvgTimeFilter, setblockAvgTimeFilter] = useState( + filterOption.d7, + ); + + const [isLoadingNewBlocks, setIsLoadingNewBlocks] = useState(true); + const [isLoadingAvgBlocks, setIsLoadingAvgBlocks] = useState(true); + + const getBlockStatistics = async (selectedFilter: filterOption) => { + const displayValue = mapTimeRangeFilterToDataValue(selectedFilter); + + try { + const data: any = await getBlockStats({ + timeFilter: displayValue, + }); + + if (!Array.isArray(data)) { + throw new Error('Expected data to be an array'); + } + + const transformedData = data.map((item: any) => ({ + start: item.start, + count: item.count, + totalRewards: item.totalRewards, + })); + + return transformedData; + } catch (error) { + console.error('Error fetching or processing block statistics:', error); + return []; + } + }; + + useEffect(() => { + setIsLoadingNewBlocks(true); + getBlockStatistics(blockTimeFilter).then((value: any) => { + setNewBlocksData(value); + setIsLoadingNewBlocks(false); + }); + }, [blockTimeFilter]); + + useEffect(() => { + setIsLoadingAvgBlocks(true); + getBlockStatistics(blockAvgTimeFilter).then((value: any) => { + const transformedData = Array.isArray(value) + ? value.map((item: any) => { + const count = Number(item.count) || 1; + const averageReward = (Number(item.totalRewards) || 0) / count; + const averageRewardInETH = averageReward / 10 ** 9; + return { + start: item.start, + count: averageRewardInETH.toFixed(9), + }; + }) + : []; + setAverageBlocksData(transformedData); + setIsLoadingAvgBlocks(false); + }); + }, [blockAvgTimeFilter]); + + return ( +
+

+ Blocks +

+ + + +
+ } + regularEl={ + total + item.count, + 0, + )} + selectedTimeRange={blockTimeFilter} + timeRangeOptions={Object.values(filterOption) as []} + onTimeRangeChange={(days) => { + setBlockTimeFilter(getFilterOptionByValue(days)); + }} + /> + } + /> + + + + } + regularEl={ + { + setblockAvgTimeFilter(getFilterOptionByValue(days)); + }} + /> + } + /> + + + ); +}; + +export default BlockStats; diff --git a/packages/app-explorer/src/systems/Statistics/components/statsHeader.tsx b/packages/app-explorer/src/systems/Statistics/components/statsHeader.tsx new file mode 100644 index 000000000..02babd702 --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/components/statsHeader.tsx @@ -0,0 +1,110 @@ +import { Heading, LoadingBox, LoadingWrapper, VStack } from '@fuels/ui'; +import React, { useState, useEffect } from 'react'; +import { tv } from 'tailwind-variants'; +import { getBlockStats } from '../actions/getBlocks'; +import { getTransactionStats } from '../actions/getTransactions'; +import Hero from './Hero/Hero'; + +const StatsHeader = () => { + const classes = styles(); + + const [stats, setStats] = useState([]); + const [isLoading, setIsLoading] = useState(true); // State to manage loading + + const getStats = async () => { + let totalTransactions = 0; + let totalNetworkFee = 0; + let totalBlock = 0; + let tps = 0; + + try { + const transactions: any = await getTransactionStats({ + timeFilter: '1day', + }); + const blocks: any = await getBlockStats({ timeFilter: '1day' }); + + if (transactions) { + transactions.map((transaction: any) => { + totalTransactions += transaction.count; + totalNetworkFee += transaction.totalFee; + }); + tps = totalTransactions / 86400; + } + + if (blocks) { + blocks.map((block: any) => { + totalBlock += block.count; + }); + } + + return [ + { + titleProp: 'Transactions', + valuesProp: totalTransactions, + timeProp: 'Last 24h', + }, + { + titleProp: 'Transaction Per Second (TPS)', + valuesProp: tps.toFixed(2), + timeProp: 'Last 24h', + }, + { + titleProp: 'Total Network Fees (ETH)', + valuesProp: totalNetworkFee / 10 ** 9, + timeProp: 'Last 24h', + }, + { titleProp: 'Blocks', valuesProp: totalBlock, timeProp: 'Last 24h' }, + ]; + } catch (error) { + console.error('Error fetching stats', error); + return []; + } + }; + + useEffect(() => { + getStats().then((value: any) => { + setStats(value); + setIsLoading(false); + }); + }, []); + + return ( + + Statistics + + + + + + + } + regularEl={ +
+ +
+ } + /> +
+ ); +}; + +export default StatsHeader; + +const styles = tv({ + slots: { + root: 'overflow-clip relative w-full border-border bg-white dark:bg-gray-1', + container: [ + ' [&_.rt-ContainerInner]:tablet:max-laptop:bg-opacity-60 [&_.rt-ContainerInner]:tablet:max-laptop:rounded-lg [&_.rt-ContainerInner]:tablet:max-laptop:shadow-2xl', + ], + input: 'w-full tablet:w-[400px]', + title: [ + 'text-2xl leading-snug text-heading justify-center', + 'tablet:text-left tablet:text-4xl tablet:justify-start', + ], + subtitle: ['text-base mb-8 justify-center'], + searchWrapper: 'grid grid-cols-12 grid-rows-auto auto-rows-min gap-5', + }, +}); diff --git a/packages/app-explorer/src/systems/Statistics/components/transactionStats.tsx b/packages/app-explorer/src/systems/Statistics/components/transactionStats.tsx new file mode 100644 index 000000000..68de1848b --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/components/transactionStats.tsx @@ -0,0 +1,264 @@ +import { Grid, LineGraph, LoadingBox, LoadingWrapper } from '@fuels/ui'; +import React, { useState, useEffect } from 'react'; +import { + getCumulativeTransactionStats, + getTransactionStats, +} from '../actions/getTransactions'; +import { + filterOption, + getFilterOptionByValue, + mapTimeRangeFilterToDataValue, +} from '../utils/utils'; + +const TransactionStats = () => { + const [cumulativeTransactionsData, setCumulativeTransactionsData] = useState< + any[] + >([]); + const [dailyTransactionsData, setDailyTransactionsData] = useState([]); + const [dailyTransactionFeeData, setdailyTransactionFeeData] = useState( + [], + ); + const [averageTransactionsData, setAverageTransactionsData] = useState( + [], + ); + + const [cumulativeTransactionFilter, setCumulativeTransactionFilter] = + useState(filterOption.d7); + const [cumulativeTransactionFeeFilter, setCumulativeTransactionFeeFilter] = + useState(filterOption.d7); + const [averageTransactionsFilter, setAverageTransactionsFilter] = + useState(filterOption.d7); + const [dailyTransactionsFilter, setdailyTransactionsFilter] = + useState(filterOption.d7); + + const [isLoadingDailyTransactions, setIsLoadingDailyTransactions] = + useState(true); + const [ + isLoadingdailyTransactionFeeData, + setIsLoadingdailyTransactionFeeData, + ] = useState(true); + const [ + isLoadingCumulativeTransactionsData, + setIsLoadingCumulativeTransactionsData, + ] = useState(true); + const [ + isLoadingAverageTransactionsData, + setIsLoadingAverageTransactionsData, + ] = useState(true); + + const getTransactionStatistics = async (selectedFilter: filterOption) => { + const displayValue = mapTimeRangeFilterToDataValue(selectedFilter); + try { + const data: any = await getTransactionStats({ + timeFilter: displayValue, + }); + + if (!Array.isArray(data)) { + throw new Error('Expected data to be an array'); + } + const transformedData = data.map((item: any) => ({ + start: item.start, + count: item.count, + totalRewards: item.totalFee, + })); + + return transformedData; + } catch (error) { + console.error('Error fetching or processing block statistics:', error); + return []; + } + }; + + const getCumulativeTransactionStatistics = async ( + selectedFilter: filterOption, + ) => { + const displayValue = mapTimeRangeFilterToDataValue(selectedFilter); + try { + const data: any = await getCumulativeTransactionStats({ + timeFilter: displayValue, + }); + + if (!Array.isArray(data?.transactions)) { + throw new Error('Expected data to be an array'); + } + + let previousCount = +data?.offset ?? 0; + + const transformedData = data.transactions.map((item: any) => { + const currentCount = previousCount + item.count; + const result = { + start: item.start, + count: currentCount, + rewards: item.totalFee, + }; + previousCount = currentCount; + return result; + }); + + return transformedData; + } catch (error) { + console.error('Error fetching or processing block statistics:', error); + return []; + } + }; + + useEffect(() => { + setIsLoadingDailyTransactions(true); + getTransactionStatistics(dailyTransactionsFilter).then((value: any) => { + setDailyTransactionsData(value); + setIsLoadingDailyTransactions(false); + }); + }, [dailyTransactionsFilter]); + + useEffect(() => { + setIsLoadingAverageTransactionsData(true); + getTransactionStatistics(averageTransactionsFilter).then((value: any) => { + const transformedData = Array.isArray(value) + ? value.map((item: any) => { + const totalFeeSpent = Number(item.totalRewards) || 0; + const totalCount = Number(item.count) || 1; + const totalFeeInEth = totalFeeSpent / 10 ** 9; + const average = totalCount ? totalFeeInEth / totalCount : 0; + return { + start: item.start, + count: average.toFixed(9), + }; + }) + : []; + + setAverageTransactionsData(transformedData); + setIsLoadingAverageTransactionsData(false); + }); + }, [averageTransactionsFilter]); + + useEffect(() => { + setIsLoadingCumulativeTransactionsData(true); + getCumulativeTransactionStatistics(cumulativeTransactionFilter).then( + (value: any) => { + setCumulativeTransactionsData(value); + setIsLoadingCumulativeTransactionsData(false); + }, + ); + }, [cumulativeTransactionFilter]); + + useEffect(() => { + setIsLoadingdailyTransactionFeeData(true); + getCumulativeTransactionStatistics(cumulativeTransactionFeeFilter).then( + (value: any) => { + const transformedData = Array.isArray(value) + ? value.map((item: any) => { + const totalFeeSpent = Number(item.rewards) || 0; + const feeInEth = totalFeeSpent / 10 ** 9; + return { + start: item.start, + count: feeInEth.toFixed(9), + }; + }) + : []; + setdailyTransactionFeeData(transformedData); + setIsLoadingdailyTransactionFeeData(false); + }, + ); + }, [cumulativeTransactionFeeFilter]); + const totalCount = averageTransactionsData.reduce( + (acc, curr) => acc + curr.count, + 0, + ); + const averageCount = totalCount / averageTransactionsData.length || 0; // Ensure there's no division by zero + + return ( +
+

+ Transactions +

+ + + +
+ } + regularEl={ + { + setCumulativeTransactionFilter(getFilterOptionByValue(days)); + }} + /> + } + /> + + + + + } + regularEl={ + { + setdailyTransactionsFilter(getFilterOptionByValue(days)); + }} + /> + } + /> + + + + + } + regularEl={ + { + setCumulativeTransactionFeeFilter(getFilterOptionByValue(days)); + }} + /> + } + /> + + + + } + regularEl={ + { + setAverageTransactionsFilter(getFilterOptionByValue(days)); + }} + /> + } + /> + + + ); +}; + +export default TransactionStats; diff --git a/packages/app-explorer/src/systems/Statistics/getAccounts.ts b/packages/app-explorer/src/systems/Statistics/getAccounts.ts new file mode 100644 index 000000000..6d130f58f --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/getAccounts.ts @@ -0,0 +1,137 @@ +'use server'; + +import { z } from 'zod'; +import { act } from '../../systems/Core/utils/act-server'; +import { sdk } from '../../systems/Core/utils/sdk'; +import { + createIntervals, + getUnitAndInterval, + processAccounts, // You would need to implement this to handle account-specific data +} from '../utils/utils'; + +const schema = z.object({ + timeFilter: z.string().optional().nullable(), +}); + +interface AccountParams { + timeFilter?: string; +} + +interface AccountNode { + __typename: 'Account'; + timestamp: string; +} + +// Common function to process account statistics +async function fetchAccountStatistics( + params: AccountParams, + fieldName: + | 'newAccountStatistics' + | 'cumulativeAccountCreationStatistics' + | 'dailyActiveAccounts', + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, + isCumulative = false, +) { + const data = await (fieldName === 'dailyActiveAccounts' + ? sdk.dailyActiveAccounts(params) + : isCumulative + ? sdk.cumulativeAccountCreationStatistics(params) + : sdk.newAccountStatistics(params)); + + const { nodes, offset } = extractAccountData(data, fieldName); + if (!nodes.length) { + return isCumulative ? { accounts: [], offset: 0 } : { accounts: [] }; + } + + const firstTimestamp = Number(nodes[0].timestamp); + const lastTimestamp = Number(nodes[nodes.length - 1].timestamp); + + const intervalMap = createIntervals( + firstTimestamp, + lastTimestamp, + unit, + intervalSize, + ); + const accounts = processAccounts(nodes, intervalMap); + + if (isCumulative) { + return { accounts, offset }; + } + + return accounts; +} + +// Helper to extract nodes and timestamps from the response +function extractAccountData( + data: any, + fieldName: string, +): { nodes: AccountNode[]; offset?: number } { + const nodes = data.data[fieldName]?.nodes || []; + const offset = data.data[fieldName]?.accountOffset; + return { nodes, offset }; +} + +async function getDailyActiveAccountStats( + params: AccountParams, + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, +) { + return fetchAccountStatistics( + params, + 'dailyActiveAccounts', // Specify the new field for daily active accounts + unit, + intervalSize, + ); +} + +async function getCumulativeAccountCreationStats( + params: AccountParams, + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, +) { + return fetchAccountStatistics( + params, + 'cumulativeAccountCreationStatistics', + unit, + intervalSize, + true, + ); +} + +async function getNewAccountCreationStats( + params: AccountParams, + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, +) { + return fetchAccountStatistics( + params, + 'newAccountStatistics', + unit, + intervalSize, + ); +} + +export const getDailyActiveAccountStatsAction = act( + schema, + async ({ timeFilter }) => { + const params = { timeFilter: timeFilter } as { timeFilter?: string }; + const { unit, intervalSize } = getUnitAndInterval(params.timeFilter || ''); + + return getDailyActiveAccountStats(params, unit, intervalSize); + }, +); + +export const getNewAccountStats = act(schema, async ({ timeFilter }) => { + const params = { timeFilter: timeFilter } as { timeFilter?: string }; + const { unit, intervalSize } = getUnitAndInterval(params.timeFilter || ''); + + return getNewAccountCreationStats(params, unit, intervalSize); +}); + +export const getCumulativeAccountStats = act(schema, async ({ timeFilter }) => { + const params = { timeFilter: timeFilter } as { timeFilter?: string }; + const { unit, intervalSize } = getUnitAndInterval(params.timeFilter || ''); + + return getCumulativeAccountCreationStats(params, unit, intervalSize); +}); diff --git a/packages/app-explorer/src/systems/Statistics/getBlocks.ts b/packages/app-explorer/src/systems/Statistics/getBlocks.ts new file mode 100644 index 000000000..1eba670f1 --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/getBlocks.ts @@ -0,0 +1,62 @@ +'use server'; + +import { z } from 'zod'; +import { act } from '../../systems/Core/utils/act-server'; +import { sdk } from '../../systems/Core/utils/sdk'; +import { DateHelper } from '../utils/date'; +import { createIntervals, getUnitAndInterval } from '../utils/utils'; + +const schema = z.object({ + timeFilter: z.string().optional().nullable(), +}); + +export const getBlockStats = act(schema, async ({ timeFilter }) => { + const params = { timeFilter: timeFilter } as { + timeFilter?: string; + }; + const data = await sdk.blockRewardStatistics(params); + + if (!data.data.blockRewardStatistics.nodes) { + return {}; + } + const { unit, intervalSize } = getUnitAndInterval(params.timeFilter || ''); + const nodes = data.data.blockRewardStatistics.nodes; + const firstTimestamp = Number(DateHelper.tai64toDate(nodes[0].timestamp)); + const lastTimestamp = Number( + DateHelper.tai64toDate(nodes[nodes.length - 1].timestamp), + ); + + const intervals = createIntervals( + firstTimestamp, + lastTimestamp, + unit, + intervalSize, + ); + + const intervalMap = intervals.map((interval) => ({ + start: interval.start.toISOString(), + end: interval.end.toISOString(), + count: 0, + totalRewards: 0, + })); + + // Process blocks and put them into the correct interval + nodes.forEach((block) => { + const blockTimestamp = Number(DateHelper.tai64toDate(block.timestamp)); + const blockReward = Number(block.reward); + + // Find the correct interval for the current block + for (const interval of intervalMap) { + const intervalStart = new Date(interval.start).getTime(); + const intervalEnd = new Date(interval.end).getTime(); + + if (blockTimestamp >= intervalStart && blockTimestamp < intervalEnd) { + // Increment count and add the reward to totalRewards + interval.count += 1; + interval.totalRewards += blockReward; + break; // Block has been assigned to the correct interval, no need to check further + } + } + }); + return intervalMap; +}); diff --git a/packages/app-explorer/src/systems/Statistics/getTopAccounts.ts b/packages/app-explorer/src/systems/Statistics/getTopAccounts.ts new file mode 100644 index 000000000..11393c06e --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/getTopAccounts.ts @@ -0,0 +1,75 @@ +'use server'; + +import { z } from 'zod'; +import { act } from '../../systems/Core/utils/act-server'; +import { sdk } from '../../systems/Core/utils/sdk'; + +// Schema to validate inputs +const schema = z.object({ + sortBy: z.string().optional(), // Sorting criteria (balance, transaction_count, etc.) + sortOrder: z.string().optional(), // asc or desc + first: z.number().optional().nullable(), // Number of accounts to fetch, can be null + cursor: z.string().optional().nullable(), // Pagination cursor +}); + +// Common function to fetch top accounts +async function fetchTopAccounts( + sortBy = 'transaction_count', // Default to transaction_count + sortOrder: 'asc' | 'desc' = 'desc', // Default to descending order + first: number | null = null, // Allow null to fetch all records if no limit is provided + cursor?: string | null, // Cursor for pagination (optional) +) { + const queryParams: Record = { + sortBy, + sortOrder, + cursor, + }; + + // If `first` is provided and not null, add it to the query parameters + if (first !== null) { + queryParams.first = first; + } + + const data = await sdk.paginatedAccounts(queryParams); + + // Handle case where no data is returned + if (!data.data.paginatedAccounts.nodes.length) { + return { + accounts: [], + pageInfo: { + hasNextPage: false, + hasPreviousPage: false, + startCursor: null, + endCursor: null, + }, + }; + } + + const { nodes, pageInfo } = data.data.paginatedAccounts; + + const accounts = nodes.map((account: any) => ({ + id: account.id, + account_id: account.account_id, + balance: account.balance, + transaction_count: account.transaction_count, + })); + + return { + accounts, + pageInfo: { + hasNextPage: pageInfo.hasNextPage, + hasPreviousPage: pageInfo.hasPreviousPage, + startCursor: pageInfo.startCursor, + endCursor: pageInfo.endCursor, + }, + }; +} + +export const getTopAccounts = act(schema, async (params) => { + const sortBy = params.sortBy || 'transaction_count'; + const sortOrder = (params.sortOrder || 'desc') as 'asc' | 'desc'; + const first = params.first === null ? null : params.first || 10; + const cursor = params.cursor || null; + + return fetchTopAccounts(sortBy, sortOrder, first, cursor); +}); diff --git a/packages/app-explorer/src/systems/Statistics/getTransactions.ts b/packages/app-explorer/src/systems/Statistics/getTransactions.ts new file mode 100644 index 000000000..9b5657346 --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/getTransactions.ts @@ -0,0 +1,131 @@ +'use server'; + +import { z } from 'zod'; +import { act } from '../../systems/Core/utils/act-server'; +import { sdk } from '../../systems/Core/utils/sdk'; +import { DateHelper } from '../utils/date'; +import { + createIntervals, + getUnitAndInterval, + processTransactions, +} from '../utils/utils'; + +const schema = z.object({ + timeFilter: z.string().optional().nullable(), +}); + +interface TransactionParams { + timeFilter?: string; +} + +interface TransactionNode { + __typename: 'TransactionFee'; + fee: string; + timestamp: string; +} + +// Common function to process transaction statistics +async function fetchTransactionStatistics( + params: TransactionParams, + fieldName: + | 'transactionsFeeStatistics' + | 'cumulativeTransactionsFeeStatistics', + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, + isCumulative = false, +) { + const data = await (isCumulative + ? sdk.cumulativeTransactionsFeeStatistics(params) + : sdk.transactionsFeeStatistics(params)); + + const { nodes, offset } = extractTransactionData(data, fieldName); + + if (!nodes.length) { + return isCumulative + ? { transactions: [], offset: 0 } + : { transactions: [] }; + } + + const firstTimestamp = Number(DateHelper.tai64toDate(nodes[0].timestamp)); + const lastTimestamp = Number( + DateHelper.tai64toDate(nodes[nodes.length - 1].timestamp), + ); + + const intervalMap = createIntervals( + firstTimestamp, + lastTimestamp, + unit, + intervalSize, + ); + const transactions = processTransactions(nodes, intervalMap); + + if (isCumulative) { + return { transactions, offset }; + } + + return transactions; +} + +// Helper to extract nodes and timestamps from the response +function extractTransactionData( + data: any, + fieldName: string, +): { nodes: TransactionNode[]; offset?: number } { + const nodes = data.data[fieldName]?.nodes || []; + const offset = data.data[fieldName]?.transactionOffset; + return { nodes, offset }; +} + +async function getCumulativeTransactionFeeStats( + params: TransactionParams, + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, +) { + return fetchTransactionStatistics( + params, + 'cumulativeTransactionsFeeStatistics', + unit, + intervalSize, + true, + ); +} + +export async function getTransactionFeeStats( + params: TransactionParams, + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, +) { + return fetchTransactionStatistics( + params, + 'transactionsFeeStatistics', + unit, + intervalSize, + ); +} + +export const getTransactionStats = act(schema, async ({ timeFilter }) => { + const params = { timeFilter: timeFilter } as { timeFilter?: string }; + const { unit, intervalSize } = getUnitAndInterval(params.timeFilter || ''); + + return getTransactionFeeStats(params, unit, intervalSize); +}); + +export const getDailyTransactionFeeStats = act( + schema, + async ({ timeFilter }) => { + const params = { timeFilter: timeFilter } as { timeFilter?: string }; + + // Use 'day' as the unit and 1 as the interval size + return getTransactionFeeStats(params, 'day', 1); + }, +); + +export const getCumulativeTransactionStats = act( + schema, + async ({ timeFilter }) => { + const params = { timeFilter: timeFilter } as { timeFilter?: string }; + const { unit, intervalSize } = getUnitAndInterval(params.timeFilter || ''); + + return getCumulativeTransactionFeeStats(params, unit, intervalSize); + }, +); diff --git a/packages/app-explorer/src/systems/Statistics/screens/StatisticsScreen.tsx b/packages/app-explorer/src/systems/Statistics/screens/StatisticsScreen.tsx new file mode 100644 index 000000000..f5d0df371 --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/screens/StatisticsScreen.tsx @@ -0,0 +1,19 @@ +import { Box, Theme } from '@fuels/ui'; + +import AccountStats from '../components/accountStats'; +import BlockStats from '../components/blockStats'; +import StatsHeader from '../components/statsHeader'; +import TransactionStats from '../components/transactionStats'; + +export const StatisticsScreen = () => { + return ( + + + + + + + + + ); +}; diff --git a/packages/app-explorer/src/systems/Statistics/utils/date.ts b/packages/app-explorer/src/systems/Statistics/utils/date.ts new file mode 100644 index 000000000..0232b5335 --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/utils/date.ts @@ -0,0 +1,20 @@ +import dayjs from 'dayjs'; +import relativeTime from 'dayjs/plugin/relativeTime'; +import { DateTime } from 'fuels'; +import { TAI64 } from 'tai64'; + +dayjs.extend(relativeTime); + +export class DateHelper { + static tai64toDate(tai64Timestamp: string) { + const timestamp = TAI64.fromString(tai64Timestamp, 10).toUnix(); + return dayjs(timestamp * 1000); + } + + static dateToTai64(date: Date) { + return TAI64.fromUnix(Math.floor(date.getTime() / 1000)).toString(10); + } + static getPreviousDayDate() { + return new Date(new Date(DateTime.now()).setDate(new Date().getDate() - 1)); + } +} diff --git a/packages/app-explorer/src/systems/Statistics/utils/utils.ts b/packages/app-explorer/src/systems/Statistics/utils/utils.ts new file mode 100644 index 000000000..a0e41e079 --- /dev/null +++ b/packages/app-explorer/src/systems/Statistics/utils/utils.ts @@ -0,0 +1,265 @@ +import { DateHelper } from './date'; + +interface TransactionNode { + __typename: 'TransactionFee'; + fee: string; + timestamp: string; +} + +interface AccountNode { + timestamp: string; +} + +interface Interval { + start: Date; + end: Date; + count: number; // To track the number of transactions + totalFee: number; // To track the total transaction fees +} + +export function getUnitAndInterval(timeRange: string): { + unit: 'minute' | 'hour' | 'day' | 'month'; + intervalSize: number; +} { + switch (timeRange) { + case '1hr': + return { unit: 'minute', intervalSize: 5 }; + case '12hr': + return { unit: 'hour', intervalSize: 1 }; + case '1day': + return { unit: 'hour', intervalSize: 2 }; + case '7days': + return { unit: 'hour', intervalSize: 12 }; + case '14days': + return { unit: 'day', intervalSize: 1 }; + case '30days': + return { unit: 'day', intervalSize: 3 }; + case '90days': + return { unit: 'day', intervalSize: 10 }; + default: + return { unit: 'month', intervalSize: 1 }; + } +} + +export enum filterOption { + hr1 = '1H', + hr12 = '12H', + d1 = '1D', + d7 = '7D', + d14 = '14D', + d30 = '30D', + d90 = '90D', + All = 'All Time', +} +export const getFilterOptionByValue = (value: string): filterOption => { + console.log('Value is', value); + switch (value) { + case '1H': + return filterOption.hr1; + + case '12H': + return filterOption.hr12; + + case '1D': + return filterOption.d1; + + case '7D': + return filterOption.d7; + + case '14D': + return filterOption.d14; + + case '30D': + return filterOption.d30; + + case '90D': + return filterOption.d90; + + case 'All Time': + return filterOption.All; + + default: + return filterOption.d30; + } +}; + +export const mapTimeRangeFilterToDataValue = (value: string): string | null => { + switch (value) { + case filterOption.hr1: + return '1hr'; + case filterOption.hr12: + return '12hr'; + case filterOption.d1: + return '1day'; + case filterOption.d7: + return '7days'; + case filterOption.d14: + return '14days'; + case filterOption.d30: + return '30days'; + case filterOption.d90: + return '90days'; + case filterOption.All: + return null; + default: + return '30days'; + } +}; + +function roundToNearest( + time: number, + unit: 'minute' | 'hour' | 'day' | 'month', + roundUp = false, +): number { + const date = new Date(time); + + switch (unit) { + case 'minute': { + const msInMinute = 60 * 1000; + const msInFiveMinutes = 5 * msInMinute; + return roundUp + ? Math.ceil(time / msInFiveMinutes) * msInFiveMinutes + : Math.floor(time / msInFiveMinutes) * msInFiveMinutes; + } + + case 'hour': { + const msInHour = 60 * 60 * 1000; + return roundUp + ? Math.ceil(time / msInHour) * msInHour + : Math.floor(time / msInHour) * msInHour; + } + + case 'day': + if (roundUp) { + date.setUTCHours(0, 0, 0, 0); + return date.getTime() + 24 * 60 * 60 * 1000; // Add one day + } + date.setUTCHours(0, 0, 0, 0); // Set to midnight + return date.getTime(); + + case 'month': + if (roundUp) { + if (date.getUTCMonth() === 11) { + // If December, increment year + date.setUTCFullYear(date.getUTCFullYear() + 1); + date.setUTCMonth(0); + } else { + date.setUTCMonth(date.getUTCMonth() + 1); + } + date.setUTCDate(1); // First day of the next month + } else { + date.setUTCDate(1); // First day of the current month + } + date.setUTCHours(0, 0, 0, 0); // Set time to midnight + return date.getTime(); + } +} + +// General interval creation function +export function createIntervals( + startTime: number, + endTime: number, + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, +): Array<{ start: Date; end: Date; count: number; totalFee: number }> { + const roundedStartTime = roundToNearest(startTime, unit); + const roundedEndTime = roundToNearest(endTime, unit, true); + + const intervals: Array<{ + start: Date; + end: Date; + count: number; + totalFee: number; + }> = []; + + let currentTime = roundedStartTime; + + if (unit === 'month') { + // Handle month-specific interval logic (varying days in a month) + const currentDate = new Date(roundedStartTime); + while (currentDate.getTime() < roundedEndTime) { + const startInterval = new Date(currentDate); + currentDate.setUTCMonth(currentDate.getUTCMonth() + intervalSize); // Move by `intervalSize` months + const endInterval = new Date(currentDate); + intervals.push({ + start: startInterval, + end: endInterval, + count: 0, + totalFee: 0, + }); + } + } else { + // Handle minute, hour, and day intervals + const msInUnit = { + minute: 60 * 1000, + hour: 60 * 60 * 1000, + day: 24 * 60 * 60 * 1000, + }; + + const intervalDuration = intervalSize * msInUnit[unit]; + + while (currentTime < roundedEndTime) { + const startInterval = new Date(currentTime); + const endInterval = new Date(currentTime + intervalDuration); + intervals.push({ + start: startInterval, + end: endInterval, + count: 0, + totalFee: 0, + }); + currentTime += intervalDuration; + } + } + + return intervals; +} + +// Helper to process transactions and map to intervals +export function processTransactions( + nodes: TransactionNode[], + intervalMap: Interval[], +) { + nodes.forEach((transaction) => { + const transactionTimestamp = Number( + DateHelper.tai64toDate(transaction.timestamp), + ); + const transactionFee = Number(transaction.fee); + + // Find the correct interval for the current transaction + for (const interval of intervalMap) { + const intervalStart = new Date(interval.start).getTime(); + const intervalEnd = new Date(interval.end).getTime(); + + if ( + transactionTimestamp >= intervalStart && + transactionTimestamp < intervalEnd + ) { + // Increment count and add the transaction fee to totalFee + interval.count += 1; + interval.totalFee += transactionFee; + break; // Transaction assigned, no need to check further + } + } + }); + return intervalMap; +} + +// Helper to process accounts and map to intervals +export function processAccounts(nodes: AccountNode[], intervalMap: Interval[]) { + nodes.forEach((account) => { + const accountTimestamp = Number(account.timestamp); + + // Find the correct interval for the current account + for (const interval of intervalMap) { + const intervalStart = new Date(interval.start).getTime(); + const intervalEnd = new Date(interval.end).getTime(); + + if (accountTimestamp >= intervalStart && accountTimestamp < intervalEnd) { + // Increment count for the number of accounts created + interval.count += 1; + break; // Account assigned, no need to check further + } + } + }); + return intervalMap; +} diff --git a/packages/app-explorer/src/systems/utils/date.ts b/packages/app-explorer/src/systems/utils/date.ts new file mode 100644 index 000000000..9995818df --- /dev/null +++ b/packages/app-explorer/src/systems/utils/date.ts @@ -0,0 +1,16 @@ +import dayjs from 'dayjs'; +import relativeTime from 'dayjs/plugin/relativeTime'; +import { TAI64 } from 'tai64'; + +dayjs.extend(relativeTime); + +export class DateHelper { + static tai64toDate(tai64Timestamp: string) { + const timestamp = TAI64.fromString(tai64Timestamp, 10).toUnix(); + return dayjs(timestamp * 1000); + } + + static dateToTai64(date: Date) { + return TAI64.fromUnix(Math.floor(date.getTime() / 1000)).toString(10); + } +} diff --git a/packages/app-explorer/src/systems/utils/utils.ts b/packages/app-explorer/src/systems/utils/utils.ts new file mode 100644 index 000000000..f8e579de3 --- /dev/null +++ b/packages/app-explorer/src/systems/utils/utils.ts @@ -0,0 +1,204 @@ +import { DateHelper } from './date'; + +interface TransactionNode { + __typename: 'TransactionFee'; + fee: string; + timestamp: string; +} + +interface AccountNode { + timestamp: string; + count?: number; +} + +interface Interval { + start: Date; + end: Date; + count: number; // To track the number of transactions + totalFee: number; // To track the total transaction fees +} + +export function getUnitAndInterval(timeRange: string): { + unit: 'minute' | 'hour' | 'day' | 'month'; + intervalSize: number; +} { + switch (timeRange) { + case '1hr': + return { unit: 'minute', intervalSize: 5 }; + case '12hr': + return { unit: 'hour', intervalSize: 1 }; + case '1day': + return { unit: 'hour', intervalSize: 2 }; + case '7days': + return { unit: 'hour', intervalSize: 12 }; + case '14days': + return { unit: 'day', intervalSize: 1 }; + case '30days': + return { unit: 'day', intervalSize: 3 }; + case '90days': + return { unit: 'day', intervalSize: 10 }; + default: + return { unit: 'month', intervalSize: 1 }; + } +} + +function roundToNearest( + time: number, + unit: 'minute' | 'hour' | 'day' | 'month', + roundUp = false, +): number { + const date = new Date(time); + + switch (unit) { + case 'minute': { + const msInMinute = 60 * 1000; + const msInFiveMinutes = 5 * msInMinute; + return roundUp + ? Math.ceil(time / msInFiveMinutes) * msInFiveMinutes + : Math.floor(time / msInFiveMinutes) * msInFiveMinutes; + } + + case 'hour': { + const msInHour = 60 * 60 * 1000; + return roundUp + ? Math.ceil(time / msInHour) * msInHour + : Math.floor(time / msInHour) * msInHour; + } + + case 'day': + if (roundUp) { + date.setUTCHours(0, 0, 0, 0); + return date.getTime() + 24 * 60 * 60 * 1000; // Add one day + } + date.setUTCHours(0, 0, 0, 0); // Set to midnight + return date.getTime(); + + case 'month': + if (roundUp) { + if (date.getUTCMonth() === 11) { + // If December, increment year + date.setUTCFullYear(date.getUTCFullYear() + 1); + date.setUTCMonth(0); + } else { + date.setUTCMonth(date.getUTCMonth() + 1); + } + date.setUTCDate(1); // First day of the next month + } else { + date.setUTCDate(1); // First day of the current month + } + date.setUTCHours(0, 0, 0, 0); // Set time to midnight + return date.getTime(); + } +} + +// General interval creation function +export function createIntervals( + startTime: number, + endTime: number, + unit: 'minute' | 'hour' | 'day' | 'month', + intervalSize: number, +): Array<{ start: Date; end: Date; count: number; totalFee: number }> { + const roundedStartTime = roundToNearest(startTime, unit); + const roundedEndTime = roundToNearest(endTime, unit, true); + + const intervals: Array<{ + start: Date; + end: Date; + count: number; + totalFee: number; + }> = []; + + let currentTime = roundedStartTime; + + if (unit === 'month') { + // Handle month-specific interval logic (varying days in a month) + const currentDate = new Date(roundedStartTime); + while (currentDate.getTime() < roundedEndTime) { + const startInterval = new Date(currentDate); + currentDate.setUTCMonth(currentDate.getUTCMonth() + intervalSize); // Move by `intervalSize` months + const endInterval = new Date(currentDate); + intervals.push({ + start: startInterval, + end: endInterval, + count: 0, + totalFee: 0, + }); + } + } else { + // Handle minute, hour, and day intervals + const msInUnit = { + minute: 60 * 1000, + hour: 60 * 60 * 1000, + day: 24 * 60 * 60 * 1000, + }; + + const intervalDuration = intervalSize * msInUnit[unit]; + + while (currentTime < roundedEndTime) { + const startInterval = new Date(currentTime); + const endInterval = new Date(currentTime + intervalDuration); + intervals.push({ + start: startInterval, + end: endInterval, + count: 0, + totalFee: 0, + }); + currentTime += intervalDuration; + } + } + + return intervals; +} + +// Helper to process transactions and map to intervals +export function processTransactions( + nodes: TransactionNode[], + intervalMap: Interval[], +) { + nodes.forEach((transaction) => { + const transactionTimestamp = Number( + DateHelper.tai64toDate(transaction.timestamp), + ); + const transactionFee = Number(transaction.fee); + + // Find the correct interval for the current transaction + for (const interval of intervalMap) { + const intervalStart = new Date(interval.start).getTime(); + const intervalEnd = new Date(interval.end).getTime(); + + if ( + transactionTimestamp >= intervalStart && + transactionTimestamp < intervalEnd + ) { + // Increment count and add the transaction fee to totalFee + interval.count += 1; + interval.totalFee += transactionFee; + break; // Transaction assigned, no need to check further + } + } + }); + return intervalMap; +} + +export function processAccounts(nodes: AccountNode[], intervalMap: Interval[]) { + nodes.forEach((account) => { + const accountTimestamp = Number(account.timestamp); + + // Find the correct interval for the current account + for (const interval of intervalMap) { + const intervalStart = new Date(interval.start).getTime(); + const intervalEnd = new Date(interval.end).getTime(); + + if (accountTimestamp >= intervalStart && accountTimestamp < intervalEnd) { + // Increment count for the number of accounts created + if (account.count) { + interval.count += account.count; + } else { + interval.count += 1; + } + break; // Account assigned, no need to check further + } + } + }); + return intervalMap; +} diff --git a/packages/graphql/src/graphql/generated/sdk-provider.ts b/packages/graphql/src/graphql/generated/sdk-provider.ts index a5d752acd..9ccfecbbb 100644 --- a/packages/graphql/src/graphql/generated/sdk-provider.ts +++ b/packages/graphql/src/graphql/generated/sdk-provider.ts @@ -1,38 +1,51 @@ +import { GraphQLError, print } from 'graphql'; import type { GraphQLClient, RequestOptions } from 'graphql-request'; -import { GraphQLError, print } from 'graphql' import gql from 'graphql-tag'; export type Maybe = T | null; export type InputMaybe = Maybe; -export type Exact = { [K in keyof T]: T[K] }; -export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; -export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; -export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; +export type Exact = { + [K in keyof T]: T[K]; +}; +export type MakeOptional = Omit & { + [SubKey in K]?: Maybe; +}; +export type MakeMaybe = Omit & { + [SubKey in K]: Maybe; +}; +export type MakeEmpty< + T extends { [key: string]: unknown }, + K extends keyof T, +> = { [_ in K]?: never }; +export type Incremental = + | T + | { + [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never; + }; type GraphQLClientRequestHeaders = RequestOptions['requestHeaders']; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { - ID: { input: string; output: string; } - String: { input: string; output: string; } - Boolean: { input: boolean; output: boolean; } - Int: { input: number; output: number; } - Float: { input: number; output: number; } - Address: { input: string; output: string; } - AssetId: { input: string; output: string; } - BlockId: { input: string; output: string; } - Bytes32: { input: string; output: string; } - ContractId: { input: string; output: string; } - HexString: { input: string; output: string; } - Nonce: { input: string; output: string; } - RelayedTransactionId: { input: string; output: string; } - Salt: { input: string; output: string; } - Signature: { input: string; output: string; } - Tai64Timestamp: { input: string; output: string; } - TransactionId: { input: string; output: string; } - TxPointer: { input: string; output: string; } - U16: { input: string; output: string; } - U32: { input: string; output: string; } - U64: { input: string; output: string; } - UtxoId: { input: string; output: string; } + ID: { input: string; output: string }; + String: { input: string; output: string }; + Boolean: { input: boolean; output: boolean }; + Int: { input: number; output: number }; + Float: { input: number; output: number }; + Address: { input: string; output: string }; + AssetId: { input: string; output: string }; + BlockId: { input: string; output: string }; + Bytes32: { input: string; output: string }; + ContractId: { input: string; output: string }; + HexString: { input: string; output: string }; + Nonce: { input: string; output: string }; + RelayedTransactionId: { input: string; output: string }; + Salt: { input: string; output: string }; + Signature: { input: string; output: string }; + Tai64Timestamp: { input: string; output: string }; + TransactionId: { input: string; output: string }; + TxPointer: { input: string; output: string }; + U16: { input: string; output: string }; + U32: { input: string; output: string }; + U64: { input: string; output: string }; + UtxoId: { input: string; output: string }; }; export type GQLBalance = { @@ -101,7 +114,7 @@ export type GQLBlockEdge = { }; export enum GQLBlockVersion { - V1 = 'V1' + V1 = 'V1', } /** Breakpoint, defined as a tuple of contract ID and relative PC offset inside it */ @@ -198,7 +211,7 @@ export type GQLConsensusParametersPurpose = { }; export enum GQLConsensusParametersVersion { - V1 = 'V1' + V1 = 'V1', } export type GQLContract = { @@ -267,7 +280,7 @@ export type GQLContractParameters = { }; export enum GQLContractParametersVersion { - V1 = 'V1' + V1 = 'V1', } export type GQLDependentCost = GQLHeavyOperation | GQLLightOperation; @@ -296,7 +309,9 @@ export type GQLDryRunTransactionExecutionStatus = { status: GQLDryRunTransactionStatus; }; -export type GQLDryRunTransactionStatus = GQLDryRunFailureStatus | GQLDryRunSuccessStatus; +export type GQLDryRunTransactionStatus = + | GQLDryRunFailureStatus + | GQLDryRunSuccessStatus; export type GQLEstimateGasPrice = { __typename: 'EstimateGasPrice'; @@ -330,7 +345,7 @@ export type GQLFeeParameters = { }; export enum GQLFeeParametersVersion { - V1 = 'V1' + V1 = 'V1', } export type GQLGasCosts = { @@ -450,7 +465,7 @@ export type GQLGasCosts = { }; export enum GQLGasCostsVersion { - V1 = 'V1' + V1 = 'V1', } export type GQLGenesis = { @@ -470,7 +485,10 @@ export type GQLGenesis = { transactionsRoot: Scalars['Bytes32']['output']; }; -export type GQLGroupedInput = GQLGroupedInputCoin | GQLGroupedInputContract | GQLGroupedInputMessage; +export type GQLGroupedInput = + | GQLGroupedInputCoin + | GQLGroupedInputContract + | GQLGroupedInputMessage; export type GQLGroupedInputCoin = { __typename: 'GroupedInputCoin'; @@ -500,10 +518,13 @@ export type GQLGroupedInputMessage = { export enum GQLGroupedInputType { InputCoin = 'InputCoin', InputContract = 'InputContract', - InputMessage = 'InputMessage' + InputMessage = 'InputMessage', } -export type GQLGroupedOutput = GQLGroupedOutputChanged | GQLGroupedOutputCoin | GQLGroupedOutputContractCreated; +export type GQLGroupedOutput = + | GQLGroupedOutputChanged + | GQLGroupedOutputCoin + | GQLGroupedOutputContractCreated; export type GQLGroupedOutputChanged = { __typename: 'GroupedOutputChanged'; @@ -533,7 +554,7 @@ export type GQLGroupedOutputContractCreated = { export enum GQLGroupedOutputType { OutputChanged = 'OutputChanged', OutputCoin = 'OutputCoin', - OutputContractCreated = 'OutputContractCreated' + OutputContractCreated = 'OutputContractCreated', } export type GQLHeader = { @@ -569,7 +590,7 @@ export type GQLHeader = { }; export enum GQLHeaderVersion { - V1 = 'V1' + V1 = 'V1', } export type GQLHeavyOperation = { @@ -688,7 +709,7 @@ export type GQLMessageProof = { export enum GQLMessageState { NotFound = 'NOT_FOUND', Spent = 'SPENT', - Unspent = 'UNSPENT' + Unspent = 'UNSPENT', } export type GQLMessageStatus = { @@ -742,59 +763,49 @@ export type GQLMutation = { submit: GQLTransaction; }; - export type GQLMutationContinueTxArgs = { id: Scalars['ID']['input']; }; - export type GQLMutationDryRunArgs = { gasPrice?: InputMaybe; txs: Array; utxoValidation?: InputMaybe; }; - export type GQLMutationEndSessionArgs = { id: Scalars['ID']['input']; }; - export type GQLMutationExecuteArgs = { id: Scalars['ID']['input']; op: Scalars['String']['input']; }; - export type GQLMutationProduceBlocksArgs = { blocksToProduce: Scalars['U32']['input']; startTimestamp?: InputMaybe; }; - export type GQLMutationResetArgs = { id: Scalars['ID']['input']; }; - export type GQLMutationSetBreakpointArgs = { breakpoint: GQLBreakpoint; id: Scalars['ID']['input']; }; - export type GQLMutationSetSingleSteppingArgs = { enable: Scalars['Boolean']['input']; id: Scalars['ID']['input']; }; - export type GQLMutationStartTxArgs = { id: Scalars['ID']['input']; txJson: Scalars['String']['input']; }; - export type GQLMutationSubmitArgs = { tx: Scalars['HexString']['input']; }; @@ -826,14 +837,19 @@ export enum GQLOperationType { FinalResult = 'FINAL_RESULT', FromAccount = 'FROM_ACCOUNT', FromContract = 'FROM_CONTRACT', - Rootless = 'ROOTLESS' + Rootless = 'ROOTLESS', } export type GQLOperationsFilterInput = { transactionHash: Scalars['String']['input']; }; -export type GQLOutput = GQLChangeOutput | GQLCoinOutput | GQLContractCreated | GQLContractOutput | GQLVariableOutput; +export type GQLOutput = + | GQLChangeOutput + | GQLCoinOutput + | GQLContractCreated + | GQLContractOutput + | GQLVariableOutput; /** * A separate `Breakpoint` type to be used as an output, as a single @@ -912,7 +928,7 @@ export type GQLPredicateParameters = { }; export enum GQLPredicateParametersVersion { - V1 = 'V1' + V1 = 'V1', } export type GQLProgramState = { @@ -973,13 +989,11 @@ export type GQLQuery = { transactionsByOwner: GQLTransactionConnection; }; - export type GQLQueryBalanceArgs = { assetId: Scalars['AssetId']['input']; owner: Scalars['Address']['input']; }; - export type GQLQueryBalancesArgs = { after?: InputMaybe; before?: InputMaybe; @@ -988,13 +1002,11 @@ export type GQLQueryBalancesArgs = { last?: InputMaybe; }; - export type GQLQueryBlockArgs = { height?: InputMaybe; id?: InputMaybe; }; - export type GQLQueryBlocksArgs = { after?: InputMaybe; before?: InputMaybe; @@ -1002,12 +1014,10 @@ export type GQLQueryBlocksArgs = { last?: InputMaybe; }; - export type GQLQueryCoinArgs = { utxoId: Scalars['UtxoId']['input']; }; - export type GQLQueryCoinsArgs = { after?: InputMaybe; before?: InputMaybe; @@ -1016,25 +1026,21 @@ export type GQLQueryCoinsArgs = { last?: InputMaybe; }; - export type GQLQueryCoinsToSpendArgs = { excludedIds?: InputMaybe; owner: Scalars['Address']['input']; queryPerAsset: Array; }; - export type GQLQueryContractArgs = { id: Scalars['ContractId']['input']; }; - export type GQLQueryContractBalanceArgs = { asset: Scalars['AssetId']['input']; contract: Scalars['ContractId']['input']; }; - export type GQLQueryContractBalancesArgs = { after?: InputMaybe; before?: InputMaybe; @@ -1043,7 +1049,6 @@ export type GQLQueryContractBalancesArgs = { last?: InputMaybe; }; - export type GQLQueryContractsArgs = { after?: InputMaybe; before?: InputMaybe; @@ -1051,29 +1056,24 @@ export type GQLQueryContractsArgs = { last?: InputMaybe; }; - export type GQLQueryEstimateGasPriceArgs = { blockHorizon?: InputMaybe; }; - export type GQLQueryEstimatePredicatesArgs = { tx: Scalars['HexString']['input']; }; - export type GQLQueryMemoryArgs = { id: Scalars['ID']['input']; size: Scalars['U32']['input']; start: Scalars['U32']['input']; }; - export type GQLQueryMessageArgs = { nonce: Scalars['Nonce']['input']; }; - export type GQLQueryMessageProofArgs = { commitBlockHeight?: InputMaybe; commitBlockId?: InputMaybe; @@ -1081,12 +1081,10 @@ export type GQLQueryMessageProofArgs = { transactionId: Scalars['TransactionId']['input']; }; - export type GQLQueryMessageStatusArgs = { nonce: Scalars['Nonce']['input']; }; - export type GQLQueryMessagesArgs = { after?: InputMaybe; before?: InputMaybe; @@ -1095,33 +1093,27 @@ export type GQLQueryMessagesArgs = { owner?: InputMaybe; }; - export type GQLQueryPredicateArgs = { address: Scalars['String']['input']; }; - export type GQLQueryRegisterArgs = { id: Scalars['ID']['input']; register: Scalars['U32']['input']; }; - export type GQLQueryRelayedTransactionStatusArgs = { id: Scalars['RelayedTransactionId']['input']; }; - export type GQLQuerySearchArgs = { query: Scalars['String']['input']; }; - export type GQLQueryTransactionArgs = { id: Scalars['TransactionId']['input']; }; - export type GQLQueryTransactionsArgs = { after?: InputMaybe; before?: InputMaybe; @@ -1129,7 +1121,6 @@ export type GQLQueryTransactionsArgs = { last?: InputMaybe; }; - export type GQLQueryTransactionsByBlockIdArgs = { after?: InputMaybe; before?: InputMaybe; @@ -1138,7 +1129,6 @@ export type GQLQueryTransactionsByBlockIdArgs = { last?: InputMaybe; }; - export type GQLQueryTransactionsByOwnerArgs = { after?: InputMaybe; before?: InputMaybe; @@ -1193,7 +1183,7 @@ export enum GQLReceiptType { Revert = 'REVERT', ScriptResult = 'SCRIPT_RESULT', Transfer = 'TRANSFER', - TransferOut = 'TRANSFER_OUT' + TransferOut = 'TRANSFER_OUT', } export type GQLRelayedTransactionFailed = { @@ -1207,7 +1197,7 @@ export type GQLRelayedTransactionStatus = GQLRelayedTransactionFailed; export enum GQLReturnType { Return = 'RETURN', ReturnData = 'RETURN_DATA', - Revert = 'REVERT' + Revert = 'REVERT', } export type GQLRunResult = { @@ -1221,7 +1211,7 @@ export enum GQLRunState { /** Stopped on a breakpoint */ Breakpoint = 'BREAKPOINT', /** All breakpoints have been processed, and the program has terminated */ - Completed = 'COMPLETED' + Completed = 'COMPLETED', } export type GQLScriptParameters = { @@ -1232,7 +1222,7 @@ export type GQLScriptParameters = { }; export enum GQLScriptParametersVersion { - V1 = 'V1' + V1 = 'V1', } export type GQLSearchAccount = { @@ -1310,12 +1300,10 @@ export type GQLSubscription = { submitAndAwait: GQLTransactionStatus; }; - export type GQLSubscriptionStatusChangeArgs = { id: Scalars['TransactionId']['input']; }; - export type GQLSubscriptionSubmitAndAwaitArgs = { tx: Scalars['HexString']['input']; }; @@ -1405,7 +1393,11 @@ export type GQLTransactionGasCosts = { gasUsed?: Maybe; }; -export type GQLTransactionStatus = GQLFailureStatus | GQLSqueezedOutStatus | GQLSubmittedStatus | GQLSuccessStatus; +export type GQLTransactionStatus = + | GQLFailureStatus + | GQLSqueezedOutStatus + | GQLSubmittedStatus + | GQLSuccessStatus; export type GQLTxParameters = { __typename: 'TxParameters'; @@ -1419,10 +1411,12 @@ export type GQLTxParameters = { }; export enum GQLTxParametersVersion { - V1 = 'V1' + V1 = 'V1', } -export type GQLUpgradePurpose = GQLConsensusParametersPurpose | GQLStateTransitionPurpose; +export type GQLUpgradePurpose = + | GQLConsensusParametersPurpose + | GQLStateTransitionPurpose; export type GQLUtxoItem = { __typename: 'UtxoItem'; @@ -1439,15 +1433,19 @@ export type GQLVariableOutput = { to: Scalars['Address']['output']; }; -export type GQLBalanceQueryVariables = Exact<{ - assetId: Scalars['AssetId']['input']; - owner: Scalars['Address']['input']; -}>; - - -export type GQLBalanceQuery = { __typename: 'Query', balance: { __typename: 'Balance', amount: string, assetId: string, owner: string } }; - -export type GQLBalanceItemFragment = { __typename: 'Balance', amount: string, assetId: string, owner: string }; +export type GQLBalanceItemFragment = { + __typename: 'Balance'; + amount: string; + assetId: string; + owner: string; + utxos?: Array<{ + __typename: 'UtxoItem'; + amount: string; + blockCreated?: string | null; + txCreatedIdx?: string | null; + utxoId: string; + } | null> | null; +}; export type GQLBalancesQueryVariables = Exact<{ after?: InputMaybe; @@ -1457,10 +1455,133 @@ export type GQLBalancesQueryVariables = Exact<{ last?: InputMaybe; }>; +export type GQLBalancesQuery = { + __typename: 'Query'; + balances: { + __typename: 'BalanceConnection'; + nodes: Array<{ + __typename: 'Balance'; + amount: string; + assetId: string; + owner: string; + utxos?: Array<{ + __typename: 'UtxoItem'; + amount: string; + blockCreated?: string | null; + txCreatedIdx?: string | null; + utxoId: string; + } | null> | null; + }>; + pageInfo: { + __typename: 'PageInfo'; + endCursor?: string | null; + hasNextPage: boolean; + hasPreviousPage: boolean; + startCursor?: string | null; + }; + }; +}; -export type GQLBalancesQuery = { __typename: 'Query', balances: { __typename: 'BalanceConnection', nodes: Array<{ __typename: 'Balance', amount: string, assetId: string, owner: string }>, pageInfo: { __typename: 'PageInfo', endCursor?: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null } } }; +export type GQLBlockFragment = { + __typename: 'Block'; + id: string; + producer?: string | null; + consensus: + | { __typename: 'Genesis' } + | { __typename: 'PoAConsensus'; signature: string }; + header: { __typename: 'Header'; transactionsCount: string }; + time?: { + __typename: 'ParsedTime'; + full?: string | null; + fromNow?: string | null; + rawUnix?: string | null; + } | null; + transactions: Array<{ + __typename: 'Transaction'; + _id?: string | null; + id: string; + title: string; + statusType?: string | null; + time: { + __typename: 'ParsedTime'; + fromNow?: string | null; + rawUnix?: string | null; + }; + gasCosts?: { + __typename: 'TransactionGasCosts'; + fee?: string | null; + } | null; + }>; +}; + +export type GQLBlockQueryVariables = Exact<{ + height?: InputMaybe; + id?: InputMaybe; +}>; -export type GQLBlockItemFragment = { __typename: 'Block', height: string, id: string, consensus: { __typename: 'Genesis', chainConfigHash: string, coinsRoot: string, contractsRoot: string, messagesRoot: string, transactionsRoot: string } | { __typename: 'PoAConsensus', signature: string }, header: { __typename: 'Header', applicationHash: string, consensusParametersVersion: string, daHeight: string, eventInboxRoot: string, height: string, id: string, messageOutboxRoot: string, messageReceiptCount: string, prevRoot: string, stateTransitionBytecodeVersion: string, time: string, transactionsCount: string, transactionsRoot: string }, transactions: Array<{ __typename: 'Transaction', bytecodeRoot?: string | null, bytecodeWitnessIndex?: string | null, id: string, inputAssetIds?: Array | null, inputContracts?: Array | null, isCreate: boolean, isMint: boolean, isScript: boolean, isUpgrade: boolean, isUpload: boolean, maturity?: string | null, mintAmount?: string | null, mintAssetId?: string | null, mintGasPrice?: string | null, proofSet?: Array | null, rawPayload: string, receiptsRoot?: string | null, salt?: string | null, script?: string | null, scriptData?: string | null, scriptGasLimit?: string | null, storageSlots?: Array | null, subsectionIndex?: string | null, subsectionsNumber?: string | null, txPointer?: string | null, witnesses?: Array | null, inputContract?: { __typename: 'InputContract', balanceRoot: string, contractId: string, stateRoot: string, txPointer: string, utxoId: string } | null, inputs?: Array<{ __typename: 'InputCoin', amount: string, assetId: string, owner: string, predicate: string, predicateData: string, predicateGasUsed: string, txPointer: string, utxoId: string, witnessIndex: string } | { __typename: 'InputContract', balanceRoot: string, contractId: string, stateRoot: string, txPointer: string, utxoId: string } | { __typename: 'InputMessage', amount: string, data: string, nonce: string, predicate: string, predicateData: string, predicateGasUsed: string, recipient: string, sender: string, witnessIndex: string }> | null, outputContract?: { __typename: 'ContractOutput', balanceRoot: string, inputIndex: string, stateRoot: string } | null, outputs: Array<{ __typename: 'ChangeOutput', amount: string, assetId: string, to: string } | { __typename: 'CoinOutput', amount: string, assetId: string, to: string } | { __typename: 'ContractCreated', contract: string, stateRoot: string } | { __typename: 'ContractOutput', balanceRoot: string, inputIndex: string, stateRoot: string } | { __typename: 'VariableOutput', amount: string, assetId: string, to: string }>, policies?: { __typename: 'Policies', maturity?: string | null, maxFee?: string | null, tip?: string | null, witnessLimit?: string | null } | null, status?: { __typename: 'FailureStatus', reason: string, time: string, totalFee: string, totalGas: string, transactionId: string, block: { __typename: 'Block', height: string, id: string, consensus: { __typename: 'Genesis', chainConfigHash: string, coinsRoot: string, contractsRoot: string, messagesRoot: string, transactionsRoot: string } | { __typename: 'PoAConsensus', signature: string }, header: { __typename: 'Header', applicationHash: string, consensusParametersVersion: string, daHeight: string, eventInboxRoot: string, height: string, id: string, messageOutboxRoot: string, messageReceiptCount: string, prevRoot: string, stateTransitionBytecodeVersion: string, time: string, transactionsCount: string, transactionsRoot: string } }, programState?: { __typename: 'ProgramState', data: string, returnType: GQLReturnType } | null, receipts: Array<{ __typename: 'Receipt', amount?: string | null, assetId?: string | null, contractId?: string | null, data?: string | null, digest?: string | null, gas?: string | null, gasUsed?: string | null, id?: string | null, is?: string | null, len?: string | null, nonce?: string | null, param1?: string | null, param2?: string | null, pc?: string | null, ptr?: string | null, ra?: string | null, rb?: string | null, rc?: string | null, rd?: string | null, reason?: string | null, receiptType: GQLReceiptType, recipient?: string | null, result?: string | null, sender?: string | null, subId?: string | null, to?: string | null, toAddress?: string | null, val?: string | null }> } | { __typename: 'SqueezedOutStatus', reason: string } | { __typename: 'SubmittedStatus', time: string } | { __typename: 'SuccessStatus', time: string, totalFee: string, totalGas: string, transactionId: string, block: { __typename: 'Block', height: string, id: string, consensus: { __typename: 'Genesis', chainConfigHash: string, coinsRoot: string, contractsRoot: string, messagesRoot: string, transactionsRoot: string } | { __typename: 'PoAConsensus', signature: string }, header: { __typename: 'Header', applicationHash: string, consensusParametersVersion: string, daHeight: string, eventInboxRoot: string, height: string, id: string, messageOutboxRoot: string, messageReceiptCount: string, prevRoot: string, stateTransitionBytecodeVersion: string, time: string, transactionsCount: string, transactionsRoot: string } }, programState?: { __typename: 'ProgramState', data: string, returnType: GQLReturnType } | null, receipts: Array<{ __typename: 'Receipt', amount?: string | null, assetId?: string | null, contractId?: string | null, data?: string | null, digest?: string | null, gas?: string | null, gasUsed?: string | null, id?: string | null, is?: string | null, len?: string | null, nonce?: string | null, param1?: string | null, param2?: string | null, pc?: string | null, ptr?: string | null, ra?: string | null, rb?: string | null, rc?: string | null, rd?: string | null, reason?: string | null, receiptType: GQLReceiptType, recipient?: string | null, result?: string | null, sender?: string | null, subId?: string | null, to?: string | null, toAddress?: string | null, val?: string | null }> } | null, upgradePurpose?: { __typename: 'ConsensusParametersPurpose', checksum: string, witnessIndex: string } | { __typename: 'StateTransitionPurpose', root: string } | null }> }; +export type GQLBlockQuery = { + __typename: 'Query'; + block?: { + __typename: 'Block'; + id: string; + producer?: string | null; + consensus: + | { __typename: 'Genesis' } + | { __typename: 'PoAConsensus'; signature: string }; + header: { __typename: 'Header'; transactionsCount: string }; + time?: { + __typename: 'ParsedTime'; + full?: string | null; + fromNow?: string | null; + rawUnix?: string | null; + } | null; + transactions: Array<{ + __typename: 'Transaction'; + _id?: string | null; + id: string; + title: string; + statusType?: string | null; + time: { + __typename: 'ParsedTime'; + fromNow?: string | null; + rawUnix?: string | null; + }; + gasCosts?: { + __typename: 'TransactionGasCosts'; + fee?: string | null; + } | null; + }>; + } | null; +}; + +export type GQLBlockItemFragment = { + __typename: 'Block'; + totalGasUsed?: string | null; + producer?: string | null; + id: string; + time?: { + __typename: 'ParsedTime'; + fromNow?: string | null; + full?: string | null; + rawTai64?: string | null; + rawUnix?: string | null; + } | null; + consensus: + | { __typename: 'Genesis' } + | { __typename: 'PoAConsensus'; signature: string }; + header: { + __typename: 'Header'; + id: string; + height: string; + time: string; + transactionsCount: string; + }; + transactions: Array<{ + __typename: 'Transaction'; + isMint: boolean; + mintAmount?: string | null; + }>; +}; export type GQLBlocksQueryVariables = Exact<{ after?: InputMaybe; @@ -1469,13 +1590,1000 @@ export type GQLBlocksQueryVariables = Exact<{ last?: InputMaybe; }>; +export type GQLBlocksQuery = { + __typename: 'Query'; + blocks: { + __typename: 'BlockConnection'; + pageInfo: { + __typename: 'PageInfo'; + startCursor?: string | null; + endCursor?: string | null; + hasPreviousPage: boolean; + hasNextPage: boolean; + }; + edges: Array<{ + __typename: 'BlockEdge'; + node: { + __typename: 'Block'; + totalGasUsed?: string | null; + producer?: string | null; + id: string; + time?: { + __typename: 'ParsedTime'; + fromNow?: string | null; + full?: string | null; + rawTai64?: string | null; + rawUnix?: string | null; + } | null; + consensus: + | { __typename: 'Genesis' } + | { __typename: 'PoAConsensus'; signature: string }; + header: { + __typename: 'Header'; + id: string; + height: string; + time: string; + transactionsCount: string; + }; + transactions: Array<{ + __typename: 'Transaction'; + isMint: boolean; + mintAmount?: string | null; + }>; + }; + }>; + }; +}; -export type GQLBlocksQuery = { __typename: 'Query', blocks: { __typename: 'BlockConnection', edges: Array<{ __typename: 'BlockEdge', cursor: string, node: { __typename: 'Block', height: string, id: string, consensus: { __typename: 'Genesis', chainConfigHash: string, coinsRoot: string, contractsRoot: string, messagesRoot: string, transactionsRoot: string } | { __typename: 'PoAConsensus', signature: string }, header: { __typename: 'Header', applicationHash: string, consensusParametersVersion: string, daHeight: string, eventInboxRoot: string, height: string, id: string, messageOutboxRoot: string, messageReceiptCount: string, prevRoot: string, stateTransitionBytecodeVersion: string, time: string, transactionsCount: string, transactionsRoot: string }, transactions: Array<{ __typename: 'Transaction', bytecodeRoot?: string | null, bytecodeWitnessIndex?: string | null, id: string, inputAssetIds?: Array | null, inputContracts?: Array | null, isCreate: boolean, isMint: boolean, isScript: boolean, isUpgrade: boolean, isUpload: boolean, maturity?: string | null, mintAmount?: string | null, mintAssetId?: string | null, mintGasPrice?: string | null, proofSet?: Array | null, rawPayload: string, receiptsRoot?: string | null, salt?: string | null, script?: string | null, scriptData?: string | null, scriptGasLimit?: string | null, storageSlots?: Array | null, subsectionIndex?: string | null, subsectionsNumber?: string | null, txPointer?: string | null, witnesses?: Array | null, inputContract?: { __typename: 'InputContract', balanceRoot: string, contractId: string, stateRoot: string, txPointer: string, utxoId: string } | null, inputs?: Array<{ __typename: 'InputCoin', amount: string, assetId: string, owner: string, predicate: string, predicateData: string, predicateGasUsed: string, txPointer: string, utxoId: string, witnessIndex: string } | { __typename: 'InputContract', balanceRoot: string, contractId: string, stateRoot: string, txPointer: string, utxoId: string } | { __typename: 'InputMessage', amount: string, data: string, nonce: string, predicate: string, predicateData: string, predicateGasUsed: string, recipient: string, sender: string, witnessIndex: string }> | null, outputContract?: { __typename: 'ContractOutput', balanceRoot: string, inputIndex: string, stateRoot: string } | null, outputs: Array<{ __typename: 'ChangeOutput', amount: string, assetId: string, to: string } | { __typename: 'CoinOutput', amount: string, assetId: string, to: string } | { __typename: 'ContractCreated', contract: string, stateRoot: string } | { __typename: 'ContractOutput', balanceRoot: string, inputIndex: string, stateRoot: string } | { __typename: 'VariableOutput', amount: string, assetId: string, to: string }>, policies?: { __typename: 'Policies', maturity?: string | null, maxFee?: string | null, tip?: string | null, witnessLimit?: string | null } | null, status?: { __typename: 'FailureStatus', reason: string, time: string, totalFee: string, totalGas: string, transactionId: string, block: { __typename: 'Block', height: string, id: string, consensus: { __typename: 'Genesis', chainConfigHash: string, coinsRoot: string, contractsRoot: string, messagesRoot: string, transactionsRoot: string } | { __typename: 'PoAConsensus', signature: string }, header: { __typename: 'Header', applicationHash: string, consensusParametersVersion: string, daHeight: string, eventInboxRoot: string, height: string, id: string, messageOutboxRoot: string, messageReceiptCount: string, prevRoot: string, stateTransitionBytecodeVersion: string, time: string, transactionsCount: string, transactionsRoot: string } }, programState?: { __typename: 'ProgramState', data: string, returnType: GQLReturnType } | null, receipts: Array<{ __typename: 'Receipt', amount?: string | null, assetId?: string | null, contractId?: string | null, data?: string | null, digest?: string | null, gas?: string | null, gasUsed?: string | null, id?: string | null, is?: string | null, len?: string | null, nonce?: string | null, param1?: string | null, param2?: string | null, pc?: string | null, ptr?: string | null, ra?: string | null, rb?: string | null, rc?: string | null, rd?: string | null, reason?: string | null, receiptType: GQLReceiptType, recipient?: string | null, result?: string | null, sender?: string | null, subId?: string | null, to?: string | null, toAddress?: string | null, val?: string | null }> } | { __typename: 'SqueezedOutStatus', reason: string } | { __typename: 'SubmittedStatus', time: string } | { __typename: 'SuccessStatus', time: string, totalFee: string, totalGas: string, transactionId: string, block: { __typename: 'Block', height: string, id: string, consensus: { __typename: 'Genesis', chainConfigHash: string, coinsRoot: string, contractsRoot: string, messagesRoot: string, transactionsRoot: string } | { __typename: 'PoAConsensus', signature: string }, header: { __typename: 'Header', applicationHash: string, consensusParametersVersion: string, daHeight: string, eventInboxRoot: string, height: string, id: string, messageOutboxRoot: string, messageReceiptCount: string, prevRoot: string, stateTransitionBytecodeVersion: string, time: string, transactionsCount: string, transactionsRoot: string } }, programState?: { __typename: 'ProgramState', data: string, returnType: GQLReturnType } | null, receipts: Array<{ __typename: 'Receipt', amount?: string | null, assetId?: string | null, contractId?: string | null, data?: string | null, digest?: string | null, gas?: string | null, gasUsed?: string | null, id?: string | null, is?: string | null, len?: string | null, nonce?: string | null, param1?: string | null, param2?: string | null, pc?: string | null, ptr?: string | null, ra?: string | null, rb?: string | null, rc?: string | null, rd?: string | null, reason?: string | null, receiptType: GQLReceiptType, recipient?: string | null, result?: string | null, sender?: string | null, subId?: string | null, to?: string | null, toAddress?: string | null, val?: string | null }> } | null, upgradePurpose?: { __typename: 'ConsensusParametersPurpose', checksum: string, witnessIndex: string } | { __typename: 'StateTransitionPurpose', root: string } | null }> } }>, nodes: Array<{ __typename: 'Block', height: string, id: string, consensus: { __typename: 'Genesis', chainConfigHash: string, coinsRoot: string, contractsRoot: string, messagesRoot: string, transactionsRoot: string } | { __typename: 'PoAConsensus', signature: string }, header: { __typename: 'Header', applicationHash: string, consensusParametersVersion: string, daHeight: string, eventInboxRoot: string, height: string, id: string, messageOutboxRoot: string, messageReceiptCount: string, prevRoot: string, stateTransitionBytecodeVersion: string, time: string, transactionsCount: string, transactionsRoot: string }, transactions: Array<{ __typename: 'Transaction', bytecodeRoot?: string | null, bytecodeWitnessIndex?: string | null, id: string, inputAssetIds?: Array | null, inputContracts?: Array | null, isCreate: boolean, isMint: boolean, isScript: boolean, isUpgrade: boolean, isUpload: boolean, maturity?: string | null, mintAmount?: string | null, mintAssetId?: string | null, mintGasPrice?: string | null, proofSet?: Array | null, rawPayload: string, receiptsRoot?: string | null, salt?: string | null, script?: string | null, scriptData?: string | null, scriptGasLimit?: string | null, storageSlots?: Array | null, subsectionIndex?: string | null, subsectionsNumber?: string | null, txPointer?: string | null, witnesses?: Array | null, inputContract?: { __typename: 'InputContract', balanceRoot: string, contractId: string, stateRoot: string, txPointer: string, utxoId: string } | null, inputs?: Array<{ __typename: 'InputCoin', amount: string, assetId: string, owner: string, predicate: string, predicateData: string, predicateGasUsed: string, txPointer: string, utxoId: string, witnessIndex: string } | { __typename: 'InputContract', balanceRoot: string, contractId: string, stateRoot: string, txPointer: string, utxoId: string } | { __typename: 'InputMessage', amount: string, data: string, nonce: string, predicate: string, predicateData: string, predicateGasUsed: string, recipient: string, sender: string, witnessIndex: string }> | null, outputContract?: { __typename: 'ContractOutput', balanceRoot: string, inputIndex: string, stateRoot: string } | null, outputs: Array<{ __typename: 'ChangeOutput', amount: string, assetId: string, to: string } | { __typename: 'CoinOutput', amount: string, assetId: string, to: string } | { __typename: 'ContractCreated', contract: string, stateRoot: string } | { __typename: 'ContractOutput', balanceRoot: string, inputIndex: string, stateRoot: string } | { __typename: 'VariableOutput', amount: string, assetId: string, to: string }>, policies?: { __typename: 'Policies', maturity?: string | null, maxFee?: string | null, tip?: string | null, witnessLimit?: string | null } | null, status?: { __typename: 'FailureStatus', reason: string, time: string, totalFee: string, totalGas: string, transactionId: string, block: { __typename: 'Block', height: string, id: string, consensus: { __typename: 'Genesis', chainConfigHash: string, coinsRoot: string, contractsRoot: string, messagesRoot: string, transactionsRoot: string } | { __typename: 'PoAConsensus', signature: string }, header: { __typename: 'Header', applicationHash: string, consensusParametersVersion: string, daHeight: string, eventInboxRoot: string, height: string, id: string, messageOutboxRoot: string, messageReceiptCount: string, prevRoot: string, stateTransitionBytecodeVersion: string, time: string, transactionsCount: string, transactionsRoot: string } }, programState?: { __typename: 'ProgramState', data: string, returnType: GQLReturnType } | null, receipts: Array<{ __typename: 'Receipt', amount?: string | null, assetId?: string | null, contractId?: string | null, data?: string | null, digest?: string | null, gas?: string | null, gasUsed?: string | null, id?: string | null, is?: string | null, len?: string | null, nonce?: string | null, param1?: string | null, param2?: string | null, pc?: string | null, ptr?: string | null, ra?: string | null, rb?: string | null, rc?: string | null, rd?: string | null, reason?: string | null, receiptType: GQLReceiptType, recipient?: string | null, result?: string | null, sender?: string | null, subId?: string | null, to?: string | null, toAddress?: string | null, val?: string | null }> } | { __typename: 'SqueezedOutStatus', reason: string } | { __typename: 'SubmittedStatus', time: string } | { __typename: 'SuccessStatus', time: string, totalFee: string, totalGas: string, transactionId: string, block: { __typename: 'Block', height: string, id: string, consensus: { __typename: 'Genesis', chainConfigHash: string, coinsRoot: string, contractsRoot: string, messagesRoot: string, transactionsRoot: string } | { __typename: 'PoAConsensus', signature: string }, header: { __typename: 'Header', applicationHash: string, consensusParametersVersion: string, daHeight: string, eventInboxRoot: string, height: string, id: string, messageOutboxRoot: string, messageReceiptCount: string, prevRoot: string, stateTransitionBytecodeVersion: string, time: string, transactionsCount: string, transactionsRoot: string } }, programState?: { __typename: 'ProgramState', data: string, returnType: GQLReturnType } | null, receipts: Array<{ __typename: 'Receipt', amount?: string | null, assetId?: string | null, contractId?: string | null, data?: string | null, digest?: string | null, gas?: string | null, gasUsed?: string | null, id?: string | null, is?: string | null, len?: string | null, nonce?: string | null, param1?: string | null, param2?: string | null, pc?: string | null, ptr?: string | null, ra?: string | null, rb?: string | null, rc?: string | null, rd?: string | null, reason?: string | null, receiptType: GQLReceiptType, recipient?: string | null, result?: string | null, sender?: string | null, subId?: string | null, to?: string | null, toAddress?: string | null, val?: string | null }> } | null, upgradePurpose?: { __typename: 'ConsensusParametersPurpose', checksum: string, witnessIndex: string } | { __typename: 'StateTransitionPurpose', root: string } | null }> }>, pageInfo: { __typename: 'PageInfo', endCursor?: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null } } }; - -export type GQLChainQueryVariables = Exact<{ [key: string]: never; }>; - +export type GQLChainQueryVariables = Exact<{ [key: string]: never }>; -export type GQLChainQuery = { __typename: 'Query', chain: { __typename: 'ChainInfo', daHeight: string, name: string, consensusParameters: { __typename: 'ConsensusParameters', baseAssetId: string, blockGasLimit: string, chainId: string, privilegedAddress: string, contractParams: { __typename: 'ContractParameters', contractMaxSize: string, maxStorageSlots: string }, feeParams: { __typename: 'FeeParameters', gasPerByte: string, gasPriceFactor: string }, gasCosts: { __typename: 'GasCosts', add: string, addi: string, aloc: string, and: string, andi: string, bal: string, bhei: string, bhsh: string, burn: string, cb: string, cfei: string, cfsi: string, div: string, divi: string, eck1: string, ecr1: string, ed19: string, eq: string, exp: string, expi: string, flag: string, gm: string, gt: string, gtf: string, ji: string, jmp: string, jmpb: string, jmpf: string, jne: string, jneb: string, jnef: string, jnei: string, jnzb: string, jnzf: string, jnzi: string, lb: string, log: string, lt: string, lw: string, mint: string, mldv: string, mlog: string, modOp: string, modi: string, moveOp: string, movi: string, mroo: string, mul: string, muli: string, newStoragePerByte: string, noop: string, not: string, or: string, ori: string, poph: string, popl: string, pshh: string, pshl: string, ret: string, rvrt: string, sb: string, sll: string, slli: string, srl: string, srli: string, srw: string, sub: string, subi: string, sw: string, sww: string, time: string, tr: string, tro: string, wdam: string, wdcm: string, wddv: string, wdmd: string, wdml: string, wdmm: string, wdop: string, wqam: string, wqcm: string, wqdv: string, wqmd: string, wqml: string, wqmm: string, wqop: string, xor: string, xori: string, call: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, ccp: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, contractRoot: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, croo: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, csiz: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, k256: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, ldc: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, logd: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, mcl: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, mcli: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, mcp: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, mcpi: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, meq: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, retd: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, s256: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, scwq: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, smo: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, srwq: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, stateRoot: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, swwq: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, vmInitialization: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string } }, predicateParams: { __typename: 'PredicateParameters', maxGasPerPredicate: string, maxMessageDataLength: string, maxPredicateDataLength: string, maxPredicateLength: string }, scriptParams: { __typename: 'ScriptParameters', maxScriptDataLength: string, maxScriptLength: string }, txParams: { __typename: 'TxParameters', maxBytecodeSubsections: string, maxGasPerTx: string, maxInputs: string, maxOutputs: string, maxSize: string, maxWitnesses: string } }, gasCosts: { __typename: 'GasCosts', add: string, addi: string, aloc: string, and: string, andi: string, bal: string, bhei: string, bhsh: string, burn: string, cb: string, cfei: string, cfsi: string, div: string, divi: string, eck1: string, ecr1: string, ed19: string, eq: string, exp: string, expi: string, flag: string, gm: string, gt: string, gtf: string, ji: string, jmp: string, jmpb: string, jmpf: string, jne: string, jneb: string, jnef: string, jnei: string, jnzb: string, jnzf: string, jnzi: string, lb: string, log: string, lt: string, lw: string, mint: string, mldv: string, mlog: string, modOp: string, modi: string, moveOp: string, movi: string, mroo: string, mul: string, muli: string, newStoragePerByte: string, noop: string, not: string, or: string, ori: string, poph: string, popl: string, pshh: string, pshl: string, ret: string, rvrt: string, sb: string, sll: string, slli: string, srl: string, srli: string, srw: string, sub: string, subi: string, sw: string, sww: string, time: string, tr: string, tro: string, wdam: string, wdcm: string, wddv: string, wdmd: string, wdml: string, wdmm: string, wdop: string, wqam: string, wqcm: string, wqdv: string, wqmd: string, wqml: string, wqmm: string, wqop: string, xor: string, xori: string, call: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, ccp: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, contractRoot: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, croo: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, csiz: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, k256: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, ldc: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, logd: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, mcl: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, mcli: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, mcp: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, mcpi: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, meq: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, retd: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, s256: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, scwq: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, smo: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, srwq: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, stateRoot: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, swwq: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string }, vmInitialization: { __typename: 'HeavyOperation', base: string, gasPerUnit: string } | { __typename: 'LightOperation', base: string, unitsPerGas: string } }, latestBlock: { __typename: 'Block', height: string, id: string, consensus: { __typename: 'Genesis', chainConfigHash: string, coinsRoot: string, contractsRoot: string, messagesRoot: string, transactionsRoot: string } | { __typename: 'PoAConsensus', signature: string }, header: { __typename: 'Header', applicationHash: string, consensusParametersVersion: string, daHeight: string, eventInboxRoot: string, height: string, id: string, messageOutboxRoot: string, messageReceiptCount: string, prevRoot: string, stateTransitionBytecodeVersion: string, time: string, transactionsCount: string, transactionsRoot: string }, transactions: Array<{ __typename: 'Transaction', bytecodeRoot?: string | null, bytecodeWitnessIndex?: string | null, id: string, inputAssetIds?: Array | null, inputContracts?: Array | null, isCreate: boolean, isMint: boolean, isScript: boolean, isUpgrade: boolean, isUpload: boolean, maturity?: string | null, mintAmount?: string | null, mintAssetId?: string | null, mintGasPrice?: string | null, proofSet?: Array | null, rawPayload: string, receiptsRoot?: string | null, salt?: string | null, script?: string | null, scriptData?: string | null, scriptGasLimit?: string | null, storageSlots?: Array | null, subsectionIndex?: string | null, subsectionsNumber?: string | null, txPointer?: string | null, witnesses?: Array | null, inputContract?: { __typename: 'InputContract', balanceRoot: string, contractId: string, stateRoot: string, txPointer: string, utxoId: string } | null, inputs?: Array<{ __typename: 'InputCoin', amount: string, assetId: string, owner: string, predicate: string, predicateData: string, predicateGasUsed: string, txPointer: string, utxoId: string, witnessIndex: string } | { __typename: 'InputContract', balanceRoot: string, contractId: string, stateRoot: string, txPointer: string, utxoId: string } | { __typename: 'InputMessage', amount: string, data: string, nonce: string, predicate: string, predicateData: string, predicateGasUsed: string, recipient: string, sender: string, witnessIndex: string }> | null, outputContract?: { __typename: 'ContractOutput', balanceRoot: string, inputIndex: string, stateRoot: string } | null, outputs: Array<{ __typename: 'ChangeOutput', amount: string, assetId: string, to: string } | { __typename: 'CoinOutput', amount: string, assetId: string, to: string } | { __typename: 'ContractCreated', contract: string, stateRoot: string } | { __typename: 'ContractOutput', balanceRoot: string, inputIndex: string, stateRoot: string } | { __typename: 'VariableOutput', amount: string, assetId: string, to: string }>, policies?: { __typename: 'Policies', maturity?: string | null, maxFee?: string | null, tip?: string | null, witnessLimit?: string | null } | null, status?: { __typename: 'FailureStatus', reason: string, time: string, totalFee: string, totalGas: string, transactionId: string, block: { __typename: 'Block', height: string, id: string, consensus: { __typename: 'Genesis', chainConfigHash: string, coinsRoot: string, contractsRoot: string, messagesRoot: string, transactionsRoot: string } | { __typename: 'PoAConsensus', signature: string }, header: { __typename: 'Header', applicationHash: string, consensusParametersVersion: string, daHeight: string, eventInboxRoot: string, height: string, id: string, messageOutboxRoot: string, messageReceiptCount: string, prevRoot: string, stateTransitionBytecodeVersion: string, time: string, transactionsCount: string, transactionsRoot: string }, transactions: Array<{ __typename: 'Transaction', bytecodeRoot?: string | null, bytecodeWitnessIndex?: string | null, id: string, inputAssetIds?: Array | null, inputContracts?: Array | null, isCreate: boolean, isMint: boolean, isScript: boolean, isUpgrade: boolean, isUpload: boolean, maturity?: string | null, mintAmount?: string | null, mintAssetId?: string | null, mintGasPrice?: string | null, proofSet?: Array | null, rawPayload: string, receiptsRoot?: string | null, salt?: string | null, script?: string | null, scriptData?: string | null, scriptGasLimit?: string | null, storageSlots?: Array | null, subsectionIndex?: string | null, subsectionsNumber?: string | null, txPointer?: string | null, witnesses?: Array | null, inputContract?: { __typename: 'InputContract', balanceRoot: string, contractId: string, stateRoot: string, txPointer: string, utxoId: string } | null, inputs?: Array<{ __typename: 'InputCoin', amount: string, assetId: string, owner: string, predicate: string, predicateData: string, predicateGasUsed: string, txPointer: string, utxoId: string, witnessIndex: string } | { __typename: 'InputContract', balanceRoot: string, contractId: string, stateRoot: string, txPointer: string, utxoId: string } | { __typename: 'InputMessage', amount: string, data: string, nonce: string, predicate: string, predicateData: string, predicateGasUsed: string, recipient: string, sender: string, witnessIndex: string }> | null, outputContract?: { __typename: 'ContractOutput', balanceRoot: string, inputIndex: string, stateRoot: string } | null, outputs: Array<{ __typename: 'ChangeOutput', amount: string, assetId: string, to: string } | { __typename: 'CoinOutput', amount: string, assetId: string, to: string } | { __typename: 'ContractCreated', contract: string, stateRoot: string } | { __typename: 'ContractOutput', balanceRoot: string, inputIndex: string, stateRoot: string } | { __typename: 'VariableOutput', amount: string, assetId: string, to: string }>, policies?: { __typename: 'Policies', maturity?: string | null, maxFee?: string | null, tip?: string | null, witnessLimit?: string | null } | null, status?: { __typename: 'FailureStatus', reason: string, time: string, totalFee: string, totalGas: string, transactionId: string } | { __typename: 'SqueezedOutStatus', reason: string } | { __typename: 'SubmittedStatus', time: string } | { __typename: 'SuccessStatus', time: string, totalFee: string, totalGas: string, transactionId: string } | null, upgradePurpose?: { __typename: 'ConsensusParametersPurpose', checksum: string, witnessIndex: string } | { __typename: 'StateTransitionPurpose', root: string } | null }> }, programState?: { __typename: 'ProgramState', data: string, returnType: GQLReturnType } | null, receipts: Array<{ __typename: 'Receipt', amount?: string | null, assetId?: string | null, contractId?: string | null, data?: string | null, digest?: string | null, gas?: string | null, gasUsed?: string | null, id?: string | null, is?: string | null, len?: string | null, nonce?: string | null, param1?: string | null, param2?: string | null, pc?: string | null, ptr?: string | null, ra?: string | null, rb?: string | null, rc?: string | null, rd?: string | null, reason?: string | null, receiptType: GQLReceiptType, recipient?: string | null, result?: string | null, sender?: string | null, subId?: string | null, to?: string | null, toAddress?: string | null, val?: string | null }> } | { __typename: 'SqueezedOutStatus', reason: string } | { __typename: 'SubmittedStatus', time: string } | { __typename: 'SuccessStatus', time: string, totalFee: string, totalGas: string, transactionId: string, block: { __typename: 'Block', height: string, id: string, consensus: { __typename: 'Genesis', chainConfigHash: string, coinsRoot: string, contractsRoot: string, messagesRoot: string, transactionsRoot: string } | { __typename: 'PoAConsensus', signature: string }, header: { __typename: 'Header', applicationHash: string, consensusParametersVersion: string, daHeight: string, eventInboxRoot: string, height: string, id: string, messageOutboxRoot: string, messageReceiptCount: string, prevRoot: string, stateTransitionBytecodeVersion: string, time: string, transactionsCount: string, transactionsRoot: string }, transactions: Array<{ __typename: 'Transaction', bytecodeRoot?: string | null, bytecodeWitnessIndex?: string | null, id: string, inputAssetIds?: Array | null, inputContracts?: Array | null, isCreate: boolean, isMint: boolean, isScript: boolean, isUpgrade: boolean, isUpload: boolean, maturity?: string | null, mintAmount?: string | null, mintAssetId?: string | null, mintGasPrice?: string | null, proofSet?: Array | null, rawPayload: string, receiptsRoot?: string | null, salt?: string | null, script?: string | null, scriptData?: string | null, scriptGasLimit?: string | null, storageSlots?: Array | null, subsectionIndex?: string | null, subsectionsNumber?: string | null, txPointer?: string | null, witnesses?: Array | null, inputContract?: { __typename: 'InputContract', balanceRoot: string, contractId: string, stateRoot: string, txPointer: string, utxoId: string } | null, inputs?: Array<{ __typename: 'InputCoin', amount: string, assetId: string, owner: string, predicate: string, predicateData: string, predicateGasUsed: string, txPointer: string, utxoId: string, witnessIndex: string } | { __typename: 'InputContract', balanceRoot: string, contractId: string, stateRoot: string, txPointer: string, utxoId: string } | { __typename: 'InputMessage', amount: string, data: string, nonce: string, predicate: string, predicateData: string, predicateGasUsed: string, recipient: string, sender: string, witnessIndex: string }> | null, outputContract?: { __typename: 'ContractOutput', balanceRoot: string, inputIndex: string, stateRoot: string } | null, outputs: Array<{ __typename: 'ChangeOutput', amount: string, assetId: string, to: string } | { __typename: 'CoinOutput', amount: string, assetId: string, to: string } | { __typename: 'ContractCreated', contract: string, stateRoot: string } | { __typename: 'ContractOutput', balanceRoot: string, inputIndex: string, stateRoot: string } | { __typename: 'VariableOutput', amount: string, assetId: string, to: string }>, policies?: { __typename: 'Policies', maturity?: string | null, maxFee?: string | null, tip?: string | null, witnessLimit?: string | null } | null, status?: { __typename: 'FailureStatus', reason: string, time: string, totalFee: string, totalGas: string, transactionId: string } | { __typename: 'SqueezedOutStatus', reason: string } | { __typename: 'SubmittedStatus', time: string } | { __typename: 'SuccessStatus', time: string, totalFee: string, totalGas: string, transactionId: string } | null, upgradePurpose?: { __typename: 'ConsensusParametersPurpose', checksum: string, witnessIndex: string } | { __typename: 'StateTransitionPurpose', root: string } | null }> }, programState?: { __typename: 'ProgramState', data: string, returnType: GQLReturnType } | null, receipts: Array<{ __typename: 'Receipt', amount?: string | null, assetId?: string | null, contractId?: string | null, data?: string | null, digest?: string | null, gas?: string | null, gasUsed?: string | null, id?: string | null, is?: string | null, len?: string | null, nonce?: string | null, param1?: string | null, param2?: string | null, pc?: string | null, ptr?: string | null, ra?: string | null, rb?: string | null, rc?: string | null, rd?: string | null, reason?: string | null, receiptType: GQLReceiptType, recipient?: string | null, result?: string | null, sender?: string | null, subId?: string | null, to?: string | null, toAddress?: string | null, val?: string | null }> } | null, upgradePurpose?: { __typename: 'ConsensusParametersPurpose', checksum: string, witnessIndex: string } | { __typename: 'StateTransitionPurpose', root: string } | null }> } } }; +export type GQLChainQuery = { + __typename: 'Query'; + chain: { + __typename: 'ChainInfo'; + daHeight: string; + name: string; + consensusParameters: { + __typename: 'ConsensusParameters'; + baseAssetId: string; + blockGasLimit: string; + chainId: string; + privilegedAddress: string; + contractParams: { + __typename: 'ContractParameters'; + contractMaxSize: string; + maxStorageSlots: string; + }; + feeParams: { + __typename: 'FeeParameters'; + gasPerByte: string; + gasPriceFactor: string; + }; + gasCosts: { + __typename: 'GasCosts'; + add: string; + addi: string; + aloc: string; + and: string; + andi: string; + bal: string; + bhei: string; + bhsh: string; + burn: string; + cb: string; + cfei: string; + cfsi: string; + div: string; + divi: string; + eck1: string; + ecr1: string; + ed19: string; + eq: string; + exp: string; + expi: string; + flag: string; + gm: string; + gt: string; + gtf: string; + ji: string; + jmp: string; + jmpb: string; + jmpf: string; + jne: string; + jneb: string; + jnef: string; + jnei: string; + jnzb: string; + jnzf: string; + jnzi: string; + lb: string; + log: string; + lt: string; + lw: string; + mint: string; + mldv: string; + mlog: string; + modOp: string; + modi: string; + moveOp: string; + movi: string; + mroo: string; + mul: string; + muli: string; + newStoragePerByte: string; + noop: string; + not: string; + or: string; + ori: string; + poph: string; + popl: string; + pshh: string; + pshl: string; + ret: string; + rvrt: string; + sb: string; + sll: string; + slli: string; + srl: string; + srli: string; + srw: string; + sub: string; + subi: string; + sw: string; + sww: string; + time: string; + tr: string; + tro: string; + wdam: string; + wdcm: string; + wddv: string; + wdmd: string; + wdml: string; + wdmm: string; + wdop: string; + wqam: string; + wqcm: string; + wqdv: string; + wqmd: string; + wqml: string; + wqmm: string; + wqop: string; + xor: string; + xori: string; + call: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + ccp: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + contractRoot: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + croo: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + csiz: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + k256: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + ldc: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + logd: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + mcl: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + mcli: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + mcp: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + mcpi: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + meq: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + retd: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + s256: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + scwq: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + smo: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + srwq: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + stateRoot: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + swwq: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + vmInitialization: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + }; + predicateParams: { + __typename: 'PredicateParameters'; + maxGasPerPredicate: string; + maxMessageDataLength: string; + maxPredicateDataLength: string; + maxPredicateLength: string; + }; + scriptParams: { + __typename: 'ScriptParameters'; + maxScriptDataLength: string; + maxScriptLength: string; + }; + txParams: { + __typename: 'TxParameters'; + maxBytecodeSubsections: string; + maxGasPerTx: string; + maxInputs: string; + maxOutputs: string; + maxSize: string; + maxWitnesses: string; + }; + }; + gasCosts: { + __typename: 'GasCosts'; + add: string; + addi: string; + aloc: string; + and: string; + andi: string; + bal: string; + bhei: string; + bhsh: string; + burn: string; + cb: string; + cfei: string; + cfsi: string; + div: string; + divi: string; + eck1: string; + ecr1: string; + ed19: string; + eq: string; + exp: string; + expi: string; + flag: string; + gm: string; + gt: string; + gtf: string; + ji: string; + jmp: string; + jmpb: string; + jmpf: string; + jne: string; + jneb: string; + jnef: string; + jnei: string; + jnzb: string; + jnzf: string; + jnzi: string; + lb: string; + log: string; + lt: string; + lw: string; + mint: string; + mldv: string; + mlog: string; + modOp: string; + modi: string; + moveOp: string; + movi: string; + mroo: string; + mul: string; + muli: string; + newStoragePerByte: string; + noop: string; + not: string; + or: string; + ori: string; + poph: string; + popl: string; + pshh: string; + pshl: string; + ret: string; + rvrt: string; + sb: string; + sll: string; + slli: string; + srl: string; + srli: string; + srw: string; + sub: string; + subi: string; + sw: string; + sww: string; + time: string; + tr: string; + tro: string; + wdam: string; + wdcm: string; + wddv: string; + wdmd: string; + wdml: string; + wdmm: string; + wdop: string; + wqam: string; + wqcm: string; + wqdv: string; + wqmd: string; + wqml: string; + wqmm: string; + wqop: string; + xor: string; + xori: string; + call: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + ccp: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + contractRoot: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + croo: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + csiz: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + k256: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + ldc: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + logd: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + mcl: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + mcli: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + mcp: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + mcpi: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + meq: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + retd: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + s256: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + scwq: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + smo: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + srwq: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + stateRoot: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + swwq: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + vmInitialization: + | { __typename: 'HeavyOperation'; base: string; gasPerUnit: string } + | { __typename: 'LightOperation'; base: string; unitsPerGas: string }; + }; + latestBlock: { + __typename: 'Block'; + height: string; + id: string; + consensus: + | { + __typename: 'Genesis'; + chainConfigHash: string; + coinsRoot: string; + contractsRoot: string; + messagesRoot: string; + transactionsRoot: string; + } + | { __typename: 'PoAConsensus'; signature: string }; + header: { + __typename: 'Header'; + applicationHash: string; + consensusParametersVersion: string; + daHeight: string; + eventInboxRoot: string; + height: string; + id: string; + messageOutboxRoot: string; + messageReceiptCount: string; + prevRoot: string; + stateTransitionBytecodeVersion: string; + time: string; + transactionsCount: string; + transactionsRoot: string; + }; + transactions: Array<{ + __typename: 'Transaction'; + bytecodeRoot?: string | null; + bytecodeWitnessIndex?: string | null; + id: string; + inputAssetIds?: Array | null; + inputContracts?: Array | null; + isCreate: boolean; + isMint: boolean; + isScript: boolean; + isUpgrade: boolean; + isUpload: boolean; + maturity?: string | null; + mintAmount?: string | null; + mintAssetId?: string | null; + mintGasPrice?: string | null; + proofSet?: Array | null; + rawPayload: string; + receiptsRoot?: string | null; + salt?: string | null; + script?: string | null; + scriptData?: string | null; + scriptGasLimit?: string | null; + storageSlots?: Array | null; + subsectionIndex?: string | null; + subsectionsNumber?: string | null; + txPointer?: string | null; + witnesses?: Array | null; + inputContract?: { + __typename: 'InputContract'; + balanceRoot: string; + contractId: string; + stateRoot: string; + txPointer: string; + utxoId: string; + } | null; + inputs?: Array< + | { + __typename: 'InputCoin'; + amount: string; + assetId: string; + owner: string; + predicate: string; + predicateData: string; + predicateGasUsed: string; + txPointer: string; + utxoId: string; + witnessIndex: string; + } + | { + __typename: 'InputContract'; + balanceRoot: string; + contractId: string; + stateRoot: string; + txPointer: string; + utxoId: string; + } + | { + __typename: 'InputMessage'; + amount: string; + data: string; + nonce: string; + predicate: string; + predicateData: string; + predicateGasUsed: string; + recipient: string; + sender: string; + witnessIndex: string; + } + > | null; + outputContract?: { + __typename: 'ContractOutput'; + balanceRoot: string; + inputIndex: string; + stateRoot: string; + } | null; + outputs: Array< + | { + __typename: 'ChangeOutput'; + amount: string; + assetId: string; + to: string; + } + | { + __typename: 'CoinOutput'; + amount: string; + assetId: string; + to: string; + } + | { + __typename: 'ContractCreated'; + contract: string; + stateRoot: string; + } + | { + __typename: 'ContractOutput'; + balanceRoot: string; + inputIndex: string; + stateRoot: string; + } + | { + __typename: 'VariableOutput'; + amount: string; + assetId: string; + to: string; + } + >; + policies?: { + __typename: 'Policies'; + maturity?: string | null; + maxFee?: string | null; + tip?: string | null; + witnessLimit?: string | null; + } | null; + status?: + | { + __typename: 'FailureStatus'; + reason: string; + time: string; + totalFee: string; + totalGas: string; + transactionId: string; + block: { + __typename: 'Block'; + height: string; + id: string; + consensus: + | { + __typename: 'Genesis'; + chainConfigHash: string; + coinsRoot: string; + contractsRoot: string; + messagesRoot: string; + transactionsRoot: string; + } + | { __typename: 'PoAConsensus'; signature: string }; + header: { + __typename: 'Header'; + applicationHash: string; + consensusParametersVersion: string; + daHeight: string; + eventInboxRoot: string; + height: string; + id: string; + messageOutboxRoot: string; + messageReceiptCount: string; + prevRoot: string; + stateTransitionBytecodeVersion: string; + time: string; + transactionsCount: string; + transactionsRoot: string; + }; + transactions: Array<{ + __typename: 'Transaction'; + bytecodeRoot?: string | null; + bytecodeWitnessIndex?: string | null; + id: string; + inputAssetIds?: Array | null; + inputContracts?: Array | null; + isCreate: boolean; + isMint: boolean; + isScript: boolean; + isUpgrade: boolean; + isUpload: boolean; + maturity?: string | null; + mintAmount?: string | null; + mintAssetId?: string | null; + mintGasPrice?: string | null; + proofSet?: Array | null; + rawPayload: string; + receiptsRoot?: string | null; + salt?: string | null; + script?: string | null; + scriptData?: string | null; + scriptGasLimit?: string | null; + storageSlots?: Array | null; + subsectionIndex?: string | null; + subsectionsNumber?: string | null; + txPointer?: string | null; + witnesses?: Array | null; + inputContract?: { + __typename: 'InputContract'; + balanceRoot: string; + contractId: string; + stateRoot: string; + txPointer: string; + utxoId: string; + } | null; + inputs?: Array< + | { + __typename: 'InputCoin'; + amount: string; + assetId: string; + owner: string; + predicate: string; + predicateData: string; + predicateGasUsed: string; + txPointer: string; + utxoId: string; + witnessIndex: string; + } + | { + __typename: 'InputContract'; + balanceRoot: string; + contractId: string; + stateRoot: string; + txPointer: string; + utxoId: string; + } + | { + __typename: 'InputMessage'; + amount: string; + data: string; + nonce: string; + predicate: string; + predicateData: string; + predicateGasUsed: string; + recipient: string; + sender: string; + witnessIndex: string; + } + > | null; + outputContract?: { + __typename: 'ContractOutput'; + balanceRoot: string; + inputIndex: string; + stateRoot: string; + } | null; + outputs: Array< + | { + __typename: 'ChangeOutput'; + amount: string; + assetId: string; + to: string; + } + | { + __typename: 'CoinOutput'; + amount: string; + assetId: string; + to: string; + } + | { + __typename: 'ContractCreated'; + contract: string; + stateRoot: string; + } + | { + __typename: 'ContractOutput'; + balanceRoot: string; + inputIndex: string; + stateRoot: string; + } + | { + __typename: 'VariableOutput'; + amount: string; + assetId: string; + to: string; + } + >; + policies?: { + __typename: 'Policies'; + maturity?: string | null; + maxFee?: string | null; + tip?: string | null; + witnessLimit?: string | null; + } | null; + status?: + | { + __typename: 'FailureStatus'; + reason: string; + time: string; + totalFee: string; + totalGas: string; + transactionId: string; + } + | { __typename: 'SqueezedOutStatus'; reason: string } + | { __typename: 'SubmittedStatus'; time: string } + | { + __typename: 'SuccessStatus'; + time: string; + totalFee: string; + totalGas: string; + transactionId: string; + } + | null; + upgradePurpose?: + | { + __typename: 'ConsensusParametersPurpose'; + checksum: string; + witnessIndex: string; + } + | { __typename: 'StateTransitionPurpose'; root: string } + | null; + }>; + }; + programState?: { + __typename: 'ProgramState'; + data: string; + returnType: GQLReturnType; + } | null; + receipts: Array<{ + __typename: 'Receipt'; + amount?: string | null; + assetId?: string | null; + contractId?: string | null; + data?: string | null; + digest?: string | null; + gas?: string | null; + gasUsed?: string | null; + id?: string | null; + is?: string | null; + len?: string | null; + nonce?: string | null; + param1?: string | null; + param2?: string | null; + pc?: string | null; + ptr?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + reason?: string | null; + receiptType: GQLReceiptType; + recipient?: string | null; + result?: string | null; + sender?: string | null; + subId?: string | null; + to?: string | null; + toAddress?: string | null; + val?: string | null; + }>; + } + | { __typename: 'SqueezedOutStatus'; reason: string } + | { __typename: 'SubmittedStatus'; time: string } + | { + __typename: 'SuccessStatus'; + time: string; + totalFee: string; + totalGas: string; + transactionId: string; + block: { + __typename: 'Block'; + height: string; + id: string; + consensus: + | { + __typename: 'Genesis'; + chainConfigHash: string; + coinsRoot: string; + contractsRoot: string; + messagesRoot: string; + transactionsRoot: string; + } + | { __typename: 'PoAConsensus'; signature: string }; + header: { + __typename: 'Header'; + applicationHash: string; + consensusParametersVersion: string; + daHeight: string; + eventInboxRoot: string; + height: string; + id: string; + messageOutboxRoot: string; + messageReceiptCount: string; + prevRoot: string; + stateTransitionBytecodeVersion: string; + time: string; + transactionsCount: string; + transactionsRoot: string; + }; + transactions: Array<{ + __typename: 'Transaction'; + bytecodeRoot?: string | null; + bytecodeWitnessIndex?: string | null; + id: string; + inputAssetIds?: Array | null; + inputContracts?: Array | null; + isCreate: boolean; + isMint: boolean; + isScript: boolean; + isUpgrade: boolean; + isUpload: boolean; + maturity?: string | null; + mintAmount?: string | null; + mintAssetId?: string | null; + mintGasPrice?: string | null; + proofSet?: Array | null; + rawPayload: string; + receiptsRoot?: string | null; + salt?: string | null; + script?: string | null; + scriptData?: string | null; + scriptGasLimit?: string | null; + storageSlots?: Array | null; + subsectionIndex?: string | null; + subsectionsNumber?: string | null; + txPointer?: string | null; + witnesses?: Array | null; + inputContract?: { + __typename: 'InputContract'; + balanceRoot: string; + contractId: string; + stateRoot: string; + txPointer: string; + utxoId: string; + } | null; + inputs?: Array< + | { + __typename: 'InputCoin'; + amount: string; + assetId: string; + owner: string; + predicate: string; + predicateData: string; + predicateGasUsed: string; + txPointer: string; + utxoId: string; + witnessIndex: string; + } + | { + __typename: 'InputContract'; + balanceRoot: string; + contractId: string; + stateRoot: string; + txPointer: string; + utxoId: string; + } + | { + __typename: 'InputMessage'; + amount: string; + data: string; + nonce: string; + predicate: string; + predicateData: string; + predicateGasUsed: string; + recipient: string; + sender: string; + witnessIndex: string; + } + > | null; + outputContract?: { + __typename: 'ContractOutput'; + balanceRoot: string; + inputIndex: string; + stateRoot: string; + } | null; + outputs: Array< + | { + __typename: 'ChangeOutput'; + amount: string; + assetId: string; + to: string; + } + | { + __typename: 'CoinOutput'; + amount: string; + assetId: string; + to: string; + } + | { + __typename: 'ContractCreated'; + contract: string; + stateRoot: string; + } + | { + __typename: 'ContractOutput'; + balanceRoot: string; + inputIndex: string; + stateRoot: string; + } + | { + __typename: 'VariableOutput'; + amount: string; + assetId: string; + to: string; + } + >; + policies?: { + __typename: 'Policies'; + maturity?: string | null; + maxFee?: string | null; + tip?: string | null; + witnessLimit?: string | null; + } | null; + status?: + | { + __typename: 'FailureStatus'; + reason: string; + time: string; + totalFee: string; + totalGas: string; + transactionId: string; + } + | { __typename: 'SqueezedOutStatus'; reason: string } + | { __typename: 'SubmittedStatus'; time: string } + | { + __typename: 'SuccessStatus'; + time: string; + totalFee: string; + totalGas: string; + transactionId: string; + } + | null; + upgradePurpose?: + | { + __typename: 'ConsensusParametersPurpose'; + checksum: string; + witnessIndex: string; + } + | { __typename: 'StateTransitionPurpose'; root: string } + | null; + }>; + }; + programState?: { + __typename: 'ProgramState'; + data: string; + returnType: GQLReturnType; + } | null; + receipts: Array<{ + __typename: 'Receipt'; + amount?: string | null; + assetId?: string | null; + contractId?: string | null; + data?: string | null; + digest?: string | null; + gas?: string | null; + gasUsed?: string | null; + id?: string | null; + is?: string | null; + len?: string | null; + nonce?: string | null; + param1?: string | null; + param2?: string | null; + pc?: string | null; + ptr?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + reason?: string | null; + receiptType: GQLReceiptType; + recipient?: string | null; + result?: string | null; + sender?: string | null; + subId?: string | null; + to?: string | null; + toAddress?: string | null; + val?: string | null; + }>; + } + | null; + upgradePurpose?: + | { + __typename: 'ConsensusParametersPurpose'; + checksum: string; + witnessIndex: string; + } + | { __typename: 'StateTransitionPurpose'; root: string } + | null; + }>; + }; + }; +}; export type GQLCoinsQueryVariables = Exact<{ after?: InputMaybe; @@ -1485,351 +2593,1993 @@ export type GQLCoinsQueryVariables = Exact<{ last?: InputMaybe; }>; - -export type GQLCoinsQuery = { __typename: 'Query', coins: { __typename: 'CoinConnection', edges: Array<{ __typename: 'CoinEdge', cursor: string, node: { __typename: 'Coin', amount: string, assetId: string, blockCreated: string, owner: string, txCreatedIdx: string, utxoId: string } }>, nodes: Array<{ __typename: 'Coin', amount: string, assetId: string, blockCreated: string, owner: string, txCreatedIdx: string, utxoId: string }>, pageInfo: { __typename: 'PageInfo', endCursor?: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null } } }; +export type GQLCoinsQuery = { + __typename: 'Query'; + coins: { + __typename: 'CoinConnection'; + edges: Array<{ + __typename: 'CoinEdge'; + cursor: string; + node: { + __typename: 'Coin'; + amount: string; + assetId: string; + blockCreated: string; + owner: string; + txCreatedIdx: string; + utxoId: string; + }; + }>; + nodes: Array<{ + __typename: 'Coin'; + amount: string; + assetId: string; + blockCreated: string; + owner: string; + txCreatedIdx: string; + utxoId: string; + }>; + pageInfo: { + __typename: 'PageInfo'; + endCursor?: string | null; + hasNextPage: boolean; + hasPreviousPage: boolean; + startCursor?: string | null; + }; + }; +}; export type GQLContractQueryVariables = Exact<{ id: Scalars['ContractId']['input']; }>; +export type GQLContractQuery = { + __typename: 'Query'; + contract?: { __typename: 'Contract'; bytecode: string } | null; +}; -export type GQLContractQuery = { __typename: 'Query', contract?: { __typename: 'Contract', id: string, bytecode: string } | null }; +export type GQLContractBalanceNodeFragment = { + __typename: 'ContractBalance'; + amount: string; + assetId: string; +}; -export type GQLContractBalanceQueryVariables = Exact<{ - asset: Scalars['AssetId']['input']; - contract: Scalars['ContractId']['input']; +export type GQLContractBalanceConnectionNodeFragment = { + __typename: 'ContractBalanceConnection'; + edges: Array<{ + __typename: 'ContractBalanceEdge'; + cursor: string; + node: { __typename: 'ContractBalance'; amount: string; assetId: string }; + }>; + pageInfo: { + __typename: 'PageInfo'; + hasNextPage: boolean; + hasPreviousPage: boolean; + endCursor?: string | null; + startCursor?: string | null; + }; +}; + +export type GQLContractBalancesQueryVariables = Exact<{ + after?: InputMaybe; + before?: InputMaybe; + filter: GQLContractBalanceFilterInput; + first?: InputMaybe; + last?: InputMaybe; }>; +export type GQLContractBalancesQuery = { + __typename: 'Query'; + contractBalances: { + __typename: 'ContractBalanceConnection'; + edges: Array<{ + __typename: 'ContractBalanceEdge'; + cursor: string; + node: { __typename: 'ContractBalance'; amount: string; assetId: string }; + }>; + pageInfo: { + __typename: 'PageInfo'; + hasNextPage: boolean; + hasPreviousPage: boolean; + endCursor?: string | null; + startCursor?: string | null; + }; + }; +}; -export type GQLContractBalanceQuery = { __typename: 'Query', contractBalance: { __typename: 'ContractBalance', amount: string, assetId: string, contract: string } }; +export type GQLPredicateQueryVariables = Exact<{ + address: Scalars['String']['input']; +}>; -export type GQLContractBalanceNodeFragment = { __typename: 'ContractBalance', amount: string, assetId: string }; +export type GQLPredicateQuery = { + __typename: 'Query'; + predicate?: { + __typename: 'PredicateItem'; + address?: string | null; + bytecode?: string | null; + } | null; +}; -export type GQLContractBalanceConnectionNodeFragment = { __typename: 'ContractBalanceConnection', edges: Array<{ __typename: 'ContractBalanceEdge', cursor: string, node: { __typename: 'ContractBalance', amount: string, assetId: string } }>, pageInfo: { __typename: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, endCursor?: string | null, startCursor?: string | null } }; +export type GQLRecentTransactionFragment = { + __typename: 'Transaction'; + _id?: string | null; + id: string; + title: string; + statusType?: string | null; + time: { + __typename: 'ParsedTime'; + fromNow?: string | null; + rawUnix?: string | null; + }; + gasCosts?: { __typename: 'TransactionGasCosts'; fee?: string | null } | null; +}; -export type GQLContractBalancesQueryVariables = Exact<{ +export type GQLRecentTransactionsQueryVariables = Exact<{ after?: InputMaybe; before?: InputMaybe; - filter: GQLContractBalanceFilterInput; first?: InputMaybe; last?: InputMaybe; }>; +export type GQLRecentTransactionsQuery = { + __typename: 'Query'; + transactions: { + __typename: 'TransactionConnection'; + nodes: Array<{ + __typename: 'Transaction'; + _id?: string | null; + id: string; + title: string; + statusType?: string | null; + time: { + __typename: 'ParsedTime'; + fromNow?: string | null; + rawUnix?: string | null; + }; + gasCosts?: { + __typename: 'TransactionGasCosts'; + fee?: string | null; + } | null; + }>; + pageInfo: { + __typename: 'PageInfo'; + endCursor?: string | null; + hasNextPage: boolean; + hasPreviousPage: boolean; + startCursor?: string | null; + }; + }; +}; -export type GQLContractBalancesQuery = { __typename: 'Query', contractBalances: { __typename: 'ContractBalanceConnection', edges: Array<{ __typename: 'ContractBalanceEdge', cursor: string, node: { __typename: 'ContractBalance', amount: string, assetId: string } }>, pageInfo: { __typename: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, endCursor?: string | null, startCursor?: string | null } } }; +export type GQLSearchQueryVariables = Exact<{ + query: Scalars['String']['input']; +}>; -export type GQLNodeInfoQueryVariables = Exact<{ [key: string]: never; }>; +export type GQLSearchQuery = { + __typename: 'Query'; + search?: { + __typename: 'SearchResult'; + account?: { + __typename: 'SearchAccount'; + address?: string | null; + transactions?: Array<{ + __typename: 'SearchTransaction'; + id?: string | null; + } | null> | null; + } | null; + block?: { + __typename: 'SearchBlock'; + height?: string | null; + id?: string | null; + } | null; + contract?: { __typename: 'SearchContract'; id?: string | null } | null; + transaction?: { + __typename: 'SearchTransaction'; + id?: string | null; + } | null; + } | null; +}; + +export type GQLTransactionDetailsQueryVariables = Exact<{ + id: Scalars['TransactionId']['input']; +}>; +export type GQLTransactionDetailsQuery = { + __typename: 'Query'; + transaction?: { + __typename: 'Transaction'; + id: string; + blockHeight?: string | null; + hasPredicate?: boolean | null; + statusType?: string | null; + title: string; + maturity?: string | null; + txPointer?: string | null; + isScript: boolean; + isCreate: boolean; + isMint: boolean; + witnesses?: Array | null; + receiptsRoot?: string | null; + script?: string | null; + scriptData?: string | null; + bytecodeWitnessIndex?: string | null; + salt?: string | null; + storageSlots?: Array | null; + rawPayload: string; + mintAmount?: string | null; + mintAssetId?: string | null; + inputAssetIds?: Array | null; + inputContracts?: Array | null; + gasCosts?: { + __typename: 'TransactionGasCosts'; + fee?: string | null; + gasUsed?: string | null; + } | null; + groupedInputs: Array< + | { + __typename: 'GroupedInputCoin'; + type?: GQLGroupedInputType | null; + totalAmount?: string | null; + owner?: string | null; + assetId?: string | null; + inputs?: Array< + | { __typename: 'InputCoin'; amount: string; utxoId: string } + | { __typename: 'InputContract' } + | { __typename: 'InputMessage' } + > | null; + } + | { + __typename: 'GroupedInputContract'; + type?: GQLGroupedInputType | null; + contractId?: string | null; + } + | { + __typename: 'GroupedInputMessage'; + type?: GQLGroupedInputType | null; + sender?: string | null; + data?: string | null; + recipient?: string | null; + } + >; + groupedOutputs: Array< + | { + __typename: 'GroupedOutputChanged'; + type?: GQLGroupedOutputType | null; + assetId?: string | null; + totalAmount?: string | null; + to?: string | null; + outputs?: Array< + | { __typename: 'ChangeOutput' } + | { __typename: 'CoinOutput' } + | { __typename: 'ContractCreated' } + | { __typename: 'ContractOutput' } + | { __typename: 'VariableOutput' } + | null + > | null; + } + | { + __typename: 'GroupedOutputCoin'; + type?: GQLGroupedOutputType | null; + assetId?: string | null; + totalAmount?: string | null; + to?: string | null; + outputs?: Array< + | { __typename: 'ChangeOutput' } + | { __typename: 'CoinOutput' } + | { __typename: 'ContractCreated' } + | { __typename: 'ContractOutput' } + | { __typename: 'VariableOutput' } + | null + > | null; + } + | { + __typename: 'GroupedOutputContractCreated'; + type?: GQLGroupedOutputType | null; + contractId?: string | null; + } + >; + operations?: Array<{ + __typename: 'Operation'; + type?: GQLOperationType | null; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + }> | null; + receipts?: Array<{ + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + }> | null; + time: { + __typename: 'ParsedTime'; + fromNow?: string | null; + full?: string | null; + rawUnix?: string | null; + }; + inputContract?: { __typename: 'InputContract'; contractId: string } | null; + outputContract?: { + __typename: 'ContractOutput'; + inputIndex: string; + } | null; + status?: + | { + __typename: 'FailureStatus'; + time: string; + programState?: { __typename: 'ProgramState'; data: string } | null; + } + | { __typename: 'SqueezedOutStatus'; reason: string } + | { __typename: 'SubmittedStatus'; time: string } + | { + __typename: 'SuccessStatus'; + time: string; + block: { + __typename: 'Block'; + id: string; + header: { + __typename: 'Header'; + id: string; + height: string; + daHeight: string; + applicationHash: string; + messageReceiptCount: string; + time: string; + }; + }; + programState?: { __typename: 'ProgramState'; data: string } | null; + } + | null; + inputs?: Array< + | { + __typename: 'InputCoin'; + amount: string; + assetId: string; + owner: string; + predicate: string; + predicateData: string; + txPointer: string; + utxoId: string; + witnessIndex: string; + } + | { + __typename: 'InputContract'; + utxoId: string; + balanceRoot: string; + txPointer: string; + contractId: string; + } + | { + __typename: 'InputMessage'; + sender: string; + recipient: string; + amount: string; + nonce: string; + data: string; + predicate: string; + predicateData: string; + } + > | null; + outputs: Array< + | { + __typename: 'ChangeOutput'; + to: string; + amount: string; + assetId: string; + } + | { + __typename: 'CoinOutput'; + to: string; + amount: string; + assetId: string; + } + | { __typename: 'ContractCreated'; contract: string } + | { + __typename: 'ContractOutput'; + inputIndex: string; + balanceRoot: string; + } + | { + __typename: 'VariableOutput'; + to: string; + amount: string; + assetId: string; + } + >; + } | null; +}; + +export type GQLTransactionsByBlockIdQueryVariables = Exact<{ + after?: InputMaybe; + before?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + blockId: Scalars['String']['input']; +}>; + +export type GQLTransactionsByBlockIdQuery = { + __typename: 'Query'; + transactionsByBlockId: { + __typename: 'TransactionConnection'; + nodes: Array<{ + __typename: 'Transaction'; + _id?: string | null; + id: string; + title: string; + statusType?: string | null; + time: { + __typename: 'ParsedTime'; + fromNow?: string | null; + rawUnix?: string | null; + }; + gasCosts?: { + __typename: 'TransactionGasCosts'; + fee?: string | null; + } | null; + }>; + pageInfo: { + __typename: 'PageInfo'; + endCursor?: string | null; + hasNextPage: boolean; + hasPreviousPage: boolean; + startCursor?: string | null; + }; + }; +}; + +export type GQLTransactionsByOwnerQueryVariables = Exact<{ + after?: InputMaybe; + before?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + owner: Scalars['Address']['input']; +}>; + +export type GQLTransactionsByOwnerQuery = { + __typename: 'Query'; + transactionsByOwner: { + __typename: 'TransactionConnection'; + nodes: Array<{ + __typename: 'Transaction'; + _id?: string | null; + id: string; + title: string; + statusType?: string | null; + time: { + __typename: 'ParsedTime'; + fromNow?: string | null; + rawUnix?: string | null; + }; + gasCosts?: { + __typename: 'TransactionGasCosts'; + fee?: string | null; + } | null; + }>; + pageInfo: { + __typename: 'PageInfo'; + endCursor?: string | null; + hasNextPage: boolean; + hasPreviousPage: boolean; + startCursor?: string | null; + }; + }; +}; + +type GQLTransactionStatus_FailureStatus_Fragment = { + __typename: 'FailureStatus'; + time: string; + programState?: { __typename: 'ProgramState'; data: string } | null; +}; + +type GQLTransactionStatus_SqueezedOutStatus_Fragment = { + __typename: 'SqueezedOutStatus'; + reason: string; +}; + +type GQLTransactionStatus_SubmittedStatus_Fragment = { + __typename: 'SubmittedStatus'; + time: string; +}; + +type GQLTransactionStatus_SuccessStatus_Fragment = { + __typename: 'SuccessStatus'; + time: string; + block: { + __typename: 'Block'; + id: string; + header: { + __typename: 'Header'; + id: string; + height: string; + daHeight: string; + applicationHash: string; + messageReceiptCount: string; + time: string; + }; + }; + programState?: { __typename: 'ProgramState'; data: string } | null; +}; + +export type GQLTransactionStatusFragment = + | GQLTransactionStatus_FailureStatus_Fragment + | GQLTransactionStatus_SqueezedOutStatus_Fragment + | GQLTransactionStatus_SubmittedStatus_Fragment + | GQLTransactionStatus_SuccessStatus_Fragment; + +type GQLTransactionInput_InputCoin_Fragment = { + __typename: 'InputCoin'; + amount: string; + assetId: string; + owner: string; + predicate: string; + predicateData: string; + txPointer: string; + utxoId: string; + witnessIndex: string; +}; + +type GQLTransactionInput_InputContract_Fragment = { + __typename: 'InputContract'; + utxoId: string; + balanceRoot: string; + txPointer: string; + contractId: string; +}; + +type GQLTransactionInput_InputMessage_Fragment = { + __typename: 'InputMessage'; + sender: string; + recipient: string; + amount: string; + nonce: string; + data: string; + predicate: string; + predicateData: string; +}; + +export type GQLTransactionInputFragment = + | GQLTransactionInput_InputCoin_Fragment + | GQLTransactionInput_InputContract_Fragment + | GQLTransactionInput_InputMessage_Fragment; + +type GQLTransactionOutput_ChangeOutput_Fragment = { + __typename: 'ChangeOutput'; + to: string; + amount: string; + assetId: string; +}; + +type GQLTransactionOutput_CoinOutput_Fragment = { + __typename: 'CoinOutput'; + to: string; + amount: string; + assetId: string; +}; + +type GQLTransactionOutput_ContractCreated_Fragment = { + __typename: 'ContractCreated'; + contract: string; +}; -export type GQLNodeInfoQuery = { __typename: 'Query', nodeInfo: { __typename: 'NodeInfo', maxDepth: string, maxTx: string, nodeVersion: string, utxoValidation: boolean, vmBacktrace: boolean, peers: Array<{ __typename: 'PeerInfo', addresses: Array, appScore: number, blockHeight?: string | null, clientVersion?: string | null, id: string, lastHeartbeatMs: string }> } }; +type GQLTransactionOutput_ContractOutput_Fragment = { + __typename: 'ContractOutput'; + inputIndex: string; + balanceRoot: string; +}; + +type GQLTransactionOutput_VariableOutput_Fragment = { + __typename: 'VariableOutput'; + to: string; + amount: string; + assetId: string; +}; + +export type GQLTransactionOutputFragment = + | GQLTransactionOutput_ChangeOutput_Fragment + | GQLTransactionOutput_CoinOutput_Fragment + | GQLTransactionOutput_ContractCreated_Fragment + | GQLTransactionOutput_ContractOutput_Fragment + | GQLTransactionOutput_VariableOutput_Fragment; + +export type GQLTransactionReceiptFragment = { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; +}; + +export type GQLInnerReceiptItemFragment = { + __typename: 'OperationReceipt'; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; +}; + +export type GQLOperationReceiptItemFragment = { + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; +}; + +export type GQLOperationItemFragment = { + __typename: 'Operation'; + type?: GQLOperationType | null; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; +}; + +export type GQLTxDetailsGroupedInputCoinFragment = { + __typename: 'GroupedInputCoin'; + type?: GQLGroupedInputType | null; + totalAmount?: string | null; + owner?: string | null; + assetId?: string | null; + inputs?: Array< + | { __typename: 'InputCoin'; amount: string; utxoId: string } + | { __typename: 'InputContract' } + | { __typename: 'InputMessage' } + > | null; +}; + +export type GQLTxDetailsGroupedInputMessageFragment = { + __typename: 'GroupedInputMessage'; + type?: GQLGroupedInputType | null; + sender?: string | null; + data?: string | null; + recipient?: string | null; +}; + +export type GQLTxDetailsGroupedInputContractFragment = { + __typename: 'GroupedInputContract'; + type?: GQLGroupedInputType | null; + contractId?: string | null; +}; + +export type GQLTxDetailsGroupedOutputCoinFragment = { + __typename: 'GroupedOutputCoin'; + type?: GQLGroupedOutputType | null; + assetId?: string | null; + totalAmount?: string | null; + to?: string | null; + outputs?: Array< + | { __typename: 'ChangeOutput' } + | { __typename: 'CoinOutput' } + | { __typename: 'ContractCreated' } + | { __typename: 'ContractOutput' } + | { __typename: 'VariableOutput' } + | null + > | null; +}; + +export type GQLTxDetailsGroupedOutputChangedFragment = { + __typename: 'GroupedOutputChanged'; + type?: GQLGroupedOutputType | null; + assetId?: string | null; + totalAmount?: string | null; + to?: string | null; + outputs?: Array< + | { __typename: 'ChangeOutput' } + | { __typename: 'CoinOutput' } + | { __typename: 'ContractCreated' } + | { __typename: 'ContractOutput' } + | { __typename: 'VariableOutput' } + | null + > | null; +}; + +export type GQLTxDetailsGroupedOutputContractCreatedFragment = { + __typename: 'GroupedOutputContractCreated'; + type?: GQLGroupedOutputType | null; + contractId?: string | null; +}; + +export type GQLTransactionItemFragment = { + __typename: 'Transaction'; + id: string; + blockHeight?: string | null; + hasPredicate?: boolean | null; + statusType?: string | null; + title: string; + maturity?: string | null; + txPointer?: string | null; + isScript: boolean; + isCreate: boolean; + isMint: boolean; + witnesses?: Array | null; + receiptsRoot?: string | null; + script?: string | null; + scriptData?: string | null; + bytecodeWitnessIndex?: string | null; + salt?: string | null; + storageSlots?: Array | null; + rawPayload: string; + mintAmount?: string | null; + mintAssetId?: string | null; + inputAssetIds?: Array | null; + inputContracts?: Array | null; + gasCosts?: { + __typename: 'TransactionGasCosts'; + fee?: string | null; + gasUsed?: string | null; + } | null; + groupedInputs: Array< + | { + __typename: 'GroupedInputCoin'; + type?: GQLGroupedInputType | null; + totalAmount?: string | null; + owner?: string | null; + assetId?: string | null; + inputs?: Array< + | { __typename: 'InputCoin'; amount: string; utxoId: string } + | { __typename: 'InputContract' } + | { __typename: 'InputMessage' } + > | null; + } + | { + __typename: 'GroupedInputContract'; + type?: GQLGroupedInputType | null; + contractId?: string | null; + } + | { + __typename: 'GroupedInputMessage'; + type?: GQLGroupedInputType | null; + sender?: string | null; + data?: string | null; + recipient?: string | null; + } + >; + groupedOutputs: Array< + | { + __typename: 'GroupedOutputChanged'; + type?: GQLGroupedOutputType | null; + assetId?: string | null; + totalAmount?: string | null; + to?: string | null; + outputs?: Array< + | { __typename: 'ChangeOutput' } + | { __typename: 'CoinOutput' } + | { __typename: 'ContractCreated' } + | { __typename: 'ContractOutput' } + | { __typename: 'VariableOutput' } + | null + > | null; + } + | { + __typename: 'GroupedOutputCoin'; + type?: GQLGroupedOutputType | null; + assetId?: string | null; + totalAmount?: string | null; + to?: string | null; + outputs?: Array< + | { __typename: 'ChangeOutput' } + | { __typename: 'CoinOutput' } + | { __typename: 'ContractCreated' } + | { __typename: 'ContractOutput' } + | { __typename: 'VariableOutput' } + | null + > | null; + } + | { + __typename: 'GroupedOutputContractCreated'; + type?: GQLGroupedOutputType | null; + contractId?: string | null; + } + >; + operations?: Array<{ + __typename: 'Operation'; + type?: GQLOperationType | null; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + receipts?: Array<{ + __typename: 'OperationReceipt'; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + item?: { + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + } | null; + }> | null; + }> | null; + receipts?: Array<{ + __typename: 'Receipt'; + id?: string | null; + to?: string | null; + pc?: string | null; + is?: string | null; + toAddress?: string | null; + amount?: string | null; + assetId?: string | null; + gas?: string | null; + param1?: string | null; + param2?: string | null; + val?: string | null; + ptr?: string | null; + digest?: string | null; + reason?: string | null; + ra?: string | null; + rb?: string | null; + rc?: string | null; + rd?: string | null; + len?: string | null; + receiptType: GQLReceiptType; + result?: string | null; + gasUsed?: string | null; + data?: string | null; + sender?: string | null; + recipient?: string | null; + nonce?: string | null; + contractId?: string | null; + subId?: string | null; + }> | null; + time: { + __typename: 'ParsedTime'; + fromNow?: string | null; + full?: string | null; + rawUnix?: string | null; + }; + inputContract?: { __typename: 'InputContract'; contractId: string } | null; + outputContract?: { __typename: 'ContractOutput'; inputIndex: string } | null; + status?: + | { + __typename: 'FailureStatus'; + time: string; + programState?: { __typename: 'ProgramState'; data: string } | null; + } + | { __typename: 'SqueezedOutStatus'; reason: string } + | { __typename: 'SubmittedStatus'; time: string } + | { + __typename: 'SuccessStatus'; + time: string; + block: { + __typename: 'Block'; + id: string; + header: { + __typename: 'Header'; + id: string; + height: string; + daHeight: string; + applicationHash: string; + messageReceiptCount: string; + time: string; + }; + }; + programState?: { __typename: 'ProgramState'; data: string } | null; + } + | null; + inputs?: Array< + | { + __typename: 'InputCoin'; + amount: string; + assetId: string; + owner: string; + predicate: string; + predicateData: string; + txPointer: string; + utxoId: string; + witnessIndex: string; + } + | { + __typename: 'InputContract'; + utxoId: string; + balanceRoot: string; + txPointer: string; + contractId: string; + } + | { + __typename: 'InputMessage'; + sender: string; + recipient: string; + amount: string; + nonce: string; + data: string; + predicate: string; + predicateData: string; + } + > | null; + outputs: Array< + | { + __typename: 'ChangeOutput'; + to: string; + amount: string; + assetId: string; + } + | { __typename: 'CoinOutput'; to: string; amount: string; assetId: string } + | { __typename: 'ContractCreated'; contract: string } + | { __typename: 'ContractOutput'; inputIndex: string; balanceRoot: string } + | { + __typename: 'VariableOutput'; + to: string; + amount: string; + assetId: string; + } + >; +}; export const BalanceItemFragmentDoc = gql` fragment BalanceItem on Balance { amount assetId owner + utxos { + amount + blockCreated + txCreatedIdx + utxoId + } } `; +export const RecentTransactionFragmentDoc = gql` + fragment RecentTransaction on Transaction { + _id + id + title + statusType + time { + fromNow + rawUnix + } + gasCosts { + fee + } +} + `; +export const BlockFragmentDoc = gql` + fragment Block on Block { + id + producer + consensus { + __typename + ... on PoAConsensus { + signature + } + } + header { + transactionsCount + } + time { + full + fromNow + rawUnix + } + transactions { + ...RecentTransaction + } +} + ${RecentTransactionFragmentDoc}`; export const BlockItemFragmentDoc = gql` fragment BlockItem on Block { + time { + fromNow + full + rawTai64 + rawUnix + } + totalGasUsed + producer + id consensus { __typename - ... on Genesis { - chainConfigHash - coinsRoot - contractsRoot - messagesRoot - transactionsRoot - } ... on PoAConsensus { signature } } header { - applicationHash - consensusParametersVersion - daHeight - eventInboxRoot - height id - messageOutboxRoot - messageReceiptCount - prevRoot - stateTransitionBytecodeVersion + height time transactionsCount - transactionsRoot } - height - id transactions { - bytecodeRoot - bytecodeWitnessIndex - id - inputAssetIds - inputContract { - balanceRoot - contractId - stateRoot - txPointer - utxoId - } - inputContracts - inputs { - __typename - ... on InputCoin { - amount - assetId - owner - predicate - predicateData - predicateGasUsed - txPointer - utxoId - witnessIndex - } - ... on InputContract { - balanceRoot - contractId - stateRoot - txPointer - utxoId - } - ... on InputMessage { - amount - data - nonce - predicate - predicateData - predicateGasUsed - recipient - sender - witnessIndex - } - } - isCreate isMint - isScript - isUpgrade - isUpload - maturity mintAmount - mintAssetId - mintGasPrice - outputContract { - balanceRoot - inputIndex - stateRoot - } - outputs { - __typename - ... on ChangeOutput { - amount - assetId - to - } - ... on CoinOutput { - amount - assetId - to - } - ... on ContractCreated { - contract - stateRoot - } - ... on ContractOutput { - balanceRoot - inputIndex - stateRoot - } - ... on VariableOutput { - amount - assetId - to - } - } - policies { - maturity - maxFee - tip - witnessLimit - } - proofSet - rawPayload - receiptsRoot - salt - script - scriptData - scriptGasLimit - status { - __typename - ... on FailureStatus { - block { - consensus { - __typename - ... on Genesis { - chainConfigHash - coinsRoot - contractsRoot - messagesRoot - transactionsRoot - } - ... on PoAConsensus { - signature - } - } - header { - applicationHash - consensusParametersVersion - daHeight - eventInboxRoot - height - id - messageOutboxRoot - messageReceiptCount - prevRoot - stateTransitionBytecodeVersion - time - transactionsCount - transactionsRoot - } - height - id - } - programState { - data - returnType - } - reason - receipts { - amount - assetId - contractId - data - digest - gas - gasUsed - id - is - len - nonce - param1 - param2 - pc - ptr - ra - rb - rc - rd - reason - receiptType - recipient - result - sender - subId - to - toAddress - val - } - time - totalFee - totalGas - transactionId - } - ... on SqueezedOutStatus { - reason - } - ... on SubmittedStatus { - time - } - ... on SuccessStatus { - block { - consensus { - __typename - ... on Genesis { - chainConfigHash - coinsRoot - contractsRoot - messagesRoot - transactionsRoot - } - ... on PoAConsensus { - signature - } - } - header { - applicationHash - consensusParametersVersion - daHeight - eventInboxRoot - height - id - messageOutboxRoot - messageReceiptCount - prevRoot - stateTransitionBytecodeVersion - time - transactionsCount - transactionsRoot - } - height - id - } - programState { - data - returnType - } - receipts { - amount - assetId - contractId - data - digest - gas - gasUsed - id - is - len - nonce - param1 - param2 - pc - ptr - ra - rb - rc - rd - reason - receiptType - recipient - result - sender - subId - to - toAddress - val - } - time - totalFee - totalGas - transactionId - } - } - storageSlots - subsectionIndex - subsectionsNumber - txPointer - upgradePurpose { - __typename - ... on ConsensusParametersPurpose { - checksum - witnessIndex - } - ... on StateTransitionPurpose { - root - } - } - witnesses } } `; @@ -1855,15 +4605,307 @@ export const ContractBalanceConnectionNodeFragmentDoc = gql` } } ${ContractBalanceNodeFragmentDoc}`; -export const BalanceDocument = gql` - query balance($assetId: AssetId!, $owner: Address!) { - balance(assetId: $assetId, owner: $owner) { +export const TxDetailsGroupedInputContractFragmentDoc = gql` + fragment TxDetailsGroupedInputContract on GroupedInputContract { + type + contractId +} + `; +export const TxDetailsGroupedInputCoinFragmentDoc = gql` + fragment TxDetailsGroupedInputCoin on GroupedInputCoin { + type + totalAmount + owner + assetId + inputs { + ... on InputCoin { + amount + utxoId + } + } +} + `; +export const TxDetailsGroupedInputMessageFragmentDoc = gql` + fragment TxDetailsGroupedInputMessage on GroupedInputMessage { + type + sender + data + recipient +} + `; +export const TxDetailsGroupedOutputCoinFragmentDoc = gql` + fragment TxDetailsGroupedOutputCoin on GroupedOutputCoin { + type + assetId + totalAmount + to + outputs { + __typename + } +} + `; +export const TxDetailsGroupedOutputChangedFragmentDoc = gql` + fragment TxDetailsGroupedOutputChanged on GroupedOutputChanged { + type + assetId + totalAmount + to + outputs { + __typename + } +} + `; +export const TxDetailsGroupedOutputContractCreatedFragmentDoc = gql` + fragment TxDetailsGroupedOutputContractCreated on GroupedOutputContractCreated { + type + contractId +} + `; +export const TransactionReceiptFragmentDoc = gql` + fragment TransactionReceipt on Receipt { + __typename + id + to + pc + is + toAddress + amount + assetId + gas + param1 + param2 + val + ptr + digest + reason + ra + rb + rc + rd + len + receiptType + result + gasUsed + data + sender + recipient + nonce + contractId + subId +} + `; +export const InnerReceiptItemFragmentDoc = gql` + fragment InnerReceiptItem on OperationReceipt { + item { + ...TransactionReceipt + } +} + ${TransactionReceiptFragmentDoc}`; +export const OperationReceiptItemFragmentDoc = gql` + fragment OperationReceiptItem on OperationReceipt { + ...InnerReceiptItem + receipts { + ...InnerReceiptItem + receipts { + ...InnerReceiptItem + receipts { + ...InnerReceiptItem + } + } + } +} + ${InnerReceiptItemFragmentDoc}`; +export const OperationItemFragmentDoc = gql` + fragment OperationItem on Operation { + __typename + type + receipts { + ...OperationReceiptItem + receipts { + ...OperationReceiptItem + receipts { + ...OperationReceiptItem + receipts { + ...OperationReceiptItem + receipts { + ...OperationReceiptItem + } + } + } + } + } +} + ${OperationReceiptItemFragmentDoc}`; +export const TransactionStatusFragmentDoc = gql` + fragment TransactionStatus on TransactionStatus { + __typename + ... on SqueezedOutStatus { + reason + } + ... on SuccessStatus { + time + block { + id + header { + id + height + daHeight + applicationHash + messageReceiptCount + time + } + } + programState { + data + } + } + ... on FailureStatus { + time + programState { + data + } + } + ... on SubmittedStatus { + time + } +} + `; +export const TransactionInputFragmentDoc = gql` + fragment TransactionInput on Input { + __typename + ... on InputCoin { amount assetId owner + predicate + predicateData + txPointer + utxoId + witnessIndex + } + ... on InputContract { + utxoId + balanceRoot + txPointer + contractId + } + ... on InputMessage { + sender + recipient + amount + nonce + data + predicate + predicateData + } +} + `; +export const TransactionOutputFragmentDoc = gql` + fragment TransactionOutput on Output { + __typename + ... on CoinOutput { + to + amount + assetId + } + ... on ContractOutput { + inputIndex + balanceRoot + } + ... on ChangeOutput { + to + amount + assetId + } + ... on VariableOutput { + to + amount + assetId + } + ... on ContractCreated { + contract } } `; +export const TransactionItemFragmentDoc = gql` + fragment TransactionItem on Transaction { + id + blockHeight + gasCosts { + fee + gasUsed + } + groupedInputs { + __typename + ...TxDetailsGroupedInputContract + ...TxDetailsGroupedInputCoin + ...TxDetailsGroupedInputMessage + } + groupedOutputs { + __typename + ...TxDetailsGroupedOutputCoin + ...TxDetailsGroupedOutputChanged + ...TxDetailsGroupedOutputContractCreated + } + operations { + ...OperationItem + } + receipts { + ...TransactionReceipt + } + hasPredicate + statusType + title + time { + fromNow + full + rawUnix + } + __typename + maturity + txPointer + isScript + isCreate + isMint + witnesses + receiptsRoot + script + scriptData + bytecodeWitnessIndex + salt + storageSlots + rawPayload + mintAmount + mintAssetId + inputContract { + contractId + } + outputContract { + inputIndex + } + status { + ...TransactionStatus + } + inputAssetIds + inputContracts + inputs { + ...TransactionInput + } + outputs { + ...TransactionOutput + } +} + ${TxDetailsGroupedInputContractFragmentDoc} +${TxDetailsGroupedInputCoinFragmentDoc} +${TxDetailsGroupedInputMessageFragmentDoc} +${TxDetailsGroupedOutputCoinFragmentDoc} +${TxDetailsGroupedOutputChangedFragmentDoc} +${TxDetailsGroupedOutputContractCreatedFragmentDoc} +${OperationItemFragmentDoc} +${TransactionReceiptFragmentDoc} +${TransactionStatusFragmentDoc} +${TransactionInputFragmentDoc} +${TransactionOutputFragmentDoc}`; export const BalancesDocument = gql` query balances($after: String, $before: String, $filter: BalanceFilterInput!, $first: Int, $last: Int) { balances( @@ -1885,24 +4927,27 @@ export const BalancesDocument = gql` } } ${BalanceItemFragmentDoc}`; +export const BlockDocument = gql` + query block($height: U32, $id: BlockId) { + block(height: $height, id: $id) { + ...Block + } +} + ${BlockFragmentDoc}`; export const BlocksDocument = gql` query blocks($after: String, $before: String, $first: Int, $last: Int) { blocks(after: $after, before: $before, first: $first, last: $last) { + pageInfo { + startCursor + endCursor + hasPreviousPage + hasNextPage + } edges { - cursor node { ...BlockItem } } - nodes { - ...BlockItem - } - pageInfo { - endCursor - hasNextPage - hasPreviousPage - startCursor - } } } ${BlockItemFragmentDoc}`; @@ -3205,20 +6250,10 @@ export const CoinsDocument = gql` export const ContractDocument = gql` query contract($id: ContractId!) { contract(id: $id) { - id bytecode } } `; -export const ContractBalanceDocument = gql` - query contractBalance($asset: AssetId!, $contract: ContractId!) { - contractBalance(asset: $asset, contract: $contract) { - amount - assetId - contract - } -} - `; export const ContractBalancesDocument = gql` query contractBalances($after: String, $before: String, $filter: ContractBalanceFilterInput!, $first: Int, $last: Int) { contractBalances( @@ -3232,68 +6267,415 @@ export const ContractBalancesDocument = gql` } } ${ContractBalanceConnectionNodeFragmentDoc}`; -export const NodeInfoDocument = gql` - query nodeInfo { - nodeInfo { - maxDepth - maxTx - nodeVersion - peers { - addresses - appScore - blockHeight - clientVersion +export const PredicateDocument = gql` + query predicate($address: String!) { + predicate(address: $address) { + address + bytecode + } +} + `; +export const RecentTransactionsDocument = gql` + query recentTransactions($after: String, $before: String, $first: Int, $last: Int) { + transactions(after: $after, before: $before, first: $first, last: $last) { + nodes { + ...RecentTransaction + } + pageInfo { + endCursor + hasNextPage + hasPreviousPage + startCursor + } + } +} + ${RecentTransactionFragmentDoc}`; +export const SearchDocument = gql` + query search($query: String!) { + search(query: $query) { + account { + address + transactions { + id + } + } + block { + height + id + } + contract { + id + } + transaction { id - lastHeartbeatMs } - utxoValidation - vmBacktrace } } `; - -export type SdkFunctionWrapper = (action: (requestHeaders?:Record) => Promise, operationName: string, operationType?: string, variables?: any) => Promise; - - -const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action(); -const BalanceDocumentString = print(BalanceDocument); +export const TransactionDetailsDocument = gql` + query transactionDetails($id: TransactionId!) { + transaction(id: $id) { + ...TransactionItem + } +} + ${TransactionItemFragmentDoc}`; +export const TransactionsByBlockIdDocument = gql` + query transactionsByBlockId($after: String, $before: String, $first: Int, $last: Int, $blockId: String!) { + transactionsByBlockId( + after: $after + before: $before + first: $first + last: $last + blockId: $blockId + ) { + nodes { + ...RecentTransaction + } + pageInfo { + endCursor + hasNextPage + hasPreviousPage + startCursor + } + } +} + ${RecentTransactionFragmentDoc}`; +export const TransactionsByOwnerDocument = gql` + query transactionsByOwner($after: String, $before: String, $first: Int, $last: Int, $owner: Address!) { + transactionsByOwner( + after: $after + before: $before + first: $first + last: $last + owner: $owner + ) { + nodes { + ...RecentTransaction + } + pageInfo { + endCursor + hasNextPage + hasPreviousPage + startCursor + } + } +} + ${RecentTransactionFragmentDoc}`; + +export type SdkFunctionWrapper = ( + action: (requestHeaders?: Record) => Promise, + operationName: string, + operationType?: string, + variables?: any, +) => Promise; + +const defaultWrapper: SdkFunctionWrapper = ( + action, + _operationName, + _operationType, + _variables, +) => action(); const BalancesDocumentString = print(BalancesDocument); +const BlockDocumentString = print(BlockDocument); const BlocksDocumentString = print(BlocksDocument); const ChainDocumentString = print(ChainDocument); const CoinsDocumentString = print(CoinsDocument); const ContractDocumentString = print(ContractDocument); -const ContractBalanceDocumentString = print(ContractBalanceDocument); const ContractBalancesDocumentString = print(ContractBalancesDocument); -const NodeInfoDocumentString = print(NodeInfoDocument); -export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) { +const PredicateDocumentString = print(PredicateDocument); +const RecentTransactionsDocumentString = print(RecentTransactionsDocument); +const SearchDocumentString = print(SearchDocument); +const TransactionDetailsDocumentString = print(TransactionDetailsDocument); +const TransactionsByBlockIdDocumentString = print( + TransactionsByBlockIdDocument, +); +const TransactionsByOwnerDocumentString = print(TransactionsByOwnerDocument); +export function getSdk( + client: GraphQLClient, + withWrapper: SdkFunctionWrapper = defaultWrapper, +) { return { - balance(variables: GQLBalanceQueryVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{ data: GQLBalanceQuery; errors?: GraphQLError[]; extensions?: any; headers: Headers; status: number; }> { - return withWrapper((wrappedRequestHeaders) => client.rawRequest(BalanceDocumentString, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'balance', 'query', variables); + balances( + variables: GQLBalancesQueryVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: GQLBalancesQuery; + errors?: GraphQLError[]; + extensions?: any; + headers: Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest( + BalancesDocumentString, + variables, + { ...requestHeaders, ...wrappedRequestHeaders }, + ), + 'balances', + 'query', + variables, + ); }, - balances(variables: GQLBalancesQueryVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{ data: GQLBalancesQuery; errors?: GraphQLError[]; extensions?: any; headers: Headers; status: number; }> { - return withWrapper((wrappedRequestHeaders) => client.rawRequest(BalancesDocumentString, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'balances', 'query', variables); + block( + variables?: GQLBlockQueryVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: GQLBlockQuery; + errors?: GraphQLError[]; + extensions?: any; + headers: Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest(BlockDocumentString, variables, { + ...requestHeaders, + ...wrappedRequestHeaders, + }), + 'block', + 'query', + variables, + ); }, - blocks(variables?: GQLBlocksQueryVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{ data: GQLBlocksQuery; errors?: GraphQLError[]; extensions?: any; headers: Headers; status: number; }> { - return withWrapper((wrappedRequestHeaders) => client.rawRequest(BlocksDocumentString, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'blocks', 'query', variables); + blocks( + variables?: GQLBlocksQueryVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: GQLBlocksQuery; + errors?: GraphQLError[]; + extensions?: any; + headers: Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest(BlocksDocumentString, variables, { + ...requestHeaders, + ...wrappedRequestHeaders, + }), + 'blocks', + 'query', + variables, + ); }, - chain(variables?: GQLChainQueryVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{ data: GQLChainQuery; errors?: GraphQLError[]; extensions?: any; headers: Headers; status: number; }> { - return withWrapper((wrappedRequestHeaders) => client.rawRequest(ChainDocumentString, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'chain', 'query', variables); + chain( + variables?: GQLChainQueryVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: GQLChainQuery; + errors?: GraphQLError[]; + extensions?: any; + headers: Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest(ChainDocumentString, variables, { + ...requestHeaders, + ...wrappedRequestHeaders, + }), + 'chain', + 'query', + variables, + ); }, - coins(variables: GQLCoinsQueryVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{ data: GQLCoinsQuery; errors?: GraphQLError[]; extensions?: any; headers: Headers; status: number; }> { - return withWrapper((wrappedRequestHeaders) => client.rawRequest(CoinsDocumentString, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'coins', 'query', variables); + coins( + variables: GQLCoinsQueryVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: GQLCoinsQuery; + errors?: GraphQLError[]; + extensions?: any; + headers: Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest(CoinsDocumentString, variables, { + ...requestHeaders, + ...wrappedRequestHeaders, + }), + 'coins', + 'query', + variables, + ); }, - contract(variables: GQLContractQueryVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{ data: GQLContractQuery; errors?: GraphQLError[]; extensions?: any; headers: Headers; status: number; }> { - return withWrapper((wrappedRequestHeaders) => client.rawRequest(ContractDocumentString, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'contract', 'query', variables); + contract( + variables: GQLContractQueryVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: GQLContractQuery; + errors?: GraphQLError[]; + extensions?: any; + headers: Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest( + ContractDocumentString, + variables, + { ...requestHeaders, ...wrappedRequestHeaders }, + ), + 'contract', + 'query', + variables, + ); }, - contractBalance(variables: GQLContractBalanceQueryVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{ data: GQLContractBalanceQuery; errors?: GraphQLError[]; extensions?: any; headers: Headers; status: number; }> { - return withWrapper((wrappedRequestHeaders) => client.rawRequest(ContractBalanceDocumentString, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'contractBalance', 'query', variables); + contractBalances( + variables: GQLContractBalancesQueryVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: GQLContractBalancesQuery; + errors?: GraphQLError[]; + extensions?: any; + headers: Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest( + ContractBalancesDocumentString, + variables, + { ...requestHeaders, ...wrappedRequestHeaders }, + ), + 'contractBalances', + 'query', + variables, + ); }, - contractBalances(variables: GQLContractBalancesQueryVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{ data: GQLContractBalancesQuery; errors?: GraphQLError[]; extensions?: any; headers: Headers; status: number; }> { - return withWrapper((wrappedRequestHeaders) => client.rawRequest(ContractBalancesDocumentString, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'contractBalances', 'query', variables); + predicate( + variables: GQLPredicateQueryVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: GQLPredicateQuery; + errors?: GraphQLError[]; + extensions?: any; + headers: Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest( + PredicateDocumentString, + variables, + { ...requestHeaders, ...wrappedRequestHeaders }, + ), + 'predicate', + 'query', + variables, + ); + }, + recentTransactions( + variables?: GQLRecentTransactionsQueryVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: GQLRecentTransactionsQuery; + errors?: GraphQLError[]; + extensions?: any; + headers: Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest( + RecentTransactionsDocumentString, + variables, + { ...requestHeaders, ...wrappedRequestHeaders }, + ), + 'recentTransactions', + 'query', + variables, + ); + }, + search( + variables: GQLSearchQueryVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: GQLSearchQuery; + errors?: GraphQLError[]; + extensions?: any; + headers: Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest(SearchDocumentString, variables, { + ...requestHeaders, + ...wrappedRequestHeaders, + }), + 'search', + 'query', + variables, + ); + }, + transactionDetails( + variables: GQLTransactionDetailsQueryVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: GQLTransactionDetailsQuery; + errors?: GraphQLError[]; + extensions?: any; + headers: Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest( + TransactionDetailsDocumentString, + variables, + { ...requestHeaders, ...wrappedRequestHeaders }, + ), + 'transactionDetails', + 'query', + variables, + ); + }, + transactionsByBlockId( + variables: GQLTransactionsByBlockIdQueryVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: GQLTransactionsByBlockIdQuery; + errors?: GraphQLError[]; + extensions?: any; + headers: Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest( + TransactionsByBlockIdDocumentString, + variables, + { ...requestHeaders, ...wrappedRequestHeaders }, + ), + 'transactionsByBlockId', + 'query', + variables, + ); + }, + transactionsByOwner( + variables: GQLTransactionsByOwnerQueryVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: GQLTransactionsByOwnerQuery; + errors?: GraphQLError[]; + extensions?: any; + headers: Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest( + TransactionsByOwnerDocumentString, + variables, + { ...requestHeaders, ...wrappedRequestHeaders }, + ), + 'transactionsByOwner', + 'query', + variables, + ); }, - nodeInfo(variables?: GQLNodeInfoQueryVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{ data: GQLNodeInfoQuery; errors?: GraphQLError[]; extensions?: any; headers: Headers; status: number; }> { - return withWrapper((wrappedRequestHeaders) => client.rawRequest(NodeInfoDocumentString, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'nodeInfo', 'query', variables); - } }; } -export type Sdk = ReturnType; \ No newline at end of file +export type Sdk = ReturnType; diff --git a/packages/graphql/src/infra/dao/BlockDAO.ts b/packages/graphql/src/infra/dao/BlockDao.ts similarity index 100% rename from packages/graphql/src/infra/dao/BlockDAO.ts rename to packages/graphql/src/infra/dao/BlockDao.ts diff --git a/packages/ui/package.json b/packages/ui/package.json index fe10efeaa..1712d4761 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -59,8 +59,8 @@ "@radix-ui/colors": "3.0.0", "@radix-ui/react-accordion": "1.1.2", "@radix-ui/react-aspect-ratio": "1.1.0", - "@radix-ui/react-portal": "1.1.1", "@radix-ui/react-dialog": "1.1.1", + "@radix-ui/react-portal": "1.1.1", "@radix-ui/react-slot": "1.0.2", "@radix-ui/react-toast": "1.2.1", "@radix-ui/themes": "3.1.1", @@ -78,6 +78,7 @@ "react-dom": "18.2.0", "react-stately": "3.29.1", "react-use": "17.5.0", + "recharts": "2.12.7", "tailwind-variants": "0.1.20", "tailwindcss-animate": "1.0.7", "tailwindcss-radix": "3.0.3", diff --git a/packages/ui/src/components/Box/RoundedContainer.tsx b/packages/ui/src/components/Box/RoundedContainer.tsx new file mode 100644 index 000000000..39ad7219f --- /dev/null +++ b/packages/ui/src/components/Box/RoundedContainer.tsx @@ -0,0 +1,25 @@ +import { Box as RadixBox } from '@radix-ui/themes'; + +import { tv } from 'tailwind-variants'; +import { createComponent } from '../../utils/component'; +import type { PropsOf, WithAsProps } from '../../utils/types'; + +export type RoundedContainerProps = WithAsProps & PropsOf; + +const styles = tv({ + slots: { + root: 'rounded-[13px] p-4 bg-gray-2 dark:bg-card-bg', + }, +}); + +export const RoundedContainer = createComponent< + RoundedContainerProps, + typeof RadixBox +>({ + id: 'RoundedContainer', + baseElement: RadixBox, + className: ({ className }) => styles().root({ className }), + render: (Comp, { children, ...props }) => { + return {children}; + }, +}); diff --git a/packages/ui/src/components/Charts/Charts.tsx b/packages/ui/src/components/Charts/Charts.tsx new file mode 100644 index 000000000..53431a871 --- /dev/null +++ b/packages/ui/src/components/Charts/Charts.tsx @@ -0,0 +1,366 @@ +'use client'; + +import * as React from 'react'; +import * as RechartsPrimitive from 'recharts'; + +import { cx } from '../../utils/css'; + +// Format: { THEME_NAME: CSS_SELECTOR } +const THEMES = { light: '', dark: '.dark' } as const; + +export type ChartConfig = { + [k in string]: { + label?: React.ReactNode; + icon?: React.ComponentType; + } & ( + | { color?: string; theme?: never } + | { color?: never; theme: Record } + ); +}; + +type ChartContextProps = { + config: ChartConfig; +}; + +const ChartContext = React.createContext(null); + +function useChart() { + const context = React.useContext(ChartContext); + + if (!context) { + throw new Error('useChart must be used within a '); + } + + return context; +} + +const ChartContainer = React.forwardRef< + HTMLDivElement, + React.ComponentProps<'div'> & { + config: ChartConfig; + children: React.ComponentProps< + typeof RechartsPrimitive.ResponsiveContainer + >['children']; + } +>(({ id, className, children, config, ...props }, ref) => { + const uniqueId = React.useId(); + const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`; + + return ( + +
+ + + {children} + +
+
+ ); +}); +ChartContainer.displayName = 'Chart'; + +const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => { + const colorConfig = Object.entries(config).filter( + ([_, config]) => config.theme || config.color, + ); + + if (!colorConfig.length) { + return null; + } + + return ( +