|
|
@ -175,15 +175,20 @@ func (api *ExternalSigner) SignData(account accounts.Account, mimeType string, d |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (api *ExternalSigner) SignText(account accounts.Account, text []byte) ([]byte, error) { |
|
|
|
func (api *ExternalSigner) SignText(account accounts.Account, text []byte) ([]byte, error) { |
|
|
|
var res hexutil.Bytes |
|
|
|
var signature hexutil.Bytes |
|
|
|
var signAddress = common.NewMixedcaseAddress(account.Address) |
|
|
|
var signAddress = common.NewMixedcaseAddress(account.Address) |
|
|
|
if err := api.client.Call(&res, "account_signData", |
|
|
|
if err := api.client.Call(&signature, "account_signData", |
|
|
|
accounts.MimetypeTextPlain, |
|
|
|
accounts.MimetypeTextPlain, |
|
|
|
&signAddress, // Need to use the pointer here, because of how MarshalJSON is defined
|
|
|
|
&signAddress, // Need to use the pointer here, because of how MarshalJSON is defined
|
|
|
|
hexutil.Encode(text)); err != nil { |
|
|
|
hexutil.Encode(text)); err != nil { |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
return res, nil |
|
|
|
if signature[64] == 27 || signature[64] == 28 { |
|
|
|
|
|
|
|
// If clef is used as a backend, it may already have transformed
|
|
|
|
|
|
|
|
// the signature to ethereum-type signature.
|
|
|
|
|
|
|
|
signature[64] -= 27 // Transform V from Ethereum-legacy to 0/1
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return signature, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) { |
|
|
|
func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) { |
|
|
|