@ledgerhq/coin-tron
Version:
Ledger Tron Coin integration
48 lines • 4.21 kB
TypeScript
import { Account, SubAccount } from "@ledgerhq/types-live";
import { BigNumber } from "bignumber.js";
import type { NetworkInfo, SendTransactionDataSuccess, SuperRepresentative, SuperRepresentativeData, Transaction, TronResource, TronTransactionInfo, TrongridTxInfo } from "../types";
import { AccountTronAPI, MalformedTransactionTronAPI, 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 function craftTrc20Transaction(tokenAddress: string, recipientAddress: string, senderAddress: string, amount: BigNumber): Promise<SendTransactionDataSuccess>;
export declare function craftStandardTransaction(tokenAddress: string | undefined, recipientAddress: string, senderAddress: string, amount: BigNumber, isTransferAsset: boolean): Promise<SendTransactionDataSuccess>;
export declare const createTronTransaction: (account: Account, transaction: Transaction, subAccount: SubAccount | null | undefined) => Promise<SendTransactionDataSuccess>;
/**
* @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<{
height: number;
hash: string;
time: Date;
}>;
export declare function fetchTronTxDetail(txId: string): Promise<TronTransactionInfo>;
export declare function fetchTronAccountTxs(addr: string, shouldFetchMoreTxs: (txs: Array<TransactionTronAPI | Trc20API | MalformedTransactionTronAPI>) => boolean, cacheTransactionInfoById: Record<string, TronTransactionInfo>): 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 getAccountName: (addr: string) => Promise<string | null | undefined>;
export declare const getBrokerage: (addr: string) => Promise<number>;
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