fix: cli: better handle sending from EthAccount actors
This will make `lotus send` mostly just "do what the user wants" in this case: 1. The user may not explicitly specify a method number. 2. Parameters are automatically cbor-encoded where applicable. 3. The method number is automatically selected based on the recipient (CreateExternal if sent to the EAM, InvokeEVM otherwise).
This commit is contained in:
@@ -295,6 +295,19 @@ func EthAddressFromPubKey(pubk []byte) ([]byte, error) {
|
||||
return ethAddr, nil
|
||||
}
|
||||
|
||||
func IsEthAddress(addr address.Address) bool {
|
||||
if addr.Protocol() != address.Delegated {
|
||||
return false
|
||||
}
|
||||
payload := addr.Payload()
|
||||
namespace, _, err := varint.FromUvarint(payload)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return namespace == builtintypes.EthereumAddressManagerActorID
|
||||
}
|
||||
|
||||
func EthAddressFromFilecoinAddress(addr address.Address) (EthAddress, error) {
|
||||
switch addr.Protocol() {
|
||||
case address.ID:
|
||||
|
||||
Reference in New Issue
Block a user