@zerodev/sdk 5.4.0-beta.2 → 5.4.0
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/_cjs/actions/paymaster/sponsorUserOperation.js +18 -9
- package/_cjs/actions/paymaster/sponsorUserOperation.js.map +1 -1
- package/_cjs/clients/decorators/kernel.js +2 -3
- package/_cjs/clients/decorators/kernel.js.map +1 -1
- package/_cjs/clients/paymasterClient.js +2 -5
- package/_cjs/clients/paymasterClient.js.map +1 -1
- package/_esm/actions/paymaster/sponsorUserOperation.js +22 -9
- package/_esm/actions/paymaster/sponsorUserOperation.js.map +1 -1
- package/_esm/clients/decorators/kernel.js +2 -3
- package/_esm/clients/decorators/kernel.js.map +1 -1
- package/_esm/clients/paymasterClient.js +3 -6
- package/_esm/clients/paymasterClient.js.map +1 -1
- package/_types/actions/paymaster/estimateGasInERC20.d.ts +4 -2
- package/_types/actions/paymaster/estimateGasInERC20.d.ts.map +1 -1
- package/_types/actions/paymaster/sponsorUserOperation.d.ts +24 -19
- package/_types/actions/paymaster/sponsorUserOperation.d.ts.map +1 -1
- package/_types/clients/decorators/kernel.d.ts +3 -4
- package/_types/clients/decorators/kernel.d.ts.map +1 -1
- package/_types/clients/paymasterClient.d.ts +4 -5
- package/_types/clients/paymasterClient.d.ts.map +1 -1
- package/_types/utils.d.ts +4 -2
- package/_types/utils.d.ts.map +1 -1
- package/actions/paymaster/sponsorUserOperation.ts +49 -65
- package/clients/decorators/kernel.ts +7 -18
- package/clients/paymasterClient.ts +8 -18
- package/package.json +1 -1
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sponsorUserOperation = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const account_abstraction_1 = require("viem/account-abstraction");
|
|
4
6
|
const utils_js_1 = require("../../utils.js");
|
|
5
7
|
const sponsorUserOperation = async (client, args) => {
|
|
8
|
+
const { userOperation: { chainId, entryPointAddress, context, calls, account, ..._userOperation } } = args;
|
|
6
9
|
const response = await client.request({
|
|
7
10
|
method: "zd_sponsorUserOperation",
|
|
8
11
|
params: [
|
|
9
12
|
{
|
|
10
13
|
chainId: client.chain?.id,
|
|
11
|
-
userOp: (0, utils_js_1.deepHexlify)(
|
|
12
|
-
entryPointAddress:
|
|
14
|
+
userOp: (0, utils_js_1.deepHexlify)(_userOperation),
|
|
15
|
+
entryPointAddress: entryPointAddress,
|
|
13
16
|
gasTokenData: args.gasToken && {
|
|
14
17
|
tokenAddress: args.gasToken
|
|
15
18
|
},
|
|
@@ -18,15 +21,18 @@ const sponsorUserOperation = async (client, args) => {
|
|
|
18
21
|
}
|
|
19
22
|
]
|
|
20
23
|
});
|
|
21
|
-
if (
|
|
24
|
+
if ((0, viem_1.isAddressEqual)(entryPointAddress, account_abstraction_1.entryPoint06Address)) {
|
|
22
25
|
return {
|
|
23
26
|
paymasterAndData: response.paymasterAndData,
|
|
24
27
|
preVerificationGas: BigInt(response.preVerificationGas),
|
|
25
28
|
verificationGasLimit: BigInt(response.verificationGasLimit),
|
|
26
29
|
callGasLimit: BigInt(response.callGasLimit),
|
|
27
|
-
maxFeePerGas: response.maxFeePerGas
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
maxFeePerGas: response.maxFeePerGas
|
|
31
|
+
? BigInt(response.maxFeePerGas)
|
|
32
|
+
: args.userOperation.maxFeePerGas,
|
|
33
|
+
maxPriorityFeePerGas: response.maxPriorityFeePerGas
|
|
34
|
+
? BigInt(response.maxPriorityFeePerGas)
|
|
35
|
+
: args.userOperation.maxPriorityFeePerGas
|
|
30
36
|
};
|
|
31
37
|
}
|
|
32
38
|
const responseV07 = response;
|
|
@@ -38,9 +44,12 @@ const sponsorUserOperation = async (client, args) => {
|
|
|
38
44
|
paymasterVerificationGasLimit: BigInt(responseV07.paymasterVerificationGasLimit),
|
|
39
45
|
paymasterPostOpGasLimit: BigInt(responseV07.paymasterPostOpGasLimit),
|
|
40
46
|
paymasterData: responseV07.paymasterData,
|
|
41
|
-
maxFeePerGas: response.maxFeePerGas
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
maxFeePerGas: response.maxFeePerGas
|
|
48
|
+
? BigInt(response.maxFeePerGas)
|
|
49
|
+
: args.userOperation.maxFeePerGas,
|
|
50
|
+
maxPriorityFeePerGas: response.maxPriorityFeePerGas
|
|
51
|
+
? BigInt(response.maxPriorityFeePerGas)
|
|
52
|
+
: args.userOperation.maxPriorityFeePerGas
|
|
44
53
|
};
|
|
45
54
|
};
|
|
46
55
|
exports.sponsorUserOperation = sponsorUserOperation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sponsorUserOperation.js","sourceRoot":"","sources":["../../../actions/paymaster/sponsorUserOperation.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"sponsorUserOperation.js","sourceRoot":"","sources":["../../../actions/paymaster/sponsorUserOperation.ts"],"names":[],"mappings":";;;AAAA,+BAA4E;AAC5E,kEAKiC;AAEjC,6CAA4C;AAsBrC,MAAM,oBAAoB,GAAG,KAAK,EAGrC,MAAiD,EACjD,IAAoC,EACG,EAAE;IACzC,MAAM,EACF,aAAa,EAAE,EACX,OAAO,EACP,iBAAiB,EACjB,OAAO,EAEP,KAAK,EAEL,OAAO,EACP,GAAG,cAAc,EACpB,EACJ,GAAG,IAAI,CAAA;IACR,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,yBAAyB;QACjC,MAAM,EAAE;YACJ;gBACI,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,EAAY;gBACnC,MAAM,EAAE,IAAA,sBAAW,EAAC,cAAc,CAAC;gBACnC,iBAAiB,EAAE,iBAAiB;gBACpC,YAAY,EAAE,IAAI,CAAC,QAAQ,IAAI;oBAC3B,YAAY,EAAE,IAAI,CAAC,QAAQ;iBAC9B;gBACD,iBAAiB,EA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AC,YAAY,CAAC;YAC/B,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY;QACrC,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB;YAC/C,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC;YACvC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,oBAAoB;KACd,CAAA;AACvC,CAAC,CAAA;AA7EY,QAAA,oBAAoB,wBA6EhC"}
|
|
@@ -11,10 +11,9 @@ const writeContract_js_1 = require("../../actions/account-client/writeContract.j
|
|
|
11
11
|
const index_js_1 = require("../../actions/index.js");
|
|
12
12
|
const estimateGasInERC20_js_1 = require("../../actions/paymaster/estimateGasInERC20.js");
|
|
13
13
|
const sponsorUserOperation_js_1 = require("../../actions/paymaster/sponsorUserOperation.js");
|
|
14
|
-
const zerodevPaymasterActions = (
|
|
14
|
+
const zerodevPaymasterActions = () => (client) => ({
|
|
15
15
|
sponsorUserOperation: async (args) => (0, sponsorUserOperation_js_1.sponsorUserOperation)(client, {
|
|
16
|
-
...args
|
|
17
|
-
entryPoint
|
|
16
|
+
...args
|
|
18
17
|
}),
|
|
19
18
|
estimateGasInERC20: async (args) => (0, estimateGasInERC20_js_1.estimateGasInERC20)(client, args)
|
|
20
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../../clients/decorators/kernel.ts"],"names":[],"mappings":";;;AAaA,oHAA6G;AAC7G,0GAGiE;AACjE,wFAGwD;AACxD,wFAAiF;AACjF,gFAAyE;AACzE,oFAA6E;AAC7E,oFAA6E;AAM7E,qDAI+B;AAC/B,yFAIsD;AACtD,6FAIwD;
|
|
1
|
+
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../../clients/decorators/kernel.ts"],"names":[],"mappings":";;;AAaA,oHAA6G;AAC7G,0GAGiE;AACjE,wFAGwD;AACxD,wFAAiF;AACjF,gFAAyE;AACzE,oFAA6E;AAC7E,oFAA6E;A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E,EAAE,CAAC,IAAA,gCAAa,EAAC,MAAM,EAAE,IAAI,CAAC;QACpD,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,gCAAa,EAAC,MAAM,EAAE,IAAI,CAAC;KACvD,CAAC,CAAA;AACN,CAAC;AAtBD,gEAsBC"}
|
|
@@ -5,7 +5,7 @@ const viem_1 = require("viem");
|
|
|
5
5
|
const account_abstraction_1 = require("viem/account-abstraction");
|
|
6
6
|
const kernel_js_1 = require("./decorators/kernel.js");
|
|
7
7
|
const createZeroDevPaymasterClient = (parameters) => {
|
|
8
|
-
const { key = "public", name = "ZeroDev Paymaster Client",
|
|
8
|
+
const { key = "public", name = "ZeroDev Paymaster Client", transport } = parameters;
|
|
9
9
|
const client = (0, viem_1.createClient)({
|
|
10
10
|
...parameters,
|
|
11
11
|
transport: (opts) => {
|
|
@@ -18,10 +18,7 @@ const createZeroDevPaymasterClient = (parameters) => {
|
|
|
18
18
|
name,
|
|
19
19
|
type: "zerodevPaymasterClient"
|
|
20
20
|
});
|
|
21
|
-
return client.extend(account_abstraction_1.paymasterActions).extend((0, kernel_js_1.zerodevPaymasterActions)(
|
|
22
|
-
address: entryPoint?.address ?? account_abstraction_1.entryPoint07Address,
|
|
23
|
-
version: entryPoint?.version ?? "0.7"
|
|
24
|
-
}));
|
|
21
|
+
return client.extend(account_abstraction_1.paymasterActions).extend((0, kernel_js_1.zerodevPaymasterActions)());
|
|
25
22
|
};
|
|
26
23
|
exports.createZeroDevPaymasterClient = createZeroDevPaymasterClient;
|
|
27
24
|
//# sourceMappingURL=paymasterClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paymasterClient.js","sourceRoot":"","sources":["../../clients/paymasterClient.ts"],"names":[],"mappings":";;;AAAA,+BASa;AACb,
|
|
1
|
+
{"version":3,"file":"paymasterClient.js","sourceRoot":"","sources":["../../clients/paymasterClient.ts"],"names":[],"mappings":";;;AAAA,+BASa;AACb,kEAIiC;AAEjC,sDAG+B;AA6DxB,MAAM,4BAA4B,GAAG,CACxC,UAAwC,EAClB,EAAE;IACxB,MAAM,EACF,GAAG,GAAG,QAAQ,EACd,IAAI,GAAG,0BAA0B,EACjC,SAAS,EACZ,GAAG,UAAU,CAAA;IACd,MAAM,MAAM,GAAG,IAAA,mBAAY,EAAC;QACxB,GAAG,UAAU;QACb,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE;YAChB,OAAO,SAAS,CAAC;gBACb,GAAG,IAAI;gBACP,UAAU,EAAE,CAAC;aAChB,CAAC,CAAA;QACN,CAAC;QACD,GAAG;QACH,IAAI;QACJ,IAAI,EAAE,wBAAwB;KACjC,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,sCAAgB,CAAC,CAAC,MAAM,CAAC,IAAA,mCAAuB,GAAE,CAAC,CAAA;AAC5E,CAAC,CAAA;AArBY,QAAA,4BAA4B,gCAqBxC"}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
+
import { isAddressEqual } from "viem";
|
|
2
|
+
import { entryPoint06Address } from "viem/account-abstraction";
|
|
1
3
|
import { deepHexlify } from "../../utils.js";
|
|
2
4
|
/**
|
|
3
5
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
4
6
|
*/
|
|
5
7
|
export const sponsorUserOperation = async (client, args) => {
|
|
8
|
+
const { userOperation: { chainId, entryPointAddress, context,
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
calls,
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
account, ..._userOperation } } = args;
|
|
6
13
|
const response = await client.request({
|
|
7
14
|
method: "zd_sponsorUserOperation",
|
|
8
15
|
params: [
|
|
9
16
|
{
|
|
10
17
|
chainId: client.chain?.id,
|
|
11
|
-
userOp: deepHexlify(
|
|
12
|
-
entryPointAddress:
|
|
18
|
+
userOp: deepHexlify(_userOperation),
|
|
19
|
+
entryPointAddress: entryPointAddress,
|
|
13
20
|
gasTokenData: args.gasToken && {
|
|
14
21
|
tokenAddress: args.gasToken
|
|
15
22
|
},
|
|
@@ -18,15 +25,18 @@ export const sponsorUserOperation = async (client, args) => {
|
|
|
18
25
|
}
|
|
19
26
|
]
|
|
20
27
|
});
|
|
21
|
-
if (
|
|
28
|
+
if (isAddressEqual(entryPointAddress, entryPoint06Address)) {
|
|
22
29
|
return {
|
|
23
30
|
paymasterAndData: response.paymasterAndData,
|
|
24
31
|
preVerificationGas: BigInt(response.preVerificationGas),
|
|
25
32
|
verificationGasLimit: BigInt(response.verificationGasLimit),
|
|
26
33
|
callGasLimit: BigInt(response.callGasLimit),
|
|
27
|
-
maxFeePerGas: response.maxFeePerGas
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
maxFeePerGas: response.maxFeePerGas
|
|
35
|
+
? BigInt(response.maxFeePerGas)
|
|
36
|
+
: args.userOperation.maxFeePerGas,
|
|
37
|
+
maxPriorityFeePerGas: response.maxPriorityFeePerGas
|
|
38
|
+
? BigInt(response.maxPriorityFeePerGas)
|
|
39
|
+
: args.userOperation.maxPriorityFeePerGas
|
|
30
40
|
};
|
|
31
41
|
}
|
|
32
42
|
const responseV07 = response;
|
|
@@ -38,9 +48,12 @@ export const sponsorUserOperation = async (client, args) => {
|
|
|
38
48
|
paymasterVerificationGasLimit: BigInt(responseV07.paymasterVerificationGasLimit),
|
|
39
49
|
paymasterPostOpGasLimit: BigInt(responseV07.paymasterPostOpGasLimit),
|
|
40
50
|
paymasterData: responseV07.paymasterData,
|
|
41
|
-
maxFeePerGas: response.maxFeePerGas
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
maxFeePerGas: response.maxFeePerGas
|
|
52
|
+
? BigInt(response.maxFeePerGas)
|
|
53
|
+
: args.userOperation.maxFeePerGas,
|
|
54
|
+
maxPriorityFeePerGas: response.maxPriorityFeePerGas
|
|
55
|
+
? BigInt(response.maxPriorityFeePerGas)
|
|
56
|
+
: args.userOperation.maxPriorityFeePerGas
|
|
44
57
|
};
|
|
45
58
|
};
|
|
46
59
|
//# sourceMappingURL=sponsorUserOperation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sponsorUserOperation.js","sourceRoot":"","sources":["../../../actions/paymaster/sponsorUserOperation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sponsorUserOperation.js","sourceRoot":"","sources":["../../../actions/paymaster/sponsorUserOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,cAAc,EAAE,MAAM,MAAM,CAAA;AAC5E,OAAO,EAIH,mBAAmB,EACtB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAmB5C;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAGrC,MAAiD,EACjD,IAAoC,EACG,EAAE;IACzC,MAAM,EACF,aAAa,EAAE,EACX,OAAO,EACP,iBAAiB,EACjB,OAAO;IACP,aAAa;IACb,KAAK;IACL,aAAa;IACb,OAAO,EACP,GAAG,cAAc,EACpB,EACJ,GAAG,IAAI,CAAA;IACR,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,yBAAyB;QACjC,MAAM,EAAE;YACJ;gBACI,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,EAAY;gBACnC,MAAM,EAAE,WAAW,CAAC,cAAc,CAAC;gBACnC,iBAAiB,EAAE,iBAAiB;gBACpC,YAAY,EAAE,IAAI,CAAC,QAAQ,IAAI;oBAC3B,YAAY,EAAE,IAAI,CAAC,QAAQ;iBAC9B;gBACD,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,IAAI,KAAK;gBAClD,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,IAAI;aAC5C;SACJ;KACJ,CAAC,CAAA;IACF,IAAI,cAAc,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,EAAE,CAAC;QACzD,OAAO;YACH,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;YAC3C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
|
|
@@ -8,10 +8,9 @@ import { writeContract } from "../../actions/account-client/writeContract.js";
|
|
|
8
8
|
import { changeSudoValidator, signUserOperation, uninstallPlugin } from "../../actions/index.js";
|
|
9
9
|
import { estimateGasInERC20 } from "../../actions/paymaster/estimateGasInERC20.js";
|
|
10
10
|
import { sponsorUserOperation } from "../../actions/paymaster/sponsorUserOperation.js";
|
|
11
|
-
export const zerodevPaymasterActions = (
|
|
11
|
+
export const zerodevPaymasterActions = () => (client) => ({
|
|
12
12
|
sponsorUserOperation: async (args) => sponsorUserOperation(client, {
|
|
13
|
-
...args
|
|
14
|
-
entryPoint
|
|
13
|
+
...args
|
|
15
14
|
}),
|
|
16
15
|
estimateGasInERC20: async (args) => estimateGasInERC20(client, args)
|
|
17
16
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../../clients/decorators/kernel.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,6BAA6B,EAAE,MAAM,+DAA+D,CAAA;AAC7G,OAAO,EAEH,wBAAwB,EAC3B,MAAM,0DAA0D,CAAA;AACjE,OAAO,EAEH,eAAe,EAClB,MAAM,iDAAiD,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAA;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAA;AAM7E,OAAO,EACH,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EAClB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAGH,kBAAkB,EACrB,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAGH,oBAAoB,EACvB,MAAM,iDAAiD,CAAA;
|
|
1
|
+
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../../clients/decorators/kernel.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,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AC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC;QACtE,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC;QAC9D,6BAA6B,EAAE,KAAK,IAAI,EAAE,CACtC,6BAA6B,CAAC,MAAM,CAAC;QACzC,4DAA4D;QAC5D,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,IAAW,CAAC;QAC/D,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC;QAChD,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC;QACpD,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC;KACvD,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createClient } from "viem";
|
|
2
|
-
import {
|
|
2
|
+
import { paymasterActions } from "viem/account-abstraction";
|
|
3
3
|
import { zerodevPaymasterActions } from "./decorators/kernel.js";
|
|
4
4
|
/**
|
|
5
5
|
* Creates a ZeroDev-specific Paymaster Client with a given [Transport](https://viem.sh/docs/clients/intro.html) configured for a [Chain](https://viem.sh/docs/clients/chains.html).
|
|
@@ -19,7 +19,7 @@ import { zerodevPaymasterActions } from "./decorators/kernel.js";
|
|
|
19
19
|
* })
|
|
20
20
|
*/
|
|
21
21
|
export const createZeroDevPaymasterClient = (parameters) => {
|
|
22
|
-
const { key = "public", name = "ZeroDev Paymaster Client",
|
|
22
|
+
const { key = "public", name = "ZeroDev Paymaster Client", transport } = parameters;
|
|
23
23
|
const client = createClient({
|
|
24
24
|
...parameters,
|
|
25
25
|
transport: (opts) => {
|
|
@@ -32,9 +32,6 @@ export const createZeroDevPaymasterClient = (parameters) => {
|
|
|
32
32
|
name,
|
|
33
33
|
type: "zerodevPaymasterClient"
|
|
34
34
|
});
|
|
35
|
-
return client.extend(paymasterActions).extend(zerodevPaymasterActions(
|
|
36
|
-
address: entryPoint?.address ?? entryPoint07Address,
|
|
37
|
-
version: entryPoint?.version ?? "0.7"
|
|
38
|
-
}));
|
|
35
|
+
return client.extend(paymasterActions).extend(zerodevPaymasterActions());
|
|
39
36
|
};
|
|
40
37
|
//# sourceMappingURL=paymasterClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paymasterClient.js","sourceRoot":"","sources":["../../clients/paymasterClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAQH,YAAY,EACf,MAAM,MAAM,CAAA;AACb,OAAO,EAGH,
|
|
1
|
+
{"version":3,"file":"paymasterClient.js","sourceRoot":"","sources":["../../clients/paymasterClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAQH,YAAY,EACf,MAAM,MAAM,CAAA;AACb,OAAO,EAGH,gBAAgB,EACnB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAEH,uBAAuB,EAC1B,MAAM,wBAAwB,CAAA;AA4C/B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CACxC,UAAwC,EAClB,EAAE;IACxB,MAAM,EACF,GAAG,GAAG,QAAQ,EACd,IAAI,GAAG,0BAA0B,EACjC,SAAS,EACZ,GAAG,UAAU,CAAA;IACd,MAAM,MAAM,GAAG,YAAY,CAAC;QACxB,GAAG,UAAU;QACb,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE;YAChB,OAAO,SAAS,CAAC;gBACb,GAAG,IAAI;gBACP,UAAU,EAAE,CAAC;aAChB,CAAC,CAAA;QACN,CAAC;QACD,GAAG;QACH,IAAI;QACJ,IAAI,EAAE,wBAAwB;KACjC,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,uBAAuB,EAAE,CAAC,CAAA;AAC5E,CAAC,CAAA"}
|
|
@@ -291,6 +291,8 @@ export declare const estimateGasInERC20: <entryPointVersion extends EntryPointVe
|
|
|
291
291
|
uid: string;
|
|
292
292
|
getPaymasterData: (parameters: import("viem/account-abstraction").GetPaymasterDataParameters) => Promise<import("viem/account-abstraction").GetPaymasterDataReturnType>;
|
|
293
293
|
getPaymasterStubData: (parameters: import("viem/account-abstraction").GetPaymasterStubDataParameters) => Promise<import("viem/account-abstraction").GetPaymasterStubDataReturnType>;
|
|
294
|
+
sponsorUserOperation: (args: import("./sponsorUserOperation.js").SponsorUserOperationParameters) => Promise<import("./sponsorUserOperation.js").SponsorUserOperationReturnType>;
|
|
295
|
+
estimateGasInERC20: (args: EstimateGasInERC20Parameters) => Promise<EstimateGasInERC20ReturnType>;
|
|
294
296
|
extend: <const client extends {
|
|
295
297
|
[x: string]: unknown;
|
|
296
298
|
account?: undefined;
|
|
@@ -1064,7 +1066,7 @@ export declare const estimateGasInERC20: <entryPointVersion extends EntryPointVe
|
|
|
1064
1066
|
} | undefined) => Promise<bigint>;
|
|
1065
1067
|
isDeployed: () => Promise<boolean>;
|
|
1066
1068
|
type: "smart";
|
|
1067
|
-
}) | undefined, import("../../index.js").ZeroDevPaymasterRpcSchema<entryPointVersion>, import("viem/account-abstraction").PaymasterActions>) => client) => import("viem").Client<import("viem").Transport, import("viem").Chain | undefined, (object & {
|
|
1069
|
+
}) | undefined, import("../../index.js").ZeroDevPaymasterRpcSchema<entryPointVersion>, import("viem/account-abstraction").PaymasterActions & import("../../index.js").ZeroDevPaymasterClientActions>) => client) => import("viem").Client<import("viem").Transport, import("viem").Chain | undefined, (object & {
|
|
1068
1070
|
client: import("viem").Client;
|
|
1069
1071
|
entryPoint: {
|
|
1070
1072
|
abi: import("viem").Abi;
|
|
@@ -1317,6 +1319,6 @@ export declare const estimateGasInERC20: <entryPointVersion extends EntryPointVe
|
|
|
1317
1319
|
} | undefined) => Promise<bigint>;
|
|
1318
1320
|
isDeployed: () => Promise<boolean>;
|
|
1319
1321
|
type: "smart";
|
|
1320
|
-
}) | undefined, import("../../index.js").ZeroDevPaymasterRpcSchema<entryPointVersion>, { [K in keyof client]: client[K]; } & import("viem/account-abstraction").PaymasterActions>;
|
|
1322
|
+
}) | undefined, import("../../index.js").ZeroDevPaymasterRpcSchema<entryPointVersion>, { [K in keyof client]: client[K]; } & import("viem/account-abstraction").PaymasterActions & import("../../index.js").ZeroDevPaymasterClientActions>;
|
|
1321
1323
|
}, args: EstimateGasInERC20Parameters) => Promise<EstimateGasInERC20ReturnType>;
|
|
1322
1324
|
//# sourceMappingURL=estimateGasInERC20.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateGasInERC20.d.ts","sourceRoot":"","sources":["../../../actions/paymaster/estimateGasInERC20.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAErB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AAG9E,MAAM,MAAM,4BAA4B,GAAG;IACvC,aAAa,EAAE,aAAa,CAAA;IAC5B,eAAe,EAAE,GAAG,CAAA;IACpB,UAAU,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IACxC,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACvC,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;GAEG;AAEH,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"estimateGasInERC20.d.ts","sourceRoot":"","sources":["../../../actions/paymaster/estimateGasInERC20.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAIrB,4BAA4B,KACnC,QAAQ,4BAA4B,CAyBtC,CAAA"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
3
|
-
import type { EntryPointVersion, UserOperation } from "viem/account-abstraction";
|
|
1
|
+
import { type Hex, type Prettify } from "viem";
|
|
2
|
+
import { type EntryPointVersion, type GetPaymasterDataParameters, type GetPaymasterStubDataReturnType } from "viem/account-abstraction";
|
|
4
3
|
import type { ZeroDevPaymasterClient } from "../../clients/paymasterClient.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
userOperation: entryPointVersion extends "0.6" ? PartialBy<UserOperation<"0.6">, "callGasLimit" | "preVerificationGas" | "verificationGasLimit"> : PartialBy<UserOperation<"0.7">, "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "paymasterVerificationGasLimit" | "paymasterPostOpGasLimit">;
|
|
8
|
-
entryPoint: EntryPointType<entryPointVersion>;
|
|
4
|
+
export type SponsorUserOperationParameters = {
|
|
5
|
+
userOperation: GetPaymasterDataParameters;
|
|
9
6
|
gasToken?: Hex;
|
|
10
7
|
shouldOverrideFee?: boolean;
|
|
11
8
|
shouldConsume?: boolean;
|
|
12
9
|
};
|
|
13
|
-
export type SponsorUserOperationReturnType
|
|
10
|
+
export type SponsorUserOperationReturnType = Prettify<GetPaymasterStubDataReturnType & {
|
|
11
|
+
maxFeePerGas?: bigint | undefined;
|
|
12
|
+
maxPriorityFeePerGas?: bigint | undefined;
|
|
13
|
+
callGasLimit?: bigint | undefined;
|
|
14
|
+
verificationGasLimit?: bigint | undefined;
|
|
15
|
+
preVerificationGas?: bigint | undefined;
|
|
16
|
+
}>;
|
|
14
17
|
/**
|
|
15
18
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
16
19
|
*/
|
|
@@ -255,7 +258,7 @@ export declare const sponsorUserOperation: <entryPointVersion extends EntryPoint
|
|
|
255
258
|
uint248?: undefined;
|
|
256
259
|
uint256?: undefined;
|
|
257
260
|
} | Record<string, unknown>, primaryType extends "EIP712Domain" | keyof typedData = keyof typedData>(parameters: import("viem").TypedDataDefinition<typedData, primaryType>) => Promise<`0x${string}`>;
|
|
258
|
-
signUserOperation: (parameters: import("viem").UnionPartialBy<UserOperation, "sender"> & {
|
|
261
|
+
signUserOperation: (parameters: import("viem").UnionPartialBy<import("viem/account-abstraction").UserOperation, "sender"> & {
|
|
259
262
|
chainId?: number | undefined;
|
|
260
263
|
}) => Promise<`0x${string}`>;
|
|
261
264
|
userOperation?: {
|
|
@@ -283,12 +286,14 @@ export declare const sponsorUserOperation: <entryPointVersion extends EntryPoint
|
|
|
283
286
|
key: string;
|
|
284
287
|
name: string;
|
|
285
288
|
pollingInterval: number;
|
|
286
|
-
request: import("viem").EIP1193RequestFn<import("../../
|
|
289
|
+
request: import("viem").EIP1193RequestFn<import("../../index.js").ZeroDevPaymasterRpcSchema<entryPointVersion>>;
|
|
287
290
|
transport: import("viem").TransportConfig<string, import("viem").EIP1193RequestFn> & Record<string, any>;
|
|
288
291
|
type: string;
|
|
289
292
|
uid: string;
|
|
290
|
-
getPaymasterData: (parameters:
|
|
291
|
-
getPaymasterStubData: (parameters: import("viem/account-abstraction").GetPaymasterStubDataParameters) => Promise<
|
|
293
|
+
getPaymasterData: (parameters: GetPaymasterDataParameters) => Promise<import("viem/account-abstraction").GetPaymasterDataReturnType>;
|
|
294
|
+
getPaymasterStubData: (parameters: import("viem/account-abstraction").GetPaymasterStubDataParameters) => Promise<GetPaymasterStubDataReturnType>;
|
|
295
|
+
sponsorUserOperation: (args: SponsorUserOperationParameters) => Promise<SponsorUserOperationReturnType>;
|
|
296
|
+
estimateGasInERC20: (args: import("./estimateGasInERC20.js").EstimateGasInERC20Parameters) => Promise<import("./estimateGasInERC20.js").EstimateGasInERC20ReturnType>;
|
|
292
297
|
extend: <const client extends {
|
|
293
298
|
[x: string]: unknown;
|
|
294
299
|
account?: undefined;
|
|
@@ -543,7 +548,7 @@ export declare const sponsorUserOperation: <entryPointVersion extends EntryPoint
|
|
|
543
548
|
uint248?: undefined;
|
|
544
549
|
uint256?: undefined;
|
|
545
550
|
} | Record<string, unknown>, primaryType extends "EIP712Domain" | keyof typedData = keyof typedData>(parameters: import("viem").TypedDataDefinition<typedData, primaryType>) => Promise<`0x${string}`>;
|
|
546
|
-
signUserOperation: (parameters: import("viem").UnionPartialBy<UserOperation, "sender"> & {
|
|
551
|
+
signUserOperation: (parameters: import("viem").UnionPartialBy<import("viem/account-abstraction").UserOperation, "sender"> & {
|
|
547
552
|
chainId?: number | undefined;
|
|
548
553
|
}) => Promise<`0x${string}`>;
|
|
549
554
|
userOperation?: {
|
|
@@ -796,7 +801,7 @@ export declare const sponsorUserOperation: <entryPointVersion extends EntryPoint
|
|
|
796
801
|
uint248?: undefined;
|
|
797
802
|
uint256?: undefined;
|
|
798
803
|
} | Record<string, unknown>, primaryType extends "EIP712Domain" | keyof typedData = keyof typedData>(parameters: import("viem").TypedDataDefinition<typedData, primaryType>) => Promise<`0x${string}`>;
|
|
799
|
-
signUserOperation: (parameters: import("viem").UnionPartialBy<UserOperation, "sender"> & {
|
|
804
|
+
signUserOperation: (parameters: import("viem").UnionPartialBy<import("viem/account-abstraction").UserOperation, "sender"> & {
|
|
800
805
|
chainId?: number | undefined;
|
|
801
806
|
}) => Promise<`0x${string}`>;
|
|
802
807
|
userOperation?: {
|
|
@@ -1049,7 +1054,7 @@ export declare const sponsorUserOperation: <entryPointVersion extends EntryPoint
|
|
|
1049
1054
|
uint248?: undefined;
|
|
1050
1055
|
uint256?: undefined;
|
|
1051
1056
|
} | Record<string, unknown>, primaryType extends "EIP712Domain" | keyof typedData = keyof typedData>(parameters: import("viem").TypedDataDefinition<typedData, primaryType>) => Promise<`0x${string}`>;
|
|
1052
|
-
signUserOperation: (parameters: import("viem").UnionPartialBy<UserOperation, "sender"> & {
|
|
1057
|
+
signUserOperation: (parameters: import("viem").UnionPartialBy<import("viem/account-abstraction").UserOperation, "sender"> & {
|
|
1053
1058
|
chainId?: number | undefined;
|
|
1054
1059
|
}) => Promise<`0x${string}`>;
|
|
1055
1060
|
userOperation?: {
|
|
@@ -1062,7 +1067,7 @@ export declare const sponsorUserOperation: <entryPointVersion extends EntryPoint
|
|
|
1062
1067
|
} | undefined) => Promise<bigint>;
|
|
1063
1068
|
isDeployed: () => Promise<boolean>;
|
|
1064
1069
|
type: "smart";
|
|
1065
|
-
}) | undefined, import("../../
|
|
1070
|
+
}) | undefined, import("../../index.js").ZeroDevPaymasterRpcSchema<entryPointVersion>, import("viem/account-abstraction").PaymasterActions & import("../../index.js").ZeroDevPaymasterClientActions>) => client) => import("viem").Client<import("viem").Transport, import("viem").Chain | undefined, (object & {
|
|
1066
1071
|
client: import("viem").Client;
|
|
1067
1072
|
entryPoint: {
|
|
1068
1073
|
abi: import("viem").Abi;
|
|
@@ -1302,7 +1307,7 @@ export declare const sponsorUserOperation: <entryPointVersion extends EntryPoint
|
|
|
1302
1307
|
uint248?: undefined;
|
|
1303
1308
|
uint256?: undefined;
|
|
1304
1309
|
} | Record<string, unknown>, primaryType extends "EIP712Domain" | keyof typedData = keyof typedData>(parameters: import("viem").TypedDataDefinition<typedData, primaryType>) => Promise<`0x${string}`>;
|
|
1305
|
-
signUserOperation: (parameters: import("viem").UnionPartialBy<UserOperation, "sender"> & {
|
|
1310
|
+
signUserOperation: (parameters: import("viem").UnionPartialBy<import("viem/account-abstraction").UserOperation, "sender"> & {
|
|
1306
1311
|
chainId?: number | undefined;
|
|
1307
1312
|
}) => Promise<`0x${string}`>;
|
|
1308
1313
|
userOperation?: {
|
|
@@ -1315,6 +1320,6 @@ export declare const sponsorUserOperation: <entryPointVersion extends EntryPoint
|
|
|
1315
1320
|
} | undefined) => Promise<bigint>;
|
|
1316
1321
|
isDeployed: () => Promise<boolean>;
|
|
1317
1322
|
type: "smart";
|
|
1318
|
-
}) | undefined, import("../../
|
|
1319
|
-
}, args: SponsorUserOperationParameters
|
|
1323
|
+
}) | undefined, import("../../index.js").ZeroDevPaymasterRpcSchema<entryPointVersion>, { [K in keyof client]: client[K]; } & import("viem/account-abstraction").PaymasterActions & import("../../index.js").ZeroDevPaymasterClientActions>;
|
|
1324
|
+
}, args: SponsorUserOperationParameters) => Promise<SponsorUserOperationReturnType>;
|
|
1320
1325
|
//# sourceMappingURL=sponsorUserOperation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sponsorUserOperation.d.ts","sourceRoot":"","sources":["../../../actions/paymaster/sponsorUserOperation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"sponsorUserOperation.d.ts","sourceRoot":"","sources":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@ -10,15 +10,14 @@ import type { ChangeSudoValidatorParameters, SignUserOperationReturnType, Uninst
|
|
|
10
10
|
import { signUserOperation } from "../../actions/index.js";
|
|
11
11
|
import { type EstimateGasInERC20Parameters, type EstimateGasInERC20ReturnType } from "../../actions/paymaster/estimateGasInERC20.js";
|
|
12
12
|
import { type SponsorUserOperationParameters, type SponsorUserOperationReturnType } from "../../actions/paymaster/sponsorUserOperation.js";
|
|
13
|
-
|
|
14
|
-
export type ZeroDevPaymasterClientActions<entryPointVersion extends EntryPointVersion> = {
|
|
13
|
+
export type ZeroDevPaymasterClientActions = {
|
|
15
14
|
/**
|
|
16
15
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
17
16
|
*/
|
|
18
|
-
sponsorUserOperation: (args: SponsorUserOperationParameters
|
|
17
|
+
sponsorUserOperation: (args: SponsorUserOperationParameters) => Promise<SponsorUserOperationReturnType>;
|
|
19
18
|
estimateGasInERC20: (args: EstimateGasInERC20Parameters) => Promise<EstimateGasInERC20ReturnType>;
|
|
20
19
|
};
|
|
21
|
-
export declare const zerodevPaymasterActions: <entryPointVersion extends EntryPointVersion>(
|
|
20
|
+
export declare const zerodevPaymasterActions: <entryPointVersion extends EntryPointVersion>() => (client: Client) => ZeroDevPaymasterClientActions;
|
|
22
21
|
export type KernelAccountClientActions<TChain extends Chain | undefined = Chain | undefined, TSmartAccount extends SmartAccount | undefined = SmartAccount | undefined> = {
|
|
23
22
|
/**
|
|
24
23
|
* Signs a user operation with the given transport, chain, and smart account.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../../clients/decorators/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,GAAG,EACH,KAAK,EACL,MAAM,EACN,oBAAoB,EACpB,oBAAoB,EACpB,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,SAAS,EACT,uBAAuB,EAC1B,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,E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,UAAU,CACX,OAAO,aAAa,CAChB,MAAM,EACN,aAAa,EACb,IAAI,EACJ,aAAa,EACb,KAAK,EACL,cAAc,CACjB,CACJ,CAAA;CACJ,CAAA;AAED,wBAAgB,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uHAsBzC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { type Chain, type Client, type ClientConfig, type Prettify, type RpcSchema, type Transport } from "viem";
|
|
2
2
|
import { type PaymasterActions, type SmartAccount } from "viem/account-abstraction";
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
export type
|
|
6
|
-
|
|
7
|
-
};
|
|
3
|
+
import type { ZeroDevPaymasterRpcSchema } from "../types/kernel.js";
|
|
4
|
+
import { type ZeroDevPaymasterClientActions } from "./decorators/kernel.js";
|
|
5
|
+
export type ZeroDevPaymasterClient<entryPointVersion extends "0.6" | "0.7" = "0.7", transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends SmartAccount | undefined = SmartAccount | undefined, client extends Client | undefined = Client | undefined, rpcSchema extends RpcSchema | undefined = undefined> = Prettify<Client<transport, chain extends Chain ? chain : client extends Client<any, infer chain> ? chain : undefined, account, rpcSchema extends RpcSchema ? [...ZeroDevPaymasterRpcSchema<entryPointVersion>, ...rpcSchema] : ZeroDevPaymasterRpcSchema<entryPointVersion>, PaymasterActions & ZeroDevPaymasterClientActions>>;
|
|
6
|
+
export type ZeroDevPaymasterClientConfig<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends SmartAccount | undefined = SmartAccount | undefined, rpcSchema extends RpcSchema | undefined = undefined> = Prettify<Pick<ClientConfig<transport, chain, account, rpcSchema>, "account" | "cacheTime" | "chain" | "key" | "name" | "pollingInterval" | "rpcSchema" | "transport">>;
|
|
8
7
|
/**
|
|
9
8
|
* Creates a ZeroDev-specific Paymaster Client with a given [Transport](https://viem.sh/docs/clients/intro.html) configured for a [Chain](https://viem.sh/docs/clients/chains.html).
|
|
10
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paymasterClient.d.ts","sourceRoot":"","sources":["../../clients/paymasterClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,QAAQ,EAEb,KAAK,SAAS,EACd,KAAK,SAAS,EAEjB,MAAM,MAAM,CAAA;AACb,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"paymasterClient.d.ts","sourceRoot":"","sources":["../../clients/paymasterClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,QAAQ,EAEb,KAAK,SAAS,EACd,KAAK,SAAS,EAEjB,MAAM,MAAM,CAAA;AACb,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAEpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oB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BAA4B,eACzB,4BAA4B,KACzC,sBAmBF,CAAA"}
|
package/_types/utils.d.ts
CHANGED
|
@@ -285,6 +285,8 @@ export declare const getERC20PaymasterApproveCall: <entryPointVersion extends En
|
|
|
285
285
|
uid: string;
|
|
286
286
|
getPaymasterData: (parameters: import("viem/account-abstraction").GetPaymasterDataParameters) => Promise<import("viem/account-abstraction").GetPaymasterDataReturnType>;
|
|
287
287
|
getPaymasterStubData: (parameters: import("viem/account-abstraction").GetPaymasterStubDataParameters) => Promise<import("viem/account-abstraction").GetPaymasterStubDataReturnType>;
|
|
288
|
+
sponsorUserOperation: (args: import("./index.js").SponsorUserOperationParameters) => Promise<import("./index.js").SponsorUserOperationReturnType>;
|
|
289
|
+
estimateGasInERC20: (args: import("./actions/index.js").EstimateGasInERC20Parameters) => Promise<import("./actions/index.js").EstimateGasInERC20ReturnType>;
|
|
288
290
|
extend: <const client extends {
|
|
289
291
|
[x: string]: unknown;
|
|
290
292
|
account?: undefined;
|
|
@@ -1058,7 +1060,7 @@ export declare const getERC20PaymasterApproveCall: <entryPointVersion extends En
|
|
|
1058
1060
|
} | undefined) => Promise<bigint>;
|
|
1059
1061
|
isDeployed: () => Promise<boolean>;
|
|
1060
1062
|
type: "smart";
|
|
1061
|
-
}) | undefined, import("./types/kernel.js").ZeroDevPaymasterRpcSchema<entryPointVersion>, import("viem/account-abstraction").PaymasterActions>) => client) => import("viem").Client<import("viem").Transport, import("viem").Chain | undefined, (object & {
|
|
1063
|
+
}) | undefined, import("./types/kernel.js").ZeroDevPaymasterRpcSchema<entryPointVersion>, import("viem/account-abstraction").PaymasterActions & import("./index.js").ZeroDevPaymasterClientActions>) => client) => import("viem").Client<import("viem").Transport, import("viem").Chain | undefined, (object & {
|
|
1062
1064
|
client: import("viem").Client;
|
|
1063
1065
|
entryPoint: {
|
|
1064
1066
|
abi: import("viem").Abi;
|
|
@@ -1311,7 +1313,7 @@ export declare const getERC20PaymasterApproveCall: <entryPointVersion extends En
|
|
|
1311
1313
|
} | undefined) => Promise<bigint>;
|
|
1312
1314
|
isDeployed: () => Promise<boolean>;
|
|
1313
1315
|
type: "smart";
|
|
1314
|
-
}) | undefined, import("./types/kernel.js").ZeroDevPaymasterRpcSchema<entryPointVersion>, { [K in keyof client]: client[K]; } & import("viem/account-abstraction").PaymasterActions>;
|
|
1316
|
+
}) | undefined, import("./types/kernel.js").ZeroDevPaymasterRpcSchema<entryPointVersion>, { [K in keyof client]: client[K]; } & import("viem/account-abstraction").PaymasterActions & import("./index.js").ZeroDevPaymasterClientActions>;
|
|
1315
1317
|
}, { gasToken, approveAmount, entryPoint }: {
|
|
1316
1318
|
gasToken: Address;
|
|
1317
1319
|
approveAmount: bigint;
|
package/_types/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,GAAG,EASX,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzE,oBAAY,eAAe;IACvB,mBAAmB,wBAAwB;IAC3C,sBAAsB,2BAA2B;IACjD,qCAAqC,0CAA0C;CAClF;AAED,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAItE,CAAA;AAED,eAAO,MAAM,gBAAgB,YAChB,eAAe,WACf,MAAM,KAChB,OAMF,CAAA;AAED,eAAO,MAAM,4BAA4B
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KA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AAED,eAAO,MAAM,cAAc,YAAa,MAAM,SAAS,MAAM,KAAG,OAE/D,CAAA;AAGD,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CA0BzC"}
|
|
@@ -1,60 +1,29 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { type Address, type Hex, type Prettify, isAddressEqual } from "viem"
|
|
2
|
+
import {
|
|
3
|
+
type EntryPointVersion,
|
|
4
|
+
type GetPaymasterDataParameters,
|
|
5
|
+
type GetPaymasterStubDataReturnType,
|
|
6
|
+
entryPoint06Address
|
|
7
|
+
} from "viem/account-abstraction"
|
|
4
8
|
import type { ZeroDevPaymasterClient } from "../../clients/paymasterClient.js"
|
|
5
|
-
import type { EntryPointType, PartialPick } from "../../types/index.js"
|
|
6
9
|
import { deepHexlify } from "../../utils.js"
|
|
7
10
|
|
|
8
|
-
export type SponsorUserOperationParameters
|
|
9
|
-
|
|
10
|
-
> = {
|
|
11
|
-
userOperation: entryPointVersion extends "0.6"
|
|
12
|
-
? PartialBy<
|
|
13
|
-
UserOperation<"0.6">,
|
|
14
|
-
"callGasLimit" | "preVerificationGas" | "verificationGasLimit"
|
|
15
|
-
>
|
|
16
|
-
: PartialBy<
|
|
17
|
-
UserOperation<"0.7">,
|
|
18
|
-
| "callGasLimit"
|
|
19
|
-
| "preVerificationGas"
|
|
20
|
-
| "verificationGasLimit"
|
|
21
|
-
| "paymasterVerificationGasLimit"
|
|
22
|
-
| "paymasterPostOpGasLimit"
|
|
23
|
-
>
|
|
24
|
-
entryPoint: EntryPointType<entryPointVersion>
|
|
11
|
+
export type SponsorUserOperationParameters = {
|
|
12
|
+
userOperation: GetPaymasterDataParameters
|
|
25
13
|
gasToken?: Hex
|
|
26
14
|
shouldOverrideFee?: boolean
|
|
27
15
|
shouldConsume?: boolean
|
|
28
16
|
}
|
|
29
17
|
|
|
30
|
-
export type SponsorUserOperationReturnType<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
> &
|
|
40
|
-
PartialPick<
|
|
41
|
-
UserOperation<"0.6">,
|
|
42
|
-
"maxFeePerGas" | "maxPriorityFeePerGas"
|
|
43
|
-
>
|
|
44
|
-
: Pick<
|
|
45
|
-
UserOperation<"0.7">,
|
|
46
|
-
| "callGasLimit"
|
|
47
|
-
| "verificationGasLimit"
|
|
48
|
-
| "preVerificationGas"
|
|
49
|
-
| "paymaster"
|
|
50
|
-
| "paymasterVerificationGasLimit"
|
|
51
|
-
| "paymasterPostOpGasLimit"
|
|
52
|
-
| "paymasterData"
|
|
53
|
-
> &
|
|
54
|
-
PartialPick<
|
|
55
|
-
UserOperation<"0.7">,
|
|
56
|
-
"maxFeePerGas" | "maxPriorityFeePerGas"
|
|
57
|
-
>
|
|
18
|
+
export type SponsorUserOperationReturnType = Prettify<
|
|
19
|
+
GetPaymasterStubDataReturnType & {
|
|
20
|
+
maxFeePerGas?: bigint | undefined
|
|
21
|
+
maxPriorityFeePerGas?: bigint | undefined
|
|
22
|
+
callGasLimit?: bigint | undefined
|
|
23
|
+
verificationGasLimit?: bigint | undefined
|
|
24
|
+
preVerificationGas?: bigint | undefined
|
|
25
|
+
}
|
|
26
|
+
>
|
|
58
27
|
|
|
59
28
|
/**
|
|
60
29
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
@@ -63,15 +32,27 @@ export const sponsorUserOperation = async <
|
|
|
63
32
|
entryPointVersion extends EntryPointVersion
|
|
64
33
|
>(
|
|
65
34
|
client: ZeroDevPaymasterClient<entryPointVersion>,
|
|
66
|
-
args: SponsorUserOperationParameters
|
|
67
|
-
): Promise<SponsorUserOperationReturnType
|
|
35
|
+
args: SponsorUserOperationParameters
|
|
36
|
+
): Promise<SponsorUserOperationReturnType> => {
|
|
37
|
+
const {
|
|
38
|
+
userOperation: {
|
|
39
|
+
chainId,
|
|
40
|
+
entryPointAddress,
|
|
41
|
+
context,
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
calls,
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
account,
|
|
46
|
+
..._userOperation
|
|
47
|
+
}
|
|
48
|
+
} = args
|
|
68
49
|
const response = await client.request({
|
|
69
50
|
method: "zd_sponsorUserOperation",
|
|
70
51
|
params: [
|
|
71
52
|
{
|
|
72
53
|
chainId: client.chain?.id as number,
|
|
73
|
-
userOp: deepHexlify(
|
|
74
|
-
entryPointAddress:
|
|
54
|
+
userOp: deepHexlify(_userOperation),
|
|
55
|
+
entryPointAddress: entryPointAddress,
|
|
75
56
|
gasTokenData: args.gasToken && {
|
|
76
57
|
tokenAddress: args.gasToken
|
|
77
58
|
},
|
|
@@ -80,18 +61,19 @@ export const sponsorUserOperation = async <
|
|
|
80
61
|
}
|
|
81
62
|
]
|
|
82
63
|
})
|
|
83
|
-
if (
|
|
64
|
+
if (isAddressEqual(entryPointAddress, entryPoint06Address)) {
|
|
84
65
|
return {
|
|
85
66
|
paymasterAndData: response.paymasterAndData,
|
|
86
67
|
preVerificationGas: BigInt(response.preVerificationGas),
|
|
87
68
|
verificationGasLimit: BigInt(response.verificationGasLimit),
|
|
88
69
|
callGasLimit: BigInt(response.callGasLimit),
|
|
89
|
-
maxFeePerGas:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
BigInt(response.maxPriorityFeePerGas)
|
|
94
|
-
|
|
70
|
+
maxFeePerGas: response.maxFeePerGas
|
|
71
|
+
? BigInt(response.maxFeePerGas)
|
|
72
|
+
: args.userOperation.maxFeePerGas,
|
|
73
|
+
maxPriorityFeePerGas: response.maxPriorityFeePerGas
|
|
74
|
+
? BigInt(response.maxPriorityFeePerGas)
|
|
75
|
+
: args.userOperation.maxPriorityFeePerGas
|
|
76
|
+
} as SponsorUserOperationReturnType
|
|
95
77
|
}
|
|
96
78
|
const responseV07 = response as {
|
|
97
79
|
preVerificationGas: Hex
|
|
@@ -116,9 +98,11 @@ export const sponsorUserOperation = async <
|
|
|
116
98
|
),
|
|
117
99
|
paymasterPostOpGasLimit: BigInt(responseV07.paymasterPostOpGasLimit),
|
|
118
100
|
paymasterData: responseV07.paymasterData,
|
|
119
|
-
maxFeePerGas: response.maxFeePerGas
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
101
|
+
maxFeePerGas: response.maxFeePerGas
|
|
102
|
+
? BigInt(response.maxFeePerGas)
|
|
103
|
+
: args.userOperation.maxFeePerGas,
|
|
104
|
+
maxPriorityFeePerGas: response.maxPriorityFeePerGas
|
|
105
|
+
? BigInt(response.maxPriorityFeePerGas)
|
|
106
|
+
: args.userOperation.maxPriorityFeePerGas
|
|
107
|
+
} as SponsorUserOperationReturnType
|
|
124
108
|
}
|
|
@@ -44,39 +44,28 @@ import {
|
|
|
44
44
|
type SponsorUserOperationReturnType,
|
|
45
45
|
sponsorUserOperation
|
|
46
46
|
} from "../../actions/paymaster/sponsorUserOperation.js"
|
|
47
|
-
import type { EntryPointType } from "../../types/kernel.js"
|
|
48
47
|
import type { ZeroDevPaymasterClient } from "../paymasterClient.js"
|
|
49
48
|
|
|
50
|
-
export type ZeroDevPaymasterClientActions
|
|
51
|
-
entryPointVersion extends EntryPointVersion
|
|
52
|
-
> = {
|
|
49
|
+
export type ZeroDevPaymasterClientActions = {
|
|
53
50
|
/**
|
|
54
51
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
55
52
|
*/
|
|
56
53
|
sponsorUserOperation: (
|
|
57
|
-
args: SponsorUserOperationParameters
|
|
58
|
-
) => Promise<SponsorUserOperationReturnType
|
|
54
|
+
args: SponsorUserOperationParameters
|
|
55
|
+
) => Promise<SponsorUserOperationReturnType>
|
|
59
56
|
estimateGasInERC20: (
|
|
60
57
|
args: EstimateGasInERC20Parameters
|
|
61
58
|
) => Promise<EstimateGasInERC20ReturnType>
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
export const zerodevPaymasterActions =
|
|
65
|
-
<entryPointVersion extends EntryPointVersion>(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
(client: Client): ZeroDevPaymasterClientActions<entryPointVersion> => ({
|
|
69
|
-
sponsorUserOperation: async (
|
|
70
|
-
args: Omit<
|
|
71
|
-
SponsorUserOperationParameters<entryPointVersion>,
|
|
72
|
-
"entryPoint"
|
|
73
|
-
>
|
|
74
|
-
) =>
|
|
62
|
+
<entryPointVersion extends EntryPointVersion>() =>
|
|
63
|
+
(client: Client): ZeroDevPaymasterClientActions => ({
|
|
64
|
+
sponsorUserOperation: async (args: SponsorUserOperationParameters) =>
|
|
75
65
|
sponsorUserOperation(
|
|
76
66
|
client as ZeroDevPaymasterClient<entryPointVersion>,
|
|
77
67
|
{
|
|
78
|
-
...args
|
|
79
|
-
entryPoint
|
|
68
|
+
...args
|
|
80
69
|
}
|
|
81
70
|
),
|
|
82
71
|
estimateGasInERC20: async (args: EstimateGasInERC20Parameters) =>
|
|
@@ -11,14 +11,13 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
type PaymasterActions,
|
|
13
13
|
type SmartAccount,
|
|
14
|
-
entryPoint07Address,
|
|
15
14
|
paymasterActions
|
|
16
15
|
} from "viem/account-abstraction"
|
|
17
|
-
import type {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
import type { ZeroDevPaymasterRpcSchema } from "../types/kernel.js"
|
|
17
|
+
import {
|
|
18
|
+
type ZeroDevPaymasterClientActions,
|
|
19
|
+
zerodevPaymasterActions
|
|
20
|
+
} from "./decorators/kernel.js"
|
|
22
21
|
|
|
23
22
|
export type ZeroDevPaymasterClient<
|
|
24
23
|
entryPointVersion extends "0.6" | "0.7" = "0.7",
|
|
@@ -40,12 +39,11 @@ export type ZeroDevPaymasterClient<
|
|
|
40
39
|
rpcSchema extends RpcSchema
|
|
41
40
|
? [...ZeroDevPaymasterRpcSchema<entryPointVersion>, ...rpcSchema]
|
|
42
41
|
: ZeroDevPaymasterRpcSchema<entryPointVersion>,
|
|
43
|
-
PaymasterActions
|
|
42
|
+
PaymasterActions & ZeroDevPaymasterClientActions
|
|
44
43
|
>
|
|
45
44
|
>
|
|
46
45
|
|
|
47
46
|
export type ZeroDevPaymasterClientConfig<
|
|
48
|
-
entryPointVersion extends "0.6" | "0.7" = "0.7" | "0.6",
|
|
49
47
|
transport extends Transport = Transport,
|
|
50
48
|
chain extends Chain | undefined = Chain | undefined,
|
|
51
49
|
account extends SmartAccount | undefined = SmartAccount | undefined,
|
|
@@ -62,9 +60,7 @@ export type ZeroDevPaymasterClientConfig<
|
|
|
62
60
|
| "rpcSchema"
|
|
63
61
|
| "transport"
|
|
64
62
|
>
|
|
65
|
-
>
|
|
66
|
-
entryPoint?: EntryPointType<entryPointVersion>
|
|
67
|
-
}
|
|
63
|
+
>
|
|
68
64
|
/**
|
|
69
65
|
* Creates a ZeroDev-specific Paymaster Client with a given [Transport](https://viem.sh/docs/clients/intro.html) configured for a [Chain](https://viem.sh/docs/clients/chains.html).
|
|
70
66
|
*
|
|
@@ -88,7 +84,6 @@ export const createZeroDevPaymasterClient = (
|
|
|
88
84
|
const {
|
|
89
85
|
key = "public",
|
|
90
86
|
name = "ZeroDev Paymaster Client",
|
|
91
|
-
entryPoint,
|
|
92
87
|
transport
|
|
93
88
|
} = parameters
|
|
94
89
|
const client = createClient({
|
|
@@ -103,10 +98,5 @@ export const createZeroDevPaymasterClient = (
|
|
|
103
98
|
name,
|
|
104
99
|
type: "zerodevPaymasterClient"
|
|
105
100
|
})
|
|
106
|
-
return client.extend(paymasterActions).extend(
|
|
107
|
-
zerodevPaymasterActions({
|
|
108
|
-
address: entryPoint?.address ?? entryPoint07Address,
|
|
109
|
-
version: entryPoint?.version ?? "0.7"
|
|
110
|
-
})
|
|
111
|
-
)
|
|
101
|
+
return client.extend(paymasterActions).extend(zerodevPaymasterActions())
|
|
112
102
|
}
|