From 7e9bd0faf1f9a68b6a63774c7f6d2b9143eb11a1 Mon Sep 17 00:00:00 2001 From: zhuguoqing Date: Tue, 31 May 2022 20:25:07 +0800 Subject: [PATCH] update --- app/AndroidManifest.xml | 13 +- app/build.gradle | 123 ++++----- app/jni/Android.mk | 8 +- app/jni/Application.mk | 2 +- app/proguard-rules.pro | 1 - .../javascript/wc/JMoshiPayloadAdapter.kt | 250 ++++++++++++++++++ .../org/cocos2dx/javascript/wc/JWCSession.kt | 9 +- .../javascript/wc/TypeMapConversion.kt | 15 ++ .../javascript/wc/entity/CallResult.java | 44 +++ .../javascript/wc/entity/ChainObj.java | 49 ++++ .../javascript/wc/entity/ChangeChainObj.java | 13 + .../javascript/wc/entity/CurrencyObj.java | 31 +++ build-cfg.json | 6 +- build.gradle | 2 +- gradle.properties | 11 +- gradle/wrapper/gradle-wrapper.properties | 6 +- settings.gradle | 5 +- 17 files changed, 480 insertions(+), 108 deletions(-) mode change 100755 => 100644 app/AndroidManifest.xml mode change 100755 => 100644 app/build.gradle mode change 100755 => 100644 app/proguard-rules.pro create mode 100644 app/src/org/cocos2dx/javascript/wc/JMoshiPayloadAdapter.kt create mode 100644 app/src/org/cocos2dx/javascript/wc/TypeMapConversion.kt create mode 100644 app/src/org/cocos2dx/javascript/wc/entity/CallResult.java create mode 100644 app/src/org/cocos2dx/javascript/wc/entity/ChainObj.java create mode 100644 app/src/org/cocos2dx/javascript/wc/entity/ChangeChainObj.java create mode 100644 app/src/org/cocos2dx/javascript/wc/entity/CurrencyObj.java mode change 100755 => 100644 build.gradle diff --git a/app/AndroidManifest.xml b/app/AndroidManifest.xml old mode 100755 new mode 100644 index 467c395..fc956dd --- a/app/AndroidManifest.xml +++ b/app/AndroidManifest.xml @@ -1,6 +1,6 @@ @@ -8,8 +8,11 @@ + + + @@ -20,11 +23,11 @@ android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:name="org.cocos2dx.javascript.ExampleApplication"> - + - + android:value="cocos2djs" /> + - + diff --git a/app/build.gradle b/app/build.gradle old mode 100755 new mode 100644 index 3e366bc..6b40a68 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,23 +10,15 @@ android { compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger() buildToolsVersion PROP_BUILD_TOOLS_VERSION - compileOptions { - sourceCompatibility = '1.8' - targetCompatibility = '1.8' - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - defaultConfig { - applicationId "games.cebg.metaverse.nft.btc.blockchain.eth.coinbase.binance.FTX.kucoin" + applicationId "com.shjc.cebg" minSdkVersion PROP_MIN_SDK_VERSION targetSdkVersion PROP_TARGET_SDK_VERSION versionCode 3 versionName "1.0.2" - - + multiDexEnabled true ndk{ - abiFilters 'armeabi-v7a','arm64-v8a', 'x86' + abiFilters 'armeabi-v7a','arm64-v8a' } externalNativeBuild { @@ -35,7 +27,6 @@ android { // skip the NDK Build step if PROP_NDK_MODE is none targets 'cocos2djs' arguments 'NDK_TOOLCHAIN_VERSION=clang' - def module_paths = [project.file("/Applications/CocosCreator.app/Contents/Resources/cocos2d-x"), project.file("/Applications/CocosCreator.app/Contents/Resources/cocos2d-x/cocos"), project.file("/Applications/CocosCreator.app/Contents/Resources/cocos2d-x/external")] @@ -45,7 +36,7 @@ android { else { arguments 'NDK_MODULE_PATH=' + module_paths.join(':') } - + arguments '-j' + Runtime.runtime.availableProcessors() abiFilters.addAll(PROP_APP_ABI.split(':').collect{it as String}) } @@ -83,33 +74,21 @@ android { buildTypes { release { - debuggable false jniDebuggable false renderscriptDebuggable false -// useProguard true -// minifyEnabled true - externalNativeBuild { - ndkBuild { - arguments 'NDK_DEBUG=1' - } + minifyEnabled true + shrinkResources true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + if (project.hasProperty("RELEASE_STORE_FILE")) { + signingConfig signingConfigs.release } -// debuggable false -// jniDebuggable false -// renderscriptDebuggable false -// minifyEnabled true -// shrinkResources true -// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' -// if (project.hasProperty("RELEASE_STORE_FILE")) { -// signingConfig signingConfigs.release -// } -// -// externalNativeBuild { -// ndkBuild { -// arguments 'NDK_DEBUG=0' -// } -// } + externalNativeBuild { + ndkBuild { + arguments 'NDK_DEBUG=0' + } + } } debug { @@ -123,8 +102,6 @@ android { } } } - - assetPacks = [":install_time_asset_pack"] } android.applicationVariants.all { variant -> @@ -132,57 +109,43 @@ android.applicationVariants.all { variant -> delete "${buildDir}/intermediates/merged_assets/${variant.dirName}" variant.mergeAssets.doLast { - def sourceDir = "${buildDir}/../../../jsb-default" + def sourceDir = "${buildDir}/../../../../.." - // copy { - // from "${sourceDir}/res" - // into "${outputDir}/res" - // } + copy { + from "${sourceDir}/res" + into "${outputDir}/res" + } - // copy { - // from "${sourceDir}/subpackages" - // into "${outputDir}/subpackages" - // } + copy { + from "${sourceDir}/subpackages" + into "${outputDir}/subpackages" + } - // copy { - // from "${sourceDir}/src" - // into "${outputDir}/src" - // } + copy { + from "${sourceDir}/src" + into "${outputDir}/src" + } - // copy { - // from "${sourceDir}/jsb-adapter" - // into "${outputDir}/jsb-adapter" - // } + copy { + from "${sourceDir}/jsb-adapter" + into "${outputDir}/jsb-adapter" + } - // copy { - // from "${sourceDir}/main.js" - // from "${sourceDir}/project.json" - // into outputDir - // } -// copy{ -// from "${sourceDir}" -// include "res/**" -// include "src/**" -// include "jsb-adapter/**" -// -// into outputDir -// } -// -// copy { -// from "${sourceDir}/main.js" -// from "${sourceDir}/project.json" -// into outputDir -// } + copy { + from "${sourceDir}/main.js" + from "${sourceDir}/project.json" + into outputDir + } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar','*.aar']) - implementation fileTree(dir: "/Applications/CocosCreator/Creator/2.0.10/CocosCreator.app/Contents/Resources/cocos2d-x/cocos/platform/android/java/libs", include: ['*.jar']) + implementation fileTree(dir: "/Applications/CocosCreator.app/Contents/Resources/cocos2d-x/cocos/platform/android/java/libs", include: ['*.jar']) implementation project(':libcocos2dx') implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: []) - implementation "org.java-websocket:Java-WebSocket:1.4.0" + implementation "org.java-websocket:Java-WebSocket:1.4.0" implementation "com.github.komputing:khex:1.0.0-RC6" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}" @@ -196,7 +159,13 @@ dependencies { implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.0' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0' - implementation 'com.github.WalletConnect:kotlin-walletconnect-lib:0.9.6' - implementation 'com.google.android.play:core:1.10.2' + + implementation ('com.github.WalletConnect:kotlin-walletconnect-lib:0.9.6') { + exclude group: 'org.bouncycastle', module: '*' + } + + implementation "org.bouncycastle:bcprov-jdk15to18:1.68" + + } diff --git a/app/jni/Android.mk b/app/jni/Android.mk index 1b2bece..4962c98 100755 --- a/app/jni/Android.mk +++ b/app/jni/Android.mk @@ -2,7 +2,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE := cocos2djs +LOCAL_MODULE := cocos2djs_shared LOCAL_MODULE_FILENAME := libcocos2djs @@ -11,10 +11,10 @@ LOCAL_ARM_MODE := arm endif LOCAL_SRC_FILES := hellojavascript/main.cpp \ - ../../Classes/AppDelegate.cpp \ - ../../Classes/jsb_module_register.cpp \ + ../../../Classes/AppDelegate.cpp \ + ../../../Classes/jsb_module_register.cpp \ -LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes LOCAL_STATIC_LIBRARIES := cocos2dx_static diff --git a/app/jni/Application.mk b/app/jni/Application.mk index 83fa1a1..5eaf4a9 100755 --- a/app/jni/Application.mk +++ b/app/jni/Application.mk @@ -14,7 +14,7 @@ USE_ARM_MODE := 1 # MUST be careful to modify this manually # disable module will speed up compile time, and reduce package size USE_GFX_RENDERER := 0 -USE_VIDEO := 1 +USE_VIDEO := 0 USE_WEB_VIEW := 0 USE_AUDIO := 1 USE_SOCKET := 1 diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro old mode 100755 new mode 100644 index f4f1a74..9607cd4 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -36,7 +36,6 @@ -keep public class com.anysdk.** { *; } -dontwarn com.anysdk.** - -keep class com.youme.**{*;} -keepattributes Signature diff --git a/app/src/org/cocos2dx/javascript/wc/JMoshiPayloadAdapter.kt b/app/src/org/cocos2dx/javascript/wc/JMoshiPayloadAdapter.kt new file mode 100644 index 0000000..4e5504e --- /dev/null +++ b/app/src/org/cocos2dx/javascript/wc/JMoshiPayloadAdapter.kt @@ -0,0 +1,250 @@ +package org.cocos2dx.javascript.wc + +import com.squareup.moshi.Json +import com.squareup.moshi.Moshi +import com.squareup.moshi.Types +import org.bouncycastle.crypto.digests.SHA256Digest +import org.bouncycastle.crypto.engines.AESEngine +import org.bouncycastle.crypto.macs.HMac +import org.bouncycastle.crypto.modes.CBCBlockCipher +import org.bouncycastle.crypto.paddings.PKCS7Padding +import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher +import org.bouncycastle.crypto.params.KeyParameter +import org.bouncycastle.crypto.params.ParametersWithIV +import org.komputing.khex.decode +import org.komputing.khex.extensions.toNoPrefixHexString +import org.walletconnect.Session +import org.walletconnect.types.* +import java.security.SecureRandom +import java.util.concurrent.ConcurrentHashMap + +class JMoshiPayloadAdapter(moshi: Moshi) : Session.PayloadAdapter { + + private val payloadAdapter = moshi.adapter(EncryptedPayload::class.java) + private val mapAdapter = moshi.adapter>( + Types.newParameterizedType( + Map::class.java, + String::class.java, + Any::class.java + ) + ) + + private val requests: MutableMap = ConcurrentHashMap() + + private fun createRandomBytes(i: Int) = ByteArray(i).also { SecureRandom().nextBytes(it) } + + override fun parse(payload: String, key: String): Session.MethodCall { + val encryptedPayload = payloadAdapter.fromJson(payload) ?: throw IllegalArgumentException("Invalid json payload!") + + // TODO verify hmac + + val padding = PKCS7Padding() + val aes = PaddedBufferedBlockCipher( + CBCBlockCipher(AESEngine()), + padding + ) + val ivAndKey = ParametersWithIV( + KeyParameter(decode(key)), + decode(encryptedPayload.iv) + ) + aes.init(false, ivAndKey) + + val encryptedData = decode(encryptedPayload.data) + val minSize = aes.getOutputSize(encryptedData.size) + val outBuf = ByteArray(minSize) + var len = aes.processBytes(encryptedData, 0, encryptedData.size, outBuf, 0) + len += aes.doFinal(outBuf, len) + + return outBuf.copyOf(len).toMethodCall() + } + + override fun prepare(data: Session.MethodCall, key: String): String { + val bytesData = data.toBytes() + val hexKey = decode(key) + val iv = createRandomBytes(16) + + val padding = PKCS7Padding() + val aes = PaddedBufferedBlockCipher( + CBCBlockCipher(AESEngine()), + padding + ) + aes.init(true, ParametersWithIV(KeyParameter(hexKey), iv)) + + val minSize = aes.getOutputSize(bytesData.size) + val outBuf = ByteArray(minSize) + val length1 = aes.processBytes(bytesData, 0, bytesData.size, outBuf, 0) + aes.doFinal(outBuf, length1) + + + val hmac = HMac(SHA256Digest()) + hmac.init(KeyParameter(hexKey)) + + val hmacResult = ByteArray(hmac.macSize) + hmac.update(outBuf, 0, outBuf.size) + hmac.update(iv, 0, iv.size) + hmac.doFinal(hmacResult, 0) + requests[data.id()] = data + return payloadAdapter.toJson( + EncryptedPayload( + outBuf.toNoPrefixHexString(), + hmac = hmacResult.toNoPrefixHexString(), + iv = iv.toNoPrefixHexString() + ) + ) + } + + /** + * Convert FROM request bytes + */ + private fun ByteArray.toMethodCall(): Session.MethodCall = + String(this).let { json -> + mapAdapter.fromJson(json)?.let { + try { + var method = it["method"] + when (method) { + "wc_sessionRequest" -> it.toSessionRequest() + "wc_sessionUpdate" -> it.toSessionUpdate() + "eth_sendTransaction" -> it.toSendTransaction() + "eth_sign" -> it.toSignMessage() + null -> it.toResponse() + else -> it.toCustom() + } + } catch (e: Exception) { + throw Session.MethodCallException.InvalidRequest(it.getId(), "$json (${e.message ?: "Unknown error"})") + } + } ?: throw IllegalArgumentException("Invalid json") + } + + private fun Map.toSessionUpdate(): Session.MethodCall.SessionUpdate { + val params = this["params"] as? List<*> ?: throw IllegalArgumentException("params missing") + val data = params.firstOrNull() as? Map ?: throw IllegalArgumentException("Invalid params") + return Session.MethodCall.SessionUpdate( + getId(), + data.extractSessionParams() + ) + } + + private fun Map.toSendTransaction(): Session.MethodCall.SendTransaction { + val params = this["params"] as? List<*> ?: throw IllegalArgumentException("params missing") + val data = params.firstOrNull() as? Map<*, *> ?: throw IllegalArgumentException("Invalid params") + val from = data["from"] as? String ?: throw IllegalArgumentException("from key missing") + val to = data["to"] as? String ?: throw IllegalArgumentException("to key missing") + val nonce = data["nonce"] as? String ?: (data["nonce"] as? Double)?.toLong()?.toString() + val gasPrice = data["gasPrice"] as? String + val gasLimit = data["gasLimit"] as? String + val value = data["value"] as? String ?: "0x0" + val txData = data["data"] as? String ?: throw IllegalArgumentException("data key missing") + return Session.MethodCall.SendTransaction(getId(), from, to, nonce, gasPrice, gasLimit, value, txData) + } + + private fun Map.toSignMessage(): Session.MethodCall.SignMessage { + val params = this["params"] as? List<*> ?: throw IllegalArgumentException("params missing") + val address = params.getOrNull(0) as? String ?: throw IllegalArgumentException("Missing address") + val message = params.getOrNull(1) as? String ?: throw IllegalArgumentException("Missing message") + return Session.MethodCall.SignMessage(getId(), address, message) + } + + private fun Map.toCustom(): Session.MethodCall.Custom { + val method = this["method"] as? String ?: throw IllegalArgumentException("method missing") + val params = this["params"] as? List<*> + return Session.MethodCall.Custom(getId(), method, params) + } + + private fun Map.toResponse(): Session.MethodCall.Response { + var result = this["result"] + val error = this["error"] as? Map<*, *> + if (result == null && error == null) { + var hasErr = true + if (requests[getId()] != null) { + when (val localData: Session.MethodCall? = requests[getId()]) { + is Session.MethodCall.Custom -> { + if (localData.method == "wallet_switchEthereumChain" || localData.method == "wallet_addEthereumChain") { + hasErr = false + result = "success" + } + } + } + requests.remove(getId()) + } + if (hasErr) { + throw IllegalArgumentException("no result or error") + } + } + return Session.MethodCall.Response( + getId(), + result, + error?.extractError() + ) + } + + /** + * Convert INTO request bytes + */ + private fun Session.MethodCall.toBytes() = + mapAdapter.toJson( + when (this) { + is Session.MethodCall.SessionRequest -> this.toMap() + is Session.MethodCall.Response -> this.toMap() + is Session.MethodCall.SessionUpdate -> this.toMap() + is Session.MethodCall.SendTransaction -> this.toMap() + is Session.MethodCall.SignMessage -> this.toMap() + is Session.MethodCall.Custom -> this.toMap() + } + ).toByteArray() + + private fun Session.MethodCall.SessionRequest.toMap() = + jsonRpc(id, "wc_sessionRequest", peer.intoMap()) + + private fun Session.MethodCall.SessionUpdate.toMap() = + jsonRpc(id, "wc_sessionUpdate", params.intoMap()) + + private fun Session.MethodCall.SendTransaction.toMap() = + jsonRpc( + id, "eth_sendTransaction", mapOf( + "from" to from, + "to" to to, + "nonce" to nonce, + "gasPrice" to gasPrice, + "gasLimit" to gasLimit, + "value" to value, + "data" to data + ) + ) + + private fun Session.MethodCall.SignMessage.toMap() = + jsonRpc( + id, "eth_sign", address, message + ) + + private fun Session.MethodCall.Response.toMap() = + mutableMapOf( + "id" to id, + "jsonrpc" to "2.0" + ).apply { + result?.let { this["result"] = result!! } + error?.let { this["error"] = error!!.intoMap() } + } + + private fun Session.MethodCall.Custom.toMap() = + jsonRpcWithList( + id, method, params ?: emptyList() + ) + + private fun jsonRpc(id: Long, method: String, vararg params: Any) = + jsonRpcWithList(id, method, params.asList()) + + private fun jsonRpcWithList(id: Long, method: String, params: List<*>) = + mapOf( + "id" to id, + "jsonrpc" to "2.0", + "method" to method, + "params" to params + ) + + // TODO: @JsonClass(generateAdapter = true) + data class EncryptedPayload( + @Json(name = "data") val data: String, + @Json(name = "iv") val iv: String, + @Json(name = "hmac") val hmac: String + ) +} \ No newline at end of file diff --git a/app/src/org/cocos2dx/javascript/wc/JWCSession.kt b/app/src/org/cocos2dx/javascript/wc/JWCSession.kt index 3ec8f7e..41f3c92 100644 --- a/app/src/org/cocos2dx/javascript/wc/JWCSession.kt +++ b/app/src/org/cocos2dx/javascript/wc/JWCSession.kt @@ -1,9 +1,9 @@ package org.cocos2dx.javascript.wc +import android.util.Log import org.walletconnect.Session import org.walletconnect.impls.WCSessionStore import org.walletconnect.nullOnThrow -import org.walletconnect.types.extractSessionParams import org.walletconnect.types.intoMap import java.util.* import java.util.concurrent.ConcurrentHashMap @@ -108,8 +108,7 @@ class JWCSession( peerId = params.peerData?.id peerMeta = params.peerData?.meta approvedAccounts = params.accounts -// chainId = params.chainId - chainId = ((resp.result as Map<*, *>).get("chainId") as Double).toLong() + chainId = params.chainId storeSession() propagateToCallbacks { onStatus(if (params.approved) Session.Status.Approved else Session.Status.Closed) } } @@ -193,6 +192,7 @@ class JWCSession( } } var accountToCheck: String? = null + Log.i("JWCSession", "handle msg: $data") when (data) { is Session.MethodCall.SessionRequest -> { handshakeId = data.id @@ -203,6 +203,8 @@ class JWCSession( is Session.MethodCall.SessionUpdate -> { if (!data.params.approved) { endSession() + } else { + chainId = data.params.chainId } // TODO handle session update -> not important for our usecase } @@ -269,6 +271,7 @@ class JWCSession( ): Boolean { topic ?: return false + Log.i("JWCSession", "sendMsg: $msg.id()") val payload: String synchronized(keyLock) { payload = payloadAdapter.prepare(msg, encryptionKey) diff --git a/app/src/org/cocos2dx/javascript/wc/TypeMapConversion.kt b/app/src/org/cocos2dx/javascript/wc/TypeMapConversion.kt new file mode 100644 index 0000000..6af00dc --- /dev/null +++ b/app/src/org/cocos2dx/javascript/wc/TypeMapConversion.kt @@ -0,0 +1,15 @@ +package org.cocos2dx.javascript.wc + +import org.walletconnect.Session +import org.walletconnect.nullOnThrow +import org.walletconnect.types.extractPeerData +import org.walletconnect.types.toStringList + + +fun Map.extractSessionParams(): Session.SessionParams { + val approved = this["approved"] as? Boolean ?: throw IllegalArgumentException("approved missing") + val chainId = (this["chainId"] as? Double)?.toLong() + val accounts = nullOnThrow { (this["accounts"] as? List<*>)?.toStringList() } + + return Session.SessionParams(approved, chainId, accounts, nullOnThrow { this.extractPeerData() }) +} \ No newline at end of file diff --git a/app/src/org/cocos2dx/javascript/wc/entity/CallResult.java b/app/src/org/cocos2dx/javascript/wc/entity/CallResult.java new file mode 100644 index 0000000..1f5e4bb --- /dev/null +++ b/app/src/org/cocos2dx/javascript/wc/entity/CallResult.java @@ -0,0 +1,44 @@ +package org.cocos2dx.javascript.wc.entity; + +public class CallResult { + private String type; + private long errCode; + private String errMsg; + private String data; + + public CallResult(String type) { + this.type = type; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public long getErrCode() { + return errCode; + } + + public void setErrCode(long errCode) { + this.errCode = errCode; + } + + public String getErrMsg() { + return errMsg; + } + + public void setErrMsg(String errMsg) { + this.errMsg = errMsg; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } +} diff --git a/app/src/org/cocos2dx/javascript/wc/entity/ChainObj.java b/app/src/org/cocos2dx/javascript/wc/entity/ChainObj.java new file mode 100644 index 0000000..72ec00b --- /dev/null +++ b/app/src/org/cocos2dx/javascript/wc/entity/ChainObj.java @@ -0,0 +1,49 @@ +package org.cocos2dx.javascript.wc.entity; + +public class ChainObj { + private String chainId; + private String chainName; + private String[] blockExplorerUrls; + private String[] rpcUrls; + private CurrencyObj nativeCurrency; + + public String getChainId() { + return chainId; + } + + public void setChainId(String chainId) { + this.chainId = chainId; + } + + public String getChainName() { + return chainName; + } + + public void setChainName(String chainName) { + this.chainName = chainName; + } + + public String[] getBlockExplorerUrls() { + return blockExplorerUrls; + } + + public void setBlockExplorerUrls(String[] blockExplorerUrls) { + this.blockExplorerUrls = blockExplorerUrls; + } + + public String[] getRpcUrls() { + return rpcUrls; + } + + public void setRpcUrls(String[] rpcUrls) { + this.rpcUrls = rpcUrls; + } + + public CurrencyObj getNativeCurrency() { + return nativeCurrency; + } + + public void setNativeCurrency(CurrencyObj nativeCurrency) { + this.nativeCurrency = nativeCurrency; + } +} diff --git a/app/src/org/cocos2dx/javascript/wc/entity/ChangeChainObj.java b/app/src/org/cocos2dx/javascript/wc/entity/ChangeChainObj.java new file mode 100644 index 0000000..17de210 --- /dev/null +++ b/app/src/org/cocos2dx/javascript/wc/entity/ChangeChainObj.java @@ -0,0 +1,13 @@ +package org.cocos2dx.javascript.wc.entity; + +public class ChangeChainObj { + private String chainId; + + public String getChainId() { + return chainId; + } + + public void setChainId(String chainId) { + this.chainId = chainId; + } +} diff --git a/app/src/org/cocos2dx/javascript/wc/entity/CurrencyObj.java b/app/src/org/cocos2dx/javascript/wc/entity/CurrencyObj.java new file mode 100644 index 0000000..954d8e6 --- /dev/null +++ b/app/src/org/cocos2dx/javascript/wc/entity/CurrencyObj.java @@ -0,0 +1,31 @@ +package org.cocos2dx.javascript.wc.entity; + +public class CurrencyObj { + private String name; + private String symbol; + private long decimals; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSymbol() { + return symbol; + } + + public void setSymbol(String symbol) { + this.symbol = symbol; + } + + public long getDecimals() { + return decimals; + } + + public void setDecimals(long decimals) { + this.decimals = decimals; + } +} diff --git a/build-cfg.json b/build-cfg.json index f4613f1..86dca20 100755 --- a/build-cfg.json +++ b/build-cfg.json @@ -1,8 +1,8 @@ { "ndk_module_path" :[ - "/Applications/CocosCreator/Creator/2.0.10/CocosCreator.app/Contents/Resources/cocos2d-x", - "/Applications/CocosCreator/Creator/2.0.10/CocosCreator.app/Contents/Resources/cocos2d-x/cocos", - "/Applications/CocosCreator/Creator/2.0.10/CocosCreator.app/Contents/Resources/cocos2d-x/external" + "/Applications/CocosCreator.app/Contents/Resources/cocos2d-x", + "/Applications/CocosCreator.app/Contents/Resources/cocos2d-x/cocos", + "/Applications/CocosCreator.app/Contents/Resources/cocos2d-x/external" ], "copy_resources": [] } diff --git a/build.gradle b/build.gradle old mode 100755 new mode 100644 index d4c6fc9..cf56fbe --- a/build.gradle +++ b/build.gradle @@ -37,7 +37,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' + classpath 'com.android.tools.build:gradle:3.2.0' classpath 'com.github.ben-manes:gradle-versions-plugin:+' classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" diff --git a/gradle.properties b/gradle.properties index 947807e..d4851e7 100755 --- a/gradle.properties +++ b/gradle.properties @@ -21,25 +21,22 @@ PROP_COMPILE_SDK_VERSION=30 # Android SDK version that will be used as the earliest version of android this application can run on -PROP_MIN_SDK_VERSION=23 +PROP_MIN_SDK_VERSION=16 # Android SDK version that will be used as the latest version of android this application has been tested on PROP_TARGET_SDK_VERSION=30 # Android Build Tools version that will be used as the compile project -PROP_BUILD_TOOLS_VERSION=30.0.2 +PROP_BUILD_TOOLS_VERSION=28.0.3 # List of CPU Archtexture to build that application with # Available architextures (armeabi-v7a | arm64-v8a | x86) # To build for multiple architexture, use the `:` between them -# Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 -PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 +# Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a +PROP_APP_ABI=armeabi-v7a:arm64-v8a # fill in sign information for release mode RELEASE_STORE_FILE=/Applications/CocosCreator.app/Contents/Resources/static/build-templates/native/debug.keystore RELEASE_STORE_PASSWORD=123456 RELEASE_KEY_ALIAS=debug_keystore RELEASE_KEY_PASSWORD=123456 - -android.useAndroidX=true -android.enableJetifier=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4361b8d..481f809 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Mar 30 17:25:47 CST 2022 +#Sat May 28 21:47:53 CST 2022 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-5.3-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle b/settings.gradle index 085fba4..cb476bb 100755 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,4 @@ include ':libcocos2dx' project(':libcocos2dx').projectDir = new File('/Applications/CocosCreator.app/Contents/Resources/cocos2d-x/cocos/platform/android/libcocos2dx') -include ':install_time_asset_pack' -include ':TestChain' -project(':TestChain').projectDir = new File(settingsDir, 'app') +include ':CEBG' +project(':CEBG').projectDir = new File(settingsDir, 'app')