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
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStackupPaymasterClient = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const bundler_js_1 = require("./decorators/bundler.js");
|
|
6
|
+
const stackup_js_1 = require("./decorators/stackup.js");
|
|
7
|
+
const createStackupPaymasterClient = (parameters) => {
|
|
8
|
+
const { key = "public", name = "Stackup Paymaster Client" } = parameters;
|
|
9
|
+
const client = (0, viem_1.createClient)({
|
|
10
|
+
...parameters,
|
|
11
|
+
key,
|
|
12
|
+
name,
|
|
13
|
+
type: "stackupPaymasterClient"
|
|
14
|
+
});
|
|
15
|
+
return client.extend(bundler_js_1.bundlerActions).extend(stackup_js_1.stackupPaymasterActions);
|
|
16
|
+
};
|
|
17
|
+
exports.createStackupPaymasterClient = createStackupPaymasterClient;
|
|
18
|
+
//# sourceMappingURL=stackup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stackup.js","sourceRoot":"","sources":["../../clients/stackup.ts"],"names":[],"mappings":";;;AAAA,+BAAmH;AAEnH,wDAA6E;AAC7E,wDAAqG;AA6B9F,MAAM,4BAA4B,GAAG,CACxC,UAAgD,EAC1B,EAAE;IACxB,MAAM,EAAE,GAAG,GAAG,QAAQ,EAAE,IAAI,GAAG,0BAA0B,EAAE,GAAG,UAAU,CAAA;IACxE,MAAM,MAAM,GAAG,IAAA,mBAAY,EAAC;QACxB,GAAG,UAAU;QACb,GAAG;QACH,IAAI;QACJ,IAAI,EAAE,wBAAwB;KACjC,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,2BAAc,CAAC,CAAC,MAAM,CAAC,oCAAuB,CAAC,CAAA;AACxE,CAAC,CAAA;AAXY,QAAA,4BAA4B,gCAWxC"}
|
package/_cjs/index.js
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUserOperationHash = exports.bundlerActions = exports.createBundlerClient = exports.getAccountNonce = exports.getSenderAddress = exports.getUserOperationReceipt = exports.getUserOperationByHash = exports.chainId = exports.supportedEntryPoints = exports.estimateUserOperationGas = exports.sendUserOperation = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const getSenderAddress_js_1 = require("./actions/public/getSenderAddress.js");
|
|
6
|
+
Object.defineProperty(exports, "getSenderAddress", { enumerable: true, get: function () { return getSenderAddress_js_1.getSenderAddress; } });
|
|
7
|
+
const chainId_js_1 = require("./actions/bundler/chainId.js");
|
|
8
|
+
Object.defineProperty(exports, "chainId", { enumerable: true, get: function () { return chainId_js_1.chainId; } });
|
|
9
|
+
const estimateUserOperationGas_js_1 = require("./actions/bundler/estimateUserOperationGas.js");
|
|
10
|
+
Object.defineProperty(exports, "estimateUserOperationGas", { enumerable: true, get: function () { return estimateUserOperationGas_js_1.estimateUserOperationGas; } });
|
|
11
|
+
const getUserOperationByHash_js_1 = require("./actions/bundler/getUserOperationByHash.js");
|
|
12
|
+
Object.defineProperty(exports, "getUserOperationByHash", { enumerable: true, get: function () { return getUserOperationByHash_js_1.getUserOperationByHash; } });
|
|
13
|
+
const getUserOperationReceipt_js_1 = require("./actions/bundler/getUserOperationReceipt.js");
|
|
14
|
+
Object.defineProperty(exports, "getUserOperationReceipt", { enumerable: true, get: function () { return getUserOperationReceipt_js_1.getUserOperationReceipt; } });
|
|
15
|
+
const sendUserOperation_js_1 = require("./actions/bundler/sendUserOperation.js");
|
|
16
|
+
Object.defineProperty(exports, "sendUserOperation", { enumerable: true, get: function () { return sendUserOperation_js_1.sendUserOperation; } });
|
|
17
|
+
const supportedEntryPoints_js_1 = require("./actions/bundler/supportedEntryPoints.js");
|
|
18
|
+
Object.defineProperty(exports, "supportedEntryPoints", { enumerable: true, get: function () { return supportedEntryPoints_js_1.supportedEntryPoints; } });
|
|
19
|
+
const getAccountNonce_js_1 = require("./actions/public/getAccountNonce.js");
|
|
20
|
+
Object.defineProperty(exports, "getAccountNonce", { enumerable: true, get: function () { return getAccountNonce_js_1.getAccountNonce; } });
|
|
21
|
+
const bundler_js_1 = require("./clients/bundler.js");
|
|
22
|
+
Object.defineProperty(exports, "createBundlerClient", { enumerable: true, get: function () { return bundler_js_1.createBundlerClient; } });
|
|
23
|
+
const bundler_js_2 = require("./clients/decorators/bundler.js");
|
|
24
|
+
Object.defineProperty(exports, "bundlerActions", { enumerable: true, get: function () { return bundler_js_2.bundlerActions; } });
|
|
25
|
+
const getUserOperationHash_js_1 = require("./utils/getUserOperationHash.js");
|
|
26
|
+
Object.defineProperty(exports, "getUserOperationHash", { enumerable: true, get: function () { return getUserOperationHash_js_1.getUserOperationHash; } });
|
|
27
|
+
tslib_1.__exportStar(require("./utils/index.js"), exports);
|
|
8
28
|
//# sourceMappingURL=index.js.map
|
package/_cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;AAaA,8EAAuE;AAmCnE,iGAnCK,sCAAgB,OAmCL;AAjCpB,6DAAsD;AA8BlD,wFA9BK,oBAAO,OA8BL;AA7BX,+FAAwF;AA2BpF,yGA3BK,sDAAwB,OA2BL;AA1B5B,2FAAoF;AA6BhF,uGA7BK,kDAAsB,OA6BL;AA5B1B,6FAAsF;AA6BlF,wGA7BK,oDAAuB,OA6BL;AA5B3B,iFAA0E;AAuBtE,kGAvBK,wCAAiB,OAuBL;AAtBrB,uFAAgF;AAwB5E,qGAxBK,8CAAoB,OAwBL;AAtBxB,4EAAqE;AA2BjE,gGA3BK,oCAAe,OA2BL;AA1BnB,qDAA8E;AA2B1E,oGA3ByB,gCAAmB,OA2BzB;AAzBvB,gEAAgE;AA0B5D,+FA1BK,2BAAc,OA0BL;AAOlB,6EAAsE;AAE7D,qGAFA,8CAAoB,OAEA;AAC7B,2DAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stackup.js","sourceRoot":"","sources":["../../types/stackup.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUserOperationHash = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
function packUserOp({ userOperation }) {
|
|
6
|
+
const hashedInitCode = (0, viem_1.keccak256)(userOperation.initCode);
|
|
7
|
+
const hashedCallData = (0, viem_1.keccak256)(userOperation.callData);
|
|
8
|
+
const hashedPaymasterAndData = (0, viem_1.keccak256)(userOperation.paymasterAndData);
|
|
9
|
+
return (0, viem_1.encodeAbiParameters)([
|
|
10
|
+
{ type: "address" },
|
|
11
|
+
{ type: "uint256" },
|
|
12
|
+
{ type: "bytes32" },
|
|
13
|
+
{ type: "bytes32" },
|
|
14
|
+
{ type: "uint256" },
|
|
15
|
+
{ type: "uint256" },
|
|
16
|
+
{ type: "uint256" },
|
|
17
|
+
{ type: "uint256" },
|
|
18
|
+
{ type: "uint256" },
|
|
19
|
+
{ type: "bytes32" }
|
|
20
|
+
], [
|
|
21
|
+
userOperation.sender,
|
|
22
|
+
userOperation.nonce,
|
|
23
|
+
hashedInitCode,
|
|
24
|
+
hashedCallData,
|
|
25
|
+
userOperation.callGasLimit,
|
|
26
|
+
userOperation.verificationGasLimit,
|
|
27
|
+
userOperation.preVerificationGas,
|
|
28
|
+
userOperation.maxFeePerGas,
|
|
29
|
+
userOperation.maxPriorityFeePerGas,
|
|
30
|
+
hashedPaymasterAndData
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
const getUserOperationHash = ({ userOperation, entryPoint, chainId }) => {
|
|
34
|
+
const encoded = (0, viem_1.encodeAbiParameters)([{ type: "bytes32" }, { type: "address" }, { type: "uint256" }], [(0, viem_1.keccak256)(packUserOp({ userOperation })), entryPoint, BigInt(chainId)]);
|
|
35
|
+
return (0, viem_1.keccak256)(encoded);
|
|
36
|
+
};
|
|
37
|
+
exports.getUserOperationHash = getUserOperationHash;
|
|
38
|
+
//# sourceMappingURL=getUserOperationHash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserOperationHash.js","sourceRoot":"","sources":["../../utils/getUserOperationHash.ts"],"names":[],"mappings":";;;AACA,+BAAqD;AAGrD,SAAS,UAAU,CAAC,EAAE,aAAa,EAAoC;IACnE,MAAM,cAAc,GAAG,IAAA,gBAAS,EAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IACxD,MAAM,cAAc,GAAG,IAAA,gBAAS,EAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IACxD,MAAM,sBAAsB,GAAG,IAAA,gBAAS,EAAC,aAAa,CAAC,gBAAgB,CAAC,CAAA;IAExE,OAAO,IAAA,0BAAmB,EACtB;QACI,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;KACtB,EACD;QACI,aAAa,CAAC,MAAiB;QAC/B,aAAa,CAAC,KAAK;QACnB,cAAc;QACd,cAAc;QACd,aAAa,CAAC,YAAY;QAC1B,aAAa,CAAC,oBAAoB;QAClC,aAAa,CAAC,kBAAkB;QAChC,aAAa,CAAC,YAAY;QAC1B,aAAa,CAAC,oBAAoB;QAClC,sBAAsB;KACzB,CACJ,CAAA;AACL,CAAC;AAyBM,MAAM,oBAAoB,GAAG,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAA8B,EAAQ,EAAE;IAC7G,MAAM,OAAO,GAAG,IAAA,0BAAmB,EAC/B,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAC/D,CAAC,IAAA,gBAAS,EAAC,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CACzD,CAAA;IAElB,OAAO,IAAA,gBAAS,EAAC,OAAO,CAAC,CAAA;AAC7B,CAAC,CAAA;AAPY,QAAA,oBAAoB,wBAOhC"}
|
package/_cjs/utils/index.js
CHANGED
|
@@ -1,38 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getUserOperationHash = void 0;
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
const hashedInitCode = (0, viem_1.keccak256)(userOperation.initCode);
|
|
7
|
-
const hashedCallData = (0, viem_1.keccak256)(userOperation.callData);
|
|
8
|
-
const hashedPaymasterAndData = (0, viem_1.keccak256)(userOperation.paymasterAndData);
|
|
9
|
-
return (0, viem_1.encodeAbiParameters)([
|
|
10
|
-
{ type: "address" },
|
|
11
|
-
{ type: "uint256" },
|
|
12
|
-
{ type: "bytes32" },
|
|
13
|
-
{ type: "bytes32" },
|
|
14
|
-
{ type: "uint256" },
|
|
15
|
-
{ type: "uint256" },
|
|
16
|
-
{ type: "uint256" },
|
|
17
|
-
{ type: "uint256" },
|
|
18
|
-
{ type: "uint256" },
|
|
19
|
-
{ type: "bytes32" }
|
|
20
|
-
], [
|
|
21
|
-
userOperation.sender,
|
|
22
|
-
userOperation.nonce,
|
|
23
|
-
hashedInitCode,
|
|
24
|
-
hashedCallData,
|
|
25
|
-
userOperation.callGasLimit,
|
|
26
|
-
userOperation.verificationGasLimit,
|
|
27
|
-
userOperation.preVerificationGas,
|
|
28
|
-
userOperation.maxFeePerGas,
|
|
29
|
-
userOperation.maxPriorityFeePerGas,
|
|
30
|
-
hashedPaymasterAndData
|
|
31
|
-
]);
|
|
32
|
-
}
|
|
33
|
-
const getUserOperationHash = ({ userOperation, entryPoint, chainId }) => {
|
|
34
|
-
const encoded = (0, viem_1.encodeAbiParameters)([{ type: "bytes32" }, { type: "address" }, { type: "uint256" }], [(0, viem_1.keccak256)(packUserOp({ userOperation })), entryPoint, BigInt(chainId)]);
|
|
35
|
-
return (0, viem_1.keccak256)(encoded);
|
|
36
|
-
};
|
|
37
|
-
exports.getUserOperationHash = getUserOperationHash;
|
|
4
|
+
const getUserOperationHash_js_1 = require("./getUserOperationHash.js");
|
|
5
|
+
Object.defineProperty(exports, "getUserOperationHash", { enumerable: true, get: function () { return getUserOperationHash_js_1.getUserOperationHash; } });
|
|
38
6
|
//# sourceMappingURL=index.js.map
|
package/_cjs/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":";;;AAAA,uEAAiG;AAExF,qGAFiC,8CAAoB,OAEjC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the supported chain id by the bundler service
|
|
3
|
+
*
|
|
4
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/chainId
|
|
5
|
+
*
|
|
6
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
7
|
+
* @returns Supported chain id
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { createClient } from "viem"
|
|
12
|
+
* import { chainId } from "permissionless/actions"
|
|
13
|
+
*
|
|
14
|
+
* const bundlerClient = createClient({
|
|
15
|
+
* chain: goerli,
|
|
16
|
+
* transport: http(BUNDLER_URL)
|
|
17
|
+
* })
|
|
18
|
+
*
|
|
19
|
+
* const bundlerChainId = chainId(bundlerClient)
|
|
20
|
+
* // Return 5n for Goerli
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export const chainId = async (client) => {
|
|
24
|
+
return Number(await client.request({
|
|
25
|
+
method: "eth_chainId",
|
|
26
|
+
params: []
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=chainId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chainId.js","sourceRoot":"","sources":["../../../actions/bundler/chainId.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,MAAqB,EAAE,EAAE;IACnD,OAAO,MAAM,CACT,MAAM,MAAM,CAAC,OAAO,CAAC;QACjB,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,EAAE;KACb,CAAC,CACL,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { deepHexlify } from "../utils.js";
|
|
2
|
+
/**
|
|
3
|
+
* Estimates preVerificationGas, verificationGasLimit and callGasLimit for user operation
|
|
4
|
+
*
|
|
5
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/estimateUserOperationGas
|
|
6
|
+
*
|
|
7
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
8
|
+
* @param args {@link EstimateUserOperationGasParameters}
|
|
9
|
+
* @returns preVerificationGas, verificationGasLimit and callGasLimit as {@link EstimateUserOperationGasReturnType}
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* import { createClient } from "viem"
|
|
14
|
+
* import { estimateUserOperationGas } from "permissionless/actions"
|
|
15
|
+
*
|
|
16
|
+
* const bundlerClient = createClient({
|
|
17
|
+
* chain: goerli,
|
|
18
|
+
* transport: http(BUNDLER_URL)
|
|
19
|
+
* })
|
|
20
|
+
*
|
|
21
|
+
* const gasParameters = estimateUserOperationGas(bundlerClient, {
|
|
22
|
+
* serOperation: signedUserOperation,
|
|
23
|
+
* entryPoint: entryPoint
|
|
24
|
+
* })
|
|
25
|
+
*
|
|
26
|
+
* // Return {preVerificationGas: 43492n, verificationGasLimit: 59436n, callGasLimit: 9000n}
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export const estimateUserOperationGas = async (client, args) => {
|
|
30
|
+
const { userOperation, entryPoint } = args;
|
|
31
|
+
const response = await client.request({
|
|
32
|
+
method: "eth_estimateUserOperationGas",
|
|
33
|
+
params: [deepHexlify(userOperation), entryPoint]
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
preVerificationGas: BigInt(response.preVerificationGas || 0),
|
|
37
|
+
verificationGasLimit: BigInt(response.verificationGasLimit || 0),
|
|
38
|
+
callGasLimit: BigInt(response.callGasLimit || 0)
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=estimateUserOperationGas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimateUserOperationGas.js","sourceRoot":"","sources":["../../../actions/bundler/estimateUserOperationGas.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAazC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EACzC,MAAqB,EACrB,IAAwC,EACG,EAAE;IAC7C,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,IAAI,CAAA;IAE1C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,8BAA8B;QACtC,MAAM,EAAE,CAAC,WAAW,CAAC,aAAa,CAAiC,EAAE,UAAqB,CAAC;KAC9F,CAAC,CAAA;IAEF,OAAO;QACH,kBAAkB,EAAE,MAAM,CAAC,QAAQ,CAAC,kBAAkB,IAAI,CAAC,CAAC;QAC5D,oBAAoB,EAAE,MAAM,CAAC,QAAQ,CAAC,oBAAoB,IAAI,CAAC,CAAC;QAChE,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAY,IAAI,CAAC,CAAC;KACnD,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the user operation from userOpHash
|
|
3
|
+
*
|
|
4
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/getUserOperationByHash
|
|
5
|
+
*
|
|
6
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
7
|
+
* @param args {@link GetUserOperationByHashParameters} UserOpHash that was returned by {@link sendUserOperation}
|
|
8
|
+
* @returns userOperation along with entryPoint, transactionHash, blockHash, blockNumber if found or null
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* import { createClient } from "viem"
|
|
13
|
+
* import { getUserOperationByHash } from "permissionless/actions"
|
|
14
|
+
*
|
|
15
|
+
* const bundlerClient = createClient({
|
|
16
|
+
* chain: goerli,
|
|
17
|
+
* transport: http(BUNDLER_URL)
|
|
18
|
+
* })
|
|
19
|
+
*
|
|
20
|
+
* getUserOperationByHash(bundlerClient, {hash: userOpHash})
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export const getUserOperationByHash = async (client, { hash }) => {
|
|
24
|
+
const params = [hash];
|
|
25
|
+
const response = await client.request({
|
|
26
|
+
method: "eth_getUserOperationByHash",
|
|
27
|
+
params
|
|
28
|
+
});
|
|
29
|
+
if (!response)
|
|
30
|
+
return null;
|
|
31
|
+
const { userOperation, entryPoint, transactionHash, blockHash, blockNumber } = response;
|
|
32
|
+
return {
|
|
33
|
+
userOperation: {
|
|
34
|
+
...userOperation,
|
|
35
|
+
nonce: BigInt(userOperation.nonce),
|
|
36
|
+
callGasLimit: BigInt(userOperation.callGasLimit),
|
|
37
|
+
verificationGasLimit: BigInt(userOperation.verificationGasLimit),
|
|
38
|
+
preVerificationGas: BigInt(userOperation.preVerificationGas),
|
|
39
|
+
maxFeePerGas: BigInt(userOperation.maxFeePerGas),
|
|
40
|
+
maxPriorityFeePerGas: BigInt(userOperation.maxPriorityFeePerGas)
|
|
41
|
+
},
|
|
42
|
+
entryPoint: entryPoint,
|
|
43
|
+
transactionHash: transactionHash,
|
|
44
|
+
blockHash: blockHash,
|
|
45
|
+
blockNumber: BigInt(blockNumber)
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=getUserOperationByHash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserOperationByHash.js","sourceRoot":"","sources":["../../../actions/bundler/getUserOperationByHash.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACvC,MAAqB,EACrB,EAAE,IAAI,EAAoC,EACD,EAAE;IAC3C,MAAM,MAAM,GAAW,CAAC,IAAI,CAAC,CAAA;IAE7B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,4BAA4B;QACpC,MAAM;KACT,CAAC,CAAA;IAEF,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAA;IAE1B,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,QAAQ,CAAA;IAEvF,OAAO;QACH,aAAa,EAAE;YACX,GAAG,aAAa;YAChB,KAAK,EAAE,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;YAClC,YAAY,EAAE,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC;YAChD,oBAAoB,EAAE,MAAM,CAAC,aAAa,CAAC,oBAAoB,CAAC;YAChE,kBAAkB,EAAE,MAAM,CAAC,aAAa,CAAC,kBAAkB,CAAC;YAC5D,YAAY,EAAE,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC;YAChD,oBAAoB,EAAE,MAAM,CAAC,aAAa,CAAC,oBAAoB,CAAC;SAClD;QAClB,UAAU,EAAE,UAAU;QACtB,eAAe,EAAE,eAAe;QAChC,SAAS,EAAE,SAAS;QACpB,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC;KACnC,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { transactionReceiptStatus } from "../utils.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the user operation receipt from userOpHash
|
|
4
|
+
*
|
|
5
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/getUserOperationReceipt
|
|
6
|
+
*
|
|
7
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
8
|
+
* @param args {@link GetUserOperationReceiptParameters} UserOpHash that was returned by {@link sendUserOperation}
|
|
9
|
+
* @returns user operation receipt {@link GetUserOperationReceiptReturnType} if found or null
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* import { createClient } from "viem"
|
|
14
|
+
* import { getUserOperationReceipt } from "permissionless/actions"
|
|
15
|
+
*
|
|
16
|
+
* const bundlerClient = createClient({
|
|
17
|
+
* chain: goerli,
|
|
18
|
+
* transport: http(BUNDLER_URL)
|
|
19
|
+
* })
|
|
20
|
+
*
|
|
21
|
+
* getUserOperationReceipt(bundlerClient, {hash: userOpHash})
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
export const getUserOperationReceipt = async (client, { hash }) => {
|
|
25
|
+
const params = [hash];
|
|
26
|
+
const response = await client.request({
|
|
27
|
+
method: "eth_getUserOperationReceipt",
|
|
28
|
+
params
|
|
29
|
+
});
|
|
30
|
+
if (!response)
|
|
31
|
+
return null;
|
|
32
|
+
const userOperationReceipt = {
|
|
33
|
+
userOpHash: response.userOpHash,
|
|
34
|
+
sender: response.sender,
|
|
35
|
+
nonce: BigInt(response.nonce),
|
|
36
|
+
actualGasUsed: BigInt(response.actualGasUsed),
|
|
37
|
+
actualGasCost: BigInt(response.actualGasCost),
|
|
38
|
+
success: response.success,
|
|
39
|
+
receipt: {
|
|
40
|
+
transactionHash: response.receipt.transactionHash,
|
|
41
|
+
transactionIndex: BigInt(response.receipt.transactionIndex),
|
|
42
|
+
blockHash: response.receipt.blockHash,
|
|
43
|
+
blockNumber: BigInt(response.receipt.blockNumber),
|
|
44
|
+
from: response.receipt.from,
|
|
45
|
+
to: response.receipt.to,
|
|
46
|
+
cumulativeGasUsed: BigInt(response.receipt.cumulativeGasUsed),
|
|
47
|
+
status: transactionReceiptStatus[response.receipt.status],
|
|
48
|
+
gasUsed: BigInt(response.receipt.gasUsed),
|
|
49
|
+
contractAddress: response.receipt.contractAddress,
|
|
50
|
+
logsBloom: response.receipt.logsBloom,
|
|
51
|
+
effectiveGasPrice: BigInt(response.receipt.effectiveGasPrice)
|
|
52
|
+
},
|
|
53
|
+
logs: response.logs.map((log) => ({
|
|
54
|
+
data: log.data,
|
|
55
|
+
blockNumber: BigInt(log.blockNumber),
|
|
56
|
+
blockHash: log.blockHash,
|
|
57
|
+
transactionHash: log.transactionHash,
|
|
58
|
+
logIndex: BigInt(log.logIndex),
|
|
59
|
+
transactionIndex: BigInt(log.transactionIndex),
|
|
60
|
+
address: log.address,
|
|
61
|
+
topics: log.topics
|
|
62
|
+
}))
|
|
63
|
+
};
|
|
64
|
+
return userOperationReceipt;
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=getUserOperationReceipt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserOperationReceipt.js","sourceRoot":"","sources":["../../../actions/bundler/getUserOperationReceipt.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAuCtD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,EAAE,MAAqB,EAAE,EAAE,IAAI,EAAqC,EAAE,EAAE;IAChH,MAAM,MAAM,GAAW,CAAC,IAAI,CAAC,CAAA;IAE7B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,6BAA6B;QACrC,MAAM;KACT,CAAC,CAAA;IAEF,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAA;IAE1B,MAAM,oBAAoB,GAAsC;QAC5D,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC7B,aAAa,EAAE,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;QAC7C,aAAa,EAAE,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;QAC7C,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,OAAO,EAAE;YACL,eAAe,EAAE,QAAQ,CAAC,OAAO,CAAC,eAAe;YACjD,gBAAgB,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC;YAC3D,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS;YACrC,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC;YACjD,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI;YAC3B,EAAE,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE;YACvB,iBAAiB,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,iBAAiB,CAAC;YAC7D,MAAM,EAAE,wBAAwB,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;YACzD,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC;YACzC,eAAe,EAAE,QAAQ,CAAC,OAAO,CAAC,eAAe;YACjD,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS;YACrC,iBAAiB,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,iBAAiB,CAAC;SAChE;QACD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC9B,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;YACpC,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,eAAe,EAAE,GAAG,CAAC,eAAe;YACpC,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YAC9B,gBAAgB,EAAE,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC;YAC9C,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,MAAM,EAAE,GAAG,CAAC,MAAM;SACrB,CAAC,CAAC;KACN,CAAA;IAED,OAAO,oBAAoB,CAAA;AAC/B,CAAC,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { deepHexlify } from "../utils.js";
|
|
2
|
+
/**
|
|
3
|
+
* Sends user operation to the bundler
|
|
4
|
+
*
|
|
5
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/sendUserOperation
|
|
6
|
+
*
|
|
7
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
8
|
+
* @param args {@link SendUserOperationParameters}.
|
|
9
|
+
* @returns UserOpHash that you can use to track user operation as {@link Hash}.
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* import { createClient } from "viem"
|
|
14
|
+
* import { sendUserOperation } from "permissionless/actions"
|
|
15
|
+
*
|
|
16
|
+
* const bundlerClient = createClient({
|
|
17
|
+
* chain: goerli,
|
|
18
|
+
* transport: http(BUNDLER_URL)
|
|
19
|
+
* })
|
|
20
|
+
*
|
|
21
|
+
* const userOpHash = sendUserOperation(bundlerClient, {
|
|
22
|
+
* userOperation: signedUserOperation,
|
|
23
|
+
* entryPoint: entryPoint
|
|
24
|
+
* })
|
|
25
|
+
*
|
|
26
|
+
* // Return '0xe9fad2cd67f9ca1d0b7a6513b2a42066784c8df938518da2b51bb8cc9a89ea34'
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export const sendUserOperation = async (client, args) => {
|
|
30
|
+
const { userOperation, entryPoint } = args;
|
|
31
|
+
return client.request({
|
|
32
|
+
method: "eth_sendUserOperation",
|
|
33
|
+
params: [deepHexlify(userOperation), entryPoint]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=sendUserOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendUserOperation.js","sourceRoot":"","sources":["../../../actions/bundler/sendUserOperation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAOzC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,MAAqB,EAAE,IAAiC,EAAiB,EAAE;IAC/G,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,IAAI,CAAA;IAE1C,OAAO,MAAM,CAAC,OAAO,CAAC;QAClB,MAAM,EAAE,uBAAuB;QAC/B,MAAM,EAAE,CAAC,WAAW,CAAC,aAAa,CAAiC,EAAE,UAAqB,CAAC;KAC9F,CAAC,CAAA;AACN,CAAC,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the supported entrypoints by the bundler service
|
|
3
|
+
*
|
|
4
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/supportedEntryPoints
|
|
5
|
+
*
|
|
6
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
7
|
+
* @returns Supported entryPoints
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { createClient } from "viem"
|
|
12
|
+
* import { supportedEntryPoints } from "permissionless/actions"
|
|
13
|
+
*
|
|
14
|
+
* const bundlerClient = createClient({
|
|
15
|
+
* chain: goerli,
|
|
16
|
+
* transport: http(BUNDLER_URL)
|
|
17
|
+
* })
|
|
18
|
+
*
|
|
19
|
+
* const entryPointsSupported = supportedEntryPoints(bundlerClient)
|
|
20
|
+
* // Return ['0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789']
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export const supportedEntryPoints = async (client) => {
|
|
24
|
+
return client.request({
|
|
25
|
+
method: "eth_supportedEntryPoints",
|
|
26
|
+
params: []
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=supportedEntryPoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supportedEntryPoints.js","sourceRoot":"","sources":["../../../actions/bundler/supportedEntryPoints.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,MAAqB,EAAsB,EAAE;IACpF,OAAO,MAAM,CAAC,OAAO,CAAC;QAClB,MAAM,EAAE,0BAA0B;QAClC,MAAM,EAAE,EAAE;KACb,CAAC,CAAA;AACN,CAAC,CAAA"}
|
package/_esm/actions/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { InvalidEntryPointError, getSenderAddress } from "./public/getSenderAddress.js";
|
|
2
|
+
import { chainId } from "./bundler/chainId.js";
|
|
3
|
+
import { estimateUserOperationGas } from "./bundler/estimateUserOperationGas.js";
|
|
4
|
+
import { getUserOperationByHash } from "./bundler/getUserOperationByHash.js";
|
|
5
|
+
import { getUserOperationReceipt } from "./bundler/getUserOperationReceipt.js";
|
|
6
|
+
import { sendUserOperation } from "./bundler/sendUserOperation.js";
|
|
7
|
+
import { supportedEntryPoints } from "./bundler/supportedEntryPoints.js";
|
|
8
|
+
import { getAccountNonce } from "./public/getAccountNonce.js";
|
|
9
|
+
export { sendUserOperation, estimateUserOperationGas, supportedEntryPoints, chainId, getUserOperationByHash, getUserOperationReceipt, getSenderAddress, getAccountNonce, InvalidEntryPointError };
|
|
4
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEvF,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAA;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAc7D,OAAO,EACH,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,OAAO,EACP,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACzB,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the live gas prices that you can use to send a user operation.
|
|
3
|
+
*
|
|
4
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationGasPrice
|
|
5
|
+
*
|
|
6
|
+
* @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
|
|
7
|
+
* @returns slow, standard & fast values for maxFeePerGas & maxPriorityFeePerGas
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { createClient } from "viem"
|
|
12
|
+
* import { getUserOperationGasPrice } from "permissionless/actions/pimlico"
|
|
13
|
+
*
|
|
14
|
+
* const bundlerClient = createClient({
|
|
15
|
+
* chain: goerli,
|
|
16
|
+
* transport: http("https://api.pimlico.io/v1/goerli/rpc?apikey=YOUR_API_KEY_HERE")
|
|
17
|
+
* })
|
|
18
|
+
*
|
|
19
|
+
* await getUserOperationGasPrice(bundlerClient)
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export const getUserOperationGasPrice = async (client) => {
|
|
23
|
+
const gasPrices = await client.request({
|
|
24
|
+
method: "pimlico_getUserOperationGasPrice",
|
|
25
|
+
params: []
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
slow: {
|
|
29
|
+
maxFeePerGas: BigInt(gasPrices.slow.maxFeePerGas),
|
|
30
|
+
maxPriorityFeePerGas: BigInt(gasPrices.slow.maxPriorityFeePerGas)
|
|
31
|
+
},
|
|
32
|
+
standard: {
|
|
33
|
+
maxFeePerGas: BigInt(gasPrices.standard.maxFeePerGas),
|
|
34
|
+
maxPriorityFeePerGas: BigInt(gasPrices.standard.maxPriorityFeePerGas)
|
|
35
|
+
},
|
|
36
|
+
fast: {
|
|
37
|
+
maxFeePerGas: BigInt(gasPrices.fast.maxFeePerGas),
|
|
38
|
+
maxPriorityFeePerGas: BigInt(gasPrices.fast.maxPriorityFeePerGas)
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=getUserOperationGasPrice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserOperationGasPrice.js","sourceRoot":"","sources":["../../../actions/pimlico/getUserOperationGasPrice.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EACzC,MAA4B,EACe,EAAE;IAC7C,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QACnC,MAAM,EAAE,kCAAkC;QAC1C,MAAM,EAAE,EAAE;KACb,CAAC,CAAA;IAEF,OAAO;QACH,IAAI,EAAE;YACF,YAAY,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC;YACjD,oBAAoB,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC;SACpE;QACD,QAAQ,EAAE;YACN,YAAY,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC;YACrD,oBAAoB,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,oBAAoB,CAAC;SACxE;QACD,IAAI,EAAE;YACF,YAAY,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC;YACjD,oBAAoB,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC;SACpE;KACJ,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the status of the userOperation that is pending in the mempool.
|
|
3
|
+
*
|
|
4
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationStatus
|
|
5
|
+
*
|
|
6
|
+
* @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
|
|
7
|
+
* @param hash {@link Hash} UserOpHash that you must have received from sendUserOperation.
|
|
8
|
+
* @returns status & transaction hash if included {@link GetUserOperationStatusReturnType}
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* import { createClient } from "viem"
|
|
13
|
+
* import { getUserOperationStatus } from "permissionless/actions/pimlico"
|
|
14
|
+
*
|
|
15
|
+
* const bundlerClient = createClient({
|
|
16
|
+
* chain: goerli,
|
|
17
|
+
* transport: http("https://api.pimlico.io/v1/goerli/rpc?apikey=YOUR_API_KEY_HERE")
|
|
18
|
+
* })
|
|
19
|
+
*
|
|
20
|
+
* await getUserOperationStatus(bundlerClient, { hash: userOpHash })
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export const getUserOperationStatus = async (client, { hash }) => {
|
|
24
|
+
return client.request({
|
|
25
|
+
method: "pimlico_getUserOperationStatus",
|
|
26
|
+
params: [hash]
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=getUserOperationStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserOperationStatus.js","sourceRoot":"","sources":["../../../actions/pimlico/getUserOperationStatus.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACvC,MAA4B,EAC5B,EAAE,IAAI,EAAoC,EACD,EAAE;IAC3C,OAAO,MAAM,CAAC,OAAO,CAAC;QAClB,MAAM,EAAE,gCAAgC;QACxC,MAAM,EAAE,CAAC,IAAI,CAAC;KACjB,CAAC,CAAA;AACN,CAAC,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { deepHexlify } from "../utils.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
4
|
+
*
|
|
5
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-paymaster-actions/sponsorUserOperation
|
|
6
|
+
*
|
|
7
|
+
* @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
|
|
8
|
+
* @param args {@link sponsorUserOperationParameters} UserOperation you want to sponsor & entryPoint.
|
|
9
|
+
* @returns paymasterAndData & updated gas parameters, see {@link SponsorUserOperationReturnType}
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* import { createClient } from "viem"
|
|
14
|
+
* import { sponsorUserOperation } from "permissionless/actions/pimlico"
|
|
15
|
+
*
|
|
16
|
+
* const bundlerClient = createClient({
|
|
17
|
+
* chain: goerli,
|
|
18
|
+
* transport: http("https://api.pimlico.io/v2/goerli/rpc?apikey=YOUR_API_KEY_HERE")
|
|
19
|
+
* })
|
|
20
|
+
*
|
|
21
|
+
* await sponsorUserOperation(bundlerClient, {
|
|
22
|
+
* userOperation: userOperationWithDummySignature,
|
|
23
|
+
* entryPoint: entryPoint
|
|
24
|
+
* }})
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
export const sponsorUserOperation = async (client, args) => {
|
|
28
|
+
const response = await client.request({
|
|
29
|
+
method: "pm_sponsorUserOperation",
|
|
30
|
+
params: [deepHexlify(args.userOperation), args.entryPoint]
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
paymasterAndData: response.paymasterAndData,
|
|
34
|
+
preVerificationGas: BigInt(response.preVerificationGas),
|
|
35
|
+
verificationGasLimit: BigInt(response.verificationGasLimit),
|
|
36
|
+
callGasLimit: BigInt(response.callGasLimit)
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=sponsorUserOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sponsorUserOperation.js","sourceRoot":"","sources":["../../../actions/pimlico/sponsorUserOperation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAiBzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EACrC,MAA8B,EAC9B,IAAoC,EACG,EAAE;IACzC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,yBAAyB;QACjC,MAAM,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAiC,EAAE,IAAI,CAAC,UAAU,CAAC;KAC7F,CAAC,CAAA;IAEF,OAAO;QACH,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;QAC3C,kBAAkB,EAAE,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QACvD,oBAAoB,EAAE,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QAC3D,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;KAC9C,CAAA;AACL,CAAC,CAAA"}
|