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";
88import { CLIError , CLIErrorType } from "./error" ;
99import { getAddressFromPublic , findPublicKey , getOpt } from "./util" ;
1010import { Option , AccountType , actions } from "./types" ;
11+ import { getAccountIdFromPublic , blake256 } from "codechain-sdk/lib/utils" ;
12+ import { H256 } from "codechain-sdk/lib/core/classes" ;
1113
1214commander
1315 . version ( "0.1.0-alpha.1" )
@@ -70,6 +72,14 @@ async function main(action: string, option: Option) {
7072 const publicKey = await cckey [ accountType ] . createKey ( {
7173 passphrase
7274 } ) ;
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+
7383 console . log (
7484 getAddressFromPublic (
7585 accountType ,
You can’t perform that action at this time.
0 commit comments