From 8fd085e10c3c5651935005abbdea81c5accd2c00 Mon Sep 17 00:00:00 2001 From: SuperBatata Date: Mon, 15 Apr 2024 16:10:19 +0100 Subject: [PATCH 1/3] chore : updated provider keys --- src/main/kotlin/id/walt/nftkit/Values.kt | 2 +- src/main/resources/walt-default.yaml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/id/walt/nftkit/Values.kt b/src/main/kotlin/id/walt/nftkit/Values.kt index 3f5622b6..ef32b72d 100644 --- a/src/main/kotlin/id/walt/nftkit/Values.kt +++ b/src/main/kotlin/id/walt/nftkit/Values.kt @@ -26,7 +26,7 @@ object Values { const val ETHEREUM_TESTNET_SEPOLIA_BLOCK_EXPLORER_URL = "https://sepolia.etherscan.io/" const val POLYGON_MAINNET_BLOCK_EXPLORER_URL = "https://polygonscan.com" const val POLYGON_TESTNET_MUMBAI_BLOCK_EXPLORER_URL = "https://mumbai.polygonscan.com" - const val SHIMMEREVM_TESTNET_BLOCK_EXPLORER_URL = "explorer.evm.testnet.shimmer.network" + const val SHIMMEREVM_TESTNET_BLOCK_EXPLORER_URL = "https://explorer.evm.testnet.shimmer.network/" const val ETHEREUM_MAINNET_ALCHEMY_URL = "https://eth-mainnet.alchemyapi.io/v2/" const val ETHEREUM_TESTNET_GOERLI_ALCHEMY_URL = "https://eth-goerli.g.alchemy.com/v2/" diff --git a/src/main/resources/walt-default.yaml b/src/main/resources/walt-default.yaml index c152e3e3..c2b3f3ad 100644 --- a/src/main/resources/walt-default.yaml +++ b/src/main/resources/walt-default.yaml @@ -13,10 +13,10 @@ azureKeyVaultConfig: providers: ethereum: "ethereum" - goerli: "https://eth-goerli.g.alchemy.com/v2/nC_mn2_pURV1zQvQAM5xFFMKVxLbvHbk" - sepolia: "https://eth-sepolia.g.alchemy.com/v2/LSlLS4At2l4RfC9x_Z_913wtdlZ2wEJK" - polygon: "https://polygon-mainnet.g.alchemy.com/v2/J-GrcOix50BCbOVuVybCFEmKAeKQNBtr" - mumbai: "https://polygon-mumbai.g.alchemy.com/v2/zyd0WGIMKdIdBGhDYX9bGwD7iVshxdCi" + goerli: "https://eth-goerli.g.alchemy.com/v2/x4Ovq8l3SL30X4B3Uz7Q9aYhxVfxhIFg" + sepolia: "https://eth-sepolia.g.alchemy.com/v2/FFX-XLBauFYuxdKDF5QUHCt7AlSGAs5q" + polygon: "https://polygon-mainnet.g.alchemy.com/v2/SUV8QnbFOKnb5eMk5amGinUMCamjLT4l" + mumbai: "https://polygon-mumbai.g.alchemy.com/v2/JzLeph1oVQq2hQByKZYMyVLCjMaZ2J-K" astar: "https://evm.astar.network" moonbeam: "https://rpc.api.moonbeam.network" unique: "https://rpc.unique.network" @@ -59,8 +59,8 @@ polkadotAccounts: apiKeys: ethereumBlockExplorer: "xEakmyYnTV2XB7xluT3Ot6PYhf4M3OuE" polygonBlockExplorer: "C0cILVib97lQAQ_y32UsM-0Rb3n8Tozj" - alchemy: "zyd0WGIMKdIdBGhDYX9bGwD7iVshxdCi" - nftstorage: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6ZXRocjoweEIwNGU5YzMyNzczNjI1MEQ0QTkzQjZmYThjODUwNzQwQkI0N0YyMmYiLCJpc3MiOiJuZnQtc3RvcmFnZSIsImlhdCI6MTcwNDgzMTk2NjUxNiwibmFtZSI6IndhbHRfaWRfbmV3In0.US2XREzruFyovZKHTzRn_TXOJg9mxo1YVUL5JvdHuZ4" + alchemy: "JzLeph1oVQq2hQByKZYMyVLCjMaZ2J-K" + nftstorage: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6ZXRocjoweEIwNGU5YzMyNzczNjI1MEQ0QTkzQjZmYThjODUwNzQwQkI0N0YyMmYiLCJpc3MiOiJuZnQtc3RvcmFnZSIsImlhdCI6MTcxMzE4Nzg3MjQ3NywibmFtZSI6Im5ldyJ9.erLykT5fM3nFG1TkxYB9I2783wq9W6Iurn1FJch4OvI" subscan: "" shimmerBlockExplorer: "52bb3024-d769-44e7-afa8-8845ee4a4419" From eccb8bfea3704e2de8307a706b834e39c8ceb045 Mon Sep 17 00:00:00 2001 From: SuperBatata Date: Mon, 15 Apr 2024 16:51:48 +0100 Subject: [PATCH 2/3] fix : added support to Amoy , previously Mumbai --- build.gradle.kts | 1 + src/main/kotlin/id/walt/nftkit/Values.kt | 8 ++--- .../chains/evm/erc721/Erc721TokenStandard.kt | 18 +++++----- .../evm/erc721/SoulBoundTokenStandard.kt | 4 +-- .../nftkit/services/AccessControlService.kt | 8 ++--- .../walt/nftkit/services/ExtensionsService.kt | 4 +-- .../id/walt/nftkit/services/NftService.kt | 6 ++-- .../id/walt/nftkit/services/WaltIdServices.kt | 4 +-- .../kotlin/id/walt/nftkit/utilis/Common.kt | 6 ++-- .../utilis/providers/ProviderFactory.kt | 2 +- src/main/resources/walt-default.yaml | 2 +- .../evm/Erc721Standard.kt | 14 ++++---- .../evm/EvmBasedAccessControl.kt | 6 ++-- .../evm/EvmBasedOwnershipVerification.kt | 4 +-- .../evm/EvmBasedSCExtensions.kt | 2 +- .../evm/Erc721Standard.kt | 14 ++++---- .../evm/EvmBasedAccessControl.kt | 24 ++++++------- .../evm/EvmBasedSCExtensions.kt | 36 +++++++++---------- 18 files changed, 82 insertions(+), 81 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 89497c62..8770749f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -94,6 +94,7 @@ tasks.withType { // > gradle build -PrunIntegrationTests if (!project.hasProperty("runIntegrationTests")) { exclude("id/walt/nftkit/blockchainTransactionsCalls/**") + exclude("id/walt/nftkit/blockchainReadingOperations/**") } } diff --git a/src/main/kotlin/id/walt/nftkit/Values.kt b/src/main/kotlin/id/walt/nftkit/Values.kt index ef32b72d..55e2dc2c 100644 --- a/src/main/kotlin/id/walt/nftkit/Values.kt +++ b/src/main/kotlin/id/walt/nftkit/Values.kt @@ -8,7 +8,7 @@ object Values { const val ETHEREUM_TESTNET_GOERLI_CHAIN_ID: Long = 5 const val ETHEREUM_TESTNET_SEPOLIA_CHAIN_ID: Long = 11155111 const val POLYGON_MAINNET_CHAIN_ID: Long = 137 - const val POLYGON_TESTNET_MUMBAI_CHAIN_ID: Long = 80001 + const val POLYGON_TESTNET_AMOY_CHAIN_ID: Long = 80002 const val MOONBEAM_MAINNET_CHAIN_ID: Long = 1284 const val ASTAR_MAINNET_CHAIN_ID: Long = 592 const val SHIMMEREVM_TESTNET_CHAIN_ID: Long = 1073 @@ -18,21 +18,21 @@ object Values { const val ETHEREUM_TESTNET_GOERLI_SCAN_API_URL = "api-goerli.etherscan.io" const val ETHEREUM_TESTNET_SEPOLIA_SCAN_API_URL = "api-sepolia.etherscan.io" const val POLYGON_MAINNET_SCAN_API_URL = "api.polygonscan.com" - const val POLYGON_TESTNET_MUMBAI_SCAN_API_URL = "api-testnet.polygonscan.com" + const val POLYGON_TESTNET_AMOY_SCAN_API_URL = "api-testnet.polygonscan.com" const val SHIMMEREVM_APPCHAIN_BLOCK_EXPLORER_URL = "" const val ETHEREUM_MAINNET_BLOCK_EXPLORER_URL = "https://etherscan.io" const val ETHEREUM_TESTNET_GOERLI_BLOCK_EXPLORER_URL = "https://goerli.etherscan.io/" const val ETHEREUM_TESTNET_SEPOLIA_BLOCK_EXPLORER_URL = "https://sepolia.etherscan.io/" const val POLYGON_MAINNET_BLOCK_EXPLORER_URL = "https://polygonscan.com" - const val POLYGON_TESTNET_MUMBAI_BLOCK_EXPLORER_URL = "https://mumbai.polygonscan.com" + const val POLYGON_TESTNET_AMOY_BLOCK_EXPLORER_URL = "https://www.oklink.com/amoy" const val SHIMMEREVM_TESTNET_BLOCK_EXPLORER_URL = "https://explorer.evm.testnet.shimmer.network/" const val ETHEREUM_MAINNET_ALCHEMY_URL = "https://eth-mainnet.alchemyapi.io/v2/" const val ETHEREUM_TESTNET_GOERLI_ALCHEMY_URL = "https://eth-goerli.g.alchemy.com/v2/" const val ETHEREUM_TESTNET_SEPOLIA_ALCHEMY_URL = "https://eth-sepolia.g.alchemy.com/v2/" const val POLYGON_MAINNET_ALCHEMY_URL = "https://polygon-mainnet.g.alchemy.com/v2/" - const val POLYGON_TESTNET_MUMBAI_ALCHEMY_URL = "https://polygon-mumbai.g.alchemy.com/v2/" + const val POLYGON_TESTNET_AMOY_ALCHEMY_URL = "https://polygon-amoy.g.alchemy.com/v2/" const val TEZOS_MAINNET_BETTER_CALL_DEV = "https://better-call.dev/mainnet" const val TEZOS_GHOSTNET_BETTER_CALL_DEV = "https://better-call.dev/ghostnet" diff --git a/src/main/kotlin/id/walt/nftkit/chains/evm/erc721/Erc721TokenStandard.kt b/src/main/kotlin/id/walt/nftkit/chains/evm/erc721/Erc721TokenStandard.kt index 27cda554..1a6c88fc 100644 --- a/src/main/kotlin/id/walt/nftkit/chains/evm/erc721/Erc721TokenStandard.kt +++ b/src/main/kotlin/id/walt/nftkit/chains/evm/erc721/Erc721TokenStandard.kt @@ -30,12 +30,12 @@ object Erc721TokenStandard : IErc721TokenStandard { val credentials: Credentials = Credentials.create(WaltIdServices.loadChainConfig().privateKey) val gasProvider: ContractGasProvider = WaltIdGasProvider val remotCall : RemoteCall - if(chain == Chain.POLYGON || chain == Chain.MUMBAI){ + if(chain == Chain.POLYGON || chain == Chain.AMOY){ val chainId : Long if(chain == Chain.POLYGON){ chainId = Values.POLYGON_MAINNET_CHAIN_ID }else{ - chainId = Values.POLYGON_TESTNET_MUMBAI_CHAIN_ID + chainId = Values.POLYGON_TESTNET_AMOY_CHAIN_ID } val transactionManager: TransactionManager = RawTransactionManager( web3j, credentials, chainId @@ -182,12 +182,12 @@ object Erc721TokenStandard : IErc721TokenStandard { val credentials: Credentials = Credentials.create(WaltIdServices.loadChainConfig().privateKey) val gasProvider: ContractGasProvider = WaltIdGasProvider val remotCall: RemoteCall - if (chain == EVMChain.POLYGON || chain == EVMChain.MUMBAI) { + if (chain == EVMChain.POLYGON || chain == EVMChain.AMOY) { val chainId: Long if (chain == EVMChain.POLYGON) { chainId = Values.POLYGON_MAINNET_CHAIN_ID } else { - chainId = Values.POLYGON_TESTNET_MUMBAI_CHAIN_ID + chainId = Values.POLYGON_TESTNET_AMOY_CHAIN_ID } val transactionManager: TransactionManager = RawTransactionManager( web3j, credentials, chainId @@ -228,12 +228,12 @@ object Erc721TokenStandard : IErc721TokenStandard { val credentials: Credentials = Credentials.create(WaltIdServices.loadChainConfig().privateKey) val gasProvider: ContractGasProvider = WaltIdGasProvider val remotCall: RemoteCall - if (chain == EVMChain.POLYGON || chain == EVMChain.MUMBAI) { + if (chain == EVMChain.POLYGON || chain == EVMChain.AMOY) { val chainId: Long if (chain == EVMChain.POLYGON) { chainId = Values.POLYGON_MAINNET_CHAIN_ID } else { - chainId = Values.POLYGON_TESTNET_MUMBAI_CHAIN_ID + chainId = Values.POLYGON_TESTNET_AMOY_CHAIN_ID } val transactionManager: TransactionManager = RawTransactionManager( web3j, credentials, chainId @@ -290,7 +290,7 @@ object Erc721TokenStandard : IErc721TokenStandard { EVMChain.GOERLI -> Values.ETHEREUM_TESTNET_GOERLI_CHAIN_ID EVMChain.SEPOLIA -> Values.ETHEREUM_TESTNET_SEPOLIA_CHAIN_ID EVMChain.POLYGON -> Values.POLYGON_MAINNET_CHAIN_ID - EVMChain.MUMBAI -> Values.POLYGON_TESTNET_MUMBAI_CHAIN_ID + EVMChain.AMOY -> Values.POLYGON_TESTNET_AMOY_CHAIN_ID EVMChain.ASTAR -> Values.ASTAR_MAINNET_CHAIN_ID EVMChain.MOONBEAM -> Values.MOONBEAM_MAINNET_CHAIN_ID EVMChain.SHIMMEREVM -> Values.SHIMMEREVM_TESTNET_CHAIN_ID @@ -300,12 +300,12 @@ object Erc721TokenStandard : IErc721TokenStandard { web3j, credentials, chainId ) return CustomOwnableERC721.load(address, web3j,transactionManager,gasProvider) - /*if (chain == EVMChain.POLYGON || chain == EVMChain.MUMBAI) { + /*if (chain == EVMChain.POLYGON || chain == EVMChain.AMOY) { val chainId: Long if (chain == EVMChain.POLYGON) { chainId = Values.POLYGON_MAINNET_CHAIN_ID } else { - chainId = Values.POLYGON_TESTNET_MUMBAI_CHAIN_ID + chainId = Values.POLYGON_TESTNET_AMOY_CHAIN_ID } val transactionManager: TransactionManager = RawTransactionManager( web3j, credentials, chainId diff --git a/src/main/kotlin/id/walt/nftkit/chains/evm/erc721/SoulBoundTokenStandard.kt b/src/main/kotlin/id/walt/nftkit/chains/evm/erc721/SoulBoundTokenStandard.kt index 012c988e..e3fef8eb 100644 --- a/src/main/kotlin/id/walt/nftkit/chains/evm/erc721/SoulBoundTokenStandard.kt +++ b/src/main/kotlin/id/walt/nftkit/chains/evm/erc721/SoulBoundTokenStandard.kt @@ -45,7 +45,7 @@ object SoulBoundTokenStandard : ISoulBoundTokenStandard { EVMChain.GOERLI -> Values.ETHEREUM_TESTNET_GOERLI_CHAIN_ID EVMChain.SEPOLIA -> Values.ETHEREUM_TESTNET_SEPOLIA_CHAIN_ID EVMChain.POLYGON -> Values.POLYGON_MAINNET_CHAIN_ID - EVMChain.MUMBAI -> Values.POLYGON_TESTNET_MUMBAI_CHAIN_ID + EVMChain.AMOY -> Values.POLYGON_TESTNET_AMOY_CHAIN_ID EVMChain.ASTAR -> Values.ASTAR_MAINNET_CHAIN_ID EVMChain.MOONBEAM -> Values.MOONBEAM_MAINNET_CHAIN_ID EVMChain.SHIMMEREVM -> Values.SHIMMEREVM_TESTNET_CHAIN_ID @@ -102,7 +102,7 @@ object SoulBoundTokenStandard : ISoulBoundTokenStandard { EVMChain.GOERLI -> Values.ETHEREUM_TESTNET_GOERLI_CHAIN_ID EVMChain.SEPOLIA -> Values.ETHEREUM_TESTNET_SEPOLIA_CHAIN_ID EVMChain.POLYGON -> Values.POLYGON_MAINNET_CHAIN_ID - EVMChain.MUMBAI -> Values.POLYGON_TESTNET_MUMBAI_CHAIN_ID + EVMChain.AMOY -> Values.POLYGON_TESTNET_AMOY_CHAIN_ID EVMChain.ASTAR -> Values.ASTAR_MAINNET_CHAIN_ID EVMChain.MOONBEAM -> Values.MOONBEAM_MAINNET_CHAIN_ID EVMChain.SHIMMEREVM -> Values.SHIMMEREVM_TESTNET_CHAIN_ID diff --git a/src/main/kotlin/id/walt/nftkit/services/AccessControlService.kt b/src/main/kotlin/id/walt/nftkit/services/AccessControlService.kt index c8ec98cc..0d8e4776 100644 --- a/src/main/kotlin/id/walt/nftkit/services/AccessControlService.kt +++ b/src/main/kotlin/id/walt/nftkit/services/AccessControlService.kt @@ -88,12 +88,12 @@ object AccessControlService { val gasProvider: ContractGasProvider = WaltIdGasProvider - if (chain == EVMChain.POLYGON || chain == EVMChain.MUMBAI) { + if (chain == EVMChain.POLYGON || chain == EVMChain.AMOY) { val chainId: Long if (chain == EVMChain.POLYGON) { chainId = Values.POLYGON_MAINNET_CHAIN_ID } else { - chainId = Values.POLYGON_TESTNET_MUMBAI_CHAIN_ID + chainId = Values.POLYGON_TESTNET_AMOY_CHAIN_ID } val transactionManager: TransactionManager = RawTransactionManager( web3j, credentials, chainId @@ -111,12 +111,12 @@ object AccessControlService { val gasProvider: ContractGasProvider = WaltIdGasProvider - if (chain == EVMChain.POLYGON || chain == EVMChain.MUMBAI) { + if (chain == EVMChain.POLYGON || chain == EVMChain.AMOY) { val chainId: Long if (chain == EVMChain.POLYGON) { chainId = Values.POLYGON_MAINNET_CHAIN_ID } else { - chainId = Values.POLYGON_TESTNET_MUMBAI_CHAIN_ID + chainId = Values.POLYGON_TESTNET_AMOY_CHAIN_ID } val transactionManager: TransactionManager = RawTransactionManager( web3j, credentials, chainId diff --git a/src/main/kotlin/id/walt/nftkit/services/ExtensionsService.kt b/src/main/kotlin/id/walt/nftkit/services/ExtensionsService.kt index 9be7df24..b868c479 100644 --- a/src/main/kotlin/id/walt/nftkit/services/ExtensionsService.kt +++ b/src/main/kotlin/id/walt/nftkit/services/ExtensionsService.kt @@ -93,12 +93,12 @@ object ExtensionsService { val gasProvider: ContractGasProvider = WaltIdGasProvider - if (chain == EVMChain.POLYGON || chain == EVMChain.MUMBAI) { + if (chain == EVMChain.POLYGON || chain == EVMChain.AMOY) { val chainId: Long if (chain == EVMChain.POLYGON) { chainId = Values.POLYGON_MAINNET_CHAIN_ID } else { - chainId = Values.POLYGON_TESTNET_MUMBAI_CHAIN_ID + chainId = Values.POLYGON_TESTNET_AMOY_CHAIN_ID } val transactionManager: TransactionManager = RawTransactionManager( web3j, credentials, chainId diff --git a/src/main/kotlin/id/walt/nftkit/services/NftService.kt b/src/main/kotlin/id/walt/nftkit/services/NftService.kt index b34867e1..8b211f1c 100644 --- a/src/main/kotlin/id/walt/nftkit/services/NftService.kt +++ b/src/main/kotlin/id/walt/nftkit/services/NftService.kt @@ -81,7 +81,7 @@ enum class Chain { POLYGON, GOERLI, SEPOLIA, - MUMBAI, + AMOY, TEZOS, GHOSTNET, MAINNET, @@ -103,7 +103,7 @@ enum class EVMChain { POLYGON, GOERLI, SEPOLIA, - MUMBAI, + AMOY, ASTAR, MOONBEAM, SHIMMEREVM, @@ -538,7 +538,7 @@ object NftService { Chain.GOERLI -> Values.ETHEREUM_TESTNET_GOERLI_ALCHEMY_URL Chain.SEPOLIA -> Values.ETHEREUM_TESTNET_SEPOLIA_ALCHEMY_URL Chain.POLYGON -> Values.POLYGON_MAINNET_ALCHEMY_URL - Chain.MUMBAI -> Values.POLYGON_TESTNET_MUMBAI_ALCHEMY_URL + Chain.AMOY -> Values.POLYGON_TESTNET_AMOY_ALCHEMY_URL Chain.SHIMMEREVM -> Values.SHIMMEREVM_TESTNET_BLOCK_EXPLORER_URL Chain.TEZOS -> throw Exception("Tezos is not supported") Chain.GHOSTNET -> throw Exception("Ghostnet is not supported") diff --git a/src/main/kotlin/id/walt/nftkit/services/WaltIdServices.kt b/src/main/kotlin/id/walt/nftkit/services/WaltIdServices.kt index 43d0dabf..93ec98bb 100644 --- a/src/main/kotlin/id/walt/nftkit/services/WaltIdServices.kt +++ b/src/main/kotlin/id/walt/nftkit/services/WaltIdServices.kt @@ -13,7 +13,7 @@ data class Providers( val goerli: String, val sepolia: String, val polygon: String, - val mumbai: String, + val amoy: String, val astar: String, val moonbeam: String, val opal: String, @@ -145,7 +145,7 @@ object WaltIdServices { EVMChain.GOERLI -> Values.ETHEREUM_TESTNET_GOERLI_BLOCK_EXPLORER_URL EVMChain.SEPOLIA -> Values.ETHEREUM_TESTNET_SEPOLIA_BLOCK_EXPLORER_URL EVMChain.POLYGON -> Values.POLYGON_MAINNET_BLOCK_EXPLORER_URL - EVMChain.MUMBAI -> Values.POLYGON_TESTNET_MUMBAI_BLOCK_EXPLORER_URL + EVMChain.AMOY -> Values.POLYGON_TESTNET_AMOY_BLOCK_EXPLORER_URL EVMChain.SHIMMEREVM -> Values.SHIMMEREVM_TESTNET_BLOCK_EXPLORER_URL EVMChain.SHIMMEREVM_APPCHAIN -> Values.SHIMMEREVM_APPCHAIN_BLOCK_EXPLORER_URL else -> { diff --git a/src/main/kotlin/id/walt/nftkit/utilis/Common.kt b/src/main/kotlin/id/walt/nftkit/utilis/Common.kt index 05cda467..2e48c2fd 100644 --- a/src/main/kotlin/id/walt/nftkit/utilis/Common.kt +++ b/src/main/kotlin/id/walt/nftkit/utilis/Common.kt @@ -96,7 +96,7 @@ object Common { EVMChain.GOERLI -> Values.ETHEREUM_TESTNET_GOERLI_SCAN_API_URL EVMChain.SEPOLIA -> Values.ETHEREUM_TESTNET_SEPOLIA_SCAN_API_URL EVMChain.POLYGON -> Values.POLYGON_MAINNET_SCAN_API_URL - EVMChain.MUMBAI -> Values.POLYGON_TESTNET_MUMBAI_SCAN_API_URL + EVMChain.AMOY -> Values.POLYGON_TESTNET_AMOY_SCAN_API_URL else -> {throw Exception("$chain is not supported")} } } @@ -107,14 +107,14 @@ object Common { EVMChain.GOERLI -> WaltIdServices.loadApiKeys().apiKeys.ethereumBlockExplorer EVMChain.SEPOLIA -> WaltIdServices.loadApiKeys().apiKeys.ethereumBlockExplorer EVMChain.POLYGON -> WaltIdServices.loadApiKeys().apiKeys.polygonBlockExplorer - EVMChain.MUMBAI -> WaltIdServices.loadApiKeys().apiKeys.polygonBlockExplorer + EVMChain.AMOY -> WaltIdServices.loadApiKeys().apiKeys.polygonBlockExplorer EVMChain.SHIMMEREVM -> WaltIdServices.loadApiKeys().apiKeys.shimmerBlockExplorer else -> {throw Exception("$chain is not supported")} } } fun isEVMChain(chain: Chain): Boolean{ - val EVMChains= listOf(Chain.ETHEREUM, Chain.POLYGON, Chain.GOERLI, Chain.SEPOLIA, Chain.MUMBAI, Chain.SHIMMEREVM , Chain.SHIMMEREVM_APPCHAIN) + val EVMChains= listOf(Chain.ETHEREUM, Chain.POLYGON, Chain.GOERLI, Chain.SEPOLIA, Chain.AMOY, Chain.SHIMMEREVM , Chain.SHIMMEREVM_APPCHAIN) return chain in EVMChains } diff --git a/src/main/kotlin/id/walt/nftkit/utilis/providers/ProviderFactory.kt b/src/main/kotlin/id/walt/nftkit/utilis/providers/ProviderFactory.kt index 0bd6652d..2cfbf9b7 100644 --- a/src/main/kotlin/id/walt/nftkit/utilis/providers/ProviderFactory.kt +++ b/src/main/kotlin/id/walt/nftkit/utilis/providers/ProviderFactory.kt @@ -9,7 +9,7 @@ object ProviderFactory { EVMChain.GOERLI -> GoerliWeb3() EVMChain.SEPOLIA -> SepoliaWeb3() EVMChain.POLYGON -> PolygonWeb3() - EVMChain.MUMBAI -> MumbaiWeb3() + EVMChain.AMOY -> AmoyWeb3() EVMChain.ASTAR -> AstarWeb3() EVMChain.MOONBEAM -> MoonbeamWeb3() EVMChain.SHIMMEREVM -> IotaWeb3() diff --git a/src/main/resources/walt-default.yaml b/src/main/resources/walt-default.yaml index c2b3f3ad..9279f24d 100644 --- a/src/main/resources/walt-default.yaml +++ b/src/main/resources/walt-default.yaml @@ -16,7 +16,7 @@ providers: goerli: "https://eth-goerli.g.alchemy.com/v2/x4Ovq8l3SL30X4B3Uz7Q9aYhxVfxhIFg" sepolia: "https://eth-sepolia.g.alchemy.com/v2/FFX-XLBauFYuxdKDF5QUHCt7AlSGAs5q" polygon: "https://polygon-mainnet.g.alchemy.com/v2/SUV8QnbFOKnb5eMk5amGinUMCamjLT4l" - mumbai: "https://polygon-mumbai.g.alchemy.com/v2/JzLeph1oVQq2hQByKZYMyVLCjMaZ2J-K" + amoy: "https://polygon-amoy.g.alchemy.com/v2/JzLeph1oVQq2hQByKZYMyVLCjMaZ2J-K" astar: "https://evm.astar.network" moonbeam: "https://rpc.api.moonbeam.network" unique: "https://rpc.unique.network" diff --git a/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/Erc721Standard.kt b/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/Erc721Standard.kt index 23870fda..13b2fccc 100644 --- a/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/Erc721Standard.kt +++ b/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/Erc721Standard.kt @@ -15,7 +15,7 @@ class Erc721Standard : StringSpec({ "Verifying nft metadata".config(){ val tokenid = BigInteger.valueOf(3) - val result = NftService.getNftMetadata(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", tokenid ) + val result = NftService.getNftMetadata(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", tokenid ) result.name shouldBe "Ticket #1" result.description shouldBe "Ticket #1 Description" @@ -23,12 +23,12 @@ class Erc721Standard : StringSpec({ "Verifying Metadata URI".config(){ val tokenid = BigInteger.valueOf(10) - val result = NftService.getNftMetadataUri(EVMChain.MUMBAI,"0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", tokenid ) + val result = NftService.getNftMetadataUri(EVMChain.AMOY,"0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", tokenid ) result shouldBe "ipfs://bafyreiebsxbmwmgrzlrhlpwj2mmz5j64vsfojfy7lviu22unkkmjdhfqt4/metadata.json" } "Verifying balance of address".config(){ - val result = NftService.balanceOf(EVMChain.MUMBAI, + val result = NftService.balanceOf(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", "0xe895D59e84d0E77a8DaEaA55547528406C5a1314") result shouldBe BigInteger.valueOf(2) @@ -36,14 +36,14 @@ class Erc721Standard : StringSpec({ "Verifying owner of a token".config(){ val tokenid = BigInteger.valueOf(35) - val result = NftService.ownerOf(EVMChain.MUMBAI, + val result = NftService.ownerOf(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", tokenid) result shouldBe "0xe895d59e84d0e77a8daeaa55547528406c5a1314" } "Verifying token collection info".config(){ - val result = NftService.getTokenCollectionInfo(EVMChain.MUMBAI, + val result = NftService.getTokenCollectionInfo(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517" ) result.name shouldBe "Ticket" result.symbol shouldBe "TK" @@ -51,7 +51,7 @@ class Erc721Standard : StringSpec({ //TODO: Fix https://docs.alchemy.com/reference/getnfts // "Verifying account NFTs by Alchmy".config(){ -// val result = NftService.getAccountNFTsByAlchemy(Chain.MUMBAI, +// val result = NftService.getAccountNFTsByAlchemy(Chain.AMOY, // "0xe895D59e84d0E77a8DaEaA55547528406C5a1314" ) // result[0].id.tokenId shouldBe "35" // result[1].id.tokenId shouldBe "36" @@ -60,7 +60,7 @@ class Erc721Standard : StringSpec({ "Verifying IPFS metadata using NFTs storage".config(){ val tokenid = BigInteger.valueOf(3) - var uri = NftService.getNftMetadataUri(EVMChain.MUMBAI,"0x7Bf34C715e9A7ADEc6c4fa1CFEE4120E2808fD8c" ,tokenid) + var uri = NftService.getNftMetadataUri(EVMChain.AMOY,"0x7Bf34C715e9A7ADEc6c4fa1CFEE4120E2808fD8c" ,tokenid) val result = NftService.getIPFSMetadataUsingNFTStorage(uri) result.description shouldBe "Walt Membership" result.name shouldBe "Walt Membership" diff --git a/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/EvmBasedAccessControl.kt b/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/EvmBasedAccessControl.kt index 2e4cdfa5..8ffad6eb 100644 --- a/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/EvmBasedAccessControl.kt +++ b/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/EvmBasedAccessControl.kt @@ -8,17 +8,17 @@ import io.kotest.matchers.shouldNotBe class EvmBasedAccessControl : StringSpec({ "Verify smart contract ownership".config() { - val result= AccessControlService.owner(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") + val result= AccessControlService.owner(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") result shouldBe "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31" } "Testing the role".config() { - val result = AccessControlService.hasRole(EVMChain.MUMBAI,"0xa5a0914988bAB4e773109969A9176855eA77FcfB", "MINTER_ROLE", "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31") + val result = AccessControlService.hasRole(EVMChain.AMOY,"0xa5a0914988bAB4e773109969A9176855eA77FcfB", "MINTER_ROLE", "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31") result shouldBe true } "Get admin of an account".config(){ - val result = AccessControlService.getRoleAdmin(EVMChain.MUMBAI, "0xa5a0914988bAB4e773109969A9176855eA77FcfB","MINTER_ROLE") + val result = AccessControlService.getRoleAdmin(EVMChain.AMOY, "0xa5a0914988bAB4e773109969A9176855eA77FcfB","MINTER_ROLE") result shouldBe "00000000000000000000000000000000" } diff --git a/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/EvmBasedOwnershipVerification.kt b/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/EvmBasedOwnershipVerification.kt index 0f0ec6fc..a5862b97 100644 --- a/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/EvmBasedOwnershipVerification.kt +++ b/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/EvmBasedOwnershipVerification.kt @@ -11,12 +11,12 @@ class EvmBasedOwnershipVerification : StringSpec({ "Verify NFT ownership".config() { - val result= VerificationService.verifyNftOwnership(Chain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", "0x2555e3a97c4ac9705d70b9e5b9b6cc6fe2977a74", "1") + val result= VerificationService.verifyNftOwnership(Chain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", "0x2555e3a97c4ac9705d70b9e5b9b6cc6fe2977a74", "1") result shouldBe true } "verify trait type and trait value in the metadata".config(){ - val resTrue = VerificationService.verifyNftOwnershipWithTraits(Chain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", "0x2555e3a97c4ac9705d70b9e5b9b6cc6fe2977a74","3", traitType="Trait 1", traitValue = "Value 1" ) + val resTrue = VerificationService.verifyNftOwnershipWithTraits(Chain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", "0x2555e3a97c4ac9705d70b9e5b9b6cc6fe2977a74","3", traitType="Trait 1", traitValue = "Value 1" ) resTrue shouldBe true } diff --git a/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/EvmBasedSCExtensions.kt b/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/EvmBasedSCExtensions.kt index 0f7ad9c2..b30aca73 100644 --- a/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/EvmBasedSCExtensions.kt +++ b/src/test/kotlin/id/walt/nftkit/blockchainReadingOperations/evm/EvmBasedSCExtensions.kt @@ -15,7 +15,7 @@ class EvmBasedSCExtensions : StringSpec({ "Verifying Smart contract state ".config() { - val result= ExtensionsService.paused(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") + val result= ExtensionsService.paused(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") result shouldBe false } diff --git a/src/test/kotlin/id/walt/nftkit/blockchainTransactionsCalls/evm/Erc721Standard.kt b/src/test/kotlin/id/walt/nftkit/blockchainTransactionsCalls/evm/Erc721Standard.kt index c1701243..58cf4c2c 100644 --- a/src/test/kotlin/id/walt/nftkit/blockchainTransactionsCalls/evm/Erc721Standard.kt +++ b/src/test/kotlin/id/walt/nftkit/blockchainTransactionsCalls/evm/Erc721Standard.kt @@ -17,14 +17,14 @@ class Erc721Standard : StringSpec({ "Smart contract deployment".config() { val deploymentOptions = DeploymentOptions(AccessControl.OWNABLE, TokenStandard.ERC721) val deploymentParameter = DeploymentParameter("Metaverse", "MTV", DeploymentParameter.Options(true, true)) - val result = NftService.deploySmartContractToken(EVMChain.MUMBAI, deploymentParameter, deploymentOptions) + val result = NftService.deploySmartContractToken(EVMChain.AMOY, deploymentParameter, deploymentOptions) val privateKey= WaltIdServices.loadChainConfig().privateKey val credentials: Credentials = Credentials.create(privateKey) result.contractAddress shouldNotBe "" result.contractAddress shouldNotBe null - val owner = AccessControlService.owner(EVMChain.MUMBAI, result.contractAddress) + val owner = AccessControlService.owner(EVMChain.AMOY, result.contractAddress) owner shouldBe credentials.address - val checkInfo = NftService.getTokenCollectionInfo(EVMChain.MUMBAI, result.contractAddress ) + val checkInfo = NftService.getTokenCollectionInfo(EVMChain.AMOY, result.contractAddress ) checkInfo.name shouldBe "Metaverse" checkInfo.symbol shouldBe "MTV" } @@ -33,8 +33,8 @@ class Erc721Standard : StringSpec({ val nftMetaData = NftMetadata("Ticket 2 description", "Ticket 2", "string", "string","string") val mintingParametre = MintingParameter(metadataUri = "", recipientAddress="0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31", metadata = nftMetaData ) val mintingOption = MintingOptions(MetadataStorageType.ON_CHAIN) - val result = NftService.mintToken(EVMChain.MUMBAI, contractAddress = "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517",mintingParametre, mintingOption , false) - val newNFT = NftService.getNftMetadata(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", result.tokenId!!) + val result = NftService.mintToken(EVMChain.AMOY, contractAddress = "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517",mintingParametre, mintingOption , false) + val newNFT = NftService.getNftMetadata(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", result.tokenId!!) result.tokenId shouldNotBe null newNFT shouldBe nftMetaData } @@ -42,14 +42,14 @@ class Erc721Standard : StringSpec({ "Setting metadata".config(){ val sdf = SimpleDateFormat("dd/M/yyyy hh:mm:ss") val currentDate = sdf.format(Date()) - val result = NftService.updateMetadata(chain=EVMChain.MUMBAI, + val result = NftService.updateMetadata(chain=EVMChain.AMOY, contractAddress = "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", tokenId="5", key= "t1", value= currentDate, signedAccount = null ) - val check = NftService.getNftMetadata(chain=EVMChain.MUMBAI, contractAddress = "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", tokenId=BigInteger.valueOf(5)) + val check = NftService.getNftMetadata(chain=EVMChain.AMOY, contractAddress = "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", tokenId=BigInteger.valueOf(5)) check.attributes!![0].value shouldBe currentDate result.transactionId shouldNotBe null } diff --git a/src/test/kotlin/id/walt/nftkit/blockchainTransactionsCalls/evm/EvmBasedAccessControl.kt b/src/test/kotlin/id/walt/nftkit/blockchainTransactionsCalls/evm/EvmBasedAccessControl.kt index e51979cb..452a35fc 100644 --- a/src/test/kotlin/id/walt/nftkit/blockchainTransactionsCalls/evm/EvmBasedAccessControl.kt +++ b/src/test/kotlin/id/walt/nftkit/blockchainTransactionsCalls/evm/EvmBasedAccessControl.kt @@ -8,11 +8,11 @@ import io.kotest.matchers.shouldNotBe class EvmBasedAccessControl : StringSpec({ "Transfer ownership of smart contract".config(){ - val result = AccessControlService.transferOwnership(EVMChain.MUMBAI, + val result = AccessControlService.transferOwnership(EVMChain.AMOY, "0x41ffba64969ab4d8a4ac7fae765e4fc1dd30290b", "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31" ) - val nOwner= AccessControlService.owner(EVMChain.MUMBAI, "0x41ffba64969ab4d8a4ac7fae765e4fc1dd30290b") + val nOwner= AccessControlService.owner(EVMChain.AMOY, "0x41ffba64969ab4d8a4ac7fae765e4fc1dd30290b") nOwner shouldBe "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31" result.transactionId shouldNotBe null } @@ -20,9 +20,9 @@ class EvmBasedAccessControl : StringSpec({ "Renounce ownership of smart contract".config(){ val deploymentOptions = DeploymentOptions(AccessControl.OWNABLE, TokenStandard.ERC721) val deploymentParameter = DeploymentParameter("Metaverse", "MTV", DeploymentParameter.Options(true, true)) - val SC = NftService.deploySmartContractToken(EVMChain.MUMBAI, deploymentParameter, deploymentOptions) - val result = AccessControlService.renounceOwnership(EVMChain.MUMBAI, SC.contractAddress) - val checkOwnership = AccessControlService.owner(EVMChain.MUMBAI, SC.contractAddress) + val SC = NftService.deploySmartContractToken(EVMChain.AMOY, deploymentParameter, deploymentOptions) + val result = AccessControlService.renounceOwnership(EVMChain.AMOY, SC.contractAddress) + val checkOwnership = AccessControlService.owner(EVMChain.AMOY, SC.contractAddress) result.transactionId shouldNotBe null checkOwnership shouldBe "0x0000000000000000000000000000000000000000" @@ -30,14 +30,14 @@ class EvmBasedAccessControl : StringSpec({ "Granting role".config(){ - var hadRole = AccessControlService.hasRole(EVMChain.MUMBAI, "0xa5a0914988bAB4e773109969A9176855eA77FcfB", "MINTER_ROLE" , "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31") + var hadRole = AccessControlService.hasRole(EVMChain.AMOY, "0xa5a0914988bAB4e773109969A9176855eA77FcfB", "MINTER_ROLE" , "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31") if (hadRole){ - val revoke = AccessControlService.revokeRole(EVMChain.MUMBAI, "0xa5a0914988bAB4e773109969A9176855eA77FcfB", "MINTER_ROLE", "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31") - hadRole = AccessControlService.hasRole(EVMChain.MUMBAI, "0xa5a0914988bAB4e773109969A9176855eA77FcfB", "MINTER_ROLE" , "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31") + val revoke = AccessControlService.revokeRole(EVMChain.AMOY, "0xa5a0914988bAB4e773109969A9176855eA77FcfB", "MINTER_ROLE", "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31") + hadRole = AccessControlService.hasRole(EVMChain.AMOY, "0xa5a0914988bAB4e773109969A9176855eA77FcfB", "MINTER_ROLE" , "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31") } - val result = AccessControlService.grantRole(EVMChain.MUMBAI,"0xa5a0914988bAB4e773109969A9176855eA77FcfB", role="MINTER_ROLE" , "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31" ) - val checkGrantedRole = AccessControlService.hasRole(EVMChain.MUMBAI, "0xa5a0914988bAB4e773109969A9176855eA77FcfB", "MINTER_ROLE" , "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31") + val result = AccessControlService.grantRole(EVMChain.AMOY,"0xa5a0914988bAB4e773109969A9176855eA77FcfB", role="MINTER_ROLE" , "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31" ) + val checkGrantedRole = AccessControlService.hasRole(EVMChain.AMOY, "0xa5a0914988bAB4e773109969A9176855eA77FcfB", "MINTER_ROLE" , "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31") result.transactionId shouldNotBe null hadRole shouldBe false checkGrantedRole shouldBe true @@ -45,8 +45,8 @@ class EvmBasedAccessControl : StringSpec({ "Revoking role".config(){ - val result = AccessControlService.revokeRole(EVMChain.MUMBAI,"0xa5a0914988bAB4e773109969A9176855eA77FcfB","MINTER_ROLE" , "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31" ) - val checkRole = AccessControlService.hasRole(EVMChain.MUMBAI, "0xa5a0914988bAB4e773109969A9176855eA77FcfB", "MINTER_ROLE" , "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31") + val result = AccessControlService.revokeRole(EVMChain.AMOY,"0xa5a0914988bAB4e773109969A9176855eA77FcfB","MINTER_ROLE" , "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31" ) + val checkRole = AccessControlService.hasRole(EVMChain.AMOY, "0xa5a0914988bAB4e773109969A9176855eA77FcfB", "MINTER_ROLE" , "0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31") result.transactionId shouldNotBe null checkRole shouldBe false } diff --git a/src/test/kotlin/id/walt/nftkit/blockchainTransactionsCalls/evm/EvmBasedSCExtensions.kt b/src/test/kotlin/id/walt/nftkit/blockchainTransactionsCalls/evm/EvmBasedSCExtensions.kt index 25edf3f8..02043638 100644 --- a/src/test/kotlin/id/walt/nftkit/blockchainTransactionsCalls/evm/EvmBasedSCExtensions.kt +++ b/src/test/kotlin/id/walt/nftkit/blockchainTransactionsCalls/evm/EvmBasedSCExtensions.kt @@ -14,21 +14,21 @@ import java.util.* class EvmBasedSCExtensions : StringSpec({ "Smart contract pause function ".config() { - val result= ExtensionsService.pause(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") - val pausedValue= ExtensionsService.paused(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") + val result= ExtensionsService.pause(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") + val pausedValue= ExtensionsService.paused(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") pausedValue shouldBe true result.transactionId shouldNotBe null } "Smart contract unpause function ".config() { - val result= ExtensionsService.unpause(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") - val pausedValue= ExtensionsService.paused(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") + val result= ExtensionsService.unpause(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") + val pausedValue= ExtensionsService.paused(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") pausedValue shouldBe false result.transactionId shouldNotBe null } "Setting token URI".config(){ - val oldURI = NftService.getNftMetadataUri(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", BigInteger.valueOf(4) ) + val oldURI = NftService.getNftMetadataUri(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", BigInteger.valueOf(4) ) val sdf = SimpleDateFormat("dd/M/yyyy hh:mm:ss") val currentDate = sdf.format(Date()) val metadata = NftMetadata( @@ -40,24 +40,24 @@ class EvmBasedSCExtensions : StringSpec({ attributes = null ) val param = UpdateTokenURIRequest("",metadata) - val result = ExtensionsService.setTokenURI(EVMChain.MUMBAI,"0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", "4",signedAccount = null ,parameter = param ) - val newURI = NftService.getNftMetadataUri(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", BigInteger.valueOf(4)) + val result = ExtensionsService.setTokenURI(EVMChain.AMOY,"0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", "4",signedAccount = null ,parameter = param ) + val newURI = NftService.getNftMetadataUri(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", BigInteger.valueOf(4)) newURI shouldNotBe oldURI result.transactionId shouldNotBe null } "Changing transferable status".config(){ - val oldT = ExtensionsService.getTransferable(EVMChain.MUMBAI,"0xf277BE034881eE38A9b270E5b6C5c6f333Af2517" ) - val result = ExtensionsService.setTransferable(EVMChain.MUMBAI,"0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", !oldT ) - val newT = ExtensionsService.getTransferable(EVMChain.MUMBAI,"0xf277BE034881eE38A9b270E5b6C5c6f333Af2517" ) + val oldT = ExtensionsService.getTransferable(EVMChain.AMOY,"0xf277BE034881eE38A9b270E5b6C5c6f333Af2517" ) + val result = ExtensionsService.setTransferable(EVMChain.AMOY,"0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", !oldT ) + val newT = ExtensionsService.getTransferable(EVMChain.AMOY,"0xf277BE034881eE38A9b270E5b6C5c6f333Af2517" ) result.transactionId shouldNotBe null newT shouldBe !oldT } "Changing burnable status".config() { - val oldB = ExtensionsService.getBurnable(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") - val result = ExtensionsService.setBurnable(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", !oldB) - val newB = ExtensionsService.getBurnable(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") + val oldB = ExtensionsService.getBurnable(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") + val result = ExtensionsService.setBurnable(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", !oldB) + val newB = ExtensionsService.getBurnable(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517") result.transactionId shouldNotBe null newB shouldBe !oldB } @@ -66,18 +66,18 @@ class EvmBasedSCExtensions : StringSpec({ val nftMetaData = NftMetadata("To burn", "To burn", "string", "string","string") val mintingParametre = MintingParameter(metadataUri = "", recipientAddress="0xaf87c5ce7a1fb6bd5aadb6dd9c0b8ef51ef1bc31", metadata = nftMetaData ) val mintingOption = MintingOptions(MetadataStorageType.ON_CHAIN) - val newNftId = NftService.mintToken(EVMChain.MUMBAI, contractAddress = "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517",mintingParametre, mintingOption ,false).tokenId - if (!(ExtensionsService.getBurnable(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517"))) - {ExtensionsService.setBurnable(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", true) } + val newNftId = NftService.mintToken(EVMChain.AMOY, contractAddress = "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517",mintingParametre, mintingOption ,false).tokenId + if (!(ExtensionsService.getBurnable(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517"))) + {ExtensionsService.setBurnable(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", true) } val result = newNftId?.let { ExtensionsService.burn( - EVMChain.MUMBAI, + EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", it ) } if (result != null) { - shouldThrow { NftService.getNftMetadataUri(EVMChain.MUMBAI, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", newNftId) } + shouldThrow { NftService.getNftMetadataUri(EVMChain.AMOY, "0xf277BE034881eE38A9b270E5b6C5c6f333Af2517", newNftId) } result.transactionId shouldNotBe null } } From 3efd9bf81684e929322c617b38105f04db692bf1 Mon Sep 17 00:00:00 2001 From: SuperBatata Date: Mon, 15 Apr 2024 16:51:52 +0100 Subject: [PATCH 3/3] fix : added support to Amoy , previously Mumbai --- .../nftkit/utilis/providers/{MumbaiWeb3.kt => AmoyWeb3.kt} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename src/main/kotlin/id/walt/nftkit/utilis/providers/{MumbaiWeb3.kt => AmoyWeb3.kt} (81%) diff --git a/src/main/kotlin/id/walt/nftkit/utilis/providers/MumbaiWeb3.kt b/src/main/kotlin/id/walt/nftkit/utilis/providers/AmoyWeb3.kt similarity index 81% rename from src/main/kotlin/id/walt/nftkit/utilis/providers/MumbaiWeb3.kt rename to src/main/kotlin/id/walt/nftkit/utilis/providers/AmoyWeb3.kt index 6d8f1b4c..4b3cd079 100644 --- a/src/main/kotlin/id/walt/nftkit/utilis/providers/MumbaiWeb3.kt +++ b/src/main/kotlin/id/walt/nftkit/utilis/providers/AmoyWeb3.kt @@ -4,8 +4,8 @@ import id.walt.nftkit.services.WaltIdServices import org.web3j.protocol.Web3j import org.web3j.protocol.http.HttpService -class MumbaiWeb3 : Web3jInstance { +class AmoyWeb3 : Web3jInstance { override fun getWeb3j(): Web3j { - return Web3j.build(HttpService(WaltIdServices.loadChainConfig().providers.mumbai)) + return Web3j.build(HttpService(WaltIdServices.loadChainConfig().providers.amoy)) } } \ No newline at end of file