This commit is contained in:
zhuguoqing 2022-05-31 20:25:07 +08:00
parent 9d22007f73
commit 7e9bd0faf1
17 changed files with 480 additions and 108 deletions

5
app/AndroidManifest.xml Executable file → Normal file
View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="games.cebg.metaverse.nft.btc.blockchain.eth.coinbase.binance.FTX.kucoin" package="com.shjc.cebg"
android:installLocation="auto"> android:installLocation="auto">
<uses-feature android:glEsVersion="0x00020000" /> <uses-feature android:glEsVersion="0x00020000" />
@ -8,8 +8,11 @@
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

119
app/build.gradle Executable file → Normal file
View File

@ -10,23 +10,15 @@ android {
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger() compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
buildToolsVersion PROP_BUILD_TOOLS_VERSION buildToolsVersion PROP_BUILD_TOOLS_VERSION
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig { defaultConfig {
applicationId "games.cebg.metaverse.nft.btc.blockchain.eth.coinbase.binance.FTX.kucoin" applicationId "com.shjc.cebg"
minSdkVersion PROP_MIN_SDK_VERSION minSdkVersion PROP_MIN_SDK_VERSION
targetSdkVersion PROP_TARGET_SDK_VERSION targetSdkVersion PROP_TARGET_SDK_VERSION
versionCode 3 versionCode 3
versionName "1.0.2" versionName "1.0.2"
multiDexEnabled true
ndk{ ndk{
abiFilters 'armeabi-v7a','arm64-v8a', 'x86' abiFilters 'armeabi-v7a','arm64-v8a'
} }
externalNativeBuild { externalNativeBuild {
@ -35,7 +27,6 @@ android {
// skip the NDK Build step if PROP_NDK_MODE is none // skip the NDK Build step if PROP_NDK_MODE is none
targets 'cocos2djs' targets 'cocos2djs'
arguments 'NDK_TOOLCHAIN_VERSION=clang' arguments 'NDK_TOOLCHAIN_VERSION=clang'
def module_paths = [project.file("/Applications/CocosCreator.app/Contents/Resources/cocos2d-x"), 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/cocos"),
project.file("/Applications/CocosCreator.app/Contents/Resources/cocos2d-x/external")] project.file("/Applications/CocosCreator.app/Contents/Resources/cocos2d-x/external")]
@ -83,33 +74,21 @@ android {
buildTypes { buildTypes {
release { release {
debuggable false debuggable false
jniDebuggable false jniDebuggable false
renderscriptDebuggable false renderscriptDebuggable false
// useProguard true minifyEnabled true
// minifyEnabled true shrinkResources true
externalNativeBuild { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
ndkBuild { if (project.hasProperty("RELEASE_STORE_FILE")) {
arguments 'NDK_DEBUG=1' signingConfig signingConfigs.release
}
} }
// debuggable false externalNativeBuild {
// jniDebuggable false ndkBuild {
// renderscriptDebuggable false arguments 'NDK_DEBUG=0'
// 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'
// }
// }
} }
debug { debug {
@ -123,8 +102,6 @@ android {
} }
} }
} }
assetPacks = [":install_time_asset_pack"]
} }
android.applicationVariants.all { variant -> android.applicationVariants.all { variant ->
@ -132,53 +109,39 @@ android.applicationVariants.all { variant ->
delete "${buildDir}/intermediates/merged_assets/${variant.dirName}" delete "${buildDir}/intermediates/merged_assets/${variant.dirName}"
variant.mergeAssets.doLast { variant.mergeAssets.doLast {
def sourceDir = "${buildDir}/../../../jsb-default" def sourceDir = "${buildDir}/../../../../.."
// copy { copy {
// from "${sourceDir}/res" from "${sourceDir}/res"
// into "${outputDir}/res" into "${outputDir}/res"
// } }
// copy { copy {
// from "${sourceDir}/subpackages" from "${sourceDir}/subpackages"
// into "${outputDir}/subpackages" into "${outputDir}/subpackages"
// } }
// copy { copy {
// from "${sourceDir}/src" from "${sourceDir}/src"
// into "${outputDir}/src" into "${outputDir}/src"
// } }
// copy { copy {
// from "${sourceDir}/jsb-adapter" from "${sourceDir}/jsb-adapter"
// into "${outputDir}/jsb-adapter" into "${outputDir}/jsb-adapter"
// } }
// copy { copy {
// from "${sourceDir}/main.js" from "${sourceDir}/main.js"
// from "${sourceDir}/project.json" from "${sourceDir}/project.json"
// into outputDir 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
// }
} }
} }
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar']) 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 project(':libcocos2dx')
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: []) implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
@ -196,7 +159,13 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.0' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android: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.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"
} }

View File

@ -2,7 +2,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := cocos2djs LOCAL_MODULE := cocos2djs_shared
LOCAL_MODULE_FILENAME := libcocos2djs LOCAL_MODULE_FILENAME := libcocos2djs
@ -11,10 +11,10 @@ LOCAL_ARM_MODE := arm
endif endif
LOCAL_SRC_FILES := hellojavascript/main.cpp \ LOCAL_SRC_FILES := hellojavascript/main.cpp \
../../Classes/AppDelegate.cpp \ ../../../Classes/AppDelegate.cpp \
../../Classes/jsb_module_register.cpp \ ../../../Classes/jsb_module_register.cpp \
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes
LOCAL_STATIC_LIBRARIES := cocos2dx_static LOCAL_STATIC_LIBRARIES := cocos2dx_static

View File

@ -14,7 +14,7 @@ USE_ARM_MODE := 1
# MUST be careful to modify this manually # MUST be careful to modify this manually
# disable module will speed up compile time, and reduce package size # disable module will speed up compile time, and reduce package size
USE_GFX_RENDERER := 0 USE_GFX_RENDERER := 0
USE_VIDEO := 1 USE_VIDEO := 0
USE_WEB_VIEW := 0 USE_WEB_VIEW := 0
USE_AUDIO := 1 USE_AUDIO := 1
USE_SOCKET := 1 USE_SOCKET := 1

1
app/proguard-rules.pro vendored Executable file → Normal file
View File

@ -36,7 +36,6 @@
-keep public class com.anysdk.** { *; } -keep public class com.anysdk.** { *; }
-dontwarn com.anysdk.** -dontwarn com.anysdk.**
-keep class com.youme.**{*;} -keep class com.youme.**{*;}
-keepattributes Signature -keepattributes Signature

View File

@ -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<Map<String, Any?>>(
Types.newParameterizedType(
Map::class.java,
String::class.java,
Any::class.java
)
)
private val requests: MutableMap<Long, Session.MethodCall> = 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<String, *>.toSessionUpdate(): Session.MethodCall.SessionUpdate {
val params = this["params"] as? List<*> ?: throw IllegalArgumentException("params missing")
val data = params.firstOrNull() as? Map<String, *> ?: throw IllegalArgumentException("Invalid params")
return Session.MethodCall.SessionUpdate(
getId(),
data.extractSessionParams()
)
}
private fun Map<String, *>.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<String, *>.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<String, *>.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<String, *>.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<String, Any>(
"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<Any>()
)
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
)
}

