示例#1
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));
        }
示例#2
0
文件: ERC721Asset.cs 项目: bojan96/0x
 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());
 }
示例#3
0
文件: ERC20Asset.cs 项目: bojan96/0x
 private ERC20Asset(byte[] assetData)
     : base(assetData, EthereumAddress.FromByteArray(assetData.Slice(16)))
 {
 }