public void Conversions() { EthereumAddress a = new EthereumAddress(Constants.TestEthereumAddress); Assert.AreEqual(Constants.TestEthereumAddress, a.ToString()); // Tests explicit cast operator Assert.AreEqual(a, (EthereumAddress)Constants.TestEthereumAddress); // Tests implicit cast operator string aStr = a; Assert.AreEqual(Constants.TestEthereumAddress, aStr); byte[] expectedBytes = a.Bytes; CollectionAssert.AreEqual(Constants.TestEthereumAddress.HexToByteArray(), a.Bytes); Assert.AreEqual(a, EthereumAddress.FromByteArray(a.Bytes)); }
private ERC721Asset(byte[] assetData) : base(assetData, EthereumAddress.FromByteArray(assetData.Slice(16, 36))) { // Reversing due to fact that BigInteger expects little endian order TokenId = new BigInteger(assetData.Slice(36).Reverse().ToArray()); }
private ERC20Asset(byte[] assetData) : base(assetData, EthereumAddress.FromByteArray(assetData.Slice(16))) { }