@@ -20,34 +20,38 @@ use primitives::H256;
2020
2121use super :: super :: types:: { SendTransactionResult , UnsignedTransaction } ;
2222
23- build_rpc_trait ! {
24- pub trait Account {
25- /// Gets a list of accounts
26- # [ rpc( name = "account_getList" ) ]
27- fn get_account_list( & self ) -> Result <Vec <PlatformAddress >>;
28-
29- /// Creates a new account
30- # [ rpc( name = "account_create" ) ]
31- fn create_account( & self , Option <Password >) -> Result <PlatformAddress >;
32-
33- /// Imports a private key
34- # [ rpc( name = "account_importRaw" ) ]
35- fn create_account_from_secret( & self , H256 , Option <Password >) -> Result <PlatformAddress >;
36-
37- /// Unlocks the specified account for use.
38- # [ rpc( name = "account_unlock" ) ]
39- fn unlock( & self , PlatformAddress , Password , Option <u64 >) -> Result <( ) >;
40-
41- /// Calculates the account's signature for a given message
42- # [ rpc( name = "account_sign" ) ]
43- fn sign( & self , H256 , PlatformAddress , Option <Password >) -> Result <Signature >;
44-
45- /// Sends a transaction with a signature of the account
46- # [ rpc( name = "account_sendTransaction" ) ]
47- fn send_transaction( & self , UnsignedTransaction , PlatformAddress , Option <Password >) -> Result <SendTransactionResult >;
48-
49- /// Changes the account's password
50- # [ rpc( name = "account_changePassword" ) ]
51- fn change_password( & self , PlatformAddress , Password , Password ) -> Result <( ) >;
52- }
23+ #[ rpc( server) ]
24+ pub trait Account {
25+ /// Gets a list of accounts
26+ #[ rpc( name = "account_getList" ) ]
27+ fn get_account_list ( & self ) -> Result < Vec < PlatformAddress > > ;
28+
29+ /// Creates a new account
30+ #[ rpc( name = "account_create" ) ]
31+ fn create_account ( & self , passphrase : Option < Password > ) -> Result < PlatformAddress > ;
32+
33+ /// Imports a private key
34+ #[ rpc( name = "account_importRaw" ) ]
35+ fn create_account_from_secret ( & self , secret : H256 , passphrase : Option < Password > ) -> Result < PlatformAddress > ;
36+
37+ /// Unlocks the specified account for use.
38+ #[ rpc( name = "account_unlock" ) ]
39+ fn unlock ( & self , address : PlatformAddress , password : Password , duration : Option < u64 > ) -> Result < ( ) > ;
40+
41+ /// Calculates the account's signature for a given message
42+ #[ rpc( name = "account_sign" ) ]
43+ fn sign ( & self , message_digest : H256 , address : PlatformAddress , passphrase : Option < Password > ) -> Result < Signature > ;
44+
45+ /// Sends a transaction with a signature of the account
46+ #[ rpc( name = "account_sendTransaction" ) ]
47+ fn send_transaction (
48+ & self ,
49+ tx : UnsignedTransaction ,
50+ platform_address : PlatformAddress ,
51+ passphrase : Option < Password > ,
52+ ) -> Result < SendTransactionResult > ;
53+
54+ /// Changes the account's password
55+ #[ rpc( name = "account_changePassword" ) ]
56+ fn change_password ( & self , address : PlatformAddress , old_password : Password , new_password : Password ) -> Result < ( ) > ;
5357}
0 commit comments