permissionless 0.0.26 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/_cjs/accounts/biconomy/signerToBiconomySmartAccount.js +16 -13
- package/_cjs/accounts/biconomy/signerToBiconomySmartAccount.js.map +1 -1
- package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js +16 -13
- package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/signerToSafeSmartAccount.js +20 -17
- package/_cjs/accounts/signerToSafeSmartAccount.js.map +1 -1
- package/_cjs/accounts/signerToSimpleSmartAccount.js +15 -12
- package/_cjs/accounts/signerToSimpleSmartAccount.js.map +1 -1
- package/_cjs/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_cjs/actions/bundler/getUserOperationByHash.js.map +1 -1
- package/_cjs/actions/bundler/getUserOperationReceipt.js.map +1 -1
- package/_cjs/actions/bundler/sendUserOperation.js.map +1 -1
- package/_cjs/actions/bundler/waitForUserOperationReceipt.js.map +1 -1
- package/_cjs/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
- package/_cjs/actions/pimlico/getUserOperationStatus.js.map +1 -1
- package/_cjs/actions/pimlico/sponsorUserOperation.js.map +1 -1
- package/_cjs/actions/pimlico/validateSponsorshipPolicies.js.map +1 -1
- package/_cjs/actions/public/getAccountNonce.js +2 -1
- package/_cjs/actions/public/getAccountNonce.js.map +1 -1
- package/_cjs/actions/public/getSenderAddress.js +2 -1
- package/_cjs/actions/public/getSenderAddress.js.map +1 -1
- package/_cjs/actions/smartAccount/deployContract.js +4 -3
- package/_cjs/actions/smartAccount/deployContract.js.map +1 -1
- package/_cjs/actions/smartAccount/prepareUserOperationRequest.js.map +1 -1
- package/_cjs/actions/smartAccount/sendTransaction.js.map +1 -1
- package/_cjs/actions/smartAccount/sendTransactions.js.map +1 -1
- package/_cjs/actions/smartAccount/sendUserOperation.js +1 -2
- package/_cjs/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/_cjs/actions/smartAccount/signTypedData.js.map +1 -1
- package/_cjs/actions/smartAccount.js.map +1 -1
- package/_cjs/clients/createSmartAccountClient.js.map +1 -1
- package/_cjs/clients/decorators/bundler.js.map +1 -1
- package/_cjs/clients/decorators/pimlico.js.map +1 -1
- package/_cjs/clients/decorators/smartAccount.js +30 -28
- package/_cjs/clients/decorators/smartAccount.js.map +1 -1
- package/_cjs/utils/deepHexlify.js.map +1 -1
- package/_cjs/utils/index.js +3 -1
- package/_cjs/utils/index.js.map +1 -1
- package/_cjs/utils/isSmartAccountDeployed.js +15 -0
- package/_cjs/utils/isSmartAccountDeployed.js.map +1 -0
- package/_cjs/utils/observe.js.map +1 -1
- package/_cjs/utils/signUserOperationHashWithECDSA.js.map +1 -1
- package/_esm/accounts/biconomy/signerToBiconomySmartAccount.js +17 -14
- package/_esm/accounts/biconomy/signerToBiconomySmartAccount.js.map +1 -1
- package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js +17 -14
- package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/signerToSafeSmartAccount.js +21 -18
- package/_esm/accounts/signerToSafeSmartAccount.js.map +1 -1
- package/_esm/accounts/signerToSimpleSmartAccount.js +16 -13
- package/_esm/accounts/signerToSimpleSmartAccount.js.map +1 -1
- package/_esm/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_esm/actions/bundler/getUserOperationByHash.js.map +1 -1
- package/_esm/actions/bundler/getUserOperationReceipt.js.map +1 -1
- package/_esm/actions/bundler/sendUserOperation.js.map +1 -1
- package/_esm/actions/bundler/waitForUserOperationReceipt.js.map +1 -1
- package/_esm/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
- package/_esm/actions/pimlico/getUserOperationStatus.js.map +1 -1
- package/_esm/actions/pimlico/sponsorUserOperation.js.map +1 -1
- package/_esm/actions/pimlico/validateSponsorshipPolicies.js +1 -1
- package/_esm/actions/pimlico/validateSponsorshipPolicies.js.map +1 -1
- package/_esm/actions/public/getAccountNonce.js +2 -1
- package/_esm/actions/public/getAccountNonce.js.map +1 -1
- package/_esm/actions/public/getSenderAddress.js +2 -1
- package/_esm/actions/public/getSenderAddress.js.map +1 -1
- package/_esm/actions/smartAccount/deployContract.js +5 -5
- package/_esm/actions/smartAccount/deployContract.js.map +1 -1
- package/_esm/actions/smartAccount/prepareUserOperationRequest.js.map +1 -1
- package/_esm/actions/smartAccount/sendTransaction.js +1 -1
- package/_esm/actions/smartAccount/sendTransaction.js.map +1 -1
- package/_esm/actions/smartAccount/sendTransactions.js +1 -1
- package/_esm/actions/smartAccount/sendTransactions.js.map +1 -1
- package/_esm/actions/smartAccount/sendUserOperation.js +1 -2
- package/_esm/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/_esm/actions/smartAccount/signTypedData.js.map +1 -1
- package/_esm/actions/smartAccount.js.map +1 -1
- package/_esm/clients/createSmartAccountClient.js.map +1 -1
- package/_esm/clients/decorators/bundler.js.map +1 -1
- package/_esm/clients/decorators/pimlico.js +1 -1
- package/_esm/clients/decorators/pimlico.js.map +1 -1
- package/_esm/clients/decorators/smartAccount.js +30 -28
- package/_esm/clients/decorators/smartAccount.js.map +1 -1
- package/_esm/utils/deepHexlify.js.map +1 -1
- package/_esm/utils/index.js +2 -1
- package/_esm/utils/index.js.map +1 -1
- package/_esm/utils/isSmartAccountDeployed.js +11 -0
- package/_esm/utils/isSmartAccountDeployed.js.map +1 -0
- package/_esm/utils/observe.js.map +1 -1
- package/_esm/utils/signUserOperationHashWithECDSA.js.map +1 -1
- package/_types/accounts/biconomy/signerToBiconomySmartAccount.d.ts +2 -1
- package/_types/accounts/biconomy/signerToBiconomySmartAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/signerToEcdsaKernelSmartAccount.d.ts +2 -1
- package/_types/accounts/kernel/signerToEcdsaKernelSmartAccount.d.ts.map +1 -1
- package/_types/accounts/signerToSafeSmartAccount.d.ts +3 -2
- package/_types/accounts/signerToSafeSmartAccount.d.ts.map +1 -1
- package/_types/accounts/signerToSimpleSmartAccount.d.ts +2 -1
- package/_types/accounts/signerToSimpleSmartAccount.d.ts.map +1 -1
- package/_types/accounts/types.d.ts +3 -3
- package/_types/accounts/types.d.ts.map +1 -1
- package/_types/actions/bundler/estimateUserOperationGas.d.ts +2 -1
- package/_types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
- package/_types/actions/bundler/getUserOperationByHash.d.ts +3 -2
- package/_types/actions/bundler/getUserOperationByHash.d.ts.map +1 -1
- package/_types/actions/bundler/getUserOperationReceipt.d.ts +2 -1
- package/_types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -1
- package/_types/actions/bundler/sendUserOperation.d.ts +2 -1
- package/_types/actions/bundler/sendUserOperation.d.ts.map +1 -1
- package/_types/actions/bundler/waitForUserOperationReceipt.d.ts +2 -1
- package/_types/actions/bundler/waitForUserOperationReceipt.d.ts.map +1 -1
- package/_types/actions/pimlico/getUserOperationGasPrice.d.ts +2 -1
- package/_types/actions/pimlico/getUserOperationGasPrice.d.ts.map +1 -1
- package/_types/actions/pimlico/getUserOperationStatus.d.ts +2 -1
- package/_types/actions/pimlico/getUserOperationStatus.d.ts.map +1 -1
- package/_types/actions/pimlico/sponsorUserOperation.d.ts +2 -1
- package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -1
- package/_types/actions/pimlico/validateSponsorshipPolicies.d.ts +5 -4
- package/_types/actions/pimlico/validateSponsorshipPolicies.d.ts.map +1 -1
- package/_types/actions/pimlico.d.ts +2 -2
- package/_types/actions/pimlico.d.ts.map +1 -1
- package/_types/actions/public/getAccountNonce.d.ts +2 -1
- package/_types/actions/public/getAccountNonce.d.ts.map +1 -1
- package/_types/actions/public/getSenderAddress.d.ts +2 -1
- package/_types/actions/public/getSenderAddress.d.ts.map +1 -1
- package/_types/actions/smartAccount/deployContract.d.ts +4 -3
- package/_types/actions/smartAccount/deployContract.d.ts.map +1 -1
- package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts +2 -2
- package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts.map +1 -1
- package/_types/actions/smartAccount/sendTransaction.d.ts +4 -3
- package/_types/actions/smartAccount/sendTransaction.d.ts.map +1 -1
- package/_types/actions/smartAccount/sendTransactions.d.ts +4 -4
- package/_types/actions/smartAccount/sendTransactions.d.ts.map +1 -1
- package/_types/actions/smartAccount/sendUserOperation.d.ts +3 -4
- package/_types/actions/smartAccount/sendUserOperation.d.ts.map +1 -1
- package/_types/actions/smartAccount/writeContract.d.ts +3 -3
- package/_types/actions/smartAccount/writeContract.d.ts.map +1 -1
- package/_types/actions/smartAccount.d.ts +2 -2
- package/_types/actions/smartAccount.d.ts.map +1 -1
- package/_types/clients/createSmartAccountClient.d.ts +5 -3
- package/_types/clients/createSmartAccountClient.d.ts.map +1 -1
- package/_types/clients/decorators/bundler.d.ts +6 -5
- package/_types/clients/decorators/bundler.d.ts.map +1 -1
- package/_types/clients/decorators/pimlico.d.ts +7 -6
- package/_types/clients/decorators/pimlico.d.ts.map +1 -1
- package/_types/clients/decorators/smartAccount.d.ts +8 -7
- package/_types/clients/decorators/smartAccount.d.ts.map +1 -1
- package/_types/utils/index.d.ts +2 -1
- package/_types/utils/index.d.ts.map +1 -1
- package/_types/utils/isSmartAccountDeployed.d.ts +3 -0
- package/_types/utils/isSmartAccountDeployed.d.ts.map +1 -0
- package/accounts/biconomy/signerToBiconomySmartAccount.ts +25 -18
- package/accounts/kernel/signerToEcdsaKernelSmartAccount.ts +24 -13
- package/accounts/signerToSafeSmartAccount.ts +24 -18
- package/accounts/signerToSimpleSmartAccount.ts +25 -18
- package/accounts/types.ts +4 -3
- package/actions/bundler/estimateUserOperationGas.ts +3 -2
- package/actions/bundler/getUserOperationByHash.ts +4 -3
- package/actions/bundler/getUserOperationReceipt.ts +3 -2
- package/actions/bundler/sendUserOperation.ts +2 -1
- package/actions/bundler/waitForUserOperationReceipt.ts +3 -2
- package/actions/pimlico/getUserOperationGasPrice.ts +2 -1
- package/actions/pimlico/getUserOperationStatus.ts +3 -2
- package/actions/pimlico/sponsorUserOperation.ts +3 -2
- package/actions/pimlico/validateSponsorshipPolicies.ts +6 -5
- package/actions/pimlico.ts +2 -2
- package/actions/public/getAccountNonce.ts +4 -1
- package/actions/public/getSenderAddress.ts +4 -1
- package/actions/smartAccount/deployContract.ts +19 -15
- package/actions/smartAccount/prepareUserOperationRequest.ts +3 -2
- package/actions/smartAccount/sendTransaction.ts +6 -7
- package/actions/smartAccount/sendTransactions.ts +5 -5
- package/actions/smartAccount/sendUserOperation.ts +5 -12
- package/actions/smartAccount/writeContract.ts +3 -3
- package/actions/smartAccount.ts +0 -2
- package/clients/createSmartAccountClient.ts +10 -16
- package/clients/decorators/bundler.ts +12 -9
- package/clients/decorators/pimlico.ts +12 -9
- package/clients/decorators/smartAccount.ts +34 -25
- package/package.json +1 -1
- package/utils/index.ts +3 -1
- package/utils/isSmartAccountDeployed.ts +16 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Client, Hash } from "viem"
|
|
2
2
|
import {
|
|
3
|
+
type ValidateSponsorshipPolicies,
|
|
3
4
|
type ValidateSponsorshipPoliciesParameters,
|
|
4
|
-
type ValidateSponsorshipPoliciesReturnType,
|
|
5
5
|
validateSponsorshipPolicies
|
|
6
6
|
} from "../../actions/pimlico.js"
|
|
7
7
|
import {
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
type SponsorUserOperationReturnType,
|
|
19
19
|
sponsorUserOperation
|
|
20
20
|
} from "../../actions/pimlico/sponsorUserOperation.js"
|
|
21
|
+
import type { Prettify } from "../../types/index.js"
|
|
21
22
|
import type {
|
|
22
23
|
PimlicoBundlerClient,
|
|
23
24
|
PimlicoPaymasterClient
|
|
@@ -43,7 +44,9 @@ export type PimlicoBundlerActions = {
|
|
|
43
44
|
*
|
|
44
45
|
* await bundlerClient.getUserOperationGasPrice()
|
|
45
46
|
*/
|
|
46
|
-
getUserOperationGasPrice: () => Promise<
|
|
47
|
+
getUserOperationGasPrice: () => Promise<
|
|
48
|
+
Prettify<GetUserOperationGasPriceReturnType>
|
|
49
|
+
>
|
|
47
50
|
/**
|
|
48
51
|
* Returns the status of the userOperation that is pending in the mempool.
|
|
49
52
|
*
|
|
@@ -64,8 +67,8 @@ export type PimlicoBundlerActions = {
|
|
|
64
67
|
* await bundlerClient.getUserOperationStatus({ hash: userOpHash })
|
|
65
68
|
*/
|
|
66
69
|
getUserOperationStatus: (
|
|
67
|
-
args: GetUserOperationStatusParameters
|
|
68
|
-
) => Promise<GetUserOperationStatusReturnType
|
|
70
|
+
args: Prettify<GetUserOperationStatusParameters>
|
|
71
|
+
) => Promise<Prettify<GetUserOperationStatusReturnType>>
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
export const pimlicoBundlerActions = (
|
|
@@ -102,12 +105,12 @@ export type PimlicoPaymasterClientActions = {
|
|
|
102
105
|
*
|
|
103
106
|
*/
|
|
104
107
|
sponsorUserOperation: (
|
|
105
|
-
args: PimlicoSponsorUserOperationParameters
|
|
106
|
-
) => Promise<SponsorUserOperationReturnType
|
|
108
|
+
args: Prettify<PimlicoSponsorUserOperationParameters>
|
|
109
|
+
) => Promise<Prettify<SponsorUserOperationReturnType>>
|
|
107
110
|
|
|
108
111
|
validateSponsorshipPolicies: (
|
|
109
|
-
args: ValidateSponsorshipPoliciesParameters
|
|
110
|
-
) => Promise<
|
|
112
|
+
args: Prettify<ValidateSponsorshipPoliciesParameters>
|
|
113
|
+
) => Promise<Prettify<ValidateSponsorshipPolicies>[]>
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
/**
|
|
@@ -115,7 +118,7 @@ export type PimlicoPaymasterClientActions = {
|
|
|
115
118
|
* - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-paymaster-actions/ValidateSponsorshipPolicies
|
|
116
119
|
*
|
|
117
120
|
* @param args {@link ValidateSponsorshipPoliciesParameters} UserOperation you want to sponsor & entryPoint.
|
|
118
|
-
* @returns valid sponsorship policies, see {@link
|
|
121
|
+
* @returns valid sponsorship policies, see {@link ValidateSponsorshipPolicies}
|
|
119
122
|
*
|
|
120
123
|
* @example
|
|
121
124
|
* import { createClient } from "viem"
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
ContractFunctionArgs,
|
|
6
6
|
ContractFunctionName,
|
|
7
7
|
DeployContractParameters,
|
|
8
|
+
Hash,
|
|
8
9
|
SendTransactionParameters,
|
|
9
10
|
Transport,
|
|
10
11
|
TypedData,
|
|
@@ -30,7 +31,6 @@ import {
|
|
|
30
31
|
} from "../../actions/smartAccount/sendTransaction.js"
|
|
31
32
|
import {
|
|
32
33
|
type SendUserOperationParameters,
|
|
33
|
-
type SendUserOperationReturnType,
|
|
34
34
|
sendUserOperation
|
|
35
35
|
} from "../../actions/smartAccount/sendUserOperation.js"
|
|
36
36
|
import { signMessage } from "../../actions/smartAccount/signMessage.js"
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
type WriteContractWithPaymasterParameters,
|
|
40
40
|
writeContract
|
|
41
41
|
} from "../../actions/smartAccount/writeContract.js"
|
|
42
|
+
import type { Prettify } from "../../types/index.js"
|
|
42
43
|
|
|
43
44
|
export type SmartAccountActions<
|
|
44
45
|
TChain extends Chain | undefined = Chain | undefined,
|
|
@@ -279,11 +280,13 @@ export type SmartAccountActions<
|
|
|
279
280
|
const TAbi extends Abi | readonly unknown[],
|
|
280
281
|
TChainOverride extends Chain | undefined = undefined
|
|
281
282
|
>(
|
|
282
|
-
args:
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
283
|
+
args: Prettify<
|
|
284
|
+
DeployContractParameters<
|
|
285
|
+
TAbi,
|
|
286
|
+
TChain,
|
|
287
|
+
TSmartAccount,
|
|
288
|
+
TChainOverride
|
|
289
|
+
>
|
|
287
290
|
>
|
|
288
291
|
) => ReturnType<typeof deployContract<TChain, TSmartAccount>>
|
|
289
292
|
/**
|
|
@@ -366,19 +369,23 @@ export type SmartAccountActions<
|
|
|
366
369
|
>
|
|
367
370
|
>
|
|
368
371
|
prepareUserOperationRequest: <TTransport extends Transport>(
|
|
369
|
-
args:
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
372
|
+
args: Prettify<
|
|
373
|
+
Parameters<
|
|
374
|
+
typeof prepareUserOperationRequest<
|
|
375
|
+
TTransport,
|
|
376
|
+
TChain,
|
|
377
|
+
TSmartAccount
|
|
378
|
+
>
|
|
379
|
+
>[1]
|
|
380
|
+
>
|
|
381
|
+
) => Promise<Prettify<PrepareUserOperationRequestReturnType>>
|
|
377
382
|
sendUserOperation: <TTransport extends Transport>(
|
|
378
|
-
args:
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
383
|
+
args: Prettify<
|
|
384
|
+
Parameters<
|
|
385
|
+
typeof sendUserOperation<TTransport, TChain, TSmartAccount>
|
|
386
|
+
>[1]
|
|
387
|
+
>
|
|
388
|
+
) => Promise<Hash>
|
|
382
389
|
/**
|
|
383
390
|
* Creates, signs, and sends a new transaction to the network.
|
|
384
391
|
* This function also allows you to sponsor this transaction if sender is a smartAccount
|
|
@@ -429,13 +436,14 @@ export type SmartAccountActions<
|
|
|
429
436
|
* }])
|
|
430
437
|
*/
|
|
431
438
|
sendTransactions: (
|
|
432
|
-
args: SendTransactionsWithPaymasterParameters<TSmartAccount
|
|
439
|
+
args: Prettify<SendTransactionsWithPaymasterParameters<TSmartAccount>>
|
|
433
440
|
) => ReturnType<typeof sendTransactions<TChain, TSmartAccount>>
|
|
434
441
|
}
|
|
435
442
|
|
|
436
|
-
export
|
|
437
|
-
|
|
438
|
-
|
|
443
|
+
export function smartAccountActions({
|
|
444
|
+
sponsorUserOperation
|
|
445
|
+
}: SponsorUserOperationMiddleware) {
|
|
446
|
+
return <
|
|
439
447
|
TTransport extends Transport,
|
|
440
448
|
TChain extends Chain | undefined = Chain | undefined,
|
|
441
449
|
TSmartAccount extends SmartAccount | undefined =
|
|
@@ -458,17 +466,17 @@ export const smartAccountActions =
|
|
|
458
466
|
sendTransaction(client, {
|
|
459
467
|
...args,
|
|
460
468
|
sponsorUserOperation
|
|
461
|
-
} as SendTransactionWithPaymasterParameters),
|
|
469
|
+
} as SendTransactionWithPaymasterParameters<TChain, TSmartAccount>),
|
|
462
470
|
sendTransactions: (args) =>
|
|
463
471
|
sendTransactions(client, {
|
|
464
472
|
...args,
|
|
465
473
|
sponsorUserOperation
|
|
466
|
-
} as SendTransactionsWithPaymasterParameters),
|
|
474
|
+
} as SendTransactionsWithPaymasterParameters<TSmartAccount>),
|
|
467
475
|
sendUserOperation: (args) =>
|
|
468
476
|
sendUserOperation(client, {
|
|
469
477
|
...args,
|
|
470
478
|
sponsorUserOperation
|
|
471
|
-
} as SendUserOperationParameters),
|
|
479
|
+
} as SendUserOperationParameters<TSmartAccount>),
|
|
472
480
|
signMessage: (args) => signMessage(client, args),
|
|
473
481
|
signTypedData: (args) => signTypedData(client, args),
|
|
474
482
|
writeContract: (args) =>
|
|
@@ -477,3 +485,4 @@ export const smartAccountActions =
|
|
|
477
485
|
sponsorUserOperation
|
|
478
486
|
} as WriteContractWithPaymasterParameters<TChain, TSmartAccount>)
|
|
479
487
|
})
|
|
488
|
+
}
|
package/package.json
CHANGED
package/utils/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
type GetUserOperationHashParams,
|
|
10
10
|
getUserOperationHash
|
|
11
11
|
} from "./getUserOperationHash.js"
|
|
12
|
+
import { isSmartAccountDeployed } from "./isSmartAccountDeployed"
|
|
12
13
|
import {
|
|
13
14
|
AccountOrClientNotFoundError,
|
|
14
15
|
type SignUserOperationHashWithECDSAParams,
|
|
@@ -33,5 +34,6 @@ export {
|
|
|
33
34
|
type GetUserOperationHashParams,
|
|
34
35
|
signUserOperationHashWithECDSA,
|
|
35
36
|
type SignUserOperationHashWithECDSAParams,
|
|
36
|
-
AccountOrClientNotFoundError
|
|
37
|
+
AccountOrClientNotFoundError,
|
|
38
|
+
isSmartAccountDeployed
|
|
37
39
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Address, Client } from "viem"
|
|
2
|
+
import { getBytecode } from "viem/actions"
|
|
3
|
+
|
|
4
|
+
export const isSmartAccountDeployed = async (
|
|
5
|
+
client: Client,
|
|
6
|
+
address: Address
|
|
7
|
+
): Promise<boolean> => {
|
|
8
|
+
const contractCode = await getBytecode(client, {
|
|
9
|
+
address: address
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
if ((contractCode?.length ?? 0) > 2) {
|
|
13
|
+
return true
|
|
14
|
+
}
|
|
15
|
+
return false
|
|
16
|
+
}
|