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

Export EIP-6963 Types #7270

Open
wants to merge 2 commits into
base: 4.x
Choose a base branch
from
Open

Export EIP-6963 Types #7270

wants to merge 2 commits into from

Conversation

danforbes
Copy link
Contributor

Export EIP-6963 types

Copy link

github-actions bot commented Sep 18, 2024

Bundle Stats

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
10 640.73 kB → 640.42 kB (-308 B) -0.05%
Changeset
File Δ Size
../web3-types/lib/commonjs/eip6963_types.js 🆕 +773 B 0 B → 773 B
../web3-types/lib/commonjs/index.js 📈 +54 B (+2.28%) 2.32 kB → 2.37 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
web3.min.js 621.32 kB → 621.41 kB (+89 B) +0.01%

Smaller

Asset File Size % Changed
../lib/commonjs/web3_eip6963.d.ts 1.28 kB → 927 B (-383 B) -29.24%
../lib/commonjs/web3.d.ts 1.38 kB → 1.37 kB (-14 B) -0.99%

Unchanged

Asset File Size % Changed
../lib/commonjs/index.d.ts 8.69 kB 0%
../lib/commonjs/accounts.d.ts 3.89 kB 0%
../lib/commonjs/types.d.ts 2.67 kB 0%
../lib/commonjs/abi.d.ts 999 B 0%
../lib/commonjs/eth.exports.d.ts 280 B 0%
../lib/commonjs/providers.exports.d.ts 183 B 0%
../lib/commonjs/version.d.ts 60 B 0%

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 6a88b18 Previous: cc99825 Ratio
processingTx 21330 ops/sec (±7.11%) 21879 ops/sec (±7.68%) 1.03
processingContractDeploy 40367 ops/sec (±5.65%) 38811 ops/sec (±6.95%) 0.96
processingContractMethodSend 15424 ops/sec (±9.24%) 15153 ops/sec (±7.20%) 0.98
processingContractMethodCall 28177 ops/sec (±6.48%) 27291 ops/sec (±6.06%) 0.97
abiEncode 43535 ops/sec (±7.97%) 41796 ops/sec (±7.77%) 0.96
abiDecode 30704 ops/sec (±8.16%) 28813 ops/sec (±7.30%) 0.94
sign 1507 ops/sec (±3.04%) 1512 ops/sec (±0.76%) 1.00
verify 367 ops/sec (±0.53%) 359 ops/sec (±0.56%) 0.98

This comment was automatically generated by workflow using github-action-benchmark.

Copy link

codecov bot commented Sep 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.44%. Comparing base (cc99825) to head (6a88b18).

Additional details and impacted files
@@           Coverage Diff           @@
##              4.x    #7270   +/-   ##
=======================================
  Coverage   94.44%   94.44%           
=======================================
  Files         216      216           
  Lines        8463     8463           
  Branches     2339     2339           
=======================================
  Hits         7993     7993           
  Misses        470      470           
Flag Coverage Δ
UnitTests 94.44% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Comment on lines +21 to +35
export interface EIP6963ProviderInfo {
uuid: string;
name: string;
icon: string;
rdns: string;
}

export interface EIP6963ProviderDetail<API = Web3APISpec> {
info: EIP6963ProviderInfo;
provider: EIP1193Provider<API>;
}

export type EIP6963ProviderResponse = Map<string, EIP6963ProviderDetail>;

export interface EIP6963ProvidersMapUpdateEvent extends CustomEvent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why these types are moved from web3 to types package?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I think they should be exported and it seemed like the best way to go about it. I can modify the PR export them directly from the web3 package, but this seemed like a better approach to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usually we move types in web3-types package if these are used by 1+ package / are common types.
As web3-types package is a dependency of almost all other packages so we try to keep it light for usecase of other individual packages usage.

( same for utils package , for future changes)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe since we created web3-types, it should encompass all the neccesary types to use the package. I think as well remain consistent, as we have EIP1193Provider types EIP6693 provider types should be included. This will allow these types to be exported through the main package which would make alot of since for most users, as I believe not very many users would know that EIP6693 types would be exported through providers namespace. We had a discussion on this a while back on this issue about doing this change #6952

Copy link
Contributor

@jdevcs jdevcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also EIP-6963 types are exported under provider namespace:

export * from './web3_eip6963.js';

export * as providers from './providers.exports.js';

but I think we may also export directly

@danforbes
Copy link
Contributor Author

Thank you for the clarification, @jdevcs - I had gotten confused. I need to revert #7271 as well.

@danforbes danforbes closed this Sep 20, 2024
@danforbes danforbes deleted the fix/eip6963/export branch September 20, 2024 13:37
@danforbes danforbes restored the fix/eip6963/export branch October 1, 2024 14:29
@danforbes
Copy link
Contributor Author

Closes #6952

@danforbes danforbes reopened this Oct 1, 2024
@danforbes danforbes linked an issue Oct 1, 2024 that may be closed by this pull request
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

Successfully merging this pull request may close these issues.

export eip6963 types
3 participants