Skip to content

Commit

Permalink
wip: next (wevm#311)
Browse files Browse the repository at this point in the history
* WIP

* wippy wip

* more writing

* Add isIdle

* Fix

* Fix heading

* Update

* Add status

* WIP: Start working on WagmiClient & actions

* try zustand

* wip

* wagmi-core -> @wagmi/core

* Cleanup

* more love

* clean

* wip

* wip

* fix directory structure

* fix ts issuez & directory structure

* connect tests

* moar tests

* feat: fetchEnsName action

* refactor: wagmi client types

* refactor: wagmi client constructor

* add fetchBalance action & refactor action types

* Add fetchSigner

* accounts/ > account/

* Add getContract

* Add watchBalance

* Add watchSigner

* Add watchContractEvent

* Add signMessage

* Add writeContract

* Add sendTransaction, waitForTransaction

* feat: add fetchEnsAddress

* feat: add watch hooks for ens

* feat: add ens resolver actions

* feat: add ens avatar actions

* `@wagmi/core` & the platform-agnostic `WagmiClient` concept (wevm#203)

* WIP

* wippy wip

* more writing

* Add isIdle

* Fix

* Fix heading

* Update

* Add status

* WIP: Start working on WagmiClient & actions

* try zustand

* wip

* wagmi-core -> @wagmi/core

* Cleanup

* more love

* clean

* wip

* wip

* fix directory structure

* fix ts issuez & directory structure

* connect tests

* moar tests

* feat: fetchEnsName action

* refactor: wagmi client types

* refactor: wagmi client constructor

* add fetchBalance action & refactor action types

* Add fetchSigner

* accounts/ > account/

* Add getContract

* Add watchBalance

* Add watchSigner

* Add watchContractEvent

* Add signMessage

* Add writeContract

* Add sendTransaction, waitForTransaction

* feat: add fetchEnsAddress

* feat: add watch hooks for ens

* feat: add ens resolver actions

* feat: add ens avatar actions

* Add fetchBlockNumber; watchBlockNumber

* Add fetchFeeData; watchFeeData

* add fetchToken

* Add watchToken

* Add readContract; watchReadContract

* Update tests

Co-authored-by: Tom Meagher <tom@meagher.co>

* feat: add hardhat

* refactor: remove remix

* feat: upgrade to coinbase wallet sdk

* refactor: ethers imports

* wip: React Query (wevm#247)

* feat: rq

* feat: connect caching

* wip: account and connect

* wip: ens lookup

* Make local storage persistence actually work; added 'status' to client state in favour of 'connecting'

* simple client cache?

* Refactor

* feat: update tests

* useBlockNumber

* Refactor

* feat: client updates

* chore: update snapshots

* wip: useNetwork

* wip: useBalance

* wip: useSigner

* feat: ens hooks

* wip: useSendTransaction

* wip: context refactor

* fix exports

* test: update useSendTransaction.test.ts

* fix: merge conflict

* feat: persist status

* test: useConnect

* refactor: watch equality

* feat: update useAccount

* test: useAccount

* feat: useNetwork

* wip: useContractRead

* tests: skip stale tests

* tests: add useContractRead & deserializeCache tests

* refactor: const to function

* test: useNetwork

* wip: useSignMessage

* wip: useContractWrite

* tests: useContractWrite

* wip: useContractEvent

* wip: useToken

* add a few more query options

* tests: useToken

* feat: add signTypedData

* feat: dynamic imports

* chore: bump packages

* feat: useFeeData

* test: update error throwing

* refactor: serialize

* fix: lint errors

* chore: clean up

* feat: watch providers

* fix: build error

* feat: make provider hooks reactive

* test: updates

* remove imperative getter fns

* chore: update snaphosts

* docs: get building

* chore: bump nextra

* docs: restructure

Co-authored-by: Tom Meagher <tom@meagher.co>

* Version packages

* fix: cache connector chains

* chore: update next example wagmi version

* Version packages

* fix: force address to be required

* Version packages

* fix: resolve issue where getProvider in connectors wasn't being awaited

* Version packages

* fix: fix useContractWrite mutation fn arguments

* fix: remove storage persistence of connector, add chains to client state

* Version packages

* fix: don't persist account data when autoConnect is falsy

* Version packages

* feat: add connecting event to connectors

* Version packages

* remove code snippet from playground

* Export useWaitForTransaction (wevm#284)

* chore: bump hardhat

* test: ens avatar mocks

* refactor: use message event instead of connecting as per EIP-1193

* Version packages

* examples: update playground

* Require hash or wait parameter, not both (wevm#296)

* chore: change babel target

* wip: 0.3.0 docs (wevm#278)

* Add some docs

* feat: add client docs

* wip: migration guide

* wip: more migration guide

* docs: update getting started

* docs: start connectors

* docs: tweaks

* test: ens avatar mocks

* test: bump timeout

* refactor: abis

* docs: reorder

* docs: coinbase wallet connector

* docs: useBlockNumber

* docs: finish connectors

* docs: ens hooks

* docs: token and fee data

* docs: constants

* docs: providers

* test: update snapshots

* docs: _app

* docs: connect

* chore: update readme

* chore: reorg

* docs: add fathom

* refactor: rename useConnect connector to pendingConnector

* docs: fix Coinbase Wallet SDK docs links (wevm#285)

* chore: move guides to examples

* chore: clean up

* docs: useContract

* feat: useDisconnect

* docs: amend useAccount migration notes

* docs: useContractRead

* docs: useContractWrite

* docs: fix type error

* docs: useContractEvent

* docs: useSendTransaction

* docs: useSigner

* docs: useSignMessage

* docs: useWaitForTransaction

* docs: useDisconnect and useSignTypedData

* docs: useNetwork

* docs: tweaks

* chore: readme

* chore: updates examples

* ci: bump actions checkout

* docs: update examples

* docs: siwe example

Co-authored-by: Tom Meagher <tom@meagher.co>
Co-authored-by: Mark Dalgleish <mark.john.dalgleish@gmail.com>

* docs: update contributing

* refactor: rpc urls and block explorers (wevm#308)

* refactor: default examples to alchemy

* chore: version packages

* chore: update lock file

* docs: tweak header

* fix: vite example build

* refactor: remove ens from useAccount (wevm#313)

* docs: tweaks

* docs: constants

* docs: comparison table

* add more example rpc url chains (wevm#314)

* feat: improve ethers provider generics (wevm#315)

* chore: version packages

* chore: republish

* chore: add lockfile

* tmm/ci optimize (wevm#316)

* ci: caching

* ci: add branches

* test: update snapshots

* docs: tweak

* fix: update connectors on chain change

* refactor: window ethereum types

* chore: version packages

* docs: tweaks

* refactor: type tweaks

* docs: injected options

* docs: codeblock style tweaks

* docs: copy tweaks

* feat: pass custom chain id (wevm#328)

* feat: pass custom chain id

* docs: add chainId

* test: close open ws

* chore: detect open handles

* chore: revert detect open handles

* chore: skip tests

* feat: add warn for nonexistant contract functions

* chore: update license from mit to wagmit

* chore: version packages

* chore: add keywords

* test: useChainId (wevm#330)

* feat: keep previous data when watching

* chore: version packages

* feat(next): Update to React Query 4 (wevm#331)

* Update to React Query 4

* feat: add custom useQuery for tracked stuff

Co-authored-by: awkweb <tom@meagher.co>

* fix: fix useConnect test

* fix: fix block number caching inconsistencies

* fix: fix watchBlockNumber listener leak

* chore: add missing dep

* docs: add docs for cacheOnBlock for useContractRead

* chore: Version packages

* wip: loose ends (wevm#342)

* test: boost coverage

* docs: clean up

* test: finish query tests

* test: boost useConnect

* test: boost useDisconnect

* test: boost useNetwork

* test: boost useContractWrite and useContractEvent

* chore: bump zustand

* chore: publish

* chore: add readmes for examples

* test: bump timeout

* chore: bump coinbase wallet

* test: clean up actions

* test: update account actions

* test: update timeout

* chore: update docs with updated useQuery API

* docs: update contributing docs

* test: bump timeout

* chore: remove hardcoded hardhat config

* feat: react 18 support

* docs: add link to 0.2.x docs

* test: bump timeout

* chore: version packages

* ci: add bundlewatch

* chore: update react-query

* chore: Version packages

* docs: add logotype

* docs: favicon

* chore: update readme

* docs: update

* refactor: make block explorers and rpc urls consistent types

* chore: version packages

* fix: reconnecting

* refactor: store key

* chore: version packages

* chore: exit pre mode

* chore: removing polling interval from mock provider

Co-authored-by: moxey.eth <jakemoxey@gmail.com>
Co-authored-by: Przemysław Kołodziejczyk <eshlox@users.noreply.github.com>
Co-authored-by: Mark Dalgleish <mark.john.dalgleish@gmail.com>
Co-authored-by: ALBERT <albert@alchemy.com>
  • Loading branch information
5 people authored Apr 25, 2022
1 parent e17f122 commit 24ce011
Show file tree
Hide file tree
Showing 424 changed files with 24,671 additions and 13,995 deletions.
6 changes: 6 additions & 0 deletions .changeset/cold-penguins-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': minor
'wagmi': minor
---

don't persist account data when `autoConnect` is falsy
8 changes: 7 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
},
"ignore": ["docs", "example-next", "example-vite-react", "example-remix"]
"ignore": [
"docs",
"example-dev",
"example-next",
"example-remix",
"example-vite-react"
]
}
6 changes: 6 additions & 0 deletions .changeset/cool-jobs-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': patch
'wagmi': patch
---

add chainId to actions and hooks
6 changes: 6 additions & 0 deletions .changeset/eight-birds-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': patch
'wagmi': patch
---

showtime
6 changes: 6 additions & 0 deletions .changeset/fair-numbers-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': patch
'wagmi': patch
---

improve type support for ethers providers
6 changes: 6 additions & 0 deletions .changeset/flat-doors-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': minor
'wagmi': minor
---

- fix(@wagmi/core): persist connector chains to local storage
7 changes: 7 additions & 0 deletions .changeset/four-actors-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@wagmi/core': minor
'wagmi': minor
---

- Favour `message` event over `connecting` event to conform to EIP-1193
- Export `useWaitForTransaction`
5 changes: 5 additions & 0 deletions .changeset/grumpy-sloths-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'wagmi': minor
---

force address to be required in `useAccount`
6 changes: 6 additions & 0 deletions .changeset/itchy-badgers-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': patch
'wagmi': patch
---

update zustand
6 changes: 6 additions & 0 deletions .changeset/khaki-dingos-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': minor
'wagmi': minor
---

Initial 0.3.0 release
8 changes: 8 additions & 0 deletions .changeset/kind-wombats-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@wagmi/core': minor
'wagmi': minor
---

Add `cacheOnBlock` config for `useContractRead`
Update `react-query` to v4
Fix `watchBlockNumber` listener leak
6 changes: 6 additions & 0 deletions .changeset/modern-dodos-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': patch
'wagmi': patch
---

update babel target
5 changes: 5 additions & 0 deletions .changeset/pink-trees-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@wagmi/core': minor
---

add `connecting` event to connectors
37 changes: 37 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"mode": "exit",
"tag": "next",
"initialVersions": {
"@wagmi/core": "0.1.13",
"wagmi": "0.2.17",
"docs": "0.0.1",
"example-next": "0.0.1",
"example-playground": "0.0.1",
"example-remix": "0.0.1",
"example-vite-react": "0.0.1",
"example-dev": "0.0.1"
},
"changesets": [
"cold-penguins-heal",
"cool-jobs-grin",
"eight-birds-clean",
"fair-numbers-tie",
"flat-doors-impress",
"four-actors-tell",
"grumpy-sloths-cough",
"itchy-badgers-lay",
"khaki-dingos-juggle",
"kind-wombats-draw",
"modern-dodos-dress",
"pink-trees-walk",
"real-icons-flow",
"rich-beers-hope",
"selfish-poets-poke",
"sharp-lizards-explode",
"shiny-pumas-suffer",
"tasty-humans-jog",
"thirty-pears-search",
"twelve-papayas-reflect",
"violet-emus-remain"
]
}
6 changes: 6 additions & 0 deletions .changeset/real-icons-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': patch
'wagmi': patch
---

update block explorers and rpc urls structure
6 changes: 6 additions & 0 deletions .changeset/rich-beers-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': patch
'wagmi': patch
---

keep previous data when watching
5 changes: 5 additions & 0 deletions .changeset/selfish-poets-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'wagmi': minor
---

- fix `useContractWrite` mutation fn arguments
6 changes: 6 additions & 0 deletions .changeset/sharp-lizards-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': patch
'wagmi': patch
---

republish
5 changes: 5 additions & 0 deletions .changeset/shiny-pumas-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@wagmi/core': minor
---

Fix issue where `getProvider` was not being awaited in `getSigner`
6 changes: 6 additions & 0 deletions .changeset/tasty-humans-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': minor
---

- remove storage persistence of `connector`
- add `chains` to client state
6 changes: 6 additions & 0 deletions .changeset/thirty-pears-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': patch
'wagmi': patch
---

fix stale connectors when switching chains
6 changes: 6 additions & 0 deletions .changeset/twelve-papayas-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': patch
'wagmi': patch
---

last beta
5 changes: 5 additions & 0 deletions .changeset/violet-emus-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'wagmi': minor
---

Update react-query to 4.0.0-beta.5
18 changes: 18 additions & 0 deletions .config/bundlewatch.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
files: [
// Core
{
path: 'packages/core/dist/*.cjs.prod.js',
},
{
path: 'packages/core/dist/*.esm.js',
},
// React
{
path: 'packages/react/dist/*.cjs.prod.js',
},
{
path: 'packages/react/dist/*.esm.js',
},
],
}
15 changes: 15 additions & 0 deletions .config/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { HardhatUserConfig } from 'hardhat/config'

const config: HardhatUserConfig = {
networks: {
hardhat: {
forking: {
url: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_ID}`,
blockNumber: 14604308,
},
loggingEnabled: false,
},
},
}

export default config
File renamed without changes.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

5 changes: 5 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
}
}
],
"ignorePatterns": [
"node_modules",
"dist",
"CHANGELOG.md"
],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx", ".d.ts"]
Expand Down
2 changes: 1 addition & 1 deletion .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at tom@meagher.co. All
reported by contacting the project team at tmm@awkweb.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand Down
74 changes: 74 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
gm.

Thanks for your interest in contributing to wagmi! Please take a moment to review this document **before submitting a pull request.**

If you want to contribute, but aren't sure where to start, you can create a [new discussion](https://github.com/tmm/wagmi/discussions) or reach out [on Twitter](https://twitter.com/awkweb).

## Pull requests

**Please ask first before starting work on any significant new features.**

It's never a fun experience to have your pull request declined after investing a lot of time and effort into a new feature. To avoid this from happening, we request that contributors create [a feature request](https://github.com/tmm/wagmi/discussions/new?category=ideas) to first discuss any significant new ideas. This includes things like adding new hooks, connectors, chains, etc.

## Prerequisites

This project uses [`pnpm`](https://pnpm.io) as a package manager.

## Development playground

To play around with code while making changes, you can run the development playground:

```bash
pnpm install
pnpm dev:playground
```

The development playground code is located at [`examples/_dev`](../examples/_dev). Make sure you clean up after yourself before pushing up any changes.

## Coding standards

Our code formatting rules are defined in [.eslintrc](../.eslintrc). You can check your code against these standards by running:

```bash
pnpm lint
```

To automatically fix any error in your code, you can run:

```bash
pnpm lint:fix
```

## Running tests

wagmi runs it's test suite against a forked Ethereum network using [Hardhat](https://hardhat.org). To get started, add a `ALCHEMY_ID` to your environment variables. You can sign up for a free Alchemy account [here](https://www.alchemy.com/).

Once you are set up, you can start the local Ethereum network and run tests in parallel:

```bash
pnpm test:ci
```

Or fire up two terminal sessions and run `pnpm hardhat:dev` in one and `pnpm test:watch` in the other. This will run tests interactively while developing.

Please ensure that the tests are passing when submitting a pull request. If you're adding new features to wagmi, please include tests.

## Updating documentation

Documentation is crucial to helping developers of all experience levels use wagmi. To preview the docs site in development mode, run:

```bash
pnpm dev:docs
```

Not all contributions require updates to the docs. Also, feel free to update the docs if you think somemthing is unclear or could be explained better.

## CI setup

The following secrets are required to run the GitHub Actions workflows:

```
ALCHEMY_ID
BUNDLEWATCH_GITHUB_TOKEN
NPM_TOKEN
```
5 changes: 4 additions & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Ask Question
url: https://github.com/tmm/wagmi/discussions
url: https://github.com/tmm/wagmi/discussions/new?category=q-a
about: Ask questions and discuss with other community members
- name: Request Feature
url: https://github.com/tmm/wagmi/discussions/new?category=ideas
about: Requests features or brainstorm ideas for new functionality
27 changes: 27 additions & 0 deletions .github/logo-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions .github/logo-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 24ce011

Please sign in to comment.