22
33package com .webank .weid .command ;
44
5- import com .webank .weid .constant .ChainVersion ;
6- import com .webank .weid .contract .deploy .v3 .RegisterAddressV3 ;
7- import java .math .BigInteger ;
8-
9- import lombok .extern .slf4j .Slf4j ;
10- import org .apache .commons .lang3 .StringUtils ;
11- import org .apache .commons .lang3 .math .NumberUtils ;
12-
135import com .beust .jcommander .JCommander ;
14- import com .webank .weid .config .FiscoConfig ;
15- import com .webank .weid .constant .CnsType ;
6+ import com .webank .weid .blockchain .config .FiscoConfig ;
7+ import com .webank .weid .blockchain .constant .CnsType ;
8+ import com .webank .weid .blockchain .deploy .v2 .RegisterAddressV2 ;
9+ import com .webank .weid .blockchain .deploy .v3 .RegisterAddressV3 ;
10+ import com .webank .weid .blockchain .service .fisco .BaseServiceFisco ;
11+ import com .webank .weid .blockchain .service .fisco .CryptoFisco ;
12+ import com .webank .weid .blockchain .service .fisco .server .WeServer ;
13+ import com .webank .weid .constant .ChainVersion ;
1614import com .webank .weid .constant .WeIdConstant ;
1715import com .webank .weid .contract .deploy .AddressProcess ;
18- import com .webank .weid .contract .deploy .v2 .RegisterAddressV2 ;
1916import com .webank .weid .contract .v2 .DataBucket ;
2017import com .webank .weid .protocol .base .WeIdPrivateKey ;
21- import com .webank .weid .service .BaseService ;
22- import com .webank .weid .service .fisco .WeServer ;
2318import com .webank .weid .util .DataToolUtils ;
2419import com .webank .weid .util .WeIdSdkUtils ;
20+ import lombok .extern .slf4j .Slf4j ;
21+ import org .apache .commons .lang3 .StringUtils ;
22+ import org .apache .commons .lang3 .math .NumberUtils ;
2523import org .fisco .bcos .sdk .abi .datatypes .generated .Bytes32 ;
2624import org .fisco .bcos .sdk .abi .datatypes .generated .tuples .generated .Tuple2 ;
2725import org .fisco .bcos .sdk .client .Client ;
2826import org .fisco .bcos .sdk .crypto .keypair .CryptoKeyPair ;
2927import org .fisco .bcos .sdk .v3 .crypto .CryptoSuite ;
3028
29+ import java .math .BigInteger ;
30+
3131/**
3232 * todo support v3 test
3333 * @author marsli
@@ -64,7 +64,7 @@ public static void main(String[] args) {
6464 System .out .println ("[RegisterEvidenceByGroup] begin register evidenceAddress by cns and groupId, cns = " + cns + ", groupId = " + goupIdStr );
6565 // 检查群组是否存在
6666 String groupId = goupIdStr ;
67- boolean checkGroupId = BaseService .checkGroupId (goupIdStr );
67+ boolean checkGroupId = BaseServiceFisco .checkGroupId (goupIdStr );
6868 if (!checkGroupId ) {
6969 System .out .println ("[RegisterEvidenceByGroup] input error, the group does not exists, Abort." );
7070 System .exit (1 );
@@ -77,7 +77,7 @@ public static void main(String[] args) {
7777 WeServer <?, ?, ?> weServer = WeServer .getInstance (fiscoConfig , groupId );
7878 // v2 chain
7979 if (ChainVersion .FISCO_V2 .getVersion () == Integer .parseInt (fiscoConfig .getVersion ())) {
80- CryptoKeyPair credentials = DataToolUtils .cryptoSuite .getKeyPairFactory ()
80+ CryptoKeyPair credentials = CryptoFisco .cryptoSuite .getKeyPairFactory ()
8181 .createKeyPair (new BigInteger (privatekey ));
8282 // 加载DataBucket
8383 DataBucket dataBucket = DataBucket .load (
@@ -102,7 +102,7 @@ public static void main(String[] args) {
102102 // 将地址注册到cns中
103103 CnsType cnsType = CnsType .SHARE ;
104104 // 注册SHARE CNS 默认主群组
105- RegisterAddressV2 .registerBucketToCns (cnsType , currentPrivateKey );
105+ RegisterAddressV2 .registerBucketToCns (cnsType , currentPrivateKey . getPrivateKey () );
106106 // 根据群组和evidence Address获取hash
107107 String hash = AddressProcess .getHashForShare (groupId , evidenceAddress );
108108 // 将evidence地址注册到cns中 默认主群组
@@ -111,19 +111,19 @@ public static void main(String[] args) {
111111 hash ,
112112 evidenceAddress ,
113113 WeIdConstant .CNS_EVIDENCE_ADDRESS ,
114- currentPrivateKey
114+ currentPrivateKey . getPrivateKey ()
115115 );
116116 // 将群组编号注册到cns中 默认主群组
117117 RegisterAddressV2 .registerAddress (
118118 cnsType ,
119119 hash ,
120120 groupId ,
121121 WeIdConstant .CNS_GROUP_ID ,
122- currentPrivateKey
122+ currentPrivateKey . getPrivateKey ()
123123 );
124124 } else {
125125 org .fisco .bcos .sdk .v3 .crypto .keypair .CryptoKeyPair credentials =
126- new CryptoSuite (DataToolUtils .cryptoSuite .getCryptoTypeConfig ()).getKeyPairFactory ()
126+ new CryptoSuite (CryptoFisco .cryptoSuite .getCryptoTypeConfig ()).getKeyPairFactory ()
127127 .createKeyPair (new BigInteger (privatekey ));
128128 // 加载DataBucket
129129 com .webank .weid .contract .v3 .DataBucket dataBucket =
@@ -150,7 +150,7 @@ public static void main(String[] args) {
150150 // 将地址注册到cns中
151151 CnsType cnsType = CnsType .SHARE ;
152152 // 注册SHARE CNS 默认主群组
153- RegisterAddressV3 .registerBucketToCns (cnsType , currentPrivateKey );
153+ RegisterAddressV3 .registerBucketToCns (cnsType , currentPrivateKey . getPrivateKey () );
154154 // 根据群组和evidence Address获取hash
155155 String hash = AddressProcess .getHashForShare (groupId , evidenceAddress );
156156 // 将evidence地址注册到cns中 默认主群组
@@ -159,15 +159,15 @@ public static void main(String[] args) {
159159 hash ,
160160 evidenceAddress ,
161161 WeIdConstant .CNS_EVIDENCE_ADDRESS ,
162- currentPrivateKey
162+ currentPrivateKey . getPrivateKey ()
163163 );
164164 // 将群组编号注册到cns中 默认主群组
165165 RegisterAddressV3 .registerAddress (
166166 cnsType ,
167167 hash ,
168168 groupId ,
169169 WeIdConstant .CNS_GROUP_ID ,
170- currentPrivateKey
170+ currentPrivateKey . getPrivateKey ()
171171 );
172172
173173 }
0 commit comments