lotus-sdk
Version:
Central repository for several classes of tools for integrating with, and building for, the Lotusia ecosystem
53 lines • 3.31 kB
TypeScript
import * as Bitcore from '../lib/bitcore/index.js';
import type { Wallet } from './types.js';
import { ScriptChunkPlatformUTF8, ScriptChunkSentimentUTF8 } from '../lib/rank/index.js';
export declare function toAsyncIterable<T>(collection: Iterable<T>): AsyncGenerator<Awaited<T>, void, unknown>;
export declare function getGeoIP(ip: string): Promise<{}>;
export declare function isSha256(str: string): boolean;
export declare function toHex(data: number | string | Buffer): string;
export declare function isHex(str: string, length?: number): boolean;
export declare function isBase64(str: string): boolean;
export declare function decodeBase64(str: string): string;
export declare function encodeBase64(str: string, encoding?: BufferEncoding): string;
export declare function toXPIFromSats(sats: number | string): number;
export declare function toSatsFromXPI(xpi: number | string): number;
export declare function truncateSha256(sha256: string): string;
export declare function truncateTxid(txid: string): string;
export declare function truncateAddress(address: string): string;
export declare function truncateBlockHash(blockHash: string): string;
export declare function numBlocksFromTip(tipHeight: number, blockHeight: number): number;
export declare function formatTimestamp(timestamp: number | string): string;
export declare function toMinifiedPercent(positive: string, negative: string): string;
export declare function toPercentColor(percentage: string): string;
export declare function toMinifiedNumber(type: 'hashrate' | 'blocksize', number: number | string): string;
export declare function toMinifiedTime(seconds: number | string): string;
export declare function getRankingColor(change: number): string;
export declare function getSentimentColor(sentiment: ScriptChunkSentimentUTF8): string;
export declare function calculateRate(current: number, previous: number, divisor?: number): number;
export declare function formatRate(rate: number): string;
export declare function toUppercaseFirstLetter(str: string): string;
export declare function toTrendingIcon(sentiment: ScriptChunkSentimentUTF8): "i-mdi-arrow-up-thin" | "i-mdi-arrow-down-thin";
export declare function toProfileUrl(platform: string, profileId: string): string;
export declare function toPostUrl(platform: ScriptChunkPlatformUTF8, profileId: string, postId: string): string;
export declare function toExternalPostUrl(platform: ScriptChunkPlatformUTF8, profileId: string, postId: string): string | undefined;
export declare function toMinifiedStatCount(number: number | string, divisor?: number): string;
export declare function truncatePostId(postId: string): string;
export declare const Util: {
sha256: {
validate(str: string): RegExpMatchArray | null;
};
base64: {
encode(str: string): string;
decode(str: string): string;
};
crypto: {
randomUUID(): string;
};
};
export declare function createWallet(mnemonic?: Bitcore.Mnemonic | string, path?: string): Wallet;
export declare function yieldToEventLoop(): Promise<void>;
export declare function scheduleNextTick(fn: () => void): void;
export declare function getHighResTime(): number;
export declare function isBrowser(): boolean;
export declare function isNode(): boolean;
//# sourceMappingURL=functions.d.ts.map