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

isHexString function not exported by library #367

Closed
bojan96 opened this issue Dec 5, 2018 · 3 comments
Closed

isHexString function not exported by library #367

bojan96 opened this issue Dec 5, 2018 · 3 comments
Labels
enhancement New feature or improvement.

Comments

@bojan96
Copy link

bojan96 commented Dec 5, 2018

isHexString function is not exported by ethers.js
It seems that problem is located in src.ts/utils/index.ts

index.ts:

export {
    AbiCoder,
    defaultAbiCoder,
    formatSignature,
    formatParamType,
    parseSignature,
    parseParamType,

    RLP,

    fetchJson,
    getNetwork,

    checkProperties,
    deepCopy,
    defineReadOnly,
    resolveProperties,
    shallowCopy,

    arrayify,

    concat,
    padZeros,
    stripZeros,

    HDNode,
    SigningKey,

    Interface,

    base64,

    BigNumber,
    bigNumberify,
// isHexString MISSING
    hexlify,
    hexStripZeros,
    hexZeroPad,
    hexDataLength,
    hexDataSlice,

    toUtf8Bytes,
    toUtf8String,

    formatBytes32String,
    parseBytes32String,

    hashMessage,
    namehash,
    id,

    getAddress,
    getIcapAddress,
    getContractAddress,

    formatEther,
    parseEther,

    formatUnits,
    parseUnits,

    commify,

    keccak256,
    sha256,

    randomBytes,

    solidityPack,
    solidityKeccak256,
    soliditySha256,

    splitSignature,
    joinSignature,

    parseTransaction,
    populateTransaction,
    serializeTransaction,

    getJsonWalletAddress,

    computeAddress,
    computePublicKey,
    recoverAddress,
    recoverPublicKey,
    verifyMessage,


    ////////////////////////
    // Enums

    SupportedAlgorithms,
    UnicodeNormalizationForm,


    ////////////////////////
    // Types

    CoerceFunc,
    EventFragment,
    FunctionFragment,
    ParamType,

    BigNumberish,

    Arrayish,
    Hexable,
    Signature,

    Indexed,

    DeployDescription,
    EventDescription,
    FunctionDescription,
    LogDescription,
    TransactionDescription,

    Network,
    Networkish,

    Transaction,
    UnsignedTransaction,

    ConnectionInfo,
    OnceBlockable,
    PollOptions,

    EncryptOptions,
    ProgressCallback,

    Wordlist,

}
@dhl
Copy link

dhl commented Dec 6, 2018

You can access isHexString by importing it directly from bytes.ts.

TypeScript

import { isHexString } from 'ethers/utils/bytes';

Node

const { isHexString } = require('ethers/utils/bytes');

Not quite sure what @ricmoo has in mind, but perhaps he did not want to re-export every exportable function in bytes.ts, because otherwise, import from bytes could have been replaced with

export * from 'bytes';

@ricmoo
Copy link
Member

ricmoo commented Dec 6, 2018

I do recall not exporting it on purpose, but I can't think of a good reason... I'll take a look to see what else is not being exported too. It is probably useful to export.

@ricmoo ricmoo added enhancement New feature or improvement. on-deck This Enhancement or Bug is currently being worked on. labels Dec 8, 2018
@ricmoo
Copy link
Member

ricmoo commented Dec 14, 2018

This function is now exported. There are several places in the code that currently use hexDataLength, which will likely be updated in the future to use the second optional parameter, which lets the check also include a test for length (in bytes; i.e. the hex string must be even length).

These functions will probably be juggled around a bit in v5. Just a heads up. :)

Thanks! :)

@ricmoo ricmoo closed this as completed Dec 14, 2018
@ricmoo ricmoo removed the on-deck This Enhancement or Bug is currently being worked on. label Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement.
Projects
None yet
Development

No branches or pull requests

3 participants