Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
h0ngcha0 committed May 2, 2024
1 parent d915796 commit 58696d8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions packages/cli/src/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,17 +337,17 @@ function genTestMethod(contract: Contract, functionSig: node.FunctionSig): strin
funcHasArgs && contractHasFields
? `params: ${baseParamsType}`
: funcHasArgs
? `params: Omit<${baseParamsType}, 'initialFields'>`
: contractHasFields
? `params: Omit<${baseParamsType}, 'testArgs'>`
: `params?: Omit<${baseParamsType}, 'testArgs' | 'initialFields'>`
? `params: Omit<${baseParamsType}, 'initialFields'>`
: contractHasFields
? `params: Omit<${baseParamsType}, 'testArgs'>`
: `params?: Omit<${baseParamsType}, 'testArgs' | 'initialFields'>`
const tsReturnTypes = functionSig.returnTypes.map((tpe) => toTsType(tpe))
const baseRetType =
tsReturnTypes.length === 0
? 'null'
: tsReturnTypes.length === 1
? tsReturnTypes[0]
: `[${tsReturnTypes.join(', ')}]`
? tsReturnTypes[0]
: `[${tsReturnTypes.join(', ')}]`
const retType = hasMapVars
? `TestContractResult<${baseRetType}, ${mapsType}>`
: `TestContractResultWithoutMaps<${baseRetType}>`
Expand All @@ -374,17 +374,17 @@ function genCallMethodTypes(contract: Contract): string {
const funcHasArgs = functionSig.paramNames.length > 0
const params = funcHasArgs
? `CallContractParams<{${formatParameters({
names: functionSig.paramNames,
types: functionSig.paramTypes
})}}>`
names: functionSig.paramNames,
types: functionSig.paramTypes
})}}>`
: `Omit<CallContractParams<{}>, 'args'>`
const tsReturnTypes = functionSig.returnTypes.map((tpe) => toTsType(tpe))
const retType =
tsReturnTypes.length === 0
? `CallContractResult<null>`
: tsReturnTypes.length === 1
? `CallContractResult<${tsReturnTypes[0]}>`
: `CallContractResult<[${tsReturnTypes.join(', ')}]>`
? `CallContractResult<${tsReturnTypes[0]}>`
: `CallContractResult<[${tsReturnTypes.join(', ')}]>`
return `
${functionSig.name}: {
params: ${params}
Expand Down Expand Up @@ -412,9 +412,9 @@ function genSignExecuteMethodTypes(contract: Contract): string {
const funcHasArgs = functionSig.paramNames.length > 0
const params = funcHasArgs
? `SignExecuteContractMethodParams<{${formatParameters({
names: functionSig.paramNames,
types: functionSig.paramTypes
})}}>`
names: functionSig.paramNames,
types: functionSig.paramTypes
})}}>`
: `Omit<SignExecuteContractMethodParams<{}>, 'args'>`

return `
Expand Down
2 changes: 1 addition & 1 deletion test/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import { UserAccount, NFTTest, OwnerOnly, TokenTest, MapTest, UserAccountTypes }
import { randomBytes } from 'crypto'
import { TokenBalance } from '../artifacts/ts/types'

describe('contract', function() {
describe('contract', function () {
let signer: PrivateKeyWallet
let signerAccount: Account
let signerGroup: number
Expand Down

0 comments on commit 58696d8

Please sign in to comment.