diff --git a/README.md b/README.md index 6cbeeb68..c9436741 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,22 @@ DCore SDK for JVM ================ -Set of APIs for accessing the DCore Blockchain. +Set of APIs for accessing the DCore Blockchain.
+If you are looking for other platforms you can find info [below](#official-dcore-sdks-for-other-platforms). -Download +Requirements -------- -Available through the JitPack.io +- [Java](https://www.java.com) +- [Gradle](https://gradle.org) -[![](https://jitpack.io/v/DECENTfoundation/DCoreKt-SDK.svg?style=flat-square)][jitpack] +Installation +-------- -Setup ------ +Available through the JitPack.io + +[![](https://jitpack.io/v/DECENTfoundation/DCoreKt-SDK.svg?style=flat-square)][jitpack] Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories: @@ -37,6 +41,8 @@ If not using `gradle`, check [jitpack] site for instructions. Usage ----- +You can find example project with SDK usage [here](https://github.com/DECENTfoundation/DCore-SDK-Examples/tree/master/sdk-java-android). + Use `DCoreSdk` to initialize the API. The `DCoreApi` provides different groups of APIs for accessing the blockchain and default configuration values. @@ -75,6 +81,13 @@ val disposable = api.accountApi.transfer(credentials, "1.2.27", amount).subscrib } ``` +Official DCore SDKs for other platforms +---------- + +- [iOS/Swift](https://github.com/DECENTfoundation/DCoreSwift-SDK) +- [JavaScript/TypeScript/Node.js](https://github.com/DECENTfoundation/DCoreJS-SDK) +- [PHP](https://github.com/DECENTfoundation/DCorePHP-SDK) + References ---------- diff --git a/library/src/main/java/ch/decent/sdk/api/BalanceApi.kt b/library/src/main/java/ch/decent/sdk/api/BalanceApi.kt index 87f24e5b..c1b65660 100644 --- a/library/src/main/java/ch/decent/sdk/api/BalanceApi.kt +++ b/library/src/main/java/ch/decent/sdk/api/BalanceApi.kt @@ -2,8 +2,8 @@ package ch.decent.sdk.api import ch.decent.sdk.DCoreApi import ch.decent.sdk.DCoreConstants -import ch.decent.sdk.model.Asset import ch.decent.sdk.model.AssetAmount +import ch.decent.sdk.model.AmountWithAsset import ch.decent.sdk.model.ChainObject import ch.decent.sdk.model.VestingBalance import ch.decent.sdk.net.model.request.GetAccountBalances @@ -64,7 +64,7 @@ class BalanceApi internal constructor(api: DCoreApi) : BaseApi(api) { * * @return a pair of asset to amount */ - fun getWithAsset(accountId: ChainObject, assetSymbol: String = DCoreConstants.DCT_SYMBOL): Single> = + fun getWithAsset(accountId: ChainObject, assetSymbol: String = DCoreConstants.DCT_SYMBOL): Single = getAllWithAsset(accountId, listOf(assetSymbol)).map { it.single() } /** @@ -75,10 +75,10 @@ class BalanceApi internal constructor(api: DCoreApi) : BaseApi(api) { * * @return a list of pairs of assets to amounts */ - fun getAllWithAsset(accountId: ChainObject, assetSymbols: List): Single>> = + fun getAllWithAsset(accountId: ChainObject, assetSymbols: List): Single> = api.assetApi.getAllByName(assetSymbols).flatMap { assets -> getAll(accountId, assets.map { it.id }).map { - it.map { balance -> assets.single { it.id == balance.assetId } to balance } + it.map { balance -> AmountWithAsset(assets.single { it.id == balance.assetId }, balance) } } } @@ -90,7 +90,7 @@ class BalanceApi internal constructor(api: DCoreApi) : BaseApi(api) { * * @return a pair of asset to amount */ - fun getWithAsset(name: String, assetSymbol: String = DCoreConstants.DCT_SYMBOL): Single> = + fun getWithAsset(name: String, assetSymbol: String = DCoreConstants.DCT_SYMBOL): Single = getAllWithAsset(name, listOf(assetSymbol)).map { it.single() } /** @@ -101,10 +101,10 @@ class BalanceApi internal constructor(api: DCoreApi) : BaseApi(api) { * * @return list of assets with amounts */ - fun getAllWithAsset(name: String, assetSymbols: List): Single>> = + fun getAllWithAsset(name: String, assetSymbols: List): Single> = api.assetApi.getAllByName(assetSymbols).flatMap { assets -> getAll(name, assets.map { it.id }).map { - it.map { balance -> assets.single { it.id == balance.assetId } to balance } + it.map { balance -> AmountWithAsset(assets.single { it.id == balance.assetId }, balance) } } } diff --git a/library/src/main/java/ch/decent/sdk/api/ContentApi.kt b/library/src/main/java/ch/decent/sdk/api/ContentApi.kt index e0df55f8..cc315c09 100644 --- a/library/src/main/java/ch/decent/sdk/api/ContentApi.kt +++ b/library/src/main/java/ch/decent/sdk/api/ContentApi.kt @@ -2,6 +2,7 @@ package ch.decent.sdk.api import ch.decent.sdk.DCoreApi import ch.decent.sdk.crypto.Credentials +import ch.decent.sdk.exception.ObjectNotFoundException import ch.decent.sdk.model.* import ch.decent.sdk.net.model.request.* import io.reactivex.Single @@ -24,7 +25,17 @@ class ContentApi internal constructor(api: DCoreApi) : BaseApi(api) { * * @return a content if found, [ch.decent.sdk.exception.ObjectNotFoundException] otherwise */ - fun get(contentId: ChainObject): Single = GetContentById(contentId).toRequest().map { it.single() } + fun get(contentId: ChainObject): Single = GetContentById(listOf(contentId)).toRequest().map { it.single() } + + /** + * Get contents by ids. + * + * @param contentId object ids of the contents, 2.13.* + * + * @return a content if found, empty list otherwise + */ + fun getAll(contentId: List): Single> = GetContentById(contentId).toRequest() + .onErrorResumeNext { if (it is ObjectNotFoundException) Single.just(emptyList()) else Single.error(it) } /** * Get content by uri. @@ -35,7 +46,6 @@ class ContentApi internal constructor(api: DCoreApi) : BaseApi(api) { */ fun get(uri: String): Single = GetContentByUri(uri).toRequest() - // todo untested no data /** * Get a list of accounts holding publishing manager status. * diff --git a/library/src/main/java/ch/decent/sdk/api/PurchaseApi.kt b/library/src/main/java/ch/decent/sdk/api/PurchaseApi.kt index 5e7e7449..0a125b9e 100644 --- a/library/src/main/java/ch/decent/sdk/api/PurchaseApi.kt +++ b/library/src/main/java/ch/decent/sdk/api/PurchaseApi.kt @@ -1,10 +1,8 @@ package ch.decent.sdk.api import ch.decent.sdk.DCoreApi -import ch.decent.sdk.model.ChainObject -import ch.decent.sdk.model.ObjectType -import ch.decent.sdk.model.Purchase -import ch.decent.sdk.model.SearchPurchasesOrder +import ch.decent.sdk.crypto.Credentials +import ch.decent.sdk.model.* import ch.decent.sdk.net.model.request.* import io.reactivex.Single @@ -87,11 +85,50 @@ class PurchaseApi internal constructor(api: DCoreApi) : BaseApi(api) { * * @return a list of purchase objects */ - // todo wait for add feedback OP so we can test fun findAllForFeedback( uri: String, user: String? = null, count: Int = 100, startId: ChainObject = ObjectType.NULL_OBJECT.genericId ): Single> = SearchFeedback(user, uri, startId, count).toRequest() + + /** + * Create a rate and comment content operation. + * + * @param uri a uri of the content + * @param consumer object id of the account, 1.2.* + * @param rating 1-5 stars + * @param comment max 100 chars + * @param fee [AssetAmount] fee for the operation, if left [BaseOperation.FEE_UNSET] the fee will be computed in DCT asset + * + * @return a rate and comment content operation + */ + fun createRateAndCommentOperation( + uri: String, + consumer: ChainObject, + rating: Int, + comment: String, + fee: AssetAmount = BaseOperation.FEE_UNSET + ): Single = Single.just(LeaveRatingAndCommentOperation(uri, consumer, rating, comment, fee)) + + /** + * Rate and comment content operation. + * + * @param credentials account credentials + * @param uri a uri of the content + * @param rating 1-5 stars + * @param comment max 100 chars + * @param fee [AssetAmount] fee for the operation, if left [BaseOperation.FEE_UNSET] the fee will be computed in DCT asset + * + * @return a rate and comment content operation + */ + fun rateAndComment( + credentials: Credentials, + uri: String, + rating: Int, + comment: String, + fee: AssetAmount = BaseOperation.FEE_UNSET + ): Single = createRateAndCommentOperation(uri, credentials.account, rating, comment, fee) + .flatMap { api.broadcastApi.broadcastWithCallback(credentials.keyPair, it) } + } diff --git a/library/src/main/java/ch/decent/sdk/crypto/DumpedPrivateKey.kt b/library/src/main/java/ch/decent/sdk/crypto/DumpedPrivateKey.kt index eeec5e9d..4b9101cd 100644 --- a/library/src/main/java/ch/decent/sdk/crypto/DumpedPrivateKey.kt +++ b/library/src/main/java/ch/decent/sdk/crypto/DumpedPrivateKey.kt @@ -33,7 +33,7 @@ class DumpedPrivateKey private constructor( fun fromBase58(encoded: String): DumpedPrivateKey { val versionAndData = Base58.decodeChecked(encoded) val version = versionAndData[0].toInt() and 0xFF - require(version == 0x80, { "$version is not a valid private key version byte" }) + require(version == 0x80) { "$version is not a valid private key version byte" } return versionAndData.copyOfRange(1, versionAndData.size).let { if (it.size == 33 && it[32].toInt() == 1) { DumpedPrivateKey(version, it.copyOfRange(0, it.size - 1), true) diff --git a/library/src/main/java/ch/decent/sdk/crypto/ECKeyPair.kt b/library/src/main/java/ch/decent/sdk/crypto/ECKeyPair.kt index 516f9ab0..64bc2e84 100644 --- a/library/src/main/java/ch/decent/sdk/crypto/ECKeyPair.kt +++ b/library/src/main/java/ch/decent/sdk/crypto/ECKeyPair.kt @@ -82,9 +82,7 @@ class ECKeyPair { System.arraycopy(signature.s.bytes(32), 0, sigData, 33, 32) // canonical tests - return if (sigData[0].toInt() and 0x80 != 0 || sigData[0].toInt() == 0 || - sigData[1].toInt() and 0x80 != 0 || sigData[32].toInt() and 0x80 != 0 || - sigData[32].toInt() == 0 || sigData[33].toInt() and 0x80 != 0) { + return if (!checkCanonicalSignature(sigData)) { "" } else { Hex.encode(sigData) @@ -222,6 +220,23 @@ class ECKeyPair { compEnc[0] = (if (yBit) 0x03 else 0x02).toByte() return curve.curve.decodePoint(compEnc) } + + /* + https://github.com/steemit/steem/issues/1944 + bool public_key::is_canonical( const compact_signature& c ) + { + return !(c.data[1] & 0x80) + && !(c.data[1] == 0 && !(c.data[2] & 0x80)) + && !(c.data[33] & 0x80) + && !(c.data[33] == 0 && !(c.data[34] & 0x80)); + } + */ + @JvmStatic + fun checkCanonicalSignature(sigData: ByteArray): Boolean = + sigData.map { it.toInt() and 0xFF }.let { + it[1] < 0x80 && !(it[1] == 0 && it[2] < 0x80) + && it[33] < 0x80 && !(it[33] == 0 && it[34] < 0x80) + } } data class ECDSASignature(val r: BigInteger, val s: BigInteger) { @@ -259,6 +274,7 @@ fun DumpedPrivateKey.ecKey() = ECKeyPair.fromPrivate(bytes, compressed) fun ECKeyPair.base58() = this.dpk().toString() fun ECKeyPair.dpk() = DumpedPrivateKey(this) fun ECKeyPair.address() = this.public.address() +fun String.ecKey() = this.dpk().ecKey() /** * Method generates private key from phrase provided by parameter of type [String]. If parameter [normalize] is true, provided pass phrase will be converted diff --git a/library/src/main/java/ch/decent/sdk/model/AmountWithAsset.kt b/library/src/main/java/ch/decent/sdk/model/AmountWithAsset.kt new file mode 100644 index 00000000..cdce0702 --- /dev/null +++ b/library/src/main/java/ch/decent/sdk/model/AmountWithAsset.kt @@ -0,0 +1,18 @@ +package ch.decent.sdk.model + +import java.text.NumberFormat + +data class AmountWithAsset( + val asset: Asset, + val amount: AssetAmount +) : AssetFormatter by asset { + + fun fromRaw() = fromRaw(amount.amount) + + fun format(formatter: NumberFormat) = formatter.format(fromRaw(amount.amount)) + " $symbol" + + fun format() = defaultFormatter.format(fromRaw(amount.amount)) + " $symbol" + + fun format(formatter: NumberFormat.() -> Unit) = defaultFormatter.apply(formatter).format(fromRaw(amount.amount)) + " $symbol" + +} \ No newline at end of file diff --git a/library/src/main/java/ch/decent/sdk/model/AssetFormatter.kt b/library/src/main/java/ch/decent/sdk/model/AssetFormatter.kt index 46fc83b0..2a665d46 100644 --- a/library/src/main/java/ch/decent/sdk/model/AssetFormatter.kt +++ b/library/src/main/java/ch/decent/sdk/model/AssetFormatter.kt @@ -47,7 +47,7 @@ interface AssetFormatter { fun format(value: BigDecimal) = defaultFormatter.format(value) + " $symbol" - fun format(value: BigDecimal, formatter: NumberFormat.() -> NumberFormat) = formatter(defaultFormatter).format(value) + " $symbol" + fun format(value: BigDecimal, formatter: NumberFormat.() -> Unit) = defaultFormatter.apply(formatter).format(value) + " $symbol" /** * format raw value with asset symbol @@ -59,7 +59,7 @@ interface AssetFormatter { fun format(value: BigInteger) = defaultFormatter.format(fromRaw(value)) + " $symbol" - fun format(value: BigInteger, formatter: NumberFormat.() -> NumberFormat) = formatter(defaultFormatter).format(fromRaw(value)) + " $symbol" + fun format(value: BigInteger, formatter: NumberFormat.() -> Unit) = defaultFormatter.apply(formatter).format(fromRaw(value)) + " $symbol" fun amount(value: String): AssetAmount = AssetAmount(toRaw(BigDecimal(value)), id) fun amount(value: Double): AssetAmount = AssetAmount(toRaw(BigDecimal(value)), id) diff --git a/library/src/main/java/ch/decent/sdk/model/OperationType.kt b/library/src/main/java/ch/decent/sdk/model/OperationType.kt index 50ea9f76..189fc67e 100644 --- a/library/src/main/java/ch/decent/sdk/model/OperationType.kt +++ b/library/src/main/java/ch/decent/sdk/model/OperationType.kt @@ -26,7 +26,7 @@ enum class OperationType(val clazz: Class<*>? = null) { ASSERT_OPERATION, CONTENT_SUBMIT_OPERATION(ContentSubmitOperation::class.java), //20 REQUEST_TO_BUY_OPERATION(PurchaseContentOperation::class.java), - LEAVE_RATING_AND_COMMENT_OPERATION, + LEAVE_RATING_AND_COMMENT_OPERATION(LeaveRatingAndCommentOperation::class.java), READY_TO_PUBLISH_OPERATION, PROOF_OF_CUSTODY_OPERATION, DELIVER_KEYS_OPERATION, //25 @@ -44,10 +44,11 @@ enum class OperationType(val clazz: Class<*>? = null) { UPDATE_MONITORED_ASSET_OPERATION, READY_TO_PUBLISH2_OPERATION, TRANSFER2_OPERATION(TransferOperation::class.java), - DISALLOW_AUTOMATIC_RENEWAL_OF_SUBSCRIPTION_OPERATION, // VIRTUAL 40 + UPDATE_USER_ISSUED_ASSET_ADVANCED, + DISALLOW_AUTOMATIC_RENEWAL_OF_SUBSCRIPTION_OPERATION, // VIRTUAL 41 RETURN_ESCROW_SUBMISSION_OPERATION, // VIRTUAL RETURN_ESCROW_BUYING_OPERATION, // VIRTUAL PAY_SEEDER_OPERATION, // VIRTUAL - FINISH_BUYING_OPERATION, // VIRTUAL - RENEWAL_OF_SUBSCRIPTION_OPERATION // VIRTUAL 45 + FINISH_BUYING_OPERATION, // VIRTUAL 45 + RENEWAL_OF_SUBSCRIPTION_OPERATION // VIRTUAL } \ No newline at end of file diff --git a/library/src/main/java/ch/decent/sdk/model/Operations.kt b/library/src/main/java/ch/decent/sdk/model/Operations.kt index 378e7f43..0df858c4 100644 --- a/library/src/main/java/ch/decent/sdk/model/Operations.kt +++ b/library/src/main/java/ch/decent/sdk/model/Operations.kt @@ -314,6 +314,39 @@ class ContentSubmitOperation constructor( } } +/** + * Leave comment and rating operation constructor + * + * @param uri uri of the content + * @param consumer chain object id of the buyer's account + * @param rating 1-5 stars + * @param comment max 100 chars + * @param fee [AssetAmount] fee for the operation, if left [BaseOperation.FEE_UNSET] the fee will be computed in DCT asset + */ +class LeaveRatingAndCommentOperation constructor( + @SerializedName("URI") val uri: String, + @SerializedName("consumer") val consumer: ChainObject, + @SerializedName("rating") val rating: Int, + @SerializedName("comment") val comment: String, + fee: AssetAmount = BaseOperation.FEE_UNSET +) : BaseOperation(OperationType.LEAVE_RATING_AND_COMMENT_OPERATION, fee) { + + init { + require(rating in 1..5) { "rating must be between 0-5" } + require(comment.length <= 100) { "comment max length is 100 chars" } + } + + override val bytes: ByteArray + get() = Bytes.concat( + byteArrayOf(type.ordinal.toByte()), + fee.bytes, + uri.bytes(), + consumer.bytes, + comment.bytes(), + rating.toLong().bytes() + ) +} + class SendMessageOperation constructor( messagePayloadJson: String, payer: ChainObject, diff --git a/library/src/main/java/ch/decent/sdk/model/Purchase.kt b/library/src/main/java/ch/decent/sdk/model/Purchase.kt index edf8a4c7..c58f6a5a 100644 --- a/library/src/main/java/ch/decent/sdk/model/Purchase.kt +++ b/library/src/main/java/ch/decent/sdk/model/Purchase.kt @@ -18,7 +18,7 @@ data class Purchase( @SerializedName("rating") val rating: BigInteger, @SerializedName("comment") val comment: String, @SerializedName("expiration_time") val expiration: LocalDateTime, - @SerializedName("pubKey") val pubElGamalKey: PubKey, + @SerializedName("pubKey") val pubElGamalKey: PubKey?, @SerializedName("key_particles") val keyParticles: List, @SerializedName("expired") val expired: Boolean, @SerializedName("delivered") val delivered: Boolean, diff --git a/library/src/main/java/ch/decent/sdk/model/TypeAdapters.kt b/library/src/main/java/ch/decent/sdk/model/TypeAdapters.kt index 80b65479..2a4c0fdd 100644 --- a/library/src/main/java/ch/decent/sdk/model/TypeAdapters.kt +++ b/library/src/main/java/ch/decent/sdk/model/TypeAdapters.kt @@ -85,10 +85,11 @@ object OperationTypeFactory : TypeAdapterFactory { } object PubKeyAdapter : TypeAdapter() { - override fun read(reader: JsonReader): PubKey { + override fun read(reader: JsonReader): PubKey? { reader.beginObject() reader.nextName() - val key = PubKey(BigInteger(reader.nextString().dropLast(1))) + val int = reader.nextString().dropLast(1) + val key = if (int.isBlank()) null else PubKey(BigInteger(int)) reader.endObject() return key } diff --git a/library/src/main/java/ch/decent/sdk/net/model/request/GetContentById.kt b/library/src/main/java/ch/decent/sdk/net/model/request/GetContentById.kt index ee897dcc..bc6bf64b 100644 --- a/library/src/main/java/ch/decent/sdk/net/model/request/GetContentById.kt +++ b/library/src/main/java/ch/decent/sdk/net/model/request/GetContentById.kt @@ -6,13 +6,13 @@ import ch.decent.sdk.model.ObjectType import com.google.gson.reflect.TypeToken internal class GetContentById( - contentId: ChainObject + contentId: List ) : GetObjects>( - listOf(contentId), + contentId, TypeToken.getParameterized(List::class.java, Content::class.java).type ) { init { - require(contentId.objectType == ObjectType.CONTENT_OBJECT) { "not a valid content object id" } + require(contentId.all { it.objectType == ObjectType.CONTENT_OBJECT }) { "not a valid content object id" } } } \ No newline at end of file diff --git a/library/src/main/java/ch/decent/sdk/net/ws/RxWebSocket.kt b/library/src/main/java/ch/decent/sdk/net/ws/RxWebSocket.kt index f71090f7..ecda965a 100644 --- a/library/src/main/java/ch/decent/sdk/net/ws/RxWebSocket.kt +++ b/library/src/main/java/ch/decent/sdk/net/ws/RxWebSocket.kt @@ -28,6 +28,7 @@ import java.lang.reflect.ParameterizedType import java.lang.reflect.Type import java.util.concurrent.TimeUnit import java.util.concurrent.TimeoutException +import java.util.concurrent.atomic.AtomicLong internal sealed class MessageEvent internal data class Message(val id: Long, val obj: JsonObject) : MessageEvent() @@ -50,8 +51,9 @@ internal class RxWebSocket( .publish() private var webSocketAsync: AsyncProcessor? = null - private var callId: Long = 0 - get() = field++ + private val backingId = AtomicLong(0) + val callId: Long + get() = backingId.getAndIncrement() internal var timeout = TimeUnit.MINUTES.toSeconds(1) @@ -125,7 +127,7 @@ internal class RxWebSocket( private fun clearConnection() { webSocketAsync = null disposable.clear() - callId = 0 + backingId.set(0) } internal fun webSocket(): Single { diff --git a/library/src/test/java/ch/decent/sdk/CrytpoTest.kt b/library/src/test/java/ch/decent/sdk/CrytpoTest.kt index 1c3d5900..c2c8ba5c 100644 --- a/library/src/test/java/ch/decent/sdk/CrytpoTest.kt +++ b/library/src/test/java/ch/decent/sdk/CrytpoTest.kt @@ -6,31 +6,34 @@ import ch.decent.sdk.net.serialization.bytes import ch.decent.sdk.utils.* import ch.decent.sdk.utils.ElGamal.publicElGamal import org.amshove.kluent.`should be equal to` +import org.amshove.kluent.`should contain all` +import org.amshove.kluent.`should contain none` import org.amshove.kluent.`should equal` import org.junit.Test import java.math.BigInteger import java.nio.charset.Charset import java.security.MessageDigest -import java.util.* class CrytpoTest : TimeOutTest() { + val private = "5Jd7zdvxXYNdUfnEXt5XokrE3zwJSs734yQ36a1YaqioRTGGLtn" + @Test fun `priv key dump`() { - val key = ECKeyPair.fromBase58(private) + val key = private.ecKey() val dump = DumpedPrivateKey.toBase58(key) private.print() ECKeyPair.fromBase58(private).privateBytes.hex().print() - public2.print() - public2.address().publicKey.getEncoded(true).hex().print() - public2.address().publicKey.multiply(key.private).normalize().xCoord.encoded.hex().print() + Helpers.public2.print() + Helpers.public2.address().publicKey.getEncoded(true).hex().print() + Helpers.public2.address().publicKey.multiply(key.private).normalize().xCoord.encoded.hex().print() - key.secret(public2.address(), BigInteger("1234567890")).hex().print() + key.secret(Helpers.public2.address(), BigInteger("1234567890")).hex().print() dump `should be equal to` private } @Test fun `nonce generation`() { - var nonce = BigInteger.ZERO + var nonce: BigInteger for (i in 0..100) { // println("$nonce ${nonce.toByteArray().size} ${nonce.toLong().bytes().joinToString()}") nonce = generateNonce() @@ -56,7 +59,6 @@ class CrytpoTest : TimeOutTest() { val encrypted = "b23f6afb8eb463704d3d752b1fd8fb804c0ce32ba8d18eeffc20a2312e7c60fa" val plain = "hello memo here i am" val nonce = BigInteger("10872523688190906880") - val from = Address.decode("DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz") val to = Address.decode("DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP") val key = ECKeyPair.fromBase58(private) @@ -238,4 +240,24 @@ class CrytpoTest : TimeOutTest() { Wallet.importDCoreWallet(gson.toJson(wallet), "pw") `should equal` credentials } + + @Test fun `should check canonical on signature invalid`() { + val sig = listOf( + "20136f5f01fb54076587670737cc350ef8c1d26d80006a62f28ce80b0df58d052b004fce54c9cc40f6191a94c617410434aab4f19ff35d296a47c1ad2ca6099a13", + "20c8d1f6ef03ec645b9c406431a325741a2247b25862a731993aa5dd3dbac723a66b73d75c5ba313dde012b499a6e1b1b48551e410a4e8758968b7bcdf64bd9a58", + "1fdbfd66ddf7c6cdd100568c15934e3bfef96022f2d335e161cff7ddeade802b5240c117706d004743296696b58138ef342a2cc2008fd5ff2ee3d76a60d2f09f05", + "1ffa382a4507662fd200e4c2bdef7a90b45362f51d79eef84ae35f0c966680a6172109f519f7709e25207462c54fdf465f8b10f84d04120f4d05db1ee5f99e867b" + ) + sig.forEach { ECKeyPair.checkCanonicalSignature(it.unhex()) `should be equal to` false } + } + + @Test fun `should check canonical on signature valid`() { + val sig = listOf( + "1f595122744cc19263b8e73bc8e1d57a045a01c3b4b04bc08216cd8b9104c81f2b154875b1941cef6e76d1d3d89bcbf906d56d4c581807098663c600ab1b0050ef", + "1f62ef0c229f0208642735bf85f20f25550e62dcaacba861e55a477587bed6e8f0490884251bf04cfe116aef02dc82771bd65fa48a6bb599bb1c57e86bcfb8756b", + "202c177696d954a03798d287cc9d4e48a95745d180db012394f39a42a32bf8e2947a434b7c53a619817d3b5c7c3285c6438c26e203ac16c2fd0c3c7de2300cd86c" + ) + sig.forEach { ECKeyPair.checkCanonicalSignature(it.unhex()) `should be equal to` true } + } + } \ No newline at end of file diff --git a/library/src/test/java/ch/decent/sdk/Helpers.kt b/library/src/test/java/ch/decent/sdk/Helpers.kt index a0107717..03900f7e 100644 --- a/library/src/test/java/ch/decent/sdk/Helpers.kt +++ b/library/src/test/java/ch/decent/sdk/Helpers.kt @@ -1,28 +1,30 @@ -@file:JvmName("Helpers") - package ch.decent.sdk -import ch.decent.sdk.model.ChainObject +import ch.decent.sdk.crypto.Credentials +import ch.decent.sdk.model.toChainObject import ch.decent.sdk.net.TrustAllCerts import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import org.slf4j.Logger import org.slf4j.LoggerFactory -val url = "wss://testnet-api.dcore.io" -val restUrl = "https://testnet-api.dcore.io/" -fun client(logger: Logger = LoggerFactory.getLogger("OkHttpClient")): OkHttpClient = - TrustAllCerts.wrap(OkHttpClient.Builder()) - .addInterceptor(HttpLoggingInterceptor { logger.info(it) }.setLevel(HttpLoggingInterceptor.Level.BODY)) - .build() +object Helpers { + @JvmStatic val wsUrl = "wss://testnet-api.dcore.io" + @JvmStatic val restUrl = "https://testnet-api.dcore.io/" + @JvmStatic fun client(logger: Logger = LoggerFactory.getLogger("OkHttpClient")): OkHttpClient = + TrustAllCerts.wrap(OkHttpClient.Builder()) + .addInterceptor(HttpLoggingInterceptor { logger.info(it) }.setLevel(HttpLoggingInterceptor.Level.BODY)) + .build() -val account = ChainObject.parse("1.2.34") -val account2 = ChainObject.parse("1.2.35") -val accountName = "u961279ec8b7ae7bd62f304f7c1c3d345" -val accountName2 = "u3a7b78084e7d3956442d5a4d439dad51" -val private = "5Jd7zdvxXYNdUfnEXt5XokrE3zwJSs734yQ36a1YaqioRTGGLtn" -val private2 = "5JVHeRffGsKGyDf7T9i9dBbzVHQrYprYeaBQo2VCSytj7BxpMCq" -val public = "DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz" -val public2 = "DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP" + @JvmStatic val account = "1.2.27".toChainObject() + @JvmStatic val account2 = "1.2.28".toChainObject() + @JvmStatic val accountName = "public-account-9" + @JvmStatic val accountName2 = "public-account-10" + @JvmStatic val private = "5Hxwqx6JJUBYWjQNt8DomTNJ6r6YK8wDJym4CMAH1zGctFyQtzt" + @JvmStatic val private2 = "5JMpT5C75rcAmuUB81mqVBXbmL1BKea4MYwVK6voMQLvigLKfrE" + @JvmStatic val public = "DCT6TjLhr8uESvgtxrbWuXNAN3vcqzBMw5eyEup3PMiD2gnVxeuTb" + @JvmStatic val public2 = "DCT5PwcSiigfTPTwubadt85enxMFC18TtVoti3gnTbG7TN9f9R3Fp" + @JvmStatic val credentials = Credentials(account, private) +} -fun Any.print() = println(this.toString()) \ No newline at end of file +fun Any.print() = println(this.toString()) diff --git a/library/src/test/java/ch/decent/sdk/Scratchpad.kt b/library/src/test/java/ch/decent/sdk/Scratchpad.kt index a73109ce..a0d71844 100644 --- a/library/src/test/java/ch/decent/sdk/Scratchpad.kt +++ b/library/src/test/java/ch/decent/sdk/Scratchpad.kt @@ -125,7 +125,7 @@ class Scratchpad { val plain = "Hello Memo" val nonce = 1521105802161233 val sender = Address.decode("DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4") - val key = ECKeyPair.fromBase58(private) + val key = ECKeyPair.fromBase58(Helpers.private) val memo = Memo(plain, key, sender, nonce.toBigInteger()) @@ -137,7 +137,7 @@ class Scratchpad { @Test fun `encrypt and decrypt long`() { val plain = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." val sender = Address.decode("DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4") - val key = ECKeyPair.fromBase58(private) + val key = ECKeyPair.fromBase58(Helpers.private) val memo = Memo(plain, key, sender) @@ -187,11 +187,11 @@ class Scratchpad { */ @Test fun `transaction signature`() { - val key = ECKeyPair.fromBase58(private) + val key = ECKeyPair.fromBase58(Helpers.private) val op = TransferOperation( - account, - account2, + Helpers.account, + Helpers.account2, AssetAmount(100000), fee = AssetAmount(5000) ) diff --git a/library/src/test/java/ch/decent/sdk/api/AccountApiTest.kt b/library/src/test/java/ch/decent/sdk/api/AccountApiTest.kt index 1bce2795..326186c2 100644 --- a/library/src/test/java/ch/decent/sdk/api/AccountApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/AccountApiTest.kt @@ -1,12 +1,7 @@ package ch.decent.sdk.api -import ch.decent.sdk.account -import ch.decent.sdk.account2 -import ch.decent.sdk.accountName +import ch.decent.sdk.* import ch.decent.sdk.crypto.address -import ch.decent.sdk.exception.ObjectNotFoundException -import ch.decent.sdk.model.toChainObject -import ch.decent.sdk.public import io.reactivex.schedulers.Schedulers import org.junit.Test import org.junit.runner.RunWith @@ -14,48 +9,20 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) class AccountApiTest(channel: Channel) : BaseApiTest(channel) { -// override val useMock: Boolean = false - @Test fun `get account by id`() { - mockWebSocket - .enqueue("""{"method":"call","params":[0,"get_objects",[["1.2.35"]]],"id":1}""", """{"id":1,"result":[{"id":"1.2.35","registrar":"1.2.15","name":"u3a7b78084e7d3956442d5a4d439dad51","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP",1]]},"options":{"memo_key":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.35","top_n_control_flags":0}]}""") - - mockHttp.enqueue("""{"id":0,"result":[{"id":"1.2.35","registrar":"1.2.15","name":"u3a7b78084e7d3956442d5a4d439dad51","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP",1]]},"options":{"memo_key":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.35","top_n_control_flags":0}]}""") - - val test = api.accountApi.get(account2) + @Test fun `account should not exist`() { + val test = api.accountApi.exist("invalid-account") .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() + .assertValue(false) } - @Test fun `get account by id not found`() { - mockWebSocket - .enqueue("""{"method":"call","params":[0,"get_objects",[["1.2.34000"]]],"id":1}""", """{"id":1,"result":[null]}""") - - mockHttp.enqueue("""{"id":0,"result":[null]}""") - - val test = api.accountApi.get("1.2.34000".toChainObject()) - .subscribeOn(Schedulers.newThread()) - .test() - - test.awaitTerminalEvent() - test.assertTerminated() - .assertError(ObjectNotFoundException::class.java) - } - - @Test fun `get account by address`() { - mockWebSocket - .enqueue("""{"method":"call","params":[0,"get_key_references",[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz"]]],"id":1}""", """{"id":1,"result":[["1.2.34","1.2.775"]]}""") - .enqueue("""{"method":"call","params":[0,"get_objects",[["1.2.34"]]],"id":2}""", """{"id":2,"result":[{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0}]}""") - - mockHttp.enqueue("""{"id":0,"result":[["1.2.34","1.2.775"]]}""") - mockHttp.enqueue("""{"id":0,"result":[{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0}]}""") - - val test = api.accountApi.findAllReferencesByKeys(listOf(public.address())).map { it.single().first() } - .flatMap { api.accountApi.get(it) } + @Test fun `should get account by id`() { + val test = api.accountApi.get(Helpers.account) .subscribeOn(Schedulers.newThread()) .test() @@ -64,39 +31,18 @@ class AccountApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `get account by address not found`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_key_references",[["DCT5Abm5dCdy3hJ1C5ckXkqUH2Me7dXqi9Y7yjn9ACaiSJ9h8r8mL"]]],"id":1}""".trimIndent(), - """{"id":1,"result":[[]]}""" - ) - - mockHttp.enqueue( - """{"id":0,"result":[[]]}""" - ) - - val test = api.accountApi.findAllReferencesByKeys(listOf("DCT5Abm5dCdy3hJ1C5ckXkqUH2Me7dXqi9Y7yjn9ACaiSJ9h8r8mL".address())) + @Test fun `should get account by name`() { + val test = api.accountApi.getByName(Helpers.accountName) .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() - .assertValue { it.single().isEmpty() } } - @Test fun `get account by name`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_account_by_name",["u961279ec8b7ae7bd62f304f7c1c3d345"]],"id":1}""", - """{"id":1,"result":{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0}}""" - ) - - mockHttp.enqueue( - """{"id":0,"result":{"id":"1.2.35","registrar":"1.2.15","name":"u3a7b78084e7d3956442d5a4d439dad51","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP",1]]},"options":{"memo_key":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.35","top_n_control_flags":0}}""" - ) - - val test = api.accountApi.getByName(accountName) + @Test fun `should get account by name or id`() { + val test = api.accountApi.get("1.2.12") .subscribeOn(Schedulers.newThread()) .test() @@ -105,80 +51,28 @@ class AccountApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `get account by name not found`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_account_by_name",["helloooo"]],"id":1}""", - """{"id":1,"result":null}""" - ) - - mockHttp.enqueue( - """{"id":0,"result":null}""" - ) - - val test = api.accountApi.getByName("helloooo") - .subscribeOn(Schedulers.newThread()) - .test() - - test.awaitTerminalEvent() - test.assertTerminated() - .assertError(ObjectNotFoundException::class.java) - } - - @Test fun `search account history`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"search_account_history",["1.2.34","-time","1.0.0",100]],"id":1}""", - """{"id":1,"result":[{"id":"2.17.52680","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-18T08:53:10"},{"id":"2.17.52678","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-18T08:29:40"},{"id":"2.17.52517","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-13T14:15:10"},{"id":"2.17.52515","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-13T14:10:25"},{"id":"2.17.52514","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-13T14:09:40"},{"id":"2.17.52301","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":3,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"8225985137041510913","message":"6bb0a05d5d597d2e468883f65dcebdf5"},"m_timestamp":"2018-12-12T12:33:30"},{"id":"2.17.52300","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":2,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"13772278880363122689","message":"9b955a68cf707d0617c40fc1dcc843a7"},"m_timestamp":"2018-12-12T12:09:00"},{"id":"2.17.52296","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"12349095297475186433","message":"f8c41beea4705ed03e0c048dd149ac09"},"m_timestamp":"2018-12-12T11:46:55"},{"id":"2.17.52234","m_from_account":"1.2.34","m_to_account":"1.2.687","m_operation_type":0,"m_transaction_amount":{"amount":10000000,"asset_id":"1.3.53"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-11T15:59:35"},{"id":"2.17.52085","m_from_account":"1.2.34","m_to_account":"1.2.687","m_operation_type":0,"m_transaction_amount":{"amount":10000000,"asset_id":"1.3.53"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.53"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-11T12:30:10"},{"id":"2.17.52081","m_from_account":"1.2.687","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":1000000000,"asset_id":"1.3.53"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-11T12:29:20"},{"id":"2.17.52074","m_from_account":"1.2.687","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":100,"asset_id":"1.3.44"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-11T12:22:15"},{"id":"2.17.52024","m_from_account":"1.2.34","m_to_account":"1.2.0","m_operation_type":2,"m_transaction_amount":{"amount":10,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":50000,"asset_id":"1.3.0"},"m_str_description":"sss","m_timestamp":"2018-12-10T13:00:05"},{"id":"2.17.52007","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-08T22:15:25"},{"id":"2.17.52006","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-08T21:59:15"},{"id":"2.17.52005","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-08T21:50:20"},{"id":"2.17.52004","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-08T21:05:20"},{"id":"2.17.52003","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-08T21:03:30"},{"id":"2.17.51988","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"7650138029544938240","message":"f4026ea182e90813fc946c2456084ace"},"m_timestamp":"2018-12-07T11:44:00"},{"id":"2.17.51950","m_from_account":"1.2.687","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.44"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-06T10:23:30"},{"id":"2.17.51949","m_from_account":"1.2.687","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":1000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-06T10:22:15"},{"id":"2.17.51948","m_from_account":"1.2.687","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":100000,"asset_id":"1.3.53"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MahVeNxrgk8BoLDWh8Gti26hGyWryNp2JmfxNioQpi7VF8sa2","to":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","nonce":"2699819554067673344","message":"91e64ef67db445feccd4c798cd311ac0"},"m_timestamp":"2018-12-06T10:21:40"},{"id":"2.17.51915","m_from_account":"1.2.34","m_to_account":"1.2.687","m_operation_type":0,"m_transaction_amount":{"amount":200000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-05T11:48:45"},{"id":"2.17.51914","m_from_account":"1.2.34","m_to_account":"1.2.687","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-05T11:43:35"},{"id":"2.17.51907","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":110000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-05T11:04:40"},{"id":"2.17.51906","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":8880000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-05T11:01:10"},{"id":"2.17.51899","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT86Z71VtXNC5P9mRbW5RyPDFGBCwsGBBnUfd5v67kozmCD1P8Wd","nonce":"17924788152174990594","message":"0829ea670a2ca8f8b7d690906350ec3d"},"m_timestamp":"2018-12-05T08:30:15"},{"id":"2.17.51891","m_from_account":"1.2.34","m_to_account":"1.2.687","m_operation_type":0,"m_transaction_amount":{"amount":1000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-04T14:22:15"},{"id":"2.17.51890","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"m_timestamp":"2018-12-04T14:17:15"},{"id":"2.17.51889","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":100,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-04T14:05:40"},{"id":"2.17.51888","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-04T14:02:30"},{"id":"2.17.51887","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"m_timestamp":"2018-12-04T13:36:50"},{"id":"2.17.51886","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"m_timestamp":"2018-12-04T13:29:15"},{"id":"2.17.51885","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT86Z71VtXNC5P9mRbW5RyPDFGBCwsGBBnUfd5v67kozmCD1P8Wd","nonce":"13958730344158767360","message":"f34d2b81ae8029cbd6f8d00375727fd9"},"m_timestamp":"2018-12-04T13:22:55"},{"id":"2.17.51840","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":10000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T12:17:15"},{"id":"2.17.51838","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":1000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T12:05:05"},{"id":"2.17.51837","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":10000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T12:01:35"},{"id":"2.17.51832","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":10000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T11:16:15"},{"id":"2.17.51831","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T11:13:25"},{"id":"2.17.51830","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":1000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T11:02:45"},{"id":"2.17.51829","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":1000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T10:57:50"},{"id":"2.17.51828","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":100000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T10:44:45"},{"id":"2.17.51827","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":1000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T10:39:50"},{"id":"2.17.51823","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":10000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T10:23:45"},{"id":"2.17.51822","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":12345678,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T10:22:50"},{"id":"2.17.51821","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":10000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T10:14:25"},{"id":"2.17.51788","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":50000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT5fSPDaH5Pi9K1fFmTMGLXVVVGu9y96FimJhGdLTSxXCFmMhB3a","nonce":"11719174962739675136","message":"d7bd50943895f6f3c713e14410010a33"},"m_timestamp":"2018-11-30T12:31:05"},{"id":"2.17.51785","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-30T12:08:20"},{"id":"2.17.51784","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-30T12:00:00"},{"id":"2.17.51783","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-30T11:59:00"},{"id":"2.17.51782","m_from_account":"1.2.687","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-30T11:13:45"},{"id":"2.17.51780","m_from_account":"1.2.687","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":420000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-30T10:54:10"},{"id":"2.17.51779","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"m_timestamp":"2018-11-30T10:10:10"},{"id":"2.17.51778","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-30T09:36:05"},{"id":"2.17.51757","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T16:54:10"},{"id":"2.17.51754","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T15:10:35"},{"id":"2.17.51753","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T15:08:50"},{"id":"2.17.51752","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T15:07:35"},{"id":"2.17.51751","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T15:00:50"},{"id":"2.17.51750","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T15:00:40"},{"id":"2.17.51749","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T15:00:30"},{"id":"2.17.51748","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T15:00:20"},{"id":"2.17.51692","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":150000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T15:29:55"},{"id":"2.17.51691","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":200000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T15:11:35"},{"id":"2.17.51690","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T15:05:55"},{"id":"2.17.51689","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":120000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T14:59:25"},{"id":"2.17.51688","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T14:52:15"},{"id":"2.17.51685","m_from_account":"1.2.17","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":160000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT7VKzkLeYTREZzCQZux5bgt61woHnhpkTBJRNnTEGnbdtpLd3n4","to":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","nonce":"6102912892363117824","message":"69eaa86d279aef68310b997286a05dbc"},"m_timestamp":"2018-11-27T13:53:10"},{"id":"2.17.51679","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":32400000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT86Z71VtXNC5P9mRbW5RyPDFGBCwsGBBnUfd5v67kozmCD1P8Wd","nonce":"2016755150050929152","message":"e153e0d94471ceae4f199b7640277852"},"m_timestamp":"2018-11-27T11:18:40"},{"id":"2.17.51678","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":32500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T11:10:45"},{"id":"2.17.51677","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":55400000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T11:09:35"},{"id":"2.17.51676","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":156000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T11:07:40"},{"id":"2.17.51675","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":150000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T10:25:25"},{"id":"2.17.51671","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":200000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT86Z71VtXNC5P9mRbW5RyPDFGBCwsGBBnUfd5v67kozmCD1P8Wd","nonce":"9168271205428338944","message":"bdb2e67762bebcc6d8904e7c06451731"},"m_timestamp":"2018-11-27T07:13:00"},{"id":"2.17.51670","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT86Z71VtXNC5P9mRbW5RyPDFGBCwsGBBnUfd5v67kozmCD1P8Wd","nonce":"5218944459109867776","message":"47fe2a7202ad85afdeb2aa39b2d321b0"},"m_timestamp":"2018-11-27T07:08:15"},{"id":"2.17.51666","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12300000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-26T23:03:25"},{"id":"2.17.51665","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-26T23:02:35"},{"id":"2.17.51615","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-23T09:44:00"},{"id":"2.17.51610","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":250000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-23T09:07:40"},{"id":"2.17.51573","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-22T12:42:55"},{"id":"2.17.51572","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-22T12:27:15"},{"id":"2.17.51571","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-22T12:18:50"},{"id":"2.17.51570","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-22T12:11:40"},{"id":"2.17.51569","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-22T12:09:35"},{"id":"2.17.51565","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":200000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-22T11:16:10"},{"id":"2.17.51564","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-22T11:15:00"},{"id":"2.17.51501","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"10854426477442327809","message":"541bf2bacdf649ac11e422f158ca7dad"},"m_timestamp":"2018-11-17T12:56:20"},{"id":"2.17.51500","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"9111025666156422145","message":"ac044c5c9e4668e7084f0b4b1aa0aee8"},"m_timestamp":"2018-11-17T12:41:05"},{"id":"2.17.51499","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"14761242053299474176","message":"dbe6a771f409336738ff3043ebbe305e"},"m_timestamp":"2018-11-17T12:33:55"},{"id":"2.17.51498","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"761008543324005121","message":"fe42bf556d06ffb0b2358bd0a2b8392d"},"m_timestamp":"2018-11-17T12:25:35"},{"id":"2.17.51497","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17482914454207859200","message":"ce59e4df7113d439c05b2b8a232d17c5"},"m_timestamp":"2018-11-17T11:04:45"},{"id":"2.17.51496","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"5512915769376770048","message":"018bf632f54d3bb6383a4a9aea7c80d2"},"m_timestamp":"2018-11-17T10:23:35"},{"id":"2.17.51474","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"2772020304535004672","message":"9395e2416062ae3213b724a0630d67aa"},"m_timestamp":"2018-11-15T22:52:40"},{"id":"2.17.51438","m_from_account":"1.2.34","m_to_account":"1.2.11705","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT8ZPKEvt8VXuzBsDgw7ZxiCw86p5eiHMGju6ckLTCLYezHAZpB6","nonce":"394799039953530","message":"2e65f45053968e3ddd3463480365f9eb"},"m_timestamp":"2018-11-14T08:22:30"},{"id":"2.17.51435","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"1965405722485841152","message":"3abd5daa5c5b57a29640bb14e7b6849b"},"m_timestamp":"2018-11-13T20:04:25"},{"id":"2.17.51368","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-12T08:08:25"},{"id":"2.17.51367","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-12T08:03:05"},{"id":"2.17.51366","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-12T01:41:20"},{"id":"2.17.51365","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"4794137663151575552","message":"0ccc11b0edc011220bcfee20818bf8e1"},"m_timestamp":"2018-11-11T15:34:40"},{"id":"2.17.51364","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"12493614158169215488","message":"f40d1c4722ac484a3f8487e91383ed95"},"m_timestamp":"2018-11-11T15:34:30"}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"id":"2.17.52680","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-18T08:53:10"},{"id":"2.17.52678","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-18T08:29:40"},{"id":"2.17.52517","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-13T14:15:10"},{"id":"2.17.52515","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-13T14:10:25"},{"id":"2.17.52514","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-13T14:09:40"},{"id":"2.17.52301","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":3,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"8225985137041510913","message":"6bb0a05d5d597d2e468883f65dcebdf5"},"m_timestamp":"2018-12-12T12:33:30"},{"id":"2.17.52300","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":2,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"13772278880363122689","message":"9b955a68cf707d0617c40fc1dcc843a7"},"m_timestamp":"2018-12-12T12:09:00"},{"id":"2.17.52296","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"12349095297475186433","message":"f8c41beea4705ed03e0c048dd149ac09"},"m_timestamp":"2018-12-12T11:46:55"},{"id":"2.17.52234","m_from_account":"1.2.34","m_to_account":"1.2.687","m_operation_type":0,"m_transaction_amount":{"amount":10000000,"asset_id":"1.3.53"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-11T15:59:35"},{"id":"2.17.52085","m_from_account":"1.2.34","m_to_account":"1.2.687","m_operation_type":0,"m_transaction_amount":{"amount":10000000,"asset_id":"1.3.53"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.53"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-11T12:30:10"},{"id":"2.17.52081","m_from_account":"1.2.687","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":1000000000,"asset_id":"1.3.53"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-11T12:29:20"},{"id":"2.17.52074","m_from_account":"1.2.687","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":100,"asset_id":"1.3.44"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-11T12:22:15"},{"id":"2.17.52024","m_from_account":"1.2.34","m_to_account":"1.2.0","m_operation_type":2,"m_transaction_amount":{"amount":10,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":50000,"asset_id":"1.3.0"},"m_str_description":"sss","m_timestamp":"2018-12-10T13:00:05"},{"id":"2.17.52007","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-08T22:15:25"},{"id":"2.17.52006","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-08T21:59:15"},{"id":"2.17.52005","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-08T21:50:20"},{"id":"2.17.52004","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-08T21:05:20"},{"id":"2.17.52003","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-12-08T21:03:30"},{"id":"2.17.51988","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"7650138029544938240","message":"f4026ea182e90813fc946c2456084ace"},"m_timestamp":"2018-12-07T11:44:00"},{"id":"2.17.51950","m_from_account":"1.2.687","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.44"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-06T10:23:30"},{"id":"2.17.51949","m_from_account":"1.2.687","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":1000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-06T10:22:15"},{"id":"2.17.51948","m_from_account":"1.2.687","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":100000,"asset_id":"1.3.53"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MahVeNxrgk8BoLDWh8Gti26hGyWryNp2JmfxNioQpi7VF8sa2","to":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","nonce":"2699819554067673344","message":"91e64ef67db445feccd4c798cd311ac0"},"m_timestamp":"2018-12-06T10:21:40"},{"id":"2.17.51915","m_from_account":"1.2.34","m_to_account":"1.2.687","m_operation_type":0,"m_transaction_amount":{"amount":200000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-05T11:48:45"},{"id":"2.17.51914","m_from_account":"1.2.34","m_to_account":"1.2.687","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-05T11:43:35"},{"id":"2.17.51907","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":110000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-05T11:04:40"},{"id":"2.17.51906","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":8880000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-05T11:01:10"},{"id":"2.17.51899","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT86Z71VtXNC5P9mRbW5RyPDFGBCwsGBBnUfd5v67kozmCD1P8Wd","nonce":"17924788152174990594","message":"0829ea670a2ca8f8b7d690906350ec3d"},"m_timestamp":"2018-12-05T08:30:15"},{"id":"2.17.51891","m_from_account":"1.2.34","m_to_account":"1.2.687","m_operation_type":0,"m_transaction_amount":{"amount":1000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-04T14:22:15"},{"id":"2.17.51890","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"m_timestamp":"2018-12-04T14:17:15"},{"id":"2.17.51889","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":100,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-04T14:05:40"},{"id":"2.17.51888","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-04T14:02:30"},{"id":"2.17.51887","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"m_timestamp":"2018-12-04T13:36:50"},{"id":"2.17.51886","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"m_timestamp":"2018-12-04T13:29:15"},{"id":"2.17.51885","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT86Z71VtXNC5P9mRbW5RyPDFGBCwsGBBnUfd5v67kozmCD1P8Wd","nonce":"13958730344158767360","message":"f34d2b81ae8029cbd6f8d00375727fd9"},"m_timestamp":"2018-12-04T13:22:55"},{"id":"2.17.51840","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":10000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T12:17:15"},{"id":"2.17.51838","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":1000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T12:05:05"},{"id":"2.17.51837","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":10000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T12:01:35"},{"id":"2.17.51832","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":10000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T11:16:15"},{"id":"2.17.51831","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T11:13:25"},{"id":"2.17.51830","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":1000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T11:02:45"},{"id":"2.17.51829","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":1000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T10:57:50"},{"id":"2.17.51828","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":100000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T10:44:45"},{"id":"2.17.51827","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":1000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T10:39:50"},{"id":"2.17.51823","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":10000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T10:23:45"},{"id":"2.17.51822","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":12345678,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T10:22:50"},{"id":"2.17.51821","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":10000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-12-03T10:14:25"},{"id":"2.17.51788","m_from_account":"1.2.34","m_to_account":"1.2.1564","m_operation_type":0,"m_transaction_amount":{"amount":50000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT5fSPDaH5Pi9K1fFmTMGLXVVVGu9y96FimJhGdLTSxXCFmMhB3a","nonce":"11719174962739675136","message":"d7bd50943895f6f3c713e14410010a33"},"m_timestamp":"2018-11-30T12:31:05"},{"id":"2.17.51785","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-30T12:08:20"},{"id":"2.17.51784","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-30T12:00:00"},{"id":"2.17.51783","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-30T11:59:00"},{"id":"2.17.51782","m_from_account":"1.2.687","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-30T11:13:45"},{"id":"2.17.51780","m_from_account":"1.2.687","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":420000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-30T10:54:10"},{"id":"2.17.51779","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"m_timestamp":"2018-11-30T10:10:10"},{"id":"2.17.51778","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-30T09:36:05"},{"id":"2.17.51757","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T16:54:10"},{"id":"2.17.51754","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T15:10:35"},{"id":"2.17.51753","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T15:08:50"},{"id":"2.17.51752","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T15:07:35"},{"id":"2.17.51751","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T15:00:50"},{"id":"2.17.51750","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T15:00:40"},{"id":"2.17.51749","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T15:00:30"},{"id":"2.17.51748","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-29T15:00:20"},{"id":"2.17.51692","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":150000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T15:29:55"},{"id":"2.17.51691","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":200000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T15:11:35"},{"id":"2.17.51690","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T15:05:55"},{"id":"2.17.51689","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":120000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T14:59:25"},{"id":"2.17.51688","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T14:52:15"},{"id":"2.17.51685","m_from_account":"1.2.17","m_to_account":"1.2.34","m_operation_type":0,"m_transaction_amount":{"amount":160000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT7VKzkLeYTREZzCQZux5bgt61woHnhpkTBJRNnTEGnbdtpLd3n4","to":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","nonce":"6102912892363117824","message":"69eaa86d279aef68310b997286a05dbc"},"m_timestamp":"2018-11-27T13:53:10"},{"id":"2.17.51679","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":32400000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT86Z71VtXNC5P9mRbW5RyPDFGBCwsGBBnUfd5v67kozmCD1P8Wd","nonce":"2016755150050929152","message":"e153e0d94471ceae4f199b7640277852"},"m_timestamp":"2018-11-27T11:18:40"},{"id":"2.17.51678","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":32500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T11:10:45"},{"id":"2.17.51677","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":55400000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T11:09:35"},{"id":"2.17.51676","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":156000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T11:07:40"},{"id":"2.17.51675","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":150000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-27T10:25:25"},{"id":"2.17.51671","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":200000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT86Z71VtXNC5P9mRbW5RyPDFGBCwsGBBnUfd5v67kozmCD1P8Wd","nonce":"9168271205428338944","message":"bdb2e67762bebcc6d8904e7c06451731"},"m_timestamp":"2018-11-27T07:13:00"},{"id":"2.17.51670","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT86Z71VtXNC5P9mRbW5RyPDFGBCwsGBBnUfd5v67kozmCD1P8Wd","nonce":"5218944459109867776","message":"47fe2a7202ad85afdeb2aa39b2d321b0"},"m_timestamp":"2018-11-27T07:08:15"},{"id":"2.17.51666","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12300000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-26T23:03:25"},{"id":"2.17.51665","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"m_timestamp":"2018-11-26T23:02:35"},{"id":"2.17.51615","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-23T09:44:00"},{"id":"2.17.51610","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":250000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-23T09:07:40"},{"id":"2.17.51573","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-22T12:42:55"},{"id":"2.17.51572","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-22T12:27:15"},{"id":"2.17.51571","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-22T12:18:50"},{"id":"2.17.51570","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-22T12:11:40"},{"id":"2.17.51569","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":500000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-22T12:09:35"},{"id":"2.17.51565","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":200000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-22T11:16:10"},{"id":"2.17.51564","m_from_account":"1.2.34","m_to_account":"1.2.11792","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-22T11:15:00"},{"id":"2.17.51501","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"10854426477442327809","message":"541bf2bacdf649ac11e422f158ca7dad"},"m_timestamp":"2018-11-17T12:56:20"},{"id":"2.17.51500","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"9111025666156422145","message":"ac044c5c9e4668e7084f0b4b1aa0aee8"},"m_timestamp":"2018-11-17T12:41:05"},{"id":"2.17.51499","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"14761242053299474176","message":"dbe6a771f409336738ff3043ebbe305e"},"m_timestamp":"2018-11-17T12:33:55"},{"id":"2.17.51498","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"761008543324005121","message":"fe42bf556d06ffb0b2358bd0a2b8392d"},"m_timestamp":"2018-11-17T12:25:35"},{"id":"2.17.51497","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17482914454207859200","message":"ce59e4df7113d439c05b2b8a232d17c5"},"m_timestamp":"2018-11-17T11:04:45"},{"id":"2.17.51496","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"5512915769376770048","message":"018bf632f54d3bb6383a4a9aea7c80d2"},"m_timestamp":"2018-11-17T10:23:35"},{"id":"2.17.51474","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"2772020304535004672","message":"9395e2416062ae3213b724a0630d67aa"},"m_timestamp":"2018-11-15T22:52:40"},{"id":"2.17.51438","m_from_account":"1.2.34","m_to_account":"1.2.11705","m_operation_type":0,"m_transaction_amount":{"amount":100000000,"asset_id":"1.3.54"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT8ZPKEvt8VXuzBsDgw7ZxiCw86p5eiHMGju6ckLTCLYezHAZpB6","nonce":"394799039953530","message":"2e65f45053968e3ddd3463480365f9eb"},"m_timestamp":"2018-11-14T08:22:30"},{"id":"2.17.51435","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"1965405722485841152","message":"3abd5daa5c5b57a29640bb14e7b6849b"},"m_timestamp":"2018-11-13T20:04:25"},{"id":"2.17.51368","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-12T08:08:25"},{"id":"2.17.51367","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-12T08:03:05"},{"id":"2.17.51366","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":1,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_timestamp":"2018-11-12T01:41:20"},{"id":"2.17.51365","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"4794137663151575552","message":"0ccc11b0edc011220bcfee20818bf8e1"},"m_timestamp":"2018-11-11T15:34:40"},{"id":"2.17.51364","m_from_account":"1.2.34","m_to_account":"1.2.35","m_operation_type":0,"m_transaction_amount":{"amount":12345000,"asset_id":"1.3.0"},"m_transaction_fee":{"amount":500000,"asset_id":"1.3.0"},"m_str_description":"transfer","m_transaction_encrypted_memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"12493614158169215488","message":"f40d1c4722ac484a3f8487e91383ed95"},"m_timestamp":"2018-11-11T15:34:30"}]}""" - ) - - val test = api.accountApi.searchAccountHistory(account) + @Test fun `should get account count`() { + val test = api.accountApi.countAll() .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() - .assertValue { it.isNotEmpty() } } - @Test fun `search account history not found`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"search_account_history",["1.2.333333","-time","1.0.0",100]],"id":1}""", - """{"id":1,"result":[]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) - - val test = api.accountApi.searchAccountHistory("1.2.333333".toChainObject()) + @Test fun `should get account references by address`() { + val test = api.accountApi.findAllReferencesByKeys(listOf(Helpers.public.address())).map { it.single().first() } .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() - .assertValue(emptyList()) } - @Test fun `get full accounts`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_full_accounts",[["u961279ec8b7ae7bd62f304f7c1c3d345","1.2.34"],false]],"id":1}""", - """{"id":1,"result":[["1.2.34",{"account":{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0},"statistics":{"id":"2.5.34","owner":"1.2.34","most_recent_op":"2.8.109869","total_ops":605,"total_core_in_orders":0,"pending_fees":0,"pending_vested_fees":0},"registrar_name":"decent","votes":[{"id":"1.4.6","miner_account":"1.2.9","last_aslot":9280815,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.3","vote_id":"0:5","total_votes":"31084811693","url":"","total_missed":478966,"last_confirmed_block_num":3440744},{"id":"1.4.9","miner_account":"1.2.12","last_aslot":9280808,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.8","vote_id":"0:8","total_votes":"573757534890","url":"","total_missed":477812,"last_confirmed_block_num":3440739}],"balances":[{"id":"2.4.29","owner":"1.2.34","asset_type":"1.3.0","balance":"24586109488"},{"id":"2.4.7564","owner":"1.2.34","asset_type":"1.3.44","balance":101},{"id":"2.4.7563","owner":"1.2.34","asset_type":"1.3.53","balance":979600000},{"id":"2.4.238","owner":"1.2.34","asset_type":"1.3.54","balance":"4764856000"}],"vesting_balances":[],"proposals":[]}],["u961279ec8b7ae7bd62f304f7c1c3d345",{"account":{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0},"statistics":{"id":"2.5.34","owner":"1.2.34","most_recent_op":"2.8.109869","total_ops":605,"total_core_in_orders":0,"pending_fees":0,"pending_vested_fees":0},"registrar_name":"decent","votes":[{"id":"1.4.6","miner_account":"1.2.9","last_aslot":9280815,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.3","vote_id":"0:5","total_votes":"31084811693","url":"","total_missed":478966,"last_confirmed_block_num":3440744},{"id":"1.4.9","miner_account":"1.2.12","last_aslot":9280808,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.8","vote_id":"0:8","total_votes":"573757534890","url":"","total_missed":477812,"last_confirmed_block_num":3440739}],"balances":[{"id":"2.4.29","owner":"1.2.34","asset_type":"1.3.0","balance":"24586109488"},{"id":"2.4.7564","owner":"1.2.34","asset_type":"1.3.44","balance":101},{"id":"2.4.7563","owner":"1.2.34","asset_type":"1.3.53","balance":979600000},{"id":"2.4.238","owner":"1.2.34","asset_type":"1.3.54","balance":"4764856000"}],"vesting_balances":[],"proposals":[]}]]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[["1.2.34",{"account":{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0},"statistics":{"id":"2.5.34","owner":"1.2.34","most_recent_op":"2.8.109869","total_ops":605,"total_core_in_orders":0,"pending_fees":0,"pending_vested_fees":0},"registrar_name":"decent","votes":[{"id":"1.4.6","miner_account":"1.2.9","last_aslot":9280815,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.3","vote_id":"0:5","total_votes":"31084811693","url":"","total_missed":478966,"last_confirmed_block_num":3440744},{"id":"1.4.9","miner_account":"1.2.12","last_aslot":9280808,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.8","vote_id":"0:8","total_votes":"573757534890","url":"","total_missed":477812,"last_confirmed_block_num":3440739}],"balances":[{"id":"2.4.29","owner":"1.2.34","asset_type":"1.3.0","balance":"24586109488"},{"id":"2.4.7564","owner":"1.2.34","asset_type":"1.3.44","balance":101},{"id":"2.4.7563","owner":"1.2.34","asset_type":"1.3.53","balance":979600000},{"id":"2.4.238","owner":"1.2.34","asset_type":"1.3.54","balance":"4764856000"}],"vesting_balances":[],"proposals":[]}],["u961279ec8b7ae7bd62f304f7c1c3d345",{"account":{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0},"statistics":{"id":"2.5.34","owner":"1.2.34","most_recent_op":"2.8.109869","total_ops":605,"total_core_in_orders":0,"pending_fees":0,"pending_vested_fees":0},"registrar_name":"decent","votes":[{"id":"1.4.6","miner_account":"1.2.9","last_aslot":9280815,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.3","vote_id":"0:5","total_votes":"31084811693","url":"","total_missed":478966,"last_confirmed_block_num":3440744},{"id":"1.4.9","miner_account":"1.2.12","last_aslot":9280808,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.8","vote_id":"0:8","total_votes":"573757534890","url":"","total_missed":477812,"last_confirmed_block_num":3440739}],"balances":[{"id":"2.4.29","owner":"1.2.34","asset_type":"1.3.0","balance":"24586109488"},{"id":"2.4.7564","owner":"1.2.34","asset_type":"1.3.44","balance":101},{"id":"2.4.7563","owner":"1.2.34","asset_type":"1.3.53","balance":979600000},{"id":"2.4.238","owner":"1.2.34","asset_type":"1.3.54","balance":"4764856000"}],"vesting_balances":[],"proposals":[]}]]}""" - ) - - val test = api.accountApi.getFullAccounts(listOf("u961279ec8b7ae7bd62f304f7c1c3d345", "1.2.34")) + @Test fun `should get account references`() { + val test = api.accountApi.findAllReferencesByAccount(Helpers.account) .subscribeOn(Schedulers.newThread()) .test() @@ -187,60 +81,28 @@ class AccountApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `get full accounts not found`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_full_accounts",[["hello"],false]],"id":1}""", - """{"id":1,"result":[]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) - - val test = api.accountApi.getFullAccounts(listOf("hello")) + @Test fun `should get accounts by ids`() { + val test = api.accountApi.getAll(listOf(Helpers.account, Helpers.account2)) .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() - .assertValue(emptyMap()) } - @Test fun `get account references`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_account_references",["1.2.34"]],"id":1}""", - """{"id":1,"result":[]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) - - val test = api.accountApi.findAllReferencesByAccount(account) + @Test fun `should get full accounts`() { + val test = api.accountApi.getFullAccounts(listOf("u961279ec8b7ae7bd62f304f7c1c3d345", "1.2.34")) .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() - .assertValue(emptyList()) } - @Test fun `get accounts by names`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"lookup_account_names",[["u961279ec8b7ae7bd62f304f7c1c3d345","u3a7b78084e7d3956442d5a4d439dad51"]]],"id":1}""", - """{"id":1,"result":[{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0},{"id":"1.2.35","registrar":"1.2.15","name":"u3a7b78084e7d3956442d5a4d439dad51","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP",1]]},"options":{"memo_key":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.35","top_n_control_flags":0}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0},{"id":"1.2.35","registrar":"1.2.15","name":"u3a7b78084e7d3956442d5a4d439dad51","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP",1]]},"options":{"memo_key":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.35","top_n_control_flags":0}]}""" - ) - - val test = api.accountApi.getAllByNames(listOf("u961279ec8b7ae7bd62f304f7c1c3d345", "u3a7b78084e7d3956442d5a4d439dad51")) + @Test fun `should get accounts by names`() { + val test = api.accountApi.getAllByNames(listOf(Helpers.accountName, Helpers.accountName2)) .subscribeOn(Schedulers.newThread()) .test() @@ -249,38 +111,18 @@ class AccountApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `get accounts by names should fail`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"lookup_account_names",[["hello"]]],"id":1}""", - """{"id":1,"result":[null]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[null]}""" - ) - - val test = api.accountApi.getAllByNames(listOf("hello")) + @Test fun `should lookup accounts by lower bound`() { + val test = api.accountApi.listAllRelative("alax", 10) .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() - test.assertTerminated() - .assertError(ObjectNotFoundException::class.java) + test.assertComplete() + .assertNoErrors() } - @Test fun `lookup accounts by lower bound`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"lookup_accounts",["alax",10]],"id":1}""", - """{"id":1,"result":[["alaxio","1.2.55"],["all-txs","1.2.85"],["all-txs2","1.2.86"],["alx-customer-00d3afac-cb38-4eb6-955a-017e53630b21","1.2.584"],["alx-customer-01265aeb-2bdb-4caa-975e-83ced23365ae","1.2.249"],["alx-customer-02b2e883-9c41-4d72-beb0-b9275b5c5be9","1.2.476"],["alx-customer-02fb0082-719d-43ae-8f24-2e2302ff5f9b","1.2.11623"],["alx-customer-030bed20-c5d4-43d9-a2dc-b1d9366595c9","1.2.1123"],["alx-customer-03320597-b5be-4f30-b8e1-b3a001d72b50","1.2.223"],["alx-customer-03f858e4-f23b-4a64-acdf-f9abb96fee54","1.2.741"]]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[["alaxio","1.2.55"],["all-txs","1.2.85"],["all-txs2","1.2.86"],["alx-customer-00d3afac-cb38-4eb6-955a-017e53630b21","1.2.584"],["alx-customer-01265aeb-2bdb-4caa-975e-83ced23365ae","1.2.249"],["alx-customer-02b2e883-9c41-4d72-beb0-b9275b5c5be9","1.2.476"],["alx-customer-02fb0082-719d-43ae-8f24-2e2302ff5f9b","1.2.11623"],["alx-customer-030bed20-c5d4-43d9-a2dc-b1d9366595c9","1.2.1123"],["alx-customer-03320597-b5be-4f30-b8e1-b3a001d72b50","1.2.223"],["alx-customer-03f858e4-f23b-4a64-acdf-f9abb96fee54","1.2.741"]]}""" - ) - - val test = api.accountApi.listAllRelative("alax", 10) + @Test fun `search accounts by term`() { + val test = api.accountApi.findAll("decent") .subscribeOn(Schedulers.newThread()) .test() @@ -289,38 +131,19 @@ class AccountApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `search accounts by term`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"search_accounts",["decent","NAME_DESC","1.0.0",1000]],"id":1}""", - """{"id":1,"result":[{"id":"1.2.15","registrar":"1.2.2","name":"decent","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4",1]]},"options":{"memo_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","voting_account":"1.2.3","num_miner":0,"votes":["0:12"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.15","top_n_control_flags":0},{"id":"1.2.16","registrar":"1.2.15","name":"decent-go","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4",1]]},"options":{"memo_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.16","top_n_control_flags":0},{"id":"1.2.79","registrar":"1.2.15","name":"decent-test1","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT76Ye5k4SMUgw2NNqpuhyjtQZQDEF5h5pL6df6mBCez8JaVoZ8g",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT76Ye5k4SMUgw2NNqpuhyjtQZQDEF5h5pL6df6mBCez8JaVoZ8g",1]]},"options":{"memo_key":"DCT76Ye5k4SMUgw2NNqpuhyjtQZQDEF5h5pL6df6mBCez8JaVoZ8g","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.79","top_n_control_flags":0},{"id":"1.2.80","registrar":"1.2.15","name":"decent-test2","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT51oiBiKzv4WVmZJmTNAoy4ZBb8TFdGEkEEDaDc7FEi2gz6PzQk",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT51oiBiKzv4WVmZJmTNAoy4ZBb8TFdGEkEEDaDc7FEi2gz6PzQk",1]]},"options":{"memo_key":"DCT51oiBiKzv4WVmZJmTNAoy4ZBb8TFdGEkEEDaDc7FEi2gz6PzQk","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.80","top_n_control_flags":0},{"id":"1.2.81","registrar":"1.2.15","name":"decent-test3","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6QurT3ZazHH6JQ5QUcMeTFvaLCgyGgwn4iK9oqgS4udjqupgmq",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6QurT3ZazHH6JQ5QUcMeTFvaLCgyGgwn4iK9oqgS4udjqupgmq",1]]},"options":{"memo_key":"DCT6QurT3ZazHH6JQ5QUcMeTFvaLCgyGgwn4iK9oqgS4udjqupgmq","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.81","top_n_control_flags":0},{"id":"1.2.82","registrar":"1.2.15","name":"decent-test4","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6ham7G5fADkR2TKLnqUPcW8q8JtsTmkCEWMnh667EHJhbe8vyP",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6ham7G5fADkR2TKLnqUPcW8q8JtsTmkCEWMnh667EHJhbe8vyP",1]]},"options":{"memo_key":"DCT6ham7G5fADkR2TKLnqUPcW8q8JtsTmkCEWMnh667EHJhbe8vyP","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.82","top_n_control_flags":0},{"id":"1.2.83","registrar":"1.2.15","name":"decent-test5","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT7WNvjuXQBw7RtCxMXyb8E7MTXA87LtkpFb1N8fKkPseaRu9PRU",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT7WNvjuXQBw7RtCxMXyb8E7MTXA87LtkpFb1N8fKkPseaRu9PRU",1]]},"options":{"memo_key":"DCT7WNvjuXQBw7RtCxMXyb8E7MTXA87LtkpFb1N8fKkPseaRu9PRU","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.83","top_n_control_flags":0},{"id":"1.2.84","registrar":"1.2.15","name":"decent-test6","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6hgxzNbUTfEuZRjM4nPQaRQwXjWHvxeravHHWP7A526ohU3tQB",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6hgxzNbUTfEuZRjM4nPQaRQwXjWHvxeravHHWP7A526ohU3tQB",1]]},"options":{"memo_key":"DCT6hgxzNbUTfEuZRjM4nPQaRQwXjWHvxeravHHWP7A526ohU3tQB","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.84","top_n_control_flags":0},{"id":"1.2.11915","registrar":"1.2.15","name":"dw-decent-wallet","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5d9pjBwAPvrG1zGrHqgrBRhFWvQQFAMd5qrS4WuXk4eP8M2ALY",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5d9pjBwAPvrG1zGrHqgrBRhFWvQQFAMd5qrS4WuXk4eP8M2ALY",1]]},"options":{"memo_key":"DCT5d9pjBwAPvrG1zGrHqgrBRhFWvQQFAMd5qrS4WuXk4eP8M2ALY","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.11915","top_n_control_flags":0},{"id":"1.2.1096","registrar":"1.2.15","name":"quoine-decent-stagenet","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5asxGy1DwHbyn7C4pwno1hf2Fs5vdUU1gj42EsE4uCSE671Z2V",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5asxGy1DwHbyn7C4pwno1hf2Fs5vdUU1gj42EsE4uCSE671Z2V",1]]},"options":{"memo_key":"DCT5asxGy1DwHbyn7C4pwno1hf2Fs5vdUU1gj42EsE4uCSE671Z2V","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.1096","top_n_control_flags":0}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"id":"1.2.15","registrar":"1.2.2","name":"decent","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4",1]]},"options":{"memo_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","voting_account":"1.2.3","num_miner":0,"votes":["0:12"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.15","top_n_control_flags":0},{"id":"1.2.16","registrar":"1.2.15","name":"decent-go","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4",1]]},"options":{"memo_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.16","top_n_control_flags":0},{"id":"1.2.79","registrar":"1.2.15","name":"decent-test1","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT76Ye5k4SMUgw2NNqpuhyjtQZQDEF5h5pL6df6mBCez8JaVoZ8g",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT76Ye5k4SMUgw2NNqpuhyjtQZQDEF5h5pL6df6mBCez8JaVoZ8g",1]]},"options":{"memo_key":"DCT76Ye5k4SMUgw2NNqpuhyjtQZQDEF5h5pL6df6mBCez8JaVoZ8g","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.79","top_n_control_flags":0},{"id":"1.2.80","registrar":"1.2.15","name":"decent-test2","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT51oiBiKzv4WVmZJmTNAoy4ZBb8TFdGEkEEDaDc7FEi2gz6PzQk",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT51oiBiKzv4WVmZJmTNAoy4ZBb8TFdGEkEEDaDc7FEi2gz6PzQk",1]]},"options":{"memo_key":"DCT51oiBiKzv4WVmZJmTNAoy4ZBb8TFdGEkEEDaDc7FEi2gz6PzQk","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.80","top_n_control_flags":0},{"id":"1.2.81","registrar":"1.2.15","name":"decent-test3","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6QurT3ZazHH6JQ5QUcMeTFvaLCgyGgwn4iK9oqgS4udjqupgmq",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6QurT3ZazHH6JQ5QUcMeTFvaLCgyGgwn4iK9oqgS4udjqupgmq",1]]},"options":{"memo_key":"DCT6QurT3ZazHH6JQ5QUcMeTFvaLCgyGgwn4iK9oqgS4udjqupgmq","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.81","top_n_control_flags":0},{"id":"1.2.82","registrar":"1.2.15","name":"decent-test4","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6ham7G5fADkR2TKLnqUPcW8q8JtsTmkCEWMnh667EHJhbe8vyP",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6ham7G5fADkR2TKLnqUPcW8q8JtsTmkCEWMnh667EHJhbe8vyP",1]]},"options":{"memo_key":"DCT6ham7G5fADkR2TKLnqUPcW8q8JtsTmkCEWMnh667EHJhbe8vyP","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.82","top_n_control_flags":0},{"id":"1.2.83","registrar":"1.2.15","name":"decent-test5","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT7WNvjuXQBw7RtCxMXyb8E7MTXA87LtkpFb1N8fKkPseaRu9PRU",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT7WNvjuXQBw7RtCxMXyb8E7MTXA87LtkpFb1N8fKkPseaRu9PRU",1]]},"options":{"memo_key":"DCT7WNvjuXQBw7RtCxMXyb8E7MTXA87LtkpFb1N8fKkPseaRu9PRU","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.83","top_n_control_flags":0},{"id":"1.2.84","registrar":"1.2.15","name":"decent-test6","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6hgxzNbUTfEuZRjM4nPQaRQwXjWHvxeravHHWP7A526ohU3tQB",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6hgxzNbUTfEuZRjM4nPQaRQwXjWHvxeravHHWP7A526ohU3tQB",1]]},"options":{"memo_key":"DCT6hgxzNbUTfEuZRjM4nPQaRQwXjWHvxeravHHWP7A526ohU3tQB","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.84","top_n_control_flags":0},{"id":"1.2.11915","registrar":"1.2.15","name":"dw-decent-wallet","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5d9pjBwAPvrG1zGrHqgrBRhFWvQQFAMd5qrS4WuXk4eP8M2ALY",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5d9pjBwAPvrG1zGrHqgrBRhFWvQQFAMd5qrS4WuXk4eP8M2ALY",1]]},"options":{"memo_key":"DCT5d9pjBwAPvrG1zGrHqgrBRhFWvQQFAMd5qrS4WuXk4eP8M2ALY","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.11915","top_n_control_flags":0},{"id":"1.2.1096","registrar":"1.2.15","name":"quoine-decent-stagenet","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5asxGy1DwHbyn7C4pwno1hf2Fs5vdUU1gj42EsE4uCSE671Z2V",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT5asxGy1DwHbyn7C4pwno1hf2Fs5vdUU1gj42EsE4uCSE671Z2V",1]]},"options":{"memo_key":"DCT5asxGy1DwHbyn7C4pwno1hf2Fs5vdUU1gj42EsE4uCSE671Z2V","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.1096","top_n_control_flags":0}]}""" - ) - - val test = api.accountApi.findAll("decent") + @Test fun `search account history`() { + val test = api.accountApi.searchAccountHistory(Helpers.account) .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() + .assertValue { it.isNotEmpty() } } - @Test fun `get account count`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_account_count",[]],"id":1}""", - """{"id":1,"result":12129}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":12129}""" - ) - - val test = api.accountApi.countAll() + @Test fun `should create credentials`() { + val test = api.accountApi.createCredentials(Helpers.accountName, Helpers.private) .subscribeOn(Schedulers.newThread()) .test() diff --git a/library/src/test/java/ch/decent/sdk/api/AssetApiTest.kt b/library/src/test/java/ch/decent/sdk/api/AssetApiTest.kt index fb01e978..a66dad17 100644 --- a/library/src/test/java/ch/decent/sdk/api/AssetApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/AssetApiTest.kt @@ -6,19 +6,8 @@ import io.reactivex.schedulers.Schedulers import org.junit.Test class AssetApiTest(channel: Channel) : BaseApiTest(channel) { -// override val useMock: Boolean = false - - @Test fun `should get assets for id`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_assets",[["1.3.0"]]],"id":1}""", - """{"id":1,"result":[{"id":"1.3.0","symbol":"DCT","precision":8,"issuer":"1.2.1","description":"","options":{"max_supply":"7319777577456900","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.0"}]}""" - ) - - mockHttp.enqueue( - """{"id":0,"result":[{"id":"1.3.0","symbol":"DCT","precision":8,"issuer":"1.2.1","description":"","options":{"max_supply":"7319777577456900","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.0"}]}""" - ) + @Test fun `should get asset for id`() { val test = api.assetApi.get("1.3.0".toChainObject()) .subscribeOn(Schedulers.newThread()) .test() @@ -28,18 +17,8 @@ class AssetApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should get asset data for id`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_objects",[["2.3.0"]]],"id":1}""", - """{"id":1,"result":[{"id":"2.3.0","current_supply":"5291193864628570","asset_pool":11000000,"core_pool":0}]}""" - ) - - mockHttp.enqueue( - """{"id":0,"result":[{"id":"2.3.0","current_supply":"5291193864628570","asset_pool":11000000,"core_pool":0}]}""" - ) - - val test = api.assetApi.getAssetData("2.3.0".toChainObject()) + @Test fun `should get assets for ids`() { + val test = api.assetApi.getAll(listOf("1.3.0".toChainObject(), "1.3.1".toChainObject())) .subscribeOn(Schedulers.newThread()) .test() @@ -48,18 +27,8 @@ class AssetApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should get assets data for id`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_objects",[["2.3.0","2.3.54"]]],"id":1}""", - """{"id":1,"result":[{"id":"2.3.0","current_supply":"5291193864628570","asset_pool":11500000,"core_pool":0},{"id":"2.3.54","current_supply":"26100000000000","asset_pool":922000000,"core_pool":"99819500000"}]}""" - ) - - mockHttp.enqueue( - """{"id":0,"result":[{"id":"2.3.0","current_supply":"5291193864628570","asset_pool":11500000,"core_pool":0},{"id":"2.3.54","current_supply":"26100000000000","asset_pool":922000000,"core_pool":"99819500000"}]}""" - ) - - val test = api.assetApi.getAssetsData(listOf("2.3.0".toChainObject(), "2.3.54".toChainObject())) + @Test fun `should get real supply`() { + val test = api.assetApi.getRealSupply() .subscribeOn(Schedulers.newThread()) .test() @@ -68,17 +37,18 @@ class AssetApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should get asset for symbol`() { - mockWebSocket.enqueue( - """{"method":"call","params":[0,"lookup_asset_symbols",[["DCT"]]],"id":1}""", - """{"id":1,"result":[{"id":"1.3.0","symbol":"DCT","precision":8,"issuer":"1.2.1","description":"","options":{"max_supply":"7319777577456900","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.0"}]}""" - ) + @Test fun `should get asset data for id`() { + val test = api.assetApi.getAssetData("2.3.0".toChainObject()) + .subscribeOn(Schedulers.newThread()) + .test() - mockHttp.enqueue( - """{"id":0,"result":[{"id":"1.3.0","symbol":"DCT","precision":8,"issuer":"1.2.1","description":"","options":{"max_supply":"7319777577456900","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.0"}]}""" - ) + test.awaitTerminalEvent() + test.assertComplete() + .assertNoErrors() + } - val test = api.assetApi.getByName("DCT") + @Test fun `should get assets data for id`() { + val test = api.assetApi.getAssetsData(listOf("2.3.0".toChainObject(), "2.3.35".toChainObject())) .subscribeOn(Schedulers.newThread()) .test() @@ -88,16 +58,7 @@ class AssetApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `should list assets for lower bound symbol`() { - mockWebSocket.enqueue( - """{"method":"call","params":[0,"list_assets",["ALX",100]],"id":1}""", - """{"id":1,"result":[{"id":"1.3.44","symbol":"ALX","precision":8,"issuer":"1.2.15","description":"","options":{"max_supply":1000000,"core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.44"}},"is_exchangeable":false,"extensions":[[1,{"is_fixed_max_supply":true}]]},"dynamic_asset_data_id":"2.3.44"},{"id":"1.3.54","symbol":"ALXT","precision":8,"issuer":"1.2.15","description":"","options":{"max_supply":"100000000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":4,"asset_id":"1.3.54"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.54"},{"id":"1.3.50","symbol":"ASDF","precision":5,"issuer":"1.2.27","description":"desc","options":{"max_supply":100,"core_exchange_rate":{"base":{"amount":100000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.50"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":true}]]},"dynamic_asset_data_id":"2.3.50"},{"id":"1.3.51","symbol":"ASDFG","precision":5,"issuer":"1.2.27","description":"desc","options":{"max_supply":100,"core_exchange_rate":{"base":{"amount":100000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.51"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":true}]]},"dynamic_asset_data_id":"2.3.51"},{"id":"1.3.52","symbol":"ASDFGH","precision":1,"issuer":"1.2.27","description":"vnifdvnod","options":{"max_supply":100,"core_exchange_rate":{"base":{"amount":100000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.52"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":true}]]},"dynamic_asset_data_id":"2.3.52"},{"id":"1.3.17","symbol":"AUD","precision":4,"issuer":"1.2.15","description":"Australian dollar","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.17"},{"id":"1.3.4","symbol":"BGN","precision":4,"issuer":"1.2.15","description":"Bulgarian lev","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.4"},{"id":"1.3.61","symbol":"BIGSATOSHI","precision":12,"issuer":"1.2.27","description":"big satoshi token","options":{"max_supply":1000000,"core_exchange_rate":{"base":{"amount":259082,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.61"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.61"},{"id":"1.3.39","symbol":"BLEH","precision":0,"issuer":"1.2.27","description":"Disgusting token","options":{"max_supply":20000,"core_exchange_rate":{"base":{"amount":20000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.39"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.39"},{"id":"1.3.18","symbol":"BRL","precision":4,"issuer":"1.2.15","description":"Brazilian real","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.18"},{"id":"1.3.38","symbol":"BUZI","precision":0,"issuer":"1.2.27","description":"buzi token","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":200000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.38"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.38"},{"id":"1.3.19","symbol":"CAD","precision":4,"issuer":"1.2.15","description":"Canadian dollar","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.19"},{"id":"1.3.12","symbol":"CHF","precision":4,"issuer":"1.2.15","description":"Swiss franc","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.12"},{"id":"1.3.20","symbol":"CNY","precision":4,"issuer":"1.2.15","description":"Chinese yuan renminbi","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.20"},{"id":"1.3.5","symbol":"CZK","precision":4,"issuer":"1.2.15","description":"Czech koruna","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.5"},{"id":"1.3.0","symbol":"DCT","precision":8,"issuer":"1.2.1","description":"","options":{"max_supply":"7319777577456900","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.0"},{"id":"1.3.6","symbol":"DKK","precision":4,"issuer":"1.2.15","description":"Danish krone","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.6"},{"id":"1.3.55","symbol":"DTO","precision":3,"issuer":"1.2.27","description":"Test asset","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.55"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.55"},{"id":"1.3.56","symbol":"DTOKENNN","precision":3,"issuer":"1.2.27","description":"Test asset","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.56"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.56"},{"id":"1.3.34","symbol":"DUS","precision":0,"issuer":"1.2.27","description":"Duskis custom token to buy a fokin content. Now begone Bitch","options":{"max_supply":80111,"core_exchange_rate":{"base":{"amount":200000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.34"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.34"},{"id":"1.3.40","symbol":"DUSKIS","precision":0,"issuer":"1.2.27","description":"duski token","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":200000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.40"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.40"},{"id":"1.3.2","symbol":"EUR","precision":4,"issuer":"1.2.15","description":"Euro","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.2"},{"id":"1.3.7","symbol":"GBP","precision":4,"issuer":"1.2.15","description":"Pound sterling","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.7"},{"id":"1.3.21","symbol":"HKD","precision":4,"issuer":"1.2.15","description":"Hong Kong dollar","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.21"},{"id":"1.3.46","symbol":"HMM","precision":0,"issuer":"1.2.15","description":"","options":{"max_supply":"1000000000000000","core_exchange_rate":{"base":{"amount":"1000000000000","asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.46"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.46"},{"id":"1.3.14","symbol":"HRK","precision":4,"issuer":"1.2.15","description":"Croatian kuna","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.14"},{"id":"1.3.8","symbol":"HUF","precision":4,"issuer":"1.2.15","description":"Hungarian forint","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.8"},{"id":"1.3.22","symbol":"IDR","precision":4,"issuer":"1.2.15","description":"Indonesian rupiah","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.22"},{"id":"1.3.23","symbol":"ILS","precision":4,"issuer":"1.2.15","description":"Israeli shekel","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.23"},{"id":"1.3.24","symbol":"INR","precision":4,"issuer":"1.2.15","description":"Indian rupee","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.24"},{"id":"1.3.3","symbol":"JPY","precision":4,"issuer":"1.2.15","description":"Japanese yen","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.3"},{"id":"1.3.25","symbol":"KRW","precision":4,"issuer":"1.2.15","description":"South Korean won","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.25"},{"id":"1.3.26","symbol":"MXN","precision":4,"issuer":"1.2.15","description":"Mexican peso","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.26"},{"id":"1.3.27","symbol":"MYR","precision":4,"issuer":"1.2.15","description":"Malaysian ringgit","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.27"},{"id":"1.3.13","symbol":"NOK","precision":4,"issuer":"1.2.15","description":"Norwegian krone","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.13"},{"id":"1.3.28","symbol":"NZD","precision":4,"issuer":"1.2.15","description":"New Zealand dollar","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.28"},{"id":"1.3.29","symbol":"PHP","precision":4,"issuer":"1.2.15","description":"Philippine peso","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.29"},{"id":"1.3.37","symbol":"PIC","precision":0,"issuer":"1.2.27","description":"buzi token","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":200000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.37"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.37"},{"id":"1.3.36","symbol":"PICKIN","precision":0,"issuer":"1.2.27","description":"Pickin token","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":400000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.36"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.36"},{"id":"1.3.9","symbol":"PLN","precision":4,"issuer":"1.2.15","description":"Polish zloty","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.9"},{"id":"1.3.58","symbol":"R1A","precision":6,"issuer":"1.2.15","description":"","options":{"max_supply":"2100000000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.58"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.58"},{"id":"1.3.42","symbol":"RATATA","precision":0,"issuer":"1.2.27","description":"This token is so ra-ta-ta-ta-ta","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":200000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.42"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.42"},{"id":"1.3.10","symbol":"RON","precision":4,"issuer":"1.2.15","description":"Romanian leu","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.10"},{"id":"1.3.59","symbol":"RRI","precision":6,"issuer":"1.2.15","description":"","options":{"max_supply":"1000000000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.59"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.59"},{"id":"1.3.57","symbol":"RRR","precision":6,"issuer":"1.2.15","description":"","options":{"max_supply":"2100000000000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.57"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.57"},{"id":"1.3.62","symbol":"RRRRR","precision":2,"issuer":"1.2.830","description":"","options":{"max_supply":"100000000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.62"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":true}]]},"dynamic_asset_data_id":"2.3.62"},{"id":"1.3.15","symbol":"RUB","precision":4,"issuer":"1.2.15","description":"Russian rouble","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.15"},{"id":"1.3.11","symbol":"SEK","precision":4,"issuer":"1.2.15","description":"Swedish krona","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.11"},{"id":"1.3.30","symbol":"SGD","precision":4,"issuer":"1.2.15","description":"Singapore dollar","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.30"},{"id":"1.3.66","symbol":"T23456789012345T","precision":2,"issuer":"1.2.11873","description":"Test token with name length 16","options":{"max_supply":"10000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.66"}},"is_exchangeable":false,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.66"},{"id":"1.3.64","symbol":"T4H","precision":2,"issuer":"1.2.11878","description":"Token 4 Hope","options":{"max_supply":10000000,"core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.64"}},"is_exchangeable":false,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.64"},{"id":"1.3.45","symbol":"TESTCOIN","precision":8,"issuer":"1.2.86","description":"new desc","options":{"max_supply":"10000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.45"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.45"},{"id":"1.3.31","symbol":"THB","precision":4,"issuer":"1.2.15","description":"Thai baht","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.31"},{"id":"1.3.33","symbol":"TOKEN","precision":0,"issuer":"1.2.15","description":"desc","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":200000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.33"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":true}]]},"dynamic_asset_data_id":"2.3.33"},{"id":"1.3.16","symbol":"TRY","precision":4,"issuer":"1.2.15","description":"Turkish lira","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.16"},{"id":"1.3.35","symbol":"TST","precision":0,"issuer":"1.2.27","description":"test token","options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":20000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.35"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.35"},{"id":"1.3.49","symbol":"UIA","precision":8,"issuer":"1.2.15","description":"desc","options":{"max_supply":"100000000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.49"}},"is_exchangeable":false,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.49"},{"id":"1.3.1","symbol":"USD","precision":4,"issuer":"1.2.15","description":"US dollar","monitored_asset_opts":{"feeds":[["1.2.85",["2018-06-15T09:58:20",{"core_exchange_rate":{"base":{"amount":4146,"asset_id":"1.3.1"},"quote":{"amount":10000,"asset_id":"1.3.0"}}}]]],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.1"},{"id":"1.3.41","symbol":"WUEY","precision":0,"issuer":"1.2.27","description":"nehehe token","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":200000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.41"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.41"},{"id":"1.3.32","symbol":"ZAR","precision":4,"issuer":"1.2.15","description":"South African rand","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.32"}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"id":"1.3.44","symbol":"ALX","precision":8,"issuer":"1.2.15","description":"","options":{"max_supply":1000000,"core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.44"}},"is_exchangeable":false,"extensions":[[1,{"is_fixed_max_supply":true}]]},"dynamic_asset_data_id":"2.3.44"},{"id":"1.3.54","symbol":"ALXT","precision":8,"issuer":"1.2.15","description":"","options":{"max_supply":"100000000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":4,"asset_id":"1.3.54"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.54"},{"id":"1.3.50","symbol":"ASDF","precision":5,"issuer":"1.2.27","description":"desc","options":{"max_supply":100,"core_exchange_rate":{"base":{"amount":100000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.50"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":true}]]},"dynamic_asset_data_id":"2.3.50"},{"id":"1.3.51","symbol":"ASDFG","precision":5,"issuer":"1.2.27","description":"desc","options":{"max_supply":100,"core_exchange_rate":{"base":{"amount":100000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.51"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":true}]]},"dynamic_asset_data_id":"2.3.51"},{"id":"1.3.52","symbol":"ASDFGH","precision":1,"issuer":"1.2.27","description":"vnifdvnod","options":{"max_supply":100,"core_exchange_rate":{"base":{"amount":100000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.52"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":true}]]},"dynamic_asset_data_id":"2.3.52"},{"id":"1.3.17","symbol":"AUD","precision":4,"issuer":"1.2.15","description":"Australian dollar","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.17"},{"id":"1.3.4","symbol":"BGN","precision":4,"issuer":"1.2.15","description":"Bulgarian lev","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.4"},{"id":"1.3.61","symbol":"BIGSATOSHI","precision":12,"issuer":"1.2.27","description":"big satoshi token","options":{"max_supply":1000000,"core_exchange_rate":{"base":{"amount":259082,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.61"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.61"},{"id":"1.3.39","symbol":"BLEH","precision":0,"issuer":"1.2.27","description":"Disgusting token","options":{"max_supply":20000,"core_exchange_rate":{"base":{"amount":20000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.39"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.39"},{"id":"1.3.18","symbol":"BRL","precision":4,"issuer":"1.2.15","description":"Brazilian real","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.18"},{"id":"1.3.38","symbol":"BUZI","precision":0,"issuer":"1.2.27","description":"buzi token","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":200000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.38"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.38"},{"id":"1.3.19","symbol":"CAD","precision":4,"issuer":"1.2.15","description":"Canadian dollar","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.19"},{"id":"1.3.12","symbol":"CHF","precision":4,"issuer":"1.2.15","description":"Swiss franc","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.12"},{"id":"1.3.20","symbol":"CNY","precision":4,"issuer":"1.2.15","description":"Chinese yuan renminbi","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.20"},{"id":"1.3.5","symbol":"CZK","precision":4,"issuer":"1.2.15","description":"Czech koruna","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.5"},{"id":"1.3.0","symbol":"DCT","precision":8,"issuer":"1.2.1","description":"","options":{"max_supply":"7319777577456900","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.0"},{"id":"1.3.6","symbol":"DKK","precision":4,"issuer":"1.2.15","description":"Danish krone","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.6"},{"id":"1.3.55","symbol":"DTO","precision":3,"issuer":"1.2.27","description":"Test asset","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.55"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.55"},{"id":"1.3.56","symbol":"DTOKENNN","precision":3,"issuer":"1.2.27","description":"Test asset","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.56"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.56"},{"id":"1.3.34","symbol":"DUS","precision":0,"issuer":"1.2.27","description":"Duskis custom token to buy a fokin content. Now begone Bitch","options":{"max_supply":80111,"core_exchange_rate":{"base":{"amount":200000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.34"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.34"},{"id":"1.3.40","symbol":"DUSKIS","precision":0,"issuer":"1.2.27","description":"duski token","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":200000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.40"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.40"},{"id":"1.3.2","symbol":"EUR","precision":4,"issuer":"1.2.15","description":"Euro","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.2"},{"id":"1.3.7","symbol":"GBP","precision":4,"issuer":"1.2.15","description":"Pound sterling","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.7"},{"id":"1.3.21","symbol":"HKD","precision":4,"issuer":"1.2.15","description":"Hong Kong dollar","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.21"},{"id":"1.3.46","symbol":"HMM","precision":0,"issuer":"1.2.15","description":"","options":{"max_supply":"1000000000000000","core_exchange_rate":{"base":{"amount":"1000000000000","asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.46"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.46"},{"id":"1.3.14","symbol":"HRK","precision":4,"issuer":"1.2.15","description":"Croatian kuna","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.14"},{"id":"1.3.8","symbol":"HUF","precision":4,"issuer":"1.2.15","description":"Hungarian forint","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.8"},{"id":"1.3.22","symbol":"IDR","precision":4,"issuer":"1.2.15","description":"Indonesian rupiah","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.22"},{"id":"1.3.23","symbol":"ILS","precision":4,"issuer":"1.2.15","description":"Israeli shekel","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.23"},{"id":"1.3.24","symbol":"INR","precision":4,"issuer":"1.2.15","description":"Indian rupee","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.24"},{"id":"1.3.3","symbol":"JPY","precision":4,"issuer":"1.2.15","description":"Japanese yen","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.3"},{"id":"1.3.25","symbol":"KRW","precision":4,"issuer":"1.2.15","description":"South Korean won","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.25"},{"id":"1.3.26","symbol":"MXN","precision":4,"issuer":"1.2.15","description":"Mexican peso","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.26"},{"id":"1.3.27","symbol":"MYR","precision":4,"issuer":"1.2.15","description":"Malaysian ringgit","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.27"},{"id":"1.3.13","symbol":"NOK","precision":4,"issuer":"1.2.15","description":"Norwegian krone","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.13"},{"id":"1.3.28","symbol":"NZD","precision":4,"issuer":"1.2.15","description":"New Zealand dollar","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.28"},{"id":"1.3.29","symbol":"PHP","precision":4,"issuer":"1.2.15","description":"Philippine peso","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.29"},{"id":"1.3.37","symbol":"PIC","precision":0,"issuer":"1.2.27","description":"buzi token","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":200000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.37"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.37"},{"id":"1.3.36","symbol":"PICKIN","precision":0,"issuer":"1.2.27","description":"Pickin token","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":400000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.36"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.36"},{"id":"1.3.9","symbol":"PLN","precision":4,"issuer":"1.2.15","description":"Polish zloty","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.9"},{"id":"1.3.58","symbol":"R1A","precision":6,"issuer":"1.2.15","description":"","options":{"max_supply":"2100000000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.58"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.58"},{"id":"1.3.42","symbol":"RATATA","precision":0,"issuer":"1.2.27","description":"This token is so ra-ta-ta-ta-ta","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":200000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.42"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.42"},{"id":"1.3.10","symbol":"RON","precision":4,"issuer":"1.2.15","description":"Romanian leu","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.10"},{"id":"1.3.59","symbol":"RRI","precision":6,"issuer":"1.2.15","description":"","options":{"max_supply":"1000000000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.59"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.59"},{"id":"1.3.57","symbol":"RRR","precision":6,"issuer":"1.2.15","description":"","options":{"max_supply":"2100000000000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.57"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.57"},{"id":"1.3.62","symbol":"RRRRR","precision":2,"issuer":"1.2.830","description":"","options":{"max_supply":"100000000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.62"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":true}]]},"dynamic_asset_data_id":"2.3.62"},{"id":"1.3.15","symbol":"RUB","precision":4,"issuer":"1.2.15","description":"Russian rouble","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.15"},{"id":"1.3.11","symbol":"SEK","precision":4,"issuer":"1.2.15","description":"Swedish krona","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.11"},{"id":"1.3.30","symbol":"SGD","precision":4,"issuer":"1.2.15","description":"Singapore dollar","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.30"},{"id":"1.3.66","symbol":"T23456789012345T","precision":2,"issuer":"1.2.11873","description":"Test token with name length 16","options":{"max_supply":"10000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.66"}},"is_exchangeable":false,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.66"},{"id":"1.3.64","symbol":"T4H","precision":2,"issuer":"1.2.11878","description":"Token 4 Hope","options":{"max_supply":10000000,"core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.64"}},"is_exchangeable":false,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.64"},{"id":"1.3.45","symbol":"TESTCOIN","precision":8,"issuer":"1.2.86","description":"new desc","options":{"max_supply":"10000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.45"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.45"},{"id":"1.3.31","symbol":"THB","precision":4,"issuer":"1.2.15","description":"Thai baht","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.31"},{"id":"1.3.33","symbol":"TOKEN","precision":0,"issuer":"1.2.15","description":"desc","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":200000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.33"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":true}]]},"dynamic_asset_data_id":"2.3.33"},{"id":"1.3.16","symbol":"TRY","precision":4,"issuer":"1.2.15","description":"Turkish lira","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.16"},{"id":"1.3.35","symbol":"TST","precision":0,"issuer":"1.2.27","description":"test token","options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":20000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.35"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.35"},{"id":"1.3.49","symbol":"UIA","precision":8,"issuer":"1.2.15","description":"desc","options":{"max_supply":"100000000000000","core_exchange_rate":{"base":{"amount":1,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.49"}},"is_exchangeable":false,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.49"},{"id":"1.3.1","symbol":"USD","precision":4,"issuer":"1.2.15","description":"US dollar","monitored_asset_opts":{"feeds":[["1.2.85",["2018-06-15T09:58:20",{"core_exchange_rate":{"base":{"amount":4146,"asset_id":"1.3.1"},"quote":{"amount":10000,"asset_id":"1.3.0"}}}]]],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.1"},{"id":"1.3.41","symbol":"WUEY","precision":0,"issuer":"1.2.27","description":"nehehe token","options":{"max_supply":10000,"core_exchange_rate":{"base":{"amount":200000000,"asset_id":"1.3.0"},"quote":{"amount":1,"asset_id":"1.3.41"}},"is_exchangeable":true,"extensions":[[1,{"is_fixed_max_supply":false}]]},"dynamic_asset_data_id":"2.3.41"},{"id":"1.3.32","symbol":"ZAR","precision":4,"issuer":"1.2.15","description":"South African rand","monitored_asset_opts":{"feeds":[],"current_feed":{"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}}},"current_feed_publication_time":"2018-12-19T12:56:45","feed_lifetime_sec":86400,"minimum_feeds":1},"options":{"max_supply":0,"core_exchange_rate":{"base":{"amount":0,"asset_id":"1.3.0"},"quote":{"amount":0,"asset_id":"1.3.0"}},"is_exchangeable":true,"extensions":[]},"dynamic_asset_data_id":"2.3.32"}]}""" - ) - - val test = api.assetApi.listAllRelative("ALX") + val test = api.assetApi.listAllRelative("A") .subscribeOn(Schedulers.newThread()) .test() @@ -106,17 +67,8 @@ class AssetApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should get price in DCT`() { - mockWebSocket.enqueue( - """{"method":"call","params":[0,"price_to_dct",[{"amount":1000,"asset_id":"1.3.54"}]],"id":1}""", - """{"id":1,"result":{"amount":250,"asset_id":"1.3.0"}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"amount":250,"asset_id":"1.3.0"}}""" - ) - - val test = api.assetApi.convertToDct(AssetAmount(1000, "1.3.54")) + @Test fun `should get asset for symbol`() { + val test = api.assetApi.getByName("DCT") .subscribeOn(Schedulers.newThread()) .test() @@ -125,17 +77,18 @@ class AssetApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should get real supply`() { - mockWebSocket.enqueue( - """{"method":"call","params":[0,"get_real_supply",[]],"id":1}""", - """{"id":1,"result":{"account_balances":"5130347742908235","vesting_balances":"123652637314133","escrows":263184,"pools":"216830752000"}}""" - ) + @Test fun `should get assets for symbols`() { + val test = api.assetApi.getAllByName(listOf("DCT", "USD")) + .subscribeOn(Schedulers.newThread()) + .test() - mockHttp.enqueue( - """{"id":1,"result":{"account_balances":"5130347742908235","vesting_balances":"123652637314133","escrows":263184,"pools":"216830752000"}}""" - ) + test.awaitTerminalEvent() + test.assertComplete() + .assertNoErrors() + } - val test = api.assetApi.getRealSupply() + @Test fun `should get price in DCT`() { + val test = api.assetApi.convertToDct(AssetAmount(1000, "1.3.35")) .subscribeOn(Schedulers.newThread()) .test() diff --git a/library/src/test/java/ch/decent/sdk/api/BalanceApiTest.kt b/library/src/test/java/ch/decent/sdk/api/BalanceApiTest.kt index f7bd02d3..889ccd46 100644 --- a/library/src/test/java/ch/decent/sdk/api/BalanceApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/BalanceApiTest.kt @@ -1,25 +1,34 @@ package ch.decent.sdk.api -import ch.decent.sdk.account +import ch.decent.sdk.Helpers import ch.decent.sdk.model.toChainObject import io.reactivex.schedulers.Schedulers import org.junit.Test class BalanceApiTest(channel: Channel) : BaseApiTest(channel) { -// override val useMock: Boolean = false - @Test fun `should get balance for account`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_account_balances",["1.2.34",[]]],"id":1}""", - """{"id":1,"result":[{"amount":50500000,"asset_id":"1.3.0"}]}""" - ) + @Test fun `should get balance for account id`() { + val test = api.balanceApi.get(Helpers.account, "1.3.35".toChainObject()) + .subscribeOn(Schedulers.newThread()) + .test() - mockHttp.enqueue( - """{"id":0,"result":[{"amount":50500000,"asset_id":"1.3.0"}]}""" - ) + test.awaitTerminalEvent() + test.assertComplete() + .assertNoErrors() + } + + @Test fun `should get balances for account id`() { + val test = api.balanceApi.getAll(Helpers.account) + .subscribeOn(Schedulers.newThread()) + .test() + + test.awaitTerminalEvent() + test.assertComplete() + .assertNoErrors() + } - val test = api.balanceApi.getAll(account) + @Test fun `should get balance for account name`() { + val test = api.balanceApi.get(Helpers.accountName, "1.3.35".toChainObject()) .subscribeOn(Schedulers.newThread()) .test() @@ -28,18 +37,18 @@ class BalanceApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should get zero balance for UIA`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_account_balances",["1.2.34",["1.3.56576"]]],"id":1}""", - """{"id":1,"result":[{"amount":0,"asset_id":"1.3.56576"}]}""" - ) + @Test fun `should get balances for account name`() { + val test = api.balanceApi.getAll(Helpers.accountName) + .subscribeOn(Schedulers.newThread()) + .test() - mockHttp.enqueue( - """{"id":0,"result":[{"amount":50500000,"asset_id":"1.3.0"}]}""" - ) + test.awaitTerminalEvent() + test.assertComplete() + .assertNoErrors() + } - val test = api.balanceApi.get(account, "1.3.56576".toChainObject()) + @Test fun `should get balance for account id with asset`() { + val test = api.balanceApi.getWithAsset(Helpers.account, "DCT") .subscribeOn(Schedulers.newThread()) .test() @@ -48,18 +57,38 @@ class BalanceApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should get vesting balances`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_vesting_balances",["1.2.34"]],"id":1}""", - """{"id":1,"result":[]}""" - ) + @Test fun `should get balances for account id with asset`() { + val test = api.balanceApi.getAllWithAsset(Helpers.account, listOf("DCT", "SDK")) + .subscribeOn(Schedulers.newThread()) + .test() + + test.awaitTerminalEvent() + test.assertComplete() + .assertNoErrors() + } + + @Test fun `should get balance for account name with asset`() { + val test = api.balanceApi.getWithAsset(Helpers.accountName, "DCT") + .subscribeOn(Schedulers.newThread()) + .test() + + test.awaitTerminalEvent() + test.assertComplete() + .assertNoErrors() + } - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) + @Test fun `should get balances for account name with asset`() { + val test = api.balanceApi.getAllWithAsset(Helpers.accountName, listOf("DCT", "SDK")) + .subscribeOn(Schedulers.newThread()) + .test() - val test = api.balanceApi.getAllVesting(account) + test.awaitTerminalEvent() + test.assertComplete() + .assertNoErrors() + } + + @Test fun `should get vesting balances`() { + val test = api.balanceApi.getAllVesting(Helpers.account) .subscribeOn(Schedulers.newThread()) .test() diff --git a/library/src/test/java/ch/decent/sdk/api/BaseApiTest.kt b/library/src/test/java/ch/decent/sdk/api/BaseApiTest.kt index 99d06220..c2de72f5 100644 --- a/library/src/test/java/ch/decent/sdk/api/BaseApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/BaseApiTest.kt @@ -1,6 +1,9 @@ package ch.decent.sdk.api -import ch.decent.sdk.* +import ch.decent.sdk.DCoreApi +import ch.decent.sdk.DCoreSdk +import ch.decent.sdk.Helpers +import ch.decent.sdk.TimeOutTest import ch.decent.sdk.net.ws.CustomWebSocketService import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockWebServer @@ -13,10 +16,6 @@ import org.slf4j.LoggerFactory @RunWith(Parameterized::class) abstract class BaseApiTest(private val channel: Channel) : TimeOutTest() { - open val useMock = true - - protected lateinit var mockWebSocket: CustomWebSocketService - protected lateinit var mockHttp: MockWebServer protected lateinit var api: DCoreApi companion object { @@ -33,21 +32,15 @@ abstract class BaseApiTest(private val channel: Channel) : TimeOutTest() { System.setProperty("rx2.buffer-size", "10") val logger = LoggerFactory.getLogger(channel.toString()) - mockHttp = MockWebServer().apply { start() } - mockWebSocket = CustomWebSocketService().apply { start() } api = when (channel) { - Channel.RpcService -> DCoreSdk.createForHttp(client(logger), if (useMock) mockHttp.url("/").toString() else restUrl, logger) - Channel.RxWebSocket -> DCoreSdk.createForWebSocket(client(logger), if (useMock) mockWebSocket.getUrl() else url, logger) + Channel.RpcService -> DCoreSdk.createForHttp(Helpers.client(logger), Helpers.restUrl, logger) + Channel.RxWebSocket -> DCoreSdk.createForWebSocket(Helpers.client(logger), Helpers.wsUrl, logger) } } @After fun finish() { - mockWebSocket.shutdown() - mockHttp.shutdown() } - fun MockWebServer.enqueue(body: String) = this.enqueue(MockResponse().apply { setBody(body) }) - enum class Channel { RpcService, RxWebSocket diff --git a/library/src/test/java/ch/decent/sdk/api/BlockApiTest.kt b/library/src/test/java/ch/decent/sdk/api/BlockApiTest.kt index 149dfa0f..db4d091a 100644 --- a/library/src/test/java/ch/decent/sdk/api/BlockApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/BlockApiTest.kt @@ -7,19 +7,8 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) class BlockApiTest(channel: Channel) : BaseApiTest(channel) { -// override val useMock: Boolean = false @Test fun `should get block header`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_block_header",[10]],"id":1}""", - """{"id":1,"result":{"previous":"00000009fdaa51c1bbb7ca167aa87cf36ef330a1","timestamp":"2018-04-26T11:24:45","miner":"1.4.8","transaction_merkle_root":"0000000000000000000000000000000000000000","extensions":[]}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"previous":"00000009fdaa51c1bbb7ca167aa87cf36ef330a1","timestamp":"2018-04-26T11:24:45","miner":"1.4.8","transaction_merkle_root":"0000000000000000000000000000000000000000","extensions":[]}}""" - ) - val test = api.blockApi.getHeader(10) .subscribeOn(Schedulers.newThread()) .test() @@ -30,16 +19,6 @@ class BlockApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `should get head block time`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"head_block_time",[]],"id":1}""", - """{"id":1,"result":"2018-10-12T14:37:40"}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":"2018-10-12T14:37:40"}""" - ) - val test = api.blockApi.getHeadTime() .subscribeOn(Schedulers.newThread()) .test() @@ -50,16 +29,6 @@ class BlockApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `should get signed block`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_block",[10]],"id":1}""", - """{"id":1,"result":{"previous":"00000009fdaa51c1bbb7ca167aa87cf36ef330a1","timestamp":"2018-04-26T11:24:45","miner":"1.4.8","transaction_merkle_root":"0000000000000000000000000000000000000000","extensions":[],"miner_signature":"204d599f40e6413e6c1c0a009e8ae244f56872ca4f501d42ba61c8a8aa6e08eff9399b71973512fb40cdb33a7faf9d8c743f618f348ef00c39dbd0119a0e934028","transactions":[]}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"previous":"00000009fdaa51c1bbb7ca167aa87cf36ef330a1","timestamp":"2018-04-26T11:24:45","miner":"1.4.8","transaction_merkle_root":"0000000000000000000000000000000000000000","extensions":[],"miner_signature":"204d599f40e6413e6c1c0a009e8ae244f56872ca4f501d42ba61c8a8aa6e08eff9399b71973512fb40cdb33a7faf9d8c743f618f348ef00c39dbd0119a0e934028","transactions":[]}}""" - ) - val test = api.blockApi.get(10) .subscribeOn(Schedulers.newThread()) .test() diff --git a/library/src/test/java/ch/decent/sdk/api/CallbackApiTest.kt b/library/src/test/java/ch/decent/sdk/api/CallbackApiTest.kt index 4e8814c8..f1c221f9 100644 --- a/library/src/test/java/ch/decent/sdk/api/CallbackApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/CallbackApiTest.kt @@ -1,36 +1,28 @@ package ch.decent.sdk.api import ch.decent.sdk.* -import ch.decent.sdk.net.ws.CustomWebSocketService import io.reactivex.schedulers.Schedulers import org.junit.After import org.junit.Before import org.junit.Ignore import org.junit.Test -import org.junit.runner.RunWith -import org.junit.runners.Parameterized import org.slf4j.LoggerFactory -import java.lang.IllegalArgumentException -// todo, unable to cancel callback +@Ignore class CallbackApiTest { - private lateinit var mockWebSocket: CustomWebSocketService private lateinit var api: DCoreApi @Before fun init() { val logger = LoggerFactory.getLogger("RxWebSocket") - mockWebSocket = CustomWebSocketService().apply { start() } - api = DCoreSdk.createForWebSocket(client(logger), mockWebSocket.getUrl(), logger) -// api = DCoreSdk.createForWebSocket(client(logger), url, logger) + api = DCoreSdk.createForWebSocket(Helpers.client(logger), Helpers.wsUrl, logger) } @After fun finish() { - mockWebSocket.shutdown() } @Test fun `should fail for HTTP`() { - api = DCoreSdk.createForHttp(client(), restUrl) + api = DCoreSdk.createForHttp(Helpers.client(), Helpers.restUrl) val test = api.callbackApi.onBlockApplied() .subscribeOn(Schedulers.newThread()) @@ -42,12 +34,6 @@ class CallbackApiTest { } @Test fun `should cancel all subscriptions`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"cancel_all_subscriptions",[]],"id":1}""", - """{"id":1,"result":null}""" - ) - val test = api.callbackApi.cancelAll() .subscribeOn(Schedulers.newThread()) .test() @@ -58,12 +44,6 @@ class CallbackApiTest { } @Test fun `should set block applied callback`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"set_block_applied_callback",[2]],"id":1}""", - """{"method":"notice","params":[2,["003484ba751fca1fea8177d8bab75116fb8be26a"]]}""" - ) - val test = api.callbackApi.onBlockApplied() .take(1) .subscribeOn(Schedulers.newThread()) @@ -74,7 +54,6 @@ class CallbackApiTest { .assertNoErrors() } - @Ignore @Test fun `should set content update callback`() { val test = api.callbackApi.onContentUpdate("http://some.uri") .subscribeOn(Schedulers.newThread()) @@ -86,12 +65,6 @@ class CallbackApiTest { } @Test fun `should set pending transaction callback`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"set_pending_transaction_callback",[2]],"id":1}""", - """{"method":"notice","params":[2,[{"ref_block_num":34021,"ref_block_prefix":2852349049,"expiration":"2018-12-19T14:59:00","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.11889","amount":{"amount":100000000,"asset_id":"1.3.0"},"memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"extensions":[]}]],"extensions":[],"signatures":["200337f7bc315bf791cef2925a0b3379fe441f8a82d51ea73bc44053dd70e7296b71755bceb68216f344e66e4b2f13206d5f8e0c13183597ce6bbb20d868161c33"]}]]}""" - ) - val test = api.callbackApi.onPendingTransaction() .take(1) .subscribeOn(Schedulers.newThread()) @@ -103,12 +76,6 @@ class CallbackApiTest { } @Test fun `should set subscribe callback`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"set_subscribe_callback",[2,false]],"id":1}""", - """{"method":"notice","params":[2,[[{"id":"2.7.34030","block_id":"003484ee95d911b9a2c7aeac303c5c0af3dabed6"},{"id":"1.4.5","miner_account":"1.2.8","last_aslot":9282243,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.0","vote_id":"0:4","total_votes":"994847645155","url":"","total_missed":478994,"last_confirmed_block_num":3441902},{"id":"1.9.0","owner":"1.2.8","balance":{"amount":"13193031582889","asset_id":"1.3.0"},"policy":[1,{"vesting_seconds":86400,"start_claim":"1970-01-01T00:00:00","coin_seconds_earned":"1139874731851536000","coin_seconds_earned_last_update":"2018-12-19T14:59:30"}]},{"id":"2.1.0","head_block_number":3441902,"head_block_id":"003484ee95d911b9a2c7aeac303c5c0af3dabed6","time":"2018-12-19T14:59:30","current_miner":"1.4.5","next_maintenance_time":"2018-12-20T00:00:00","last_budget_time":"2018-12-19T00:00:00","unspent_fee_budget":10769536,"mined_rewards":"327043000000","miner_budget_from_fees":22030422,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":12,"recently_missed_count":8,"current_aslot":9282243,"recent_slots_filled":"324323827292130661946547205444974147516","dynamic_flags":0,"last_irreversible_block_num":3441902},{"id":"1.4.12","miner_account":"1.2.27","last_aslot":0,"signing_key":"DCT8cYDtKZvcAyWfFRusy6ja1Hafe9Ys4UPJS92ajTmcrufHnGgjp","vote_id":"0:11","total_votes":"1530588818359","url":"http://ardstudio.studenthosting.sk","total_missed":284573,"last_confirmed_block_num":0},{"id":"1.4.13","miner_account":"1.2.85","last_aslot":0,"signing_key":"DCT6ZNZ5KGadKr346doCUvUUYu1fTgDoTwEV1aCbrNqgP82oN9ADt","vote_id":"0:12","total_votes":"5116212862873020","url":"my new URL","total_missed":290199,"last_confirmed_block_num":0}]]]}""" - ) - val test = api.callbackApi.onGlobal(false) .take(1) .subscribeOn(Schedulers.newThread()) diff --git a/library/src/test/java/ch/decent/sdk/api/ContentApiTest.kt b/library/src/test/java/ch/decent/sdk/api/ContentApiTest.kt index 967c7214..d91dd2ef 100644 --- a/library/src/test/java/ch/decent/sdk/api/ContentApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/ContentApiTest.kt @@ -1,8 +1,9 @@ package ch.decent.sdk.api +import ch.decent.sdk.Helpers import ch.decent.sdk.crypto.ECKeyPair +import ch.decent.sdk.model.ChainObject import ch.decent.sdk.model.toChainObject -import ch.decent.sdk.private import ch.decent.sdk.utils.privateElGamal import io.reactivex.schedulers.Schedulers import org.junit.Test @@ -11,20 +12,9 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) class ContentApiTest(channel: Channel) : BaseApiTest(channel) { -// override val useMock: Boolean = false - @Test fun `should get content by uri`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_content",["http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=bbc8a9c3-1bcd-48a6-820d-e5a60c29cf56"]],"id":1}""", - """{"id":1,"result":{"id":"2.13.3","author":"1.2.17","co_authors":[],"expiration":"2019-04-26T15:34:51","created":"2018-04-26T15:34:50","price":{"map_price":[[1,{"amount":100000000,"asset_id":"1.3.0"}]]},"size":1,"synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=bbc8a9c3-1bcd-48a6-820d-e5a60c29cf56","quorum":0,"key_parts":[],"_hash":"0000000000000000000000000000000000000000","last_proof":[],"is_blocked":false,"AVG_rating":0,"num_of_ratings":0,"times_bought":1,"publishing_fee_escrow":{"amount":0,"asset_id":"1.3.0"},"seeder_price":[]}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"id":"2.13.3","author":"1.2.17","co_authors":[],"expiration":"2019-04-26T15:34:51","created":"2018-04-26T15:34:50","price":{"map_price":[[1,{"amount":100000000,"asset_id":"1.3.0"}]]},"size":1,"synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=bbc8a9c3-1bcd-48a6-820d-e5a60c29cf56","quorum":0,"key_parts":[],"_hash":"0000000000000000000000000000000000000000","last_proof":[],"is_blocked":false,"AVG_rating":0,"num_of_ratings":0,"times_bought":1,"publishing_fee_escrow":{"amount":0,"asset_id":"1.3.0"},"seeder_price":[]}}""" - ) - - val test = api.contentApi.get("http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=bbc8a9c3-1bcd-48a6-820d-e5a60c29cf56") + @Test fun `should generate content keys`() { + val test = api.contentApi.generateKeys(listOf(ChainObject.parse("1.2.17"), ChainObject.parse("1.2.18"))) .subscribeOn(Schedulers.newThread()) .test() @@ -34,16 +24,6 @@ class ContentApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `should get content by id`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_objects",[["2.13.3"]]],"id":1}""", - """{"id":1,"result":[{"id":"2.13.3","author":"1.2.17","co_authors":[],"expiration":"2019-04-26T15:34:51","created":"2018-04-26T15:34:50","price":{"map_price":[[1,{"amount":100000000,"asset_id":"1.3.0"}]]},"size":1,"synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=bbc8a9c3-1bcd-48a6-820d-e5a60c29cf56","quorum":0,"key_parts":[],"_hash":"0000000000000000000000000000000000000000","last_proof":[],"is_blocked":false,"AVG_rating":0,"num_of_ratings":0,"times_bought":1,"publishing_fee_escrow":{"amount":0,"asset_id":"1.3.0"},"seeder_price":[]}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"id":"2.13.3","author":"1.2.17","co_authors":[],"expiration":"2019-04-26T15:34:51","created":"2018-04-26T15:34:50","price":{"map_price":[[1,{"amount":100000000,"asset_id":"1.3.0"}]]},"size":1,"synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=bbc8a9c3-1bcd-48a6-820d-e5a60c29cf56","quorum":0,"key_parts":[],"_hash":"0000000000000000000000000000000000000000","last_proof":[],"is_blocked":false,"AVG_rating":0,"num_of_ratings":0,"times_bought":1,"publishing_fee_escrow":{"amount":0,"asset_id":"1.3.0"},"seeder_price":[]}]}""" - ) - val test = api.contentApi.get("2.13.3".toChainObject()) .subscribeOn(Schedulers.newThread()) .test() @@ -53,18 +33,18 @@ class ContentApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should get list of content by search`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"search_content",["","-created","","default","0.0.0","1.0.0",100]],"id":1}""", - """{"id":1,"result":[]}""" - ) + @Test fun `should get contents by ids`() { + val test = api.contentApi.getAll(listOf("2.13.3".toChainObject(), "2.13.4".toChainObject())) + .subscribeOn(Schedulers.newThread()) + .test() - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) + test.awaitTerminalEvent() + test.assertComplete() + .assertNoErrors() + } - val test = api.contentApi.findAll("") + @Test fun `should get content by uri`() { + val test = api.contentApi.get("ipfs:QmWBoRBYuxzH5a8d3gssRbMS5scs6fqLKgapBfqVNUFUtZ") .subscribeOn(Schedulers.newThread()) .test() @@ -74,16 +54,6 @@ class ContentApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `should get list of publishing managers`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"list_publishing_managers",["",100]],"id":1}""", - """{"id":1,"result":[]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) - val test = api.contentApi.listAllPublishersRelative("") .subscribeOn(Schedulers.newThread()) .test() @@ -93,18 +63,8 @@ class ContentApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should generate content keys`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"generate_content_keys",[[]]],"id":1}""", - """{"id":1,"result":{"key":"b44e0749395e1009a90cdd7e545897b66f7abacada463091c53bf76e1af74e6f","parts":[]}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"key":"b44e0749395e1009a90cdd7e545897b66f7abacada463091c53bf76e1af74e6f","parts":[]}}""" - ) - - val test = api.contentApi.generateKeys(emptyList()) + @Test fun `should restore content encryption key`() { + val test = api.contentApi.restoreEncryptionKey(Helpers.credentials.keyPair.privateElGamal(), "2.12.3".toChainObject()) .subscribeOn(Schedulers.newThread()) .test() @@ -113,18 +73,9 @@ class ContentApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should restore content encryption key`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"restore_encryption_key",[{"s":"8149734503494312909116126763927194608124629667940168421251424974828815164868905638030541425377704620941193711130535974967507480114755414928915429397074890."},"2.12.3"]],"id":1}""", - """{"id":1,"result":"0000000000000000000000000000000000000000000000000000000000000000"}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":"0000000000000000000000000000000000000000000000000000000000000000"}""" - ) - val test = api.contentApi.restoreEncryptionKey(ECKeyPair.fromBase58(private).privateElGamal(), "2.12.3".toChainObject()) + @Test fun `should get list of content by search`() { + val test = api.contentApi.findAll("") .subscribeOn(Schedulers.newThread()) .test() diff --git a/library/src/test/java/ch/decent/sdk/api/GeneralApiTest.kt b/library/src/test/java/ch/decent/sdk/api/GeneralApiTest.kt index 56532c83..02d8e5dd 100644 --- a/library/src/test/java/ch/decent/sdk/api/GeneralApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/GeneralApiTest.kt @@ -8,19 +8,8 @@ import org.threeten.bp.LocalDateTime @RunWith(Parameterized::class) class GeneralApiTest(channel: Channel) : BaseApiTest(channel) { -// override val useMock: Boolean = false @Test fun `get chain props`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_chain_properties",[]],"id":1}""", - """{"id":1,"result":{"id":"2.9.0","chain_id":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc","immutable_parameters":{"min_miner_count":11,"num_special_accounts":0,"num_special_assets":0}}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"id":"2.9.0","chain_id":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc","immutable_parameters":{"min_miner_count":11,"num_special_accounts":0,"num_special_assets":0}}}""" - ) - val test = api.generalApi.getChainProperties() .subscribeOn(Schedulers.newThread()) .test() @@ -31,16 +20,6 @@ class GeneralApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `get general props`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_global_properties",[]],"id":1}""", - """{"id":1,"result":{"id":"2.0.0","parameters":{"current_fees":{"parameters":[[0,{"fee":500000}],[1,{"basic_fee":500000}],[2,{"fee":500000}],[3,{"basic_fee":500000}],[4,{"fee":500000}],[5,{"fee":10}],[6,{"fee":50000000}],[7,{"fee":500000}],[8,{"fee":10}],[9,{"fee":500000,"price_per_kbyte":10}],[10,{"fee":500000,"price_per_kbyte":10}],[11,{"fee":500000}],[12,{"fee":500000}],[13,{"fee":500000}],[14,{"fee":500000,"price_per_kbyte":10}],[15,{"fee":0}],[16,{"fee":500000}],[17,{"fee":500000}],[18,{"fee":500000,"price_per_kbyte":10}],[19,{"fee":5000000}],[20,{"fee":0}],[21,{"fee":0}],[22,{"fee":0}],[23,{"fee":0}],[24,{"fee":0}],[25,{"fee":0}],[26,{"fee":0}],[27,{"fee":0}],[28,{"fee":0}],[29,{"fee":0}],[30,{"fee":0}],[31,{"fee":0}],[32,{"fee":0}],[33,{"fee":0}],[34,{"fee":0}],[35,{"fee":0}],[36,{"fee":0}],[37,{"fee":0}],[38,{"fee":0}],[39,{"fee":500000}]],"scale":10000},"block_interval":5,"maintenance_interval":86400,"maintenance_skip_slots":3,"miner_proposal_review_period":1209600,"maximum_transaction_size":4096,"maximum_block_size":2048000,"maximum_time_until_expiration":86400,"maximum_proposal_lifetime":2419200,"maximum_asset_feed_publishers":10,"maximum_miner_count":1001,"maximum_authority_membership":10,"cashback_vesting_period_seconds":31536000,"cashback_vesting_threshold":1000000000,"max_predicate_opcode":1,"max_authority_depth":2,"extensions":[]},"next_available_vote_id":13,"active_miners":["1.4.13","1.4.12","1.4.9","1.4.1","1.4.2","1.4.8","1.4.11","1.4.4","1.4.5","1.4.6","1.4.3"]}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"id":"2.0.0","parameters":{"current_fees":{"parameters":[[0,{"fee":500000}],[1,{"basic_fee":500000}],[2,{"fee":500000}],[3,{"basic_fee":500000}],[4,{"fee":500000}],[5,{"fee":10}],[6,{"fee":50000000}],[7,{"fee":500000}],[8,{"fee":10}],[9,{"fee":500000,"price_per_kbyte":10}],[10,{"fee":500000,"price_per_kbyte":10}],[11,{"fee":500000}],[12,{"fee":500000}],[13,{"fee":500000}],[14,{"fee":500000,"price_per_kbyte":10}],[15,{"fee":0}],[16,{"fee":500000}],[17,{"fee":500000}],[18,{"fee":500000,"price_per_kbyte":10}],[19,{"fee":5000000}],[20,{"fee":0}],[21,{"fee":0}],[22,{"fee":0}],[23,{"fee":0}],[24,{"fee":0}],[25,{"fee":0}],[26,{"fee":0}],[27,{"fee":0}],[28,{"fee":0}],[29,{"fee":0}],[30,{"fee":0}],[31,{"fee":0}],[32,{"fee":0}],[33,{"fee":0}],[34,{"fee":0}],[35,{"fee":0}],[36,{"fee":0}],[37,{"fee":0}],[38,{"fee":0}],[39,{"fee":500000}]],"scale":10000},"block_interval":5,"maintenance_interval":86400,"maintenance_skip_slots":3,"miner_proposal_review_period":1209600,"maximum_transaction_size":4096,"maximum_block_size":2048000,"maximum_time_until_expiration":86400,"maximum_proposal_lifetime":2419200,"maximum_asset_feed_publishers":10,"maximum_miner_count":1001,"maximum_authority_membership":10,"cashback_vesting_period_seconds":31536000,"cashback_vesting_threshold":1000000000,"max_predicate_opcode":1,"max_authority_depth":2,"extensions":[]},"next_available_vote_id":13,"active_miners":["1.4.13","1.4.12","1.4.9","1.4.1","1.4.2","1.4.8","1.4.11","1.4.4","1.4.5","1.4.6","1.4.3"]}}""" - ) - val test = api.generalApi.getGlobalProperties() .subscribeOn(Schedulers.newThread()) .test() @@ -51,16 +30,6 @@ class GeneralApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `get config`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_config",[]],"id":1}""", - """{"id":1,"result":{"GRAPHENE_SYMBOL":"DCT","GRAPHENE_ADDRESS_PREFIX":"DCT","GRAPHENE_MIN_ACCOUNT_NAME_LENGTH":5,"GRAPHENE_MAX_ACCOUNT_NAME_LENGTH":63,"GRAPHENE_MIN_ASSET_SYMBOL_LENGTH":3,"GRAPHENE_MAX_ASSET_SYMBOL_LENGTH":16,"GRAPHENE_MAX_SHARE_SUPPLY":"7319777577456890","GRAPHENE_MAX_PAY_RATE":10000,"GRAPHENE_MAX_SIG_CHECK_DEPTH":2,"GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT":1024,"GRAPHENE_MIN_BLOCK_INTERVAL":1,"GRAPHENE_MAX_BLOCK_INTERVAL":30,"GRAPHENE_DEFAULT_BLOCK_INTERVAL":5,"GRAPHENE_DEFAULT_MAX_TRANSACTION_SIZE":4096,"GRAPHENE_DEFAULT_MAX_BLOCK_SIZE":4096000,"GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION":86400,"GRAPHENE_DEFAULT_MAINTENANCE_INTERVAL":86400,"GRAPHENE_DEFAULT_MAINTENANCE_SKIP_SLOTS":3,"GRAPHENE_MIN_UNDO_HISTORY":10,"GRAPHENE_MAX_UNDO_HISTORY":10000,"GRAPHENE_MIN_BLOCK_SIZE_LIMIT":5120,"GRAPHENE_MIN_TRANSACTION_EXPIRATION_LIMIT":150,"GRAPHENE_BLOCKCHAIN_PRECISION":100000000,"GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS":8,"GRAPHENE_DEFAULT_TRANSFER_FEE":1000000,"GRAPHENE_MAX_INSTANCE_ID":"281474976710655","GRAPHENE_100_PERCENT":10000,"GRAPHENE_1_PERCENT":100,"GRAPHENE_MAX_MARKET_FEE_PERCENT":10000,"GRAPHENE_DEFAULT_FORCE_SETTLEMENT_DELAY":86400,"GRAPHENE_DEFAULT_FORCE_SETTLEMENT_OFFSET":0,"GRAPHENE_DEFAULT_FORCE_SETTLEMENT_MAX_VOLUME":2000,"GRAPHENE_DEFAULT_PRICE_FEED_LIFETIME":86400,"GRAPHENE_MAX_FEED_PRODUCERS":200,"GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP":10,"GRAPHENE_DEFAULT_MAX_ASSET_WHITELIST_AUTHORITIES":10,"GRAPHENE_DEFAULT_MAX_ASSET_FEED_PUBLISHERS":10,"GRAPHENE_COLLATERAL_RATIO_DENOM":1000,"GRAPHENE_MIN_COLLATERAL_RATIO":1001,"GRAPHENE_MAX_COLLATERAL_RATIO":32000,"GRAPHENE_DEFAULT_MAINTENANCE_COLLATERAL_RATIO":1750,"GRAPHENE_DEFAULT_MAX_SHORT_SQUEEZE_RATIO":1500,"GRAPHENE_DEFAULT_MARGIN_PERIOD_SEC":2592000,"GRAPHENE_DEFAULT_MAX_MINERS":1001,"GRAPHENE_DEFAULT_MAX_PROPOSAL_LIFETIME_SEC":2419200,"GRAPHENE_DEFAULT_MINER_PROPOSAL_REVIEW_PERIOD_SEC":1209600,"GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE":2000,"GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE":3000,"GRAPHENE_DEFAULT_MAX_BULK_DISCOUNT_PERCENT":5000,"GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MIN":"10000000000","GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MAX":"100000000000","GRAPHENE_DEFAULT_CASHBACK_VESTING_PERIOD_SEC":31536000,"GRAPHENE_DEFAULT_CASHBACK_VESTING_THRESHOLD":"10000000000","GRAPHENE_DEFAULT_BURN_PERCENT_OF_FEE":2000,"GRAPHENE_MINER_PAY_PERCENT_PRECISION":1000000000,"GRAPHENE_DEFAULT_MAX_ASSERT_OPCODE":1,"GRAPHENE_DEFAULT_FEE_LIQUIDATION_THRESHOLD":100000000,"GRAPHENE_DEFAULT_ACCOUNTS_PER_FEE_SCALE":1000,"GRAPHENE_DEFAULT_ACCOUNT_FEE_SCALE_BITSHIFTS":4,"GRAPHENE_MAX_WORKER_NAME_LENGTH":63,"GRAPHENE_MAX_URL_LENGTH":127,"GRAPHENE_NEAR_SCHEDULE_CTR_IV":"7640891576956012808","GRAPHENE_FAR_SCHEDULE_CTR_IV":"13503953896175478587","GRAPHENE_CORE_ASSET_CYCLE_RATE":17,"GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS":32,"GRAPHENE_DEFAULT_MINER_PAY_PER_BLOCK":10000000,"GRAPHENE_DEFAULT_MINER_PAY_VESTING_SECONDS":86400,"GRAPHENE_MAX_INTEREST_APR":10000,"GRAPHENE_MINER_ACCOUNT":"1.2.0","GRAPHENE_NULL_ACCOUNT":"1.2.1","GRAPHENE_TEMP_ACCOUNT":"1.2.2"}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"GRAPHENE_SYMBOL":"DCT","GRAPHENE_ADDRESS_PREFIX":"DCT","GRAPHENE_MIN_ACCOUNT_NAME_LENGTH":5,"GRAPHENE_MAX_ACCOUNT_NAME_LENGTH":63,"GRAPHENE_MIN_ASSET_SYMBOL_LENGTH":3,"GRAPHENE_MAX_ASSET_SYMBOL_LENGTH":16,"GRAPHENE_MAX_SHARE_SUPPLY":"7319777577456890","GRAPHENE_MAX_PAY_RATE":10000,"GRAPHENE_MAX_SIG_CHECK_DEPTH":2,"GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT":1024,"GRAPHENE_MIN_BLOCK_INTERVAL":1,"GRAPHENE_MAX_BLOCK_INTERVAL":30,"GRAPHENE_DEFAULT_BLOCK_INTERVAL":5,"GRAPHENE_DEFAULT_MAX_TRANSACTION_SIZE":4096,"GRAPHENE_DEFAULT_MAX_BLOCK_SIZE":4096000,"GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION":86400,"GRAPHENE_DEFAULT_MAINTENANCE_INTERVAL":86400,"GRAPHENE_DEFAULT_MAINTENANCE_SKIP_SLOTS":3,"GRAPHENE_MIN_UNDO_HISTORY":10,"GRAPHENE_MAX_UNDO_HISTORY":10000,"GRAPHENE_MIN_BLOCK_SIZE_LIMIT":5120,"GRAPHENE_MIN_TRANSACTION_EXPIRATION_LIMIT":150,"GRAPHENE_BLOCKCHAIN_PRECISION":100000000,"GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS":8,"GRAPHENE_DEFAULT_TRANSFER_FEE":1000000,"GRAPHENE_MAX_INSTANCE_ID":"281474976710655","GRAPHENE_100_PERCENT":10000,"GRAPHENE_1_PERCENT":100,"GRAPHENE_MAX_MARKET_FEE_PERCENT":10000,"GRAPHENE_DEFAULT_FORCE_SETTLEMENT_DELAY":86400,"GRAPHENE_DEFAULT_FORCE_SETTLEMENT_OFFSET":0,"GRAPHENE_DEFAULT_FORCE_SETTLEMENT_MAX_VOLUME":2000,"GRAPHENE_DEFAULT_PRICE_FEED_LIFETIME":86400,"GRAPHENE_MAX_FEED_PRODUCERS":200,"GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP":10,"GRAPHENE_DEFAULT_MAX_ASSET_WHITELIST_AUTHORITIES":10,"GRAPHENE_DEFAULT_MAX_ASSET_FEED_PUBLISHERS":10,"GRAPHENE_COLLATERAL_RATIO_DENOM":1000,"GRAPHENE_MIN_COLLATERAL_RATIO":1001,"GRAPHENE_MAX_COLLATERAL_RATIO":32000,"GRAPHENE_DEFAULT_MAINTENANCE_COLLATERAL_RATIO":1750,"GRAPHENE_DEFAULT_MAX_SHORT_SQUEEZE_RATIO":1500,"GRAPHENE_DEFAULT_MARGIN_PERIOD_SEC":2592000,"GRAPHENE_DEFAULT_MAX_MINERS":1001,"GRAPHENE_DEFAULT_MAX_PROPOSAL_LIFETIME_SEC":2419200,"GRAPHENE_DEFAULT_MINER_PROPOSAL_REVIEW_PERIOD_SEC":1209600,"GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE":2000,"GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE":3000,"GRAPHENE_DEFAULT_MAX_BULK_DISCOUNT_PERCENT":5000,"GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MIN":"10000000000","GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MAX":"100000000000","GRAPHENE_DEFAULT_CASHBACK_VESTING_PERIOD_SEC":31536000,"GRAPHENE_DEFAULT_CASHBACK_VESTING_THRESHOLD":"10000000000","GRAPHENE_DEFAULT_BURN_PERCENT_OF_FEE":2000,"GRAPHENE_MINER_PAY_PERCENT_PRECISION":1000000000,"GRAPHENE_DEFAULT_MAX_ASSERT_OPCODE":1,"GRAPHENE_DEFAULT_FEE_LIQUIDATION_THRESHOLD":100000000,"GRAPHENE_DEFAULT_ACCOUNTS_PER_FEE_SCALE":1000,"GRAPHENE_DEFAULT_ACCOUNT_FEE_SCALE_BITSHIFTS":4,"GRAPHENE_MAX_WORKER_NAME_LENGTH":63,"GRAPHENE_MAX_URL_LENGTH":127,"GRAPHENE_NEAR_SCHEDULE_CTR_IV":"7640891576956012808","GRAPHENE_FAR_SCHEDULE_CTR_IV":"13503953896175478587","GRAPHENE_CORE_ASSET_CYCLE_RATE":17,"GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS":32,"GRAPHENE_DEFAULT_MINER_PAY_PER_BLOCK":10000000,"GRAPHENE_DEFAULT_MINER_PAY_VESTING_SECONDS":86400,"GRAPHENE_MAX_INTEREST_APR":10000,"GRAPHENE_MINER_ACCOUNT":"1.2.0","GRAPHENE_NULL_ACCOUNT":"1.2.1","GRAPHENE_TEMP_ACCOUNT":"1.2.2"}}""" - ) - val test = api.generalApi.getConfig() .subscribeOn(Schedulers.newThread()) .test() @@ -71,16 +40,6 @@ class GeneralApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `get chain id`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_chain_id",[]],"id":1}""", - """{"id":1,"result":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc"}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc"}""" - ) - val test = api.generalApi.getChainId() .subscribeOn(Schedulers.newThread()) .test() @@ -91,16 +50,6 @@ class GeneralApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `get dynamic props`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_dynamic_global_properties",[]],"id":1}""", - """{"id":1,"result":{"id":"2.1.0","head_block_number":2494883,"head_block_id":"002611a3a107be99a3a54caf6e06951cadc9fd14","time":"2018-10-13T20:16:30","current_miner":"1.4.1","next_maintenance_time":"2018-10-14T00:00:00","last_budget_time":"2018-10-13T00:00:00","unspent_fee_budget":384090625,"mined_rewards":"443667000000","miner_budget_from_fees":1254865054,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":2,"recently_missed_count":0,"current_aslot":8128488,"recent_slots_filled":"169890005455821587429091203373177192415","dynamic_flags":0,"last_irreversible_block_num":2494883}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"id":"2.1.0","head_block_number":2494883,"head_block_id":"002611a3a107be99a3a54caf6e06951cadc9fd14","time":"2018-10-13T20:16:30","current_miner":"1.4.1","next_maintenance_time":"2018-10-14T00:00:00","last_budget_time":"2018-10-13T00:00:00","unspent_fee_budget":384090625,"mined_rewards":"443667000000","miner_budget_from_fees":1254865054,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":2,"recently_missed_count":0,"current_aslot":8128488,"recent_slots_filled":"169890005455821587429091203373177192415","dynamic_flags":0,"last_irreversible_block_num":2494883}}""" - ) - val test = api.generalApi.getDynamicGlobalProperties() .subscribeOn(Schedulers.newThread()) .test() @@ -111,16 +60,6 @@ class GeneralApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `get time to maintenance`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_time_to_maint_by_block_time",["2018-10-13T22:26:02.825"]],"id":1}""", - """{"id":1,"result":{"time_to_maint":86400,"from_accumulated_fees":1254865054,"block_interval":5}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"time_to_maint":86400,"from_accumulated_fees":1254865054,"block_interval":5}}""" - ) - val test = api.generalApi.getTimeToMaintenance(LocalDateTime.parse("2018-10-13T22:26:02.825")) .subscribeOn(Schedulers.newThread()) .test() diff --git a/library/src/test/java/ch/decent/sdk/api/HistoryApiTest.kt b/library/src/test/java/ch/decent/sdk/api/HistoryApiTest.kt index b592b75f..a8572a23 100644 --- a/library/src/test/java/ch/decent/sdk/api/HistoryApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/HistoryApiTest.kt @@ -1,26 +1,14 @@ package ch.decent.sdk.api -import ch.decent.sdk.account +import ch.decent.sdk.Helpers import ch.decent.sdk.model.toChainObject -import ch.decent.sdk.print import io.reactivex.schedulers.Schedulers import org.junit.Test class HistoryApiTest(channel: Channel) : BaseApiTest(channel) { -// override val useMock: Boolean = false - @Test fun `should get account history`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[3,"get_account_history",["1.2.34","1.7.0",100,"1.7.0"]],"id":1}""", - """{"id":1,"result":[{"id":"1.7.557","op":[2,{"fee":{"amount":500000,"asset_id":"1.3.0"},"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"extensions":{}}],"result":[0,{}],"block_num":480676,"trx_in_block":0,"op_in_trx":0,"virtual_op":1231},{"id":"1.7.556","op":[2,{"fee":{"amount":500000,"asset_id":"1.3.0"},"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"extensions":{}}],"result":[0,{}],"block_num":480675,"trx_in_block":0,"op_in_trx":0,"virtual_op":1228},{"id":"1.7.456","op":[2,{"fee":{"amount":500000,"asset_id":"1.3.0"},"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"extensions":{}}],"result":[0,{}],"block_num":419229,"trx_in_block":0,"op_in_trx":0,"virtual_op":902},{"id":"1.7.455","op":[2,{"fee":{"amount":500000,"asset_id":"1.3.0"},"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"extensions":{}}],"result":[0,{}],"block_num":419228,"trx_in_block":0,"op_in_trx":0,"virtual_op":899},{"id":"1.7.368","op":[0,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":150000000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"9637208953715299072","message":"b7da6b1f94635777b2649309af699cee7ece00f31f0a652eb786a03b32ff2714"},"extensions":[]}],"result":[0,{}],"block_num":385238,"trx_in_block":0,"op_in_trx":0,"virtual_op":632},{"id":"1.7.367","op":[2,{"fee":{"amount":500000,"asset_id":"1.3.0"},"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"extensions":{}}],"result":[0,{}],"block_num":385122,"trx_in_block":0,"op_in_trx":0,"virtual_op":629}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"id":"1.7.557","op":[2,{"fee":{"amount":500000,"asset_id":"1.3.0"},"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"extensions":{}}],"result":[0,{}],"block_num":480676,"trx_in_block":0,"op_in_trx":0,"virtual_op":1231},{"id":"1.7.556","op":[2,{"fee":{"amount":500000,"asset_id":"1.3.0"},"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"extensions":{}}],"result":[0,{}],"block_num":480675,"trx_in_block":0,"op_in_trx":0,"virtual_op":1228},{"id":"1.7.456","op":[2,{"fee":{"amount":500000,"asset_id":"1.3.0"},"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"extensions":{}}],"result":[0,{}],"block_num":419229,"trx_in_block":0,"op_in_trx":0,"virtual_op":902},{"id":"1.7.455","op":[2,{"fee":{"amount":500000,"asset_id":"1.3.0"},"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"extensions":{}}],"result":[0,{}],"block_num":419228,"trx_in_block":0,"op_in_trx":0,"virtual_op":899},{"id":"1.7.368","op":[0,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":150000000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"9637208953715299072","message":"b7da6b1f94635777b2649309af699cee7ece00f31f0a652eb786a03b32ff2714"},"extensions":[]}],"result":[0,{}],"block_num":385238,"trx_in_block":0,"op_in_trx":0,"virtual_op":632},{"id":"1.7.367","op":[2,{"fee":{"amount":500000,"asset_id":"1.3.0"},"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"extensions":{}}],"result":[0,{}],"block_num":385122,"trx_in_block":0,"op_in_trx":0,"virtual_op":629}]}""" - ) - - val test = api.historyApi.listOperations(account) + @Test fun `should get account balance for op`() { + val test = api.historyApi.getOperation(Helpers.account, "1.7.980424".toChainObject()) .subscribeOn(Schedulers.newThread()) .test() @@ -29,40 +17,18 @@ class HistoryApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should get relative account history`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[3,"get_relative_account_history",["1.2.34",0,10,0]],"id":1}""", - """{"id":1,"result":[{"id":"1.7.57238","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3424128,"trx_in_block":0,"op_in_trx":0,"virtual_op":60320},{"id":"1.7.57236","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3423895,"trx_in_block":0,"op_in_trx":0,"virtual_op":60314},{"id":"1.7.57067","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3356379,"trx_in_block":0,"op_in_trx":0,"virtual_op":59796},{"id":"1.7.57065","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3356332,"trx_in_block":0,"op_in_trx":0,"virtual_op":59790},{"id":"1.7.57064","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3356325,"trx_in_block":0,"op_in_trx":0,"virtual_op":59787},{"id":"1.7.56849","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":3,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"8225985137041510913","message":"6bb0a05d5d597d2e468883f65dcebdf5"},"extensions":[]}],"result":[0,{}],"block_num":3341179,"trx_in_block":0,"op_in_trx":0,"virtual_op":59136},{"id":"1.7.56848","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":2,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"13772278880363122689","message":"9b955a68cf707d0617c40fc1dcc843a7"},"extensions":[]}],"result":[0,{}],"block_num":3340937,"trx_in_block":0,"op_in_trx":0,"virtual_op":59133},{"id":"1.7.56844","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"12349095297475186433","message":"f8c41beea4705ed03e0c048dd149ac09"},"extensions":[]}],"result":[0,{}],"block_num":3340722,"trx_in_block":0,"op_in_trx":0,"virtual_op":59121},{"id":"1.7.56805","op":[42,{"fee":{"amount":0,"asset_id":"1.3.0"},"author":"1.2.34","escrow":{"amount":10,"asset_id":"1.3.0"},"content":"2.13.621"}],"result":[0,{}],"block_num":3333778,"trx_in_block":0,"op_in_trx":1,"virtual_op":59003},{"id":"1.7.56772","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.687","amount":{"amount":10000000,"asset_id":"1.3.53"},"memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"extensions":[]}],"result":[0,{}],"block_num":3329053,"trx_in_block":0,"op_in_trx":0,"virtual_op":58906}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"id":"1.7.57238","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3424128,"trx_in_block":0,"op_in_trx":0,"virtual_op":60320},{"id":"1.7.57236","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3423895,"trx_in_block":0,"op_in_trx":0,"virtual_op":60314},{"id":"1.7.57067","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3356379,"trx_in_block":0,"op_in_trx":0,"virtual_op":59796},{"id":"1.7.57065","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3356332,"trx_in_block":0,"op_in_trx":0,"virtual_op":59790},{"id":"1.7.57064","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3356325,"trx_in_block":0,"op_in_trx":0,"virtual_op":59787},{"id":"1.7.56849","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":3,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"8225985137041510913","message":"6bb0a05d5d597d2e468883f65dcebdf5"},"extensions":[]}],"result":[0,{}],"block_num":3341179,"trx_in_block":0,"op_in_trx":0,"virtual_op":59136},{"id":"1.7.56848","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":2,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"13772278880363122689","message":"9b955a68cf707d0617c40fc1dcc843a7"},"extensions":[]}],"result":[0,{}],"block_num":3340937,"trx_in_block":0,"op_in_trx":0,"virtual_op":59133},{"id":"1.7.56844","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"12349095297475186433","message":"f8c41beea4705ed03e0c048dd149ac09"},"extensions":[]}],"result":[0,{}],"block_num":3340722,"trx_in_block":0,"op_in_trx":0,"virtual_op":59121},{"id":"1.7.56805","op":[42,{"fee":{"amount":0,"asset_id":"1.3.0"},"author":"1.2.34","escrow":{"amount":10,"asset_id":"1.3.0"},"content":"2.13.621"}],"result":[0,{}],"block_num":3333778,"trx_in_block":0,"op_in_trx":1,"virtual_op":59003},{"id":"1.7.56772","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.687","amount":{"amount":10000000,"asset_id":"1.3.53"},"memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000"},"extensions":[]}],"result":[0,{}],"block_num":3329053,"trx_in_block":0,"op_in_trx":0,"virtual_op":58906}]}""" - ) - - val test = api.historyApi.listOperationsRelative(account, limit = 10) + @Test fun `should list account history`() { + val test = api.historyApi.listOperations("1.2.27".toChainObject()) .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() - - test.values().map { it.map { it.id } }.print() } - @Test fun `should get account history balances`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[3,"search_account_balance_history",["1.2.34",[],null,0,0,2,3]],"id":1}""", - """{"id":1,"result":[{"hist_object":{"id":"1.7.57067","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3356379,"trx_in_block":0,"op_in_trx":0,"virtual_op":59796},"balance":{"asset0":{"amount":-1,"asset_id":"1.3.0"},"asset1":{"amount":0,"asset_id":"1.3.0"}},"fee":{"amount":500000,"asset_id":"1.3.0"}},{"hist_object":{"id":"1.7.57065","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3356332,"trx_in_block":0,"op_in_trx":0,"virtual_op":59790},"balance":{"asset0":{"amount":-1,"asset_id":"1.3.0"},"asset1":{"amount":0,"asset_id":"1.3.0"}},"fee":{"amount":500000,"asset_id":"1.3.0"}},{"hist_object":{"id":"1.7.57064","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3356325,"trx_in_block":0,"op_in_trx":0,"virtual_op":59787},"balance":{"asset0":{"amount":-1,"asset_id":"1.3.0"},"asset1":{"amount":0,"asset_id":"1.3.0"}},"fee":{"amount":500000,"asset_id":"1.3.0"}}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"hist_object":{"id":"1.7.57067","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3356379,"trx_in_block":0,"op_in_trx":0,"virtual_op":59796},"balance":{"asset0":{"amount":-1,"asset_id":"1.3.0"},"asset1":{"amount":0,"asset_id":"1.3.0"}},"fee":{"amount":500000,"asset_id":"1.3.0"}},{"hist_object":{"id":"1.7.57065","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3356332,"trx_in_block":0,"op_in_trx":0,"virtual_op":59790},"balance":{"asset0":{"amount":-1,"asset_id":"1.3.0"},"asset1":{"amount":0,"asset_id":"1.3.0"}},"fee":{"amount":500000,"asset_id":"1.3.0"}},{"hist_object":{"id":"1.7.57064","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":3356325,"trx_in_block":0,"op_in_trx":0,"virtual_op":59787},"balance":{"asset0":{"amount":-1,"asset_id":"1.3.0"},"asset1":{"amount":0,"asset_id":"1.3.0"}},"fee":{"amount":500000,"asset_id":"1.3.0"}}]}""" - ) - - val test = api.historyApi.findAllOperations(account, startOffset = 2, limit = 3) + @Test fun `should list relative account history`() { + val test = api.historyApi.listOperationsRelative(Helpers.account, limit = 10) .subscribeOn(Schedulers.newThread()) .test() @@ -71,18 +37,8 @@ class HistoryApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should get account balance history for op`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[3,"get_account_balance_for_transaction",["1.2.34","1.7.7570"]],"id":1}""", - """{"id":1,"result":{"hist_object":{"id":"1.7.7570","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":2447775,"trx_in_block":0,"op_in_trx":0,"virtual_op":7595},"balance":{"asset0":{"amount":-1,"asset_id":"1.3.0"},"asset1":{"amount":0,"asset_id":"1.3.0"}},"fee":{"amount":500000,"asset_id":"1.3.0"}}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"hist_object":{"id":"1.7.7570","op":[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"extensions":[]}],"result":[0,{}],"block_num":2447775,"trx_in_block":0,"op_in_trx":0,"virtual_op":7595},"balance":{"asset0":{"amount":-1,"asset_id":"1.3.0"},"asset1":{"amount":0,"asset_id":"1.3.0"}},"fee":{"amount":500000,"asset_id":"1.3.0"}}}""" - ) - - val test = api.historyApi.getOperation(account, "1.7.7570".toChainObject()) + @Test fun `should search account history balances`() { + val test = api.historyApi.findAllOperations(Helpers.account, startOffset = 2, limit = 3) .subscribeOn(Schedulers.newThread()) .test() diff --git a/library/src/test/java/ch/decent/sdk/api/MessagingApiTest.kt b/library/src/test/java/ch/decent/sdk/api/MessagingApiTest.kt index 9d519ee2..1e8d150e 100644 --- a/library/src/test/java/ch/decent/sdk/api/MessagingApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/MessagingApiTest.kt @@ -1,10 +1,7 @@ package ch.decent.sdk.api -import ch.decent.sdk.account -import ch.decent.sdk.account2 +import ch.decent.sdk.* import ch.decent.sdk.crypto.Credentials -import ch.decent.sdk.private -import ch.decent.sdk.private2 import io.reactivex.schedulers.Schedulers import org.amshove.kluent.`should equal` import org.junit.Test @@ -13,20 +10,19 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) class MessagingApiTest(channel: Channel) : BaseApiTest(channel) { -// override val useMock: Boolean = false - @Test fun `should get messages for account and decrypt for receiver`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[5,"get_message_objects",[null,"1.2.35",1000]],"id":1}""", - """{"id":1,"result":[{"id":"2.18.3","created":"2019-02-22T11:41:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17391111264393218816","data":"4e2e37edec71eadba4eb8171f7ec1468dc8f5c9b5c218baef9447fd7b998fd83"}],"text":""},{"id":"2.18.4","created":"2019-02-22T11:42:00","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"9084912823086861056","data":"dbf804d15fc01cafa7380f66e008ac2549f0c67900a415d822a7ecc0397013e7"}],"text":""},{"id":"2.18.5","created":"2019-02-22T11:42:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"15712596674046053120","data":"05927f8341f72c1af709c076604482605f3180d1d71a99a64d96620e922c5b66"}],"text":""},{"id":"2.18.6","created":"2019-02-22T11:43:45","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"6523220187852098304","data":"d10fc732248baf8daf36c3e78bb8412c8602e0649e081d1e45410ced8dd66db0"}],"text":""},{"id":"2.18.7","created":"2019-02-22T11:46:25","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"5418653098442279680","data":"1eb0eb62c81bb84a6d91fc42d54d374498dded5c286b59e5b46490b78234d39c"}],"text":""},{"id":"2.18.8","created":"2019-02-22T11:46:45","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"16910704723097406208","data":"5ae4141456f1f7ed5525739426457266b8f84aeebdfe77c14358111cf80c4594"}],"text":""},{"id":"2.18.9","created":"2019-02-22T11:48:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17798987865604147968","data":"e1654daf4ee9ffc01aa460d5d6b6dbbb82d1fb88967c88691f1093a778f95d42"}],"text":""},{"id":"2.18.10","created":"2019-02-22T11:48:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17095986669189122816","data":"97d75766f62ac390d54f572b3c06e3f790567134753e2c0ff5adc3471b1312ff"}],"text":""},{"id":"2.18.11","created":"2019-02-22T11:50:50","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"716610381404359424","data":"6a5c230e0f5b7f449a279a10ceacc16c7e7e103c229f27dba3d95491cd427984"}],"text":""},{"id":"2.18.12","created":"2019-02-22T11:53:40","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"4764221389359926272","data":"fd71b9cbe050899358204513f1cb4f4ccd0115806d14b03f18d787de1633f6c2"}],"text":""},{"id":"2.18.13","created":"2019-02-22T14:11:40","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"2691640026145870592","data":"bdebc10baef29f5554beefafa4566a50f928379ffb6194e1b58f1fd9f02cc1a2"}],"text":""},{"id":"2.18.14","created":"2019-02-22T14:22:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"14691757747255038976","data":"af18f34442ff09acbfd6152c9a1e7aafe77a8f83fad12a1f04d248d702239081"}],"text":""},{"id":"2.18.15","created":"2019-02-22T14:23:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"10216254519122646016","data":"9b93c57410ea7d80ba6750819e06d6e2b7ba81cf91bbf7e31d265909b46790ad"}],"text":""},{"id":"2.18.16","created":"2019-02-22T15:04:05","sender":"1.2.34","sender_pubkey":"DCT1111111111111111111111111111111114T1Anm","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"data":"0000000068656c6c6f206d6573736167696e672061706920756e656e63727970746564"}],"text":""},{"id":"2.18.17","created":"2019-02-22T15:20:25","sender":"1.2.34","sender_pubkey":"DCT1111111111111111111111111111111114T1Anm","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"data":"0000000068656c6c6f206d6573736167696e672061706920756e656e63727970746564"}],"text":""}]}""" - ) + @Test fun `should get message operations for receiver`() { + val test = api.messagingApi.getAllOperations(receiver = Helpers.account2) + .subscribeOn(Schedulers.newThread()) + .test() - mockHttp.enqueue( - """{"id":1,"result":[{"id":"2.18.3","created":"2019-02-22T11:41:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17391111264393218816","data":"4e2e37edec71eadba4eb8171f7ec1468dc8f5c9b5c218baef9447fd7b998fd83"}],"text":""},{"id":"2.18.4","created":"2019-02-22T11:42:00","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"9084912823086861056","data":"dbf804d15fc01cafa7380f66e008ac2549f0c67900a415d822a7ecc0397013e7"}],"text":""},{"id":"2.18.5","created":"2019-02-22T11:42:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"15712596674046053120","data":"05927f8341f72c1af709c076604482605f3180d1d71a99a64d96620e922c5b66"}],"text":""},{"id":"2.18.6","created":"2019-02-22T11:43:45","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"6523220187852098304","data":"d10fc732248baf8daf36c3e78bb8412c8602e0649e081d1e45410ced8dd66db0"}],"text":""},{"id":"2.18.7","created":"2019-02-22T11:46:25","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"5418653098442279680","data":"1eb0eb62c81bb84a6d91fc42d54d374498dded5c286b59e5b46490b78234d39c"}],"text":""},{"id":"2.18.8","created":"2019-02-22T11:46:45","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"16910704723097406208","data":"5ae4141456f1f7ed5525739426457266b8f84aeebdfe77c14358111cf80c4594"}],"text":""},{"id":"2.18.9","created":"2019-02-22T11:48:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17798987865604147968","data":"e1654daf4ee9ffc01aa460d5d6b6dbbb82d1fb88967c88691f1093a778f95d42"}],"text":""},{"id":"2.18.10","created":"2019-02-22T11:48:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17095986669189122816","data":"97d75766f62ac390d54f572b3c06e3f790567134753e2c0ff5adc3471b1312ff"}],"text":""},{"id":"2.18.11","created":"2019-02-22T11:50:50","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"716610381404359424","data":"6a5c230e0f5b7f449a279a10ceacc16c7e7e103c229f27dba3d95491cd427984"}],"text":""},{"id":"2.18.12","created":"2019-02-22T11:53:40","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"4764221389359926272","data":"fd71b9cbe050899358204513f1cb4f4ccd0115806d14b03f18d787de1633f6c2"}],"text":""},{"id":"2.18.13","created":"2019-02-22T14:11:40","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"2691640026145870592","data":"bdebc10baef29f5554beefafa4566a50f928379ffb6194e1b58f1fd9f02cc1a2"}],"text":""},{"id":"2.18.14","created":"2019-02-22T14:22:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"14691757747255038976","data":"af18f34442ff09acbfd6152c9a1e7aafe77a8f83fad12a1f04d248d702239081"}],"text":""},{"id":"2.18.15","created":"2019-02-22T14:23:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"10216254519122646016","data":"9b93c57410ea7d80ba6750819e06d6e2b7ba81cf91bbf7e31d265909b46790ad"}],"text":""},{"id":"2.18.16","created":"2019-02-22T15:04:05","sender":"1.2.34","sender_pubkey":"DCT1111111111111111111111111111111114T1Anm","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"data":"0000000068656c6c6f206d6573736167696e672061706920756e656e63727970746564"}],"text":""},{"id":"2.18.17","created":"2019-02-22T15:20:25","sender":"1.2.34","sender_pubkey":"DCT1111111111111111111111111111111114T1Anm","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"data":"0000000068656c6c6f206d6573736167696e672061706920756e656e63727970746564"}],"text":""}]}""" - ) + test.awaitTerminalEvent() + test.assertComplete() + .assertNoErrors() + } - val test = api.messagingApi.getAll(receiver = account2).cache() + @Test fun `should get messages for account and decrypt for receiver`() { + val test = api.messagingApi.getAll(receiver = Helpers.account2).cache() .subscribeOn(Schedulers.newThread()) .test() @@ -38,32 +34,20 @@ class MessagingApiTest(channel: Channel) : BaseApiTest(channel) { .filter { it.encrypted.not() } .toSet() - unencrypted.all { it.sender == account } `should equal` true - unencrypted.all { it.receiver == account2 } `should equal` true - unencrypted.all { it.message == "hello messaging api unencrypted" } `should equal` true + unencrypted.all { it.sender == Helpers.account } `should equal` true + unencrypted.all { it.receiver == Helpers.account2 } `should equal` true - val credentials = Credentials(account, private) + val credentials = Credentials(Helpers.account, Helpers.private) val decrypted = test.values().single() .filter { it.encrypted } .map { it.decrypt(credentials) } - decrypted.all { it.sender == account } `should equal` true - decrypted.all { it.receiver == account2 } `should equal` true - decrypted.all { it.message == "hello messaging api" } `should equal` true + decrypted.all { it.sender == Helpers.account } `should equal` true + decrypted.all { it.receiver == Helpers.account2 } `should equal` true } @Test fun `should get decrypted messages for sender account`() { - val credentials = Credentials(account, private) - mockWebSocket - .enqueue( - """{"method":"call","params":[5,"get_message_objects",["1.2.34",null,1000]],"id":1}""", - """{"id":1,"result":[{"id":"2.18.3","created":"2019-02-22T11:41:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17391111264393218816","data":"4e2e37edec71eadba4eb8171f7ec1468dc8f5c9b5c218baef9447fd7b998fd83"}],"text":""},{"id":"2.18.4","created":"2019-02-22T11:42:00","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"9084912823086861056","data":"dbf804d15fc01cafa7380f66e008ac2549f0c67900a415d822a7ecc0397013e7"}],"text":""},{"id":"2.18.5","created":"2019-02-22T11:42:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"15712596674046053120","data":"05927f8341f72c1af709c076604482605f3180d1d71a99a64d96620e922c5b66"}],"text":""},{"id":"2.18.6","created":"2019-02-22T11:43:45","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"6523220187852098304","data":"d10fc732248baf8daf36c3e78bb8412c8602e0649e081d1e45410ced8dd66db0"}],"text":""},{"id":"2.18.7","created":"2019-02-22T11:46:25","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"5418653098442279680","data":"1eb0eb62c81bb84a6d91fc42d54d374498dded5c286b59e5b46490b78234d39c"}],"text":""},{"id":"2.18.8","created":"2019-02-22T11:46:45","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"16910704723097406208","data":"5ae4141456f1f7ed5525739426457266b8f84aeebdfe77c14358111cf80c4594"}],"text":""},{"id":"2.18.9","created":"2019-02-22T11:48:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17798987865604147968","data":"e1654daf4ee9ffc01aa460d5d6b6dbbb82d1fb88967c88691f1093a778f95d42"}],"text":""},{"id":"2.18.10","created":"2019-02-22T11:48:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17095986669189122816","data":"97d75766f62ac390d54f572b3c06e3f790567134753e2c0ff5adc3471b1312ff"}],"text":""},{"id":"2.18.11","created":"2019-02-22T11:50:50","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"716610381404359424","data":"6a5c230e0f5b7f449a279a10ceacc16c7e7e103c229f27dba3d95491cd427984"}],"text":""},{"id":"2.18.12","created":"2019-02-22T11:53:40","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"4764221389359926272","data":"fd71b9cbe050899358204513f1cb4f4ccd0115806d14b03f18d787de1633f6c2"}],"text":""},{"id":"2.18.13","created":"2019-02-22T14:11:40","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"2691640026145870592","data":"bdebc10baef29f5554beefafa4566a50f928379ffb6194e1b58f1fd9f02cc1a2"}],"text":""},{"id":"2.18.14","created":"2019-02-22T14:22:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"14691757747255038976","data":"af18f34442ff09acbfd6152c9a1e7aafe77a8f83fad12a1f04d248d702239081"}],"text":""},{"id":"2.18.15","created":"2019-02-22T14:23:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"10216254519122646016","data":"9b93c57410ea7d80ba6750819e06d6e2b7ba81cf91bbf7e31d265909b46790ad"}],"text":""},{"id":"2.18.16","created":"2019-02-22T15:04:05","sender":"1.2.34","sender_pubkey":"DCT1111111111111111111111111111111114T1Anm","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"data":"0000000068656c6c6f206d6573736167696e672061706920756e656e63727970746564"}],"text":""},{"id":"2.18.17","created":"2019-02-22T15:20:25","sender":"1.2.34","sender_pubkey":"DCT1111111111111111111111111111111114T1Anm","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"data":"0000000068656c6c6f206d6573736167696e672061706920756e656e63727970746564"}],"text":""}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"id":"2.18.3","created":"2019-02-22T11:41:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17391111264393218816","data":"4e2e37edec71eadba4eb8171f7ec1468dc8f5c9b5c218baef9447fd7b998fd83"}],"text":""},{"id":"2.18.4","created":"2019-02-22T11:42:00","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"9084912823086861056","data":"dbf804d15fc01cafa7380f66e008ac2549f0c67900a415d822a7ecc0397013e7"}],"text":""},{"id":"2.18.5","created":"2019-02-22T11:42:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"15712596674046053120","data":"05927f8341f72c1af709c076604482605f3180d1d71a99a64d96620e922c5b66"}],"text":""},{"id":"2.18.6","created":"2019-02-22T11:43:45","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"6523220187852098304","data":"d10fc732248baf8daf36c3e78bb8412c8602e0649e081d1e45410ced8dd66db0"}],"text":""},{"id":"2.18.7","created":"2019-02-22T11:46:25","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"5418653098442279680","data":"1eb0eb62c81bb84a6d91fc42d54d374498dded5c286b59e5b46490b78234d39c"}],"text":""},{"id":"2.18.8","created":"2019-02-22T11:46:45","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"16910704723097406208","data":"5ae4141456f1f7ed5525739426457266b8f84aeebdfe77c14358111cf80c4594"}],"text":""},{"id":"2.18.9","created":"2019-02-22T11:48:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17798987865604147968","data":"e1654daf4ee9ffc01aa460d5d6b6dbbb82d1fb88967c88691f1093a778f95d42"}],"text":""},{"id":"2.18.10","created":"2019-02-22T11:48:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17095986669189122816","data":"97d75766f62ac390d54f572b3c06e3f790567134753e2c0ff5adc3471b1312ff"}],"text":""},{"id":"2.18.11","created":"2019-02-22T11:50:50","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"716610381404359424","data":"6a5c230e0f5b7f449a279a10ceacc16c7e7e103c229f27dba3d95491cd427984"}],"text":""},{"id":"2.18.12","created":"2019-02-22T11:53:40","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"4764221389359926272","data":"fd71b9cbe050899358204513f1cb4f4ccd0115806d14b03f18d787de1633f6c2"}],"text":""},{"id":"2.18.13","created":"2019-02-22T14:11:40","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"2691640026145870592","data":"bdebc10baef29f5554beefafa4566a50f928379ffb6194e1b58f1fd9f02cc1a2"}],"text":""},{"id":"2.18.14","created":"2019-02-22T14:22:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"14691757747255038976","data":"af18f34442ff09acbfd6152c9a1e7aafe77a8f83fad12a1f04d248d702239081"}],"text":""},{"id":"2.18.15","created":"2019-02-22T14:23:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"10216254519122646016","data":"9b93c57410ea7d80ba6750819e06d6e2b7ba81cf91bbf7e31d265909b46790ad"}],"text":""},{"id":"2.18.16","created":"2019-02-22T15:04:05","sender":"1.2.34","sender_pubkey":"DCT1111111111111111111111111111111114T1Anm","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"data":"0000000068656c6c6f206d6573736167696e672061706920756e656e63727970746564"}],"text":""},{"id":"2.18.17","created":"2019-02-22T15:20:25","sender":"1.2.34","sender_pubkey":"DCT1111111111111111111111111111111114T1Anm","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"data":"0000000068656c6c6f206d6573736167696e672061706920756e656e63727970746564"}],"text":""}]}""" - ) - + val credentials = Credentials(Helpers.account, Helpers.private) val test = api.messagingApi.getAllDecryptedForSender(credentials) .subscribeOn(Schedulers.newThread()) .test() @@ -76,17 +60,7 @@ class MessagingApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `should get fail decrypt messages for sender account with wrong credentials`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[5,"get_message_objects",["1.2.34",null,1000]],"id":1}""", - """{"id":1,"result":[{"id":"2.18.3","created":"2019-02-22T11:41:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17391111264393218816","data":"4e2e37edec71eadba4eb8171f7ec1468dc8f5c9b5c218baef9447fd7b998fd83"}],"text":""},{"id":"2.18.4","created":"2019-02-22T11:42:00","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"9084912823086861056","data":"dbf804d15fc01cafa7380f66e008ac2549f0c67900a415d822a7ecc0397013e7"}],"text":""},{"id":"2.18.5","created":"2019-02-22T11:42:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"15712596674046053120","data":"05927f8341f72c1af709c076604482605f3180d1d71a99a64d96620e922c5b66"}],"text":""},{"id":"2.18.6","created":"2019-02-22T11:43:45","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"6523220187852098304","data":"d10fc732248baf8daf36c3e78bb8412c8602e0649e081d1e45410ced8dd66db0"}],"text":""},{"id":"2.18.7","created":"2019-02-22T11:46:25","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"5418653098442279680","data":"1eb0eb62c81bb84a6d91fc42d54d374498dded5c286b59e5b46490b78234d39c"}],"text":""},{"id":"2.18.8","created":"2019-02-22T11:46:45","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"16910704723097406208","data":"5ae4141456f1f7ed5525739426457266b8f84aeebdfe77c14358111cf80c4594"}],"text":""},{"id":"2.18.9","created":"2019-02-22T11:48:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17798987865604147968","data":"e1654daf4ee9ffc01aa460d5d6b6dbbb82d1fb88967c88691f1093a778f95d42"}],"text":""},{"id":"2.18.10","created":"2019-02-22T11:48:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17095986669189122816","data":"97d75766f62ac390d54f572b3c06e3f790567134753e2c0ff5adc3471b1312ff"}],"text":""},{"id":"2.18.11","created":"2019-02-22T11:50:50","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"716610381404359424","data":"6a5c230e0f5b7f449a279a10ceacc16c7e7e103c229f27dba3d95491cd427984"}],"text":""},{"id":"2.18.12","created":"2019-02-22T11:53:40","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"4764221389359926272","data":"fd71b9cbe050899358204513f1cb4f4ccd0115806d14b03f18d787de1633f6c2"}],"text":""},{"id":"2.18.13","created":"2019-02-22T14:11:40","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"2691640026145870592","data":"bdebc10baef29f5554beefafa4566a50f928379ffb6194e1b58f1fd9f02cc1a2"}],"text":""},{"id":"2.18.14","created":"2019-02-22T14:22:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"14691757747255038976","data":"af18f34442ff09acbfd6152c9a1e7aafe77a8f83fad12a1f04d248d702239081"}],"text":""},{"id":"2.18.15","created":"2019-02-22T14:23:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"10216254519122646016","data":"9b93c57410ea7d80ba6750819e06d6e2b7ba81cf91bbf7e31d265909b46790ad"}],"text":""},{"id":"2.18.16","created":"2019-02-22T15:04:05","sender":"1.2.34","sender_pubkey":"DCT1111111111111111111111111111111114T1Anm","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"data":"0000000068656c6c6f206d6573736167696e672061706920756e656e63727970746564"}],"text":""},{"id":"2.18.17","created":"2019-02-22T15:20:25","sender":"1.2.34","sender_pubkey":"DCT1111111111111111111111111111111114T1Anm","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"data":"0000000068656c6c6f206d6573736167696e672061706920756e656e63727970746564"}],"text":""}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"id":"2.18.3","created":"2019-02-22T11:41:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17391111264393218816","data":"4e2e37edec71eadba4eb8171f7ec1468dc8f5c9b5c218baef9447fd7b998fd83"}],"text":""},{"id":"2.18.4","created":"2019-02-22T11:42:00","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"9084912823086861056","data":"dbf804d15fc01cafa7380f66e008ac2549f0c67900a415d822a7ecc0397013e7"}],"text":""},{"id":"2.18.5","created":"2019-02-22T11:42:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"15712596674046053120","data":"05927f8341f72c1af709c076604482605f3180d1d71a99a64d96620e922c5b66"}],"text":""},{"id":"2.18.6","created":"2019-02-22T11:43:45","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"6523220187852098304","data":"d10fc732248baf8daf36c3e78bb8412c8602e0649e081d1e45410ced8dd66db0"}],"text":""},{"id":"2.18.7","created":"2019-02-22T11:46:25","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"5418653098442279680","data":"1eb0eb62c81bb84a6d91fc42d54d374498dded5c286b59e5b46490b78234d39c"}],"text":""},{"id":"2.18.8","created":"2019-02-22T11:46:45","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"16910704723097406208","data":"5ae4141456f1f7ed5525739426457266b8f84aeebdfe77c14358111cf80c4594"}],"text":""},{"id":"2.18.9","created":"2019-02-22T11:48:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17798987865604147968","data":"e1654daf4ee9ffc01aa460d5d6b6dbbb82d1fb88967c88691f1093a778f95d42"}],"text":""},{"id":"2.18.10","created":"2019-02-22T11:48:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"17095986669189122816","data":"97d75766f62ac390d54f572b3c06e3f790567134753e2c0ff5adc3471b1312ff"}],"text":""},{"id":"2.18.11","created":"2019-02-22T11:50:50","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"716610381404359424","data":"6a5c230e0f5b7f449a279a10ceacc16c7e7e103c229f27dba3d95491cd427984"}],"text":""},{"id":"2.18.12","created":"2019-02-22T11:53:40","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"4764221389359926272","data":"fd71b9cbe050899358204513f1cb4f4ccd0115806d14b03f18d787de1633f6c2"}],"text":""},{"id":"2.18.13","created":"2019-02-22T14:11:40","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"2691640026145870592","data":"bdebc10baef29f5554beefafa4566a50f928379ffb6194e1b58f1fd9f02cc1a2"}],"text":""},{"id":"2.18.14","created":"2019-02-22T14:22:15","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"14691757747255038976","data":"af18f34442ff09acbfd6152c9a1e7aafe77a8f83fad12a1f04d248d702239081"}],"text":""},{"id":"2.18.15","created":"2019-02-22T14:23:20","sender":"1.2.34","sender_pubkey":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"10216254519122646016","data":"9b93c57410ea7d80ba6750819e06d6e2b7ba81cf91bbf7e31d265909b46790ad"}],"text":""},{"id":"2.18.16","created":"2019-02-22T15:04:05","sender":"1.2.34","sender_pubkey":"DCT1111111111111111111111111111111114T1Anm","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"data":"0000000068656c6c6f206d6573736167696e672061706920756e656e63727970746564"}],"text":""},{"id":"2.18.17","created":"2019-02-22T15:20:25","sender":"1.2.34","sender_pubkey":"DCT1111111111111111111111111111111114T1Anm","receivers_data":[{"receiver":"1.2.35","receiver_pubkey":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"data":"0000000068656c6c6f206d6573736167696e672061706920756e656e63727970746564"}],"text":""}]}""" - ) - - val test = api.messagingApi.getAll(account) + val test = api.messagingApi.getAll(Helpers.account) .subscribeOn(Schedulers.newThread()) .test() @@ -94,7 +68,7 @@ class MessagingApiTest(channel: Channel) : BaseApiTest(channel) { test.assertComplete() .assertNoErrors() - val credentials = Credentials(account, private2) + val credentials = Credentials(Helpers.account, Helpers.private2) test.values().single() .filter { it.encrypted } .map { it.decrypt(credentials) } diff --git a/library/src/test/java/ch/decent/sdk/api/MiningApiTest.kt b/library/src/test/java/ch/decent/sdk/api/MiningApiTest.kt index b719ace9..c54277bc 100644 --- a/library/src/test/java/ch/decent/sdk/api/MiningApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/MiningApiTest.kt @@ -1,32 +1,14 @@ package ch.decent.sdk.api -import ch.decent.sdk.accountName +import ch.decent.sdk.Helpers import ch.decent.sdk.model.toChainObject import io.reactivex.schedulers.Schedulers import org.junit.Test class MiningApiTest(channel: Channel) : BaseApiTest(channel) { -// override val useMock: Boolean = false - @Test fun `get miners, load their accounts and put it into map with miner names`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"lookup_miner_accounts",["",1000]],"id":1}""", - """{"id":1,"result":[["init0","1.4.1"],["init1","1.4.2"],["init10","1.4.11"],["init2","1.4.3"],["init3","1.4.4"],["init4","1.4.5"],["init5","1.4.6"],["init6","1.4.7"],["init7","1.4.8"],["init8","1.4.9"],["init9","1.4.10"],["u46f36fcd24d74ae58c9b0e49a1f0103c","1.4.12"]]}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_objects",[["1.4.1","1.4.2","1.4.11","1.4.3","1.4.4","1.4.5","1.4.6","1.4.7","1.4.8","1.4.9","1.4.10","1.4.12"]]],"id":2}""", - """{"id":2,"result":[{"id":"1.4.1","miner_account":"1.2.4","last_aslot":5739518,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.6","vote_id":"0:0","total_votes":"1883948815097","url":"","total_missed":477296,"last_confirmed_block_num":485250},{"id":"1.4.2","miner_account":"1.2.5","last_aslot":5739523,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.4","vote_id":"0:1","total_votes":"891228003003","url":"","total_missed":477300,"last_confirmed_block_num":485255},{"id":"1.4.11","miner_account":"1.2.14","last_aslot":5739515,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.9","vote_id":"0:10","total_votes":"891227003003","url":"","total_missed":475818,"last_confirmed_block_num":485248},{"id":"1.4.3","miner_account":"1.2.6","last_aslot":5739522,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.2","vote_id":"0:2","total_votes":248000000,"url":"","total_missed":472864,"last_confirmed_block_num":485254},{"id":"1.4.4","miner_account":"1.2.7","last_aslot":5739513,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.7","vote_id":"0:3","total_votes":"1883458812094","url":"","total_missed":477283,"last_confirmed_block_num":485246},{"id":"1.4.5","miner_account":"1.2.8","last_aslot":5739524,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.0","vote_id":"0:4","total_votes":248000000,"url":"","total_missed":477302,"last_confirmed_block_num":485256},{"id":"1.4.6","miner_account":"1.2.9","last_aslot":5739520,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.3","vote_id":"0:5","total_votes":"890986000000","url":"","total_missed":477298,"last_confirmed_block_num":485252},{"id":"1.4.7","miner_account":"1.2.10","last_aslot":5739519,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.10","vote_id":"0:6","total_votes":"992961815097","url":"","total_missed":477300,"last_confirmed_block_num":485251},{"id":"1.4.8","miner_account":"1.2.11","last_aslot":5739521,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.5","vote_id":"0:7","total_votes":"992720812094","url":"","total_missed":477299,"last_confirmed_block_num":485253},{"id":"1.4.9","miner_account":"1.2.12","last_aslot":5739516,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.8","vote_id":"0:8","total_votes":"890986000000","url":"","total_missed":477299,"last_confirmed_block_num":485249},{"id":"1.4.10","miner_account":"1.2.13","last_aslot":5695113,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.1","vote_id":"0:9","total_votes":0,"url":"","total_missed":5935,"last_confirmed_block_num":444827},{"id":"1.4.12","miner_account":"1.2.27","last_aslot":0,"signing_key":"DCT8cYDtKZvcAyWfFRusy6ja1Hafe9Ys4UPJS92ajTmcrufHnGgjp","vote_id":"0:11","total_votes":"992472812094","url":"","total_missed":3982,"last_confirmed_block_num":0}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[["init0","1.4.1"],["init1","1.4.2"],["init10","1.4.11"],["init2","1.4.3"],["init3","1.4.4"],["init4","1.4.5"],["init5","1.4.6"],["init6","1.4.7"],["init7","1.4.8"],["init8","1.4.9"],["init9","1.4.10"],["u46f36fcd24d74ae58c9b0e49a1f0103c","1.4.12"]]}""" - ) - mockHttp.enqueue( - """{"id":1,"result":[{"id":"1.4.1","miner_account":"1.2.4","last_aslot":5739518,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.6","vote_id":"0:0","total_votes":"1883948815097","url":"","total_missed":477296,"last_confirmed_block_num":485250},{"id":"1.4.2","miner_account":"1.2.5","last_aslot":5739523,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.4","vote_id":"0:1","total_votes":"891228003003","url":"","total_missed":477300,"last_confirmed_block_num":485255},{"id":"1.4.11","miner_account":"1.2.14","last_aslot":5739515,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.9","vote_id":"0:10","total_votes":"891227003003","url":"","total_missed":475818,"last_confirmed_block_num":485248},{"id":"1.4.3","miner_account":"1.2.6","last_aslot":5739522,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.2","vote_id":"0:2","total_votes":248000000,"url":"","total_missed":472864,"last_confirmed_block_num":485254},{"id":"1.4.4","miner_account":"1.2.7","last_aslot":5739513,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.7","vote_id":"0:3","total_votes":"1883458812094","url":"","total_missed":477283,"last_confirmed_block_num":485246},{"id":"1.4.5","miner_account":"1.2.8","last_aslot":5739524,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.0","vote_id":"0:4","total_votes":248000000,"url":"","total_missed":477302,"last_confirmed_block_num":485256},{"id":"1.4.6","miner_account":"1.2.9","last_aslot":5739520,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.3","vote_id":"0:5","total_votes":"890986000000","url":"","total_missed":477298,"last_confirmed_block_num":485252},{"id":"1.4.7","miner_account":"1.2.10","last_aslot":5739519,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.10","vote_id":"0:6","total_votes":"992961815097","url":"","total_missed":477300,"last_confirmed_block_num":485251},{"id":"1.4.8","miner_account":"1.2.11","last_aslot":5739521,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.5","vote_id":"0:7","total_votes":"992720812094","url":"","total_missed":477299,"last_confirmed_block_num":485253},{"id":"1.4.9","miner_account":"1.2.12","last_aslot":5739516,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.8","vote_id":"0:8","total_votes":"890986000000","url":"","total_missed":477299,"last_confirmed_block_num":485249},{"id":"1.4.10","miner_account":"1.2.13","last_aslot":5695113,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.1","vote_id":"0:9","total_votes":0,"url":"","total_missed":5935,"last_confirmed_block_num":444827},{"id":"1.4.12","miner_account":"1.2.27","last_aslot":0,"signing_key":"DCT8cYDtKZvcAyWfFRusy6ja1Hafe9Ys4UPJS92ajTmcrufHnGgjp","vote_id":"0:11","total_votes":"992472812094","url":"","total_missed":3982,"last_confirmed_block_num":0}]}""" - ) - - val test = api.miningApi.getMiners() + @Test fun `get actual votes`() { + val test = api.miningApi.getActualVotes() .subscribeOn(Schedulers.newThread()) .test() @@ -35,18 +17,8 @@ class MiningApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `get new asset per block`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_new_asset_per_block",[]],"id":1}""", - """{"id":1,"result":37000000}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":37000000}""" - ) - - val test = api.miningApi.getNewAssetPerBlock() + @Test fun `get asset per block for block`() { + val test = api.miningApi.getAssetPerBlock(100) .subscribeOn(Schedulers.newThread()) .test() @@ -55,18 +27,8 @@ class MiningApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `get asset per block for block`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_asset_per_block_by_block_num",[100]],"id":1}""", - """{"id":1,"result":0}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":0}""" - ) - - val test = api.miningApi.getAssetPerBlock(100) + @Test fun `get feeds by miner`() { + val test = api.miningApi.getFeedsByMiner("1.2.4".toChainObject()) .subscribeOn(Schedulers.newThread()) .test() @@ -76,16 +38,6 @@ class MiningApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `get miner by account`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_miner_by_account",["1.2.4"]],"id":1}""", - """{"id":1,"result":{"id":"1.4.1","miner_account":"1.2.4","last_aslot":9281456,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.6","vote_id":"0:0","total_votes":"549660925403","url":"","total_missed":478994,"last_confirmed_block_num":3441265}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"id":"1.4.1","miner_account":"1.2.4","last_aslot":9281456,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.6","vote_id":"0:0","total_votes":"549660925403","url":"","total_missed":478994,"last_confirmed_block_num":3441265}}""" - ) - val test = api.miningApi.getMinerByAccount("1.2.4".toChainObject()) .subscribeOn(Schedulers.newThread()) .test() @@ -96,16 +48,6 @@ class MiningApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `get miner count`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_miner_count",[]],"id":1}""", - """{"id":1,"result":13}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":13}""" - ) - val test = api.miningApi.getMinerCount() .subscribeOn(Schedulers.newThread()) .test() @@ -115,18 +57,8 @@ class MiningApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `get feeds by miner`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_feeds_by_miner",["1.2.4",100]],"id":1}""", - """{"id":1,"result":[]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) - - val test = api.miningApi.getFeedsByMiner("1.2.4".toChainObject()) + @Test fun `get miners by ids`() { + val test = api.miningApi.getMiners(listOf("1.4.2".toChainObject(), "1.4.3".toChainObject())) .subscribeOn(Schedulers.newThread()) .test() @@ -135,18 +67,18 @@ class MiningApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `lookup votes`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"lookup_vote_ids",[["0:0","0:1"]]],"id":1}""", - """{"id":1,"result":[{"id":"1.4.1","miner_account":"1.2.4","last_aslot":9281456,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.6","vote_id":"0:0","total_votes":"549660925403","url":"","total_missed":478994,"last_confirmed_block_num":3441265},{"id":"1.4.2","miner_account":"1.2.5","last_aslot":9281457,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.4","vote_id":"0:1","total_votes":"548881501573","url":"","total_missed":478995,"last_confirmed_block_num":3441266}]}""" - ) + @Test fun `get miners, load their accounts and put it into map with miner names`() { + val test = api.miningApi.getMiners() + .subscribeOn(Schedulers.newThread()) + .test() - mockHttp.enqueue( - """{"id":1,"result":[{"id":"1.4.1","miner_account":"1.2.4","last_aslot":9281456,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.6","vote_id":"0:0","total_votes":"549660925403","url":"","total_missed":478994,"last_confirmed_block_num":3441265},{"id":"1.4.2","miner_account":"1.2.5","last_aslot":9281457,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.4","vote_id":"0:1","total_votes":"548881501573","url":"","total_missed":478995,"last_confirmed_block_num":3441266}]}""" - ) + test.awaitTerminalEvent() + test.assertComplete() + .assertNoErrors() + } - val test = api.miningApi.findVotedMiners(listOf("0:0", "0:1")) + @Test fun `get new asset per block`() { + val test = api.miningApi.getNewAssetPerBlock() .subscribeOn(Schedulers.newThread()) .test() @@ -155,18 +87,18 @@ class MiningApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `get actual votes`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_actual_votes",[]],"id":1}""", - """{"id":1,"result":[{"account_name":"all-txs","votes":"5116212862873020"},{"account_name":"u46f36fcd24d74ae58c9b0e49a1f0103c","votes":"1530586818359"},{"account_name":"init10","votes":"995092145155"},{"account_name":"init4","votes":"994847645155"},{"account_name":"init3","votes":"794248451326"},{"account_name":"init8","votes":"573755534890"},{"account_name":"init7","votes":"553531798983"},{"account_name":"init0","votes":"549658925403"},{"account_name":"init1","votes":"548879501573"},{"account_name":"init6","votes":"107330608260"},{"account_name":"init5","votes":"31084811693"},{"account_name":"init2","votes":"6498702205"},{"account_name":"init9","votes":"6498702205"}]}""" - ) + @Test fun `should list miners`() { + val test = api.miningApi.listMinersRelative("") + .subscribeOn(Schedulers.newThread()) + .test() - mockHttp.enqueue( - """{"id":1,"result":[{"account_name":"all-txs","votes":"5116212862873020"},{"account_name":"u46f36fcd24d74ae58c9b0e49a1f0103c","votes":"1530586818359"},{"account_name":"init10","votes":"995092145155"},{"account_name":"init4","votes":"994847645155"},{"account_name":"init3","votes":"794248451326"},{"account_name":"init8","votes":"573755534890"},{"account_name":"init7","votes":"553531798983"},{"account_name":"init0","votes":"549658925403"},{"account_name":"init1","votes":"548879501573"},{"account_name":"init6","votes":"107330608260"},{"account_name":"init5","votes":"31084811693"},{"account_name":"init2","votes":"6498702205"},{"account_name":"init9","votes":"6498702205"}]}""" - ) + test.awaitTerminalEvent() + test.assertComplete() + .assertNoErrors() + } - val test = api.miningApi.getActualVotes() + @Test fun `lookup votes`() { + val test = api.miningApi.findVotedMiners(listOf("0:0", "0:1")) .subscribeOn(Schedulers.newThread()) .test() @@ -176,17 +108,7 @@ class MiningApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `search miner voting`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"search_miner_voting",["u961279ec8b7ae7bd62f304f7c1c3d345","init",true,"NAME_DESC",null,1000]],"id":1}""", - """{"id":1,"result":[{"id":"1.4.6","name":"init5","url":"","total_votes":"31084811693","voted":true},{"id":"1.4.9","name":"init8","url":"","total_votes":"573757534890","voted":true}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"id":"1.4.6","name":"init5","url":"","total_votes":"31084811693","voted":true},{"id":"1.4.9","name":"init8","url":"","total_votes":"573757534890","voted":true}]}""" - ) - - val test = api.miningApi.findAllVotingInfo("init", accountName = accountName, onlyMyVotes = true) + val test = api.miningApi.findAllVotingInfo("init", accountName = Helpers.accountName, onlyMyVotes = true) .subscribeOn(Schedulers.newThread()) .test() diff --git a/library/src/test/java/ch/decent/sdk/api/OperationsTest.kt b/library/src/test/java/ch/decent/sdk/api/OperationsTest.kt index 9ad46a96..8b06b6bc 100644 --- a/library/src/test/java/ch/decent/sdk/api/OperationsTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/OperationsTest.kt @@ -1,266 +1,117 @@ package ch.decent.sdk.api -import ch.decent.sdk.* -import ch.decent.sdk.crypto.Address +import ch.decent.sdk.DCoreApi +import ch.decent.sdk.DCoreConstants +import ch.decent.sdk.DCoreSdk +import ch.decent.sdk.Helpers import ch.decent.sdk.crypto.Credentials -import ch.decent.sdk.crypto.ECKeyPair import ch.decent.sdk.crypto.address -import ch.decent.sdk.model.* -import ch.decent.sdk.net.ws.CustomWebSocketService +import ch.decent.sdk.model.AssetAmount +import ch.decent.sdk.model.toChainObject import io.reactivex.schedulers.Schedulers -import org.junit.After -import org.junit.Before -import org.junit.Ignore -import org.junit.Test +import org.junit.* +import org.junit.runners.MethodSorters import org.slf4j.LoggerFactory -import java.math.BigInteger +@FixMethodOrder(MethodSorters.NAME_ASCENDING) class OperationsTest { - private lateinit var mockWebSocket: CustomWebSocketService + companion object { + private lateinit var timestamp: String + + @BeforeClass @JvmStatic fun before() { + timestamp = System.currentTimeMillis().toString() + } + } + private lateinit var api: DCoreApi + private val accountName: String + get() = "sdk-account-$timestamp" + @Before fun init() { val logger = LoggerFactory.getLogger("RxWebSocket") - mockWebSocket = CustomWebSocketService().apply { start() } - api = DCoreSdk.createForWebSocket(client(logger), mockWebSocket.getUrl(), logger) -// api = DCoreSdk.createForWebSocket(client(logger), url, logger) + api = DCoreSdk.createForWebSocket(Helpers.client(logger), Helpers.wsUrl, logger) } @After fun finish() { - mockWebSocket.shutdown() } - @Test fun `should fail for HTTP`() { - api = DCoreSdk.createForHttp(client(), restUrl) - - val test = api.broadcastApi.broadcastWithCallback(private, emptyList()) + @Test fun `accounts-1 should create account`() { + val test = api.accountApi.create(Helpers.credentials, accountName, Helpers.public.address()) .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() - test.assertTerminated() - .assertError(IllegalArgumentException::class.java) + test.assertComplete() + .assertNoErrors() } - @Test fun `should create a transfer operation and broadcast`() { - val key = ECKeyPair.fromBase58(private) - val memo = Memo("hello memo here i am", key, Address.decode(public2), BigInteger("735604672334802432")) - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_chain_id",[]],"id":0}""", - """{"id":0,"result":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc"}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_dynamic_global_properties",[]],"id":1}""", - """{"id":1,"result":{"id":"2.1.0","head_block_number":3441407,"head_block_id":"003482ff012880f806baa6f220538425804136be","time":"2018-12-19T14:08:30","current_miner":"1.4.9","next_maintenance_time":"2018-12-20T00:00:00","last_budget_time":"2018-12-19T00:00:00","unspent_fee_budget":11400166,"mined_rewards":"308728000000","miner_budget_from_fees":22030422,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":8,"recently_missed_count":0,"current_aslot":9281631,"recent_slots_filled":"317672346624442248850332726400554761855","dynamic_flags":0,"last_irreversible_block_num":3441407}}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_required_fees",[[[39,{"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7","nonce":735604672334802432},"fee":{"amount":0,"asset_id":"1.3.0"}}]],"1.3.0"]],"id":2}""", - """{"id":2,"result":[{"amount":500000,"asset_id":"1.3.0"}]}""" - ) - .enqueue( - """{"method":"call","params":[2,"broadcast_transaction_with_callback",[4,{"expiration":"2018-12-19T14:09:01","ref_block_num":33535,"ref_block_prefix":4169148417,"extensions":[],"operations":[[39,{"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7","nonce":735604672334802432},"fee":{"amount":500000,"asset_id":"1.3.0"}}]],"signatures":["202760acbe00037b01faa2fb86da9b22a6c3cd739a8de63f55e40b47b3a94ba46f20063c040d8b34de25b36379e96749f2d941f45a221e8c381a821ddb295a0e80"]}]],"id":3}""", - """{"method":"notice","params":[4,[{"id":"30429898f56b61a01691f195aed6290525320ba3","block_num":3441408,"trx_num":0,"trx":{"ref_block_num":33535,"ref_block_prefix":4169148417,"expiration":"2018-12-19T14:09:01","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["202760acbe00037b01faa2fb86da9b22a6c3cd739a8de63f55e40b47b3a94ba46f20063c040d8b34de25b36379e96749f2d941f45a221e8c381a821ddb295a0e80"],"operation_results":[[0,{}]]}}]]}""" - ) - - val op = TransferOperation( - account, - account2, - AssetAmount(1), - memo - ) - - val trx = api.transactionApi.createTransaction(listOf(op)) - .map { it.withSignature(key) } - .blockingGet() - - val test = api.broadcastApi.broadcastWithCallback(trx) + @Test fun `accounts-2 should make a transfer to new account`() { + val test = api.accountApi.transfer(Helpers.credentials, accountName, DCoreConstants.DCT.amount(1.0)) .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() - .assertValue { it.id == trx.id } - } - @Ignore - @Test fun `should create account`() { - val key = ECKeyPair.fromBase58(private) - val op = AccountCreateOperation(account, "hello.johnny", public.address()) - val trx = api.transactionApi.createTransaction(op) - .map { it.withSignature(key) } - .blockingGet() - - val test = api.broadcastApi.broadcastWithCallback(trx) + @Test fun `accounts-3 should make a vote on a new account`() { + val test = api.accountApi.createCredentials(accountName, Helpers.private) + .flatMap { api.miningApi.vote(it, listOf("1.4.4".toChainObject())) } .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() - .assertValue { it.id == trx.id } } - @Test fun `should send message`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_chain_id",[]],"id":0}""", - """{"id":0,"result":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc"}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_objects",[["1.2.34"]]],"id":1}""", - """{"id":1,"result":[{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0}]}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_objects",[["1.2.35"]]],"id":2}""", - """{"id":2,"result":[{"id":"1.2.35","registrar":"1.2.15","name":"u3a7b78084e7d3956442d5a4d439dad51","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP",1]]},"options":{"memo_key":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.35","top_n_control_flags":0}]}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_dynamic_global_properties",[]],"id":3}""", - """{"id":3,"result":{"id":"2.1.0","head_block_number":4364411,"head_block_id":"0042987bdf9453eac6b4257f78db4cc790219c7c","time":"2019-02-22T15:57:00","current_miner":"1.4.8","next_maintenance_time":"2019-02-23T00:00:00","last_budget_time":"2019-02-22T00:00:00","unspent_fee_budget":3354697,"mined_rewards":"349021000000","miner_budget_from_fees":7373155,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":9,"recently_missed_count":4,"current_aslot":10405938,"recent_slots_filled":"318349415066694580176222834493180803053","dynamic_flags":0,"last_irreversible_block_num":4364411}}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_required_fees",[[[18,{"id":1,"payer":"1.2.34","required_auths":["1.2.34"],"data":"7b2266726f6d223a22312e322e3334222c227265636569766572735f64617461223a5b7b22746f223a22312e322e3335222c2264617461223a2239623933633537343130656137643830626136373530383139653036643665326237626138316366393162626637653331643236353930396234363739306164222c227075625f746f223a224443543662566d696d745953765751747764726b56565147486b5673544a5a564b74426955716634596d4a6e724a506e6b38395150222c226e6f6e6365223a31303231363235343531393132323634363031367d5d2c227075625f66726f6d223a22444354364d41355451513655624d794d614c506d505845325379683547335a566876355362466564714c507164464368536571547a227d","fee":{"amount":0,"asset_id":"1.3.0"}}]],"1.3.0"]],"id":4}""", - """{"id":4,"result":[{"amount":500002,"asset_id":"1.3.0"}]}""" - ) - .enqueue( - """{"method":"call","params":[2,"broadcast_transaction_with_callback",[6,{"expiration":"2019-02-22T15:57:32","ref_block_num":39035,"ref_block_prefix":3931346143,"extensions":[],"operations":[[18,{"id":1,"payer":"1.2.34","required_auths":["1.2.34"],"data":"7b2266726f6d223a22312e322e3334222c227265636569766572735f64617461223a5b7b22746f223a22312e322e3335222c2264617461223a2239623933633537343130656137643830626136373530383139653036643665326237626138316366393162626637653331643236353930396234363739306164222c227075625f746f223a224443543662566d696d745953765751747764726b56565147486b5673544a5a564b74426955716634596d4a6e724a506e6b38395150222c226e6f6e6365223a31303231363235343531393132323634363031367d5d2c227075625f66726f6d223a22444354364d41355451513655624d794d614c506d505845325379683547335a566876355362466564714c507164464368536571547a227d","fee":{"amount":500002,"asset_id":"1.3.0"}}]],"signatures":["1f597c8d0f6fdda0f5afd3968ef64e6bbc04bc14d30be0d3d2b18c92ec2818a14c44ac4a1922f99fefab2b42a2616577e955a6df61d1d185551c6b0253bbe4e2db"]}]],"id":5}""", - """{"method":"notice","params":[6,[{"id":"177476c0cafa8dddc30bcd6449d3d47195e00d09","block_num":4364412,"trx_num":0,"trx":{"ref_block_num":39035,"ref_block_prefix":3931346143,"expiration":"2019-02-22T15:57:32","operations":[[18,{"fee":{"amount":500002,"asset_id":"1.3.0"},"payer":"1.2.34","required_auths":["1.2.34"],"id":1,"data":"7b2266726f6d223a22312e322e3334222c227265636569766572735f64617461223a5b7b22746f223a22312e322e3335222c2264617461223a2239623933633537343130656137643830626136373530383139653036643665326237626138316366393162626637653331643236353930396234363739306164222c227075625f746f223a224443543662566d696d745953765751747764726b56565147486b5673544a5a564b74426955716634596d4a6e724a506e6b38395150222c226e6f6e6365223a31303231363235343531393132323634363031367d5d2c227075625f66726f6d223a22444354364d41355451513655624d794d614c506d505845325379683547335a566876355362466564714c507164464368536571547a227d"}]],"extensions":[],"signatures":["1f597c8d0f6fdda0f5afd3968ef64e6bbc04bc14d30be0d3d2b18c92ec2818a14c44ac4a1922f99fefab2b42a2616577e955a6df61d1d185551c6b0253bbe4e2db"],"operation_results":[[0,{}]]}}]]}""" - ) - val sender = api.accountApi.get(account).blockingGet() - val recipient = api.accountApi.get(account2).blockingGet() - val keyPair = ECKeyPair.fromBase58(private) - val msg = Memo("hello messaging api", keyPair, recipient.options.memoKey, BigInteger("10216254519122646016")) - val payloadReceiver = MessagePayloadReceiver(recipient.id, msg.message, recipient.options.memoKey, msg.nonce) - val payload = MessagePayload(sender.id, listOf(payloadReceiver), sender.options.memoKey) - val op = SendMessageOperation(api.core.gson.toJson(payload), sender.id) - -// we cannot set the nonce with api call -// val op = api.messagingApi.createMessageOperation(credentials, account2, "hello messaging api") -// .blockingGet() - - val trx = api.transactionApi.createTransaction(op) - .map { it.withSignature(keyPair) } - .blockingGet() - - val test = api.broadcastApi.broadcastWithCallback(trx) + @Test fun `should send message`() { + val test = api.messagingApi.send(Helpers.credentials, listOf(Helpers.account2 to "test message encrypted t=$timestamp")) .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() - .assertValue { it.id == trx.id } } @Test fun `should send unencrypted message`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_chain_id",[]],"id":0}""", - """{"id":0,"result":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc"}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_dynamic_global_properties",[]],"id":1}""", - """{"id":1,"result":{"id":"2.1.0","head_block_number":4364343,"head_block_id":"004298378768bfcc66bb1c8974b6d75d5b723c8d","time":"2019-02-22T15:49:55","current_miner":"1.4.1","next_maintenance_time":"2019-02-23T00:00:00","last_budget_time":"2019-02-22T00:00:00","unspent_fee_budget":3383665,"mined_rewards":"346505000000","miner_budget_from_fees":7373155,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":9,"recently_missed_count":0,"current_aslot":10405853,"recent_slots_filled":"249850723296557969923040622545875230591","dynamic_flags":0,"last_irreversible_block_num":4364343}}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_required_fees",[[[18,{"id":1,"payer":"1.2.34","required_auths":["1.2.34"],"data":"7b2266726f6d223a22312e322e3334222c227265636569766572735f64617461223a5b7b22746f223a22312e322e3335222c2264617461223a2230303030303030303638363536633663366632303664363537333733363136373639366536373230363137303639323037353665363536653633373237393730373436353634227d5d7d","fee":{"amount":0,"asset_id":"1.3.0"}}]],"1.3.0"]],"id":2}""", - """{"id":2,"result":[{"amount":500001,"asset_id":"1.3.0"}]}""" - ) - .enqueue( - """{"method":"call","params":[2,"broadcast_transaction_with_callback",[4,{"expiration":"2019-02-22T15:50:39","ref_block_num":38967,"ref_block_prefix":3435096199,"extensions":[],"operations":[[18,{"id":1,"payer":"1.2.34","required_auths":["1.2.34"],"data":"7b2266726f6d223a22312e322e3334222c227265636569766572735f64617461223a5b7b22746f223a22312e322e3335222c2264617461223a2230303030303030303638363536633663366632303664363537333733363136373639366536373230363137303639323037353665363536653633373237393730373436353634227d5d7d","fee":{"amount":500001,"asset_id":"1.3.0"}}]],"signatures":["1f43188b754f7e443675c5240d5a4ae2e326a53335b5f35908eea5b55af67bfa1230a73021b4db6a2cc0dd6743ff9c42dbbc1cfa5b06cb9b49edae6998ab83d7b8"]}]],"id":3}""", - """{"method":"notice","params":[4,[{"id":"4cafe3a8f039ad8f370782b7572ae77207940a36","block_num":4364344,"trx_num":0,"trx":{"ref_block_num":38967,"ref_block_prefix":3435096199,"expiration":"2019-02-22T15:50:39","operations":[[18,{"fee":{"amount":500001,"asset_id":"1.3.0"},"payer":"1.2.34","required_auths":["1.2.34"],"id":1,"data":"7b2266726f6d223a22312e322e3334222c227265636569766572735f64617461223a5b7b22746f223a22312e322e3335222c2264617461223a2230303030303030303638363536633663366632303664363537333733363136373639366536373230363137303639323037353665363536653633373237393730373436353634227d5d7d"}]],"extensions":[],"signatures":["1f43188b754f7e443675c5240d5a4ae2e326a53335b5f35908eea5b55af67bfa1230a73021b4db6a2cc0dd6743ff9c42dbbc1cfa5b06cb9b49edae6998ab83d7b8"],"operation_results":[[0,{}]]}}]]}""" - ) - - val credentials = Credentials(account, private) - val op = api.messagingApi.createMessageOperationUnencrypted(credentials, listOf(account2 to "hello messaging api unencrypted")) - .blockingGet() - - val trx = api.transactionApi.createTransaction(op) - .map { it.withSignature(credentials.keyPair) } - .blockingGet() - - val test = api.broadcastApi.broadcastWithCallback(trx) + val test = api.messagingApi.sendUnencrypted(Helpers.credentials, listOf(Helpers.account2 to "test message plain t=$timestamp")) .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() - .assertValue { it.id == trx.id } } @Test fun `should make a transfer to content`() { - - val key = ECKeyPair.fromBase58(private) - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_chain_id",[]],"id":0}""", - """{"id":0,"result":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc"}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_dynamic_global_properties",[]],"id":1}""", - """{"id":1,"result":{"id":"2.1.0","head_block_number":3441407,"head_block_id":"003482ff012880f806baa6f220538425804136be","time":"2018-12-19T14:08:30","current_miner":"1.4.9","next_maintenance_time":"2018-12-20T00:00:00","last_budget_time":"2018-12-19T00:00:00","unspent_fee_budget":11400166,"mined_rewards":"308728000000","miner_budget_from_fees":22030422,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":8,"recently_missed_count":0,"current_aslot":9281631,"recent_slots_filled":"317672346624442248850332726400554761855","dynamic_flags":0,"last_irreversible_block_num":3441407}}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_required_fees",[[[39,{"from":"1.2.34","to":"2.13.3","amount":{"amount":1,"asset_id":"1.3.0"},"memo":{"message":"00000000436f6e74656e74207472616e7366657220746f20","nonce":0},"fee":{"amount":0,"asset_id":"1.3.0"}}]],"1.3.0"]],"id":2}""", - """{"id":2,"result":[{"amount":500000,"asset_id":"1.3.0"}]}""" - ) - .enqueue( - """{"method":"call","params":[2,"broadcast_transaction_with_callback",[4,{"expiration":"2018-12-19T14:09:03","ref_block_num":33535,"ref_block_prefix":4169148417,"extensions":[],"operations":[[39,{"from":"1.2.34","to":"2.13.3","amount":{"amount":1,"asset_id":"1.3.0"},"memo":{"message":"00000000436f6e74656e74207472616e7366657220746f20","nonce":0},"fee":{"amount":500000,"asset_id":"1.3.0"}}]],"signatures":["1f7c0e4a9f58f41e1e362e27eddd1c4b54638ba1b2a572e7908d73971a19a17b4535db019ff44b3202187d531ff0f98f1e0a0a70be8f7bafca9cc199aca8fd17e9"]}]],"id":3}""", - """{"method":"notice","params":[4,[{"id":"f4d3e80488de8a565ebad03845bec8a9c9f75c23","block_num":4460425,"trx_num":0,"trx":{"ref_block_num":3976,"ref_block_prefix":239596881,"expiration":"2019-03-01T10:21:01","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"2.13.3","amount":{"amount":1,"asset_id":"1.3.0"},"memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000436f6e74656e74207472616e7366657220746f20"},"extensions":[]}]],"extensions":[],"signatures":["2004e63d74b8915a91a92cd1332432492f061adc191e5f0a317cd1cab777089a7552ad54025bf6dd3145c49347701915d5b2a1d1348325c9bd838d43bbf5149c4c"],"operation_results":[[0,{}]]}}]]}""" - ) - - val test = api.contentApi.transfer(Credentials(account, key), "2.13.3".toChainObject(), AssetAmount(1), "Content transfer to ") - .subscribeOn(Schedulers.newThread()) - .test() + val test = api.contentApi.transfer(Helpers.credentials, "2.13.3".toChainObject(), AssetAmount(1), "transfer to content") + .subscribeOn(Schedulers.newThread()) + .test() test.awaitTerminalEvent() test.assertComplete() - .assertNoErrors() - + .assertNoErrors() } - @Test fun `should make a vote`() { - - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_objects",[["1.4.4"]]],"id":1}""", - """{"id":1,"result":[{"id":"1.4.4","miner_account":"1.2.7","last_aslot":10596344,"signing_key":"DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4","pay_vb":"1.9.7","vote_id":"0:3","total_votes":"793223016266","url":"","total_missed":478522,"last_confirmed_block_num":4520754,"vote_ranking":4}]}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_objects",[["1.2.34"]]],"id":2}""", - """{"id":2,"result":[{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:3"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0}]}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_chain_id",[]],"id":0}""", - """{"id":0,"result":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc"}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_dynamic_global_properties",[]],"id":3}""", - """{"id":3,"result":{"id":"2.1.0","head_block_number":3441407,"head_block_id":"003482ff012880f806baa6f220538425804136be","time":"2018-12-19T14:08:30","current_miner":"1.4.9","next_maintenance_time":"2018-12-20T00:00:00","last_budget_time":"2018-12-19T00:00:00","unspent_fee_budget":11400166,"mined_rewards":"308728000000","miner_budget_from_fees":22030422,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":8,"recently_missed_count":0,"current_aslot":9281631,"recent_slots_filled":"317672346624442248850332726400554761855","dynamic_flags":0,"last_irreversible_block_num":3441407}}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_required_fees",[[[2,{"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:3"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"fee":{"amount":0,"asset_id":"1.3.0"}}]],"1.3.0"]],"id":4}""", - """{"id":4,"result":[{"amount":500000,"asset_id":"1.3.0"}]}""" - ) - .enqueue( - """{"method":"call","params":[2,"broadcast_transaction_with_callback",[6,{"expiration":"2018-12-19T14:09:02","ref_block_num":33535,"ref_block_prefix":4169148417,"extensions":[],"operations":[[2,{"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:3"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"fee":{"amount":500000,"asset_id":"1.3.0"}}]],"signatures":["2046d64bf6b11931d29d8b125894d807f81c9af9c1e270ac0bb9212c3f3800fc7677cca63f79303fcac448adc79f820cd559dfc4c4aa76f34ba3a4755b7c48387b"]}]],"id":5}""", - """{"method":"notice","params":[6,[{"id":"f4d3e80488de8a565ebad03845bec8a9c9f75c23","block_num":4460425,"trx_num":0,"trx":{"ref_block_num":3976,"ref_block_prefix":239596881,"expiration":"2019-03-01T10:21:01","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"2.13.3","amount":{"amount":1,"asset_id":"1.3.0"},"memo":{"from":"DCT1111111111111111111111111111111114T1Anm","to":"DCT1111111111111111111111111111111114T1Anm","nonce":0,"message":"00000000436f6e74656e74207472616e7366657220746f20"},"extensions":[]}]],"extensions":[],"signatures":["2004e63d74b8915a91a92cd1332432492f061adc191e5f0a317cd1cab777089a7552ad54025bf6dd3145c49347701915d5b2a1d1348325c9bd838d43bbf5149c4c"],"operation_results":[[0,{}]]}}]]}""" - ) - - val test = api.miningApi.vote(Credentials(account, private), listOf("1.4.4".toChainObject())) - .subscribeOn(Schedulers.newThread()) - .test() + @Ignore // already commented + @Test fun `leave rating and comment`() { + val test = api.purchaseApi.rateAndComment( + Credentials("1.2.27".toChainObject(), "5Hxwqx6JJUBYWjQNt8DomTNJ6r6YK8wDJym4CMAH1zGctFyQtzt"), + "ipfs:QmUuWZihBKYnC7TrhCMjtZrLPrEnPCQLeAkkDEP2tvNcqC", + 2, + "comment KT" + ) + .subscribeOn(Schedulers.newThread()) + .test() test.awaitTerminalEvent() test.assertComplete() - .assertNoErrors() - + .assertNoErrors() } - } \ No newline at end of file diff --git a/library/src/test/java/ch/decent/sdk/api/PurchaseApiTest.kt b/library/src/test/java/ch/decent/sdk/api/PurchaseApiTest.kt index 4bfd52ed..71b78cf1 100644 --- a/library/src/test/java/ch/decent/sdk/api/PurchaseApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/PurchaseApiTest.kt @@ -1,6 +1,6 @@ package ch.decent.sdk.api -import ch.decent.sdk.account +import ch.decent.sdk.Helpers import io.reactivex.schedulers.Schedulers import org.junit.Test import org.junit.runner.RunWith @@ -8,20 +8,9 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) class PurchaseApiTest(channel: Channel) : BaseApiTest(channel) { -// override val useMock: Boolean = false - @Test fun `should get list of open purchases`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_open_buyings",[]],"id":1}""", - """{"id":1,"result":[]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) - - val test = api.purchaseApi.getAllOpen() + @Test fun `should get list of history purchases`() { + val test = api.purchaseApi.getAllHistory(Helpers.account) .subscribeOn(Schedulers.newThread()) .test() @@ -30,18 +19,8 @@ class PurchaseApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should get list of open purchases for account`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_open_buyings_by_consumer",["1.2.34"]],"id":1}""", - """{"id":1,"result":[]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) - - val test = api.purchaseApi.getAllOpenByAccount(account) + @Test fun `should get list of open purchases`() { + val test = api.purchaseApi.getAllOpen() .subscribeOn(Schedulers.newThread()) .test() @@ -51,17 +30,7 @@ class PurchaseApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `should get list of open purchases for uri`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_open_buyings_by_URI",["http://some.uri"]],"id":1}""", - """{"id":1,"result":[]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) - - val test = api.purchaseApi.getAllOpenByUri("http://some.uri") + val test = api.purchaseApi.getAllOpenByUri("ipfs:QmWBoRBYuxzH5a8d3gssRbMS5scs6fqLKgapBfqVNUFUtZ") .subscribeOn(Schedulers.newThread()) .test() @@ -70,18 +39,8 @@ class PurchaseApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should get list of history purchases`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_buying_history_objects_by_consumer",["1.2.34"]],"id":1}""", - """{"id":1,"result":[{"id":"2.12.3","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=bbc8a9c3-1bcd-48a6-820d-e5a60c29cf56","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-16T08:59:10","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-15T08:59:10","rated_or_commented":false,"created":"2018-04-26T15:34:50","region_code_from":1},{"id":"2.12.5","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=13f99277-f746-447f-9d07-47e597d7b0e0","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-29T13:49:00","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-28T13:49:00","rated_or_commented":false,"created":"2018-04-26T15:36:15","region_code_from":1},{"id":"2.12.6","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2Ftest%3A3&version=3b0b6b4b-5c8f-412f-ba03-bf7e6679df49","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Hra\",\"description\":\"{\\\"applicationId\\\":3,\\\"vendorId\\\":2}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-30T07:38:05","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-29T07:38:05","rated_or_commented":false,"created":"2018-05-29T07:36:20","region_code_from":1},{"id":"2.12.9","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=cb525aa4-6d75-4f27-84bc-cdf372ef148b","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T09:16:10","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T09:16:10","rated_or_commented":false,"created":"2018-04-26T15:48:50","region_code_from":1},{"id":"2.12.13","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=3c7cf98f-fdff-4bfa-b698-b30ee8abfe92","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T09:21:10","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T09:21:10","rated_or_commented":false,"created":"2018-04-27T08:54:25","region_code_from":1},{"id":"2.12.14","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F1&version=b711dc9b-3627-4f37-93f3-6f6f3137bcca","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"New product 2\",\"description\":\"{\\\"productId\\\":1,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T09:21:10","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T09:21:10","rated_or_commented":false,"created":"2018-05-21T09:29:15","region_code_from":1},{"id":"2.12.15","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=65fe7fa5-a81b-45fc-a733-c713dd816024","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T09:21:40","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T09:21:40","rated_or_commented":false,"created":"2018-04-26T15:57:05","region_code_from":1},{"id":"2.12.16","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=6eb8850f-2edd-4164-9069-3f3f5ea2eca5","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T09:30:30","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T09:30:30","rated_or_commented":false,"created":"2018-05-21T09:37:10","region_code_from":1},{"id":"2.12.17","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F1&version=949da412-18bd-4b8d-acba-e8fd7a594d88","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"New product 2\",\"description\":\"{\\\"productId\\\":1,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T11:34:40","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T11:34:40","rated_or_commented":false,"created":"2018-05-21T09:37:20","region_code_from":1}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"id":"2.12.3","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=bbc8a9c3-1bcd-48a6-820d-e5a60c29cf56","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-16T08:59:10","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-15T08:59:10","rated_or_commented":false,"created":"2018-04-26T15:34:50","region_code_from":1},{"id":"2.12.5","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=13f99277-f746-447f-9d07-47e597d7b0e0","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-29T13:49:00","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-28T13:49:00","rated_or_commented":false,"created":"2018-04-26T15:36:15","region_code_from":1},{"id":"2.12.6","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2Ftest%3A3&version=3b0b6b4b-5c8f-412f-ba03-bf7e6679df49","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Hra\",\"description\":\"{\\\"applicationId\\\":3,\\\"vendorId\\\":2}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-30T07:38:05","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-29T07:38:05","rated_or_commented":false,"created":"2018-05-29T07:36:20","region_code_from":1},{"id":"2.12.9","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=cb525aa4-6d75-4f27-84bc-cdf372ef148b","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T09:16:10","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T09:16:10","rated_or_commented":false,"created":"2018-04-26T15:48:50","region_code_from":1},{"id":"2.12.13","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=3c7cf98f-fdff-4bfa-b698-b30ee8abfe92","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T09:21:10","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T09:21:10","rated_or_commented":false,"created":"2018-04-27T08:54:25","region_code_from":1},{"id":"2.12.14","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F1&version=b711dc9b-3627-4f37-93f3-6f6f3137bcca","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"New product 2\",\"description\":\"{\\\"productId\\\":1,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T09:21:10","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T09:21:10","rated_or_commented":false,"created":"2018-05-21T09:29:15","region_code_from":1},{"id":"2.12.15","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=65fe7fa5-a81b-45fc-a733-c713dd816024","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T09:21:40","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T09:21:40","rated_or_commented":false,"created":"2018-04-26T15:57:05","region_code_from":1},{"id":"2.12.16","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=6eb8850f-2edd-4164-9069-3f3f5ea2eca5","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T09:30:30","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T09:30:30","rated_or_commented":false,"created":"2018-05-21T09:37:10","region_code_from":1},{"id":"2.12.17","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F1&version=949da412-18bd-4b8d-acba-e8fd7a594d88","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"New product 2\",\"description\":\"{\\\"productId\\\":1,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T11:34:40","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T11:34:40","rated_or_commented":false,"created":"2018-05-21T09:37:20","region_code_from":1}]}""" - ) - - val test = api.purchaseApi.getAllHistory(account) + @Test fun `should get list of open purchases for account`() { + val test = api.purchaseApi.getAllOpenByAccount(Helpers.account) .subscribeOn(Schedulers.newThread()) .test() @@ -91,17 +50,7 @@ class PurchaseApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `should get purchase for account and uri`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_buying_by_consumer_URI",["1.2.34","http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=bbc8a9c3-1bcd-48a6-820d-e5a60c29cf56"]],"id":1}""", - """{"id":1,"result":{"id":"2.12.3","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=bbc8a9c3-1bcd-48a6-820d-e5a60c29cf56","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-16T08:59:10","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-15T08:59:10","rated_or_commented":false,"created":"2018-04-26T15:34:50","region_code_from":1}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"id":"2.12.3","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=bbc8a9c3-1bcd-48a6-820d-e5a60c29cf56","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"Product 2\",\"description\":\"{\\\"productId\\\":2,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-16T08:59:10","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-15T08:59:10","rated_or_commented":false,"created":"2018-04-26T15:34:50","region_code_from":1}}""" - ) - - val test = api.purchaseApi.get(account, "http://alax.io/?scheme=alax%3A%2F%2F1%2F2&version=bbc8a9c3-1bcd-48a6-820d-e5a60c29cf56") + val test = api.purchaseApi.get(Helpers.account, "ipfs:QmWBoRBYuxzH5a8d3gssRbMS5scs6fqLKgapBfqVNUFUtZ") .subscribeOn(Schedulers.newThread()) .test() @@ -111,17 +60,7 @@ class PurchaseApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `should search purchases`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_buying_objects_by_consumer",["1.2.34","-purchased","1.0.0","new",100]],"id":1}""", - """{"id":1,"result":[{"id":"2.12.17","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F1&version=949da412-18bd-4b8d-acba-e8fd7a594d88","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"New product 2\",\"description\":\"{\\\"productId\\\":1,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T11:34:40","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T11:34:40","rated_or_commented":false,"created":"2018-05-21T09:37:20","region_code_from":1},{"id":"2.12.14","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F1&version=b711dc9b-3627-4f37-93f3-6f6f3137bcca","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"New product 2\",\"description\":\"{\\\"productId\\\":1,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T09:21:10","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T09:21:10","rated_or_commented":false,"created":"2018-05-21T09:29:15","region_code_from":1}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"id":"2.12.17","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F1&version=949da412-18bd-4b8d-acba-e8fd7a594d88","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"New product 2\",\"description\":\"{\\\"productId\\\":1,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T11:34:40","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T11:34:40","rated_or_commented":false,"created":"2018-05-21T09:37:20","region_code_from":1},{"id":"2.12.14","consumer":"1.2.34","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F1&version=b711dc9b-3627-4f37-93f3-6f6f3137bcca","synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"New product 2\",\"description\":\"{\\\"productId\\\":1,\\\"applicationId\\\":1}\"}","price":{"amount":0,"asset_id":"1.3.0"},"paid_price_before_exchange":{"amount":100000000,"asset_id":"1.3.0"},"paid_price_after_exchange":{"amount":100000000,"asset_id":"1.3.0"},"seeders_answered":[],"size":1,"rating":"18446744073709551615","comment":"","expiration_time":"2018-05-31T09:21:10","pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"key_particles":[],"expired":false,"delivered":true,"expiration_or_delivery_time":"2018-05-30T09:21:10","rated_or_commented":false,"created":"2018-05-21T09:29:15","region_code_from":1}]}""" - ) - - val test = api.purchaseApi.findAll(account, "new") + val test = api.purchaseApi.findAll(Helpers.account, "") .subscribeOn(Schedulers.newThread()) .test() @@ -131,17 +70,7 @@ class PurchaseApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `should search feedback`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"search_feedback",[null,"","1.0.0",100]],"id":1}""", - """{"id":1,"result":[]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) - - val test = api.purchaseApi.findAllForFeedback("") + val test = api.purchaseApi.findAllForFeedback("ipfs:QmWBoRBYuxzH5a8d3gssRbMS5scs6fqLKgapBfqVNUFUtZ") .subscribeOn(Schedulers.newThread()) .test() diff --git a/library/src/test/java/ch/decent/sdk/api/SeederApiTest.kt b/library/src/test/java/ch/decent/sdk/api/SeederApiTest.kt index 13b0deab..612cc9f7 100644 --- a/library/src/test/java/ch/decent/sdk/api/SeederApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/SeederApiTest.kt @@ -1,5 +1,6 @@ package ch.decent.sdk.api +import ch.decent.sdk.model.Regions import ch.decent.sdk.model.toChainObject import io.reactivex.schedulers.Schedulers import org.junit.Test @@ -8,20 +9,9 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) class SeederApiTest(channel: Channel) : BaseApiTest(channel) { -// override val useMock: Boolean = false - @Test fun `should list seeders by price`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"list_seeders_by_price",[100]],"id":1}""", - """{"id":1,"result":[]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) - - val test = api.seedersApi.listByPrice() + @Test fun `should get seeder by id`() { + val test = api.seedersApi.get("1.2.17".toChainObject()) .subscribeOn(Schedulers.newThread()) .test() @@ -30,18 +20,8 @@ class SeederApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should list seeders by upload`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"list_seeders_by_upload",[100]],"id":1}""", - """{"id":1,"result":[{"id":"2.14.0","seeder":"1.2.16","free_space":1022,"price":{"amount":1,"asset_id":"1.3.0"},"expiration":"2018-09-14T02:10:05","pubKey":{"s":"108509137992084552766842257584642929445130808368600055288928130756106214148863141200188299504000640159872636359336882924163527129138321742300857400054934."},"ipfs_ID":"Qmd1WE8qhNDhwbZwRn4J6UJwAoBCgxX7iLHM856pkvDFdJ","stats":"2.16.0","rating":0,"region_code":""},{"id":"2.14.1","seeder":"1.2.90","free_space":1018,"price":{"amount":1,"asset_id":"1.3.0"},"expiration":"2018-07-31T04:16:25","pubKey":{"s":"8490319717792401336022711903211688203776011372958543603431635388400597658916629399144065413122027733188246528373794568719741969521921155180202961044843254."},"ipfs_ID":"QmVotciYd21wM5fbQzCA4S9nG5hqumkcbfjvHJtLnsAWoF","stats":"2.16.1","rating":0,"region_code":""},{"id":"2.14.2","seeder":"1.2.91","free_space":1022,"price":{"amount":1,"asset_id":"1.3.0"},"expiration":"2018-07-23T11:18:05","pubKey":{"s":"2303777410538172886271756794595982408449215299184180786707946414344825115577210309329094182704710373375176575047946743652593825273038473592524248046488588."},"ipfs_ID":"QmcTKsArf7aMicW1zNvMRXEJHbpEdfFF2wZi6HK7UdEYvs","stats":"2.16.2","rating":0,"region_code":""},{"id":"2.14.3","seeder":"1.2.85","free_space":99,"price":{"amount":70000000,"asset_id":"1.3.0"},"expiration":"2018-07-07T11:26:40","pubKey":{"s":"3743207398576779808066945562729802450508896326744651113099676580067412967050373989300299175261482010131674378978235327498648053632565557861526621363621025."},"ipfs_ID":"QmU4zusEFksdUoEnqk57LND5fFFdDjzDTCBGJsYahN56Tt","stats":"2.16.3","rating":0,"region_code":""}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"id":"2.14.0","seeder":"1.2.16","free_space":1022,"price":{"amount":1,"asset_id":"1.3.0"},"expiration":"2018-09-14T02:10:05","pubKey":{"s":"108509137992084552766842257584642929445130808368600055288928130756106214148863141200188299504000640159872636359336882924163527129138321742300857400054934."},"ipfs_ID":"Qmd1WE8qhNDhwbZwRn4J6UJwAoBCgxX7iLHM856pkvDFdJ","stats":"2.16.0","rating":0,"region_code":""},{"id":"2.14.1","seeder":"1.2.90","free_space":1018,"price":{"amount":1,"asset_id":"1.3.0"},"expiration":"2018-07-31T04:16:25","pubKey":{"s":"8490319717792401336022711903211688203776011372958543603431635388400597658916629399144065413122027733188246528373794568719741969521921155180202961044843254."},"ipfs_ID":"QmVotciYd21wM5fbQzCA4S9nG5hqumkcbfjvHJtLnsAWoF","stats":"2.16.1","rating":0,"region_code":""},{"id":"2.14.2","seeder":"1.2.91","free_space":1022,"price":{"amount":1,"asset_id":"1.3.0"},"expiration":"2018-07-23T11:18:05","pubKey":{"s":"2303777410538172886271756794595982408449215299184180786707946414344825115577210309329094182704710373375176575047946743652593825273038473592524248046488588."},"ipfs_ID":"QmcTKsArf7aMicW1zNvMRXEJHbpEdfFF2wZi6HK7UdEYvs","stats":"2.16.2","rating":0,"region_code":""},{"id":"2.14.3","seeder":"1.2.85","free_space":99,"price":{"amount":70000000,"asset_id":"1.3.0"},"expiration":"2018-07-07T11:26:40","pubKey":{"s":"3743207398576779808066945562729802450508896326744651113099676580067412967050373989300299175261482010131674378978235327498648053632565557861526621363621025."},"ipfs_ID":"QmU4zusEFksdUoEnqk57LND5fFFdDjzDTCBGJsYahN56Tt","stats":"2.16.3","rating":0,"region_code":""}]}""" - ) - - val test = api.seedersApi.listByUpload() + @Test fun `should list seeders by price`() { + val test = api.seedersApi.listByPrice() .subscribeOn(Schedulers.newThread()) .test() @@ -50,18 +30,8 @@ class SeederApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should list seeders by region`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"list_seeders_by_region",["default"]],"id":1}""", - """{"id":1,"result":[]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) - - val test = api.seedersApi.listByRegion() + @Test fun `should list seeders by upload`() { + val test = api.seedersApi.listByUpload() .subscribeOn(Schedulers.newThread()) .test() @@ -70,18 +40,8 @@ class SeederApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should list seeders by rating`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"list_seeders_by_rating",[10]],"id":1}""", - """{"id":1,"result":[]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) - - val test = api.seedersApi.listByRating(10) + @Test fun `should list seeders by region`() { + val test = api.seedersApi.listByRegion(Regions.NONE.code) .subscribeOn(Schedulers.newThread()) .test() @@ -90,18 +50,8 @@ class SeederApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should get seeder by id`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_seeder",["1.2.16"]],"id":1}""", - """{"id":1,"result":{"id":"2.14.0","seeder":"1.2.16","free_space":1022,"price":{"amount":1,"asset_id":"1.3.0"},"expiration":"2018-09-14T02:10:05","pubKey":{"s":"108509137992084552766842257584642929445130808368600055288928130756106214148863141200188299504000640159872636359336882924163527129138321742300857400054934."},"ipfs_ID":"Qmd1WE8qhNDhwbZwRn4J6UJwAoBCgxX7iLHM856pkvDFdJ","stats":"2.16.0","rating":0,"region_code":""}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"id":"2.14.0","seeder":"1.2.16","free_space":1022,"price":{"amount":1,"asset_id":"1.3.0"},"expiration":"2018-09-14T02:10:05","pubKey":{"s":"108509137992084552766842257584642929445130808368600055288928130756106214148863141200188299504000640159872636359336882924163527129138321742300857400054934."},"ipfs_ID":"Qmd1WE8qhNDhwbZwRn4J6UJwAoBCgxX7iLHM856pkvDFdJ","stats":"2.16.0","rating":0,"region_code":""}}""" - ) - - val test = api.seedersApi.get("1.2.16".toChainObject()) + @Test fun `should list seeders by rating`() { + val test = api.seedersApi.listByRating(10) .subscribeOn(Schedulers.newThread()) .test() diff --git a/library/src/test/java/ch/decent/sdk/api/SubscriptionApiTest.kt b/library/src/test/java/ch/decent/sdk/api/SubscriptionApiTest.kt index 5e3b175e..748ee7e5 100644 --- a/library/src/test/java/ch/decent/sdk/api/SubscriptionApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/SubscriptionApiTest.kt @@ -1,27 +1,17 @@ package ch.decent.sdk.api -import ch.decent.sdk.account +import ch.decent.sdk.Helpers import io.reactivex.schedulers.Schedulers +import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized @RunWith(Parameterized::class) +@Ignore class SubscriptionApiTest(channel: Channel) : BaseApiTest(channel) { -// override val useMock: Boolean = false - @Test fun `should get list of subscription for consumer`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"list_subscriptions_by_consumer",["1.2.34",10]],"id":1}""", - """{"id":1,"result":[]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) - - val test = api.subscriptionApi.getAllByConsumer(account, 10) + val test = api.subscriptionApi.getAllByConsumer(Helpers.account, 10) .subscribeOn(Schedulers.newThread()) .test() diff --git a/library/src/test/java/ch/decent/sdk/api/TransactionApiTest.kt b/library/src/test/java/ch/decent/sdk/api/TransactionApiTest.kt index 228b12f8..a6d981ad 100644 --- a/library/src/test/java/ch/decent/sdk/api/TransactionApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/TransactionApiTest.kt @@ -1,77 +1,60 @@ package ch.decent.sdk.api -import ch.decent.sdk.account -import ch.decent.sdk.crypto.Sha256Hash +import ch.decent.sdk.Helpers import ch.decent.sdk.exception.ObjectNotFoundException -import ch.decent.sdk.model.BlockData -import ch.decent.sdk.model.Transaction -import ch.decent.sdk.print -import ch.decent.sdk.utils.hex -import ch.decent.sdk.utils.unhex +import ch.decent.sdk.model.AssetAmount +import ch.decent.sdk.model.TransactionConfirmation +import ch.decent.sdk.model.TransferOperation import io.reactivex.schedulers.Schedulers -import org.junit.Ignore import org.junit.Test -import org.threeten.bp.ZoneOffset class TransactionApiTest(channel: Channel) : BaseApiTest(channel) { -// override val useMock: Boolean = false - // already expired - @Test fun `should get recent transaction by ID`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_recent_transaction_by_id",["322d451fb1dc9b3ec6bc521395f4547a8b62eb3f"]],"id":1}""", - """{"id":1,"result":null}""" - ) + @Test fun `should create a transaction`() { + val test = api.transactionApi.createTransaction(TransferOperation(Helpers.account, Helpers.account2, AssetAmount(1))) + .subscribeOn(Schedulers.newThread()) + .test() + + test.awaitTerminalEvent() + test.assertTerminated() + .assertNoErrors() + .assertComplete() + } - mockHttp.enqueue( - """{"id":1,"result":null}""" - ) + @Test fun `should get a list of proposed transactions`() { + val test = api.transactionApi.getAllProposed(Helpers.account) + .subscribeOn(Schedulers.newThread()) + .test() + + test.awaitTerminalEvent() + test.assertComplete() + .assertNoErrors() + } - val test = api.transactionApi.getRecent("322d451fb1dc9b3ec6bc521395f4547a8b62eb3f") + @Test fun `should get expired recent transaction by ID`() { + val test = api.transactionApi.getRecent("abb2c83679c2217bd20bed723f3a9ffa8653a953") .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertTerminated() .assertError(ObjectNotFoundException::class.java) - } @Test fun `should get a transaction by ID`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_transaction_by_id",["322d451fb1dc9b3ec6bc521395f4547a8b62eb3f"]],"id":1}""", - """{"id":1,"result":{"ref_block_num":65525,"ref_block_prefix":2304643484,"expiration":"2018-10-13T12:37:19","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["2072e8b8efa1ca97c2f9d85f69a31761fc212858fc77b5d8bc824627117904214458a7deecc8b4fd8495f8b448d971ed92c0bcb0c9b3f3fcf0c7eba4c81303de4b"]}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"ref_block_num":65525,"ref_block_prefix":2304643484,"expiration":"2018-10-13T12:37:19","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["2072e8b8efa1ca97c2f9d85f69a31761fc212858fc77b5d8bc824627117904214458a7deecc8b4fd8495f8b448d971ed92c0bcb0c9b3f3fcf0c7eba4c81303de4b"]}}""" - ) - - val test = api.transactionApi.get("322d451fb1dc9b3ec6bc521395f4547a8b62eb3f") + val test = api.transactionApi.get("abb2c83679c2217bd20bed723f3a9ffa8653a953") .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() - .assertValue { it.id == "322d451fb1dc9b3ec6bc521395f4547a8b62eb3f"} + .assertValue { it.id == "abb2c83679c2217bd20bed723f3a9ffa8653a953" } } @Test fun `should get a transaction by block`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_transaction",[1370282,0]],"id":1}""", - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - - val test = api.transactionApi.get(1370282, 0) + val test = api.transactionApi.get(446532, 0) .subscribeOn(Schedulers.newThread()) .test() @@ -81,55 +64,22 @@ class TransactionApiTest(channel: Channel) : BaseApiTest(channel) { } - @Test fun `should get a transaction hex dump`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_chain_id",[]],"id":1}""", - """{"id":1,"result":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc"}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_transaction",[1370282,0]],"id":2}""", - """{"id":2,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_transaction_hex",[{"expiration":"2018-07-26T11:27:07","ref_block_num":59561,"ref_block_prefix":2414941591,"extensions":[],"operations":[[39,{"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7","nonce":735604672334802432},"fee":{"amount":500000,"asset_id":"1.3.0"}}]],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"]}]],"id":3}""", - """{"id":3,"result":"a9e89715f18f0bb0595b012720a10700000000000022230000000000020160e3160000000000000102c03f8e840c1699fd7808c2bb858e249c688c5be8acf0a0c1c484ab0cfb27f0a802e0ced80260630f641f61f6d6959f32b5c43b1a38be55666b98abfe8bafcc556b002ea2558d64350a204bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a70000011f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc"}""" - ) - mockHttp.enqueue( - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - mockHttp.enqueue( - """{"id":1,"result":"a9e89715f18f0bb0595b012720a10700000000000022230000000000020160e3160000000000000102c03f8e840c1699fd7808c2bb858e249c688c5be8acf0a0c1c484ab0cfb27f0a802e0ced80260630f641f61f6d6959f32b5c43b1a38be55666b98abfe8bafcc556b002ea2558d64350a204bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a70000011f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"}""" - ) - - val id = api.generalApi.getChainId().blockingGet() - val ptrx = api.transactionApi.get(1370282, 0).blockingGet() - val trx = Transaction(BlockData(ptrx.refBlockNum, ptrx.refBlockPrefix, ptrx.expiration.toEpochSecond(ZoneOffset.UTC)), ptrx.operations, id, ptrx.signatures) - val test = api.transactionApi.getHexDump(trx) + @Test fun `should get a transaction by confirmation`() { + val test = api.transactionApi.get(446532, 0) + .map { TransactionConfirmation("abb2c83679c2217bd20bed723f3a9ffa8653a953", 446532, 0, it) } + .flatMap { api.transactionApi.get(it) } .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() - } - - @Test fun `should get a list of proposed transactions`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_proposed_transactions",["1.2.34"]],"id":1}""", - """{"id":1,"result":[]}""" - ) - mockHttp.enqueue( - """{"id":1,"result":[]}""" - ) + } - val test = api.transactionApi.getAllProposed(account) + @Test fun `should get a transaction hex dump`() { + val test = api.transactionApi.createTransaction(TransferOperation(Helpers.account, Helpers.account2, AssetAmount(1))) + .flatMap { api.transactionApi.getHexDump(it) } .subscribeOn(Schedulers.newThread()) .test() diff --git a/library/src/test/java/ch/decent/sdk/api/ValidationApiTest.kt b/library/src/test/java/ch/decent/sdk/api/ValidationApiTest.kt index 37668a8c..3a3293c2 100644 --- a/library/src/test/java/ch/decent/sdk/api/ValidationApiTest.kt +++ b/library/src/test/java/ch/decent/sdk/api/ValidationApiTest.kt @@ -1,104 +1,43 @@ package ch.decent.sdk.api -import ch.decent.sdk.accountName2 -import ch.decent.sdk.crypto.ECKeyPair +import ch.decent.sdk.Helpers import ch.decent.sdk.crypto.address -import ch.decent.sdk.exception.DCoreException -import ch.decent.sdk.model.BlockData +import ch.decent.sdk.model.AssetAmount import ch.decent.sdk.model.OperationType -import ch.decent.sdk.model.Transaction -import ch.decent.sdk.private -import ch.decent.sdk.public -import ch.decent.sdk.public2 +import ch.decent.sdk.model.TransferOperation +import ch.decent.sdk.model.toChainObject import io.reactivex.schedulers.Schedulers import org.junit.Test -import org.threeten.bp.ZoneOffset class ValidationApiTest(channel: Channel) : BaseApiTest(channel) { -// override val useMock: Boolean = false - private val signature = "1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41" - private val signatureInvalid = "1f3aaceb17ae6718235bac851fb376b2c00cfc69ddb23d471a29135f49c336de5316d92ee14d73567d57781bd8a14d69259adbe6e6094b387d9d9ea60e25fcf089" - private val trx: Transaction - get() = api.transactionApi.get(1370282, 0).blockingGet().let { - Transaction(BlockData(it.refBlockNum, it.refBlockPrefix, it.expiration.toEpochSecond(ZoneOffset.UTC)), it.operations, "") - } + private val trx + get() = api.transactionApi.createTransaction(TransferOperation(Helpers.account, Helpers.account2, AssetAmount(1))) @Test fun `should get required signatures`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_transaction",[1370282,0]],"id":1}""", - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_required_signatures",[{"expiration":"2018-07-26T11:27:07","ref_block_num":59561,"ref_block_prefix":2414941591,"extensions":[],"operations":[[39,{"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7","nonce":735604672334802432},"fee":{"amount":500000,"asset_id":"1.3.0"}}]]},["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP"]]],"id":2}""", - """{"id":2,"result":["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz"]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - mockHttp.enqueue( - """{"id":1,"result":["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz"]}""" - ) - - val test = api.validationApi.getRequiredSignatures(trx, listOf(public.address(), public2.address())) + val test = trx.flatMap { api.validationApi.getRequiredSignatures(it, listOf(Helpers.public.address(), Helpers.public2.address())) } .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() - .assertValue(listOf(public.address())) + .assertValue(listOf(Helpers.public.address())) } @Test fun `should get potential signatures`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_transaction",[1370282,0]],"id":1}""", - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_potential_signatures",[{"expiration":"2018-07-26T11:27:07","ref_block_num":59561,"ref_block_prefix":2414941591,"extensions":[],"operations":[[39,{"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7","nonce":735604672334802432},"fee":{"amount":500000,"asset_id":"1.3.0"}}]]}]],"id":2}""", - """{"id":2,"result":["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz"]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - mockHttp.enqueue( - """{"id":1,"result":["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz"]}""" - ) - - val test = api.validationApi.getPotentialSignatures(trx) + val test = trx.flatMap { api.validationApi.getPotentialSignatures(it) } .subscribeOn(Schedulers.newThread()) .test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() - .assertValue(listOf(public.address())) + .assertValue(listOf(Helpers.public.address())) } @Test fun `should verify signed transaction`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_transaction",[1370282,0]],"id":1}""", - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - .enqueue( - """{"method":"call","params":[0,"verify_authority",[{"expiration":"2018-07-26T11:27:07","ref_block_num":59561,"ref_block_prefix":2414941591,"extensions":[],"operations":[[39,{"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7","nonce":735604672334802432},"fee":{"amount":500000,"asset_id":"1.3.0"}}]],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"]}]],"id":2}""", - """{"id":2,"result":true}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - mockHttp.enqueue( - """{"id":1,"result":true}""" - ) - - val test = api.validationApi.verifyAuthority(trx.copy(signatures = listOf(signature))) + val test = trx.flatMap { api.validationApi.verifyAuthority(it.withSignature(Helpers.credentials.keyPair)) } .subscribeOn(Schedulers.newThread()) .test() @@ -108,45 +47,8 @@ class ValidationApiTest(channel: Channel) : BaseApiTest(channel) { .assertValue(true) } - @Test fun `should fail to verify signed transaction`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_transaction",[1370282,0]],"id":1}""", - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - .enqueue( - """{"method":"call","params":[0,"verify_authority",[{"expiration":"2018-07-26T11:27:07","ref_block_num":59561,"ref_block_prefix":2414941591,"extensions":[],"operations":[[39,{"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7","nonce":735604672334802432},"fee":{"amount":500000,"asset_id":"1.3.0"}}]],"signatures":["1f3aaceb17ae6718235bac851fb376b2c00cfc69ddb23d471a29135f49c336de5316d92ee14d73567d57781bd8a14d69259adbe6e6094b387d9d9ea60e25fcf089"]}]],"id":2}""", - """{"id":2,"result":false}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - mockHttp.enqueue( - """{"id":1,"result":false}""" - ) - - val test = api.validationApi.verifyAuthority(trx.copy(signatures = listOf(signatureInvalid))) - .subscribeOn(Schedulers.newThread()) - .test() - - test.awaitTerminalEvent() - test.assertComplete() - .assertValue(false) - } - @Test fun `should verify signers for account`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"verify_account_authority",["u3a7b78084e7d3956442d5a4d439dad51",["DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP"]]],"id":1}""", - """{"id":1,"result":true}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":true}""" - ) - - val test = api.validationApi.verifyAccountAuthority(accountName2, listOf(public2.address())) + val test = api.validationApi.verifyAccountAuthority(Helpers.accountName2, listOf(Helpers.public2.address())) .subscribeOn(Schedulers.newThread()) .test() @@ -156,40 +58,7 @@ class ValidationApiTest(channel: Channel) : BaseApiTest(channel) { } @Test fun `should validate signed transaction`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_transaction",[1370282,0]],"id":1}""", - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_chain_id",[]],"id":0}""", - """{"id":0,"result":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc"}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_dynamic_global_properties",[]],"id":2}""", - """{"id":2,"result":{"id":"2.1.0","head_block_number":3442144,"head_block_id":"003485e0f7300e97b92207ea19de4993914e3188","time":"2018-12-19T15:24:00","current_miner":"1.4.6","next_maintenance_time":"2018-12-20T00:00:00","last_budget_time":"2018-12-19T00:00:00","unspent_fee_budget":10461228,"mined_rewards":"335997000000","miner_budget_from_fees":22030422,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":14,"recently_missed_count":3,"current_aslot":9282537,"recent_slots_filled":"249727409722337398080179390021076115419","dynamic_flags":0,"last_irreversible_block_num":3442144}}""" - ) - .enqueue( - """{"method":"call","params":[0,"validate_transaction",[{"expiration":"2018-12-19T15:24:33","ref_block_num":34272,"ref_block_prefix":2534289655,"extensions":[],"operations":[[39,{"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7","nonce":735604672334802432},"fee":{"amount":500000,"asset_id":"1.3.0"}}]],"signatures":["2062d7b1b43e388a4061f7db26f2dad3c6e81d0f32b6aa00d2c9ad14484140d841157be7a75460e39e3d2f05e411dd72a9cd8051442fe853ba00d6482d275a9646"]}]],"id":3}""", - """{"id":3,"result":{"ref_block_num":34272,"ref_block_prefix":2534289655,"expiration":"2018-12-19T15:24:33","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["2062d7b1b43e388a4061f7db26f2dad3c6e81d0f32b6aa00d2c9ad14484140d841157be7a75460e39e3d2f05e411dd72a9cd8051442fe853ba00d6482d275a9646"],"operation_results":[[0,{}]]}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - mockHttp.enqueue( - """{"id":1,"result":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc"}""" - ) - mockHttp.enqueue( - """{"id":1,"result":{"id":"2.1.0","head_block_number":3442144,"head_block_id":"003485e0f7300e97b92207ea19de4993914e3188","time":"2018-12-19T15:24:00","current_miner":"1.4.6","next_maintenance_time":"2018-12-20T00:00:00","last_budget_time":"2018-12-19T00:00:00","unspent_fee_budget":10461228,"mined_rewards":"335997000000","miner_budget_from_fees":22030422,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":14,"recently_missed_count":3,"current_aslot":9282537,"recent_slots_filled":"249727409722337398080179390021076115419","dynamic_flags":0,"last_irreversible_block_num":3442144}}""" - ) - mockHttp.enqueue( - """{"id":1,"result":{"ref_block_num":34272,"ref_block_prefix":2534289655,"expiration":"2018-12-19T15:24:33","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["2062d7b1b43e388a4061f7db26f2dad3c6e81d0f32b6aa00d2c9ad14484140d841157be7a75460e39e3d2f05e411dd72a9cd8051442fe853ba00d6482d275a9646"],"operation_results":[[0,{}]]}}""" - ) - - val trxNew = api.transactionApi.createTransaction(trx.operations).blockingGet() - .withSignature(ECKeyPair.fromBase58(private)) - val test = api.validationApi.validateTransaction(trxNew) + val test = trx.flatMap { api.validationApi.validateTransaction(it.withSignature(Helpers.credentials.keyPair)) } .subscribeOn(Schedulers.newThread()) .test() @@ -198,61 +67,8 @@ class ValidationApiTest(channel: Channel) : BaseApiTest(channel) { .assertNoErrors() } - @Test fun `should fail to validate signed transaction`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_transaction",[1370282,0]],"id":1}""", - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_chain_id",[]],"id":0}""", - """{"id":0,"result":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc"}""" - ) - .enqueue( - """{"method":"call","params":[0,"get_dynamic_global_properties",[]],"id":2}""", - """{"id":2,"result":{"id":"2.1.0","head_block_number":3442144,"head_block_id":"003485e0f7300e97b92207ea19de4993914e3188","time":"2018-12-19T15:24:00","current_miner":"1.4.6","next_maintenance_time":"2018-12-20T00:00:00","last_budget_time":"2018-12-19T00:00:00","unspent_fee_budget":10461228,"mined_rewards":"335997000000","miner_budget_from_fees":22030422,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":14,"recently_missed_count":3,"current_aslot":9282537,"recent_slots_filled":"249727409722337398080179390021076115419","dynamic_flags":0,"last_irreversible_block_num":3442144}}""" - ) - .enqueue( - """{"method":"call","params":[0,"validate_transaction",[{"expiration":"2018-12-19T15:24:33","ref_block_num":34272,"ref_block_prefix":2534289655,"extensions":[],"operations":[[39,{"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7","nonce":735604672334802432},"fee":{"amount":500000,"asset_id":"1.3.0"}}]],"signatures":["1f3aaceb17ae6718235bac851fb376b2c00cfc69ddb23d471a29135f49c336de5316d92ee14d73567d57781bd8a14d69259adbe6e6094b387d9d9ea60e25fcf089"]}]],"id":3}""", - """{"id":3,"error":{"code":1,"message":"3030001 tx_missing_active_auth: missing required active authority\nMissing Active Authority 1.2.34\n {\"id\":\"1.2.34\",\"auth\":{\"weight_threshold\":1,\"account_auths\":[],\"key_auths\":[[\"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz\",1]]},\"owner\":{\"weight_threshold\":1,\"account_auths\":[],\"key_auths\":[[\"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz\",1]]}}\n th_a transaction.cpp:365 verify_authority1\n\n {\"ops\":[[39,{\"fee\":{\"amount\":500000,\"asset_id\":\"1.3.0\"},\"from\":\"1.2.34\",\"to\":\"1.2.35\",\"amount\":{\"amount\":1500000,\"asset_id\":\"1.3.0\"},\"memo\":{\"from\":\"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz\",\"to\":\"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP\",\"nonce\":\"735604672334802432\",\"message\":\"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7\"},\"extensions\":[]}]],\"sigs\":\"DCT6XMv4Nkg11y3WYb8J2ueWbSumvzVz3Zd65wGShmdkPmGonhs4X\"}\n th_a transaction.cpp:374 verify_authority1\n\n {\"*this\":{\"ref_block_num\":34271,\"ref_block_prefix\":1928460153,\"expiration\":\"2018-12-19T15:24:26\",\"operations\":[[39,{\"fee\":{\"amount\":500000,\"asset_id\":\"1.3.0\"},\"from\":\"1.2.34\",\"to\":\"1.2.35\",\"amount\":{\"amount\":1500000,\"asset_id\":\"1.3.0\"},\"memo\":{\"from\":\"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz\",\"to\":\"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP\",\"nonce\":\"735604672334802432\",\"message\":\"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7\"},\"extensions\":[]}]],\"extensions\":[],\"signatures\":[\"1f3aaceb17ae6718235bac851fb376b2c00cfc69ddb23d471a29135f49c336de5316d92ee14d73567d57781bd8a14d69259adbe6e6094b387d9d9ea60e25fcf089\"]}}\n th_a transaction.cpp:465 verify_authority\n\n {\"trx\":{\"ref_block_num\":34271,\"ref_block_prefix\":1928460153,\"expiration\":\"2018-12-19T15:24:26\",\"operations\":[[39,{\"fee\":{\"amount\":500000,\"asset_id\":\"1.3.0\"},\"from\":\"1.2.34\",\"to\":\"1.2.35\",\"amount\":{\"amount\":1500000,\"asset_id\":\"1.3.0\"},\"memo\":{\"from\":\"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz\",\"to\":\"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP\",\"nonce\":\"735604672334802432\",\"message\":\"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7\"},\"extensions\":[]}]],\"extensions\":[],\"signatures\":[\"1f3aaceb17ae6718235bac851fb376b2c00cfc69ddb23d471a29135f49c336de5316d92ee14d73567d57781bd8a14d69259adbe6e6094b387d9d9ea60e25fcf089\"]}}\n th_a db_block.cpp:669 _apply_transaction","data":{"code":3030001,"name":"tx_missing_active_auth","message":"missing required active authority","stack":[{"context":{"level":"error","file":"transaction.cpp","line":365,"method":"verify_authority1","hostname":"","thread_name":"th_a","timestamp":"2018-12-19T15:23:59"},"format":"Missing Active Authority {id}","data":{"id":"1.2.34","auth":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]}}},{"context":{"level":"warn","file":"transaction.cpp","line":374,"method":"verify_authority1","hostname":"","thread_name":"th_a","timestamp":"2018-12-19T15:23:59"},"format":"","data":{"ops":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"sigs":"DCT6XMv4Nkg11y3WYb8J2ueWbSumvzVz3Zd65wGShmdkPmGonhs4X"}},{"context":{"level":"warn","file":"transaction.cpp","line":465,"method":"verify_authority","hostname":"","thread_name":"th_a","timestamp":"2018-12-19T15:23:59"},"format":"","data":{"*this":{"ref_block_num":34271,"ref_block_prefix":1928460153,"expiration":"2018-12-19T15:24:26","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f3aaceb17ae6718235bac851fb376b2c00cfc69ddb23d471a29135f49c336de5316d92ee14d73567d57781bd8a14d69259adbe6e6094b387d9d9ea60e25fcf089"]}}},{"context":{"level":"warn","file":"db_block.cpp","line":669,"method":"_apply_transaction","hostname":"","thread_name":"th_a","timestamp":"2018-12-19T15:23:59"},"format":"","data":{"trx":{"ref_block_num":34271,"ref_block_prefix":1928460153,"expiration":"2018-12-19T15:24:26","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f3aaceb17ae6718235bac851fb376b2c00cfc69ddb23d471a29135f49c336de5316d92ee14d73567d57781bd8a14d69259adbe6e6094b387d9d9ea60e25fcf089"]}}}]}}}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":{"ref_block_num":59561,"ref_block_prefix":2414941591,"expiration":"2018-07-26T11:27:07","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f140e5744bcef282147ef3f0bab8df46f49704a99046d6ea5db37ab3113e0f45935fd94af7b33189ad34fa1666ab7e54aa127d725e2018fb6b68771aacef54c41"],"operation_results":[[0,{}]]}}""" - ) - mockHttp.enqueue( - """{"id":1,"result":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc"}""" - ) - mockHttp.enqueue( - """{"id":1,"result":{"id":"2.1.0","head_block_number":3442144,"head_block_id":"003485e0f7300e97b92207ea19de4993914e3188","time":"2018-12-19T15:24:00","current_miner":"1.4.6","next_maintenance_time":"2018-12-20T00:00:00","last_budget_time":"2018-12-19T00:00:00","unspent_fee_budget":10461228,"mined_rewards":"335997000000","miner_budget_from_fees":22030422,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":14,"recently_missed_count":3,"current_aslot":9282537,"recent_slots_filled":"249727409722337398080179390021076115419","dynamic_flags":0,"last_irreversible_block_num":3442144}}""" - ) - mockHttp.enqueue( - """{"id":1,"error":{"code":1,"message":"3030001 tx_missing_active_auth: missing required active authority\nMissing Active Authority 1.2.34\n {\"id\":\"1.2.34\",\"auth\":{\"weight_threshold\":1,\"account_auths\":[],\"key_auths\":[[\"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz\",1]]},\"owner\":{\"weight_threshold\":1,\"account_auths\":[],\"key_auths\":[[\"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz\",1]]}}\n th_a transaction.cpp:365 verify_authority1\n\n {\"ops\":[[39,{\"fee\":{\"amount\":500000,\"asset_id\":\"1.3.0\"},\"from\":\"1.2.34\",\"to\":\"1.2.35\",\"amount\":{\"amount\":1500000,\"asset_id\":\"1.3.0\"},\"memo\":{\"from\":\"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz\",\"to\":\"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP\",\"nonce\":\"735604672334802432\",\"message\":\"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7\"},\"extensions\":[]}]],\"sigs\":\"DCT6XMv4Nkg11y3WYb8J2ueWbSumvzVz3Zd65wGShmdkPmGonhs4X\"}\n th_a transaction.cpp:374 verify_authority1\n\n {\"*this\":{\"ref_block_num\":34271,\"ref_block_prefix\":1928460153,\"expiration\":\"2018-12-19T15:24:26\",\"operations\":[[39,{\"fee\":{\"amount\":500000,\"asset_id\":\"1.3.0\"},\"from\":\"1.2.34\",\"to\":\"1.2.35\",\"amount\":{\"amount\":1500000,\"asset_id\":\"1.3.0\"},\"memo\":{\"from\":\"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz\",\"to\":\"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP\",\"nonce\":\"735604672334802432\",\"message\":\"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7\"},\"extensions\":[]}]],\"extensions\":[],\"signatures\":[\"1f3aaceb17ae6718235bac851fb376b2c00cfc69ddb23d471a29135f49c336de5316d92ee14d73567d57781bd8a14d69259adbe6e6094b387d9d9ea60e25fcf089\"]}}\n th_a transaction.cpp:465 verify_authority\n\n {\"trx\":{\"ref_block_num\":34271,\"ref_block_prefix\":1928460153,\"expiration\":\"2018-12-19T15:24:26\",\"operations\":[[39,{\"fee\":{\"amount\":500000,\"asset_id\":\"1.3.0\"},\"from\":\"1.2.34\",\"to\":\"1.2.35\",\"amount\":{\"amount\":1500000,\"asset_id\":\"1.3.0\"},\"memo\":{\"from\":\"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz\",\"to\":\"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP\",\"nonce\":\"735604672334802432\",\"message\":\"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7\"},\"extensions\":[]}]],\"extensions\":[],\"signatures\":[\"1f3aaceb17ae6718235bac851fb376b2c00cfc69ddb23d471a29135f49c336de5316d92ee14d73567d57781bd8a14d69259adbe6e6094b387d9d9ea60e25fcf089\"]}}\n th_a db_block.cpp:669 _apply_transaction","data":{"code":3030001,"name":"tx_missing_active_auth","message":"missing required active authority","stack":[{"context":{"level":"error","file":"transaction.cpp","line":365,"method":"verify_authority1","hostname":"","thread_name":"th_a","timestamp":"2018-12-19T15:23:59"},"format":"Missing Active Authority {id}","data":{"id":"1.2.34","auth":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]}}},{"context":{"level":"warn","file":"transaction.cpp","line":374,"method":"verify_authority1","hostname":"","thread_name":"th_a","timestamp":"2018-12-19T15:23:59"},"format":"","data":{"ops":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"sigs":"DCT6XMv4Nkg11y3WYb8J2ueWbSumvzVz3Zd65wGShmdkPmGonhs4X"}},{"context":{"level":"warn","file":"transaction.cpp","line":465,"method":"verify_authority","hostname":"","thread_name":"th_a","timestamp":"2018-12-19T15:23:59"},"format":"","data":{"*this":{"ref_block_num":34271,"ref_block_prefix":1928460153,"expiration":"2018-12-19T15:24:26","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f3aaceb17ae6718235bac851fb376b2c00cfc69ddb23d471a29135f49c336de5316d92ee14d73567d57781bd8a14d69259adbe6e6094b387d9d9ea60e25fcf089"]}}},{"context":{"level":"warn","file":"db_block.cpp","line":669,"method":"_apply_transaction","hostname":"","thread_name":"th_a","timestamp":"2018-12-19T15:23:59"},"format":"","data":{"trx":{"ref_block_num":34271,"ref_block_prefix":1928460153,"expiration":"2018-12-19T15:24:26","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"1.2.35","amount":{"amount":1500000,"asset_id":"1.3.0"},"memo":{"from":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","to":"DCT6bVmimtYSvWQtwdrkVVQGHkVsTJZVKtBiUqf4YmJnrJPnk89QP","nonce":"735604672334802432","message":"4bc2a1ee670302ceddb897c2d351fa0496ff089c934e35e030f8ae4f3f9397a7"},"extensions":[]}]],"extensions":[],"signatures":["1f3aaceb17ae6718235bac851fb376b2c00cfc69ddb23d471a29135f49c336de5316d92ee14d73567d57781bd8a14d69259adbe6e6094b387d9d9ea60e25fcf089"]}}}]}}}""" - ) - - val trxNew = api.transactionApi.createTransaction(trx.operations).blockingGet() - .withSignature(ECKeyPair.fromBase58(private)) - val test = api.validationApi.validateTransaction(trxNew.copy(signatures = listOf(signatureInvalid))) - .subscribeOn(Schedulers.newThread()) - .test() - - test.awaitTerminalEvent() - test.assertTerminated() - .assertError(DCoreException::class.java) - } - @Test fun `should get fee for transfer OP`() { - mockWebSocket - .enqueue( - """{"method":"call","params":[0,"get_required_fees",[[[39,{"fee":{"amount":0,"asset_id":"1.3.0"}}]],"1.3.0"]],"id":1}""", - """{"id":1,"result":[{"amount":500000,"asset_id":"1.3.0"}]}""" - ) - - mockHttp.enqueue( - """{"id":1,"result":[{"amount":500000,"asset_id":"1.3.0"}]}""" - ) - - val test = api.validationApi.getFee(OperationType.TRANSFER2_OPERATION) + val test = api.validationApi.getFee(OperationType.TRANSFER2_OPERATION, "1.3.35".toChainObject()) .subscribeOn(Schedulers.newThread()) .test() diff --git a/library/src/test/java/ch/decent/sdk/api/java/ApiTest.java b/library/src/test/java/ch/decent/sdk/api/java/ApiTest.java index 1893156d..c6b1d373 100644 --- a/library/src/test/java/ch/decent/sdk/api/java/ApiTest.java +++ b/library/src/test/java/ch/decent/sdk/api/java/ApiTest.java @@ -20,17 +20,18 @@ /** * this test checks calling Kotlin from Java */ +@SuppressWarnings("all") public class ApiTest { private Logger logger = LoggerFactory.getLogger("API"); - private DCoreApi api = DCoreSdk.create(Helpers.client(logger), Helpers.getUrl(), Helpers.getRestUrl(), logger); + private DCoreApi api = DCoreSdk.create(Helpers.client(logger), Helpers.getWsUrl(), Helpers.getRestUrl(), logger); @Test public void init() { DCoreApi apiHttp = DCoreSdk.createForHttp(Helpers.client(logger), Helpers.getRestUrl()); apiHttp = DCoreSdk.createForHttp(Helpers.client(logger), Helpers.getRestUrl(), logger); - DCoreApi apiWs = DCoreSdk.createForWebSocket(Helpers.client(logger), Helpers.getUrl()); - apiWs = DCoreSdk.createForWebSocket(Helpers.client(logger), Helpers.getUrl(), logger); + DCoreApi apiWs = DCoreSdk.createForWebSocket(Helpers.client(logger), Helpers.getWsUrl()); + apiWs = DCoreSdk.createForWebSocket(Helpers.client(logger), Helpers.getWsUrl(), logger); Gson gson = DCoreSdk.getGsonBuilder().create(); apiHttp.setTransactionExpiration(100); diff --git a/library/src/test/java/ch/decent/sdk/net/SerializerTest.kt b/library/src/test/java/ch/decent/sdk/net/SerializerTest.kt index 5dd1095d..f01f645e 100644 --- a/library/src/test/java/ch/decent/sdk/net/SerializerTest.kt +++ b/library/src/test/java/ch/decent/sdk/net/SerializerTest.kt @@ -1,8 +1,9 @@ package ch.decent.sdk.net -import ch.decent.sdk.* +import ch.decent.sdk.DCoreSdk +import ch.decent.sdk.Helpers +import ch.decent.sdk.TimeOutTest import ch.decent.sdk.crypto.Address -import ch.decent.sdk.crypto.Credentials import ch.decent.sdk.crypto.ECKeyPair import ch.decent.sdk.crypto.address import ch.decent.sdk.model.* @@ -122,23 +123,23 @@ class SerializerTest : TimeOutTest() { } @Test fun `serialize create account`() { - val bytes = "0100000000000000000022086d696b656565656501000000000102a01c045821676cfc191832ad22cc5c9ade0ea1760131c87ff2dd3fed2f13dd33010001000000000102a01c045821676cfc191832ad22cc5c9ade0ea1760131c87ff2dd3fed2f13dd33010002a01c045821676cfc191832ad22cc5c9ade0ea1760131c87ff2dd3fed2f13dd330300000000000000000000000000000000000000" + val bytes = "010000000000000000001b086d696b656565656501000000000102a01c045821676cfc191832ad22cc5c9ade0ea1760131c87ff2dd3fed2f13dd33010001000000000102a01c045821676cfc191832ad22cc5c9ade0ea1760131c87ff2dd3fed2f13dd33010002a01c045821676cfc191832ad22cc5c9ade0ea1760131c87ff2dd3fed2f13dd330300000000000000000000000000000000000000" - val op = AccountCreateOperation(account, "mikeeeee", "DCT6718kUCCksnkeYD1YySWkXb1VLpzjkFfHHMirCRPexp5gDPJLU".address()) + val op = AccountCreateOperation(Helpers.account, "mikeeeee", "DCT6718kUCCksnkeYD1YySWkXb1VLpzjkFfHHMirCRPexp5gDPJLU".address()) .apply { fee = AssetAmount(0) } op.bytes.hex() `should be equal to` bytes } @Test fun `serialize send message op`() { - val bytes = "1222a10700000000000022012201009e027b2266726f6d223a22312e322e3334222c227265636569766572735f64617461223a5b7b22746f223a22312e322e3335222c2264617461223a2266643731623963626530353038393933353832303435313366316362346634636364303131353830366431346230336631386437383764653136333366366332222c227075625f746f223a224443543662566d696d745953765751747764726b56565147486b5673544a5a564b74426955716634596d4a6e724a506e6b38395150222c226e6f6e6365223a343736343232313338393335393932363237327d5d2c227075625f66726f6d223a22444354364d41355451513655624d794d614c506d505845325379683547335a566876355362466564714c507164464368536571547a227d" + val bytes = "1222a1070000000000001b011b01009e027b2266726f6d223a22312e322e3237222c227265636569766572735f64617461223a5b7b22746f223a22312e322e3238222c2264617461223a2263646132383562326165653737303435343233333661633236626339613361666333393735363562616531353561316535663766353131393338326434303633222c227075625f746f223a224443543550776353696967665450547775626164743835656e784d464331385474566f746933676e54624737544e39663952334670222c226e6f6e6365223a343736343232313338393335393932363237327d5d2c227075625f66726f6d223a2244435436546a4c6872387545537667747872625775584e414e337663717a424d7735657945757033504d694432676e567865755462227d" - val keyPair = ECKeyPair.fromBase58(private) - val memo = Memo("hello messaging api", keyPair, public2.address(), 4764221389359926272.toBigInteger()) - val payloadReceiver = MessagePayloadReceiver(account2, memo.message, public2.address(), memo.nonce) - val payload = MessagePayload(account, listOf(payloadReceiver), public.address()) + val keyPair = ECKeyPair.fromBase58(Helpers.private) + val memo = Memo("hello messaging api", keyPair, Helpers.public2.address(), 4764221389359926272.toBigInteger()) + val payloadReceiver = MessagePayloadReceiver(Helpers.account2, memo.message, Helpers.public2.address(), memo.nonce) + val payload = MessagePayload(Helpers.account, listOf(payloadReceiver), Helpers.public.address()) val json = DCoreSdk.gsonBuilder.create().toJson(payload) - val op = SendMessageOperation(json, account).apply { fee = AssetAmount(500002) } + val op = SendMessageOperation(json, Helpers.account).apply { fee = AssetAmount(500002) } op.bytes.hex() `should be equal to` bytes } diff --git a/library/src/test/java/ch/decent/sdk/net/ws/ApiTest.kt b/library/src/test/java/ch/decent/sdk/net/ws/ApiTest.kt deleted file mode 100644 index 5c4d669f..00000000 --- a/library/src/test/java/ch/decent/sdk/net/ws/ApiTest.kt +++ /dev/null @@ -1,260 +0,0 @@ -package ch.decent.sdk.net.ws - -import ch.decent.sdk.* -import ch.decent.sdk.crypto.Address -import ch.decent.sdk.crypto.DumpedPrivateKey -import ch.decent.sdk.crypto.ECKeyPair -import ch.decent.sdk.crypto.address -import ch.decent.sdk.model.* -import ch.decent.sdk.net.model.request.* -import ch.decent.sdk.utils.hex -import ch.decent.sdk.utils.publicElGamal -import io.reactivex.Single -import io.reactivex.schedulers.Schedulers -import org.junit.After -import org.junit.Before -import org.junit.Test -import org.slf4j.LoggerFactory -import org.threeten.bp.LocalDateTime -import java.math.BigInteger - -/** - * simulate calling the api from different threads - */ -class ApiTest : TimeOutTest() { - - private lateinit var socket: RxWebSocket - private lateinit var mockWebServer: CustomWebSocketService - - @Before fun init() { - mockWebServer = CustomWebSocketService().apply { start() } - val logger = LoggerFactory.getLogger("RxWebSocket") - socket = RxWebSocket( - client(logger), -// mockWebServer.getUrl(), - url, - logger = logger, - gson = DCoreSdk.gsonBuilder.create() - ) - } - - @After fun finish() { - mockWebServer.shutdown() - } - - - - -/* - - @Test fun `transfer to content test`() { - val dpk = DumpedPrivateKey.fromBase58(private) - val key = ECKeyPair.fromPrivate(dpk.bytes, dpk.compressed) - mockWebServer - .enqueue("""{"method":"call","params":[2,"get_dynamic_global_properties",[]],"id":0}""", """{"id":0,"result":{"id":"2.1.0","head_block_number":599091,"head_block_id":"00092433e84dedb18c9b9a378cfea8cdfbb2b637","time":"2018-06-04T12:25:00","current_miner":"1.4.8","next_maintenance_time":"2018-06-05T00:00:00","last_budget_time":"2018-06-04T00:00:00","unspent_fee_budget":96490,"mined_rewards":"301032000000","miner_budget_from_fees":169714,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":1,"recently_missed_count":0,"current_aslot":5859543,"recent_slots_filled":"329648380685469039951165571643239038463","dynamic_flags":0,"last_irreversible_block_num":599091}}""") - .enqueue("""{"method":"call","params":[1,"database",[]],"id":1}""", """{"id":1,"result":2}""") - .enqueue("""{"method":"call","params":[1,"login",["",""]],"id":2}""", """{"id":2,"result":true}""") - .enqueue("""{"method":"call","params":[2,"get_required_fees",[[[39,{"from":"1.2.34","to":"2.13.74","amount":{"amount":1500000,"asset_id":"1.3.0"},"fee":{"amount":0,"asset_id":"1.3.0"}}]],"1.3.0"]],"id":3}""", """{"id":3,"result":[{"amount":500000,"asset_id":"1.3.0"}]}""") - .enqueue("""{"method":"call","params":[3,"broadcast_transaction_with_callback",[27185,{"expiration":"2018-06-04T12:25:35","ref_block_num":9267,"ref_block_prefix":2985119208,"extensions":[],"operations":[[39,{"from":"1.2.34","to":"2.13.74","amount":{"amount":1500000,"asset_id":"1.3.0"},"fee":{"amount":500000,"asset_id":"1.3.0"}}]],"signatures":["1f380d2c1fcff9f4c3ba1349cd3bc9318d8c670c8f204b7e6ea58c0c45bbffc626640a3b02cf04b30c53eeb7ff7158ba2d17b046817212c22ea9f347f67e2e81e9"]}]],"id":4}""", """{"method":"notice","params":[27185,[{"id":"b238a0bec414566c3d3bc9cb06b36179f070b07f","block_num":599092,"trx_num":0,"trx":{"ref_block_num":9267,"ref_block_prefix":2985119208,"expiration":"2018-06-04T12:25:35","operations":[[39,{"fee":{"amount":500000,"asset_id":"1.3.0"},"from":"1.2.34","to":"2.13.74","amount":{"amount":1500000,"asset_id":"1.3.0"},"extensions":[]}]],"extensions":[],"signatures":["1f380d2c1fcff9f4c3ba1349cd3bc9318d8c670c8f204b7e6ea58c0c45bbffc626640a3b02cf04b30c53eeb7ff7158ba2d17b046817212c22ea9f347f67e2e81e9"],"operation_results":[[0,{}]]}}]]}""") - .enqueue("""{"method":"call","params":[1,"network_broadcast",[]],"id":5}""", """{"id":5,"result":3}""") - - - val op = TransferOperation( - account, - "2.13.74".toChainObject(), - AssetAmount(1500000) - ) - val props = socket.request(GetDynamicGlobalProps).blockingGet() - val fees = socket.request(GetRequiredFees(listOf(op))).blockingGet() - - val transaction = Transaction( - BlockData(props, DCoreSdk.defaultExpiration), - listOf(op.apply { fee = fees.first() }) - ).withSignature(key) - - val test = socket.request(BroadcastTransactionWithCallback(transaction, 27185)) - .subscribeOn(Schedulers.newThread()) - .test() - - test.awaitTerminalEvent() - test.assertComplete() - .assertNoErrors() - .assertValue { it.id == transaction.id } - } - - private fun testBuyContent(price: Long, signature: String, transactionId: String, expiration: String) { - mockWebServer - .enqueue("""{"method":"call","params":[2,"get_objects",[["2.13.74"]]],"id":0}""", """{"id":0,"result":[{"id":"2.13.74","author":"1.2.17","co_authors":[],"expiration":"2019-05-21T09:37:21","created":"2018-05-21T09:37:20","price":{"map_price":[[1,{"amount":$price,"asset_id":"1.3.0"}]]},"size":1,"synopsis":"{\"content_type_id\":\"1.5.5.0\",\"title\":\"New product 2\",\"description\":\"{\\\"productId\\\":1,\\\"applicationId\\\":1}\"}","URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F1&version=949da412-18bd-4b8d-acba-e8fd7a594d88","quorum":0,"key_parts":[],"_hash":"0000000000000000000000000000000000000000","last_proof":[],"is_blocked":false,"AVG_rating":0,"num_of_ratings":0,"times_bought":0,"publishing_fee_escrow":{"amount":0,"asset_id":"1.3.0"},"seeder_price":[]}]}""") - .enqueue("""{"method":"call","params":[1,"database",[]],"id":1}""", """{"id":1,"result":2}""") - .enqueue("""{"method":"call","params":[1,"login",["",""]],"id":2}""", """{"id":2,"result":true}""") - .enqueue("""{"method":"call","params":[2,"get_dynamic_global_properties",[]],"id":3}""", """{"id":3,"result":{"id":"2.1.0","head_block_number":516024,"head_block_id":"0007dfb8478ca274d1c4e21d79e419317662032b","time":"2018-05-30T11:34:40","current_miner":"1.4.7","next_maintenance_time":"2018-05-31T00:00:00","last_budget_time":"2018-05-30T00:00:00","unspent_fee_budget":36688567,"mined_rewards":"306693000000","miner_budget_from_fees":70507687,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":0,"recently_missed_count":0,"current_aslot":5772554,"recent_slots_filled":"340282366920938463463374607431768211455","dynamic_flags":0,"last_irreversible_block_num":516024}}""") - .enqueue("""{"method":"call","params":[2,"get_required_fees",[[[21,{"URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F1&version=949da412-18bd-4b8d-acba-e8fd7a594d88","consumer":"1.2.34","price":{"amount":$price,"asset_id":"1.3.0"},"pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"region_code_from":1,"fee":{"amount":0,"asset_id":"1.3.0"}}]],"1.3.0"]],"id":4}""", """{"id":4,"result":[{"amount":0,"asset_id":"1.3.0"}]}""") - .enqueue("""{"method":"call","params":[3,"broadcast_transaction_with_callback",[27185,{"expiration":"$expiration","ref_block_num":57272,"ref_block_prefix":1956809799,"extensions":[],"operations":[[21,{"URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F1&version=949da412-18bd-4b8d-acba-e8fd7a594d88","consumer":"1.2.34","price":{"amount":$price,"asset_id":"1.3.0"},"pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."},"region_code_from":1,"fee":{"amount":0,"asset_id":"1.3.0"}}]],"signatures":["$signature"]}]],"id":5}""", """{"method":"notice","params":[27185,[{"id":"$transactionId","block_num":516025,"trx_num":1,"trx":{"ref_block_num":57272,"ref_block_prefix":1956809799,"expiration":"$expiration","operations":[[21,{"fee":{"amount":0,"asset_id":"1.3.0"},"URI":"http://alax.io/?scheme=alax%3A%2F%2F1%2F1&version=949da412-18bd-4b8d-acba-e8fd7a594d88","consumer":"1.2.34","price":{"amount":$price,"asset_id":"1.3.0"},"region_code_from":1,"pubKey":{"s":"5182545488318095000498180568539728214545472470974958338942426759510121851708530625921436777555517288139787965253547588340803542762268721656138876002028437."}}]],"extensions":[],"signatures":["$signature"],"operation_results":[[0,{}]]}}]]}""") - .enqueue("""{"method":"call","params":[1,"network_broadcast",[]],"id":6}""", """{"id":6,"result":3}""") - - - val key = ECKeyPair.fromBase58(private) - val content = socket.request(GetContentById("2.13.74".toChainObject())).blockingGet().first() - val op = BuyContentOperation( - content.uri, - account, - content.price(), - key.publicElGamal() - ) - - val props = socket.request(GetDynamicGlobalProps).blockingGet() - val fees = socket.request(GetRequiredFees(listOf(op))).blockingGet() - - val transaction = Transaction( - BlockData(props, DCoreSdk.defaultExpiration), - listOf(op.apply { fee = fees.first() }) - ).withSignature(key) - - val test = socket.request(BroadcastTransactionWithCallback(transaction, 27185)) - .subscribeOn(Schedulers.newThread()) - .test() - - test.awaitTerminalEvent() - test.assertComplete() - .assertNoErrors() - .assertValue { it.id == transaction.id } - } - - @Test fun `buy content`() = testBuyContent(100000000, "204d792108ef89ed570e3fcc57a2da6fa8eab4ece0d27672d0021883add926e24637058d66bb18afcf64786e3238c703d85b5ee6d4e36ffab80f2f618fa46e1d0f", "70d7e960885eaa4dfa885631c3cef6ea5abf5d62", "2018-05-30T11:35:15") - - @Test fun `buy free content`() = testBuyContent(0, "1f51b2c15930ff46cb08f75d24488e2ac0a5c75567962d43b8384af6f03d5bde603c4c36949bd7b9c5ba007e73e95703a27a7d43e6936a8f9f68323b47d64d2ed5", "65650fc8c317e5e9d008fe6f694ad4fc1246c176", "2018-05-30T11:35:16") - - @Test(expected = IllegalArgumentException::class) fun `require non negative price for buy content`() { - val key = ECKeyPair.fromBase58(private) - BuyContentOperation( - "http://alax.io/?scheme=alax%3A%2F%2F1%2F1&version=949da412-18bd-4b8d-acba-e8fd7a594d88", - account, - AssetAmount(BigInteger.valueOf(-1), "1.3.0".toChainObject()), - key.publicElGamal() - ) - } - - @Test fun `vote for miners`() { - mockWebServer - .enqueue("""{"method":"call","params":[2,"get_objects",[["1.2.34"]]],"id":0}""", """{"id":0,"result":[{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0}]}""") - .enqueue("""{"method":"call","params":[1,"database",[]],"id":1}""", """{"id":1,"result":2}""") - .enqueue("""{"method":"call","params":[1,"login",["",""]],"id":2}""", """{"id":2,"result":true}""") - .enqueue("""{"method":"call","params":[2,"get_dynamic_global_properties",[]],"id":3}""", """{"id":3,"result":{"id":"2.1.0","head_block_number":485151,"head_block_id":"0007671fb754a6b8cf3e5df7c8d8668f0c96cef1","time":"2018-05-28T13:32:00","current_miner":"1.4.9","next_maintenance_time":"2018-05-29T00:00:00","last_budget_time":"2018-05-28T00:00:00","unspent_fee_budget":5530514,"mined_rewards":"328005000000","miner_budget_from_fees":11345954,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":1,"recently_missed_count":3,"current_aslot":5739408,"recent_slots_filled":"319012120304339705501019736411954184189","dynamic_flags":0,"last_irreversible_block_num":485151}}""") - .enqueue("""{"method":"call","params":[2,"get_required_fees",[[[2,{"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"fee":{"amount":0,"asset_id":"1.3.0"}}]],"1.3.0"]],"id":4}""", """{"id":4,"result":[{"amount":500000,"asset_id":"1.3.0"}]}""") - .enqueue("""{"method":"call","params":[3,"broadcast_transaction_with_callback",[27185,{"expiration":"2018-05-28T13:32:33","ref_block_num":26399,"ref_block_prefix":3097908407,"extensions":[],"operations":[[2,{"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"fee":{"amount":500000,"asset_id":"1.3.0"}}]],"signatures":["1f32983b7f22a6b4f8abf4c4084eb8d7a602e924fd74636576722b56fec766f7115e85694ba4c48b30ae9ef8499e2ebeb2df9e58945baf70dfb7a6b61f5ef2723f"]}]],"id":5}""", """{"method":"notice","params":[27185,[{"id":"7a36485857261f61eafb70e54ac7994baeba15f2","block_num":485152,"trx_num":0,"trx":{"ref_block_num":26399,"ref_block_prefix":3097908407,"expiration":"2018-05-28T13:32:33","operations":[[2,{"fee":{"amount":500000,"asset_id":"1.3.0"},"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"extensions":{}}]],"extensions":[],"signatures":["1f32983b7f22a6b4f8abf4c4084eb8d7a602e924fd74636576722b56fec766f7115e85694ba4c48b30ae9ef8499e2ebeb2df9e58945baf70dfb7a6b61f5ef2723f"],"operation_results":[[0,{}]]}}]]}""") - .enqueue("""{"method":"call","params":[2,"get_objects",[["1.2.34"]]],"id":6}""", """{"id":6,"result":[{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0}]}""") - .enqueue("""{"method":"call","params":[2,"get_dynamic_global_properties",[]],"id":7}""", """{"id":7,"result":{"id":"2.1.0","head_block_number":485151,"head_block_id":"0007671fb754a6b8cf3e5df7c8d8668f0c96cef1","time":"2018-05-28T13:32:00","current_miner":"1.4.9","next_maintenance_time":"2018-05-29T00:00:00","last_budget_time":"2018-05-28T00:00:00","unspent_fee_budget":5530514,"mined_rewards":"328005000000","miner_budget_from_fees":11345954,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":1,"recently_missed_count":3,"current_aslot":5739408,"recent_slots_filled":"319012120304339705501019736411954184189","dynamic_flags":0,"last_irreversible_block_num":485151}}""") - .enqueue("""{"method":"call","params":[2,"get_required_fees",[[[2,{"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"fee":{"amount":0,"asset_id":"1.3.0"}}]],"1.3.0"]],"id":8}""", """{"id":8,"result":[{"amount":500000,"asset_id":"1.3.0"}]}""") - .enqueue("""{"method":"call","params":[3,"broadcast_transaction_with_callback",[27185,{"expiration":"2018-05-28T13:32:34","ref_block_num":26399,"ref_block_prefix":3097908407,"extensions":[],"operations":[[2,{"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"fee":{"amount":500000,"asset_id":"1.3.0"}}]],"signatures":["2066279380490926435ad860568ba23e0deabc3073c6f24866adf0db2980df10325e10902a23ec69ca66242b229a22b943f001129e5a507b79c54268114912a7fa"]}]],"id":9}""", """{"method":"notice","params":[27185,[{"id":"fbabe85706822779b7808729606aba651ecd6e90","block_num":485153,"trx_num":0,"trx":{"ref_block_num":26399,"ref_block_prefix":3097908407,"expiration":"2018-05-28T13:32:34","operations":[[2,{"fee":{"amount":500000,"asset_id":"1.3.0"},"account":"1.2.34","new_options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"extensions":{}}]],"extensions":[],"signatures":["2066279380490926435ad860568ba23e0deabc3073c6f24866adf0db2980df10325e10902a23ec69ca66242b229a22b943f001129e5a507b79c54268114912a7fa"],"operation_results":[[0,{}]]}}]]}""") - .enqueue("""{"method":"call","params":[1,"network_broadcast",[]],"id":10}""", """{"id":10,"result":3}""") - .enqueue("""{"method":"call","params":[2,"get_objects",[["1.2.34"]]],"id":11}""", """{"id":11,"result":[{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":["0:5","0:8"],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0}]}""") - .enqueue("""{"method":"call","params":[2,"get_objects",[["1.2.34"]]],"id":12}""", """{"id":12,"result":[{"id":"1.2.34","registrar":"1.2.15","name":"u961279ec8b7ae7bd62f304f7c1c3d345","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz",1]]},"options":{"memo_key":"DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"rights_to_publish":{"is_publishing_manager":false,"publishing_rights_received":[],"publishing_rights_forwarded":[]},"statistics":"2.5.34","top_n_control_flags":0}]}""") - - val votes = setOf("0:5", "0:8") - - val test = vote(votes).concatWith(vote(emptySet())) - .subscribeOn(Schedulers.newThread()) - .test() - - test.awaitTerminalEvent() - test.assertComplete() - .assertNoErrors() - .assertValueAt(0, { it.options.votes == votes }) - .assertValueAt(1, { it.options.votes.isEmpty() }) - } - - private fun vote(votes: Set): Single { - val key = ECKeyPair.fromBase58(private) - val account = socket.request(GetAccountById(listOf(account))).blockingGet().first() - val op = AccountUpdateOperation( - account.id, options = account.options.copy(votes = votes) - ) - val props = socket.request(GetDynamicGlobalProps).blockingGet() - val fees = socket.request(GetRequiredFees(listOf(op))).blockingGet() - - val transaction = Transaction( - BlockData(props, DCoreSdk.defaultExpiration), - listOf(op.apply { fee = fees.first() }) - ).withSignature(key) - - return socket.request(BroadcastTransactionWithCallback(transaction, 27185)) - .flatMap { socket.request(GetAccountById(listOf(account.id))).map { it.first() } } - } - - @Test fun `create account`() { - mockWebServer - .enqueue("""{"method":"call","params":[1,"login",["",""]],"id":2}""", """{"id":2,"result":true}""") - .enqueue("""{"method":"call","params":[1,"database",[]],"id":1}""", """{"id":1,"result":2}""") - .enqueue("""{"method":"call","params":[2,"get_dynamic_global_properties",[]],"id":0}""", """{"id":0,"result":{"id":"2.1.0","head_block_number":483808,"head_block_id":"000761e0b1d5fbffd947cb42b397d355e4e25246","time":"2018-05-28T11:29:05","current_miner":"1.4.1","next_maintenance_time":"2018-05-29T00:00:00","last_budget_time":"2018-05-28T00:00:00","unspent_fee_budget":6411522,"mined_rewards":"278314000000","miner_budget_from_fees":11345954,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":0,"recently_missed_count":0,"current_aslot":5737933,"recent_slots_filled":"169974867696766918687181421356601016319","dynamic_flags":0,"last_irreversible_block_num":483808}}""") - .enqueue("""{"method":"call","params":[2,"get_required_fees",[[[1,{"registrar":"1.2.34","name":"mikeeee","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6718kUCCksnkeYD1YySWkXb1VLpzjkFfHHMirCRPexp5gDPJLU",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6718kUCCksnkeYD1YySWkXb1VLpzjkFfHHMirCRPexp5gDPJLU",1]]},"options":{"memo_key":"DCT6718kUCCksnkeYD1YySWkXb1VLpzjkFfHHMirCRPexp5gDPJLU","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"fee":{"amount":0,"asset_id":"1.3.0"}}]],"1.3.0"]],"id":3}""", """{"id":3,"result":[{"amount":500000,"asset_id":"1.3.0"}]}""") - .enqueue("""{"method":"call","params":[1,"network_broadcast",[]],"id":5}""", """{"id":5,"result":3}""") - .enqueue("""{"method":"call","params":[3,"broadcast_transaction_with_callback",[27185,{"expiration":"2018-05-28T11:29:36","ref_block_num":25056,"ref_block_prefix":4294694321,"extensions":[],"operations":[[1,{"registrar":"1.2.34","name":"mikeeee","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6718kUCCksnkeYD1YySWkXb1VLpzjkFfHHMirCRPexp5gDPJLU",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6718kUCCksnkeYD1YySWkXb1VLpzjkFfHHMirCRPexp5gDPJLU",1]]},"options":{"memo_key":"DCT6718kUCCksnkeYD1YySWkXb1VLpzjkFfHHMirCRPexp5gDPJLU","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"fee":{"amount":500000,"asset_id":"1.3.0"}}]],"signatures":["1f246288a9167fa71269bdb2ceaefa02334cecf1363db112b560476aad76ac1d5a66e17ffb6a209261aa6052142373955fb007ed815a46ee3cca1402862a85ae19"]}]],"id":4}""", """{"method":"notice","params":[27185,[{"id":"cc8d5f4c211a0d6d08c78d7c9a762617d064f2c1","block_num":483809,"trx_num":0,"trx":{"ref_block_num":25056,"ref_block_prefix":4294694321,"expiration":"2018-05-28T11:29:36","operations":[[1,{"fee":{"amount":500000,"asset_id":"1.3.0"},"registrar":"1.2.34","name":"mikeeee","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6718kUCCksnkeYD1YySWkXb1VLpzjkFfHHMirCRPexp5gDPJLU",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["DCT6718kUCCksnkeYD1YySWkXb1VLpzjkFfHHMirCRPexp5gDPJLU",1]]},"options":{"memo_key":"DCT6718kUCCksnkeYD1YySWkXb1VLpzjkFfHHMirCRPexp5gDPJLU","voting_account":"1.2.3","num_miner":0,"votes":[],"extensions":[],"allow_subscription":false,"price_per_subscribe":{"amount":0,"asset_id":"1.3.0"},"subscription_period":0},"extensions":{}}]],"extensions":[],"signatures":["1f246288a9167fa71269bdb2ceaefa02334cecf1363db112b560476aad76ac1d5a66e17ffb6a209261aa6052142373955fb007ed815a46ee3cca1402862a85ae19"],"operation_results":[[1,"1.2.41"]]}}]]}""") - - - val key = ECKeyPair.fromBase58(private) - val public = "DCT6718kUCCksnkeYD1YySWkXb1VLpzjkFfHHMirCRPexp5gDPJLU".address() - val op = AccountCreateOperation(account, "mikeeee", public) - - val props = socket.request(GetDynamicGlobalProps).blockingGet() - val fees = socket.request(GetRequiredFees(listOf(op))).blockingGet() - - val transaction = Transaction( - BlockData(props, DCoreSdk.defaultExpiration), - listOf(op.apply { fee = fees.first() }) - ).withSignature(key) - - val test = socket.request(BroadcastTransactionWithCallback(transaction, 27185)) - .subscribeOn(Schedulers.newThread()) - .test() - - test.awaitTerminalEvent() - test.assertComplete() - .assertNoErrors() - } - - - @Test fun `content submit`() { - - mockWebServer - .enqueue("""{"method":"call","params":[1,"login",["",""]],"id":2}""", """{"id":2,"result":true}""") - .enqueue("""{"method":"call","params":[1,"database",[]],"id":1}""", """{"id":1,"result":2}""") - .enqueue("""{"method":"call","params":[2,"get_dynamic_global_properties",[]],"id":0}""", """{"id":0,"result":{"id":"2.1.0","head_block_number":738195,"head_block_id":"000b43939a8dbb62f7a7d95f5d050536a139c485","time":"2018-06-13T08:49:05","current_miner":"1.4.4","next_maintenance_time":"2018-06-14T00:00:00","last_budget_time":"2018-06-13T00:00:00","unspent_fee_budget":3405423,"mined_rewards":"213268000000","miner_budget_from_fees":5105803,"miner_budget_from_rewards":"639249000000","accounts_registered_this_interval":0,"recently_missed_count":2,"current_aslot":6012445,"recent_slots_filled":"329643350499266886481768439395175624699","dynamic_flags":0,"last_irreversible_block_num":738195}}""") - .enqueue("""{"method":"call","params":[2,"get_required_fees",[[[20,{"size":10000,"author":"1.2.34","co_authors":[],"URI":"http://hello.io/world2","quorum":0,"price":[{"price":{"amount":1000,"asset_id":"1.3.0"},"region":1}],"hash":"2222222222222222222222222222222222222222","seeders":[],"key_parts":[],"expiration":"2019-05-28T13:32:34","publishing_fee":{"amount":1000,"asset_id":"1.3.0"},"synopsis":"{\"title\":\"Game Title\",\"description\":\"Description\",\"content_type_id\":\"1.2.3\"}","fee":{"amount":0,"asset_id":"1.3.0"}}]],"1.3.0"]],"id":3}""", """{"id":3,"result":[{"amount":0,"asset_id":"1.3.0"}]}""") - .enqueue("""{"method":"call","params":[1,"network_broadcast",[]],"id":5}""", """{"id":5,"result":3}""") - .enqueue("""{"method":"call","params":[3,"broadcast_transaction_with_callback",[27185,{"expiration":"2018-06-13T08:49:39","ref_block_num":17299,"ref_block_prefix":1656458650,"extensions":[],"operations":[[20,{"size":10000,"author":"1.2.34","co_authors":[],"URI":"http://hello.io/world2","quorum":0,"price":[{"price":{"amount":1000,"asset_id":"1.3.0"},"region":1}],"hash":"2222222222222222222222222222222222222222","seeders":[],"key_parts":[],"expiration":"2019-05-28T13:32:34","publishing_fee":{"amount":1000,"asset_id":"1.3.0"},"synopsis":"{\"title\":\"Game Title\",\"description\":\"Description\",\"content_type_id\":\"1.2.3\"}","fee":{"amount":0,"asset_id":"1.3.0"}}]],"signatures":["1f2701505f266fac3fc4c6c6d8021a841ccbba281b191dfea940c5f54851333f3e2d17999f172a1ffa4ee2f0f36ff1b9f0bf68e81317191df46b30b8116ce899b8"]}]],"id":4}""", """{"method":"notice","params":[27185,[{"id":"d2bdda78d8ee2ebce0819ff9ff7a30858f27d49e","block_num":738196,"trx_num":1,"trx":{"ref_block_num":17299,"ref_block_prefix":1656458650,"expiration":"2018-06-13T08:49:39","operations":[[20,{"fee":{"amount":0,"asset_id":"1.3.0"},"size":10000,"author":"1.2.34","co_authors":[],"URI":"http://hello.io/world2","quorum":0,"price":[{"region":1,"price":{"amount":1000,"asset_id":"1.3.0"}}],"hash":"2222222222222222222222222222222222222222","seeders":[],"key_parts":[],"expiration":"2019-05-28T13:32:34","publishing_fee":{"amount":1000,"asset_id":"1.3.0"},"synopsis":"{\"title\":\"Game Title\",\"description\":\"Description\",\"content_type_id\":\"1.2.3\"}"}]],"extensions":[],"signatures":["1f2701505f266fac3fc4c6c6d8021a841ccbba281b191dfea940c5f54851333f3e2d17999f172a1ffa4ee2f0f36ff1b9f0bf68e81317191df46b30b8116ce899b8"],"operation_results":[[0,{}]]}}]]}""") - - val key = ECKeyPair.fromBase58(private) - - val op = ContentSubmitOperation( - 10000, - account, - listOf(), - "http://hello.io/world2", - 0, - listOf(RegionalPrice(AssetAmount(1000), 1)), - "2222222222222222222222222222222222222222", - listOf(), - listOf(), - LocalDateTime.parse("2019-05-28T13:32:34"), - AssetAmount(1000), - Synopsis("Game Title", "Description", "1.2.3".toChainObject()).json - ) - - val props = socket.request(GetDynamicGlobalProps).blockingGet() - val fees = socket.request(GetRequiredFees(listOf(op))).blockingGet() - - val transaction = Transaction( - BlockData(props, DCoreSdk.defaultExpiration), - listOf(op.apply { fee = fees.first() }) - ).withSignature(key) - - val test = socket.request(BroadcastTransactionWithCallback(transaction, 27185)) - .subscribeOn(Schedulers.newThread()) - .test() - - test.awaitTerminalEvent() - test.assertComplete() - .assertNoErrors() - } -*/ -} \ No newline at end of file diff --git a/library/src/test/java/ch/decent/sdk/net/ws/ConnectionTest.kt b/library/src/test/java/ch/decent/sdk/net/ws/RxWebSocketTest.kt similarity index 54% rename from library/src/test/java/ch/decent/sdk/net/ws/ConnectionTest.kt rename to library/src/test/java/ch/decent/sdk/net/ws/RxWebSocketTest.kt index 1c18db22..0523692c 100644 --- a/library/src/test/java/ch/decent/sdk/net/ws/ConnectionTest.kt +++ b/library/src/test/java/ch/decent/sdk/net/ws/RxWebSocketTest.kt @@ -1,41 +1,39 @@ package ch.decent.sdk.net.ws import ch.decent.sdk.DCoreSdk +import ch.decent.sdk.Helpers import ch.decent.sdk.TimeOutTest -import ch.decent.sdk.client import ch.decent.sdk.net.model.request.GetChainId import ch.decent.sdk.net.model.request.Login import ch.decent.sdk.net.ws.model.WebSocketClosedException +import ch.decent.sdk.print +import io.reactivex.Observable +import io.reactivex.Single +import io.reactivex.schedulers.Schedulers +import org.amshove.kluent.`should be equal to` import org.junit.After import org.junit.Before import org.junit.Test import org.slf4j.LoggerFactory -class ConnectionTest : TimeOutTest() { +class RxWebSocketTest : TimeOutTest() { private lateinit var socket: RxWebSocket - private lateinit var mockWebServer: CustomWebSocketService @Before fun init() { - mockWebServer = CustomWebSocketService().apply { start(port) } val logger = LoggerFactory.getLogger("RxWebSocket") socket = RxWebSocket( - client(logger), - mockWebServer.getUrl(), -// url, + Helpers.client(logger), + Helpers.wsUrl, logger = logger, gson = DCoreSdk.gsonBuilder.create() ) } @After fun close() { - mockWebServer.shutdown() } @Test fun `should connect, disconnect and connect`() { - mockWebServer - .enqueue("keep alive", "") - var websocket = socket.webSocket().test() websocket.awaitTerminalEvent() @@ -56,18 +54,14 @@ class ConnectionTest : TimeOutTest() { } @Test fun `should connect, disconnect, fail request and reconnect with success`() { - mockWebServer - .enqueue("keep alive", "") - .enqueue("""{"method":"call","params":[1,"login",["",""]],"id":0}""", """{"id":0,"result":true}""") - val websocket = socket.webSocket().test() websocket.awaitTerminalEvent() websocket.assertComplete() .assertValueCount(1) - val fail = socket.request(GetChainId).test() socket.disconnect() + val fail = socket.request(GetChainId).test() fail.awaitTerminalEvent() fail.assertError(WebSocketClosedException::class.java) @@ -81,53 +75,28 @@ class ConnectionTest : TimeOutTest() { } @Test fun `should connect, disconnect, fail request and retry with success`() { - mockWebServer - .enqueue("keep alive", "") - .enqueue("""{"method":"call","params":[0,"get_chain_id",[]],"id":0}""", """{"id":0,"result":"17401602b201b3c45a3ad98afc6fb458f91f519bd30d1058adf6f2bed66376bc"}""") - val websocket = socket.webSocket().test() websocket.awaitTerminalEvent() websocket.assertComplete() .assertValueCount(1) - val test = socket.request(GetChainId).retry(1).test() socket.disconnect() + val test = socket.request(GetChainId).retry(1).test() test.awaitTerminalEvent() test.assertComplete() .assertNoErrors() } - @Test fun `should fail, disconnect, connect and make request`() { - mockWebServer - .enqueue("keep alive", "") - .enqueue("""{"method":"call","params":[1,"login",["",""]],"id":0}""", """{"id":0,"result":true}""") - - val websocket = socket.webSocket().test() - - websocket.awaitTerminalEvent() - websocket.assertComplete() - .assertValueCount(1) + @Test fun `should get unique call id`() { + val len = 9999 + val test = Single.merge((1..len).map { Single.just(it).subscribeOn(Schedulers.newThread()).map { socket.callId } }) + .toList() + .map { it.toSet().size } + .test() - websocket.values().single().send("fail") - val fail = socket.events.test() - fail.awaitTerminalEvent() - - mockWebServer.shutdown() - mockWebServer = CustomWebSocketService().apply { start(port) } - .enqueue("keep alive", "") - .enqueue("""{"method":"call","params":[1,"login",["",""]],"id":0}""", """{"id":0,"result":true}""") - - val login = socket.request(Login).test() - - login.awaitTerminalEvent() - login.assertComplete() - .assertNoErrors() - .assertValue(true) - } - - companion object { - private const val port = 1111 + test.awaitTerminalEvent() + test.values().single() `should be equal to` len } } \ No newline at end of file