ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

Consider exporting all coders.

Open Satan-web3 opened this issue 1 year ago • 5 comments

Describe the Feature

I want to change some functions of coders to implement some functionalities. But when I try to import like this:

import { AddressCoder } from "ethers/lib.esm/abi/coders/address.js";

It report Error [ERR_PACKAGE_PATH_NOT_EXPORTED]. So please consider exporting all coders in index.ts.

Code Example

In `src.ts/abi/index.ts`:

export { Coder, Reader } from './coders/abstract-coder.js';
export { AddressCoder } from "./coders/address.js";
export { ArrayCoder } from "./coders/array.js";
export { BooleanCoder } from "./coders/boolean.js";
export { BytesCoder } from "./coders/bytes.js";
export { FixedBytesCoder } from "./coders/fixed-bytes.js";
export { NullCoder } from "./coders/null.js";
export { NumberCoder } from "./coders/number.js";
export { StringCoder } from "./coders/string.js";
export { TupleCoder } from "./coders/tuple.js";

Satan-web3 avatar Aug 27 '24 06:08 Satan-web3

Ive been considering adding this using the exports; so it would be something to the effect of import { NumberCoder } from "ethers/abi".

ricmoo avatar Sep 16 '24 16:09 ricmoo

Ive been considering adding this using the exports; so it would be something to the effect of import { NumberCoder } from "ethers/abi".

Thank you!

Satan-web3 avatar Sep 19 '24 03:09 Satan-web3

Ive been considering adding this using the exports; so it would be something to the effect of import { NumberCoder } from "ethers/abi".

When will this feature publish? I've been waiting for it for nearly a month.

Satan-web3 avatar Oct 14 '24 09:10 Satan-web3

Sorry. I'm still working on the next minor release, which this will go out in. I'm also planning to make the export prefixed with an underscore _ since it will be somewhat experimental.

ricmoo avatar Oct 16 '24 00:10 ricmoo

Sorry. I'm still working on the next minor release, which this will go out in. I'm also planning to make the export prefixed with an underscore _ since it will be somewhat experimental.

I think it's better not to add it because the export doesn't conflict with other code. But the underscore is acceptable if you are planning to change some coders in the future.

Satan-web3 avatar Oct 16 '24 09:10 Satan-web3