File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ import { CCKey } from "codechain-keystore";
8
8
import { CLIError , CLIErrorType } from "./error" ;
9
9
import { getAddressFromPublic , findPublicKey , getOpt } from "./util" ;
10
10
import { Option , AccountType , actions } from "./types" ;
11
+ import { getAccountIdFromPublic , blake256 } from "codechain-sdk/lib/utils" ;
12
+ import { H256 } from "codechain-sdk/lib/core/classes" ;
11
13
12
14
commander
13
15
. version ( "0.1.0-alpha.1" )
@@ -70,6 +72,14 @@ async function main(action: string, option: Option) {
70
72
const publicKey = await cckey [ accountType ] . createKey ( {
71
73
passphrase
72
74
} ) ;
75
+ if ( accountType === "platform" ) {
76
+ const accountId = getAccountIdFromPublic ( publicKey ) ;
77
+ cckey . mapping . add ( { key : accountId , value : publicKey } ) ;
78
+ } if ( accountType === "asset" ) {
79
+ const hash = H256 . ensure ( blake256 ( publicKey ) ) . value ;
80
+ cckey . mapping . add ( { key : hash , value : publicKey } ) ;
81
+ }
82
+
73
83
console . log (
74
84
getAddressFromPublic (
75
85
accountType ,
You can’t perform that action at this time.
0 commit comments