permissionless 0.0.5 → 0.0.7
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 +13 -0
- package/_cjs/actions/bundler/chainId.js +11 -0
- package/_cjs/actions/bundler/chainId.js.map +1 -0
- package/_cjs/actions/bundler/estimateUserOperationGas.js +18 -0
- package/_cjs/actions/bundler/estimateUserOperationGas.js.map +1 -0
- package/_cjs/actions/bundler/getUserOperationByHash.js +30 -0
- package/_cjs/actions/bundler/getUserOperationByHash.js.map +1 -0
- package/_cjs/actions/bundler/getUserOperationReceipt.js +48 -0
- package/_cjs/actions/bundler/getUserOperationReceipt.js.map +1 -0
- package/_cjs/actions/bundler/sendUserOperation.js +13 -0
- package/_cjs/actions/bundler/sendUserOperation.js.map +1 -0
- package/_cjs/actions/bundler/supportedEntryPoints.js +11 -0
- package/_cjs/actions/bundler/supportedEntryPoints.js.map +1 -0
- package/_cjs/actions/index.js +18 -11
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/pimlico/getUserOperationGasPrice.js +25 -0
- package/_cjs/actions/pimlico/getUserOperationGasPrice.js.map +1 -0
- package/_cjs/actions/pimlico/getUserOperationStatus.js +11 -0
- package/_cjs/actions/pimlico/getUserOperationStatus.js.map +1 -0
- package/_cjs/actions/pimlico/sponsorUserOperation.js +18 -0
- package/_cjs/actions/pimlico/sponsorUserOperation.js.map +1 -0
- package/_cjs/actions/pimlico.js +10 -52
- package/_cjs/actions/pimlico.js.map +1 -1
- package/_cjs/actions/public/getAccountNonce.js +35 -0
- package/_cjs/actions/public/getAccountNonce.js.map +1 -0
- package/_cjs/actions/{public.js → public/getSenderAddress.js} +1 -1
- package/_cjs/actions/public/getSenderAddress.js.map +1 -0
- package/_cjs/actions/stackup/accounts.js +12 -0
- package/_cjs/actions/stackup/accounts.js.map +1 -0
- package/_cjs/actions/stackup/sponsorUserOperation.js +18 -0
- package/_cjs/actions/stackup/sponsorUserOperation.js.map +1 -0
- package/_cjs/actions/stackup.js +10 -0
- package/_cjs/actions/stackup.js.map +1 -0
- package/_cjs/clients/bundler.js +2 -2
- package/_cjs/clients/bundler.js.map +1 -1
- package/_cjs/clients/decorators/bundler.js +19 -0
- package/_cjs/clients/decorators/bundler.js.map +1 -0
- package/_cjs/clients/decorators/pimlico.js +16 -0
- package/_cjs/clients/decorators/pimlico.js.map +1 -0
- package/_cjs/clients/decorators/stackup.js +11 -0
- package/_cjs/clients/decorators/stackup.js.map +1 -0
- package/_cjs/clients/pimlico.js +4 -4
- package/_cjs/clients/pimlico.js.map +1 -1
- package/_cjs/clients/stackup.js +18 -0
- package/_cjs/clients/stackup.js.map +1 -0
- package/_cjs/index.js +24 -4
- package/_cjs/index.js.map +1 -1
- package/_cjs/types/stackup.js +3 -0
- package/_cjs/types/stackup.js.map +1 -0
- package/_cjs/utils/getUserOperationHash.js +38 -0
- package/_cjs/utils/getUserOperationHash.js.map +1 -0
- package/_cjs/utils/index.js +2 -34
- package/_cjs/utils/index.js.map +1 -1
- package/_esm/actions/bundler/chainId.js +29 -0
- package/_esm/actions/bundler/chainId.js.map +1 -0
- package/_esm/actions/bundler/estimateUserOperationGas.js +41 -0
- package/_esm/actions/bundler/estimateUserOperationGas.js.map +1 -0
- package/_esm/actions/bundler/getUserOperationByHash.js +48 -0
- package/_esm/actions/bundler/getUserOperationByHash.js.map +1 -0
- package/_esm/actions/bundler/getUserOperationReceipt.js +66 -0
- package/_esm/actions/bundler/getUserOperationReceipt.js.map +1 -0
- package/_esm/actions/bundler/sendUserOperation.js +36 -0
- package/_esm/actions/bundler/sendUserOperation.js.map +1 -0
- package/_esm/actions/bundler/supportedEntryPoints.js +29 -0
- package/_esm/actions/bundler/supportedEntryPoints.js.map +1 -0
- package/_esm/actions/index.js +9 -3
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/pimlico/getUserOperationGasPrice.js +42 -0
- package/_esm/actions/pimlico/getUserOperationGasPrice.js.map +1 -0
- package/_esm/actions/pimlico/getUserOperationStatus.js +29 -0
- package/_esm/actions/pimlico/getUserOperationStatus.js.map +1 -0
- package/_esm/actions/pimlico/sponsorUserOperation.js +39 -0
- package/_esm/actions/pimlico/sponsorUserOperation.js.map +1 -0
- package/_esm/actions/pimlico.js +5 -123
- package/_esm/actions/pimlico.js.map +1 -1
- package/_esm/actions/public/getAccountNonce.js +57 -0
- package/_esm/actions/public/getAccountNonce.js.map +1 -0
- package/_esm/actions/{public.js → public/getSenderAddress.js} +3 -3
- package/_esm/actions/public/getSenderAddress.js.map +1 -0
- package/_esm/actions/stackup/accounts.js +30 -0
- package/_esm/actions/stackup/accounts.js.map +1 -0
- package/_esm/actions/stackup/sponsorUserOperation.js +40 -0
- package/_esm/actions/stackup/sponsorUserOperation.js.map +1 -0
- package/_esm/actions/stackup.js +5 -0
- package/_esm/actions/stackup.js.map +1 -0
- package/_esm/clients/bundler.js +1 -1
- package/_esm/clients/bundler.js.map +1 -1
- package/_esm/clients/decorators/bundler.js +16 -0
- package/_esm/clients/decorators/bundler.js.map +1 -0
- package/_esm/clients/decorators/pimlico.js +20 -0
- package/_esm/clients/decorators/pimlico.js.map +1 -0
- package/_esm/clients/decorators/stackup.js +8 -0
- package/_esm/clients/decorators/stackup.js.map +1 -0
- package/_esm/clients/pimlico.js +2 -2
- package/_esm/clients/pimlico.js.map +1 -1
- package/_esm/clients/stackup.js +33 -0
- package/_esm/clients/stackup.js.map +1 -0
- package/_esm/index.js +15 -4
- package/_esm/index.js.map +1 -1
- package/_esm/types/stackup.js +2 -0
- package/_esm/types/stackup.js.map +1 -0
- package/_esm/utils/getUserOperationHash.js +55 -0
- package/_esm/utils/getUserOperationHash.js.map +1 -0
- package/_esm/utils/index.js +1 -54
- package/_esm/utils/index.js.map +1 -1
- package/_types/actions/bundler/chainId.d.ts +25 -0
- package/_types/actions/bundler/chainId.d.ts.map +1 -0
- package/_types/actions/bundler/estimateUserOperationGas.d.ts +42 -0
- package/_types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -0
- package/_types/actions/bundler/getUserOperationByHash.d.ts +37 -0
- package/_types/actions/bundler/getUserOperationByHash.d.ts.map +1 -0
- package/_types/actions/bundler/getUserOperationReceipt.d.ts +93 -0
- package/_types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -0
- package/_types/actions/bundler/sendUserOperation.d.ts +36 -0
- package/_types/actions/bundler/sendUserOperation.d.ts.map +1 -0
- package/_types/actions/bundler/supportedEntryPoints.d.ts +26 -0
- package/_types/actions/bundler/supportedEntryPoints.d.ts.map +1 -0
- package/_types/actions/index.d.ts +17 -6
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/pimlico/getUserOperationGasPrice.d.ts +38 -0
- package/_types/actions/pimlico/getUserOperationGasPrice.d.ts.map +1 -0
- package/_types/actions/pimlico/getUserOperationStatus.d.ts +31 -0
- package/_types/actions/pimlico/getUserOperationStatus.d.ts.map +1 -0
- package/_types/actions/pimlico/sponsorUserOperation.d.ts +41 -0
- package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -0
- package/_types/actions/pimlico.d.ts +7 -177
- package/_types/actions/pimlico.d.ts.map +1 -1
- package/_types/actions/public/getAccountNonce.d.ts +34 -0
- package/_types/actions/public/getAccountNonce.d.ts.map +1 -0
- package/_types/actions/{public.d.ts → public/getSenderAddress.d.ts} +4 -5
- package/_types/actions/public/getSenderAddress.d.ts.map +1 -0
- package/_types/actions/stackup/accounts.d.ts +29 -0
- package/_types/actions/stackup/accounts.d.ts.map +1 -0
- package/_types/actions/stackup/sponsorUserOperation.d.ts +43 -0
- package/_types/actions/stackup/sponsorUserOperation.d.ts.map +1 -0
- package/_types/actions/stackup.d.ts +7 -0
- package/_types/actions/stackup.d.ts.map +1 -0
- package/_types/clients/bundler.d.ts +2 -2
- package/_types/clients/bundler.d.ts.map +1 -1
- package/_types/clients/decorators/bundler.d.ts +150 -0
- package/_types/clients/decorators/bundler.d.ts.map +1 -0
- package/_types/clients/decorators/pimlico.d.ts +78 -0
- package/_types/clients/decorators/pimlico.d.ts.map +1 -0
- package/_types/clients/decorators/stackup.d.ts +54 -0
- package/_types/clients/decorators/stackup.d.ts.map +1 -0
- package/_types/clients/pimlico.d.ts +3 -3
- package/_types/clients/pimlico.d.ts.map +1 -1
- package/_types/clients/stackup.d.ts +39 -0
- package/_types/clients/stackup.d.ts.map +1 -0
- package/_types/index.d.ts +26 -4
- package/_types/index.d.ts.map +1 -1
- package/_types/types/bundler.d.ts +1 -1
- package/_types/types/bundler.d.ts.map +1 -1
- package/_types/types/index.d.ts +1 -1
- package/_types/types/index.d.ts.map +1 -1
- package/_types/types/pimlico.d.ts +1 -1
- package/_types/types/pimlico.d.ts.map +1 -1
- package/_types/types/stackup.d.ts +35 -0
- package/_types/types/stackup.d.ts.map +1 -0
- package/_types/utils/getUserOperationHash.d.ts +30 -0
- package/_types/utils/getUserOperationHash.d.ts.map +1 -0
- package/_types/utils/index.d.ts +2 -30
- package/_types/utils/index.d.ts.map +1 -1
- package/actions/bundler/chainId.ts +32 -0
- package/actions/bundler/estimateUserOperationGas.ts +62 -0
- package/actions/bundler/getUserOperationByHash.ts +69 -0
- package/actions/bundler/getUserOperationReceipt.ts +109 -0
- package/actions/bundler/sendUserOperation.ts +45 -0
- package/actions/bundler/supportedEntryPoints.ts +31 -0
- package/actions/index.ts +23 -21
- package/actions/pimlico/getUserOperationGasPrice.ts +61 -0
- package/actions/pimlico/getUserOperationStatus.ts +41 -0
- package/actions/pimlico/sponsorUserOperation.ts +62 -0
- package/actions/pimlico.ts +34 -251
- package/actions/public/getAccountNonce.ts +63 -0
- package/actions/{public.ts → public/getSenderAddress.ts} +9 -9
- package/actions/stackup/accounts.ts +40 -0
- package/actions/stackup/sponsorUserOperation.ts +64 -0
- package/actions/stackup.ts +17 -0
- package/clients/bundler.ts +2 -3
- package/clients/decorators/bundler.ts +178 -0
- package/clients/decorators/pimlico.ts +107 -0
- package/clients/decorators/stackup.ts +65 -0
- package/clients/pimlico.ts +3 -4
- package/clients/stackup.ts +44 -0
- package/index.ts +62 -4
- package/package.json +11 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/bundler.ts +1 -1
- package/types/index.ts +1 -1
- package/types/pimlico.ts +1 -1
- package/types/stackup.ts +36 -0
- package/utils/getUserOperationHash.ts +68 -0
- package/utils/index.ts +2 -69
- package/_cjs/actions/bundler.js +0 -118
- package/_cjs/actions/bundler.js.map +0 -1
- package/_cjs/actions/public.js.map +0 -1
- package/_cjs/clients/index.js +0 -6
- package/_cjs/clients/index.js.map +0 -1
- package/_esm/actions/bundler.js +0 -251
- package/_esm/actions/bundler.js.map +0 -1
- package/_esm/actions/public.js.map +0 -1
- package/_esm/clients/index.js +0 -3
- package/_esm/clients/index.js.map +0 -1
- package/_types/actions/bundler.d.ts +0 -393
- package/_types/actions/bundler.d.ts.map +0 -1
- package/_types/actions/public.d.ts.map +0 -1
- package/_types/clients/index.d.ts +0 -3
- package/_types/clients/index.d.ts.map +0 -1
- package/actions/bundler.ts +0 -498
- package/clients/index.ts +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address, Hash, Hex } from "viem";
|
|
2
2
|
import type { PartialBy } from "viem/types/utils";
|
|
3
|
-
import type { UserOperationWithBigIntAsHex } from "./userOperation";
|
|
3
|
+
import type { UserOperationWithBigIntAsHex } from "./userOperation.js";
|
|
4
4
|
type PimlicoUserOperationGasPriceWithBigIntAsHex = {
|
|
5
5
|
slow: {
|
|
6
6
|
maxFeePerGas: Hex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pimlico.d.ts","sourceRoot":"","sources":["../../types/pimlico.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pimlico.d.ts","sourceRoot":"","sources":["../../types/pimlico.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAA;AAEtE,KAAK,2CAA2C,GAAG;IAC/C,IAAI,EAAE;QACF,YAAY,EAAE,GAAG,CAAA;QACjB,oBAAoB,EAAE,GAAG,CAAA;KAC5B,CAAA;IACD,QAAQ,EAAE;QACN,YAAY,EAAE,GAAG,CAAA;QACjB,oBAAoB,EAAE,GAAG,CAAA;KAC5B,CAAA;IACD,IAAI,EAAE;QACF,YAAY,EAAE,GAAG,CAAA;QACjB,oBAAoB,EAAE,GAAG,CAAA;KAC5B,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,MAAM,EAAE,WAAW,GAAG,eAAe,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAA;IACrG,eAAe,EAAE,IAAI,GAAG,IAAI,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IAClC;QACI,MAAM,EAAE,kCAAkC,CAAA;QAC1C,UAAU,EAAE,EAAE,CAAA;QACd,UAAU,EAAE,2CAA2C,CAAA;KAC1D;IACD;QACI,MAAM,EAAE,gCAAgC,CAAA;QACxC,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QACxB,UAAU,EAAE,0BAA0B,CAAA;KACzC;CACJ,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACpC;QACI,MAAM,EAAE,yBAAyB,CAAA;QACjC,UAAU,EAAE;YACR,aAAa,EAAE,SAAS,CACpB,4BAA4B,EAC5B,cAAc,GAAG,oBAAoB,GAAG,sBAAsB,GAAG,kBAAkB,CACtF;YACD,UAAU,EAAE,OAAO;SACtB,CAAA;QACD,UAAU,EAAE;YACR,gBAAgB,EAAE,GAAG,CAAA;YACrB,kBAAkB,EAAE,GAAG,CAAA;YACvB,oBAAoB,EAAE,GAAG,CAAA;YACzB,YAAY,EAAE,GAAG,CAAA;SACpB,CAAA;KACJ;CACJ,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
import type { PartialBy } from "viem/types/utils";
|
|
3
|
+
import type { UserOperationWithBigIntAsHex } from "./userOperation.js";
|
|
4
|
+
interface StackupPaymasterContextType {
|
|
5
|
+
type: "erc20token" | "payg";
|
|
6
|
+
}
|
|
7
|
+
export type StackupPaymasterContext = (StackupPaymasterContextType & {
|
|
8
|
+
type: "erc20token";
|
|
9
|
+
token: string;
|
|
10
|
+
}) | (StackupPaymasterContextType & {
|
|
11
|
+
type: "payg";
|
|
12
|
+
});
|
|
13
|
+
export type StackupPaymasterRpcSchema = [
|
|
14
|
+
{
|
|
15
|
+
Method: "pm_sponsorUserOperation";
|
|
16
|
+
Parameters: [
|
|
17
|
+
userOperation: PartialBy<UserOperationWithBigIntAsHex, "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "paymasterAndData">,
|
|
18
|
+
entryPoint: Address,
|
|
19
|
+
context: StackupPaymasterContext
|
|
20
|
+
];
|
|
21
|
+
ReturnType: {
|
|
22
|
+
paymasterAndData: Hex;
|
|
23
|
+
preVerificationGas: Hex;
|
|
24
|
+
verificationGasLimit: Hex;
|
|
25
|
+
callGasLimit: Hex;
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
Method: "pm_accounts";
|
|
30
|
+
Parameters: [entryPoint: Address];
|
|
31
|
+
ReturnType: Address[];
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=stackup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stackup.d.ts","sourceRoot":"","sources":["../../types/stackup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAA;AAEtE,UAAU,2BAA2B;IACjC,IAAI,EAAE,YAAY,GAAG,MAAM,CAAA;CAC9B;AAED,MAAM,MAAM,uBAAuB,GAC7B,CAAC,2BAA2B,GAAG;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GACrE,CAAC,2BAA2B,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAEtD,MAAM,MAAM,yBAAyB,GAAG;IACpC;QACI,MAAM,EAAE,yBAAyB,CAAA;QACjC,UAAU,EAAE;YACR,aAAa,EAAE,SAAS,CACpB,4BAA4B,EAC5B,cAAc,GAAG,oBAAoB,GAAG,sBAAsB,GAAG,kBAAkB,CACtF;YACD,UAAU,EAAE,OAAO;YACnB,OAAO,EAAE,uBAAuB;SACnC,CAAA;QACD,UAAU,EAAE;YACR,gBAAgB,EAAE,GAAG,CAAA;YACrB,kBAAkB,EAAE,GAAG,CAAA;YACvB,oBAAoB,EAAE,GAAG,CAAA;YACzB,YAAY,EAAE,GAAG,CAAA;SACpB,CAAA;KACJ;IACD;QACI,MAAM,EAAE,aAAa,CAAA;QACrB,UAAU,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QACjC,UAAU,EAAE,OAAO,EAAE,CAAA;KACxB;CACJ,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Address, Hash } from "viem";
|
|
2
|
+
import type { UserOperation } from "../types/userOperation.js";
|
|
3
|
+
export type GetUserOperationHashParams = {
|
|
4
|
+
userOperation: UserOperation;
|
|
5
|
+
entryPoint: Address;
|
|
6
|
+
chainId: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* Returns user operation hash that is a unique identifier of the user operation.
|
|
11
|
+
*
|
|
12
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/utils/getUserOperationHash
|
|
13
|
+
*
|
|
14
|
+
* @param args: userOperation, entryPoint, chainId as {@link GetUserOperationHashParams}
|
|
15
|
+
* @returns userOperationHash as {@link Hash}
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* import { getUserOperationHash } from "permissionless/utils"
|
|
19
|
+
*
|
|
20
|
+
* const userOperationHash = getUserOperationHash({
|
|
21
|
+
* userOperation,
|
|
22
|
+
* entryPoint,
|
|
23
|
+
* chainId
|
|
24
|
+
* })
|
|
25
|
+
*
|
|
26
|
+
* // Returns "0xe9fad2cd67f9ca1d0b7a6513b2a42066784c8df938518da2b51bb8cc9a89ea34"
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export declare const getUserOperationHash: ({ userOperation, entryPoint, chainId }: GetUserOperationHashParams) => Hash;
|
|
30
|
+
//# sourceMappingURL=getUserOperationHash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserOperationHash.d.ts","sourceRoot":"","sources":["../../utils/getUserOperationHash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAO,MAAM,MAAM,CAAA;AAE9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAmC9D,MAAM,MAAM,0BAA0B,GAAG;IAAE,aAAa,EAAE,aAAa,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/G;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,oBAAoB,2CAA4C,0BAA0B,KAAG,IAOzG,CAAA"}
|
package/_types/utils/index.d.ts
CHANGED
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
export type GetUserOperationHashParams = {
|
|
4
|
-
userOperation: UserOperation;
|
|
5
|
-
entryPoint: Address;
|
|
6
|
-
chainId: number;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* Returns user operation hash that is a unique identifier of the user operation.
|
|
11
|
-
*
|
|
12
|
-
* - Docs: https://docs.pimlico.io/permissionless/reference/utils/getUserOperationHash
|
|
13
|
-
*
|
|
14
|
-
* @param args: userOperation, entryPoint, chainId as {@link GetUserOperationHashParams}
|
|
15
|
-
* @returns userOperationHash as {@link Hash}
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* import { getUserOperationHash } from "permissionless/utils"
|
|
19
|
-
*
|
|
20
|
-
* const userOperationHash = getUserOperationHash({
|
|
21
|
-
* userOperation,
|
|
22
|
-
* entryPoint,
|
|
23
|
-
* chainId
|
|
24
|
-
* })
|
|
25
|
-
*
|
|
26
|
-
* // Returns "0xe9fad2cd67f9ca1d0b7a6513b2a42066784c8df938518da2b51bb8cc9a89ea34"
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
declare const getUserOperationHash: ({ userOperation, entryPoint, chainId }: GetUserOperationHashParams) => Hash;
|
|
30
|
-
export { getUserOperationHash };
|
|
1
|
+
import { type GetUserOperationHashParams, getUserOperationHash } from "./getUserOperationHash.js";
|
|
2
|
+
export { getUserOperationHash, type GetUserOperationHashParams };
|
|
31
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAEjG,OAAO,EAAE,oBAAoB,EAAE,KAAK,0BAA0B,EAAE,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { BundlerClient } from "../../clients/bundler.js"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns the supported chain id by the bundler service
|
|
5
|
+
*
|
|
6
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/chainId
|
|
7
|
+
*
|
|
8
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
9
|
+
* @returns Supported chain id
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* import { createClient } from "viem"
|
|
14
|
+
* import { chainId } from "permissionless/actions"
|
|
15
|
+
*
|
|
16
|
+
* const bundlerClient = createClient({
|
|
17
|
+
* chain: goerli,
|
|
18
|
+
* transport: http(BUNDLER_URL)
|
|
19
|
+
* })
|
|
20
|
+
*
|
|
21
|
+
* const bundlerChainId = chainId(bundlerClient)
|
|
22
|
+
* // Return 5n for Goerli
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
export const chainId = async (client: BundlerClient) => {
|
|
26
|
+
return Number(
|
|
27
|
+
await client.request({
|
|
28
|
+
method: "eth_chainId",
|
|
29
|
+
params: []
|
|
30
|
+
})
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Address } from "viem"
|
|
2
|
+
import type { PartialBy } from "viem/types/utils"
|
|
3
|
+
import type { BundlerClient } from "../../clients/bundler.js"
|
|
4
|
+
import type { UserOperation } from "../../types/userOperation.js"
|
|
5
|
+
import type { UserOperationWithBigIntAsHex } from "../../types/userOperation.js"
|
|
6
|
+
import { deepHexlify } from "../utils.js"
|
|
7
|
+
|
|
8
|
+
export type EstimateUserOperationGasParameters = {
|
|
9
|
+
userOperation: PartialBy<UserOperation, "callGasLimit" | "preVerificationGas" | "verificationGasLimit">
|
|
10
|
+
entryPoint: Address
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type EstimateUserOperationGasReturnType = {
|
|
14
|
+
preVerificationGas: bigint
|
|
15
|
+
verificationGasLimit: bigint
|
|
16
|
+
callGasLimit: bigint
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Estimates preVerificationGas, verificationGasLimit and callGasLimit for user operation
|
|
21
|
+
*
|
|
22
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/estimateUserOperationGas
|
|
23
|
+
*
|
|
24
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
25
|
+
* @param args {@link EstimateUserOperationGasParameters}
|
|
26
|
+
* @returns preVerificationGas, verificationGasLimit and callGasLimit as {@link EstimateUserOperationGasReturnType}
|
|
27
|
+
*
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* import { createClient } from "viem"
|
|
31
|
+
* import { estimateUserOperationGas } from "permissionless/actions"
|
|
32
|
+
*
|
|
33
|
+
* const bundlerClient = createClient({
|
|
34
|
+
* chain: goerli,
|
|
35
|
+
* transport: http(BUNDLER_URL)
|
|
36
|
+
* })
|
|
37
|
+
*
|
|
38
|
+
* const gasParameters = estimateUserOperationGas(bundlerClient, {
|
|
39
|
+
* serOperation: signedUserOperation,
|
|
40
|
+
* entryPoint: entryPoint
|
|
41
|
+
* })
|
|
42
|
+
*
|
|
43
|
+
* // Return {preVerificationGas: 43492n, verificationGasLimit: 59436n, callGasLimit: 9000n}
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
export const estimateUserOperationGas = async (
|
|
47
|
+
client: BundlerClient,
|
|
48
|
+
args: EstimateUserOperationGasParameters
|
|
49
|
+
): Promise<EstimateUserOperationGasReturnType> => {
|
|
50
|
+
const { userOperation, entryPoint } = args
|
|
51
|
+
|
|
52
|
+
const response = await client.request({
|
|
53
|
+
method: "eth_estimateUserOperationGas",
|
|
54
|
+
params: [deepHexlify(userOperation) as UserOperationWithBigIntAsHex, entryPoint as Address]
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
preVerificationGas: BigInt(response.preVerificationGas || 0),
|
|
59
|
+
verificationGasLimit: BigInt(response.verificationGasLimit || 0),
|
|
60
|
+
callGasLimit: BigInt(response.callGasLimit || 0)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Address, Hash } from "viem"
|
|
2
|
+
import type { BundlerClient } from "../../clients/bundler.js"
|
|
3
|
+
import type { UserOperation } from "../../types/userOperation.js"
|
|
4
|
+
|
|
5
|
+
export type GetUserOperationByHashParameters = {
|
|
6
|
+
hash: Hash
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type GetUserOperationByHashReturnType = {
|
|
10
|
+
userOperation: UserOperation
|
|
11
|
+
entryPoint: Address
|
|
12
|
+
transactionHash: Hash
|
|
13
|
+
blockHash: Hash
|
|
14
|
+
blockNumber: bigint
|
|
15
|
+
} | null
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Returns the user operation from userOpHash
|
|
19
|
+
*
|
|
20
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/getUserOperationByHash
|
|
21
|
+
*
|
|
22
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
23
|
+
* @param args {@link GetUserOperationByHashParameters} UserOpHash that was returned by {@link sendUserOperation}
|
|
24
|
+
* @returns userOperation along with entryPoint, transactionHash, blockHash, blockNumber if found or null
|
|
25
|
+
*
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* import { createClient } from "viem"
|
|
29
|
+
* import { getUserOperationByHash } from "permissionless/actions"
|
|
30
|
+
*
|
|
31
|
+
* const bundlerClient = createClient({
|
|
32
|
+
* chain: goerli,
|
|
33
|
+
* transport: http(BUNDLER_URL)
|
|
34
|
+
* })
|
|
35
|
+
*
|
|
36
|
+
* getUserOperationByHash(bundlerClient, {hash: userOpHash})
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
export const getUserOperationByHash = async (
|
|
40
|
+
client: BundlerClient,
|
|
41
|
+
{ hash }: GetUserOperationByHashParameters
|
|
42
|
+
): Promise<GetUserOperationByHashReturnType> => {
|
|
43
|
+
const params: [Hash] = [hash]
|
|
44
|
+
|
|
45
|
+
const response = await client.request({
|
|
46
|
+
method: "eth_getUserOperationByHash",
|
|
47
|
+
params
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
if (!response) return null
|
|
51
|
+
|
|
52
|
+
const { userOperation, entryPoint, transactionHash, blockHash, blockNumber } = response
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
userOperation: {
|
|
56
|
+
...userOperation,
|
|
57
|
+
nonce: BigInt(userOperation.nonce),
|
|
58
|
+
callGasLimit: BigInt(userOperation.callGasLimit),
|
|
59
|
+
verificationGasLimit: BigInt(userOperation.verificationGasLimit),
|
|
60
|
+
preVerificationGas: BigInt(userOperation.preVerificationGas),
|
|
61
|
+
maxFeePerGas: BigInt(userOperation.maxFeePerGas),
|
|
62
|
+
maxPriorityFeePerGas: BigInt(userOperation.maxPriorityFeePerGas)
|
|
63
|
+
} as UserOperation,
|
|
64
|
+
entryPoint: entryPoint,
|
|
65
|
+
transactionHash: transactionHash,
|
|
66
|
+
blockHash: blockHash,
|
|
67
|
+
blockNumber: BigInt(blockNumber)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { Address, Hash, Hex } from "viem"
|
|
2
|
+
import type { BundlerClient } from "../../clients/bundler.js"
|
|
3
|
+
import type { TStatus } from "../../types/userOperation.js"
|
|
4
|
+
import { transactionReceiptStatus } from "../utils.js"
|
|
5
|
+
|
|
6
|
+
export type GetUserOperationReceiptParameters = {
|
|
7
|
+
hash: Hash
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type GetUserOperationReceiptReturnType = {
|
|
11
|
+
userOpHash: Hash
|
|
12
|
+
sender: Address
|
|
13
|
+
nonce: bigint
|
|
14
|
+
actualGasUsed: bigint
|
|
15
|
+
actualGasCost: bigint
|
|
16
|
+
success: boolean
|
|
17
|
+
receipt: {
|
|
18
|
+
transactionHash: Hex
|
|
19
|
+
transactionIndex: bigint
|
|
20
|
+
blockHash: Hash
|
|
21
|
+
blockNumber: bigint
|
|
22
|
+
from: Address
|
|
23
|
+
to: Address | null
|
|
24
|
+
cumulativeGasUsed: bigint
|
|
25
|
+
status: TStatus
|
|
26
|
+
gasUsed: bigint
|
|
27
|
+
contractAddress: Address | null
|
|
28
|
+
logsBloom: Hex
|
|
29
|
+
effectiveGasPrice: bigint
|
|
30
|
+
}
|
|
31
|
+
logs: {
|
|
32
|
+
data: Hex
|
|
33
|
+
blockNumber: bigint
|
|
34
|
+
blockHash: Hash
|
|
35
|
+
transactionHash: Hash
|
|
36
|
+
logIndex: bigint
|
|
37
|
+
transactionIndex: bigint
|
|
38
|
+
address: Address
|
|
39
|
+
topics: Hex[]
|
|
40
|
+
}[]
|
|
41
|
+
} | null
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Returns the user operation receipt from userOpHash
|
|
45
|
+
*
|
|
46
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/getUserOperationReceipt
|
|
47
|
+
*
|
|
48
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
49
|
+
* @param args {@link GetUserOperationReceiptParameters} UserOpHash that was returned by {@link sendUserOperation}
|
|
50
|
+
* @returns user operation receipt {@link GetUserOperationReceiptReturnType} if found or null
|
|
51
|
+
*
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* import { createClient } from "viem"
|
|
55
|
+
* import { getUserOperationReceipt } from "permissionless/actions"
|
|
56
|
+
*
|
|
57
|
+
* const bundlerClient = createClient({
|
|
58
|
+
* chain: goerli,
|
|
59
|
+
* transport: http(BUNDLER_URL)
|
|
60
|
+
* })
|
|
61
|
+
*
|
|
62
|
+
* getUserOperationReceipt(bundlerClient, {hash: userOpHash})
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
export const getUserOperationReceipt = async (client: BundlerClient, { hash }: GetUserOperationReceiptParameters) => {
|
|
66
|
+
const params: [Hash] = [hash]
|
|
67
|
+
|
|
68
|
+
const response = await client.request({
|
|
69
|
+
method: "eth_getUserOperationReceipt",
|
|
70
|
+
params
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
if (!response) return null
|
|
74
|
+
|
|
75
|
+
const userOperationReceipt: GetUserOperationReceiptReturnType = {
|
|
76
|
+
userOpHash: response.userOpHash,
|
|
77
|
+
sender: response.sender,
|
|
78
|
+
nonce: BigInt(response.nonce),
|
|
79
|
+
actualGasUsed: BigInt(response.actualGasUsed),
|
|
80
|
+
actualGasCost: BigInt(response.actualGasCost),
|
|
81
|
+
success: response.success,
|
|
82
|
+
receipt: {
|
|
83
|
+
transactionHash: response.receipt.transactionHash,
|
|
84
|
+
transactionIndex: BigInt(response.receipt.transactionIndex),
|
|
85
|
+
blockHash: response.receipt.blockHash,
|
|
86
|
+
blockNumber: BigInt(response.receipt.blockNumber),
|
|
87
|
+
from: response.receipt.from,
|
|
88
|
+
to: response.receipt.to,
|
|
89
|
+
cumulativeGasUsed: BigInt(response.receipt.cumulativeGasUsed),
|
|
90
|
+
status: transactionReceiptStatus[response.receipt.status],
|
|
91
|
+
gasUsed: BigInt(response.receipt.gasUsed),
|
|
92
|
+
contractAddress: response.receipt.contractAddress,
|
|
93
|
+
logsBloom: response.receipt.logsBloom,
|
|
94
|
+
effectiveGasPrice: BigInt(response.receipt.effectiveGasPrice)
|
|
95
|
+
},
|
|
96
|
+
logs: response.logs.map((log) => ({
|
|
97
|
+
data: log.data,
|
|
98
|
+
blockNumber: BigInt(log.blockNumber),
|
|
99
|
+
blockHash: log.blockHash,
|
|
100
|
+
transactionHash: log.transactionHash,
|
|
101
|
+
logIndex: BigInt(log.logIndex),
|
|
102
|
+
transactionIndex: BigInt(log.transactionIndex),
|
|
103
|
+
address: log.address,
|
|
104
|
+
topics: log.topics
|
|
105
|
+
}))
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return userOperationReceipt
|
|
109
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Address, Hash } from "viem"
|
|
2
|
+
import type { BundlerClient } from "../../clients/bundler.js"
|
|
3
|
+
import type { UserOperation, UserOperationWithBigIntAsHex } from "../../types/userOperation.js"
|
|
4
|
+
import { deepHexlify } from "../utils.js"
|
|
5
|
+
|
|
6
|
+
export type SendUserOperationParameters = {
|
|
7
|
+
userOperation: UserOperation
|
|
8
|
+
entryPoint: Address
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Sends user operation to the bundler
|
|
13
|
+
*
|
|
14
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/sendUserOperation
|
|
15
|
+
*
|
|
16
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
17
|
+
* @param args {@link SendUserOperationParameters}.
|
|
18
|
+
* @returns UserOpHash that you can use to track user operation as {@link Hash}.
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* import { createClient } from "viem"
|
|
23
|
+
* import { sendUserOperation } from "permissionless/actions"
|
|
24
|
+
*
|
|
25
|
+
* const bundlerClient = createClient({
|
|
26
|
+
* chain: goerli,
|
|
27
|
+
* transport: http(BUNDLER_URL)
|
|
28
|
+
* })
|
|
29
|
+
*
|
|
30
|
+
* const userOpHash = sendUserOperation(bundlerClient, {
|
|
31
|
+
* userOperation: signedUserOperation,
|
|
32
|
+
* entryPoint: entryPoint
|
|
33
|
+
* })
|
|
34
|
+
*
|
|
35
|
+
* // Return '0xe9fad2cd67f9ca1d0b7a6513b2a42066784c8df938518da2b51bb8cc9a89ea34'
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
export const sendUserOperation = async (client: BundlerClient, args: SendUserOperationParameters): Promise<Hash> => {
|
|
39
|
+
const { userOperation, entryPoint } = args
|
|
40
|
+
|
|
41
|
+
return client.request({
|
|
42
|
+
method: "eth_sendUserOperation",
|
|
43
|
+
params: [deepHexlify(userOperation) as UserOperationWithBigIntAsHex, entryPoint as Address]
|
|
44
|
+
})
|
|
45
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Address } from "viem"
|
|
2
|
+
import type { BundlerClient } from "../../clients/bundler.js"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Returns the supported entrypoints by the bundler service
|
|
6
|
+
*
|
|
7
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/supportedEntryPoints
|
|
8
|
+
*
|
|
9
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
10
|
+
* @returns Supported entryPoints
|
|
11
|
+
*
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* import { createClient } from "viem"
|
|
15
|
+
* import { supportedEntryPoints } from "permissionless/actions"
|
|
16
|
+
*
|
|
17
|
+
* const bundlerClient = createClient({
|
|
18
|
+
* chain: goerli,
|
|
19
|
+
* transport: http(BUNDLER_URL)
|
|
20
|
+
* })
|
|
21
|
+
*
|
|
22
|
+
* const entryPointsSupported = supportedEntryPoints(bundlerClient)
|
|
23
|
+
* // Return ['0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789']
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
export const supportedEntryPoints = async (client: BundlerClient): Promise<Address[]> => {
|
|
27
|
+
return client.request({
|
|
28
|
+
method: "eth_supportedEntryPoints",
|
|
29
|
+
params: []
|
|
30
|
+
})
|
|
31
|
+
}
|
package/actions/index.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
EstimateUserOperationGasParameters,
|
|
3
|
-
EstimateUserOperationGasReturnType
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
EstimateUserOperationGasReturnType
|
|
4
|
+
} from "./bundler/estimateUserOperationGas.js"
|
|
5
|
+
import type { GetUserOperationByHashParameters } from "./bundler/getUserOperationByHash.js"
|
|
6
|
+
import type { GetUserOperationByHashReturnType } from "./bundler/getUserOperationByHash.js"
|
|
7
|
+
import type {
|
|
6
8
|
GetUserOperationReceiptParameters,
|
|
7
|
-
GetUserOperationReceiptReturnType
|
|
8
|
-
|
|
9
|
-
} from "./bundler"
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
bundlerActions,
|
|
13
|
-
chainId,
|
|
14
|
-
estimateUserOperationGas,
|
|
15
|
-
getUserOperationByHash,
|
|
16
|
-
getUserOperationReceipt,
|
|
17
|
-
sendUserOperation,
|
|
18
|
-
supportedEntryPoints
|
|
19
|
-
} from "./bundler"
|
|
9
|
+
GetUserOperationReceiptReturnType
|
|
10
|
+
} from "./bundler/getUserOperationReceipt.js"
|
|
11
|
+
import type { SendUserOperationParameters } from "./bundler/sendUserOperation.js"
|
|
20
12
|
|
|
21
|
-
import type { GetSenderAddressParams } from "./public"
|
|
13
|
+
import type { GetSenderAddressParams } from "./public/getSenderAddress.js"
|
|
14
|
+
import { InvalidEntryPointError, getSenderAddress } from "./public/getSenderAddress.js"
|
|
22
15
|
|
|
23
|
-
import {
|
|
16
|
+
import { chainId } from "./bundler/chainId.js"
|
|
17
|
+
import { estimateUserOperationGas } from "./bundler/estimateUserOperationGas.js"
|
|
18
|
+
import { getUserOperationByHash } from "./bundler/getUserOperationByHash.js"
|
|
19
|
+
import { getUserOperationReceipt } from "./bundler/getUserOperationReceipt.js"
|
|
20
|
+
import { sendUserOperation } from "./bundler/sendUserOperation.js"
|
|
21
|
+
import { supportedEntryPoints } from "./bundler/supportedEntryPoints.js"
|
|
22
|
+
import type { GetAccountNonceParams } from "./public/getAccountNonce.js"
|
|
23
|
+
import { getAccountNonce } from "./public/getAccountNonce.js"
|
|
24
24
|
|
|
25
25
|
export type {
|
|
26
26
|
SendUserOperationParameters,
|
|
@@ -30,16 +30,18 @@ export type {
|
|
|
30
30
|
GetUserOperationByHashReturnType,
|
|
31
31
|
GetUserOperationReceiptParameters,
|
|
32
32
|
GetUserOperationReceiptReturnType,
|
|
33
|
-
GetSenderAddressParams
|
|
33
|
+
GetSenderAddressParams,
|
|
34
|
+
GetAccountNonceParams
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
export {
|
|
37
|
-
bundlerActions,
|
|
38
38
|
sendUserOperation,
|
|
39
39
|
estimateUserOperationGas,
|
|
40
40
|
supportedEntryPoints,
|
|
41
41
|
chainId,
|
|
42
42
|
getUserOperationByHash,
|
|
43
43
|
getUserOperationReceipt,
|
|
44
|
-
getSenderAddress
|
|
44
|
+
getSenderAddress,
|
|
45
|
+
getAccountNonce,
|
|
46
|
+
InvalidEntryPointError
|
|
45
47
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { PimlicoBundlerClient } from "../../clients/pimlico.js"
|
|
2
|
+
|
|
3
|
+
export type GetUserOperationGasPriceReturnType = {
|
|
4
|
+
slow: {
|
|
5
|
+
maxFeePerGas: bigint
|
|
6
|
+
maxPriorityFeePerGas: bigint
|
|
7
|
+
}
|
|
8
|
+
standard: {
|
|
9
|
+
maxFeePerGas: bigint
|
|
10
|
+
maxPriorityFeePerGas: bigint
|
|
11
|
+
}
|
|
12
|
+
fast: {
|
|
13
|
+
maxFeePerGas: bigint
|
|
14
|
+
maxPriorityFeePerGas: bigint
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns the live gas prices that you can use to send a user operation.
|
|
20
|
+
*
|
|
21
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationGasPrice
|
|
22
|
+
*
|
|
23
|
+
* @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
|
|
24
|
+
* @returns slow, standard & fast values for maxFeePerGas & maxPriorityFeePerGas
|
|
25
|
+
*
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* import { createClient } from "viem"
|
|
29
|
+
* import { getUserOperationGasPrice } from "permissionless/actions/pimlico"
|
|
30
|
+
*
|
|
31
|
+
* const bundlerClient = createClient({
|
|
32
|
+
* chain: goerli,
|
|
33
|
+
* transport: http("https://api.pimlico.io/v1/goerli/rpc?apikey=YOUR_API_KEY_HERE")
|
|
34
|
+
* })
|
|
35
|
+
*
|
|
36
|
+
* await getUserOperationGasPrice(bundlerClient)
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
export const getUserOperationGasPrice = async (
|
|
40
|
+
client: PimlicoBundlerClient
|
|
41
|
+
): Promise<GetUserOperationGasPriceReturnType> => {
|
|
42
|
+
const gasPrices = await client.request({
|
|
43
|
+
method: "pimlico_getUserOperationGasPrice",
|
|
44
|
+
params: []
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
slow: {
|
|
49
|
+
maxFeePerGas: BigInt(gasPrices.slow.maxFeePerGas),
|
|
50
|
+
maxPriorityFeePerGas: BigInt(gasPrices.slow.maxPriorityFeePerGas)
|
|
51
|
+
},
|
|
52
|
+
standard: {
|
|
53
|
+
maxFeePerGas: BigInt(gasPrices.standard.maxFeePerGas),
|
|
54
|
+
maxPriorityFeePerGas: BigInt(gasPrices.standard.maxPriorityFeePerGas)
|
|
55
|
+
},
|
|
56
|
+
fast: {
|
|
57
|
+
maxFeePerGas: BigInt(gasPrices.fast.maxFeePerGas),
|
|
58
|
+
maxPriorityFeePerGas: BigInt(gasPrices.fast.maxPriorityFeePerGas)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Hash } from "viem"
|
|
2
|
+
import type { PimlicoBundlerClient } from "../../clients/pimlico.js"
|
|
3
|
+
import type { PimlicoUserOperationStatus } from "../../types/pimlico.js"
|
|
4
|
+
|
|
5
|
+
export type GetUserOperationStatusParameters = {
|
|
6
|
+
hash: Hash
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type GetUserOperationStatusReturnType = PimlicoUserOperationStatus
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Returns the status of the userOperation that is pending in the mempool.
|
|
13
|
+
*
|
|
14
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationStatus
|
|
15
|
+
*
|
|
16
|
+
* @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
|
|
17
|
+
* @param hash {@link Hash} UserOpHash that you must have received from sendUserOperation.
|
|
18
|
+
* @returns status & transaction hash if included {@link GetUserOperationStatusReturnType}
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* import { createClient } from "viem"
|
|
23
|
+
* import { getUserOperationStatus } from "permissionless/actions/pimlico"
|
|
24
|
+
*
|
|
25
|
+
* const bundlerClient = createClient({
|
|
26
|
+
* chain: goerli,
|
|
27
|
+
* transport: http("https://api.pimlico.io/v1/goerli/rpc?apikey=YOUR_API_KEY_HERE")
|
|
28
|
+
* })
|
|
29
|
+
*
|
|
30
|
+
* await getUserOperationStatus(bundlerClient, { hash: userOpHash })
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
export const getUserOperationStatus = async (
|
|
34
|
+
client: PimlicoBundlerClient,
|
|
35
|
+
{ hash }: GetUserOperationStatusParameters
|
|
36
|
+
): Promise<GetUserOperationStatusReturnType> => {
|
|
37
|
+
return client.request({
|
|
38
|
+
method: "pimlico_getUserOperationStatus",
|
|
39
|
+
params: [hash]
|
|
40
|
+
})
|
|
41
|
+
}
|