UNPKG

@ledgerhq/coin-tron

Version:
74 lines 5.55 kB
import { Account, TokenAccount } from "@ledgerhq/types-live"; import { BigNumber } from "bignumber.js"; import type { NetworkInfo, SendTransactionDataSuccess, SuperRepresentative, SuperRepresentativeData, Transaction, TrongridTxInfo, TronResource } from "../types"; import { AccountTronAPI, Block, BlockWithTransactionsAPI, MalformedTransactionTronAPI, TransactionInfoByBlockNumAPI, TransactionTronAPI, Trc20API } from "./types"; export declare function post<T, U extends object = any>(endPoint: string, body: T): Promise<U>; export declare const freezeTronTransaction: (account: Account, transaction: Transaction) => Promise<SendTransactionDataSuccess>; export declare const unfreezeTronTransaction: (account: Account, transaction: Transaction) => Promise<SendTransactionDataSuccess>; export declare const withdrawExpireUnfreezeTronTransaction: (account: Account, _transaction: Transaction) => Promise<SendTransactionDataSuccess>; export declare const unDelegateResourceTransaction: (account: Account, transaction: Transaction) => Promise<SendTransactionDataSuccess>; export declare const legacyUnfreezeTronTransaction: (account: Account, transaction: Transaction) => Promise<SendTransactionDataSuccess>; export declare function getDelegatedResource(account: Account, transaction: Transaction, resource: TronResource): Promise<BigNumber>; export declare const DEFAULT_TRC20_FEES_LIMIT = 50000000; export declare function craftTrc20Transaction(tokenAddress: string, recipientAddress: string, senderAddress: string, amount: BigNumber, customFees?: number, expiration?: number): Promise<SendTransactionDataSuccess>; export declare function craftStandardTransaction(tokenAddress: string | undefined, recipientAddress: string, senderAddress: string, amount: BigNumber, isTransferAsset: boolean, memo?: string, expiration?: number): Promise<SendTransactionDataSuccess>; export declare const createTronTransaction: (account: Account, transaction: Transaction, subAccount: TokenAccount | null | undefined) => Promise<SendTransactionDataSuccess>; /** Default expiration of 10 minutes (in seconds) after crafting time. */ export declare const DEFAULT_EXPIRATION = 600; /** * @see https://github.com/tronprotocol/java-tron/blob/develop/framework/src/main/java/org/tron/core/services/http/BroadcastServlet.java * @param trxTransaction * @returns Transaction ID */ export declare const broadcastTron: (trxTransaction: SendTransactionDataSuccess & { signature: string[]; }) => Promise<string>; export declare const broadcastHexTron: (rawTransaction: string) => Promise<string>; /** * {@link https://github.com/tronprotocol/java-tron/blob/develop/framework/src/main/java/org/tron/core/services/http/GetAccountServlet.java | Tron Framework} */ export declare function fetchTronAccount(addr: string): Promise<AccountTronAPI[]>; export declare function getLastBlock(): Promise<Block>; export declare function getBlock(blockNumber: number): Promise<Block>; export declare function getBlockWithTransactions(blockNumber: number): Promise<BlockWithTransactionsAPI>; export declare function getTransactionInfoByBlockNum(blockNum: number): Promise<TransactionInfoByBlockNumAPI[]>; export type FetchTxsStopPredicate = (txs: Array<TransactionTronAPI | Trc20API | MalformedTransactionTronAPI>) => boolean; export type FetchParams = { /** The maximum number of transactions to fetch per call. */ limitPerCall: number; /** Hint about the number of transactions to be fetched in total (hint to optimize `limitPerCall`) */ hintGlobalLimit?: number; minTimestamp: number; order: "asc" | "desc"; }; export declare const defaultFetchParams: FetchParams; export type TxPageResult = { txs: TrongridTxInfo[]; hasNextPage: boolean; }; export type FetchTxsPageParams = { limit: number; minTimestamp: number; maxTimestamp?: number; order: "asc" | "desc"; }; export type FetchTxsPageResult = { nativeTxs: TxPageResult; trc20Txs: TxPageResult; }; export declare function fetchTronAccountTxsPage(addr: string, params: FetchTxsPageParams): Promise<FetchTxsPageResult>; export declare function fetchTronAccountTxs(addr: string, shouldFetchMoreTxs: FetchTxsStopPredicate, params: FetchParams): Promise<TrongridTxInfo[]>; export declare const getContractUserEnergyRatioConsumption: (address: string) => Promise<number>; export declare const fetchTronContract: (addr: string) => Promise<Record<string, any> | undefined>; export declare const getTronAccountNetwork: (address: string) => Promise<NetworkInfo>; export declare const validateAddress: (address: string) => Promise<boolean>; export declare const accountNamesCache: import("@ledgerhq/live-network/cache").CacheRes<[addr: string], string | null | undefined>; export declare const getAccountName: (addr: string) => Promise<string | null | undefined>; export declare const getTronSuperRepresentatives: () => Promise<SuperRepresentative[]>; export declare const hydrateSuperRepresentatives: (list: SuperRepresentative[]) => void; export declare const getNextVotingDate: () => Promise<Date>; export declare const getTronSuperRepresentativeData: (max: number | null | undefined) => Promise<SuperRepresentativeData>; export declare const voteTronSuperRepresentatives: (account: Account, transaction: Transaction) => Promise<SendTransactionDataSuccess>; export declare const getUnwithdrawnReward: (addr: string) => Promise<BigNumber>; export declare const claimRewardTronTransaction: (account: Account) => Promise<SendTransactionDataSuccess>; //# sourceMappingURL=index.d.ts.map