Skip to content

Commit

Permalink
fix sep-10 signed transaction post
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-rogobete committed Nov 27, 2021
1 parent 3fe5560 commit b1e119f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [1.2.7] - 27.Nov.2021.
- fix sep-10 transaction post

## [1.2.6] - 27.Nov.2021.
- fix sep-10 timebounds validation

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The Soneso open source Stellar SDK for Flutter is build with Dart and provides A
1. Add the dependency to your pubspec.yaml file:
```
dependencies:
stellar_flutter_sdk: ^1.2.6
stellar_flutter_sdk: ^1.2.7
```
2. Install it (command line or IDE):
```
Expand Down
5 changes: 4 additions & 1 deletion lib/src/sep/0010/webauth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,12 @@ class WebAuth {
String base64EnvelopeXDR) async {
Uri serverURI = Uri.parse(_authEndpoint!);

Map<String, String> headers = RequestBuilder.headers;
headers.putIfAbsent("Content-Type", () => "application/json");

SubmitCompletedChallengeResponse result = await httpClient
.post(serverURI,
body: {"transaction": base64EnvelopeXDR}, headers: RequestBuilder.headers)
body: json.encode({"transaction": base64EnvelopeXDR}), headers: headers)
.then((response) {
SubmitCompletedChallengeResponse submitTransactionResponse;
switch (response.statusCode) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/stellar_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import 'requests/liquidity_pools_request_builder.dart';

/// Main class of the flutter stellar sdk.
class StellarSDK {
static const versionNumber = "1.2.6";
static const versionNumber = "1.2.7";

static final StellarSDK PUBLIC = StellarSDK("https://horizon.stellar.org");
static final StellarSDK TESTNET =
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: stellar_flutter_sdk
description: A stellar blockchain sdk that query's horizon, build, signs and submits transactions to the stellar network.
version: 1.2.6
version: 1.2.7
homepage: https://github.com/Soneso/stellar_flutter_sdk

environment:
Expand Down
12 changes: 4 additions & 8 deletions test/sep0010_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,8 @@ void main() {
if (request.url.toString().startsWith(authServer) &&
request.method == "POST") {
// validate if the challenge transaction has been signed by the client
String signedTransaction = request.body;
XdrTransactionEnvelope envelopeXdr =
XdrTransactionEnvelope.fromEnvelopeXdrString(signedTransaction);
XdrTransactionEnvelope.fromEnvelopeXdrString(json.decode(request.body)['transaction']);
final signatures = envelopeXdr.v1!.signatures;
if (signatures!.length == 2) {
final clientSignature = envelopeXdr.v1!.signatures![1];
Expand Down Expand Up @@ -356,9 +355,8 @@ void main() {
if (request.url.toString().startsWith(authServer) &&
request.method == "POST") {
// validate if the challenge transaction has been signed by the client
String signedTransaction = request.body;
XdrTransactionEnvelope envelopeXdr =
XdrTransactionEnvelope.fromEnvelopeXdrString(signedTransaction);
XdrTransactionEnvelope.fromEnvelopeXdrString(json.decode(request.body)['transaction']);
final signatures = envelopeXdr.v1!.signatures;
if (signatures!.length == 2) {
final clientSignature = envelopeXdr.v1!.signatures![1];
Expand Down Expand Up @@ -396,9 +394,8 @@ void main() {
if (request.url.toString().startsWith(authServer) &&
request.method == "POST") {
// validate if the challenge transaction has been signed by the client
String signedTransaction = request.body;
XdrTransactionEnvelope envelopeXdr =
XdrTransactionEnvelope.fromEnvelopeXdrString(signedTransaction);
XdrTransactionEnvelope.fromEnvelopeXdrString(json.decode(request.body)['transaction']);
final signatures = envelopeXdr.v1!.signatures;
if (signatures!.length == 2) {
final clientSignature = envelopeXdr.v1!.signatures![1];
Expand Down Expand Up @@ -800,9 +797,8 @@ void main() {
if (request.url.toString().startsWith(authServer) &&
request.method == "POST") {
// validate if the challenge transaction has been signed by the client
String signedTransaction = request.body;
XdrTransactionEnvelope envelopeXdr =
XdrTransactionEnvelope.fromEnvelopeXdrString(signedTransaction);
XdrTransactionEnvelope.fromEnvelopeXdrString(json.decode(request.body)['transaction']);
final signatures = envelopeXdr.v1!.signatures;
if (signatures!.length == 3) {
final clientSignature = envelopeXdr.v1!.signatures![1];
Expand Down

0 comments on commit b1e119f

Please sign in to comment.