Skip to content

Commit 1d6201e

Browse files
committed
feat: improve accountId behaviour, cli improvements
1 parent 26c4409 commit 1d6201e

File tree

8 files changed

+211
-129
lines changed

8 files changed

+211
-129
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"wagemos-cosmoskit-nextjs": patch
3+
"wagemos-graz-nextjs": patch
4+
"@abstract-money/cli": patch
5+
"@abstract-money/react": patch
6+
---
7+
8+
Improves `accountId` usage, when passed to generated hooks or hooks from \`react\` package, it takes precedence over the context, yet if one is not passed, an error is thrown to indicate that it either should be passed or account id provider wrapping is needed. Also improves `cli` to not require args in hooks that don't need them.

examples/wagemos-cosmoskit-nextjs/src/_generated/index.ts

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ import {
1818
} from '@abstract-money/react/hooks'
1919

2020
import {
21-
useBettingBetsQuery,
22-
useBettingConfigQuery,
23-
useBettingListOddsQuery,
24-
useBettingOddsQuery,
25-
useBettingListRoundsQuery,
26-
useBettingRoundQuery,
2721
useBettingUpdateConfigMutation,
2822
BettingUpdateConfigMutation,
2923
useBettingCloseRoundMutation,
@@ -38,6 +32,12 @@ import {
3832
BettingRegisterMutation,
3933
useBettingCreateRoundMutation,
4034
BettingCreateRoundMutation,
35+
useBettingBetsQuery,
36+
useBettingConfigQuery,
37+
useBettingListOddsQuery,
38+
useBettingOddsQuery,
39+
useBettingListRoundsQuery,
40+
useBettingRoundQuery,
4141
} from './cosmwasm-codegen/Betting.react-query'
4242

4343
import * as BettingTypes from './cosmwasm-codegen/Betting.types'
@@ -96,8 +96,7 @@ export const betting = {
9696
queries: {
9797
useBets: ({
9898
options,
99-
accountId,
100-
chainName,
99+
args,
101100
...rest
102101
}: Omit<
103102
Parameters<typeof useBettingBetsQuery<BettingTypes.BetsResponse>>[0],
@@ -111,8 +110,7 @@ export const betting = {
111110
} = useAbstractModuleQueryClient(
112111
{
113112
moduleId: BETTING_MODULE_ID,
114-
accountId,
115-
chainName,
113+
...rest,
116114
Module: BettingAppQueryClient,
117115
},
118116
{ enabled: options?.enabled },
@@ -126,7 +124,7 @@ export const betting = {
126124
} = useBettingBetsQuery({
127125
client: bettingAppQueryClient,
128126
options,
129-
...rest,
127+
args,
130128
})
131129

132130
if (isBettingAppQueryClientError)
@@ -161,8 +159,6 @@ export const betting = {
161159
},
162160
useConfig: ({
163161
options,
164-
accountId,
165-
chainName,
166162
...rest
167163
}: Omit<
168164
Parameters<typeof useBettingConfigQuery<BettingTypes.ConfigResponse>>[0],
@@ -176,8 +172,7 @@ export const betting = {
176172
} = useAbstractModuleQueryClient(
177173
{
178174
moduleId: BETTING_MODULE_ID,
179-
accountId,
180-
chainName,
175+
...rest,
181176
Module: BettingAppQueryClient,
182177
},
183178
{ enabled: options?.enabled },
@@ -191,7 +186,6 @@ export const betting = {
191186
} = useBettingConfigQuery({
192187
client: bettingAppQueryClient,
193188
options,
194-
...rest,
195189
})
196190

197191
if (isBettingAppQueryClientError)
@@ -226,8 +220,7 @@ export const betting = {
226220
},
227221
useListOdds: ({
228222
options,
229-
accountId,
230-
chainName,
223+
args,
231224
...rest
232225
}: Omit<
233226
Parameters<
@@ -243,8 +236,7 @@ export const betting = {
243236
} = useAbstractModuleQueryClient(
244237
{
245238
moduleId: BETTING_MODULE_ID,
246-
accountId,
247-
chainName,
239+
...rest,
248240
Module: BettingAppQueryClient,
249241
},
250242
{ enabled: options?.enabled },
@@ -258,7 +250,7 @@ export const betting = {
258250
} = useBettingListOddsQuery({
259251
client: bettingAppQueryClient,
260252
options,
261-
...rest,
253+
args,
262254
})
263255

264256
if (isBettingAppQueryClientError)
@@ -293,8 +285,7 @@ export const betting = {
293285
},
294286
useOdds: ({
295287
options,
296-
accountId,
297-
chainName,
288+
args,
298289
...rest
299290
}: Omit<
300291
Parameters<typeof useBettingOddsQuery<BettingTypes.OddsResponse>>[0],
@@ -308,8 +299,7 @@ export const betting = {
308299
} = useAbstractModuleQueryClient(
309300
{
310301
moduleId: BETTING_MODULE_ID,
311-
accountId,
312-
chainName,
302+
...rest,
313303
Module: BettingAppQueryClient,
314304
},
315305
{ enabled: options?.enabled },
@@ -323,7 +313,7 @@ export const betting = {
323313
} = useBettingOddsQuery({
324314
client: bettingAppQueryClient,
325315
options,
326-
...rest,
316+
args,
327317
})
328318

329319
if (isBettingAppQueryClientError)
@@ -358,8 +348,7 @@ export const betting = {
358348
},
359349
useListRounds: ({
360350
options,
361-
accountId,
362-
chainName,
351+
args,
363352
...rest
364353
}: Omit<
365354
Parameters<
@@ -375,8 +364,7 @@ export const betting = {
375364
} = useAbstractModuleQueryClient(
376365
{
377366
moduleId: BETTING_MODULE_ID,
378-
accountId,
379-
chainName,
367+
...rest,
380368
Module: BettingAppQueryClient,
381369
},
382370
{ enabled: options?.enabled },
@@ -390,7 +378,7 @@ export const betting = {
390378
} = useBettingListRoundsQuery({
391379
client: bettingAppQueryClient,
392380
options,
393-
...rest,
381+
args,
394382
})
395383

396384
if (isBettingAppQueryClientError)
@@ -425,8 +413,7 @@ export const betting = {
425413
},
426414
useRound: ({
427415
options,
428-
accountId,
429-
chainName,
416+
args,
430417
...rest
431418
}: Omit<
432419
Parameters<typeof useBettingRoundQuery<BettingTypes.RoundResponse>>[0],
@@ -440,8 +427,7 @@ export const betting = {
440427
} = useAbstractModuleQueryClient(
441428
{
442429
moduleId: BETTING_MODULE_ID,
443-
accountId,
444-
chainName,
430+
...rest,
445431
Module: BettingAppQueryClient,
446432
},
447433
{ enabled: options?.enabled },
@@ -455,7 +441,7 @@ export const betting = {
455441
} = useBettingRoundQuery({
456442
client: bettingAppQueryClient,
457443
options,
458-
...rest,
444+
args,
459445
})
460446

461447
if (isBettingAppQueryClientError)

0 commit comments

Comments
 (0)