Skip to content

Commit

Permalink
add fee meta xdr
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-rogobete committed Jan 30, 2023
1 parent 491416e commit ea0a9f3
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 40 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [1.5.1] - 30.Jan.2023.
- improve submit transaction response
- add fee meta xdr
- improve tx result xdr
- improve and bugfix tx result meta

## [1.5.0] - 22.Jan.2023.
- add soroban support

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.5.0
stellar_flutter_sdk: ^1.5.1
```
2. Install it (command line or IDE):
```
Expand Down
Binary file modified documentation/sdk_api_doc.zip
Binary file not shown.
90 changes: 62 additions & 28 deletions lib/src/responses/submit_transaction_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,32 @@ import 'dart:convert';
import '../xdr/xdr_data_io.dart';
import '../xdr/xdr_operation.dart';
import '../xdr/xdr_transaction.dart';
import '../xdr/xdr_ledger.dart';
import '../util.dart';

/// Represents the horizon server response after submitting transaction.
class SubmitTransactionResponse extends Response {
String? hash;
int? ledger;
String? strEnvelopeXdr;
String? strResultXdr;
String? strMetaXdr;
String? _strEnvelopeXdr;
String? _strResultXdr;
String? _strMetaXdr;
String? _strFeeMetaXdr;
SubmitTransactionResponseExtras? extras;

SubmitTransactionResponse(this.extras, this.ledger, this.hash,
this.strEnvelopeXdr, this.strResultXdr, this.strMetaXdr);
SubmitTransactionResponse(
this.extras,
this.ledger,
this.hash,
this._strEnvelopeXdr,
this._strResultXdr,
this._strMetaXdr,
this._strFeeMetaXdr);

bool get success {
if (strResultXdr != null) {
if (_strResultXdr != null) {
XdrTransactionResult result =
XdrTransactionResult.fromBase64EncodedXdrString(strResultXdr!);
XdrTransactionResult.fromBase64EncodedXdrString(_strResultXdr!);
if (result.result.discriminant == XdrTransactionResultCode.txSUCCESS) {
return true;
} else if (result.result.discriminant ==
Expand All @@ -43,7 +51,7 @@ class SubmitTransactionResponse extends Response {

String? get envelopeXdr {
if (this.success) {
return this.strEnvelopeXdr;
return this._strEnvelopeXdr;
} else {
if (this.extras != null) {
return this.extras!.envelopeXdr;
Expand All @@ -54,7 +62,7 @@ class SubmitTransactionResponse extends Response {

String? get resultXdr {
if (this.success) {
return this.strResultXdr;
return this._strResultXdr;
} else {
if (this.extras != null) {
return this.extras!.resultXdr;
Expand All @@ -65,7 +73,7 @@ class SubmitTransactionResponse extends Response {

String? get resultMetaXdr {
if (this.success) {
return this.strMetaXdr;
return this._strMetaXdr;
} else {
if (this.extras != null) {
return this.extras!.strMetaXdr;
Expand All @@ -74,23 +82,47 @@ class SubmitTransactionResponse extends Response {
}
}

XdrTransactionResult? getTransactionResultXdr() {
XdrDataInputStream xdrInputStream =
XdrDataInputStream(base64Decode(this.resultXdr!));
String? get feeMetaXdr {
if (this.success) {
return this._strFeeMetaXdr;
} else {
if (this.extras != null) {
return this.extras!.strFeeMetaXdr;
}
return null;
}
}

XdrTransactionResult? getTransactionResultXdr() {
if (this.resultXdr == null) {
return null;
}
try {
return XdrTransactionResult.decode(xdrInputStream);
return XdrTransactionResult.fromBase64EncodedXdrString(this.resultXdr!);
} catch (e) {
return null;
}
}

XdrTransactionMeta? getTransactionMetaResultXdr() {
XdrDataInputStream xdrInputStream =
XdrDataInputStream(base64Decode(this.resultMetaXdr!));
if (this.resultMetaXdr == null) {
return null;
}

try {
return XdrTransactionMeta.decode(xdrInputStream);
return XdrTransactionMeta.fromBase64EncodedXdrString(this.resultMetaXdr!);
} catch (e) {
return null;
}
}

XdrLedgerEntryChanges? getFeeMetaXdr() {
if (this.feeMetaXdr == null) {
return null;
}

try {
return XdrLedgerEntryChanges.fromBase64EncodedXdrString(this.feeMetaXdr!);
} catch (e) {
return null;
}
Expand Down Expand Up @@ -193,15 +225,15 @@ class SubmitTransactionResponse extends Response {

factory SubmitTransactionResponse.fromJson(Map<String, dynamic> json) =>
SubmitTransactionResponse(
json['extras'] == null
? null
: SubmitTransactionResponseExtras.fromJson(json['extras']),
convertInt(json['ledger']),
json['hash'],
json['envelope_xdr'],
json['result_xdr'],
json['result_meta_xdr'],
)
json['extras'] == null
? null
: SubmitTransactionResponseExtras.fromJson(json['extras']),
convertInt(json['ledger']),
json['hash'],
json['envelope_xdr'],
json['result_xdr'],
json['result_meta_xdr'],
json['fee_meta_xdr'])
..rateLimitLimit = convertInt(json['rateLimitLimit'])
..rateLimitRemaining = convertInt(json['rateLimitRemaining'])
..rateLimitReset = convertInt(json['rateLimitReset']);
Expand All @@ -228,16 +260,18 @@ class SubmitTransactionResponseExtras {
String envelopeXdr;
String resultXdr;
String? strMetaXdr;
String? strFeeMetaXdr;
ExtrasResultCodes? resultCodes;

SubmitTransactionResponseExtras(
this.envelopeXdr, this.resultXdr, this.strMetaXdr, this.resultCodes);
SubmitTransactionResponseExtras(this.envelopeXdr, this.resultXdr,
this.strMetaXdr, this.strFeeMetaXdr, this.resultCodes);

factory SubmitTransactionResponseExtras.fromJson(Map<String, dynamic> json) =>
SubmitTransactionResponseExtras(
json['envelope_xdr'],
json['result_xdr'],
json['result_meta_xdr'],
json['fee_meta_xdr'],
json['result_codes'] == null
? null
: ExtrasResultCodes.fromJson(json['result_codes']));
Expand Down
11 changes: 11 additions & 0 deletions lib/src/xdr/xdr_ledger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,17 @@ class XdrLedgerEntryChanges {
}
return XdrLedgerEntryChanges(ledgerEntryChanges);
}

static XdrLedgerEntryChanges fromBase64EncodedXdrString(String xdr) {
Uint8List bytes = base64Decode(xdr);
return XdrLedgerEntryChanges.decode(XdrDataInputStream(bytes));
}

String toBase64EncodedXdrString() {
XdrDataOutputStream xdrOutputStream = XdrDataOutputStream();
XdrLedgerEntryChanges.encode(xdrOutputStream, this);
return base64Encode(xdrOutputStream.bytes);
}
}

class XdrLedgerHeaderHistoryEntry {
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.5.0
version: 1.5.1
homepage: https://github.com/Soneso/stellar_flutter_sdk

environment:
Expand Down
7 changes: 0 additions & 7 deletions test/account_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ import 'tests_util.dart';
void main() {
StellarSDK sdk = StellarSDK.TESTNET;

test('test meta', () async{
String xdrStr = 'AAAAAgAAAAIAAAADAAvYfQAAAAAAAAAAgb/c3CAnOmtPd/yLjvJ/H3toSG4NRcCBj54Hh2ivmJwAAAAXSHbi7AAL2HsAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAvYfQAAAAAAAAAAgb/c3CAnOmtPd/yLjvJ/H3toSG4NRcCBj54Hh2ivmJwAAAAXSHbi7AAL2HsAAAABAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAC9h9AAAAAGPX05AAAAAAAAAADQAAAAAAAAADAAAAAwAL2H0AAAAAAAAAAIG/3NwgJzprT3f8i47yfx97aEhuDUXAgY+eB4dor5icAAAAF0h24uwAC9h7AAAAAQAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAAAvYfQAAAABj19OQAAAAAAAAAAEAC9h9AAAAAAAAAACBv9zcICc6a093/IuO8n8fe2hIbg1FwIGPngeHaK+YnAAAABcM3BjsAAvYewAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAA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cCBj54Hh2ivmJwAAAABAAAAAQAAAAAL68IAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAA';
XdrTransactionMeta meta = XdrTransactionMeta.fromBase64EncodedXdrString(xdrStr);
print(meta.toBase64EncodedXdrString());
assert(xdrStr == meta.toBase64EncodedXdrString());
});

test('test set account options', () async {
KeyPair keyPairA = KeyPair.random();
String accountAId = keyPairA.accountId;
Expand Down
14 changes: 11 additions & 3 deletions test/tests_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart';

class TestUtils {
static void resultDeAndEncodingTest(AbstractTransaction transaction, SubmitTransactionResponse response) {
String metaXdrStr = response.resultMetaXdr!;
XdrTransactionMeta meta = XdrTransactionMeta.fromBase64EncodedXdrString(metaXdrStr);
assert(metaXdrStr == meta.toBase64EncodedXdrString());
String? metaXdrStr = response.resultMetaXdr;
if (metaXdrStr != null) {
XdrTransactionMeta meta = response.getTransactionMetaResultXdr()!;
assert(metaXdrStr == meta.toBase64EncodedXdrString());
}

String envelopeXdrStr = response.envelopeXdr!;
XdrTransactionEnvelope envelope = XdrTransactionEnvelope.fromEnvelopeXdrString(envelopeXdrStr);
Expand All @@ -13,5 +15,11 @@ class TestUtils {
String resultXdrStr = response.resultXdr!;
XdrTransactionResult result = XdrTransactionResult.fromBase64EncodedXdrString(resultXdrStr);
assert(resultXdrStr == result.toBase64EncodedXdrString());

String? feeMetaXdrStr = response.feeMetaXdr;
if (feeMetaXdrStr != null) {
XdrLedgerEntryChanges changes = response.getFeeMetaXdr()!;
assert(feeMetaXdrStr == changes.toBase64EncodedXdrString());
}
}
}
Loading

0 comments on commit ea0a9f3

Please sign in to comment.