diff --git a/app/src/main/java/com/example/android_sdk/account.kt b/app/src/main/java/com/example/android_sdk/account.kt index e4ee588..7d9b4c6 100644 --- a/app/src/main/java/com/example/android_sdk/account.kt +++ b/app/src/main/java/com/example/android_sdk/account.kt @@ -89,14 +89,14 @@ suspend fun account() = runBlocking { // } // */ // - // Find account info asynchronously to network & account - val getAccountInfo = async { getAccountInfoAsync("0x90d86020c8241326f0950795a3a8db6f593a321a") }.await() - println( - """ - getAccountInfo: - ${getAccountInfo} - """.trimIndent() - ) +// // Find account info asynchronously to network & account +// val getAccountInfo = async { getAccountInfoAsync("0x90d86020c8241326f0950795a3a8db6f593a321a") }.await() +// println( +// """ +// getAccountInfo: +// ${getAccountInfo} +// """.trimIndent() +// ) // /** // * getAccountInfo : // { diff --git a/app/src/main/java/com/example/android_sdk/nft.kt b/app/src/main/java/com/example/android_sdk/nft.kt index e81236b..3fa0764 100644 --- a/app/src/main/java/com/example/android_sdk/nft.kt +++ b/app/src/main/java/com/example/android_sdk/nft.kt @@ -747,7 +747,9 @@ suspend fun sendNFT721TransactionAsync( try { val getAddressInfo = getAccountInfoAsync(fromAddress) - val privateKey = getAddressInfo.getString("private") + val result = getAddressInfo.getJSONArray("value") + val value = result.getJSONObject(0) + val privateKey = value.getString("private") val web3j = Web3j.build(HttpService(rpcUrl)) val credentials = @@ -837,7 +839,9 @@ suspend fun sendNFT1155TransactionAsync( } try { val getAddressInfo = getAccountInfoAsync(fromAddress) - val privateKey = getAddressInfo.getString("private") + val result = getAddressInfo.getJSONArray("value") + val value = result.getJSONObject(0) + val privateKey = value.getString("private") val web3j = Web3j.build(HttpService(rpcUrl)) val credentials = Credentials.create(privateKey) @@ -931,7 +935,9 @@ suspend fun sendNFT721BatchTransactionAsync( } try { val getAddressInfo = getAccountInfoAsync(fromAddress) - val privateKey = getAddressInfo.getString("private") + val result = getAddressInfo.getJSONArray("value") + val value = result.getJSONObject(0) + val privateKey = value.getString("private") val web3j = Web3j.build(HttpService(rpcUrl)) val credentials = Credentials.create(privateKey) @@ -1036,7 +1042,9 @@ suspend fun sendNFT1155BatchTransactionAsync( } try { val getAddressInfo = getAccountInfoAsync(fromAddress) - val privateKey = getAddressInfo.getString("private") + val result = getAddressInfo.getJSONArray("value") + val value = result.getJSONObject(0) + val privateKey = value.getString("private") val web3j = Web3j.build(HttpService(rpcUrl)) val credentials = Credentials.create(privateKey) @@ -1154,7 +1162,9 @@ suspend fun deployErc721Async( try { val getAddressInfo = getAccountInfoAsync(fromAddress) - val privateKey = getAddressInfo.getString("private") + val result = getAddressInfo.getJSONArray("value") + val value = result.getJSONObject(0) + val privateKey = value.getString("private") val web3j = Web3j.build(HttpService(rpcUrl)) val credentials = Credentials.create(privateKey) @@ -1263,7 +1273,9 @@ suspend fun mintErc721Async( try { val getAddressInfo = getAccountInfoAsync(fromAddress) - val privateKey = getAddressInfo.getString("private") + val result = getAddressInfo.getJSONArray("value") + val value = result.getJSONObject(0) + val privateKey = value.getString("private") val web3j = Web3j.build(HttpService(rpcUrl)) val credentials = Credentials.create(privateKey) @@ -1582,4 +1594,4 @@ suspend fun mintErc721Async( // //fun decimalToHexString(decimal: Int): String { // return Integer.toHexString(decimal) -//} \ No newline at end of file +//}