Code Monkey home page Code Monkey logo

eth-ui's Introduction

Eth-ui Monorepo

Note: Archived!

Please use wagmi as a modern alternative! Please see scaffold-eth-2 for details on how to use it with scaffold eth


A monorep for eth ui related packages including eth-hooks


๐Ÿ–‡ Eth-hooks Overview

Commonly used Ethereum hooks to supercharge your web3 dev!

Used by ๐Ÿญ scaffold-eth-typescript, ๐Ÿ— scaffold-eth , eth-components and many other web3 projects!

Created by ๐Ÿฐ BuidlGuidl.eth

See the eth-hooks readme for more details.

Author

@shravansunder @stevenpslade @grothem

Documentation

๐Ÿ“š Check out the documentation at Eth-ui-documentation

eth-ui's People

Contributors

0xsama avatar austintgriffith avatar azf20 avatar btogzhan2000 avatar calvbore avatar changoman avatar clacladev avatar codenamejason avatar dependabot[bot] avatar forshtat avatar ironsoul0 avatar j2r5m3 avatar jacobwillemsma avatar omahs avatar omnifient avatar pabloruiz55 avatar ryanlabouve avatar satyambnsal avatar shravansunder avatar shravansunderxero avatar ssp6 avatar swellander avatar taldenv avatar thesuperb1 avatar tobiasbk avatar tomafc330 avatar tomafrench avatar tomfuertes avatar xalava avatar xjjda22 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eth-ui's Issues

useEventListener returns repeated events in Scaffold-Eth

Sometimes useEventListener works as expected and returns the right event logs, with no duplicates. However, other times, it completely fails to do its job and returns many copies of the same log, so that there are 3x or 4x as many logs as expected.

cant install using node 12

plz make this repo include the stable node versions.
this repo is not useful if only include the latest node version. it has to be inclusive to run on stable node versions.

https://nodejs.org/en/about/releases/
Release | Status | Codename | Initial Release | Active LTS Start | Maintenance LTS Start | End-of-life
v12 | Maintenance LTS | Erbium | 2019-04-23 | 2019-10-21 | 2020-11-30 | 2022-04-30
v14 | Active LTS | Fermium | 2020-04-21 | 2020-10-27 | 2021-10-19 | 2023-04-30
v16 | Current | ย  | 2021-04-20 | 2021-10-26 | 2022-10-18 | 2024-04-30
v17 | Pending | ย  | 2021-10-19 | ย  | 2022-04-01 | 2022-06-01
v18 | Pending | ย  | 2022-04-19 | 2022-10-25 | 2023-10-18 | 2025-04-30

https://github.com/scaffold-eth/eth-hooks/blob/0f9ed3aaed0960eb74c80eb2cdb62d8d3ecdfcc3/package.json#L9

useEventListener call back isn't correct

See: https://t.me/c/1551360911/1009 @azf20

Currently we are assuming callback args events Event[]
The actual signature is export type Listener = (...args: Array<any>) => void;

  • the last of this array is the actual event

The following is the fix

const addNewEvent = useCallback((...newEvent) => {
        if (newEvent != null && newEvent.length > 0) {
            const _event = newEvent[newEvent.length - 1]
            const newMap = new Map([[getEventKey(_event), _event]]);
            setEventMap((oldMap) => new Map([...oldMap, ...newMap]));
        }
    }, [setEventMap]);

unexpected "export"

using with nextjs typescript, when importing any hook from the library, throws error when reading "export * from './useBlockNumber'; at index.js.

Is the best way to contribute here adding a github action that publishes a package to npm on successful push or pr to main that works with the tests and this scenario?

Replace parameter provider with context

https://github.com/orgs/scaffold-eth/projects/2#card-69883528

Add context to eth-hooks v3, eth-components v2 and scaffold-eth-typescript

Overview

  • This change adds concept of context using web3-react
  • Creates a connector for web3modal to connect it with web3-react
  • Creates a connector for web3modal that allows it to use StaticJsonUrlRpc so localproviders and burner wallets work
  • replace provider that's being passed around in hooks and components with a web3react based context

App changes

  • All components, hooks and typescript app now use context, EthersAppContext
  • There is a BlockNumberContext as part of EthersAppContext that any hook can subscribe to easily. useOnBlock or usePoller are NOT required
  • Split the app out into chunks
  • Fixed issues with login and log out and made it more seemless
  • Some UI changes

PRs

leadTrigger on useOnRepetition makes a lot of RPC calls

Testing eth-hooks as part of the stage branch of scaffold-eth, there are lots of RPC calls.

This appears to be related to the leadTrigger in useOnRepetition (link). This is executed multiple times, rather than just once. I think using callFunctionWithArgs as a useEffect dependency might be leading to the problem.

I tried a couple of things - removing callFunctionWithArgs as a dependency here worked. I was also able to patch this in my scaffold-eth branch by introducing a "firstCall" useRef which is set to true by default, is required to execute the leadTrigger function, and is set to false when it has been executed. This significantly reduced the polling intensity

Something like:

import { useCallback, useEffect, useRef } from 'react';
...
export const useOnRepetition = (callback, options, ...args) => {
const firstCall = useRef(true)
...
if (options.leadTrigger && firstCall.current) {
            console.log('got that lead trigger')
            firstCall.current = false;
            callFunctionWithArgs();

There might be a more elegant way to solve this

useEventListener needs to be updated as it uses a deprecated method

  • resetEventsBlock is deprecated
  • change logic to properly use contract.queryFilter( event [ , fromBlockOrBlockHash [ , toBlock ] ) in addNewEvent
  • make addNewEvent logic to just get events using the above qureyFunction
  • cache in state if there are performance issues

related test ticket should be done after

Revisit polling frequency

A lot of the polling frequencies are much higher than necessary for a mainnet application. For example, we test for new blocks roughly once every 2 seconds whereas the typical blocktime is 15 seconds.

There's also the question of does a user need their balance being updated every second? There are savings to be made here without impairing UX.

Higher frequencies may be desirable for local chains but we should ensure that the default works well on mainnet

linear test issue 2 [SET-14]

test stuff

no date &


      "**/node_modules/": true,
      "**/obj": true,
      "node_modules": true,
      "node_modules/*/**": true,
      "**/node_modules": true,

Automatically created from Linear (#14)

via LinearSync

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.