Skip to content

Commit

Permalink
update biome spec per latest version of bun, lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroXbrock committed Dec 8, 2023
1 parent 563fd12 commit bf56e83
Show file tree
Hide file tree
Showing 24 changed files with 221 additions and 239 deletions.
11 changes: 4 additions & 7 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"indentSize": 2,
"lineWidth": 80
},
"linter": {
Expand All @@ -36,23 +36,20 @@
"noUnusedVariables": "error"
},
"complexity": {
"noForEach": "off",
"noBannedTypes": "off"
"noForEach": "off"
},
"performance": {
"noDelete": "off"
},
"style": {
"noNonNullAssertion": "off",
"useShorthandArrayType": "error",
"noUselessElse": "off"
"useShorthandArrayType": "error"
},
"suspicious": {
"noArrayIndexKey": "off",
"noAssignInExpressions": "off",
"noExplicitAny": "off",
"noRedeclare": "off",
"noConfusingVoidType": "off"
"noRedeclare": "off"
}
}
},
Expand Down
6 changes: 2 additions & 4 deletions src/accounts/utils/signTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import {
import { type SignErrorType, sign } from './sign.js'

export type SignTransactionParameters<
TTransactionSerializable extends
TransactionSerializable = TransactionSerializable,
TTransactionSerializable extends TransactionSerializable = TransactionSerializable,
> = {
privateKey: Hex
transaction: TTransactionSerializable
Expand All @@ -28,8 +27,7 @@ export type SignTransactionParameters<
}

export type SignTransactionReturnType<
TTransactionSerializable extends
TransactionSerializable = TransactionSerializable,
TTransactionSerializable extends TransactionSerializable = TransactionSerializable,
> = TransactionSerialized<GetTransactionType<TTransactionSerializable>>

export type SignTransactionErrorType =
Expand Down
20 changes: 9 additions & 11 deletions src/actions/public/createContractEventFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,15 @@ export type CreateContractEventFilterParameters<
args?: never
}
: MaybeExtractEventArgsFromAbi<
TAbi,
TEventName
> extends infer TEventFilterArgs
? {
args?:
| TEventFilterArgs
| (TArgs extends TEventFilterArgs ? TArgs : never)
}
: {
args?: never
})
TAbi,
TEventName
> extends infer TEventFilterArgs
? {
args?: TEventFilterArgs | (TArgs extends TEventFilterArgs ? TArgs : never)
}
: {
args?: never
})

export type CreateContractEventFilterReturnType<
TAbi extends Abi | readonly unknown[] = Abi,
Expand Down
5 changes: 2 additions & 3 deletions src/chains/suave/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ const AllSuaveTypes = {
}

// syntactical sugar to allow inline string literals
export type SuaveTxType =
`${(typeof AllSuaveTypes)[keyof typeof AllSuaveTypes]}`
export type SuaveTxType = `${typeof AllSuaveTypes[keyof typeof AllSuaveTypes]}`
export type SuaveTxRequestType =
`${(typeof SuaveTxRequestTypes)[keyof typeof SuaveTxRequestTypes]}`
`${typeof SuaveTxRequestTypes[keyof typeof SuaveTxRequestTypes]}`

type ConfidentialOverrides = {
kettleAddress?: Address
Expand Down
4 changes: 2 additions & 2 deletions src/errors/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export class BaseError extends Error {
args.cause instanceof BaseError
? args.cause.details
: args.cause?.message
? args.cause.message
: args.details!
? args.cause.message
: args.details!
const docsPath =
args.cause instanceof BaseError
? args.cause.docsPath || args.docsPath
Expand Down
127 changes: 64 additions & 63 deletions src/types/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ export type ContractFunctionResult<
> = true extends FailedToParseArgs
? unknown
: TArgs extends readonly []
? void
: TArgs extends readonly [infer Arg]
? Arg
: TArgs
? void
: TArgs extends readonly [infer Arg]
? Arg
: TArgs

export type GetValue<
TAbi extends Abi | readonly unknown[],
Expand All @@ -75,8 +75,8 @@ export type GetValue<
? TAbiFunction['stateMutability'] extends 'payable'
? { value?: NoUndefined<TValueType> }
: TAbiFunction['payable'] extends true
? { value?: NoUndefined<TValueType> }
: { value?: never }
? { value?: NoUndefined<TValueType> }
: { value?: never }
: { value?: TValueType }

export type MaybeAbiEventName<TAbiEvent extends AbiEvent | undefined> =
Expand Down Expand Up @@ -170,10 +170,10 @@ export type GetFunctionArgs<
args?: readonly unknown[]
}
: TArgs extends readonly []
? { args?: never }
: {
/** Arguments to pass contract method */ args: TArgs
}
? { args?: never }
: {
/** Arguments to pass contract method */ args: TArgs
}

export type GetConstructorArgs<
TAbi extends Abi | readonly unknown[],
Expand All @@ -194,10 +194,10 @@ export type GetConstructorArgs<
args?: readonly unknown[]
}
: TArgs extends readonly []
? { args?: never }
: {
/** Arguments to pass contract constructor */ args: TArgs
}
? { args?: never }
: {
/** Arguments to pass contract constructor */ args: TArgs
}

