import BigNumber from "bignumber.js"; import { type NearConfig } from "../config"; import { NearAccount } from "../types"; import { NearAccessKey, NearAccountDetails, NearRawValidator, NearStakingPosition } from "./sdk.types"; export declare const fetchAccountDetails: (config: NearConfig, address: string) => Promise; /** * Changes whenever a transaction concerns the account: balance, lock, storage or contract, and the * nonce of the account's access keys, which a relayed transaction moves without the account paying. * A key read that fails keeps the nonces of `previousFingerprint`: the fingerprint must neither be * the reason a sync fails nor change because of a read that failed. */ export declare const getAccountStateFingerprint: (config: NearConfig, address: string, accountDetails: NearAccountDetails | undefined, previousFingerprint?: string) => Promise; export type StakingPositionsOptions = { /** * Pools the caller already holds a position in. With them, a failed indexer listing falls back to * reading these pools from the node. A pool whose node read fails still fails the call: dropping * it would show a lower balance and forget the pool. Only a pool the node shows is no pool (no * account, no contract, a contract that fails the views) is dropped. */ knownValidatorIds?: string[]; /** Ask the indexer for the account's pools (default). `false` reads the known pools only. */ listValidators?: boolean; /** * Pools the account may have just funded (named by staking calls the caller has not seen yet). * Read from the node when the listing does not return them, including when it succeeds: the * listing may lag behind the history. A candidate the node shows is not a pool (no account, no * contract, the contract fails the view) is dropped; any other failed read is reported in * `failedCandidates`, so the caller can try it again. */ candidateValidatorIds?: string[]; }; export declare const getAccount: (config: NearConfig, address: string, options?: StakingPositionsOptions & Partial<{ accountDetails: NearAccountDetails | undefined; }>) => Promise & { poolListingFailed: boolean; failedCandidates: string[]; }>; export declare const getGasPrice: (config: NearConfig) => Promise; export declare const getAccessKey: (config: NearConfig, { address, publicKey, }: { address: string; publicKey: string; }) => Promise; type BroadcastTiming = { retryBudgetMs: number; attemptTimeoutMs: number; retryDelayMs: number; maxRetryDelayMs: number; }; /** * Implements a retry mechanism for broadcasting a transaction * based on the near documentation: https://docs.near.org/api/rpc/transactions#what-could-go-wrong-send-tx * * `TIMEOUT_ERROR` can be thrown when the transaction is not yet executed in less than 10 seconds. * Documentation advises to "re-submit the request with the identical transaction" in this case, * which is done, with a growing delay between attempts, until the retries or the time budget are * spent. The node is then asked for the transaction by hash before reporting a failure for a * broadcast that went through. */ export declare const broadcastTransaction: (config: NearConfig, transaction: string, retries?: number, timing?: BroadcastTiming) => Promise; export declare const getStakingPositions: (config: NearConfig, address: string, options?: StakingPositionsOptions) => Promise<{ stakingPositions: NearStakingPosition[]; totalStaked: BigNumber; totalAvailable: BigNumber; totalPending: BigNumber; /** The listing was asked for and failed; the positions come from the known and candidate pools. */ poolListingFailed: boolean; /** Candidate pools whose node read failed for a reason other than not being a pool. */ failedCandidates: string[]; }>; type NearValidator = NearRawValidator & { commission: number; }; type FetchValidatorsParams = { total: number; config: NearConfig; }; /** * A failed read is remembered for a short time: during an indexer outage every account sync asks for * the validators, and each would otherwise add a request to an indexer that is refusing them. */ declare const getValidatorsWithFailureMemory: (params: FetchValidatorsParams) => Promise; export declare const getValidators: typeof getValidatorsWithFailureMemory & { reset: () => void; }; export {}; //# sourceMappingURL=node.d.ts.map