-
Notifications
You must be signed in to change notification settings - Fork 35
/
tests_util.dart
26 lines (22 loc) · 1.06 KB
/
tests_util.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart';
class TestUtils {
static void resultDeAndEncodingTest(AbstractTransaction transaction, SubmitTransactionResponse response) {
String? metaXdrStr = response.resultMetaXdr;
if (metaXdrStr != null) {
XdrTransactionMeta? meta = response.getTransactionMetaResultXdr();
assert(meta != null);
assert(metaXdrStr == meta!.toBase64EncodedXdrString());
}
String envelopeXdrStr = response.envelopeXdr!;
XdrTransactionEnvelope envelope = XdrTransactionEnvelope.fromEnvelopeXdrString(envelopeXdrStr);
assert(envelopeXdrStr == envelope.toEnvelopeXdrBase64());
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());
}
}
}