import { common } from './common' ; import { crypto } from './crypto' ; import { AddressString , PrivateKeyString , PublicKeyString } from './types' ; param publicKey returns export function publicKeyToScriptHash ( publicKey ) { return common . uInt160ToString ( crypto . publicKeyToScriptHash ( common . stringToECPoint ( publicKey ) ) ) ; } param publicKey returns export function publicKeyToAddress ( publicKey ) { return crypto . scriptHashToAddress ( { addressVersion : common . NEO_ADDRESS_VERSION , scriptHash : crypto . publicKeyToScriptHash ( common . stringToECPoint ( publicKey ) ) } ) ; } param scriptHash returns export function scriptHashToAddress ( scriptHash ) { return crypto . scriptHashToAddress ( { addressVersion : common . NEO_ADDRESS_VERSION , scriptHash : common . stringToUInt160 ( scriptHash ) } ) ; } param address returns export function addressToScriptHash ( address ) { return common . uInt160ToString ( crypto . addressToScriptHash ( { addressVersion : common . NEO_ADDRESS_VERSION , address } ) ) ; } param wif returns export function wifToPrivateKey ( wif ) { return common . privateKeyToString ( crypto . wifToPrivateKey ( wif , common . NEO_PRIVATE_KEY_VERSION ) ) ; } param privateKey returns export function privateKeyToWIF ( privateKey ) { return crypto . privateKeyToWIF ( common . stringToPrivateKey ( privateKey ) , common . NEO_PRIVATE_KEY_VERSION ) ; } param privateKey returns export function privateKeyToScriptHash ( privateKey ) { return common . uInt160ToString ( crypto . privateKeyToScriptHash ( common . stringToPrivateKey ( privateKey ) ) ) ; } param privateKey returns export function privateKeyToAddress ( privateKey ) { return crypto . privateKeyToAddress ( { addressVersion : common . NEO_ADDRESS_VERSION , privateKey : common . stringToPrivateKey ( privateKey ) } ) ; } param privateKey returns export function privateKeyToPublicKey ( privateKey ) { return common . ecPointToString ( crypto . privateKeyToPublicKey ( common . stringToPrivateKey ( privateKey ) ) ) ; } param encryptedKey returns export function isNEP2 ( encryptedKey ) { return crypto . isNEP2 ( encryptedKey ) ; } param password param privateKey returns export async function encryptNEP2 ( options ) { const { password , privateKey } = options ; return crypto . encryptNEP2 ( { addressVersion : common . NEO_ADDRESS_VERSION , privateKey : common . stringToPrivateKey ( privateKey ) , password } ) ; } param password param encryptedKey returns export async function decryptNEP2 ( options ) { const { password , encryptedKey } = options ; const privateKey = await crypto . decryptNEP2 ( { addressVersion : common . NEO_ADDRESS_VERSION , encryptedKey , password } ) ; return common . privateKeyToString ( privateKey ) ; } returns export function createPrivateKey ( ) { return common . privateKeyToString ( crypto . createPrivateKey ( ) ) ; }