private EIP712Domain GetEIP712Domain(EthereumAddress exchangeAddress) => new EIP712Domain { Name = "0x Protocol", Version = "2", VerifyingContract = exchangeAddress.ToString() };
public void Construction() { EthereumAddress address = new EthereumAddress(Constants.TestEthereumAddress); Assert.AreEqual(Constants.TestEthereumAddress, address.ToString()); Assert.IsTrue(address.IsChecksumAddress, "Address should be checksummed"); }
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)); }
protected static byte[] EncodeAddress(EthereumAddress address) // Address type encoder pads address with zeros to 32 bytes => new AddressTypeEncoder().Encode(address.ToString());