From c10c606666041461f03400fda693a3315a692723 Mon Sep 17 00:00:00 2001 From: adairrr <32375605+adairrr@users.noreply.github.com> Date: Sun, 24 Nov 2024 13:21:55 -0500 Subject: [PATCH 01/18] Update wagemos constants --- .../src/app/_components/place-bet-dialog.tsx | 5 +++-- .../src/app/_components/wallet-button.tsx | 11 ++++++++--- .../src/app/_lib/constants.ts | 3 +++ examples/wagemos-cosmoskit-nextjs/src/app/page.tsx | 5 +++-- examples/wagemos-graz-nextjs/src/_generated/index.ts | 2 +- .../wagemos-graz-nextjs/src/app/_lib/constants.ts | 2 +- examples/wagemos-graz-nextjs/src/app/layout.tsx | 2 +- packages/core/src/utils/constants.ts | 2 +- 8 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 examples/wagemos-cosmoskit-nextjs/src/app/_lib/constants.ts diff --git a/examples/wagemos-cosmoskit-nextjs/src/app/_components/place-bet-dialog.tsx b/examples/wagemos-cosmoskit-nextjs/src/app/_components/place-bet-dialog.tsx index 36fe1983..445aa4ca 100644 --- a/examples/wagemos-cosmoskit-nextjs/src/app/_components/place-bet-dialog.tsx +++ b/examples/wagemos-cosmoskit-nextjs/src/app/_components/place-bet-dialog.tsx @@ -37,6 +37,7 @@ import { SelectValue, } from '../../components/ui/select' import { useToast } from '../../components/ui/use-toast' +import { ROUND_ACCOUNT_ID, ROUND_CHAIN_NAME } from '../_lib/constants' const placeBetSchema = z.object({ amount: z.coerce @@ -63,8 +64,8 @@ export function PlaceBetDialog({ round }: { round: RoundResponse }) { const { mutateAsync: placeBetAsync, isLoading } = betting.mutations.usePlaceBet({ - accountId: stringToAccountId('neutron-18'), - chainName: 'neutron', + accountId: stringToAccountId(ROUND_ACCOUNT_ID), + chainName: ROUND_CHAIN_NAME, }) const onSubmit: SubmitHandler> = useCallback( diff --git a/examples/wagemos-cosmoskit-nextjs/src/app/_components/wallet-button.tsx b/examples/wagemos-cosmoskit-nextjs/src/app/_components/wallet-button.tsx index 5a688706..df7d1d71 100644 --- a/examples/wagemos-cosmoskit-nextjs/src/app/_components/wallet-button.tsx +++ b/examples/wagemos-cosmoskit-nextjs/src/app/_components/wallet-button.tsx @@ -3,8 +3,11 @@ import { useChain } from '@cosmos-kit/react' import { useCallback } from 'react' import { Button } from '../../components/ui/button' import { useToast } from '../../components/ui/use-toast' +import { ROUND_CHAIN_NAME } from '../_lib/constants' -function DisconnectButton({ chainName = 'neutron' }: { chainName?: string }) { +function DisconnectButton({ + chainName = ROUND_CHAIN_NAME, +}: { chainName?: string }) { const { disconnect, address } = useChain(chainName) const { toast } = useToast() @@ -44,7 +47,9 @@ function DisconnectButton({ chainName = 'neutron' }: { chainName?: string }) { ) } -function ConnectButton({ chainName = 'neutron' }: { chainName?: string }) { +function ConnectButton({ + chainName = ROUND_CHAIN_NAME, +}: { chainName?: string }) { const { connect } = useChain(chainName) const { toast } = useToast() @@ -63,7 +68,7 @@ function ConnectButton({ chainName = 'neutron' }: { chainName?: string }) { } export function WalletButton({ - chainName = 'neutron', + chainName = ROUND_CHAIN_NAME, }: { chainName?: string }) { const { isWalletConnected: isConnected } = useChain(chainName) if (isConnected) { diff --git a/examples/wagemos-cosmoskit-nextjs/src/app/_lib/constants.ts b/examples/wagemos-cosmoskit-nextjs/src/app/_lib/constants.ts new file mode 100644 index 00000000..c3d8ca05 --- /dev/null +++ b/examples/wagemos-cosmoskit-nextjs/src/app/_lib/constants.ts @@ -0,0 +1,3 @@ +export const ROUND_ACCOUNT_ID = 'neutron-18'; + +export const ROUND_CHAIN_NAME = 'neutron'; diff --git a/examples/wagemos-cosmoskit-nextjs/src/app/page.tsx b/examples/wagemos-cosmoskit-nextjs/src/app/page.tsx index 9bb8c303..42430513 100644 --- a/examples/wagemos-cosmoskit-nextjs/src/app/page.tsx +++ b/examples/wagemos-cosmoskit-nextjs/src/app/page.tsx @@ -18,12 +18,13 @@ import { RoundWinningTeam, } from './_components/round' import { WalletButton } from './_components/wallet-button' +import { ROUND_ACCOUNT_ID, ROUND_CHAIN_NAME } from './_lib/constants' export default function Home() { const { data, isLoading, isError } = betting.queries.useListRounds({ args: {}, - accountId: stringToAccountId('neutron-18'), - chainName: 'neutron', + accountId: stringToAccountId(ROUND_ACCOUNT_ID), + chainName: ROUND_CHAIN_NAME, }) if (isLoading) return

Loading...

if (isError) return

Error

diff --git a/examples/wagemos-graz-nextjs/src/_generated/index.ts b/examples/wagemos-graz-nextjs/src/_generated/index.ts index 8e3ead4f..3ba96005 100644 --- a/examples/wagemos-graz-nextjs/src/_generated/index.ts +++ b/examples/wagemos-graz-nextjs/src/_generated/index.ts @@ -49,7 +49,7 @@ import { // React ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -export const BETTING_MODULE_ID = 'abstract:betting' +export const BETTING_MODULE_ID = 'wagemos:betting' export const betting = { queries: { diff --git a/examples/wagemos-graz-nextjs/src/app/_lib/constants.ts b/examples/wagemos-graz-nextjs/src/app/_lib/constants.ts index dcd1d86c..5873a387 100644 --- a/examples/wagemos-graz-nextjs/src/app/_lib/constants.ts +++ b/examples/wagemos-graz-nextjs/src/app/_lib/constants.ts @@ -1,4 +1,4 @@ -export const ROUND_ACCOUNT_ID = 'neutron-5'; +export const ROUND_ACCOUNT_ID = 'neutrontestnet-67'; export const ROUND_CHAIN_NAME = "neutrontestnet"; export const CHAIN_IDS = ["pion-1"]; // export const CHAIN_IDS = ["neutron-1", "osmosis-1", "pion-1"]; diff --git a/examples/wagemos-graz-nextjs/src/app/layout.tsx b/examples/wagemos-graz-nextjs/src/app/layout.tsx index 88bef9a9..fd719e8f 100644 --- a/examples/wagemos-graz-nextjs/src/app/layout.tsx +++ b/examples/wagemos-graz-nextjs/src/app/layout.tsx @@ -33,7 +33,7 @@ const poppins = Poppins({ }) const abstractConfig = createConfig({ provider: grazProvider, - apiUrl: 'http://localhost:4001/graphql', + apiUrl: 'https://api-hackmos-2024.up.railway.app/', }) export default function RootLayout({ diff --git a/packages/core/src/utils/constants.ts b/packages/core/src/utils/constants.ts index 9f7fa2d3..c937d0eb 100644 --- a/packages/core/src/utils/constants.ts +++ b/packages/core/src/utils/constants.ts @@ -5,7 +5,7 @@ export const ABSTRACT_CONSTANTS = { MAX_MANAGER_PAGE_SIZE: 10, } -export const ABSTRACT_API_URL = 'https://abstract-subgraph-0-19.fly.dev/graphql' +export const ABSTRACT_API_URL = 'https://api.abstract.money/graphql' export const RAW_QUERY_KEYS = { ModuleData: 'module_data', From d00a7af2e3a5e9d80543c21758b5212bd6353086 Mon Sep 17 00:00:00 2001 From: adairrr <32375605+adairrr@users.noreply.github.com> Date: Sun, 24 Nov 2024 13:51:30 -0500 Subject: [PATCH 02/18] Initial xion example --- .../src/app/_providers/graz.tsx | 6 + examples/wagemos-xion-nextjs/.gitignore | 36 + examples/wagemos-xion-nextjs/CHANGELOG.md | 815 ++++++++++++++++ examples/wagemos-xion-nextjs/LICENSE | 21 + examples/wagemos-xion-nextjs/README.md | 36 + .../wagemos-xion-nextjs/abstract.config.ts | 12 + examples/wagemos-xion-nextjs/components.json | 16 + examples/wagemos-xion-nextjs/next.config.js | 4 + examples/wagemos-xion-nextjs/package.json | 59 ++ .../wagemos-xion-nextjs/postcss.config.js | 6 + examples/wagemos-xion-nextjs/public/next.svg | 1 + .../wagemos-xion-nextjs/public/vercel.svg | 1 + .../cosmwasm-codegen/Betting.client.ts | 199 ++++ .../Betting.message-builder.ts | 166 ++++ .../cosmwasm-codegen/Betting.react-query.ts | 297 ++++++ .../cosmwasm-codegen/Betting.types.ts | 129 +++ .../src/_generated/index.ts | 625 ++++++++++++ .../src/app/_components/place-bet-dialog.tsx | 193 ++++ .../src/app/_components/round.tsx | 93 ++ .../src/app/_components/wallet-button.tsx | 119 +++ .../src/app/_hooks/use-list-rounds.ts | 11 + .../src/app/_lib/constants.ts | 5 + .../src/app/_providers/graz.tsx | 50 + .../wagemos-xion-nextjs/src/app/favicon.ico | Bin 0 -> 25931 bytes .../wagemos-xion-nextjs/src/app/globals.css | 104 ++ .../wagemos-xion-nextjs/src/app/layout.tsx | 66 ++ examples/wagemos-xion-nextjs/src/app/page.tsx | 78 ++ .../src/components/ui/badge.tsx | 36 + .../src/components/ui/button.tsx | 56 ++ .../src/components/ui/dialog.tsx | 122 +++ .../src/components/ui/form.tsx | 176 ++++ .../src/components/ui/input.tsx | 24 + .../src/components/ui/label.tsx | 26 + .../src/components/ui/select.tsx | 160 +++ .../src/components/ui/toast.tsx | 127 +++ .../src/components/ui/toaster.tsx | 35 + .../src/components/ui/use-toast.ts | 189 ++++ .../wagemos-xion-nextjs/src/middleware.ts | 13 + examples/wagemos-xion-nextjs/src/utils.ts | 6 + .../wagemos-xion-nextjs/tailwind.config.ts | 80 ++ examples/wagemos-xion-nextjs/tsconfig.json | 24 + examples/wagemos-xion-nextjs/turbo.json | 32 + pnpm-lock.yaml | 910 ++++++++++++++++-- 43 files changed, 5093 insertions(+), 71 deletions(-) create mode 100644 examples/wagemos-xion-nextjs/.gitignore create mode 100644 examples/wagemos-xion-nextjs/CHANGELOG.md create mode 100644 examples/wagemos-xion-nextjs/LICENSE create mode 100644 examples/wagemos-xion-nextjs/README.md create mode 100644 examples/wagemos-xion-nextjs/abstract.config.ts create mode 100644 examples/wagemos-xion-nextjs/components.json create mode 100644 examples/wagemos-xion-nextjs/next.config.js create mode 100644 examples/wagemos-xion-nextjs/package.json create mode 100644 examples/wagemos-xion-nextjs/postcss.config.js create mode 100644 examples/wagemos-xion-nextjs/public/next.svg create mode 100644 examples/wagemos-xion-nextjs/public/vercel.svg create mode 100644 examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.client.ts create mode 100644 examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.message-builder.ts create mode 100644 examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.react-query.ts create mode 100644 examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.types.ts create mode 100644 examples/wagemos-xion-nextjs/src/_generated/index.ts create mode 100644 examples/wagemos-xion-nextjs/src/app/_components/place-bet-dialog.tsx create mode 100644 examples/wagemos-xion-nextjs/src/app/_components/round.tsx create mode 100644 examples/wagemos-xion-nextjs/src/app/_components/wallet-button.tsx create mode 100644 examples/wagemos-xion-nextjs/src/app/_hooks/use-list-rounds.ts create mode 100644 examples/wagemos-xion-nextjs/src/app/_lib/constants.ts create mode 100644 examples/wagemos-xion-nextjs/src/app/_providers/graz.tsx create mode 100644 examples/wagemos-xion-nextjs/src/app/favicon.ico create mode 100644 examples/wagemos-xion-nextjs/src/app/globals.css create mode 100644 examples/wagemos-xion-nextjs/src/app/layout.tsx create mode 100644 examples/wagemos-xion-nextjs/src/app/page.tsx create mode 100644 examples/wagemos-xion-nextjs/src/components/ui/badge.tsx create mode 100644 examples/wagemos-xion-nextjs/src/components/ui/button.tsx create mode 100644 examples/wagemos-xion-nextjs/src/components/ui/dialog.tsx create mode 100644 examples/wagemos-xion-nextjs/src/components/ui/form.tsx create mode 100644 examples/wagemos-xion-nextjs/src/components/ui/input.tsx create mode 100644 examples/wagemos-xion-nextjs/src/components/ui/label.tsx create mode 100644 examples/wagemos-xion-nextjs/src/components/ui/select.tsx create mode 100644 examples/wagemos-xion-nextjs/src/components/ui/toast.tsx create mode 100644 examples/wagemos-xion-nextjs/src/components/ui/toaster.tsx create mode 100644 examples/wagemos-xion-nextjs/src/components/ui/use-toast.ts create mode 100644 examples/wagemos-xion-nextjs/src/middleware.ts create mode 100644 examples/wagemos-xion-nextjs/src/utils.ts create mode 100644 examples/wagemos-xion-nextjs/tailwind.config.ts create mode 100644 examples/wagemos-xion-nextjs/tsconfig.json create mode 100644 examples/wagemos-xion-nextjs/turbo.json diff --git a/examples/wagemos-graz-nextjs/src/app/_providers/graz.tsx b/examples/wagemos-graz-nextjs/src/app/_providers/graz.tsx index 5df9c579..3120d170 100644 --- a/examples/wagemos-graz-nextjs/src/app/_providers/graz.tsx +++ b/examples/wagemos-graz-nextjs/src/app/_providers/graz.tsx @@ -38,6 +38,12 @@ export function GrazProvider( denom: 'untrn', }, }, + [testnetChains.xiontestnet.chainId]: { + gas: { + price: '0.001', + denom: 'uxion', + }, + }, }, }} {...props} diff --git a/examples/wagemos-xion-nextjs/.gitignore b/examples/wagemos-xion-nextjs/.gitignore new file mode 100644 index 00000000..fd3dbb57 --- /dev/null +++ b/examples/wagemos-xion-nextjs/.gitignore @@ -0,0 +1,36 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js +.yarn/install-state.gz + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env*.local + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts diff --git a/examples/wagemos-xion-nextjs/CHANGELOG.md b/examples/wagemos-xion-nextjs/CHANGELOG.md new file mode 100644 index 00000000..592a8fa9 --- /dev/null +++ b/examples/wagemos-xion-nextjs/CHANGELOG.md @@ -0,0 +1,815 @@ +# wagemos-graz-nextjs + +## 0.4.8 + +### Patch Changes + +- Updated dependencies [[`c8826a8`](https://github.com/AbstractSDK/abstract.js/commit/c8826a86906954097b1495e26309cea578d81b53)]: + - @abstract-money/core@3.4.1 + - @abstract-money/provider-graz@11.0.1 + - @abstract-money/react@2.3.4 + +## 0.4.7 + +### Patch Changes + +- Updated dependencies [[`83cd666`](https://github.com/AbstractSDK/abstract.js/commit/83cd666774aa33d60e41fe404fa920a53b2e465b)]: + - @abstract-money/core@3.4.0 + - @abstract-money/provider-graz@11.0.0 + - @abstract-money/react@2.3.3 + +## 0.4.6 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/core@3.3.2 + - @abstract-money/provider-graz@10.0.2 + - @abstract-money/react@2.3.2 + +## 0.4.5 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/core@3.3.1 + - @abstract-money/provider-graz@10.0.1 + - @abstract-money/react@2.3.1 + +## 0.4.4 + +### Patch Changes + +- [#142](https://github.com/AbstractSDK/abstract.js/pull/142) [`8b8f2be`](https://github.com/AbstractSDK/abstract.js/commit/8b8f2be68577587edd285aa15c1c491fa208c88c) Thanks [@adairrr](https://github.com/adairrr)! - Rename instantiate2 methods to predict and remove 'base' from AccountAddress retrieval + +- Updated dependencies [[`a45d7d0`](https://github.com/AbstractSDK/abstract.js/commit/a45d7d0fb3fef37805231d5715a1d288c966be72), [`8b8f2be`](https://github.com/AbstractSDK/abstract.js/commit/8b8f2be68577587edd285aa15c1c491fa208c88c), [`1078fae`](https://github.com/AbstractSDK/abstract.js/commit/1078fae09363757fbbe93e77d210f8c9d73db6a1)]: + - @abstract-money/core@3.3.0 + - @abstract-money/react@2.3.0 + - @abstract-money/provider-graz@10.0.0 + +## 0.4.3 + +### Patch Changes + +- Updated dependencies [[`f2c6344`](https://github.com/AbstractSDK/abstract.js/commit/f2c6344babaccd2b25cc0cd54e6774496d2be1ad)]: + - @abstract-money/core@3.2.0 + - @abstract-money/react@2.2.0 + - @abstract-money/provider-graz@9.0.0 + +## 0.4.2 + +### Patch Changes + +- Updated dependencies [[`b63ee9b`](https://github.com/AbstractSDK/abstract.js/commit/b63ee9bdb1809ab1ffadde21f76ab1735208ba87)]: + - @abstract-money/core@3.1.0 + - @abstract-money/react@2.1.0 + - @abstract-money/provider-graz@8.0.0 + +## 0.4.1 + +### Patch Changes + +- Updated dependencies [[`04cb51f`](https://github.com/AbstractSDK/abstract.js/commit/04cb51fffc933abf6e47b881001e6bb3fb340f02)]: + - @abstract-money/core@3.0.1 + - @abstract-money/provider-graz@7.0.1 + - @abstract-money/react@2.0.1 + +## 0.4.0 + +### Minor Changes + +- [#124](https://github.com/AbstractSDK/abstract.js/pull/124) [`0ed4329`](https://github.com/AbstractSDK/abstract.js/commit/0ed432944ab838c084d88e8d2ec5f32ece730afb) Thanks [@adairrr](https://github.com/adairrr)! - Update graz to 0.19 + +- [#127](https://github.com/AbstractSDK/abstract.js/pull/127) [`e46ec91`](https://github.com/AbstractSDK/abstract.js/commit/e46ec91c1169752f552dd627d2fe93bb3ff932be) Thanks [@adairrr](https://github.com/adairrr)! - Update Abstract to 0.24.0 with unified accounts + + The major changes include: + + - Updating Abstract to 0.24.0 + - Removing distinction between `proxy` and `manager`, replacing them with simply `account` + - Clarify `executeRemote` and `executeOnRemote` + - Add doc comments + - Remove components from legacy code + - Ensure generation works for both esm and cjs + +### Patch Changes + +- Updated dependencies [[`0ed4329`](https://github.com/AbstractSDK/abstract.js/commit/0ed432944ab838c084d88e8d2ec5f32ece730afb), [`a0c78be`](https://github.com/AbstractSDK/abstract.js/commit/a0c78be885b934e4c6c1a219b07ed58e3248f8d4), [`e46ec91`](https://github.com/AbstractSDK/abstract.js/commit/e46ec91c1169752f552dd627d2fe93bb3ff932be)]: + - @abstract-money/provider-graz@7.0.0 + - @abstract-money/react@2.0.0 + - @abstract-money/core@3.0.0 + +## 0.3.25 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/core@1.4.0 + - @abstract-money/react@1.4.0 + - @abstract-money/provider-graz@6.0.0 + +## 0.3.24 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/react@1.3.11 + - @abstract-money/provider-graz@5.0.11 + +## 0.3.23 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/react@1.3.10 + - @abstract-money/provider-graz@5.0.10 + +## 0.3.22 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/react@1.3.9 + - @abstract-money/provider-graz@5.0.9 + +## 0.3.21 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/react@1.3.8 + - @abstract-money/provider-graz@5.0.8 + +## 0.3.20 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/core@1.3.4 + - @abstract-money/react@1.3.7 + - @abstract-money/provider-graz@5.0.7 + +## 0.3.19 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/core@1.3.3 + - @abstract-money/react@1.3.6 + - @abstract-money/provider-graz@5.0.6 + +## 0.3.18 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/core@1.3.2 + - @abstract-money/provider-graz@5.0.5 + - @abstract-money/react@1.3.5 + +## 0.3.17 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/react@1.3.4 + - @abstract-money/provider-graz@5.0.4 + +## 0.3.16 + +### Patch Changes + +- Updated dependencies [[`4084d7a`](https://github.com/AbstractSDK/abstract.js/commit/4084d7a33f751883c8fa83898007edefa4a5a2ff)]: + - @abstract-money/react@1.3.3 + - @abstract-money/provider-graz@5.0.3 + +## 0.3.15 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/react@1.3.2 + - @abstract-money/provider-graz@5.0.2 + +## 0.3.14 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/core@1.3.1 + - @abstract-money/provider-graz@5.0.1 + - @abstract-money/react@1.3.1 + +## 0.3.13 + +### Patch Changes + +- Updated dependencies [[`0082bc6`](https://github.com/AbstractSDK/abstract.js/commit/0082bc613c6a3013964799a69f6a214bbb4fc9ac)]: + - @abstract-money/core@1.3.0 + - @abstract-money/react@1.3.0 + - @abstract-money/provider-graz@5.0.0 + +## 0.3.12 + +### Patch Changes + +- Updated dependencies [[`1c784b5`](https://github.com/AbstractSDK/abstract.js/commit/1c784b5616db96e6a0cc86dca083df18bf358c8f), [`1c784b5`](https://github.com/AbstractSDK/abstract.js/commit/1c784b5616db96e6a0cc86dca083df18bf358c8f)]: + - @abstract-money/core@1.2.1 + - @abstract-money/react@1.2.3 + - @abstract-money/provider-graz@4.0.3 + +## 0.3.11 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/react@1.2.2 + - @abstract-money/provider-graz@4.0.2 + +## 0.3.10 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/react@1.2.1 + - @abstract-money/provider-graz@4.0.1 + +## 0.3.9 + +### Patch Changes + +- Updated dependencies [[`711365a`](https://github.com/AbstractSDK/abstract.js/commit/711365a5548f75d885e79635f68d5ba6dfdf2abf)]: + - @abstract-money/core@1.2.0 + - @abstract-money/react@1.2.0 + - @abstract-money/provider-graz@4.0.0 + +## 0.3.8 + +### Patch Changes + +- Updated dependencies [[`7e1694c`](https://github.com/AbstractSDK/abstract.js/commit/7e1694cb2e77c0aae76259e3763ff9957cef0caf)]: + - @abstract-money/core@1.1.6 + - @abstract-money/provider-graz@3.0.8 + - @abstract-money/react@1.1.8 + +## 0.3.7 + +### Patch Changes + +- Updated dependencies [[`66e4e7a`](https://github.com/AbstractSDK/abstract.js/commit/66e4e7a2ca0dd51f3d024e41d044150df73ad271)]: + - @abstract-money/core@1.1.5 + - @abstract-money/provider-graz@3.0.7 + - @abstract-money/react@1.1.7 + +## 0.3.6 + +### Patch Changes + +- Updated dependencies [[`8f27b28`](https://github.com/AbstractSDK/abstract.js/commit/8f27b28890e01f256b78a2d94805992b6cc5433f)]: + - @abstract-money/core@1.1.4 + - @abstract-money/provider-graz@3.0.6 + - @abstract-money/react@1.1.6 + +## 0.3.5 + +### Patch Changes + +- Updated dependencies [[`b83b132`](https://github.com/AbstractSDK/abstract.js/commit/b83b132568594d85ec2b3ee27ee445904527e698)]: + - @abstract-money/core@1.1.3 + - @abstract-money/provider-graz@3.0.5 + - @abstract-money/react@1.1.5 + +## 0.3.4 + +### Patch Changes + +- Updated dependencies [[`310ed97`](https://github.com/AbstractSDK/abstract.js/commit/310ed9799c5c86a06fad2a6032f181fed5d0b354)]: + - @abstract-money/core@1.1.2 + - @abstract-money/provider-graz@3.0.4 + - @abstract-money/react@1.1.4 + +## 0.3.3 + +### Patch Changes + +- Updated dependencies [[`8042c3c`](https://github.com/AbstractSDK/abstract.js/commit/8042c3c3e42939ad05b8106722ecbc0538e2e514)]: + - @abstract-money/react@1.1.3 + - @abstract-money/provider-graz@3.0.3 + +## 0.3.2 + +### Patch Changes + +- Updated dependencies [[`a3dc4ba`](https://github.com/AbstractSDK/abstract.js/commit/a3dc4ba177ace727d2909cfade1f009aae457549)]: + - @abstract-money/react@1.1.2 + - @abstract-money/provider-graz@3.0.2 + +## 0.3.1 + +### Patch Changes + +- Updated dependencies [[`ed50660`](https://github.com/AbstractSDK/abstract.js/commit/ed5066049de491a9a8793211dcb0d07f18424851)]: + - @abstract-money/core@1.1.1 + - @abstract-money/react@1.1.1 + - @abstract-money/provider-graz@3.0.1 + +## 0.3.0 + +### Minor Changes + +- [`ccf8001`](https://github.com/AbstractSDK/abstract.js/commit/ccf80013d12e8033da273eed6d486edf6762441d) Thanks [@dalechyn](https://github.com/dalechyn)! - Added overrideable parameters that are decorated via `extra` property. + +### Patch Changes + +- Updated dependencies [[`ccf8001`](https://github.com/AbstractSDK/abstract.js/commit/ccf80013d12e8033da273eed6d486edf6762441d)]: + - @abstract-money/core@1.1.0 + - @abstract-money/provider-graz@3.0.0 + - @abstract-money/react@1.1.0 + +## 0.2.45 + +### Patch Changes + +- [`805888a`](https://github.com/AbstractSDK/abstract.js/commit/805888a3807a8e09dd2424978d7acc5cbdf5e494) Thanks [@dalechyn](https://github.com/dalechyn)! - Fixed IBC Action queries. + +- Updated dependencies [[`805888a`](https://github.com/AbstractSDK/abstract.js/commit/805888a3807a8e09dd2424978d7acc5cbdf5e494)]: + - @abstract-money/core@1.0.7 + - @abstract-money/provider-graz@2.0.12 + - @abstract-money/react@1.0.12 + +## 0.2.44 + +### Patch Changes + +- [#74](https://github.com/AbstractSDK/abstract.js/pull/74) [`ceee727`](https://github.com/AbstractSDK/abstract.js/commit/ceee727a9fa8f028f9c8169d775cb23c58dee4ff) Thanks [@adairrr](https://github.com/adairrr)! - Added IBC hooks. + +- Updated dependencies [[`ceee727`](https://github.com/AbstractSDK/abstract.js/commit/ceee727a9fa8f028f9c8169d775cb23c58dee4ff)]: + - @abstract-money/core@1.0.6 + - @abstract-money/react@1.0.11 + - @abstract-money/provider-graz@2.0.11 + +## 0.2.43 + +### Patch Changes + +- Updated dependencies [[`3d7057a`](https://github.com/AbstractSDK/abstract.js/commit/3d7057a2e20d127d40f83fd4a3ac69bfe324f9f9)]: + - @abstract-money/core@1.0.5 + - @abstract-money/provider-graz@2.0.10 + - @abstract-money/react@1.0.10 + +## 0.2.42 + +### Patch Changes + +- [`21f8b18`](https://github.com/AbstractSDK/abstract.js/commit/21f8b18a813b44ff0399c422bbec971a328f34a2) Thanks [@dalechyn](https://github.com/dalechyn)! - Bumped @cosmjs dependencies versions. + +- Updated dependencies [[`21f8b18`](https://github.com/AbstractSDK/abstract.js/commit/21f8b18a813b44ff0399c422bbec971a328f34a2)]: + - @abstract-money/core@1.0.4 + - @abstract-money/react@1.0.9 + - @abstract-money/provider-graz@2.0.9 + +## 0.2.41 + +### Patch Changes + +- Updated dependencies [[`32d747a`](https://github.com/AbstractSDK/abstract.js/commit/32d747a0c759bef64c8a439bffd5b82a506bda94)]: + - @abstract-money/react@1.0.8 + - @abstract-money/provider-graz@2.0.8 + +## 0.2.40 + +### Patch Changes + +- Updated dependencies [[`6b763ee`](https://github.com/AbstractSDK/abstract.js/commit/6b763ee9d2cd4aeb257fa24d3f258bd4d13f1a09)]: + - @abstract-money/core@1.0.3 + - @abstract-money/react@1.0.7 + - @abstract-money/provider-graz@2.0.7 + +## 0.2.39 + +### Patch Changes + +- Updated dependencies [[`5f849f4`](https://github.com/AbstractSDK/abstract.js/commit/5f849f4de8aace7b8bc21b20a876236376042b38)]: + - @abstract-money/core@1.0.2 + - @abstract-money/react@1.0.6 + - @abstract-money/provider-graz@2.0.6 + +## 0.2.38 + +### Patch Changes + +- Updated dependencies [[`b5dd99c`](https://github.com/AbstractSDK/abstract.js/commit/b5dd99cae260bf44ff510cbb18a6793ee593a0d7)]: + - @abstract-money/react@1.0.5 + - @abstract-money/provider-graz@2.0.5 + +## 0.2.37 + +### Patch Changes + +- [#96](https://github.com/AbstractSDK/abstract.js/pull/96) [`fc1d460`](https://github.com/AbstractSDK/abstract.js/commit/fc1d46077f5f242c02a6d671920b1906e3dbd5de) Thanks [@dalechyn](https://github.com/dalechyn)! - Return full query result from generated queries. + +- Updated dependencies []: + - @abstract-money/core@1.0.1 + +## 0.2.36 + +### Patch Changes + +- Updated dependencies [[`2f770a3`](https://github.com/AbstractSDK/abstract.js/commit/2f770a3e83bbcdf114adbad246abddeb8fa4a581)]: + - @abstract-money/core@1.0.1 + - @abstract-money/react@1.0.4 + - @abstract-money/provider-graz@2.0.4 + +## 0.2.35 + +### Patch Changes + +- [#90](https://github.com/AbstractSDK/abstract.js/pull/90) [`a3f19b4`](https://github.com/AbstractSDK/abstract.js/commit/a3f19b4bb076c6ad4821e1ff8ad8ef45cf637f68) Thanks [@dalechyn](https://github.com/dalechyn)! - Moved query client to be defined outside of the abstract provider. Now you either need to declare one in your app in case you're using cosmos-kit, or the sdk will use graz provider's query client. + +- Updated dependencies [[`a3f19b4`](https://github.com/AbstractSDK/abstract.js/commit/a3f19b4bb076c6ad4821e1ff8ad8ef45cf637f68)]: + - @abstract-money/provider-graz@2.0.3 + - @abstract-money/react@1.0.3 + +## 0.2.34 + +### Patch Changes + +- Updated dependencies [[`8d4ec17`](https://github.com/AbstractSDK/abstract.js/commit/8d4ec1775a0c18c4540f16a432564cf2b9e022e8), [`7601ab6`](https://github.com/AbstractSDK/abstract.js/commit/7601ab662060030ae4943c94f7bf7134533df071)]: + - @abstract-money/react@1.0.2 + - @abstract-money/provider-graz@2.0.2 + +## 0.2.33 + +### Patch Changes + +- [#84](https://github.com/AbstractSDK/abstract.js/pull/84) [`969a679`](https://github.com/AbstractSDK/abstract.js/commit/969a6797fae69f3285b3e7c303a1e498836951f4) Thanks [@dalechyn](https://github.com/dalechyn)! - Brought `chainName` parameter back to account-dependant hooks. + +- Updated dependencies [[`969a679`](https://github.com/AbstractSDK/abstract.js/commit/969a6797fae69f3285b3e7c303a1e498836951f4)]: + - @abstract-money/react@1.0.1 + - @abstract-money/core@1.0.0 + - @abstract-money/provider-graz@2.0.1 + +## 0.2.32 + +### Patch Changes + +- [#81](https://github.com/AbstractSDK/abstract.js/pull/81) [`8ac578d`](https://github.com/AbstractSDK/abstract.js/commit/8ac578dd0703391257e06fcce219ab32afe01fd9) Thanks [@dalechyn](https://github.com/dalechyn)! - Changed the API for `react` and `core` packages. Previously `core` package had unnecessary `args:{}` wrapping, now it doesn't. Also, `query` and `mutation` fields were added to the `react` package to have a clear separation of concerns, as well as fixed inconsistent API around `chainName` and types. + +- Updated dependencies [[`8ac578d`](https://github.com/AbstractSDK/abstract.js/commit/8ac578dd0703391257e06fcce219ab32afe01fd9)]: + - @abstract-money/core@1.0.0 + - @abstract-money/react@1.0.0 + - @abstract-money/provider-graz@2.0.0 + +## 0.2.31 + +### Patch Changes + +- [#79](https://github.com/AbstractSDK/abstract.js/pull/79) [`5c10a90`](https://github.com/AbstractSDK/abstract.js/commit/5c10a900f65240b80bb69ac407d3b2f1d43e3020) Thanks [@dalechyn](https://github.com/dalechyn)! - Dropped the `chainName` that was passed previously as a parameter to every query/mutation. It's not needed as the account always has a `chainName` set. + +- Updated dependencies [[`5c10a90`](https://github.com/AbstractSDK/abstract.js/commit/5c10a900f65240b80bb69ac407d3b2f1d43e3020)]: + - @abstract-money/react@0.3.2 + - @abstract-money/core@0.3.9 + - @abstract-money/provider-graz@1.0.2 + +## 0.2.30 + +### Patch Changes + +- Updated dependencies [[`ecbdd3a`](https://github.com/AbstractSDK/abstract.js/commit/ecbdd3aec6226ff23e71f9b16596834bf808742f)]: + - @abstract-money/react@0.3.1 + - @abstract-money/provider-graz@1.0.1 + +## 0.2.29 + +### Patch Changes + +- [#75](https://github.com/AbstractSDK/abstract.js/pull/75) [`6a02ff5`](https://github.com/AbstractSDK/abstract.js/commit/6a02ff503356d8d17bd94973f7b75c728b13b340) Thanks [@dalechyn](https://github.com/dalechyn)! - Deprecated `AbstractAccountIdProvider` in favor of custom client's accountId state management. + Introduced consequent changes to types involving `accountId`. + Fixes the peer-dependency issue in `provider-graz` package. + Dropped `@cosmjs/amino` in favor of `@cosmjs/stargate` +- Updated dependencies [[`6a02ff5`](https://github.com/AbstractSDK/abstract.js/commit/6a02ff503356d8d17bd94973f7b75c728b13b340)]: + - @abstract-money/react@0.3.0 + - @abstract-money/provider-graz@1.0.0 + - @abstract-money/core@0.3.9 + +## 0.2.28 + +### Patch Changes + +- [#71](https://github.com/AbstractSDK/abstract.js/pull/71) [`d7b32cf`](https://github.com/AbstractSDK/abstract.js/commit/d7b32cf3e3ca1ca8460ba91c7013ed4bf3f3e301) Thanks [@dalechyn](https://github.com/dalechyn)! - Fixes bad dependencies in all of the packages. + +- Updated dependencies [[`d7b32cf`](https://github.com/AbstractSDK/abstract.js/commit/d7b32cf3e3ca1ca8460ba91c7013ed4bf3f3e301)]: + - @abstract-money/core@0.3.9 + - @abstract-money/provider-graz@0.0.27 + - @abstract-money/react@0.2.28 + +## 0.2.27 + +### Patch Changes + +- Updated dependencies [[`2edf0de`](https://github.com/AbstractSDK/abstract.js/commit/2edf0de7ae902a3543c8b6728a563d4583aec808)]: + - @abstract-money/react@0.2.27 + - @abstract-money/provider-graz@0.0.26 + +## 0.2.26 + +### Patch Changes + +- Updated dependencies [[`87b2119`](https://github.com/AbstractSDK/abstract.js/commit/87b2119b09e167a3693e75703b5db16cb1c1b491)]: + - @abstract-money/core@0.3.8 + - @abstract-money/provider-graz@0.0.25 + - @abstract-money/react@0.2.26 + +## 0.2.25 + +### Patch Changes + +- [`6b6809d`](https://github.com/AbstractSDK/abstract.js/commit/6b6809d7f9b4288aa3626c18818218dbc6805728) Thanks [@dalechyn](https://github.com/dalechyn)! - Fix the parameters for hooks that get the version. + +- Updated dependencies [[`6b6809d`](https://github.com/AbstractSDK/abstract.js/commit/6b6809d7f9b4288aa3626c18818218dbc6805728)]: + - @abstract-money/core@0.3.7 + - @abstract-money/react@0.2.25 + - @abstract-money/provider-graz@0.0.24 + +## 0.2.24 + +### Patch Changes + +- [`795d207`](https://github.com/AbstractSDK/abstract.js/commit/795d2079b714bc740c670a95954fd17dbf4ca9de) Thanks [@dalechyn](https://github.com/dalechyn)! - Add hook to fetch module version./ + +- [`b56c2db`](https://github.com/AbstractSDK/abstract.js/commit/b56c2db0d0fb4d0630cae3ea305071c7aeb1e99b) Thanks [@dalechyn](https://github.com/dalechyn)! - Fix imports. + +- Updated dependencies [[`795d207`](https://github.com/AbstractSDK/abstract.js/commit/795d2079b714bc740c670a95954fd17dbf4ca9de)]: + - @abstract-money/core@0.3.6 + - @abstract-money/react@0.2.24 + - @abstract-money/provider-graz@0.0.23 + +## 0.2.23 + +### Patch Changes + +- Updated dependencies [[`12f8922`](https://github.com/AbstractSDK/abstract.js/commit/12f89220a5abeaf673d3836330d162f9694f89b7)]: + - @abstract-money/core@0.3.5 + - @abstract-money/react@0.2.23 + - @abstract-money/provider-graz@0.0.22 + +## 0.2.22 + +### Patch Changes + +- Updated dependencies [[`42f205d`](https://github.com/AbstractSDK/abstract.js/commit/42f205d544336b452649a490e22e7a5d1c015cb0)]: + - @abstract-money/react@0.2.22 + - @abstract-money/provider-graz@0.0.21 + +## 0.2.21 + +### Patch Changes + +- Updated dependencies [[`6275682`](https://github.com/AbstractSDK/abstract.js/commit/627568200c08d6e786693ef4f8795b5b7de11b4c)]: + - @abstract-money/react@0.2.21 + - @abstract-money/provider-graz@0.0.20 + +## 0.2.20 + +### Patch Changes + +- Updated dependencies [[`e838eb0`](https://github.com/AbstractSDK/abstract.js/commit/e838eb076f7a14cd3ee4034a88d8383869d5efb6)]: + - @abstract-money/react@0.2.20 + - @abstract-money/provider-graz@0.0.19 + +## 0.2.19 + +### Patch Changes + +- Updated dependencies [[`bd6928a`](https://github.com/AbstractSDK/abstract.js/commit/bd6928a8e6779f02498b09dbcb01a09421f1c7e4)]: + - @abstract-money/react@0.2.19 + - @abstract-money/provider-graz@0.0.18 + +## 0.2.18 + +### Patch Changes + +- Updated dependencies [[`61866cd`](https://github.com/AbstractSDK/abstract.js/commit/61866cdc4b93eaa2b43fdceb8144016037228998)]: + - @abstract-money/core@0.3.4 + - @abstract-money/provider-graz@0.0.17 + - @abstract-money/react@0.2.18 + +## 0.2.17 + +### Patch Changes + +- Updated dependencies [[`22daa16`](https://github.com/AbstractSDK/abstract.js/commit/22daa16fd55a0c54066b46c98d7b1cf68e88d1ab)]: + - @abstract-money/core@0.3.3 + - @abstract-money/provider-graz@0.0.16 + - @abstract-money/react@0.2.17 + +## 0.2.16 + +### Patch Changes + +- [`396d21e`](https://github.com/AbstractSDK/abstract.js/commit/396d21e1fe6a0fd80655b9de5fa6bd68eebd8ea1) Thanks [@dalechyn](https://github.com/dalechyn)! - Added missed overload for module address prediction hook + +- Updated dependencies [[`396d21e`](https://github.com/AbstractSDK/abstract.js/commit/396d21e1fe6a0fd80655b9de5fa6bd68eebd8ea1)]: + - @abstract-money/react@0.2.16 + - @abstract-money/provider-graz@0.0.15 + +## 0.2.15 + +### Patch Changes + +- [#55](https://github.com/AbstractSDK/abstract.js/pull/55) [`2bca172`](https://github.com/AbstractSDK/abstract.js/commit/2bca17257f8b957f6e2b8e156e7e9cad1b4674ff) Thanks [@adairrr](https://github.com/adairrr)! - Add helpers to predict module address + +- Updated dependencies [[`2bca172`](https://github.com/AbstractSDK/abstract.js/commit/2bca17257f8b957f6e2b8e156e7e9cad1b4674ff)]: + - @abstract-money/core@0.3.2 + - @abstract-money/react@0.2.15 + - @abstract-money/provider-graz@0.0.14 + +## 0.2.14 + +### Patch Changes + +- [#52](https://github.com/AbstractSDK/abstract.js/pull/52) [`4526937`](https://github.com/AbstractSDK/abstract.js/commit/4526937949897f736daf125558454cc069205562) Thanks [@dalechyn](https://github.com/dalechyn)! - Introduces new hooks for the savings app. + +- Updated dependencies [[`f0d965e`](https://github.com/AbstractSDK/abstract.js/commit/f0d965e33176306bfb6e11d6d4c1924b5e960a5a), [`4526937`](https://github.com/AbstractSDK/abstract.js/commit/4526937949897f736daf125558454cc069205562), [`cadb381`](https://github.com/AbstractSDK/abstract.js/commit/cadb381837899de18a71efb2a21e14819d70214d)]: + - @abstract-money/react@0.2.14 + - @abstract-money/core@0.3.1 + - @abstract-money/provider-graz@0.0.13 + +## 0.2.13 + +### Patch Changes + +- Updated dependencies [[`ce722cc`](https://github.com/AbstractSDK/abstract.js/commit/ce722cc4821e220694ec710ebd867e2c906aa888), [`9f6274a`](https://github.com/AbstractSDK/abstract.js/commit/9f6274a756cc84f2013f1f460dd2212d01f159b1)]: + - @abstract-money/core@0.3.0 + - @abstract-money/provider-graz@1.0.0 + - @abstract-money/react@0.2.13 + +## 0.2.12 + +### Patch Changes + +- Updated dependencies [[`82b5ca6`](https://github.com/AbstractSDK/abstract.js/commit/82b5ca619f5a8bf0e6dcc4b0741d4e91edb396d0)]: + - @abstract-money/react@0.2.12 + - @abstract-money/provider-graz@0.0.11 + +## 0.2.11 + +### Patch Changes + +- Updated dependencies [[`bb7def0`](https://github.com/AbstractSDK/abstract.js/commit/bb7def01d62cb759edb6972b7a49331c39bad1e9)]: + - @abstract-money/core@0.2.3 + - @abstract-money/react@0.2.11 + - @abstract-money/provider-graz@0.0.10 + +## 0.2.10 + +### Patch Changes + +- [`f183560`](https://github.com/AbstractSDK/abstract.js/commit/f1835604f7b00e4b89c550620940d0df3af1a6a2) Thanks [@dalechyn](https://github.com/dalechyn)! - Partial arguments for generated hooks + +- Updated dependencies [[`f183560`](https://github.com/AbstractSDK/abstract.js/commit/f1835604f7b00e4b89c550620940d0df3af1a6a2)]: + - @abstract-money/react@0.2.10 + - @abstract-money/core@0.2.2 + - @abstract-money/provider-graz@0.0.9 + +## 0.2.9 + +### Patch Changes + +- Updated dependencies [[`c49dee6`](https://github.com/AbstractSDK/abstract.js/commit/c49dee6c6db5dad9896e9b858fede68b645efcaf)]: + - @abstract-money/react@0.2.9 + - @abstract-money/provider-graz@0.0.8 + +## 0.2.8 + +### Patch Changes + +- Updated dependencies [[`3ae1291`](https://github.com/AbstractSDK/abstract.js/commit/3ae1291a673964478e74aca758d7537d4a4db615)]: + - @abstract-money/react@0.2.8 + - @abstract-money/provider-graz@0.0.7 + +## 0.2.7 + +### Patch Changes + +- Updated dependencies [[`b48d9f2`](https://github.com/AbstractSDK/abstract.js/commit/b48d9f2154d1902073287b151195a3b1f3bd7080)]: + - @abstract-money/react@0.2.7 + - @abstract-money/provider-graz@0.0.6 + +## 0.2.6 + +### Patch Changes + +- Updated dependencies [[`3ca6d2f`](https://github.com/AbstractSDK/abstract.js/commit/3ca6d2f0c302978b3d03e9deb511b94765a68b15)]: + - @abstract-money/react@0.2.6 + - @abstract-money/core@0.2.2 + - @abstract-money/provider-graz@0.0.5 + +## 0.2.5 + +### Patch Changes + +- [`1d6201e`](https://github.com/AbstractSDK/abstract.js/commit/1d6201efe3b52b8d34e7ad9de5179b5abe318e9a) Thanks [@dalechyn](https://github.com/dalechyn)! - Improves `accountId` usage, when passed to generated hooks or hooks from \`react\` package, it takes precedence over the context, yet if one is not passed, an error is thrown to indicate that it either should be passed or account id provider wrapping is needed. Also improves `cli` to not require args in hooks that don't need them. + +- Updated dependencies [[`1d6201e`](https://github.com/AbstractSDK/abstract.js/commit/1d6201efe3b52b8d34e7ad9de5179b5abe318e9a), [`1a38dc4`](https://github.com/AbstractSDK/abstract.js/commit/1a38dc47d7cb59eacc156471b0400c02353b15fb)]: + - @abstract-money/react@0.2.5 + - @abstract-money/core@0.2.2 + - @abstract-money/provider-graz@0.0.4 + +## 0.2.4 + +### Patch Changes + +- Updated dependencies [[`89c8d26`](https://github.com/AbstractSDK/abstract.js/commit/89c8d267ff9e00552bf1b56e1191f57aa25a6eee)]: + - @abstract-money/react@0.2.4 + - @abstract-money/provider-graz@0.0.3 + +## 0.2.3 + +### Patch Changes + +- Updated dependencies [[`8b41b44`](https://github.com/AbstractSDK/abstract.js/commit/8b41b444180838c7c82247ddc3f611bc7dc6085b)]: + - @abstract-money/react@0.2.3 + - @abstract-money/provider-graz@0.0.2 + +## 0.2.2 + +### Patch Changes + +- [#33](https://github.com/AbstractSDK/abstract.js/pull/33) [`ec5cb1e`](https://github.com/AbstractSDK/abstract.js/commit/ec5cb1e346668d3b93ad175fe3964a6be7327c29) Thanks [@dalechyn](https://github.com/dalechyn)! - Moves the provider-injection logic from `cli` package into `react` package. + +- Updated dependencies [[`ec5cb1e`](https://github.com/AbstractSDK/abstract.js/commit/ec5cb1e346668d3b93ad175fe3964a6be7327c29)]: + - @abstract-money/core@0.2.2 + - @abstract-money/provider-graz@0.0.1 + - @abstract-money/react@0.2.2 + +## 0.2.1 + +### Patch Changes + +- Updated dependencies [[`f1ba82a`](https://github.com/AbstractSDK/abstract.js/commit/f1ba82a116296c8d4d9cdc88e3cac136284528a1)]: + - @abstract-money/core@0.2.1 + - @abstract-money/react@0.2.1 + +## 0.2.0 + +### Minor Changes + +- [#30](https://github.com/AbstractSDK/abstract.js/pull/30) [`24438df`](https://github.com/AbstractSDK/abstract.js/commit/24438dfd851ff9d8b7ca02da2168bf60cd91cfde) Thanks [@dalechyn](https://github.com/dalechyn)! - Reimplements `core` package, with backwards compatibility support at `@abstract-money/core/legacy`. + +### Patch Changes + +- Updated dependencies [[`24438df`](https://github.com/AbstractSDK/abstract.js/commit/24438dfd851ff9d8b7ca02da2168bf60cd91cfde)]: + - @abstract-money/core@0.2.0 + - @abstract-money/react@0.2.0 + +## 0.1.6 + +### Patch Changes + +- [#27](https://github.com/AbstractSDK/abstract.js/pull/27) [`72c2d2c`](https://github.com/AbstractSDK/abstract.js/commit/72c2d2c7dffb34fedad3af4a8905f8737f58f206) Thanks [@dalechyn](https://github.com/dalechyn)! - Fixes api url propagation + +- Updated dependencies [[`72c2d2c`](https://github.com/AbstractSDK/abstract.js/commit/72c2d2c7dffb34fedad3af4a8905f8737f58f206)]: + - @abstract-money/core@0.1.5 + - @abstract-money/react@0.1.5 + +## 0.1.5 + +### Patch Changes + +- Updated dependencies [[`39b71f4`](https://github.com/AbstractSDK/abstract.js/commit/39b71f43a7a207199dcf3abcd491db8de4f7825f)]: + - @abstract-money/core@0.1.4 + - @abstract-money/react@0.1.4 + +## 0.1.4 + +### Patch Changes + +- Updated dependencies [[`2811970`](https://github.com/AbstractSDK/abstract.js/commit/281197085b04750aa041fb1904535d5926e043de)]: + - @abstract-money/core@0.1.3 + - @abstract-money/react@0.1.3 + +## 0.1.3 + +### Patch Changes + +- Updated dependencies [[`31348c5`](https://github.com/AbstractSDK/abstract.js/commit/31348c5a05da05b2d5e4d4446a72662e4669c466)]: + - @abstract-money/react@0.1.2 + - @abstract-money/core@0.1.2 + +## 0.1.2 + +### Patch Changes + +- [#14](https://github.com/AbstractSDK/abstract.js/pull/14) [`bfb3519`](https://github.com/AbstractSDK/abstract.js/commit/bfb351972b4bd901d219f0f3790050c3a7264e0e) Thanks [@dalechyn](https://github.com/dalechyn)! - Implements the `useAccounts` hook to retrieve the list of accounts of the connected signer. + +- Updated dependencies [[`bfb3519`](https://github.com/AbstractSDK/abstract.js/commit/bfb351972b4bd901d219f0f3790050c3a7264e0e)]: + - @abstract-money/core@0.1.1 + - @abstract-money/react@0.1.1 + +## 0.1.1 + +### Patch Changes + +- Updated dependencies [[`33390a1`](https://github.com/AbstractSDK/abstract.js/commit/33390a1ca0f7c73ff39dd7fb494802b8cc2e9de0)]: + - @abstract-money/core@0.1.0 + - @abstract-money/react@0.1.0 diff --git a/examples/wagemos-xion-nextjs/LICENSE b/examples/wagemos-xion-nextjs/LICENSE new file mode 100644 index 00000000..bd04abb5 --- /dev/null +++ b/examples/wagemos-xion-nextjs/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024, Abstract Money + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/examples/wagemos-xion-nextjs/README.md b/examples/wagemos-xion-nextjs/README.md new file mode 100644 index 00000000..c4033664 --- /dev/null +++ b/examples/wagemos-xion-nextjs/README.md @@ -0,0 +1,36 @@ +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). + +## Getting Started + +First, run the development server: + +```bash +npm run dev +# or +yarn dev +# or +pnpm dev +# or +bun dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. + +This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/examples/wagemos-xion-nextjs/abstract.config.ts b/examples/wagemos-xion-nextjs/abstract.config.ts new file mode 100644 index 00000000..f7553bd5 --- /dev/null +++ b/examples/wagemos-xion-nextjs/abstract.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from '@abstract-money/cli' +import { react, registry } from '@abstract-money/cli/plugins' + +export default defineConfig({ + out: 'src/_generated', + plugins: [ + react(), + registry({ + contracts: [{ namespace: 'wagemos', name: 'betting', version: '0.0.2' }], + }), + ], +}) diff --git a/examples/wagemos-xion-nextjs/components.json b/examples/wagemos-xion-nextjs/components.json new file mode 100644 index 00000000..35ee76c9 --- /dev/null +++ b/examples/wagemos-xion-nextjs/components.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "default", + "rsc": true, + "tsx": true, + "tailwind": { + "config": "tailwind.config.ts", + "css": "src/app/globals.css", + "baseColor": "slate", + "cssVariables": true + }, + "aliases": { + "components": "~/components", + "utils": "~/utils" + } +} diff --git a/examples/wagemos-xion-nextjs/next.config.js b/examples/wagemos-xion-nextjs/next.config.js new file mode 100644 index 00000000..767719fc --- /dev/null +++ b/examples/wagemos-xion-nextjs/next.config.js @@ -0,0 +1,4 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = {} + +module.exports = nextConfig diff --git a/examples/wagemos-xion-nextjs/package.json b/examples/wagemos-xion-nextjs/package.json new file mode 100644 index 00000000..e755c264 --- /dev/null +++ b/examples/wagemos-xion-nextjs/package.json @@ -0,0 +1,59 @@ +{ + "name": "wagemos-graz-nextjs", + "version": "0.4.8", + "private": true, + "scripts": { + "dev": "NODE_OPTIONS='--inspect' next dev", + "build": "next build", + "start": "next start", + "typecheck": "tsc --noEmit", + "lint": "next lint", + "postinstall": "pnpm generate", + "generate": "graz generate -g -M neutron,osmosis -T neutrontestnet,osmosistestnet,xiontestnet" + }, + "dependencies": { + "@abstract-money/core": "workspace:*", + "@abstract-money/provider-graz": "workspace:*", + "@abstract-money/provider-xion": "workspace:*", + "@abstract-money/actions-xion": "workspace:*", + "@abstract-money/react": "workspace:*", + "@burnt-labs/abstraxion": "^1.0.0-alpha.53", + "@cosmjs/stargate": "^0.32.3", + "@hookform/resolvers": "^3.3.2", + "@osmosis-labs/math": "^5.1.0", + "@osmosis-labs/proto-codecs": "^5.1.0", + "@radix-ui/react-dialog": "^1.0.5", + "@radix-ui/react-label": "^2.0.2", + "@radix-ui/react-select": "^2.0.0", + "@radix-ui/react-slot": "^1.0.2", + "@radix-ui/react-toast": "^1.1.5", + "@tanstack/react-query": "4.36.1", + "@tanstack/react-query-devtools": "^5.40.0", + "class-variance-authority": "^0.7.0", + "clsx": "^2.0.0", + "cosmjs-types": "^0.8.0", + "graz": "^0.1.19", + "long": "^5.2.3", + "lucide-react": "^0.293.0", + "next": "14.0.3", + "react": "^18", + "react-dom": "^18", + "react-hook-form": "^7.48.2", + "tailwind-merge": "^2.0.0", + "tailwindcss-animate": "^1.0.7", + "type-fest": "^4.2.6", + "zod": "^3.22.4" + }, + "devDependencies": { + "@abstract-money/cli": "workspace:*", + "@keplr-wallet/types": "^0.12.44", + "@types/node": "^20.0.0", + "@types/react": "^18", + "@types/react-dom": "^18", + "autoprefixer": "^10.0.1", + "pino-pretty": "^10.2.3", + "postcss": "^8", + "tailwindcss": "^3.3.0", + "typescript": "^5.0.4" + } +} diff --git a/examples/wagemos-xion-nextjs/postcss.config.js b/examples/wagemos-xion-nextjs/postcss.config.js new file mode 100644 index 00000000..33ad091d --- /dev/null +++ b/examples/wagemos-xion-nextjs/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/examples/wagemos-xion-nextjs/public/next.svg b/examples/wagemos-xion-nextjs/public/next.svg new file mode 100644 index 00000000..5174b28c --- /dev/null +++ b/examples/wagemos-xion-nextjs/public/next.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/wagemos-xion-nextjs/public/vercel.svg b/examples/wagemos-xion-nextjs/public/vercel.svg new file mode 100644 index 00000000..d2f84222 --- /dev/null +++ b/examples/wagemos-xion-nextjs/public/vercel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.client.ts b/examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.client.ts new file mode 100644 index 00000000..29b44e92 --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.client.ts @@ -0,0 +1,199 @@ +/** +* This file was automatically generated by @abstract-money/ts-codegen@0.37.0-beta-2. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @abstract-money/ts-codegen generate command to regenerate this file. +*/ + +import { CamelCasedProperties } from "type-fest"; +import { SigningCosmWasmClient, ExecuteResult } from "@abstract-money/cli/cosmjs"; +import { AccountPublicClient, AccountWalletClient, AppExecuteMsg, AppExecuteMsgFactory, AdapterExecuteMsg, AdapterExecuteMsgFactory } from "@abstract-money/core"; +import { StdFee, Coin } from "@abstract-money/cli/cosmjs"; +import { Decimal, InstantiateMsg, ExecuteMsg, AssetEntry, AccountTrace, ChainName, Uint128, AccountOdds, AccountId, Bet, AnsAsset, QueryMsg, MigrateMsg, Addr, BetsResponse, ConfigResponse, ListOddsResponse, RoundStatus, RoundsResponse, RoundResponse, OddsResponse } from "./Betting.types"; +import { BettingQueryMsgBuilder, BettingExecuteMsgBuilder } from "./Betting.message-builder"; +export interface IBettingAppQueryClient { + moduleId: string; + accountPublicClient: AccountPublicClient; + _moduleAddress: string | undefined; + round: (params: CamelCasedProperties["round"]>) => Promise; + listRounds: (params: CamelCasedProperties["list_rounds"]>) => Promise; + odds: (params: CamelCasedProperties["odds"]>) => Promise; + listOdds: (params: CamelCasedProperties["list_odds"]>) => Promise; + config: () => Promise; + bets: (params: CamelCasedProperties["bets"]>) => Promise; + getAddress: () => Promise; +} +export class BettingAppQueryClient implements IBettingAppQueryClient { + accountPublicClient: AccountPublicClient; + moduleId: string; + _moduleAddress: string | undefined; + + constructor({ + accountPublicClient, + moduleId + }: { + accountPublicClient: AccountPublicClient; + moduleId: string; + }) { + this.accountPublicClient = accountPublicClient; + this.moduleId = moduleId; + this.round = this.round.bind(this); + this.listRounds = this.listRounds.bind(this); + this.odds = this.odds.bind(this); + this.listOdds = this.listOdds.bind(this); + this.config = this.config.bind(this); + this.bets = this.bets.bind(this); + } + + round = async (params: CamelCasedProperties["round"]>): Promise => { + return this._query(BettingQueryMsgBuilder.round(params)); + }; + listRounds = async (params: CamelCasedProperties["list_rounds"]>): Promise => { + return this._query(BettingQueryMsgBuilder.listRounds(params)); + }; + odds = async (params: CamelCasedProperties["odds"]>): Promise => { + return this._query(BettingQueryMsgBuilder.odds(params)); + }; + listOdds = async (params: CamelCasedProperties["list_odds"]>): Promise => { + return this._query(BettingQueryMsgBuilder.listOdds(params)); + }; + config = async (): Promise => { + return this._query(BettingQueryMsgBuilder.config()); + }; + bets = async (params: CamelCasedProperties["bets"]>): Promise => { + return this._query(BettingQueryMsgBuilder.bets(params)); + }; + getAddress = async (): Promise => { + if (!this._moduleAddress) { + const address = await this.accountPublicClient.getModuleAddress({ + id: this.moduleId + }); + + if (address === null) { + throw new Error(`Module ${this.moduleId} not installed`); + } + + this._moduleAddress = address; + } + + return this._moduleAddress!; + }; + _query = async (queryMsg: QueryMsg): Promise => { + return this.accountPublicClient.queryModule({ + moduleId: this.moduleId, + moduleType: "app", + queryMsg + }); + }; +} +export interface IBettingAppClient extends IBettingAppQueryClient { + accountWalletClient: AccountWalletClient; + createRound: (params: CamelCasedProperties["create_round"]>, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + register: (params: CamelCasedProperties["register"]>, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + updateAccounts: (params: CamelCasedProperties["update_accounts"]>, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + placeBet: (params: CamelCasedProperties["place_bet"]>, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + distributeWinnings: (params: CamelCasedProperties["distribute_winnings"]>, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + closeRound: (params: CamelCasedProperties["close_round"]>, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + updateConfig: (params: CamelCasedProperties["update_config"]>, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; +} +export class BettingAppClient extends BettingAppQueryClient implements IBettingAppClient { + accountWalletClient: AccountWalletClient; + + constructor({ + accountPublicClient, + accountWalletClient, + moduleId + }: { + accountPublicClient: AccountPublicClient; + accountWalletClient: AccountWalletClient; + moduleId: string; + }) { + super({ + accountPublicClient, + moduleId + }); + this.accountWalletClient = accountWalletClient; + this.createRound = this.createRound.bind(this); + this.register = this.register.bind(this); + this.updateAccounts = this.updateAccounts.bind(this); + this.placeBet = this.placeBet.bind(this); + this.distributeWinnings = this.distributeWinnings.bind(this); + this.closeRound = this.closeRound.bind(this); + this.updateConfig = this.updateConfig.bind(this); + } + + createRound = async (params: CamelCasedProperties["create_round"]>, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return this._execute(BettingExecuteMsgBuilder.createRound(params), fee_, memo_, funds_); + }; + register = async (params: CamelCasedProperties["register"]>, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return this._execute(BettingExecuteMsgBuilder.register(params), fee_, memo_, funds_); + }; + updateAccounts = async (params: CamelCasedProperties["update_accounts"]>, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return this._execute(BettingExecuteMsgBuilder.updateAccounts(params), fee_, memo_, funds_); + }; + placeBet = async (params: CamelCasedProperties["place_bet"]>, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return this._execute(BettingExecuteMsgBuilder.placeBet(params), fee_, memo_, funds_); + }; + distributeWinnings = async (params: CamelCasedProperties["distribute_winnings"]>, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return this._execute(BettingExecuteMsgBuilder.distributeWinnings(params), fee_, memo_, funds_); + }; + closeRound = async (params: CamelCasedProperties["close_round"]>, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return this._execute(BettingExecuteMsgBuilder.closeRound(params), fee_, memo_, funds_); + }; + updateConfig = async (params: CamelCasedProperties["update_config"]>, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return this._execute(BettingExecuteMsgBuilder.updateConfig(params), fee_, memo_, funds_); + }; + _execute = async (msg: ExecuteMsg, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + const signingCwClient = await this.accountWalletClient.getSigningCosmWasmClient(); + const sender = await this.accountWalletClient.getSenderAddress(); + const moduleMsg: AppExecuteMsg = AppExecuteMsgFactory.executeApp(msg); + return await signingCwClient.execute(sender, await this.getAddress(), moduleMsg, fee_, memo_, funds_); + }; +} \ No newline at end of file diff --git a/examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.message-builder.ts b/examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.message-builder.ts new file mode 100644 index 00000000..70f7bbbe --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.message-builder.ts @@ -0,0 +1,166 @@ +// @ts-nocheck + /** +* This file was automatically generated by @abstract-money/ts-codegen@0.37.0-beta-2. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @abstract-money/ts-codegen generate command to regenerate this file. +*/ + +import { Decimal, InstantiateMsg, ExecuteMsg, AssetEntry, AccountTrace, ChainName, Uint128, AccountOdds, AccountId, Bet, AnsAsset, QueryMsg, MigrateMsg, Addr, BetsResponse, ConfigResponse, ListOddsResponse, RoundStatus, RoundsResponse, RoundResponse, OddsResponse } from "./Betting.types"; +import { CamelCasedProperties } from "type-fest"; +export abstract class BettingExecuteMsgBuilder { +static createRound = ({ + baseBetToken, + description, + name +}: CamelCasedProperties["create_round"]>): ExecuteMsg => { + return { + create_round: ({ + base_bet_token: baseBetToken, + description, + name + } as const) + }; +}; +static register = ({ + roundId +}: CamelCasedProperties["register"]>): ExecuteMsg => { + return { + register: ({ + round_id: roundId + } as const) + }; +}; +static updateAccounts = ({ + roundId, + toAdd, + toRemove +}: CamelCasedProperties["update_accounts"]>): ExecuteMsg => { + return { + update_accounts: ({ + round_id: roundId, + to_add: toAdd, + to_remove: toRemove + } as const) + }; +}; +static placeBet = ({ + bet, + roundId +}: CamelCasedProperties["place_bet"]>): ExecuteMsg => { + return { + place_bet: ({ + bet, + round_id: roundId + } as const) + }; +}; +static distributeWinnings = ({ + roundId +}: CamelCasedProperties["distribute_winnings"]>): ExecuteMsg => { + return { + distribute_winnings: ({ + round_id: roundId + } as const) + }; +}; +static closeRound = ({ + roundId, + winner +}: CamelCasedProperties["close_round"]>): ExecuteMsg => { + return { + close_round: ({ + round_id: roundId, + winner + } as const) + }; +}; +static updateConfig = ({ + rake +}: CamelCasedProperties["update_config"]>): ExecuteMsg => { + return { + update_config: ({ + rake + } as const) + }; +}; +} +export abstract class BettingQueryMsgBuilder { +static round = ({ + roundId +}: CamelCasedProperties["round"]>): QueryMsg => { + return { + round: ({ + round_id: roundId + } as const) + }; +}; +static listRounds = ({ + limit, + startAfter +}: CamelCasedProperties["list_rounds"]>): QueryMsg => { + return { + list_rounds: ({ + limit, + start_after: startAfter + } as const) + }; +}; +static odds = ({ + roundId, + teamId +}: CamelCasedProperties["odds"]>): QueryMsg => { + return { + odds: ({ + round_id: roundId, + team_id: teamId + } as const) + }; +}; +static listOdds = ({ + roundId +}: CamelCasedProperties["list_odds"]>): QueryMsg => { + return { + list_odds: ({ + round_id: roundId + } as const) + }; +}; +static config = (): QueryMsg => { + return { + config: ({} as const) + }; +}; +static bets = ({ + roundId +}: CamelCasedProperties["bets"]>): QueryMsg => { + return { + bets: ({ + round_id: roundId + } as const) + }; +}; +} \ No newline at end of file diff --git a/examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.react-query.ts b/examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.react-query.ts new file mode 100644 index 00000000..0a829f0a --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.react-query.ts @@ -0,0 +1,297 @@ +/** +* This file was automatically generated by @abstract-money/ts-codegen@0.37.0-beta-2. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @abstract-money/ts-codegen generate command to regenerate this file. +*/ + +import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from "@tanstack/react-query"; +import { ExecuteResult } from "@abstract-money/cli/cosmjs"; +import { StdFee, Coin } from "@abstract-money/cli/cosmjs"; +import { Decimal, InstantiateMsg, ExecuteMsg, AssetEntry, AccountTrace, ChainName, Uint128, AccountOdds, AccountId, Bet, AnsAsset, QueryMsg, MigrateMsg, Addr, BetsResponse, ConfigResponse, ListOddsResponse, RoundStatus, RoundsResponse, RoundResponse, OddsResponse } from "./Betting.types"; +import { BettingAppQueryClient, BettingAppClient } from "./Betting.client"; +export const bettingQueryKeys = { + contract: ([{ + contract: "betting" + }] as const), + address: (contractAddress: string | undefined) => ([{ ...bettingQueryKeys.contract[0], + address: contractAddress + }] as const), + round: (contractAddress: string | undefined, args?: Record) => ([{ ...bettingQueryKeys.address(contractAddress)[0], + method: "round", + args + }] as const), + listRounds: (contractAddress: string | undefined, args?: Record) => ([{ ...bettingQueryKeys.address(contractAddress)[0], + method: "list_rounds", + args + }] as const), + odds: (contractAddress: string | undefined, args?: Record) => ([{ ...bettingQueryKeys.address(contractAddress)[0], + method: "odds", + args + }] as const), + listOdds: (contractAddress: string | undefined, args?: Record) => ([{ ...bettingQueryKeys.address(contractAddress)[0], + method: "list_odds", + args + }] as const), + config: (contractAddress: string | undefined, args?: Record) => ([{ ...bettingQueryKeys.address(contractAddress)[0], + method: "config", + args + }] as const), + bets: (contractAddress: string | undefined, args?: Record) => ([{ ...bettingQueryKeys.address(contractAddress)[0], + method: "bets", + args + }] as const) +}; +export interface BettingReactQuery { + client: BettingAppQueryClient | undefined; + options?: Omit, "'queryKey' | 'queryFn' | 'initialData'"> & { + initialData?: undefined; + }; +} +export interface BettingBetsQuery extends BettingReactQuery { + args: undefined | { + roundId: number; + }; +} +export function useBettingBetsQuery({ + client, + args, + options +}: BettingBetsQuery) { + return useQuery(bettingQueryKeys.bets(client?._moduleAddress, args), () => client && args ? client.bets({ + roundId: args.roundId + }) : Promise.reject(new Error("Invalid client or args")), { ...options, enabled: !!args && !!client && (options?.enabled != undefined ? options.enabled : true) + }); +} +export interface BettingConfigQuery extends BettingReactQuery {} +export function useBettingConfigQuery({ + client, + options +}: BettingConfigQuery) { + return useQuery(bettingQueryKeys.config(client?._moduleAddress), () => client ? client.config() : Promise.reject(new Error("Invalid client")), { ...options, + enabled: !!client && (options?.enabled != undefined ? options.enabled : true) + }); +} +export interface BettingListOddsQuery extends BettingReactQuery { + args: undefined | { + roundId: number; + }; +} +export function useBettingListOddsQuery({ + client, + args, + options +}: BettingListOddsQuery) { + return useQuery(bettingQueryKeys.listOdds(client?._moduleAddress, args), () => client && args ? client.listOdds({ + roundId: args.roundId + }) : Promise.reject(new Error("Invalid client or args")), { ...options, enabled: !!args && !!client && (options?.enabled != undefined ? options.enabled : true) + }); +} +export interface BettingOddsQuery extends BettingReactQuery { + args: undefined | { + roundId: number; + teamId: AccountId; + }; +} +export function useBettingOddsQuery({ + client, + args, + options +}: BettingOddsQuery) { + return useQuery(bettingQueryKeys.odds(client?._moduleAddress, args), () => client && args ? client.odds({ + roundId: args.roundId, + teamId: args.teamId + }) : Promise.reject(new Error("Invalid client or args")), { ...options, enabled: !!args && !!client && (options?.enabled != undefined ? options.enabled : true) + }); +} +export interface BettingListRoundsQuery extends BettingReactQuery { + args: undefined | { + limit?: number; + startAfter?: number; + }; +} +export function useBettingListRoundsQuery({ + client, + args, + options +}: BettingListRoundsQuery) { + return useQuery(bettingQueryKeys.listRounds(client?._moduleAddress, args), () => client && args ? client.listRounds({ + limit: args.limit, + startAfter: args.startAfter + }) : Promise.reject(new Error("Invalid client or args")), { ...options, enabled: !!args && !!client && (options?.enabled != undefined ? options.enabled : true) + }); +} +export interface BettingRoundQuery extends BettingReactQuery { + args: undefined | { + roundId: number; + }; +} +export function useBettingRoundQuery({ + client, + args, + options +}: BettingRoundQuery) { + return useQuery(bettingQueryKeys.round(client?._moduleAddress, args), () => client && args ? client.round({ + roundId: args.roundId + }) : Promise.reject(new Error("Invalid client or args")), { ...options, enabled: !!args && !!client && (options?.enabled != undefined ? options.enabled : true) + }); +} +export interface BettingUpdateConfigMutation { + client: BettingAppClient; + msg: { + rake?: Decimal; + }; + args?: { + fee?: number | StdFee | "auto"; + memo?: string; + funds?: Coin[]; + }; +} +export function useBettingUpdateConfigMutation(options?: Omit, "mutationFn">) { + return useMutation(({ + client, + msg, + args: { + fee, + memo, + funds + } = {} + }) => client.updateConfig(msg, fee, memo, funds), options); +} +export interface BettingCloseRoundMutation { + client: BettingAppClient; + msg: { + roundId: number; + winner?: AccountId; + }; + args?: { + fee?: number | StdFee | "auto"; + memo?: string; + funds?: Coin[]; + }; +} +export function useBettingCloseRoundMutation(options?: Omit, "mutationFn">) { + return useMutation(({ + client, + msg, + args: { + fee, + memo, + funds + } = {} + }) => client.closeRound(msg, fee, memo, funds), options); +} +export interface BettingDistributeWinningsMutation { + client: BettingAppClient; + msg: { + roundId: number; + }; + args?: { + fee?: number | StdFee | "auto"; + memo?: string; + funds?: Coin[]; + }; +} +export function useBettingDistributeWinningsMutation(options?: Omit, "mutationFn">) { + return useMutation(({ + client, + msg, + args: { + fee, + memo, + funds + } = {} + }) => client.distributeWinnings(msg, fee, memo, funds), options); +} +export interface BettingPlaceBetMutation { + client: BettingAppClient; + msg: { + bet: Bet; + roundId: number; + }; + args?: { + fee?: number | StdFee | "auto"; + memo?: string; + funds?: Coin[]; + }; +} +export function useBettingPlaceBetMutation(options?: Omit, "mutationFn">) { + return useMutation(({ + client, + msg, + args: { + fee, + memo, + funds + } = {} + }) => client.placeBet(msg, fee, memo, funds), options); +} +export interface BettingUpdateAccountsMutation { + client: BettingAppClient; + msg: { + roundId: number; + toAdd: AccountOdds[]; + toRemove: AccountId[]; + }; + args?: { + fee?: number | StdFee | "auto"; + memo?: string; + funds?: Coin[]; + }; +} +export function useBettingUpdateAccountsMutation(options?: Omit, "mutationFn">) { + return useMutation(({ + client, + msg, + args: { + fee, + memo, + funds + } = {} + }) => client.updateAccounts(msg, fee, memo, funds), options); +} +export interface BettingRegisterMutation { + client: BettingAppClient; + msg: { + roundId: number; + }; + args?: { + fee?: number | StdFee | "auto"; + memo?: string; + funds?: Coin[]; + }; +} +export function useBettingRegisterMutation(options?: Omit, "mutationFn">) { + return useMutation(({ + client, + msg, + args: { + fee, + memo, + funds + } = {} + }) => client.register(msg, fee, memo, funds), options); +} +export interface BettingCreateRoundMutation { + client: BettingAppClient; + msg: { + baseBetToken: AssetEntry; + description: string; + name: string; + }; + args?: { + fee?: number | StdFee | "auto"; + memo?: string; + funds?: Coin[]; + }; +} +export function useBettingCreateRoundMutation(options?: Omit, "mutationFn">) { + return useMutation(({ + client, + msg, + args: { + fee, + memo, + funds + } = {} + }) => client.createRound(msg, fee, memo, funds), options); +} diff --git a/examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.types.ts b/examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.types.ts new file mode 100644 index 00000000..2ac88c88 --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/_generated/cosmwasm-codegen/Betting.types.ts @@ -0,0 +1,129 @@ +/** +* This file was automatically generated by @abstract-money/ts-codegen@0.37.0-beta-2. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @abstract-money/ts-codegen generate command to regenerate this file. +*/ + +export type Decimal = string; +export interface InstantiateMsg { + rake?: Decimal | null; +} +export type ExecuteMsg = { + create_round: { + base_bet_token: AssetEntry; + description: string; + name: string; + }; +} | { + register: { + round_id: number; + }; +} | { + update_accounts: { + round_id: number; + to_add: AccountOdds[]; + to_remove: AccountId[]; + }; +} | { + place_bet: { + bet: Bet; + round_id: number; + }; +} | { + distribute_winnings: { + round_id: number; + }; +} | { + close_round: { + round_id: number; + winner?: AccountId | null; + }; +} | { + update_config: { + rake?: Decimal | null; + }; +}; +export type AssetEntry = string; +export type AccountTrace = "local" | { + remote: ChainName[]; +}; +export type ChainName = string; +export type Uint128 = string; +export interface AccountOdds { + account_id: AccountId; + odds: Decimal; +} +export interface AccountId { + seq: number; + trace: AccountTrace; +} +export interface Bet { + account_id: AccountId; + asset: AnsAsset; +} +export interface AnsAsset { + amount: Uint128; + name: AssetEntry; + [k: string]: unknown; +} +export type QueryMsg = { + round: { + round_id: number; + }; +} | { + list_rounds: { + limit?: number | null; + start_after?: number | null; + }; +} | { + odds: { + round_id: number; + team_id: AccountId; + }; +} | { + list_odds: { + round_id: number; + }; +} | { + config: {}; +} | { + bets: { + round_id: number; + }; +}; +export interface MigrateMsg { + [k: string]: unknown; +} +export type Addr = string; +export interface BetsResponse { + bets: [Addr, Uint128][]; + round_id: number; +} +export interface ConfigResponse { + rake: Decimal; +} +export interface ListOddsResponse { + odds: AccountOdds[]; + round_id: number; +} +export type RoundStatus = ("open" | "rewards_distributed") | { + closed: { + winning_team?: AccountId | null; + }; +}; +export interface RoundsResponse { + rounds: RoundResponse[]; +} +export interface RoundResponse { + bet_count: number; + description: string; + id: number; + name: string; + status: RoundStatus; + teams: AccountId[]; + total_bet: AnsAsset; +} +export interface OddsResponse { + odds: Decimal; + round_id: number; +} \ No newline at end of file diff --git a/examples/wagemos-xion-nextjs/src/_generated/index.ts b/examples/wagemos-xion-nextjs/src/_generated/index.ts new file mode 100644 index 00000000..3ba96005 --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/_generated/index.ts @@ -0,0 +1,625 @@ +'use client' + +import { ExecuteResult } from '@abstract-money/cli/cosmjs' +import { UseMutationOptions } from '@tanstack/react-query' +import { useMemo } from 'react' + +import { + useAbstractModuleClient, + useAbstractModuleQueryClient, +} from '@abstract-money/react' + +import { AccountId } from '@abstract-money/core' + +import { + useBettingUpdateConfigMutation, + BettingUpdateConfigMutation, + useBettingCloseRoundMutation, + BettingCloseRoundMutation, + useBettingDistributeWinningsMutation, + BettingDistributeWinningsMutation, + useBettingPlaceBetMutation, + BettingPlaceBetMutation, + useBettingUpdateAccountsMutation, + BettingUpdateAccountsMutation, + useBettingRegisterMutation, + BettingRegisterMutation, + useBettingCreateRoundMutation, + BettingCreateRoundMutation, + useBettingBetsQuery, + useBettingConfigQuery, + useBettingListOddsQuery, + useBettingOddsQuery, + useBettingListRoundsQuery, + useBettingRoundQuery, +} from './cosmwasm-codegen/Betting.react-query' + +import * as BettingTypes from './cosmwasm-codegen/Betting.types' + +import { + BettingAppQueryClient, + BettingAppClient, +} from './cosmwasm-codegen/Betting.client' + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Betting +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// React +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +export const BETTING_MODULE_ID = 'wagemos:betting' + +export const betting = { + queries: { + useBets: ({ + options, + args, + ...rest + }: Omit< + Parameters>[0], + 'client' + > & { + accountId: AccountId | undefined + chainName: string | undefined + }) => { + const { data: bettingAppQueryClient } = useAbstractModuleQueryClient({ + moduleId: BETTING_MODULE_ID, + ...rest, + Module: BettingAppQueryClient, + query: { enabled: options?.enabled }, + }) + + return useBettingBetsQuery({ + client: bettingAppQueryClient, + options, + args, + }) + }, + useConfig: ({ + options, + ...rest + }: Omit< + Parameters>[0], + 'client' + > & { + accountId: AccountId | undefined + chainName: string | undefined + }) => { + const { data: bettingAppQueryClient } = useAbstractModuleQueryClient({ + moduleId: BETTING_MODULE_ID, + ...rest, + Module: BettingAppQueryClient, + query: { enabled: options?.enabled }, + }) + + return useBettingConfigQuery({ + client: bettingAppQueryClient, + options, + }) + }, + useListOdds: ({ + options, + args, + ...rest + }: Omit< + Parameters< + typeof useBettingListOddsQuery + >[0], + 'client' + > & { + accountId: AccountId | undefined + chainName: string | undefined + }) => { + const { data: bettingAppQueryClient } = useAbstractModuleQueryClient({ + moduleId: BETTING_MODULE_ID, + ...rest, + Module: BettingAppQueryClient, + query: { enabled: options?.enabled }, + }) + + return useBettingListOddsQuery({ + client: bettingAppQueryClient, + options, + args, + }) + }, + useOdds: ({ + options, + args, + ...rest + }: Omit< + Parameters>[0], + 'client' + > & { + accountId: AccountId | undefined + chainName: string | undefined + }) => { + const { data: bettingAppQueryClient } = useAbstractModuleQueryClient({ + moduleId: BETTING_MODULE_ID, + ...rest, + Module: BettingAppQueryClient, + query: { enabled: options?.enabled }, + }) + + return useBettingOddsQuery({ + client: bettingAppQueryClient, + options, + args, + }) + }, + useListRounds: ({ + options, + args, + ...rest + }: Omit< + Parameters< + typeof useBettingListRoundsQuery + >[0], + 'client' + > & { + accountId: AccountId | undefined + chainName: string | undefined + }) => { + const { data: bettingAppQueryClient } = useAbstractModuleQueryClient({ + moduleId: BETTING_MODULE_ID, + ...rest, + Module: BettingAppQueryClient, + query: { enabled: options?.enabled }, + }) + + return useBettingListRoundsQuery({ + client: bettingAppQueryClient, + options, + args, + }) + }, + useRound: ({ + options, + args, + ...rest + }: Omit< + Parameters>[0], + 'client' + > & { + accountId: AccountId | undefined + chainName: string | undefined + }) => { + const { data: bettingAppQueryClient } = useAbstractModuleQueryClient({ + moduleId: BETTING_MODULE_ID, + ...rest, + Module: BettingAppQueryClient, + query: { enabled: options?.enabled }, + }) + + return useBettingRoundQuery({ + client: bettingAppQueryClient, + options, + args, + }) + }, + }, + mutations: { + useUpdateConfig: ( + { + accountId, + chainName, + sender, + }: { + accountId: AccountId | undefined + chainName: string | undefined + sender?: string | undefined + }, + options?: Omit< + UseMutationOptions< + ExecuteResult, + Error, + Omit + >, + 'mutationFn' + >, + ) => { + const { + data: bettingAppClient, + // TODO: figure out what to do with those + // isLoading: isBettingAppClientLoading, + // isError: isBettingAppClientError, + // error: bettingAppClientError, + } = useAbstractModuleClient({ + moduleId: BETTING_MODULE_ID, + accountId, + chainName, + sender, + + Module: BettingAppClient, + }) + + const { + mutate: mutate_, + mutateAsync: mutateAsync_, + ...rest + } = useBettingUpdateConfigMutation(options) + + const mutate = useMemo(() => { + if (!bettingAppClient) return undefined + + return ( + variables: Omit[0], 'client'>, + options?: Parameters[1], + ) => mutate_({ client: bettingAppClient, ...variables }, options) + }, [mutate_, bettingAppClient]) + + const mutateAsync = useMemo(() => { + if (!bettingAppClient) return undefined + + return ( + variables: Omit[0], 'client'>, + options?: Parameters[1], + ) => mutateAsync_({ client: bettingAppClient, ...variables }, options) + }, [mutateAsync_, bettingAppClient]) + + return { mutate, mutateAsync, ...rest } as const + }, + useCloseRound: ( + { + accountId, + chainName, + sender, + }: { + accountId: AccountId | undefined + chainName: string | undefined + sender?: string | undefined + }, + options?: Omit< + UseMutationOptions< + ExecuteResult, + Error, + Omit + >, + 'mutationFn' + >, + ) => { + const { + data: bettingAppClient, + // TODO: figure out what to do with those + // isLoading: isBettingAppClientLoading, + // isError: isBettingAppClientError, + // error: bettingAppClientError, + } = useAbstractModuleClient({ + moduleId: BETTING_MODULE_ID, + accountId, + chainName, + sender, + + Module: BettingAppClient, + }) + + const { + mutate: mutate_, + mutateAsync: mutateAsync_, + ...rest + } = useBettingCloseRoundMutation(options) + + const mutate = useMemo(() => { + if (!bettingAppClient) return undefined + + return ( + variables: Omit[0], 'client'>, + options?: Parameters[1], + ) => mutate_({ client: bettingAppClient, ...variables }, options) + }, [mutate_, bettingAppClient]) + + const mutateAsync = useMemo(() => { + if (!bettingAppClient) return undefined + + return ( + variables: Omit[0], 'client'>, + options?: Parameters[1], + ) => mutateAsync_({ client: bettingAppClient, ...variables }, options) + }, [mutateAsync_, bettingAppClient]) + + return { mutate, mutateAsync, ...rest } as const + }, + useDistributeWinnings: ( + { + accountId, + chainName, + sender, + }: { + accountId: AccountId | undefined + chainName: string | undefined + sender?: string | undefined + }, + options?: Omit< + UseMutationOptions< + ExecuteResult, + Error, + Omit + >, + 'mutationFn' + >, + ) => { + const { + data: bettingAppClient, + // TODO: figure out what to do with those + // isLoading: isBettingAppClientLoading, + // isError: isBettingAppClientError, + // error: bettingAppClientError, + } = useAbstractModuleClient({ + moduleId: BETTING_MODULE_ID, + accountId, + chainName, + sender, + + Module: BettingAppClient, + }) + + const { + mutate: mutate_, + mutateAsync: mutateAsync_, + ...rest + } = useBettingDistributeWinningsMutation(options) + + const mutate = useMemo(() => { + if (!bettingAppClient) return undefined + + return ( + variables: Omit[0], 'client'>, + options?: Parameters[1], + ) => mutate_({ client: bettingAppClient, ...variables }, options) + }, [mutate_, bettingAppClient]) + + const mutateAsync = useMemo(() => { + if (!bettingAppClient) return undefined + + return ( + variables: Omit[0], 'client'>, + options?: Parameters[1], + ) => mutateAsync_({ client: bettingAppClient, ...variables }, options) + }, [mutateAsync_, bettingAppClient]) + + return { mutate, mutateAsync, ...rest } as const + }, + usePlaceBet: ( + { + accountId, + chainName, + sender, + }: { + accountId: AccountId | undefined + chainName: string | undefined + sender?: string | undefined + }, + options?: Omit< + UseMutationOptions< + ExecuteResult, + Error, + Omit + >, + 'mutationFn' + >, + ) => { + const { + data: bettingAppClient, + // TODO: figure out what to do with those + // isLoading: isBettingAppClientLoading, + // isError: isBettingAppClientError, + // error: bettingAppClientError, + } = useAbstractModuleClient({ + moduleId: BETTING_MODULE_ID, + accountId, + chainName, + sender, + + Module: BettingAppClient, + }) + + const { + mutate: mutate_, + mutateAsync: mutateAsync_, + ...rest + } = useBettingPlaceBetMutation(options) + + const mutate = useMemo(() => { + if (!bettingAppClient) return undefined + + return ( + variables: Omit[0], 'client'>, + options?: Parameters[1], + ) => mutate_({ client: bettingAppClient, ...variables }, options) + }, [mutate_, bettingAppClient]) + + const mutateAsync = useMemo(() => { + if (!bettingAppClient) return undefined + + return ( + variables: Omit[0], 'client'>, + options?: Parameters[1], + ) => mutateAsync_({ client: bettingAppClient, ...variables }, options) + }, [mutateAsync_, bettingAppClient]) + + return { mutate, mutateAsync, ...rest } as const + }, + useUpdateAccounts: ( + { + accountId, + chainName, + sender, + }: { + accountId: AccountId | undefined + chainName: string | undefined + sender?: string | undefined + }, + options?: Omit< + UseMutationOptions< + ExecuteResult, + Error, + Omit + >, + 'mutationFn' + >, + ) => { + const { + data: bettingAppClient, + // TODO: figure out what to do with those + // isLoading: isBettingAppClientLoading, + // isError: isBettingAppClientError, + // error: bettingAppClientError, + } = useAbstractModuleClient({ + moduleId: BETTING_MODULE_ID, + accountId, + chainName, + sender, + + Module: BettingAppClient, + }) + + const { + mutate: mutate_, + mutateAsync: mutateAsync_, + ...rest + } = useBettingUpdateAccountsMutation(options) + + const mutate = useMemo(() => { + if (!bettingAppClient) return undefined + + return ( + variables: Omit[0], 'client'>, + options?: Parameters[1], + ) => mutate_({ client: bettingAppClient, ...variables }, options) + }, [mutate_, bettingAppClient]) + + const mutateAsync = useMemo(() => { + if (!bettingAppClient) return undefined + + return ( + variables: Omit[0], 'client'>, + options?: Parameters[1], + ) => mutateAsync_({ client: bettingAppClient, ...variables }, options) + }, [mutateAsync_, bettingAppClient]) + + return { mutate, mutateAsync, ...rest } as const + }, + useRegister: ( + { + accountId, + chainName, + sender, + }: { + accountId: AccountId | undefined + chainName: string | undefined + sender?: string | undefined + }, + options?: Omit< + UseMutationOptions< + ExecuteResult, + Error, + Omit + >, + 'mutationFn' + >, + ) => { + const { + data: bettingAppClient, + // TODO: figure out what to do with those + // isLoading: isBettingAppClientLoading, + // isError: isBettingAppClientError, + // error: bettingAppClientError, + } = useAbstractModuleClient({ + moduleId: BETTING_MODULE_ID, + accountId, + chainName, + sender, + + Module: BettingAppClient, + }) + + const { + mutate: mutate_, + mutateAsync: mutateAsync_, + ...rest + } = useBettingRegisterMutation(options) + + const mutate = useMemo(() => { + if (!bettingAppClient) return undefined + + return ( + variables: Omit[0], 'client'>, + options?: Parameters[1], + ) => mutate_({ client: bettingAppClient, ...variables }, options) + }, [mutate_, bettingAppClient]) + + const mutateAsync = useMemo(() => { + if (!bettingAppClient) return undefined + + return ( + variables: Omit[0], 'client'>, + options?: Parameters[1], + ) => mutateAsync_({ client: bettingAppClient, ...variables }, options) + }, [mutateAsync_, bettingAppClient]) + + return { mutate, mutateAsync, ...rest } as const + }, + useCreateRound: ( + { + accountId, + chainName, + sender, + }: { + accountId: AccountId | undefined + chainName: string | undefined + sender?: string | undefined + }, + options?: Omit< + UseMutationOptions< + ExecuteResult, + Error, + Omit + >, + 'mutationFn' + >, + ) => { + const { + data: bettingAppClient, + // TODO: figure out what to do with those + // isLoading: isBettingAppClientLoading, + // isError: isBettingAppClientError, + // error: bettingAppClientError, + } = useAbstractModuleClient({ + moduleId: BETTING_MODULE_ID, + accountId, + chainName, + sender, + + Module: BettingAppClient, + }) + + const { + mutate: mutate_, + mutateAsync: mutateAsync_, + ...rest + } = useBettingCreateRoundMutation(options) + + const mutate = useMemo(() => { + if (!bettingAppClient) return undefined + + return ( + variables: Omit[0], 'client'>, + options?: Parameters[1], + ) => mutate_({ client: bettingAppClient, ...variables }, options) + }, [mutate_, bettingAppClient]) + + const mutateAsync = useMemo(() => { + if (!bettingAppClient) return undefined + + return ( + variables: Omit[0], 'client'>, + options?: Parameters[1], + ) => mutateAsync_({ client: bettingAppClient, ...variables }, options) + }, [mutateAsync_, bettingAppClient]) + + return { mutate, mutateAsync, ...rest } as const + }, + }, +} diff --git a/examples/wagemos-xion-nextjs/src/app/_components/place-bet-dialog.tsx b/examples/wagemos-xion-nextjs/src/app/_components/place-bet-dialog.tsx new file mode 100644 index 00000000..101a1d33 --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/app/_components/place-bet-dialog.tsx @@ -0,0 +1,193 @@ +'use client' + +import { stringToAccountId } from '@abstract-money/core' +import { coin } from '@cosmjs/stargate' +import { zodResolver } from '@hookform/resolvers/zod' +import { DialogDescription } from '@radix-ui/react-dialog' +import { useAccount } from 'graz' +import { Loader2 } from 'lucide-react' +import { useCallback, useState } from 'react' +import { SubmitHandler, useForm } from 'react-hook-form' +import { z } from 'zod' +import { betting } from '../../_generated' +import { RoundResponse } from '../../_generated/cosmwasm-codegen/Betting.types' +import { Button } from '../../components/ui/button' +import { + Dialog, + DialogContent, + DialogFooter, + DialogHeader, + DialogTitle, +} from '../../components/ui/dialog' +import { + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '../../components/ui/form' +import { Input } from '../../components/ui/input' +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from '../../components/ui/select' +import { useToast } from '../../components/ui/use-toast' +import { useListRounds } from '../_hooks/use-list-rounds' +import { + BET_DENOM, + ROUND_ACCOUNT_ID, + ROUND_CHAIN_NAME, +} from '../_lib/constants' + +const placeBetSchema = z.object({ + amount: z.coerce + .number({ required_error: 'Amount to bet is required' }) + .positive('Amout to bet must be positive'), + accountSeq: z.string({ required_error: 'Account Sequence is required' }), +}) + +export function PlaceBetDialog({ round }: { round: RoundResponse }) { + const [isOpen, setIsOpen] = useState(false) + + const { isConnected } = useAccount() + + const form = useForm({ + mode: 'onTouched', + resolver: zodResolver(placeBetSchema), + defaultValues: { + amount: 1, + accountSeq: round.teams[0]?.seq.toString(), + }, + }) + + const { toast } = useToast() + + const { refetch: refetchRounds } = useListRounds() + + const { + mutateAsync: placeBetAsync, + isLoading, + ...rest + } = betting.mutations.usePlaceBet( + { + accountId: stringToAccountId(ROUND_ACCOUNT_ID), + chainName: ROUND_CHAIN_NAME, + }, + { + onSuccess: () => refetchRounds(), + }, + ) + + const onSubmit: SubmitHandler> = useCallback( + async ({ amount, accountSeq }) => { + if (!placeBetAsync) + throw new Error('Unexpected error: placeBetAsync is not defined') + const accountIdToBetOn = round.teams.find( + (account) => account.seq === +accountSeq, + ) + if (!accountIdToBetOn) throw new Error('Account not found') + + await placeBetAsync?.({ + msg: { + roundId: round.id, + bet: { + account_id: accountIdToBetOn, + asset: { name: round.total_bet.name, amount: amount.toString() }, + }, + }, + args: { funds: [coin(amount.toString(), BET_DENOM)] }, + }) + + setIsOpen(false) + toast({ + title: 'Bet placed', + description: `You bet ${amount} ${round.total_bet.name} on account ${accountIdToBetOn.seq}`, + }) + }, + [placeBetAsync], + ) + + return ( + <> + + setIsOpen(open)}> + +
+ + + Place a bet on {round.name} + {round.description} + +
+ ( + + Account Sequence + + + Select an account sequence to bet on. + + + + )} + /> + ( + + Bet Amount + + + + + Enter the amount you want to bet. + + + + )} + /> +
+ + + +
+ +
+
+ + ) +} diff --git a/examples/wagemos-xion-nextjs/src/app/_components/round.tsx b/examples/wagemos-xion-nextjs/src/app/_components/round.tsx new file mode 100644 index 00000000..20d3b0fe --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/app/_components/round.tsx @@ -0,0 +1,93 @@ +import { ComponentProps } from 'react' +import { Badge } from '../../components/ui/badge' +import { cn } from '../../utils' + +export function Round({ className, ...rest }: ComponentProps<'div'>) { + return ( +
+ ) +} + +export function RoundHeader({ className, ...rest }: ComponentProps<'div'>) { + return ( +
+ ) +} + +export function RoundBody({ className, ...rest }: ComponentProps<'div'>) { + return
+} + +export function RoundFooter({ className, ...rest }: ComponentProps<'div'>) { + return ( +
+ ) +} + +export function RoundName({ className, ...rest }: ComponentProps<'span'>) { + return +} + +export function RoundDescription({ + className, + ...rest +}: ComponentProps<'div'>) { + return
+} + +export function RoundId({ + className, + ...rest +}: Omit, 'variant'>) { + return +} + +export function RoundStatus({ + className, + open, + ...rest +}: Omit, 'variant'> & { open: boolean }) { + return ( + + ) +} + +export function RoundWinningTeam({ + className, + ...rest +}: Omit, 'variant'>) { + return +} + +export function RoundTeams({ className, ...rest }: ComponentProps<'div'>) { + return ( +
+ ) +} + +export function RoundTeamMember({ + className, + ...rest +}: Omit, 'variant'>) { + return +} + +export function RoundTotalBet({ + className, + ...rest +}: Omit, 'variant'>) { + return +} diff --git a/examples/wagemos-xion-nextjs/src/app/_components/wallet-button.tsx b/examples/wagemos-xion-nextjs/src/app/_components/wallet-button.tsx new file mode 100644 index 00000000..6cdd604f --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/app/_components/wallet-button.tsx @@ -0,0 +1,119 @@ +'use client' +import { + WalletType, + getAvailableWallets, + useAccount, + useConnect, + useDisconnect, +} from 'graz' +import { useState } from 'react' +import { Button } from '../../components/ui/button' +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, +} from '../../components/ui/dialog' +import { useToast } from '../../components/ui/use-toast' + +import { CHAIN_IDS } from '../_lib/constants' + +function DisconnectButton() { + const { disconnect } = useDisconnect() + const { data: account } = useAccount({ + chainId: CHAIN_IDS[0], + }) + + const { toast } = useToast() + + const handleCopy = () => { + if (!account) return + navigator.clipboard.writeText(account?.bech32Address) + toast({ title: 'Address copied to clipboard' }) + } + + return ( +
+ + +
+ ) +} + +function ConnectButton() { + const wallets = getAvailableWallets() + const [isOpen, setIsOpen] = useState(false) + const { toast } = useToast() + + const { isConnecting } = useAccount({ + chainId: CHAIN_IDS, + multiChain: true, + onConnect: ({ walletType, chains }) => { + toast({ + title: `Wallet connected! using ${walletType} to ${chains.map( + (item) => item?.chainId, + )}`, + }) + }, + onDisconnect: () => { + toast({ + title: 'Wallet disconnected!', + }) + }, + }) + + const { connect } = useConnect() + + const handleConnect = (wallet: WalletType) => { + connect({ walletType: wallet, chainId: CHAIN_IDS }) + setIsOpen(false) + } + return ( + <> + + setIsOpen(open)}> + + + Connect your wallet + +
+ {Object.entries(wallets).map(([key, enabled], i) => { + if (enabled) { + return ( + + ) + } + })} +
+
+
+ + ) +} + +export function WalletButton() { + const { isConnected } = useAccount({ + chainId: CHAIN_IDS, + }) + if (isConnected) { + return + } + return +} diff --git a/examples/wagemos-xion-nextjs/src/app/_hooks/use-list-rounds.ts b/examples/wagemos-xion-nextjs/src/app/_hooks/use-list-rounds.ts new file mode 100644 index 00000000..bcd5db06 --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/app/_hooks/use-list-rounds.ts @@ -0,0 +1,11 @@ +import { stringToAccountId } from '@abstract-money/core' +import { betting } from '../../_generated' +import { ROUND_ACCOUNT_ID, ROUND_CHAIN_NAME } from '../_lib/constants' + +export const useListRounds = () => { + return betting.queries.useListRounds({ + accountId: stringToAccountId(ROUND_ACCOUNT_ID), + chainName: ROUND_CHAIN_NAME, + args: {}, + }) +} diff --git a/examples/wagemos-xion-nextjs/src/app/_lib/constants.ts b/examples/wagemos-xion-nextjs/src/app/_lib/constants.ts new file mode 100644 index 00000000..08def470 --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/app/_lib/constants.ts @@ -0,0 +1,5 @@ +export const ROUND_ACCOUNT_ID = 'xiontestnet-11'; +export const ROUND_CHAIN_NAME = "xiontestnet"; +export const CHAIN_IDS = ["xion-testnet-1"]; +// export const CHAIN_IDS = ["neutron-1", "osmosis-1", "pion-1"]; +export const BET_DENOM = 'uxion' diff --git a/examples/wagemos-xion-nextjs/src/app/_providers/graz.tsx b/examples/wagemos-xion-nextjs/src/app/_providers/graz.tsx new file mode 100644 index 00000000..1cf79a7c --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/app/_providers/graz.tsx @@ -0,0 +1,50 @@ +'use client' + +import { GrazProvider as Provider } from 'graz' +import { + mainnetChains, + mainnetChainsArray, + testnetChains, + testnetChainsArray, +} from 'graz/chains' +import { ComponentProps } from 'react' + +export function GrazProvider( + props: Pick, 'children' | 'client'>, +) { + return ( + + ) +} diff --git a/examples/wagemos-xion-nextjs/src/app/favicon.ico b/examples/wagemos-xion-nextjs/src/app/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..718d6fea4835ec2d246af9800eddb7ffb276240c GIT binary patch literal 25931 zcmeHv30#a{`}aL_*G&7qml|y<+KVaDM2m#dVr!KsA!#An?kSQM(q<_dDNCpjEux83 zLb9Z^XxbDl(w>%i@8hT6>)&Gu{h#Oeyszu?xtw#Zb1mO{pgX9699l+Qppw7jXaYf~-84xW z)w4x8?=youko|}Vr~(D$UXIbiXABHh`p1?nn8Po~fxRJv}|0e(BPs|G`(TT%kKVJAdg5*Z|x0leQq0 zkdUBvb#>9F()jo|T~kx@OM8$9wzs~t2l;K=woNssA3l6|sx2r3+kdf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( zAyS;Ow?6Q&XA+cnkCb{28_1N8H#?J!*$MmIwLq^*T_9-z^&UE@A(z9oGYtFy6EZef LrJugUA?W`A8`#=m literal 0 HcmV?d00001 diff --git a/examples/wagemos-xion-nextjs/src/app/globals.css b/examples/wagemos-xion-nextjs/src/app/globals.css new file mode 100644 index 00000000..2d017685 --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/app/globals.css @@ -0,0 +1,104 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +@layer base { + :root { + --background: 0 0% 100%; + --foreground: 222.2 84% 4.9%; + + --card: 0 0% 100%; + --card-foreground: 222.2 84% 4.9%; + + --popover: 0 0% 100%; + --popover-foreground: 222.2 84% 4.9%; + + --primary: 222.2 47.4% 11.2%; + --primary-foreground: 210 40% 98%; + + --secondary: 210 40% 96.1%; + --secondary-foreground: 222.2 47.4% 11.2%; + + --muted: 210 40% 96.1%; + --muted-foreground: 215.4 16.3% 46.9%; + + --accent: 210 40% 96.1%; + --accent-foreground: 222.2 47.4% 11.2%; + + --destructive: 0 84.2% 60.2%; + --destructive-foreground: 210 40% 98%; + + --border: 214.3 31.8% 91.4%; + --input: 214.3 31.8% 91.4%; + --ring: 222.2 84% 4.9%; + + --radius: 0.5rem; + } + + .dark { + --background: 222.2 84% 4.9%; + --foreground: 210 40% 98%; + + --card: 222.2 84% 4.9%; + --card-foreground: 210 40% 98%; + + --popover: 222.2 84% 4.9%; + --popover-foreground: 210 40% 98%; + + --primary: 210 40% 98%; + --primary-foreground: 222.2 47.4% 11.2%; + + --secondary: 217.2 32.6% 17.5%; + --secondary-foreground: 210 40% 98%; + + --muted: 217.2 32.6% 17.5%; + --muted-foreground: 215 20.2% 65.1%; + + --accent: 217.2 32.6% 17.5%; + --accent-foreground: 210 40% 98%; + + --destructive: 0 62.8% 30.6%; + --destructive-foreground: 210 40% 98%; + + --border: 217.2 32.6% 17.5%; + --input: 217.2 32.6% 17.5%; + --ring: 212.7 26.8% 83.9%; + } +} + +@layer base { + * { + @apply border-border; + } + body { + @apply bg-background text-foreground; + } +} + + +@layer base { + html * { + font-family: var(--font-body); + } + h1, h2, h3, h4, h5, h6 { + font-family: var(--font-display); + } + h1 { + @apply text-5xl font-bold; + } + h2 { + @apply text-4xl font-bold; + } + h3 { + @apply text-3xl font-bold; + } + h4 { + @apply text-2xl font-medium; + } + h5 { + @apply text-xl font-medium; + } + h6 { + @apply text-lg font-medium; + } +} diff --git a/examples/wagemos-xion-nextjs/src/app/layout.tsx b/examples/wagemos-xion-nextjs/src/app/layout.tsx new file mode 100644 index 00000000..3f3097ea --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/app/layout.tsx @@ -0,0 +1,66 @@ +'use client' + +import { grazProvider } from '@abstract-money/provider-graz' +import { xionProvider } from '@abstract-money/provider-xion' +import { AbstractProvider, createConfig } from '@abstract-money/react' +import { AbstraxionProvider } from '@burnt-labs/abstraxion' +import { QueryClient } from '@tanstack/react-query' +import { ReactQueryDevtools } from '@tanstack/react-query-devtools' +import { Inter, Poppins } from 'next/font/google' +import { Toaster } from '../components/ui/toaster' +import { cn } from '../utils' +import { GrazProvider } from './_providers/graz' +import './globals.css' + +const client = new QueryClient({ + defaultOptions: { + queries: { + cacheTime: 1_000 * 60 * 60 * 24, // 24 hours + networkMode: 'offlineFirst', + refetchOnWindowFocus: false, + retry: 0, + }, + mutations: { + networkMode: 'offlineFirst', + }, + }, +}) + +const inter = Inter({ subsets: ['latin'], variable: '--font-body' }) + +const poppins = Poppins({ + subsets: ['latin'], + weight: ['900', '800', '700'], + variable: '--font-display', +}) +const abstractConfig = createConfig({ + provider: grazProvider, + apiUrl: 'https://believathon.api.abstract.money/', +}) + +export default function RootLayout({ + children, +}: { + children: React.ReactNode + bets: React.ReactNode +}) { + return ( + + + {/**/} + + +
+
+
{children}
+
+
+
+ +
+ {/*
*/} + + + + ) +} diff --git a/examples/wagemos-xion-nextjs/src/app/page.tsx b/examples/wagemos-xion-nextjs/src/app/page.tsx new file mode 100644 index 00000000..a9ced6e2 --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/app/page.tsx @@ -0,0 +1,78 @@ +'use client' + +import { PlaceBetDialog } from './_components/place-bet-dialog' +import { + Round, + RoundBody, + RoundDescription, + RoundFooter, + RoundHeader, + RoundId, + RoundName, + RoundStatus, + RoundTeamMember, + RoundTeams, + RoundTotalBet, + RoundWinningTeam, +} from './_components/round' +import { WalletButton } from './_components/wallet-button' +import { useListRounds } from './_hooks/use-list-rounds' + +export default function Home() { + const { data, isLoading, isError } = useListRounds() + if (isLoading) return

Loading...

+ if (isError) return

Error

+ return ( + <> +

WAGEMOS with graz

+ +
+

List of Rounds:

+
+ {data.rounds.map((round) => { + const status = + typeof round.status === 'string' + ? { status: round.status } + : ({ + status: 'closed', + winningTeam: round.status.closed.winning_team?.seq, + } as const) + return ( + + + {round.name} + ID: {round.id} + + {status.status} + + {status.winningTeam && ( + + Winner Account Sequence: {status.winningTeam} + + )} + + + {round.description} +

Team members:

+ + {round.teams.map((member, i) => ( + + Account Seq: {member.seq} + + ))} + +
+ + + Total Bet: {round.total_bet.amount} {round.total_bet.name} + + {status.status === 'open' && } + +
+ ) + })} +
+
+ + ) +} diff --git a/examples/wagemos-xion-nextjs/src/components/ui/badge.tsx b/examples/wagemos-xion-nextjs/src/components/ui/badge.tsx new file mode 100644 index 00000000..c5c751fe --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/components/ui/badge.tsx @@ -0,0 +1,36 @@ +import { type VariantProps, cva } from 'class-variance-authority' +import * as React from 'react' + +import { cn } from '../../utils' + +const badgeVariants = cva( + 'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', + { + variants: { + variant: { + default: + 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80', + secondary: + 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80', + destructive: + 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80', + outline: 'text-foreground', + }, + }, + defaultVariants: { + variant: 'default', + }, + }, +) + +export interface BadgeProps + extends React.HTMLAttributes, + VariantProps {} + +function Badge({ className, variant, ...props }: BadgeProps) { + return ( +
+ ) +} + +export { Badge, badgeVariants } diff --git a/examples/wagemos-xion-nextjs/src/components/ui/button.tsx b/examples/wagemos-xion-nextjs/src/components/ui/button.tsx new file mode 100644 index 00000000..09da3342 --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/components/ui/button.tsx @@ -0,0 +1,56 @@ +import { Slot } from '@radix-ui/react-slot' +import { type VariantProps, cva } from 'class-variance-authority' +import * as React from 'react' + +import { cn } from '../../utils' + +const buttonVariants = cva( + 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', + { + variants: { + variant: { + default: 'bg-primary text-primary-foreground hover:bg-primary/90', + destructive: + 'bg-destructive text-destructive-foreground hover:bg-destructive/90', + outline: + 'border border-input bg-background hover:bg-accent hover:text-accent-foreground', + secondary: + 'bg-secondary text-secondary-foreground hover:bg-secondary/80', + ghost: 'hover:bg-accent hover:text-accent-foreground', + link: 'text-primary underline-offset-4 hover:underline', + }, + size: { + default: 'h-10 px-4 py-2', + sm: 'h-9 rounded-md px-3', + lg: 'h-11 rounded-md px-8', + icon: 'h-10 w-10', + }, + }, + defaultVariants: { + variant: 'default', + size: 'default', + }, + }, +) + +export interface ButtonProps + extends React.ButtonHTMLAttributes, + VariantProps { + asChild?: boolean +} + +const Button = React.forwardRef( + ({ className, variant, size, asChild = false, ...props }, ref) => { + const Comp = asChild ? Slot : 'button' + return ( + + ) + }, +) +Button.displayName = 'Button' + +export { Button, buttonVariants } diff --git a/examples/wagemos-xion-nextjs/src/components/ui/dialog.tsx b/examples/wagemos-xion-nextjs/src/components/ui/dialog.tsx new file mode 100644 index 00000000..2c6e4a83 --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/components/ui/dialog.tsx @@ -0,0 +1,122 @@ +'use client' + +import * as DialogPrimitive from '@radix-ui/react-dialog' +import { X } from 'lucide-react' +import * as React from 'react' + +import { cn } from '../../utils' + +const Dialog = DialogPrimitive.Root + +const DialogTrigger = DialogPrimitive.Trigger + +const DialogPortal = DialogPrimitive.Portal + +const DialogClose = DialogPrimitive.Close + +const DialogOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogOverlay.displayName = DialogPrimitive.Overlay.displayName + +const DialogContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + + {children} + + + Close + + + +)) +DialogContent.displayName = DialogPrimitive.Content.displayName + +const DialogHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +DialogHeader.displayName = 'DialogHeader' + +const DialogFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +DialogFooter.displayName = 'DialogFooter' + +const DialogTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogTitle.displayName = DialogPrimitive.Title.displayName + +const DialogDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogDescription.displayName = DialogPrimitive.Description.displayName + +export { + Dialog, + DialogPortal, + DialogOverlay, + DialogClose, + DialogTrigger, + DialogContent, + DialogHeader, + DialogFooter, + DialogTitle, + DialogDescription, +} diff --git a/examples/wagemos-xion-nextjs/src/components/ui/form.tsx b/examples/wagemos-xion-nextjs/src/components/ui/form.tsx new file mode 100644 index 00000000..540baaad --- /dev/null +++ b/examples/wagemos-xion-nextjs/src/components/ui/form.tsx @@ -0,0 +1,176 @@ +import * as LabelPrimitive from '@radix-ui/react-label' +import { Slot } from '@radix-ui/react-slot' +import * as React from 'react' +import { + Controller, + ControllerProps, + FieldPath, + FieldValues, + FormProvider, + useFormContext, +} from 'react-hook-form' + +import { Label } from '../../components/ui/label' +import { cn } from '../../utils' + +const Form = FormProvider + +type FormFieldContextValue< + TFieldValues extends FieldValues = FieldValues, + TName extends FieldPath = FieldPath, +> = { + name: TName +} + +const FormFieldContext = React.createContext( + {} as FormFieldContextValue, +) + +const FormField = < + TFieldValues extends FieldValues = FieldValues, + TName extends FieldPath = FieldPath, +>({ + ...props +}: ControllerProps) => { + return ( + + + + ) +} + +const useFormField = () => { + const fieldContext = React.useContext(FormFieldContext) + const itemContext = React.useContext(FormItemContext) + const { getFieldState, formState } = useFormContext() + + const fieldState = getFieldState(fieldContext.name, formState) + + if (!fieldContext) { + throw new Error('useFormField should be used within ') + } + + const { id } = itemContext + + return { + id, + name: fieldContext.name, + formItemId: `${id}-form-item`, + formDescriptionId: `${id}-form-item-description`, + formMessageId: `${id}-form-item-message`, + ...fieldState, + } +} + +type FormItemContextValue = { + id: string +} + +const FormItemContext = React.createContext( + {} as FormItemContextValue, +) + +const FormItem = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => { + const id = React.useId() + + return ( + +
+ + ) +}) +FormItem.displayName = 'FormItem' + +const FormLabel = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { + const { error, formItemId } = useFormField() + + return ( +