permissionless 0.0.31 → 0.0.32
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 +6 -0
- package/_cjs/actions/bundler/estimateUserOperationGas.js +21 -15
- package/_cjs/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_cjs/actions/bundler/sendUserOperation.js +14 -7
- package/_cjs/actions/bundler/sendUserOperation.js.map +1 -1
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/errors/account.js +311 -0
- package/_cjs/errors/account.js.map +1 -0
- package/_cjs/errors/bundler.js +61 -0
- package/_cjs/errors/bundler.js.map +1 -0
- package/_cjs/errors/estimateUserOperationGas.js +47 -0
- package/_cjs/errors/estimateUserOperationGas.js.map +1 -0
- package/_cjs/errors/gas.js +113 -0
- package/_cjs/errors/gas.js.map +1 -0
- package/_cjs/errors/index.js +35 -0
- package/_cjs/errors/index.js.map +1 -0
- package/_cjs/errors/paymaster.js +228 -0
- package/_cjs/errors/paymaster.js.map +1 -0
- package/_cjs/errors/sendUserOperation.js +47 -0
- package/_cjs/errors/sendUserOperation.js.map +1 -0
- package/_cjs/errors/utils.js +18 -0
- package/_cjs/errors/utils.js.map +1 -0
- package/_cjs/index.js +1 -0
- package/_cjs/index.js.map +1 -1
- package/_cjs/utils/errors/getBundlerError.js +124 -0
- package/_cjs/utils/errors/getBundlerError.js.map +1 -0
- package/_cjs/utils/errors/getEstimateUserOperationGasError.js +19 -0
- package/_cjs/utils/errors/getEstimateUserOperationGasError.js.map +1 -0
- package/_cjs/utils/errors/getSendUserOperationError.js +19 -0
- package/_cjs/utils/errors/getSendUserOperationError.js.map +1 -0
- package/_cjs/utils/getAddressFromInitCodeOrPaymasterAndData.js +15 -0
- package/_cjs/utils/getAddressFromInitCodeOrPaymasterAndData.js.map +1 -0
- package/_cjs/utils/index.js +3 -1
- package/_cjs/utils/index.js.map +1 -1
- package/_esm/actions/bundler/estimateUserOperationGas.js +22 -15
- package/_esm/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_esm/actions/bundler/sendUserOperation.js +14 -7
- package/_esm/actions/bundler/sendUserOperation.js.map +1 -1
- package/_esm/actions/index.js.map +1 -1
- package/_esm/errors/account.js +298 -0
- package/_esm/errors/account.js.map +1 -0
- package/_esm/errors/bundler.js +56 -0
- package/_esm/errors/bundler.js.map +1 -0
- package/_esm/errors/estimateUserOperationGas.js +43 -0
- package/_esm/errors/estimateUserOperationGas.js.map +1 -0
- package/_esm/errors/gas.js +106 -0
- package/_esm/errors/gas.js.map +1 -0
- package/_esm/errors/index.js +8 -0
- package/_esm/errors/index.js.map +1 -0
- package/_esm/errors/paymaster.js +218 -0
- package/_esm/errors/paymaster.js.map +1 -0
- package/_esm/errors/sendUserOperation.js +44 -0
- package/_esm/errors/sendUserOperation.js.map +1 -0
- package/_esm/errors/utils.js +14 -0
- package/_esm/errors/utils.js.map +1 -0
- package/_esm/index.js +1 -0
- package/_esm/index.js.map +1 -1
- package/_esm/utils/errors/getBundlerError.js +121 -0
- package/_esm/utils/errors/getBundlerError.js.map +1 -0
- package/_esm/utils/errors/getEstimateUserOperationGasError.js +19 -0
- package/_esm/utils/errors/getEstimateUserOperationGasError.js.map +1 -0
- package/_esm/utils/errors/getSendUserOperationError.js +15 -0
- package/_esm/utils/errors/getSendUserOperationError.js.map +1 -0
- package/_esm/utils/getAddressFromInitCodeOrPaymasterAndData.js +11 -0
- package/_esm/utils/getAddressFromInitCodeOrPaymasterAndData.js.map +1 -0
- package/_esm/utils/index.js +2 -1
- package/_esm/utils/index.js.map +1 -1
- package/_types/actions/bundler/estimateUserOperationGas.d.ts +3 -1
- package/_types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
- package/_types/actions/bundler/sendUserOperation.d.ts.map +1 -1
- package/_types/actions/index.d.ts +2 -2
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/errors/account.d.ts +121 -0
- package/_types/errors/account.d.ts.map +1 -0
- package/_types/errors/bundler.d.ts +24 -0
- package/_types/errors/bundler.d.ts.map +1 -0
- package/_types/errors/estimateUserOperationGas.d.ts +13 -0
- package/_types/errors/estimateUserOperationGas.d.ts.map +1 -0
- package/_types/errors/gas.d.ts +47 -0
- package/_types/errors/gas.d.ts.map +1 -0
- package/_types/errors/index.d.ts +8 -0
- package/_types/errors/index.d.ts.map +1 -0
- package/_types/errors/paymaster.d.ts +85 -0
- package/_types/errors/paymaster.d.ts.map +1 -0
- package/_types/errors/sendUserOperation.d.ts +13 -0
- package/_types/errors/sendUserOperation.d.ts.map +1 -0
- package/_types/errors/utils.d.ts +5 -0
- package/_types/errors/utils.d.ts.map +1 -0
- package/_types/index.d.ts +1 -0
- package/_types/index.d.ts.map +1 -1
- package/_types/utils/errors/getBundlerError.d.ts +11 -0
- package/_types/utils/errors/getBundlerError.d.ts.map +1 -0
- package/_types/utils/errors/getEstimateUserOperationGasError.d.ts +9 -0
- package/_types/utils/errors/getEstimateUserOperationGasError.d.ts.map +1 -0
- package/_types/utils/errors/getSendUserOperationError.d.ts +4 -0
- package/_types/utils/errors/getSendUserOperationError.d.ts.map +1 -0
- package/_types/utils/getAddressFromInitCodeOrPaymasterAndData.d.ts +3 -0
- package/_types/utils/getAddressFromInitCodeOrPaymasterAndData.d.ts.map +1 -0
- package/_types/utils/index.d.ts +2 -1
- package/_types/utils/index.d.ts.map +1 -1
- package/actions/bundler/estimateUserOperationGas.ts +33 -15
- package/actions/bundler/sendUserOperation.ts +26 -8
- package/actions/index.ts +3 -1
- package/errors/account.ts +345 -0
- package/errors/bundler.ts +62 -0
- package/errors/estimateUserOperationGas.ts +50 -0
- package/errors/gas.ts +120 -0
- package/errors/index.ts +118 -0
- package/errors/paymaster.ts +257 -0
- package/errors/sendUserOperation.ts +49 -0
- package/errors/utils.ts +19 -0
- package/index.ts +1 -0
- package/package.json +6 -1
- package/utils/errors/getBundlerError.ts +220 -0
- package/utils/errors/getEstimateUserOperationGasError.ts +37 -0
- package/utils/errors/getSendUserOperationError.ts +25 -0
- package/utils/getAddressFromInitCodeOrPaymasterAndData.ts +13 -0
- package/utils/index.ts +3 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseError, UnknownNodeError } from "viem"
|
|
2
|
+
import type { EstimateUserOperationGasParameters } from "../../actions/bundler/estimateUserOperationGas"
|
|
3
|
+
import {
|
|
4
|
+
EstimateUserOperationGasError,
|
|
5
|
+
type EstimateUserOperationGasErrorType
|
|
6
|
+
} from "../../errors/estimateUserOperationGas"
|
|
7
|
+
import { type ErrorType } from "../../errors/utils"
|
|
8
|
+
import {
|
|
9
|
+
type GetBundlerErrorParameters,
|
|
10
|
+
type GetBundlerErrorReturnType,
|
|
11
|
+
getBundlerError
|
|
12
|
+
} from "./getBundlerError"
|
|
13
|
+
|
|
14
|
+
export type GetEstimateUserOperationGasErrorReturnType<cause = ErrorType> =
|
|
15
|
+
Omit<EstimateUserOperationGasErrorType, "cause"> & {
|
|
16
|
+
cause: cause | GetBundlerErrorReturnType
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function getEstimateUserOperationGasError<err extends ErrorType<string>>(
|
|
20
|
+
error: err,
|
|
21
|
+
args: EstimateUserOperationGasParameters
|
|
22
|
+
) {
|
|
23
|
+
const cause = (() => {
|
|
24
|
+
const cause = getBundlerError(
|
|
25
|
+
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
26
|
+
error as {} as BaseError,
|
|
27
|
+
args as GetBundlerErrorParameters
|
|
28
|
+
)
|
|
29
|
+
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
30
|
+
if (cause instanceof UnknownNodeError) return error as {} as BaseError
|
|
31
|
+
return cause
|
|
32
|
+
})()
|
|
33
|
+
|
|
34
|
+
throw new EstimateUserOperationGasError(cause, {
|
|
35
|
+
...args
|
|
36
|
+
}) as GetEstimateUserOperationGasErrorReturnType<err>
|
|
37
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseError, UnknownNodeError } from "viem"
|
|
2
|
+
import type { SendUserOperationParameters } from "../../actions/bundler/sendUserOperation"
|
|
3
|
+
import { SendUserOperationError } from "../../errors"
|
|
4
|
+
import {
|
|
5
|
+
type GetBundlerErrorParameters,
|
|
6
|
+
getBundlerError
|
|
7
|
+
} from "./getBundlerError"
|
|
8
|
+
|
|
9
|
+
export function getSendUserOperationError(
|
|
10
|
+
err: BaseError,
|
|
11
|
+
args: SendUserOperationParameters
|
|
12
|
+
) {
|
|
13
|
+
const cause = (() => {
|
|
14
|
+
const cause = getBundlerError(
|
|
15
|
+
err as BaseError,
|
|
16
|
+
args as GetBundlerErrorParameters
|
|
17
|
+
)
|
|
18
|
+
if (cause instanceof UnknownNodeError) return err as BaseError
|
|
19
|
+
return cause
|
|
20
|
+
})()
|
|
21
|
+
|
|
22
|
+
throw new SendUserOperationError(cause, {
|
|
23
|
+
...args
|
|
24
|
+
})
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Address, type Hex, getAddress } from "viem"
|
|
2
|
+
|
|
3
|
+
export function getAddressFromInitCodeOrPaymasterAndData(
|
|
4
|
+
data: Hex
|
|
5
|
+
): Address | undefined {
|
|
6
|
+
if (!data) {
|
|
7
|
+
return undefined
|
|
8
|
+
}
|
|
9
|
+
if (data.length >= 42) {
|
|
10
|
+
return getAddress(data.slice(0, 42))
|
|
11
|
+
}
|
|
12
|
+
return undefined
|
|
13
|
+
}
|
package/utils/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Account, Address } from "viem"
|
|
2
2
|
import { deepHexlify, transactionReceiptStatus } from "./deepHexlify.js"
|
|
3
3
|
import { getAction } from "./getAction.js"
|
|
4
|
+
import { getAddressFromInitCodeOrPaymasterAndData } from "./getAddressFromInitCodeOrPaymasterAndData.js"
|
|
4
5
|
import {
|
|
5
6
|
type GetRequiredPrefundReturnType,
|
|
6
7
|
getRequiredPrefund
|
|
@@ -35,5 +36,6 @@ export {
|
|
|
35
36
|
signUserOperationHashWithECDSA,
|
|
36
37
|
type SignUserOperationHashWithECDSAParams,
|
|
37
38
|
AccountOrClientNotFoundError,
|
|
38
|
-
isSmartAccountDeployed
|
|
39
|
+
isSmartAccountDeployed,
|
|
40
|
+
getAddressFromInitCodeOrPaymasterAndData
|
|
39
41
|
}
|