Skip to content

Commit

Permalink
Merge main into release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Nov 28, 2024
2 parents 18adcb4 + 18ab4e9 commit b494dac
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 30 deletions.
4 changes: 2 additions & 2 deletions examples/arc56_test/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,10 @@ export class Arc56TestFactory {
* Creates a new instance of the ARC56Test smart contract using the createApplication()void ABI method.
*
* @param params The params for the smart contract call
* @returns The create params
* @returns The create transaction
*/
createApplication: (params: CallParams<Arc56TestArgs['obj']['createApplication()void'] | Arc56TestArgs['tuple']['createApplication()void']> & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC} = {args: []}) => {
return this.appFactory.params.create(Arc56TestParamsFactory.create.createApplication(params))
return this.appFactory.createTransaction.create(Arc56TestParamsFactory.create.createApplication(params))
},
},

Expand Down
4 changes: 2 additions & 2 deletions examples/duplicate_structs/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,10 @@ export class DuplicateStructsContractFactory {
* Creates a new instance of the DuplicateStructsContract smart contract using a bare call.
*
* @param params The params for the bare (raw) call
* @returns The params for a create call
* @returns The transaction for a create call
*/
bare: (params?: Expand<AppClientBareCallParams & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}>) => {
return this.appFactory.params.bare.create(params)
return this.appFactory.createTransaction.bare.create(params)
},
},

Expand Down
4 changes: 2 additions & 2 deletions examples/helloworld/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,10 @@ export class HelloWorldAppFactory {
* Creates a new instance of the HelloWorldApp smart contract using a bare call.
*
* @param params The params for the bare (raw) call
* @returns The params for a create call
* @returns The transaction for a create call
*/
bare: (params?: Expand<AppClientBareCallParams & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}>) => {
return this.appFactory.params.bare.create(params)
return this.appFactory.createTransaction.bare.create(params)
},
},

Expand Down
12 changes: 6 additions & 6 deletions examples/lifecycle/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,32 +434,32 @@ export class LifeCycleAppFactory {
* Creates a new instance of the LifeCycleApp smart contract using a bare call.
*
* @param params The params for the bare (raw) call
* @returns The params for a create call
* @returns The transaction for a create call
*/
bare: (params?: Expand<AppClientBareCallParams & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC | OnApplicationComplete.OptInOC}>) => {
return this.appFactory.params.bare.create(params)
return this.appFactory.createTransaction.bare.create(params)
},
/**
* Creates a new instance of the LifeCycleApp smart contract using the create(string)string ABI method.
*
* ABI create method with 1 argument
*
* @param params The params for the smart contract call
* @returns The create params: The formatted greeting
* @returns The create transaction: The formatted greeting
*/
createStringString: (params: CallParams<LifeCycleAppArgs['obj']['create(string)string'] | LifeCycleAppArgs['tuple']['create(string)string']> & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}) => {
return this.appFactory.params.create(LifeCycleAppParamsFactory.create.createStringString(params))
return this.appFactory.createTransaction.create(LifeCycleAppParamsFactory.create.createStringString(params))
},
/**
* Creates a new instance of the LifeCycleApp smart contract using the create(string,uint32)void ABI method.
*
* ABI create method with 2 arguments
*
* @param params The params for the smart contract call
* @returns The create params
* @returns The create transaction
*/
createStringUint32Void: (params: CallParams<LifeCycleAppArgs['obj']['create(string,uint32)void'] | LifeCycleAppArgs['tuple']['create(string,uint32)void']> & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}) => {
return this.appFactory.params.create(LifeCycleAppParamsFactory.create.createStringUint32Void(params))
return this.appFactory.createTransaction.create(LifeCycleAppParamsFactory.create.createStringUint32Void(params))
},
},

Expand Down
4 changes: 2 additions & 2 deletions examples/minimal/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,10 @@ export class AppFactory {
* Creates a new instance of the App smart contract using a bare call.
*
* @param params The params for the bare (raw) call
* @returns The params for a create call
* @returns The transaction for a create call
*/
bare: (params?: Expand<AppClientBareCallParams & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}>) => {
return this.appFactory.params.bare.create(params)
return this.appFactory.createTransaction.bare.create(params)
},
},

Expand Down
4 changes: 2 additions & 2 deletions examples/nested/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,10 @@ export class NestedContractFactory {
* Creates a new instance of the NestedContract smart contract using a bare call.
*
* @param params The params for the bare (raw) call
* @returns The params for a create call
* @returns The transaction for a create call
*/
bare: (params?: Expand<AppClientBareCallParams & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}>) => {
return this.appFactory.params.bare.create(params)
return this.appFactory.createTransaction.bare.create(params)
},
},

