Skip to content

Commit

Permalink
fix: Include schema property in create and deploy calls
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmenzel committed Mar 19, 2024
1 parent c965cca commit 708adf4
Show file tree
Hide file tree
Showing 8 changed files with 1,573 additions and 1,285 deletions.
12 changes: 10 additions & 2 deletions examples/helloworld/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
AppCompilationResult,
AppReference,
AppState,
AppStorageSchema,
CoreAppCallArgs,
RawAppCallArgs,
TealTemplateParams,
Expand Down Expand Up @@ -158,6 +159,13 @@ export type AppClientComposeCallCoreParams = Omit<AppClientCallCoreParams, 'send
}
export type AppClientComposeExecuteParams = Pick<SendTransactionParams, 'skipWaiting' | 'maxRoundsToWaitForConfirmation' | 'populateAppCallResources' | 'suppressLog'>

export type IncludeSchema = {
/**
* Any overrides for the storage schema to request for the created app; by default the schema indicated by the app spec is used.
*/
schema?: AppStorageSchema
}

/**
* Defines the types of available calls and state of the HelloWorldApp smart contract.
*/
Expand Down Expand Up @@ -412,7 +420,7 @@ export class HelloWorldAppClient {
* @param params The arguments for the contract calls and any additional parameters for the call
* @returns The deployment result
*/
public deploy(params: HelloWorldAppDeployArgs & AppClientDeployCoreParams = {}): ReturnType<ApplicationClient['deploy']> {
public deploy(params: HelloWorldAppDeployArgs & AppClientDeployCoreParams & IncludeSchema = {}): ReturnType<ApplicationClient['deploy']> {
const createArgs = params.createCall?.(HelloWorldAppCallFactory.create)
const updateArgs = params.updateCall?.(HelloWorldAppCallFactory.update)
const deleteArgs = params.deleteCall?.(HelloWorldAppCallFactory.delete)
Expand All @@ -437,7 +445,7 @@ export class HelloWorldAppClient {
* @param args The arguments for the bare call
* @returns The create result
*/
async bare(args: BareCallArgs & AppClientCallCoreParams & AppClientCompilationParams & CoreAppCallArgs & (OnCompleteNoOp) = {}) {
async bare(args: BareCallArgs & AppClientCallCoreParams & AppClientCompilationParams & IncludeSchema & CoreAppCallArgs & (OnCompleteNoOp) = {}) {
return $this.mapReturnValue<undefined, AppCreateCallTransactionResult>(await $this.appClient.create(args))
},
}
Expand Down
16 changes: 12 additions & 4 deletions examples/lifecycle/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
AppCompilationResult,
AppReference,
AppState,
AppStorageSchema,
CoreAppCallArgs,
RawAppCallArgs,
TealTemplateParams,
Expand Down Expand Up @@ -204,6 +205,13 @@ export type AppClientComposeCallCoreParams = Omit<AppClientCallCoreParams, 'send
}
export type AppClientComposeExecuteParams = Pick<SendTransactionParams, 'skipWaiting' | 'maxRoundsToWaitForConfirmation' | 'populateAppCallResources' | 'suppressLog'>

export type IncludeSchema = {
/**
* Any overrides for the storage schema to request for the created app; by default the schema indicated by the app spec is used.
*/
schema?: AppStorageSchema
}

/**
* Defines the types of available calls and state of the LifeCycleApp smart contract.
*/
Expand Down Expand Up @@ -479,7 +487,7 @@ export class LifeCycleAppClient {
* @param params The arguments for the contract calls and any additional parameters for the call
* @returns The deployment result
*/
public deploy(params: LifeCycleAppDeployArgs & AppClientDeployCoreParams = {}): ReturnType<ApplicationClient['deploy']> {
public deploy(params: LifeCycleAppDeployArgs & AppClientDeployCoreParams & IncludeSchema = {}): ReturnType<ApplicationClient['deploy']> {
const createArgs = params.createCall?.(LifeCycleAppCallFactory.create)
const updateArgs = params.updateCall?.(LifeCycleAppCallFactory.update)
return this.appClient.deploy({
Expand All @@ -502,7 +510,7 @@ export class LifeCycleAppClient {
* @param args The arguments for the bare call
* @returns The create result
*/
async bare(args: BareCallArgs & AppClientCallCoreParams & AppClientCompilationParams & CoreAppCallArgs & (OnCompleteNoOp | OnCompleteOptIn) = {}) {
async bare(args: BareCallArgs & AppClientCallCoreParams & AppClientCompilationParams & IncludeSchema & CoreAppCallArgs & (OnCompleteNoOp | OnCompleteOptIn) = {}) {
return $this.mapReturnValue<undefined, AppCreateCallTransactionResult>(await $this.appClient.create(args))
},
/**
Expand All @@ -512,7 +520,7 @@ export class LifeCycleAppClient {
* @param params Any additional parameters for the call
* @returns The create result: The formatted greeting
*/
async createStringString(args: MethodArgs<'create(string)string'>, params: AppClientCallCoreParams & AppClientCompilationParams & (OnCompleteNoOp) = {}) {
async createStringString(args: MethodArgs<'create(string)string'>, params: AppClientCallCoreParams & AppClientCompilationParams& IncludeSchema & (OnCompleteNoOp) = {}) {
return $this.mapReturnValue<MethodReturn<'create(string)string'>, AppCreateCallTransactionResult>(await $this.appClient.create(LifeCycleAppCallFactory.create.createStringString(args, params)))
},
/**
Expand All @@ -522,7 +530,7 @@ export class LifeCycleAppClient {
* @param params Any additional parameters for the call
* @returns The create result
*/
async createStringUint32Void(args: MethodArgs<'create(string,uint32)void'>, params: AppClientCallCoreParams & AppClientCompilationParams & (OnCompleteNoOp) = {}) {
async createStringUint32Void(args: MethodArgs<'create(string,uint32)void'>, params: AppClientCallCoreParams & AppClientCompilationParams& IncludeSchema & (OnCompleteNoOp) = {}) {
return $this.mapReturnValue<MethodReturn<'create(string,uint32)void'>, AppCreateCallTransactionResult>(await $this.appClient.create(LifeCycleAppCallFactory.create.createStringUint32Void(args, params)))
},
}
Expand Down
14 changes: 11 additions & 3 deletions examples/state/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
AppCompilationResult,
AppReference,
AppState,
AppStorageSchema,
CoreAppCallArgs,
RawAppCallArgs,
TealTemplateParams,
Expand Down Expand Up @@ -533,6 +534,13 @@ export type AppClientComposeCallCoreParams = Omit<AppClientCallCoreParams, 'send
}
export type AppClientComposeExecuteParams = Pick<SendTransactionParams, 'skipWaiting' | 'maxRoundsToWaitForConfirmation' | 'populateAppCallResources' | 'suppressLog'>

export type IncludeSchema = {
/**
* Any overrides for the storage schema to request for the created app; by default the schema indicated by the app spec is used.
*/
schema?: AppStorageSchema
}

/**
* Defines the types of available calls and state of the StateApp smart contract.
*/
Expand Down Expand Up @@ -1114,7 +1122,7 @@ export class StateAppClient {
* @param params The arguments for the contract calls and any additional parameters for the call
* @returns The deployment result
*/
public deploy(params: StateAppDeployArgs & AppClientDeployCoreParams = {}): ReturnType<ApplicationClient['deploy']> {
public deploy(params: StateAppDeployArgs & AppClientDeployCoreParams & IncludeSchema = {}): ReturnType<ApplicationClient['deploy']> {
const createArgs = params.createCall?.(StateAppCallFactory.create)
const updateArgs = params.updateCall?.(StateAppCallFactory.update)
const deleteArgs = params.deleteCall?.(StateAppCallFactory.delete)
Expand All @@ -1139,7 +1147,7 @@ export class StateAppClient {
* @param args The arguments for the bare call
* @returns The create result
*/
async bare(args: BareCallArgs & AppClientCallCoreParams & AppClientCompilationParams & CoreAppCallArgs & (OnCompleteNoOp | OnCompleteOptIn) = {}) {
async bare(args: BareCallArgs & AppClientCallCoreParams & AppClientCompilationParams & IncludeSchema & CoreAppCallArgs & (OnCompleteNoOp | OnCompleteOptIn) = {}) {
return $this.mapReturnValue<undefined, AppCreateCallTransactionResult>(await $this.appClient.create(args))
},
/**
Expand All @@ -1149,7 +1157,7 @@ export class StateAppClient {
* @param params Any additional parameters for the call
* @returns The create result
*/
async createAbi(args: MethodArgs<'create_abi(string)string'>, params: AppClientCallCoreParams & AppClientCompilationParams & (OnCompleteNoOp) = {}) {
async createAbi(args: MethodArgs<'create_abi(string)string'>, params: AppClientCallCoreParams & AppClientCompilationParams& IncludeSchema & (OnCompleteNoOp) = {}) {
return $this.mapReturnValue<MethodReturn<'create_abi(string)string'>, AppCreateCallTransactionResult>(await $this.appClient.create(StateAppCallFactory.create.createAbi(args, params)))
},
}
Expand Down
12 changes: 10 additions & 2 deletions examples/voting/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
AppCompilationResult,
AppReference,
AppState,
AppStorageSchema,
CoreAppCallArgs,
RawAppCallArgs,
TealTemplateParams,
Expand Down Expand Up @@ -329,6 +330,13 @@ export type AppClientComposeCallCoreParams = Omit<AppClientCallCoreParams, 'send
}
export type AppClientComposeExecuteParams = Pick<SendTransactionParams, 'skipWaiting' | 'maxRoundsToWaitForConfirmation' | 'populateAppCallResources' | 'suppressLog'>

export type IncludeSchema = {
/**
* Any overrides for the storage schema to request for the created app; by default the schema indicated by the app spec is used.
*/
schema?: AppStorageSchema
}

/**
* Defines the types of available calls and state of the VotingRoundApp smart contract.
*/
Expand Down Expand Up @@ -690,7 +698,7 @@ export class VotingRoundAppClient {
* @param params The arguments for the contract calls and any additional parameters for the call
* @returns The deployment result
*/
public deploy(params: VotingRoundAppDeployArgs & AppClientDeployCoreParams = {}): ReturnType<ApplicationClient['deploy']> {
public deploy(params: VotingRoundAppDeployArgs & AppClientDeployCoreParams & IncludeSchema = {}): ReturnType<ApplicationClient['deploy']> {
const createArgs = params.createCall?.(VotingRoundAppCallFactory.create)
const deleteArgs = params.deleteCall?.(VotingRoundAppCallFactory.delete)
return this.appClient.deploy({
Expand All @@ -714,7 +722,7 @@ export class VotingRoundAppClient {
* @param params Any additional parameters for the call
* @returns The create result
*/
async create(args: MethodArgs<'create(string,byte[],string,uint64,uint64,uint8[],uint64,string)void'>, params: AppClientCallCoreParams & AppClientCompilationParams & (OnCompleteNoOp) = {}) {
async create(args: MethodArgs<'create(string,byte[],string,uint64,uint64,uint8[],uint64,string)void'>, params: AppClientCallCoreParams & AppClientCompilationParams& IncludeSchema & (OnCompleteNoOp) = {}) {
return $this.mapReturnValue<MethodReturn<'create(string,byte[],string,uint64,uint64,uint8[],uint64,string)void'>, AppCreateCallTransactionResult>(await $this.appClient.create(VotingRoundAppCallFactory.create.create(args, params)))
},
}
Expand Down
Loading

0 comments on commit 708adf4

Please sign in to comment.