@aa-sdk/core 4.0.0-beta.7 → 4.0.0-beta.9
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/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +9 -4
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js +17 -12
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
- package/dist/esm/actions/smartAccount/signMessage.js +1 -1
- package/dist/esm/actions/smartAccount/signMessage.js.map +1 -1
- package/dist/esm/actions/smartAccount/signTypedData.js +1 -1
- package/dist/esm/actions/smartAccount/signTypedData.js.map +1 -1
- package/dist/esm/client/decorators/smartAccountClient.d.ts +2 -5
- package/dist/esm/client/decorators/smartAccountClient.js +1 -5
- package/dist/esm/client/decorators/smartAccountClient.js.map +1 -1
- package/dist/esm/middleware/erc7677middleware.d.ts +4 -4
- package/dist/esm/middleware/erc7677middleware.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +9 -4
- package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts.map +1 -1
- package/dist/types/client/decorators/smartAccountClient.d.ts +2 -5
- package/dist/types/client/decorators/smartAccountClient.d.ts.map +1 -1
- package/dist/types/middleware/erc7677middleware.d.ts +4 -4
- package/dist/types/middleware/erc7677middleware.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/actions/smartAccount/checkGasSponsorshipEligibility.ts +33 -16
- package/src/actions/smartAccount/signMessage.ts +1 -1
- package/src/actions/smartAccount/signTypedData.ts +1 -1
- package/src/client/decorators/smartAccountClient.ts +9 -14
- package/src/middleware/erc7677middleware.ts +9 -9
- package/src/version.ts +1 -1
- package/dist/esm/actions/smartAccount/signMessageWith6492.d.ts +0 -4
- package/dist/esm/actions/smartAccount/signMessageWith6492.js +0 -8
- package/dist/esm/actions/smartAccount/signMessageWith6492.js.map +0 -1
- package/dist/esm/actions/smartAccount/signTypedDataWith6492.d.ts +0 -6
- package/dist/esm/actions/smartAccount/signTypedDataWith6492.js +0 -8
- package/dist/esm/actions/smartAccount/signTypedDataWith6492.js.map +0 -1
- package/dist/types/actions/smartAccount/signMessageWith6492.d.ts +0 -5
- package/dist/types/actions/smartAccount/signMessageWith6492.d.ts.map +0 -1
- package/dist/types/actions/smartAccount/signTypedDataWith6492.d.ts +0 -7
- package/dist/types/actions/smartAccount/signTypedDataWith6492.d.ts.map +0 -1
- package/src/actions/smartAccount/signMessageWith6492.ts +0 -21
- package/src/actions/smartAccount/signTypedDataWith6492.ts +0 -23
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { Chain, Client, Transport } from "viem";
|
|
2
|
-
import type { SmartContractAccount } from "../../account/smartContractAccount.js";
|
|
2
|
+
import type { GetEntryPointFromAccount, SmartContractAccount } from "../../account/smartContractAccount.js";
|
|
3
|
+
import type { UserOperationStruct } from "../../types.js";
|
|
3
4
|
import type { SendUserOperationParameters, UserOperationContext } from "./types";
|
|
5
|
+
export type CheckGasSponsorshipEligibilityResult<TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>> = {
|
|
6
|
+
eligible: boolean;
|
|
7
|
+
request?: UserOperationStruct<TEntryPointVersion>;
|
|
8
|
+
};
|
|
4
9
|
/**
|
|
5
10
|
* This function verifies the eligibility of the connected account for gas sponsorship concerning the upcoming `UserOperation` (UO) that is intended to be sent.
|
|
6
11
|
* Internally, this method invokes `buildUserOperation`, which navigates through the middleware pipeline, including the `PaymasterMiddleware`. Its purpose is to construct the UO struct meant for transmission to the bundler. Following the construction of the UO struct, this function verifies if the resulting structure contains a non-empty `paymasterAndData` field.
|
|
@@ -10,7 +15,7 @@ import type { SendUserOperationParameters, UserOperationContext } from "./types"
|
|
|
10
15
|
* ```ts
|
|
11
16
|
* import { smartAccountClient } from "./smartAccountClient";
|
|
12
17
|
* // [!code focus:99]
|
|
13
|
-
* const eligible = await smartAccountClient.checkGasSponsorshipEligibility({
|
|
18
|
+
* const { eligible } = await smartAccountClient.checkGasSponsorshipEligibility({
|
|
14
19
|
* uo: {
|
|
15
20
|
* data: "0xCalldata",
|
|
16
21
|
* target: "0xTarget",
|
|
@@ -27,6 +32,6 @@ import type { SendUserOperationParameters, UserOperationContext } from "./types"
|
|
|
27
32
|
*
|
|
28
33
|
* @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for making RPC calls
|
|
29
34
|
* @param {SendUserOperationParameters} args containing the user operation, account, context, and overrides
|
|
30
|
-
* @returns {Promise<
|
|
35
|
+
* @returns {Promise<CheckGasSponsorshipEligibilityResult<TAccount>>} a Promise containing a boolean indicating if the account is elgibile for sponsorship and the sponsored UO
|
|
31
36
|
*/
|
|
32
|
-
export declare function checkGasSponsorshipEligibility<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(client: Client<TTransport, TChain, TAccount>, args: SendUserOperationParameters<TAccount, TContext>): Promise<
|
|
37
|
+
export declare function checkGasSponsorshipEligibility<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(client: Client<TTransport, TChain, TAccount>, args: SendUserOperationParameters<TAccount, TContext>): Promise<CheckGasSponsorshipEligibilityResult<TAccount>>;
|
|
@@ -11,7 +11,7 @@ import { buildUserOperation } from "./buildUserOperation.js";
|
|
|
11
11
|
* ```ts
|
|
12
12
|
* import { smartAccountClient } from "./smartAccountClient";
|
|
13
13
|
* // [!code focus:99]
|
|
14
|
-
* const eligible = await smartAccountClient.checkGasSponsorshipEligibility({
|
|
14
|
+
* const { eligible } = await smartAccountClient.checkGasSponsorshipEligibility({
|
|
15
15
|
* uo: {
|
|
16
16
|
* data: "0xCalldata",
|
|
17
17
|
* target: "0xTarget",
|
|
@@ -28,7 +28,7 @@ import { buildUserOperation } from "./buildUserOperation.js";
|
|
|
28
28
|
*
|
|
29
29
|
* @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for making RPC calls
|
|
30
30
|
* @param {SendUserOperationParameters} args containing the user operation, account, context, and overrides
|
|
31
|
-
* @returns {Promise<
|
|
31
|
+
* @returns {Promise<CheckGasSponsorshipEligibilityResult<TAccount>>} a Promise containing a boolean indicating if the account is elgibile for sponsorship and the sponsored UO
|
|
32
32
|
*/
|
|
33
33
|
export function checkGasSponsorshipEligibility(client, args) {
|
|
34
34
|
const { account = client.account, overrides, context } = args;
|
|
@@ -44,15 +44,20 @@ export function checkGasSponsorshipEligibility(client, args) {
|
|
|
44
44
|
overrides,
|
|
45
45
|
context,
|
|
46
46
|
})
|
|
47
|
-
.then((userOperationStruct) =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
.then((userOperationStruct) => ({
|
|
48
|
+
eligible: account.getEntryPoint().version === "0.6.0"
|
|
49
|
+
? userOperationStruct
|
|
50
|
+
.paymasterAndData !== "0x" &&
|
|
51
|
+
userOperationStruct
|
|
52
|
+
.paymasterAndData !== null
|
|
53
|
+
: userOperationStruct
|
|
54
|
+
.paymasterData !== "0x" &&
|
|
55
|
+
userOperationStruct
|
|
56
|
+
.paymasterData !== null,
|
|
57
|
+
request: userOperationStruct,
|
|
58
|
+
}))
|
|
59
|
+
.catch(() => ({
|
|
60
|
+
eligible: false,
|
|
61
|
+
}));
|
|
57
62
|
}
|
|
58
63
|
//# sourceMappingURL=checkGasSponsorshipEligibility.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkGasSponsorshipEligibility.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/checkGasSponsorshipEligibility.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkGasSponsorshipEligibility.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/checkGasSponsorshipEligibility.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAgB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,8BAA8B,CAU5C,MAA4C,EAC5C,IAAqD;IAErD,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAE9D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,uBAAuB,CAC/B,wBAAwB,EACxB,gCAAgC,EAChC,MAAM,CACP,CAAC;IACJ,CAAC;IAED,OAAO,kBAAkB,CAAC,MAAM,EAAE;QAChC,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,OAAO;QACP,SAAS;QACT,OAAO;KACR,CAAC;SACC,IAAI,CAAC,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;QAC9B,QAAQ,EACN,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO,KAAK,OAAO;YACzC,CAAC,CAAE,mBAAoD;iBAClD,gBAAgB,KAAK,IAAI;gBAC3B,mBAAoD;qBAClD,gBAAgB,KAAK,IAAI;YAC9B,CAAC,CAAE,mBAAoD;iBAClD,aAAa,KAAK,IAAI;gBACxB,mBAAoD;qBAClD,aAAa,KAAK,IAAI;QAC/B,OAAO,EAAE,mBAAmB;KAC7B,CAAC,CAAC;SACF,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;QACZ,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC,CAAC;AACR,CAAC","sourcesContent":["import type { Chain, Client, Transport } from \"viem\";\nimport type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport type { UserOperationStruct } from \"../../types.js\";\nimport { buildUserOperation } from \"./buildUserOperation.js\";\nimport type {\n SendUserOperationParameters,\n UserOperationContext,\n} from \"./types\";\n\nexport type CheckGasSponsorshipEligibilityResult<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n eligible: boolean;\n request?: UserOperationStruct<TEntryPointVersion>;\n};\n\n/**\n * This function verifies the eligibility of the connected account for gas sponsorship concerning the upcoming `UserOperation` (UO) that is intended to be sent.\n * Internally, this method invokes `buildUserOperation`, which navigates through the middleware pipeline, including the `PaymasterMiddleware`. Its purpose is to construct the UO struct meant for transmission to the bundler. Following the construction of the UO struct, this function verifies if the resulting structure contains a non-empty `paymasterAndData` field.\n * You can utilize this method before sending the user operation to confirm its eligibility for gas sponsorship. Depending on the outcome, it allows you to tailor the user experience accordingly, based on eligibility.\n *\n * @example\n * ```ts\n * import { smartAccountClient } from \"./smartAccountClient\";\n * // [!code focus:99]\n * const { eligible } = await smartAccountClient.checkGasSponsorshipEligibility({\n * uo: {\n * data: \"0xCalldata\",\n * target: \"0xTarget\",\n * value: 0n,\n * },\n * });\n *\n * console.log(\n * `User Operation is ${\n * eligible ? \"eligible\" : \"ineligible\"\n * } for gas sponsorship.`\n * );\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for making RPC calls\n * @param {SendUserOperationParameters} args containing the user operation, account, context, and overrides\n * @returns {Promise<CheckGasSponsorshipEligibilityResult<TAccount>>} a Promise containing a boolean indicating if the account is elgibile for sponsorship and the sponsored UO\n */\nexport function checkGasSponsorshipEligibility<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: SendUserOperationParameters<TAccount, TContext>\n): Promise<CheckGasSponsorshipEligibilityResult<TAccount>> {\n const { account = client.account, overrides, context } = args;\n\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"checkGasSponsorshipEligibility\",\n client\n );\n }\n\n return buildUserOperation(client, {\n uo: args.uo,\n account,\n overrides,\n context,\n })\n .then((userOperationStruct) => ({\n eligible:\n account.getEntryPoint().version === \"0.6.0\"\n ? (userOperationStruct as UserOperationStruct<\"0.6.0\">)\n .paymasterAndData !== \"0x\" &&\n (userOperationStruct as UserOperationStruct<\"0.6.0\">)\n .paymasterAndData !== null\n : (userOperationStruct as UserOperationStruct<\"0.7.0\">)\n .paymasterData !== \"0x\" &&\n (userOperationStruct as UserOperationStruct<\"0.7.0\">)\n .paymasterData !== null,\n request: userOperationStruct,\n }))\n .catch(() => ({\n eligible: false,\n }));\n}\n"]}
|
|
@@ -3,6 +3,6 @@ export const signMessage = async (client, { account = client.account, message })
|
|
|
3
3
|
if (!account) {
|
|
4
4
|
throw new AccountNotFoundError();
|
|
5
5
|
}
|
|
6
|
-
return account.
|
|
6
|
+
return account.signMessageWith6492({ message });
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=signMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signMessage.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/signMessage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAQ/D,MAAM,CAAC,MAAM,WAAW,GASJ,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;IAC1E,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IACD,OAAO,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"signMessage.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/signMessage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAQ/D,MAAM,CAAC,MAAM,WAAW,GASJ,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;IAC1E,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IACD,OAAO,OAAO,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import type { Chain, Client, Hex, SignableMessage, Transport } from \"viem\";\nimport type {\n GetAccountParameter,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\n\nexport type SignMessageParameters<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n> = { message: SignableMessage } & GetAccountParameter<TAccount>;\n\nexport const signMessage: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: SignMessageParameters<TAccount>\n) => Promise<Hex> = async (client, { account = client.account, message }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n return account.signMessageWith6492({ message });\n};\n"]}
|
|
@@ -3,6 +3,6 @@ export const signTypedData = async (client, { account = client.account, typedDat
|
|
|
3
3
|
if (!account) {
|
|
4
4
|
throw new AccountNotFoundError();
|
|
5
5
|
}
|
|
6
|
-
return account.
|
|
6
|
+
return account.signTypedDataWith6492(typedData);
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=signTypedData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/signTypedData.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAY/D,MAAM,CAAC,MAAM,aAAa,GAWN,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;IAC5E,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,OAAO,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/signTypedData.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAY/D,MAAM,CAAC,MAAM,aAAa,GAWN,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;IAC5E,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,OAAO,OAAO,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import type {\n Chain,\n Client,\n Hex,\n Transport,\n TypedData,\n TypedDataDefinition,\n} from \"viem\";\nimport type {\n GetAccountParameter,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\n\nexport type SignTypedDataParameters<\n TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n> = {\n typedData: TypedDataDefinition<TTypedData, TPrimaryType>;\n} & GetAccountParameter<TAccount>;\n\nexport const signTypedData: <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string,\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>\n) => Promise<Hex> = async (client, { account = client.account, typedData }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n return account.signTypedDataWith6492(typedData);\n};\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Address, type Chain, type Client, type Hex, type SendTransactionParameters, type Transport, type TypedData } from "viem";
|
|
2
2
|
import type { GetAccountParameter, GetEntryPointFromAccount, SmartContractAccount } from "../../account/smartContractAccount";
|
|
3
|
+
import { type CheckGasSponsorshipEligibilityResult } from "../../actions/smartAccount/checkGasSponsorshipEligibility.js";
|
|
3
4
|
import { type SignMessageParameters } from "../../actions/smartAccount/signMessage.js";
|
|
4
5
|
import { type SignTypedDataParameters } from "../../actions/smartAccount/signTypedData.js";
|
|
5
6
|
import type { BuildTransactionParameters, BuildUserOperationFromTransactionsResult, BuildUserOperationParameters, DropAndReplaceUserOperationParameters, SendTransactionsParameters, SendUserOperationParameters, SignUserOperationParameters, UpgradeAccountParams, UserOperationContext, WaitForUserOperationTxParameters } from "../../actions/smartAccount/types";
|
|
@@ -10,7 +11,7 @@ export type BaseSmartAccountClientActions<TChain extends Chain | undefined = Cha
|
|
|
10
11
|
buildUserOperation: (args: BuildUserOperationParameters<TAccount, TContext>) => Promise<UserOperationStruct<TEntryPointVersion>>;
|
|
11
12
|
buildUserOperationFromTx: (args: SendTransactionParameters<TChain, TAccount>, overrides?: UserOperationOverrides<TEntryPointVersion>, context?: TContext) => Promise<UserOperationStruct<TEntryPointVersion>>;
|
|
12
13
|
buildUserOperationFromTxs: (args: BuildTransactionParameters<TAccount, TContext>) => Promise<BuildUserOperationFromTransactionsResult<TEntryPointVersion>>;
|
|
13
|
-
checkGasSponsorshipEligibility: <TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(args: SendUserOperationParameters<TAccount, TContext>) => Promise<
|
|
14
|
+
checkGasSponsorshipEligibility: <TContext extends UserOperationContext | undefined = UserOperationContext | undefined, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>>(args: SendUserOperationParameters<TAccount, TContext>) => Promise<CheckGasSponsorshipEligibilityResult<TAccount, TEntryPointVersion>>;
|
|
14
15
|
signUserOperation: (args: SignUserOperationParameters<TAccount, TEntryPointVersion, TContext>) => Promise<UserOperationRequest<TEntryPointVersion>>;
|
|
15
16
|
dropAndReplaceUserOperation: (args: DropAndReplaceUserOperationParameters<TAccount, TContext>) => Promise<SendUserOperationResult<TEntryPointVersion>>;
|
|
16
17
|
sendTransaction: <TChainOverride extends Chain | undefined = undefined>(args: SendTransactionParameters<TChain, TAccount, TChainOverride>, overrides?: UserOperationOverrides<TEntryPointVersion>, context?: TContext) => Promise<Hex>;
|
|
@@ -22,10 +23,6 @@ export type BaseSmartAccountClientActions<TChain extends Chain | undefined = Cha
|
|
|
22
23
|
signTypedData: <const TTypedData extends TypedData | {
|
|
23
24
|
[key: string]: unknown;
|
|
24
25
|
}, TPrimaryType extends string = string>(args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>) => Promise<Hex>;
|
|
25
|
-
signMessageWith6492: (args: SignMessageParameters<TAccount>) => Promise<Hex>;
|
|
26
|
-
signTypedDataWith6492: <const TTypedData extends TypedData | {
|
|
27
|
-
[key: string]: unknown;
|
|
28
|
-
}, TPrimaryType extends string = string>(args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>) => Promise<Hex>;
|
|
29
26
|
} & (IsUndefined<TAccount> extends false ? {
|
|
30
27
|
getAddress: () => Address;
|
|
31
28
|
} : {
|
|
@@ -2,16 +2,14 @@ import {} from "viem";
|
|
|
2
2
|
import { buildUserOperation } from "../../actions/smartAccount/buildUserOperation.js";
|
|
3
3
|
import { buildUserOperationFromTx } from "../../actions/smartAccount/buildUserOperationFromTx.js";
|
|
4
4
|
import { buildUserOperationFromTxs } from "../../actions/smartAccount/buildUserOperationFromTxs.js";
|
|
5
|
-
import { checkGasSponsorshipEligibility } from "../../actions/smartAccount/checkGasSponsorshipEligibility.js";
|
|
5
|
+
import { checkGasSponsorshipEligibility, } from "../../actions/smartAccount/checkGasSponsorshipEligibility.js";
|
|
6
6
|
import { dropAndReplaceUserOperation } from "../../actions/smartAccount/dropAndReplaceUserOperation.js";
|
|
7
7
|
import { getAddress } from "../../actions/smartAccount/getAddress.js";
|
|
8
8
|
import { sendTransaction } from "../../actions/smartAccount/sendTransaction.js";
|
|
9
9
|
import { sendTransactions } from "../../actions/smartAccount/sendTransactions.js";
|
|
10
10
|
import { sendUserOperation } from "../../actions/smartAccount/sendUserOperation.js";
|
|
11
11
|
import { signMessage, } from "../../actions/smartAccount/signMessage.js";
|
|
12
|
-
import { signMessageWith6492 } from "../../actions/smartAccount/signMessageWith6492.js";
|
|
13
12
|
import { signTypedData, } from "../../actions/smartAccount/signTypedData.js";
|
|
14
|
-
import { signTypedDataWith6492 } from "../../actions/smartAccount/signTypedDataWith6492.js";
|
|
15
13
|
import { signUserOperation } from "../../actions/smartAccount/signUserOperation.js";
|
|
16
14
|
import { upgradeAccount } from "../../actions/smartAccount/upgradeAccount.js";
|
|
17
15
|
import { waitForUserOperationTransaction } from "../../actions/smartAccount/waitForUserOperationTransacation.js";
|
|
@@ -39,8 +37,6 @@ export const smartAccountClientActions = (client) => ({
|
|
|
39
37
|
getAddress: (args) => getAddress(client, args),
|
|
40
38
|
signMessage: (args) => signMessage(client, args),
|
|
41
39
|
signTypedData: (args) => signTypedData(client, args),
|
|
42
|
-
signMessageWith6492: (args) => signMessageWith6492(client, args),
|
|
43
|
-
signTypedDataWith6492: (args) => signTypedDataWith6492(client, args),
|
|
44
40
|
});
|
|
45
41
|
export const smartAccountClientMethodKeys = Object.keys(
|
|
46
42
|
// @ts-expect-error we just want to get the keys
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../../src/client/decorators/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAQN,MAAM,MAAM,CAAC;AAMd,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,yDAAyD,CAAC;AACpG,OAAO,EAAE,8BAA8B,EAAE,MAAM,8DAA8D,CAAC;AAC9G,OAAO,EAAE,2BAA2B,EAAE,MAAM,2DAA2D,CAAC;AACxG,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACpF,OAAO,EACL,WAAW,GAEZ,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AACxF,OAAO,EACL,aAAa,GAEd,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AAapF,OAAO,EAAE,cAAc,EAAE,M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C,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC;IACtD,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC;IAC9C,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC;IAChD,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC;IACpD,mBAAmB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC;IAChE,qBAAqB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC;CACrE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,IAAI;AACrD,gDAAgD;AAChD,yBAAyB,CAAC,SAAS,CAAC,CACrC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACvB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChB,OAAO,KAAK,CAAC;AACf,CAAC,EAAE,IAAI,GAAG,EAAU,CAAC,CAAC","sourcesContent":["import {\n type Address,\n type Chain,\n type Client,\n type Hex,\n type SendTransactionParameters,\n type Transport,\n type TypedData,\n} from \"viem\";\nimport type {\n GetAccountParameter,\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport { buildUserOperation } from \"../../actions/smartAccount/buildUserOperation.js\";\nimport { buildUserOperationFromTx } from \"../../actions/smartAccount/buildUserOperationFromTx.js\";\nimport { buildUserOperationFromTxs } from \"../../actions/smartAccount/buildUserOperationFromTxs.js\";\nimport { checkGasSponsorshipEligibility } from \"../../actions/smartAccount/checkGasSponsorshipEligibility.js\";\nimport { dropAndReplaceUserOperation } from \"../../actions/smartAccount/dropAndReplaceUserOperation.js\";\nimport { getAddress } from \"../../actions/smartAccount/getAddress.js\";\nimport { sendTransaction } from \"../../actions/smartAccount/sendTransaction.js\";\nimport { sendTransactions } from \"../../actions/smartAccount/sendTransactions.js\";\nimport { sendUserOperation } from \"../../actions/smartAccount/sendUserOperation.js\";\nimport {\n signMessage,\n type SignMessageParameters,\n} from \"../../actions/smartAccount/signMessage.js\";\nimport { signMessageWith6492 } from \"../../actions/smartAccount/signMessageWith6492.js\";\nimport {\n signTypedData,\n type SignTypedDataParameters,\n} from \"../../actions/smartAccount/signTypedData.js\";\nimport { signTypedDataWith6492 } from \"../../actions/smartAccount/signTypedDataWith6492.js\";\nimport { signUserOperation } from \"../../actions/smartAccount/signUserOperation.js\";\nimport type {\n BuildTransactionParameters,\n BuildUserOperationFromTransactionsResult,\n BuildUserOperationParameters,\n DropAndReplaceUserOperationParameters,\n SendTransactionsParameters,\n SendUserOperationParameters,\n SignUserOperationParameters,\n UpgradeAccountParams,\n UserOperationContext,\n WaitForUserOperationTxParameters,\n} from \"../../actions/smartAccount/types\";\nimport { upgradeAccount } from \"../../actions/smartAccount/upgradeAccount.js\";\nimport { waitForUserOperationTransaction } from \"../../actions/smartAccount/waitForUserOperationTransacation.js\";\nimport type {\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../../types\";\nimport type { IsUndefined } from \"../../utils\";\nimport type { SendUserOperationResult } from \"../types\";\n\n//#region SmartAccountClientActions\nexport type BaseSmartAccountClientActions<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n buildUserOperation: (\n args: BuildUserOperationParameters<TAccount, TContext>\n ) => Promise<UserOperationStruct<TEntryPointVersion>>;\n buildUserOperationFromTx: (\n args: SendTransactionParameters<TChain, TAccount>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext\n ) => Promise<UserOperationStruct<TEntryPointVersion>>;\n buildUserOperationFromTxs: (\n args: BuildTransactionParameters<TAccount, TContext>\n ) => Promise<BuildUserOperationFromTransactionsResult<TEntryPointVersion>>;\n checkGasSponsorshipEligibility: <\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n >(\n args: SendUserOperationParameters<TAccount, TContext>\n ) => Promise<boolean>;\n signUserOperation: (\n args: SignUserOperationParameters<TAccount, TEntryPointVersion, TContext>\n ) => Promise<UserOperationRequest<TEntryPointVersion>>;\n dropAndReplaceUserOperation: (\n args: DropAndReplaceUserOperationParameters<TAccount, TContext>\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n // TODO: for v4 we should combine override and context into an `opts` parameter\n // which wraps both of these properties so we can use GetContextParameter\n sendTransaction: <TChainOverride extends Chain | undefined = undefined>(\n args: SendTransactionParameters<TChain, TAccount, TChainOverride>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext\n ) => Promise<Hex>;\n sendTransactions: (\n args: SendTransactionsParameters<TAccount, TContext>\n ) => Promise<Hex>;\n sendUserOperation: (\n args: SendUserOperationParameters<\n TAccount,\n TContext,\n GetEntryPointFromAccount<TAccount>\n >\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n waitForUserOperationTransaction: (\n args: WaitForUserOperationTxParameters\n ) => Promise<Hex>;\n upgradeAccount: (\n args: UpgradeAccountParams<TAccount, TContext>\n ) => Promise<Hex>;\n signMessage: (args: SignMessageParameters<TAccount>) => Promise<Hex>;\n signTypedData: <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>\n ) => Promise<Hex>;\n signMessageWith6492: (args: SignMessageParameters<TAccount>) => Promise<Hex>;\n signTypedDataWith6492: <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>\n ) => Promise<Hex>;\n} & (IsUndefined<TAccount> extends false\n ? { getAddress: () => Address }\n : {\n getAddress: (args: GetAccountParameter<TAccount>) => Address;\n });\n// #endregion SmartAccountClientActions\n\n/**\n * Provides a set of smart account client actions to decorate the provided client. These actions include building and signing user operations, sending transactions, and more.\n *\n * NOTE: this is already added to clients returned from `createSmartAccountClient`\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client to bind the smart account actions to\n * @returns {BaseSmartAccountClientActions<TChain, TAccount, TContext>} An object containing various smart account client actions\n */\nexport const smartAccountClientActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => BaseSmartAccountClientActions<TChain, TAccount, TContext> = (client) => ({\n buildUserOperation: (args) => buildUserOperation(client, args),\n buildUserOperationFromTx: (args, overrides, context) =>\n buildUserOperationFromTx(client, args, overrides, context),\n buildUserOperationFromTxs: (args) => buildUserOperationFromTxs(client, args),\n checkGasSponsorshipEligibility: (args) =>\n checkGasSponsorshipEligibility(client, args),\n signUserOperation: (args) => signUserOperation(client, args),\n dropAndReplaceUserOperation: (args) =>\n dropAndReplaceUserOperation(client, args),\n sendTransaction: (args, overrides, context) =>\n sendTransaction(client, args, overrides, context),\n sendTransactions: (args) => sendTransactions(client, args),\n sendUserOperation: (args) => sendUserOperation(client, args),\n waitForUserOperationTransaction: (args) =>\n waitForUserOperationTransaction.bind(client)(client, args),\n upgradeAccount: (args) => upgradeAccount(client, args),\n getAddress: (args) => getAddress(client, args),\n signMessage: (args) => signMessage(client, args),\n signTypedData: (args) => signTypedData(client, args),\n signMessageWith6492: (args) => signMessageWith6492(client, args),\n signTypedDataWith6492: (args) => signTypedDataWith6492(client, args),\n});\n\nexport const smartAccountClientMethodKeys = Object.keys(\n // @ts-expect-error we just want to get the keys\n smartAccountClientActions(undefined)\n).reduce((accum, curr) => {\n accum.add(curr);\n return accum;\n}, new Set<string>());\n"]}
|
|
1
|
+
{"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../../src/client/decorators/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAQN,MAAM,MAAM,CAAC;AAMd,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,yDAAyD,CAAC;AACpG,OAAO,EACL,8BAA8B,GAE/B,MAAM,8DAA8D,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,2DAA2D,CAAC;AACxG,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACpF,OAAO,EACL,WAAW,GAEZ,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,aAAa,GAEd,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AAapF,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,gEAAgE,CAAC;AAkFjH,uCAAuC;AAEvC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAW2B,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5E,kBAAkB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC;IAC9D,wBAAwB,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EA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AAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,IAAI;AACrD,gDAAgD;AAChD,yBAAyB,CAAC,SAAS,CAAC,CACrC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACvB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChB,OAAO,KAAK,CAAC;AACf,CAAC,EAAE,IAAI,GAAG,EAAU,CAAC,CAAC","sourcesContent":["import {\n type Address,\n type Chain,\n type Client,\n type Hex,\n type SendTransactionParameters,\n type Transport,\n type TypedData,\n} from \"viem\";\nimport type {\n GetAccountParameter,\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport { buildUserOperation } from \"../../actions/smartAccount/buildUserOperation.js\";\nimport { buildUserOperationFromTx } from \"../../actions/smartAccount/buildUserOperationFromTx.js\";\nimport { buildUserOperationFromTxs } from \"../../actions/smartAccount/buildUserOperationFromTxs.js\";\nimport {\n checkGasSponsorshipEligibility,\n type CheckGasSponsorshipEligibilityResult,\n} from \"../../actions/smartAccount/checkGasSponsorshipEligibility.js\";\nimport { dropAndReplaceUserOperation } from \"../../actions/smartAccount/dropAndReplaceUserOperation.js\";\nimport { getAddress } from \"../../actions/smartAccount/getAddress.js\";\nimport { sendTransaction } from \"../../actions/smartAccount/sendTransaction.js\";\nimport { sendTransactions } from \"../../actions/smartAccount/sendTransactions.js\";\nimport { sendUserOperation } from \"../../actions/smartAccount/sendUserOperation.js\";\nimport {\n signMessage,\n type SignMessageParameters,\n} from \"../../actions/smartAccount/signMessage.js\";\nimport {\n signTypedData,\n type SignTypedDataParameters,\n} from \"../../actions/smartAccount/signTypedData.js\";\nimport { signUserOperation } from \"../../actions/smartAccount/signUserOperation.js\";\nimport type {\n BuildTransactionParameters,\n BuildUserOperationFromTransactionsResult,\n BuildUserOperationParameters,\n DropAndReplaceUserOperationParameters,\n SendTransactionsParameters,\n SendUserOperationParameters,\n SignUserOperationParameters,\n UpgradeAccountParams,\n UserOperationContext,\n WaitForUserOperationTxParameters,\n} from \"../../actions/smartAccount/types\";\nimport { upgradeAccount } from \"../../actions/smartAccount/upgradeAccount.js\";\nimport { waitForUserOperationTransaction } from \"../../actions/smartAccount/waitForUserOperationTransacation.js\";\nimport type {\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../../types\";\nimport type { IsUndefined } from \"../../utils\";\nimport type { SendUserOperationResult } from \"../types\";\n\n//#region SmartAccountClientActions\nexport type BaseSmartAccountClientActions<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n buildUserOperation: (\n args: BuildUserOperationParameters<TAccount, TContext>\n ) => Promise<UserOperationStruct<TEntryPointVersion>>;\n buildUserOperationFromTx: (\n args: SendTransactionParameters<TChain, TAccount>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext\n ) => Promise<UserOperationStruct<TEntryPointVersion>>;\n buildUserOperationFromTxs: (\n args: BuildTransactionParameters<TAccount, TContext>\n ) => Promise<BuildUserOperationFromTransactionsResult<TEntryPointVersion>>;\n checkGasSponsorshipEligibility: <\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n >(\n args: SendUserOperationParameters<TAccount, TContext>\n ) => Promise<\n CheckGasSponsorshipEligibilityResult<TAccount, TEntryPointVersion>\n >;\n signUserOperation: (\n args: SignUserOperationParameters<TAccount, TEntryPointVersion, TContext>\n ) => Promise<UserOperationRequest<TEntryPointVersion>>;\n dropAndReplaceUserOperation: (\n args: DropAndReplaceUserOperationParameters<TAccount, TContext>\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n // TODO: for v4 we should combine override and context into an `opts` parameter\n // which wraps both of these properties so we can use GetContextParameter\n sendTransaction: <TChainOverride extends Chain | undefined = undefined>(\n args: SendTransactionParameters<TChain, TAccount, TChainOverride>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext\n ) => Promise<Hex>;\n sendTransactions: (\n args: SendTransactionsParameters<TAccount, TContext>\n ) => Promise<Hex>;\n sendUserOperation: (\n args: SendUserOperationParameters<\n TAccount,\n TContext,\n GetEntryPointFromAccount<TAccount>\n >\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n waitForUserOperationTransaction: (\n args: WaitForUserOperationTxParameters\n ) => Promise<Hex>;\n upgradeAccount: (\n args: UpgradeAccountParams<TAccount, TContext>\n ) => Promise<Hex>;\n signMessage: (args: SignMessageParameters<TAccount>) => Promise<Hex>;\n signTypedData: <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>\n ) => Promise<Hex>;\n} & (IsUndefined<TAccount> extends false\n ? { getAddress: () => Address }\n : {\n getAddress: (args: GetAccountParameter<TAccount>) => Address;\n });\n// #endregion SmartAccountClientActions\n\n/**\n * Provides a set of smart account client actions to decorate the provided client. These actions include building and signing user operations, sending transactions, and more.\n *\n * NOTE: this is already added to clients returned from `createSmartAccountClient`\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client to bind the smart account actions to\n * @returns {BaseSmartAccountClientActions<TChain, TAccount, TContext>} An object containing various smart account client actions\n */\nexport const smartAccountClientActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => BaseSmartAccountClientActions<TChain, TAccount, TContext> = (client) => ({\n buildUserOperation: (args) => buildUserOperation(client, args),\n buildUserOperationFromTx: (args, overrides, context) =>\n buildUserOperationFromTx(client, args, overrides, context),\n buildUserOperationFromTxs: (args) => buildUserOperationFromTxs(client, args),\n checkGasSponsorshipEligibility: (args) =>\n checkGasSponsorshipEligibility(client, args),\n signUserOperation: (args) => signUserOperation(client, args),\n dropAndReplaceUserOperation: (args) =>\n dropAndReplaceUserOperation(client, args),\n sendTransaction: (args, overrides, context) =>\n sendTransaction(client, args, overrides, context),\n sendTransactions: (args) => sendTransactions(client, args),\n sendUserOperation: (args) => sendUserOperation(client, args),\n waitForUserOperationTransaction: (args) =>\n waitForUserOperationTransaction.bind(client)(client, args),\n upgradeAccount: (args) => upgradeAccount(client, args),\n getAddress: (args) => getAddress(client, args),\n signMessage: (args) => signMessage(client, args),\n signTypedData: (args) => signTypedData(client, args),\n});\n\nexport const smartAccountClientMethodKeys = Object.keys(\n // @ts-expect-error we just want to get the keys\n smartAccountClientActions(undefined)\n).reduce((accum, curr) => {\n accum.add(curr);\n return accum;\n}, new Set<string>());\n"]}
|
|
@@ -3,10 +3,10 @@ import type { ClientMiddlewareConfig } from "../client/types";
|
|
|
3
3
|
import type { EntryPointVersion } from "../entrypoint/types";
|
|
4
4
|
import type { UserOperationFeeOptions, UserOperationOverrides, UserOperationRequest, UserOperationStruct } from "../types";
|
|
5
5
|
import { type Deferrable } from "../utils/index.js";
|
|
6
|
-
export type Erc7677RpcSchema = [
|
|
6
|
+
export type Erc7677RpcSchema<TContext extends Record<string, any> = Record<string, any>> = [
|
|
7
7
|
{
|
|
8
8
|
Method: "pm_getPaymasterStubData";
|
|
9
|
-
Parameters: [UserOperationRequest, Address, Hex,
|
|
9
|
+
Parameters: [UserOperationRequest, Address, Hex, TContext];
|
|
10
10
|
ReturnType: {
|
|
11
11
|
sponsor?: {
|
|
12
12
|
name: string;
|
|
@@ -22,7 +22,7 @@ export type Erc7677RpcSchema = [
|
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
Method: "pm_getPaymasterData";
|
|
25
|
-
Parameters: [UserOperationRequest, Address, Hex,
|
|
25
|
+
Parameters: [UserOperationRequest, Address, Hex, TContext];
|
|
26
26
|
ReturnType: {
|
|
27
27
|
paymaster?: Address;
|
|
28
28
|
paymasterData?: Hex;
|
|
@@ -30,7 +30,7 @@ export type Erc7677RpcSchema = [
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
];
|
|
33
|
-
export type Erc7677Client<T extends Transport = Transport> = Client<T, Chain, undefined, Erc7677RpcSchema
|
|
33
|
+
export type Erc7677Client<T extends Transport = Transport, TContext extends Record<string, any> = Record<string, any>> = Client<T, Chain, undefined, Erc7677RpcSchema<TContext>>;
|
|
34
34
|
export type Erc7677MiddlewareParams<TContext extends Record<string, any> | undefined = Record<string, any> | undefined, TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = {
|
|
35
35
|
context?: ((struct: Deferrable<UserOperationStruct<TEntryPointVersion>>, args: {
|
|
36
36
|
overrides?: UserOperationOverrides<TEntryPointVersion>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc7677middleware.js","sourceRoot":"","sources":["../../../src/middleware/erc7677middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAMN,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAOzD,OAAO,EACL,WAAW,EACX,iBAAiB,GAElB,MAAM,mBAAmB,CAAC;AAoD3B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,iBAAiB,CAK/B,MAA0C;IAE1C,MAAM,qBAAqB,GAAuB,KAAK,EACrD,EAAE,EACF,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,EAC1C,EAAE;QACF,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;QAExD,iDAAiD;QACjD,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC;QAC5B,MAAM,CAAC,oBAAoB,GAAG,KA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";\nimport type { ClientMiddlewareConfig } from \"../client/types\";\nimport type { EntryPointVersion } from \"../entrypoint/types\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../types\";\nimport {\n deepHexlify,\n resolveProperties,\n type Deferrable,\n} from \"../utils/index.js\";\nimport type { ClientMiddlewareFn } from \"./types\";\n\nexport type Erc7677RpcSchema = [\n {\n Method: \"pm_getPaymasterStubData\";\n Parameters: [UserOperationRequest, Address, Hex,
|
|
1
|
+
{"version":3,"file":"erc7677middleware.js","sourceRoot":"","sources":["../../../src/middleware/erc7677middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAMN,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAOzD,OAAO,EACL,WAAW,EACX,iBAAiB,GAElB,MAAM,mBAAmB,CAAC;AAoD3B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,iBAAiB,CAK/B,MAA0C;IAE1C,MAAM,qBAAqB,GAAuB,KAAK,EACrD,EAAE,EACF,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,EAC1C,EAAE;QACF,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;QAExD,iDAAiD;QACjD,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC;QAC5B,MAAM,CAAC,oBAAoB,GAAG,KAAK,CAAC;QACpC,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC;QAC5B,MAAM,CAAC,oBAAoB,GAAG,KAAK,CAAC;QACpC,MAAM,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAElC,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAE3C,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;YACnC,MAA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E,OAAO,KAAK,UAAU;YACpC,CAAC,CAAC,MAAM,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;YAC1D,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QAE7B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;QACjC,CAAC;QAED,MAAM,aAAa,GAAG,MAAuB,CAAC;QAE9C,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAC3C,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,aAAa,EAAE,GAClD,MAAM,aAAa,CAAC,OAAO,CAAC;YAC1B,MAAM,EAAE,qBAAqB;YAC7B,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC;SACtE,CAAC,CAAC;QAEL,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;YACnC,OAAO;gBACL,GAAG,EAAE;gBACL,gBAAgB;aACjB,CAAC;QACJ,CAAC;QAED,OAAO;YACL,GAAG,EAAE;YACL,SAAS;YACT,aAAa;SACd,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,qBAAqB;QACrB,gBAAgB;KACjB,CAAC;AACJ,CAAC","sourcesContent":["import {\n toHex,\n type Address,\n type Chain,\n type Client,\n type Hex,\n type Transport,\n} from \"viem\";\nimport type { ClientMiddlewareConfig } from \"../client/types\";\nimport type { EntryPointVersion } from \"../entrypoint/types\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../types\";\nimport {\n deepHexlify,\n resolveProperties,\n type Deferrable,\n} from \"../utils/index.js\";\nimport type { ClientMiddlewareFn } from \"./types\";\n\nexport type Erc7677RpcSchema<\n TContext extends Record<string, any> = Record<string, any>\n> = [\n {\n Method: \"pm_getPaymasterStubData\";\n Parameters: [UserOperationRequest, Address, Hex, TContext];\n ReturnType: {\n sponsor?: { name: string; icon?: string }; // Sponsor info\n paymaster?: Address; // Paymaster address (entrypoint v0.7)\n paymasterData?: Hex; // Paymaster data (entrypoint v0.7)\n paymasterVerificationGasLimit?: Hex; // Paymaster validation gas (entrypoint v0.7)\n paymasterPostOpGasLimit?: Hex; // Paymaster post-op gas (entrypoint v0.7)\n paymasterAndData?: Hex; // Paymaster and data (entrypoint v0.6)\n isFinal?: boolean; // Indicates that the caller does not need to call pm_getPaymasterData\n };\n },\n {\n Method: \"pm_getPaymasterData\";\n Parameters: [UserOperationRequest, Address, Hex, TContext];\n ReturnType: {\n paymaster?: Address; // Paymaster address (entrypoint v0.7)\n paymasterData?: Hex; // Paymaster data (entrypoint v0.7)\n paymasterAndData?: Hex; // Paymaster and data (entrypoint v0.6)\n };\n }\n];\n\nexport type Erc7677Client<\n T extends Transport = Transport,\n TContext extends Record<string, any> = Record<string, any>\n> = Client<T, Chain, undefined, Erc7677RpcSchema<TContext>>;\n\nexport type Erc7677MiddlewareParams<\n TContext extends Record<string, any> | undefined =\n | Record<string, any>\n | undefined,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n context?:\n | ((\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args: {\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n feeOptions?: UserOperationFeeOptions;\n }\n ) => Promise<TContext>)\n | TContext;\n};\n\n/**\n * Middleware function for interacting with ERC-7677 enabled clients. It supports resolving paymaster and data fields for user operations.\n * This middleware assumes that your RPC provider supports the ERC-7677 methods (pm_getPaymasterStubData and pm_getPaymasterData).\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, erc7677Middleware } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * transport: http(\"rpc-url\"),\n * chain: sepolia,\n * // this assumes that your RPC provider supports the ERC-7677 methods AND takes no context\n * ...erc7677Middleware(),\n * })\n * ```\n *\n * @param {Erc7677MiddlewareParams<TContext>} params Middleware parameters including context function or object. Context can be resolved dynamically by passing in a function which takes in the context at the time of sending a user op\n * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">} An object containing middleware functions `dummyPaymasterAndData` and `paymasterAndData` for processing user operations with the paymaster data\n */\nexport function erc7677Middleware<\n TContext extends Record<string, any> | undefined =\n | Record<string, any>\n | undefined\n>(\n params?: Erc7677MiddlewareParams<TContext>\n): Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\"> {\n const dummyPaymasterAndData: ClientMiddlewareFn = async (\n uo,\n { client, account, feeOptions, overrides }\n ) => {\n const userOp = deepHexlify(await resolveProperties(uo));\n\n // Those values will be set after fee estimation.\n userOp.maxFeePerGas = \"0x0\";\n userOp.maxPriorityFeePerGas = \"0x0\";\n userOp.callGasLimit = \"0x0\";\n userOp.verificationGasLimit = \"0x0\";\n userOp.preVerificationGas = \"0x0\";\n\n const entrypoint = account.getEntryPoint();\n\n if (entrypoint.version === \"0.7.0\") {\n userOp.paymasterVerificationGasLimit = \"0x0\";\n userOp.paymasterPostOpGasLimit = \"0x0\";\n }\n\n const context =\n (typeof params?.context === \"function\"\n ? await params?.context(userOp, { overrides, feeOptions })\n : params?.context) ?? {};\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const erc7677client = client as Erc7677Client;\n // TODO: probably need to handle the sponsor and isFinal fields\n const {\n paymaster,\n paymasterAndData,\n paymasterData,\n paymasterPostOpGasLimit,\n paymasterVerificationGasLimit,\n } = await erc7677client.request({\n method: \"pm_getPaymasterStubData\",\n params: [userOp, entrypoint.address, toHex(client.chain.id), context],\n });\n\n if (entrypoint.version === \"0.6.0\") {\n return {\n ...uo,\n paymasterAndData,\n };\n }\n\n return {\n ...uo,\n paymaster,\n paymasterData,\n paymasterPostOpGasLimit,\n paymasterVerificationGasLimit,\n };\n };\n\n const paymasterAndData: ClientMiddlewareFn = async (\n uo,\n { client, account, feeOptions, overrides }\n ) => {\n const userOp = deepHexlify(await resolveProperties(uo));\n const context =\n (typeof params?.context === \"function\"\n ? await params?.context(userOp, { overrides, feeOptions })\n : params?.context) ?? {};\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const erc7677client = client as Erc7677Client;\n\n const entrypoint = account.getEntryPoint();\n const { paymaster, paymasterAndData, paymasterData } =\n await erc7677client.request({\n method: \"pm_getPaymasterData\",\n params: [userOp, entrypoint.address, toHex(client.chain.id), context],\n });\n\n if (entrypoint.version === \"0.6.0\") {\n return {\n ...uo,\n paymasterAndData,\n };\n }\n\n return {\n ...uo,\n paymaster,\n paymasterData,\n };\n };\n\n return {\n dummyPaymasterAndData,\n paymasterAndData,\n };\n}\n"]}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.0-beta.
|
|
1
|
+
export declare const VERSION = "4.0.0-beta.9";
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.0.0-beta.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.0.0-beta.9\";\n"]}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { Chain, Client, Transport } from "viem";
|
|
2
|
-
import type { SmartContractAccount } from "../../account/smartContractAccount.js";
|
|
2
|
+
import type { GetEntryPointFromAccount, SmartContractAccount } from "../../account/smartContractAccount.js";
|
|
3
|
+
import type { UserOperationStruct } from "../../types.js";
|
|
3
4
|
import type { SendUserOperationParameters, UserOperationContext } from "./types";
|
|
5
|
+
export type CheckGasSponsorshipEligibilityResult<TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>> = {
|
|
6
|
+
eligible: boolean;
|
|
7
|
+
request?: UserOperationStruct<TEntryPointVersion>;
|
|
8
|
+
};
|
|
4
9
|
/**
|
|
5
10
|
* This function verifies the eligibility of the connected account for gas sponsorship concerning the upcoming `UserOperation` (UO) that is intended to be sent.
|
|
6
11
|
* Internally, this method invokes `buildUserOperation`, which navigates through the middleware pipeline, including the `PaymasterMiddleware`. Its purpose is to construct the UO struct meant for transmission to the bundler. Following the construction of the UO struct, this function verifies if the resulting structure contains a non-empty `paymasterAndData` field.
|
|
@@ -10,7 +15,7 @@ import type { SendUserOperationParameters, UserOperationContext } from "./types"
|
|
|
10
15
|
* ```ts
|
|
11
16
|
* import { smartAccountClient } from "./smartAccountClient";
|
|
12
17
|
* // [!code focus:99]
|
|
13
|
-
* const eligible = await smartAccountClient.checkGasSponsorshipEligibility({
|
|
18
|
+
* const { eligible } = await smartAccountClient.checkGasSponsorshipEligibility({
|
|
14
19
|
* uo: {
|
|
15
20
|
* data: "0xCalldata",
|
|
16
21
|
* target: "0xTarget",
|
|
@@ -27,7 +32,7 @@ import type { SendUserOperationParameters, UserOperationContext } from "./types"
|
|
|
27
32
|
*
|
|
28
33
|
* @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for making RPC calls
|
|
29
34
|
* @param {SendUserOperationParameters} args containing the user operation, account, context, and overrides
|
|
30
|
-
* @returns {Promise<
|
|
35
|
+
* @returns {Promise<CheckGasSponsorshipEligibilityResult<TAccount>>} a Promise containing a boolean indicating if the account is elgibile for sponsorship and the sponsored UO
|
|
31
36
|
*/
|
|
32
|
-
export declare function checkGasSponsorshipEligibility<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(client: Client<TTransport, TChain, TAccount>, args: SendUserOperationParameters<TAccount, TContext>): Promise<
|
|
37
|
+
export declare function checkGasSponsorshipEligibility<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(client: Client<TTransport, TChain, TAccount>, args: SendUserOperationParameters<TAccount, TContext>): Promise<CheckGasSponsorshipEligibilityResult<TAccount>>;
|
|
33
38
|
//# sourceMappingURL=checkGasSponsorshipEligibility.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkGasSponsorshipEligibility.d.ts","sourceRoot":"","sources":["../../../../src/actions/smartAccount/checkGasSponsorshipEligibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACrD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"checkGasSponsorshipEligibility.d.ts","sourceRoot":"","sources":["../../../../src/actions/smartAccount/checkGasSponsorshipEligibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACrD,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,uCAAuC,CAAC;AAI/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KAAK,EACV,2BAA2B,EAC3B,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,oCAAoC,CAC9C,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EACb,kBAAkB,SAAS,wBAAwB,CAAC,QAAQ,CAAC,GAAG,wBAAwB,CAAC,QAAQ,CAAC,IAChG;IACF,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,8BAA8B,CAC5C,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EACb,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EAEb,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC5C,IAAI,EAAE,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,CAAC,GACpD,OAAO,CAAC,oCAAoC,CAAC,QAAQ,CAAC,CAAC,CAqCzD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Address, type Chain, type Client, type Hex, type SendTransactionParameters, type Transport, type TypedData } from "viem";
|
|
2
2
|
import type { GetAccountParameter, GetEntryPointFromAccount, SmartContractAccount } from "../../account/smartContractAccount";
|
|
3
|
+
import { type CheckGasSponsorshipEligibilityResult } from "../../actions/smartAccount/checkGasSponsorshipEligibility.js";
|
|
3
4
|
import { type SignMessageParameters } from "../../actions/smartAccount/signMessage.js";
|
|
4
5
|
import { type SignTypedDataParameters } from "../../actions/smartAccount/signTypedData.js";
|
|
5
6
|
import type { BuildTransactionParameters, BuildUserOperationFromTransactionsResult, BuildUserOperationParameters, DropAndReplaceUserOperationParameters, SendTransactionsParameters, SendUserOperationParameters, SignUserOperationParameters, UpgradeAccountParams, UserOperationContext, WaitForUserOperationTxParameters } from "../../actions/smartAccount/types";
|
|
@@ -10,7 +11,7 @@ export type BaseSmartAccountClientActions<TChain extends Chain | undefined = Cha
|
|
|
10
11
|
buildUserOperation: (args: BuildUserOperationParameters<TAccount, TContext>) => Promise<UserOperationStruct<TEntryPointVersion>>;
|
|
11
12
|
buildUserOperationFromTx: (args: SendTransactionParameters<TChain, TAccount>, overrides?: UserOperationOverrides<TEntryPointVersion>, context?: TContext) => Promise<UserOperationStruct<TEntryPointVersion>>;
|
|
12
13
|
buildUserOperationFromTxs: (args: BuildTransactionParameters<TAccount, TContext>) => Promise<BuildUserOperationFromTransactionsResult<TEntryPointVersion>>;
|
|
13
|
-
checkGasSponsorshipEligibility: <TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(args: SendUserOperationParameters<TAccount, TContext>) => Promise<
|
|
14
|
+
checkGasSponsorshipEligibility: <TContext extends UserOperationContext | undefined = UserOperationContext | undefined, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>>(args: SendUserOperationParameters<TAccount, TContext>) => Promise<CheckGasSponsorshipEligibilityResult<TAccount, TEntryPointVersion>>;
|
|
14
15
|
signUserOperation: (args: SignUserOperationParameters<TAccount, TEntryPointVersion, TContext>) => Promise<UserOperationRequest<TEntryPointVersion>>;
|
|
15
16
|
dropAndReplaceUserOperation: (args: DropAndReplaceUserOperationParameters<TAccount, TContext>) => Promise<SendUserOperationResult<TEntryPointVersion>>;
|
|
16
17
|
sendTransaction: <TChainOverride extends Chain | undefined = undefined>(args: SendTransactionParameters<TChain, TAccount, TChainOverride>, overrides?: UserOperationOverrides<TEntryPointVersion>, context?: TContext) => Promise<Hex>;
|
|
@@ -22,10 +23,6 @@ export type BaseSmartAccountClientActions<TChain extends Chain | undefined = Cha
|
|
|
22
23
|
signTypedData: <const TTypedData extends TypedData | {
|
|
23
24
|
[key: string]: unknown;
|
|
24
25
|
}, TPrimaryType extends string = string>(args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>) => Promise<Hex>;
|
|
25
|
-
signMessageWith6492: (args: SignMessageParameters<TAccount>) => Promise<Hex>;
|
|
26
|
-
signTypedDataWith6492: <const TTypedData extends TypedData | {
|
|
27
|
-
[key: string]: unknown;
|
|
28
|
-
}, TPrimaryType extends string = string>(args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>) => Promise<Hex>;
|
|
29
26
|
} & (IsUndefined<TAccount> extends false ? {
|
|
30
27
|
getAddress: () => Address;
|
|
31
28
|
} : {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smartAccountClient.d.ts","sourceRoot":"","sources":["../../../../src/client/decorators/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,yBAAyB,EAC9B,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"smartAccountClient.d.ts","sourceRoot":"","sources":["../../../../src/client/decorators/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,yBAAyB,EAC9B,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,oCAAoC,CAAC;AAI5C,OAAO,EAEL,KAAK,oCAAoC,EAC1C,MAAM,8DAA8D,CAAC;AAMtE,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,2CAA2C,CAAC;AACnD,OAAO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types";
|
|
4
4
|
import type { UserOperationFeeOptions, UserOperationOverrides, UserOperationRequest, UserOperationStruct } from "../types";
|
|
5
5
|
import { type Deferrable } from "../utils/index.js";
|
|
6
|
-
export type Erc7677RpcSchema = [
|
|
6
|
+
export type Erc7677RpcSchema<TContext extends Record<string, any> = Record<string, any>> = [
|
|
7
7
|
{
|
|
8
8
|
Method: "pm_getPaymasterStubData";
|
|
9
|
-
Parameters: [UserOperationRequest, Address, Hex,
|
|
9
|
+
Parameters: [UserOperationRequest, Address, Hex, TContext];
|
|
10
10
|
ReturnType: {
|
|
11
11
|
sponsor?: {
|
|
12
12
|
name: string;
|
|
@@ -22,7 +22,7 @@ export type Erc7677RpcSchema = [
|
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
Method: "pm_getPaymasterData";
|
|
25
|
-
Parameters: [UserOperationRequest, Address, Hex,
|
|
25
|
+
Parameters: [UserOperationRequest, Address, Hex, TContext];
|
|
26
26
|
ReturnType: {
|
|
27
27
|
paymaster?: Address;
|
|
28
28
|
paymasterData?: Hex;
|
|
@@ -30,7 +30,7 @@ export type Erc7677RpcSchema = [
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
];
|
|
33
|
-
export type Erc7677Client<T extends Transport = Transport> = Client<T, Chain, undefined, Erc7677RpcSchema
|
|
33
|
+
export type Erc7677Client<T extends Transport = Transport, TContext extends Record<string, any> = Record<string, any>> = Client<T, Chain, undefined, Erc7677RpcSchema<TContext>>;
|
|
34
34
|
export type Erc7677MiddlewareParams<TContext extends Record<string, any> | undefined = Record<string, any> | undefined, TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = {
|
|
35
35
|
context?: ((struct: Deferrable<UserOperationStruct<TEntryPointVersion>>, args: {
|
|
36
36
|
overrides?: UserOperationOverrides<TEntryPointVersion>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc7677middleware.d.ts","sourceRoot":"","sources":["../../../src/middleware/erc7677middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,MAAM,gBAAgB,GAAG;
|
|
1
|
+
{"version":3,"file":"erc7677middleware.d.ts","sourceRoot":"","sources":["../../../src/middleware/erc7677middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,MAAM,gBAAgB,CAC1B,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IACxD;IACF;QACE,MAAM,EAAE,yBAAyB,CAAC;QAClC,UAAU,EAAE,CAAC,oBAAoB,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC3D,UAAU,EAAE;YACV,OAAO,CAAC,EAAE;gBAAE,IAAI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E,uBAAuB,CAAC;KACtC,KACE,OAAO,CAAC,QAAQ,CAAC,CAAC,GACvB,QAAQ,CAAC;CACd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAC5C,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACnB,SAAS,EAEb,MAAM,CAAC,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GACzC,IAAI,CAAC,sBAAsB,EAAE,uBAAuB,GAAG,kBAAkB,CAAC,CAoG5E"}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.0-beta.
|
|
1
|
+
export declare const VERSION = "4.0.0-beta.9";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aa-sdk/core",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.9",
|
|
5
5
|
"description": "viem based SDK that enables interactions with ERC-4337 Smart Accounts. ABIs are based off the definitions generated in @account-abstraction/contracts",
|
|
6
6
|
"author": "Alchemy",
|
|
7
7
|
"type": "module",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
66
66
|
},
|
|
67
67
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "6c5f0ff3863587178909a4df689df3d8379b1851"
|
|
69
69
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Chain, Client, Transport } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
GetEntryPointFromAccount,
|
|
4
|
+
SmartContractAccount,
|
|
5
|
+
} from "../../account/smartContractAccount.js";
|
|
3
6
|
import { isBaseSmartAccountClient } from "../../client/isSmartAccountClient.js";
|
|
4
7
|
import { AccountNotFoundError } from "../../errors/account.js";
|
|
5
8
|
import { IncompatibleClientError } from "../../errors/client.js";
|
|
@@ -10,6 +13,16 @@ import type {
|
|
|
10
13
|
UserOperationContext,
|
|
11
14
|
} from "./types";
|
|
12
15
|
|
|
16
|
+
export type CheckGasSponsorshipEligibilityResult<
|
|
17
|
+
TAccount extends SmartContractAccount | undefined =
|
|
18
|
+
| SmartContractAccount
|
|
19
|
+
| undefined,
|
|
20
|
+
TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>
|
|
21
|
+
> = {
|
|
22
|
+
eligible: boolean;
|
|
23
|
+
request?: UserOperationStruct<TEntryPointVersion>;
|
|
24
|
+
};
|
|
25
|
+
|
|
13
26
|
/**
|
|
14
27
|
* This function verifies the eligibility of the connected account for gas sponsorship concerning the upcoming `UserOperation` (UO) that is intended to be sent.
|
|
15
28
|
* Internally, this method invokes `buildUserOperation`, which navigates through the middleware pipeline, including the `PaymasterMiddleware`. Its purpose is to construct the UO struct meant for transmission to the bundler. Following the construction of the UO struct, this function verifies if the resulting structure contains a non-empty `paymasterAndData` field.
|
|
@@ -19,7 +32,7 @@ import type {
|
|
|
19
32
|
* ```ts
|
|
20
33
|
* import { smartAccountClient } from "./smartAccountClient";
|
|
21
34
|
* // [!code focus:99]
|
|
22
|
-
* const eligible = await smartAccountClient.checkGasSponsorshipEligibility({
|
|
35
|
+
* const { eligible } = await smartAccountClient.checkGasSponsorshipEligibility({
|
|
23
36
|
* uo: {
|
|
24
37
|
* data: "0xCalldata",
|
|
25
38
|
* target: "0xTarget",
|
|
@@ -36,7 +49,7 @@ import type {
|
|
|
36
49
|
*
|
|
37
50
|
* @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for making RPC calls
|
|
38
51
|
* @param {SendUserOperationParameters} args containing the user operation, account, context, and overrides
|
|
39
|
-
* @returns {Promise<
|
|
52
|
+
* @returns {Promise<CheckGasSponsorshipEligibilityResult<TAccount>>} a Promise containing a boolean indicating if the account is elgibile for sponsorship and the sponsored UO
|
|
40
53
|
*/
|
|
41
54
|
export function checkGasSponsorshipEligibility<
|
|
42
55
|
TTransport extends Transport = Transport,
|
|
@@ -50,7 +63,7 @@ export function checkGasSponsorshipEligibility<
|
|
|
50
63
|
>(
|
|
51
64
|
client: Client<TTransport, TChain, TAccount>,
|
|
52
65
|
args: SendUserOperationParameters<TAccount, TContext>
|
|
53
|
-
): Promise<
|
|
66
|
+
): Promise<CheckGasSponsorshipEligibilityResult<TAccount>> {
|
|
54
67
|
const { account = client.account, overrides, context } = args;
|
|
55
68
|
|
|
56
69
|
if (!account) {
|
|
@@ -71,16 +84,20 @@ export function checkGasSponsorshipEligibility<
|
|
|
71
84
|
overrides,
|
|
72
85
|
context,
|
|
73
86
|
})
|
|
74
|
-
.then((userOperationStruct) =>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
.then((userOperationStruct) => ({
|
|
88
|
+
eligible:
|
|
89
|
+
account.getEntryPoint().version === "0.6.0"
|
|
90
|
+
? (userOperationStruct as UserOperationStruct<"0.6.0">)
|
|
91
|
+
.paymasterAndData !== "0x" &&
|
|
92
|
+
(userOperationStruct as UserOperationStruct<"0.6.0">)
|
|
93
|
+
.paymasterAndData !== null
|
|
94
|
+
: (userOperationStruct as UserOperationStruct<"0.7.0">)
|
|
95
|
+
.paymasterData !== "0x" &&
|
|
96
|
+
(userOperationStruct as UserOperationStruct<"0.7.0">)
|
|
97
|
+
.paymasterData !== null,
|
|
98
|
+
request: userOperationStruct,
|
|
99
|
+
}))
|
|
100
|
+
.catch(() => ({
|
|
101
|
+
eligible: false,
|
|
102
|
+
}));
|
|
86
103
|
}
|
|
@@ -15,7 +15,10 @@ import type {
|
|
|
15
15
|
import { buildUserOperation } from "../../actions/smartAccount/buildUserOperation.js";
|
|
16
16
|
import { buildUserOperationFromTx } from "../../actions/smartAccount/buildUserOperationFromTx.js";
|
|
17
17
|
import { buildUserOperationFromTxs } from "../../actions/smartAccount/buildUserOperationFromTxs.js";
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
checkGasSponsorshipEligibility,
|
|
20
|
+
type CheckGasSponsorshipEligibilityResult,
|
|
21
|
+
} from "../../actions/smartAccount/checkGasSponsorshipEligibility.js";
|
|
19
22
|
import { dropAndReplaceUserOperation } from "../../actions/smartAccount/dropAndReplaceUserOperation.js";
|
|
20
23
|
import { getAddress } from "../../actions/smartAccount/getAddress.js";
|
|
21
24
|
import { sendTransaction } from "../../actions/smartAccount/sendTransaction.js";
|
|
@@ -25,12 +28,10 @@ import {
|
|
|
25
28
|
signMessage,
|
|
26
29
|
type SignMessageParameters,
|
|
27
30
|
} from "../../actions/smartAccount/signMessage.js";
|
|
28
|
-
import { signMessageWith6492 } from "../../actions/smartAccount/signMessageWith6492.js";
|
|
29
31
|
import {
|
|
30
32
|
signTypedData,
|
|
31
33
|
type SignTypedDataParameters,
|
|
32
34
|
} from "../../actions/smartAccount/signTypedData.js";
|
|
33
|
-
import { signTypedDataWith6492 } from "../../actions/smartAccount/signTypedDataWith6492.js";
|
|
34
35
|
import { signUserOperation } from "../../actions/smartAccount/signUserOperation.js";
|
|
35
36
|
import type {
|
|
36
37
|
BuildTransactionParameters,
|
|
@@ -79,10 +80,13 @@ export type BaseSmartAccountClientActions<
|
|
|
79
80
|
checkGasSponsorshipEligibility: <
|
|
80
81
|
TContext extends UserOperationContext | undefined =
|
|
81
82
|
| UserOperationContext
|
|
82
|
-
| undefined
|
|
83
|
+
| undefined,
|
|
84
|
+
TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>
|
|
83
85
|
>(
|
|
84
86
|
args: SendUserOperationParameters<TAccount, TContext>
|
|
85
|
-
) => Promise<
|
|
87
|
+
) => Promise<
|
|
88
|
+
CheckGasSponsorshipEligibilityResult<TAccount, TEntryPointVersion>
|
|
89
|
+
>;
|
|
86
90
|
signUserOperation: (
|
|
87
91
|
args: SignUserOperationParameters<TAccount, TEntryPointVersion, TContext>
|
|
88
92
|
) => Promise<UserOperationRequest<TEntryPointVersion>>;
|
|
@@ -119,13 +123,6 @@ export type BaseSmartAccountClientActions<
|
|
|
119
123
|
>(
|
|
120
124
|
args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>
|
|
121
125
|
) => Promise<Hex>;
|
|
122
|
-
signMessageWith6492: (args: SignMessageParameters<TAccount>) => Promise<Hex>;
|
|
123
|
-
signTypedDataWith6492: <
|
|
124
|
-
const TTypedData extends TypedData | { [key: string]: unknown },
|
|
125
|
-
TPrimaryType extends string = string
|
|
126
|
-
>(
|
|
127
|
-
args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>
|
|
128
|
-
) => Promise<Hex>;
|
|
129
126
|
} & (IsUndefined<TAccount> extends false
|
|
130
127
|
? { getAddress: () => Address }
|
|
131
128
|
: {
|
|
@@ -172,8 +169,6 @@ export const smartAccountClientActions: <
|
|
|
172
169
|
getAddress: (args) => getAddress(client, args),
|
|
173
170
|
signMessage: (args) => signMessage(client, args),
|
|
174
171
|
signTypedData: (args) => signTypedData(client, args),
|
|
175
|
-
signMessageWith6492: (args) => signMessageWith6492(client, args),
|
|
176
|
-
signTypedDataWith6492: (args) => signTypedDataWith6492(client, args),
|
|
177
172
|
});
|
|
178
173
|
|
|
179
174
|
export const smartAccountClientMethodKeys = Object.keys(
|
|
@@ -22,10 +22,12 @@ import {
|
|
|
22
22
|
} from "../utils/index.js";
|
|
23
23
|
import type { ClientMiddlewareFn } from "./types";
|
|
24
24
|
|
|
25
|
-
export type Erc7677RpcSchema
|
|
25
|
+
export type Erc7677RpcSchema<
|
|
26
|
+
TContext extends Record<string, any> = Record<string, any>
|
|
27
|
+
> = [
|
|
26
28
|
{
|
|
27
29
|
Method: "pm_getPaymasterStubData";
|
|
28
|
-
Parameters: [UserOperationRequest, Address, Hex,
|
|
30
|
+
Parameters: [UserOperationRequest, Address, Hex, TContext];
|
|
29
31
|
ReturnType: {
|
|
30
32
|
sponsor?: { name: string; icon?: string }; // Sponsor info
|
|
31
33
|
paymaster?: Address; // Paymaster address (entrypoint v0.7)
|
|
@@ -38,7 +40,7 @@ export type Erc7677RpcSchema = [
|
|
|
38
40
|
},
|
|
39
41
|
{
|
|
40
42
|
Method: "pm_getPaymasterData";
|
|
41
|
-
Parameters: [UserOperationRequest, Address, Hex,
|
|
43
|
+
Parameters: [UserOperationRequest, Address, Hex, TContext];
|
|
42
44
|
ReturnType: {
|
|
43
45
|
paymaster?: Address; // Paymaster address (entrypoint v0.7)
|
|
44
46
|
paymasterData?: Hex; // Paymaster data (entrypoint v0.7)
|
|
@@ -47,12 +49,10 @@ export type Erc7677RpcSchema = [
|
|
|
47
49
|
}
|
|
48
50
|
];
|
|
49
51
|
|
|
50
|
-
export type Erc7677Client<
|
|
51
|
-
T,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
Erc7677RpcSchema
|
|
55
|
-
>;
|
|
52
|
+
export type Erc7677Client<
|
|
53
|
+
T extends Transport = Transport,
|
|
54
|
+
TContext extends Record<string, any> = Record<string, any>
|
|
55
|
+
> = Client<T, Chain, undefined, Erc7677RpcSchema<TContext>>;
|
|
56
56
|
|
|
57
57
|
export type Erc7677MiddlewareParams<
|
|
58
58
|
TContext extends Record<string, any> | undefined =
|
package/src/version.ts
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Chain, Client, Hex, Transport } from "viem";
|
|
2
|
-
import type { SmartContractAccount } from "../../account/smartContractAccount";
|
|
3
|
-
import type { SignMessageParameters } from "./signMessage";
|
|
4
|
-
export declare const signMessageWith6492: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: Client<TTransport, TChain, TAccount>, args: SignMessageParameters<TAccount>) => Promise<Hex>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AccountNotFoundError } from "../../errors/account.js";
|
|
2
|
-
export const signMessageWith6492 = async (client, { account = client.account, message }) => {
|
|
3
|
-
if (!account) {
|
|
4
|
-
throw new AccountNotFoundError();
|
|
5
|
-
}
|
|
6
|
-
return account.signMessageWith6492({ message });
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=signMessageWith6492.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signMessageWith6492.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/signMessageWith6492.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/D,MAAM,CAAC,MAAM,mBAAmB,GASZ,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;IAC1E,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,OAAO,OAAO,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { SmartContractAccount } from \"../../account/smartContractAccount\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport type { SignMessageParameters } from \"./signMessage\";\n\nexport const signMessageWith6492: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: SignMessageParameters<TAccount>\n) => Promise<Hex> = async (client, { account = client.account, message }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n return account.signMessageWith6492({ message });\n};\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Chain, Client, Hex, Transport, TypedData } from "viem";
|
|
2
|
-
import type { SmartContractAccount } from "../../account/smartContractAccount";
|
|
3
|
-
import type { SignTypedDataParameters } from "./signTypedData";
|
|
4
|
-
export declare const signTypedDataWith6492: <const TTypedData extends TypedData | {
|
|
5
|
-
[key: string]: unknown;
|
|
6
|
-
}, TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TPrimaryType extends string = string>(client: Client<TTransport, TChain, TAccount>, args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>) => Promise<Hex>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AccountNotFoundError } from "../../errors/account.js";
|
|
2
|
-
export const signTypedDataWith6492 = async (client, { account = client.account, typedData }) => {
|
|
3
|
-
if (!account) {
|
|
4
|
-
throw new AccountNotFoundError();
|
|
5
|
-
}
|
|
6
|
-
return account.signTypedDataWith6492(typedData);
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=signTypedDataWith6492.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signTypedDataWith6492.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/signTypedDataWith6492.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/D,MAAM,CAAC,MAAM,qBAAqB,GAWd,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;IAC5E,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,OAAO,OAAO,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import type { Chain, Client, Hex, Transport, TypedData } from \"viem\";\nimport type { SmartContractAccount } from \"../../account/smartContractAccount\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport type { SignTypedDataParameters } from \"./signTypedData\";\n\nexport const signTypedDataWith6492: <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TPrimaryType extends string = string\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>\n) => Promise<Hex> = async (client, { account = client.account, typedData }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n return account.signTypedDataWith6492(typedData);\n};\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Chain, Client, Hex, Transport } from "viem";
|
|
2
|
-
import type { SmartContractAccount } from "../../account/smartContractAccount";
|
|
3
|
-
import type { SignMessageParameters } from "./signMessage";
|
|
4
|
-
export declare const signMessageWith6492: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: Client<TTransport, TChain, TAccount>, args: SignMessageParameters<TAccount>) => Promise<Hex>;
|
|
5
|
-
//# sourceMappingURL=signMessageWith6492.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signMessageWith6492.d.ts","sourceRoot":"","sources":["../../../../src/actions/smartAccount/signMessageWith6492.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3D,eAAO,MAAM,mBAAmB,EAAE,CAChC,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EAEb,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC5C,IAAI,EAAE,qBAAqB,CAAC,QAAQ,CAAC,KAClC,OAAO,CAAC,GAAG,CAMf,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Chain, Client, Hex, Transport, TypedData } from "viem";
|
|
2
|
-
import type { SmartContractAccount } from "../../account/smartContractAccount";
|
|
3
|
-
import type { SignTypedDataParameters } from "./signTypedData";
|
|
4
|
-
export declare const signTypedDataWith6492: <const TTypedData extends TypedData | {
|
|
5
|
-
[key: string]: unknown;
|
|
6
|
-
}, TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TPrimaryType extends string = string>(client: Client<TTransport, TChain, TAccount>, args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>) => Promise<Hex>;
|
|
7
|
-
//# sourceMappingURL=signTypedDataWith6492.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signTypedDataWith6492.d.ts","sourceRoot":"","sources":["../../../../src/actions/smartAccount/signTypedDataWith6492.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D,eAAO,MAAM,qBAAqB,EAAE,CAClC,KAAK,CAAC,UAAU,SAAS,SAAS,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EAC/D,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EACb,YAAY,SAAS,MAAM,GAAG,MAAM,EAEpC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC5C,IAAI,EAAE,uBAAuB,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,CAAC,KAC9D,OAAO,CAAC,GAAG,CAMf,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Chain, Client, Hex, Transport } from "viem";
|
|
2
|
-
import type { SmartContractAccount } from "../../account/smartContractAccount";
|
|
3
|
-
import { AccountNotFoundError } from "../../errors/account.js";
|
|
4
|
-
import type { SignMessageParameters } from "./signMessage";
|
|
5
|
-
|
|
6
|
-
export const signMessageWith6492: <
|
|
7
|
-
TTransport extends Transport = Transport,
|
|
8
|
-
TChain extends Chain | undefined = Chain | undefined,
|
|
9
|
-
TAccount extends SmartContractAccount | undefined =
|
|
10
|
-
| SmartContractAccount
|
|
11
|
-
| undefined
|
|
12
|
-
>(
|
|
13
|
-
client: Client<TTransport, TChain, TAccount>,
|
|
14
|
-
args: SignMessageParameters<TAccount>
|
|
15
|
-
) => Promise<Hex> = async (client, { account = client.account, message }) => {
|
|
16
|
-
if (!account) {
|
|
17
|
-
throw new AccountNotFoundError();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return account.signMessageWith6492({ message });
|
|
21
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Chain, Client, Hex, Transport, TypedData } from "viem";
|
|
2
|
-
import type { SmartContractAccount } from "../../account/smartContractAccount";
|
|
3
|
-
import { AccountNotFoundError } from "../../errors/account.js";
|
|
4
|
-
import type { SignTypedDataParameters } from "./signTypedData";
|
|
5
|
-
|
|
6
|
-
export const signTypedDataWith6492: <
|
|
7
|
-
const TTypedData extends TypedData | { [key: string]: unknown },
|
|
8
|
-
TTransport extends Transport = Transport,
|
|
9
|
-
TChain extends Chain | undefined = Chain | undefined,
|
|
10
|
-
TAccount extends SmartContractAccount | undefined =
|
|
11
|
-
| SmartContractAccount
|
|
12
|
-
| undefined,
|
|
13
|
-
TPrimaryType extends string = string
|
|
14
|
-
>(
|
|
15
|
-
client: Client<TTransport, TChain, TAccount>,
|
|
16
|
-
args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>
|
|
17
|
-
) => Promise<Hex> = async (client, { account = client.account, typedData }) => {
|
|
18
|
-
if (!account) {
|
|
19
|
-
throw new AccountNotFoundError();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return account.signTypedDataWith6492(typedData);
|
|
23
|
-
};
|