View File

@ -1,9 +1,9 @@
package org.cocos2dx.javascript.wc package org.cocos2dx.javascript.wc
import android.util.Log
import org.walletconnect.Session import org.walletconnect.Session
import org.walletconnect.impls.WCSessionStore import org.walletconnect.impls.WCSessionStore
import org.walletconnect.nullOnThrow import org.walletconnect.nullOnThrow
import org.walletconnect.types.extractSessionParams
import org.walletconnect.types.intoMap import org.walletconnect.types.intoMap
import java.util.* import java.util.*
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
@ -108,8 +108,7 @@ class JWCSession(
peerId = params.peerData?.id peerId = params.peerData?.id
peerMeta = params.peerData?.meta peerMeta = params.peerData?.meta
approvedAccounts = params.accounts approvedAccounts = params.accounts
// chainId = params.chainId chainId = params.chainId
chainId = ((resp.result as Map<*, *>).get("chainId") as Double).toLong()
storeSession() storeSession()
propagateToCallbacks { onStatus(if (params.approved) Session.Status.Approved else Session.Status.Closed) } propagateToCallbacks { onStatus(if (params.approved) Session.Status.Approved else Session.Status.Closed) }
} }
@ -193,6 +192,7 @@ class JWCSession(
} }
} }
var accountToCheck: String? = null var accountToCheck: String? = null
Log.i("JWCSession", "handle msg: $data")
when (data) { when (data) {
is Session.MethodCall.SessionRequest -> { is Session.MethodCall.SessionRequest -> {
handshakeId = data.id handshakeId = data.id
@ -203,6 +203,8 @@ class JWCSession(
is Session.MethodCall.SessionUpdate -> { is Session.MethodCall.SessionUpdate -> {
if (!data.params.approved) { if (!data.params.approved) {
endSession() endSession()
} else {
chainId = data.params.chainId
} }
// TODO handle session update -> not important for our usecase // TODO handle session update -> not important for our usecase
} }
@ -269,6 +271,7 @@ class JWCSession(
): Boolean { ): Boolean {
topic ?: return false topic ?: return false
Log.i("JWCSession", "sendMsg: $msg.id()")
val payload: String val payload: String
synchronized(keyLock) { synchronized(keyLock) {
payload = payloadAdapter.prepare(msg, encryptionKey) payload = payloadAdapter.prepare(msg, encryptionKey)

View File

@ -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<String, *>.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() })
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -1,8 +1,8 @@
{ {
"ndk_module_path" :[ "ndk_module_path" :[
"/Applications/CocosCreator/Creator/2.0.10/CocosCreator.app/Contents/Resources/cocos2d-x", "/Applications/CocosCreator.app/Contents/Resources/cocos2d-x",
"/Applications/CocosCreator/Creator/2.0.10/CocosCreator.app/Contents/Resources/cocos2d-x/cocos", "/Applications/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/external"
], ],
"copy_resources": [] "copy_resources": []
} }

2
build.gradle Executable file → Normal file
View File

@ -37,7 +37,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { 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 'com.github.ben-manes:gradle-versions-plugin:+'
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"

View File

@ -21,25 +21,22 @@
PROP_COMPILE_SDK_VERSION=30 PROP_COMPILE_SDK_VERSION=30
# Android SDK version that will be used as the earliest version of android this application can run on # 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 # Android SDK version that will be used as the latest version of android this application has been tested on
PROP_TARGET_SDK_VERSION=30 PROP_TARGET_SDK_VERSION=30
# Android Build Tools version that will be used as the compile project # 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 # List of CPU Archtexture to build that application with
# Available architextures (armeabi-v7a | arm64-v8a | x86) # Available architextures (armeabi-v7a | arm64-v8a | x86)
# To build for multiple architexture, use the `:` between them # To build for multiple architexture, use the `:` between them
# Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 # Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a
PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 PROP_APP_ABI=armeabi-v7a:arm64-v8a
# fill in sign information for release mode # fill in sign information for release mode
RELEASE_STORE_FILE=/Applications/CocosCreator.app/Contents/Resources/static/build-templates/native/debug.keystore RELEASE_STORE_FILE=/Applications/CocosCreator.app/Contents/Resources/static/build-templates/native/debug.keystore
RELEASE_STORE_PASSWORD=123456 RELEASE_STORE_PASSWORD=123456
RELEASE_KEY_ALIAS=debug_keystore RELEASE_KEY_ALIAS=debug_keystore
RELEASE_KEY_PASSWORD=123456 RELEASE_KEY_PASSWORD=123456
android.useAndroidX=true
android.enableJetifier=true

View File

@ -1,6 +1,6 @@
#Wed Mar 30 17:25:47 CST 2022 #Sat May 28 21:47:53 CST 2022
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3-bin.zip
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip zipStoreBase=GRADLE_USER_HOME

View File

@ -1,5 +1,4 @@
include ':libcocos2dx' include ':libcocos2dx'
project(':libcocos2dx').projectDir = new File('/Applications/CocosCreator.app/Contents/Resources/cocos2d-x/cocos/platform/android/libcocos2dx') project(':libcocos2dx').projectDir = new File('/Applications/CocosCreator.app/Contents/Resources/cocos2d-x/cocos/platform/android/libcocos2dx')
include ':install_time_asset_pack' include ':CEBG'
include ':TestChain' project(':CEBG').projectDir = new File(settingsDir, 'app')
project(':TestChain').projectDir = new File(settingsDir, 'app')