permissionless 0.0.11 → 0.0.12
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/accounts/index.js +7 -0
- package/_cjs/accounts/index.js.map +1 -0
- package/_cjs/accounts/privateKeyToSimpleSmartAccount.js +168 -0
- package/_cjs/accounts/privateKeyToSimpleSmartAccount.js.map +1 -0
- package/_cjs/accounts/types.js +3 -0
- package/_cjs/accounts/types.js.map +1 -0
- package/_cjs/actions/bundler/estimateUserOperationGas.js +4 -1
- package/_cjs/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_cjs/actions/bundler/getUserOperationByHash.js.map +1 -1
- package/_cjs/actions/bundler/sendUserOperation.js +4 -1
- package/_cjs/actions/bundler/sendUserOperation.js.map +1 -1
- package/_cjs/actions/bundler/supportedEntryPoints.js.map +1 -1
- package/_cjs/actions/bundler/waitForUserOperationReceipt.js +7 -2
- package/_cjs/actions/bundler/waitForUserOperationReceipt.js.map +1 -1
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
- package/_cjs/actions/pimlico/getUserOperationStatus.js.map +1 -1
- package/_cjs/actions/pimlico/sponsorUserOperation.js +4 -1
- package/_cjs/actions/pimlico/sponsorUserOperation.js.map +1 -1
- package/_cjs/actions/pimlico.js.map +1 -1
- package/_cjs/actions/public/getAccountNonce.js +4 -2
- package/_cjs/actions/public/getAccountNonce.js.map +1 -1
- package/_cjs/actions/public/getSenderAddress.js +7 -3
- package/_cjs/actions/public/getSenderAddress.js.map +1 -1
- package/_cjs/actions/smartAccount/deployContract.js +38 -0
- package/_cjs/actions/smartAccount/deployContract.js.map +1 -0
- package/_cjs/actions/smartAccount/prepareUserOperationRequest.js +71 -0
- package/_cjs/actions/smartAccount/prepareUserOperationRequest.js.map +1 -0
- package/_cjs/actions/smartAccount/sendTransaction.js +43 -0
- package/_cjs/actions/smartAccount/sendTransaction.js.map +1 -0
- package/_cjs/actions/smartAccount/sendUserOperation.js +22 -0
- package/_cjs/actions/smartAccount/sendUserOperation.js.map +1 -0
- package/_cjs/actions/smartAccount/signMessage.js +16 -0
- package/_cjs/actions/smartAccount/signMessage.js.map +1 -0
- package/_cjs/actions/smartAccount/signTypedData.js +34 -0
- package/_cjs/actions/smartAccount/signTypedData.js.map +1 -0
- package/_cjs/actions/smartAccount/writeContract.js +21 -0
- package/_cjs/actions/smartAccount/writeContract.js.map +1 -0
- package/_cjs/actions/smartAccount.js +16 -0
- package/_cjs/actions/smartAccount.js.map +1 -0
- package/_cjs/actions/stackup/sponsorUserOperation.js +5 -1
- package/_cjs/actions/stackup/sponsorUserOperation.js.map +1 -1
- package/_cjs/clients/{bundler.js → createBundlerClient.js} +1 -1
- package/_cjs/clients/createBundlerClient.js.map +1 -0
- package/_cjs/clients/createSmartAccountClient.js +20 -0
- package/_cjs/clients/createSmartAccountClient.js.map +1 -0
- package/_cjs/clients/decorators/bundler.js.map +1 -1
- package/_cjs/clients/decorators/pimlico.js.map +1 -1
- package/_cjs/clients/decorators/smartAccount.js +28 -0
- package/_cjs/clients/decorators/smartAccount.js.map +1 -0
- package/_cjs/clients/decorators/stackup.js.map +1 -1
- package/_cjs/clients/pimlico.js.map +1 -1
- package/_cjs/clients/stackup.js.map +1 -1
- package/_cjs/index.js +9 -5
- package/_cjs/index.js.map +1 -1
- package/_cjs/utils/deepHexlify.js +4 -4
- package/_cjs/utils/deepHexlify.js.map +1 -1
- package/_cjs/utils/getAction.js +8 -0
- package/_cjs/utils/getAction.js.map +1 -0
- package/_cjs/utils/getUserOperationHash.js.map +1 -1
- package/_cjs/utils/index.js +7 -1
- package/_cjs/utils/index.js.map +1 -1
- package/_cjs/utils/observe.js +7 -2
- package/_cjs/utils/observe.js.map +1 -1
- package/_cjs/utils/signUserOperationHashWithECDSA.js +7 -7
- package/_cjs/utils/signUserOperationHashWithECDSA.js.map +1 -1
- package/_esm/accounts/index.js +4 -0
- package/_esm/accounts/index.js.map +1 -0
- package/_esm/accounts/privateKeyToSimpleSmartAccount.js +169 -0
- package/_esm/accounts/privateKeyToSimpleSmartAccount.js.map +1 -0
- package/_esm/accounts/types.js +2 -0
- package/_esm/accounts/types.js.map +1 -0
- package/_esm/actions/bundler/estimateUserOperationGas.js +4 -1
- package/_esm/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_esm/actions/bundler/getUserOperationByHash.js.map +1 -1
- package/_esm/actions/bundler/sendUserOperation.js +4 -3
- package/_esm/actions/bundler/sendUserOperation.js.map +1 -1
- package/_esm/actions/bundler/supportedEntryPoints.js.map +1 -1
- package/_esm/actions/bundler/waitForUserOperationReceipt.js +7 -2
- package/_esm/actions/bundler/waitForUserOperationReceipt.js.map +1 -1
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/pimlico/getUserOperationGasPrice.js +1 -1
- package/_esm/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
- package/_esm/actions/pimlico/getUserOperationStatus.js.map +1 -1
- package/_esm/actions/pimlico/sponsorUserOperation.js +4 -1
- package/_esm/actions/pimlico/sponsorUserOperation.js.map +1 -1
- package/_esm/actions/pimlico.js.map +1 -1
- package/_esm/actions/public/getAccountNonce.js +7 -5
- package/_esm/actions/public/getAccountNonce.js.map +1 -1
- package/_esm/actions/public/getSenderAddress.js +8 -5
- package/_esm/actions/public/getSenderAddress.js.map +1 -1
- package/_esm/actions/smartAccount/deployContract.js +64 -0
- package/_esm/actions/smartAccount/deployContract.js.map +1 -0
- package/_esm/actions/smartAccount/prepareUserOperationRequest.js +67 -0
- package/_esm/actions/smartAccount/prepareUserOperationRequest.js.map +1 -0
- package/_esm/actions/smartAccount/sendTransaction.js +87 -0
- package/_esm/actions/smartAccount/sendTransaction.js.map +1 -0
- package/_esm/actions/smartAccount/sendUserOperation.js +18 -0
- package/_esm/actions/smartAccount/sendUserOperation.js.map +1 -0
- package/_esm/actions/smartAccount/signMessage.js +59 -0
- package/_esm/actions/smartAccount/signMessage.js.map +1 -0
- package/_esm/actions/smartAccount/signTypedData.js +129 -0
- package/_esm/actions/smartAccount/signTypedData.js.map +1 -0
- package/_esm/actions/smartAccount/writeContract.js +19 -0
- package/_esm/actions/smartAccount/writeContract.js.map +1 -0
- package/_esm/actions/smartAccount.js +8 -0
- package/_esm/actions/smartAccount.js.map +1 -0
- package/_esm/actions/stackup/sponsorUserOperation.js +5 -1
- package/_esm/actions/stackup/sponsorUserOperation.js.map +1 -1
- package/_esm/clients/{bundler.js → createBundlerClient.js} +1 -1
- package/_esm/clients/createBundlerClient.js.map +1 -0
- package/_esm/clients/createSmartAccountClient.js +38 -0
- package/_esm/clients/createSmartAccountClient.js.map +1 -0
- package/_esm/clients/decorators/bundler.js.map +1 -1
- package/_esm/clients/decorators/pimlico.js.map +1 -1
- package/_esm/clients/decorators/smartAccount.js +24 -0
- package/_esm/clients/decorators/smartAccount.js.map +1 -0
- package/_esm/clients/decorators/stackup.js.map +1 -1
- package/_esm/clients/pimlico.js.map +1 -1
- package/_esm/clients/stackup.js.map +1 -1
- package/_esm/index.js +5 -2
- package/_esm/index.js.map +1 -1
- package/_esm/utils/deepHexlify.js +6 -4
- package/_esm/utils/deepHexlify.js.map +1 -1
- package/_esm/utils/getAction.js +6 -0
- package/_esm/utils/getAction.js.map +1 -0
- package/_esm/utils/getUserOperationHash.js.map +1 -1
- package/_esm/utils/index.js +5 -0
- package/_esm/utils/index.js.map +1 -1
- package/_esm/utils/observe.js +7 -2
- package/_esm/utils/observe.js.map +1 -1
- package/_esm/utils/signUserOperationHashWithECDSA.js +7 -6
- package/_esm/utils/signUserOperationHashWithECDSA.js.map +1 -1
- package/_types/accounts/index.d.ts +4 -0
- package/_types/accounts/index.d.ts.map +1 -0
- package/_types/accounts/privateKeyToSimpleSmartAccount.d.ts +20 -0
- package/_types/accounts/privateKeyToSimpleSmartAccount.d.ts.map +1 -0
- package/_types/accounts/types.d.ts +21 -0
- package/_types/accounts/types.d.ts.map +1 -0
- package/_types/actions/bundler/chainId.d.ts +1 -1
- package/_types/actions/bundler/chainId.d.ts.map +1 -1
- package/_types/actions/bundler/estimateUserOperationGas.d.ts +1 -1
- package/_types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
- package/_types/actions/bundler/getUserOperationByHash.d.ts +1 -1
- package/_types/actions/bundler/getUserOperationByHash.d.ts.map +1 -1
- package/_types/actions/bundler/getUserOperationReceipt.d.ts +1 -1
- package/_types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -1
- package/_types/actions/bundler/sendUserOperation.d.ts +1 -3
- package/_types/actions/bundler/sendUserOperation.d.ts.map +1 -1
- package/_types/actions/bundler/supportedEntryPoints.d.ts +1 -1
- package/_types/actions/bundler/supportedEntryPoints.d.ts.map +1 -1
- package/_types/actions/bundler/waitForUserOperationReceipt.d.ts +1 -1
- package/_types/actions/bundler/waitForUserOperationReceipt.d.ts.map +1 -1
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/pimlico/getUserOperationGasPrice.d.ts +4 -3
- package/_types/actions/pimlico/getUserOperationGasPrice.d.ts.map +1 -1
- package/_types/actions/pimlico/getUserOperationStatus.d.ts +3 -4
- package/_types/actions/pimlico/getUserOperationStatus.d.ts.map +1 -1
- package/_types/actions/pimlico/sponsorUserOperation.d.ts +3 -3
- package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -1
- package/_types/actions/pimlico.d.ts.map +1 -1
- package/_types/actions/public/getAccountNonce.d.ts +5 -5
- package/_types/actions/public/getAccountNonce.d.ts.map +1 -1
- package/_types/actions/public/getSenderAddress.d.ts +3 -4
- package/_types/actions/public/getSenderAddress.d.ts.map +1 -1
- package/_types/actions/smartAccount/deployContract.d.ts +34 -0
- package/_types/actions/smartAccount/deployContract.d.ts.map +1 -0
- package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts +20 -0
- package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts.map +1 -0
- package/_types/actions/smartAccount/sendTransaction.d.ts +52 -0
- package/_types/actions/smartAccount/sendTransaction.d.ts.map +1 -0
- package/_types/actions/smartAccount/sendUserOperation.d.ts +10 -0
- package/_types/actions/smartAccount/sendUserOperation.d.ts.map +1 -0
- package/_types/actions/smartAccount/signMessage.d.ts +50 -0
- package/_types/actions/smartAccount/signMessage.d.ts.map +1 -0
- package/_types/actions/smartAccount/signTypedData.d.ts +104 -0
- package/_types/actions/smartAccount/signTypedData.d.ts.map +1 -0
- package/_types/actions/smartAccount/writeContract.d.ts +57 -0
- package/_types/actions/smartAccount/writeContract.d.ts.map +1 -0
- package/_types/actions/smartAccount.d.ts +8 -0
- package/_types/actions/smartAccount.d.ts.map +1 -0
- package/_types/actions/stackup/sponsorUserOperation.d.ts.map +1 -1
- package/_types/clients/{bundler.d.ts → createBundlerClient.d.ts} +1 -1
- package/_types/clients/createBundlerClient.d.ts.map +1 -0
- package/_types/clients/createSmartAccountClient.d.ts +281 -0
- package/_types/clients/createSmartAccountClient.d.ts.map +1 -0
- package/_types/clients/decorators/bundler.d.ts.map +1 -1
- package/_types/clients/decorators/pimlico.d.ts.map +1 -1
- package/_types/clients/decorators/smartAccount.d.ts +276 -0
- package/_types/clients/decorators/smartAccount.d.ts.map +1 -0
- package/_types/clients/decorators/stackup.d.ts.map +1 -1
- package/_types/clients/pimlico.d.ts.map +1 -1
- package/_types/clients/stackup.d.ts.map +1 -1
- package/_types/index.d.ts +6 -3
- package/_types/index.d.ts.map +1 -1
- package/_types/types/bundler.d.ts +4 -1
- package/_types/types/bundler.d.ts.map +1 -1
- package/_types/types/index.d.ts +19 -0
- package/_types/types/index.d.ts.map +1 -1
- package/_types/types/pimlico.d.ts.map +1 -1
- package/_types/types/stackup.d.ts.map +1 -1
- package/_types/utils/deepHexlify.d.ts.map +1 -1
- package/_types/utils/getAction.d.ts +3 -0
- package/_types/utils/getAction.d.ts.map +1 -0
- package/_types/utils/getUserOperationHash.d.ts.map +1 -1
- package/_types/utils/index.d.ts +2 -0
- package/_types/utils/index.d.ts.map +1 -1
- package/_types/utils/observe.d.ts.map +1 -1
- package/_types/utils/signUserOperationHashWithECDSA.d.ts +3 -11
- package/_types/utils/signUserOperationHashWithECDSA.d.ts.map +1 -1
- package/accounts/index.ts +14 -0
- package/accounts/privateKeyToSimpleSmartAccount.ts +220 -0
- package/accounts/types.ts +33 -0
- package/actions/bundler/chainId.ts +1 -1
- package/actions/bundler/estimateUserOperationGas.ts +9 -3
- package/actions/bundler/getUserOperationByHash.ts +8 -2
- package/actions/bundler/getUserOperationReceipt.ts +1 -1
- package/actions/bundler/sendUserOperation.ts +13 -6
- package/actions/bundler/supportedEntryPoints.ts +4 -2
- package/actions/bundler/waitForUserOperationReceipt.ts +50 -23
- package/actions/index.ts +4 -1
- package/actions/pimlico/getUserOperationGasPrice.ts +12 -5
- package/actions/pimlico/getUserOperationStatus.ts +11 -4
- package/actions/pimlico/sponsorUserOperation.ts +20 -7
- package/actions/pimlico.ts +8 -2
- package/actions/public/getAccountNonce.ts +20 -8
- package/actions/public/getSenderAddress.ts +25 -8
- package/actions/smartAccount/deployContract.ts +110 -0
- package/actions/smartAccount/prepareUserOperationRequest.ts +138 -0
- package/actions/smartAccount/sendTransaction.ts +136 -0
- package/actions/smartAccount/sendUserOperation.ts +70 -0
- package/actions/smartAccount/signMessage.ts +79 -0
- package/actions/smartAccount/signTypedData.ts +161 -0
- package/actions/smartAccount/writeContract.ts +126 -0
- package/actions/smartAccount.ts +42 -0
- package/actions/stackup/sponsorUserOperation.ts +13 -3
- package/clients/{bundler.ts → createBundlerClient.ts} +14 -3
- package/clients/createSmartAccountClient.ts +95 -0
- package/clients/decorators/bundler.ts +19 -9
- package/clients/decorators/pimlico.ts +18 -6
- package/clients/decorators/smartAccount.ts +390 -0
- package/clients/decorators/stackup.ts +12 -4
- package/clients/pimlico.ts +19 -4
- package/clients/stackup.ts +16 -3
- package/index.ts +20 -3
- package/package.json +11 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/bundler.ts +4 -1
- package/types/index.ts +24 -0
- package/types/pimlico.ts +12 -2
- package/types/stackup.ts +4 -1
- package/utils/deepHexlify.test.ts +13 -7
- package/utils/deepHexlify.ts +5 -4
- package/utils/getAction.ts +15 -0
- package/utils/getUserOperationHash.ts +10 -2
- package/utils/index.ts +15 -2
- package/utils/observe.ts +18 -5
- package/utils/signUserOperationHashWithECDSA.ts +17 -20
- package/_cjs/clients/bundler.js.map +0 -1
- package/_esm/clients/bundler.js.map +0 -1
- package/_types/clients/bundler.d.ts.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.signMessage = void 0;
|
|
4
|
+
const index_js_1 = require("../../utils/index.js");
|
|
5
|
+
async function signMessage(client, { account: account_ = client.account, message }) {
|
|
6
|
+
if (!account_)
|
|
7
|
+
throw new index_js_1.AccountOrClientNotFoundError({
|
|
8
|
+
docsPath: "/docs/actions/wallet/signMessage"
|
|
9
|
+
});
|
|
10
|
+
const account = (0, index_js_1.parseAccount)(account_);
|
|
11
|
+
if (account.type === "local")
|
|
12
|
+
return account.signMessage({ message });
|
|
13
|
+
throw new Error("Sign message is not supported by this account");
|
|
14
|
+
}
|
|
15
|
+
exports.signMessage = signMessage;
|
|
16
|
+
//# sourceMappingURL=signMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signMessage.js","sourceRoot":"","sources":["../../../actions/smartAccount/signMessage.ts"],"names":[],"mappings":";;;AAQA,mDAG6B;AAgDtB,KAAK,UAAU,WAAW,CAI7B,MAA2C,EAC3C,EACI,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAClC,OAAO,EACuB;IAElC,IAAI,CAAC,QAAQ;QACT,MAAM,IAAI,uCAA4B,CAAC;YACnC,QAAQ,EAAE,kCAAkC;SAC/C,CAAC,CAAA;IAEN,MAAM,OAAO,GAAG,IAAA,uBAAY,EAAC,QAAQ,CAAC,CAAA;IACtC,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,OAAO,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;IAErE,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;AACpE,CAAC;AAnBD,kCAmBC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.signTypedData = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const index_js_1 = require("../../utils/index.js");
|
|
6
|
+
async function signTypedData(client, { account: account_ = client.account, domain, message, primaryType, types: types_ }) {
|
|
7
|
+
if (!account_) {
|
|
8
|
+
throw new index_js_1.AccountOrClientNotFoundError({
|
|
9
|
+
docsPath: "/docs/actions/wallet/signMessage"
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
const account = (0, index_js_1.parseAccount)(account_);
|
|
13
|
+
const types = {
|
|
14
|
+
EIP712Domain: (0, viem_1.getTypesForEIP712Domain)({ domain }),
|
|
15
|
+
...types_
|
|
16
|
+
};
|
|
17
|
+
(0, viem_1.validateTypedData)({
|
|
18
|
+
domain,
|
|
19
|
+
message,
|
|
20
|
+
primaryType,
|
|
21
|
+
types
|
|
22
|
+
});
|
|
23
|
+
if (account.type === "local") {
|
|
24
|
+
return account.signTypedData({
|
|
25
|
+
domain,
|
|
26
|
+
primaryType,
|
|
27
|
+
types,
|
|
28
|
+
message
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
throw new Error("Sign type message is not supported by this account");
|
|
32
|
+
}
|
|
33
|
+
exports.signTypedData = signTypedData;
|
|
34
|
+
//# sourceMappingURL=signTypedData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../actions/smartAccount/signTypedData.ts"],"names":[],"mappings":";;;AAAA,+BAUa;AAEb,mDAG6B;AAoGtB,KAAK,UAAU,aAAa,CAM/B,MAA2C,EAC3C,EACI,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAClC,MAAM,EACN,OAAO,EACP,WAAW,EACX,KAAK,EAAE,MAAM,EAC6C;IAE9D,IAAI,CAAC,QAAQ,EAAE;QACX,MAAM,IAAI,uCAA4B,CAAC;YACnC,QAAQ,EAAE,kCAAkC;SAC/C,CAAC,CAAA;KACL;IAED,MAAM,OAAO,GAAG,IAAA,uBAAY,EAAC,QAAQ,CAAC,CAAA;IAEtC,MAAM,KAAK,GAAG;QACV,YAAY,EAAE,IAAA,8BAAuB,EAAC,EAAE,MAAM,EAAE,CAAC;QACjD,GAAI,MAAqB;KAC5B,CAAA;IAED,IAAA,wBAAiB,EAAC;QACd,MAAM;QACN,OAAO;QACP,WAAW;QACX,KAAK;KACe,CAAC,CAAA;IAEzB,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE;QAC1B,OAAO,OAAO,CAAC,aAAa,CAAC;YACzB,MAAM;YACN,WAAW;YACX,KAAK;YACL,OAAO;SACa,CAAC,CAAA;KAC5B;IAED,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;AACzE,CAAC;AA7CD,sCA6CC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.writeContract = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const getAction_js_1 = require("../../utils/getAction.js");
|
|
6
|
+
const sendTransaction_js_1 = require("./sendTransaction.js");
|
|
7
|
+
async function writeContract(client, { abi, address, args, dataSuffix, functionName, ...request }) {
|
|
8
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
9
|
+
abi,
|
|
10
|
+
args,
|
|
11
|
+
functionName
|
|
12
|
+
});
|
|
13
|
+
const hash = await (0, getAction_js_1.getAction)(client, (sendTransaction_js_1.sendTransaction))({
|
|
14
|
+
data: `${data}${dataSuffix ? dataSuffix.replace("0x", "") : ""}`,
|
|
15
|
+
to: address,
|
|
16
|
+
...request
|
|
17
|
+
});
|
|
18
|
+
return hash;
|
|
19
|
+
}
|
|
20
|
+
exports.writeContract = writeContract;
|
|
21
|
+
//# sourceMappingURL=writeContract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeContract.js","sourceRoot":"","sources":["../../../actions/smartAccount/writeContract.ts"],"names":[],"mappings":";;;AAAA,+BASa;AAEb,2DAAoD;AAEpD,6DAG6B;AAoEtB,KAAK,UAAU,aAAa,CAO/B,MAA2C,EAC3C,EACI,GAAG,EACH,OAAO,EACP,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,GAAG,OAAO,EAOb;IAED,MAAM,IAAI,GAAG,IAAA,yBAAkB,EAAC;QAC5B,GAAG;QACH,IAAI;QACJ,YAAY;KACiD,CAAC,CAAA;IAClE,MAAM,IAAI,GAAG,MAAM,IAAA,wBAAS,EACxB,MAAM,EACN,CAAA,oCAAiD,CAAA,CACpD,CAAC;QACE,IAAI,EAAE,GAAG,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE;QAChE,EAAE,EAAE,OAAO;QACX,GAAG,OAAO;KAKb,CAAC,CAAA;IACF,OAAO,IAAI,CAAA;AACf,CAAC;AAzCD,sCAyCC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.signTypedData = exports.signMessage = exports.sendUserOperation = exports.sendTransaction = exports.prepareUserOperationRequest = exports.deployContract = void 0;
|
|
4
|
+
const deployContract_js_1 = require("./smartAccount/deployContract.js");
|
|
5
|
+
Object.defineProperty(exports, "deployContract", { enumerable: true, get: function () { return deployContract_js_1.deployContract; } });
|
|
6
|
+
const prepareUserOperationRequest_js_1 = require("./smartAccount/prepareUserOperationRequest.js");
|
|
7
|
+
Object.defineProperty(exports, "prepareUserOperationRequest", { enumerable: true, get: function () { return prepareUserOperationRequest_js_1.prepareUserOperationRequest; } });
|
|
8
|
+
const sendTransaction_js_1 = require("./smartAccount/sendTransaction.js");
|
|
9
|
+
Object.defineProperty(exports, "sendTransaction", { enumerable: true, get: function () { return sendTransaction_js_1.sendTransaction; } });
|
|
10
|
+
const sendUserOperation_js_1 = require("./smartAccount/sendUserOperation.js");
|
|
11
|
+
Object.defineProperty(exports, "sendUserOperation", { enumerable: true, get: function () { return sendUserOperation_js_1.sendUserOperation; } });
|
|
12
|
+
const signMessage_js_1 = require("./smartAccount/signMessage.js");
|
|
13
|
+
Object.defineProperty(exports, "signMessage", { enumerable: true, get: function () { return signMessage_js_1.signMessage; } });
|
|
14
|
+
const signTypedData_js_1 = require("./smartAccount/signTypedData.js");
|
|
15
|
+
Object.defineProperty(exports, "signTypedData", { enumerable: true, get: function () { return signTypedData_js_1.signTypedData; } });
|
|
16
|
+
//# sourceMappingURL=smartAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smartAccount.js","sourceRoot":"","sources":["../../actions/smartAccount.ts"],"names":[],"mappings":";;;AAAA,wEAGyC;AAyBrC,+FA1BA,kCAAc,OA0BA;AAvBlB,kGAKsD;AAoBlD,4GArBA,4DAA2B,OAqBA;AAlB/B,0EAG0C;AAkBtC,gGAnBA,oCAAe,OAmBA;AAhBnB,8EAI4C;AAaxC,kGAdA,wCAAiB,OAcA;AAXrB,kEAA2D;AAcvD,4FAdK,4BAAW,OAcL;AAZf,sEAA+D;AAa3D,8FAbK,gCAAa,OAaL"}
|
|
@@ -5,7 +5,11 @@ const deepHexlify_js_1 = require("../../utils/deepHexlify.js");
|
|
|
5
5
|
const sponsorUserOperation = async (client, args) => {
|
|
6
6
|
const response = await client.request({
|
|
7
7
|
method: "pm_sponsorUserOperation",
|
|
8
|
-
params: [
|
|
8
|
+
params: [
|
|
9
|
+
(0, deepHexlify_js_1.deepHexlify)(args.userOperation),
|
|
10
|
+
args.entryPoint,
|
|
11
|
+
args.context
|
|
12
|
+
]
|
|
9
13
|
});
|
|
10
14
|
return {
|
|
11
15
|
paymasterAndData: response.paymasterAndData,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sponsorUserOperation.js","sourceRoot":"","sources":["../../../actions/stackup/sponsorUserOperation.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"sponsorUserOperation.js","sourceRoot":"","sources":["../../../actions/stackup/sponsorUserOperation.ts"],"names":[],"mappings":";;;AAQA,+DAAwD;AA8CjD,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;YACJ,IAAA,4BAAW,EAAC,IAAI,CAAC,aAAa,CAAiC;YAC/D,IAAI,CAAC,UAAU;YACf,IAAI,CAAC,OAAO;SACf;KACJ,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;AAnBY,QAAA,oBAAoB,wBAmBhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createBundlerClient.js","sourceRoot":"","sources":["../../clients/createBundlerClient.ts"],"names":[],"mappings":";;;AAOA,+BAAmC;AAEnC,wDAA6E;AA8BtE,MAAM,mBAAmB,GAAG,CAI/B,UAAgD,EACnC,EAAE;IACf,MAAM,EAAE,GAAG,GAAG,QAAQ,EAAE,IAAI,GAAG,gBAAgB,EAAE,GAAG,UAAU,CAAA;IAC9D,MAAM,MAAM,GAAG,IAAA,mBAAY,EAAC;QACxB,GAAG,UAAU;QACb,GAAG;QACH,IAAI;QACJ,IAAI,EAAE,eAAe;KACxB,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,2BAAc,CAAC,CAAA;AACxC,CAAC,CAAA;AAdY,QAAA,mBAAmB,uBAc/B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSmartAccountClient = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const smartAccount_js_1 = require("./decorators/smartAccount.js");
|
|
6
|
+
const createSmartAccountClient = (parameters) => {
|
|
7
|
+
const { key = "Account", name = "Smart Account Client", transport } = parameters;
|
|
8
|
+
const client = (0, viem_1.createClient)({
|
|
9
|
+
...parameters,
|
|
10
|
+
key,
|
|
11
|
+
name,
|
|
12
|
+
transport: (opts) => transport({ ...opts, retryCount: 0 }),
|
|
13
|
+
type: "smartAccountClient"
|
|
14
|
+
});
|
|
15
|
+
return client.extend((0, smartAccount_js_1.smartAccountActions)({
|
|
16
|
+
sponsorUserOperation: parameters.sponsorUserOperation
|
|
17
|
+
}));
|
|
18
|
+
};
|
|
19
|
+
exports.createSmartAccountClient = createSmartAccountClient;
|
|
20
|
+
//# sourceMappingURL=createSmartAccountClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSmartAccountClient.js","sourceRoot":"","sources":["../../clients/createSmartAccountClient.ts"],"names":[],"mappings":";;;AAQA,+BAAmC;AAKnC,kEAGqC;AAoD9B,MAAM,wBAAwB,GAAG,CAKpC,UACkC,EACiC,EAAE;IACrE,MAAM,EACF,GAAG,GAAG,SAAS,EACf,IAAI,GAAG,sBAAsB,EAC7B,SAAS,EACZ,GAAG,UAAU,CAAA;IACd,MAAM,MAAM,GAAG,IAAA,mBAAY,EAAC;QACxB,GAAG,UAAU;QACb,GAAG;QACH,IAAI;QACJ,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;QAC1D,IAAI,EAAE,oBAAoB;KAC7B,CAAC,CAAA;IAEF,OAAO,MAAM,CAAC,MAAM,CAChB,IAAA,qCAAmB,EAAC;QAChB,oBAAoB,EAAE,UAAU,CAAC,oBAAoB;KACxD,CAAC,CACL,CAAA;AACL,CAAC,CAAA;AA1BY,QAAA,wBAAwB,4BA0BpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundler.js","sourceRoot":"","sources":["../../../clients/decorators/bundler.ts"],"names":[],"mappings":";;;AAEA,iEAA0D;AAC1D,mGAI0D;AAC1D,+FAIwD;AACxD,iGAIyD;AACzD,
|
|
1
|
+
{"version":3,"file":"bundler.js","sourceRoot":"","sources":["../../../clients/decorators/bundler.ts"],"names":[],"mappings":";;;AAEA,iEAA0D;AAC1D,mGAI0D;AAC1D,+FAIwD;AACxD,iGAIyD;AACzD,qFAGmD;AACnD,2FAAoF;AACpF,yGAG6D;AAgL7D,MAAM,cAAc,GAAG,CAAC,MAAc,EAAkB,EAAE,CAAC,CAAC;IACxD,iBAAiB,EAAE,KAAK,EACpB,IAAiC,EACpB,EAAE,CAAC,IAAA,wCAAiB,EAAC,MAAuB,EAAE,IAAI,CAAC;IACpE,wBAAwB,EAAE,CAAC,IAAwC,EAAE,EAAE,CACnE,IAAA,sDAAwB,EAAC,MAAuB,EAAE,IAAI,CAAC;IAC3D,oBAAoB,EAAE,GAAuB,EAAE,CAC3C,IAAA,8CAAoB,EAAC,MAAuB,CAAC;IACjD,OAAO,EAAE,GAAG,EAAE,CAAC,IAAA,oBAAO,EAAC,MAAuB,CAAC;IAC/C,sBAAsB,EAAE,CAAC,IAAsC,EAAE,EAAE,CAC/D,IAAA,kDAAsB,EAAC,MAAuB,EAAE,IAAI,CAAC;IACzD,uBAAuB,EAAE,CAAC,IAAuC,EAAE,EAAE,CACjE,IAAA,oDAAuB,EAAC,MAAuB,EAAE,IAAI,CAAC;IAC1D,2BAA2B,EAAE,CACzB,IAA2C,EAC7C,EAAE,CAAC,IAAA,4DAA2B,EAAC,MAAuB,EAAE,IAAI,CAAC;CAClE,CAAC,CAAA;AAEO,wCAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pimlico.js","sourceRoot":"","sources":["../../../clients/decorators/pimlico.ts"],"names":[],"mappings":";;;AACA,mGAG0D;AAC1D,+FAIwD;AACxD,2FAIsD;
|
|
1
|
+
{"version":3,"file":"pimlico.js","sourceRoot":"","sources":["../../../clients/decorators/pimlico.ts"],"names":[],"mappings":";;;AACA,mGAG0D;AAC1D,+FAIwD;AACxD,2FAIsD;AAmD/C,MAAM,qBAAqB,GAAG,CACjC,MAAc,EACO,EAAE,CAAC,CAAC;IACzB,wBAAwB,EAAE,KAAK,IAAI,EAAE,CACjC,IAAA,sDAAwB,EAAC,MAA8B,CAAC;IAC5D,sBAAsB,EAAE,KAAK,EAAE,IAAsC,EAAE,EAAE,CACrE,IAAA,kDAAsB,EAAC,MAA8B,EAAE,IAAI,CAAC;CACnE,CAAC,CAAA;AAPW,QAAA,qBAAqB,yBAOhC;AA+BK,MAAM,uBAAuB,GAAG,CACnC,MAAc,EACe,EAAE,CAAC,CAAC;IACjC,oBAAoB,EAAE,KAAK,EAAE,IAAoC,EAAE,EAAE,CACjE,IAAA,8CAAoB,EAAC,MAAgC,EAAE,IAAI,CAAC;CACnE,CAAC,CAAA;AALW,QAAA,uBAAuB,2BAKlC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.smartAccountActions = void 0;
|
|
4
|
+
const deployContract_js_1 = require("../../actions/smartAccount/deployContract.js");
|
|
5
|
+
const prepareUserOperationRequest_js_1 = require("../../actions/smartAccount/prepareUserOperationRequest.js");
|
|
6
|
+
const sendTransaction_js_1 = require("../../actions/smartAccount/sendTransaction.js");
|
|
7
|
+
const signMessage_js_1 = require("../../actions/smartAccount/signMessage.js");
|
|
8
|
+
const signTypedData_js_1 = require("../../actions/smartAccount/signTypedData.js");
|
|
9
|
+
const writeContract_js_1 = require("../../actions/smartAccount/writeContract.js");
|
|
10
|
+
const smartAccountActions = ({ sponsorUserOperation }) => (client) => ({
|
|
11
|
+
prepareUserOperationRequest: (args) => (0, prepareUserOperationRequest_js_1.prepareUserOperationRequest)(client, args),
|
|
12
|
+
deployContract: (args) => (0, deployContract_js_1.deployContract)(client, {
|
|
13
|
+
...args,
|
|
14
|
+
sponsorUserOperation
|
|
15
|
+
}),
|
|
16
|
+
sendTransaction: (args) => (0, sendTransaction_js_1.sendTransaction)(client, {
|
|
17
|
+
...args,
|
|
18
|
+
sponsorUserOperation
|
|
19
|
+
}),
|
|
20
|
+
signMessage: (args) => (0, signMessage_js_1.signMessage)(client, args),
|
|
21
|
+
signTypedData: (args) => (0, signTypedData_js_1.signTypedData)(client, args),
|
|
22
|
+
writeContract: (args) => (0, writeContract_js_1.writeContract)(client, {
|
|
23
|
+
...args,
|
|
24
|
+
sponsorUserOperation
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
exports.smartAccountActions = smartAccountActions;
|
|
28
|
+
//# sourceMappingURL=smartAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smartAccount.js","sourceRoot":"","sources":["../../../clients/decorators/smartAccount.ts"],"names":[],"mappings":";;;AAWA,oFAGqD;AACrD,8GAIkE;AAClE,sFAGsD;AACtD,8EAAuE;AACvE,kFAA2E;AAC3E,kFAGoD;AA0U7C,MAAM,mBAAmB,GAC5B,CAAC,EAAE,oBAAoB,EAAkC,EAAE,EAAE,CAC7D,CAOI,MAAiD,EACP,EAAE,CAAC,CAAC;IAC9C,2BAA2B,EAAE,CAAC,IAAI,EAAE,EAAE,CAClC,IAAA,4DAA2B,EAAC,MAAM,EAAE,IAAI,CAAC;IAC7C,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE,CACrB,IAAA,kCAAc,EAAC,MAAM,EAAE;QACnB,GAAG,IAAI;QACP,oBAAoB;KACkB,CAAC;IAC/C,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE,CACtB,IAAA,oCAAe,EAAC,MAAM,EAAE;QACpB,GAAG,IAAI;QACP,oBAAoB;KACmB,CAAC;IAChD,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,4BAAW,EAAC,MAAM,EAAE,IAAI,CAAC;IAChD,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,gCAAa,EAAC,MAAM,EAAE,IAAI,CAAC;IACpD,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CACpB,IAAA,gCAAa,EAAC,MAAM,EAAE;QAClB,GAAG,IAAI;QACP,oBAAoB;KACiB,CAAC;CACjD,CAAC,CAAA;AA9BO,QAAA,mBAAmB,uBA8B1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stackup.js","sourceRoot":"","sources":["../../../clients/decorators/stackup.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"stackup.js","sourceRoot":"","sources":["../../../clients/decorators/stackup.ts"],"names":[],"mappings":";;;AACA,mEAG0C;AAC1C,2FAIsD;AAwD/C,MAAM,uBAAuB,GAAG,CACnC,MAAc,EACe,EAAE,CAAC,CAAC;IACjC,oBAAoB,EAAE,KAAK,EAAE,IAAoC,EAAE,EAAE,CACjE,IAAA,8CAAoB,EAAC,MAAgC,EAAE,IAAI,CAAC;IAChE,QAAQ,EAAE,KAAK,EAAE,IAAwB,EAAE,EAAE,CACzC,IAAA,sBAAQ,EAAC,MAAgC,EAAE,IAAI,CAAC;CACvD,CAAC,CAAA;AAPW,QAAA,uBAAuB,2BAOlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pimlico.js","sourceRoot":"","sources":["../../clients/pimlico.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"pimlico.js","sourceRoot":"","sources":["../../clients/pimlico.ts"],"names":[],"mappings":";;;AAOA,+BAAmC;AAKnC,wDAA6E;AAC7E,wDAKgC;AAqCzB,MAAM,0BAA0B,GAAG,CAItC,UAAgD,EAC5B,EAAE;IACtB,MAAM,EAAE,GAAG,GAAG,QAAQ,EAAE,IAAI,GAAG,wBAAwB,EAAE,GAAG,UAAU,CAAA;IACtE,MAAM,MAAM,GAAG,IAAA,mBAAY,EAAC;QACxB,GAAG,UAAU;QACb,GAAG;QACH,IAAI;QACJ,IAAI,EAAE,sBAAsB;KAC/B,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,2BAAc,CAAC,CAAC,MAAM,CAAC,kCAAqB,CAAC,CAAA;AACtE,CAAC,CAAA;AAdY,QAAA,0BAA0B,8BActC;AAqBM,MAAM,4BAA4B,GAAG,CAIxC,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,oCAAuB,CAAC,CAAA;AACjD,CAAC,CAAA;AAdY,QAAA,4BAA4B,gCAcxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stackup.js","sourceRoot":"","sources":["../../clients/stackup.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"stackup.js","sourceRoot":"","sources":["../../clients/stackup.ts"],"names":[],"mappings":";;;AAAA,+BAOa;AAEb,wDAA6E;AAC7E,wDAGgC;AA6BzB,MAAM,4BAA4B,GAAG,CAIxC,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;AAdY,QAAA,4BAA4B,gCAcxC"}
|
package/_cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUserOperationHash = exports.WaitForUserOperationReceiptTimeoutError = exports.bundlerActions = exports.createBundlerClient = exports.waitForUserOperationReceipt = exports.getAccountNonce = exports.getSenderAddress = exports.getUserOperationReceipt = exports.getUserOperationByHash = exports.chainId = exports.supportedEntryPoints = exports.estimateUserOperationGas = exports.sendUserOperation = void 0;
|
|
3
|
+
exports.getUserOperationHash = exports.smartAccountActions = exports.createSmartAccountClient = exports.WaitForUserOperationReceiptTimeoutError = exports.bundlerActions = exports.createBundlerClient = exports.waitForUserOperationReceipt = exports.getAccountNonce = exports.getSenderAddress = exports.getUserOperationReceipt = exports.getUserOperationByHash = exports.chainId = exports.supportedEntryPoints = exports.estimateUserOperationGas = exports.sendUserOperation = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const getSenderAddress_js_1 = require("./actions/public/getSenderAddress.js");
|
|
6
6
|
Object.defineProperty(exports, "getSenderAddress", { enumerable: true, get: function () { return getSenderAddress_js_1.getSenderAddress; } });
|
|
@@ -22,10 +22,14 @@ const waitForUserOperationReceipt_js_2 = require("./actions/bundler/waitForUserO
|
|
|
22
22
|
Object.defineProperty(exports, "WaitForUserOperationReceiptTimeoutError", { enumerable: true, get: function () { return waitForUserOperationReceipt_js_2.WaitForUserOperationReceiptTimeoutError; } });
|
|
23
23
|
const getAccountNonce_js_1 = require("./actions/public/getAccountNonce.js");
|
|
24
24
|
Object.defineProperty(exports, "getAccountNonce", { enumerable: true, get: function () { return getAccountNonce_js_1.getAccountNonce; } });
|
|
25
|
-
const
|
|
26
|
-
Object.defineProperty(exports, "createBundlerClient", { enumerable: true, get: function () { return
|
|
27
|
-
const
|
|
28
|
-
Object.defineProperty(exports, "
|
|
25
|
+
const createBundlerClient_js_1 = require("./clients/createBundlerClient.js");
|
|
26
|
+
Object.defineProperty(exports, "createBundlerClient", { enumerable: true, get: function () { return createBundlerClient_js_1.createBundlerClient; } });
|
|
27
|
+
const createSmartAccountClient_js_1 = require("./clients/createSmartAccountClient.js");
|
|
28
|
+
Object.defineProperty(exports, "createSmartAccountClient", { enumerable: true, get: function () { return createSmartAccountClient_js_1.createSmartAccountClient; } });
|
|
29
|
+
const bundler_js_1 = require("./clients/decorators/bundler.js");
|
|
30
|
+
Object.defineProperty(exports, "bundlerActions", { enumerable: true, get: function () { return bundler_js_1.bundlerActions; } });
|
|
31
|
+
const smartAccount_js_1 = require("./clients/decorators/smartAccount.js");
|
|
32
|
+
Object.defineProperty(exports, "smartAccountActions", { enumerable: true, get: function () { return smartAccount_js_1.smartAccountActions; } });
|
|
29
33
|
const getUserOperationHash_js_1 = require("./utils/getUserOperationHash.js");
|
|
30
34
|
Object.defineProperty(exports, "getUserOperationHash", { enumerable: true, get: function () { return getUserOperationHash_js_1.getUserOperationHash; } });
|
|
31
35
|
tslib_1.__exportStar(require("./utils/index.js"), exports);
|
package/_cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;AAaA,8EAAuE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;AAaA,8EAAuE;AAwDnE,iGAxDK,sCAAgB,OAwDL;AAtDpB,6DAAsD;AAmDlD,wFAnDK,oBAAO,OAmDL;AAlDX,+FAAwF;AAgDpF,yGAhDK,sDAAwB,OAgDL;AA/C5B,2FAAoF;AAkDhF,uGAlDK,kDAAsB,OAkDL;AAjD1B,6FAAsF;AAkDlF,wGAlDK,oDAAuB,OAkDL;AAjD3B,iFAA0E;AA4CtE,kGA5CK,wCAAiB,OA4CL;AA3CrB,uFAAgF;AA6C5E,qGA7CK,8CAAoB,OA6CL;AA5CxB,qGAA8F;AAkD1F,4GAlDK,4DAA2B,OAkDL;AAjD/B,qGAGyD;AAiDrD,wHAlDA,wEAAuC,OAkDA;AA/C3C,4EAAqE;AA2CjE,gGA3CK,oCAAe,OA2CL;AA1CnB,6EAGyC;AAyCrC,oGA1CA,4CAAmB,OA0CA;AAxCvB,uFAAgF;AA2C5E,yGA3CK,sDAAwB,OA2CL;AArC5B,gEAAgE;AAmC5D,+FAnCK,2BAAc,OAmCL;AAlClB,0EAG6C;AAkCzC,oGAnCA,qCAAmB,OAmCA;AAOvB,6EAAsE;AAE7D,qGAFA,8CAAoB,OAEA;AAC7B,2DAAgC"}
|
|
@@ -22,10 +22,10 @@ function deepHexlify(obj) {
|
|
|
22
22
|
if (Array.isArray(obj)) {
|
|
23
23
|
return obj.map((member) => deepHexlify(member));
|
|
24
24
|
}
|
|
25
|
-
return Object.keys(obj).reduce((set, key) =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
25
|
+
return Object.keys(obj).reduce((set, key) => {
|
|
26
|
+
set[key] = deepHexlify(obj[key]);
|
|
27
|
+
return set;
|
|
28
|
+
}, {});
|
|
29
29
|
}
|
|
30
30
|
exports.deepHexlify = deepHexlify;
|
|
31
31
|
//# sourceMappingURL=deepHexlify.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepHexlify.js","sourceRoot":"","sources":["../../utils/deepHexlify.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAEf,QAAA,wBAAwB,GAAG;IACpC,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,SAAS;CACV,CAAA;AAGV,SAAgB,WAAW,CAAC,GAAQ;IAChC,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;QAC3B,OAAO,SAAS,CAAA;KACnB;IACD,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,SAAS,EAAE;QACpE,OAAO,GAAG,CAAA;KACb;SAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAChC,OAAO,IAAA,YAAK,EAAC,GAAG,CAAC,CAAA;KACpB;SAAM,IAAI,GAAG,CAAC,YAAY,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC5D,OAAO,IAAA,YAAK,EAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;KAC1C;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACpB,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;KAClD;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"deepHexlify.js","sourceRoot":"","sources":["../../utils/deepHexlify.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAEf,QAAA,wBAAwB,GAAG;IACpC,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,SAAS;CACV,CAAA;AAGV,SAAgB,WAAW,CAAC,GAAQ;IAChC,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;QAC3B,OAAO,SAAS,CAAA;KACnB;IACD,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,SAAS,EAAE;QACpE,OAAO,GAAG,CAAA;KACb;SAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAChC,OAAO,IAAA,YAAK,EAAC,GAAG,CAAC,CAAA;KACpB;SAAM,IAAI,GAAG,CAAC,YAAY,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC5D,OAAO,IAAA,YAAK,EAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;KAC1C;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACpB,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;KAClD;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAE1B,CAAC,GAAQ,EAAE,GAAW,EAAE,EAAE;QACtB,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;QAChC,OAAO,GAAG,CAAA;IACd,CAAC,EACD,EAAE,CACL,CAAA;AACL,CAAC;AAtBD,kCAsBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAction = void 0;
|
|
4
|
+
function getAction(client, action, actionName = action.name) {
|
|
5
|
+
return (params) => client[actionName]?.(params) ?? action(client, params);
|
|
6
|
+
}
|
|
7
|
+
exports.getAction = getAction;
|
|
8
|
+
//# sourceMappingURL=getAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAction.js","sourceRoot":"","sources":["../../utils/getAction.ts"],"names":[],"mappings":";;;AAEA,SAAgB,SAAS,CACrB,MAAc,EAEd,MAA8C,EAC9C,aAAqB,MAAM,CAAC,IAAI;IAEhC,OAAO,CAAC,MAAc,EAAc,EAAE,CAE9B,MAGH,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACzD,CAAC;AAZD,8BAYC"}
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"getUserOperationHash.js","sourceRo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,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;AAXY,QAAA,oBAAoB,wBAWhC"}
|
package/_cjs/utils/index.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AccountOrClientNotFoundError = exports.signUserOperationHashWithECDSA = exports.getUserOperationHash = void 0;
|
|
3
|
+
exports.AccountOrClientNotFoundError = exports.signUserOperationHashWithECDSA = exports.getUserOperationHash = exports.parseAccount = void 0;
|
|
4
4
|
const getUserOperationHash_js_1 = require("./getUserOperationHash.js");
|
|
5
5
|
Object.defineProperty(exports, "getUserOperationHash", { enumerable: true, get: function () { return getUserOperationHash_js_1.getUserOperationHash; } });
|
|
6
6
|
const signUserOperationHashWithECDSA_js_1 = require("./signUserOperationHashWithECDSA.js");
|
|
7
7
|
Object.defineProperty(exports, "AccountOrClientNotFoundError", { enumerable: true, get: function () { return signUserOperationHashWithECDSA_js_1.AccountOrClientNotFoundError; } });
|
|
8
8
|
Object.defineProperty(exports, "signUserOperationHashWithECDSA", { enumerable: true, get: function () { return signUserOperationHashWithECDSA_js_1.signUserOperationHashWithECDSA; } });
|
|
9
|
+
function parseAccount(account) {
|
|
10
|
+
if (typeof account === "string")
|
|
11
|
+
return { address: account, type: "json-rpc" };
|
|
12
|
+
return account;
|
|
13
|
+
}
|
|
14
|
+
exports.parseAccount = parseAccount;
|
|
9
15
|
//# 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":";;;AACA,uEAGkC;AAa9B,qGAdA,8CAAoB,OAcA;AAZxB,2FAG4C;AAYxC,6GAdA,gEAA4B,OAcA;AAD5B,+GAZA,kEAA8B,OAYA;AATlC,SAAgB,YAAY,CAAC,OAA0B;IACnD,IAAI,OAAO,OAAO,KAAK,QAAQ;QAC3B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAA;IACjD,OAAO,OAAO,CAAA;AAClB,CAAC;AAJD,oCAIC"}
|
package/_cjs/utils/observe.js
CHANGED
|
@@ -18,7 +18,10 @@ function observe(observerId, callbacks, fn) {
|
|
|
18
18
|
unsubscribe();
|
|
19
19
|
};
|
|
20
20
|
const listeners = getListeners();
|
|
21
|
-
exports.listenersCache.set(observerId, [
|
|
21
|
+
exports.listenersCache.set(observerId, [
|
|
22
|
+
...listeners,
|
|
23
|
+
{ id: callbackId, fns: callbacks }
|
|
24
|
+
]);
|
|
22
25
|
if (listeners && listeners.length > 0)
|
|
23
26
|
return unwatch;
|
|
24
27
|
const emit = {};
|
|
@@ -27,7 +30,9 @@ function observe(observerId, callbacks, fn) {
|
|
|
27
30
|
const listeners = getListeners();
|
|
28
31
|
if (listeners.length === 0)
|
|
29
32
|
return;
|
|
30
|
-
|
|
33
|
+
for (const listener of listeners) {
|
|
34
|
+
listener.fns[key]?.(...args);
|
|
35
|
+
}
|
|
31
36
|
});
|
|
32
37
|
}
|
|
33
38
|
const cleanup = fn(emit);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observe.js","sourceRoot":"","sources":["../../utils/observe.ts"],"names":[],"mappings":";;;AAMa,QAAA,cAAc,GAAiB,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"observe.js","sourceRoot":"","sources":["../../utils/observe.ts"],"names":[],"mappings":";;;AAMa,QAAA,cAAc,GAAiB,IAAI,GAAG,EAGhD,CAAA;AACU,QAAA,YAA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CAAC;gBAAE,OAAM;YAClC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;gBAC9B,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAA;aAC/B;QACL,CAAC,CAAkD,CAAA;KACtD;IAED,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;IACxB,IAAI,OAAO,OAAO,KAAK,UAAU;QAAE,oBAAY,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAExE,OAAO,OAAO,CAAA;AAClB,CAAC;AAjDD,0BAiDC"}
|
|
@@ -3,11 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.signUserOperationHashWithECDSA = exports.AccountOrClientNotFoundError = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
const getUserOperationHash_js_1 = require("./getUserOperationHash.js");
|
|
6
|
-
|
|
7
|
-
if (typeof account === "string")
|
|
8
|
-
return { address: account, type: "json-rpc" };
|
|
9
|
-
return account;
|
|
10
|
-
}
|
|
6
|
+
const index_js_1 = require("./index.js");
|
|
11
7
|
class AccountOrClientNotFoundError extends viem_1.BaseError {
|
|
12
8
|
constructor({ docsPath } = {}) {
|
|
13
9
|
super([
|
|
@@ -36,9 +32,13 @@ const signUserOperationHashWithECDSA = async ({ client, account: account_ = clie
|
|
|
36
32
|
userOperationHash = hash;
|
|
37
33
|
}
|
|
38
34
|
else {
|
|
39
|
-
userOperationHash = (0, getUserOperationHash_js_1.getUserOperationHash)({
|
|
35
|
+
userOperationHash = (0, getUserOperationHash_js_1.getUserOperationHash)({
|
|
36
|
+
userOperation,
|
|
37
|
+
chainId,
|
|
38
|
+
entryPoint
|
|
39
|
+
});
|
|
40
40
|
}
|
|
41
|
-
const account = parseAccount(account_);
|
|
41
|
+
const account = (0, index_js_1.parseAccount)(account_);
|
|
42
42
|
if (account.type === "local")
|
|
43
43
|
return account.signMessage({
|
|
44
44
|
message: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signUserOperationHashWithECDSA.js","sourceRoot":"","sources":["../../utils/signUserOperationHashWithECDSA.ts"],"names":[],"mappings":";;;AAAA,+BASa;
|
|
1
|
+
{"version":3,"file":"signUserOperationHashWithECDSA.js","sourceRoot":"","sources":["../../utils/signUserOperationHashWithECDSA.ts"],"names":[],"mappings":";;;AAAA,+BASa;AAGb,uEAAgE;AAChE,yCAAyC;AAsBzC,MAAa,4BAA6B,SAAQ,gBAAS;IAEvD,YAAY,EAAE,QAAQ,KAA4B,EAAE;QAChD,KAAK,CACD;YACI,wDAAwD;YACxD,wHAAwH;SAC3H,CAAC,IAAI,CAAC,IAAI,CAAC,EACZ;YACI,QAAQ;YACR,QAAQ,EAAE,SAAS;SACtB,CACJ,CAAA;QAXI;;;;mBAAO,8BAA8B;WAAA;IAY9C,CAAC;CACJ;AAdD,oEAcC;AAyBM,MAAM,8BAA8B,GAAG,KAAK,EAIjD,EACE,MAAM,EACN,OAAO,EAAE,QAAQ,GAAG,MAAM,EAAE,OAAO,EACnC,IAAI,EACJ,aAAa,EACb,OAAO,EACP,UAAU,EAKb,EAAgB,EAAE;IACf,IAAI,CAAC,QAAQ;QACT,MAAM,IAAI,4BAA4B,CAAC;YACnC,QAAQ,EACJ,gEAAgE;SACvE,CAAC,CAAA;IAEN,IAAI,iBAAuB,CAAA;IAE3B,IAAI,IAAI,EAAE;QACN,iBAAiB,GAAG,IAAI,CAAA;KAC3B;SAAM;QACH,iBAAiB,GAAG,IAAA,8CAAoB,EAAC;YACrC,aAAa;YACb,OAAO;YACP,UAAU;SACb,CAAC,CAAA;KACL;IAED,MAAM,OAAO,GAAG,IAAA,uBAAY,EAAC,QAAQ,CAAC,CAAA;IAEtC,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO;QACxB,OAAO,OAAO,CAAC,WAAW,CAAC;YACvB,OAAO,EAAE;gBACL,GAAG,EAAE,iBAAiB;aACzB;SACJ,CAAC,CAAA;IAEN,IAAI,CAAC,MAAM;QACP,MAAM,IAAI,4BAA4B,CAAC;YACnC,QAAQ,EACJ,gEAAgE;SACvE,CAAC,CAAA;IAEN,OAAO,MAAM,CAAC,OAAO,CAAC;QAClB,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE,CAAC,iBAAiB,EAAE,OAAO,CAAC,OAAO,CAAC;KAC/C,CAAC,CAAA;AACN,CAAC,CAAA;AArDY,QAAA,8BAA8B,kCAqD1C"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SignTransactionNotSupportedBySmartAccount, privateKeyToSimpleSmartAccount } from "./privateKeyToSimpleSmartAccount.js";
|
|
2
|
+
import {} from "./types.js";
|
|
3
|
+
export { SignTransactionNotSupportedBySmartAccount, privateKeyToSimpleSmartAccount };
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../accounts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,yCAAyC,EACzC,8BAA8B,EACjC,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EAAqB,MAAM,YAAY,CAAA;AAE9C,OAAO,EACH,yCAAyC,EAEzC,8BAA8B,EAEjC,CAAA"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { BaseError, concatHex, encodeFunctionData } from "viem";
|
|
2
|
+
import { privateKeyToAccount, toAccount } from "viem/accounts";
|
|
3
|
+
import { getBytecode, getChainId } from "viem/actions";
|
|
4
|
+
import { getAccountNonce } from "../actions/public/getAccountNonce.js";
|
|
5
|
+
import { getSenderAddress } from "../actions/public/getSenderAddress.js";
|
|
6
|
+
import { getUserOperationHash } from "../utils/getUserOperationHash.js";
|
|
7
|
+
import {} from "./types.js";
|
|
8
|
+
export class SignTransactionNotSupportedBySmartAccount extends BaseError {
|
|
9
|
+
constructor({ docsPath } = {}) {
|
|
10
|
+
super([
|
|
11
|
+
"A smart account cannot sign or send transaction, it can only sign message or userOperation.",
|
|
12
|
+
"Please send user operation instead."
|
|
13
|
+
].join("\n"), {
|
|
14
|
+
docsPath,
|
|
15
|
+
docsSlug: "account"
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(this, "name", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true,
|
|
21
|
+
value: "SignTransactionNotSupportedBySmartAccount"
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const getAccountInitCode = async (factoryAddress, owner, index = 0n) => {
|
|
26
|
+
if (!owner)
|
|
27
|
+
throw new Error("Owner account not found");
|
|
28
|
+
return concatHex([
|
|
29
|
+
factoryAddress,
|
|
30
|
+
encodeFunctionData({
|
|
31
|
+
abi: [
|
|
32
|
+
{
|
|
33
|
+
inputs: [
|
|
34
|
+
{
|
|
35
|
+
internalType: "address",
|
|
36
|
+
name: "owner",
|
|
37
|
+
type: "address"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
internalType: "uint256",
|
|
41
|
+
name: "salt",
|
|
42
|
+
type: "uint256"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
name: "createAccount",
|
|
46
|
+
outputs: [
|
|
47
|
+
{
|
|
48
|
+
internalType: "contract SimpleAccount",
|
|
49
|
+
name: "ret",
|
|
50
|
+
type: "address"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
stateMutability: "nonpayable",
|
|
54
|
+
type: "function"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
functionName: "createAccount",
|
|
58
|
+
args: [owner, index]
|
|
59
|
+
})
|
|
60
|
+
]);
|
|
61
|
+
};
|
|
62
|
+
const getAccountAddress = async ({ client, factoryAddress, entryPoint, owner }) => {
|
|
63
|
+
const initCode = await getAccountInitCode(factoryAddress, owner);
|
|
64
|
+
return getSenderAddress(client, {
|
|
65
|
+
initCode,
|
|
66
|
+
entryPoint
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* @description Creates an Simple Account from a private key.
|
|
71
|
+
*
|
|
72
|
+
* @returns A Private Key Simple Account.
|
|
73
|
+
*/
|
|
74
|
+
export async function privateKeyToSimpleSmartAccount(client, { privateKey, factoryAddress, entryPoint }) {
|
|
75
|
+
const privateKeyAccount = privateKeyToAccount(privateKey);
|
|
76
|
+
const [accountAddress, chainId] = await Promise.all([
|
|
77
|
+
getAccountAddress({
|
|
78
|
+
client,
|
|
79
|
+
factoryAddress,
|
|
80
|
+
entryPoint,
|
|
81
|
+
owner: privateKeyAccount.address
|
|
82
|
+
}),
|
|
83
|
+
getChainId(client)
|
|
84
|
+
]);
|
|
85
|
+
if (!accountAddress)
|
|
86
|
+
throw new Error("Account address not found");
|
|
87
|
+
const account = toAccount({
|
|
88
|
+
address: accountAddress,
|
|
89
|
+
async signMessage({ message }) {
|
|
90
|
+
return privateKeyAccount.signMessage({ message });
|
|
91
|
+
},
|
|
92
|
+
async signTransaction(_, __) {
|
|
93
|
+
throw new SignTransactionNotSupportedBySmartAccount();
|
|
94
|
+
},
|
|
95
|
+
async signTypedData(typedData) {
|
|
96
|
+
return privateKeyAccount.signTypedData({ ...typedData, privateKey });
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return {
|
|
100
|
+
...account,
|
|
101
|
+
client: client,
|
|
102
|
+
publicKey: accountAddress,
|
|
103
|
+
entryPoint: entryPoint,
|
|
104
|
+
source: "privateKeySimpleSmartAccount",
|
|
105
|
+
async getNonce() {
|
|
106
|
+
return getAccountNonce(client, {
|
|
107
|
+
sender: accountAddress,
|
|
108
|
+
entryPoint: entryPoint
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
async signUserOperation(userOperation) {
|
|
112
|
+
return account.signMessage({
|
|
113
|
+
message: {
|
|
114
|
+
raw: getUserOperationHash({
|
|
115
|
+
userOperation,
|
|
116
|
+
entryPoint: entryPoint,
|
|
117
|
+
chainId: chainId
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
async getInitCode() {
|
|
123
|
+
const contractCode = await getBytecode(client, {
|
|
124
|
+
address: accountAddress
|
|
125
|
+
});
|
|
126
|
+
if ((contractCode?.length ?? 0) > 2)
|
|
127
|
+
return "0x";
|
|
128
|
+
return getAccountInitCode(factoryAddress, privateKeyAccount.address);
|
|
129
|
+
},
|
|
130
|
+
async encodeDeployCallData(_) {
|
|
131
|
+
throw new Error("Simple account doesn't support account deployment");
|
|
132
|
+
},
|
|
133
|
+
async encodeCallData({ to, value, data }) {
|
|
134
|
+
return encodeFunctionData({
|
|
135
|
+
abi: [
|
|
136
|
+
{
|
|
137
|
+
inputs: [
|
|
138
|
+
{
|
|
139
|
+
internalType: "address",
|
|
140
|
+
name: "dest",
|
|
141
|
+
type: "address"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
internalType: "uint256",
|
|
145
|
+
name: "value",
|
|
146
|
+
type: "uint256"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
internalType: "bytes",
|
|
150
|
+
name: "func",
|
|
151
|
+
type: "bytes"
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
name: "execute",
|
|
155
|
+
outputs: [],
|
|
156
|
+
stateMutability: "nonpayable",
|
|
157
|
+
type: "function"
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
functionName: "execute",
|
|
161
|
+
args: [to, value, data]
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
async getDummySignature() {
|
|
165
|
+
return "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c";
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=privateKeyToSimpleSmartAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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