public bool validateTransactionOptions(ITransactionOptions options) { IOutputAgent optionsAgent = options.agent; if (options.value < 0) { return(false); } bool isValidTronAddress = TronAddress.ValidateAddress(optionsAgent.address); if (!isValidTronAddress) { return(false); } byte[] primaryKeyBytes = StringHelper.GetBytesAdressFromString(optionsAgent.privateKey); try { KeyTriple keyTriple = new KeyTriple(primaryKeyBytes.ToHexString2()); } catch (FormatException) { return(false); } bool isBelongsPublicKeyToPrivateKey = TronAddress.isBelongsPublicKeyToPrivateKey(optionsAgent.privateKey, optionsAgent.address); if (!isBelongsPublicKeyToPrivateKey) { return(false); } ITransactionCredentials credentials = options.credentials; bool isValidTronCredentialsAddress = TronAddress.ValidateAddress(credentials.address); if (!isValidTronCredentialsAddress) { return(false); } if (!isValidateAmountInSatoshiByMax(options.value)) { return(false); } long balanceAgent = balanceByAddress(optionsAgent.address); if (balanceAgent < options.value) { return(false); } return(true); }
public bool validateAddress(string address) { return(TronAddress.ValidateAddress(address)); }