@ledgerhq/coin-near
Version:
36 lines • 1.8 kB
TypeScript
import { BigNumber } from "bignumber.js";
import { NearAccount } from "../types";
import { NearAccessKey, NearAccountDetails, NearProtocolConfig, NearRawValidator, NearStakingPosition } from "./sdk.types";
export declare const fetchAccountDetails: (address: string) => Promise<NearAccountDetails>;
export declare const getAccount: (address: string) => Promise<Pick<NearAccount, "blockHeight" | "balance" | "spendableBalance" | "nearResources">>;
export declare const getProtocolConfig: () => Promise<NearProtocolConfig>;
export declare const getGasPrice: () => Promise<string>;
export declare const getAccessKey: ({ address, publicKey, }: {
address: string;
publicKey: string;
}) => Promise<NearAccessKey>;
/**
* 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.
*/
export declare const broadcastTransaction: (transaction: string, retries?: number) => Promise<string>;
export declare const getStakingPositions: (address: string) => Promise<{
stakingPositions: NearStakingPosition[];
totalStaked: BigNumber;
totalAvailable: BigNumber;
totalPending: BigNumber;
}>;
type NearValidator = NearRawValidator & {
commission: number;
};
type fetchValidators = {
per_page: number;
page: number;
};
declare function fetchValidators({ per_page, page }: fetchValidators): Promise<NearValidator[]>;
export declare const getValidators: import("@ledgerhq/live-network/cache").CacheRes<[fetchValidators], NearValidator[]>;
export {};
//# sourceMappingURL=node.d.ts.map