-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from Staketab/dev
send Domains to zkCloudWorker
- Loading branch information
Showing
14 changed files
with
187 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
src/main/java/com/staketab/minanames/dto/ZkCloudWorkerRequestDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
package com.staketab.minanames.dto; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class ZkCloudWorkerRequestDTO { | ||
private String auth; | ||
private String jwtToken; | ||
private String command; | ||
@Builder.Default | ||
private String command = "execute"; | ||
private ZkCloudWorkerDataDTO data; | ||
private String chain; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/com/staketab/minanames/entity/ZkCloudWorkerTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.staketab.minanames.entity; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum ZkCloudWorkerTask { | ||
SEND_TRANSACTION("createTxTask", "backend txs"), | ||
GET_BLOCK_INFO("getBlocksInfo", "commands info"); | ||
|
||
private final String name; | ||
private final String metadata; | ||
|
||
ZkCloudWorkerTask(String name, String metadata) { | ||
this.name = name; | ||
this.metadata = metadata; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/staketab/minanames/entity/ZkCloudWorkerTxOperation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.staketab.minanames.entity; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum ZkCloudWorkerTxOperation { | ||
ADD("add"), | ||
EXTEND("extend"), | ||
UPDATE("update"), | ||
REMOVE("remove"); | ||
|
||
private final String name; | ||
|
||
ZkCloudWorkerTxOperation(String name) { | ||
this.name = name; | ||
} | ||
} |
7 changes: 4 additions & 3 deletions
7
src/main/java/com/staketab/minanames/service/LogInfoService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
package com.staketab.minanames.service; | ||
|
||
import com.staketab.minanames.entity.LogInfoEntity; | ||
import com.staketab.minanames.entity.DomainEntity; | ||
import com.staketab.minanames.entity.LogInfoStatus; | ||
|
||
import java.util.List; | ||
|
||
public interface LogInfoService { | ||
|
||
void saveLogInfo(LogInfoEntity logInfoEntity); | ||
void saveLogInfo(DomainEntity domainEntity, LogInfoStatus status); | ||
|
||
void saveAllLogInfos(List<LogInfoEntity> logInfoEntities); | ||
void saveAllLogInfos(List<DomainEntity> domainEntities, LogInfoStatus status); | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/staketab/minanames/service/ZkCloudWorkerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.staketab.minanames.service; | ||
|
||
import com.staketab.minanames.entity.PayableTransactionEntity; | ||
|
||
import java.util.List; | ||
|
||
public interface ZkCloudWorkerService { | ||
|
||
void sendTxs(List<PayableTransactionEntity> appliedTxs); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
src/main/java/com/staketab/minanames/service/impl/LogInfoEntityImpl.java
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
src/main/java/com/staketab/minanames/service/impl/LogInfoServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.staketab.minanames.service.impl; | ||
|
||
import com.staketab.minanames.entity.DomainEntity; | ||
import com.staketab.minanames.entity.LogInfoEntity; | ||
import com.staketab.minanames.entity.LogInfoStatus; | ||
import com.staketab.minanames.repository.LogInfoRepository; | ||
import com.staketab.minanames.service.LogInfoService; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
@Slf4j | ||
@Service | ||
@RequiredArgsConstructor | ||
public class LogInfoServiceImpl implements LogInfoService { | ||
|
||
private final LogInfoRepository logInfoRepository; | ||
|
||
@Override | ||
public void saveLogInfo(DomainEntity domainEntity, LogInfoStatus status) { | ||
logInfoRepository.save(buildLogInfoEntity(domainEntity, status)); | ||
} | ||
|
||
@Override | ||
public void saveAllLogInfos(List<DomainEntity> domainEntities, LogInfoStatus status) { | ||
List<LogInfoEntity> logInfoEntities = domainEntities | ||
.stream() | ||
.map(domainEntity -> buildLogInfoEntity(domainEntity, status)) | ||
.toList(); | ||
logInfoRepository.saveAll(logInfoEntities); | ||
} | ||
|
||
private LogInfoEntity buildLogInfoEntity(DomainEntity domainEntity, LogInfoStatus status) { | ||
return LogInfoEntity.builder() | ||
.logInfoStatus(status.name()) | ||
.txHash(domainEntity.getTransaction().getTxHash()) | ||
.domainName(domainEntity.getDomainName()) | ||
.amount(domainEntity.getAmount()) | ||
.ownerAddress(domainEntity.getOwnerAddress()) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.