UNPKG

@ar.io/sdk

Version:

[![codecov](https://codecov.io/gh/ar-io/ar-io-sdk/graph/badge.svg?token=7dXKcT7dJy)](https://codecov.io/gh/ar-io/ar-io-sdk)

80 lines (79 loc) 3.25 kB
/** * Copyright (C) 2022-2024 Permanent Data Solutions, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import Arweave from 'arweave'; import { AoClient, BlockHeight } from '../types/common.js'; import { AoEligibleDistribution, AoEpochData, AoEpochDistributed, PaginationParams, PaginationResult } from '../types/io.js'; export declare const validateArweaveId: (id: string) => boolean; export declare function isBlockHeight(height: string | number): height is BlockHeight; /** * Prune tags that are undefined or empty. * @param tags - The tags to prune. * @returns The pruned tags. */ export declare const pruneTags: (tags: { name: string; value: string | undefined; }[]) => { name: string; value: string; }[]; export declare const paginationParamsToTags: <T>(params?: PaginationParams<T>) => { name: string; value: string; }[]; /** * Get the epoch with distribution data for the current epoch * @param arweave - The Arweave instance * @returns The epoch with distribution data */ export declare const getEpochDataFromGql: ({ arweave, epochIndex, processId, retries, gqlUrl, }: { arweave: Arweave; epochIndex: number; processId?: string; retries?: number; gqlUrl?: string; }) => Promise<AoEpochData<AoEpochDistributed> | undefined>; export declare const getEpochDataFromGqlWithCUFallback: ({ arweave, ao, epochIndex, processId, }: { arweave: Arweave; ao: AoClient; epochIndex: number; processId?: string; }) => Promise<AoEpochData<AoEpochDistributed> | undefined>; export declare const getEpochDataFromGqlFallback: ({ ao, epochIndex, processId, gqlUrl, }: { ao: AoClient; epochIndex: number; processId?: string; gqlUrl?: string; }) => Promise<AoEpochData<AoEpochDistributed> | undefined>; /** * Get the epoch with distribution data for the current epoch * @param arweave - The Arweave instance * @param epochIndex - The index of the epoch * @param processId - The process ID (optional, defaults to ARIO_MAINNET_PROCESS_ID) * @returns string - The stringified GQL query */ export declare const epochDistributionNoticeGqlQuery: ({ epochIndex, processId, authorities, }: { epochIndex: any; processId?: string | undefined; authorities?: string[] | undefined; }) => string; export declare const epochDistributionNoticeGqlQueryFallback: ({ processId, owners, }: { epochIndex: number; processId?: string; owners?: string[]; }) => string; export declare function sortAndPaginateEpochDataIntoEligibleDistributions(epochData: AoEpochData, params?: PaginationParams<AoEligibleDistribution>): PaginationResult<AoEligibleDistribution>; export declare function removeEligibleRewardsFromEpochData(epochData: AoEpochData): AoEpochData;