public override async Task <OperationResult <VoidResponse> > LoginWithPostingKey(AuthorizedModel model, CancellationToken ct) { return(await Task.Run(() => { if (!TryReconnectChain(ct)) { return new OperationResult <VoidResponse>(new AppError(LocalizationKeys.EnableConnectToBlockchain)); } var keys = ToKeyArr(model.PostingKey); if (keys == null) { return new OperationResult <VoidResponse>(new AppError(LocalizationKeys.WrongPrivatePostingKey)); } var op = new FollowOperation(model.Login, "steepshot", DitchFollowType.Blog, model.Login); var resp = _operationManager.VerifyAuthority(keys, ct, op); var result = new OperationResult <VoidResponse>(); if (!resp.IsError) { result.Result = new VoidResponse(); } else { OnError(resp, result); } return result; }, ct)); }
public override async Task <OperationResult <object> > GetVerifyTransaction(AuthorizedModel model, CancellationToken ct) { if (!TryReconnectChain(ct)) { return(new OperationResult <object>(new AppError(LocalizationKeys.EnableConnectToBlockchain))); } var keys = ToKeyArr(model.PostingKey); if (keys == null) { return(new OperationResult <object>(new AppError(LocalizationKeys.WrongPrivatePostingKey))); } return(await Task.Run(() => { var op = new FollowOperation(model.Login, "steepshot", DitchFollowType.Blog, model.Login); var properties = new DynamicGlobalPropertyApiObj { HeadBlockId = Hex.ToString(_operationManager.ChainId), Time = DateTime.Now, HeadBlockNumber = 0 }; var tr = _operationManager.CreateTransaction(properties, keys, ct, op); return new OperationResult <object>() { Result = tr }; }, ct)); }
public void VerifyAuthorityFallTest([Values("Steem", "Golos")] string name) { var op = new FollowOperation(Login[name], "steepshot", FollowType.blog, "StubLogin"); var resp = Manager(name).VerifyAuthority(UserPrivateKeys[name], op); Assert.IsTrue(resp.IsError); }
public async Task FollowUnfollowTest() { var user = User; const string autor = "steepshot"; var isFollow = await IsFollow(autor).ConfigureAwait(false); var op = isFollow ? new UnfollowOperation(user.Login, autor, user.Login) : new FollowOperation(user.Login, autor, FollowType.Blog, user.Login); await Post(user.PostingKeys, false, op).ConfigureAwait(false); isFollow = !isFollow; op = isFollow ? new UnfollowOperation(user.Login, autor, user.Login) : new FollowOperation(user.Login, autor, FollowType.Blog, user.Login); await Post(user.PostingKeys, false, op).ConfigureAwait(false); isFollow = !isFollow; var fType = isFollow ? new FollowType[0] : new[] { FollowType.Blog }; op = new FollowOperation(user.Login, autor, fType, user.Login); await Post(user.PostingKeys, false, op).ConfigureAwait(false); isFollow = !isFollow; fType = isFollow ? new FollowType[0] : new[] { FollowType.Blog }; op = new FollowOperation(user.Login, autor, fType, user.Login); await Post(user.PostingKeys, false, op).ConfigureAwait(false); }
public override async Task <OperationResult <string> > GetVerifyTransaction(AuthorizedPostingModel model, CancellationToken ct) { var isConnected = await TryReconnectChain(ct); if (!isConnected) { return(new OperationResult <string>(new ValidationException(LocalizationKeys.EnableConnectToBlockchain))); } var keys = ToKeyArr(model.PostingKey); if (keys == null) { return(new OperationResult <string>(new ValidationException(LocalizationKeys.WrongPrivatePostingKey))); } var op = new FollowOperation(model.Login, "steepshot", Ditch.Golos.Models.FollowType.Blog, model.Login); var properties = new DynamicGlobalPropertyObject { HeadBlockId = "0000000000000000000000000000000000000000", Time = DateTime.Now, HeadBlockNumber = 0 }; var tr = await _operationManager.CreateTransaction(properties, keys, op, ct); return(new OperationResult <string> { Result = JsonConvert.SerializeObject(tr) }); }
public void VerifyAuthoritySuccessTest([Values("Steem", "Golos")] string name) { var op = new FollowOperation(Login[name], "steepshot", FollowType.blog, Login[name]); var resp = Manager(name).VerifyAuthority(UserPrivateKeys[name], op); Assert.IsFalse(resp.IsError, resp.GetErrorMessage()); Assert.IsTrue(resp.Result); }
public void FollowTest([Values("Steem", "Golos")] string name) { var op = new FollowOperation(_login[name], "joseph.kalu", FollowType.Blog | FollowType.Posts, _login[name]); var prop = Manager(name).VerifyAuthority(_userPrivateKeys[name], op); //var prop = Manager(name).BroadcastOperations(_userPrivateKeys[name], op); Assert.IsFalse(prop.IsError, prop.GetErrorMessage()); }
public void UnFollowTest2([Values("Steem", "Golos")] string name) { var op = new FollowOperation(Login[name], "aarnold", null, Login[name]); //var prop = Manager(name).VerifyAuthority(UserPrivateKeys[name], op); var prop = Manager(name).BroadcastOperations(UserPrivateKeys[name], op); Assert.IsFalse(prop.IsError, prop.GetErrorMessage()); }
public async Task VerifyAuthoritySuccessTest() { var user = User; var op = new FollowOperation(user.Login, "steepshot", FollowType.Blog, user.Login); await Post(user.PostingKeys, false, op).ConfigureAwait(false); }
public void FollowTest2([Values("Steem", "Golos")] string name) { var fType = new[] { FollowType.blog }; var op = new FollowOperation(Login[name], "joseph.kalu", fType, Login[name]); var prop = Manager(name).VerifyAuthority(UserPrivateKeys[name], op); //var prop = Manager(name).BroadcastOperations(UserPrivateKeys[name], op); Assert.IsFalse(prop.IsError, prop.GetErrorMessage()); }
public void VerifyAuthorityFallTest() { var user = User; var op = new FollowOperation(user.Login, "steepshot", FollowType.Blog, "StubLogin"); var response = Post(user.PostingKeys, false, op); Assert.IsTrue(response.IsError); }
public void VerifyAuthoritySuccessTest() { var user = User; var op = new FollowOperation(user.Login, "steepshot", FollowType.Blog, user.Login); var response = Post(user.PostingKeys, false, op); Assert.IsFalse(response.IsError, response.GetErrorMessage()); }
protected SignedTransaction GetSignedTransaction() { var user = User; var autor = "steepshot"; var op = new FollowOperation(user.Login, autor, FollowType.Blog, user.Login); var prop = Api.GetDynamicGlobalProperties(CancellationToken.None); var transaction = Api.CreateTransaction(prop.Result, user.PostingKeys, CancellationToken.None, op); return(transaction); }
protected async Task <SignedTransaction> GetSignedTransaction() { var user = User; const string autor = "steepshot"; var op = new FollowOperation(user.Login, autor, FollowType.Blog, user.Login); var prop = await Api.GetDynamicGlobalProperties(CancellationToken.None); var transaction = await Api.CreateTransaction(prop.Result, user.PostingKeys, op, CancellationToken.None); return(transaction); }
public void get_required_signatures() { var user = User; var autor = "steepshot"; var op = new FollowOperation(user.Login, autor, FollowType.Blog, user.Login); var prop = Api.GetDynamicGlobalProperties(CancellationToken.None); var transaction = Api.CreateTransaction(prop.Result, user.PostingKeys, CancellationToken.None, op); var resp = Api.GetRequiredSignatures(transaction, new PublicKeyType[0], CancellationToken.None); WriteLine(resp); Assert.IsFalse(resp.IsError); }
public void broadcast_transaction_synchronous() { var user = User; var autor = "steepshot"; var op = new FollowOperation(user.Login, autor, FollowType.Blog, user.Login); var prop = Api.GetDynamicGlobalProperties(CancellationToken.None); var transaction = Api.CreateTransaction(prop.Result, user.PostingKeys, CancellationToken.None, op); var resp = Api.BroadcastTransactionSynchronous(transaction, CancellationToken.None); WriteLine(resp); Assert.IsFalse(resp.IsError); }
public async Task verify_authority() { var user = User; var autor = "steepshot"; var op = new FollowOperation(user.Login, autor, FollowType.Blog, user.Login); var prop = await Api.GetDynamicGlobalProperties(CancellationToken.None); var transaction = await Api.CreateTransaction(prop.Result, user.PostingKeys, op, CancellationToken.None); var resp = await Api.VerifyAuthority(transaction, CancellationToken.None); WriteLine(resp); Assert.IsFalse(resp.IsError); }
public async Task broadcast_transaction() { var user = User; var autor = "steepshot"; var op = new FollowOperation(user.Login, autor, FollowType.Blog, user.Login); var prop = await Api.GetDynamicGlobalPropertiesAsync(CancellationToken.None).ConfigureAwait(false); var transaction = await Api.CreateTransactionAsync(prop.Result, user.PostingKeys, op, CancellationToken.None).ConfigureAwait(false); var resp = await Api.BroadcastTransactionAsync(transaction, CancellationToken.None).ConfigureAwait(false); WriteLine(resp); Assert.IsFalse(resp.IsError); }
public void broadcast_transaction() { var user = User; var autor = "steepshot"; var op = new FollowOperation(user.Login, autor, FollowType.Blog, user.Login); var prop = Api.GetDynamicGlobalProperties(CancellationToken.None); var transaction = Api.CreateTransaction(prop.Result, user.PostingKeys, CancellationToken.None, op); var resp = Api.BroadcastTransaction(transaction, CancellationToken.None); Console.WriteLine(resp.Error); Assert.IsFalse(resp.IsError); Console.WriteLine(JsonConvert.SerializeObject(resp.Result)); }
public async Task FollowUnfollowTest() { var user = User; var autor = "steepshot"; var isFollow = IsFollow(autor); var op = isFollow ? new UnfollowOperation(user.Login, autor, user.Login) : new FollowOperation(user.Login, autor, FollowType.Blog, user.Login); var response = Post(user.PostingKeys, false, op); Assert.IsFalse(response.IsError, response.GetErrorMessage()); if (!IsVerify) { await Task.Delay(1000); var isFollow2 = IsFollow(autor); Assert.IsTrue(isFollow != isFollow2); } isFollow = !isFollow; op = isFollow ? new UnfollowOperation(user.Login, autor, user.Login) : new FollowOperation(user.Login, autor, FollowType.Blog, user.Login); response = Post(user.PostingKeys, false, op); Assert.IsFalse(response.IsError, response.GetErrorMessage()); if (!IsVerify) { await Task.Delay(1000); var isFollow2 = IsFollow(autor); Assert.IsTrue(isFollow != isFollow2); } isFollow = !isFollow; var fType = isFollow ? new FollowType[0] : new[] { FollowType.Blog }; op = new FollowOperation(user.Login, autor, fType, user.Login); response = Post(user.PostingKeys, false, op); Assert.IsFalse(response.IsError, response.GetErrorMessage()); if (!IsVerify) { await Task.Delay(1000); var isFollow2 = IsFollow(autor); Assert.IsTrue(isFollow != isFollow2); } isFollow = !isFollow; fType = isFollow ? new FollowType[0] : new[] { FollowType.Blog }; op = new FollowOperation(user.Login, autor, fType, user.Login); response = Post(user.PostingKeys, false, op); Assert.IsFalse(response.IsError, response.GetErrorMessage()); if (!IsVerify) { await Task.Delay(1000); var isFollow2 = IsFollow(autor); Assert.IsTrue(isFollow != isFollow2); } }