Skip to content

Commit f96a3c8

Browse files
authored
Merge pull request #463 from pimlicolabs/chore/sonarqube
chore/sonarqube
2 parents 6da9708 + 8d6c7b1 commit f96a3c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+193
-335
lines changed
File renamed without changes.

packages/mock-paymaster/helpers/schema.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const hexNumberSchema = z
5353
})
5454
}
5555
})
56-
.transform((val) => BigInt(val))
56+
.transform(BigInt)
5757

5858
export const hexDataSchema = z
5959
.string()
@@ -63,21 +63,21 @@ export const hexDataSchema = z
6363
const signedAuthorizationSchema = z.union([
6464
z.object({
6565
contractAddress: addressSchema,
66-
chainId: hexNumberSchema.transform((val) => Number(val)),
67-
nonce: hexNumberSchema.transform((val) => Number(val)),
66+
chainId: hexNumberSchema.transform(Number),
67+
nonce: hexNumberSchema.transform(Number),
6868
r: hexDataSchema.transform((val) => val as Hex),
6969
s: hexDataSchema.transform((val) => val as Hex),
7070
v: hexNumberSchema.optional(),
71-
yParity: hexNumberSchema.transform((val) => Number(val))
71+
yParity: hexNumberSchema.transform(Number)
7272
}),
7373
z.object({
7474
address: addressSchema,
75-
chainId: hexNumberSchema.transform((val) => Number(val)),
76-
nonce: hexNumberSchema.transform((val) => Number(val)),
75+
chainId: hexNumberSchema.transform(Number),
76+
nonce: hexNumberSchema.transform(Number),
7777
r: hexDataSchema.transform((val) => val as Hex),
7878
s: hexDataSchema.transform((val) => val as Hex),
7979
v: hexNumberSchema.optional(),
80-
yParity: hexNumberSchema.transform((val) => Number(val))
80+
yParity: hexNumberSchema.transform(Number)
8181
})
8282
])
8383

packages/mock-paymaster/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ import Fastify from "fastify"
33
import { defineInstance } from "prool"
44
import { http, createWalletClient } from "viem"
55
import { privateKeyToAccount } from "viem/accounts"
6-
import {
7-
deployErc20Token,
8-
erc20Address,
9-
sudoMintTokens
10-
} from "./helpers/erc20-utils.js"
6+
import { deployErc20Token } from "./helpers/erc20-utils.js"
117
import { getChain } from "./helpers/utils.js"
128
import { createRpcHandler } from "./relay.js"
139
import { deployPaymasters } from "./singletonPaymasters.js"
@@ -66,4 +62,4 @@ export const paymaster = defineInstance(
6662
}
6763
)
6864

69-
export { erc20Address, sudoMintTokens }
65+
export { erc20Address, sudoMintTokens } from "./helpers/erc20-utils.js"

packages/permissionless-test/mock-aa-infra/alto/instance.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { resolve } from "node:path"
2-
import { defineInstance } from "prool"
3-
import { toArgs } from "prool"
2+
import { defineInstance, toArgs } from "prool"
43
import { execa } from "prool/processes"
54

