Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Believathon XION Example #155

Merged
merged 19 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/big-llamas-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"wagemos-xion-nextjs": minor
"@abstract-money/provider-xion": minor
"wagemos-cosmoskit-nextjs": patch
"wagemos-graz-nextjs": patch
"@abstract-money/core": patch
---

Update xion abstraxion dep
5 changes: 5 additions & 0 deletions .changeset/loud-boxes-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@abstract-money/actions-xion": minor
---

Update XION actions with better names
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<z.infer<typeof placeBetSchema>> = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions examples/wagemos-cosmoskit-nextjs/src/app/_lib/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const ROUND_ACCOUNT_ID = 'neutron-18';

export const ROUND_CHAIN_NAME = 'neutron';
5 changes: 3 additions & 2 deletions examples/wagemos-cosmoskit-nextjs/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <p>Loading...</p>
if (isError) return <p>Error</p>
Expand Down
2 changes: 1 addition & 1 deletion examples/wagemos-graz-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"typecheck": "tsc --noEmit",
"lint": "next lint",
"postinstall": "pnpm generate",
"generate": "graz generate -g -M neutron,osmosis -T neutrontestnet,osmosistestnet"
"generate": "graz generate -g -M neutron,osmosis -T neutrontestnet,osmosistestnet,xiontestnet"
},
"dependencies": {
"@abstract-money/core": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion examples/wagemos-graz-nextjs/src/_generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {
// React
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

export const BETTING_MODULE_ID = 'abstract:betting'
export const BETTING_MODULE_ID = 'wagemos:betting'

export const betting = {
queries: {
Expand Down
2 changes: 1 addition & 1 deletion examples/wagemos-graz-nextjs/src/app/_lib/constants.ts
Original file line number Diff line number Diff line change
@@ -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"];
2 changes: 1 addition & 1 deletion examples/wagemos-graz-nextjs/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
36 changes: 36 additions & 0 deletions examples/wagemos-xion-nextjs/.gitignore
Original file line number Diff line number Diff line change
@@ -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
Loading
Loading