Skip to content

Commit

Permalink
feat: drop chainName from cli queries/mutations
Browse files Browse the repository at this point in the history
  • Loading branch information
dalechyn committed Mar 12, 2024
1 parent 0104268 commit 5c10a90
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 140 deletions.
8 changes: 8 additions & 0 deletions .changeset/young-lamps-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@abstract-money/cli": minor
"wagemos-cosmoskit-nextjs": patch
"wagemos-graz-nextjs": patch
"@abstract-money/react": patch
---

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.
72 changes: 13 additions & 59 deletions examples/wagemos-cosmoskit-nextjs/src/_generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ export const betting = {
}: Omit<
Parameters<typeof useBettingBetsQuery<BettingTypes.BetsResponse>>[0],
'client'
> & {
accountId: AccountId | undefined
chainName: string | undefined
}) => {
> & { accountId: AccountId | undefined }) => {
const {
data: bettingAppQueryClient,
isLoading: isBettingAppQueryClientLoading,
Expand Down Expand Up @@ -125,10 +122,7 @@ export const betting = {
}: Omit<
Parameters<typeof useBettingConfigQuery<BettingTypes.ConfigResponse>>[0],
'client'
> & {
accountId: AccountId | undefined
chainName: string | undefined
}) => {
> & { accountId: AccountId | undefined }) => {
const {
data: bettingAppQueryClient,
isLoading: isBettingAppQueryClientLoading,
Expand Down Expand Up @@ -192,10 +186,7 @@ export const betting = {
typeof useBettingListOddsQuery<BettingTypes.ListOddsResponse>
>[0],
'client'
> & {
accountId: AccountId | undefined
chainName: string | undefined
}) => {
> & { accountId: AccountId | undefined }) => {
const {
data: bettingAppQueryClient,
isLoading: isBettingAppQueryClientLoading,
Expand Down Expand Up @@ -258,10 +249,7 @@ export const betting = {
}: Omit<
Parameters<typeof useBettingOddsQuery<BettingTypes.OddsResponse>>[0],
'client'
> & {
accountId: AccountId | undefined
chainName: string | undefined
}) => {
> & { accountId: AccountId | undefined }) => {
const {
data: bettingAppQueryClient,
isLoading: isBettingAppQueryClientLoading,
Expand Down Expand Up @@ -326,10 +314,7 @@ export const betting = {
typeof useBettingListRoundsQuery<BettingTypes.RoundsResponse>
>[0],
'client'
> & {
accountId: AccountId | undefined
chainName: string | undefined
}) => {
> & { accountId: AccountId | undefined }) => {
const {
data: bettingAppQueryClient,
isLoading: isBettingAppQueryClientLoading,
Expand Down Expand Up @@ -392,10 +377,7 @@ export const betting = {
}: Omit<
Parameters<typeof useBettingRoundQuery<BettingTypes.RoundResponse>>[0],
'client'
> & {
accountId: AccountId | undefined
chainName: string | undefined
}) => {
> & { accountId: AccountId | undefined }) => {
const {
data: bettingAppQueryClient,
isLoading: isBettingAppQueryClientLoading,
Expand Down Expand Up @@ -454,10 +436,7 @@ export const betting = {
},
mutations: {
useUpdateConfig: (
{
chainName,
accountId,
}: { chainName: string | undefined; accountId: AccountId | undefined },
{ accountId }: { accountId: AccountId | undefined },
options?: Omit<
UseMutationOptions<
ExecuteResult,
Expand All @@ -477,7 +456,6 @@ export const betting = {
moduleId: BETTING_MODULE_ID,
accountId,

chainName,
Module: BettingAppClient,
})

Expand Down Expand Up @@ -508,10 +486,7 @@ export const betting = {
return { mutate, mutateAsync, ...rest } as const
},
useCloseRound: (
{
chainName,
accountId,
}: { chainName: string | undefined; accountId: AccountId | undefined },
{ accountId }: { accountId: AccountId | undefined },
options?: Omit<
UseMutationOptions<
ExecuteResult,
Expand All @@ -531,7 +506,6 @@ export const betting = {
moduleId: BETTING_MODULE_ID,
accountId,

chainName,
Module: BettingAppClient,
})

Expand Down Expand Up @@ -562,10 +536,7 @@ export const betting = {
return { mutate, mutateAsync, ...rest } as const
},
useDistributeWinnings: (
{
chainName,
accountId,
}: { chainName: string | undefined; accountId: AccountId | undefined },
{ accountId }: { accountId: AccountId | undefined },
options?: Omit<
UseMutationOptions<
ExecuteResult,
Expand All @@ -585,7 +556,6 @@ export const betting = {
moduleId: BETTING_MODULE_ID,
accountId,

chainName,
Module: BettingAppClient,
})

Expand Down Expand Up @@ -616,10 +586,7 @@ export const betting = {
return { mutate, mutateAsync, ...rest } as const
},
usePlaceBet: (
{
chainName,
accountId,
}: { chainName: string | undefined; accountId: AccountId | undefined },
{ accountId }: { accountId: AccountId | undefined },
options?: Omit<
UseMutationOptions<
ExecuteResult,
Expand All @@ -639,7 +606,6 @@ export const betting = {
moduleId: BETTING_MODULE_ID,
accountId,

chainName,
Module: BettingAppClient,
})

Expand Down Expand Up @@ -670,10 +636,7 @@ export const betting = {
return { mutate, mutateAsync, ...rest } as const
},
useUpdateAccounts: (
{
chainName,
accountId,
}: { chainName: string | undefined; accountId: AccountId | undefined },
{ accountId }: { accountId: AccountId | undefined },
options?: Omit<
UseMutationOptions<
ExecuteResult,
Expand All @@ -693,7 +656,6 @@ export const betting = {
moduleId: BETTING_MODULE_ID,
accountId,

chainName,
Module: BettingAppClient,
})

Expand Down Expand Up @@ -724,10 +686,7 @@ export const betting = {
return { mutate, mutateAsync, ...rest } as const
},
useRegister: (
{
chainName,
accountId,
}: { chainName: string | undefined; accountId: AccountId | undefined },
{ accountId }: { accountId: AccountId | undefined },
options?: Omit<
UseMutationOptions<
ExecuteResult,
Expand All @@ -747,7 +706,6 @@ export const betting = {
moduleId: BETTING_MODULE_ID,
accountId,

chainName,
Module: BettingAppClient,
})

Expand Down Expand Up @@ -778,10 +736,7 @@ export const betting = {
return { mutate, mutateAsync, ...rest } as const
},
useCreateRound: (
{
chainName,
accountId,
}: { chainName: string | undefined; accountId: AccountId | undefined },
{ accountId }: { accountId: AccountId | undefined },
options?: Omit<
UseMutationOptions<
ExecuteResult,
Expand All @@ -801,7 +756,6 @@ export const betting = {
moduleId: BETTING_MODULE_ID,
accountId,

chainName,
Module: BettingAppClient,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export function PlaceBetDialog({ round }: { round: RoundResponse }) {

const { mutateAsync: placeBetAsync, isLoading } =
betting.mutations.usePlaceBet({
chainName: 'neutron',
accountId: stringToAccountId('neutron-18'),
})

Expand Down
1 change: 0 additions & 1 deletion examples/wagemos-cosmoskit-nextjs/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { WalletButton } from './_components/wallet-button'
export default function Home() {
const { data, isLoading, isError } = betting.queries.useListRounds({
args: {},
chainName: 'neutron',
accountId: stringToAccountId('neutron-18'),
})
if (isLoading) return <p>Loading...</p>
Expand Down
Loading

0 comments on commit 5c10a90

Please sign in to comment.