Skip to content

Commit

Permalink
nft update
Browse files Browse the repository at this point in the history
  • Loading branch information
SionNoh committed Aug 2, 2023
1 parent ad5babe commit 5ff0ffc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
16 changes: 8 additions & 8 deletions app/src/main/java/com/example/android_sdk/account.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ suspend fun account() = runBlocking<Unit> {
// }
// */
//
// 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 :
// {
Expand Down
26 changes: 19 additions & 7 deletions app/src/main/java/com/example/android_sdk/nft.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1582,4 +1594,4 @@ suspend fun mintErc721Async(
//
//fun decimalToHexString(decimal: Int): String {
// return Integer.toHexString(decimal)
//}
//}

0 comments on commit 5ff0ffc

Please sign in to comment.