From ecc434ae1879de259f36b9646e5b202e0113fe0e Mon Sep 17 00:00:00 2001 From: ahmed smiai Date: Fri, 1 Sep 2023 11:12:36 +0100 Subject: [PATCH] updated algorand chains names --- .../nftkit/services/AlgorandNftService.kt | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/kotlin/id/walt/nftkit/services/AlgorandNftService.kt b/src/main/kotlin/id/walt/nftkit/services/AlgorandNftService.kt index 7c25aa06..5b802960 100644 --- a/src/main/kotlin/id/walt/nftkit/services/AlgorandNftService.kt +++ b/src/main/kotlin/id/walt/nftkit/services/AlgorandNftService.kt @@ -63,7 +63,7 @@ data class NFTStorageResponse( val value: NFTStorageValue ) enum class AlgorandChain{ - MAINNET, TESTNET, BETANET + ALGORAND_MAINNET, ALGORAND_TESTNET, ALGORAND_BETANET } @Serializable @@ -251,9 +251,9 @@ object AlgorandNftService { } val client_algod = when(chain) { - AlgorandChain.MAINNET -> AlgodClient("https://mainnet-algorand.api.purestake.io/ps2", ALGOD_PORT, ALGOD_API_TOKEN, ALGOD_API_TOKEN_KEY) - AlgorandChain.TESTNET -> AlgodClient("https://testnet-algorand.api.purestake.io/ps2", ALGOD_PORT, ALGOD_API_TOKEN, ALGOD_API_TOKEN_KEY) - AlgorandChain.BETANET -> AlgodClient("https://betanet-algorand.api.purestake.io/ps2", ALGOD_PORT, ALGOD_API_TOKEN, ALGOD_API_TOKEN_KEY) + AlgorandChain.ALGORAND_MAINNET -> AlgodClient("https://mainnet-algorand.api.purestake.io/ps2", ALGOD_PORT, ALGOD_API_TOKEN, ALGOD_API_TOKEN_KEY) + AlgorandChain.ALGORAND_TESTNET -> AlgodClient("https://testnet-algorand.api.purestake.io/ps2", ALGOD_PORT, ALGOD_API_TOKEN, ALGOD_API_TOKEN_KEY) + AlgorandChain.ALGORAND_BETANET -> AlgodClient("https://betanet-algorand.api.purestake.io/ps2", ALGOD_PORT, ALGOD_API_TOKEN, ALGOD_API_TOKEN_KEY) } val SRC_ACCOUNT = loadAlgorand().algorandConfig.algorand_seed_Mnemonic val src = Account(SRC_ACCOUNT) @@ -282,9 +282,9 @@ object AlgorandNftService { val encodedTxBytes = Encoder.encodeToMsgPack(signedTx) val txResponse = client_algod.RawTransaction().rawtxn(encodedTxBytes).execute(txHeaders, txValues).body() return when(chain) { - AlgorandChain.MAINNET -> AlgodResponse(txResponse.txId, "$ALGORAND_MAINNET_EXPLORER"+"tx/${txResponse.txId}") - AlgorandChain.TESTNET -> AlgodResponse(txResponse.txId, "$ALGORAND_TESTNET_EXPLORER"+"tx/${txResponse.txId}") - AlgorandChain.BETANET -> AlgodResponse(txResponse.txId, "$ALGORAND_BETANET_EXPLORER"+"tx/${txResponse.txId}") + AlgorandChain.ALGORAND_MAINNET -> AlgodResponse(txResponse.txId, "$ALGORAND_MAINNET_EXPLORER"+"tx/${txResponse.txId}") + AlgorandChain.ALGORAND_TESTNET -> AlgodResponse(txResponse.txId, "$ALGORAND_TESTNET_EXPLORER"+"tx/${txResponse.txId}") + AlgorandChain.ALGORAND_BETANET -> AlgodResponse(txResponse.txId, "$ALGORAND_BETANET_EXPLORER"+"tx/${txResponse.txId}") } } catch (e: Exception) { e.printStackTrace() @@ -296,9 +296,9 @@ object AlgorandNftService { fun getToken(assetId: String, chain: AlgorandChain): AlgorandToken { return runBlocking { val API_ADDR = when (chain) { - AlgorandChain.MAINNET -> "https://mainnet-api.algonode.cloud" - AlgorandChain.TESTNET -> "https://testnet-api.algonode.cloud" - AlgorandChain.BETANET -> "https://betanet-api.algonode.cloud" + AlgorandChain.ALGORAND_MAINNET -> "https://mainnet-api.algonode.cloud" + AlgorandChain.ALGORAND_TESTNET -> "https://testnet-api.algonode.cloud" + AlgorandChain.ALGORAND_BETANET -> "https://betanet-api.algonode.cloud" } val tokenParams = client.get(API_ADDR + "/v2/assets/" + assetId){ contentType(ContentType.Application.Json) @@ -324,9 +324,9 @@ object AlgorandNftService { fun getAssetMeatadata(assetId: String, chain: AlgorandChain): Asset { return runBlocking { val API_ADDR = when (chain) { - AlgorandChain.MAINNET -> "https://mainnet-api.algonode.cloud" - AlgorandChain.TESTNET -> "https://testnet-api.algonode.cloud" - AlgorandChain.BETANET -> "https://betanet-api.algonode.cloud" + AlgorandChain.ALGORAND_MAINNET -> "https://mainnet-api.algonode.cloud" + AlgorandChain.ALGORAND_TESTNET -> "https://testnet-api.algonode.cloud" + AlgorandChain.ALGORAND_BETANET -> "https://betanet-api.algonode.cloud" } val asset = client.get(API_ADDR + "/v2/assets/" + assetId){ contentType(ContentType.Application.Json) @@ -353,9 +353,9 @@ object AlgorandNftService { fun getAccountAssets(address: String, chain: AlgorandChain): List { val API_ADDR = when (chain) { - AlgorandChain.MAINNET -> "https://mainnet-idx.algonode.cloud" - AlgorandChain.TESTNET -> "https://testnet-idx.algonode.cloud" - AlgorandChain.BETANET -> "https://betanet-idx.algonode.cloud" + AlgorandChain.ALGORAND_MAINNET -> "https://mainnet-idx.algonode.cloud" + AlgorandChain.ALGORAND_TESTNET -> "https://testnet-idx.algonode.cloud" + AlgorandChain.ALGORAND_BETANET -> "https://betanet-idx.algonode.cloud" } return runBlocking { @@ -379,9 +379,9 @@ object AlgorandNftService { fun verifyOwnership(address: String, assetId:String, chain: AlgorandChain): AccountAssetResponse{ return runBlocking { val API_ADDR = when (chain) { - AlgorandChain.MAINNET -> "https://mainnet-api.algonode.cloud" - AlgorandChain.TESTNET -> "https://testnet-api.algonode.cloud" - AlgorandChain.BETANET -> "https://betanet-api.algonode.cloud" + AlgorandChain.ALGORAND_MAINNET -> "https://mainnet-api.algonode.cloud" + AlgorandChain.ALGORAND_TESTNET -> "https://testnet-api.algonode.cloud" + AlgorandChain.ALGORAND_BETANET -> "https://betanet-api.algonode.cloud" } val response = client.get(API_ADDR+"/v2/accounts/"+address+"/assets/"+assetId){