export type GetErrorArgs<
TAbi extends Abi | readonly unknown[],
Expand All @@ -219,10 +219,10 @@ export type GetErrorArgs<
args?: readonly unknown[]
}
: TArgs extends readonly []
? { args?: never }
: {
/** Arguments to pass contract method */ args: TArgs
}
? { args?: never }
: {
/** Arguments to pass contract method */ args: TArgs
}

export type GetEventArgs<
TAbi extends Abi | readonly unknown[],
Expand Down Expand Up @@ -296,10 +296,10 @@ export type LogTopicType<
> = TTopic extends Hex
? TPrimitiveType
: TTopic extends Hex[]
? TPrimitiveType[]
: TTopic extends null
? null
: never
? TPrimitiveType[]
: TTopic extends null
? null
: never

/**
* @internal
Expand Down Expand Up @@ -328,45 +328,46 @@ export type AbiEventParametersToPrimitiveTypes<
> = TAbiParameters extends readonly []
? readonly []
: Filter<
TAbiParameters,
Options['IndexedOnly'] extends true ? { indexed: true } : object
> extends infer Filtered extends readonly AbiParameter[]
? _HasUnnamedAbiParameter<Filtered> extends true
? // Has unnamed tuple parameters so return as array
| readonly [
...{
[K in keyof Filtered]: AbiEventParameterToPrimitiveType<
Filtered[K],
Options
>
},
]
// Distribute over tuple to represent optional parameters
| (Options['Required'] extends true
? never
: // Distribute over tuple to represent optional parameters
Filtered extends readonly [
...infer Head extends readonly AbiParameter[],
infer _,
]
? AbiEventParametersToPrimitiveTypes<
readonly [...{ [K in keyof Head]: Omit<Head[K], 'name'> }],
Options
>
: never)
: // All tuple parameters are named so return as object
{
[Parameter in Filtered[number] as Parameter extends {
name: infer Name extends string
}
? Name
: never]?: AbiEventParameterToPrimitiveType<Parameter, Options>
} extends infer Mapped
? Prettify<
MaybeRequired<
Mapped,
Options['Required'] extends boolean ? Options['Required'] : false
>
>
: never
TAbiParameters,
Options['IndexedOnly'] extends true ? { indexed: true } : object
> extends infer Filtered extends readonly AbiParameter[]
? _HasUnnamedAbiParameter<Filtered> extends true
? // Has unnamed tuple parameters so return as array
| readonly [
...{
[K in keyof Filtered]: AbiEventParameterToPrimitiveType<
Filtered[K],
Options
>
},
]
// Distribute over tuple to represent optional parameters
| (Options['Required'] extends true
? never
: // Distribute over tuple to represent optional parameters
Filtered extends readonly [
...infer Head extends readonly AbiParameter[],
infer _,
]
? AbiEventParametersToPrimitiveTypes<
readonly [...{ [K in keyof Head]: Omit<Head[K], 'name'> }],
Options
>
: never)
: // All tuple parameters are named so return as object
{
[Parameter in
Filtered[number] as Parameter extends {
name: infer Name extends string
}
? Name
: never]?: AbiEventParameterToPrimitiveType<Parameter, Options>
} extends infer Mapped
? Prettify<
MaybeRequired<
Mapped,
Options['Required'] extends boolean ? Options['Required'] : false
>
>
: never
: never
24 changes: 12 additions & 12 deletions src/types/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ export type Filter<
strict: TStrict
}
: TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName>
? {
abi: TAbi
args: TArgs
eventName: TEventName
strict: TStrict
}
: {
abi: TAbi
args?: never
eventName: TEventName
strict: TStrict
}
? {
abi: TAbi
args: TArgs
eventName: TEventName
strict: TStrict
}
: {
abi: TAbi
args?: never
eventName: TEventName
strict: TStrict
}
: {
abi?: never
args?: never
Expand Down
8 changes: 4 additions & 4 deletions src/types/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ type GetTopics<
> = true extends _FailedToParseArgs
? [Hex, ...Hex[]] | []
: TAbiEvent extends AbiEvent
? Topics<TAbiEvent['inputs']>
: _AbiEvent extends AbiEvent
? Topics<_AbiEvent['inputs']>
: [Hex, ...Hex[]] | []
? Topics<TAbiEvent['inputs']>
: _AbiEvent extends AbiEvent
? Topics<_AbiEvent['inputs']>
: [Hex, ...Hex[]] | []

type GetInferredLogValues<
TAbiEvent extends AbiEvent | undefined = undefined,
Expand Down
Loading

0 comments on commit bf56e83

Please sign in to comment.