@@ -21,48 +21,34 @@ import {
2121
2222const VERSION = "0.1.1" ;
2323
24- program . version ( VERSION ) ;
25-
2624program
27- . command ( "list" )
28- . description ( "list keys" )
25+ . version ( VERSION )
2926 . option (
3027 "-t, --account-type <accountType>" ,
3128 "'platform' or 'asset'. The type of the key" ,
3229 "platform"
33- )
30+ ) ;
31+
32+ program
33+ . command ( "list" )
34+ . description ( "list keys" )
3435 . action ( handleError ( listCommand ) ) ;
3536
3637program
3738 . command ( "create" )
3839 . description ( "create a new key" )
39- . option (
40- "-t, --account-type <accountType>" ,
41- "'platform' or 'asset'. The type of the key" ,
42- "platform"
43- )
4440 . option ( "-p, --passphrase <passphrase>" , "passphrase" )
4541 . action ( handleError ( createCommand ) ) ;
4642
4743program
4844 . command ( "delete" )
4945 . description ( "delete the key" )
50- . option (
51- "-t, --account-type <accountType>" ,
52- "'platform' or 'asset'. The type of the key" ,
53- "platform"
54- )
5546 . option ( "-a, --address <address>" , "address" )
5647 . action ( handleError ( deleteCommand ) ) ;
5748
5849program
5950 . command ( "import <path>" )
6051 . description ( "import a key" )
61- . option (
62- "-t, --account-type <accountType>" ,
63- "'platform' or 'asset'. The type of the key" ,
64- "platform"
65- )
6652 . option ( "-p, --passphrase <passphrase>" , "passphrase" )
6753 . action ( handleError ( importCommand ) ) ;
6854
@@ -81,27 +67,27 @@ function handleError(
8167
8268async function listCommand ( option : ListOption ) {
8369 const cckey = await CCKey . create ( ) ;
84- const accountType = parseAccountType ( option . accountType ) ;
70+ const accountType = parseAccountType ( option . parent . accountType ) ;
8571 await listKeys ( cckey , accountType ) ;
8672}
8773
8874async function createCommand ( option : CreateOption ) {
8975 const cckey = await CCKey . create ( ) ;
90- const accountType = parseAccountType ( option . accountType ) ;
76+ const accountType = parseAccountType ( option . parent . accountType ) ;
9177 const passphrase = parsePassphrase ( option . passphrase ) ;
9278 await createKey ( cckey , accountType , passphrase ) ;
9379}
9480
9581async function deleteCommand ( option : DeleteOption ) {
9682 const cckey = await CCKey . create ( ) ;
97- const accountType = parseAccountType ( option . accountType ) ;
83+ const accountType = parseAccountType ( option . parent . accountType ) ;
9884 const address = parseAddress ( option . address ) ;
9985 await deleteKey ( cckey , accountType , address ) ;
10086}
10187
10288async function importCommand ( path : string , option : ImportOption ) {
10389 const cckey = await CCKey . create ( ) ;
104- const accountType = parseAccountType ( option . accountType ) ;
90+ const accountType = parseAccountType ( option . parent . accountType ) ;
10591 const passphrase = parsePassphrase ( option . passphrase ) ;
10692 const contents = fs . readFileSync ( path , { encoding : "utf8" } ) ;
10793 await importKey ( cckey , accountType , JSON . parse ( contents ) , passphrase ) ;
0 commit comments