Esempio n. 1
0
 private EIP712Domain GetEIP712Domain(EthereumAddress exchangeAddress)
 => new EIP712Domain
 {
     Name              = "0x Protocol",
     Version           = "2",
     VerifyingContract = exchangeAddress.ToString()
 };
Esempio n. 2
0
        public void Construction()
        {
            EthereumAddress address = new EthereumAddress(Constants.TestEthereumAddress);

            Assert.AreEqual(Constants.TestEthereumAddress, address.ToString());
            Assert.IsTrue(address.IsChecksumAddress, "Address should be checksummed");
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
 protected static byte[] EncodeAddress(EthereumAddress address)
 // Address type encoder pads address with zeros to 32 bytes
 => new AddressTypeEncoder().Encode(address.ToString());