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

0.1.x #121

Merged
merged 88 commits into from
Nov 17, 2023
Merged

0.1.x #121

Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
a2dfe8c
feat: modify store, rework connect
codingki Sep 4, 2023
c07049e
feat: rework disconnect
codingki Sep 4, 2023
9e503e1
testing: hook multi chain query
codingki Sep 4, 2023
d341e23
wip: multichain hooks
codingki Sep 4, 2023
fa33a87
feat(hooks): multichain signingClient
codingki Sep 5, 2023
3a2a83e
feat: update signingClients hooks query enabled
codingki Sep 5, 2023
3d75295
feat: query config & args optional
codingki Sep 6, 2023
fad0e72
feat: extract interface
codingki Sep 6, 2023
e7fee24
feat: improve tendermintClient typing
codingki Sep 6, 2023
fdb53d0
fix: typing
codingki Sep 6, 2023
bc5be0d
feat(hooks): multi chain useAccount, useBalances
codingki Sep 7, 2023
a36f052
feat(hooks): multi chain hooks
codingki Sep 7, 2023
83ff5be
fix: import
codingki Sep 7, 2023
f6a744f
feat(docs): jsdocs chains hooks
codingki Sep 7, 2023
cb3d323
feat(docs): update js docs hooks
codingki Sep 7, 2023
0c0cac4
feat(types): string to ChainId
codingki Sep 7, 2023
aadb548
feat(example): migration example
codingki Sep 7, 2023
3429070
temp: remove pMap
codingki Sep 7, 2023
b84b93e
feat: improve useAccount
codingki Sep 7, 2023
9d8b728
feat: #115 remove GrazChain
codingki Sep 7, 2023
34ee552
feat: update tsup and p-map
grikomsn Sep 7, 2023
37589e7
refactor: rework cli & p-map bundling
grikomsn Sep 7, 2023
0098423
fix: ensure using local packages
grikomsn Sep 7, 2023
bded96e
chore: remove ncc.sh
grikomsn Sep 7, 2023
a41cfe5
refactor: remove vendor re-exports
grikomsn Sep 7, 2023
faa24cc
refactor: remove tanstack devtools
grikomsn Sep 7, 2023
cfdf16b
chore: update tsup externals
grikomsn Sep 7, 2023
6f61d18
feat: trim cli deps usage
grikomsn Sep 7, 2023
61d6403
refactor: rework dependencies
grikomsn Sep 7, 2023
c411e58
feat: update build entrypoint
grikomsn Sep 7, 2023
a195f74
feat: update pkg exports
grikomsn Sep 7, 2023
b852dc8
feat: auto reference global types
grikomsn Sep 7, 2023
953cd2c
feat: update peer deps
grikomsn Sep 7, 2023
17bfb81
chore: update tsconfig
grikomsn Sep 7, 2023
4fbaece
refactor: update and reorganize deps
grikomsn Sep 7, 2023
9d92eb3
feat: update tsup configs
grikomsn Sep 7, 2023
4b2b676
chore: update scripts
codingki Sep 8, 2023
0f1836f
chore: run lint
codingki Sep 8, 2023
b0d55d3
feat: required chains param
codingki Sep 8, 2023
06aada5
fix: 0 chains throw
codingki Sep 8, 2023
3ee4f93
feat: bringback pMap
codingki Sep 8, 2023
a486c1a
chore: cleanup examples
codingki Sep 8, 2023
5de8246
feat: bringback defineChains and defineChainInfo
codingki Sep 8, 2023
78d97ed
fix: add jsx compilerOptions
codingki Sep 8, 2023
75d85dc
chore: export ./chains
codingki Sep 8, 2023
926e620
feat(example): update starter
codingki Sep 8, 2023
86145fb
feat(example/next): update chains
codingki Sep 8, 2023
2a4761a
feat: add QueryConfig params to signingClients hooks
codingki Sep 8, 2023
5a36d0f
wip: rewrite starter
codingki Sep 8, 2023
bc20a62
wip: graz wadesta cli
codingki Sep 9, 2023
e529346
chore: update deps
grikomsn Sep 9, 2023
8c6e42c
feat: update [email protected]
grikomsn Sep 9, 2023
e192d12
feat: update exports entrypoints
grikomsn Sep 9, 2023
3022f19
feat: add walletType to useAccount
codingki Sep 10, 2023
cdfc861
fix: empty account disconnect all
codingki Sep 10, 2023
6998112
feat: improve multichain enabled hooks
codingki Sep 10, 2023
b7ca056
feat: remove multichain from useBalance
codingki Sep 10, 2023
e8dfff1
wip(example:starter: update
codingki Sep 10, 2023
084e75b
chore(packages): remove create-graz-app
codingki Sep 10, 2023
b960eba
feat(example): 0.1.x examples
codingki Sep 10, 2023
15f045e
feat(example): remove comment
codingki Sep 10, 2023
226f388
feat(hook): use object param
codingki Sep 10, 2023
67cefe3
wip(docs): 0.1.0 docs
codingki Sep 10, 2023
c04f7ac
chore(docs): update docs
codingki Sep 10, 2023
bb1119d
chore: cleanup
codingki Sep 11, 2023
4887871
feat(docs): 0.1.0 docs
codingki Sep 11, 2023
09e1b70
feat(docs): wip guides
codingki Sep 11, 2023
4ca4590
chore(example): update vite
codingki Sep 11, 2023
3868089
feat(docs): complete guides
codingki Sep 11, 2023
d9e8e6f
chore(docs): reorganize sidebar
codingki Sep 11, 2023
0fae803
chore(docs): cleanup mainnetchains
codingki Sep 11, 2023
a6bfe38
fix(docs): broken links
codingki Sep 18, 2023
75631e6
feat(cli): revert wadesta cli
codingki Sep 18, 2023
6623cc1
feat: 0.1.0-beta.0
codingki Sep 18, 2023
40a2541
remove post install
codingki Oct 2, 2023
82d951f
0.1.0 changelog
codingki Oct 2, 2023
916bf29
fix: wallet connect 0.1.0
codingki Oct 2, 2023
6cd78e2
feat: 0.1.0-beta.1
codingki Oct 2, 2023
135fc80
fix: disconnect type
codingki Oct 2, 2023
09f3e2e
feat: 0.1.0-beta.2
codingki Oct 2, 2023
b685af9
add generate cli
codingki Oct 5, 2023
238d40e
feat: signingClient return undefined if chain not connected
codingki Oct 9, 2023
0cd5cda
feat: v0.1.0-beta.3
codingki Oct 9, 2023
5078741
Update README.md
codingki Nov 15, 2023
05a7c1b
Update CONTRIBUTING.md
codingki Nov 15, 2023
ec5e8d5
Update docs/docs/contributing.md
codingki Nov 15, 2023
137b2dc
Update docs/docs/getting-started.mdx
codingki Nov 15, 2023
796d934
feat: 0.1.0
codingki Nov 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
public-hoist-pattern[]=*
publish-branch=dev
strict-peer-dependencies=false
prefer-workspace-packages=true
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
Expand Down
28 changes: 15 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ This project and everyone participating in it is governed by the [`graz` Code of

### Why this library exist?

Currently there is no stable library for cosmos wallets, in ethereum there's [`wagmi`](https://wagmi.sh) with hook patterns that we inspired from.
Currently there were no stable library for cosmos wallets. We were inspired by the patterns in [`wagmi`](https://wagmi.sh) in the Etherium ecosystem.
codingki marked this conversation as resolved.
Show resolved Hide resolved

## What should I know before I get started?

It would be better you know these things:
It greatly helps if you already have a basic understanding of:

- [Cosmos ecosystem](https://cosmos.network/)
- [Cosmjs](https://cosmos.github.io/cosmjs/)
- [`react-query`](https://react-query.tanstack.com/)
- [`zustand`](https://github.com/pmndrs/zustand)
- [Keplr Wallet](https://docs.keplr.app)
Expand All @@ -49,11 +50,9 @@ The following steps will get you up and running to contribute to `graz`:

```sh
├── packages/ # local packages
│   ├── eslint-config/ # project eslint configuration
│   ├── prettier-config/ # project prettier configuration
│   └── graz/ # graz
├── docs/ # documentation website
└── example/ # example website (nextjs + chakra ui)
└── example/* # example website (nextjs + chakra ui)
```

### graz
Expand All @@ -66,31 +65,34 @@ The following steps will get you up and running to contribute to `graz`:
│   └── provider/ # application state providers
│   └── store/ # application state stores
│   └── types/ # shared types
├── dist/ # output
├── dist/ # output graz package
├── chains/ # output chains
```

## Development

- `pnpm install`: bootstrap the entire project
- `pnpm graz install`: install `graz` project
- `pnpm graz build`: build `graz` package
- `pnpm install`: install all projects
- `pnpm dev`: compiles `graz` and start the development server of the example app
- `pnpm docs dev`: start the documentation website
- `pnpm project:docs dev`: start the documentation website
- `pnpm example dev`: start the example app

## Pull Request

Pull requests need only the 👍 of one collaborator to be merged.
Pull requests only need one collaborator 👍 to be merged.

### Commit Convention

Before you create a Pull Request, please check whether your commits comply with the commit conventions used in this repository.

When you create a commit we kindly ask you to follow the convention category(scope or module): message in your commit message while using one of the following categories:
When you create a commit we kindly ask you to follow the convention of category (scope or module): title in your commit message, using one of the following categories:

- `feat / feature`: all changes that introduce completely new code or new features
- `fix`: changes that fix a bug (ideally you will additionally reference an issue if present)
- `refactor`: any code related change that is not a fix nor a feature
- `fix`: changes that fix a bug (reference the relevant issue(s) if possible)
- `refactor`: any code-related change that is not a fix nor a feature
- `docs`: changing existing or creating new documentation (i.e. README, docs for usage of a lib or cli usage)
- `build`: all changes regarding the build of the software, changes to dependencies or the addition of new dependencies
- `build`: all changes regarding the build of the software, updates to dependencies, or the addition of new dependencies
- `test`: all changes regarding tests (adding new tests or changing existing ones)
- `ci`: all changes regarding the configuration of continuous integration (i.e. github actions, ci system)
- `chore`: all changes to the repository that do not fit into any of the above categories
Expand Down
56 changes: 28 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
## Features

- 🪝 20+ hooks for interfacing with wallets, clients, signers, etc. (connecting, view balances, send tokens, etc.)
- 💳 Multiple wallet supports (Keplr, Leap, Cosmostation, WalletConnect )
- ⚙️ Generate mainnet & testnet `ChainInfo` from chain registry
- 💳 Multiple wallet supports (Keplr, Leap, Cosmostation, Vectis, Metamask Snap, WalletConnect)
- ⚙️ Generate mainnet & testnet `ChainInfo`
- 📚 Built-in caching, request deduplication, and all the good stuff from [`@tanstack/react-query`](https://tanstack.com/query) and [`zustand`](https://github.com/pmndrs/zustand)
- 🔄 Auto refresh on wallet and network change
- 👏 Fully typed and tree-shakeable
Expand All @@ -35,21 +35,39 @@ yarn add graz
pnpm add graz
```

### Install peer dependencies

To avoid version missmatch we dcided to make these packages as peer dependencies
codingki marked this conversation as resolved.
Show resolved Hide resolved

```shell
# using npm
npm install @cosmjs/cosmwasm-stargate @cosmjs/launchpad @cosmjs/proto-signing @cosmjs/stargate @cosmjs/tendermint-rpc long

# using yarn
yarn add @cosmjs/cosmwasm-stargate @cosmjs/launchpad @cosmjs/proto-signing @cosmjs/stargate @cosmjs/tendermint-rpc long

# using pnpm
pnpm add @cosmjs/cosmwasm-stargate @cosmjs/launchpad @cosmjs/proto-signing @cosmjs/stargate @cosmjs/tendermint-rpc long
```

## Quick start

Wrap your React app with `<GrazProvider />` and use available `graz` hooks anywhere:

```jsx
import { GrazProvider, mainnetChains } from "graz";
import { GrazProvider } from "graz";

const cosmoshub: ChainInfo = {
chainId: "cosmoshub-4",
chainName: "Cosmos Hub",
//... rest of cosmoshub ChainInfo
}

function App() {
return (
<GrazProvider
// optional
grazOptions={{
defaultChain: mainnetChains.cosmos,
}}
>
<GrazProvider grazOptions={{
chains: [cosmoshub]
}}>
<Wallet />
</GrazProvider>
);
Expand Down Expand Up @@ -79,27 +97,9 @@ function Wallet() {

## Examples

- Next.js + Multi chain: https://graz.sh/examples/starter ([source code](https://github.com/graz-sh/graz/tree/dev/example/starter/))
- Next.js + Chakra UI: https://graz.sh/examples/next ([source code](./example/next/))
- Vite: https://graz.sh/examples/vite ([source code](./example/vite/))
- Next.js Starter: https://graz.sh/examples/starter ([source code](https://github.com/graz-sh/graz/tree/dev/example/starter/))

## Third-party dependencies

`graz` uses various dependencies such as [`@cosmjs/cosmwasm-stargate`](https://www.npmjs.com/package/@cosmjs/cosmwasm-stargate) and [`@keplr-wallet/types`](https://www.npmjs.com/package/@keplr-wallet/types).

Rather than importing those packages directly, you can import from [`graz/dist/cosmjs`](./packages/graz/src/cosmjs.ts) and [`graz/dist/keplr`](./packages/graz/src/keplr.ts) which re-exports all respective dependencies:

```diff
- import type { CosmWasmClient } from "@cosmjs/cosmwasm-stargate";
+ import type { CosmWasmClient } from "graz/dist/cosmjs";
```

But if you prefer importing from their respective pacakges, you can install dependencies that `graz` uses for better intellisense:

```sh
# using pnpm
pnpm add @cosmjs/cosmwasm-stargate @cosmjs/proto-signing @cosmjs/stargate @keplr-wallet/types
```

## API

Expand Down
13 changes: 11 additions & 2 deletions docs/docs/change-log.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
---
sidebar_position: 15
sidebar_position: 8
---

# Changelog

## Version 0.1.0

- Multi Chain experience
- Removed `GrazChain` type
- Reworked `GrazProvider`
- Roworked most of the hooks

Read migration guide [here](./migration-guide/#010-breaking-changes)

## Version 0.0.51

- Fix Wallet Connect multiple prompt when connect in mobile
Expand Down Expand Up @@ -90,5 +99,5 @@ sidebar_position: 15

- ✅ [WalletConnect v2 support](./wallet-connect.md)
- ✅ Added more `WalletType` for connecting WalletConnect wallets
- 🗑️ Deprecated constants, will be removed in next version `mainnetChains`, `mainnetChainsArray`, `testnetChains`, `testnetChainsArray`. Use [`graz generate`](./generate-chain-info.mdx)👍
- 🗑️ Deprecated constants, will be removed in next version `mainnetChains`, `mainnetChainsArray`, `testnetChains`, `testnetChainsArray`. Use [`graz generate`](./generate-chain-info.md)👍
- 🛠️ Splitted internal store between user session and graz internal
4 changes: 2 additions & 2 deletions docs/docs/constants/WALLET_TYPES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
### Usage

```tsx
import { WALLET_TYPES, useConnect, mainnetChains } from "graz";
import { WALLET_TYPES, useConnect } from "graz";

export const SupportedWallet = () => {
const { connect } = useConnect();
return (
<div>
{WALLET_TYPES.map((name) => (
<button onClick={connect({ chain: mainnetChains.cosmoshub, walletType: name })} key={name}>
<button onClick={connect({ chain: cosmoshub, walletType: name })} key={name}>
{name}
</button>
))}
Expand Down
16 changes: 9 additions & 7 deletions docs/docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ This project and everyone participating in it is governed by the [`graz` Code of

### Why this library exist?

Currently there is no stable library for cosmos wallets. We were inspired by the patterns in [`wagmi`](https://wagmi.sh) in the Etherium ecosystem.
Currently there were no stable library for cosmos wallets. We were inspired by the patterns in [`wagmi`](https://wagmi.sh) in the Etherium ecosystem.
codingki marked this conversation as resolved.
Show resolved Hide resolved

## What should I know before I get started?

It greatly helps if you already have a basic understanding of:

- [Cosmos ecosystem](https://cosmos.network/)
- [Cosmjs](https://cosmos.github.io/cosmjs/)
- [`react-query`](https://react-query.tanstack.com/)
- [`zustand`](https://github.com/pmndrs/zustand)
- [Keplr Wallet](https://docs.keplr.app)
Expand All @@ -49,11 +50,9 @@ The following steps will get you up and running to contribute to `graz`:

```sh
├── packages/ # local packages
│   ├── eslint-config/ # project eslint configuration
│   ├── prettier-config/ # project prettier configuration
│   └── graz/ # graz
├── docs/ # documentation website
└── example/ # example website (nextjs + chakra ui)
└── example/* # example website (nextjs + chakra ui)
```

### graz
Expand All @@ -66,14 +65,17 @@ The following steps will get you up and running to contribute to `graz`:
│   └── provider/ # application state providers
│   └── store/ # application state stores
│   └── types/ # shared types
├── dist/ # output
├── dist/ # output graz package
├── chains/ # output chains
```

## Development

- `pnpm install`: bootstrap the entire project
- `pnpm graz install`: install `graz` project
- `pnpm graz build`: build `graz` package
- `pnpm install`: install all projects
- `pnpm dev`: compiles `graz` and start the development server of the example app
- `pnpm docs dev`: start the documentation website
- `pnpm project:docs dev`: start the documentation website
- `pnpm example dev`: start the example app

## Pull Request
Expand Down
14 changes: 7 additions & 7 deletions docs/docs/examples/index.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
sidebar_position: 3
sidebar_position: 5
---

# Examples

## Next.js

- Website: https://graz.sh/examples/next
- GitHub: https://github.com/graz-sh/graz/tree/dev/example/next

## Next.js Starter
## Next.js + Multi chain

- Website: https://graz.sh/examples/starter
- GitHub: https://github.com/graz-sh/graz/tree/dev/example/starter

## Next.js Simple

- Website: https://graz.sh/examples/next
- GitHub: https://github.com/graz-sh/graz/tree/dev/example/next

## Vite

- Website: https://graz.sh/examples/vite
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 4
sidebar_position: 5
---

# Generate ChainInfo
Expand Down Expand Up @@ -48,5 +48,5 @@ in your package.json add it to in your install or postInstall scripts
After you generate `ChainInfo` you can use it in you project

```ts
import { axelar, cosmoshub, sommelier, mainnetChains, testnetChains } from "graz/chains";
import { axelar, cosmoshub, sommelier } from "graz/chains";
```
34 changes: 25 additions & 9 deletions docs/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ yarn add graz
pnpm add graz
```

## Install peer dependencies

To avoid version missmatch we dcided to make these packages as peer dependencies
codingki marked this conversation as resolved.
Show resolved Hide resolved

```shell
# using npm
npm install @cosmjs/cosmwasm-stargate @cosmjs/launchpad @cosmjs/proto-signing @cosmjs/stargate @cosmjs/tendermint-rpc long

# using yarn
yarn add @cosmjs/cosmwasm-stargate @cosmjs/launchpad @cosmjs/proto-signing @cosmjs/stargate @cosmjs/tendermint-rpc long

# using pnpm
pnpm add @cosmjs/cosmwasm-stargate @cosmjs/launchpad @cosmjs/proto-signing @cosmjs/stargate @cosmjs/tendermint-rpc long
```

## Quick start

### 1. Wrap app with `<GrazProvider />`
Expand All @@ -45,20 +60,21 @@ function App() {

### 2. Configure `grazOptions`

:::info

**Optional** You can configure your default chain, default wallet, default `SigningClient`

:::
```tsx
import { ChainInfo } from "@keplr-wallet/types";
import { GrazProvider } from "graz";

```jsx
import { GrazProvider, mainnetChains } from "graz";
const cosmoshub: ChainInfo = {
chainId: "cosmoshub-4",
chainName: "Cosmos Hub",
//... rest of cosmoshub ChainInfo
};

function App() {
return (
<GrazProvider
grazOptions={{
defaultChain: mainnetChains.cosmoshub,
chains: [cosmoshub],
}}
>
<Wallet />
Expand All @@ -72,7 +88,7 @@ function App() {
Use hooks! Every component inside the GrazProvider is now set up to use the graz hooks.

```jsx
import { mainnetChains, useAccount, useConnect, useDisconnect } from "graz";
import { useAccount, useConnect, useDisconnect } from "graz";

function Wallet() {
const { connect, status } = useConnect();
Expand Down
8 changes: 8 additions & 0 deletions docs/docs/guides/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Guides",
"position": 4,
"link": {
"type": "generated-index",
"description": "Collection of Constants that graz provide"
}
}
Loading
Loading