Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new ExtCalls for Get Nexus and Validate an Address. #285

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Phantasma.Business/src/Blockchain/VM/EVMContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ public static Address AddressConvertEthereumToPhantasma(string addressText, INex
pubKey[0] = (byte)kind;
return Address.FromBytes(pubKey);
}

public static Address AddressConvertEthereumToPhantasmaNoNexus(string addressText)
{
Throw.If(!IsValidAddress(addressText), "invalid ethereum address");
var input = addressText.Substring(2);
var decodedInput = input.Decode();

AddressKind kind = AddressKind.User;

var pubKey = new byte[Address.LengthInBytes];
ByteArrayUtils.CopyBytes(decodedInput, 0, pubKey, 1, decodedInput.Length);
pubKey[0] = (byte)kind;
return Address.FromBytes(pubKey);
}

public static string AddressConvertPhantasmaToEthereum(Address addr)
{
Expand Down
Loading
Loading