UNPKG

@tracer-protocol/pools-js

Version:

Javascript library for interacting with Tracer's Perpetual Pools

21 lines (20 loc) 1.26 kB
import { ethers } from "ethers"; import BigNumber from "bignumber.js"; import { CommitEnum } from ".."; import { TotalPoolCommitments, TotalPoolCommitmentsBN } from "../types"; export declare const encodeCommitParams: (payForClaim: boolean, fromAggregateBalances: boolean, commitType: CommitEnum, parsedAmount: ethers.BigNumber) => ethers.BytesLike; export declare const ethersBNtoBN: (ethersBN: ethers.BigNumber, decimals?: number | undefined) => BigNumber; export declare const movingAveragePriceTransformer: (lastPrice: BigNumber, currentPrice: BigNumber) => BigNumber; export declare const pendingCommitsToBN: (pendingCommits: TotalPoolCommitments, decimals?: number | undefined) => TotalPoolCommitmentsBN; /** * attempt promise until it succeeds or the maximum number of allowed attempts is reached * * @returns a promise that will eventually error or resolve to the same type as the original promise */ export declare const attemptPromiseRecursively: <T>({ promise, retryCheck, maxAttempts, interval, attemptCount }: { promise: () => Promise<T>; retryCheck?: ((error: unknown) => Promise<boolean>) | undefined; maxAttempts?: number | undefined; interval?: number | undefined; attemptCount?: number | undefined; }) => Promise<T>;