From 33390a1ca0f7c73ff39dd7fb494802b8cc2e9de0 Mon Sep 17 00:00:00 2001 From: hotwater Date: Fri, 29 Dec 2023 15:55:38 +0200 Subject: [PATCH] fix: build --- .changeset/clever-flies-sneeze.md | 26 +++++++ .changeset/violet-suns-jam.md | 7 -- .github/workflows/on-push-to-main.yml | 4 +- .../wagemos-cosmoskit-nextjs/package.json | 6 +- .../src/_generated/index.ts | 2 + .../src/app/@bets/layout.tsx | 18 ----- .../src/app/@bets/page.tsx | 76 ------------------- .../_components/place-bet-dialog.tsx | 16 ++-- .../src/app}/_components/round.tsx | 4 +- .../src/app/layout.tsx | 29 +++---- .../wagemos-cosmoskit-nextjs/src/app/page.tsx | 71 +++++++++++++++++ examples/wagemos-graz-nextjs/package.json | 6 +- .../src/app/@bets/layout.tsx | 18 ----- .../src/app/@bets/page.tsx | 76 ------------------- .../_components/place-bet-dialog.tsx | 16 ++-- .../src/app}/_components/round.tsx | 4 +- .../wagemos-graz-nextjs/src/app/layout.tsx | 28 ++++--- examples/wagemos-graz-nextjs/src/app/page.tsx | 71 +++++++++++++++++ package.json | 5 +- packages/cli/src/plugins/react.ts | 2 + packages/core/package.json | 4 +- packages/core/src/clients/AbstractClient.ts | 2 +- packages/core/src/clients/index.ts | 2 +- packages/core/turbo.json | 4 +- .../{cosmwasm => cosmwasm-utils}/.gitignore | 2 +- .../{cosmwasm => cosmwasm-utils}/README.md | 0 .../{cosmwasm => cosmwasm-utils}/package.json | 14 ++-- .../src/client/BatchCosmWasmClient.ts | 0 .../src/client/index.ts | 0 .../{cosmwasm => cosmwasm-utils}/src/index.ts | 2 +- .../src/query}/index.ts | 0 .../src/query}/rawQuery.ts | 0 .../tsconfig.json | 0 .../tsup.config.ts | 2 +- .../{cosmwasm => cosmwasm-utils}/turbo.json | 0 packages/cosmwasm-utils/utils/package.json | 4 + packages/react/package.json | 2 +- packages/react/src/contexts/account-id.ts | 2 +- pnpm-lock.yaml | 24 +++--- pnpm-workspace.yaml | 1 - 40 files changed, 269 insertions(+), 281 deletions(-) create mode 100644 .changeset/clever-flies-sneeze.md delete mode 100644 .changeset/violet-suns-jam.md delete mode 100644 examples/wagemos-cosmoskit-nextjs/src/app/@bets/layout.tsx delete mode 100644 examples/wagemos-cosmoskit-nextjs/src/app/@bets/page.tsx rename examples/wagemos-cosmoskit-nextjs/src/app/{@bets => }/_components/place-bet-dialog.tsx (92%) rename examples/{wagemos-graz-nextjs/src/app/@bets => wagemos-cosmoskit-nextjs/src/app}/_components/round.tsx (96%) delete mode 100644 examples/wagemos-graz-nextjs/src/app/@bets/layout.tsx delete mode 100644 examples/wagemos-graz-nextjs/src/app/@bets/page.tsx rename examples/wagemos-graz-nextjs/src/app/{@bets => }/_components/place-bet-dialog.tsx (92%) rename examples/{wagemos-cosmoskit-nextjs/src/app/@bets => wagemos-graz-nextjs/src/app}/_components/round.tsx (96%) rename packages/{cosmwasm => cosmwasm-utils}/.gitignore (86%) rename packages/{cosmwasm => cosmwasm-utils}/README.md (100%) rename packages/{cosmwasm => cosmwasm-utils}/package.json (81%) rename packages/{cosmwasm => cosmwasm-utils}/src/client/BatchCosmWasmClient.ts (100%) rename packages/{cosmwasm => cosmwasm-utils}/src/client/index.ts (100%) rename packages/{cosmwasm => cosmwasm-utils}/src/index.ts (51%) rename packages/{cosmwasm/src/utils => cosmwasm-utils/src/query}/index.ts (100%) rename packages/{cosmwasm/src/utils => cosmwasm-utils/src/query}/rawQuery.ts (100%) rename packages/{cosmwasm => cosmwasm-utils}/tsconfig.json (100%) rename packages/{cosmwasm => cosmwasm-utils}/tsup.config.ts (82%) rename packages/{cosmwasm => cosmwasm-utils}/turbo.json (100%) create mode 100644 packages/cosmwasm-utils/utils/package.json diff --git a/.changeset/clever-flies-sneeze.md b/.changeset/clever-flies-sneeze.md new file mode 100644 index 00000000..9852c0cf --- /dev/null +++ b/.changeset/clever-flies-sneeze.md @@ -0,0 +1,26 @@ +--- +"@abstract-money/cli": minor +"@abstract-money/core": minor +"@abstract-money/cosmwasm-utils": minor +"@abstract-money/react": minor +--- + +First release of **abstract.js** revamped SDK! + +New SDK structure involves multiple packages, each with its own dependencies. +This allows for more flexibility and better control over the SDK. + +Old-new packages mapping: + +- `@abstract-money/abstract.js` -> `@abstract-money/core` +- `@abstract-money/abstract.js-react` -> `@abstract-money/react` +- `@abstract-money/cosmwasm` -> `@abstract-money/cosmwasm-utils` + +A new package was introduced, `@abstract-money/cli` that adopts a quicker +development setup when using Abstract contracts. +A developer is now not obligated to download the Abstract contract schemas himself, +and can simply enumerate the required contracts via the `registry` plugin, +available at `@abstract-money/cli/plugins`, and the CLI will download and cache them +itself. +This feature also allowed to cut out the boilerplate code from the old `@abstract-money/abstract.js`, +yet keeping the backwards compatibility. diff --git a/.changeset/violet-suns-jam.md b/.changeset/violet-suns-jam.md deleted file mode 100644 index 59d97d7b..00000000 --- a/.changeset/violet-suns-jam.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@abstract-money/core": patch -"@abstract-money/cosmwasm": patch -"@abstract-money/react": patch ---- - -Initializes core, react packages and fixes cosmwasm types diff --git a/.github/workflows/on-push-to-main.yml b/.github/workflows/on-push-to-main.yml index ec07db43..88be26bd 100644 --- a/.github/workflows/on-push-to-main.yml +++ b/.github/workflows/on-push-to-main.yml @@ -1,7 +1,7 @@ name: Main on: push: - branches: [main] + branches: [mainline] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -31,7 +31,7 @@ jobs: - name: Create version pull request or publish to npm id: changesets - uses: changesets/action@v1 + uses: changesets/action@v1.4.1 with: title: "chore: version packages" commit: "chore: version packages" diff --git a/examples/wagemos-cosmoskit-nextjs/package.json b/examples/wagemos-cosmoskit-nextjs/package.json index 81a00475..df9ed98e 100644 --- a/examples/wagemos-cosmoskit-nextjs/package.json +++ b/examples/wagemos-cosmoskit-nextjs/package.json @@ -10,8 +10,8 @@ "lint": "next lint" }, "dependencies": { - "@abstract-money/core": "workspace:@abstract-money/core@*", - "@abstract-money/react": "workspace:@abstract-money/react@*", + "@abstract-money/core": "workspace:*", + "@abstract-money/react": "workspace:*", "@chain-registry/types": "^0.13.1", "@cosmjs/amino": "^0.31.0", "@cosmjs/cosmwasm-stargate": "^0.31.0", @@ -44,7 +44,7 @@ "zod": "^3.22.4" }, "devDependencies": { - "@abstract-money/cli": "workspace:@abstract-money/cli@*", + "@abstract-money/cli": "workspace:*", "@keplr-wallet/types": "^0.12.44", "@types/node": "^20", "@types/react": "^18", diff --git a/examples/wagemos-cosmoskit-nextjs/src/_generated/index.ts b/examples/wagemos-cosmoskit-nextjs/src/_generated/index.ts index 49e32fe7..a097a635 100644 --- a/examples/wagemos-cosmoskit-nextjs/src/_generated/index.ts +++ b/examples/wagemos-cosmoskit-nextjs/src/_generated/index.ts @@ -1,3 +1,5 @@ +'use client' + import { SigningCosmWasmClient, CosmWasmClient, diff --git a/examples/wagemos-cosmoskit-nextjs/src/app/@bets/layout.tsx b/examples/wagemos-cosmoskit-nextjs/src/app/@bets/layout.tsx deleted file mode 100644 index eb9a5c02..00000000 --- a/examples/wagemos-cosmoskit-nextjs/src/app/@bets/layout.tsx +++ /dev/null @@ -1,18 +0,0 @@ -'use client' -import { AbstractAccountId } from '@abstract-money/core' -import { AbstractAccountIdProvider } from '@abstract-money/react' -import { PropsWithChildren, ReactNode } from 'react' - -export default function BetsLayout({ - children, -}: PropsWithChildren<{ children: ReactNode }>) { - return ( - -
-
{children}
-
-
- ) -} diff --git a/examples/wagemos-cosmoskit-nextjs/src/app/@bets/page.tsx b/examples/wagemos-cosmoskit-nextjs/src/app/@bets/page.tsx deleted file mode 100644 index d42e3490..00000000 --- a/examples/wagemos-cosmoskit-nextjs/src/app/@bets/page.tsx +++ /dev/null @@ -1,76 +0,0 @@ -'use client' - -import { betting } from '../../_generated' -import { PlaceBetDialog } from './_components/place-bet-dialog' -import { - Round, - RoundBody, - RoundDescription, - RoundFooter, - RoundHeader, - RoundId, - RoundName, - RoundStatus, - RoundTeamMember, - RoundTeams, - RoundTotalBet, - RoundWinningTeam, -} from './_components/round' - -export default function ListRoundsPage() { - const { data, isLoading, isError } = betting.queries.useListRounds({ - args: {}, - chain: 'neutron', - }) - if (isLoading) return

Loading...

- if (isError) return

Error

- return ( -
-

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-cosmoskit-nextjs/src/app/@bets/_components/place-bet-dialog.tsx b/examples/wagemos-cosmoskit-nextjs/src/app/_components/place-bet-dialog.tsx similarity index 92% rename from examples/wagemos-cosmoskit-nextjs/src/app/@bets/_components/place-bet-dialog.tsx rename to examples/wagemos-cosmoskit-nextjs/src/app/_components/place-bet-dialog.tsx index 068c4ca8..edf02269 100644 --- a/examples/wagemos-cosmoskit-nextjs/src/app/@bets/_components/place-bet-dialog.tsx +++ b/examples/wagemos-cosmoskit-nextjs/src/app/_components/place-bet-dialog.tsx @@ -8,16 +8,16 @@ 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 { 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' +} from '../../components/ui/dialog' import { Form, FormControl, @@ -26,16 +26,16 @@ import { FormItem, FormLabel, FormMessage, -} from '../../../components/ui/form' -import { Input } from '../../../components/ui/input' +} 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' +} from '../../components/ui/select' +import { useToast } from '../../components/ui/use-toast' const placeBetSchema = z.object({ amount: z.coerce diff --git a/examples/wagemos-graz-nextjs/src/app/@bets/_components/round.tsx b/examples/wagemos-cosmoskit-nextjs/src/app/_components/round.tsx similarity index 96% rename from examples/wagemos-graz-nextjs/src/app/@bets/_components/round.tsx rename to examples/wagemos-cosmoskit-nextjs/src/app/_components/round.tsx index bb0c8450..20d3b0fe 100644 --- a/examples/wagemos-graz-nextjs/src/app/@bets/_components/round.tsx +++ b/examples/wagemos-cosmoskit-nextjs/src/app/_components/round.tsx @@ -1,6 +1,6 @@ import { ComponentProps } from 'react' -import { Badge } from '../../../components/ui/badge' -import { cn } from '../../../utils' +import { Badge } from '../../components/ui/badge' +import { cn } from '../../utils' export function Round({ className, ...rest }: ComponentProps<'div'>) { return ( diff --git a/examples/wagemos-cosmoskit-nextjs/src/app/layout.tsx b/examples/wagemos-cosmoskit-nextjs/src/app/layout.tsx index 7053a3bf..fcdcf8e2 100644 --- a/examples/wagemos-cosmoskit-nextjs/src/app/layout.tsx +++ b/examples/wagemos-cosmoskit-nextjs/src/app/layout.tsx @@ -1,6 +1,11 @@ -import { AbstractProvider } from '@abstract-money/react' +'use client' + +import { AbstractAccountId } from '@abstract-money/core' +import { + AbstractAccountIdProvider, + AbstractProvider, +} from '@abstract-money/react' import '@interchain-ui/react/styles' -import type { Metadata } from 'next' import { Inter, Poppins } from 'next/font/google' import { Toaster } from '../components/ui/toaster' import { cn } from '../utils' @@ -14,27 +19,25 @@ const poppins = Poppins({ variable: '--font-display', }) -export const metadata: Metadata = { - title: 'Wagemos App', - description: 'Wagemos App using Abstract SDK', -} - export default function RootLayout({ children, - bets, }: { children: React.ReactNode - bets: React.ReactNode }) { return ( -
- {children} - {bets} -
+ +
+
+
{children}
+
+
+
diff --git a/examples/wagemos-cosmoskit-nextjs/src/app/page.tsx b/examples/wagemos-cosmoskit-nextjs/src/app/page.tsx index 98e09fe9..46465f1d 100644 --- a/examples/wagemos-cosmoskit-nextjs/src/app/page.tsx +++ b/examples/wagemos-cosmoskit-nextjs/src/app/page.tsx @@ -1,10 +1,81 @@ +'use client' + +import { betting } from '../_generated' +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' export default function Home() { + const { data, isLoading, isError } = betting.queries.useListRounds({ + args: {}, + chain: 'neutron', + }) + if (isLoading) return

Loading...

+ if (isError) return

Error

return ( <>

WAGEMOS with cosmoskit

+
+

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-graz-nextjs/package.json b/examples/wagemos-graz-nextjs/package.json index 0a10ea91..45d13cf3 100644 --- a/examples/wagemos-graz-nextjs/package.json +++ b/examples/wagemos-graz-nextjs/package.json @@ -12,8 +12,8 @@ "generate": "graz generate -g -b" }, "dependencies": { - "@abstract-money/core": "workspace:@abstract-money/core@*", - "@abstract-money/react": "workspace:@abstract-money/react@*", + "@abstract-money/core": "workspace:*", + "@abstract-money/react": "workspace:*", "@cosmjs/amino": "^0.31.0", "@cosmjs/cosmwasm-stargate": "^0.31.0", "@cosmjs/encoding": "^0.31.0", @@ -43,7 +43,7 @@ "zod": "^3.22.4" }, "devDependencies": { - "@abstract-money/cli": "workspace:@abstract-money/cli@*", + "@abstract-money/cli": "workspace:*", "@keplr-wallet/types": "^0.12.44", "@types/node": "^20", "@types/react": "^18", diff --git a/examples/wagemos-graz-nextjs/src/app/@bets/layout.tsx b/examples/wagemos-graz-nextjs/src/app/@bets/layout.tsx deleted file mode 100644 index eb9a5c02..00000000 --- a/examples/wagemos-graz-nextjs/src/app/@bets/layout.tsx +++ /dev/null @@ -1,18 +0,0 @@ -'use client' -import { AbstractAccountId } from '@abstract-money/core' -import { AbstractAccountIdProvider } from '@abstract-money/react' -import { PropsWithChildren, ReactNode } from 'react' - -export default function BetsLayout({ - children, -}: PropsWithChildren<{ children: ReactNode }>) { - return ( - -
-
{children}
-
-
- ) -} diff --git a/examples/wagemos-graz-nextjs/src/app/@bets/page.tsx b/examples/wagemos-graz-nextjs/src/app/@bets/page.tsx deleted file mode 100644 index 82a752fe..00000000 --- a/examples/wagemos-graz-nextjs/src/app/@bets/page.tsx +++ /dev/null @@ -1,76 +0,0 @@ -'use client' - -import { betting } from '../../_generated' -import { PlaceBetDialog } from './_components/place-bet-dialog' -import { - Round, - RoundBody, - RoundDescription, - RoundFooter, - RoundHeader, - RoundId, - RoundName, - RoundStatus, - RoundTeamMember, - RoundTeams, - RoundTotalBet, - RoundWinningTeam, -} from './_components/round' - -export default function ListRoundsPage() { - const { data, isLoading, isError } = betting.queries.useListRounds({ - chain: 'neutron', - args: {}, - }) - if (isLoading) return

Loading...

- if (isError) return

Error

- return ( -
-

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-graz-nextjs/src/app/@bets/_components/place-bet-dialog.tsx b/examples/wagemos-graz-nextjs/src/app/_components/place-bet-dialog.tsx similarity index 92% rename from examples/wagemos-graz-nextjs/src/app/@bets/_components/place-bet-dialog.tsx rename to examples/wagemos-graz-nextjs/src/app/_components/place-bet-dialog.tsx index 79ad0462..06386023 100644 --- a/examples/wagemos-graz-nextjs/src/app/@bets/_components/place-bet-dialog.tsx +++ b/examples/wagemos-graz-nextjs/src/app/_components/place-bet-dialog.tsx @@ -8,16 +8,16 @@ 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 { 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' +} from '../../components/ui/dialog' import { Form, FormControl, @@ -26,16 +26,16 @@ import { FormItem, FormLabel, FormMessage, -} from '../../../components/ui/form' -import { Input } from '../../../components/ui/input' +} 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' +} from '../../components/ui/select' +import { useToast } from '../../components/ui/use-toast' const placeBetSchema = z.object({ amount: z.coerce diff --git a/examples/wagemos-cosmoskit-nextjs/src/app/@bets/_components/round.tsx b/examples/wagemos-graz-nextjs/src/app/_components/round.tsx similarity index 96% rename from examples/wagemos-cosmoskit-nextjs/src/app/@bets/_components/round.tsx rename to examples/wagemos-graz-nextjs/src/app/_components/round.tsx index bb0c8450..20d3b0fe 100644 --- a/examples/wagemos-cosmoskit-nextjs/src/app/@bets/_components/round.tsx +++ b/examples/wagemos-graz-nextjs/src/app/_components/round.tsx @@ -1,6 +1,6 @@ import { ComponentProps } from 'react' -import { Badge } from '../../../components/ui/badge' -import { cn } from '../../../utils' +import { Badge } from '../../components/ui/badge' +import { cn } from '../../utils' export function Round({ className, ...rest }: ComponentProps<'div'>) { return ( diff --git a/examples/wagemos-graz-nextjs/src/app/layout.tsx b/examples/wagemos-graz-nextjs/src/app/layout.tsx index 2d880e90..49a0c976 100644 --- a/examples/wagemos-graz-nextjs/src/app/layout.tsx +++ b/examples/wagemos-graz-nextjs/src/app/layout.tsx @@ -1,5 +1,10 @@ -import { AbstractProvider } from '@abstract-money/react' -import type { Metadata } from 'next' +'use client' + +import { AbstractAccountId } from '@abstract-money/core' +import { + AbstractAccountIdProvider, + AbstractProvider, +} from '@abstract-money/react' import { Inter, Poppins } from 'next/font/google' import { Toaster } from '../components/ui/toaster' import { cn } from '../utils' @@ -14,14 +19,8 @@ const poppins = Poppins({ variable: '--font-display', }) -export const metadata: Metadata = { - title: 'Wagemos App', - description: 'Wagemos App using Abstract SDK', -} - export default function RootLayout({ children, - bets, }: { children: React.ReactNode bets: React.ReactNode @@ -31,10 +30,15 @@ export default function RootLayout({ -
- {children} - {bets} -
+ +
+
+
{children}
+
+
+
diff --git a/examples/wagemos-graz-nextjs/src/app/page.tsx b/examples/wagemos-graz-nextjs/src/app/page.tsx index 20f4d90f..d3a9137c 100644 --- a/examples/wagemos-graz-nextjs/src/app/page.tsx +++ b/examples/wagemos-graz-nextjs/src/app/page.tsx @@ -1,10 +1,81 @@ +'use client' + +import { betting } from '../_generated' +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' export default function Home() { + const { data, isLoading, isError } = betting.queries.useListRounds({ + chain: 'neutron', + args: {}, + }) + 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/package.json b/package.json index 40e00e4a..6773fcf1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,8 @@ { "private": true, + "workspaces": ["examples/*", "packages/*"], "scripts": { - "build": "turbo --filter \"./packages/**\" build", + "build": "turbo build", "changeset:release": "turbo build && changeset publish", "changeset:version": "changeset version && pnpm install --lockfile-only", "cjs:release": "node -r esbuild-register ./scripts/cjs.ts", @@ -9,7 +10,7 @@ "lint": "biome check .", "lint:fix": "pnpm lint --apply", "preinstall": "npx only-allow pnpm", - "postinstall": "pnpm build", + "postinstall": "turbo --filter \"./packages/**\" build", "prepare": "npx simple-git-hooks", "typecheck": "turbo typecheck" }, diff --git a/packages/cli/src/plugins/react.ts b/packages/cli/src/plugins/react.ts index cf1f127f..d5638724 100644 --- a/packages/cli/src/plugins/react.ts +++ b/packages/cli/src/plugins/react.ts @@ -650,6 +650,8 @@ export function react(options?: ReactConfig): ReactResult { return { imports: dedent` + 'use client'; + import { ${ shouldImportCosmWasmClientTypes ? 'SigningCosmWasmClient, CosmWasmClient, ' diff --git a/packages/core/package.json b/packages/core/package.json index c1c66e22..d1d7771b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -28,7 +28,7 @@ "codegen:subgraph:watch": "graphql-codegen --watch" }, "dependencies": { - "@abstract-money/cosmwasm": "workspace:@abstract-money/cosmwasm@*", + "@abstract-money/cosmwasm-utils": "workspace:*", "@chain-registry/types": "^0.13.1", "@cosmjs/amino": "^0.31.0", "@cosmjs/cosmwasm-stargate": "^0.31.0", @@ -54,7 +54,7 @@ }, "type": "module", "devDependencies": { - "@abstract-money/cli": "workspace:@abstract-money/cli@*", + "@abstract-money/cli": "workspace:*", "@graphql-codegen/cli": "^2.13.1", "@graphql-codegen/client-preset": "^1.2.6", "@graphql-typed-document-node/core": "^3.2.0", diff --git a/packages/core/src/clients/AbstractClient.ts b/packages/core/src/clients/AbstractClient.ts index d201907d..0d509fb2 100644 --- a/packages/core/src/clients/AbstractClient.ts +++ b/packages/core/src/clients/AbstractClient.ts @@ -1,7 +1,7 @@ import { BatchCosmWasmClient, type BatchCosmWasmClientOptions, -} from '@abstract-money/cosmwasm' +} from '@abstract-money/cosmwasm-utils' import { Coin } from '@cosmjs/amino' import { CosmWasmClient, diff --git a/packages/core/src/clients/index.ts b/packages/core/src/clients/index.ts index c839c622..98af86e7 100644 --- a/packages/core/src/clients/index.ts +++ b/packages/core/src/clients/index.ts @@ -1,4 +1,4 @@ -import { BatchCosmWasmClient } from '@abstract-money/cosmwasm' +import { BatchCosmWasmClient } from '@abstract-money/cosmwasm-utils' import { Mixin } from 'ts-mixer' export * from './errors' diff --git a/packages/core/turbo.json b/packages/core/turbo.json index 70083886..f000faa0 100644 --- a/packages/core/turbo.json +++ b/packages/core/turbo.json @@ -4,7 +4,7 @@ "pipeline": { "build": { "dependsOn": [ - "@abstract-money/cosmwasm#build", + "@abstract-money/cosmwasm-utils#build", "@abstract-money/cli#build", "codegen:abstract", "codegen:subgraph", @@ -14,7 +14,7 @@ }, "typecheck": { "dependsOn": [ - "@abstract-money/cosmwasm#build", + "@abstract-money/cosmwasm-utils#build", "@abstract-money/cli#build", "codegen:abstract", "codegen:subgraph", diff --git a/packages/cosmwasm/.gitignore b/packages/cosmwasm-utils/.gitignore similarity index 86% rename from packages/cosmwasm/.gitignore rename to packages/cosmwasm-utils/.gitignore index ee8856f2..7c7e7812 100644 --- a/packages/cosmwasm/.gitignore +++ b/packages/cosmwasm-utils/.gitignore @@ -1,3 +1,3 @@ # Generated file. Do not edit directly. client/** -utils/** \ No newline at end of file +query/** \ No newline at end of file diff --git a/packages/cosmwasm/README.md b/packages/cosmwasm-utils/README.md similarity index 100% rename from packages/cosmwasm/README.md rename to packages/cosmwasm-utils/README.md diff --git a/packages/cosmwasm/package.json b/packages/cosmwasm-utils/package.json similarity index 81% rename from packages/cosmwasm/package.json rename to packages/cosmwasm-utils/package.json index a3147f36..1f20db69 100644 --- a/packages/cosmwasm/package.json +++ b/packages/cosmwasm-utils/package.json @@ -1,7 +1,7 @@ { - "name": "@abstract-money/cosmwasm", - "version": "0.1.3", - "description": "Cosmwasm helpers", + "name": "@abstract-money/cosmwasm-utils", + "version": "0.0.0", + "description": "Cosmwasm utils", "author": "adairrr", "license": "MIT", "repository": "", @@ -40,15 +40,15 @@ "types": "./dist/client/index.d.ts", "default": "./dist/client/index.js" }, - "./utils": { - "types": "./dist/utils/index.d.ts", - "default": "./dist/utils/index.js" + "./query": { + "types": "./dist/query/index.d.ts", + "default": "./dist/query/index.js" }, "./package.json": "./package.json" }, "files": [ "/client", - "/utils", + "/query", "/dist" ], "sideEffects": false diff --git a/packages/cosmwasm/src/client/BatchCosmWasmClient.ts b/packages/cosmwasm-utils/src/client/BatchCosmWasmClient.ts similarity index 100% rename from packages/cosmwasm/src/client/BatchCosmWasmClient.ts rename to packages/cosmwasm-utils/src/client/BatchCosmWasmClient.ts diff --git a/packages/cosmwasm/src/client/index.ts b/packages/cosmwasm-utils/src/client/index.ts similarity index 100% rename from packages/cosmwasm/src/client/index.ts rename to packages/cosmwasm-utils/src/client/index.ts diff --git a/packages/cosmwasm/src/index.ts b/packages/cosmwasm-utils/src/index.ts similarity index 51% rename from packages/cosmwasm/src/index.ts rename to packages/cosmwasm-utils/src/index.ts index 155d5630..cedf5075 100644 --- a/packages/cosmwasm/src/index.ts +++ b/packages/cosmwasm-utils/src/index.ts @@ -1,2 +1,2 @@ -export * from './utils' export * from './client' +export * from './query' diff --git a/packages/cosmwasm/src/utils/index.ts b/packages/cosmwasm-utils/src/query/index.ts similarity index 100% rename from packages/cosmwasm/src/utils/index.ts rename to packages/cosmwasm-utils/src/query/index.ts diff --git a/packages/cosmwasm/src/utils/rawQuery.ts b/packages/cosmwasm-utils/src/query/rawQuery.ts similarity index 100% rename from packages/cosmwasm/src/utils/rawQuery.ts rename to packages/cosmwasm-utils/src/query/rawQuery.ts diff --git a/packages/cosmwasm/tsconfig.json b/packages/cosmwasm-utils/tsconfig.json similarity index 100% rename from packages/cosmwasm/tsconfig.json rename to packages/cosmwasm-utils/tsconfig.json diff --git a/packages/cosmwasm/tsup.config.ts b/packages/cosmwasm-utils/tsup.config.ts similarity index 82% rename from packages/cosmwasm/tsup.config.ts rename to packages/cosmwasm-utils/tsup.config.ts index a02c59e6..9aeededc 100644 --- a/packages/cosmwasm/tsup.config.ts +++ b/packages/cosmwasm-utils/tsup.config.ts @@ -7,7 +7,7 @@ export default defineConfig( getConfig({ outDir: 'dist', //dev: process.env.DEV === 'true', - entry: ['src/index.ts', 'src/client/index.ts', 'src/utils/index.ts'], + entry: ['src/index.ts', 'src/client/index.ts', 'src/query/index.ts'], external: [...Object.keys(dependencies)], }), ) diff --git a/packages/cosmwasm/turbo.json b/packages/cosmwasm-utils/turbo.json similarity index 100% rename from packages/cosmwasm/turbo.json rename to packages/cosmwasm-utils/turbo.json diff --git a/packages/cosmwasm-utils/utils/package.json b/packages/cosmwasm-utils/utils/package.json new file mode 100644 index 00000000..ed285364 --- /dev/null +++ b/packages/cosmwasm-utils/utils/package.json @@ -0,0 +1,4 @@ +{ + "type": "module", + "main": "../dist/utils/index.js" +} \ No newline at end of file diff --git a/packages/react/package.json b/packages/react/package.json index c9c5d2df..0a2336d3 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -23,7 +23,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@abstract-money/core": "workspace:@abstract-money/core@*", + "@abstract-money/core": "workspace:*", "@tanstack/react-query": "^4", "zustand": "^4.4.6" }, diff --git a/packages/react/src/contexts/account-id.ts b/packages/react/src/contexts/account-id.ts index d39e4619..2116458d 100644 --- a/packages/react/src/contexts/account-id.ts +++ b/packages/react/src/contexts/account-id.ts @@ -33,7 +33,7 @@ export function useAccountId() { const accountStore = React.useContext(Context) if (!accountStore) throw new Error( - '`useAccountId` must be used within `AbstractAccountIdContext`.', + '`useAccountId` must be used within `AbstractAccountIdProvider`.', ) return accountStore } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2103c8b6..4c6fd8b5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -93,10 +93,10 @@ importers: examples/wagemos-cosmoskit-nextjs: dependencies: '@abstract-money/core': - specifier: workspace:@abstract-money/core@* + specifier: workspace:* version: link:../../packages/core '@abstract-money/react': - specifier: workspace:@abstract-money/react@* + specifier: workspace:* version: link:../../packages/react '@chain-registry/types': specifier: ^0.13.1 @@ -190,7 +190,7 @@ importers: version: 3.22.4 devDependencies: '@abstract-money/cli': - specifier: workspace:@abstract-money/cli@* + specifier: workspace:* version: link:../../packages/cli '@keplr-wallet/types': specifier: ^0.12.44 @@ -223,10 +223,10 @@ importers: examples/wagemos-graz-nextjs: dependencies: '@abstract-money/core': - specifier: workspace:@abstract-money/core@* + specifier: workspace:* version: link:../../packages/core '@abstract-money/react': - specifier: workspace:@abstract-money/react@* + specifier: workspace:* version: link:../../packages/react '@cosmjs/amino': specifier: ^0.31.0 @@ -311,7 +311,7 @@ importers: version: 3.22.4 devDependencies: '@abstract-money/cli': - specifier: workspace:@abstract-money/cli@* + specifier: workspace:* version: link:../../packages/cli '@keplr-wallet/types': specifier: ^0.12.44 @@ -431,9 +431,9 @@ importers: packages/core: dependencies: - '@abstract-money/cosmwasm': - specifier: workspace:@abstract-money/cosmwasm@* - version: link:../cosmwasm + '@abstract-money/cosmwasm-utils': + specifier: workspace:* + version: link:../cosmwasm-utils '@chain-registry/types': specifier: ^0.13.1 version: 0.13.1 @@ -487,7 +487,7 @@ importers: version: 1.3.2 devDependencies: '@abstract-money/cli': - specifier: workspace:@abstract-money/cli@* + specifier: workspace:* version: link:../cli '@graphql-codegen/cli': specifier: ^2.13.1 @@ -535,7 +535,7 @@ importers: specifier: ^3.14.0 version: 3.17.1(typedoc@0.23.28) - packages/cosmwasm: + packages/cosmwasm-utils: dependencies: '@cosmjs/cosmwasm-stargate': specifier: ^0.31.0 @@ -560,7 +560,7 @@ importers: packages/react: dependencies: '@abstract-money/core': - specifier: workspace:@abstract-money/core@* + specifier: workspace:* version: link:../core '@tanstack/react-query': specifier: ^4 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index dda1eb95..c9494909 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,4 +1,3 @@ packages: - - 'docs' - 'examples/*' - 'packages/*'