@unspent/phi
Version:
a collection of anyone can spend contracts
60 lines • 2.74 kB
TypeScript
import { CashAddressNetworkPrefix } from "@bitauth/libauth";
/**
* Helper function to convert an address to a public key hash
*
* @param address Address to convert to a hash
*
* @returns a public key hash corresponding to the passed address
*/
export declare function derivePublicKeyHash(address: string): Uint8Array;
export declare function derivePublicKeyHashHex(address: string): string;
export declare function deriveLockingBytecodeHex(address: string): string;
export declare function deriveLockingBytecode(address: string): Uint8Array;
export declare function sanitizeAddress(wildString: string): Promise<string>;
export declare function getPrefixFromNetwork(network: string): CashAddressNetworkPrefix;
export declare function createOpReturnData(opReturnData: string[]): Uint8Array;
export declare function toBin(output: string): Uint8Array;
export declare function toHex(num: number | bigint): string;
export declare function binToNumber(data: Uint8Array): number;
export declare function binToBigInt(data: Uint8Array): bigint;
export declare function decodeNullDataScript(data: Uint8Array | string): Uint8Array[];
/**
* hash160 - Calculate the sha256, ripemd160 hash of a value
*
* @param {message} Uint8Array value to hash as a binary array
*
* @returns a promise to the hash160 value of the input
*/
export declare function hash160(message: Uint8Array): Promise<Uint8Array>;
/**
* sha256 - Calculate the sha256 a value
*
* @param {message} Uint8Array value to hash as a binary array
*
* @returns a promise to the sha256 value of the input
*/
export declare function sha256(message: Uint8Array): Promise<Uint8Array>;
export declare function getRandomIntWeak(max: number): number;
export declare function sum(previousValue: any, currentValue: any): bigint;
export declare function sumNumber(previousValue: any, currentValue: any): any;
export declare function parseBigInt(num: string): bigint;
export declare function assurePkh(address: string): void;
/**
* Helper function to convert an address to a locking script
*
* @param address Address to convert to locking script
*
* @returns a locking script corresponding to the passed address
*/
export declare function addressToLockScript(address: string): Uint8Array;
/**
* Helper function to convert an address to an electrum-cash compatible scripthash.
* This is necessary to support electrum versions lower than 1.4.3, which do not
* support addresses, only script hashes.
*
* @param address Address to convert to an electrum scripthash
*
* @returns The corresponding script hash in an electrum-cash compatible format
*/
export declare function addressToElectrumScriptHash(address: string): Promise<string>;
//# sourceMappingURL=util.d.ts.map