@ngraveio/ur-blockchain-commons
Version:
A JS implementation of Uniform Resources(UR) Registry specification from Blockchain Commons.
35 lines (34 loc) • 1.2 kB
TypeScript
import { CoinInfo } from './CoinInfo';
interface IAddressArgs {
/** Type of the coin and network (testnet, mainnet) */
info?: CoinInfo;
/**
* The `type` field MAY be included for Bitcoin (and similar cryptocurrency) addresses, and MUST be omitted for non-applicable types.
* For bitcoin script type eg: p2ms, p2pk, p2pkh, p2sh, p2wpkh, p2wsh, P2TR
**/
type?: AddressScriptType;
/** Public key or script hash that is encoded */
data: Uint8Array | Buffer;
}
export declare enum AddressScriptType {
P2PKH = 0,
P2SH = 1,
P2WPKH = 2,
P2WSH = 3,
P2TR = 4,
P2MS = 5
}
declare const Address_base: import("@ngraveio/bc-ur").RegistryItemClass<import("@ngraveio/bc-ur").RegistryItemBase>;
export declare class Address extends Address_base {
data: IAddressArgs;
constructor(input: IAddressArgs);
getAddressInfo: () => CoinInfo;
getAddressScriptType: () => AddressScriptType | undefined;
static fromAddress(address: string, network?: 'mainnet' | 'testnet'): Address;
/**
* Convert the address object to its string representation.
* @returns The encoded address string.
*/
toAddress(): string;
}
export {};