Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception Submitting transaction #38

Closed
abidnazir27 opened this issue Dec 31, 2021 · 4 comments
Closed

Exception Submitting transaction #38

abidnazir27 opened this issue Dec 31, 2021 · 4 comments

Comments

@abidnazir27
Copy link

Hi,
I'm getting this exception after withdraw request when trying to deposit to anchor.

Exception: Bad state: Cannot set the body fields of a Request with content-type "application/json".
E/flutter ( 8436): #0 Request.bodyFields= (package:http/src/request.dart:133:7)
E/flutter ( 8436): #1 BaseClient._sendUnstreamed (package:http/src/base_client.dart:87:17)
E/flutter ( 8436): #2 BaseClient.post (package:http/src/base_client.dart:32:7)
E/flutter ( 8436): #3 StellarSDK.submitTransactionEnvelopeXdrBase64 (package:stellar_flutter_sdk/src/stellar_sdk.dart:160:10)
E/flutter ( 8436): #4 StellarSDK.submitTransaction (package:stellar_flutter_sdk/src/stellar_sdk.dart:141:12)

Asset asset = AssetTypeCreditAlphaNum4('SRT' , issuer);

Transaction transaction = TransactionBuilder(sender) .addOperation(PaymentOperationBuilder( withdrawAnchorAccount, asset,'100') .build()).addMemo(MemoHash(base64Decode(withdrawMemo))) .build();

transaction.sign(keyPair,Network.TESTNET);
SubmitTransactionResponse submitTransactionResponse = await StellarSDK.TESTNET.submitTransaction(transaction);

@christian-rogobete
Copy link
Contributor

Hello @abidnazir27,
thank you for reporting this issue. I tried to reproduce the issue, but no luck.
You can see the corresponding test in my latest commit: 4ace040
in test/payments_test.dart

Do you still have the issue?
If yes, which version of the SDK are you using?
Did you change the httpClient of StellarSDK? E.g. by setting it or by adding a content type header with the value of "application/json"?

@abidnazir27
Copy link
Author

abidnazir27 commented Jan 11, 2022

@christian-rogobete
Yes Still have the issue.
I'm using Stellar SDK 1.2.7
In stellar_sdk.dart -> submitTransactionEnvelopeXdrBase64 method If I remove Content-Type from Headers then it works fine.
if(RequestBuilder.headers.containsKey("Content-Type")) {
RequestBuilder.headers.removeWhere((key, value) => key == 'Content-Type');
}
Capture

Have you tried to deposit an amount to anchor after withdrawal request ? This is where I'm getting the issue.

@christian-rogobete
Copy link
Contributor

thank you @abidnazir27,
I fixed it in release 1.2.8
should work now

@abidnazir27
Copy link
Author

Thank You @christian-rogobete
It's working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants