瀏覽代碼

eth/api: rename signAndSendTransaction to sendTransaction

Bas van Kervel 9 年之前
父節點
當前提交
4ee00b2309
共有 2 個文件被更改,包括 10 次插入4 次删除
  1. 8 2
      internal/ethapi/api.go
  2. 2 2
      internal/web3ext/web3ext.go

+ 8 - 2
internal/ethapi/api.go

@@ -303,10 +303,10 @@ func (s *PrivateAccountAPI) LockAccount(addr common.Address) bool {
 	return s.am.Lock(addr) == nil
 	return s.am.Lock(addr) == nil
 }
 }
 
 
-// SignAndSendTransaction will create a transaction from the given arguments and
+// SendTransaction will create a transaction from the given arguments and
 // tries to sign it with the key associated with args.To. If the given passwd isn't
 // tries to sign it with the key associated with args.To. If the given passwd isn't
 // able to decrypt the key it fails.
 // able to decrypt the key it fails.
-func (s *PrivateAccountAPI) SignAndSendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error) {
+func (s *PrivateAccountAPI) SendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error) {
 	var err error
 	var err error
 	args, err = prepareSendTxArgs(ctx, args, s.b)
 	args, err = prepareSendTxArgs(ctx, args, s.b)
 	if err != nil {
 	if err != nil {
@@ -336,6 +336,12 @@ func (s *PrivateAccountAPI) SignAndSendTransaction(ctx context.Context, args Sen
 	return submitTransaction(ctx, s.b, tx, signature)
 	return submitTransaction(ctx, s.b, tx, signature)
 }
 }
 
 
+// SignAndSendTransaction was renamed to SendTransaction. This method is deprecated
+// and will be removed in the future. It primary goal is to give clients time to update.
+func (s *PrivateAccountAPI) SignAndSendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error) {
+	return s.SendTransaction(ctx, args, passwd)
+}
+
 // PublicBlockChainAPI provides an API to access the Ethereum blockchain.
 // PublicBlockChainAPI provides an API to access the Ethereum blockchain.
 // It offers only methods that operate on public data that is freely available to anyone.
 // It offers only methods that operate on public data that is freely available to anyone.
 type PublicBlockChainAPI struct {
 type PublicBlockChainAPI struct {

+ 2 - 2
internal/web3ext/web3ext.go

@@ -418,8 +418,8 @@ web3._extend({
 			params: 2
 			params: 2
 		}),
 		}),
 		new web3._extend.Method({
 		new web3._extend.Method({
-			name: 'signAndSendTransaction',
-			call: 'personal_signAndSendTransaction',
+			name: 'sendTransaction',
+			call: 'personal_sendTransaction',
 			params: 2,
 			params: 2,
 			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null]
 			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null]
 		})
 		})