Skip to content

Commit 18ab4e9

Browse files
authored
fix: correctly call createTransaction (#135)
1 parent 835f722 commit 18ab4e9

File tree

10 files changed

+55
-30
lines changed

10 files changed

+55
-30
lines changed

examples/arc56_test/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,10 @@ export class Arc56TestFactory {
444444
* Creates a new instance of the ARC56Test smart contract using the createApplication()void ABI method.
445445
*
446446
* @param params The params for the smart contract call
447-
* @returns The create params
447+
* @returns The create transaction
448448
*/
449449
createApplication: (params: CallParams<Arc56TestArgs['obj']['createApplication()void'] | Arc56TestArgs['tuple']['createApplication()void']> & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC} = {args: []}) => {
450-
return this.appFactory.params.create(Arc56TestParamsFactory.create.createApplication(params))
450+
return this.appFactory.createTransaction.create(Arc56TestParamsFactory.create.createApplication(params))
451451
},
452452
},
453453

examples/duplicate_structs/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,10 @@ export class DuplicateStructsContractFactory {
311311
* Creates a new instance of the DuplicateStructsContract smart contract using a bare call.
312312
*
313313
* @param params The params for the bare (raw) call
314-
* @returns The params for a create call
314+
* @returns The transaction for a create call
315315
*/
316316
bare: (params?: Expand<AppClientBareCallParams & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}>) => {
317-
return this.appFactory.params.bare.create(params)
317+
return this.appFactory.createTransaction.bare.create(params)
318318
},
319319
},
320320

examples/helloworld/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,10 @@ export class HelloWorldAppFactory {
352352
* Creates a new instance of the HelloWorldApp smart contract using a bare call.
353353
*
354354
* @param params The params for the bare (raw) call
355-
* @returns The params for a create call
355+
* @returns The transaction for a create call
356356
*/
357357
bare: (params?: Expand<AppClientBareCallParams & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}>) => {
358-
return this.appFactory.params.bare.create(params)
358+
return this.appFactory.createTransaction.bare.create(params)
359359
},
360360
},
361361

examples/lifecycle/client.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -434,32 +434,32 @@ export class LifeCycleAppFactory {
434434
* Creates a new instance of the LifeCycleApp smart contract using a bare call.
435435
*
436436
* @param params The params for the bare (raw) call
437-
* @returns The params for a create call
437+
* @returns The transaction for a create call
438438
*/
439439
bare: (params?: Expand<AppClientBareCallParams & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC | OnApplicationComplete.OptInOC}>) => {
440-
return this.appFactory.params.bare.create(params)
440+
return this.appFactory.createTransaction.bare.create(params)
441441
},
442442
/**
443443
* Creates a new instance of the LifeCycleApp smart contract using the create(string)string ABI method.
444444
*
445445
* ABI create method with 1 argument
446446
*
447447
* @param params The params for the smart contract call
448-
* @returns The create params: The formatted greeting
448+
* @returns The create transaction: The formatted greeting
449449
*/
450450
createStringString: (params: CallParams<LifeCycleAppArgs['obj']['create(string)string'] | LifeCycleAppArgs['tuple']['create(string)string']> & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}) => {
451-
return this.appFactory.params.create(LifeCycleAppParamsFactory.create.createStringString(params))
451+
return this.appFactory.createTransaction.create(LifeCycleAppParamsFactory.create.createStringString(params))
452452
},
453453
/**
454454
* Creates a new instance of the LifeCycleApp smart contract using the create(string,uint32)void ABI method.
455455
*
456456
* ABI create method with 2 arguments
457457
*
458458
* @param params The params for the smart contract call
459-
* @returns The create params
459+
* @returns The create transaction
460460
*/
461461
createStringUint32Void: (params: CallParams<LifeCycleAppArgs['obj']['create(string,uint32)void'] | LifeCycleAppArgs['tuple']['create(string,uint32)void']> & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}) => {
462-
return this.appFactory.params.create(LifeCycleAppParamsFactory.create.createStringUint32Void(params))
462+
return this.appFactory.createTransaction.create(LifeCycleAppParamsFactory.create.createStringUint32Void(params))
463463
},
464464
},
465465

examples/minimal/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,10 @@ export class AppFactory {
302302
* Creates a new instance of the App smart contract using a bare call.
303303
*
304304
* @param params The params for the bare (raw) call
305-
* @returns The params for a create call
305+
* @returns The transaction for a create call
306306
*/
307307
bare: (params?: Expand<AppClientBareCallParams & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}>) => {
308-
return this.appFactory.params.bare.create(params)
308+
return this.appFactory.createTransaction.bare.create(params)
309309
},
310310
},
311311

examples/nested/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,10 @@ export class NestedContractFactory {
326326
* Creates a new instance of the NestedContract smart contract using a bare call.
327327
*
328328
* @param params The params for the bare (raw) call
329-
* @returns The params for a create call
329+
* @returns The transaction for a create call
330330
*/
331331
bare: (params?: Expand<AppClientBareCallParams & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}>) => {
332-
return this.appFactory.params.bare.create(params)
332+
return this.appFactory.createTransaction.bare.create(params)
333333
},
334334
},
335335

