From 13c578db56647e6d1544f2909615f73f380f6156 Mon Sep 17 00:00:00 2001 From: Christian Rogobete Date: Sun, 28 Jun 2020 23:31:22 +0200 Subject: [PATCH] remove warnings and prepare release --- CHANGELOG.md | 6 + README.md | 6 +- lib/src/manage_buy_offer_operation.dart | 4 +- lib/src/manage_sell_offer_operation.dart | 4 +- lib/src/operation.dart | 2 +- lib/src/requests/request_builder.dart | 2 +- .../submit_transaction_response.dart | 2 +- lib/src/stellar_sdk.dart | 2 +- lib/src/str_key.dart | 1 - lib/src/transaction.dart | 2 +- lib/src/xdr/xdr_bucket.dart | 2 +- lib/src/xdr/xdr_data_entry.dart | 2 +- lib/src/xdr/xdr_data_io.dart | 1 - lib/src/xdr/xdr_error.dart | 3 +- lib/src/xdr/xdr_history.dart | 12 +- lib/src/xdr/xdr_ledger.dart | 22 ++-- lib/src/xdr/xdr_memo.dart | 3 +- lib/src/xdr/xdr_offer.dart | 38 +++--- lib/src/xdr/xdr_operation.dart | 57 +++++---- lib/src/xdr/xdr_other.dart | 2 +- lib/src/xdr/xdr_payment.dart | 113 ++++++++++-------- lib/src/xdr/xdr_scp.dart | 3 +- lib/src/xdr/xdr_signing.dart | 5 +- lib/src/xdr/xdr_transaction.dart | 34 +++--- lib/src/xdr/xdr_trustline.dart | 33 +++-- pubspec.yaml | 2 +- test/account_test.dart | 2 +- test/examples_test.dart | 57 ++++----- 28 files changed, 220 insertions(+), 202 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40020d6..98d0c76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [0.8.2] - 28.Jun.2020. +- Add query tests for accounts, efffects, ledgers. +- Fix ledger response parsing. +- Extend EffectsRequestBuilder for order, limit, cursor. +- remove many warnings/hints + ## [0.8.1] - 27.Jun.2020. - Add examples, app and more documentation. - Restructuring of the project. diff --git a/README.md b/README.md index 9ca84d2..e1a5173 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # [Stellar SDK for Flutter](https://github.com/Soneso/stellar_flutter_sdk) -![Beta Version](https://img.shields.io/badge/Beta-v0.8.1-yellow.svg) +![Beta Version](https://img.shields.io/badge/Beta-v0.8.2-yellow.svg) ![Dart](https://img.shields.io/badge/Dart-green.svg) ![Flutter](https://img.shields.io/badge/Flutter-blue.svg) ![Supports Stellar Horizon v1.4.0](https://img.shields.io/badge/Horizon-v1.4.0-blue.svg) @@ -8,7 +8,7 @@ The Soneso open source Stellar SDK for Flutter is build with Dart and provides APIs to build and sign transactions, connect and query [Horizon](https://github.com/stellar/horizon). -The SDK is currently in beta stage - v. 0.8.1. +The SDK is currently in beta stage - v. 0.8.2. ## Installation @@ -16,7 +16,7 @@ The SDK is currently in beta stage - v. 0.8.1. 1. Add the dependency to your pubspec.yaml file: ``` dependencies: - stellar_flutter_sdk: ^0.8.1 + stellar_flutter_sdk: ^0.8.2 ``` 2. Install it (command line or IDE): ``` diff --git a/lib/src/manage_buy_offer_operation.dart b/lib/src/manage_buy_offer_operation.dart index 3daea4c..f3ba7bf 100644 --- a/lib/src/manage_buy_offer_operation.dart +++ b/lib/src/manage_buy_offer_operation.dart @@ -24,8 +24,8 @@ class ManageBuyOfferOperation extends Operation { /// [buying] is the asset the offer creator is buying. /// [amount] is the amount of buying being bought. Set to 0 if you want to delete an existing offer. /// [price] is the price of 1 unit of buying in terms of selling. (e.g. "0.1" => pay up to 0.1 asset selling for 1 unit asset of buying). - ManageBuyOfferOperation(Asset selling, Asset buying, String amount, - String price, int offerId) { + ManageBuyOfferOperation( + Asset selling, Asset buying, String amount, String price, int offerId) { this._selling = checkNotNull(selling, "selling cannot be null"); this._buying = checkNotNull(buying, "buying cannot be null"); this._amount = checkNotNull(amount, "amount cannot be null"); diff --git a/lib/src/manage_sell_offer_operation.dart b/lib/src/manage_sell_offer_operation.dart index 44356f8..deb77bc 100644 --- a/lib/src/manage_sell_offer_operation.dart +++ b/lib/src/manage_sell_offer_operation.dart @@ -19,8 +19,8 @@ class ManageSellOfferOperation extends Operation { String _price; int _offerId; - ManageSellOfferOperation(Asset selling, Asset buying, String amount, - String price, int offerId) { + ManageSellOfferOperation( + Asset selling, Asset buying, String amount, String price, int offerId) { this._selling = checkNotNull(selling, "selling cannot be null"); this._buying = checkNotNull(buying, "buying cannot be null"); this._amount = checkNotNull(amount, "amount cannot be null"); diff --git a/lib/src/operation.dart b/lib/src/operation.dart index cf2ba72..58353d7 100644 --- a/lib/src/operation.dart +++ b/lib/src/operation.dart @@ -29,7 +29,7 @@ abstract class Operation { String _sourceAccount; - static final BigInt ONE = BigInt.from(10).pow(7); + static final BigInt one = BigInt.from(10).pow(7); static int toXdrAmount(String value) { value = checkNotNull(value, "value cannot be null"); diff --git a/lib/src/requests/request_builder.dart b/lib/src/requests/request_builder.dart index baf7deb..aad1403 100644 --- a/lib/src/requests/request_builder.dart +++ b/lib/src/requests/request_builder.dart @@ -18,7 +18,7 @@ class ErrorResponse implements Exception { ErrorResponse(this._code, this._body); String toString() { - return "Error response from the server. Code: ${_code} - Body: $body"; + return "Error response from the server. Code: $_code - Body: $body"; } int get code => _code; diff --git a/lib/src/responses/submit_transaction_response.dart b/lib/src/responses/submit_transaction_response.dart index 5aa7fef..eeb1f66 100644 --- a/lib/src/responses/submit_transaction_response.dart +++ b/lib/src/responses/submit_transaction_response.dart @@ -150,7 +150,7 @@ class SubmitTransactionUnknownResponseException implements Exception { SubmitTransactionUnknownResponseException(this._code, this._body); String toString() { - return "Unknown response from Horizon - code: ${code} - body:$body"; + return "Unknown response from Horizon - code: $code - body:$body"; } int get code => _code; diff --git a/lib/src/stellar_sdk.dart b/lib/src/stellar_sdk.dart index d41a5b9..cc77bf2 100644 --- a/lib/src/stellar_sdk.dart +++ b/lib/src/stellar_sdk.dart @@ -27,7 +27,7 @@ import 'requests/trades_request_builder.dart'; /// Main class of the flutter stellar sdk. class StellarSDK { - static const versionNumber = "0.8.0"; + static const versionNumber = "0.8.2"; static final StellarSDK PUBLIC = new StellarSDK("https://horizon.stellar.org"); diff --git a/lib/src/str_key.dart b/lib/src/str_key.dart index 602f134..8c7f25c 100644 --- a/lib/src/str_key.dart +++ b/lib/src/str_key.dart @@ -11,7 +11,6 @@ import 'transaction.dart'; import 'xdr/xdr_data_io.dart'; import 'xdr/xdr_signing.dart'; import 'xdr/xdr_type.dart'; -import 'xdr/xdr_other.dart'; class VersionByte { final _value; diff --git a/lib/src/transaction.dart b/lib/src/transaction.dart index 8daaabc..9212fee 100644 --- a/lib/src/transaction.dart +++ b/lib/src/transaction.dart @@ -20,7 +20,7 @@ import 'account.dart'; abstract class AbstractTransaction { Network _mNetwork; List _mSignatures; - static final int MIN_BASE_FEE = 100; + static const int MIN_BASE_FEE = 100; AbstractTransaction(Network network) { _mNetwork = checkNotNull(network, "network cannot be null"); diff --git a/lib/src/xdr/xdr_bucket.dart b/lib/src/xdr/xdr_bucket.dart index 634c8e9..ccb7ffa 100644 --- a/lib/src/xdr/xdr_bucket.dart +++ b/lib/src/xdr/xdr_bucket.dart @@ -88,4 +88,4 @@ class XdrBucketEntry { } return decodedBucketEntry; } -} \ No newline at end of file +} diff --git a/lib/src/xdr/xdr_data_entry.dart b/lib/src/xdr/xdr_data_entry.dart index 96ad26f..a0c9a4a 100644 --- a/lib/src/xdr/xdr_data_entry.dart +++ b/lib/src/xdr/xdr_data_entry.dart @@ -88,4 +88,4 @@ class XdrDataValue { decodedDataValue.dataValue = stream.readBytes(dataValuesize); return decodedDataValue; } -} \ No newline at end of file +} diff --git a/lib/src/xdr/xdr_data_io.dart b/lib/src/xdr/xdr_data_io.dart index 6f105ba..5d13015 100644 --- a/lib/src/xdr/xdr_data_io.dart +++ b/lib/src/xdr/xdr_data_io.dart @@ -166,7 +166,6 @@ class DataInput { } } - class DataOutput { List data = List(); int offset = 0; diff --git a/lib/src/xdr/xdr_error.dart b/lib/src/xdr/xdr_error.dart index c6443b1..c188e96 100644 --- a/lib/src/xdr/xdr_error.dart +++ b/lib/src/xdr/xdr_error.dart @@ -40,7 +40,6 @@ class XdrErrorCode { } } - class XdrError { XdrError(); XdrErrorCode _code; @@ -62,4 +61,4 @@ class XdrError { decodedError.msg = stream.readString(); return decodedError; } -} \ No newline at end of file +} diff --git a/lib/src/xdr/xdr_history.dart b/lib/src/xdr/xdr_history.dart index 5a66b96..587d3ab 100644 --- a/lib/src/xdr/xdr_history.dart +++ b/lib/src/xdr/xdr_history.dart @@ -100,7 +100,7 @@ class XdrTransactionHistoryEntry { static XdrTransactionHistoryEntry decode(XdrDataInputStream stream) { XdrTransactionHistoryEntry decodedTransactionHistoryEntry = - XdrTransactionHistoryEntry(); + XdrTransactionHistoryEntry(); decodedTransactionHistoryEntry.ledgerSeq = XdrUint32.decode(stream); decodedTransactionHistoryEntry.txSet = XdrTransactionSet.decode(stream); decodedTransactionHistoryEntry.ext = @@ -126,7 +126,7 @@ class XdrTransactionHistoryEntryExt { static XdrTransactionHistoryEntryExt decode(XdrDataInputStream stream) { XdrTransactionHistoryEntryExt decodedTransactionHistoryEntryExt = - XdrTransactionHistoryEntryExt(); + XdrTransactionHistoryEntryExt(); int discriminant = stream.readInt(); decodedTransactionHistoryEntryExt.discriminant = discriminant; switch (decodedTransactionHistoryEntryExt.discriminant) { @@ -162,7 +162,7 @@ class XdrTransactionHistoryResultEntry { static XdrTransactionHistoryResultEntry decode(XdrDataInputStream stream) { XdrTransactionHistoryResultEntry decodedTransactionHistoryResultEntry = - XdrTransactionHistoryResultEntry(); + XdrTransactionHistoryResultEntry(); decodedTransactionHistoryResultEntry.ledgerSeq = XdrUint32.decode(stream); decodedTransactionHistoryResultEntry.txResultSet = XdrTransactionResultSet.decode(stream); @@ -181,7 +181,7 @@ class XdrTransactionHistoryResultEntryExt { static void encode( XdrDataOutputStream stream, XdrTransactionHistoryResultEntryExt - encodedTransactionHistoryResultEntryExt) { + encodedTransactionHistoryResultEntryExt) { stream.writeInt(encodedTransactionHistoryResultEntryExt.discriminant); switch (encodedTransactionHistoryResultEntryExt.discriminant) { case 0: @@ -191,8 +191,8 @@ class XdrTransactionHistoryResultEntryExt { static XdrTransactionHistoryResultEntryExt decode(XdrDataInputStream stream) { XdrTransactionHistoryResultEntryExt - decodedTransactionHistoryResultEntryExt = - XdrTransactionHistoryResultEntryExt(); + decodedTransactionHistoryResultEntryExt = + XdrTransactionHistoryResultEntryExt(); int discriminant = stream.readInt(); decodedTransactionHistoryResultEntryExt.discriminant = discriminant; switch (decodedTransactionHistoryResultEntryExt.discriminant) { diff --git a/lib/src/xdr/xdr_ledger.dart b/lib/src/xdr/xdr_ledger.dart index 459b920..aca270c 100644 --- a/lib/src/xdr/xdr_ledger.dart +++ b/lib/src/xdr/xdr_ledger.dart @@ -12,7 +12,6 @@ import 'xdr_asset.dart'; import 'xdr_scp.dart'; import 'xdr_account.dart'; - class XdrLedgerEntryChangeType { final _value; const XdrLedgerEntryChangeType._internal(this._value); @@ -21,11 +20,11 @@ class XdrLedgerEntryChangeType { get value => this._value; static const LEDGER_ENTRY_CREATED = - const XdrLedgerEntryChangeType._internal(0); + const XdrLedgerEntryChangeType._internal(0); static const LEDGER_ENTRY_UPDATED = - const XdrLedgerEntryChangeType._internal(1); + const XdrLedgerEntryChangeType._internal(1); static const LEDGER_ENTRY_REMOVED = - const XdrLedgerEntryChangeType._internal(2); + const XdrLedgerEntryChangeType._internal(2); static const LEDGER_ENTRY_STATE = const XdrLedgerEntryChangeType._internal(3); static XdrLedgerEntryChangeType decode(XdrDataInputStream stream) { @@ -92,11 +91,11 @@ class XdrLedgerUpgradeType { static const LEDGER_UPGRADE_VERSION = const XdrLedgerUpgradeType._internal(1); static const LEDGER_UPGRADE_BASE_FEE = - const XdrLedgerUpgradeType._internal(2); + const XdrLedgerUpgradeType._internal(2); static const LEDGER_UPGRADE_MAX_TX_SET_SIZE = - const XdrLedgerUpgradeType._internal(3); + const XdrLedgerUpgradeType._internal(3); static const LEDGER_UPGRADE_BASE_RESERVE = - const XdrLedgerUpgradeType._internal(4); + const XdrLedgerUpgradeType._internal(4); static XdrLedgerUpgradeType decode(XdrDataInputStream stream) { int value = stream.readInt(); @@ -503,7 +502,6 @@ class XdrLedgerUpgrade { } } - class XdrLedgerEntry { XdrLedgerEntry(); XdrUint32 _lastModifiedLedgerSeq; @@ -669,7 +667,7 @@ class XdrLedgerEntryChange { static XdrLedgerEntryChange decode(XdrDataInputStream stream) { XdrLedgerEntryChange decodedLedgerEntryChange = XdrLedgerEntryChange(); XdrLedgerEntryChangeType discriminant = - XdrLedgerEntryChangeType.decode(stream); + XdrLedgerEntryChangeType.decode(stream); decodedLedgerEntryChange.discriminant = discriminant; switch (decodedLedgerEntryChange.discriminant) { case XdrLedgerEntryChangeType.LEDGER_ENTRY_CREATED: @@ -743,7 +741,7 @@ class XdrLedgerHeaderHistoryEntry { static XdrLedgerHeaderHistoryEntry decode(XdrDataInputStream stream) { XdrLedgerHeaderHistoryEntry decodedLedgerHeaderHistoryEntry = - XdrLedgerHeaderHistoryEntry(); + XdrLedgerHeaderHistoryEntry(); decodedLedgerHeaderHistoryEntry.hash = XdrHash.decode(stream); decodedLedgerHeaderHistoryEntry.header = XdrLedgerHeader.decode(stream); decodedLedgerHeaderHistoryEntry.ext = @@ -769,7 +767,7 @@ class XdrLedgerHeaderHistoryEntryExt { static XdrLedgerHeaderHistoryEntryExt decode(XdrDataInputStream stream) { XdrLedgerHeaderHistoryEntryExt decodedLedgerHeaderHistoryEntryExt = - XdrLedgerHeaderHistoryEntryExt(); + XdrLedgerHeaderHistoryEntryExt(); int discriminant = stream.readInt(); decodedLedgerHeaderHistoryEntryExt.discriminant = discriminant; switch (decodedLedgerHeaderHistoryEntryExt.discriminant) { @@ -778,4 +776,4 @@ class XdrLedgerHeaderHistoryEntryExt { } return decodedLedgerHeaderHistoryEntryExt; } -} \ No newline at end of file +} diff --git a/lib/src/xdr/xdr_memo.dart b/lib/src/xdr/xdr_memo.dart index 1651cb0..afe64f6 100644 --- a/lib/src/xdr/xdr_memo.dart +++ b/lib/src/xdr/xdr_memo.dart @@ -41,7 +41,6 @@ class XdrMemoType { } } - class XdrMemo { XdrMemo(); XdrMemoType _type; @@ -106,4 +105,4 @@ class XdrMemo { } return decodedMemo; } -} \ No newline at end of file +} diff --git a/lib/src/xdr/xdr_offer.dart b/lib/src/xdr/xdr_offer.dart index a919ae4..443baad 100644 --- a/lib/src/xdr/xdr_offer.dart +++ b/lib/src/xdr/xdr_offer.dart @@ -179,7 +179,7 @@ class XdrCreatePassiveSellOfferOp { static XdrCreatePassiveSellOfferOp decode(XdrDataInputStream stream) { XdrCreatePassiveSellOfferOp decodedCreatePassiveOfferOp = - XdrCreatePassiveSellOfferOp(); + XdrCreatePassiveSellOfferOp(); decodedCreatePassiveOfferOp.selling = XdrAsset.decode(stream); decodedCreatePassiveOfferOp.buying = XdrAsset.decode(stream); decodedCreatePassiveOfferOp.amount = XdrInt64.decode(stream); @@ -188,7 +188,6 @@ class XdrCreatePassiveSellOfferOp { } } - class XdrManageBuyOfferOp { XdrManageBuyOfferOp(); XdrAsset _selling; @@ -299,7 +298,7 @@ class XdrManageOfferResult { static XdrManageOfferResult decode(XdrDataInputStream stream) { XdrManageOfferResult decodedManageOfferResult = XdrManageOfferResult(); XdrManageOfferResultCode discriminant = - XdrManageOfferResultCode.decode(stream); + XdrManageOfferResultCode.decode(stream); decodedManageOfferResult.discriminant = discriminant; switch (decodedManageOfferResult.discriminant) { case XdrManageOfferResultCode.MANAGE_OFFER_SUCCESS: @@ -339,7 +338,7 @@ class XdrManageOfferSuccessResult { static XdrManageOfferSuccessResult decode(XdrDataInputStream stream) { XdrManageOfferSuccessResult decodedManageOfferSuccessResult = - XdrManageOfferSuccessResult(); + XdrManageOfferSuccessResult(); int offersClaimedsize = stream.readInt(); decodedManageOfferSuccessResult.offersClaimed = List(offersClaimedsize); @@ -379,7 +378,7 @@ class XdrManageOfferSuccessResultOffer { static XdrManageOfferSuccessResultOffer decode(XdrDataInputStream stream) { XdrManageOfferSuccessResultOffer decodedManageOfferSuccessResultOffer = - XdrManageOfferSuccessResultOffer(); + XdrManageOfferSuccessResultOffer(); XdrManageOfferEffect discriminant = XdrManageOfferEffect.decode(stream); decodedManageOfferSuccessResultOffer.discriminant = discriminant; switch (decodedManageOfferSuccessResultOffer.discriminant) { @@ -395,7 +394,6 @@ class XdrManageOfferSuccessResultOffer { } } - class XdrManageOfferResultCode { final _value; const XdrManageOfferResultCode._internal(this._value); @@ -405,55 +403,55 @@ class XdrManageOfferResultCode { /// Success. static const MANAGE_OFFER_SUCCESS = - const XdrManageOfferResultCode._internal(0); + const XdrManageOfferResultCode._internal(0); /// Generated offer would be invalid. static const MANAGE_OFFER_MALFORMED = - const XdrManageOfferResultCode._internal(-1); + const XdrManageOfferResultCode._internal(-1); /// No trust line for what we're selling. static const MANAGE_OFFER_SELL_NO_TRUST = - const XdrManageOfferResultCode._internal(-2); + const XdrManageOfferResultCode._internal(-2); /// No trust line for what we're buying. static const MANAGE_OFFER_BUY_NO_TRUST = - const XdrManageOfferResultCode._internal(-3); + const XdrManageOfferResultCode._internal(-3); /// Not authorized to sell. static const MANAGE_OFFER_SELL_NOT_AUTHORIZED = - const XdrManageOfferResultCode._internal(-4); + const XdrManageOfferResultCode._internal(-4); /// Not authorized to buy. static const MANAGE_OFFER_BUY_NOT_AUTHORIZED = - const XdrManageOfferResultCode._internal(-5); + const XdrManageOfferResultCode._internal(-5); /// Can't receive more of what it's buying. static const MANAGE_OFFER_LINE_FULL = - const XdrManageOfferResultCode._internal(-6); + const XdrManageOfferResultCode._internal(-6); /// Doesn't hold what it's trying to sell. static const MANAGE_OFFER_UNDERFUNDED = - const XdrManageOfferResultCode._internal(-7); + const XdrManageOfferResultCode._internal(-7); /// Would cross an offer from the same user. static const MANAGE_OFFER_CROSS_SELF = - const XdrManageOfferResultCode._internal(-8); + const XdrManageOfferResultCode._internal(-8); /// No issuer for what we're selling. static const MANAGE_OFFER_SELL_NO_ISSUER = - const XdrManageOfferResultCode._internal(-9); + const XdrManageOfferResultCode._internal(-9); /// No issuer for what we're buying. static const MANAGE_OFFER_BUY_NO_ISSUER = - const XdrManageOfferResultCode._internal(-10); + const XdrManageOfferResultCode._internal(-10); /// OfferID does not match an existing offer. static const MANAGE_OFFER_NOT_FOUND = - const XdrManageOfferResultCode._internal(-11); + const XdrManageOfferResultCode._internal(-11); /// Not enough funds to create a new Offer. static const MANAGE_OFFER_LOW_RESERVE = - const XdrManageOfferResultCode._internal(-12); + const XdrManageOfferResultCode._internal(-12); static XdrManageOfferResultCode decode(XdrDataInputStream stream) { int value = stream.readInt(); @@ -493,4 +491,4 @@ class XdrManageOfferResultCode { XdrDataOutputStream stream, XdrManageOfferResultCode value) { stream.writeInt(value.value); } -} \ No newline at end of file +} diff --git a/lib/src/xdr/xdr_operation.dart b/lib/src/xdr/xdr_operation.dart index e630baf..6a5a7c3 100644 --- a/lib/src/xdr/xdr_operation.dart +++ b/lib/src/xdr/xdr_operation.dart @@ -18,7 +18,8 @@ class XdrOperationType { static const CREATE_ACCOUNT = const XdrOperationType._internal(0); static const PAYMENT = const XdrOperationType._internal(1); - static const PATH_PAYMENT_STRICT_RECEIVE = const XdrOperationType._internal(2); + static const PATH_PAYMENT_STRICT_RECEIVE = + const XdrOperationType._internal(2); static const MANAGE_SELL_OFFER = const XdrOperationType._internal(3); static const CREATE_PASSIVE_SELL_OFFER = const XdrOperationType._internal(4); static const SET_OPTIONS = const XdrOperationType._internal(5); @@ -120,20 +121,26 @@ class XdrOperationBody { set paymentOp(XdrPaymentOp value) => this._paymentOp = value; XdrPathPaymentStrictReceiveOp _pathPaymentStrictReceiveOp; - XdrPathPaymentStrictReceiveOp get pathPaymentStrictReceiveOp => this._pathPaymentStrictReceiveOp; - set pathPaymentStrictReceiveOp(XdrPathPaymentStrictReceiveOp value) => this._pathPaymentStrictReceiveOp = value; + XdrPathPaymentStrictReceiveOp get pathPaymentStrictReceiveOp => + this._pathPaymentStrictReceiveOp; + set pathPaymentStrictReceiveOp(XdrPathPaymentStrictReceiveOp value) => + this._pathPaymentStrictReceiveOp = value; XdrPathPaymentStrictSendOp _pathPaymentStrictSendOp; - XdrPathPaymentStrictSendOp get pathPaymentStrictSendOp => this._pathPaymentStrictSendOp; - set pathPaymentStrictSendOp(XdrPathPaymentStrictSendOp value) => this._pathPaymentStrictSendOp = value; + XdrPathPaymentStrictSendOp get pathPaymentStrictSendOp => + this._pathPaymentStrictSendOp; + set pathPaymentStrictSendOp(XdrPathPaymentStrictSendOp value) => + this._pathPaymentStrictSendOp = value; XdrManageBuyOfferOp _manageBuyOfferOp; XdrManageBuyOfferOp get manageBuyOfferOp => this._manageBuyOfferOp; - set manageBuyOfferOp(XdrManageBuyOfferOp value) => this._manageBuyOfferOp = value; + set manageBuyOfferOp(XdrManageBuyOfferOp value) => + this._manageBuyOfferOp = value; XdrManageSellOfferOp _manageSellOfferOp; XdrManageSellOfferOp get manageSellOfferOp => this._manageSellOfferOp; - set manageSellOfferOp(XdrManageSellOfferOp value) => this._manageSellOfferOp = value; + set manageSellOfferOp(XdrManageSellOfferOp value) => + this._manageSellOfferOp = value; XdrCreatePassiveSellOfferOp _createPassiveSellOfferOp; XdrCreatePassiveSellOfferOp get createPassiveSellOfferOp => @@ -176,10 +183,12 @@ class XdrOperationBody { XdrPaymentOp.encode(stream, encodedOperationBody.paymentOp); break; case XdrOperationType.PATH_PAYMENT_STRICT_RECEIVE: - XdrPathPaymentStrictReceiveOp.encode(stream, encodedOperationBody.pathPaymentStrictReceiveOp); + XdrPathPaymentStrictReceiveOp.encode( + stream, encodedOperationBody.pathPaymentStrictReceiveOp); break; case XdrOperationType.MANAGE_SELL_OFFER: - XdrManageSellOfferOp.encode(stream, encodedOperationBody.manageSellOfferOp); + XdrManageSellOfferOp.encode( + stream, encodedOperationBody.manageSellOfferOp); break; case XdrOperationType.CREATE_PASSIVE_SELL_OFFER: XdrCreatePassiveSellOfferOp.encode( @@ -206,10 +215,12 @@ class XdrOperationBody { XdrBumpSequenceOp.encode(stream, encodedOperationBody.bumpSequenceOp); break; case XdrOperationType.MANAGE_BUY_OFFER: - XdrManageBuyOfferOp.encode(stream, encodedOperationBody.manageBuyOfferOp); + XdrManageBuyOfferOp.encode( + stream, encodedOperationBody.manageBuyOfferOp); break; case XdrOperationType.PATH_PAYMENT_STRICT_SEND: - XdrPathPaymentStrictSendOp.encode(stream, encodedOperationBody.pathPaymentStrictSendOp); + XdrPathPaymentStrictSendOp.encode( + stream, encodedOperationBody.pathPaymentStrictSendOp); break; } } @@ -227,10 +238,12 @@ class XdrOperationBody { decodedOperationBody.paymentOp = XdrPaymentOp.decode(stream); break; case XdrOperationType.PATH_PAYMENT_STRICT_RECEIVE: - decodedOperationBody.pathPaymentStrictReceiveOp = XdrPathPaymentStrictReceiveOp.decode(stream); + decodedOperationBody.pathPaymentStrictReceiveOp = + XdrPathPaymentStrictReceiveOp.decode(stream); break; case XdrOperationType.MANAGE_SELL_OFFER: - decodedOperationBody.manageSellOfferOp = XdrManageSellOfferOp.decode(stream); + decodedOperationBody.manageSellOfferOp = + XdrManageSellOfferOp.decode(stream); break; case XdrOperationType.CREATE_PASSIVE_SELL_OFFER: decodedOperationBody.createPassiveOfferOp = @@ -257,10 +270,12 @@ class XdrOperationBody { decodedOperationBody.bumpSequenceOp = XdrBumpSequenceOp.decode(stream); break; case XdrOperationType.MANAGE_BUY_OFFER: - decodedOperationBody.manageBuyOfferOp = XdrManageBuyOfferOp.decode(stream); + decodedOperationBody.manageBuyOfferOp = + XdrManageBuyOfferOp.decode(stream); break; case XdrOperationType.PATH_PAYMENT_STRICT_SEND: - decodedOperationBody.pathPaymentStrictSendOp = XdrPathPaymentStrictSendOp.decode(stream); + decodedOperationBody.pathPaymentStrictSendOp = + XdrPathPaymentStrictSendOp.decode(stream); break; } return decodedOperationBody; @@ -338,12 +353,14 @@ class XdrOperationResultTr { set paymentResult(XdrPaymentResult value) => this._paymentResult = value; XdrPathPaymentStrictReceiveResult _pathPaymentStrictReceiveResult; - XdrPathPaymentStrictReceiveResult get pathPaymentStrictReceiveResult => this._pathPaymentStrictReceiveResult; + XdrPathPaymentStrictReceiveResult get pathPaymentStrictReceiveResult => + this._pathPaymentStrictReceiveResult; set pathPaymentStrictReceiveResult(XdrPathPaymentStrictReceiveResult value) => this._pathPaymentStrictReceiveResult = value; XdrPathPaymentStrictSendResult _pathPaymentStrictSendResult; - XdrPathPaymentStrictSendResult get pathPaymentStrictSendResult => this._pathPaymentStrictSendResult; + XdrPathPaymentStrictSendResult get pathPaymentStrictSendResult => + this._pathPaymentStrictSendResult; set pathPaymentStrictSendResult(XdrPathPaymentStrictSendResult value) => this._pathPaymentStrictSendResult = value; @@ -541,11 +558,11 @@ class XdrOperationResultCode { /// Max number of subentries already reached. static const opTOO_MANY_SUBENTRIES = - const XdrOperationResultCode._internal(-4); + const XdrOperationResultCode._internal(-4); /// Operation did too much work. static const opEXCEEDED_WORK_LIMIT = - const XdrOperationResultCode._internal(-5); + const XdrOperationResultCode._internal(-5); static XdrOperationResultCode decode(XdrDataInputStream stream) { int value = stream.readInt(); @@ -570,4 +587,4 @@ class XdrOperationResultCode { static void encode(XdrDataOutputStream stream, XdrOperationResultCode value) { stream.writeInt(value.value); } -} \ No newline at end of file +} diff --git a/lib/src/xdr/xdr_other.dart b/lib/src/xdr/xdr_other.dart index 031b9ae..3c52a20 100644 --- a/lib/src/xdr/xdr_other.dart +++ b/lib/src/xdr/xdr_other.dart @@ -496,4 +496,4 @@ class XdrStellarValueExt { } return decodedStellarValueExt; } -} \ No newline at end of file +} diff --git a/lib/src/xdr/xdr_payment.dart b/lib/src/xdr/xdr_payment.dart index b231e8b..aa0fe28 100644 --- a/lib/src/xdr/xdr_payment.dart +++ b/lib/src/xdr/xdr_payment.dart @@ -34,8 +34,8 @@ class XdrPathPaymentStrictReceiveOp { List get path => this._path; set path(List value) => this._path = value; - static void encode( - XdrDataOutputStream stream, XdrPathPaymentStrictReceiveOp encodedPathPaymentOp) { + static void encode(XdrDataOutputStream stream, + XdrPathPaymentStrictReceiveOp encodedPathPaymentOp) { XdrAsset.encode(stream, encodedPathPaymentOp.sendAsset); XdrInt64.encode(stream, encodedPathPaymentOp.sendMax); XdrAccountID.encode(stream, encodedPathPaymentOp.destination); @@ -49,7 +49,8 @@ class XdrPathPaymentStrictReceiveOp { } static XdrPathPaymentStrictReceiveOp decode(XdrDataInputStream stream) { - XdrPathPaymentStrictReceiveOp decodedPathPaymentOp = XdrPathPaymentStrictReceiveOp(); + XdrPathPaymentStrictReceiveOp decodedPathPaymentOp = + XdrPathPaymentStrictReceiveOp(); decodedPathPaymentOp.sendAsset = XdrAsset.decode(stream); decodedPathPaymentOp.sendMax = XdrInt64.decode(stream); decodedPathPaymentOp.destination = XdrAccountID.decode(stream); @@ -90,8 +91,8 @@ class XdrPathPaymentStrictSendOp { List get path => this._path; set path(List value) => this._path = value; - static void encode( - XdrDataOutputStream stream, XdrPathPaymentStrictSendOp encodedPathPaymentOp) { + static void encode(XdrDataOutputStream stream, + XdrPathPaymentStrictSendOp encodedPathPaymentOp) { XdrAsset.encode(stream, encodedPathPaymentOp.sendAsset); XdrInt64.encode(stream, encodedPathPaymentOp.sendMax); XdrAccountID.encode(stream, encodedPathPaymentOp.destination); @@ -105,7 +106,8 @@ class XdrPathPaymentStrictSendOp { } static XdrPathPaymentStrictSendOp decode(XdrDataInputStream stream) { - XdrPathPaymentStrictSendOp decodedPathPaymentOp = XdrPathPaymentStrictSendOp(); + XdrPathPaymentStrictSendOp decodedPathPaymentOp = + XdrPathPaymentStrictSendOp(); decodedPathPaymentOp.sendAsset = XdrAsset.decode(stream); decodedPathPaymentOp.sendMax = XdrInt64.decode(stream); decodedPathPaymentOp.destination = XdrAccountID.decode(stream); @@ -124,7 +126,8 @@ class XdrPathPaymentStrictReceiveResult { XdrPathPaymentStrictReceiveResult(); XdrPathPaymentStrictReceiveResultCode _code; XdrPathPaymentStrictReceiveResultCode get discriminant => this._code; - set discriminant(XdrPathPaymentStrictReceiveResultCode value) => this._code = value; + set discriminant(XdrPathPaymentStrictReceiveResultCode value) => + this._code = value; XdrPathPaymentResultSuccess _success; XdrPathPaymentResultSuccess get success => this._success; @@ -138,11 +141,13 @@ class XdrPathPaymentStrictReceiveResult { XdrPathPaymentStrictReceiveResult encodedPathPaymentResult) { stream.writeInt(encodedPathPaymentResult.discriminant.value); switch (encodedPathPaymentResult.discriminant) { - case XdrPathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_SUCCESS: + case XdrPathPaymentStrictReceiveResultCode + .PATH_PAYMENT_STRICT_RECEIVE_SUCCESS: XdrPathPaymentResultSuccess.encode( stream, encodedPathPaymentResult.success); break; - case XdrPathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER: + case XdrPathPaymentStrictReceiveResultCode + .PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER: XdrAsset.encode(stream, encodedPathPaymentResult.noIssuer); break; default: @@ -151,16 +156,19 @@ class XdrPathPaymentStrictReceiveResult { } static XdrPathPaymentStrictReceiveResult decode(XdrDataInputStream stream) { - XdrPathPaymentStrictReceiveResult decodedPathPaymentResult = XdrPathPaymentStrictReceiveResult(); + XdrPathPaymentStrictReceiveResult decodedPathPaymentResult = + XdrPathPaymentStrictReceiveResult(); XdrPathPaymentStrictReceiveResultCode discriminant = - XdrPathPaymentStrictReceiveResultCode.decode(stream); + XdrPathPaymentStrictReceiveResultCode.decode(stream); decodedPathPaymentResult.discriminant = discriminant; switch (decodedPathPaymentResult.discriminant) { - case XdrPathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_SUCCESS: + case XdrPathPaymentStrictReceiveResultCode + .PATH_PAYMENT_STRICT_RECEIVE_SUCCESS: decodedPathPaymentResult.success = XdrPathPaymentResultSuccess.decode(stream); break; - case XdrPathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER: + case XdrPathPaymentStrictReceiveResultCode + .PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER: decodedPathPaymentResult.noIssuer = XdrAsset.decode(stream); break; default: @@ -174,7 +182,8 @@ class XdrPathPaymentStrictSendResult { XdrPathPaymentStrictSendResult(); XdrPathPaymentStrictSendResultCode _code; XdrPathPaymentStrictSendResultCode get discriminant => this._code; - set discriminant(XdrPathPaymentStrictSendResultCode value) => this._code = value; + set discriminant(XdrPathPaymentStrictSendResultCode value) => + this._code = value; XdrPathPaymentResultSuccess _success; XdrPathPaymentResultSuccess get success => this._success; @@ -192,7 +201,8 @@ class XdrPathPaymentStrictSendResult { XdrPathPaymentResultSuccess.encode( stream, encodedPathPaymentResult.success); break; - case XdrPathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_NO_ISSUER: + case XdrPathPaymentStrictSendResultCode + .PATH_PAYMENT_STRICT_SEND_NO_ISSUER: XdrAsset.encode(stream, encodedPathPaymentResult.noIssuer); break; default: @@ -201,16 +211,18 @@ class XdrPathPaymentStrictSendResult { } static XdrPathPaymentStrictSendResult decode(XdrDataInputStream stream) { - XdrPathPaymentStrictSendResult decodedPathPaymentResult = XdrPathPaymentStrictSendResult(); + XdrPathPaymentStrictSendResult decodedPathPaymentResult = + XdrPathPaymentStrictSendResult(); XdrPathPaymentStrictSendResultCode discriminant = - XdrPathPaymentStrictSendResultCode.decode(stream); + XdrPathPaymentStrictSendResultCode.decode(stream); decodedPathPaymentResult.discriminant = discriminant; switch (decodedPathPaymentResult.discriminant) { case XdrPathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_SUCCESS: decodedPathPaymentResult.success = XdrPathPaymentResultSuccess.decode(stream); break; - case XdrPathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_NO_ISSUER: + case XdrPathPaymentStrictSendResultCode + .PATH_PAYMENT_STRICT_SEND_NO_ISSUER: decodedPathPaymentResult.noIssuer = XdrAsset.decode(stream); break; default: @@ -229,55 +241,55 @@ class XdrPathPaymentStrictReceiveResultCode { /// Success. static const PATH_PAYMENT_STRICT_RECEIVE_SUCCESS = - const XdrPathPaymentStrictReceiveResultCode._internal(0); + const XdrPathPaymentStrictReceiveResultCode._internal(0); /// Bad input. static const PATH_PAYMENT_STRICT_RECEIVE_MALFORMED = - const XdrPathPaymentStrictReceiveResultCode._internal(-1); + const XdrPathPaymentStrictReceiveResultCode._internal(-1); /// Not enough funds in source account. static const PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED = - const XdrPathPaymentStrictReceiveResultCode._internal(-2); + const XdrPathPaymentStrictReceiveResultCode._internal(-2); /// No trust line on source account. static const PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST = - const XdrPathPaymentStrictReceiveResultCode._internal(-3); + const XdrPathPaymentStrictReceiveResultCode._internal(-3); /// Source not authorized to transfer. static const PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED = - const XdrPathPaymentStrictReceiveResultCode._internal(-4); + const XdrPathPaymentStrictReceiveResultCode._internal(-4); /// Destination account does not exist. static const PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION = - const XdrPathPaymentStrictReceiveResultCode._internal(-5); + const XdrPathPaymentStrictReceiveResultCode._internal(-5); /// Dest missing a trust line for asset. static const PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST = - const XdrPathPaymentStrictReceiveResultCode._internal(-6); + const XdrPathPaymentStrictReceiveResultCode._internal(-6); /// Dest not authorized to hold asset. static const PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED = - const XdrPathPaymentStrictReceiveResultCode._internal(-7); + const XdrPathPaymentStrictReceiveResultCode._internal(-7); /// Dest would go above their limit. static const PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL = - const XdrPathPaymentStrictReceiveResultCode._internal(-8); + const XdrPathPaymentStrictReceiveResultCode._internal(-8); /// Missing issuer on one asset. static const PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER = - const XdrPathPaymentStrictReceiveResultCode._internal(-9); + const XdrPathPaymentStrictReceiveResultCode._internal(-9); /// Not enough offers to satisfy path. static const PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS = - const XdrPathPaymentStrictReceiveResultCode._internal(-10); + const XdrPathPaymentStrictReceiveResultCode._internal(-10); /// Would cross one of its own offers. static const PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF = - const XdrPathPaymentStrictReceiveResultCode._internal(-11); + const XdrPathPaymentStrictReceiveResultCode._internal(-11); /// Could not satisfy sendmax. static const PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX = - const XdrPathPaymentStrictReceiveResultCode._internal(-12); + const XdrPathPaymentStrictReceiveResultCode._internal(-12); static XdrPathPaymentStrictReceiveResultCode decode( XdrDataInputStream stream) { @@ -329,55 +341,55 @@ class XdrPathPaymentStrictSendResultCode { /// Success. static const PATH_PAYMENT_STRICT_SEND_SUCCESS = - const XdrPathPaymentStrictSendResultCode._internal(0); + const XdrPathPaymentStrictSendResultCode._internal(0); /// Bad input. static const PATH_PAYMENT_STRICT_SEND_MALFORMED = - const XdrPathPaymentStrictSendResultCode._internal(-1); + const XdrPathPaymentStrictSendResultCode._internal(-1); /// Not enough funds in source account. static const PATH_PAYMENT_STRICT_SEND_UNDERFUNDED = - const XdrPathPaymentStrictSendResultCode._internal(-2); + const XdrPathPaymentStrictSendResultCode._internal(-2); /// No trust line on source account. static const PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST = - const XdrPathPaymentStrictSendResultCode._internal(-3); + const XdrPathPaymentStrictSendResultCode._internal(-3); /// Source not authorized to transfer. static const PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED = - const XdrPathPaymentStrictSendResultCode._internal(-4); + const XdrPathPaymentStrictSendResultCode._internal(-4); /// Destination account does not exist. static const PATH_PAYMENT_STRICT_SEND_NO_DESTINATION = - const XdrPathPaymentStrictSendResultCode._internal(-5); + const XdrPathPaymentStrictSendResultCode._internal(-5); /// Dest missing a trust line for asset. static const PATH_PAYMENT_STRICT_SEND_NO_TRUST = - const XdrPathPaymentStrictSendResultCode._internal(-6); + const XdrPathPaymentStrictSendResultCode._internal(-6); /// Dest not authorized to hold asset. static const PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED = - const XdrPathPaymentStrictSendResultCode._internal(-7); + const XdrPathPaymentStrictSendResultCode._internal(-7); /// Dest would go above their limit. static const PATH_PAYMENT_STRICT_SEND_LINE_FULL = - const XdrPathPaymentStrictSendResultCode._internal(-8); + const XdrPathPaymentStrictSendResultCode._internal(-8); /// Missing issuer on one asset. static const PATH_PAYMENT_STRICT_SEND_NO_ISSUER = - const XdrPathPaymentStrictSendResultCode._internal(-9); + const XdrPathPaymentStrictSendResultCode._internal(-9); /// Not enough offers to satisfy path. static const PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS = - const XdrPathPaymentStrictSendResultCode._internal(-10); + const XdrPathPaymentStrictSendResultCode._internal(-10); /// Would cross one of its own offers. static const PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF = - const XdrPathPaymentStrictSendResultCode._internal(-11); + const XdrPathPaymentStrictSendResultCode._internal(-11); /// Could not satisfy destMin. static const PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN = - const XdrPathPaymentStrictSendResultCode._internal(-12); + const XdrPathPaymentStrictSendResultCode._internal(-12); static XdrPathPaymentStrictSendResultCode decode(XdrDataInputStream stream) { int value = stream.readInt(); @@ -442,7 +454,7 @@ class XdrPathPaymentResultSuccess { static XdrPathPaymentResultSuccess decode(XdrDataInputStream stream) { XdrPathPaymentResultSuccess decodedPathPaymentResultSuccess = - XdrPathPaymentResultSuccess(); + XdrPathPaymentResultSuccess(); int offerssize = stream.readInt(); decodedPathPaymentResultSuccess.offers = List(offerssize); @@ -479,7 +491,7 @@ class XdrSimplePaymentResult { static XdrSimplePaymentResult decode(XdrDataInputStream stream) { XdrSimplePaymentResult decodedSimplePaymentResult = - XdrSimplePaymentResult(); + XdrSimplePaymentResult(); decodedSimplePaymentResult.destination = XdrAccountID.decode(stream); decodedSimplePaymentResult.asset = XdrAsset.decode(stream); decodedSimplePaymentResult.amount = XdrInt64.decode(stream); @@ -548,7 +560,6 @@ class XdrPaymentResult { } } - class XdrPaymentResultCode { final _value; const XdrPaymentResultCode._internal(this._value); @@ -570,18 +581,18 @@ class XdrPaymentResultCode { /// Source not authorized to transfer. static const PAYMENT_SRC_NOT_AUTHORIZED = - const XdrPaymentResultCode._internal(-4); + const XdrPaymentResultCode._internal(-4); /// Destination account does not exist. static const PAYMENT_NO_DESTINATION = - const XdrPaymentResultCode._internal(-5); + const XdrPaymentResultCode._internal(-5); /// Destination missing a trust line for asset. static const PAYMENT_NO_TRUST = const XdrPaymentResultCode._internal(-6); /// Destination not authorized to hold asset. static const PAYMENT_NOT_AUTHORIZED = - const XdrPaymentResultCode._internal(-7); + const XdrPaymentResultCode._internal(-7); /// Destination would go above their limit. static const PAYMENT_LINE_FULL = const XdrPaymentResultCode._internal(-8); @@ -620,4 +631,4 @@ class XdrPaymentResultCode { static void encode(XdrDataOutputStream stream, XdrPaymentResultCode value) { stream.writeInt(value.value); } -} \ No newline at end of file +} diff --git a/lib/src/xdr/xdr_scp.dart b/lib/src/xdr/xdr_scp.dart index 2b0682e..773acbd 100644 --- a/lib/src/xdr/xdr_scp.dart +++ b/lib/src/xdr/xdr_scp.dart @@ -40,7 +40,6 @@ class XdrSCPStatementType { } } - class XdrSCPBallot { XdrSCPBallot(); XdrUint32 _counter; @@ -419,4 +418,4 @@ class XdrSCPStatementExternalize { decodedSCPStatementExternalize.commitQuorumSetHash = XdrHash.decode(stream); return decodedSCPStatementExternalize; } -} \ No newline at end of file +} diff --git a/lib/src/xdr/xdr_signing.dart b/lib/src/xdr/xdr_signing.dart index e8563c0..948cd85 100644 --- a/lib/src/xdr/xdr_signing.dart +++ b/lib/src/xdr/xdr_signing.dart @@ -11,7 +11,7 @@ class XdrSignerKeyType { static const SIGNER_KEY_TYPE_ED25519 = const XdrSignerKeyType._internal(0); static const SIGNER_KEY_TYPE_PRE_AUTH_TX = - const XdrSignerKeyType._internal(1); + const XdrSignerKeyType._internal(1); static const SIGNER_KEY_TYPE_HASH_X = const XdrSignerKeyType._internal(2); static XdrSignerKeyType decode(XdrDataInputStream stream) { @@ -133,7 +133,6 @@ class XdrDecoratedSignature { } } - class XdrSignatureHint { Uint8List _signatureHint; XdrSignatureHint(); @@ -171,4 +170,4 @@ class XdrSignature { decodedSignature.signature = stream.readBytes(signaturesize); return decodedSignature; } -} \ No newline at end of file +} diff --git a/lib/src/xdr/xdr_transaction.dart b/lib/src/xdr/xdr_transaction.dart index 9a084b1..227ed09 100644 --- a/lib/src/xdr/xdr_transaction.dart +++ b/lib/src/xdr/xdr_transaction.dart @@ -145,7 +145,7 @@ class XdrFeeBumpTransaction { } class XdrFeeBumpTransactionInnerTx { - XdrFeeBumpTransactionInnerTx (); + XdrFeeBumpTransactionInnerTx(); XdrEnvelopeType _type; XdrEnvelopeType get discriminant => this._type; @@ -155,9 +155,8 @@ class XdrFeeBumpTransactionInnerTx { XdrTransactionV1Envelope get v1 => this._v1; set v1(XdrTransactionV1Envelope value) => this._v1 = value; - - static void encode( - XdrDataOutputStream stream, XdrFeeBumpTransactionInnerTx encodedTransaction) { + static void encode(XdrDataOutputStream stream, + XdrFeeBumpTransactionInnerTx encodedTransaction) { stream.writeInt(encodedTransaction.discriminant.value); switch (encodedTransaction.discriminant.value) { case XdrEnvelopeType.ENVELOPE_TYPE_TX: @@ -184,8 +183,8 @@ class XdrFeeBumpTransactionExt { int get discriminant => this._v; set discriminant(int value) => this._v = value; - static void encode( - XdrDataOutputStream stream, XdrFeeBumpTransactionExt encodedTransactionExt) { + static void encode(XdrDataOutputStream stream, + XdrFeeBumpTransactionExt encodedTransactionExt) { stream.writeInt(encodedTransactionExt.discriminant); switch (encodedTransactionExt.discriminant) { case 0: @@ -210,7 +209,8 @@ class XdrTransactionV0 { XdrTransactionV0(); XdrUint256 _sourceAccountEd25519; XdrUint256 get sourceAccountEd25519 => this._sourceAccountEd25519; - set sourceAccountEd25519(XdrUint256 value) => this._sourceAccountEd25519 = value; + set sourceAccountEd25519(XdrUint256 value) => + this._sourceAccountEd25519 = value; XdrUint32 _fee; XdrUint32 get fee => this._fee; @@ -380,7 +380,7 @@ class XdrTransactionV1Envelope { static XdrTransactionV1Envelope decode(XdrDataInputStream stream) { XdrTransactionV1Envelope decodedTransactionEnvelope = - XdrTransactionV1Envelope(); + XdrTransactionV1Envelope(); decodedTransactionEnvelope._tx = XdrTransaction.decode(stream); int signaturesSize = stream.readInt(); decodedTransactionEnvelope._signatures = @@ -417,7 +417,7 @@ class XdrFeeBumpTransactionEnvelope { static XdrFeeBumpTransactionEnvelope decode(XdrDataInputStream stream) { XdrFeeBumpTransactionEnvelope decodedTransactionEnvelope = - XdrFeeBumpTransactionEnvelope(); + XdrFeeBumpTransactionEnvelope(); decodedTransactionEnvelope._tx = XdrFeeBumpTransaction.decode(stream); int signaturesSize = stream.readInt(); decodedTransactionEnvelope._signatures = @@ -455,7 +455,7 @@ class XdrTransactionV0Envelope { static XdrTransactionV0Envelope decode(XdrDataInputStream stream) { XdrTransactionV0Envelope decodedTransactionEnvelope = - XdrTransactionV0Envelope(); + XdrTransactionV0Envelope(); decodedTransactionEnvelope._tx = XdrTransactionV0.decode(stream); int signaturesSize = stream.readInt(); decodedTransactionEnvelope._signatures = @@ -825,7 +825,6 @@ class XdrTransactionSignaturePayloadTaggedTransaction { } } - class XdrTransactionResultCode { final _value; const XdrTransactionResultCode._internal(this._value); @@ -834,7 +833,8 @@ class XdrTransactionResultCode { get value => this._value; /// Fee bump inner transaction succeeded. - static const txFEE_BUMP_INNER_SUCCESS = const XdrTransactionResultCode._internal(1); + static const txFEE_BUMP_INNER_SUCCESS = + const XdrTransactionResultCode._internal(1); /// All operations succeeded. static const txSUCCESS = const XdrTransactionResultCode._internal(0); @@ -850,7 +850,7 @@ class XdrTransactionResultCode { /// No operation was specified. static const txMISSING_OPERATION = - const XdrTransactionResultCode._internal(-4); + const XdrTransactionResultCode._internal(-4); /// Sequence number does not match source account. static const txBAD_SEQ = const XdrTransactionResultCode._internal(-5); @@ -860,14 +860,14 @@ class XdrTransactionResultCode { /// Fee would bring account below reserve. static const txINSUFFICIENT_BALANCE = - const XdrTransactionResultCode._internal(-7); + const XdrTransactionResultCode._internal(-7); /// Source account not found. static const txNO_ACCOUNT = const XdrTransactionResultCode._internal(-8); /// Fee is too small. static const txINSUFFICIENT_FEE = - const XdrTransactionResultCode._internal(-9); + const XdrTransactionResultCode._internal(-9); /// Unused signatures attached to transaction. static const txBAD_AUTH_EXTRA = const XdrTransactionResultCode._internal(-10); @@ -879,7 +879,8 @@ class XdrTransactionResultCode { static const txNOT_SUPPORTED = const XdrTransactionResultCode._internal(-12); /// Fee bump inner transaction failed. - static const txFEE_BUMP_INNER_FAILED = const XdrTransactionResultCode._internal(-13); + static const txFEE_BUMP_INNER_FAILED = + const XdrTransactionResultCode._internal(-13); static XdrTransactionResultCode decode(XdrDataInputStream stream) { int value = stream.readInt(); @@ -925,7 +926,6 @@ class XdrTransactionResultCode { } } - class XdrEnvelopeType { final _value; const XdrEnvelopeType._internal(this._value); diff --git a/lib/src/xdr/xdr_trustline.dart b/lib/src/xdr/xdr_trustline.dart index cc2f0a5..11d9ba4 100644 --- a/lib/src/xdr/xdr_trustline.dart +++ b/lib/src/xdr/xdr_trustline.dart @@ -20,7 +20,8 @@ class XdrTrustLineFlags { static const AUTHORIZED_FLAG = const XdrTrustLineFlags._internal(1); /// The issuer has authorized account to maintain and reduce liabilities for its credit. - static const AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG = const XdrTrustLineFlags._internal(2); + static const AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG = + const XdrTrustLineFlags._internal(2); static XdrTrustLineFlags decode(XdrDataInputStream stream) { int value = stream.readInt(); @@ -176,7 +177,6 @@ class XdrTrustLineEntryV1Ext { } } - class XdrAllowTrustOp { XdrAllowTrustOp(); XdrAccountID _trustor; @@ -273,7 +273,7 @@ class XdrAllowTrustResult { static XdrAllowTrustResult decode(XdrDataInputStream stream) { XdrAllowTrustResult decodedAllowTrustResult = XdrAllowTrustResult(); XdrAllowTrustResultCode discriminant = - XdrAllowTrustResultCode.decode(stream); + XdrAllowTrustResultCode.decode(stream); decodedAllowTrustResult.discriminant = discriminant; switch (decodedAllowTrustResult.discriminant) { case XdrAllowTrustResultCode.ALLOW_TRUST_SUCCESS: @@ -285,7 +285,6 @@ class XdrAllowTrustResult { } } - class XdrAllowTrustResultCode { final _value; const XdrAllowTrustResultCode._internal(this._value); @@ -300,23 +299,23 @@ class XdrAllowTrustResultCode { /// Asset is not ASSET_TYPE_ALPHANUM. static const ALLOW_TRUST_MALFORMED = - const XdrAllowTrustResultCode._internal(-1); + const XdrAllowTrustResultCode._internal(-1); /// Trustor does not have a trustline. static const ALLOW_TRUST_NO_TRUST_LINE = - const XdrAllowTrustResultCode._internal(-2); + const XdrAllowTrustResultCode._internal(-2); /// Source account does not require trust. static const ALLOW_TRUST_TRUST_NOT_REQUIRED = - const XdrAllowTrustResultCode._internal(-3); + const XdrAllowTrustResultCode._internal(-3); /// Source account can't revoke trust. static const ALLOW_TRUST_CANT_REVOKE = - const XdrAllowTrustResultCode._internal(-4); + const XdrAllowTrustResultCode._internal(-4); /// Trusting self is not allowed. static const ALLOW_TRUST_SELF_NOT_ALLOWED = - const XdrAllowTrustResultCode._internal(-5); + const XdrAllowTrustResultCode._internal(-5); static XdrAllowTrustResultCode decode(XdrDataInputStream stream) { int value = stream.readInt(); @@ -388,7 +387,7 @@ class XdrChangeTrustResult { static XdrChangeTrustResult decode(XdrDataInputStream stream) { XdrChangeTrustResult decodedChangeTrustResult = XdrChangeTrustResult(); XdrChangeTrustResultCode discriminant = - XdrChangeTrustResultCode.decode(stream); + XdrChangeTrustResultCode.decode(stream); decodedChangeTrustResult.discriminant = discriminant; switch (decodedChangeTrustResult.discriminant) { case XdrChangeTrustResultCode.CHANGE_TRUST_SUCCESS: @@ -409,27 +408,27 @@ class XdrChangeTrustResultCode { /// Success. static const CHANGE_TRUST_SUCCESS = - const XdrChangeTrustResultCode._internal(0); + const XdrChangeTrustResultCode._internal(0); /// Bad input. static const CHANGE_TRUST_MALFORMED = - const XdrChangeTrustResultCode._internal(-1); + const XdrChangeTrustResultCode._internal(-1); /// Could not find issuer. static const CHANGE_TRUST_NO_ISSUER = - const XdrChangeTrustResultCode._internal(-2); + const XdrChangeTrustResultCode._internal(-2); /// Cannot drop limit below balance. Cannot create with a limit of 0. static const CHANGE_TRUST_INVALID_LIMIT = - const XdrChangeTrustResultCode._internal(-3); + const XdrChangeTrustResultCode._internal(-3); /// Not enough funds to create a new trust line static const CHANGE_TRUST_LOW_RESERVE = - const XdrChangeTrustResultCode._internal(-4); + const XdrChangeTrustResultCode._internal(-4); /// Trusting self is not allowed. static const CHANGE_TRUST_SELF_NOT_ALLOWED = - const XdrChangeTrustResultCode._internal(-5); + const XdrChangeTrustResultCode._internal(-5); static XdrChangeTrustResultCode decode(XdrDataInputStream stream) { int value = stream.readInt(); @@ -455,4 +454,4 @@ class XdrChangeTrustResultCode { XdrDataOutputStream stream, XdrChangeTrustResultCode value) { stream.writeInt(value.value); } -} \ No newline at end of file +} diff --git a/pubspec.yaml b/pubspec.yaml index f215e22..9c262d4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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 netweok. -version: 0.8.1 +version: 0.8.2 homepage: https://github.com/Soneso/stellar_flutter_sdk environment: diff --git a/test/account_test.dart b/test/account_test.dart index fed3a12..8d0102e 100644 --- a/test/account_test.dart +++ b/test/account_test.dart @@ -236,7 +236,7 @@ void main() { await sdk.submitTransaction(transaction); await sdk.accounts.account(accountYId).then((response) { - print("account still exists: ${accountYId}"); + print("account still exists: $accountYId"); assert(false); }).catchError((error) { print(error.toString()); diff --git a/test/examples_test.dart b/test/examples_test.dart index 33873dc..7b27467 100644 --- a/test/examples_test.dart +++ b/test/examples_test.dart @@ -393,10 +393,10 @@ void main() { KeyPair keyPair = KeyPair.random(); // Ask the Freindbot to create our account in the stellar network (only awailable in testnet). - bool funded = await FriendBot.fundTestAccount(keyPair.accountId); + await FriendBot.fundTestAccount(keyPair.accountId); // Load the account data from stellar. - AccountResponse account = await sdk.accounts.account(keyPair.accountId); + await sdk.accounts.account(keyPair.accountId); }); test('create account', () async { @@ -431,8 +431,7 @@ void main() { await sdk.submitTransaction(transaction); // Load the data of the new created account. - AccountResponse newAccount = - await sdk.accounts.account(newAccountKeyPair.accountId); + await sdk.accounts.account(newAccountKeyPair.accountId); }); test('test account merge', () async { @@ -473,7 +472,7 @@ void main() { // Check that account Y has been removed. await sdk.accounts.account(accountYId).then((response) { - print("account still exists: ${accountYId}"); + print("account still exists: $accountYId"); }).catchError((error) { print(error.toString()); if (error is ErrorResponse && error.code == 404) { @@ -628,8 +627,7 @@ void main() { .addOperation(caob.build()) .build(); transaction.sign(buyerKeipair); - SubmitTransactionResponse response = - await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Define an asset. Asset astroDollar = AssetTypeCreditAlphaNum12("ASTRO", issuerAccountId); @@ -641,7 +639,7 @@ void main() { .addOperation(cto) .build(); transaction.sign(buyerKeipair); - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Create the offer. // I want to pay max. 50 XLM for 100 ASTRO. @@ -659,7 +657,7 @@ void main() { // Sign the transaction. transaction.sign(buyerKeipair); // Submit the transaction. - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Now let's load the offers of our account to see if the offer has been created. Page offers = @@ -700,7 +698,7 @@ void main() { // Sign. transaction.sign(buyerKeipair); // Submit. - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Load the offer from stellar. offers = (await sdk.offers.forAccount(buyerAccountId).execute()); @@ -738,7 +736,7 @@ void main() { transaction.sign(buyerKeipair); // Submit. - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // check if the offer has been deleted. offers = await sdk.offers.forAccount(buyerAccountId).execute(); @@ -767,8 +765,7 @@ void main() { .addOperation(co) .build(); transaction.sign(sellerKeipair); - SubmitTransactionResponse response = - await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Load issuer account so that we can send our custom assets to the seller account. AccountResponse issuerAccount = await sdk.accounts.account(issuerAccountId); @@ -783,7 +780,7 @@ void main() { .addOperation(cto) .build(); transaction.sign(sellerKeipair); - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Send 2000 MOON asset to the seller account. PaymentOperation po = @@ -792,7 +789,7 @@ void main() { .addOperation(po) .build(); transaction.sign(issuerKeipair); - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Create the offer. // I want to sell 100 MOON for 50 XLM. @@ -810,7 +807,7 @@ void main() { // Sign. transaction.sign(sellerKeipair); // Submit. - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Now let's load the offers of our account to see if the offer has been created. Page offers = @@ -849,7 +846,7 @@ void main() { // Sign. transaction.sign(sellerKeipair); // Submit. - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Load again to see if it has been modified. offers = await sdk.offers.forAccount(sellerAccountId).execute(); @@ -882,7 +879,7 @@ void main() { // Sign. transaction.sign(sellerKeipair); // Submit. - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Check if the offer has been deleted. offers = await sdk.offers.forAccount(sellerAccountId).execute(); @@ -911,8 +908,7 @@ void main() { .addOperation(co) .build(); transaction.sign(sellerKeipair); - SubmitTransactionResponse response = - await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Load issuer account so that we can send some custom asset funds to the seller account. AccountResponse issuerAccount = await sdk.accounts.account(issuerAccountId); @@ -927,7 +923,7 @@ void main() { .addOperation(cto) .build(); transaction.sign(sellerKeipair); - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Send a couple of custom asset MARS funds from the issuer to the seller account so that the seller can offer them. PaymentOperation po = @@ -936,7 +932,7 @@ void main() { .addOperation(po) .build(); transaction.sign(issuerKeipair); - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Create the offer. // I want to sell 100 MARS for 50 XLM. @@ -955,7 +951,7 @@ void main() { // Sign. transaction.sign(sellerKeipair); // Submit. - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Now let's load the offers of our account to see if the offer has been created. Page offers = @@ -995,7 +991,7 @@ void main() { // Sign. transaction.sign(sellerKeipair); // Submit. - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Load again to see if it has been modified. offers = await sdk.offers.forAccount(sellerAccountId).execute(); @@ -1029,7 +1025,7 @@ void main() { // Sign. transaction.sign(sellerKeipair); // Submit. - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Check if the offer has been deleted. offers = await sdk.offers.forAccount(sellerAccountId).execute(); @@ -1062,8 +1058,7 @@ void main() { .addOperation(cao) .build(); transaction.sign(trustorKeipair); - SubmitTransactionResponse response = - await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Creat our custom asset. String assetCode = "ASTRO"; @@ -1080,7 +1075,7 @@ void main() { // Sign. transaction.sign(trustorKeipair); // Submit. - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Load the trustor account again to see if the trustline has been created. trustorAccount = await sdk.accounts.account(trustorAccountId); @@ -1108,7 +1103,7 @@ void main() { // Sign. transaction.sign(trustorKeipair); // Submit. - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Load the trustor account to see if the trustline has been modified. trustorAccount = await sdk.accounts.account(trustorAccountId); @@ -1136,7 +1131,7 @@ void main() { // Sign. transaction.sign(trustorKeipair); // Submit. - response = await sdk.submitTransaction(transaction); + await sdk.submitTransaction(transaction); // Load the trustor account again to see if the trustline has been deleted. trustorAccount = await sdk.accounts.account(trustorAccountId); @@ -1351,7 +1346,7 @@ void main() { .build(); transaction.sign(issuerKeipair); response = await sdk.submitTransaction(transaction); - if (!response.success) ; + if (!response.success) { // is not authorized for new funds print("payment correctly blocked.");