Skip to content

Commit

Permalink
Merge pull request #43 from mildlyskilled/master
Browse files Browse the repository at this point in the history
Fix stack overflow error caused by typo for issue #44
  • Loading branch information
christian-rogobete authored Apr 18, 2022
2 parents cf304ef + 5d68912 commit 56794ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/xdr/xdr_operation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -671,14 +671,14 @@ class XdrOperationResultTr {
XdrLiquidityPoolDepositResult? get liquidityPoolDepositResult => this._liquidityPoolDepositResult;

set liquidityPoolDepositResult(XdrLiquidityPoolDepositResult? value) =>
this.liquidityPoolDepositResult = value;
this._liquidityPoolDepositResult = value;

XdrLiquidityPoolWithdrawResult? _liquidityPoolWithdrawResult;

XdrLiquidityPoolWithdrawResult? get liquidityPoolWithdrawResult => this._liquidityPoolWithdrawResult;

set liquidityPoolWithdrawResult(XdrLiquidityPoolWithdrawResult? value) =>
this.liquidityPoolWithdrawResult = value;
this._liquidityPoolWithdrawResult = value;

static void encode(XdrDataOutputStream stream, XdrOperationResultTr encodedOperationResultTr) {
stream.writeInt(encodedOperationResultTr.discriminant!.value);
Expand Down
9 changes: 9 additions & 0 deletions test/amm_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:convert';

import 'package:flutter_test/flutter_test.dart';
import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart';

Expand Down Expand Up @@ -363,5 +365,12 @@ void main() {
List<TradeResponse> trades2 = trades2Page.records!;
assert(trades2.first.baseLiquidityPoolId == nonNativeLiquidityPoolId);
});

test("parse liquidity pool resultXdr", (){
final input = XdrDataInputStream(base64Decode("AAAAAAAAAGT/////AAAAAQAAAAAAAAAW/////AAAAAA="));
final result = XdrTransactionResult.decode(input);
final operationResult = (result.result!.results.first as XdrOperationResult).tr!.liquidityPoolDepositResult;
assert(operationResult!.discriminant == XdrLiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED);
});
});
}

0 comments on commit 56794ea

Please sign in to comment.