Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        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");
        }
Exemplo n.º 3
0
            public Task <string> RaiseEventMetadataAsync(string addressFrom, RaiseEventMetadataInput input,
                                                         HexBigInteger gas = null, HexBigInteger valueAmount = null)
            {
                var function = _contract.GetFunction <RaiseEventMetadataInput>();

                return(function.SendTransactionAsync(input, addressFrom, gas, valueAmount));
            }