parent
40a157a5af
commit
5f28d8b809
|
@ -214,7 +214,7 @@ proc newAppController*(statusFoundation: StatusFoundation): AppController =
|
|||
result.settingsService, result.walletAccountService, result.transactionService,
|
||||
result.networkService, result.tokenService)
|
||||
result.tokensService = tokens_service.newService(statusFoundation.events, statusFoundation.threadpool,
|
||||
result.networkService, result.transactionService)
|
||||
result.transactionService)
|
||||
result.providerService = provider_service.newService(statusFoundation.events, statusFoundation.threadpool, result.ensService)
|
||||
|
||||
# Modules
|
||||
|
|
|
@ -34,8 +34,8 @@ proc init*(self: Controller) =
|
|||
return
|
||||
self.mintingModule.onUserAuthenticated(args.password)
|
||||
|
||||
proc mintCollectibles*(self: Controller, communityId: string, addressFrom: string, password: string, deploymentParams: DeploymentParameters) =
|
||||
self.communityTokensService.mintCollectibles(communityId, addressFrom, password, deploymentParams)
|
||||
proc mintCollectibles*(self: Controller, communityId: string, addressFrom: string, password: string, deploymentParams: DeploymentParameters, chainId: int) =
|
||||
self.communityTokensService.mintCollectibles(communityId, addressFrom, password, deploymentParams, chainId)
|
||||
|
||||
proc authenticateUser*(self: Controller, keyUid = "") =
|
||||
let data = SharedKeycarModuleAuthenticationArgs(uniqueIdentifier: UNIQUE_MINT_COLLECTIBLES_MINTING_MODULE_IDENTIFIER, keyUid: keyUid)
|
||||
|
|
|
@ -10,7 +10,7 @@ method load*(self: AccessInterface) {.base.} =
|
|||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method mintCollectible*(self: AccessInterface, communityId: string, address: string, name: string, symbol: string, description: string, supply: int, infiniteSupply: bool, transferable: bool,
|
||||
selfDestruct: bool, network: string) {.base.} =
|
||||
selfDestruct: bool, chainId: int) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method onUserAuthenticated*(self: AccessInterface, password: string) {.base.} =
|
||||
|
|
|
@ -16,6 +16,7 @@ type
|
|||
viewVariant: QVariant
|
||||
tempAddressFrom: string
|
||||
tempCommunityId: string
|
||||
tempChainId: int
|
||||
tempDeploymentParams: DeploymentParameters
|
||||
|
||||
proc newMintingModule*(
|
||||
|
@ -39,9 +40,10 @@ method load*(self: Module) =
|
|||
self.view.load()
|
||||
|
||||
method mintCollectible*(self: Module, communityId: string, fromAddress: string, name: string, symbol: string, description: string,
|
||||
supply: int, infiniteSupply: bool, transferable: bool, selfDestruct: bool, network: string) =
|
||||
supply: int, infiniteSupply: bool, transferable: bool, selfDestruct: bool, chainId: int) =
|
||||
self.tempAddressFrom = fromAddress
|
||||
self.tempCommunityId = communityId
|
||||
self.tempChainId = chainId
|
||||
self.tempDeploymentParams.name = name
|
||||
self.tempDeploymentParams.symbol = symbol
|
||||
self.tempDeploymentParams.description = description
|
||||
|
@ -59,8 +61,9 @@ method onUserAuthenticated*(self: Module, password: string) =
|
|||
defer: self.tempAddressFrom = ""
|
||||
defer: self.tempDeploymentParams = DeploymentParameters()
|
||||
defer: self.tempCommunityId = ""
|
||||
defer: self.tempChainId = -1
|
||||
if password.len == 0:
|
||||
discard
|
||||
#TODO signalize somehow
|
||||
else:
|
||||
self.controller.mintCollectibles(self.tempCommunityId, self.tempAddressFrom, password, self.tempDeploymentParams)
|
||||
self.controller.mintCollectibles(self.tempCommunityId, self.tempAddressFrom, password, self.tempDeploymentParams, self.tempChainId)
|
||||
|
|
|
@ -18,8 +18,8 @@ QtObject:
|
|||
result.QObject.setup
|
||||
result.mintingModule = mintingModule
|
||||
|
||||
proc mintCollectible*(self: View, communityId: string, fromAddress: string, name: string, symbol: string, description: string, supply: int, infiniteSupply: bool, transferable: bool, selfDestruct: bool, network: string) {.slot.} =
|
||||
self.mintingModule.mintCollectible(communityId, fromAddress, name, symbol, description, supply, infiniteSupply, transferable, selfDestruct, network)
|
||||
proc mintCollectible*(self: View, communityId: string, fromAddress: string, name: string, symbol: string, description: string, supply: int, infiniteSupply: bool, transferable: bool, selfDestruct: bool, chainId: int) {.slot.} =
|
||||
self.mintingModule.mintCollectible(communityId, fromAddress, name, symbol, description, supply, infiniteSupply, transferable, selfDestruct, chainId)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import ../../../app/core/eventemitter
|
|||
import ../../../app/core/tasks/[qt, threadpool]
|
||||
|
||||
import ../../../backend/community_tokens as tokens_backend
|
||||
import ../network/service as network_service
|
||||
import ../transaction/service as transaction_service
|
||||
|
||||
import ../eth/dto/transaction
|
||||
|
@ -40,7 +39,6 @@ QtObject:
|
|||
Service* = ref object of QObject
|
||||
events: EventEmitter
|
||||
threadpool: ThreadPool
|
||||
networkService: network_service.Service
|
||||
transactionService: transaction_service.Service
|
||||
|
||||
proc delete*(self: Service) =
|
||||
|
@ -49,14 +47,12 @@ QtObject:
|
|||
proc newService*(
|
||||
events: EventEmitter,
|
||||
threadpool: ThreadPool,
|
||||
networkService: network_service.Service,
|
||||
transactionService: transaction_service.Service
|
||||
): Service =
|
||||
result = Service()
|
||||
result.QObject.setup
|
||||
result.events = events
|
||||
result.threadpool = threadpool
|
||||
result.networkService = networkService
|
||||
result.transactionService = transactionService
|
||||
|
||||
proc init*(self: Service) =
|
||||
|
@ -73,9 +69,8 @@ QtObject:
|
|||
let data = CommunityTokenDeployedStatusArgs(communityId: tokenDto.communityId, contractAddress: tokenDto.address, deployState: deployState)
|
||||
self.events.emit(SIGNAL_COMMUNITY_TOKEN_DEPLOY_STATUS, data)
|
||||
|
||||
proc mintCollectibles*(self: Service, communityId: string, addressFrom: string, password: string, deploymentParams: DeploymentParameters) =
|
||||
proc mintCollectibles*(self: Service, communityId: string, addressFrom: string, password: string, deploymentParams: DeploymentParameters, chainId: int) =
|
||||
try:
|
||||
let chainId = self.networkService.getNetworkForCollectibles().chainId
|
||||
let txData = TransactionDataDto(source: parseAddress(addressFrom))
|
||||
|
||||
let response = tokens_backend.deployCollectibles(chainId, %deploymentParams, %txData, password)
|
||||
|
@ -120,8 +115,7 @@ QtObject:
|
|||
|
||||
proc getCommunityTokens*(self: Service, communityId: string): seq[CommunityTokenDto] =
|
||||
try:
|
||||
let chainId = self.networkService.getNetworkForCollectibles().chainId
|
||||
let response = tokens_backend.getCommunityTokens(communityId, chainId)
|
||||
let response = tokens_backend.getCommunityTokens(communityId)
|
||||
return parseCommunityTokens(response)
|
||||
except RpcException:
|
||||
error "Error getting community tokens", message = getCurrentExceptionMsg()
|
||||
|
|
|
@ -8,8 +8,8 @@ proc deployCollectibles*(chainId: int, deploymentParams: JsonNode, txData: JsonN
|
|||
let payload = %* [chainId, deploymentParams, txData, utils.hashPassword(password)]
|
||||
return core.callPrivateRPC("collectibles_deploy", payload)
|
||||
|
||||
proc getCommunityTokens*(communityId: string, chainId: int): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
let payload = %* [communityId, chainId]
|
||||
proc getCommunityTokens*(communityId: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
let payload = %* [communityId]
|
||||
return core.callPrivateRPC("wakuext_getCommunityTokens", payload)
|
||||
|
||||
proc addCommunityToken*(token: CommunityTokenDto): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
|
|
Loading…
Reference in New Issue