Expand Down
4 changes: 2 additions & 2 deletions examples/reti/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1543,10 +1543,10 @@ export class ValidatorRegistryFactory {
* Creates a new instance of the ValidatorRegistry smart contract using the createApplication()void ABI method.
*
* @param params The params for the smart contract call
* @returns The create params
* @returns The create transaction
*/
createApplication: (params: CallParams<ValidatorRegistryArgs['obj']['createApplication()void'] | ValidatorRegistryArgs['tuple']['createApplication()void']> & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC} = {args: []}) => {
return this.appFactory.params.create(ValidatorRegistryParamsFactory.create.createApplication(params))
return this.appFactory.createTransaction.create(ValidatorRegistryParamsFactory.create.createApplication(params))
},
},

Expand Down
8 changes: 4 additions & 4 deletions examples/state/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -895,19 +895,19 @@ export class StateAppFactory {
* Creates a new instance of the StateApp smart contract using a bare call.
*
* @param params The params for the bare (raw) call
* @returns The params for a create call
* @returns The transaction for a create call
*/
bare: (params?: Expand<AppClientBareCallParams & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC | OnApplicationComplete.OptInOC}>) => {
return this.appFactory.params.bare.create(params)
return this.appFactory.createTransaction.bare.create(params)
},
/**
* Creates a new instance of the StateApp smart contract using the create_abi(string)string ABI method.
*
* @param params The params for the smart contract call
* @returns The create params
* @returns The create transaction
*/
createAbi: (params: CallParams<StateAppArgs['obj']['create_abi(string)string'] | StateAppArgs['tuple']['create_abi(string)string']> & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}) => {
return this.appFactory.params.create(StateAppParamsFactory.create.createAbi(params))
return this.appFactory.createTransaction.create(StateAppParamsFactory.create.createAbi(params))
},
},

Expand Down
4 changes: 2 additions & 2 deletions examples/voting/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,10 @@ export class VotingRoundAppFactory {
* Creates a new instance of the VotingRoundApp smart contract using the create(string,byte[],string,uint64,uint64,uint8[],uint64,string)void ABI method.
*
* @param params The params for the smart contract call
* @returns The create params
* @returns The create transaction
*/
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}) => {
return this.appFactory.params.create(VotingRoundAppParamsFactory.create.create(params))
return this.appFactory.createTransaction.create(VotingRoundAppParamsFactory.create.create(params))
},
},

Expand Down
37 changes: 31 additions & 6 deletions src/client/app-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,43 @@ function* createMethods(generator: GeneratorContext): DocumentParts {
function* paramMethods(ctx: GeneratorContext): DocumentParts {
const { app, callConfig } = ctx

yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true)
yield* operationMethods(
ctx,
`Creates a new instance of the ${app.name} smart contract`,
callConfig.createMethods,
'create',
'params',
true,
)

yield* operationMethods(
ctx,
`Updates an existing instance of the ${app.name} smart contract`,
callConfig.updateMethods,
'deployUpdate',
'params',
true,
)
yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'deployDelete')
yield* operationMethods(
ctx,
`Deletes an existing instance of the ${app.name} smart contract`,
callConfig.deleteMethods,
'deployDelete',
'params',
)
}

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

yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true)
yield* operationMethods(
ctx,
`Creates a new instance of the ${app.name} smart contract`,
callConfig.createMethods,
'create',
'createTransaction',
true,
)
}

function* bareMethodCallParams({
Expand All @@ -187,7 +208,10 @@ function* bareMethodCallParams({
params: {
params: `The params for the bare (raw) call`,
},
returns: type === 'params' ? `The params for a ${verb} call` : `The ${verb} result`,
returns:
type === 'params' || type === 'createTransaction'
? `The ${type === 'createTransaction' ? 'transaction' : type} for a ${verb} call`
: `The ${verb} result`,
})
yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${
includeCompilation ? ' &' + ' AppClientCompilationParams' : ''
Expand Down Expand Up @@ -257,6 +281,7 @@ function* operationMethods(
description: string,
methods: MethodList,
verb: 'create' | 'deployUpdate' | 'deployDelete',
type: 'params' | 'createTransaction',
includeCompilation?: boolean,
): DocumentParts {
if (methods.length) {
Expand All @@ -270,7 +295,7 @@ function* operationMethods(
name: 'bare',
description: `${description} using a bare call`,
verb,
type: 'params',
type,
includeCompilation,
})
} else {
Expand All @@ -280,7 +305,7 @@ function* operationMethods(
method,
description,
verb,
type: 'params',
type,
includeCompilation,
})
}
Expand Down

0 comments on commit b494dac

Please sign in to comment.