examples/reti/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,10 +1543,10 @@ export class ValidatorRegistryFactory {
15431543
* Creates a new instance of the ValidatorRegistry smart contract using the createApplication()void ABI method.
15441544
*
15451545
* @param params The params for the smart contract call
1546-
* @returns The create params
1546+
* @returns The create transaction
15471547
*/
15481548
createApplication: (params: CallParams<ValidatorRegistryArgs['obj']['createApplication()void'] | ValidatorRegistryArgs['tuple']['createApplication()void']> & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC} = {args: []}) => {
1549-
return this.appFactory.params.create(ValidatorRegistryParamsFactory.create.createApplication(params))
1549+
return this.appFactory.createTransaction.create(ValidatorRegistryParamsFactory.create.createApplication(params))
15501550
},
15511551
},
15521552

examples/state/client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -895,19 +895,19 @@ export class StateAppFactory {
895895
* Creates a new instance of the StateApp smart contract using a bare call.
896896
*
897897
* @param params The params for the bare (raw) call
898-
* @returns The params for a create call
898+
* @returns The transaction for a create call
899899
*/
900900
bare: (params?: Expand<AppClientBareCallParams & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC | OnApplicationComplete.OptInOC}>) => {
901-
return this.appFactory.params.bare.create(params)
901+
return this.appFactory.createTransaction.bare.create(params)
902902
},
903903
/**
904904
* Creates a new instance of the StateApp smart contract using the create_abi(string)string ABI method.
905905
*
906906
* @param params The params for the smart contract call
907-
* @returns The create params
907+
* @returns The create transaction
908908
*/
909909
createAbi: (params: CallParams<StateAppArgs['obj']['create_abi(string)string'] | StateAppArgs['tuple']['create_abi(string)string']> & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}) => {
910-
return this.appFactory.params.create(StateAppParamsFactory.create.createAbi(params))
910+
return this.appFactory.createTransaction.create(StateAppParamsFactory.create.createAbi(params))
911911
},
912912
},
913913

examples/voting/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,10 @@ export class VotingRoundAppFactory {
510510
* Creates a new instance of the VotingRoundApp smart contract using the create(string,byte[],string,uint64,uint64,uint8[],uint64,string)void ABI method.
511511
*
512512
* @param params The params for the smart contract call
513-
* @returns The create params
513+
* @returns The create transaction
514514
*/
515515
create: (params: CallParams<VotingRoundAppArgs['obj']['create(string,byte[],string,uint64,uint64,uint8[],uint64,string)void'] | VotingRoundAppArgs['tuple']['create(string,byte[],string,uint64,uint64,uint8[],uint64,string)void']> & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}) => {
516-
return this.appFactory.params.create(VotingRoundAppParamsFactory.create.create(params))
516+
return this.appFactory.createTransaction.create(VotingRoundAppParamsFactory.create.create(params))
517517
},
518518
},
519519

src/client/app-factory.ts

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,22 +148,43 @@ function* createMethods(generator: GeneratorContext): DocumentParts {
148148
function* paramMethods(ctx: GeneratorContext): DocumentParts {
149149
const { app, callConfig } = ctx
150150

151-
yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true)
151+
yield* operationMethods(
152+
ctx,
153+
`Creates a new instance of the ${app.name} smart contract`,
154+
callConfig.createMethods,
155+
'create',
156+
'params',
157+
true,
158+
)
152159

153160
yield* operationMethods(
154161
ctx,
155162
`Updates an existing instance of the ${app.name} smart contract`,
156163
callConfig.updateMethods,
157164
'deployUpdate',
165+
'params',
158166
true,
159167
)
160-
yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'deployDelete')
168+
yield* operationMethods(
169+
ctx,
170+
`Deletes an existing instance of the ${app.name} smart contract`,
171+
callConfig.deleteMethods,
172+
'deployDelete',
173+
'params',
174+
)
161175
}
162176

163177
function* createTransactionMethods(ctx: GeneratorContext): DocumentParts {
164178
const { app, callConfig } = ctx
165179

166-
yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true)
180+
yield* operationMethods(
181+
ctx,
182+
`Creates a new instance of the ${app.name} smart contract`,
183+
callConfig.createMethods,
184+
'create',
185+
'createTransaction',
186+
true,
187+
)
167188
}
168189

169190
function* bareMethodCallParams({
@@ -187,7 +208,10 @@ function* bareMethodCallParams({
187208
params: {
188209
params: `The params for the bare (raw) call`,
189210
},
190-
returns: type === 'params' ? `The params for a ${verb} call` : `The ${verb} result`,
211+
returns:
212+
type === 'params' || type === 'createTransaction'
213+
? `The ${type === 'createTransaction' ? 'transaction' : type} for a ${verb} call`
214+
: `The ${verb} result`,
191215
})
192216
yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${
193217
includeCompilation ? ' &' + ' AppClientCompilationParams' : ''
@@ -257,6 +281,7 @@ function* operationMethods(
257281
description: string,
258282
methods: MethodList,
259283
verb: 'create' | 'deployUpdate' | 'deployDelete',
284+
type: 'params' | 'createTransaction',
260285
includeCompilation?: boolean,
261286
): DocumentParts {
262287
if (methods.length) {
@@ -270,7 +295,7 @@ function* operationMethods(
270295
name: 'bare',
271296
description: `${description} using a bare call`,
272297
verb,
273-
type: 'params',
298+
type,
274299
includeCompilation,
275300
})
276301
} else {
@@ -280,7 +305,7 @@ function* operationMethods(
280305
method,
281306
description,
282307
verb,
283-
type: 'params',
308+
type,
284309
includeCompilation,
285310
})
286311
}

0 commit comments

Comments
 (0)