@@ -56,22 +56,25 @@ export function react(options: ReactOptions = {}): ReactResult {
56
56
57
57
const cosmwasmCodegenDirPath = join ( out , 'cosmwasm-codegen' )
58
58
59
- // Guard speicfic contracts to not have the abstract app generated
60
- const contractsWithoutAbstractApp = contracts . filter ( ( { namespace } ) =>
61
- disableAbstractAppFor . includes ( namespace ) ,
59
+ // Guard specific contracts to not have the abstract app generated
60
+ const contractsWithoutAbstractApp = contracts . filter ( ( { name } ) =>
61
+ disableAbstractAppFor . includes ( name ) ,
62
62
)
63
63
64
+ const absContracts = contracts
65
+ . filter (
66
+ ( { name } ) =>
67
+ ! disableAbstractAppFor . includes ( name ) &&
68
+ contractsWithoutAbstractApp . every (
69
+ ( guardedContract ) => guardedContract . name !== name ,
70
+ ) ,
71
+ )
72
+ . map ( ( { name, path } ) => ( { name, dir : path } ) )
73
+ console . log ( 'absContracts' , absContracts )
74
+
64
75
await codegen ( {
65
76
options : codegenOptions ,
66
- contracts : contracts
67
- . filter (
68
- ( { namespace } ) =>
69
- ! disableAbstractAppFor . includes ( namespace ) &&
70
- contractsWithoutAbstractApp . every (
71
- ( guardedContract ) => guardedContract . namespace !== namespace ,
72
- ) ,
73
- )
74
- . map ( ( { name, path } ) => ( { name, dir : path } ) ) ,
77
+ contracts : absContracts ,
75
78
outPath : cosmwasmCodegenDirPath ,
76
79
} )
77
80
@@ -80,8 +83,8 @@ export function react(options: ReactOptions = {}): ReactResult {
80
83
options : { ...codegenOptions , abstractApp : { enabled : false } } ,
81
84
contracts : [
82
85
...contractsWithoutAbstractApp ,
83
- ...contracts . filter ( ( { namespace } ) =>
84
- disableAbstractAppFor . includes ( namespace ) ,
86
+ ...contracts . filter ( ( { name } ) =>
87
+ disableAbstractAppFor . includes ( name ) ,
85
88
) ,
86
89
] . map ( ( { name, path } ) => ( { name, dir : path } ) ) ,
87
90
outPath : cosmwasmCodegenDirPath ,
@@ -242,12 +245,14 @@ export function react(options: ReactOptions = {}): ReactResult {
242
245
cosmwasmCodegenDirPath ,
243
246
`${ contractNamePascalCase } .types.ts` ,
244
247
)
245
- imports . push (
246
- `import * as ${ contractNamePascalCase } Types from './${ relative (
247
- out ,
248
- typesFilePath . slice ( 0 , - 3 ) ,
249
- ) } '`,
250
- )
248
+ if ( hasAbstractApp ) {
249
+ imports . push (
250
+ `import * as ${ contractNamePascalCase } Types from './${ relative (
251
+ out ,
252
+ typesFilePath . slice ( 0 , - 3 ) ,
253
+ ) } '`,
254
+ )
255
+ }
251
256
}
252
257
253
258
imports . push (
@@ -293,7 +298,7 @@ export function react(options: ReactOptions = {}): ReactResult {
293
298
) } >>[0], 'client'> & { ${
294
299
hasAbstractApp
295
300
? 'accountId: AccountId | undefined; chainName: string | undefined;'
296
- : 'contractAddress: string | undefined;'
301
+ : 'contractAddress: string | undefined; chainName: string | undefined '
297
302
} }) => {
298
303
const {
299
304
data: ${ queryClientCamelCase } ,
@@ -346,11 +351,11 @@ export function react(options: ReactOptions = {}): ReactResult {
346
351
{ ${
347
352
hasAbstractApp
348
353
? 'accountId, chainName, sender'
349
- : 'contractAddress, sender'
354
+ : 'contractAddress, chainName, sender'
350
355
} }: { ${
351
356
hasAbstractApp
352
357
? 'accountId: AccountId | undefined; chainName: string | undefined; sender?: string | undefined;'
353
- : 'contractAddress: string | undefined; sender?: string | undefined;'
358
+ : 'contractAddress: string | undefined; chainName: string | undefined; sender?: string | undefined;'
354
359
} },
355
360
options?: Omit<
356
361
UseMutationOptions<
@@ -377,7 +382,7 @@ export function react(options: ReactOptions = {}): ReactResult {
377
382
chainName,
378
383
sender,
379
384
`
380
- : 'contractAddress,'
385
+ : 'contractAddress, chainName, '
381
386
}
382
387
Module: ${ clientPascalCase } ,
383
388
}
0 commit comments