Skip to content

Commit

Permalink
Merge pull request #84 from AbstractSDK/bring-chain-name-back
Browse files Browse the repository at this point in the history
feat: bring `chainName` back
  • Loading branch information
dalechyn authored Mar 18, 2024
2 parents d4b0805 + 12f463b commit 445fa7d
Show file tree
Hide file tree
Showing 20 changed files with 184 additions and 60 deletions.
8 changes: 8 additions & 0 deletions .changeset/young-dingos-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"wagemos-cosmoskit-nextjs": patch
"wagemos-graz-nextjs": patch
"@abstract-money/cli": patch
"@abstract-money/react": patch
---

Brought `chainName` parameter back to account-dependant hooks.
72 changes: 59 additions & 13 deletions examples/wagemos-cosmoskit-nextjs/src/_generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ export const betting = {
}: Omit<
Parameters<typeof useBettingBetsQuery<BettingTypes.BetsResponse>>[0],
'client'
> & { accountId: AccountId | undefined }) => {
> & {
accountId: AccountId | undefined
chainName: string | undefined
}) => {
const {
data: bettingAppQueryClient,
isLoading: isBettingAppQueryClientLoading,
Expand Down Expand Up @@ -120,7 +123,10 @@ export const betting = {
}: Omit<
Parameters<typeof useBettingConfigQuery<BettingTypes.ConfigResponse>>[0],
'client'
> & { accountId: AccountId | undefined }) => {
> & {
accountId: AccountId | undefined
chainName: string | undefined
}) => {
const {
data: bettingAppQueryClient,
isLoading: isBettingAppQueryClientLoading,
Expand Down Expand Up @@ -182,7 +188,10 @@ export const betting = {
typeof useBettingListOddsQuery<BettingTypes.ListOddsResponse>
>[0],
'client'
> & { accountId: AccountId | undefined }) => {
> & {
accountId: AccountId | undefined
chainName: string | undefined
}) => {
const {
data: bettingAppQueryClient,
isLoading: isBettingAppQueryClientLoading,
Expand Down Expand Up @@ -243,7 +252,10 @@ export const betting = {
}: Omit<
Parameters<typeof useBettingOddsQuery<BettingTypes.OddsResponse>>[0],
'client'
> & { accountId: AccountId | undefined }) => {
> & {
accountId: AccountId | undefined
chainName: string | undefined
}) => {
const {
data: bettingAppQueryClient,
isLoading: isBettingAppQueryClientLoading,
Expand Down Expand Up @@ -306,7 +318,10 @@ export const betting = {
typeof useBettingListRoundsQuery<BettingTypes.RoundsResponse>
>[0],
'client'
> & { accountId: AccountId | undefined }) => {
> & {
accountId: AccountId | undefined
chainName: string | undefined
}) => {
const {
data: bettingAppQueryClient,
isLoading: isBettingAppQueryClientLoading,
Expand Down Expand Up @@ -367,7 +382,10 @@ export const betting = {
}: Omit<
Parameters<typeof useBettingRoundQuery<BettingTypes.RoundResponse>>[0],
'client'
> & { accountId: AccountId | undefined }) => {
> & {
accountId: AccountId | undefined
chainName: string | undefined
}) => {
const {
data: bettingAppQueryClient,
isLoading: isBettingAppQueryClientLoading,
Expand Down Expand Up @@ -424,7 +442,10 @@ export const betting = {
},
mutations: {
useUpdateConfig: (
{ accountId }: { accountId: AccountId | undefined },
{
accountId,
chainName,
}: { accountId: AccountId | undefined; chainName: string | undefined },
options?: Omit<
UseMutationOptions<
ExecuteResult,
Expand All @@ -443,6 +464,7 @@ export const betting = {
} = useAbstractModuleClient({
moduleId: BETTING_MODULE_ID,
accountId,
chainName,

Module: BettingAppClient,
})
Expand Down Expand Up @@ -474,7 +496,10 @@ export const betting = {
return { mutate, mutateAsync, ...rest } as const
},
useCloseRound: (
{ accountId }: { accountId: AccountId | undefined },
{
accountId,
chainName,
}: { accountId: AccountId | undefined; chainName: string | undefined },
options?: Omit<
UseMutationOptions<
ExecuteResult,
Expand All @@ -493,6 +518,7 @@ export const betting = {
} = useAbstractModuleClient({
moduleId: BETTING_MODULE_ID,
accountId,
chainName,

Module: BettingAppClient,
})
Expand Down Expand Up @@ -524,7 +550,10 @@ export const betting = {
return { mutate, mutateAsync, ...rest } as const
},
useDistributeWinnings: (
{ accountId }: { accountId: AccountId | undefined },
{
accountId,
chainName,
}: { accountId: AccountId | undefined; chainName: string | undefined },
options?: Omit<
UseMutationOptions<
ExecuteResult,
Expand All @@ -543,6 +572,7 @@ export const betting = {
} = useAbstractModuleClient({
moduleId: BETTING_MODULE_ID,
accountId,
chainName,

Module: BettingAppClient,
})
Expand Down Expand Up @@ -574,7 +604,10 @@ export const betting = {
return { mutate, mutateAsync, ...rest } as const
},
usePlaceBet: (
{ accountId }: { accountId: AccountId | undefined },
{
accountId,
chainName,
}: { accountId: AccountId | undefined; chainName: string | undefined },
options?: Omit<
UseMutationOptions<
ExecuteResult,
Expand All @@ -593,6 +626,7 @@ export const betting = {
} = useAbstractModuleClient({
moduleId: BETTING_MODULE_ID,
accountId,
chainName,

Module: BettingAppClient,
})
Expand Down Expand Up @@ -624,7 +658,10 @@ export const betting = {
return { mutate, mutateAsync, ...rest } as const
},
useUpdateAccounts: (
{ accountId }: { accountId: AccountId | undefined },
{
accountId,
chainName,
}: { accountId: AccountId | undefined; chainName: string | undefined },
options?: Omit<
UseMutationOptions<
ExecuteResult,
Expand All @@ -643,6 +680,7 @@ export const betting = {
} = useAbstractModuleClient({
moduleId: BETTING_MODULE_ID,
accountId,
chainName,

Module: BettingAppClient,
})
Expand Down Expand Up @@ -674,7 +712,10 @@ export const betting = {
return { mutate, mutateAsync, ...rest } as const
},
useRegister: (
{ accountId }: { accountId: AccountId | undefined },
{
accountId,
chainName,
}: { accountId: AccountId | undefined; chainName: string | undefined },
options?: Omit<
UseMutationOptions<
ExecuteResult,
Expand All @@ -693,6 +734,7 @@ export const betting = {
} = useAbstractModuleClient({
moduleId: BETTING_MODULE_ID,
accountId,
chainName,

Module: BettingAppClient,
})
Expand Down Expand Up @@ -724,7 +766,10 @@ export const betting = {
return { mutate, mutateAsync, ...rest } as const
},
useCreateRound: (
{ accountId }: { accountId: AccountId | undefined },
{
accountId,
chainName,
}: { accountId: AccountId | undefined; chainName: string | undefined },
options?: Omit<
UseMutationOptions<
ExecuteResult,
Expand All @@ -743,6 +788,7 @@ export const betting = {
} = useAbstractModuleClient({
moduleId: BETTING_MODULE_ID,
accountId,
chainName,

Module: BettingAppClient,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export function PlaceBetDialog({ round }: { round: RoundResponse }) {
const { mutateAsync: placeBetAsync, isLoading } =
betting.mutations.usePlaceBet({
accountId: stringToAccountId('neutron-18'),
chainName: 'neutron',
})

const onSubmit: SubmitHandler<z.infer<typeof placeBetSchema>> = useCallback(
Expand Down
1 change: 1 addition & 0 deletions examples/wagemos-cosmoskit-nextjs/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function Home() {
const { data, isLoading, isError } = betting.queries.useListRounds({
args: {},
accountId: stringToAccountId('neutron-18'),
chainName: 'neutron',
})
if (isLoading) return <p>Loading...</p>
if (isError) return <p>Error</p>
Expand Down
Loading

0 comments on commit 445fa7d

Please sign in to comment.