From 388e8caed92dca5932d446722bb450f4c47a4f1e Mon Sep 17 00:00:00 2001 From: slackve Date: Sat, 23 May 2020 20:20:29 -0500 Subject: [PATCH] update version to 0.0.5+4 --- CHANGELOG.md | 4 +++ README.md | 2 +- ...account_properties_transaction_buffer.dart | 2 +- .../model/exchange_transaction_buffer.dart | 34 +++++++++---------- .../mosaic_definition_transaction_buffer.dart | 2 +- .../model/transfer_transaction_buffer.dart | 2 +- lib/src/model/account/account_model.dart | 33 +++++++++--------- lib/src/model/account/account_properties.dart | 2 -- lib/src/model/mosaic/mosaic_model.dart | 14 +++----- lib/src/model/network/network_type.dart | 2 -- pubspec.yaml | 2 +- 11 files changed, 46 insertions(+), 53 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80d8a2d..389417d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.5+4 +### Updates +[UPDATE] analysis code. + ## 0.0.5+3 ### Updates [UPDATE] format code. diff --git a/README.md b/README.md index 2168e88..4a08855 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Add this to your package's pubspec.yaml file: ```dart dependencies: - xpx_chain_sdk: 0.0.5+3 + xpx_chain_sdk: 0.0.5+4 ``` **2. Install it** diff --git a/lib/imp/buffer/model/account_properties_transaction_buffer.dart b/lib/imp/buffer/model/account_properties_transaction_buffer.dart index 774b1a3..95cd4d7 100644 --- a/lib/imp/buffer/model/account_properties_transaction_buffer.dart +++ b/lib/imp/buffer/model/account_properties_transaction_buffer.dart @@ -101,7 +101,7 @@ class AccountPropertiesTransactionBuffer { AccountPropertiesTransactionBuffer._(this._bc, this._bcOffset); static const fb.Reader reader = - const _AccountPropertiesTransactionBufferReader(); + _AccountPropertiesTransactionBufferReader(); final fb.BufferContext _bc; final int _bcOffset; diff --git a/lib/imp/buffer/model/exchange_transaction_buffer.dart b/lib/imp/buffer/model/exchange_transaction_buffer.dart index 12a7bd1..9156590 100644 --- a/lib/imp/buffer/model/exchange_transaction_buffer.dart +++ b/lib/imp/buffer/model/exchange_transaction_buffer.dart @@ -210,20 +210,20 @@ class ExchangeOfferTransactionBuffer { int get size => const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 4, 0); - List get signature => const fb.ListReader(const fb.Uint8Reader()) + List get signature => const fb.ListReader(fb.Uint8Reader()) .vTableGet(_bc, _bcOffset, 6, null); - List get signer => const fb.ListReader(const fb.Uint8Reader()) + List get signer => const fb.ListReader(fb.Uint8Reader()) .vTableGet(_bc, _bcOffset, 8, null); int get version => const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 10, 0); int get type => const fb.Uint16Reader().vTableGet(_bc, _bcOffset, 12, 0); - List get maxFee => const fb.ListReader(const fb.Uint32Reader()) + List get maxFee => const fb.ListReader(fb.Uint32Reader()) .vTableGet(_bc, _bcOffset, 14, null); - List get deadline => const fb.ListReader(const fb.Uint32Reader()) + List get deadline => const fb.ListReader(fb.Uint32Reader()) .vTableGet(_bc, _bcOffset, 16, null); int get offersCount => @@ -414,10 +414,10 @@ class RemoveExchangeOfferTransactionBuffer { int get type => const fb.Uint16Reader().vTableGet(_bc, _bcOffset, 12, 0); - List get maxFee => const fb.ListReader(const fb.Uint32Reader()) + List get maxFee => const fb.ListReader(fb.Uint32Reader()) .vTableGet(_bc, _bcOffset, 14, null); - List get deadline => const fb.ListReader(const fb.Uint32Reader()) + List get deadline => const fb.ListReader(fb.Uint32Reader()) .vTableGet(_bc, _bcOffset, 16, null); int get offersCount => @@ -598,19 +598,18 @@ class AddExchangeOfferBuffer { final fb.BufferContext _bc; final int _bcOffset; - List get mosaicId => const fb.ListReader(const fb.Uint32Reader()) + List get mosaicId => const fb.ListReader(fb.Uint32Reader()) .vTableGet(_bc, _bcOffset, 4, null); - List get mosaicAmount => - const fb.ListReader(const fb.Uint32Reader()) - .vTableGet(_bc, _bcOffset, 6, null); + List get mosaicAmount => const fb.ListReader(fb.Uint32Reader()) + .vTableGet(_bc, _bcOffset, 6, null); - List get cost => const fb.ListReader(const fb.Uint32Reader()) + List get cost => const fb.ListReader(fb.Uint32Reader()) .vTableGet(_bc, _bcOffset, 8, null); int get type => const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 10, 0); - List get duration => const fb.ListReader(const fb.Uint32Reader()) + List get duration => const fb.ListReader(fb.Uint32Reader()) .vTableGet(_bc, _bcOffset, 12, null); @override @@ -739,19 +738,18 @@ class ExchangeOfferBuffer { final fb.BufferContext _bc; final int _bcOffset; - List get mosaicId => const fb.ListReader(const fb.Uint32Reader()) + List get mosaicId => const fb.ListReader(fb.Uint32Reader()) .vTableGet(_bc, _bcOffset, 4, null); - List get mosaicAmount => - const fb.ListReader(const fb.Uint32Reader()) - .vTableGet(_bc, _bcOffset, 6, null); + List get mosaicAmount => const fb.ListReader(fb.Uint32Reader()) + .vTableGet(_bc, _bcOffset, 6, null); - List get cost => const fb.ListReader(const fb.Uint32Reader()) + List get cost => const fb.ListReader(fb.Uint32Reader()) .vTableGet(_bc, _bcOffset, 8, null); int get type => const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 10, 0); - List get owner => const fb.ListReader(const fb.Uint8Reader()) + List get owner => const fb.ListReader(fb.Uint8Reader()) .vTableGet(_bc, _bcOffset, 12, null); @override diff --git a/lib/imp/buffer/model/mosaic_definition_transaction_buffer.dart b/lib/imp/buffer/model/mosaic_definition_transaction_buffer.dart index a1b9d2c..2032c6c 100644 --- a/lib/imp/buffer/model/mosaic_definition_transaction_buffer.dart +++ b/lib/imp/buffer/model/mosaic_definition_transaction_buffer.dart @@ -97,7 +97,7 @@ class MosaicDefinitionTransactionBuffer { MosaicDefinitionTransactionBuffer._(this._bc, this._bcOffset); static const fb.Reader reader = - const _MosaicDefinitionTransactionBufferReader(); + _MosaicDefinitionTransactionBufferReader(); final fb.BufferContext _bc; final int _bcOffset; diff --git a/lib/imp/buffer/model/transfer_transaction_buffer.dart b/lib/imp/buffer/model/transfer_transaction_buffer.dart index 4fe1a98..7cdbcb8 100644 --- a/lib/imp/buffer/model/transfer_transaction_buffer.dart +++ b/lib/imp/buffer/model/transfer_transaction_buffer.dart @@ -187,7 +187,7 @@ class TransferTransactionBuffer { TransferTransactionBuffer._(this._bc, this._bcOffset); static const fb.Reader reader = - const _TransferTransactionBufferReader(); + _TransferTransactionBufferReader(); final fb.BufferContext _bc; final int _bcOffset; diff --git a/lib/src/model/account/account_model.dart b/lib/src/model/account/account_model.dart index fb0ba73..25c1c31 100644 --- a/lib/src/model/account/account_model.dart +++ b/lib/src/model/account/account_model.dart @@ -4,18 +4,20 @@ class Account { Account._(this.publicAccount, this.account); /// Create an Account from a given hex private key. - Account.fromPrivateKey(String shex, int networkType) { - account = crypto.KeyPair.fromHexString(shex); - publicAccount = + static Account fromPrivateKey(String shex, int networkType) { + final account = crypto.KeyPair.fromHexString(shex); + final publicAccount = PublicAccount.fromPublicKey(account.publicKey.toString(), networkType); + return Account._(publicAccount, account); } /// Create an Account from a given networkType. - Account.random(int networkType) { + static Account random(int networkType) { final kp = crypto.KeyPair.fromRandomKeyPair(); final acc = Account.fromPrivateKey(kp.privateKey.toString(), networkType); - publicAccount = acc.publicAccount; - account = acc.account; + final publicAccount = acc.publicAccount; + final account = acc.account; + return Account._(publicAccount, account); } PublicAccount publicAccount; @@ -47,12 +49,13 @@ class PublicAccount { PublicAccount._(this.publicKey, this.address); /// Create an Account from a given publicKey hex string. - PublicAccount.fromPublicKey(this.publicKey, int networkType) { + static PublicAccount fromPublicKey(String publicKey, int networkType) { if (publicKey == null || (publicKeySize != publicKey.length && 66 != publicKey.length)) { throw errInvalidPublicKey; } - address = Address.fromPublicKey(publicKey, networkType); + final address = Address.fromPublicKey(publicKey, networkType); + return PublicAccount._(publicKey, address); } String publicKey; @@ -83,12 +86,12 @@ class PublicAccount { } class AccountNames { - AccountNames._(); + AccountNames._(this.address, this.names); - AccountNames.fromDto(AccountNamesDTO dto) { - if (dto == null) return; - address = Address.fromEncoded(dto.address); - names = (dto._names == null) ? null : dto._names.cast(); + static AccountNames fromDto(AccountNamesDTO dto) { + final address = Address.fromEncoded(dto.address); + final names = (dto._names == null) ? null : dto._names.cast(); + return AccountNames._(address, names); } /* The address of the account in hexadecimal. */ @@ -98,9 +101,7 @@ class AccountNames { List names; static List listFromJson(List json) => - json == null - ? [] - : json.map((value) => AccountNames.fromDto(value)).toList(); + json == null ? [] : json.map(AccountNames.fromDto).toList(); @override String toString() => '{\n' diff --git a/lib/src/model/account/account_properties.dart b/lib/src/model/account/account_properties.dart index 42f1699..3302782 100644 --- a/lib/src/model/account/account_properties.dart +++ b/lib/src/model/account/account_properties.dart @@ -7,8 +7,6 @@ enum PropertyModificationType { } class AccountProperties { - AccountProperties._(); - AccountProperties.fromDto(AccountPropertiesDTO dto) { if (dto == null) return; address = Address.fromEncoded(dto.address); diff --git a/lib/src/model/mosaic/mosaic_model.dart b/lib/src/model/mosaic/mosaic_model.dart index e914412..deb613a 100644 --- a/lib/src/model/mosaic/mosaic_model.dart +++ b/lib/src/model/mosaic/mosaic_model.dart @@ -7,16 +7,16 @@ enum MosaicPropertyId { } class Mosaic { - Mosaic(AssetId mosaicId, Uint64 amount) { - if (mosaicId == null) { + Mosaic(this.assetId, this.amount) { + if (assetId == null) { throw errNullMosaicId; } else if (amount == null) { throw errNullMosaicAmount; } else if (amount.isZero) { throw errNullMosaicAmount; } else { - assetId = mosaicId; - this.amount = amount; + assetId = assetId; + amount = amount; } } @@ -96,8 +96,6 @@ class MosaicId extends AssetId { } class MosaicIds { - MosaicIds._(); - MosaicIds.fromList(List list) : assert(list != null, 'list must not be null') { _list = list.map((item) => item).toList(); @@ -214,10 +212,6 @@ class MosaicProperties { MosaicProperties.fromDTO(List<_MosaicPropertyDTO> value) : assert(value != null, 'mosaic Properties is not valid') { -// if (value.length < 3) {// -// throw errInvalidMosaicProperties; -// } - var flags = Uint64.zero; divisibility = 0; diff --git a/lib/src/model/network/network_type.dart b/lib/src/model/network/network_type.dart index 6126be9..6851365 100644 --- a/lib/src/model/network/network_type.dart +++ b/lib/src/model/network/network_type.dart @@ -19,8 +19,6 @@ const Map addressNet = { }; class NetworkType { - NetworkType._(this.networkType, this.description); - NetworkType.fromJson(Map json) : assert(json != null, 'json must not be null') { networkType = json['name']; diff --git a/pubspec.yaml b/pubspec.yaml index 7f25367..9bb441c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: xpx_chain_sdk -version: 0.0.5+3 +version: 0.0.5+4 author: 'Eleazar Garrido ' description: 'The ProximaX Sirius Chain Dart SDK works as a lightweight Dart library for interacting with the Sirius Blockchain.'