public async Task Should_Add_Account_Filter_With_Allow_Entity_Type() { var company = Account.GenerateNewAccount(Fixture.NetworkType); var allowedTransType = EntityType.MODIFY_ACCOUNT_PROPERTY_ENTITY_TYPE; var accountFilter = ModifyAccountPropertyTransaction <EntityType> .CreateForEntityType( Deadline.Create(), (ulong)0, PropertyType.ALLOW_TRANSACTION, new List <AccountPropertyModification <EntityType> >() { new AccountPropertyModification <EntityType>(PropertyModificationType.ADD, allowedTransType) }, Fixture.NetworkType); Log.WriteLine($"Going to filter the address {company.Address} "); await Fixture.SiriusWebSocketClient.Listener.Open(); var tx = Fixture.SiriusWebSocketClient.Listener.ConfirmedTransactionsGiven(company.Address).Take(1) .Timeout(TimeSpan.FromSeconds(1000)); var signedTransaction = accountFilter.SignWith(company, Fixture.GenerationHash); Log.WriteLine($"Going to announce transaction {signedTransaction.Hash}"); await Fixture.SiriusClient.TransactionHttp.Announce(signedTransaction); var result = await tx; Log.WriteLine($"Request confirmed with transaction {result.TransactionInfo.Hash}"); var accountProperties = await Fixture.SiriusClient.AccountHttp.GetAccountProperty(company.PublicAccount); accountProperties.Should().NotBeNull(); var allowedTransactionProperty = accountProperties.AccountProperties.Properties.Single(ap => ap.PropertyType == PropertyType.ALLOW_TRANSACTION); var allowedTxType = allowedTransactionProperty.Values.Select(p => EntityTypeExtension.GetRawValue((int)p) == allowedTransType); allowedTxType.Should().NotBeNull(); }
public async Task Should_Add_Account_Filter_With_Allow_Entity_Type() { // var company = await Fixture.GenerateAccountWithCurrency(10000); var company = Account.CreateFromPrivateKey("101a4dfcffe3d5abddee535c0c7fa7bb386b99eb7c19f0c73cdc3837c5844477", Fixture.NetworkType); Log.WriteLine($"Company Account {company.Address.Plain} \r\n Private Key: {company.PrivateKey} \r\n Public Key {company.PublicKey}"); // var allowedMosaic = await Fixture.CreateMosaic(company); var allowedTransType = EntityType.TRANSFER; var accountFilter = ModifyAccountPropertyTransaction <EntityType> .CreateForEntityType( Deadline.Create(), (ulong)0, PropertyType.BLOCK_TRANSACTION, new List <AccountPropertyModification <EntityType> >() { new AccountPropertyModification <EntityType>(PropertyModificationType.ADD, allowedTransType) }, Fixture.NetworkType); Log.WriteLine($"Going to filter the address {company.Address} "); // await Fixture.SiriusWebSocketClient.Listener.Open(); // var tx = Fixture.SiriusWebSocketClient.Listener.ConfirmedTransactionsGiven(company.Address).Take(1).Timeout(TimeSpan.FromSeconds(5000)); var signedTransaction = accountFilter.SignWith(Fixture.SeedAccount, Fixture.GenerationHash); Log.WriteLine($"Going to announce transaction {signedTransaction.Hash}"); Log.WriteLine($"Transaction Payload {signedTransaction.Payload}"); await Fixture.SiriusClient.TransactionHttp.Announce(signedTransaction); // var result = await tx; // Log.WriteLine($"Request confirmed with transaction {result.TransactionInfo.Hash}"); var accountProperties = await Fixture.SiriusClient.AccountHttp.GetAccountProperty(company.Address); accountProperties.Should().NotBeNull(); var allowedTransactionProperty = accountProperties.AccountProperties.Properties.Single(ap => ap.PropertyType == PropertyType.BLOCK_TRANSACTION); var allowedTxType = allowedTransactionProperty.Values.Select(p => EntityTypeExtension.GetRawValue((int)p) == allowedTransType); allowedTxType.Should().NotBeNull(); }