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

Wallet Addresses return in lower case and it is causing issues for devs #134

Open
JAlbertCode opened this issue Jun 25, 2024 · 0 comments
Open
Assignees

Comments

@JAlbertCode
Copy link
Contributor

When a dev tries to validate a wallet address they are running into issues because the web3.Signer.GetAddress() function returns an address in all lower case. So when they check if the wallets match, it returns false even though the addresses are the same. The following script resolves the issue and needs to be added to the docs.

// Put this at the top of your script, it's a using directive to give you access to the helper method.
using Nethereum.Util;

// This is your checksum function, place it anywhere.

/// <summary>
/// Converts an address to checksum format.
/// </summary>
private string ConvertToChecksum(string address)
{
    string checksumAddress = new AddressUtil().ConvertToChecksumAddress(address);
    return checksumAddress;
}

// Call it like this.
var checksumAddress = ConvertToChecksum(Your Address Here);
@JAlbertCode JAlbertCode self-assigned this Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant