-
-
Notifications
You must be signed in to change notification settings - Fork 839
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
feat: decorate clients with actions #77
Conversation
🦋 Changeset detectedLatest commit: 91db4b7 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Size Change: +2.46 kB (+7%) 🔍 Total Size: 40.1 kB
ℹ️ View Unchanged
|
Codecov upload limit reached
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Few docs suggestions. Also, wired up some missing generics in 318770c
::: warning | ||
A name must be [normalized via UTS-46 normalization](https://docs.ens.domains/contract-api-reference/name-processing) before being used with `getEnsAddress`. | ||
This can be achieved by using the `normalize` utility. | ||
::: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
::: warning | |
A name must be [normalized via UTS-46 normalization](https://docs.ens.domains/contract-api-reference/name-processing) before being used with `getEnsAddress`. | |
This can be achieved by using the `normalize` utility. | |
::: | |
::: warning | |
Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. | |
This can be achieved by using viem's built-in [`normalize`](/docs/ens/utilities/normalize) utility. | |
::: |
::: warning | ||
A label must be [normalized via UTS-46 normalization](https://docs.ens.domains/contract-api-reference/name-processing) before being hashed with labelhash. | ||
This can be achieved by using the `normalize` utility. | ||
::: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
::: warning | |
A label must be [normalized via UTS-46 normalization](https://docs.ens.domains/contract-api-reference/name-processing) before being hashed with labelhash. | |
This can be achieved by using the `normalize` utility. | |
::: | |
::: warning | |
Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize labels](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `labelhash`. | |
This can be achieved by using viem's built-in [`normalize`](/docs/ens/utilities/normalize) utility. | |
::: |
::: warning | ||
A name must be [normalized via UTS-46 normalization](https://docs.ens.domains/contract-api-reference/name-processing) before being hashed with namehash. | ||
This can be achieved by using the `normalize` utility. | ||
::: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
::: warning | |
A name must be [normalized via UTS-46 normalization](https://docs.ens.domains/contract-api-reference/name-processing) before being hashed with namehash. | |
This can be achieved by using the `normalize` utility. | |
::: | |
::: warning | |
Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `namehash`. | |
This can be achieved by using viem's built-in [`normalize`](/docs/ens/utilities/normalize) utility. | |
::: |
} from './utils/ens' | ||
|
||
export { normalize } from './utils/ens/normalize' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For tree shake-ability?
AddChainArgs, | ||
FormattedTransactionRequest, | ||
GetPermissionsResponse, | ||
GetAccountsResponse, | ||
RequestAccountsResponse, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few missing args/response types for consistency
318770c
to
074f263
Compare
ca7b490
to
daee568
Compare
Co-authored-by: awkweb <tom@meagher.co>
074f263
to
0600343
Compare
* feat: fall back to getLogs if filters are not supported * Update src/actions/public/watchContractEvent.test.ts Co-authored-by: awkweb <tom@meagher.co> * pr review * feat: decode event log topics & data * wip: public * wip: add ens * docs: public actions * wip: wallet actions * docs: wallet actions * wip: test actions * wip: add utils to main entrypoint * tests: add tests * playgrounds: update * chore: changeset * test * refactor: wire up decorator generics * fix conflicts * format --------- Co-authored-by: awkweb <tom@meagher.co>
* feat: add timeout as config to transport * chore: changeset * feat: decode log `topics` + `data` & infer types for logs (#75) * feat: decode event log topics & data * docs: createContractEventFilter * pr review * feat: fall back to `getLogs` if filters are not supported (#76) * feat: fall back to getLogs if filters are not supported * Update src/actions/public/watchContractEvent.test.ts Co-authored-by: awkweb <tom@meagher.co> * pr review --------- Co-authored-by: awkweb <tom@meagher.co> * feat: decorate clients with actions (#77) * feat: fall back to getLogs if filters are not supported * Update src/actions/public/watchContractEvent.test.ts Co-authored-by: awkweb <tom@meagher.co> * pr review * feat: decode event log topics & data * wip: public * wip: add ens * docs: public actions * wip: wallet actions * docs: wallet actions * wip: test actions * wip: add utils to main entrypoint * tests: add tests * playgrounds: update * chore: changeset * test * refactor: wire up decorator generics * fix conflicts * format --------- Co-authored-by: awkweb <tom@meagher.co> --------- Co-authored-by: awkweb <tom@meagher.co>
After some research, it seems like decorating clients with their respective actions won't add too much to the bundle size. For example, adding public actions onto the public client only added 4kB (gzipped) for the
createPublicClient
import. I think the trade-off of losing tree-shaking here is okay since we gain a massive DX improvement (no extraneous imports + autocomplete of actions on the client).Example:
Tree-shaking escape hatch
If a consumer wants to be pedantic about bundle size, we also provide the escape hatch for them to leverage tree-shaking (the previous approach), using the base client (the base client does not attach any actions) – will need to document this.
TODO