GithubHelp home page GithubHelp logo

scaffold-eth / eth-ui Goto Github PK

View Code? Open in Web Editor NEW
435.0 435.0 56.0 21.59 MB

๐Ÿ–‡ React library of commonly used Ethereum hooks

JavaScript 21.77% TypeScript 67.82% Shell 0.02% Solidity 0.40% CSS 0.64% HTML 0.02% MDX 9.34%
ethereum hooks react react-hooks typescript web3

eth-ui's Introduction

๐Ÿ— Scaffold-ETH

๐Ÿšจ๐Ÿšจ This repository has been archived and is now read-only ๐Ÿšจ๐Ÿšจ

You are still welcome to fork and use as a template but no more changes will be made to this repository.

๐ŸŽ– Scaffold-ETH 2 is the latest version, we recommend you fork: https://github.com/scaffold-eth/scaffold-eth-2


everything you need to build on Ethereum! ๐Ÿš€

๐Ÿงช Quickly experiment with Solidity using a frontend that adapts to your smart contract:

image

๐Ÿ„โ€โ™‚๏ธ Quick Start

Prerequisites: Node (v18 LTS) plus Yarn (v1.x) and Git

๐Ÿšจ If you are using a version < v18 you will need to remove openssl-legacy-provider from the start script in package.json

1๏ธโƒฃ clone/fork ๐Ÿ— scaffold-eth:

git clone https://github.com/scaffold-eth/scaffold-eth.git

2๏ธโƒฃ install and start your ๐Ÿ‘ทโ€ Hardhat chain:

cd scaffold-eth
yarn install
yarn chain

3๏ธโƒฃ in a second terminal window, start your ๐Ÿ“ฑ frontend:

๐Ÿšจ if your contracts are not deployed to localhost, you will need to update the default network in App.jsx to match your default network in hardhat-config.js.

cd scaffold-eth
yarn start

4๏ธโƒฃ in a third terminal window, ๐Ÿ›ฐ deploy your contract:

๐Ÿšจ if you are not deploying to localhost, you will need to run yarn generate first and then fund the deployer account. To view account balances, run yarn account. You will also need to update hardhat-config.js with the correct default network.

cd scaffold-eth
yarn deploy

๐Ÿ” Edit your smart contract YourContract.sol in packages/hardhat/contracts

๐Ÿ“ Edit your frontend App.jsx in packages/react-app/src

๐Ÿ’ผ Edit your deployment scripts in packages/hardhat/deploy

๐Ÿ“ฑ Open http://localhost:3000 to see the app

๐Ÿšจ๐Ÿ“ก To deploy to a public domain, use yarn surge. You will need to have a surge account and have the surge CLI installed. There is also the option to deploy to IPFS using yarn ipfs and yarn s3 to deploy to an AWS bucket ๐Ÿชฃ There are scripts in the packages/react-app/src/scripts folder to help with this.`

๐Ÿ“š Documentation

Documentation, tutorials, challenges, and many more resources, visit: docs.scaffoldeth.io

๐Ÿฆ Other Flavors

๐Ÿ”ญ Learning Solidity

๐Ÿ“• Read the docs: https://docs.soliditylang.org

๐Ÿ“š Go through each topic from solidity by example editing YourContract.sol in ๐Ÿ— scaffold-eth

๐Ÿ“ง Learn the Solidity globals and units

๐Ÿ›  Buidl

Check out all the active branches, open issues, and join/fund the ๐Ÿฐ BuidlGuidl!

๐Ÿ’Œ P.S.

๐ŸŒ You need an RPC key for testnets and production deployments, create an Alchemy account and replace the value of ALCHEMY_KEY = xxx in packages/react-app/src/constants.js with your new key.

๐Ÿ“ฃ Make sure you update the InfuraID before you go to production. Huge thanks to Infura for our special account that fields 7m req/day!

๐Ÿƒ๐Ÿ’จ Speedrun Ethereum

Register as a builder here and start on some of the challenges and build a portfolio.

๐Ÿ’ฌ Support Chat

Join the telegram support chat ๐Ÿ’ฌ or buidlguidl discord to ask questions and find others building with ๐Ÿ— scaffold-eth!


๐Ÿ™ Please check out our Gitcoin grant too!

Automated with Gitpod

Open in Gitpod

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 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

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

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?

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

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

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

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.

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]);

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

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.