/// <summary> /// Submit a transaction to the network. /// /// This method will check if any of the destination accounts require a memo. /// </summary> /// <param name="transaction"></param> /// <returns></returns> public Task <SubmitTransactionResponse> SubmitTransaction(Transaction transaction) { var options = new SubmitTransactionOptions { SkipMemoRequiredCheck = false }; return(SubmitTransaction(transaction.ToEnvelopeXdrBase64(), options)); }
public async Task <SubmitTransactionResponse> SubmitTransaction(Transaction transaction) { var transactionUri = new UriBuilder(_serverUri).SetPath("/transactions").Uri; var paramsPairs = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("tx", transaction.ToEnvelopeXdrBase64()) }; var response = await HttpClient.PostAsync(transactionUri, new FormUrlEncodedContent(paramsPairs.ToArray())); if (response.Content != null) { var responseString = await response.Content.ReadAsStringAsync(); var submitTransactionResponse = JsonSingleton.GetInstance <SubmitTransactionResponse>(responseString); return(submitTransactionResponse); } return(null); }
public void ReturnsTransactionHash() { Stellar.Transaction tx = this.GenerateSignedChallenge(_fixture.UserKeypair, _fixture.DevKeypair); Library.Auth.Token token = new Library.Auth.Token(_fixture.DevKeypair.SecretSeed, tx.ToEnvelopeXdrBase64(), _fixture.UserKeypair.AccountId); Assert.NotNull(token.Hash()); }
public void ThrowsErrorIfCurrentTimeIsOutsideTimeBounds() { Stellar.Transaction tx = this.GenerateSignedChallenge(_fixture.UserKeypair, _fixture.DevKeypair); Library.Auth.Token token = new Library.Auth.Token(_fixture.DevKeypair.SecretSeed, tx.ToEnvelopeXdrBase64(), _fixture.UserKeypair.AccountId); System.Threading.Thread.Sleep(11000); Assert.ThrowsAny <Exception>(() => token.Validate()); }
public void CurrentTimeIsWithinTimeBounds() { Stellar.Transaction tx = this.GenerateSignedChallenge(_fixture.UserKeypair, _fixture.DevKeypair); Library.Auth.Token token = new Library.Auth.Token(_fixture.DevKeypair.SecretSeed, tx.ToEnvelopeXdrBase64(), _fixture.UserKeypair.AccountId); Assert.True(token.Validate()); }
/// <summary> /// Submit a transaction to the network. /// /// This method will check if any of the destination accounts require a memo. Change the SkipMemoRequiredCheck /// options to change this behaviour. /// </summary> /// <param name="transaction"></param> /// <param name="options"></param> /// <returns></returns> public Task <SubmitTransactionResponse> SubmitTransaction(Transaction transaction, SubmitTransactionOptions options) { return(SubmitTransaction(transaction.ToEnvelopeXdrBase64(), options)); }