public function testBitcoinAddressToHexadecimal() { $converter = new AddressConverter(); $result = $converter->bitcoinAddressToHexadecimal('1JztLWos5K7LsqW5E78EASgiVBaCe6f7cD'); PHPUnit::assertEquals('00c56cb39f9b289c0ec4ef6943fa107c904820fe0980df2772', $result); $result = $converter->bitcoinAddressToHexadecimal('1BURNsssssssssssssssssssssstsp2x8'); PHPUnit::assertEquals('0001fb0c86969f0ec7c3137ef692ed24da94d5bb29600f4679', $result); $result = $converter->bitcoinAddressToHexadecimal('1ANTHERXXXXXXXXXXXXXXXXXXXXVA2ynW'); PHPUnit::assertEquals('0001c5a6dc8dd376ab0a6c27f872f4fd6965fa795c6f0c7fe7', $result); }
/** * builds the OP_RETURN data to trigger an alternate swapbot receipt destination * @param string $bitcoin_address a base58 encoded bitcoin address * @return string a hexadecimal representation of the OP_RETURN value */ public function buildDestinationInstruction($bitcoin_address) { $address_converter = new AddressConverter(); return Constants::PREFIX . Constants::OP_DESTINATION . $address_converter->bitcoinAddressToHexadecimal($bitcoin_address); }