65
export type AltoParameters = {
@@ -267,8 +266,6 @@ export const alto = defineInstance((parameters?: AltoParameters) => {
267266
return ["node", resolve(libPath, "../cli/alto.js")]
268267
})()
269268

270-
const command = `${binary} ${toArgs({ port, ...args })}`
271-
272269
await process.start(
273270
($) => $`${binary} ${toArgs({ port, ...args })}`,
274271
{

packages/permissionless-test/src/testWithRpc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const testWithRpc = test.extend<{
117117
paymasterRpc
118118
})
119119

120-
await Promise.all([...instances.map((instance) => instance.stop())])
120+
await Promise.all(instances.map((instance) => instance.stop()))
121121
ports = ports.filter(
122122
(port) =>
123123
port !== altoPort ||

packages/permissionless-test/src/utils.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,20 +202,26 @@ export const getPimlicoClient = <entryPointVersion extends EntryPointVersion>({
202202
}: {
203203
entryPointVersion: entryPointVersion
204204
altoRpc: string
205-
}) =>
206-
createPimlicoClient({
205+
}) => {
206+
const address = (() => {
207+
if (entryPointVersion === "0.6") {
208+
return entryPoint06Address
209+
}
210+
if (entryPointVersion === "0.7") {
211+
return entryPoint07Address
212+
}
213+
return entryPoint08Address
214+
})()
215+
216+
return createPimlicoClient({
207217
chain: foundry,
208218
entryPoint: {
209-
address:
210-
entryPointVersion === "0.6"
211-
? entryPoint06Address
212-
: entryPointVersion === "0.7"
213-
? entryPoint07Address
214-
: entryPoint08Address,
219+
address,
215220
version: entryPointVersion
216221
},
217222
transport: http(altoRpc)
218223
})
224+
}
219225

220226
export const getPublicClient = (anvilRpc: string) => {
221227
const transport = http(anvilRpc, {

packages/permissionless/accounts/biconomy/toBiconomySmartAccount.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
import type {
2-
Account,
3-
Assign,
4-
Chain,
5-
JsonRpcAccount,
6-
OneOf,
7-
Prettify,
8-
Transport,
9-
WalletClient
10-
} from "viem"
111
import {
2+
type Account,
123
type Address,
4+
type Assign,
5+
type Chain,
136
type Client,
147
type Hex,
8+
type JsonRpcAccount,
159
type LocalAccount,
10+
type OneOf,
11+
type Prettify,
12+
type Transport,
13+
type WalletClient,
1614
decodeFunctionData,
1715
encodeAbiParameters,
1816
encodeFunctionData,

packages/permissionless/accounts/etherspot/utils/wrapMessageHash.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import {
2+
type Address,
23
type Hex,
34
concatHex,
5+
domainSeparator,
46
encodeAbiParameters,
57
keccak256,
68
stringToHex
79
} from "viem"
8-
import { type Address, domainSeparator } from "viem"
910

1011
export type WrapMessageHashParams = {
1112
accountAddress: Address
Lines changed: 12 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,140 +1,86 @@
1-
import {
1+
export {
22
type SimpleSmartAccountImplementation,
33
type ToSimpleSmartAccountParameters,
44
type ToSimpleSmartAccountReturnType,
55
toSimpleSmartAccount
66
} from "./simple/toSimpleSmartAccount.js"
77

8-
import {
8+
export {
99
type To7702SimpleSmartAccountImplementation,
1010
type To7702SimpleSmartAccountParameters,
1111
type To7702SimpleSmartAccountReturnType,
1212
to7702SimpleSmartAccount
1313
} from "./simple/to7702SimpleSmartAccount.js"
1414

15-
import {
15+
export {
1616
type LightAccountVersion,
1717
type LightSmartAccountImplementation,
1818
type ToLightSmartAccountParameters,
1919
type ToLightSmartAccountReturnType,
2020
toLightSmartAccount
2121
} from "./light/toLightSmartAccount.js"
2222

23-
import {
23+
export {
2424
type ToTrustSmartAccountParameters,
2525
type ToTrustSmartAccountReturnType,
2626
type TrustSmartAccountImplementation,
2727
toTrustSmartAccount
2828
} from "./trust/toTrustSmartAccount.js"
2929

30-
import {
30+
export {
3131
type EtherspotSmartAccountImplementation,
3232
type ToEtherspotSmartAccountParameters,
3333
type ToEtherspotSmartAccountReturnType,
3434
toEtherspotSmartAccount
3535
} from "./etherspot/toEtherspotSmartAccount.js"
3636

37-
import {
37+
export {
3838
type SafeSmartAccountImplementation,
3939
type SafeVersion,
4040
type ToSafeSmartAccountParameters,
4141
type ToSafeSmartAccountReturnType,
4242
toSafeSmartAccount
4343
} from "./safe/toSafeSmartAccount.js"
4444

45-
import {
45+
export {
4646
type EcdsaKernelSmartAccountImplementation,
4747
type ToEcdsaKernelSmartAccountParameters,
4848
type ToEcdsaKernelSmartAccountReturnType,
4949
toEcdsaKernelSmartAccount
5050
} from "./kernel/toEcdsaKernelSmartAccount.js"
5151

52-
import {
52+
export {
5353
type To7702KernelSmartAccountImplementation,
5454
type To7702KernelSmartAccountParameters,
5555
type To7702KernelSmartAccountReturnType,
5656
to7702KernelSmartAccount
5757
} from "./kernel/to7702KernelSmartAccount.js"
5858

59-
import {
59+
export {
6060
type KernelSmartAccountImplementation,
6161
type KernelVersion,
6262
type ToKernelSmartAccountParameters,
6363
type ToKernelSmartAccountReturnType,
6464
toKernelSmartAccount
6565
} from "./kernel/toKernelSmartAccount.js"
6666

67-
import {
67+
export {
6868
type BiconomySmartAccountImplementation,
6969
type ToBiconomySmartAccountParameters,
7070
type ToBiconomySmartAccountReturnType,
7171
toBiconomySmartAccount
7272
} from "./biconomy/toBiconomySmartAccount.js"
7373

74-
import {
74+
export {
7575
type NexusSmartAccountImplementation,
7676
type ToNexusSmartAccountParameters,
7777
type ToNexusSmartAccountReturnType,
7878
toNexusSmartAccount
7979
} from "./nexus/toNexusSmartAccount.js"
8080

81-
import {
81+
export {
8282
type ThirdwebSmartAccountImplementation,
8383
type ToThirdwebSmartAccountParameters,
8484
type ToThirdwebSmartAccountReturnType,
8585
toThirdwebSmartAccount
8686
} from "./thirdweb/toThirdwebSmartAccount.js"
87-
88-
export {
89-
type ToSimpleSmartAccountParameters,
90-
type SimpleSmartAccountImplementation,
91-
type ToSimpleSmartAccountReturnType,
92-
toSimpleSmartAccount,
93-
type To7702SimpleSmartAccountParameters,
94-
type To7702SimpleSmartAccountImplementation,
95-
type To7702SimpleSmartAccountReturnType,
96-
to7702SimpleSmartAccount,
97-
type LightAccountVersion,
98-
type ToLightSmartAccountParameters,
99-
type LightSmartAccountImplementation,
100-
type ToLightSmartAccountReturnType,
101-
toLightSmartAccount,
102-
type ToTrustSmartAccountParameters,
103-
type TrustSmartAccountImplementation,
104-
type ToTrustSmartAccountReturnType,
105-
toTrustSmartAccount,
106-
type ToSafeSmartAccountParameters,
107-
type SafeSmartAccountImplementation,
108-
type ToSafeSmartAccountReturnType,
109-
type SafeVersion,
110-
toSafeSmartAccount,
111-
type ToEcdsaKernelSmartAccountParameters,
112-
type EcdsaKernelSmartAccountImplementation,
113-
type ToEcdsaKernelSmartAccountReturnType,
114-
toEcdsaKernelSmartAccount,
115-
type KernelSmartAccountImplementation,
116-
type ToKernelSmartAccountReturnType,
117-
type ToKernelSmartAccountParameters,
118-
type KernelVersion,
119-
toKernelSmartAccount,
120-
type NexusSmartAccountImplementation,
121-
type ToNexusSmartAccountParameters,
122-
type ToNexusSmartAccountReturnType,
123-
toNexusSmartAccount,
124-
type ToBiconomySmartAccountReturnType,
125-
type ToBiconomySmartAccountParameters,
126-
type BiconomySmartAccountImplementation,
127-
toBiconomySmartAccount,
128-
type ToThirdwebSmartAccountReturnType,
129-
type ToThirdwebSmartAccountParameters,
130-
type ThirdwebSmartAccountImplementation,
131-
toThirdwebSmartAccount,
132-
type ToEtherspotSmartAccountParameters,
133-
type EtherspotSmartAccountImplementation,
134-
type ToEtherspotSmartAccountReturnType,
135-
toEtherspotSmartAccount,
136-
type To7702KernelSmartAccountParameters,
137-
type To7702KernelSmartAccountImplementation,
138-
type To7702KernelSmartAccountReturnType,
139-
to7702KernelSmartAccount
140-
}

packages/permissionless/accounts/kernel/toKernelSmartAccount.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
import { Base64, Hex, PublicKey } from "ox"
2-
import type {
3-
Account,
4-
Assign,
5-
Chain,
6-
JsonRpcAccount,
7-
OneOf,
8-
PrivateKeyAccount,
9-
Transport,
10-
WalletClient
11-
} from "viem"
122
import {
3+
type Account,
134
type Address,
5+
type Assign,
6+
type Chain,
147
type Client,
8+
type JsonRpcAccount,
159
type LocalAccount,
10+
type OneOf,
11+
type PrivateKeyAccount,
12+
type Transport,
1613
type TypedDataDefinition,
14+
type WalletClient,
1715
concatHex,
1816
decodeFunctionData,
1917
encodeAbiParameters,

0 commit comments

Comments
 (0)