public async void Test()
        {
            var account         = new Account("0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7");
            var web3            = new Web3(account, ClientFactory.GetClient());
            var pollingService  = new TransactionReceiptPollingService(web3.TransactionManager);
            var contractAddress = await pollingService.DeployContractAndGetAddressAsync(() =>
                                                                                        CoinService.DeployContractAsync(web3, account.Address, new HexBigInteger(4000000)));

            var coinService = new CoinService(web3, contractAddress);
            var txn         = await coinService.MintAsync(account.Address, account.Address, 100, new HexBigInteger(4000000));

            var receipt = await pollingService.PollForReceiptAsync(txn);

            var eventSent = coinService.GetEventSent();
            var sent      = await eventSent.GetAllChanges <SentEventDTO>(eventSent.CreateFilterInput());

            txn = await coinService.RaiseEventMetadataAsync(account.Address, account.Address, 100, "Description", "The metadata created here blah blah blah", new HexBigInteger(4000000));

            receipt = await pollingService.PollForReceiptAsync(txn);

            var metadataEvent = coinService.GetEventMetadataEvent();
            var metadata      = await metadataEvent.GetAllChanges <MetadataEventEventDTO>(metadataEvent.CreateFilterInput(new BlockParameter(receipt.BlockNumber)));

            var result = metadata[0].Event;

            Assert.Equal(result.Creator.ToLower(), account.Address.ToLower());
            Assert.Equal(result.Id, 100);
            Assert.Equal(result.Metadata, "The metadata created here blah blah blah");
            Assert.Equal(result.Description, "Description");
        }
Beispiel #2
0
        public async void TestChinese()
        {
            var web3            = _ethereumClientIntegrationFixture.GetWeb3();
            var accountAddresss = EthereumClientIntegrationFixture.AccountAddress;
            var pollingService  = new TransactionReceiptPollingService(web3.TransactionManager);
            var contractAddress = await pollingService.DeployContractAndGetAddressAsync(() =>
                                                                                        CoinService.DeployContractAsync(web3, accountAddresss, new HexBigInteger(4000000)))
                                  .ConfigureAwait(false);

            var coinService = new CoinService(web3, contractAddress);

            var input = new RaiseEventMetadataInput
            {
                Creator     = accountAddresss,
                Id          = 101,
                Description = @"中国,China",
                Metadata    = @"中国,China"
            };

            var txn = await coinService.RaiseEventMetadataAsync(accountAddresss, input, new HexBigInteger(4000000))
                      .ConfigureAwait(false);

            var receipt = await pollingService.PollForReceiptAsync(txn).ConfigureAwait(false);

            var metadataEvent = coinService.GetEventMetadataEvent();
            var metadata      = await metadataEvent
                                .GetAllChangesAsync <MetadataEventEventDTO>(metadataEvent.CreateFilterInput()).ConfigureAwait(false);

            var result = metadata[0].Event;

            Assert.Equal(result.Creator.ToLower(), accountAddresss.ToLower());
            Assert.Equal(101, result.Id);
            Assert.Equal(@"中国,China", result.Metadata);
            Assert.Equal(@"中国,China", result.Description);
        }
        public async void TestChinese()
        {
            var account         = new Account("0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7");
            var web3            = new Web3(account, ClientFactory.GetClient());
            var pollingService  = new TransactionReceiptPollingService(web3.TransactionManager);
            var contractAddress = await pollingService.DeployContractAndGetAddressAsync(() =>
                                                                                        CoinService.DeployContractAsync(web3, account.Address, new HexBigInteger(4000000)));

            var coinService = new CoinService(web3, contractAddress);

            var input = new RaiseEventMetadataInput()
            {
                Creator     = account.Address,
                Id          = 101,
                Description = @"中国,China",
                Metadata    = @"中国,China"
            };

            var txn = await coinService.RaiseEventMetadataAsync(account.Address, input, new HexBigInteger(4000000));

            var receipt = await pollingService.PollForReceiptAsync(txn);

            var metadataEvent = coinService.GetEventMetadataEvent();
            var metadata      = await metadataEvent.GetAllChanges <MetadataEventEventDTO>(metadataEvent.CreateFilterInput());

            var result = metadata[0].Event;

            Assert.Equal(result.Creator.ToLower(), account.Address.ToLower());
            Assert.Equal(result.Id, 101);
            Assert.Equal(result.Metadata, @"中国,China");
            Assert.Equal(result.Description, @"中国,China");
        }
Beispiel #4
0
        public async void Test()
        {
            var web3            = _ethereumClientIntegrationFixture.GetWeb3();
            var accountAddresss = EthereumClientIntegrationFixture.AccountAddress;
            var pollingService  = new TransactionReceiptPollingService(web3.TransactionManager);
            var contractAddress = await pollingService.DeployContractAndGetAddressAsync(() =>
                                                                                        CoinService.DeployContractAsync(web3, accountAddresss, new HexBigInteger(4000000)))
                                  .ConfigureAwait(false);

            var coinService = new CoinService(web3, contractAddress);
            var txn         = await coinService.MintAsync(accountAddresss, accountAddresss, 100, new HexBigInteger(4000000))
                              .ConfigureAwait(false);

            var receipt = await pollingService.PollForReceiptAsync(txn).ConfigureAwait(false);

            var eventSent = coinService.GetEventSent();
            var sent      = await eventSent.GetAllChangesAsync <SentEventDTO>(eventSent.CreateFilterInput())
                            .ConfigureAwait(false);

            txn = await coinService.RaiseEventMetadataAsync(accountAddresss, accountAddresss, 100, "Description",
                                                            "The metadata created here blah blah blah", new HexBigInteger(4000000)).ConfigureAwait(false);

            receipt = await pollingService.PollForReceiptAsync(txn).ConfigureAwait(false);

            var metadataEvent = coinService.GetEventMetadataEvent();
            var metadata      =
                await metadataEvent.GetAllChangesAsync <MetadataEventEventDTO>(
                    metadataEvent.CreateFilterInput(new BlockParameter(receipt.BlockNumber), null))
                .ConfigureAwait(false);

            var result = metadata[0].Event;

            Assert.Equal(result.Creator.ToLower(), accountAddresss.ToLower());
            Assert.Equal(100, result.Id);
            Assert.Equal("The metadata created here blah blah blah", result.Metadata);
            Assert.Equal("Description", result.Description);
        }