UNPKG

2.82 kBTypeScriptView Raw
1export declare const BLOCKSTACK_HANDLER = "blockstack";
2export declare function nextYear(): Date;
3export declare function nextMonth(): Date;
4export declare function nextHour(): Date;
5export declare function megabytesToBytes(megabytes: number): number;
6export declare function getAesCbcOutputLength(inputByteLength: number): number;
7export declare function getBase64OutputLength(inputByteLength: number): number;
8export declare function updateQueryStringParameter(uri: string, key: string, value: string): string;
9export declare function isLaterVersion(v1: string, v2: string): boolean;
10export declare function makeUUID4(): string;
11export declare function isSameOriginAbsoluteUrl(uri1: string, uri2: string): boolean;
12export declare function getGlobalScope(): Window;
13interface GetGlobalObjectOptions {
14 throwIfUnavailable?: boolean;
15 usageDesc?: string;
16 returnEmptyObject?: boolean;
17}
18export declare function getGlobalObject<K extends Extract<keyof Window, string>>(name: K, { throwIfUnavailable, usageDesc, returnEmptyObject }?: GetGlobalObjectOptions): Window[K] | undefined;
19export declare function getGlobalObjects<K extends Extract<keyof Window, string>>(names: K[], { throwIfUnavailable, usageDesc, returnEmptyObject }?: GetGlobalObjectOptions): Pick<Window, K>;
20declare type BN = import('bn.js');
21export declare type IntegerType = number | string | bigint | Uint8Array | BN;
22export declare function intToBytes(value: IntegerType, signed: boolean, byteLength: number): Uint8Array;
23export declare function intToBigInt(value: IntegerType, signed: boolean): bigint;
24export declare function with0x(value: string): string;
25export declare function hexToBigInt(hex: string): bigint;
26export declare function intToHex(integer: IntegerType, lengthBytes?: number): string;
27export declare function hexToInt(hex: string): number;
28export declare function bigIntToBytes(value: bigint, length?: number): Uint8Array;
29export declare function toTwos(value: bigint, width: bigint): bigint;
30export declare function fromTwos(value: bigint, width: bigint): bigint;
31export declare function bytesToHex(uint8a: Uint8Array): string;
32export declare function hexToBytes(hex: string): Uint8Array;
33export declare function utf8ToBytes(str: string): Uint8Array;
34export declare function bytesToUtf8(arr: Uint8Array): string;
35export declare function asciiToBytes(str: string): Uint8Array;
36export declare function bytesToAscii(arr: Uint8Array): string;
37export declare function octetsToBytes(numbers: number[]): Uint8Array;
38export declare function toBytes(data: Uint8Array | string): Uint8Array;
39export declare function concatBytes(...arrays: Uint8Array[]): Uint8Array;
40export declare function concatArray(elements: (Uint8Array | number[] | number)[]): Uint8Array;
41export declare function isInstance(object: any, type: any): boolean;
42export {};