Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
dalechyn committed Dec 29, 2023
1 parent 8d8c1bc commit 33390a1
Show file tree
Hide file tree
Showing 40 changed files with 269 additions and 281 deletions.
26 changes: 26 additions & 0 deletions .changeset/clever-flies-sneeze.md
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 0 additions & 7 deletions .changeset/violet-suns-jam.md

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/on-push-to-main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Main
on:
push:
branches: [main]
branches: [mainline]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions examples/wagemos-cosmoskit-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions examples/wagemos-cosmoskit-nextjs/src/_generated/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import {
SigningCosmWasmClient,
CosmWasmClient,
Expand Down
18 changes: 0 additions & 18 deletions examples/wagemos-cosmoskit-nextjs/src/app/@bets/layout.tsx

This file was deleted.

76 changes: 0 additions & 76 deletions examples/wagemos-cosmoskit-nextjs/src/app/@bets/page.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
29 changes: 16 additions & 13 deletions examples/wagemos-cosmoskit-nextjs/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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 (
<html lang="en">
<body className={cn(inter.variable, poppins.variable)}>
<CosmosKitProvider>
<AbstractProvider>
<main className="flex flex-col items-center p-24 min-h-screen">
{children}
{bets}
</main>
<AbstractAccountIdProvider
accountId={AbstractAccountId.fromStringId('neutron-18')}
>
<main className="flex flex-col items-center p-24 min-h-screen">
<section className="mt-10">
<div className="mt-10">{children}</div>
</section>
</main>
</AbstractAccountIdProvider>
</AbstractProvider>
</CosmosKitProvider>
<Toaster />
Expand Down
71 changes: 71 additions & 0 deletions examples/wagemos-cosmoskit-nextjs/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -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 <p>Loading...</p>
if (isError) return <p>Error</p>
return (
<>
<h1>WAGEMOS with cosmoskit</h1>
<WalletButton />
<div>
<h4>List of Rounds:</h4>
<div className="grid row-auto gap-2 md:grid-cols-2">
{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 key={round.id}>
<RoundHeader>
<RoundName>{round.name}</RoundName>
<RoundId>ID: {round.id}</RoundId>
<RoundStatus open={status.status === 'open'}>
{status.status}
</RoundStatus>
{status.winningTeam && (
<RoundWinningTeam>
Winner Account Sequence: {status.winningTeam}
</RoundWinningTeam>
)}
</RoundHeader>
<RoundBody>
<RoundDescription>{round.description}</RoundDescription>
<p>Team members:</p>
<RoundTeams>
{round.teams.map((member, i) => (
<RoundTeamMember key={i}>
Account Seq: {member.seq}
</RoundTeamMember>
))}
</RoundTeams>
</RoundBody>
<RoundFooter>
<RoundTotalBet>
Total Bet: {round.total_bet.amount} {round.total_bet.name}
</RoundTotalBet>
{status.status === 'open' && <PlaceBetDialog round={round} />}
</RoundFooter>
</Round>
)
})}
</div>
</div>
</>
)
}
6 changes: 3 additions & 3 deletions examples/wagemos-graz-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
18 changes: 0 additions & 18 deletions examples/wagemos-graz-nextjs/src/app/@bets/layout.tsx

This file was deleted.

Loading

0 comments on commit 33390a1

Please sign in to comment.